1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: txtimppr.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
33 #include <tools/debug.hxx>
34 #include <com/sun/star/awt/FontFamily.hpp>
35 #include <com/sun/star/awt/FontPitch.hpp>
36 #include <com/sun/star/table/BorderLine.hpp>
37 #include <com/sun/star/text/VertOrientation.hpp>
38 #include <com/sun/star/text/SizeType.hpp>
39 #include <tools/string.hxx>
40 #include <xmloff/XMLFontStylesContext.hxx>
41 #include <xmloff/txtprmap.hxx>
42 #include <xmloff/xmlimp.hxx>
43 #include "txtimppr.hxx"
45 #define XML_LINE_LEFT 0
46 #define XML_LINE_RIGHT 1
47 #define XML_LINE_TOP 2
48 #define XML_LINE_BOTTOM 3
49 #define MIN_BORDER_DIST 49
51 using ::rtl::OUString
;
53 using namespace ::com::sun::star
;
54 using namespace ::com::sun::star::uno
;
55 using namespace ::com::sun::star::table
;
56 using namespace ::com::sun::star::text
;
58 sal_Bool
XMLTextImportPropertyMapper::handleSpecialItem(
59 XMLPropertyState
& rProperty
,
60 ::std::vector
< XMLPropertyState
>& rProperties
,
61 const ::rtl::OUString
& rValue
,
62 const SvXMLUnitConverter
& rUnitConverter
,
63 const SvXMLNamespaceMap
& rNamespaceMap
) const
65 sal_Bool bRet
= sal_False
;
66 sal_Int32 nIndex
= rProperty
.mnIndex
;
67 switch( getPropertySetMapper()->GetEntryContextId( nIndex
) )
70 case CTF_FONTNAME_CJK
:
71 case CTF_FONTNAME_CTL
:
75 ( CTF_FONTFAMILYNAME
==
76 getPropertySetMapper()->GetEntryContextId(nIndex
+1) &&
78 getPropertySetMapper()->GetEntryContextId(nIndex
+2) &&
80 getPropertySetMapper()->GetEntryContextId(nIndex
+3) &&
82 getPropertySetMapper()->GetEntryContextId(nIndex
+4) &&
84 getPropertySetMapper()->GetEntryContextId(nIndex
+5) ) ||
85 ( CTF_FONTFAMILYNAME_CJK
==
86 getPropertySetMapper()->GetEntryContextId(nIndex
+1) &&
87 CTF_FONTSTYLENAME_CJK
==
88 getPropertySetMapper()->GetEntryContextId(nIndex
+2) &&
90 getPropertySetMapper()->GetEntryContextId(nIndex
+3) &&
92 getPropertySetMapper()->GetEntryContextId(nIndex
+4) &&
93 CTF_FONTCHARSET_CJK
==
94 getPropertySetMapper()->GetEntryContextId(nIndex
+5) ) ||
95 ( CTF_FONTFAMILYNAME_CTL
==
96 getPropertySetMapper()->GetEntryContextId(nIndex
+1) &&
97 CTF_FONTSTYLENAME_CTL
==
98 getPropertySetMapper()->GetEntryContextId(nIndex
+2) &&
100 getPropertySetMapper()->GetEntryContextId(nIndex
+3) &&
102 getPropertySetMapper()->GetEntryContextId(nIndex
+4) &&
103 CTF_FONTCHARSET_CTL
==
104 getPropertySetMapper()->GetEntryContextId(nIndex
+5) ),
105 "illegal property map" );
107 ((XMLFontStylesContext
*)&xFontDecls
)->FillProperties(
109 rProperty
.mnIndex
+1, rProperty
.mnIndex
+2,
110 rProperty
.mnIndex
+3, rProperty
.mnIndex
+4,
111 rProperty
.mnIndex
+5 );
112 bRet
= sal_False
; // the property hasn't been filled
116 // If we want to do StarMath/StarSymbol font conversion, then we'll
117 // want these special items to be treated just like regular ones...
118 // For the Writer, we'll catch and convert them in _FillPropertySet;
119 // the other apps probably don't care. For the other apps, we just
120 // imitate the default non-special-item mechanism.
121 case CTF_FONTFAMILYNAME
:
122 case CTF_FONTFAMILYNAME_CJK
:
123 case CTF_FONTFAMILYNAME_CTL
:
124 bRet
= getPropertySetMapper()->importXML( rValue
, rProperty
,
128 case CTF_TEXT_DISPLAY
:
129 bRet
= getPropertySetMapper()->importXML( rValue
, rProperty
,
131 if( SvXMLImport::OOo_2x
== GetImport().getGeneratorVersion() )
134 rProperty
.maValue
>>= bHidden
;
136 rProperty
.maValue
<<= bHidden
;
140 bRet
= SvXMLImportPropertyMapper::handleSpecialItem( rProperty
,
141 rProperties
, rValue
, rUnitConverter
, rNamespaceMap
);
148 XMLTextImportPropertyMapper::XMLTextImportPropertyMapper(
149 const UniReference
< XMLPropertySetMapper
>& rMapper
,
151 XMLFontStylesContext
*pFontDecls
) :
152 SvXMLImportPropertyMapper( rMapper
, rImp
),
153 nSizeTypeIndex( -2 ),
154 nWidthTypeIndex( -2 ),
155 xFontDecls( pFontDecls
)
159 XMLTextImportPropertyMapper::~XMLTextImportPropertyMapper()
163 void XMLTextImportPropertyMapper::SetFontDecls(
164 XMLFontStylesContext
*pFontDecls
)
166 xFontDecls
= pFontDecls
;
169 void XMLTextImportPropertyMapper::FontFinished(
170 XMLPropertyState
*pFontFamilyNameState
,
171 XMLPropertyState
*pFontStyleNameState
,
172 XMLPropertyState
*pFontFamilyState
,
173 XMLPropertyState
*pFontPitchState
,
174 XMLPropertyState
*pFontCharsetState
) const
176 if( pFontFamilyNameState
&& pFontFamilyNameState
->mnIndex
!= -1 )
179 pFontFamilyNameState
->maValue
>>= sName
;
180 if( !sName
.getLength() )
181 pFontFamilyNameState
->mnIndex
= -1;
183 if( !pFontFamilyNameState
|| pFontFamilyNameState
->mnIndex
== -1 )
185 if( pFontStyleNameState
)
186 pFontStyleNameState
->mnIndex
= -1;
187 if( pFontFamilyState
)
188 pFontFamilyState
->mnIndex
= -1;
189 if( pFontPitchState
)
190 pFontPitchState
->mnIndex
= -1;
191 if( pFontCharsetState
)
192 pFontCharsetState
->mnIndex
= -1;
196 /** since the properties "CharFontFamilyName", "CharFontStyleName", "CharFontFamily",
197 "CharFontPitch" and "CharFontSet" and theire CJK and CTL counterparts are only
198 usable as a union, we add defaults to all values that are not set as long as we
199 have an "CharFontFamilyName"
202 void XMLTextImportPropertyMapper::FontDefaultsCheck(
203 XMLPropertyState
* pFontFamilyName
,
204 XMLPropertyState
* pFontStyleName
,
205 XMLPropertyState
* pFontFamily
,
206 XMLPropertyState
* pFontPitch
,
207 XMLPropertyState
* pFontCharSet
,
208 XMLPropertyState
** ppNewFontStyleName
,
209 XMLPropertyState
** ppNewFontFamily
,
210 XMLPropertyState
** ppNewFontPitch
,
211 XMLPropertyState
** ppNewFontCharSet
) const
213 if( pFontFamilyName
)
218 if( !pFontStyleName
)
222 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
223 pFontFamilyName
->mnIndex
+ 1 );
224 DBG_ASSERT( nTmp
== CTF_FONTSTYLENAME
|| nTmp
== CTF_FONTSTYLENAME_CJK
|| nTmp
== CTF_FONTSTYLENAME_CTL
,
225 "wrong property context id" );
227 *ppNewFontStyleName
= new XMLPropertyState( pFontFamilyName
->mnIndex
+ 1,
233 aAny
<<= (sal_Int16
)com::sun::star::awt::FontFamily::DONTKNOW
;
236 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
237 pFontFamilyName
->mnIndex
+ 2 );
238 DBG_ASSERT( nTmp
== CTF_FONTFAMILY
|| nTmp
== CTF_FONTFAMILY_CJK
|| nTmp
== CTF_FONTFAMILY_CTL
,
239 "wrong property context id" );
241 *ppNewFontFamily
= new XMLPropertyState( pFontFamilyName
->mnIndex
+ 2,
247 aAny
<<= (sal_Int16
)com::sun::star::awt::FontPitch::DONTKNOW
;
249 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
250 pFontFamilyName
->mnIndex
+ 3 );
251 DBG_ASSERT( nTmp
== CTF_FONTPITCH
|| nTmp
== CTF_FONTPITCH_CJK
|| nTmp
== CTF_FONTPITCH_CTL
,
252 "wrong property context id" );
254 *ppNewFontPitch
= new XMLPropertyState( pFontFamilyName
->mnIndex
+ 3,
260 aAny
<<= (sal_Int16
)gsl_getSystemTextEncoding();
262 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
263 pFontFamilyName
->mnIndex
+ 4 );
264 DBG_ASSERT( nTmp
== CTF_FONTCHARSET
|| nTmp
== CTF_FONTCHARSET_CJK
|| nTmp
== CTF_FONTCHARSET_CTL
,
265 "wrong property context id" );
267 *ppNewFontCharSet
= new XMLPropertyState( pFontFamilyName
->mnIndex
+ 4,
273 void XMLTextImportPropertyMapper::finished(
274 ::std::vector
< XMLPropertyState
>& rProperties
,
275 sal_Int32
/*nStartIndex*/, sal_Int32
/*nEndIndex*/ ) const
277 sal_Bool bHasAnyHeight
= sal_False
;
278 sal_Bool bHasAnyMinHeight
= sal_False
;
279 sal_Bool bHasAnyWidth
= sal_False
;
280 sal_Bool bHasAnyMinWidth
= sal_False
;
282 XMLPropertyState
* pFontFamilyName
= 0;
283 XMLPropertyState
* pFontStyleName
= 0;
284 XMLPropertyState
* pFontFamily
= 0;
285 XMLPropertyState
* pFontPitch
= 0;
286 XMLPropertyState
* pFontCharSet
= 0;
287 XMLPropertyState
* pNewFontStyleName
= 0;
288 XMLPropertyState
* pNewFontFamily
= 0;
289 XMLPropertyState
* pNewFontPitch
= 0;
290 XMLPropertyState
* pNewFontCharSet
= 0;
291 XMLPropertyState
* pFontFamilyNameCJK
= 0;
292 XMLPropertyState
* pFontStyleNameCJK
= 0;
293 XMLPropertyState
* pFontFamilyCJK
= 0;
294 XMLPropertyState
* pFontPitchCJK
= 0;
295 XMLPropertyState
* pFontCharSetCJK
= 0;
296 XMLPropertyState
* pNewFontStyleNameCJK
= 0;
297 XMLPropertyState
* pNewFontFamilyCJK
= 0;
298 XMLPropertyState
* pNewFontPitchCJK
= 0;
299 XMLPropertyState
* pNewFontCharSetCJK
= 0;
300 XMLPropertyState
* pFontFamilyNameCTL
= 0;
301 XMLPropertyState
* pFontStyleNameCTL
= 0;
302 XMLPropertyState
* pFontFamilyCTL
= 0;
303 XMLPropertyState
* pFontPitchCTL
= 0;
304 XMLPropertyState
* pFontCharSetCTL
= 0;
305 XMLPropertyState
* pNewFontStyleNameCTL
= 0;
306 XMLPropertyState
* pNewFontFamilyCTL
= 0;
307 XMLPropertyState
* pNewFontPitchCTL
= 0;
308 XMLPropertyState
* pNewFontCharSetCTL
= 0;
309 XMLPropertyState
* pAllBorderDistance
= 0;
310 XMLPropertyState
* pBorderDistances
[4] = { 0, 0, 0, 0 };
311 XMLPropertyState
* pNewBorderDistances
[4] = { 0, 0, 0, 0 };
312 XMLPropertyState
* pAllBorder
= 0;
313 XMLPropertyState
* pBorders
[4] = { 0, 0, 0, 0 };
314 XMLPropertyState
* pNewBorders
[4] = { 0, 0, 0, 0 };
315 XMLPropertyState
* pAllBorderWidth
= 0;
316 XMLPropertyState
* pBorderWidths
[4] = { 0, 0, 0, 0 };
317 XMLPropertyState
* pAnchorType
= 0;
318 XMLPropertyState
* pVertOrient
= 0;
319 XMLPropertyState
* pVertOrientRelAsChar
= 0;
320 XMLPropertyState
* pBackTransparency
= NULL
; // transparency in %
321 XMLPropertyState
* pBackTransparent
= NULL
; // transparency as boolean
322 sal_uInt16 i
; // for the "for" loop
324 for( ::std::vector
< XMLPropertyState
>::iterator aIter
= rProperties
.begin();
325 aIter
!= rProperties
.end();
328 XMLPropertyState
* property
= &(*aIter
);
329 if( -1 == property
->mnIndex
)
332 switch( getPropertySetMapper()->GetEntryContextId( property
->mnIndex
) )
334 case CTF_FONTFAMILYNAME
: pFontFamilyName
= property
; break;
335 case CTF_FONTSTYLENAME
: pFontStyleName
= property
; break;
336 case CTF_FONTFAMILY
: pFontFamily
= property
; break;
337 case CTF_FONTPITCH
: pFontPitch
= property
; break;
338 case CTF_FONTCHARSET
: pFontCharSet
= property
; break;
340 case CTF_FONTFAMILYNAME_CJK
: pFontFamilyNameCJK
= property
; break;
341 case CTF_FONTSTYLENAME_CJK
: pFontStyleNameCJK
= property
; break;
342 case CTF_FONTFAMILY_CJK
: pFontFamilyCJK
= property
; break;
343 case CTF_FONTPITCH_CJK
: pFontPitchCJK
= property
; break;
344 case CTF_FONTCHARSET_CJK
: pFontCharSetCJK
= property
; break;
346 case CTF_FONTFAMILYNAME_CTL
: pFontFamilyNameCTL
= property
; break;
347 case CTF_FONTSTYLENAME_CTL
: pFontStyleNameCTL
= property
; break;
348 case CTF_FONTFAMILY_CTL
: pFontFamilyCTL
= property
; break;
349 case CTF_FONTPITCH_CTL
: pFontPitchCTL
= property
; break;
350 case CTF_FONTCHARSET_CTL
: pFontCharSetCTL
= property
; break;
352 case CTF_ALLBORDERDISTANCE
: pAllBorderDistance
= property
; break;
353 case CTF_LEFTBORDERDISTANCE
: pBorderDistances
[XML_LINE_LEFT
] = property
; break;
354 case CTF_RIGHTBORDERDISTANCE
: pBorderDistances
[XML_LINE_RIGHT
] = property
; break;
355 case CTF_TOPBORDERDISTANCE
: pBorderDistances
[XML_LINE_TOP
] = property
; break;
356 case CTF_BOTTOMBORDERDISTANCE
: pBorderDistances
[XML_LINE_BOTTOM
] = property
; break;
357 case CTF_ALLBORDER
: pAllBorder
= property
; break;
358 case CTF_LEFTBORDER
: pBorders
[XML_LINE_LEFT
] = property
; break;
359 case CTF_RIGHTBORDER
: pBorders
[XML_LINE_RIGHT
] = property
; break;
360 case CTF_TOPBORDER
: pBorders
[XML_LINE_TOP
] = property
; break;
361 case CTF_BOTTOMBORDER
: pBorders
[XML_LINE_BOTTOM
] = property
; break;
363 case CTF_ALLBORDERWIDTH
: pAllBorderWidth
= property
; break;
364 case CTF_LEFTBORDERWIDTH
: pBorderWidths
[XML_LINE_LEFT
] = property
; break;
365 case CTF_RIGHTBORDERWIDTH
: pBorderWidths
[XML_LINE_RIGHT
] = property
; break;
366 case CTF_TOPBORDERWIDTH
: pBorderWidths
[XML_LINE_TOP
] = property
; break;
367 case CTF_BOTTOMBORDERWIDTH
: pBorderWidths
[XML_LINE_BOTTOM
] = property
; break;
368 case CTF_ANCHORTYPE
: pAnchorType
= property
; break;
369 case CTF_VERTICALPOS
: pVertOrient
= property
; break;
370 case CTF_VERTICALREL_ASCHAR
: pVertOrientRelAsChar
= property
; break;
372 case CTF_FRAMEHEIGHT_MIN_ABS
:
373 case CTF_FRAMEHEIGHT_MIN_REL
:
374 // case CTF_SYNCHEIGHT_MIN:
375 bHasAnyMinHeight
= sal_True
;
377 case CTF_FRAMEHEIGHT_ABS
:
378 case CTF_FRAMEHEIGHT_REL
:
379 // case CTF_SYNCHEIGHT:
380 bHasAnyHeight
= sal_True
; break;
381 case CTF_FRAMEWIDTH_MIN_ABS
:
382 case CTF_FRAMEWIDTH_MIN_REL
:
383 bHasAnyMinWidth
= sal_True
;
385 case CTF_FRAMEWIDTH_ABS
:
386 case CTF_FRAMEWIDTH_REL
:
387 bHasAnyWidth
= sal_True
; break;
388 case CTF_BACKGROUND_TRANSPARENCY
: pBackTransparency
= property
; break;
389 case CTF_BACKGROUND_TRANSPARENT
: pBackTransparent
= property
; break;
394 if( pFontFamilyName
|| pFontStyleName
|| pFontFamily
||
395 pFontPitch
|| pFontCharSet
)
396 FontFinished( pFontFamilyName
, pFontStyleName
, pFontFamily
,
397 pFontPitch
, pFontCharSet
);
398 if( pFontFamilyNameCJK
|| pFontStyleNameCJK
|| pFontFamilyCJK
||
399 pFontPitchCJK
|| pFontCharSetCJK
)
400 FontFinished( pFontFamilyNameCJK
, pFontStyleNameCJK
, pFontFamilyCJK
,
401 pFontPitchCJK
, pFontCharSetCJK
);
402 if( pFontFamilyNameCTL
|| pFontStyleNameCTL
|| pFontFamilyCTL
||
403 pFontPitchCTL
|| pFontCharSetCTL
)
404 FontFinished( pFontFamilyNameCTL
, pFontStyleNameCTL
, pFontFamilyCTL
,
405 pFontPitchCTL
, pFontCharSetCTL
);
407 for( i
= 0; i
< 4; i
++ )
409 if( pAllBorderDistance
&& !pBorderDistances
[i
] )
412 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
413 pAllBorderDistance
->mnIndex
+ i
+ 1 );
414 DBG_ASSERT( nTmp
>= CTF_LEFTBORDERDISTANCE
&&
415 nTmp
<= CTF_BOTTOMBORDERDISTANCE
,
416 "wrong property context id" );
418 pNewBorderDistances
[i
] =
419 new XMLPropertyState( pAllBorderDistance
->mnIndex
+ i
+ 1,
420 pAllBorderDistance
->maValue
);
421 pBorderDistances
[i
] = pNewBorderDistances
[i
];
423 if( pAllBorder
&& !pBorders
[i
] )
426 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
427 pAllBorder
->mnIndex
+ i
+ 1 );
428 DBG_ASSERT( nTmp
>= CTF_LEFTBORDER
&& nTmp
<= CTF_BOTTOMBORDER
,
429 "wrong property context id" );
431 pNewBorders
[i
] = new XMLPropertyState( pAllBorder
->mnIndex
+ i
+ 1,
432 pAllBorder
->maValue
);
433 pBorders
[i
] = pNewBorders
[i
];
435 if( !pBorderWidths
[i
] )
436 pBorderWidths
[i
] = pAllBorderWidth
;
438 pBorderWidths
[i
]->mnIndex
= -1;
440 #ifdef XML_CHECK_UI_CONSTRAINS
441 sal_Bool bHasBorder
= sal_False
;
444 table::BorderLine aBorderLine
;
445 pBorders
[i
]->maValue
>>= aBorderLine
;
447 if( pBorderWidths
[i
] )
449 table::BorderLine aBorderLineWidth
;
450 pBorderWidths
[i
]->maValue
>>= aBorderLineWidth
;
451 aBorderLine
.OuterLineWidth
= aBorderLineWidth
.OuterLineWidth
;
452 aBorderLine
.InnerLineWidth
= aBorderLineWidth
.InnerLineWidth
;
453 aBorderLine
.LineDistance
= aBorderLineWidth
.LineDistance
;
455 pBorders
[i
]->maValue
<<= aBorderLine
;
457 bHasBorder
= (aBorderLine
.OuterLineWidth
+
458 aBorderLine
.InnerLineWidth
) > 0;
462 if( !pBorderDistances
[i
] )
465 sal_Int16 nTmp
= getPropertySetMapper()->GetEntryContextId(
466 pBorders
[i
]->mnIndex
+ 5 );
467 DBG_ASSERT( nTmp
>= CTF_LEFTBORDERDISTANCE
&&
468 nTmp
<= CTF_BOTTOMBORDERDISTANCE
,
469 "wrong property context id" );
472 pNewBorderDistances
[i
] =
473 new XMLPropertyState( pBorders
[i
]->mnIndex
+ 5 );
474 pNewBorderDistances
[i
]->maValue
<<= (sal_Int32
)MIN_BORDER_DIST
;
475 pBorderDistances
[i
] = pNewBorderDistances
[i
];
480 pBorderDistances
[i
]->maValue
>>= nDist
;
481 if( nDist
< MIN_BORDER_DIST
)
482 pBorderDistances
[i
]->maValue
<<= (sal_Int32
)MIN_BORDER_DIST
;
487 if( pBorderDistances
[i
] )
490 pBorderDistances
[i
]->maValue
>>= nDist
;
492 pBorderDistances
[i
]->maValue
<<= (sal_Int32
)0;
496 if( pBorders
[i
] && pBorderWidths
[i
] )
498 table::BorderLine aBorderLine
;
499 pBorders
[i
]->maValue
>>= aBorderLine
;
501 table::BorderLine aBorderLineWidth
;
502 pBorderWidths
[i
]->maValue
>>= aBorderLineWidth
;
504 aBorderLine
.OuterLineWidth
= aBorderLineWidth
.OuterLineWidth
;
505 aBorderLine
.InnerLineWidth
= aBorderLineWidth
.InnerLineWidth
;
506 aBorderLine
.LineDistance
= aBorderLineWidth
.LineDistance
;
508 pBorders
[i
]->maValue
<<= aBorderLine
;
512 if( pAllBorderDistance
)
513 pAllBorderDistance
->mnIndex
= -1;
516 pAllBorder
->mnIndex
= -1;
518 if( pAllBorderWidth
)
519 pAllBorderWidth
->mnIndex
= -1;
521 if( pVertOrient
&& pVertOrientRelAsChar
)
523 sal_Int16 nVertOrient
;
524 pVertOrient
->maValue
>>= nVertOrient
;
525 sal_Int16 nVertOrientRel
= 0;
526 pVertOrientRelAsChar
->maValue
>>= nVertOrientRel
;
527 switch( nVertOrient
)
529 case VertOrientation::TOP
:
530 nVertOrient
= nVertOrientRel
;
532 case VertOrientation::CENTER
:
533 switch( nVertOrientRel
)
535 case VertOrientation::CHAR_TOP
:
536 nVertOrient
= VertOrientation::CHAR_CENTER
;
538 case VertOrientation::LINE_TOP
:
539 nVertOrient
= VertOrientation::LINE_CENTER
;
543 case VertOrientation::BOTTOM
:
544 switch( nVertOrientRel
)
546 case VertOrientation::CHAR_TOP
:
547 nVertOrient
= VertOrientation::CHAR_BOTTOM
;
549 case VertOrientation::LINE_TOP
:
550 nVertOrient
= VertOrientation::LINE_BOTTOM
;
555 pVertOrient
->maValue
<<= nVertOrient
;
556 pVertOrientRelAsChar
->mnIndex
= -1;
559 FontDefaultsCheck( pFontFamilyName
,
560 pFontStyleName
, pFontFamily
, pFontPitch
, pFontCharSet
,
561 &pNewFontStyleName
, &pNewFontFamily
, &pNewFontPitch
, &pNewFontCharSet
);
563 FontDefaultsCheck( pFontFamilyNameCJK
,
564 pFontStyleNameCJK
, pFontFamilyCJK
, pFontPitchCJK
, pFontCharSetCJK
,
565 &pNewFontStyleNameCJK
, &pNewFontFamilyCJK
, &pNewFontPitchCJK
, &pNewFontCharSetCJK
);
567 FontDefaultsCheck( pFontFamilyNameCTL
,
568 pFontStyleNameCTL
, pFontFamilyCTL
, pFontPitchCTL
, pFontCharSetCTL
,
569 &pNewFontStyleNameCTL
, &pNewFontFamilyCTL
, &pNewFontPitchCTL
, &pNewFontCharSetCTL
);
571 // #i5775# don't overwrite %transparency with binary transparency
572 if( ( pBackTransparency
!= NULL
) && ( pBackTransparent
!= NULL
) )
574 if( ! *(sal_Bool
*)(pBackTransparent
->maValue
.getValue()) )
575 pBackTransparent
->mnIndex
= -1;
579 // insert newly created properties. This inavlidates all iterators!
580 // Most of the pXXX variables in this method are iterators and will be
583 if( pNewFontStyleName
)
585 rProperties
.push_back( *pNewFontStyleName
);
586 delete pNewFontStyleName
;
591 rProperties
.push_back( *pNewFontFamily
);
592 delete pNewFontFamily
;
597 rProperties
.push_back( *pNewFontPitch
);
598 delete pNewFontPitch
;
601 if( pNewFontCharSet
)
603 rProperties
.push_back( *pNewFontCharSet
);
604 delete pNewFontCharSet
;
607 if( pNewFontStyleNameCJK
)
609 rProperties
.push_back( *pNewFontStyleNameCJK
);
610 delete pNewFontStyleNameCJK
;
613 if( pNewFontFamilyCJK
)
615 rProperties
.push_back( *pNewFontFamilyCJK
);
616 delete pNewFontFamilyCJK
;
619 if( pNewFontPitchCJK
)
621 rProperties
.push_back( *pNewFontPitchCJK
);
622 delete pNewFontPitchCJK
;
625 if( pNewFontCharSetCJK
)
627 rProperties
.push_back( *pNewFontCharSetCJK
);
628 delete pNewFontCharSetCJK
;
631 if( pNewFontStyleNameCTL
)
633 rProperties
.push_back( *pNewFontStyleNameCTL
);
634 delete pNewFontStyleNameCTL
;
637 if( pNewFontFamilyCTL
)
639 rProperties
.push_back( *pNewFontFamilyCTL
);
640 delete pNewFontFamilyCTL
;
643 if( pNewFontPitchCTL
)
645 rProperties
.push_back( *pNewFontPitchCTL
);
646 delete pNewFontPitchCTL
;
649 if( pNewFontCharSetCTL
)
651 rProperties
.push_back( *pNewFontCharSetCTL
);
652 delete pNewFontCharSetCTL
;
657 if( pNewBorderDistances
[i
] )
659 rProperties
.push_back( *pNewBorderDistances
[i
] );
660 delete pNewBorderDistances
[i
];
664 rProperties
.push_back( *pNewBorders
[i
] );
665 delete pNewBorders
[i
];
671 if( nSizeTypeIndex
== -2 )
673 const_cast < XMLTextImportPropertyMapper
* > ( this )
674 ->nSizeTypeIndex
= -1;
675 sal_Int32 nPropCount
= getPropertySetMapper()->GetEntryCount();
676 for( sal_Int32 j
=0; j
< nPropCount
; j
++ )
678 if( CTF_SIZETYPE
== getPropertySetMapper()
679 ->GetEntryContextId( j
) )
681 const_cast < XMLTextImportPropertyMapper
* > ( this )
682 ->nSizeTypeIndex
= j
;
687 if( nSizeTypeIndex
!= -1 )
689 XMLPropertyState
aSizeTypeState( nSizeTypeIndex
);
690 aSizeTypeState
.maValue
<<= (sal_Int16
)( bHasAnyMinHeight
693 rProperties
.push_back( aSizeTypeState
);
699 if( nWidthTypeIndex
== -2 )
701 const_cast < XMLTextImportPropertyMapper
* > ( this )
702 ->nWidthTypeIndex
= -1;
703 sal_Int32 nCount
= getPropertySetMapper()->GetEntryCount();
704 for( sal_Int32 j
=0; j
< nCount
; j
++ )
706 if( CTF_FRAMEWIDTH_TYPE
== getPropertySetMapper()
707 ->GetEntryContextId( j
) )
709 const_cast < XMLTextImportPropertyMapper
* > ( this )
710 ->nWidthTypeIndex
= j
;
715 if( nWidthTypeIndex
!= -1 )
717 XMLPropertyState
aSizeTypeState( nWidthTypeIndex
);
718 aSizeTypeState
.maValue
<<= (sal_Int16
)( bHasAnyMinWidth
721 rProperties
.push_back( aSizeTypeState
);
725 // DO NOT USE ITERATORS/POINTERS INTO THE rProperties-VECTOR AFTER
726 // THIS LINE. All iterators into the rProperties-vector, especially all
727 // pXXX-type variables set in the first switch statement of this method,
728 // may have been invalidated by the above push_back() calls!