1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <osl/thread.h>
21 #include <com/sun/star/awt/FontFamily.hpp>
22 #include <com/sun/star/awt/FontPitch.hpp>
23 #include <com/sun/star/drawing/FillStyle.hpp>
24 #include <com/sun/star/table/BorderLine2.hpp>
25 #include <com/sun/star/text/VertOrientation.hpp>
26 #include <com/sun/star/text/SizeType.hpp>
27 #include <xmloff/XMLFontStylesContext.hxx>
28 #include <xmloff/txtprmap.hxx>
29 #include <xmloff/xmlimp.hxx>
30 #include <xmloff/txtimppr.hxx>
31 #include <xmloff/maptype.hxx>
33 #define XML_LINE_LEFT 0
34 #define XML_LINE_RIGHT 1
35 #define XML_LINE_TOP 2
36 #define XML_LINE_BOTTOM 3
39 using namespace ::com::sun::star
;
40 using namespace ::com::sun::star::uno
;
41 using namespace ::com::sun::star::table
;
42 using namespace ::com::sun::star::text
;
44 bool XMLTextImportPropertyMapper::handleSpecialItem(
45 XMLPropertyState
& rProperty
,
46 ::std::vector
< XMLPropertyState
>& rProperties
,
47 const OUString
& rValue
,
48 const SvXMLUnitConverter
& rUnitConverter
,
49 const SvXMLNamespaceMap
& rNamespaceMap
) const
52 sal_Int32 nIndex
= rProperty
.mnIndex
;
53 switch( getPropertySetMapper()->GetEntryContextId( nIndex
) )
56 case CTF_FONTNAME_CJK
:
57 case CTF_FONTNAME_CTL
:
58 if( GetImport().GetFontDecls() != NULL
)
61 ( CTF_FONTFAMILYNAME
==
62 getPropertySetMapper()->GetEntryContextId(nIndex
+1) &&
64 getPropertySetMapper()->GetEntryContextId(nIndex
+2) &&
66 getPropertySetMapper()->GetEntryContextId(nIndex
+3) &&
68 getPropertySetMapper()->GetEntryContextId(nIndex
+4) &&
70 getPropertySetMapper()->GetEntryContextId(nIndex
+5) ) ||
71 ( CTF_FONTFAMILYNAME_CJK
==
72 getPropertySetMapper()->GetEntryContextId(nIndex
+1) &&
73 CTF_FONTSTYLENAME_CJK
==
74 getPropertySetMapper()->GetEntryContextId(nIndex
+2) &&
76 getPropertySetMapper()->GetEntryContextId(nIndex
+3) &&
78 getPropertySetMapper()->GetEntryContextId(nIndex
+4) &&
79 CTF_FONTCHARSET_CJK
==
80 getPropertySetMapper()->GetEntryContextId(nIndex
+5) ) ||
81 ( CTF_FONTFAMILYNAME_CTL
==
82 getPropertySetMapper()->GetEntryContextId(nIndex
+1) &&
83 CTF_FONTSTYLENAME_CTL
==
84 getPropertySetMapper()->GetEntryContextId(nIndex
+2) &&
86 getPropertySetMapper()->GetEntryContextId(nIndex
+3) &&
88 getPropertySetMapper()->GetEntryContextId(nIndex
+4) &&
89 CTF_FONTCHARSET_CTL
==
90 getPropertySetMapper()->GetEntryContextId(nIndex
+5) )
91 ) && "illegal property map" );
93 GetImport().GetFontDecls()->FillProperties(
95 rProperty
.mnIndex
+1, rProperty
.mnIndex
+2,
96 rProperty
.mnIndex
+3, rProperty
.mnIndex
+4,
97 rProperty
.mnIndex
+5 );
98 bRet
= false; // the property hasn't been filled
102 // If we want to do StarMath/StarSymbol font conversion, then we'll
103 // want these special items to be treated just like regular ones...
104 // For the Writer, we'll catch and convert them in _FillPropertySet;
105 // the other apps probably don't care. For the other apps, we just
106 // imitate the default non-special-item mechanism.
107 case CTF_FONTFAMILYNAME
:
108 case CTF_FONTFAMILYNAME_CJK
:
109 case CTF_FONTFAMILYNAME_CTL
:
110 bRet
= getPropertySetMapper()->importXML( rValue
, rProperty
,
114 case CTF_TEXT_DISPLAY
:
115 bRet
= getPropertySetMapper()->importXML( rValue
, rProperty
,
117 if( SvXMLImport::OOo_2x
== GetImport().getGeneratorVersion() )
119 bool bHidden
= false;
120 rProperty
.maValue
>>= bHidden
;
122 rProperty
.maValue
<<= bHidden
;
126 bRet
= SvXMLImportPropertyMapper::handleSpecialItem( rProperty
,
127 rProperties
, rValue
, rUnitConverter
, rNamespaceMap
);
134 XMLTextImportPropertyMapper::XMLTextImportPropertyMapper(
135 const rtl::Reference
< XMLPropertySetMapper
>& rMapper
,
136 SvXMLImport
& rImp
) :
137 SvXMLImportPropertyMapper( rMapper
, rImp
),
138 nSizeTypeIndex( -2 ),
139 nWidthTypeIndex( -2 )
143 XMLTextImportPropertyMapper::~XMLTextImportPropertyMapper()
147 void XMLTextImportPropertyMapper::FontFinished(
148 XMLPropertyState
*pFontFamilyNameState
,
149 XMLPropertyState
*pFontStyleNameState
,
150 XMLPropertyState
*pFontFamilyState
,
151 XMLPropertyState
*pFontPitchState
,
152 XMLPropertyState
*pFontCharsetState
)
154 if( pFontFamilyNameState
&& pFontFamilyNameState
->mnIndex
!= -1 )
157 pFontFamilyNameState
->maValue
>>= sName
;
158 if( sName
.isEmpty() )
159 pFontFamilyNameState
->mnIndex
= -1;
161 if( !pFontFamilyNameState
|| pFontFamilyNameState
->mnIndex
== -1 )
163 if( pFontStyleNameState
)
164 pFontStyleNameState
->mnIndex
= -1;
165 if( pFontFamilyState
)
166 pFontFamilyState
->mnIndex
= -1;
167 if( pFontPitchState
)
168 pFontPitchState
->mnIndex
= -1;
169 if( pFontCharsetState
)
170 pFontCharsetState
->mnIndex
= -1;
174 /** since the properties "CharFontFamilyName", "CharFontStyleName", "CharFontFamily",
175 "CharFontPitch" and "CharFontSet" and theire CJK and CTL counterparts are only
176 usable as a union, we add defaults to all values that are not set as long as we
177 have an "CharFontFamilyName"
180 void XMLTextImportPropertyMapper::FontDefaultsCheck(
181 XMLPropertyState
* pFontFamilyName
,
182 XMLPropertyState
* pFontStyleName
,
183 XMLPropertyState
* pFontFamily
,
184 XMLPropertyState
* pFontPitch
,
185 XMLPropertyState
* pFontCharSet
,
186 XMLPropertyState
** ppNewFontStyleName
,
187 XMLPropertyState
** ppNewFontFamily
,
188 XMLPropertyState
** ppNewFontPitch
,
189 XMLPropertyState
** ppNewFontCharSet
) const
191 if( pFontFamilyName
)
196 if( !pFontStyleName
)
199 #if OSL_DEBUG_LEVEL > 0
200 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
201 pFontFamilyName
->mnIndex
+ 1 );
202 assert(nTmp
== CTF_FONTSTYLENAME
|| nTmp
== CTF_FONTSTYLENAME_CJK
|| nTmp
== CTF_FONTSTYLENAME_CTL
);
204 *ppNewFontStyleName
= new XMLPropertyState( pFontFamilyName
->mnIndex
+ 1,
210 aAny
<<= (sal_Int16
)com::sun::star::awt::FontFamily::DONTKNOW
;
212 #if OSL_DEBUG_LEVEL > 0
213 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
214 pFontFamilyName
->mnIndex
+ 2 );
215 assert(nTmp
== CTF_FONTFAMILY
|| nTmp
== CTF_FONTFAMILY_CJK
|| nTmp
== CTF_FONTFAMILY_CTL
);
217 *ppNewFontFamily
= new XMLPropertyState( pFontFamilyName
->mnIndex
+ 2,
223 aAny
<<= (sal_Int16
)com::sun::star::awt::FontPitch::DONTKNOW
;
224 #if OSL_DEBUG_LEVEL > 0
225 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
226 pFontFamilyName
->mnIndex
+ 3 );
227 assert(nTmp
== CTF_FONTPITCH
|| nTmp
== CTF_FONTPITCH_CJK
|| nTmp
== CTF_FONTPITCH_CTL
);
229 *ppNewFontPitch
= new XMLPropertyState( pFontFamilyName
->mnIndex
+ 3,
235 aAny
<<= (sal_Int16
)osl_getThreadTextEncoding();
236 #if OSL_DEBUG_LEVEL > 0
237 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
238 pFontFamilyName
->mnIndex
+ 4 );
239 assert(nTmp
== CTF_FONTCHARSET
|| nTmp
== CTF_FONTCHARSET_CJK
|| nTmp
== CTF_FONTCHARSET_CTL
);
241 *ppNewFontCharSet
= new XMLPropertyState( pFontFamilyName
->mnIndex
+ 4,
248 //fdo#58730 The [UL|LR]Space class has a deficiency where "100%" also serves as
249 //a flag that the value is an absolute value so we can't truly handle an
250 //up/lower space property which wants to specify its 200% upper but 100% lower
251 //of its parent (try typing 100% vs 200% into the edit style dialog and revisit
252 //your style). So on xml load that ends up meaning 200%, 0 lower. This is a
255 //On import clear 100% all-margins relative sizes.
257 isNotDefaultRelSize(const XMLPropertyState
* pRelState
, const rtl::Reference
<XMLPropertySetMapper
>& rPrMap
)
259 if (rPrMap
->GetEntryContextId(pRelState
->mnIndex
) == CTF_PARAMARGINALL_REL
)
262 pRelState
->maValue
>>= nTemp
;
269 * Separate compressed border attributes.
270 * During export, border attributes are compressed if there are equal to all four side.
271 * Since Writer hasn't the same compressed attributes, but has distinct ones for all
272 * four side, we have to duplicate the compressed attribute during import.
274 static void lcl_SeparateBorder(
275 sal_uInt16 nIndex
, XMLPropertyState
* pAllBorderDistance
,
276 XMLPropertyState
* pBorderDistances
[4], XMLPropertyState
* pNewBorderDistances
[4],
277 XMLPropertyState
* pAllBorder
, XMLPropertyState
* pBorders
[4],
278 XMLPropertyState
* pNewBorders
[4], XMLPropertyState
* pAllBorderWidth
,
279 XMLPropertyState
* pBorderWidths
[4]
280 #if OSL_DEBUG_LEVEL > 0
281 , const rtl::Reference
< XMLPropertySetMapper
>& rMapper
285 if( pAllBorderDistance
&& !pBorderDistances
[nIndex
] )
287 #if OSL_DEBUG_LEVEL > 0
288 sal_Int16 nTmp
= rMapper
->GetEntryContextId(
289 pAllBorderDistance
->mnIndex
+ nIndex
+ 1 );
290 if (CTF_CHARALLBORDERDISTANCE
==
291 rMapper
->GetEntryContextId(pAllBorderDistance
->mnIndex
))
293 assert(nTmp
>= CTF_CHARLEFTBORDERDISTANCE
&&
294 nTmp
<= CTF_CHARBOTTOMBORDERDISTANCE
);
298 assert(nTmp
>= CTF_LEFTBORDERDISTANCE
&&
299 nTmp
<= CTF_BOTTOMBORDERDISTANCE
);
302 pNewBorderDistances
[nIndex
] =
303 new XMLPropertyState( pAllBorderDistance
->mnIndex
+ nIndex
+ 1,
304 pAllBorderDistance
->maValue
);
305 pBorderDistances
[nIndex
] = pNewBorderDistances
[nIndex
];
307 if( pAllBorder
&& !pBorders
[nIndex
] )
309 #if OSL_DEBUG_LEVEL > 0
310 sal_Int16 nTmp
= rMapper
->GetEntryContextId(
311 pAllBorder
->mnIndex
+ nIndex
+ 1 );
312 if (CTF_CHARALLBORDER
==
313 rMapper
->GetEntryContextId(pAllBorder
->mnIndex
))
315 assert(nTmp
>= CTF_CHARLEFTBORDER
&& nTmp
<= CTF_CHARBOTTOMBORDER
);
319 assert(nTmp
>= CTF_LEFTBORDER
&& nTmp
<= CTF_BOTTOMBORDER
);
322 pNewBorders
[nIndex
] = new XMLPropertyState( pAllBorder
->mnIndex
+ nIndex
+ 1,
323 pAllBorder
->maValue
);
324 pBorders
[nIndex
] = pNewBorders
[nIndex
];
326 if( !pBorderWidths
[nIndex
] )
327 pBorderWidths
[nIndex
] = pAllBorderWidth
;
329 pBorderWidths
[nIndex
]->mnIndex
= -1;
331 if( pBorders
[nIndex
] && pBorderWidths
[nIndex
] )
333 table::BorderLine2 aBorderLine
;
334 pBorders
[nIndex
]->maValue
>>= aBorderLine
;
336 table::BorderLine2 aBorderLineWidth
;
337 pBorderWidths
[nIndex
]->maValue
>>= aBorderLineWidth
;
339 aBorderLine
.OuterLineWidth
= aBorderLineWidth
.OuterLineWidth
;
340 aBorderLine
.InnerLineWidth
= aBorderLineWidth
.InnerLineWidth
;
341 aBorderLine
.LineDistance
= aBorderLineWidth
.LineDistance
;
342 aBorderLine
.LineWidth
= aBorderLineWidth
.LineWidth
;
344 pBorders
[nIndex
]->maValue
<<= aBorderLine
;
350 void XMLTextImportPropertyMapper::finished(
351 ::std::vector
< XMLPropertyState
>& rProperties
,
352 sal_Int32
/*nStartIndex*/, sal_Int32
/*nEndIndex*/ ) const
354 bool bHasAnyHeight
= false;
355 bool bHasAnyMinHeight
= false;
356 bool bHasAnyWidth
= false;
357 bool bHasAnyMinWidth
= false;
359 XMLPropertyState
* pFontFamilyName
= 0;
360 XMLPropertyState
* pFontStyleName
= 0;
361 XMLPropertyState
* pFontFamily
= 0;
362 XMLPropertyState
* pFontPitch
= 0;
363 XMLPropertyState
* pFontCharSet
= 0;
364 XMLPropertyState
* pNewFontStyleName
= 0;
365 XMLPropertyState
* pNewFontFamily
= 0;
366 XMLPropertyState
* pNewFontPitch
= 0;
367 XMLPropertyState
* pNewFontCharSet
= 0;
368 XMLPropertyState
* pFontFamilyNameCJK
= 0;
369 XMLPropertyState
* pFontStyleNameCJK
= 0;
370 XMLPropertyState
* pFontFamilyCJK
= 0;
371 XMLPropertyState
* pFontPitchCJK
= 0;
372 XMLPropertyState
* pFontCharSetCJK
= 0;
373 XMLPropertyState
* pNewFontStyleNameCJK
= 0;
374 XMLPropertyState
* pNewFontFamilyCJK
= 0;
375 XMLPropertyState
* pNewFontPitchCJK
= 0;
376 XMLPropertyState
* pNewFontCharSetCJK
= 0;
377 XMLPropertyState
* pFontFamilyNameCTL
= 0;
378 XMLPropertyState
* pFontStyleNameCTL
= 0;
379 XMLPropertyState
* pFontFamilyCTL
= 0;
380 XMLPropertyState
* pFontPitchCTL
= 0;
381 XMLPropertyState
* pFontCharSetCTL
= 0;
382 XMLPropertyState
* pNewFontStyleNameCTL
= 0;
383 XMLPropertyState
* pNewFontFamilyCTL
= 0;
384 XMLPropertyState
* pNewFontPitchCTL
= 0;
385 XMLPropertyState
* pNewFontCharSetCTL
= 0;
386 XMLPropertyState
* pAllBorderDistance
= 0;
387 XMLPropertyState
* pBorderDistances
[4] = { 0, 0, 0, 0 };
388 XMLPropertyState
* pNewBorderDistances
[4] = { 0, 0, 0, 0 };
389 XMLPropertyState
* pAllBorder
= 0;
390 XMLPropertyState
* pBorders
[4] = { 0, 0, 0, 0 };
391 XMLPropertyState
* pNewBorders
[4] = { 0, 0, 0, 0 };
392 XMLPropertyState
* pAllBorderWidth
= 0;
393 XMLPropertyState
* pBorderWidths
[4] = { 0, 0, 0, 0 };
394 XMLPropertyState
* pCharAllBorderDistance
= 0;
395 XMLPropertyState
* pCharBorderDistances
[4] = { 0, 0, 0, 0 };
396 XMLPropertyState
* pCharNewBorderDistances
[4] = { 0, 0, 0, 0 };
397 XMLPropertyState
* pCharAllBorder
= 0;
398 XMLPropertyState
* pCharBorders
[4] = { 0, 0, 0, 0 };
399 XMLPropertyState
* pCharNewBorders
[4] = { 0, 0, 0, 0 };
400 XMLPropertyState
* pCharAllBorderWidth
= 0;
401 XMLPropertyState
* pCharBorderWidths
[4] = { 0, 0, 0, 0 };
402 XMLPropertyState
* pVertOrient
= 0;
403 XMLPropertyState
* pVertOrientRelAsChar
= 0;
404 XMLPropertyState
* pBackTransparency
= NULL
; // transparency in %
405 XMLPropertyState
* pBackTransparent
= NULL
; // transparency as boolean
406 XMLPropertyState
* pAllParaMargin
= 0;
407 XMLPropertyState
* pParaMargins
[4] = { 0, 0, 0, 0 };
408 ::std::unique_ptr
<XMLPropertyState
> pNewParaMargins
[4];
409 XMLPropertyState
* pAllMargin
= 0;
410 XMLPropertyState
* pMargins
[4] = { 0, 0, 0, 0 };
411 ::std::unique_ptr
<XMLPropertyState
> pNewMargins
[4];
412 XMLPropertyState
* pFillStyle(nullptr);
413 XMLPropertyState
* pFillColor(nullptr);
415 for( ::std::vector
< XMLPropertyState
>::iterator aIter
= rProperties
.begin();
416 aIter
!= rProperties
.end();
419 XMLPropertyState
* property
= &(*aIter
);
420 if( -1 == property
->mnIndex
)
423 switch( getPropertySetMapper()->GetEntryContextId( property
->mnIndex
) )
425 case CTF_FONTFAMILYNAME
: pFontFamilyName
= property
; break;
426 case CTF_FONTSTYLENAME
: pFontStyleName
= property
; break;
427 case CTF_FONTFAMILY
: pFontFamily
= property
; break;
428 case CTF_FONTPITCH
: pFontPitch
= property
; break;
429 case CTF_FONTCHARSET
: pFontCharSet
= property
; break;
431 case CTF_FONTFAMILYNAME_CJK
: pFontFamilyNameCJK
= property
; break;
432 case CTF_FONTSTYLENAME_CJK
: pFontStyleNameCJK
= property
; break;
433 case CTF_FONTFAMILY_CJK
: pFontFamilyCJK
= property
; break;
434 case CTF_FONTPITCH_CJK
: pFontPitchCJK
= property
; break;
435 case CTF_FONTCHARSET_CJK
: pFontCharSetCJK
= property
; break;
437 case CTF_FONTFAMILYNAME_CTL
: pFontFamilyNameCTL
= property
; break;
438 case CTF_FONTSTYLENAME_CTL
: pFontStyleNameCTL
= property
; break;
439 case CTF_FONTFAMILY_CTL
: pFontFamilyCTL
= property
; break;
440 case CTF_FONTPITCH_CTL
: pFontPitchCTL
= property
; break;
441 case CTF_FONTCHARSET_CTL
: pFontCharSetCTL
= property
; break;
443 case CTF_ALLBORDERDISTANCE
: pAllBorderDistance
= property
; break;
444 case CTF_LEFTBORDERDISTANCE
: pBorderDistances
[XML_LINE_LEFT
] = property
; break;
445 case CTF_RIGHTBORDERDISTANCE
: pBorderDistances
[XML_LINE_RIGHT
] = property
; break;
446 case CTF_TOPBORDERDISTANCE
: pBorderDistances
[XML_LINE_TOP
] = property
; break;
447 case CTF_BOTTOMBORDERDISTANCE
: pBorderDistances
[XML_LINE_BOTTOM
] = property
; break;
448 case CTF_ALLBORDER
: pAllBorder
= property
; break;
449 case CTF_LEFTBORDER
: pBorders
[XML_LINE_LEFT
] = property
; break;
450 case CTF_RIGHTBORDER
: pBorders
[XML_LINE_RIGHT
] = property
; break;
451 case CTF_TOPBORDER
: pBorders
[XML_LINE_TOP
] = property
; break;
452 case CTF_BOTTOMBORDER
: pBorders
[XML_LINE_BOTTOM
] = property
; break;
453 case CTF_ALLBORDERWIDTH
: pAllBorderWidth
= property
; break;
454 case CTF_LEFTBORDERWIDTH
: pBorderWidths
[XML_LINE_LEFT
] = property
; break;
455 case CTF_RIGHTBORDERWIDTH
: pBorderWidths
[XML_LINE_RIGHT
] = property
; break;
456 case CTF_TOPBORDERWIDTH
: pBorderWidths
[XML_LINE_TOP
] = property
; break;
457 case CTF_BOTTOMBORDERWIDTH
: pBorderWidths
[XML_LINE_BOTTOM
] = property
; break;
459 case CTF_CHARALLBORDERDISTANCE
: pCharAllBorderDistance
= property
; break;
460 case CTF_CHARLEFTBORDERDISTANCE
: pCharBorderDistances
[XML_LINE_LEFT
] = property
; break;
461 case CTF_CHARRIGHTBORDERDISTANCE
: pCharBorderDistances
[XML_LINE_RIGHT
] = property
; break;
462 case CTF_CHARTOPBORDERDISTANCE
: pCharBorderDistances
[XML_LINE_TOP
] = property
; break;
463 case CTF_CHARBOTTOMBORDERDISTANCE
: pCharBorderDistances
[XML_LINE_BOTTOM
] = property
; break;
464 case CTF_CHARALLBORDER
: pCharAllBorder
= property
; break;
465 case CTF_CHARLEFTBORDER
: pCharBorders
[XML_LINE_LEFT
] = property
; break;
466 case CTF_CHARRIGHTBORDER
: pCharBorders
[XML_LINE_RIGHT
] = property
; break;
467 case CTF_CHARTOPBORDER
: pCharBorders
[XML_LINE_TOP
] = property
; break;
468 case CTF_CHARBOTTOMBORDER
: pCharBorders
[XML_LINE_BOTTOM
] = property
; break;
469 case CTF_CHARALLBORDERWIDTH
: pCharAllBorderWidth
= property
; break;
470 case CTF_CHARLEFTBORDERWIDTH
: pCharBorderWidths
[XML_LINE_LEFT
] = property
; break;
471 case CTF_CHARRIGHTBORDERWIDTH
: pCharBorderWidths
[XML_LINE_RIGHT
] = property
; break;
472 case CTF_CHARTOPBORDERWIDTH
: pCharBorderWidths
[XML_LINE_TOP
] = property
; break;
473 case CTF_CHARBOTTOMBORDERWIDTH
: pCharBorderWidths
[XML_LINE_BOTTOM
] = property
; break;
475 case CTF_ANCHORTYPE
: break;
476 case CTF_VERTICALPOS
: pVertOrient
= property
; break;
477 case CTF_VERTICALREL_ASCHAR
: pVertOrientRelAsChar
= property
; break;
479 case CTF_FRAMEHEIGHT_MIN_ABS
:
480 case CTF_FRAMEHEIGHT_MIN_REL
:
481 // case CTF_SYNCHEIGHT_MIN:
482 bHasAnyMinHeight
= true;
484 case CTF_FRAMEHEIGHT_ABS
:
485 case CTF_FRAMEHEIGHT_REL
:
486 // case CTF_SYNCHEIGHT:
487 bHasAnyHeight
= true; break;
488 case CTF_FRAMEWIDTH_MIN_ABS
:
489 case CTF_FRAMEWIDTH_MIN_REL
:
490 bHasAnyMinWidth
= true;
492 case CTF_FRAMEWIDTH_ABS
:
493 case CTF_FRAMEWIDTH_REL
:
494 bHasAnyWidth
= true; break;
495 case CTF_BACKGROUND_TRANSPARENCY
: pBackTransparency
= property
; break;
496 case CTF_BACKGROUND_TRANSPARENT
: pBackTransparent
= property
; break;
497 case CTF_FILLSTYLE
: pFillStyle
= property
; break;
498 case CTF_FILLCOLOR
: pFillColor
= property
; break;
499 case CTF_PARAMARGINALL
:
500 case CTF_PARAMARGINALL_REL
:
501 pAllParaMargin
= property
; break;
502 case CTF_PARALEFTMARGIN
:
503 case CTF_PARALEFTMARGIN_REL
:
504 pParaMargins
[XML_LINE_LEFT
] = property
; break;
505 case CTF_PARARIGHTMARGIN
:
506 case CTF_PARARIGHTMARGIN_REL
:
507 pParaMargins
[XML_LINE_RIGHT
] = property
; break;
508 case CTF_PARATOPMARGIN
:
509 case CTF_PARATOPMARGIN_REL
:
510 pParaMargins
[XML_LINE_TOP
] = property
; break;
511 case CTF_PARABOTTOMMARGIN
:
512 case CTF_PARABOTTOMMARGIN_REL
:
513 pParaMargins
[XML_LINE_BOTTOM
] = property
; break;
515 pAllMargin
= property
; break;
517 pMargins
[XML_LINE_LEFT
] = property
; break;
518 case CTF_MARGINRIGHT
:
519 pMargins
[XML_LINE_RIGHT
] = property
; break;
521 pMargins
[XML_LINE_TOP
] = property
; break;
522 case CTF_MARGINBOTTOM
:
523 pMargins
[XML_LINE_BOTTOM
] = property
; break;
527 if( pFontFamilyName
|| pFontStyleName
|| pFontFamily
||
528 pFontPitch
|| pFontCharSet
)
529 FontFinished( pFontFamilyName
, pFontStyleName
, pFontFamily
,
530 pFontPitch
, pFontCharSet
);
531 if( pFontFamilyNameCJK
|| pFontStyleNameCJK
|| pFontFamilyCJK
||
532 pFontPitchCJK
|| pFontCharSetCJK
)
533 FontFinished( pFontFamilyNameCJK
, pFontStyleNameCJK
, pFontFamilyCJK
,
534 pFontPitchCJK
, pFontCharSetCJK
);
535 if( pFontFamilyNameCTL
|| pFontStyleNameCTL
|| pFontFamilyCTL
||
536 pFontPitchCTL
|| pFontCharSetCTL
)
537 FontFinished( pFontFamilyNameCTL
, pFontStyleNameCTL
, pFontFamilyCTL
,
538 pFontPitchCTL
, pFontCharSetCTL
);
540 for (sal_uInt16 i
= 0; i
< 4; i
++)
542 if (pAllParaMargin
&& !pParaMargins
[i
]
543 && isNotDefaultRelSize(pAllParaMargin
, getPropertySetMapper()))
545 #if OSL_DEBUG_LEVEL > 0
546 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
547 pAllParaMargin
->mnIndex
+ (2*i
) + 2 );
548 assert(nTmp
>= CTF_PARALEFTMARGIN
&&
549 nTmp
<= CTF_PARABOTTOMMARGIN_REL
);
551 pNewParaMargins
[i
].reset(new XMLPropertyState(
552 pAllParaMargin
->mnIndex
+ (2*i
) + 2, pAllParaMargin
->maValue
));
554 if (pAllMargin
&& !pMargins
[i
])
556 #if OSL_DEBUG_LEVEL > 0
557 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
558 pAllMargin
->mnIndex
+ i
+ 1 );
559 assert(nTmp
>= CTF_MARGINLEFT
&& nTmp
<= CTF_MARGINBOTTOM
);
561 pNewMargins
[i
].reset(new XMLPropertyState(
562 pAllMargin
->mnIndex
+ i
+ 1, pAllMargin
->maValue
));
566 i
, pAllBorderDistance
, pBorderDistances
, pNewBorderDistances
,
567 pAllBorder
, pBorders
, pNewBorders
,
568 pAllBorderWidth
, pBorderWidths
569 #if OSL_DEBUG_LEVEL > 0
570 , getPropertySetMapper()
575 i
, pCharAllBorderDistance
, pCharBorderDistances
,
576 pCharNewBorderDistances
, pCharAllBorder
, pCharBorders
,
577 pCharNewBorders
, pCharAllBorderWidth
, pCharBorderWidths
578 #if OSL_DEBUG_LEVEL > 0
579 , getPropertySetMapper()
586 pAllParaMargin
->mnIndex
= -1;
590 pAllMargin
->mnIndex
= -1;
593 if( pAllBorderDistance
)
594 pAllBorderDistance
->mnIndex
= -1;
597 pAllBorder
->mnIndex
= -1;
599 if( pAllBorderWidth
)
600 pAllBorderWidth
->mnIndex
= -1;
602 if( pCharAllBorderDistance
)
603 pCharAllBorderDistance
->mnIndex
= -1;
606 pCharAllBorder
->mnIndex
= -1;
608 if( pCharAllBorderWidth
)
609 pCharAllBorderWidth
->mnIndex
= -1;
611 if( pVertOrient
&& pVertOrientRelAsChar
)
613 sal_Int16 nVertOrient
;
614 pVertOrient
->maValue
>>= nVertOrient
;
615 sal_Int16 nVertOrientRel
= 0;
616 pVertOrientRelAsChar
->maValue
>>= nVertOrientRel
;
617 switch( nVertOrient
)
619 case VertOrientation::TOP
:
620 nVertOrient
= nVertOrientRel
;
622 case VertOrientation::CENTER
:
623 switch( nVertOrientRel
)
625 case VertOrientation::CHAR_TOP
:
626 nVertOrient
= VertOrientation::CHAR_CENTER
;
628 case VertOrientation::LINE_TOP
:
629 nVertOrient
= VertOrientation::LINE_CENTER
;
633 case VertOrientation::BOTTOM
:
634 switch( nVertOrientRel
)
636 case VertOrientation::CHAR_TOP
:
637 nVertOrient
= VertOrientation::CHAR_BOTTOM
;
639 case VertOrientation::LINE_TOP
:
640 nVertOrient
= VertOrientation::LINE_BOTTOM
;
645 pVertOrient
->maValue
<<= nVertOrient
;
646 pVertOrientRelAsChar
->mnIndex
= -1;
649 FontDefaultsCheck( pFontFamilyName
,
650 pFontStyleName
, pFontFamily
, pFontPitch
, pFontCharSet
,
651 &pNewFontStyleName
, &pNewFontFamily
, &pNewFontPitch
, &pNewFontCharSet
);
653 FontDefaultsCheck( pFontFamilyNameCJK
,
654 pFontStyleNameCJK
, pFontFamilyCJK
, pFontPitchCJK
, pFontCharSetCJK
,
655 &pNewFontStyleNameCJK
, &pNewFontFamilyCJK
, &pNewFontPitchCJK
, &pNewFontCharSetCJK
);
657 FontDefaultsCheck( pFontFamilyNameCTL
,
658 pFontStyleNameCTL
, pFontFamilyCTL
, pFontPitchCTL
, pFontCharSetCTL
,
659 &pNewFontStyleNameCTL
, &pNewFontFamilyCTL
, &pNewFontPitchCTL
, &pNewFontCharSetCTL
);
661 if (pFillStyle
&& !pFillColor
&& pBackTransparent
662 && drawing::FillStyle_SOLID
== pFillStyle
->maValue
.get
<drawing::FillStyle
>()
663 && pBackTransparent
->maValue
.get
<bool>())
665 // fo:background="transparent", draw:fill="solid" without draw:fill-color
666 // prevent getSvxBrushItemFromSourceSet from adding bogus default color
667 pFillStyle
->mnIndex
= -1;
670 // #i5775# don't overwrite %transparency with binary transparency
671 if( ( pBackTransparency
!= NULL
) && ( pBackTransparent
!= NULL
) )
673 if( ! *static_cast<sal_Bool
const *>(pBackTransparent
->maValue
.getValue()) )
674 pBackTransparent
->mnIndex
= -1;
678 // insert newly created properties. This invalidates all iterators!
679 // Most of the pXXX variables in this method are iterators and will be
682 if( pNewFontStyleName
)
684 rProperties
.push_back( *pNewFontStyleName
);
685 delete pNewFontStyleName
;
690 rProperties
.push_back( *pNewFontFamily
);
691 delete pNewFontFamily
;
696 rProperties
.push_back( *pNewFontPitch
);
697 delete pNewFontPitch
;
700 if( pNewFontCharSet
)
702 rProperties
.push_back( *pNewFontCharSet
);
703 delete pNewFontCharSet
;
706 if( pNewFontStyleNameCJK
)
708 rProperties
.push_back( *pNewFontStyleNameCJK
);
709 delete pNewFontStyleNameCJK
;
712 if( pNewFontFamilyCJK
)
714 rProperties
.push_back( *pNewFontFamilyCJK
);
715 delete pNewFontFamilyCJK
;
718 if( pNewFontPitchCJK
)
720 rProperties
.push_back( *pNewFontPitchCJK
);
721 delete pNewFontPitchCJK
;
724 if( pNewFontCharSetCJK
)
726 rProperties
.push_back( *pNewFontCharSetCJK
);
727 delete pNewFontCharSetCJK
;
730 if( pNewFontStyleNameCTL
)
732 rProperties
.push_back( *pNewFontStyleNameCTL
);
733 delete pNewFontStyleNameCTL
;
736 if( pNewFontFamilyCTL
)
738 rProperties
.push_back( *pNewFontFamilyCTL
);
739 delete pNewFontFamilyCTL
;
742 if( pNewFontPitchCTL
)
744 rProperties
.push_back( *pNewFontPitchCTL
);
745 delete pNewFontPitchCTL
;
748 if( pNewFontCharSetCTL
)
750 rProperties
.push_back( *pNewFontCharSetCTL
);
751 delete pNewFontCharSetCTL
;
754 for (sal_uInt16 i
=0; i
<4; i
++)
756 if (pNewParaMargins
[i
].get())
758 rProperties
.push_back(*pNewParaMargins
[i
]);
760 if (pNewMargins
[i
].get())
762 rProperties
.push_back(*pNewMargins
[i
]);
764 if( pNewBorderDistances
[i
] )
766 rProperties
.push_back( *pNewBorderDistances
[i
] );
767 delete pNewBorderDistances
[i
];
771 rProperties
.push_back( *pNewBorders
[i
] );
772 delete pNewBorders
[i
];
774 if( pCharNewBorderDistances
[i
] )
776 rProperties
.push_back( *pCharNewBorderDistances
[i
] );
777 delete pCharNewBorderDistances
[i
];
779 if( pCharNewBorders
[i
] )
781 rProperties
.push_back( *pCharNewBorders
[i
] );
782 delete pCharNewBorders
[i
];
788 if( nSizeTypeIndex
== -2 )
790 const_cast < XMLTextImportPropertyMapper
* > ( this )
791 ->nSizeTypeIndex
= -1;
792 sal_Int32 nPropCount
= getPropertySetMapper()->GetEntryCount();
793 for( sal_Int32 j
=0; j
< nPropCount
; j
++ )
795 if( CTF_SIZETYPE
== getPropertySetMapper()
796 ->GetEntryContextId( j
) )
798 const_cast < XMLTextImportPropertyMapper
* > ( this )
799 ->nSizeTypeIndex
= j
;
804 if( nSizeTypeIndex
!= -1 )
806 XMLPropertyState
aSizeTypeState( nSizeTypeIndex
);
807 aSizeTypeState
.maValue
<<= (sal_Int16
)( bHasAnyMinHeight
810 rProperties
.push_back( aSizeTypeState
);
816 if( nWidthTypeIndex
== -2 )
818 const_cast < XMLTextImportPropertyMapper
* > ( this )
819 ->nWidthTypeIndex
= -1;
820 sal_Int32 nCount
= getPropertySetMapper()->GetEntryCount();
821 for( sal_Int32 j
=0; j
< nCount
; j
++ )
823 if( CTF_FRAMEWIDTH_TYPE
== getPropertySetMapper()
824 ->GetEntryContextId( j
) )
826 const_cast < XMLTextImportPropertyMapper
* > ( this )
827 ->nWidthTypeIndex
= j
;
832 if( nWidthTypeIndex
!= -1 )
834 XMLPropertyState
aSizeTypeState( nWidthTypeIndex
);
835 aSizeTypeState
.maValue
<<= (sal_Int16
)( bHasAnyMinWidth
838 rProperties
.push_back( aSizeTypeState
);
842 // DO NOT USE ITERATORS/POINTERS INTO THE rProperties-VECTOR AFTER
843 // THIS LINE. All iterators into the rProperties-vector, especially all
844 // pXXX-type variables set in the first switch statement of this method,
845 // may have been invalidated by the above push_back() calls!
849 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */