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 "PageMasterExportPropMapper.hxx"
21 #include <xmloff/xmlprmap.hxx>
22 #include <xmloff/xmltoken.hxx>
23 #include <comphelper/types.hxx>
24 #include <com/sun/star/beans/XPropertySet.hpp>
25 #include <com/sun/star/table/BorderLine2.hpp>
26 #include <xmloff/PageMasterStyleMap.hxx>
27 #include <rtl/ref.hxx>
28 #include <comphelper/extract.hxx>
29 
30 using namespace ::com::sun::star;
31 using namespace ::com::sun::star::uno;
32 using namespace ::com::sun::star::beans;
33 using namespace ::comphelper;
34 using namespace ::xmloff::token;
35 
lcl_HasSameLineWidth(const table::BorderLine2 & rLine1,const table::BorderLine2 & rLine2)36 static bool lcl_HasSameLineWidth( const table::BorderLine2& rLine1, const table::BorderLine2& rLine2 )
37 {
38     return  (rLine1.InnerLineWidth == rLine2.InnerLineWidth) &&
39             (rLine1.OuterLineWidth == rLine2.OuterLineWidth) &&
40             (rLine1.LineDistance == rLine2.LineDistance) &&
41             (rLine1.LineWidth == rLine2.LineWidth);
42 }
43 
lcl_RemoveState(XMLPropertyState * pState)44 static void lcl_RemoveState( XMLPropertyState* pState )
45 {
46     pState->mnIndex = -1;
47     pState->maValue.clear();
48 }
49 
lcl_RemoveStateIfZero16(XMLPropertyState * pState)50 static void lcl_RemoveStateIfZero16( XMLPropertyState* pState )
51 {
52     sal_Int16   nValue = sal_Int16();
53     if( (pState->maValue >>= nValue) && !nValue )
54         lcl_RemoveState( pState );
55 }
56 
lcl_AddState(::std::vector<XMLPropertyState> & rPropState,sal_Int32 nIndex,const OUString & rProperty,const uno::Reference<beans::XPropertySet> & xProps)57 static void lcl_AddState(::std::vector< XMLPropertyState >& rPropState, sal_Int32 nIndex, const OUString& rProperty, const uno::Reference< beans::XPropertySet >& xProps)
58 {
59     if(::cppu::any2bool(xProps->getPropertyValue(rProperty)))
60         rPropState.emplace_back(nIndex, css::uno::Any(true));
61 }
62 
63 // helper struct to handle equal XMLPropertyState's for page, header and footer
64 
65 struct XMLPropertyStateBuffer
66 {
67     XMLPropertyState*       pPMMarginAll;
68 
69     XMLPropertyState*       pPMBorderAll;
70     XMLPropertyState*       pPMBorderTop;
71     XMLPropertyState*       pPMBorderBottom;
72     XMLPropertyState*       pPMBorderLeft;
73     XMLPropertyState*       pPMBorderRight;
74 
75     XMLPropertyState*       pPMBorderWidthAll;
76     XMLPropertyState*       pPMBorderWidthTop;
77     XMLPropertyState*       pPMBorderWidthBottom;
78     XMLPropertyState*       pPMBorderWidthLeft;
79     XMLPropertyState*       pPMBorderWidthRight;
80 
81     XMLPropertyState*       pPMPaddingAll;
82     XMLPropertyState*       pPMPaddingTop;
83     XMLPropertyState*       pPMPaddingBottom;
84     XMLPropertyState*       pPMPaddingLeft;
85     XMLPropertyState*       pPMPaddingRight;
86 
87                             XMLPropertyStateBuffer();
88     void                    ContextFilter( ::std::vector< XMLPropertyState >& rPropState );
89 };
90 
XMLPropertyStateBuffer()91 XMLPropertyStateBuffer::XMLPropertyStateBuffer()
92     :   pPMMarginAll( nullptr )
93     ,
94         pPMBorderAll( nullptr ),
95         pPMBorderTop( nullptr ),
96         pPMBorderBottom( nullptr ),
97         pPMBorderLeft( nullptr ),
98         pPMBorderRight( nullptr ),
99 
100         pPMBorderWidthAll( nullptr ),
101         pPMBorderWidthTop( nullptr ),
102         pPMBorderWidthBottom( nullptr ),
103         pPMBorderWidthLeft( nullptr ),
104         pPMBorderWidthRight( nullptr ),
105 
106         pPMPaddingAll( nullptr ),
107         pPMPaddingTop( nullptr ),
108         pPMPaddingBottom( nullptr ),
109         pPMPaddingLeft( nullptr ),
110         pPMPaddingRight( nullptr )
111 {
112 }
113 
ContextFilter(::std::vector<XMLPropertyState> &)114 void XMLPropertyStateBuffer::ContextFilter( ::std::vector< XMLPropertyState >& )
115 {
116     if (pPMMarginAll)
117     {
118         lcl_RemoveState(pPMMarginAll); // #i117696# do not write fo:margin
119     }
120 
121     if( pPMBorderAll )
122     {
123         if( pPMBorderTop && pPMBorderBottom && pPMBorderLeft && pPMBorderRight )
124         {
125             table::BorderLine2 aLineTop, aLineBottom, aLineLeft, aLineRight;
126 
127             pPMBorderTop->maValue >>= aLineTop;
128             pPMBorderBottom->maValue >>= aLineBottom;
129             pPMBorderLeft->maValue >>= aLineLeft;
130             pPMBorderRight->maValue >>= aLineRight;
131 
132             if( (aLineTop == aLineBottom) && (aLineBottom == aLineLeft) && (aLineLeft == aLineRight) )
133             {
134                 lcl_RemoveState( pPMBorderTop );
135                 lcl_RemoveState( pPMBorderBottom );
136                 lcl_RemoveState( pPMBorderLeft );
137                 lcl_RemoveState( pPMBorderRight );
138             }
139             else
140                 lcl_RemoveState( pPMBorderAll );
141         }
142         else
143             lcl_RemoveState( pPMBorderAll );
144     }
145 
146     if( pPMBorderWidthAll )
147     {
148         if( pPMBorderWidthTop && pPMBorderWidthBottom && pPMBorderWidthLeft && pPMBorderWidthRight )
149         {
150             table::BorderLine2 aLineTop, aLineBottom, aLineLeft, aLineRight;
151 
152             pPMBorderWidthTop->maValue >>= aLineTop;
153             pPMBorderWidthBottom->maValue >>= aLineBottom;
154             pPMBorderWidthLeft->maValue >>= aLineLeft;
155             pPMBorderWidthRight->maValue >>= aLineRight;
156 
157             if( lcl_HasSameLineWidth( aLineTop, aLineBottom ) &&
158                 lcl_HasSameLineWidth( aLineBottom, aLineLeft ) &&
159                 lcl_HasSameLineWidth( aLineLeft, aLineRight ) )
160             {
161                 lcl_RemoveState( pPMBorderWidthTop );
162                 lcl_RemoveState( pPMBorderWidthBottom );
163                 lcl_RemoveState( pPMBorderWidthLeft );
164                 lcl_RemoveState( pPMBorderWidthRight );
165             }
166             else
167                 lcl_RemoveState( pPMBorderWidthAll );
168         }
169         else
170             lcl_RemoveState( pPMBorderWidthAll );
171     }
172 
173     if( pPMPaddingAll )
174     {
175         if( pPMPaddingTop && pPMPaddingBottom && pPMPaddingLeft && pPMPaddingRight )
176         {
177             sal_Int32 nTop = 0, nBottom = 0, nLeft = 0, nRight = 0;
178 
179             pPMPaddingTop->maValue >>= nTop;
180             pPMPaddingBottom->maValue >>= nBottom;
181             pPMPaddingLeft->maValue >>= nLeft;
182             pPMPaddingRight->maValue >>= nRight;
183 
184             if( (nTop == nBottom) && (nBottom == nLeft) && (nLeft == nRight) )
185             {
186                 lcl_RemoveState( pPMPaddingTop );
187                 lcl_RemoveState( pPMPaddingBottom );
188                 lcl_RemoveState( pPMPaddingLeft );
189                 lcl_RemoveState( pPMPaddingRight );
190             }
191             else
192                 lcl_RemoveState( pPMPaddingAll );
193         }
194         else
195             lcl_RemoveState( pPMPaddingAll );
196     }
197 }
198 
XMLPageMasterExportPropMapper(const rtl::Reference<XMLPropertySetMapper> & rMapper,SvXMLExport & rExport)199 XMLPageMasterExportPropMapper::XMLPageMasterExportPropMapper(
200         const rtl::Reference< XMLPropertySetMapper >& rMapper,
201         SvXMLExport& rExport ) :
202     SvXMLExportPropertyMapper( rMapper ),
203     aBackgroundImageExport( rExport ),
204     aTextColumnsExport( rExport ),
205     aFootnoteSeparatorExport( rExport )
206 {
207 }
208 
~XMLPageMasterExportPropMapper()209 XMLPageMasterExportPropMapper::~XMLPageMasterExportPropMapper()
210 {
211 }
212 
handleElementItem(SvXMLExport &,const XMLPropertyState & rProperty,SvXmlExportFlags,const::std::vector<XMLPropertyState> * pProperties,sal_uInt32 nIdx) const213 void XMLPageMasterExportPropMapper::handleElementItem(
214         SvXMLExport&,
215         const XMLPropertyState& rProperty,
216         SvXmlExportFlags /*nFlags*/,
217         const ::std::vector< XMLPropertyState >* pProperties,
218         sal_uInt32 nIdx ) const
219 {
220     XMLPageMasterExportPropMapper* pThis = const_cast<XMLPageMasterExportPropMapper*>(this);
221 
222     sal_uInt32 nContextId = getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex );
223     switch( nContextId )
224     {
225         case CTF_PM_GRAPHICURL:
226         case CTF_PM_HEADERGRAPHICURL:
227         case CTF_PM_FOOTERGRAPHICURL:
228             {
229                 assert(pProperties);
230                 assert(nIdx >= 2 && "horrible array ordering borked again");
231                 sal_Int32 nPos(-1);
232                 sal_Int32 nFilter(-1);
233                 switch( nContextId  )
234                 {
235                 case CTF_PM_GRAPHICURL:
236                     nPos = CTF_PM_GRAPHICPOSITION;
237                     nFilter = CTF_PM_GRAPHICFILTER;
238                     break;
239                 case CTF_PM_HEADERGRAPHICURL:
240                     nPos = CTF_PM_HEADERGRAPHICPOSITION;
241                     nFilter = CTF_PM_HEADERGRAPHICFILTER;
242                     break;
243                 case CTF_PM_FOOTERGRAPHICURL:
244                     nPos = CTF_PM_FOOTERGRAPHICPOSITION;
245                     nFilter = CTF_PM_FOOTERGRAPHICFILTER;
246                     break;
247                 default:
248                     assert(false);
249                 }
250                 const Any*  pPos    = nullptr;
251                 const Any*  pFilter = nullptr;
252                 sal_uInt32 nIndex(nIdx - 1);
253                 const XMLPropertyState& rFilter = (*pProperties)[nIndex];
254                 if (getPropertySetMapper()->GetEntryContextId(rFilter.mnIndex) == nFilter)
255                 {
256                     pFilter = &rFilter.maValue;
257                     --nIndex;
258                 }
259                 const XMLPropertyState& rPos = (*pProperties)[nIndex];
260                 if (getPropertySetMapper()->GetEntryContextId(rPos.mnIndex) == nPos)
261                 {
262                     pPos = &rPos.maValue;
263                     --nIndex;
264                 }
265                 sal_uInt32 nPropIndex = rProperty.mnIndex;
266                 pThis->aBackgroundImageExport.exportXML( rProperty.maValue, pPos, pFilter, nullptr,
267                     getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
268                     getPropertySetMapper()->GetEntryXMLName( nPropIndex ) );
269             }
270             break;
271         case CTF_PM_TEXTCOLUMNS:
272             pThis->aTextColumnsExport.exportXML( rProperty.maValue );
273             break;
274         case CTF_PM_FTN_LINE_WEIGHT:
275             pThis->aFootnoteSeparatorExport.exportXML( pProperties, nIdx,
276                                                        getPropertySetMapper());
277             break;
278     }
279 }
280 
handleSpecialItem(SvXMLAttributeList &,const XMLPropertyState &,const SvXMLUnitConverter &,const SvXMLNamespaceMap &,const::std::vector<XMLPropertyState> *,sal_uInt32) const281 void XMLPageMasterExportPropMapper::handleSpecialItem(
282         SvXMLAttributeList&,
283         const XMLPropertyState&,
284         const SvXMLUnitConverter&,
285         const SvXMLNamespaceMap&,
286         const ::std::vector< XMLPropertyState >*,
287         sal_uInt32 /*nIdx*/) const
288 {
289 }
290 
ContextFilter(bool bEnableFoFontFamily,::std::vector<XMLPropertyState> & rPropState,const Reference<XPropertySet> & rPropSet) const291 void XMLPageMasterExportPropMapper::ContextFilter(
292         bool bEnableFoFontFamily,
293         ::std::vector< XMLPropertyState >& rPropState,
294         const Reference< XPropertySet >& rPropSet ) const
295 {
296     XMLPropertyStateBuffer  aPageBuffer;
297     XMLPropertyStateBuffer  aHeaderBuffer;
298     XMLPropertyStateBuffer  aFooterBuffer;
299 
300     XMLPropertyState*       pPMHeaderHeight     = nullptr;
301     XMLPropertyState*       pPMHeaderMinHeight  = nullptr;
302     XMLPropertyState*       pPMHeaderDynamic    = nullptr;
303 
304     XMLPropertyState*       pPMFooterHeight     = nullptr;
305     XMLPropertyState*       pPMFooterMinHeight  = nullptr;
306     XMLPropertyState*       pPMFooterDynamic    = nullptr;
307 
308     XMLPropertyState*       pPMScaleTo          = nullptr;
309     XMLPropertyState*       pPMScaleToPages     = nullptr;
310     XMLPropertyState*       pPMScaleToX         = nullptr;
311     XMLPropertyState*       pPMScaleToY         = nullptr;
312     XMLPropertyState*       pPMStandardMode     = nullptr;
313     XMLPropertyState*       pPMGridBaseWidth    = nullptr;
314     // same as pPMGridSnapTo but for backward compatibility only
315     XMLPropertyState*       pPMGridSnapToChars  = nullptr;
316     XMLPropertyState*       pPMGridSnapTo       = nullptr;
317 
318     XMLPropertyState*       pPrint              = nullptr;
319 
320     XMLPropertyState* pRepeatOffsetX = nullptr;
321     XMLPropertyState* pRepeatOffsetY = nullptr;
322     XMLPropertyState* pHeaderRepeatOffsetX = nullptr;
323     XMLPropertyState* pHeaderRepeatOffsetY = nullptr;
324     XMLPropertyState* pFooterRepeatOffsetX = nullptr;
325     XMLPropertyState* pFooterRepeatOffsetY = nullptr;
326 
327     rtl::Reference < XMLPropertySetMapper > aPropMapper(getPropertySetMapper());
328 
329     for( auto& rProp : rPropState )
330     {
331         XMLPropertyState *pProp = &rProp;
332         sal_Int16 nContextId    = aPropMapper->GetEntryContextId( pProp->mnIndex );
333         sal_Int16 nFlag         = nContextId & CTF_PM_FLAGMASK;
334         sal_Int16 nSimpleId     = nContextId & (~CTF_PM_FLAGMASK | XML_PM_CTF_START);
335         sal_Int16 nPrintId      = nContextId & CTF_PM_PRINTMASK;
336 
337         XMLPropertyStateBuffer* pBuffer;
338         switch( nFlag )
339         {
340             case CTF_PM_HEADERFLAG:         pBuffer = &aHeaderBuffer;   break;
341             case CTF_PM_FOOTERFLAG:         pBuffer = &aFooterBuffer;   break;
342             default:                        pBuffer = &aPageBuffer;     break;
343         }
344 
345         switch( nSimpleId )
346         {
347             case CTF_PM_MARGINALL:          pBuffer->pPMMarginAll           = pProp;    break;
348             case CTF_PM_BORDERALL:          pBuffer->pPMBorderAll           = pProp;    break;
349             case CTF_PM_BORDERTOP:          pBuffer->pPMBorderTop           = pProp;    break;
350             case CTF_PM_BORDERBOTTOM:       pBuffer->pPMBorderBottom        = pProp;    break;
351             case CTF_PM_BORDERLEFT:         pBuffer->pPMBorderLeft          = pProp;    break;
352             case CTF_PM_BORDERRIGHT:        pBuffer->pPMBorderRight         = pProp;    break;
353             case CTF_PM_BORDERWIDTHALL:     pBuffer->pPMBorderWidthAll      = pProp;    break;
354             case CTF_PM_BORDERWIDTHTOP:     pBuffer->pPMBorderWidthTop      = pProp;    break;
355             case CTF_PM_BORDERWIDTHBOTTOM:  pBuffer->pPMBorderWidthBottom   = pProp;    break;
356             case CTF_PM_BORDERWIDTHLEFT:    pBuffer->pPMBorderWidthLeft     = pProp;    break;
357             case CTF_PM_BORDERWIDTHRIGHT:   pBuffer->pPMBorderWidthRight    = pProp;    break;
358             case CTF_PM_PADDINGALL:         pBuffer->pPMPaddingAll          = pProp;    break;
359             case CTF_PM_PADDINGTOP:         pBuffer->pPMPaddingTop          = pProp;    break;
360             case CTF_PM_PADDINGBOTTOM:      pBuffer->pPMPaddingBottom       = pProp;    break;
361             case CTF_PM_PADDINGLEFT:        pBuffer->pPMPaddingLeft         = pProp;    break;
362             case CTF_PM_PADDINGRIGHT:       pBuffer->pPMPaddingRight        = pProp;    break;
363         }
364 
365         switch( nContextId )
366         {
367             case CTF_PM_HEADERHEIGHT:       pPMHeaderHeight     = pProp;    break;
368             case CTF_PM_HEADERMINHEIGHT:    pPMHeaderMinHeight  = pProp;    break;
369             case CTF_PM_HEADERDYNAMIC:      pPMHeaderDynamic    = pProp;    break;
370             case CTF_PM_FOOTERHEIGHT:       pPMFooterHeight     = pProp;    break;
371             case CTF_PM_FOOTERMINHEIGHT:    pPMFooterMinHeight  = pProp;    break;
372             case CTF_PM_FOOTERDYNAMIC:      pPMFooterDynamic    = pProp;    break;
373             case CTF_PM_SCALETO:            pPMScaleTo          = pProp;    break;
374             case CTF_PM_SCALETOPAGES:       pPMScaleToPages     = pProp;    break;
375             case CTF_PM_SCALETOX:           pPMScaleToX         = pProp;    break;
376             case CTF_PM_SCALETOY:           pPMScaleToY         = pProp;    break;
377             case CTF_PM_STANDARD_MODE:      pPMStandardMode     = pProp;    break;
378             case CTP_PM_GRID_BASE_WIDTH:        pPMGridBaseWidth    = pProp;    break;
379             case CTP_PM_GRID_SNAP_TO_CHARS:     pPMGridSnapToChars  = pProp;    break;
380             case CTP_PM_GRID_SNAP_TO:       pPMGridSnapTo = pProp;    break;
381 
382             case CTF_PM_REPEAT_OFFSET_X:
383                 pRepeatOffsetX = pProp;
384                 break;
385 
386             case CTF_PM_REPEAT_OFFSET_Y:
387                 pRepeatOffsetY = pProp;
388                 break;
389 
390             case CTF_PM_HEADERREPEAT_OFFSET_X:
391                 pHeaderRepeatOffsetX = pProp;
392                 break;
393 
394             case CTF_PM_HEADERREPEAT_OFFSET_Y:
395                 pHeaderRepeatOffsetY = pProp;
396                 break;
397 
398             case CTF_PM_FOOTERREPEAT_OFFSET_X:
399                 pFooterRepeatOffsetX = pProp;
400                 break;
401 
402             case CTF_PM_FOOTERREPEAT_OFFSET_Y:
403                 pFooterRepeatOffsetY = pProp;
404                 break;
405 
406             // Sort out empty entries
407             case CTF_PM_FILLGRADIENTNAME:
408             case CTF_PM_FILLHATCHNAME:
409             case CTF_PM_FILLBITMAPNAME:
410             case CTF_PM_FILLTRANSNAME:
411 
412             case CTF_PM_HEADERFILLGRADIENTNAME:
413             case CTF_PM_HEADERFILLHATCHNAME:
414             case CTF_PM_HEADERFILLBITMAPNAME:
415             case CTF_PM_HEADERFILLTRANSNAME:
416 
417             case CTF_PM_FOOTERFILLGRADIENTNAME:
418             case CTF_PM_FOOTERFILLHATCHNAME:
419             case CTF_PM_FOOTERFILLBITMAPNAME:
420             case CTF_PM_FOOTERFILLTRANSNAME:
421             {
422                 OUString aStr;
423 
424                 if( (pProp->maValue >>= aStr) && 0 == aStr.getLength() )
425                 {
426                     pProp->mnIndex = -1;
427                 }
428 
429                 break;
430             }
431         }
432 
433         if (nPrintId == CTF_PM_PRINTMASK)
434         {
435             pPrint = pProp;
436             lcl_RemoveState(pPrint);
437         }
438     }
439 
440     // These entries need to be reduced to a single one for XML export.
441     // Both would be exported as 'draw:tile-repeat-offset' following a percent
442     // value and a 'vertical' or 'horizontal' tag as mark. If both would be active
443     // and both would be exported this would create an XML error (same property twice)
444     if(pRepeatOffsetX && pRepeatOffsetY)
445     {
446         sal_Int32 nOffset(0);
447 
448         if((pRepeatOffsetX->maValue >>= nOffset) && (!nOffset))
449         {
450             pRepeatOffsetX->mnIndex = -1;
451         }
452         else
453         {
454             pRepeatOffsetY->mnIndex = -1;
455         }
456     }
457 
458     // Same as above for Header
459     if(pHeaderRepeatOffsetX && pHeaderRepeatOffsetY)
460     {
461         sal_Int32 nOffset(0);
462 
463         if((pHeaderRepeatOffsetX->maValue >>= nOffset) && (!nOffset))
464         {
465             pHeaderRepeatOffsetX->mnIndex = -1;
466         }
467         else
468         {
469             pHeaderRepeatOffsetY->mnIndex = -1;
470         }
471     }
472 
473     // Same as above for Footer
474     if(pFooterRepeatOffsetX && pFooterRepeatOffsetY)
475     {
476         sal_Int32 nOffset(0);
477 
478         if((pFooterRepeatOffsetX->maValue >>= nOffset) && (!nOffset))
479         {
480             pFooterRepeatOffsetX->mnIndex = -1;
481         }
482         else
483         {
484             pFooterRepeatOffsetY->mnIndex = -1;
485         }
486     }
487 
488     if( pPMStandardMode && !getBOOL(pPMStandardMode->maValue) )
489     {
490         lcl_RemoveState(pPMStandardMode);
491         if( pPMGridBaseWidth )
492             lcl_RemoveState(pPMGridBaseWidth);
493         if( pPMGridSnapToChars )
494             lcl_RemoveState(pPMGridSnapToChars);
495         if (pPMGridSnapTo)
496         {
497             lcl_RemoveState(pPMGridSnapTo);
498         }
499     }
500 
501     if( pPMGridBaseWidth && pPMStandardMode )
502         lcl_RemoveState(pPMStandardMode);
503 
504     aPageBuffer.ContextFilter( rPropState );
505     aHeaderBuffer.ContextFilter( rPropState );
506     aFooterBuffer.ContextFilter( rPropState );
507 
508     if( pPMHeaderHeight && (!pPMHeaderDynamic || getBOOL( pPMHeaderDynamic->maValue )) )
509         lcl_RemoveState( pPMHeaderHeight );
510     if( pPMHeaderMinHeight && pPMHeaderDynamic && !getBOOL( pPMHeaderDynamic->maValue ) )
511         lcl_RemoveState( pPMHeaderMinHeight );
512     if( pPMHeaderDynamic )
513         lcl_RemoveState( pPMHeaderDynamic );
514 
515     if( pPMFooterHeight && (!pPMFooterDynamic || getBOOL( pPMFooterDynamic->maValue )) )
516         lcl_RemoveState( pPMFooterHeight );
517     if( pPMFooterMinHeight && pPMFooterDynamic && !getBOOL( pPMFooterDynamic->maValue ) )
518         lcl_RemoveState( pPMFooterMinHeight );
519     if( pPMFooterDynamic )
520         lcl_RemoveState( pPMFooterDynamic );
521 
522     if( pPMScaleTo )
523         lcl_RemoveStateIfZero16( pPMScaleTo );
524     if( pPMScaleToPages )
525         lcl_RemoveStateIfZero16( pPMScaleToPages );
526     if( pPMScaleToX )
527         lcl_RemoveStateIfZero16( pPMScaleToX );
528     if( pPMScaleToY )
529         lcl_RemoveStateIfZero16( pPMScaleToY );
530 
531     if (pPrint)
532     {
533         lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_ANNOTATIONS), "PrintAnnotations", rPropSet);
534         lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_CHARTS), "PrintCharts", rPropSet);
535         lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_DRAWING), "PrintDrawing", rPropSet);
536         lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_FORMULAS), "PrintFormulas", rPropSet);
537         lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_GRID), "PrintGrid", rPropSet);
538         lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_HEADERS), "PrintHeaders", rPropSet);
539         lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_OBJECTS), "PrintObjects", rPropSet);
540         lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_ZEROVALUES), "PrintZeroValues", rPropSet);
541     }
542 
543     SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rPropState, rPropSet);
544 }
545 
546 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
547