1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/table/BorderLine2.hpp>
22 #include "txtexppr.hxx"
24 #include <com/sun/star/frame/XModel.hpp>
25 #include <com/sun/star/text/SizeType.hpp>
26 #include <com/sun/star/text/WrapTextMode.hpp>
27 #include <com/sun/star/text/TextContentAnchorType.hpp>
28 #include <com/sun/star/awt/FontUnderline.hpp>
29 #include <com/sun/star/text/XChapterNumberingSupplier.hpp>
30 #include <com/sun/star/beans/XPropertySet.hpp>
31 #include <o3tl/any.hxx>
32 #include <sal/log.hxx>
33 #include <tools/color.hxx>
34 #include <xmloff/txtprmap.hxx>
35 #include <xmloff/xmlexp.hxx>
36 #include <xmloff/maptype.hxx>
37 #include <xmloff/namespacemap.hxx>
38 #include "XMLSectionFootnoteConfigExport.hxx"
39 #include <xmlsdtypes.hxx>
40 #include <XMLNumberWithAutoForVoidPropHdl.hxx>
42 using namespace ::com::sun::star
;
43 using namespace ::com::sun::star::uno
;
44 using namespace ::com::sun::star::style
;
45 using namespace ::com::sun::star::beans
;
46 using namespace ::com::sun::star::text
;
48 void XMLTextExportPropertySetMapper::handleElementItem(
50 const XMLPropertyState
& rProperty
,
51 SvXmlExportFlags nFlags
,
52 const ::std::vector
< XMLPropertyState
> *pProperties
,
53 sal_uInt32 nIdx
) const
55 XMLTextExportPropertySetMapper
*pThis
=
56 const_cast<XMLTextExportPropertySetMapper
*>(this);
58 switch( getPropertySetMapper()->GetEntryContextId( rProperty
.mnIndex
) )
60 case CTF_DROPCAPFORMAT
:
61 pThis
->maDropCapExport
.exportXML( rProperty
.maValue
, bDropWholeWord
,
63 pThis
->bDropWholeWord
= false;
64 pThis
->sDropCharStyle
.clear();
68 pThis
->maTabStopExport
.Export( rProperty
.maValue
);
72 pThis
->maTextColumnsExport
.exportXML( rProperty
.maValue
);
75 case CTF_BACKGROUND_URL
:
77 const Any
*pPos
= nullptr, *pFilter
= nullptr, *pTrans
= nullptr;
78 sal_uInt32 nPropIndex
= rProperty
.mnIndex
;
80 // these are all optional, so have to check them in order
81 // note: this index order dependency is a steaming pile of manure
84 const XMLPropertyState
& rFilter
= (*pProperties
)[nIdx
- 1];
85 if (CTF_BACKGROUND_FILTER
== getPropertySetMapper()
86 ->GetEntryContextId(rFilter
.mnIndex
))
88 pFilter
= &rFilter
.maValue
;
95 const XMLPropertyState
& rPos
= (*pProperties
)[nIdx
- 1];
96 if (CTF_BACKGROUND_POS
== getPropertySetMapper()
97 ->GetEntryContextId(rPos
.mnIndex
))
106 const XMLPropertyState
& rTrans
= (*pProperties
)[nIdx
- 1];
107 // #99657# transparency may be there, but doesn't have to be.
108 // If it's there, it must be in the right position.
109 if( CTF_BACKGROUND_TRANSPARENCY
== getPropertySetMapper()
110 ->GetEntryContextId( rTrans
.mnIndex
) )
111 pTrans
= &rTrans
.maValue
;
114 pThis
->maBackgroundImageExport
.exportXML(
115 rProperty
.maValue
, pPos
, pFilter
, pTrans
,
116 getPropertySetMapper()->GetEntryNameSpace( nPropIndex
),
117 getPropertySetMapper()->GetEntryXMLName( nPropIndex
) );
121 case CTF_SECTION_FOOTNOTE_END
:
122 XMLSectionFootnoteConfigExport::exportXML(rExp
, false,
124 getPropertySetMapper());
127 case CTF_SECTION_ENDNOTE_END
:
128 XMLSectionFootnoteConfigExport::exportXML(rExp
, true,
130 getPropertySetMapper());
134 SvXMLExportPropertyMapper::handleElementItem( rExp
, rProperty
, nFlags
, pProperties
, nIdx
);
139 void XMLTextExportPropertySetMapper::handleSpecialItem(
140 SvXMLAttributeList
& rAttrList
,
141 const XMLPropertyState
& rProperty
,
142 const SvXMLUnitConverter
& rUnitConverter
,
143 const SvXMLNamespaceMap
& rNamespaceMap
,
144 const ::std::vector
< XMLPropertyState
> *pProperties
,
145 sal_uInt32 nIdx
) const
147 XMLTextExportPropertySetMapper
*pThis
=
148 const_cast<XMLTextExportPropertySetMapper
*>(this);
150 switch( getPropertySetMapper()->GetEntryContextId( rProperty
.mnIndex
) )
152 case CTF_PAGENUMBEROFFSET
:
155 XMLNumberWithAutoForVoidPropHdl
const handler
;
156 handler
.exportXML(value
, rProperty
.maValue
, rUnitConverter
);
157 if (GetExport().getSaneDefaultVersion() < SvtSaveOptions::ODFSVER_013
158 && value
== "0") // tdf#91306 ODF 1.3 OFFICE-3923
162 OUString
const name
= rNamespaceMap
.GetQNameByKey(
163 getPropertySetMapper()->GetEntryNameSpace(rProperty
.mnIndex
),
164 getPropertySetMapper()->GetEntryXMLName(rProperty
.mnIndex
));
165 rAttrList
.AddAttribute(name
, value
);
168 case CTF_DROPCAPWHOLEWORD
:
169 SAL_WARN_IF( !!bDropWholeWord
, "xmloff", "drop whole word is set already!" );
170 pThis
->bDropWholeWord
= *o3tl::doAccess
<bool>(rProperty
.maValue
);
172 case CTF_DROPCAPCHARSTYLE
:
173 SAL_WARN_IF( !sDropCharStyle
.isEmpty(), "xmloff", "drop char style is set already!" );
174 rProperty
.maValue
>>= pThis
->sDropCharStyle
;
176 case CTF_NUMBERINGSTYLENAME
:
177 case CTF_PAGEDESCNAME
:
178 case CTF_OLDTEXTBACKGROUND
:
179 case CTF_BACKGROUND_POS
:
180 case CTF_BACKGROUND_FILTER
:
181 case CTF_BACKGROUND_TRANSPARENCY
:
182 case CTF_SECTION_FOOTNOTE_NUM_OWN
:
183 case CTF_SECTION_FOOTNOTE_NUM_RESTART
:
184 case CTF_SECTION_FOOTNOTE_NUM_RESTART_AT
:
185 case CTF_SECTION_FOOTNOTE_NUM_TYPE
:
186 case CTF_SECTION_FOOTNOTE_NUM_PREFIX
:
187 case CTF_SECTION_FOOTNOTE_NUM_SUFFIX
:
188 case CTF_SECTION_ENDNOTE_NUM_OWN
:
189 case CTF_SECTION_ENDNOTE_NUM_RESTART
:
190 case CTF_SECTION_ENDNOTE_NUM_RESTART_AT
:
191 case CTF_SECTION_ENDNOTE_NUM_TYPE
:
192 case CTF_SECTION_ENDNOTE_NUM_PREFIX
:
193 case CTF_SECTION_ENDNOTE_NUM_SUFFIX
:
194 case CTF_DEFAULT_OUTLINE_LEVEL
:
195 case CTF_OLD_FLOW_WITH_TEXT
:
196 // There's nothing to do here!
199 SvXMLExportPropertyMapper::handleSpecialItem(rAttrList
, rProperty
, rUnitConverter
, rNamespaceMap
, pProperties
, nIdx
);
204 XMLTextExportPropertySetMapper::XMLTextExportPropertySetMapper(
205 const rtl::Reference
< XMLPropertySetMapper
>& rMapper
,
206 SvXMLExport
& rExp
) :
207 SvXMLExportPropertyMapper( rMapper
),
209 bDropWholeWord( false ),
210 maDropCapExport( rExp
),
211 maTabStopExport( rExp
),
212 maTextColumnsExport( rExp
),
213 maBackgroundImageExport( rExp
)
217 XMLTextExportPropertySetMapper::~XMLTextExportPropertySetMapper()
221 void XMLTextExportPropertySetMapper::ContextFontFilter(
222 bool bEnableFoFontFamily
,
223 XMLPropertyState
*pFontNameState
,
224 XMLPropertyState
*pFontFamilyNameState
,
225 XMLPropertyState
*pFontStyleNameState
,
226 XMLPropertyState
*pFontFamilyState
,
227 XMLPropertyState
*pFontPitchState
,
228 XMLPropertyState
*pFontCharsetState
) const
230 OUString sFamilyName
;
232 FontFamily nFamily
= FAMILY_DONTKNOW
;
233 FontPitch nPitch
= PITCH_DONTKNOW
;
234 rtl_TextEncoding eEnc
= RTL_TEXTENCODING_DONTKNOW
;
237 if( pFontFamilyNameState
&& (pFontFamilyNameState
->maValue
>>= sTmp
) )
239 if( pFontStyleNameState
&& (pFontStyleNameState
->maValue
>>= sTmp
) )
242 sal_Int16 nTmp
= sal_Int16();
243 if( pFontFamilyState
&& (pFontFamilyState
->maValue
>>= nTmp
) )
244 nFamily
= static_cast< FontFamily
>( nTmp
);
245 if( pFontPitchState
&& (pFontPitchState
->maValue
>>= nTmp
) )
246 nPitch
= static_cast< FontPitch
>( nTmp
);
247 if( pFontCharsetState
&& (pFontCharsetState
->maValue
>>= nTmp
) )
248 eEnc
= static_cast<rtl_TextEncoding
>(nTmp
);
250 //Resolves: fdo#67665 The purpose here appears to be to replace
251 //FontFamilyName and FontStyleName etc with a single FontName property. The
252 //problem is that repeated calls to here will first set
253 //pFontFamilyNameState->mnIndex to -1 to indicate it is disabled, so the
254 //next time pFontFamilyNameState is not passed here at all, which gives an
255 //empty sFamilyName resulting in disabling pFontNameState->mnIndex to -1.
256 //That doesn't seem right to me.
258 //So assuming that the main purpose is just to convert the properties in
259 //the main when we can, and to leave them alone when we can't. And with a
260 //secondary purpose to filter out empty font properties, then is would
261 //appear to make sense to base attempting the conversion if we have
262 //both of the major facts of the font description
264 //An alternative solution is to *not* fill the FontAutoStylePool with
265 //every font in the document, but to partition the fonts into the
266 //hard-attribute fonts which go into that pool and the style-attribute
267 //fonts which go into some additional pool which get merged just for
268 //the purposes of writing the embedded fonts but are not queried by
269 //"Find" which restores the original logic.
270 if (pFontFamilyNameState
|| pFontStyleNameState
)
272 OUString
sName( const_cast<SvXMLExport
&>(GetExport()).GetFontAutoStylePool()->Find(
273 sFamilyName
, sStyleName
, nFamily
, nPitch
, eEnc
) );
274 if (!sName
.isEmpty())
276 pFontNameState
->maValue
<<= sName
;
277 //Resolves: fdo#68431 style:font-name unrecognized by LibreOffice
278 //<= 4.1 in styles (but recognized in autostyles) so add
279 //fo:font-family, etc
280 if (!bEnableFoFontFamily
)
282 if( pFontFamilyNameState
)
283 pFontFamilyNameState
->mnIndex
= -1;
284 if( pFontStyleNameState
)
285 pFontStyleNameState
->mnIndex
= -1;
286 if( pFontFamilyState
)
287 pFontFamilyState
->mnIndex
= -1;
288 if( pFontPitchState
)
289 pFontPitchState
->mnIndex
= -1;
290 if( pFontCharsetState
)
291 pFontCharsetState
->mnIndex
= -1;
296 pFontNameState
->mnIndex
= -1;
300 if( pFontFamilyNameState
&& sFamilyName
.isEmpty() )
302 pFontFamilyNameState
->mnIndex
= -1;
305 if( pFontStyleNameState
&& sStyleName
.isEmpty() )
307 pFontStyleNameState
->mnIndex
= -1;
311 void XMLTextExportPropertySetMapper::ContextFontHeightFilter(
312 XMLPropertyState
* pCharHeightState
,
313 XMLPropertyState
* pCharPropHeightState
,
314 XMLPropertyState
* pCharDiffHeightState
)
316 if( pCharPropHeightState
)
319 pCharPropHeightState
->maValue
>>= nTemp
;
322 pCharPropHeightState
->mnIndex
= -1;
323 pCharPropHeightState
->maValue
.clear();
327 pCharHeightState
->mnIndex
= -1;
328 pCharHeightState
->maValue
.clear();
331 if( !pCharDiffHeightState
)
335 pCharDiffHeightState
->maValue
>>= nTemp
;
338 pCharDiffHeightState
->mnIndex
= -1;
339 pCharDiffHeightState
->maValue
.clear();
343 pCharHeightState
->mnIndex
= -1;
344 pCharHeightState
->maValue
.clear();
351 // helper method; implementation below
352 bool lcl_IsOutlineStyle(const SvXMLExport
&, const OUString
&);
355 lcl_checkMultiProperty(XMLPropertyState
*const pState
,
356 XMLPropertyState
*const pRelState
)
358 if (!(pState
&& pRelState
))
362 pRelState
->maValue
>>= nTemp
;
365 pRelState
->mnIndex
= -1;
366 pRelState
->maValue
.clear();
370 pState
->mnIndex
= -1;
371 pState
->maValue
.clear();
376 * Filter context of paragraph and character borders.
377 * Compress border attributes. If one of groupable attributes (border type, border width, padding)
378 * is equal for all four side then just one general attribute will be exported.
380 void lcl_FilterBorders(
381 XMLPropertyState
* pAllBorderWidthState
, XMLPropertyState
* pLeftBorderWidthState
,
382 XMLPropertyState
* pRightBorderWidthState
, XMLPropertyState
* pTopBorderWidthState
,
383 XMLPropertyState
* pBottomBorderWidthState
, XMLPropertyState
* pAllBorderDistanceState
,
384 XMLPropertyState
* pLeftBorderDistanceState
, XMLPropertyState
* pRightBorderDistanceState
,
385 XMLPropertyState
* pTopBorderDistanceState
, XMLPropertyState
* pBottomBorderDistanceState
,
386 XMLPropertyState
* pAllBorderState
, XMLPropertyState
* pLeftBorderState
,
387 XMLPropertyState
* pRightBorderState
,XMLPropertyState
* pTopBorderState
,
388 XMLPropertyState
* pBottomBorderState
)
390 if( pAllBorderWidthState
)
392 if( pLeftBorderWidthState
&& pRightBorderWidthState
&& pTopBorderWidthState
&& pBottomBorderWidthState
)
394 table::BorderLine2 aLeft
, aRight
, aTop
, aBottom
;
396 pLeftBorderWidthState
->maValue
>>= aLeft
;
397 pRightBorderWidthState
->maValue
>>= aRight
;
398 pTopBorderWidthState
->maValue
>>= aTop
;
399 pBottomBorderWidthState
->maValue
>>= aBottom
;
400 if( aLeft
.Color
== aRight
.Color
&& aLeft
.InnerLineWidth
== aRight
.InnerLineWidth
&&
401 aLeft
.OuterLineWidth
== aRight
.OuterLineWidth
&& aLeft
.LineDistance
== aRight
.LineDistance
&&
402 aLeft
.LineStyle
== aRight
.LineStyle
&&
403 aLeft
.LineWidth
== aRight
.LineWidth
&&
404 aLeft
.Color
== aTop
.Color
&& aLeft
.InnerLineWidth
== aTop
.InnerLineWidth
&&
405 aLeft
.OuterLineWidth
== aTop
.OuterLineWidth
&& aLeft
.LineDistance
== aTop
.LineDistance
&&
406 aLeft
.LineStyle
== aTop
.LineStyle
&&
407 aLeft
.LineWidth
== aTop
.LineWidth
&&
408 aLeft
.Color
== aBottom
.Color
&& aLeft
.InnerLineWidth
== aBottom
.InnerLineWidth
&&
409 aLeft
.OuterLineWidth
== aBottom
.OuterLineWidth
&& aLeft
.LineDistance
== aBottom
.LineDistance
&&
410 aLeft
.LineStyle
== aBottom
.LineStyle
&&
411 aLeft
.LineWidth
== aBottom
.LineWidth
)
413 pLeftBorderWidthState
->mnIndex
= -1;
414 pLeftBorderWidthState
->maValue
.clear();
415 pRightBorderWidthState
->mnIndex
= -1;
416 pRightBorderWidthState
->maValue
.clear();
417 pTopBorderWidthState
->mnIndex
= -1;
418 pTopBorderWidthState
->maValue
.clear();
419 pBottomBorderWidthState
->mnIndex
= -1;
420 pBottomBorderWidthState
->maValue
.clear();
424 pAllBorderWidthState
->mnIndex
= -1;
425 pAllBorderWidthState
->maValue
.clear();
430 pAllBorderWidthState
->mnIndex
= -1;
431 pAllBorderWidthState
->maValue
.clear();
435 if( pAllBorderDistanceState
)
437 if( pLeftBorderDistanceState
&& pRightBorderDistanceState
&& pTopBorderDistanceState
&& pBottomBorderDistanceState
)
439 sal_Int32 aLeft
= 0, aRight
= 0, aTop
= 0, aBottom
= 0;
441 pLeftBorderDistanceState
->maValue
>>= aLeft
;
442 pRightBorderDistanceState
->maValue
>>= aRight
;
443 pTopBorderDistanceState
->maValue
>>= aTop
;
444 pBottomBorderDistanceState
->maValue
>>= aBottom
;
445 if( aLeft
== aRight
&& aLeft
== aTop
&& aLeft
== aBottom
)
447 pLeftBorderDistanceState
->mnIndex
= -1;
448 pLeftBorderDistanceState
->maValue
.clear();
449 pRightBorderDistanceState
->mnIndex
= -1;
450 pRightBorderDistanceState
->maValue
.clear();
451 pTopBorderDistanceState
->mnIndex
= -1;
452 pTopBorderDistanceState
->maValue
.clear();
453 pBottomBorderDistanceState
->mnIndex
= -1;
454 pBottomBorderDistanceState
->maValue
.clear();
458 pAllBorderDistanceState
->mnIndex
= -1;
459 pAllBorderDistanceState
->maValue
.clear();
464 pAllBorderDistanceState
->mnIndex
= -1;
465 pAllBorderDistanceState
->maValue
.clear();
469 if( !pAllBorderState
)
472 if( pLeftBorderState
&& pRightBorderState
&& pTopBorderState
&& pBottomBorderState
)
474 table::BorderLine2 aLeft
, aRight
, aTop
, aBottom
;
476 pLeftBorderState
->maValue
>>= aLeft
;
477 pRightBorderState
->maValue
>>= aRight
;
478 pTopBorderState
->maValue
>>= aTop
;
479 pBottomBorderState
->maValue
>>= aBottom
;
480 if( aLeft
.Color
== aRight
.Color
&& aLeft
.InnerLineWidth
== aRight
.InnerLineWidth
&&
481 aLeft
.OuterLineWidth
== aRight
.OuterLineWidth
&& aLeft
.LineDistance
== aRight
.LineDistance
&&
482 aLeft
.LineStyle
== aRight
.LineStyle
&&
483 aLeft
.LineWidth
== aRight
.LineWidth
&&
484 aLeft
.Color
== aTop
.Color
&& aLeft
.InnerLineWidth
== aTop
.InnerLineWidth
&&
485 aLeft
.OuterLineWidth
== aTop
.OuterLineWidth
&& aLeft
.LineDistance
== aTop
.LineDistance
&&
486 aLeft
.LineStyle
== aTop
.LineStyle
&&
487 aLeft
.LineWidth
== aTop
.LineWidth
&&
488 aLeft
.Color
== aBottom
.Color
&& aLeft
.InnerLineWidth
== aBottom
.InnerLineWidth
&&
489 aLeft
.OuterLineWidth
== aBottom
.OuterLineWidth
&& aLeft
.LineDistance
== aBottom
.LineDistance
&&
490 aLeft
.LineWidth
== aBottom
.LineWidth
&&
491 aLeft
.LineStyle
== aBottom
.LineStyle
)
493 pLeftBorderState
->mnIndex
= -1;
494 pLeftBorderState
->maValue
.clear();
495 pRightBorderState
->mnIndex
= -1;
496 pRightBorderState
->maValue
.clear();
497 pTopBorderState
->mnIndex
= -1;
498 pTopBorderState
->maValue
.clear();
499 pBottomBorderState
->mnIndex
= -1;
500 pBottomBorderState
->maValue
.clear();
504 pAllBorderState
->mnIndex
= -1;
505 pAllBorderState
->maValue
.clear();
510 pAllBorderState
->mnIndex
= -1;
511 pAllBorderState
->maValue
.clear();
517 void XMLTextExportPropertySetMapper::ContextFilter(
518 bool bEnableFoFontFamily
,
519 ::std::vector
< XMLPropertyState
>& rProperties
,
520 const Reference
< XPropertySet
>& rPropSet
) const
523 XMLPropertyState
*pFontNameState
= nullptr;
524 XMLPropertyState
*pFontFamilyNameState
= nullptr;
525 XMLPropertyState
*pFontStyleNameState
= nullptr;
526 XMLPropertyState
*pFontFamilyState
= nullptr;
527 XMLPropertyState
*pFontPitchState
= nullptr;
528 XMLPropertyState
*pFontCharsetState
= nullptr;
529 XMLPropertyState
*pFontNameCJKState
= nullptr;
530 XMLPropertyState
*pFontFamilyNameCJKState
= nullptr;
531 XMLPropertyState
*pFontStyleNameCJKState
= nullptr;
532 XMLPropertyState
*pFontFamilyCJKState
= nullptr;
533 XMLPropertyState
*pFontPitchCJKState
= nullptr;
534 XMLPropertyState
*pFontCharsetCJKState
= nullptr;
535 XMLPropertyState
*pFontNameCTLState
= nullptr;
536 XMLPropertyState
*pFontFamilyNameCTLState
= nullptr;
537 XMLPropertyState
*pFontStyleNameCTLState
= nullptr;
538 XMLPropertyState
*pFontFamilyCTLState
= nullptr;
539 XMLPropertyState
*pFontPitchCTLState
= nullptr;
540 XMLPropertyState
*pFontCharsetCTLState
= nullptr;
542 // filter char height point/percent
543 XMLPropertyState
* pCharHeightState
= nullptr;
544 XMLPropertyState
* pCharPropHeightState
= nullptr;
545 XMLPropertyState
* pCharDiffHeightState
= nullptr;
546 XMLPropertyState
* pCharHeightCJKState
= nullptr;
547 XMLPropertyState
* pCharPropHeightCJKState
= nullptr;
548 XMLPropertyState
* pCharDiffHeightCJKState
= nullptr;
549 XMLPropertyState
* pCharHeightCTLState
= nullptr;
550 XMLPropertyState
* pCharPropHeightCTLState
= nullptr;
551 XMLPropertyState
* pCharDiffHeightCTLState
= nullptr;
553 // filter left margin measure/percent
554 XMLPropertyState
* pParaLeftMarginState
= nullptr;
555 XMLPropertyState
* pParaLeftMarginRelState
= nullptr;
557 // filter right margin measure/percent
558 XMLPropertyState
* pParaRightMarginState
= nullptr;
559 XMLPropertyState
* pParaRightMarginRelState
= nullptr;
561 // filter first line indent measure/percent
562 XMLPropertyState
* pParaFirstLineState
= nullptr;
563 XMLPropertyState
* pParaFirstLineRelState
= nullptr;
565 // filter ParaTopMargin/Relative
566 XMLPropertyState
* pParaTopMarginState
= nullptr;
567 XMLPropertyState
* pParaTopMarginRelState
= nullptr;
569 // filter ParaTopMargin/Relative
570 XMLPropertyState
* pParaBottomMarginState
= nullptr;
571 XMLPropertyState
* pParaBottomMarginRelState
= nullptr;
573 // filter (Left|Right|Top|Bottom|)BorderWidth
574 XMLPropertyState
* pAllBorderWidthState
= nullptr;
575 XMLPropertyState
* pLeftBorderWidthState
= nullptr;
576 XMLPropertyState
* pRightBorderWidthState
= nullptr;
577 XMLPropertyState
* pTopBorderWidthState
= nullptr;
578 XMLPropertyState
* pBottomBorderWidthState
= nullptr;
580 // filter (Left|Right|Top|)BorderDistance
581 XMLPropertyState
* pAllBorderDistanceState
= nullptr;
582 XMLPropertyState
* pLeftBorderDistanceState
= nullptr;
583 XMLPropertyState
* pRightBorderDistanceState
= nullptr;
584 XMLPropertyState
* pTopBorderDistanceState
= nullptr;
585 XMLPropertyState
* pBottomBorderDistanceState
= nullptr;
587 // filter (Left|Right|Top|Bottom|)Border
588 XMLPropertyState
* pAllBorderState
= nullptr;
589 XMLPropertyState
* pLeftBorderState
= nullptr;
590 XMLPropertyState
* pRightBorderState
= nullptr;
591 XMLPropertyState
* pTopBorderState
= nullptr;
592 XMLPropertyState
* pBottomBorderState
= nullptr;
594 // filter Char(Left|Right|Top|Bottom|)BorderWidth
595 XMLPropertyState
* pCharAllBorderWidthState
= nullptr;
596 XMLPropertyState
* pCharLeftBorderWidthState
= nullptr;
597 XMLPropertyState
* pCharRightBorderWidthState
= nullptr;
598 XMLPropertyState
* pCharTopBorderWidthState
= nullptr;
599 XMLPropertyState
* pCharBottomBorderWidthState
= nullptr;
601 // filter Char(Left|Right|Top|)BorderDistance
602 XMLPropertyState
* pCharAllBorderDistanceState
= nullptr;
603 XMLPropertyState
* pCharLeftBorderDistanceState
= nullptr;
604 XMLPropertyState
* pCharRightBorderDistanceState
= nullptr;
605 XMLPropertyState
* pCharTopBorderDistanceState
= nullptr;
606 XMLPropertyState
* pCharBottomBorderDistanceState
= nullptr;
608 // filter Char(Left|Right|Top|Bottom|)Border
609 XMLPropertyState
* pCharAllBorderState
= nullptr;
610 XMLPropertyState
* pCharLeftBorderState
= nullptr;
611 XMLPropertyState
* pCharRightBorderState
= nullptr;
612 XMLPropertyState
* pCharTopBorderState
= nullptr;
613 XMLPropertyState
* pCharBottomBorderState
= nullptr;
615 // filter height properties
616 XMLPropertyState
* pHeightMinAbsState
= nullptr;
617 XMLPropertyState
* pHeightMinRelState
= nullptr;
618 XMLPropertyState
* pHeightAbsState
= nullptr;
619 XMLPropertyState
* pHeightRelState
= nullptr;
620 XMLPropertyState
* pSizeTypeState
= nullptr;
622 // filter width properties
623 XMLPropertyState
* pWidthMinAbsState
= nullptr;
624 XMLPropertyState
* pWidthMinRelState
= nullptr;
625 XMLPropertyState
* pWidthAbsState
= nullptr;
626 XMLPropertyState
* pWidthRelState
= nullptr;
627 XMLPropertyState
* pWidthTypeState
= nullptr;
630 XMLPropertyState
* pWrapState
= nullptr;
631 XMLPropertyState
* pWrapContourState
= nullptr;
632 XMLPropertyState
* pWrapContourModeState
= nullptr;
633 XMLPropertyState
* pWrapParagraphOnlyState
= nullptr;
636 XMLPropertyState
* pAnchorTypeState
= nullptr;
638 // horizontal position and relation
639 XMLPropertyState
* pHoriOrientState
= nullptr;
640 XMLPropertyState
* pHoriOrientMirroredState
= nullptr;
641 XMLPropertyState
* pHoriOrientRelState
= nullptr;
642 XMLPropertyState
* pHoriOrientRelFrameState
= nullptr;
643 XMLPropertyState
* pHoriOrientMirrorState
= nullptr;
644 // Horizontal position and relation for shapes (#i28749#)
645 XMLPropertyState
* pShapeHoriOrientState
= nullptr;
646 XMLPropertyState
* pShapeHoriOrientMirroredState
= nullptr;
647 XMLPropertyState
* pShapeHoriOrientRelState
= nullptr;
648 XMLPropertyState
* pShapeHoriOrientRelFrameState
= nullptr;
649 XMLPropertyState
* pShapeHoriOrientMirrorState
= nullptr;
651 // vertical position and relation
652 XMLPropertyState
* pVertOrientState
= nullptr;
653 XMLPropertyState
* pVertOrientAtCharState
= nullptr;
654 XMLPropertyState
* pVertOrientRelState
= nullptr;
655 XMLPropertyState
* pVertOrientRelPageState
= nullptr;
656 XMLPropertyState
* pVertOrientRelFrameState
= nullptr;
657 XMLPropertyState
* pVertOrientRelAsCharState
= nullptr;
658 XMLPropertyState
* pRelWidthRel
= nullptr;
659 XMLPropertyState
* pRelHeightRel
= nullptr;
661 // Vertical position and relation for shapes (#i28749#)
662 XMLPropertyState
* pShapeVertOrientState
= nullptr;
663 XMLPropertyState
* pShapeVertOrientAtCharState
= nullptr;
664 XMLPropertyState
* pShapeVertOrientRelState
= nullptr;
665 XMLPropertyState
* pShapeVertOrientRelPageState
= nullptr;
666 XMLPropertyState
* pShapeVertOrientRelFrameState
= nullptr;
668 // filter underline color
669 XMLPropertyState
* pUnderlineState
= nullptr;
670 XMLPropertyState
* pUnderlineColorState
= nullptr;
671 XMLPropertyState
* pUnderlineHasColorState
= nullptr;
673 // filter list style name
674 XMLPropertyState
* pListStyleName
= nullptr;
677 XMLPropertyState
* pClip11State
= nullptr;
678 XMLPropertyState
* pClipState
= nullptr;
681 XMLPropertyState
* pAllParaMarginRel
= nullptr;
682 XMLPropertyState
* pAllParaMargin
= nullptr;
683 XMLPropertyState
* pAllMargin
= nullptr;
685 XMLPropertyState
* pRepeatOffsetX
= nullptr;
686 XMLPropertyState
* pRepeatOffsetY
= nullptr;
688 // character background and highlight
689 XMLPropertyState
* pCharBackground
= nullptr;
690 XMLPropertyState
* pCharBackgroundTransparency
= nullptr;
691 XMLPropertyState
* pCharHighlight
= nullptr;
693 bool bNeedsAnchor
= false;
695 for( auto& rPropertyState
: rProperties
)
697 XMLPropertyState
*propertyState
= &rPropertyState
;
698 if( propertyState
->mnIndex
== -1 )
701 switch( getPropertySetMapper()->GetEntryContextId( propertyState
->mnIndex
) )
703 case CTF_CHARHEIGHT
: pCharHeightState
= propertyState
; break;
704 case CTF_CHARHEIGHT_REL
: pCharPropHeightState
= propertyState
; break;
705 case CTF_CHARHEIGHT_DIFF
: pCharDiffHeightState
= propertyState
; break;
706 case CTF_CHARHEIGHT_CJK
: pCharHeightCJKState
= propertyState
; break;
707 case CTF_CHARHEIGHT_REL_CJK
: pCharPropHeightCJKState
= propertyState
; break;
708 case CTF_CHARHEIGHT_DIFF_CJK
: pCharDiffHeightCJKState
= propertyState
; break;
709 case CTF_CHARHEIGHT_CTL
: pCharHeightCTLState
= propertyState
; break;
710 case CTF_CHARHEIGHT_REL_CTL
: pCharPropHeightCTLState
= propertyState
; break;
711 case CTF_CHARHEIGHT_DIFF_CTL
: pCharDiffHeightCTLState
= propertyState
; break;
712 case CTF_PARALEFTMARGIN
: pParaLeftMarginState
= propertyState
; break;
713 case CTF_PARALEFTMARGIN_REL
: pParaLeftMarginRelState
= propertyState
; break;
714 case CTF_PARARIGHTMARGIN
: pParaRightMarginState
= propertyState
; break;
715 case CTF_PARARIGHTMARGIN_REL
: pParaRightMarginRelState
= propertyState
; break;
716 case CTF_PARAFIRSTLINE
: pParaFirstLineState
= propertyState
; break;
717 case CTF_PARAFIRSTLINE_REL
: pParaFirstLineRelState
= propertyState
; break;
718 case CTF_PARATOPMARGIN
: pParaTopMarginState
= propertyState
; break;
719 case CTF_PARATOPMARGIN_REL
: pParaTopMarginRelState
= propertyState
; break;
720 case CTF_PARABOTTOMMARGIN
: pParaBottomMarginState
= propertyState
; break;
721 case CTF_PARABOTTOMMARGIN_REL
: pParaBottomMarginRelState
= propertyState
; break;
723 case CTF_ALLBORDERWIDTH
: pAllBorderWidthState
= propertyState
; break;
724 case CTF_LEFTBORDERWIDTH
: pLeftBorderWidthState
= propertyState
; break;
725 case CTF_RIGHTBORDERWIDTH
: pRightBorderWidthState
= propertyState
; break;
726 case CTF_TOPBORDERWIDTH
: pTopBorderWidthState
= propertyState
; break;
727 case CTF_BOTTOMBORDERWIDTH
: pBottomBorderWidthState
= propertyState
; break;
728 case CTF_ALLBORDERDISTANCE
: pAllBorderDistanceState
= propertyState
; break;
729 case CTF_LEFTBORDERDISTANCE
: pLeftBorderDistanceState
= propertyState
; break;
730 case CTF_RIGHTBORDERDISTANCE
: pRightBorderDistanceState
= propertyState
; break;
731 case CTF_TOPBORDERDISTANCE
: pTopBorderDistanceState
= propertyState
; break;
732 case CTF_BOTTOMBORDERDISTANCE
: pBottomBorderDistanceState
= propertyState
; break;
733 case CTF_ALLBORDER
: pAllBorderState
= propertyState
; break;
734 case CTF_LEFTBORDER
: pLeftBorderState
= propertyState
; break;
735 case CTF_RIGHTBORDER
: pRightBorderState
= propertyState
; break;
736 case CTF_TOPBORDER
: pTopBorderState
= propertyState
; break;
737 case CTF_BOTTOMBORDER
: pBottomBorderState
= propertyState
; break;
739 case CTF_CHARALLBORDERWIDTH
: pCharAllBorderWidthState
= propertyState
; break;
740 case CTF_CHARLEFTBORDERWIDTH
: pCharLeftBorderWidthState
= propertyState
; break;
741 case CTF_CHARRIGHTBORDERWIDTH
: pCharRightBorderWidthState
= propertyState
; break;
742 case CTF_CHARTOPBORDERWIDTH
: pCharTopBorderWidthState
= propertyState
; break;
743 case CTF_CHARBOTTOMBORDERWIDTH
: pCharBottomBorderWidthState
= propertyState
; break;
744 case CTF_CHARALLBORDERDISTANCE
: pCharAllBorderDistanceState
= propertyState
; break;
745 case CTF_CHARLEFTBORDERDISTANCE
: pCharLeftBorderDistanceState
= propertyState
; break;
746 case CTF_CHARRIGHTBORDERDISTANCE
: pCharRightBorderDistanceState
= propertyState
; break;
747 case CTF_CHARTOPBORDERDISTANCE
: pCharTopBorderDistanceState
= propertyState
; break;
748 case CTF_CHARBOTTOMBORDERDISTANCE
: pCharBottomBorderDistanceState
= propertyState
; break;
749 case CTF_CHARALLBORDER
: pCharAllBorderState
= propertyState
; break;
750 case CTF_CHARLEFTBORDER
: pCharLeftBorderState
= propertyState
; break;
751 case CTF_CHARRIGHTBORDER
: pCharRightBorderState
= propertyState
; break;
752 case CTF_CHARTOPBORDER
: pCharTopBorderState
= propertyState
; break;
753 case CTF_CHARBOTTOMBORDER
: pCharBottomBorderState
= propertyState
; break;
755 case CTF_FRAMEHEIGHT_MIN_ABS
: pHeightMinAbsState
= propertyState
; break;
756 case CTF_FRAMEHEIGHT_MIN_REL
: pHeightMinRelState
= propertyState
; break;
757 case CTF_FRAMEHEIGHT_ABS
: pHeightAbsState
= propertyState
; break;
758 case CTF_FRAMEHEIGHT_REL
: pHeightRelState
= propertyState
; break;
759 case CTF_SIZETYPE
: pSizeTypeState
= propertyState
; break;
761 case CTF_FRAMEWIDTH_MIN_ABS
: pWidthMinAbsState
= propertyState
; break;
762 case CTF_FRAMEWIDTH_MIN_REL
: pWidthMinRelState
= propertyState
; break;
763 case CTF_FRAMEWIDTH_ABS
: pWidthAbsState
= propertyState
; break;
764 case CTF_FRAMEWIDTH_REL
: pWidthRelState
= propertyState
; break;
765 case CTF_FRAMEWIDTH_TYPE
: pWidthTypeState
= propertyState
; break;
767 case CTF_WRAP
: pWrapState
= propertyState
; break;
768 case CTF_WRAP_CONTOUR
: pWrapContourState
= propertyState
; break;
769 case CTF_WRAP_CONTOUR_MODE
: pWrapContourModeState
= propertyState
; break;
770 case CTF_WRAP_PARAGRAPH_ONLY
: pWrapParagraphOnlyState
= propertyState
; break;
771 case CTF_ANCHORTYPE
: pAnchorTypeState
= propertyState
; break;
773 case CTF_HORIZONTALPOS
: pHoriOrientState
= propertyState
; bNeedsAnchor
= true; break;
774 case CTF_HORIZONTALPOS_MIRRORED
: pHoriOrientMirroredState
= propertyState
; bNeedsAnchor
= true; break;
775 case CTF_HORIZONTALREL
: pHoriOrientRelState
= propertyState
; bNeedsAnchor
= true; break;
776 case CTF_HORIZONTALREL_FRAME
: pHoriOrientRelFrameState
= propertyState
; bNeedsAnchor
= true; break;
777 case CTF_HORIZONTALMIRROR
: pHoriOrientMirrorState
= propertyState
; bNeedsAnchor
= true; break;
778 case CTF_RELWIDTHREL
: pRelWidthRel
= propertyState
; break;
779 case CTF_VERTICALPOS
: pVertOrientState
= propertyState
; bNeedsAnchor
= true; break;
780 case CTF_VERTICALPOS_ATCHAR
: pVertOrientAtCharState
= propertyState
; bNeedsAnchor
= true; break;
781 case CTF_VERTICALREL
: pVertOrientRelState
= propertyState
; bNeedsAnchor
= true; break;
782 case CTF_VERTICALREL_PAGE
: pVertOrientRelPageState
= propertyState
; bNeedsAnchor
= true; break;
783 case CTF_VERTICALREL_FRAME
: pVertOrientRelFrameState
= propertyState
; bNeedsAnchor
= true; break;
784 case CTF_VERTICALREL_ASCHAR
: pVertOrientRelAsCharState
= propertyState
; bNeedsAnchor
= true; break;
785 case CTF_RELHEIGHTREL
: pRelHeightRel
= propertyState
; break;
787 // Handle new CTFs for shape positioning properties (#i28749#)
788 case CTF_SHAPE_HORIZONTALPOS
: pShapeHoriOrientState
= propertyState
; bNeedsAnchor
= true; break;
789 case CTF_SHAPE_HORIZONTALPOS_MIRRORED
: pShapeHoriOrientMirroredState
= propertyState
; bNeedsAnchor
= true; break;
790 case CTF_SHAPE_HORIZONTALREL
: pShapeHoriOrientRelState
= propertyState
; bNeedsAnchor
= true; break;
791 case CTF_SHAPE_HORIZONTALREL_FRAME
: pShapeHoriOrientRelFrameState
= propertyState
; bNeedsAnchor
= true; break;
792 case CTF_SHAPE_HORIZONTALMIRROR
: pShapeHoriOrientMirrorState
= propertyState
; bNeedsAnchor
= true; break;
793 case CTF_SHAPE_VERTICALPOS
: pShapeVertOrientState
= propertyState
; bNeedsAnchor
= true; break;
794 case CTF_SHAPE_VERTICALPOS_ATCHAR
: pShapeVertOrientAtCharState
= propertyState
; bNeedsAnchor
= true; break;
795 case CTF_SHAPE_VERTICALREL
: pShapeVertOrientRelState
= propertyState
; bNeedsAnchor
= true; break;
796 case CTF_SHAPE_VERTICALREL_PAGE
: pShapeVertOrientRelPageState
= propertyState
; bNeedsAnchor
= true; break;
797 case CTF_SHAPE_VERTICALREL_FRAME
: pShapeVertOrientRelFrameState
= propertyState
; bNeedsAnchor
= true; break;
798 case CTF_FONTNAME
: pFontNameState
= propertyState
; break;
799 case CTF_FONTFAMILYNAME
: pFontFamilyNameState
= propertyState
; break;
800 case CTF_FONTSTYLENAME
: pFontStyleNameState
= propertyState
; break;
801 case CTF_FONTFAMILY
: pFontFamilyState
= propertyState
; break;
802 case CTF_FONTPITCH
: pFontPitchState
= propertyState
; break;
803 case CTF_FONTCHARSET
: pFontCharsetState
= propertyState
; break;
805 case CTF_FONTNAME_CJK
: pFontNameCJKState
= propertyState
; break;
806 case CTF_FONTFAMILYNAME_CJK
: pFontFamilyNameCJKState
= propertyState
; break;
807 case CTF_FONTSTYLENAME_CJK
: pFontStyleNameCJKState
= propertyState
; break;
808 case CTF_FONTFAMILY_CJK
: pFontFamilyCJKState
= propertyState
; break;
809 case CTF_FONTPITCH_CJK
: pFontPitchCJKState
= propertyState
; break;
810 case CTF_FONTCHARSET_CJK
: pFontCharsetCJKState
= propertyState
; break;
812 case CTF_FONTNAME_CTL
: pFontNameCTLState
= propertyState
; break;
813 case CTF_FONTFAMILYNAME_CTL
: pFontFamilyNameCTLState
= propertyState
; break;
814 case CTF_FONTSTYLENAME_CTL
: pFontStyleNameCTLState
= propertyState
; break;
815 case CTF_FONTFAMILY_CTL
: pFontFamilyCTLState
= propertyState
; break;
816 case CTF_FONTPITCH_CTL
: pFontPitchCTLState
= propertyState
; break;
817 case CTF_FONTCHARSET_CTL
: pFontCharsetCTLState
= propertyState
; break;
818 case CTF_UNDERLINE
: pUnderlineState
= propertyState
; break;
819 case CTF_UNDERLINE_COLOR
: pUnderlineColorState
= propertyState
; break;
820 case CTF_UNDERLINE_HASCOLOR
: pUnderlineHasColorState
= propertyState
; break;
821 case CTF_NUMBERINGSTYLENAME
: pListStyleName
= propertyState
; break;
822 case CTF_TEXT_CLIP11
: pClip11State
= propertyState
; break;
823 case CTF_TEXT_CLIP
: pClipState
= propertyState
; break;
824 case CTF_PARAMARGINALL_REL
: pAllParaMarginRel
= propertyState
; break;
825 case CTF_PARAMARGINALL
: pAllParaMargin
= propertyState
; break;
826 case CTF_MARGINALL
: pAllMargin
= propertyState
; break;
828 case CTF_REPEAT_OFFSET_X
:
829 pRepeatOffsetX
= propertyState
;
832 case CTF_REPEAT_OFFSET_Y
:
833 pRepeatOffsetY
= propertyState
;
836 case CTF_FILLGRADIENTNAME
:
837 case CTF_FILLHATCHNAME
:
838 case CTF_FILLBITMAPNAME
:
839 case CTF_FILLTRANSNAME
:
842 if( (propertyState
->maValue
>>= aStr
) && 0 == aStr
.getLength() )
843 propertyState
->mnIndex
= -1;
847 case CTF_CHAR_BACKGROUND
: pCharBackground
= propertyState
; break;
848 case CTF_CHAR_BACKGROUND_TRANSPARENCY
: pCharBackgroundTransparency
= propertyState
; break;
849 case CTF_CHAR_HIGHLIGHT
: pCharHighlight
= propertyState
; break;
853 if( pRepeatOffsetX
&& pRepeatOffsetY
)
855 sal_Int32 nOffset
= 0;
856 if( ( pRepeatOffsetX
->maValue
>>= nOffset
) && ( nOffset
== 0 ) )
857 pRepeatOffsetX
->mnIndex
= -1;
859 pRepeatOffsetY
->mnIndex
= -1;
863 ContextFontFilter( bEnableFoFontFamily
, pFontNameState
, pFontFamilyNameState
,
864 pFontStyleNameState
, pFontFamilyState
,
865 pFontPitchState
, pFontCharsetState
);
866 if( pFontNameCJKState
)
867 ContextFontFilter( bEnableFoFontFamily
, pFontNameCJKState
, pFontFamilyNameCJKState
,
868 pFontStyleNameCJKState
, pFontFamilyCJKState
,
869 pFontPitchCJKState
, pFontCharsetCJKState
);
870 if( pFontNameCTLState
)
871 ContextFontFilter( bEnableFoFontFamily
, pFontNameCTLState
, pFontFamilyNameCTLState
,
872 pFontStyleNameCTLState
, pFontFamilyCTLState
,
873 pFontPitchCTLState
, pFontCharsetCTLState
);
875 if( pCharHeightState
&& (pCharPropHeightState
|| pCharDiffHeightState
) )
876 ContextFontHeightFilter( pCharHeightState
, pCharPropHeightState
,
877 pCharDiffHeightState
);
878 if( pCharHeightCJKState
&&
879 (pCharPropHeightCJKState
|| pCharDiffHeightCJKState
) )
880 ContextFontHeightFilter( pCharHeightCJKState
, pCharPropHeightCJKState
,
881 pCharDiffHeightCJKState
);
882 if( pCharHeightCTLState
&&
883 (pCharPropHeightCTLState
|| pCharDiffHeightCTLState
) )
884 ContextFontHeightFilter( pCharHeightCTLState
, pCharPropHeightCTLState
,
885 pCharDiffHeightCTLState
);
886 if( pUnderlineColorState
|| pUnderlineHasColorState
)
888 bool bClear
= !pUnderlineState
;
891 sal_Int16 nUnderline
= 0;
892 pUnderlineState
->maValue
>>= nUnderline
;
893 bClear
= awt::FontUnderline::NONE
== nUnderline
;
897 if( pUnderlineColorState
)
898 pUnderlineColorState
->mnIndex
= -1;
899 if( pUnderlineHasColorState
)
900 pUnderlineHasColorState
->mnIndex
= -1;
904 lcl_checkMultiProperty(pParaLeftMarginState
, pParaLeftMarginRelState
);
905 lcl_checkMultiProperty(pParaRightMarginState
, pParaRightMarginRelState
);
906 lcl_checkMultiProperty(pParaTopMarginState
, pParaTopMarginRelState
);
907 lcl_checkMultiProperty(pParaBottomMarginState
, pParaBottomMarginRelState
);
908 lcl_checkMultiProperty(pParaFirstLineState
, pParaFirstLineRelState
);
910 if (pAllParaMarginRel
)
911 { // because older OOo/LO versions can't read fo:margin:
912 pAllParaMarginRel
->mnIndex
= -1; // just export individual attributes...
913 pAllParaMarginRel
->maValue
.clear();
917 pAllParaMargin
->mnIndex
= -1; // just export individual attributes...
918 pAllParaMargin
->maValue
.clear();
922 pAllMargin
->mnIndex
= -1; // just export individual attributes...
923 pAllMargin
->maValue
.clear();
927 pAllBorderWidthState
, pLeftBorderWidthState
, pRightBorderWidthState
,
928 pTopBorderWidthState
, pBottomBorderWidthState
, pAllBorderDistanceState
,
929 pLeftBorderDistanceState
, pRightBorderDistanceState
, pTopBorderDistanceState
,
930 pBottomBorderDistanceState
, pAllBorderState
, pLeftBorderState
,
931 pRightBorderState
, pTopBorderState
, pBottomBorderState
);
934 pCharAllBorderWidthState
, pCharLeftBorderWidthState
, pCharRightBorderWidthState
,
935 pCharTopBorderWidthState
, pCharBottomBorderWidthState
, pCharAllBorderDistanceState
,
936 pCharLeftBorderDistanceState
, pCharRightBorderDistanceState
, pCharTopBorderDistanceState
,
937 pCharBottomBorderDistanceState
, pCharAllBorderState
, pCharLeftBorderState
,
938 pCharRightBorderState
, pCharTopBorderState
, pCharBottomBorderState
);
940 sal_Int16 nSizeType
= SizeType::FIX
;
943 pSizeTypeState
->maValue
>>= nSizeType
;
944 pSizeTypeState
->mnIndex
= -1;
947 if( pHeightMinAbsState
)
949 sal_Int16 nRel
= sal_Int16();
950 if( (SizeType::FIX
== nSizeType
) ||
951 ( pHeightMinRelState
&&
952 ( !(pHeightMinRelState
->maValue
>>= nRel
) || nRel
> 0 ) ) )
954 pHeightMinAbsState
->mnIndex
= -1;
957 // export SizeType::VARIABLE as min-width="0"
958 if( SizeType::VARIABLE
== nSizeType
)
959 pHeightMinAbsState
->maValue
<<= static_cast<sal_Int32
>( 0 );
961 if( pHeightMinRelState
&& SizeType::MIN
!= nSizeType
)
962 pHeightMinRelState
->mnIndex
= -1;
963 if( pHeightAbsState
&& pHeightMinAbsState
&&
964 -1 != pHeightMinAbsState
->mnIndex
)
965 pHeightAbsState
->mnIndex
= -1;
966 if( pHeightRelState
&& SizeType::FIX
!= nSizeType
)
967 pHeightRelState
->mnIndex
= -1;
970 nSizeType
= SizeType::FIX
;
971 if( pWidthTypeState
)
973 pWidthTypeState
->maValue
>>= nSizeType
;
974 pWidthTypeState
->mnIndex
= -1;
976 if( pWidthMinAbsState
)
978 sal_Int16 nRel
= sal_Int16();
979 if( (SizeType::FIX
== nSizeType
) ||
980 ( pWidthMinRelState
&&
981 ( !(pWidthMinRelState
->maValue
>>= nRel
) || nRel
> 0 ) ) )
983 pWidthMinAbsState
->mnIndex
= -1;
986 // export SizeType::VARIABLE as min-width="0"
987 if( SizeType::VARIABLE
== nSizeType
)
988 pWidthMinAbsState
->maValue
<<= static_cast<sal_Int32
>( 0 );
990 if( pWidthMinRelState
&& SizeType::MIN
!= nSizeType
)
991 pWidthMinRelState
->mnIndex
= -1;
992 if( pWidthAbsState
&& pWidthMinAbsState
&&
993 -1 != pWidthMinAbsState
->mnIndex
)
994 pWidthAbsState
->mnIndex
= -1;
995 if( pWidthRelState
&& SizeType::FIX
!= nSizeType
)
996 pWidthRelState
->mnIndex
= -1;
1001 pWrapState
->maValue
>>= eVal
;
1004 case WrapTextMode_NONE
:
1005 // no wrapping: disable para-only and contour
1006 if( pWrapParagraphOnlyState
)
1007 pWrapParagraphOnlyState
->mnIndex
= -1;
1009 case WrapTextMode_THROUGH
:
1010 // wrap through: disable only contour
1011 if( pWrapContourState
)
1012 pWrapContourState
->mnIndex
= -1;
1017 if( pWrapContourModeState
&&
1018 (!pWrapContourState
||
1019 !*o3tl::doAccess
<bool>(pWrapContourState
->maValue
) ) )
1020 pWrapContourModeState
->mnIndex
= -1;
1023 TextContentAnchorType eAnchor
= TextContentAnchorType_AT_PARAGRAPH
;
1024 if( pAnchorTypeState
)
1025 pAnchorTypeState
->maValue
>>= eAnchor
;
1026 else if( bNeedsAnchor
)
1028 Any aAny
= rPropSet
->getPropertyValue("AnchorType");
1032 // states for frame positioning attributes
1034 if( pHoriOrientState
&& pHoriOrientMirroredState
)
1036 if( pHoriOrientMirrorState
&&
1037 *o3tl::doAccess
<bool>(pHoriOrientMirrorState
->maValue
) )
1038 pHoriOrientState
->mnIndex
= -1;
1040 pHoriOrientMirroredState
->mnIndex
= -1;
1042 if( pHoriOrientMirrorState
)
1043 pHoriOrientMirrorState
->mnIndex
= -1;
1045 if( pHoriOrientRelState
&& TextContentAnchorType_AT_FRAME
== eAnchor
)
1046 pHoriOrientRelState
->mnIndex
= -1;
1047 if( pHoriOrientRelFrameState
&& TextContentAnchorType_AT_FRAME
!= eAnchor
)
1048 pHoriOrientRelFrameState
->mnIndex
= -1;
1051 sal_Int16 nRelWidth
= 0;
1052 rPropSet
->getPropertyValue("RelativeWidth") >>= nRelWidth
;
1054 pRelWidthRel
->mnIndex
= -1;
1057 if( pVertOrientState
&& TextContentAnchorType_AT_CHARACTER
== eAnchor
)
1058 pVertOrientState
->mnIndex
= -1;
1059 if( pVertOrientAtCharState
&& TextContentAnchorType_AT_CHARACTER
!= eAnchor
)
1060 pVertOrientAtCharState
->mnIndex
= -1;
1061 if( pVertOrientRelState
&& TextContentAnchorType_AT_PARAGRAPH
!= eAnchor
&&
1062 TextContentAnchorType_AT_CHARACTER
!= eAnchor
)
1063 pVertOrientRelState
->mnIndex
= -1;
1064 if( pVertOrientRelPageState
&& TextContentAnchorType_AT_PAGE
!= eAnchor
)
1065 pVertOrientRelPageState
->mnIndex
= -1;
1066 if( pVertOrientRelFrameState
&& TextContentAnchorType_AT_FRAME
!= eAnchor
)
1067 pVertOrientRelFrameState
->mnIndex
= -1;
1068 if( pVertOrientRelAsCharState
&& TextContentAnchorType_AS_CHARACTER
!= eAnchor
)
1069 pVertOrientRelAsCharState
->mnIndex
= -1;
1072 sal_Int16 nRelHeight
= 0;
1073 rPropSet
->getPropertyValue("RelativeHeight") >>= nRelHeight
;
1075 pRelHeightRel
->mnIndex
= -1;
1079 // States for shape positioning properties (#i28749#)
1080 if ( eAnchor
!= TextContentAnchorType_AS_CHARACTER
&&
1081 !( GetExport().getExportFlags() & SvXMLExportFlags::OASIS
) )
1083 // no export of shape positioning properties,
1084 // if shape isn't anchored as-character and
1085 // destination file format is OpenOffice.org file format
1086 if ( pShapeHoriOrientState
)
1087 pShapeHoriOrientState
->mnIndex
= -1;
1088 if ( pShapeHoriOrientMirroredState
)
1089 pShapeHoriOrientMirroredState
->mnIndex
= -1;
1090 if ( pShapeHoriOrientRelState
)
1091 pShapeHoriOrientRelState
->mnIndex
= -1;
1092 if ( pShapeHoriOrientRelFrameState
)
1093 pShapeHoriOrientRelFrameState
->mnIndex
= -1;
1094 if ( pShapeHoriOrientMirrorState
)
1095 pShapeHoriOrientMirrorState
->mnIndex
= -1;
1096 if ( pShapeVertOrientState
)
1097 pShapeVertOrientState
->mnIndex
= -1;
1098 if ( pShapeVertOrientAtCharState
)
1099 pShapeVertOrientAtCharState
->mnIndex
= -1;
1100 if ( pShapeVertOrientRelState
)
1101 pShapeVertOrientRelState
->mnIndex
= -1;
1102 if ( pShapeVertOrientRelPageState
)
1103 pShapeVertOrientRelPageState
->mnIndex
= -1;
1104 if ( pShapeVertOrientRelFrameState
)
1105 pShapeVertOrientRelFrameState
->mnIndex
= -1;
1109 // handling of shape positioning property states as for frames - see above
1110 if( pShapeHoriOrientState
&& pShapeHoriOrientMirroredState
)
1112 if( pShapeHoriOrientMirrorState
&&
1113 *o3tl::doAccess
<bool>(pShapeHoriOrientMirrorState
->maValue
) )
1114 pShapeHoriOrientState
->mnIndex
= -1;
1116 pShapeHoriOrientMirroredState
->mnIndex
= -1;
1118 if( pShapeHoriOrientMirrorState
)
1119 pShapeHoriOrientMirrorState
->mnIndex
= -1;
1121 if( pShapeHoriOrientRelState
&& TextContentAnchorType_AT_FRAME
== eAnchor
)
1122 pShapeHoriOrientRelState
->mnIndex
= -1;
1123 if( pShapeHoriOrientRelFrameState
&& TextContentAnchorType_AT_FRAME
!= eAnchor
)
1124 pShapeHoriOrientRelFrameState
->mnIndex
= -1;
1126 if( pShapeVertOrientState
&& TextContentAnchorType_AT_CHARACTER
== eAnchor
)
1127 pShapeVertOrientState
->mnIndex
= -1;
1128 if( pShapeVertOrientAtCharState
&& TextContentAnchorType_AT_CHARACTER
!= eAnchor
)
1129 pShapeVertOrientAtCharState
->mnIndex
= -1;
1130 if( pShapeVertOrientRelState
&& TextContentAnchorType_AT_PARAGRAPH
!= eAnchor
&&
1131 TextContentAnchorType_AT_CHARACTER
!= eAnchor
)
1132 pShapeVertOrientRelState
->mnIndex
= -1;
1133 if( pShapeVertOrientRelPageState
&& TextContentAnchorType_AT_PAGE
!= eAnchor
)
1134 pShapeVertOrientRelPageState
->mnIndex
= -1;
1135 if( pShapeVertOrientRelFrameState
&& TextContentAnchorType_AT_FRAME
!= eAnchor
)
1136 pShapeVertOrientRelFrameState
->mnIndex
= -1;
1139 // list style name: remove list style if it is the default outline style
1140 if( pListStyleName
!= nullptr )
1142 OUString sListStyleName
;
1143 pListStyleName
->maValue
>>= sListStyleName
;
1144 if( lcl_IsOutlineStyle( GetExport(), sListStyleName
) )
1145 pListStyleName
->mnIndex
= -1;
1148 if( pClipState
!= nullptr && pClip11State
!= nullptr )
1149 pClip11State
->mnIndex
= -1;
1151 // When both background attributes are available export the visible one
1154 Color nColor
= COL_TRANSPARENT
;
1155 pCharHighlight
->maValue
>>= nColor
;
1156 if( nColor
== COL_TRANSPARENT
)
1158 // actually this would not be exported as transparent anyway
1159 // and we'd need another property CharHighlightTransparent for that
1160 pCharHighlight
->mnIndex
= -1;
1162 // When both background attributes are available export the visible one
1163 else if(pCharBackground
)
1165 assert(pCharBackgroundTransparency
); // always together
1166 pCharBackground
->mnIndex
= -1;
1167 pCharBackgroundTransparency
->mnIndex
= -1;
1171 SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily
, rProperties
, rPropSet
);
1176 bool lcl_IsOutlineStyle(const SvXMLExport
&rExport
, const OUString
& rName
)
1178 Reference
< XChapterNumberingSupplier
>
1179 xCNSupplier(rExport
.GetModel(), UNO_QUERY
);
1181 OUString sOutlineName
;
1183 if (xCNSupplier
.is())
1185 Reference
<XPropertySet
> xNumRule(
1186 xCNSupplier
->getChapterNumberingRules(), UNO_QUERY
);
1187 SAL_WARN_IF( !xNumRule
.is(), "xmloff", "no chapter numbering rules" );
1190 xNumRule
->getPropertyValue("Name") >>= sOutlineName
;
1194 return rName
== sOutlineName
;
1199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */