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

Generated by: LCOV version 1.10