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