LCOV - code coverage report
Current view: top level - xmloff/source/style - PageMasterExportPropMapper.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 211 266 79.3 %
Date: 2015-06-13 12:38:46 Functions: 13 13 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11