Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <com/sun/star/table/BorderLine2.hpp>
21 :
22 : #include "txtexppr.hxx"
23 :
24 : #include <com/sun/star/text/SizeType.hpp>
25 : #include <com/sun/star/text/WrapTextMode.hpp>
26 : #include <com/sun/star/text/TextContentAnchorType.hpp>
27 : #include <com/sun/star/awt/FontUnderline.hpp>
28 : #include <com/sun/star/text/XChapterNumberingSupplier.hpp>
29 :
30 : #include <tools/debug.hxx>
31 :
32 : #include <xmloff/txtprmap.hxx>
33 : #include <xmloff/xmlexp.hxx>
34 : #include "XMLSectionFootnoteConfigExport.hxx"
35 :
36 :
37 : using namespace ::com::sun::star;
38 : using namespace ::com::sun::star::uno;
39 : using namespace ::com::sun::star::style;
40 : using namespace ::com::sun::star::beans;
41 : using namespace ::com::sun::star::text;
42 :
43 69 : void XMLTextExportPropertySetMapper::handleElementItem(
44 : SvXMLExport& rExp,
45 : const XMLPropertyState& rProperty,
46 : sal_uInt16 nFlags,
47 : const ::std::vector< XMLPropertyState > *pProperties,
48 : sal_uInt32 nIdx ) const
49 : {
50 : XMLTextExportPropertySetMapper *pThis =
51 69 : ((XMLTextExportPropertySetMapper *)this);
52 :
53 69 : switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
54 : {
55 : case CTF_DROPCAPFORMAT:
56 : pThis->maDropCapExport.exportXML( rProperty.maValue, bDropWholeWord,
57 2 : sDropCharStyle );
58 2 : pThis->bDropWholeWord = sal_False;
59 2 : pThis->sDropCharStyle = OUString();
60 2 : break;
61 :
62 : case CTF_TABSTOP:
63 54 : pThis->maTabStopExport.Export( rProperty.maValue );
64 54 : break;
65 :
66 : case CTF_TEXTCOLUMNS:
67 5 : pThis->maTextColumnsExport.exportXML( rProperty.maValue );
68 5 : break;
69 :
70 : case CTF_BACKGROUND_URL:
71 : {
72 : DBG_ASSERT( pProperties && nIdx >= 3,
73 : "property vector missing" );
74 8 : const Any *pPos = 0, *pFilter = 0, *pTrans = 0;
75 8 : if( pProperties && nIdx >= 3 )
76 : {
77 8 : const XMLPropertyState& rTrans = (*pProperties)[nIdx-3];
78 : // #99657# transparency may be there, but doesn't have to be.
79 : // If it's there, it must be in the right position.
80 16 : if( CTF_BACKGROUND_TRANSPARENCY == getPropertySetMapper()
81 16 : ->GetEntryContextId( rTrans.mnIndex ) )
82 7 : pTrans = &rTrans.maValue;
83 :
84 8 : const XMLPropertyState& rPos = (*pProperties)[nIdx-2];
85 : DBG_ASSERT( CTF_BACKGROUND_POS == getPropertySetMapper()
86 : ->GetEntryContextId( rPos.mnIndex ),
87 : "invalid property map: pos expected" );
88 16 : if( CTF_BACKGROUND_POS == getPropertySetMapper()
89 16 : ->GetEntryContextId( rPos.mnIndex ) )
90 8 : pPos = &rPos.maValue;
91 :
92 8 : const XMLPropertyState& rFilter = (*pProperties)[nIdx-1];
93 : DBG_ASSERT( CTF_BACKGROUND_FILTER == getPropertySetMapper()
94 : ->GetEntryContextId( rFilter.mnIndex ),
95 : "invalid property map: filter expected" );
96 16 : if( CTF_BACKGROUND_FILTER == getPropertySetMapper()
97 16 : ->GetEntryContextId( rFilter.mnIndex ) )
98 8 : pFilter = &rFilter.maValue;
99 : }
100 8 : sal_uInt32 nPropIndex = rProperty.mnIndex;
101 : pThis->maBackgroundImageExport.exportXML(
102 : rProperty.maValue, pPos, pFilter, pTrans,
103 8 : getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
104 16 : getPropertySetMapper()->GetEntryXMLName( nPropIndex ) );
105 : }
106 8 : break;
107 :
108 : case CTF_SECTION_FOOTNOTE_END:
109 : XMLSectionFootnoteConfigExport::exportXML(rExp, sal_False,
110 : pProperties, nIdx,
111 0 : getPropertySetMapper());
112 0 : break;
113 :
114 : case CTF_SECTION_ENDNOTE_END:
115 : XMLSectionFootnoteConfigExport::exportXML(rExp, sal_True,
116 : pProperties, nIdx,
117 0 : getPropertySetMapper());
118 0 : break;
119 :
120 : default:
121 0 : SvXMLExportPropertyMapper::handleElementItem( rExp, rProperty, nFlags, pProperties, nIdx );
122 0 : break;
123 : }
124 69 : }
125 :
126 39 : void XMLTextExportPropertySetMapper::handleSpecialItem(
127 : SvXMLAttributeList& rAttrList,
128 : const XMLPropertyState& rProperty,
129 : const SvXMLUnitConverter& rUnitConverter,
130 : const SvXMLNamespaceMap& rNamespaceMap,
131 : const ::std::vector< XMLPropertyState > *pProperties,
132 : sal_uInt32 nIdx ) const
133 : {
134 : XMLTextExportPropertySetMapper *pThis =
135 39 : ((XMLTextExportPropertySetMapper *)this);
136 :
137 39 : switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
138 : {
139 : case CTF_DROPCAPWHOLEWORD:
140 : DBG_ASSERT( !bDropWholeWord, "drop whole word is set already!" );
141 2 : pThis->bDropWholeWord = *(sal_Bool *)rProperty.maValue.getValue();
142 2 : break;
143 : case CTF_DROPCAPCHARSTYLE:
144 : DBG_ASSERT( sDropCharStyle.isEmpty(), "drop char style is set already!" );
145 2 : rProperty.maValue >>= pThis->sDropCharStyle;
146 2 : break;
147 : case CTF_NUMBERINGSTYLENAME:
148 : case CTF_PAGEDESCNAME:
149 : case CTF_OLDTEXTBACKGROUND:
150 : case CTF_BACKGROUND_POS:
151 : case CTF_BACKGROUND_FILTER:
152 : case CTF_BACKGROUND_TRANSPARENCY:
153 : case CTF_SECTION_FOOTNOTE_NUM_OWN:
154 : case CTF_SECTION_FOOTNOTE_NUM_RESTART:
155 : case CTF_SECTION_FOOTNOTE_NUM_RESTART_AT:
156 : case CTF_SECTION_FOOTNOTE_NUM_TYPE:
157 : case CTF_SECTION_FOOTNOTE_NUM_PREFIX:
158 : case CTF_SECTION_FOOTNOTE_NUM_SUFFIX:
159 : case CTF_SECTION_ENDNOTE_NUM_OWN:
160 : case CTF_SECTION_ENDNOTE_NUM_RESTART:
161 : case CTF_SECTION_ENDNOTE_NUM_RESTART_AT:
162 : case CTF_SECTION_ENDNOTE_NUM_TYPE:
163 : case CTF_SECTION_ENDNOTE_NUM_PREFIX:
164 : case CTF_SECTION_ENDNOTE_NUM_SUFFIX:
165 : case CTF_DEFAULT_OUTLINE_LEVEL:
166 : case CTF_OLD_FLOW_WITH_TEXT:
167 : // There's nothing to do here!
168 35 : break;
169 : default:
170 0 : SvXMLExportPropertyMapper::handleSpecialItem(rAttrList, rProperty, rUnitConverter, rNamespaceMap, pProperties, nIdx );
171 0 : break;
172 : }
173 39 : }
174 :
175 4486 : XMLTextExportPropertySetMapper::XMLTextExportPropertySetMapper(
176 : const UniReference< XMLPropertySetMapper >& rMapper,
177 : SvXMLExport& rExp ) :
178 : SvXMLExportPropertyMapper( rMapper ),
179 : rExport( rExp ),
180 : bDropWholeWord( sal_False ),
181 : maDropCapExport( rExp ),
182 : maTabStopExport( rExp ),
183 : maTextColumnsExport( rExp ),
184 4486 : maBackgroundImageExport( rExp )
185 : {
186 4486 : }
187 :
188 8962 : XMLTextExportPropertySetMapper::~XMLTextExportPropertySetMapper()
189 : {
190 8962 : }
191 :
192 2532 : void XMLTextExportPropertySetMapper::ContextFontFilter(
193 : bool bEnableFoFontFamily,
194 : XMLPropertyState *pFontNameState,
195 : XMLPropertyState *pFontFamilyNameState,
196 : XMLPropertyState *pFontStyleNameState,
197 : XMLPropertyState *pFontFamilyState,
198 : XMLPropertyState *pFontPitchState,
199 : XMLPropertyState *pFontCharsetState ) const
200 : {
201 2532 : OUString sFamilyName;
202 5064 : OUString sStyleName;
203 2532 : FontFamily nFamily = FAMILY_DONTKNOW;
204 2532 : FontPitch nPitch = PITCH_DONTKNOW;
205 2532 : rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
206 :
207 5064 : OUString sTmp;
208 2532 : if( pFontFamilyNameState && (pFontFamilyNameState->maValue >>= sTmp ) )
209 2393 : sFamilyName = sTmp;
210 2532 : if( pFontStyleNameState && (pFontStyleNameState->maValue >>= sTmp ) )
211 659 : sStyleName = sTmp;
212 :
213 2532 : sal_Int16 nTmp = sal_Int16();
214 2532 : if( pFontFamilyState && (pFontFamilyState->maValue >>= nTmp ) )
215 2393 : nFamily = static_cast< FontFamily >( nTmp );
216 2532 : if( pFontPitchState && (pFontPitchState->maValue >>= nTmp ) )
217 2393 : nPitch = static_cast< FontPitch >( nTmp );
218 2532 : if( pFontCharsetState && (pFontCharsetState->maValue >>= nTmp ) )
219 725 : eEnc = (rtl_TextEncoding)nTmp;
220 :
221 : //Resolves: fdo#67665 The purpose here appears to be to replace
222 : //FontFamilyName and FontStyleName etc with a single FontName property. The
223 : //problem is that repeated calls to here will first set
224 : //pFontFamilyNameState->mnIndex to -1 to indicate it is disabled, so the
225 : //next time pFontFamilyNameState is not passed here at all, which gives an
226 : //empty sFamilyName resulting in disabling pFontNameState->mnIndex to -1.
227 : //That doesn't seem right to me.
228 :
229 : //So assuming that the main purpose is just to convert the properties in
230 : //the main when we can, and to leave them alone when we can't. And with a
231 : //secondary purpose to filter out empty font properties, then is would
232 : //appear to make sense to base attempting the conversion if we have
233 : //both of the major facts of the font description
234 :
235 : //An alternative solution is to *not* fill the FontAutoStylePool with
236 : //every font in the document, but to partition the fonts into the
237 : //hard-attribute fonts which go into that pool and the style-attribute
238 : //fonts which go into some additional pool which get merged just for
239 : //the purposes of writing the embedded fonts but are not queried by
240 : //"Find" which restores the original logic.
241 2532 : if (pFontFamilyNameState || pFontStyleNameState)
242 : {
243 2393 : OUString sName( ((SvXMLExport&)GetExport()).GetFontAutoStylePool()->Find(
244 4786 : sFamilyName, sStyleName, nFamily, nPitch, eEnc ) );
245 2393 : if (!sName.isEmpty())
246 : {
247 720 : pFontNameState->maValue <<= sName;
248 : //Resolves: fdo#68431 style:font-name unrecognized by LibreOffice
249 : //<= 4.1 in styles (but recognized in autostyles) so add
250 : //fo:font-family, etc
251 720 : if (!bEnableFoFontFamily)
252 : {
253 284 : if( pFontFamilyNameState )
254 284 : pFontFamilyNameState->mnIndex = -1;
255 284 : if( pFontStyleNameState )
256 284 : pFontStyleNameState->mnIndex = -1;
257 284 : if( pFontFamilyState )
258 284 : pFontFamilyState->mnIndex = -1;
259 284 : if( pFontPitchState )
260 284 : pFontPitchState->mnIndex = -1;
261 284 : if( pFontCharsetState )
262 284 : pFontCharsetState->mnIndex = -1;
263 : }
264 : }
265 : else
266 : {
267 1673 : pFontNameState->mnIndex = -1;
268 2393 : }
269 : }
270 :
271 2532 : if( pFontFamilyNameState && sFamilyName.isEmpty() )
272 : {
273 2 : pFontFamilyNameState->mnIndex = -1;
274 : }
275 :
276 2532 : if( pFontStyleNameState && sStyleName.isEmpty() )
277 : {
278 659 : pFontStyleNameState->mnIndex = -1;
279 2532 : }
280 2532 : }
281 :
282 333 : void XMLTextExportPropertySetMapper::ContextFontHeightFilter(
283 : XMLPropertyState* pCharHeightState,
284 : XMLPropertyState* pCharPropHeightState,
285 : XMLPropertyState* pCharDiffHeightState ) const
286 : {
287 333 : if( pCharPropHeightState )
288 : {
289 333 : sal_Int32 nTemp = 0;
290 333 : pCharPropHeightState->maValue >>= nTemp;
291 333 : if( nTemp == 100 )
292 : {
293 333 : pCharPropHeightState->mnIndex = -1;
294 333 : pCharPropHeightState->maValue.clear();
295 : }
296 : else
297 : {
298 0 : pCharHeightState->mnIndex = -1;
299 0 : pCharHeightState->maValue.clear();
300 : }
301 : }
302 333 : if( pCharDiffHeightState )
303 : {
304 333 : float nTemp = 0;
305 333 : pCharDiffHeightState->maValue >>= nTemp;
306 333 : if( nTemp == 0. )
307 : {
308 333 : pCharDiffHeightState->mnIndex = -1;
309 333 : pCharDiffHeightState->maValue.clear();
310 : }
311 : else
312 : {
313 0 : pCharHeightState->mnIndex = -1;
314 0 : pCharHeightState->maValue.clear();
315 : }
316 : }
317 :
318 333 : }
319 :
320 : namespace {
321 :
322 : // helper method; implementation below
323 : static bool lcl_IsOutlineStyle(const SvXMLExport&, const OUString&);
324 :
325 : static void
326 31820 : lcl_checkMultiProperty(XMLPropertyState *const pState,
327 : XMLPropertyState *const pRelState)
328 : {
329 31820 : if (pState && pRelState)
330 : {
331 179 : sal_Int32 nTemp = 0;
332 179 : pRelState->maValue >>= nTemp;
333 179 : if (100 == nTemp)
334 : {
335 179 : pRelState->mnIndex = -1;
336 179 : pRelState->maValue.clear();
337 : }
338 : else
339 : {
340 0 : pState->mnIndex = -1;
341 0 : pState->maValue.clear();
342 : }
343 : }
344 31820 : }
345 :
346 : /**
347 : * Filter context of paragraph and character borders.
348 : * Compress border attriubtes. If one of groupable attributes (border type, border width, padding)
349 : * is equal for all four side then just one general attribute will be exported.
350 : **/
351 12728 : static void lcl_FilterBorders(
352 : XMLPropertyState* pAllBorderWidthState, XMLPropertyState* pLeftBorderWidthState,
353 : XMLPropertyState* pRightBorderWidthState, XMLPropertyState* pTopBorderWidthState,
354 : XMLPropertyState* pBottomBorderWidthState, XMLPropertyState* pAllBorderDistanceState,
355 : XMLPropertyState* pLeftBorderDistanceState, XMLPropertyState* pRightBorderDistanceState,
356 : XMLPropertyState* pTopBorderDistanceState, XMLPropertyState* pBottomBorderDistanceState,
357 : XMLPropertyState* pAllBorderState, XMLPropertyState* pLeftBorderState,
358 : XMLPropertyState* pRightBorderState,XMLPropertyState* pTopBorderState,
359 : XMLPropertyState* pBottomBorderState )
360 : {
361 12728 : if( pAllBorderWidthState )
362 : {
363 29 : if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState )
364 : {
365 29 : table::BorderLine2 aLeft, aRight, aTop, aBottom;
366 :
367 29 : pLeftBorderWidthState->maValue >>= aLeft;
368 29 : pRightBorderWidthState->maValue >>= aRight;
369 29 : pTopBorderWidthState->maValue >>= aTop;
370 29 : pBottomBorderWidthState->maValue >>= aBottom;
371 57 : if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
372 84 : aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
373 56 : aLeft.LineStyle == aRight.LineStyle &&
374 56 : aLeft.LineWidth == aRight.LineWidth &&
375 84 : aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
376 84 : aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
377 56 : aLeft.LineStyle == aTop.LineStyle &&
378 56 : aLeft.LineWidth == aTop.LineWidth &&
379 84 : aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
380 84 : aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance &&
381 56 : aLeft.LineStyle == aBottom.LineStyle &&
382 28 : aLeft.LineWidth == aBottom.LineWidth )
383 : {
384 28 : pLeftBorderWidthState->mnIndex = -1;
385 28 : pLeftBorderWidthState->maValue.clear();
386 28 : pRightBorderWidthState->mnIndex = -1;
387 28 : pRightBorderWidthState->maValue.clear();
388 28 : pTopBorderWidthState->mnIndex = -1;
389 28 : pTopBorderWidthState->maValue.clear();
390 28 : pBottomBorderWidthState->mnIndex = -1;
391 28 : pBottomBorderWidthState->maValue.clear();
392 : }
393 : else
394 : {
395 1 : pAllBorderWidthState->mnIndex = -1;
396 1 : pAllBorderWidthState->maValue.clear();
397 29 : }
398 : }
399 : else
400 : {
401 0 : pAllBorderWidthState->mnIndex = -1;
402 0 : pAllBorderWidthState->maValue.clear();
403 : }
404 : }
405 :
406 12728 : if( pAllBorderDistanceState )
407 : {
408 29 : if( pLeftBorderDistanceState && pRightBorderDistanceState && pTopBorderDistanceState && pBottomBorderDistanceState )
409 : {
410 29 : sal_Int32 aLeft = 0, aRight = 0, aTop = 0, aBottom = 0;
411 :
412 29 : pLeftBorderDistanceState->maValue >>= aLeft;
413 29 : pRightBorderDistanceState->maValue >>= aRight;
414 29 : pTopBorderDistanceState->maValue >>= aTop;
415 29 : pBottomBorderDistanceState->maValue >>= aBottom;
416 29 : if( aLeft == aRight && aLeft == aTop && aLeft == aBottom )
417 : {
418 14 : pLeftBorderDistanceState->mnIndex = -1;
419 14 : pLeftBorderDistanceState->maValue.clear();
420 14 : pRightBorderDistanceState->mnIndex = -1;
421 14 : pRightBorderDistanceState->maValue.clear();
422 14 : pTopBorderDistanceState->mnIndex = -1;
423 14 : pTopBorderDistanceState->maValue.clear();
424 14 : pBottomBorderDistanceState->mnIndex = -1;
425 14 : pBottomBorderDistanceState->maValue.clear();
426 : }
427 : else
428 : {
429 15 : pAllBorderDistanceState->mnIndex = -1;
430 15 : pAllBorderDistanceState->maValue.clear();
431 29 : }
432 : }
433 : else
434 : {
435 0 : pAllBorderDistanceState->mnIndex = -1;
436 0 : pAllBorderDistanceState->maValue.clear();
437 : }
438 : }
439 :
440 12728 : if( pAllBorderState )
441 : {
442 29 : if( pLeftBorderState && pRightBorderState && pTopBorderState && pBottomBorderState )
443 : {
444 29 : table::BorderLine2 aLeft, aRight, aTop, aBottom;
445 :
446 29 : pLeftBorderState->maValue >>= aLeft;
447 29 : pRightBorderState->maValue >>= aRight;
448 29 : pTopBorderState->maValue >>= aTop;
449 29 : pBottomBorderState->maValue >>= aBottom;
450 57 : if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
451 84 : aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
452 56 : aLeft.LineStyle == aRight.LineStyle &&
453 56 : aLeft.LineWidth == aRight.LineWidth &&
454 84 : aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
455 84 : aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
456 56 : aLeft.LineStyle == aTop.LineStyle &&
457 56 : aLeft.LineWidth == aTop.LineWidth &&
458 84 : aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
459 84 : aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance &&
460 56 : aLeft.LineWidth == aBottom.LineWidth &&
461 28 : aLeft.LineStyle == aBottom.LineStyle )
462 : {
463 28 : pLeftBorderState->mnIndex = -1;
464 28 : pLeftBorderState->maValue.clear();
465 28 : pRightBorderState->mnIndex = -1;
466 28 : pRightBorderState->maValue.clear();
467 28 : pTopBorderState->mnIndex = -1;
468 28 : pTopBorderState->maValue.clear();
469 28 : pBottomBorderState->mnIndex = -1;
470 28 : pBottomBorderState->maValue.clear();
471 : }
472 : else
473 : {
474 1 : pAllBorderState->mnIndex = -1;
475 1 : pAllBorderState->maValue.clear();
476 29 : }
477 : }
478 : else
479 : {
480 0 : pAllBorderState->mnIndex = -1;
481 0 : pAllBorderState->maValue.clear();
482 : }
483 : }
484 12728 : }
485 :
486 : }
487 :
488 6364 : void XMLTextExportPropertySetMapper::ContextFilter(
489 : bool bEnableFoFontFamily,
490 : ::std::vector< XMLPropertyState >& rProperties,
491 : Reference< XPropertySet > rPropSet ) const
492 : {
493 : // filter font
494 6364 : XMLPropertyState *pFontNameState = 0;
495 6364 : XMLPropertyState *pFontFamilyNameState = 0;
496 6364 : XMLPropertyState *pFontStyleNameState = 0;
497 6364 : XMLPropertyState *pFontFamilyState = 0;
498 6364 : XMLPropertyState *pFontPitchState = 0;
499 6364 : XMLPropertyState *pFontCharsetState = 0;
500 6364 : XMLPropertyState *pFontNameCJKState = 0;
501 6364 : XMLPropertyState *pFontFamilyNameCJKState = 0;
502 6364 : XMLPropertyState *pFontStyleNameCJKState = 0;
503 6364 : XMLPropertyState *pFontFamilyCJKState = 0;
504 6364 : XMLPropertyState *pFontPitchCJKState = 0;
505 6364 : XMLPropertyState *pFontCharsetCJKState = 0;
506 6364 : XMLPropertyState *pFontNameCTLState = 0;
507 6364 : XMLPropertyState *pFontFamilyNameCTLState = 0;
508 6364 : XMLPropertyState *pFontStyleNameCTLState = 0;
509 6364 : XMLPropertyState *pFontFamilyCTLState = 0;
510 6364 : XMLPropertyState *pFontPitchCTLState = 0;
511 6364 : XMLPropertyState *pFontCharsetCTLState = 0;
512 :
513 : // filter char height point/percent
514 6364 : XMLPropertyState* pCharHeightState = NULL;
515 6364 : XMLPropertyState* pCharPropHeightState = NULL;
516 6364 : XMLPropertyState* pCharDiffHeightState = NULL;
517 6364 : XMLPropertyState* pCharHeightCJKState = NULL;
518 6364 : XMLPropertyState* pCharPropHeightCJKState = NULL;
519 6364 : XMLPropertyState* pCharDiffHeightCJKState = NULL;
520 6364 : XMLPropertyState* pCharHeightCTLState = NULL;
521 6364 : XMLPropertyState* pCharPropHeightCTLState = NULL;
522 6364 : XMLPropertyState* pCharDiffHeightCTLState = NULL;
523 :
524 : // filter left margin measure/percent
525 6364 : XMLPropertyState* pParaLeftMarginState = NULL;
526 6364 : XMLPropertyState* pParaLeftMarginRelState = NULL;
527 :
528 : // filter right margin measure/percent
529 6364 : XMLPropertyState* pParaRightMarginState = NULL;
530 6364 : XMLPropertyState* pParaRightMarginRelState = NULL;
531 :
532 : // filter first line indent measure/percent
533 6364 : XMLPropertyState* pParaFirstLineState = NULL;
534 6364 : XMLPropertyState* pParaFirstLineRelState = NULL;
535 :
536 : // filter ParaTopMargin/Relative
537 6364 : XMLPropertyState* pParaTopMarginState = NULL;
538 6364 : XMLPropertyState* pParaTopMarginRelState = NULL;
539 :
540 : // filter ParaTopMargin/Relative
541 6364 : XMLPropertyState* pParaBottomMarginState = NULL;
542 6364 : XMLPropertyState* pParaBottomMarginRelState = NULL;
543 :
544 : // filter (Left|Right|Top|Bottom|)BorderWidth
545 6364 : XMLPropertyState* pAllBorderWidthState = NULL;
546 6364 : XMLPropertyState* pLeftBorderWidthState = NULL;
547 6364 : XMLPropertyState* pRightBorderWidthState = NULL;
548 6364 : XMLPropertyState* pTopBorderWidthState = NULL;
549 6364 : XMLPropertyState* pBottomBorderWidthState = NULL;
550 :
551 : // filter (Left|Right|Top|)BorderDistance
552 6364 : XMLPropertyState* pAllBorderDistanceState = NULL;
553 6364 : XMLPropertyState* pLeftBorderDistanceState = NULL;
554 6364 : XMLPropertyState* pRightBorderDistanceState = NULL;
555 6364 : XMLPropertyState* pTopBorderDistanceState = NULL;
556 6364 : XMLPropertyState* pBottomBorderDistanceState = NULL;
557 :
558 : // filter (Left|Right|Top|Bottom|)Border
559 6364 : XMLPropertyState* pAllBorderState = NULL;
560 6364 : XMLPropertyState* pLeftBorderState = NULL;
561 6364 : XMLPropertyState* pRightBorderState = NULL;
562 6364 : XMLPropertyState* pTopBorderState = NULL;
563 6364 : XMLPropertyState* pBottomBorderState = NULL;
564 :
565 : // filter Char(Left|Right|Top|Bottom|)BorderWidth
566 6364 : XMLPropertyState* pCharAllBorderWidthState = NULL;
567 6364 : XMLPropertyState* pCharLeftBorderWidthState = NULL;
568 6364 : XMLPropertyState* pCharRightBorderWidthState = NULL;
569 6364 : XMLPropertyState* pCharTopBorderWidthState = NULL;
570 6364 : XMLPropertyState* pCharBottomBorderWidthState = NULL;
571 :
572 : // filter Char(Left|Right|Top|)BorderDistance
573 6364 : XMLPropertyState* pCharAllBorderDistanceState = NULL;
574 6364 : XMLPropertyState* pCharLeftBorderDistanceState = NULL;
575 6364 : XMLPropertyState* pCharRightBorderDistanceState = NULL;
576 6364 : XMLPropertyState* pCharTopBorderDistanceState = NULL;
577 6364 : XMLPropertyState* pCharBottomBorderDistanceState = NULL;
578 :
579 : // filter Char(Left|Right|Top|Bottom|)Border
580 6364 : XMLPropertyState* pCharAllBorderState = NULL;
581 6364 : XMLPropertyState* pCharLeftBorderState = NULL;
582 6364 : XMLPropertyState* pCharRightBorderState = NULL;
583 6364 : XMLPropertyState* pCharTopBorderState = NULL;
584 6364 : XMLPropertyState* pCharBottomBorderState = NULL;
585 :
586 : // filter height properties
587 6364 : XMLPropertyState* pHeightMinAbsState = NULL;
588 6364 : XMLPropertyState* pHeightMinRelState = NULL;
589 6364 : XMLPropertyState* pHeightAbsState = NULL;
590 6364 : XMLPropertyState* pHeightRelState = NULL;
591 6364 : XMLPropertyState* pSizeTypeState = NULL;
592 :
593 : // filter width properties
594 6364 : XMLPropertyState* pWidthMinAbsState = NULL;
595 6364 : XMLPropertyState* pWidthMinRelState = NULL;
596 6364 : XMLPropertyState* pWidthAbsState = NULL;
597 6364 : XMLPropertyState* pWidthRelState = NULL;
598 6364 : XMLPropertyState* pWidthTypeState = NULL;
599 :
600 : // wrap
601 6364 : XMLPropertyState* pWrapState = NULL;
602 6364 : XMLPropertyState* pWrapContourState = NULL;
603 6364 : XMLPropertyState* pWrapContourModeState = NULL;
604 6364 : XMLPropertyState* pWrapParagraphOnlyState = NULL;
605 :
606 : // anchor
607 6364 : XMLPropertyState* pAnchorTypeState = NULL;
608 :
609 : // horizontal position and relation
610 6364 : XMLPropertyState* pHoriOrientState = NULL;
611 6364 : XMLPropertyState* pHoriOrientMirroredState = NULL;
612 6364 : XMLPropertyState* pHoriOrientRelState = NULL;
613 6364 : XMLPropertyState* pHoriOrientRelFrameState = NULL;
614 6364 : XMLPropertyState* pHoriOrientMirrorState = NULL;
615 : // Horizontal position and relation for shapes (#i28749#)
616 6364 : XMLPropertyState* pShapeHoriOrientState = NULL;
617 6364 : XMLPropertyState* pShapeHoriOrientMirroredState = NULL;
618 6364 : XMLPropertyState* pShapeHoriOrientRelState = NULL;
619 6364 : XMLPropertyState* pShapeHoriOrientRelFrameState = NULL;
620 6364 : XMLPropertyState* pShapeHoriOrientMirrorState = NULL;
621 :
622 : // vertical position and relation
623 6364 : XMLPropertyState* pVertOrientState = NULL;
624 6364 : XMLPropertyState* pVertOrientAtCharState = NULL;
625 6364 : XMLPropertyState* pVertOrientRelState = NULL;
626 6364 : XMLPropertyState* pVertOrientRelPageState = NULL;
627 6364 : XMLPropertyState* pVertOrientRelFrameState = NULL;
628 6364 : XMLPropertyState* pVertOrientRelAsCharState = NULL;
629 6364 : XMLPropertyState* pRelWidthRel = NULL;
630 6364 : XMLPropertyState* pRelHeightRel = NULL;
631 :
632 : // Vertical position and relation for shapes (#i28749#)
633 6364 : XMLPropertyState* pShapeVertOrientState = NULL;
634 6364 : XMLPropertyState* pShapeVertOrientAtCharState = NULL;
635 6364 : XMLPropertyState* pShapeVertOrientRelState = NULL;
636 6364 : XMLPropertyState* pShapeVertOrientRelPageState = NULL;
637 6364 : XMLPropertyState* pShapeVertOrientRelFrameState = NULL;
638 :
639 : // filter underline color
640 6364 : XMLPropertyState* pUnderlineState = NULL;
641 6364 : XMLPropertyState* pUnderlineColorState = NULL;
642 6364 : XMLPropertyState* pUnderlineHasColorState = NULL;
643 :
644 : // filter list style name
645 6364 : XMLPropertyState* pListStyleName = NULL;
646 :
647 : // filter fo:clip
648 6364 : XMLPropertyState* pClip11State = NULL;
649 6364 : XMLPropertyState* pClipState = NULL;
650 :
651 : // filter fo:margin
652 6364 : XMLPropertyState* pAllParaMarginRel = NULL;
653 6364 : XMLPropertyState* pAllParaMargin = NULL;
654 6364 : XMLPropertyState* pAllMargin = NULL;
655 :
656 : //UUUU
657 6364 : XMLPropertyState* pRepeatOffsetX = NULL;
658 6364 : XMLPropertyState* pRepeatOffsetY = NULL;
659 :
660 6364 : sal_Bool bNeedsAnchor = sal_False;
661 :
662 243072 : for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
663 162048 : aIter != rProperties.end();
664 : ++aIter )
665 : {
666 74660 : XMLPropertyState *propertie = &(*aIter);
667 74660 : if( propertie->mnIndex == -1 )
668 5596 : continue;
669 :
670 69064 : switch( getPropertySetMapper()->GetEntryContextId( propertie->mnIndex ) )
671 : {
672 3255 : case CTF_CHARHEIGHT: pCharHeightState = propertie; break;
673 99 : case CTF_CHARHEIGHT_REL: pCharPropHeightState = propertie; break;
674 99 : case CTF_CHARHEIGHT_DIFF: pCharDiffHeightState = propertie; break;
675 2916 : case CTF_CHARHEIGHT_CJK: pCharHeightCJKState = propertie; break;
676 133 : case CTF_CHARHEIGHT_REL_CJK: pCharPropHeightCJKState = propertie; break;
677 133 : case CTF_CHARHEIGHT_DIFF_CJK: pCharDiffHeightCJKState = propertie; break;
678 2882 : case CTF_CHARHEIGHT_CTL: pCharHeightCTLState = propertie; break;
679 101 : case CTF_CHARHEIGHT_REL_CTL: pCharPropHeightCTLState = propertie; break;
680 101 : case CTF_CHARHEIGHT_DIFF_CTL: pCharDiffHeightCTLState = propertie; break;
681 153 : case CTF_PARALEFTMARGIN: pParaLeftMarginState = propertie; break;
682 9 : case CTF_PARALEFTMARGIN_REL: pParaLeftMarginRelState = propertie; break;
683 153 : case CTF_PARARIGHTMARGIN: pParaRightMarginState = propertie; break;
684 9 : case CTF_PARARIGHTMARGIN_REL: pParaRightMarginRelState = propertie; break;
685 153 : case CTF_PARAFIRSTLINE: pParaFirstLineState = propertie; break;
686 9 : case CTF_PARAFIRSTLINE_REL: pParaFirstLineRelState = propertie; break;
687 339 : case CTF_PARATOPMARGIN: pParaTopMarginState = propertie; break;
688 76 : case CTF_PARATOPMARGIN_REL: pParaTopMarginRelState = propertie; break;
689 339 : case CTF_PARABOTTOMMARGIN: pParaBottomMarginState = propertie; break;
690 76 : case CTF_PARABOTTOMMARGIN_REL: pParaBottomMarginRelState = propertie; break;
691 :
692 24 : case CTF_ALLBORDERWIDTH: pAllBorderWidthState = propertie; break;
693 24 : case CTF_LEFTBORDERWIDTH: pLeftBorderWidthState = propertie; break;
694 24 : case CTF_RIGHTBORDERWIDTH: pRightBorderWidthState = propertie; break;
695 24 : case CTF_TOPBORDERWIDTH: pTopBorderWidthState = propertie; break;
696 24 : case CTF_BOTTOMBORDERWIDTH: pBottomBorderWidthState = propertie; break;
697 24 : case CTF_ALLBORDERDISTANCE: pAllBorderDistanceState = propertie; break;
698 24 : case CTF_LEFTBORDERDISTANCE: pLeftBorderDistanceState = propertie; break;
699 24 : case CTF_RIGHTBORDERDISTANCE: pRightBorderDistanceState = propertie; break;
700 24 : case CTF_TOPBORDERDISTANCE: pTopBorderDistanceState = propertie; break;
701 24 : case CTF_BOTTOMBORDERDISTANCE: pBottomBorderDistanceState = propertie; break;
702 24 : case CTF_ALLBORDER: pAllBorderState = propertie; break;
703 24 : case CTF_LEFTBORDER: pLeftBorderState = propertie; break;
704 24 : case CTF_RIGHTBORDER: pRightBorderState = propertie; break;
705 24 : case CTF_TOPBORDER: pTopBorderState = propertie; break;
706 24 : case CTF_BOTTOMBORDER: pBottomBorderState = propertie; break;
707 :
708 5 : case CTF_CHARALLBORDERWIDTH: pCharAllBorderWidthState = propertie; break;
709 5 : case CTF_CHARLEFTBORDERWIDTH: pCharLeftBorderWidthState = propertie; break;
710 5 : case CTF_CHARRIGHTBORDERWIDTH: pCharRightBorderWidthState = propertie; break;
711 5 : case CTF_CHARTOPBORDERWIDTH: pCharTopBorderWidthState = propertie; break;
712 5 : case CTF_CHARBOTTOMBORDERWIDTH: pCharBottomBorderWidthState = propertie; break;
713 5 : case CTF_CHARALLBORDERDISTANCE: pCharAllBorderDistanceState = propertie; break;
714 5 : case CTF_CHARLEFTBORDERDISTANCE: pCharLeftBorderDistanceState = propertie; break;
715 5 : case CTF_CHARRIGHTBORDERDISTANCE: pCharRightBorderDistanceState = propertie; break;
716 5 : case CTF_CHARTOPBORDERDISTANCE: pCharTopBorderDistanceState = propertie; break;
717 5 : case CTF_CHARBOTTOMBORDERDISTANCE: pCharBottomBorderDistanceState = propertie; break;
718 5 : case CTF_CHARALLBORDER: pCharAllBorderState = propertie; break;
719 5 : case CTF_CHARLEFTBORDER: pCharLeftBorderState = propertie; break;
720 5 : case CTF_CHARRIGHTBORDER: pCharRightBorderState = propertie; break;
721 5 : case CTF_CHARTOPBORDER: pCharTopBorderState = propertie; break;
722 5 : case CTF_CHARBOTTOMBORDER: pCharBottomBorderState = propertie; break;
723 :
724 0 : case CTF_FRAMEHEIGHT_MIN_ABS: pHeightMinAbsState = propertie; break;
725 0 : case CTF_FRAMEHEIGHT_MIN_REL: pHeightMinRelState = propertie; break;
726 0 : case CTF_FRAMEHEIGHT_ABS: pHeightAbsState = propertie; break;
727 0 : case CTF_FRAMEHEIGHT_REL: pHeightRelState = propertie; break;
728 0 : case CTF_SIZETYPE: pSizeTypeState = propertie; break;
729 :
730 0 : case CTF_FRAMEWIDTH_MIN_ABS: pWidthMinAbsState = propertie; break;
731 0 : case CTF_FRAMEWIDTH_MIN_REL: pWidthMinRelState = propertie; break;
732 0 : case CTF_FRAMEWIDTH_ABS: pWidthAbsState = propertie; break;
733 0 : case CTF_FRAMEWIDTH_REL: pWidthRelState = propertie; break;
734 0 : case CTF_FRAMEWIDTH_TYPE: pWidthTypeState = propertie; break;
735 :
736 36 : case CTF_WRAP: pWrapState = propertie; break;
737 22 : case CTF_WRAP_CONTOUR: pWrapContourState = propertie; break;
738 22 : case CTF_WRAP_CONTOUR_MODE: pWrapContourModeState = propertie; break;
739 36 : case CTF_WRAP_PARAGRAPH_ONLY: pWrapParagraphOnlyState = propertie; break;
740 11 : case CTF_ANCHORTYPE: pAnchorTypeState = propertie; break;
741 :
742 37 : case CTF_HORIZONTALPOS: pHoriOrientState = propertie; bNeedsAnchor = sal_True; break;
743 37 : case CTF_HORIZONTALPOS_MIRRORED: pHoriOrientMirroredState = propertie; bNeedsAnchor = sal_True; break;
744 37 : case CTF_HORIZONTALREL: pHoriOrientRelState = propertie; bNeedsAnchor = sal_True; break;
745 37 : case CTF_HORIZONTALREL_FRAME: pHoriOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
746 37 : case CTF_HORIZONTALMIRROR: pHoriOrientMirrorState = propertie; bNeedsAnchor = sal_True; break;
747 33 : case CTF_RELWIDTHREL: pRelWidthRel = propertie; break;
748 43 : case CTF_VERTICALPOS: pVertOrientState = propertie; bNeedsAnchor = sal_True; break;
749 43 : case CTF_VERTICALPOS_ATCHAR: pVertOrientAtCharState = propertie; bNeedsAnchor = sal_True; break;
750 43 : case CTF_VERTICALREL: pVertOrientRelState = propertie; bNeedsAnchor = sal_True; break;
751 43 : case CTF_VERTICALREL_PAGE: pVertOrientRelPageState = propertie; bNeedsAnchor = sal_True; break;
752 43 : case CTF_VERTICALREL_FRAME: pVertOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
753 44 : case CTF_VERTICALREL_ASCHAR: pVertOrientRelAsCharState = propertie; bNeedsAnchor = sal_True; break;
754 33 : case CTF_RELHEIGHTREL: pRelHeightRel = propertie; break;
755 :
756 : // Handle new CTFs for shape positioning properties (#i28749#)
757 1 : case CTF_SHAPE_HORIZONTALPOS: pShapeHoriOrientState = propertie; bNeedsAnchor = sal_True; break;
758 1 : case CTF_SHAPE_HORIZONTALPOS_MIRRORED: pShapeHoriOrientMirroredState = propertie; bNeedsAnchor = sal_True; break;
759 1 : case CTF_SHAPE_HORIZONTALREL: pShapeHoriOrientRelState = propertie; bNeedsAnchor = sal_True; break;
760 1 : case CTF_SHAPE_HORIZONTALREL_FRAME: pShapeHoriOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
761 1 : case CTF_SHAPE_HORIZONTALMIRROR: pShapeHoriOrientMirrorState = propertie; bNeedsAnchor = sal_True; break;
762 1 : case CTF_SHAPE_VERTICALPOS: pShapeVertOrientState = propertie; bNeedsAnchor = sal_True; break;
763 1 : case CTF_SHAPE_VERTICALPOS_ATCHAR: pShapeVertOrientAtCharState = propertie; bNeedsAnchor = sal_True; break;
764 1 : case CTF_SHAPE_VERTICALREL: pShapeVertOrientRelState = propertie; bNeedsAnchor = sal_True; break;
765 1 : case CTF_SHAPE_VERTICALREL_PAGE: pShapeVertOrientRelPageState = propertie; bNeedsAnchor = sal_True; break;
766 1 : case CTF_SHAPE_VERTICALREL_FRAME: pShapeVertOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
767 1886 : case CTF_FONTNAME: pFontNameState = propertie; break;
768 1848 : case CTF_FONTFAMILYNAME: pFontFamilyNameState = propertie; break;
769 207 : case CTF_FONTSTYLENAME: pFontStyleNameState = propertie; break;
770 1848 : case CTF_FONTFAMILY: pFontFamilyState = propertie; break;
771 1848 : case CTF_FONTPITCH: pFontPitchState = propertie; break;
772 234 : case CTF_FONTCHARSET: pFontCharsetState = propertie; break;
773 :
774 293 : case CTF_FONTNAME_CJK: pFontNameCJKState = propertie; break;
775 245 : case CTF_FONTFAMILYNAME_CJK: pFontFamilyNameCJKState = propertie; break;
776 193 : case CTF_FONTSTYLENAME_CJK: pFontStyleNameCJKState = propertie; break;
777 245 : case CTF_FONTFAMILY_CJK: pFontFamilyCJKState = propertie; break;
778 245 : case CTF_FONTPITCH_CJK: pFontPitchCJKState = propertie; break;
779 215 : case CTF_FONTCHARSET_CJK: pFontCharsetCJKState = propertie; break;
780 :
781 353 : case CTF_FONTNAME_CTL: pFontNameCTLState = propertie; break;
782 305 : case CTF_FONTFAMILYNAME_CTL: pFontFamilyNameCTLState = propertie; break;
783 259 : case CTF_FONTSTYLENAME_CTL: pFontStyleNameCTLState = propertie; break;
784 305 : case CTF_FONTFAMILY_CTL: pFontFamilyCTLState = propertie; break;
785 305 : case CTF_FONTPITCH_CTL: pFontPitchCTLState = propertie; break;
786 281 : case CTF_FONTCHARSET_CTL: pFontCharsetCTLState = propertie; break;
787 92 : case CTF_UNDERLINE: pUnderlineState = propertie; break;
788 70 : case CTF_UNDERLINE_COLOR: pUnderlineColorState = propertie; break;
789 70 : case CTF_UNDERLINE_HASCOLOR: pUnderlineHasColorState = propertie; break;
790 0 : case CTF_NUMBERINGSTYLENAME: pListStyleName = propertie; break;
791 2 : case CTF_TEXT_CLIP11: pClip11State = propertie; break;
792 2 : case CTF_TEXT_CLIP: pClipState = propertie; break;
793 9 : case CTF_PARAMARGINALL_REL: pAllParaMarginRel = propertie; break;
794 89 : case CTF_PARAMARGINALL: pAllParaMargin = propertie; break;
795 20 : case CTF_MARGINALL: pAllMargin = propertie; break;
796 :
797 : //UUUU
798 : case CTF_SW_REPEAT_OFFSET_X:
799 0 : pRepeatOffsetX = propertie;
800 0 : break;
801 :
802 : //UUUU
803 : case CTF_SW_REPEAT_OFFSET_Y:
804 0 : pRepeatOffsetY = propertie;
805 0 : break;
806 :
807 : //UUUU
808 : case CTF_SW_FILLGRADIENTNAME:
809 : case CTF_SW_FILLHATCHNAME:
810 : case CTF_SW_FILLBITMAPNAME:
811 : case CTF_SW_FILLTRANSNAME:
812 : {
813 4 : OUString aStr;
814 4 : if( (propertie->maValue >>= aStr) && 0 == aStr.getLength() )
815 0 : propertie->mnIndex = -1;
816 : }
817 4 : break;
818 : }
819 : }
820 :
821 : //UUUU
822 6364 : if( pRepeatOffsetX && pRepeatOffsetY )
823 : {
824 0 : sal_Int32 nOffset = 0;
825 0 : if( ( pRepeatOffsetX->maValue >>= nOffset ) && ( nOffset == 0 ) )
826 0 : pRepeatOffsetX->mnIndex = -1;
827 : else
828 0 : pRepeatOffsetY->mnIndex = -1;
829 : }
830 :
831 6364 : if( pFontNameState )
832 : ContextFontFilter( bEnableFoFontFamily, pFontNameState, pFontFamilyNameState,
833 : pFontStyleNameState, pFontFamilyState,
834 1886 : pFontPitchState, pFontCharsetState );
835 6364 : if( pFontNameCJKState )
836 : ContextFontFilter( bEnableFoFontFamily, pFontNameCJKState, pFontFamilyNameCJKState,
837 : pFontStyleNameCJKState, pFontFamilyCJKState,
838 293 : pFontPitchCJKState, pFontCharsetCJKState );
839 6364 : if( pFontNameCTLState )
840 : ContextFontFilter( bEnableFoFontFamily, pFontNameCTLState, pFontFamilyNameCTLState,
841 : pFontStyleNameCTLState, pFontFamilyCTLState,
842 353 : pFontPitchCTLState, pFontCharsetCTLState );
843 :
844 6364 : if( pCharHeightState && (pCharPropHeightState || pCharDiffHeightState ) )
845 : ContextFontHeightFilter( pCharHeightState, pCharPropHeightState,
846 99 : pCharDiffHeightState );
847 6364 : if( pCharHeightCJKState &&
848 2783 : (pCharPropHeightCJKState || pCharDiffHeightCJKState ) )
849 : ContextFontHeightFilter( pCharHeightCJKState, pCharPropHeightCJKState,
850 133 : pCharDiffHeightCJKState );
851 6364 : if( pCharHeightCTLState &&
852 2781 : (pCharPropHeightCTLState || pCharDiffHeightCTLState ) )
853 : ContextFontHeightFilter( pCharHeightCTLState, pCharPropHeightCTLState,
854 101 : pCharDiffHeightCTLState );
855 6364 : if( pUnderlineColorState || pUnderlineHasColorState )
856 : {
857 70 : sal_Bool bClear = !pUnderlineState;
858 70 : if( !bClear )
859 : {
860 70 : sal_Int16 nUnderline = 0;
861 70 : pUnderlineState->maValue >>= nUnderline;
862 70 : bClear = awt::FontUnderline::NONE == nUnderline;
863 : }
864 70 : if( bClear )
865 : {
866 51 : if( pUnderlineColorState )
867 51 : pUnderlineColorState->mnIndex = -1;
868 51 : if( pUnderlineHasColorState )
869 51 : pUnderlineHasColorState->mnIndex = -1;
870 : }
871 : }
872 :
873 6364 : lcl_checkMultiProperty(pParaLeftMarginState, pParaLeftMarginRelState);
874 6364 : lcl_checkMultiProperty(pParaRightMarginState, pParaRightMarginRelState);
875 6364 : lcl_checkMultiProperty(pParaTopMarginState, pParaTopMarginRelState);
876 6364 : lcl_checkMultiProperty(pParaBottomMarginState, pParaBottomMarginRelState);
877 6364 : lcl_checkMultiProperty(pParaFirstLineState, pParaFirstLineRelState);
878 :
879 6364 : if (pAllParaMarginRel)
880 : { // because older OOo/LO versions can't read fo:margin:
881 9 : pAllParaMarginRel->mnIndex = -1; // just export individual attributes...
882 9 : pAllParaMarginRel->maValue.clear();
883 : }
884 6364 : if (pAllParaMargin)
885 : {
886 89 : pAllParaMargin->mnIndex = -1; // just export individual attributes...
887 89 : pAllParaMargin->maValue.clear();
888 : }
889 6364 : if (pAllMargin)
890 : {
891 20 : pAllMargin->mnIndex = -1; // just export individual attributes...
892 20 : pAllMargin->maValue.clear();
893 : }
894 :
895 : lcl_FilterBorders(
896 : pAllBorderWidthState, pLeftBorderWidthState, pRightBorderWidthState,
897 : pTopBorderWidthState, pBottomBorderWidthState, pAllBorderDistanceState,
898 : pLeftBorderDistanceState, pRightBorderDistanceState, pTopBorderDistanceState,
899 : pBottomBorderDistanceState, pAllBorderState, pLeftBorderState,
900 6364 : pRightBorderState, pTopBorderState, pBottomBorderState);
901 :
902 : lcl_FilterBorders(
903 : pCharAllBorderWidthState, pCharLeftBorderWidthState, pCharRightBorderWidthState,
904 : pCharTopBorderWidthState, pCharBottomBorderWidthState, pCharAllBorderDistanceState,
905 : pCharLeftBorderDistanceState, pCharRightBorderDistanceState, pCharTopBorderDistanceState,
906 : pCharBottomBorderDistanceState, pCharAllBorderState, pCharLeftBorderState,
907 6364 : pCharRightBorderState, pCharTopBorderState, pCharBottomBorderState);
908 :
909 6364 : sal_Int16 nSizeType = SizeType::FIX;
910 6364 : if( pSizeTypeState )
911 : {
912 0 : pSizeTypeState->maValue >>= nSizeType;
913 0 : pSizeTypeState->mnIndex = -1;
914 : }
915 :
916 6364 : if( pHeightMinAbsState )
917 : {
918 0 : sal_Int16 nRel = sal_Int16();
919 0 : if( (SizeType::FIX == nSizeType) ||
920 0 : ( pHeightMinRelState &&
921 0 : ( !(pHeightMinRelState->maValue >>= nRel) || nRel > 0 ) ) )
922 : {
923 0 : pHeightMinAbsState->mnIndex = -1;
924 : }
925 :
926 : // export SizeType::VARIABLE als min-width="0"
927 0 : if( SizeType::VARIABLE == nSizeType )
928 0 : pHeightMinAbsState->maValue <<= static_cast<sal_Int32>( 0 );
929 : }
930 6364 : if( pHeightMinRelState && SizeType::MIN != nSizeType)
931 0 : pHeightMinRelState->mnIndex = -1;
932 6364 : if( pHeightAbsState && pHeightMinAbsState &&
933 0 : -1 != pHeightMinAbsState->mnIndex )
934 0 : pHeightAbsState->mnIndex = -1;
935 6364 : if( pHeightRelState && SizeType::FIX != nSizeType)
936 0 : pHeightRelState->mnIndex = -1;
937 :
938 : // frame width
939 6364 : nSizeType = SizeType::FIX;
940 6364 : if( pWidthTypeState )
941 : {
942 0 : pWidthTypeState->maValue >>= nSizeType;
943 0 : pWidthTypeState->mnIndex = -1;
944 : }
945 6364 : if( pWidthMinAbsState )
946 : {
947 0 : sal_Int16 nRel = sal_Int16();
948 0 : if( (SizeType::FIX == nSizeType) ||
949 0 : ( pWidthMinRelState &&
950 0 : ( !(pWidthMinRelState->maValue >>= nRel) || nRel > 0 ) ) )
951 : {
952 0 : pWidthMinAbsState->mnIndex = -1;
953 : }
954 :
955 : // export SizeType::VARIABLE als min-width="0"
956 0 : if( SizeType::VARIABLE == nSizeType )
957 0 : pWidthMinAbsState->maValue <<= static_cast<sal_Int32>( 0 );
958 : }
959 6364 : if( pWidthMinRelState && SizeType::MIN != nSizeType)
960 0 : pWidthMinRelState->mnIndex = -1;
961 6364 : if( pWidthAbsState && pWidthMinAbsState &&
962 0 : -1 != pWidthMinAbsState->mnIndex )
963 0 : pWidthAbsState->mnIndex = -1;
964 6364 : if( pWidthRelState && SizeType::FIX != nSizeType)
965 0 : pWidthRelState->mnIndex = -1;
966 :
967 6364 : if( pWrapState )
968 : {
969 : WrapTextMode eVal;
970 36 : pWrapState->maValue >>= eVal;
971 36 : switch( eVal )
972 : {
973 : case WrapTextMode_NONE:
974 : // no wrapping: disable para-only and contour
975 0 : if( pWrapParagraphOnlyState )
976 0 : pWrapParagraphOnlyState->mnIndex = -1;
977 : // no break
978 : case WrapTextMode_THROUGHT:
979 : // wrap through: disable only contour
980 27 : if( pWrapContourState )
981 13 : pWrapContourState->mnIndex = -1;
982 27 : break;
983 : default:
984 9 : break;
985 : }
986 58 : if( pWrapContourModeState &&
987 22 : (!pWrapContourState ||
988 22 : !*(sal_Bool *)pWrapContourState ->maValue.getValue() ) )
989 22 : pWrapContourModeState->mnIndex = -1;
990 : }
991 :
992 6364 : TextContentAnchorType eAnchor = TextContentAnchorType_AT_PARAGRAPH;
993 6364 : if( pAnchorTypeState )
994 11 : pAnchorTypeState->maValue >>= eAnchor;
995 6353 : else if( bNeedsAnchor )
996 : {
997 33 : Any aAny = rPropSet->getPropertyValue("AnchorType");
998 33 : aAny >>= eAnchor;
999 : }
1000 :
1001 : // states for frame positioning attributes
1002 : {
1003 6364 : if( pHoriOrientState && pHoriOrientMirroredState )
1004 : {
1005 74 : if( pHoriOrientMirrorState &&
1006 37 : *(sal_Bool *)pHoriOrientMirrorState->maValue.getValue() )
1007 0 : pHoriOrientState->mnIndex = -1;
1008 : else
1009 37 : pHoriOrientMirroredState->mnIndex = -1;
1010 : }
1011 6364 : if( pHoriOrientMirrorState )
1012 37 : pHoriOrientMirrorState->mnIndex = -1;
1013 :
1014 6364 : if( pHoriOrientRelState && TextContentAnchorType_AT_FRAME == eAnchor )
1015 0 : pHoriOrientRelState->mnIndex = -1;
1016 6364 : if( pHoriOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
1017 37 : pHoriOrientRelFrameState->mnIndex = -1;
1018 6364 : if (pRelWidthRel)
1019 : {
1020 33 : sal_Int16 nRelWidth = 0;
1021 33 : rPropSet->getPropertyValue("RelativeWidth") >>= nRelWidth;
1022 33 : if (!nRelWidth)
1023 28 : pRelWidthRel->mnIndex = -1;
1024 : }
1025 :
1026 6364 : if( pVertOrientState && TextContentAnchorType_AT_CHARACTER == eAnchor )
1027 4 : pVertOrientState->mnIndex = -1;
1028 6364 : if( pVertOrientAtCharState && TextContentAnchorType_AT_CHARACTER != eAnchor )
1029 39 : pVertOrientAtCharState->mnIndex = -1;
1030 6388 : if( pVertOrientRelState && TextContentAnchorType_AT_PARAGRAPH != eAnchor &&
1031 24 : TextContentAnchorType_AT_CHARACTER != eAnchor )
1032 20 : pVertOrientRelState->mnIndex = -1;
1033 6364 : if( pVertOrientRelPageState && TextContentAnchorType_AT_PAGE != eAnchor )
1034 43 : pVertOrientRelPageState->mnIndex = -1;
1035 6364 : if( pVertOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
1036 43 : pVertOrientRelFrameState->mnIndex = -1;
1037 6364 : if( pVertOrientRelAsCharState && TextContentAnchorType_AS_CHARACTER != eAnchor )
1038 24 : pVertOrientRelAsCharState->mnIndex = -1;
1039 6364 : if (pRelHeightRel)
1040 : {
1041 33 : sal_Int16 nRelHeight = 0;
1042 33 : rPropSet->getPropertyValue("RelativeHeight") >>= nRelHeight;
1043 33 : if (!nRelHeight)
1044 28 : pRelHeightRel->mnIndex = -1;
1045 : }
1046 : }
1047 :
1048 : // States for shape positioning properties (#i28749#)
1049 12708 : if ( eAnchor != TextContentAnchorType_AS_CHARACTER &&
1050 6344 : ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 )
1051 : {
1052 : // no export of shape positioning properties,
1053 : // if shape isn't anchored as-character and
1054 : // destination file format is OpenOffice.org file format
1055 68 : if ( pShapeHoriOrientState )
1056 0 : pShapeHoriOrientState->mnIndex = -1;
1057 68 : if ( pShapeHoriOrientMirroredState )
1058 0 : pShapeHoriOrientMirroredState->mnIndex = -1;
1059 68 : if ( pShapeHoriOrientRelState )
1060 0 : pShapeHoriOrientRelState->mnIndex = -1;
1061 68 : if ( pShapeHoriOrientRelFrameState )
1062 0 : pShapeHoriOrientRelFrameState->mnIndex = -1;
1063 68 : if ( pShapeHoriOrientMirrorState )
1064 0 : pShapeHoriOrientMirrorState->mnIndex = -1;
1065 68 : if ( pShapeVertOrientState )
1066 0 : pShapeVertOrientState->mnIndex = -1;
1067 68 : if ( pShapeVertOrientAtCharState )
1068 0 : pShapeVertOrientAtCharState->mnIndex = -1;
1069 68 : if ( pShapeVertOrientRelState )
1070 0 : pShapeVertOrientRelState->mnIndex = -1;
1071 68 : if ( pShapeVertOrientRelPageState )
1072 0 : pShapeVertOrientRelPageState->mnIndex = -1;
1073 68 : if ( pShapeVertOrientRelFrameState )
1074 0 : pShapeVertOrientRelFrameState->mnIndex = -1;
1075 : }
1076 : else
1077 : {
1078 : // handling of shape positioning property states as for frames - see above
1079 6296 : if( pShapeHoriOrientState && pShapeHoriOrientMirroredState )
1080 : {
1081 2 : if( pShapeHoriOrientMirrorState &&
1082 1 : *(sal_Bool *)pShapeHoriOrientMirrorState->maValue.getValue() )
1083 0 : pShapeHoriOrientState->mnIndex = -1;
1084 : else
1085 1 : pShapeHoriOrientMirroredState->mnIndex = -1;
1086 : }
1087 6296 : if( pShapeHoriOrientMirrorState )
1088 1 : pShapeHoriOrientMirrorState->mnIndex = -1;
1089 :
1090 6296 : if( pShapeHoriOrientRelState && TextContentAnchorType_AT_FRAME == eAnchor )
1091 0 : pShapeHoriOrientRelState->mnIndex = -1;
1092 6296 : if( pShapeHoriOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
1093 1 : pShapeHoriOrientRelFrameState->mnIndex = -1;
1094 :
1095 6296 : if( pShapeVertOrientState && TextContentAnchorType_AT_CHARACTER == eAnchor )
1096 0 : pShapeVertOrientState->mnIndex = -1;
1097 6296 : if( pShapeVertOrientAtCharState && TextContentAnchorType_AT_CHARACTER != eAnchor )
1098 1 : pShapeVertOrientAtCharState->mnIndex = -1;
1099 6296 : if( pShapeVertOrientRelState && TextContentAnchorType_AT_PARAGRAPH != eAnchor &&
1100 0 : TextContentAnchorType_AT_CHARACTER != eAnchor )
1101 0 : pShapeVertOrientRelState->mnIndex = -1;
1102 6296 : if( pShapeVertOrientRelPageState && TextContentAnchorType_AT_PAGE != eAnchor )
1103 1 : pShapeVertOrientRelPageState->mnIndex = -1;
1104 6296 : if( pShapeVertOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
1105 1 : pShapeVertOrientRelFrameState->mnIndex = -1;
1106 : }
1107 :
1108 : // list style name: remove list style if it is the default outline style
1109 6364 : if( pListStyleName != NULL )
1110 : {
1111 0 : OUString sListStyleName;
1112 0 : pListStyleName->maValue >>= sListStyleName;
1113 0 : if( lcl_IsOutlineStyle( GetExport(), sListStyleName ) )
1114 0 : pListStyleName->mnIndex = -1;
1115 : }
1116 :
1117 6364 : if( pClipState != NULL && pClip11State != NULL )
1118 2 : pClip11State->mnIndex = -1;
1119 :
1120 6364 : SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet);
1121 6364 : }
1122 :
1123 : namespace {
1124 :
1125 0 : static bool lcl_IsOutlineStyle(const SvXMLExport &rExport, const OUString & rName)
1126 : {
1127 : Reference< XChapterNumberingSupplier >
1128 0 : xCNSupplier(rExport.GetModel(), UNO_QUERY);
1129 :
1130 0 : OUString sOutlineName;
1131 0 : OUString sName("Name");
1132 :
1133 0 : if (xCNSupplier.is())
1134 : {
1135 : Reference<XPropertySet> xNumRule(
1136 0 : xCNSupplier->getChapterNumberingRules(), UNO_QUERY );
1137 : DBG_ASSERT( xNumRule.is(), "no chapter numbering rules" );
1138 0 : if (xNumRule.is())
1139 : {
1140 0 : xNumRule->getPropertyValue(sName) >>= sOutlineName;
1141 0 : }
1142 : }
1143 :
1144 0 : return rName == sOutlineName;
1145 : }
1146 :
1147 : }
1148 :
1149 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|