LibreOffice Module xmloff (master)  1
PageMasterExportPropMapper.cxx
Go to the documentation of this file.
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 
21 #include <xmloff/xmlprmap.hxx>
22 #include <xmloff/xmltoken.hxx>
23 #include <xmloff/xmlexp.hxx>
24 #include <comphelper/types.hxx>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/table/BorderLine2.hpp>
27 #include <com/sun/star/drawing/FillStyle.hpp>
28 #include <com/sun/star/drawing/BitmapMode.hpp>
29 #include <PageMasterStyleMap.hxx>
30 #include <rtl/ref.hxx>
31 #include <comphelper/extract.hxx>
32 
33 using namespace ::com::sun::star;
34 using namespace ::com::sun::star::uno;
35 using namespace ::com::sun::star::beans;
36 using namespace ::comphelper;
37 using namespace ::xmloff::token;
38 
39 static bool lcl_HasSameLineWidth( const table::BorderLine2& rLine1, const table::BorderLine2& rLine2 )
40 {
41  return (rLine1.InnerLineWidth == rLine2.InnerLineWidth) &&
42  (rLine1.OuterLineWidth == rLine2.OuterLineWidth) &&
43  (rLine1.LineDistance == rLine2.LineDistance) &&
44  (rLine1.LineWidth == rLine2.LineWidth);
45 }
46 
47 static void lcl_RemoveState( XMLPropertyState* pState )
48 {
49  pState->mnIndex = -1;
50  pState->maValue.clear();
51 }
52 
54 {
55  sal_Int16 nValue = sal_Int16();
56  if( (pState->maValue >>= nValue) && !nValue )
57  lcl_RemoveState( pState );
58 }
59 
60 static void lcl_AddState(::std::vector< XMLPropertyState >& rPropState, sal_Int32 nIndex, const OUString& rProperty, const uno::Reference< beans::XPropertySet >& xProps)
61 {
62  if(::cppu::any2bool(xProps->getPropertyValue(rProperty)))
63  rPropState.emplace_back(nIndex, css::uno::Any(true));
64 }
65 
66 // helper struct to handle equal XMLPropertyState's for page, header and footer
67 
68 namespace {
69 
70 struct XMLPropertyStateBuffer
71 {
72  XMLPropertyState* pPMMarginAll;
73 
74  XMLPropertyState* pPMBorderAll;
75  XMLPropertyState* pPMBorderTop;
76  XMLPropertyState* pPMBorderBottom;
77  XMLPropertyState* pPMBorderLeft;
78  XMLPropertyState* pPMBorderRight;
79 
80  XMLPropertyState* pPMBorderWidthAll;
81  XMLPropertyState* pPMBorderWidthTop;
82  XMLPropertyState* pPMBorderWidthBottom;
83  XMLPropertyState* pPMBorderWidthLeft;
84  XMLPropertyState* pPMBorderWidthRight;
85 
86  XMLPropertyState* pPMPaddingAll;
87  XMLPropertyState* pPMPaddingTop;
88  XMLPropertyState* pPMPaddingBottom;
89  XMLPropertyState* pPMPaddingLeft;
90  XMLPropertyState* pPMPaddingRight;
91 
92  XMLPropertyStateBuffer();
93  void ContextFilter( ::std::vector< XMLPropertyState >& rPropState );
94 };
95 
96 }
97 
98 XMLPropertyStateBuffer::XMLPropertyStateBuffer()
99  : pPMMarginAll( nullptr )
100  ,
101  pPMBorderAll( nullptr ),
102  pPMBorderTop( nullptr ),
103  pPMBorderBottom( nullptr ),
104  pPMBorderLeft( nullptr ),
105  pPMBorderRight( nullptr ),
106 
107  pPMBorderWidthAll( nullptr ),
108  pPMBorderWidthTop( nullptr ),
109  pPMBorderWidthBottom( nullptr ),
110  pPMBorderWidthLeft( nullptr ),
111  pPMBorderWidthRight( nullptr ),
112 
113  pPMPaddingAll( nullptr ),
114  pPMPaddingTop( nullptr ),
115  pPMPaddingBottom( nullptr ),
116  pPMPaddingLeft( nullptr ),
117  pPMPaddingRight( nullptr )
118 {
119 }
120 
121 void XMLPropertyStateBuffer::ContextFilter( ::std::vector< XMLPropertyState >& )
122 {
123  if (pPMMarginAll)
124  {
125  lcl_RemoveState(pPMMarginAll); // #i117696# do not write fo:margin
126  }
127 
128  if( pPMBorderAll )
129  {
130  if( pPMBorderTop && pPMBorderBottom && pPMBorderLeft && pPMBorderRight )
131  {
132  table::BorderLine2 aLineTop, aLineBottom, aLineLeft, aLineRight;
133 
134  pPMBorderTop->maValue >>= aLineTop;
135  pPMBorderBottom->maValue >>= aLineBottom;
136  pPMBorderLeft->maValue >>= aLineLeft;
137  pPMBorderRight->maValue >>= aLineRight;
138 
139  if( (aLineTop == aLineBottom) && (aLineBottom == aLineLeft) && (aLineLeft == aLineRight) )
140  {
141  lcl_RemoveState( pPMBorderTop );
142  lcl_RemoveState( pPMBorderBottom );
143  lcl_RemoveState( pPMBorderLeft );
144  lcl_RemoveState( pPMBorderRight );
145  }
146  else
147  lcl_RemoveState( pPMBorderAll );
148  }
149  else
150  lcl_RemoveState( pPMBorderAll );
151  }
152 
153  if( pPMBorderWidthAll )
154  {
155  if( pPMBorderWidthTop && pPMBorderWidthBottom && pPMBorderWidthLeft && pPMBorderWidthRight )
156  {
157  table::BorderLine2 aLineTop, aLineBottom, aLineLeft, aLineRight;
158 
159  pPMBorderWidthTop->maValue >>= aLineTop;
160  pPMBorderWidthBottom->maValue >>= aLineBottom;
161  pPMBorderWidthLeft->maValue >>= aLineLeft;
162  pPMBorderWidthRight->maValue >>= aLineRight;
163 
164  if( lcl_HasSameLineWidth( aLineTop, aLineBottom ) &&
165  lcl_HasSameLineWidth( aLineBottom, aLineLeft ) &&
166  lcl_HasSameLineWidth( aLineLeft, aLineRight ) )
167  {
168  lcl_RemoveState( pPMBorderWidthTop );
169  lcl_RemoveState( pPMBorderWidthBottom );
170  lcl_RemoveState( pPMBorderWidthLeft );
171  lcl_RemoveState( pPMBorderWidthRight );
172  }
173  else
174  lcl_RemoveState( pPMBorderWidthAll );
175  }
176  else
177  lcl_RemoveState( pPMBorderWidthAll );
178  }
179 
180  if( !pPMPaddingAll )
181  return;
182 
183  if( pPMPaddingTop && pPMPaddingBottom && pPMPaddingLeft && pPMPaddingRight )
184  {
185  sal_Int32 nTop = 0, nBottom = 0, nLeft = 0, nRight = 0;
186 
187  pPMPaddingTop->maValue >>= nTop;
188  pPMPaddingBottom->maValue >>= nBottom;
189  pPMPaddingLeft->maValue >>= nLeft;
190  pPMPaddingRight->maValue >>= nRight;
191 
192  if( (nTop == nBottom) && (nBottom == nLeft) && (nLeft == nRight) )
193  {
194  lcl_RemoveState( pPMPaddingTop );
195  lcl_RemoveState( pPMPaddingBottom );
196  lcl_RemoveState( pPMPaddingLeft );
197  lcl_RemoveState( pPMPaddingRight );
198  }
199  else
200  lcl_RemoveState( pPMPaddingAll );
201  }
202  else
203  lcl_RemoveState( pPMPaddingAll );
204 }
205 
208  SvXMLExport& rExport ) :
209  SvXMLExportPropertyMapper( rMapper ),
210  aBackgroundImageExport( rExport ),
211  aTextColumnsExport( rExport ),
212  aFootnoteSeparatorExport( rExport )
213 {
214 }
215 
217 {
218 }
219 
221  SvXMLExport&,
222  const XMLPropertyState& rProperty,
223  SvXmlExportFlags /*nFlags*/,
224  const ::std::vector< XMLPropertyState >* pProperties,
225  sal_uInt32 nIdx ) const
226 {
228 
229  sal_uInt32 nContextId = getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex );
230  switch( nContextId )
231  {
232  case CTF_PM_GRAPHICURL:
235  {
236  assert(pProperties);
237  assert(nIdx >= 2 && "horrible array ordering borked again");
238  sal_Int32 nPos(-1);
239  sal_Int32 nFilter(-1);
240  switch( nContextId )
241  {
242  case CTF_PM_GRAPHICURL:
243  nPos = CTF_PM_GRAPHICPOSITION;
244  nFilter = CTF_PM_GRAPHICFILTER;
245  break;
248  nFilter = CTF_PM_HEADERGRAPHICFILTER;
249  break;
252  nFilter = CTF_PM_FOOTERGRAPHICFILTER;
253  break;
254  default:
255  assert(false);
256  }
257  const Any* pPos = nullptr;
258  const Any* pFilter = nullptr;
259  sal_uInt32 nIndex(nIdx - 1);
260  const XMLPropertyState& rFilter = (*pProperties)[nIndex];
261  if (getPropertySetMapper()->GetEntryContextId(rFilter.mnIndex) == nFilter)
262  {
263  pFilter = &rFilter.maValue;
264  --nIndex;
265  }
266  const XMLPropertyState& rPos = (*pProperties)[nIndex];
267  if (getPropertySetMapper()->GetEntryContextId(rPos.mnIndex) == nPos)
268  {
269  pPos = &rPos.maValue;
270  --nIndex;
271  }
272  sal_uInt32 nPropIndex = rProperty.mnIndex;
273  pThis->aBackgroundImageExport.exportXML( rProperty.maValue, pPos, pFilter, nullptr,
274  getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
275  getPropertySetMapper()->GetEntryXMLName( nPropIndex ) );
276  }
277  break;
278  case CTF_PM_TEXTCOLUMNS:
279  pThis->aTextColumnsExport.exportXML( rProperty.maValue );
280  break;
282  pThis->aFootnoteSeparatorExport.exportXML( pProperties, nIdx,
284  break;
285  }
286 }
287 
290  const XMLPropertyState&,
291  const SvXMLUnitConverter&,
292  const SvXMLNamespaceMap&,
293  const ::std::vector< XMLPropertyState >*,
294  sal_uInt32 /*nIdx*/) const
295 {
296 }
297 
299  bool bEnableFoFontFamily,
300  ::std::vector< XMLPropertyState >& rPropState,
301  const Reference< XPropertySet >& rPropSet ) const
302 {
303  XMLPropertyStateBuffer aPageBuffer;
304  XMLPropertyStateBuffer aHeaderBuffer;
305  XMLPropertyStateBuffer aFooterBuffer;
306 
307  XMLPropertyState* pPMHeaderHeight = nullptr;
308  XMLPropertyState* pPMHeaderMinHeight = nullptr;
309  XMLPropertyState* pPMHeaderDynamic = nullptr;
310 
311  XMLPropertyState* pPMFooterHeight = nullptr;
312  XMLPropertyState* pPMFooterMinHeight = nullptr;
313  XMLPropertyState* pPMFooterDynamic = nullptr;
314 
315  XMLPropertyState* pPMScaleTo = nullptr;
316  XMLPropertyState* pPMScaleToPages = nullptr;
317  XMLPropertyState* pPMScaleToX = nullptr;
318  XMLPropertyState* pPMScaleToY = nullptr;
319  XMLPropertyState* pPMStandardMode = nullptr;
320  XMLPropertyState* pPMGridBaseWidth = nullptr;
321  // same as pPMGridSnapTo but for backward compatibility only
322  XMLPropertyState* pPMGridSnapToChars = nullptr;
323  XMLPropertyState* pPMGridSnapTo = nullptr;
324 
325  XMLPropertyState* pPrint = nullptr;
326 
327  XMLPropertyState* pRepeatOffsetX = nullptr;
328  XMLPropertyState* pRepeatOffsetY = nullptr;
329  XMLPropertyState* pHeaderRepeatOffsetX = nullptr;
330  XMLPropertyState* pHeaderRepeatOffsetY = nullptr;
331  XMLPropertyState* pFooterRepeatOffsetX = nullptr;
332  XMLPropertyState* pFooterRepeatOffsetY = nullptr;
333 
334  XMLPropertyState* pFill = nullptr;
335  XMLPropertyState* pFillBitmapMode = nullptr;
336 
338 
339  // distinguish 2 cases: drawing-page export has CTF_PM_FILL, page-layout-properties export does not
340  bool const isDrawingPageExport(aPropMapper->FindEntryIndex(CTF_PM_FILL) != -1);
341 
342  for( auto& rProp : rPropState )
343  {
344  XMLPropertyState *pProp = &rProp;
345  sal_Int16 nContextId = aPropMapper->GetEntryContextId( pProp->mnIndex );
346  sal_Int16 nFlag = nContextId & CTF_PM_FLAGMASK;
347  sal_Int16 nSimpleId = nContextId & (~CTF_PM_FLAGMASK | XML_PM_CTF_START);
348  sal_Int16 nPrintId = nContextId & CTF_PM_PRINTMASK;
349 
350 
351  // tdf#103602 don't export draw:fill attributes on page-layout-properties in strict ODF
352  if (!isDrawingPageExport
353  && [](OUString const& rName) -> bool {
354  return rName.startsWith("Fill")
355  || rName.startsWith("HeaderFill")
356  || rName.startsWith("FooterFill");
357  } (aPropMapper->GetEntryAPIName(rProp.mnIndex))
360  {
361  lcl_RemoveState(&rProp);
362  continue;
363  }
364 
365  XMLPropertyStateBuffer* pBuffer;
366  switch( nFlag )
367  {
368  case CTF_PM_HEADERFLAG: pBuffer = &aHeaderBuffer; break;
369  case CTF_PM_FOOTERFLAG: pBuffer = &aFooterBuffer; break;
370  default: pBuffer = &aPageBuffer; break;
371  }
372 
373  switch( nSimpleId )
374  {
375  case CTF_PM_FILL: // tdf#103602: add background-size attribute to ODT
376  if (nFlag != CTF_PM_HEADERFLAG && nFlag != CTF_PM_FOOTERFLAG
377  && rProp.maValue.hasValue())
378  {
379  pFill = &rProp;
380  }
381  break;
383  if (nFlag != CTF_PM_HEADERFLAG && nFlag != CTF_PM_FOOTERFLAG
384  && rProp.maValue.hasValue())
385  {
386  pFillBitmapMode = &rProp;
387  }
388  break;
389  case CTF_PM_MARGINALL: pBuffer->pPMMarginAll = pProp; break;
390  case CTF_PM_BORDERALL: pBuffer->pPMBorderAll = pProp; break;
391  case CTF_PM_BORDERTOP: pBuffer->pPMBorderTop = pProp; break;
392  case CTF_PM_BORDERBOTTOM: pBuffer->pPMBorderBottom = pProp; break;
393  case CTF_PM_BORDERLEFT: pBuffer->pPMBorderLeft = pProp; break;
394  case CTF_PM_BORDERRIGHT: pBuffer->pPMBorderRight = pProp; break;
395  case CTF_PM_BORDERWIDTHALL: pBuffer->pPMBorderWidthAll = pProp; break;
396  case CTF_PM_BORDERWIDTHTOP: pBuffer->pPMBorderWidthTop = pProp; break;
397  case CTF_PM_BORDERWIDTHBOTTOM: pBuffer->pPMBorderWidthBottom = pProp; break;
398  case CTF_PM_BORDERWIDTHLEFT: pBuffer->pPMBorderWidthLeft = pProp; break;
399  case CTF_PM_BORDERWIDTHRIGHT: pBuffer->pPMBorderWidthRight = pProp; break;
400  case CTF_PM_PADDINGALL: pBuffer->pPMPaddingAll = pProp; break;
401  case CTF_PM_PADDINGTOP: pBuffer->pPMPaddingTop = pProp; break;
402  case CTF_PM_PADDINGBOTTOM: pBuffer->pPMPaddingBottom = pProp; break;
403  case CTF_PM_PADDINGLEFT: pBuffer->pPMPaddingLeft = pProp; break;
404  case CTF_PM_PADDINGRIGHT: pBuffer->pPMPaddingRight = pProp; break;
405  }
406 
407  switch( nContextId )
408  {
409  case CTF_PM_HEADERHEIGHT: pPMHeaderHeight = pProp; break;
410  case CTF_PM_HEADERMINHEIGHT: pPMHeaderMinHeight = pProp; break;
411  case CTF_PM_HEADERDYNAMIC: pPMHeaderDynamic = pProp; break;
412  case CTF_PM_FOOTERHEIGHT: pPMFooterHeight = pProp; break;
413  case CTF_PM_FOOTERMINHEIGHT: pPMFooterMinHeight = pProp; break;
414  case CTF_PM_FOOTERDYNAMIC: pPMFooterDynamic = pProp; break;
415  case CTF_PM_SCALETO: pPMScaleTo = pProp; break;
416  case CTF_PM_SCALETOPAGES: pPMScaleToPages = pProp; break;
417  case CTF_PM_SCALETOX: pPMScaleToX = pProp; break;
418  case CTF_PM_SCALETOY: pPMScaleToY = pProp; break;
419  case CTF_PM_STANDARD_MODE: pPMStandardMode = pProp; break;
420  case CTP_PM_GRID_BASE_WIDTH: pPMGridBaseWidth = pProp; break;
421  case CTP_PM_GRID_SNAP_TO_CHARS: pPMGridSnapToChars = pProp; break;
422  case CTP_PM_GRID_SNAP_TO: pPMGridSnapTo = pProp; break;
423 
425  pRepeatOffsetX = pProp;
426  break;
427 
429  pRepeatOffsetY = pProp;
430  break;
431 
433  pHeaderRepeatOffsetX = pProp;
434  break;
435 
437  pHeaderRepeatOffsetY = pProp;
438  break;
439 
441  pFooterRepeatOffsetX = pProp;
442  break;
443 
445  pFooterRepeatOffsetY = pProp;
446  break;
447 
448  // Sort out empty entries
453 
458 
463  {
464  OUString aStr;
465 
466  if( (pProp->maValue >>= aStr) && 0 == aStr.getLength() )
467  {
468  pProp->mnIndex = -1;
469  }
470 
471  break;
472  }
473  }
474 
475  if (nPrintId == CTF_PM_PRINTMASK)
476  {
477  pPrint = pProp;
478  lcl_RemoveState(pPrint);
479  }
480  }
481 
482  // These entries need to be reduced to a single one for XML export.
483  // Both would be exported as 'draw:tile-repeat-offset' following a percent
484  // value and a 'vertical' or 'horizontal' tag as mark. If both would be active
485  // and both would be exported this would create an XML error (same property twice)
486  if(pRepeatOffsetX && pRepeatOffsetY)
487  {
488  sal_Int32 nOffset(0);
489 
490  if((pRepeatOffsetX->maValue >>= nOffset) && (!nOffset))
491  {
492  pRepeatOffsetX->mnIndex = -1;
493  }
494  else
495  {
496  pRepeatOffsetY->mnIndex = -1;
497  }
498  }
499 
500  // Same as above for Header
501  if(pHeaderRepeatOffsetX && pHeaderRepeatOffsetY)
502  {
503  sal_Int32 nOffset(0);
504 
505  if((pHeaderRepeatOffsetX->maValue >>= nOffset) && (!nOffset))
506  {
507  pHeaderRepeatOffsetX->mnIndex = -1;
508  }
509  else
510  {
511  pHeaderRepeatOffsetY->mnIndex = -1;
512  }
513  }
514 
515  // Same as above for Footer
516  if(pFooterRepeatOffsetX && pFooterRepeatOffsetY)
517  {
518  sal_Int32 nOffset(0);
519 
520  if((pFooterRepeatOffsetX->maValue >>= nOffset) && (!nOffset))
521  {
522  pFooterRepeatOffsetX->mnIndex = -1;
523  }
524  else
525  {
526  pFooterRepeatOffsetY->mnIndex = -1;
527  }
528  }
529 
530  if( pPMStandardMode && !getBOOL(pPMStandardMode->maValue) )
531  {
532  lcl_RemoveState(pPMStandardMode);
533  if( pPMGridBaseWidth )
534  lcl_RemoveState(pPMGridBaseWidth);
535  if( pPMGridSnapToChars )
536  lcl_RemoveState(pPMGridSnapToChars);
537  if (pPMGridSnapTo)
538  {
539  lcl_RemoveState(pPMGridSnapTo);
540  }
541  }
542 
543  if( pPMGridBaseWidth && pPMStandardMode )
544  lcl_RemoveState(pPMStandardMode);
545 
546  aPageBuffer.ContextFilter( rPropState );
547  aHeaderBuffer.ContextFilter( rPropState );
548  aFooterBuffer.ContextFilter( rPropState );
549 
550  if( pPMHeaderHeight && (!pPMHeaderDynamic || getBOOL( pPMHeaderDynamic->maValue )) )
551  lcl_RemoveState( pPMHeaderHeight );
552  if( pPMHeaderMinHeight && pPMHeaderDynamic && !getBOOL( pPMHeaderDynamic->maValue ) )
553  lcl_RemoveState( pPMHeaderMinHeight );
554  if( pPMHeaderDynamic )
555  lcl_RemoveState( pPMHeaderDynamic );
556 
557  if( pPMFooterHeight && (!pPMFooterDynamic || getBOOL( pPMFooterDynamic->maValue )) )
558  lcl_RemoveState( pPMFooterHeight );
559  if( pPMFooterMinHeight && pPMFooterDynamic && !getBOOL( pPMFooterDynamic->maValue ) )
560  lcl_RemoveState( pPMFooterMinHeight );
561  if( pPMFooterDynamic )
562  lcl_RemoveState( pPMFooterDynamic );
563 
564  if( pPMScaleTo )
565  lcl_RemoveStateIfZero16( pPMScaleTo );
566  if( pPMScaleToPages )
567  lcl_RemoveStateIfZero16( pPMScaleToPages );
568  if( pPMScaleToX )
569  lcl_RemoveStateIfZero16( pPMScaleToX );
570  if( pPMScaleToY )
571  lcl_RemoveStateIfZero16( pPMScaleToY );
572 
573  if (pPrint)
574  {
575  lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_ANNOTATIONS), "PrintAnnotations", rPropSet);
576  lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_CHARTS), "PrintCharts", rPropSet);
577  lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_DRAWING), "PrintDrawing", rPropSet);
578  lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_FORMULAS), "PrintFormulas", rPropSet);
579  lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_GRID), "PrintGrid", rPropSet);
580  lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_HEADERS), "PrintHeaders", rPropSet);
581  lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_OBJECTS), "PrintObjects", rPropSet);
582  lcl_AddState(rPropState, aPropMapper->FindEntryIndex(CTF_PM_PRINT_ZEROVALUES), "PrintZeroValues", rPropSet);
583  }
584 
585  if (pFill)
586  { // note: only drawing-page export should write this, because CTF_PM_FILL
587  uno::Any backgroundSize;
588  switch (pFill->maValue.get<drawing::FillStyle>())
589  {
590  case drawing::FillStyle_NONE:
591  break;
592  case drawing::FillStyle_SOLID:
593  case drawing::FillStyle_GRADIENT:
594  case drawing::FillStyle_HATCH:
595  backgroundSize <<= true;
596  break;
597  case drawing::FillStyle_BITMAP:
598  if (pFillBitmapMode)
599  {
600  switch (pFillBitmapMode->maValue.get<drawing::BitmapMode>())
601  {
602  case drawing::BitmapMode_REPEAT:
603  backgroundSize <<= true;
604  break;
605  case drawing::BitmapMode_STRETCH:
606  case drawing::BitmapMode_NO_REPEAT:
607  backgroundSize <<= false;
608  break;
609  default:
610  assert(false);
611  }
612  }
613  // else: leave it ambiguous if not explicitly defined
614  break;
615  default:
616  assert(false);
617  }
618 
619  if (backgroundSize.hasValue())
620  {
621  auto const nIndex(aPropMapper->FindEntryIndex(CTF_PM_BACKGROUNDSIZE));
622  assert(0 <= nIndex);
623  rPropState.emplace_back(nIndex, backgroundSize);
624  }
625  }
626 
627  SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rPropState, rPropSet);
628 }
629 
630 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define CTF_PM_HEADERGRAPHICPOSITION
#define CTP_PM_GRID_SNAP_TO_CHARS
#define CTF_PM_HEADERHEIGHT
#define CTF_PM_HEADERFILLTRANSNAME
#define CTF_PM_FOOTERDYNAMIC
bool hasValue()
#define CTF_PM_FLAGMASK
sal_Int32 nIndex
#define CTF_PM_FILLGRADIENTNAME
#define CTF_PM_HEADERFILLHATCHNAME
#define CTF_PM_PADDINGTOP
XMLBackgroundImageExport aBackgroundImageExport
#define CTF_PM_FOOTERREPEAT_OFFSET_Y
virtual void ContextFilter(bool bEnableFoFontFamily,::std::vector< XMLPropertyState > &rProperties, const css::uno::Reference< css::beans::XPropertySet > &rPropSet) const override
Application-specific filter.
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
Definition: xmluconv.hxx:77
#define CTF_PM_HEADERFILLBITMAPNAME
static void lcl_AddState(::std::vector< XMLPropertyState > &rPropState, sal_Int32 nIndex, const OUString &rProperty, const uno::Reference< beans::XPropertySet > &xProps)
#define CTF_PM_BACKGROUNDSIZE
XMLFootnoteSeparatorExport aFootnoteSeparatorExport
#define CTF_PM_FTN_LINE_WEIGHT
SvXMLExport & GetExport() const
static bool lcl_HasSameLineWidth(const table::BorderLine2 &rLine1, const table::BorderLine2 &rLine2)
#define CTF_PM_PRINT_DRAWING
bool getBOOL(const Any &_rAny)
#define CTF_PM_HEADERGRAPHICURL
sal_Int32 mnIndex
Definition: maptype.hxx:124
#define CTF_PM_PADDINGRIGHT
#define CTF_PM_FILLBITMAPMODE
static void lcl_RemoveState(XMLPropertyState *pState)
#define CTF_PM_BORDERLEFT
#define CTF_PM_FOOTERGRAPHICURL
#define CTF_PM_GRAPHICFILTER
#define CTF_PM_PADDINGBOTTOM
#define CTF_PM_HEADERMINHEIGHT
#define CTF_PM_MARGINALL
#define CTF_PM_GRAPHICURL
#define CTF_PM_FOOTERGRAPHICPOSITION
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
virtual void ContextFilter(bool bEnableFoFontFamily,::std::vector< XMLPropertyState > &rProperties, const css::uno::Reference< css::beans::XPropertySet > &rPropSet) const
Application-specific filter.
Definition: xmlexppr.cxx:669
#define CTF_PM_SCALETO
#define CTF_PM_BORDERTOP
#define CTF_PM_FOOTERFILLBITMAPNAME
#define CTF_PM_BORDERWIDTHLEFT
#define XML_PM_CTF_START
Definition: contextid.hxx:30
#define CTF_PM_FOOTERFILLGRADIENTNAME
#define CTF_PM_PRINT_GRID
#define CTF_PM_PRINT_HEADERS
#define CTF_PM_SCALETOX
#define CTF_PM_FILLBITMAPNAME
#define CTF_PM_HEADERREPEAT_OFFSET_Y
#define CTF_PM_BORDERWIDTHTOP
SvtSaveOptions::ODFSaneDefaultVersion getSaneDefaultVersion() const
returns the deterministic version for odf export
Definition: xmlexp.cxx:2297
#define CTF_PM_PRINT_ZEROVALUES
virtual void handleElementItem(SvXMLExport &rExport, const XMLPropertyState &rProperty, SvXmlExportFlags nFlags, const ::std::vector< XMLPropertyState > *pProperties, sal_uInt32 nIdx) const override
this method is called for every item that has the MID_FLAG_ELEMENT_EXPORT flag set ...
#define CTF_PM_FOOTERREPEAT_OFFSET_X
virtual void handleSpecialItem(SvXMLAttributeList &rAttrList, const XMLPropertyState &rProperty, const SvXMLUnitConverter &rUnitConverter, const SvXMLNamespaceMap &rNamespaceMap, const ::std::vector< XMLPropertyState > *pProperties, sal_uInt32 nIdx) const override
this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set ...
static void lcl_RemoveStateIfZero16(XMLPropertyState *pState)
void exportXML(const ::std::vector< XMLPropertyState > *pProperties, sal_uInt32 nIdx, const rtl::Reference< XMLPropertySetMapper > &rMapper)
#define CTF_PM_HEADERFILLGRADIENTNAME
#define CTF_PM_BORDERWIDTHRIGHT
#define CTF_PM_PRINTMASK
#define CTF_PM_BORDERWIDTHBOTTOM
#define CTF_PM_REPEAT_OFFSET_X
#define CTF_PM_FOOTERGRAPHICFILTER
#define CTF_PM_PRINT_CHARTS
#define CTF_PM_PRINT_OBJECTS
#define CTF_PM_HEADERFLAG
void exportXML(const css::uno::Any &rURL, const css::uno::Any *pPos, const css::uno::Any *pFilter, const css::uno::Any *pTransparency, sal_uInt16 nPrefix, const OUString &rLocalName)
#define CTF_PM_FILLHATCHNAME
#define CTF_PM_FOOTERFILLTRANSNAME
#define CTF_PM_FOOTERFILLHATCHNAME
#define CTF_PM_GRAPHICPOSITION
css::uno::Any maValue
Definition: maptype.hxx:125
SvXmlExportFlags
Definition: xmlexppr.hxx:39
#define CTF_PM_HEADERDYNAMIC
#define CTF_PM_BORDERWIDTHALL
#define CTF_PM_FOOTERMINHEIGHT
Handling of tokens in XML:
#define CTF_PM_SCALETOPAGES
#define CTP_PM_GRID_BASE_WIDTH
Smart struct to transport an Any with an index to the appropriate property-name.
Definition: maptype.hxx:122
#define CTF_PM_PRINT_ANNOTATIONS
XMLPageMasterExportPropMapper(const rtl::Reference< XMLPropertySetMapper > &rMapper, SvXMLExport &rExport)
#define CTF_PM_FOOTERHEIGHT
#define CTF_PM_PADDINGALL
#define CTF_PM_STANDARD_MODE
#define CTF_PM_PADDINGLEFT
#define CTP_PM_GRID_SNAP_TO
#define CTF_PM_FOOTERFLAG
#define CTF_PM_HEADERGRAPHICFILTER
#define CTF_PM_FILLTRANSNAME
#define CTF_PM_SCALETOY
#define CTF_PM_BORDERBOTTOM
#define CTF_PM_BORDERALL
css::uno::Any const SvXMLExport & rExport
Definition: ImageStyle.hxx:38
#define CTF_PM_FILL
aStr
#define CTF_PM_TEXTCOLUMNS
#define CTF_PM_REPEAT_OFFSET_Y
sal_uInt16 nPos
bool any2bool(const css::uno::Any &rAny)
#define CTF_PM_PRINT_FORMULAS
sal_Int16 nValue
const rtl::Reference< XMLPropertySetMapper > & getPropertySetMapper() const
Definition: xmlexppr.cxx:1119
#define CTF_PM_HEADERREPEAT_OFFSET_X
#define CTF_PM_BORDERRIGHT
void exportXML(const css::uno::Any &rAny)