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 <tools/debug.hxx>
21 #include <osl/thread.h>
22 #include <com/sun/star/awt/FontFamily.hpp>
23 #include <com/sun/star/awt/FontPitch.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"
32 #define XML_LINE_LEFT 0
33 #define XML_LINE_RIGHT 1
34 #define XML_LINE_TOP 2
35 #define XML_LINE_BOTTOM 3
38 using namespace ::com::sun::star
;
39 using namespace ::com::sun::star::uno
;
40 using namespace ::com::sun::star::table
;
41 using namespace ::com::sun::star::text
;
43 bool XMLTextImportPropertyMapper::handleSpecialItem(
44 XMLPropertyState
& rProperty
,
45 ::std::vector
< XMLPropertyState
>& rProperties
,
46 const OUString
& rValue
,
47 const SvXMLUnitConverter
& rUnitConverter
,
48 const SvXMLNamespaceMap
& rNamespaceMap
) const
50 sal_Bool bRet
= sal_False
;
51 sal_Int32 nIndex
= rProperty
.mnIndex
;
52 switch( getPropertySetMapper()->GetEntryContextId( nIndex
) )
55 case CTF_FONTNAME_CJK
:
56 case CTF_FONTNAME_CTL
:
57 if( GetImport().GetFontDecls() != NULL
)
60 ( CTF_FONTFAMILYNAME
==
61 getPropertySetMapper()->GetEntryContextId(nIndex
+1) &&
63 getPropertySetMapper()->GetEntryContextId(nIndex
+2) &&
65 getPropertySetMapper()->GetEntryContextId(nIndex
+3) &&
67 getPropertySetMapper()->GetEntryContextId(nIndex
+4) &&
69 getPropertySetMapper()->GetEntryContextId(nIndex
+5) ) ||
70 ( CTF_FONTFAMILYNAME_CJK
==
71 getPropertySetMapper()->GetEntryContextId(nIndex
+1) &&
72 CTF_FONTSTYLENAME_CJK
==
73 getPropertySetMapper()->GetEntryContextId(nIndex
+2) &&
75 getPropertySetMapper()->GetEntryContextId(nIndex
+3) &&
77 getPropertySetMapper()->GetEntryContextId(nIndex
+4) &&
78 CTF_FONTCHARSET_CJK
==
79 getPropertySetMapper()->GetEntryContextId(nIndex
+5) ) ||
80 ( CTF_FONTFAMILYNAME_CTL
==
81 getPropertySetMapper()->GetEntryContextId(nIndex
+1) &&
82 CTF_FONTSTYLENAME_CTL
==
83 getPropertySetMapper()->GetEntryContextId(nIndex
+2) &&
85 getPropertySetMapper()->GetEntryContextId(nIndex
+3) &&
87 getPropertySetMapper()->GetEntryContextId(nIndex
+4) &&
88 CTF_FONTCHARSET_CTL
==
89 getPropertySetMapper()->GetEntryContextId(nIndex
+5) ),
90 "illegal property map" );
92 GetImport().GetFontDecls()->FillProperties(
94 rProperty
.mnIndex
+1, rProperty
.mnIndex
+2,
95 rProperty
.mnIndex
+3, rProperty
.mnIndex
+4,
96 rProperty
.mnIndex
+5 );
97 bRet
= sal_False
; // the property hasn't been filled
101 // If we want to do StarMath/StarSymbol font conversion, then we'll
102 // want these special items to be treated just like regular ones...
103 // For the Writer, we'll catch and convert them in _FillPropertySet;
104 // the other apps probably don't care. For the other apps, we just
105 // imitate the default non-special-item mechanism.
106 case CTF_FONTFAMILYNAME
:
107 case CTF_FONTFAMILYNAME_CJK
:
108 case CTF_FONTFAMILYNAME_CTL
:
109 bRet
= getPropertySetMapper()->importXML( rValue
, rProperty
,
113 case CTF_TEXT_DISPLAY
:
114 bRet
= getPropertySetMapper()->importXML( rValue
, rProperty
,
116 if( SvXMLImport::OOo_2x
== GetImport().getGeneratorVersion() )
119 rProperty
.maValue
>>= bHidden
;
121 rProperty
.maValue
<<= bHidden
;
125 bRet
= SvXMLImportPropertyMapper::handleSpecialItem( rProperty
,
126 rProperties
, rValue
, rUnitConverter
, rNamespaceMap
);
133 XMLTextImportPropertyMapper::XMLTextImportPropertyMapper(
134 const UniReference
< XMLPropertySetMapper
>& rMapper
,
135 SvXMLImport
& rImp
) :
136 SvXMLImportPropertyMapper( rMapper
, rImp
),
137 nSizeTypeIndex( -2 ),
138 nWidthTypeIndex( -2 )
142 XMLTextImportPropertyMapper::~XMLTextImportPropertyMapper()
146 void XMLTextImportPropertyMapper::FontFinished(
147 XMLPropertyState
*pFontFamilyNameState
,
148 XMLPropertyState
*pFontStyleNameState
,
149 XMLPropertyState
*pFontFamilyState
,
150 XMLPropertyState
*pFontPitchState
,
151 XMLPropertyState
*pFontCharsetState
) const
153 if( pFontFamilyNameState
&& pFontFamilyNameState
->mnIndex
!= -1 )
156 pFontFamilyNameState
->maValue
>>= sName
;
157 if( sName
.isEmpty() )
158 pFontFamilyNameState
->mnIndex
= -1;
160 if( !pFontFamilyNameState
|| pFontFamilyNameState
->mnIndex
== -1 )
162 if( pFontStyleNameState
)
163 pFontStyleNameState
->mnIndex
= -1;
164 if( pFontFamilyState
)
165 pFontFamilyState
->mnIndex
= -1;
166 if( pFontPitchState
)
167 pFontPitchState
->mnIndex
= -1;
168 if( pFontCharsetState
)
169 pFontCharsetState
->mnIndex
= -1;
173 /** since the properties "CharFontFamilyName", "CharFontStyleName", "CharFontFamily",
174 "CharFontPitch" and "CharFontSet" and theire CJK and CTL counterparts are only
175 usable as a union, we add defaults to all values that are not set as long as we
176 have an "CharFontFamilyName"
179 void XMLTextImportPropertyMapper::FontDefaultsCheck(
180 XMLPropertyState
* pFontFamilyName
,
181 XMLPropertyState
* pFontStyleName
,
182 XMLPropertyState
* pFontFamily
,
183 XMLPropertyState
* pFontPitch
,
184 XMLPropertyState
* pFontCharSet
,
185 XMLPropertyState
** ppNewFontStyleName
,
186 XMLPropertyState
** ppNewFontFamily
,
187 XMLPropertyState
** ppNewFontPitch
,
188 XMLPropertyState
** ppNewFontCharSet
) const
190 if( pFontFamilyName
)
195 if( !pFontStyleName
)
199 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
200 pFontFamilyName
->mnIndex
+ 1 );
201 DBG_ASSERT( nTmp
== CTF_FONTSTYLENAME
|| nTmp
== CTF_FONTSTYLENAME_CJK
|| nTmp
== CTF_FONTSTYLENAME_CTL
,
202 "wrong property context id" );
204 *ppNewFontStyleName
= new XMLPropertyState( pFontFamilyName
->mnIndex
+ 1,
210 aAny
<<= (sal_Int16
)com::sun::star::awt::FontFamily::DONTKNOW
;
213 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
214 pFontFamilyName
->mnIndex
+ 2 );
215 DBG_ASSERT( nTmp
== CTF_FONTFAMILY
|| nTmp
== CTF_FONTFAMILY_CJK
|| nTmp
== CTF_FONTFAMILY_CTL
,
216 "wrong property context id" );
218 *ppNewFontFamily
= new XMLPropertyState( pFontFamilyName
->mnIndex
+ 2,
224 aAny
<<= (sal_Int16
)com::sun::star::awt::FontPitch::DONTKNOW
;
226 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
227 pFontFamilyName
->mnIndex
+ 3 );
228 DBG_ASSERT( nTmp
== CTF_FONTPITCH
|| nTmp
== CTF_FONTPITCH_CJK
|| nTmp
== CTF_FONTPITCH_CTL
,
229 "wrong property context id" );
231 *ppNewFontPitch
= new XMLPropertyState( pFontFamilyName
->mnIndex
+ 3,
237 aAny
<<= (sal_Int16
)osl_getThreadTextEncoding();
239 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
240 pFontFamilyName
->mnIndex
+ 4 );
241 DBG_ASSERT( nTmp
== CTF_FONTCHARSET
|| nTmp
== CTF_FONTCHARSET_CJK
|| nTmp
== CTF_FONTCHARSET_CTL
,
242 "wrong property context id" );
244 *ppNewFontCharSet
= new XMLPropertyState( pFontFamilyName
->mnIndex
+ 4,
250 //fdo#58730 The [UL|LR]Space class has a deficiency where "100%" also serves as
251 //a flag that the value is an absolute value so we can't truly handle an
252 //up/lower space property which wants to specify its 200% upper but 100% lower
253 //of its parent (try typing 100% vs 200% into the edit style dialog and revisit
254 //your style). So on xml load that ends up meaning 200%, 0 lower. This is a
257 //On import clear 100% all-margins relative sizes.
259 isNotDefaultRelSize(const XMLPropertyState
* pRelState
, const UniReference
<XMLPropertySetMapper
>& rPrMap
)
261 if (rPrMap
->GetEntryContextId(pRelState
->mnIndex
) == CTF_PARAMARGINALL_REL
)
264 pRelState
->maValue
>>= nTemp
;
270 void XMLTextImportPropertyMapper::finished(
271 ::std::vector
< XMLPropertyState
>& rProperties
,
272 sal_Int32
/*nStartIndex*/, sal_Int32
/*nEndIndex*/ ) const
274 sal_Bool bHasAnyHeight
= sal_False
;
275 sal_Bool bHasAnyMinHeight
= sal_False
;
276 sal_Bool bHasAnyWidth
= sal_False
;
277 sal_Bool bHasAnyMinWidth
= sal_False
;
279 XMLPropertyState
* pFontFamilyName
= 0;
280 XMLPropertyState
* pFontStyleName
= 0;
281 XMLPropertyState
* pFontFamily
= 0;
282 XMLPropertyState
* pFontPitch
= 0;
283 XMLPropertyState
* pFontCharSet
= 0;
284 XMLPropertyState
* pNewFontStyleName
= 0;
285 XMLPropertyState
* pNewFontFamily
= 0;
286 XMLPropertyState
* pNewFontPitch
= 0;
287 XMLPropertyState
* pNewFontCharSet
= 0;
288 XMLPropertyState
* pFontFamilyNameCJK
= 0;
289 XMLPropertyState
* pFontStyleNameCJK
= 0;
290 XMLPropertyState
* pFontFamilyCJK
= 0;
291 XMLPropertyState
* pFontPitchCJK
= 0;
292 XMLPropertyState
* pFontCharSetCJK
= 0;
293 XMLPropertyState
* pNewFontStyleNameCJK
= 0;
294 XMLPropertyState
* pNewFontFamilyCJK
= 0;
295 XMLPropertyState
* pNewFontPitchCJK
= 0;
296 XMLPropertyState
* pNewFontCharSetCJK
= 0;
297 XMLPropertyState
* pFontFamilyNameCTL
= 0;
298 XMLPropertyState
* pFontStyleNameCTL
= 0;
299 XMLPropertyState
* pFontFamilyCTL
= 0;
300 XMLPropertyState
* pFontPitchCTL
= 0;
301 XMLPropertyState
* pFontCharSetCTL
= 0;
302 XMLPropertyState
* pNewFontStyleNameCTL
= 0;
303 XMLPropertyState
* pNewFontFamilyCTL
= 0;
304 XMLPropertyState
* pNewFontPitchCTL
= 0;
305 XMLPropertyState
* pNewFontCharSetCTL
= 0;
306 XMLPropertyState
* pAllBorderDistance
= 0;
307 XMLPropertyState
* pBorderDistances
[4] = { 0, 0, 0, 0 };
308 XMLPropertyState
* pNewBorderDistances
[4] = { 0, 0, 0, 0 };
309 XMLPropertyState
* pAllBorder
= 0;
310 XMLPropertyState
* pBorders
[4] = { 0, 0, 0, 0 };
311 XMLPropertyState
* pNewBorders
[4] = { 0, 0, 0, 0 };
312 XMLPropertyState
* pAllBorderWidth
= 0;
313 XMLPropertyState
* pBorderWidths
[4] = { 0, 0, 0, 0 };
314 XMLPropertyState
* pVertOrient
= 0;
315 XMLPropertyState
* pVertOrientRelAsChar
= 0;
316 XMLPropertyState
* pBackTransparency
= NULL
; // transparency in %
317 XMLPropertyState
* pBackTransparent
= NULL
; // transparency as boolean
318 XMLPropertyState
* pAllParaMargin
= 0;
319 XMLPropertyState
* pParaMargins
[4] = { 0, 0, 0, 0 };
320 SAL_WNODEPRECATED_DECLARATIONS_PUSH
321 ::std::auto_ptr
<XMLPropertyState
> pNewParaMargins
[4];
322 SAL_WNODEPRECATED_DECLARATIONS_POP
323 XMLPropertyState
* pAllMargin
= 0;
324 XMLPropertyState
* pMargins
[4] = { 0, 0, 0, 0 };
325 SAL_WNODEPRECATED_DECLARATIONS_PUSH
326 ::std::auto_ptr
<XMLPropertyState
> pNewMargins
[4];
327 SAL_WNODEPRECATED_DECLARATIONS_POP
329 for( ::std::vector
< XMLPropertyState
>::iterator aIter
= rProperties
.begin();
330 aIter
!= rProperties
.end();
333 XMLPropertyState
* property
= &(*aIter
);
334 if( -1 == property
->mnIndex
)
337 switch( getPropertySetMapper()->GetEntryContextId( property
->mnIndex
) )
339 case CTF_FONTFAMILYNAME
: pFontFamilyName
= property
; break;
340 case CTF_FONTSTYLENAME
: pFontStyleName
= property
; break;
341 case CTF_FONTFAMILY
: pFontFamily
= property
; break;
342 case CTF_FONTPITCH
: pFontPitch
= property
; break;
343 case CTF_FONTCHARSET
: pFontCharSet
= property
; break;
345 case CTF_FONTFAMILYNAME_CJK
: pFontFamilyNameCJK
= property
; break;
346 case CTF_FONTSTYLENAME_CJK
: pFontStyleNameCJK
= property
; break;
347 case CTF_FONTFAMILY_CJK
: pFontFamilyCJK
= property
; break;
348 case CTF_FONTPITCH_CJK
: pFontPitchCJK
= property
; break;
349 case CTF_FONTCHARSET_CJK
: pFontCharSetCJK
= property
; break;
351 case CTF_FONTFAMILYNAME_CTL
: pFontFamilyNameCTL
= property
; break;
352 case CTF_FONTSTYLENAME_CTL
: pFontStyleNameCTL
= property
; break;
353 case CTF_FONTFAMILY_CTL
: pFontFamilyCTL
= property
; break;
354 case CTF_FONTPITCH_CTL
: pFontPitchCTL
= property
; break;
355 case CTF_FONTCHARSET_CTL
: pFontCharSetCTL
= property
; break;
357 case CTF_ALLBORDERDISTANCE
: pAllBorderDistance
= property
; break;
358 case CTF_LEFTBORDERDISTANCE
: pBorderDistances
[XML_LINE_LEFT
] = property
; break;
359 case CTF_RIGHTBORDERDISTANCE
: pBorderDistances
[XML_LINE_RIGHT
] = property
; break;
360 case CTF_TOPBORDERDISTANCE
: pBorderDistances
[XML_LINE_TOP
] = property
; break;
361 case CTF_BOTTOMBORDERDISTANCE
: pBorderDistances
[XML_LINE_BOTTOM
] = property
; break;
362 case CTF_ALLBORDER
: pAllBorder
= property
; break;
363 case CTF_LEFTBORDER
: pBorders
[XML_LINE_LEFT
] = property
; break;
364 case CTF_RIGHTBORDER
: pBorders
[XML_LINE_RIGHT
] = property
; break;
365 case CTF_TOPBORDER
: pBorders
[XML_LINE_TOP
] = property
; break;
366 case CTF_BOTTOMBORDER
: pBorders
[XML_LINE_BOTTOM
] = property
; break;
368 case CTF_ALLBORDERWIDTH
: pAllBorderWidth
= property
; break;
369 case CTF_LEFTBORDERWIDTH
: pBorderWidths
[XML_LINE_LEFT
] = property
; break;
370 case CTF_RIGHTBORDERWIDTH
: pBorderWidths
[XML_LINE_RIGHT
] = property
; break;
371 case CTF_TOPBORDERWIDTH
: pBorderWidths
[XML_LINE_TOP
] = property
; break;
372 case CTF_BOTTOMBORDERWIDTH
: pBorderWidths
[XML_LINE_BOTTOM
] = property
; break;
373 case CTF_ANCHORTYPE
: break;
374 case CTF_VERTICALPOS
: pVertOrient
= property
; break;
375 case CTF_VERTICALREL_ASCHAR
: pVertOrientRelAsChar
= property
; break;
377 case CTF_FRAMEHEIGHT_MIN_ABS
:
378 case CTF_FRAMEHEIGHT_MIN_REL
:
379 // case CTF_SYNCHEIGHT_MIN:
380 bHasAnyMinHeight
= sal_True
;
382 case CTF_FRAMEHEIGHT_ABS
:
383 case CTF_FRAMEHEIGHT_REL
:
384 // case CTF_SYNCHEIGHT:
385 bHasAnyHeight
= sal_True
; break;
386 case CTF_FRAMEWIDTH_MIN_ABS
:
387 case CTF_FRAMEWIDTH_MIN_REL
:
388 bHasAnyMinWidth
= sal_True
;
390 case CTF_FRAMEWIDTH_ABS
:
391 case CTF_FRAMEWIDTH_REL
:
392 bHasAnyWidth
= sal_True
; break;
393 case CTF_BACKGROUND_TRANSPARENCY
: pBackTransparency
= property
; break;
394 case CTF_BACKGROUND_TRANSPARENT
: pBackTransparent
= property
; break;
395 case CTF_PARAMARGINALL
:
396 case CTF_PARAMARGINALL_REL
:
397 pAllParaMargin
= property
; break;
398 case CTF_PARALEFTMARGIN
:
399 case CTF_PARALEFTMARGIN_REL
:
400 pParaMargins
[XML_LINE_LEFT
] = property
; break;
401 case CTF_PARARIGHTMARGIN
:
402 case CTF_PARARIGHTMARGIN_REL
:
403 pParaMargins
[XML_LINE_RIGHT
] = property
; break;
404 case CTF_PARATOPMARGIN
:
405 case CTF_PARATOPMARGIN_REL
:
406 pParaMargins
[XML_LINE_TOP
] = property
; break;
407 case CTF_PARABOTTOMMARGIN
:
408 case CTF_PARABOTTOMMARGIN_REL
:
409 pParaMargins
[XML_LINE_BOTTOM
] = property
; break;
411 pAllMargin
= property
; break;
413 pMargins
[XML_LINE_LEFT
] = property
; break;
414 case CTF_MARGINRIGHT
:
415 pMargins
[XML_LINE_RIGHT
] = property
; break;
417 pMargins
[XML_LINE_TOP
] = property
; break;
418 case CTF_MARGINBOTTOM
:
419 pMargins
[XML_LINE_BOTTOM
] = property
; break;
423 if( pFontFamilyName
|| pFontStyleName
|| pFontFamily
||
424 pFontPitch
|| pFontCharSet
)
425 FontFinished( pFontFamilyName
, pFontStyleName
, pFontFamily
,
426 pFontPitch
, pFontCharSet
);
427 if( pFontFamilyNameCJK
|| pFontStyleNameCJK
|| pFontFamilyCJK
||
428 pFontPitchCJK
|| pFontCharSetCJK
)
429 FontFinished( pFontFamilyNameCJK
, pFontStyleNameCJK
, pFontFamilyCJK
,
430 pFontPitchCJK
, pFontCharSetCJK
);
431 if( pFontFamilyNameCTL
|| pFontStyleNameCTL
|| pFontFamilyCTL
||
432 pFontPitchCTL
|| pFontCharSetCTL
)
433 FontFinished( pFontFamilyNameCTL
, pFontStyleNameCTL
, pFontFamilyCTL
,
434 pFontPitchCTL
, pFontCharSetCTL
);
436 for (sal_uInt16 i
= 0; i
< 4; i
++)
438 if (pAllParaMargin
&& !pParaMargins
[i
]
439 && isNotDefaultRelSize(pAllParaMargin
, getPropertySetMapper()))
441 #if OSL_DEBUG_LEVEL > 0
442 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
443 pAllParaMargin
->mnIndex
+ (2*i
) + 2 );
444 OSL_ENSURE( nTmp
>= CTF_PARALEFTMARGIN
&&
445 nTmp
<= CTF_PARABOTTOMMARGIN_REL
,
446 "wrong property context id" );
448 pNewParaMargins
[i
].reset(new XMLPropertyState(
449 pAllParaMargin
->mnIndex
+ (2*i
) + 2, pAllParaMargin
->maValue
));
451 if (pAllMargin
&& !pMargins
[i
])
453 #if OSL_DEBUG_LEVEL > 0
454 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
455 pAllMargin
->mnIndex
+ i
+ 1 );
456 OSL_ENSURE( nTmp
>= CTF_MARGINLEFT
&& nTmp
<= CTF_MARGINBOTTOM
,
457 "wrong property context id" );
459 pNewMargins
[i
].reset(new XMLPropertyState(
460 pAllMargin
->mnIndex
+ i
+ 1, pAllMargin
->maValue
));
462 if( pAllBorderDistance
&& !pBorderDistances
[i
] )
465 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
466 pAllBorderDistance
->mnIndex
+ i
+ 1 );
467 DBG_ASSERT( nTmp
>= CTF_LEFTBORDERDISTANCE
&&
468 nTmp
<= CTF_BOTTOMBORDERDISTANCE
,
469 "wrong property context id" );
471 pNewBorderDistances
[i
] =
472 new XMLPropertyState( pAllBorderDistance
->mnIndex
+ i
+ 1,
473 pAllBorderDistance
->maValue
);
474 pBorderDistances
[i
] = pNewBorderDistances
[i
];
476 if( pAllBorder
&& !pBorders
[i
] )
479 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
480 pAllBorder
->mnIndex
+ i
+ 1 );
481 DBG_ASSERT( nTmp
>= CTF_LEFTBORDER
&& nTmp
<= CTF_BOTTOMBORDER
,
482 "wrong property context id" );
484 pNewBorders
[i
] = new XMLPropertyState( pAllBorder
->mnIndex
+ i
+ 1,
485 pAllBorder
->maValue
);
486 pBorders
[i
] = pNewBorders
[i
];
488 if( !pBorderWidths
[i
] )
489 pBorderWidths
[i
] = pAllBorderWidth
;
491 pBorderWidths
[i
]->mnIndex
= -1;
493 if( pBorders
[i
] && pBorderWidths
[i
] )
495 table::BorderLine2 aBorderLine
;
496 pBorders
[i
]->maValue
>>= aBorderLine
;
498 table::BorderLine2 aBorderLineWidth
;
499 pBorderWidths
[i
]->maValue
>>= aBorderLineWidth
;
501 aBorderLine
.OuterLineWidth
= aBorderLineWidth
.OuterLineWidth
;
502 aBorderLine
.InnerLineWidth
= aBorderLineWidth
.InnerLineWidth
;
503 aBorderLine
.LineDistance
= aBorderLineWidth
.LineDistance
;
504 aBorderLine
.LineWidth
= aBorderLineWidth
.LineWidth
;
506 pBorders
[i
]->maValue
<<= aBorderLine
;
512 pAllParaMargin
->mnIndex
= -1;
516 pAllMargin
->mnIndex
= -1;
519 if( pAllBorderDistance
)
520 pAllBorderDistance
->mnIndex
= -1;
523 pAllBorder
->mnIndex
= -1;
525 if( pAllBorderWidth
)
526 pAllBorderWidth
->mnIndex
= -1;
528 if( pVertOrient
&& pVertOrientRelAsChar
)
530 sal_Int16 nVertOrient
;
531 pVertOrient
->maValue
>>= nVertOrient
;
532 sal_Int16 nVertOrientRel
= 0;
533 pVertOrientRelAsChar
->maValue
>>= nVertOrientRel
;
534 switch( nVertOrient
)
536 case VertOrientation::TOP
:
537 nVertOrient
= nVertOrientRel
;
539 case VertOrientation::CENTER
:
540 switch( nVertOrientRel
)
542 case VertOrientation::CHAR_TOP
:
543 nVertOrient
= VertOrientation::CHAR_CENTER
;
545 case VertOrientation::LINE_TOP
:
546 nVertOrient
= VertOrientation::LINE_CENTER
;
550 case VertOrientation::BOTTOM
:
551 switch( nVertOrientRel
)
553 case VertOrientation::CHAR_TOP
:
554 nVertOrient
= VertOrientation::CHAR_BOTTOM
;
556 case VertOrientation::LINE_TOP
:
557 nVertOrient
= VertOrientation::LINE_BOTTOM
;
562 pVertOrient
->maValue
<<= nVertOrient
;
563 pVertOrientRelAsChar
->mnIndex
= -1;
566 FontDefaultsCheck( pFontFamilyName
,
567 pFontStyleName
, pFontFamily
, pFontPitch
, pFontCharSet
,
568 &pNewFontStyleName
, &pNewFontFamily
, &pNewFontPitch
, &pNewFontCharSet
);
570 FontDefaultsCheck( pFontFamilyNameCJK
,
571 pFontStyleNameCJK
, pFontFamilyCJK
, pFontPitchCJK
, pFontCharSetCJK
,
572 &pNewFontStyleNameCJK
, &pNewFontFamilyCJK
, &pNewFontPitchCJK
, &pNewFontCharSetCJK
);
574 FontDefaultsCheck( pFontFamilyNameCTL
,
575 pFontStyleNameCTL
, pFontFamilyCTL
, pFontPitchCTL
, pFontCharSetCTL
,
576 &pNewFontStyleNameCTL
, &pNewFontFamilyCTL
, &pNewFontPitchCTL
, &pNewFontCharSetCTL
);
578 // #i5775# don't overwrite %transparency with binary transparency
579 if( ( pBackTransparency
!= NULL
) && ( pBackTransparent
!= NULL
) )
581 if( ! *(sal_Bool
*)(pBackTransparent
->maValue
.getValue()) )
582 pBackTransparent
->mnIndex
= -1;
586 // insert newly created properties. This invalidates all iterators!
587 // Most of the pXXX variables in this method are iterators and will be
590 if( pNewFontStyleName
)
592 rProperties
.push_back( *pNewFontStyleName
);
593 delete pNewFontStyleName
;
598 rProperties
.push_back( *pNewFontFamily
);
599 delete pNewFontFamily
;
604 rProperties
.push_back( *pNewFontPitch
);
605 delete pNewFontPitch
;
608 if( pNewFontCharSet
)
610 rProperties
.push_back( *pNewFontCharSet
);
611 delete pNewFontCharSet
;
614 if( pNewFontStyleNameCJK
)
616 rProperties
.push_back( *pNewFontStyleNameCJK
);
617 delete pNewFontStyleNameCJK
;
620 if( pNewFontFamilyCJK
)
622 rProperties
.push_back( *pNewFontFamilyCJK
);
623 delete pNewFontFamilyCJK
;
626 if( pNewFontPitchCJK
)
628 rProperties
.push_back( *pNewFontPitchCJK
);
629 delete pNewFontPitchCJK
;
632 if( pNewFontCharSetCJK
)
634 rProperties
.push_back( *pNewFontCharSetCJK
);
635 delete pNewFontCharSetCJK
;
638 if( pNewFontStyleNameCTL
)
640 rProperties
.push_back( *pNewFontStyleNameCTL
);
641 delete pNewFontStyleNameCTL
;
644 if( pNewFontFamilyCTL
)
646 rProperties
.push_back( *pNewFontFamilyCTL
);
647 delete pNewFontFamilyCTL
;
650 if( pNewFontPitchCTL
)
652 rProperties
.push_back( *pNewFontPitchCTL
);
653 delete pNewFontPitchCTL
;
656 if( pNewFontCharSetCTL
)
658 rProperties
.push_back( *pNewFontCharSetCTL
);
659 delete pNewFontCharSetCTL
;
662 for (sal_uInt16 i
=0; i
<4; i
++)
664 if (pNewParaMargins
[i
].get())
666 rProperties
.push_back(*pNewParaMargins
[i
]);
668 if (pNewMargins
[i
].get())
670 rProperties
.push_back(*pNewMargins
[i
]);
672 if( pNewBorderDistances
[i
] )
674 rProperties
.push_back( *pNewBorderDistances
[i
] );
675 delete pNewBorderDistances
[i
];
679 rProperties
.push_back( *pNewBorders
[i
] );
680 delete pNewBorders
[i
];
686 if( nSizeTypeIndex
== -2 )
688 const_cast < XMLTextImportPropertyMapper
* > ( this )
689 ->nSizeTypeIndex
= -1;
690 sal_Int32 nPropCount
= getPropertySetMapper()->GetEntryCount();
691 for( sal_Int32 j
=0; j
< nPropCount
; j
++ )
693 if( CTF_SIZETYPE
== getPropertySetMapper()
694 ->GetEntryContextId( j
) )
696 const_cast < XMLTextImportPropertyMapper
* > ( this )
697 ->nSizeTypeIndex
= j
;
702 if( nSizeTypeIndex
!= -1 )
704 XMLPropertyState
aSizeTypeState( nSizeTypeIndex
);
705 aSizeTypeState
.maValue
<<= (sal_Int16
)( bHasAnyMinHeight
708 rProperties
.push_back( aSizeTypeState
);
714 if( nWidthTypeIndex
== -2 )
716 const_cast < XMLTextImportPropertyMapper
* > ( this )
717 ->nWidthTypeIndex
= -1;
718 sal_Int32 nCount
= getPropertySetMapper()->GetEntryCount();
719 for( sal_Int32 j
=0; j
< nCount
; j
++ )
721 if( CTF_FRAMEWIDTH_TYPE
== getPropertySetMapper()
722 ->GetEntryContextId( j
) )
724 const_cast < XMLTextImportPropertyMapper
* > ( this )
725 ->nWidthTypeIndex
= j
;
730 if( nWidthTypeIndex
!= -1 )
732 XMLPropertyState
aSizeTypeState( nWidthTypeIndex
);
733 aSizeTypeState
.maValue
<<= (sal_Int16
)( bHasAnyMinWidth
736 rProperties
.push_back( aSizeTypeState
);
740 // DO NOT USE ITERATORS/POINTERS INTO THE rProperties-VECTOR AFTER
741 // THIS LINE. All iterators into the rProperties-vector, especially all
742 // pXXX-type variables set in the first switch statement of this method,
743 // may have been invalidated by the above push_back() calls!
747 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */