LCOV - code coverage report
Current view: top level - xmloff/source/text - txtexppr.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 569 655 86.9 %
Date: 2014-11-03 Functions: 10 11 90.9 %
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 <com/sun/star/table/BorderLine2.hpp>
      21             : 
      22             : #include "txtexppr.hxx"
      23             : 
      24             : #include <com/sun/star/text/SizeType.hpp>
      25             : #include <com/sun/star/text/WrapTextMode.hpp>
      26             : #include <com/sun/star/text/TextContentAnchorType.hpp>
      27             : #include <com/sun/star/awt/FontUnderline.hpp>
      28             : #include <com/sun/star/text/XChapterNumberingSupplier.hpp>
      29             : #include <tools/debug.hxx>
      30             : #include <xmloff/txtprmap.hxx>
      31             : #include <xmloff/xmlexp.hxx>
      32             : #include <xmloff/maptype.hxx>
      33             : #include "XMLSectionFootnoteConfigExport.hxx"
      34             : 
      35             : //UUUU
      36             : #include <xmlsdtypes.hxx>
      37             : 
      38             : using namespace ::com::sun::star;
      39             : using namespace ::com::sun::star::uno;
      40             : using namespace ::com::sun::star::style;
      41             : using namespace ::com::sun::star::beans;
      42             : using namespace ::com::sun::star::text;
      43             : 
      44         154 : void XMLTextExportPropertySetMapper::handleElementItem(
      45             :         SvXMLExport& rExp,
      46             :         const XMLPropertyState& rProperty,
      47             :         sal_uInt16 nFlags,
      48             :         const ::std::vector< XMLPropertyState > *pProperties,
      49             :         sal_uInt32 nIdx ) const
      50             : {
      51             :     XMLTextExportPropertySetMapper *pThis =
      52         154 :            ((XMLTextExportPropertySetMapper *)this);
      53             : 
      54         154 :     switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
      55             :     {
      56             :     case CTF_DROPCAPFORMAT:
      57             :         pThis->maDropCapExport.exportXML( rProperty.maValue, bDropWholeWord,
      58           4 :                                           sDropCharStyle );
      59           4 :         pThis->bDropWholeWord = false;
      60           4 :         pThis->sDropCharStyle = OUString();
      61           4 :         break;
      62             : 
      63             :     case CTF_TABSTOP:
      64         120 :         pThis->maTabStopExport.Export( rProperty.maValue );
      65         120 :         break;
      66             : 
      67             :     case CTF_TEXTCOLUMNS:
      68          16 :         pThis->maTextColumnsExport.exportXML( rProperty.maValue );
      69          16 :         break;
      70             : 
      71             :     case CTF_BACKGROUND_URL:
      72             :         {
      73             :             DBG_ASSERT( pProperties && nIdx >= 3,
      74             :                         "property vector missing" );
      75          14 :             const Any *pPos = 0, *pFilter = 0, *pTrans = 0;
      76          14 :             if( pProperties && nIdx >= 3 )
      77             :             {
      78          14 :                 const XMLPropertyState& rTrans = (*pProperties)[nIdx-3];
      79             :                 // #99657# transparency may be there, but doesn't have to be.
      80             :                 // If it's there, it must be in the right position.
      81          28 :                 if( CTF_BACKGROUND_TRANSPARENCY == getPropertySetMapper()
      82          28 :                       ->GetEntryContextId( rTrans.mnIndex ) )
      83          14 :                     pTrans = &rTrans.maValue;
      84             : 
      85          14 :                 const XMLPropertyState& rPos = (*pProperties)[nIdx-2];
      86             :                 DBG_ASSERT( CTF_BACKGROUND_POS == getPropertySetMapper()
      87             :                         ->GetEntryContextId( rPos.mnIndex ),
      88             :                          "invalid property map: pos expected" );
      89          28 :                 if( CTF_BACKGROUND_POS == getPropertySetMapper()
      90          28 :                         ->GetEntryContextId( rPos.mnIndex ) )
      91          14 :                     pPos = &rPos.maValue;
      92             : 
      93          14 :                 const XMLPropertyState& rFilter = (*pProperties)[nIdx-1];
      94             :                 DBG_ASSERT( CTF_BACKGROUND_FILTER == getPropertySetMapper()
      95             :                         ->GetEntryContextId( rFilter.mnIndex ),
      96             :                          "invalid property map: filter expected" );
      97          28 :                 if( CTF_BACKGROUND_FILTER == getPropertySetMapper()
      98          28 :                         ->GetEntryContextId( rFilter.mnIndex ) )
      99          14 :                     pFilter = &rFilter.maValue;
     100             :             }
     101          14 :             sal_uInt32 nPropIndex = rProperty.mnIndex;
     102             :             pThis->maBackgroundImageExport.exportXML(
     103             :                     rProperty.maValue, pPos, pFilter, pTrans,
     104          14 :                     getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
     105          28 :                     getPropertySetMapper()->GetEntryXMLName( nPropIndex ) );
     106             :         }
     107          14 :         break;
     108             : 
     109             :     case CTF_SECTION_FOOTNOTE_END:
     110             :         XMLSectionFootnoteConfigExport::exportXML(rExp, false,
     111             :                                                   pProperties, nIdx,
     112           0 :                                                   getPropertySetMapper());
     113           0 :         break;
     114             : 
     115             :     case CTF_SECTION_ENDNOTE_END:
     116             :         XMLSectionFootnoteConfigExport::exportXML(rExp, true,
     117             :                                                   pProperties, nIdx,
     118           0 :                                                   getPropertySetMapper());
     119           0 :         break;
     120             : 
     121             :     default:
     122           0 :         SvXMLExportPropertyMapper::handleElementItem( rExp, rProperty, nFlags, pProperties, nIdx );
     123           0 :         break;
     124             :     }
     125         154 : }
     126             : 
     127         140 : void XMLTextExportPropertySetMapper::handleSpecialItem(
     128             :         SvXMLAttributeList& rAttrList,
     129             :         const XMLPropertyState& rProperty,
     130             :         const SvXMLUnitConverter& rUnitConverter,
     131             :         const SvXMLNamespaceMap& rNamespaceMap,
     132             :         const ::std::vector< XMLPropertyState > *pProperties,
     133             :         sal_uInt32 nIdx ) const
     134             : {
     135             :     XMLTextExportPropertySetMapper *pThis =
     136         140 :            ((XMLTextExportPropertySetMapper *)this);
     137             : 
     138         140 :     switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
     139             :     {
     140             :     case CTF_DROPCAPWHOLEWORD:
     141             :         DBG_ASSERT( !bDropWholeWord, "drop whole word is set already!" );
     142           4 :         pThis->bDropWholeWord = *(sal_Bool *)rProperty.maValue.getValue();
     143           4 :         break;
     144             :     case CTF_DROPCAPCHARSTYLE:
     145             :         DBG_ASSERT( sDropCharStyle.isEmpty(), "drop char style is set already!" );
     146           4 :         rProperty.maValue >>= pThis->sDropCharStyle;
     147           4 :         break;
     148             :     case CTF_NUMBERINGSTYLENAME:
     149             :     case CTF_PAGEDESCNAME:
     150             :     case CTF_OLDTEXTBACKGROUND:
     151             :     case CTF_BACKGROUND_POS:
     152             :     case CTF_BACKGROUND_FILTER:
     153             :     case CTF_BACKGROUND_TRANSPARENCY:
     154             :     case CTF_SECTION_FOOTNOTE_NUM_OWN:
     155             :     case CTF_SECTION_FOOTNOTE_NUM_RESTART:
     156             :     case CTF_SECTION_FOOTNOTE_NUM_RESTART_AT:
     157             :     case CTF_SECTION_FOOTNOTE_NUM_TYPE:
     158             :     case CTF_SECTION_FOOTNOTE_NUM_PREFIX:
     159             :     case CTF_SECTION_FOOTNOTE_NUM_SUFFIX:
     160             :     case CTF_SECTION_ENDNOTE_NUM_OWN:
     161             :     case CTF_SECTION_ENDNOTE_NUM_RESTART:
     162             :     case CTF_SECTION_ENDNOTE_NUM_RESTART_AT:
     163             :     case CTF_SECTION_ENDNOTE_NUM_TYPE:
     164             :     case CTF_SECTION_ENDNOTE_NUM_PREFIX:
     165             :     case CTF_SECTION_ENDNOTE_NUM_SUFFIX:
     166             :     case CTF_DEFAULT_OUTLINE_LEVEL:
     167             :     case CTF_OLD_FLOW_WITH_TEXT:
     168             :         // There's nothing to do here!
     169          84 :         break;
     170             :     default:
     171          48 :         SvXMLExportPropertyMapper::handleSpecialItem(rAttrList, rProperty, rUnitConverter, rNamespaceMap, pProperties, nIdx );
     172          48 :         break;
     173             :     }
     174         140 : }
     175             : 
     176       12828 : XMLTextExportPropertySetMapper::XMLTextExportPropertySetMapper(
     177             :         const rtl::Reference< XMLPropertySetMapper >& rMapper,
     178             :         SvXMLExport& rExp ) :
     179             :     SvXMLExportPropertyMapper( rMapper ),
     180             :     rExport( rExp ),
     181             :     bDropWholeWord( false ),
     182             :     maDropCapExport( rExp ),
     183             :     maTabStopExport( rExp ),
     184             :     maTextColumnsExport( rExp ),
     185       12828 :     maBackgroundImageExport( rExp )
     186             : {
     187       12828 : }
     188             : 
     189       25636 : XMLTextExportPropertySetMapper::~XMLTextExportPropertySetMapper()
     190             : {
     191       25636 : }
     192             : 
     193        7492 : void XMLTextExportPropertySetMapper::ContextFontFilter(
     194             :     bool bEnableFoFontFamily,
     195             :     XMLPropertyState *pFontNameState,
     196             :     XMLPropertyState *pFontFamilyNameState,
     197             :     XMLPropertyState *pFontStyleNameState,
     198             :     XMLPropertyState *pFontFamilyState,
     199             :     XMLPropertyState *pFontPitchState,
     200             :     XMLPropertyState *pFontCharsetState ) const
     201             : {
     202        7492 :     OUString sFamilyName;
     203       14984 :     OUString sStyleName;
     204        7492 :     FontFamily nFamily = FAMILY_DONTKNOW;
     205        7492 :     FontPitch nPitch = PITCH_DONTKNOW;
     206        7492 :     rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
     207             : 
     208       14984 :     OUString sTmp;
     209        7492 :     if( pFontFamilyNameState && (pFontFamilyNameState->maValue >>= sTmp ) )
     210        7222 :         sFamilyName = sTmp;
     211        7492 :     if( pFontStyleNameState && (pFontStyleNameState->maValue >>= sTmp ) )
     212        1396 :         sStyleName = sTmp;
     213             : 
     214        7492 :     sal_Int16 nTmp = sal_Int16();
     215        7492 :     if( pFontFamilyState && (pFontFamilyState->maValue >>= nTmp ) )
     216        7222 :         nFamily = static_cast< FontFamily >( nTmp );
     217        7492 :     if( pFontPitchState && (pFontPitchState->maValue >>= nTmp ) )
     218        7222 :         nPitch = static_cast< FontPitch >( nTmp );
     219        7492 :     if( pFontCharsetState && (pFontCharsetState->maValue >>= nTmp ) )
     220        1462 :         eEnc = (rtl_TextEncoding)nTmp;
     221             : 
     222             :     //Resolves: fdo#67665 The purpose here appears to be to replace
     223             :     //FontFamilyName and FontStyleName etc with a single FontName property. The
     224             :     //problem is that repeated calls to here will first set
     225             :     //pFontFamilyNameState->mnIndex to -1 to indicate it is disabled, so the
     226             :     //next time pFontFamilyNameState is not passed here at all, which gives an
     227             :     //empty sFamilyName resulting in disabling pFontNameState->mnIndex to -1.
     228             :     //That doesn't seem right to me.
     229             : 
     230             :     //So assuming that the main purpose is just to convert the properties in
     231             :     //the main when we can, and to leave them alone when we can't. And with a
     232             :     //secondary purpose to filter out empty font properties, then is would
     233             :     //appear to make sense to base attempting the conversion if we have
     234             :     //both of the major facts of the font description
     235             : 
     236             :     //An alternative solution is to *not* fill the FontAutoStylePool with
     237             :     //every font in the document, but to partition the fonts into the
     238             :     //hard-attribute fonts which go into that pool and the style-attribute
     239             :     //fonts which go into some additional pool which get merged just for
     240             :     //the purposes of writing the embedded fonts but are not queried by
     241             :     //"Find" which restores the original logic.
     242        7492 :     if (pFontFamilyNameState || pFontStyleNameState)
     243             :     {
     244        7222 :         OUString sName( ((SvXMLExport&)GetExport()).GetFontAutoStylePool()->Find(
     245       14444 :                             sFamilyName, sStyleName, nFamily, nPitch, eEnc ) );
     246        7222 :         if (!sName.isEmpty())
     247             :         {
     248        1450 :             pFontNameState->maValue <<= sName;
     249             :             //Resolves: fdo#68431 style:font-name unrecognized by LibreOffice
     250             :             //<= 4.1 in styles (but recognized in autostyles) so add
     251             :             //fo:font-family, etc
     252        1450 :             if (!bEnableFoFontFamily)
     253             :             {
     254         654 :                 if( pFontFamilyNameState )
     255         654 :                     pFontFamilyNameState->mnIndex = -1;
     256         654 :                 if( pFontStyleNameState )
     257         654 :                     pFontStyleNameState->mnIndex = -1;
     258         654 :                 if( pFontFamilyState )
     259         654 :                     pFontFamilyState->mnIndex = -1;
     260         654 :                 if( pFontPitchState )
     261         654 :                     pFontPitchState->mnIndex = -1;
     262         654 :                 if( pFontCharsetState )
     263         654 :                     pFontCharsetState->mnIndex = -1;
     264             :             }
     265             :         }
     266             :         else
     267             :         {
     268        5772 :             pFontNameState->mnIndex = -1;
     269        7222 :         }
     270             :     }
     271             : 
     272        7492 :     if( pFontFamilyNameState && sFamilyName.isEmpty() )
     273             :     {
     274           4 :         pFontFamilyNameState->mnIndex = -1;
     275             :     }
     276             : 
     277        7492 :     if( pFontStyleNameState && sStyleName.isEmpty() )
     278             :     {
     279        1396 :         pFontStyleNameState->mnIndex = -1;
     280        7492 :     }
     281        7492 : }
     282             : 
     283         870 : void XMLTextExportPropertySetMapper::ContextFontHeightFilter(
     284             :     XMLPropertyState* pCharHeightState,
     285             :     XMLPropertyState* pCharPropHeightState,
     286             :     XMLPropertyState* pCharDiffHeightState ) const
     287             : {
     288         870 :     if( pCharPropHeightState )
     289             :     {
     290         870 :         sal_Int32 nTemp = 0;
     291         870 :         pCharPropHeightState->maValue >>= nTemp;
     292         870 :         if( nTemp == 100 )
     293             :         {
     294         852 :             pCharPropHeightState->mnIndex = -1;
     295         852 :             pCharPropHeightState->maValue.clear();
     296             :         }
     297             :         else
     298             :         {
     299          18 :             pCharHeightState->mnIndex = -1;
     300          18 :             pCharHeightState->maValue.clear();
     301             :         }
     302             :     }
     303         870 :     if( pCharDiffHeightState )
     304             :     {
     305         870 :         float nTemp = 0;
     306         870 :         pCharDiffHeightState->maValue >>= nTemp;
     307         870 :         if( nTemp == 0. )
     308             :         {
     309         870 :             pCharDiffHeightState->mnIndex = -1;
     310         870 :             pCharDiffHeightState->maValue.clear();
     311             :         }
     312             :         else
     313             :         {
     314           0 :             pCharHeightState->mnIndex = -1;
     315           0 :             pCharHeightState->maValue.clear();
     316             :         }
     317             :     }
     318             : 
     319         870 : }
     320             : 
     321             : namespace {
     322             : 
     323             : // helper method; implementation below
     324             : static bool lcl_IsOutlineStyle(const SvXMLExport&, const OUString&);
     325             : 
     326             : static void
     327       84180 : lcl_checkMultiProperty(XMLPropertyState *const pState,
     328             :                        XMLPropertyState *const pRelState)
     329             : {
     330       84180 :     if (pState && pRelState)
     331             :     {
     332         514 :         sal_Int32 nTemp = 0;
     333         514 :         pRelState->maValue >>= nTemp;
     334         514 :         if (100 == nTemp)
     335             :         {
     336         514 :             pRelState->mnIndex = -1;
     337         514 :             pRelState->maValue.clear();
     338             :         }
     339             :         else
     340             :         {
     341           0 :             pState->mnIndex = -1;
     342           0 :             pState->maValue.clear();
     343             :         }
     344             :     }
     345       84180 : }
     346             : 
     347             : /**
     348             :  * Filter context of paragraph and character borders.
     349             :  * Compress border attriubtes. If one of groupable attributes (border type, border width, padding)
     350             :  * is equal for all four side then just one general attribute will be exported.
     351             : **/
     352       33672 : static void lcl_FilterBorders(
     353             :     XMLPropertyState* pAllBorderWidthState, XMLPropertyState* pLeftBorderWidthState,
     354             :     XMLPropertyState* pRightBorderWidthState, XMLPropertyState* pTopBorderWidthState,
     355             :     XMLPropertyState* pBottomBorderWidthState, XMLPropertyState* pAllBorderDistanceState,
     356             :     XMLPropertyState* pLeftBorderDistanceState, XMLPropertyState* pRightBorderDistanceState,
     357             :     XMLPropertyState* pTopBorderDistanceState, XMLPropertyState* pBottomBorderDistanceState,
     358             :     XMLPropertyState* pAllBorderState, XMLPropertyState* pLeftBorderState,
     359             :     XMLPropertyState* pRightBorderState,XMLPropertyState* pTopBorderState,
     360             :     XMLPropertyState* pBottomBorderState )
     361             : {
     362       33672 :     if( pAllBorderWidthState )
     363             :     {
     364         110 :         if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState )
     365             :         {
     366         110 :             table::BorderLine2 aLeft, aRight, aTop, aBottom;
     367             : 
     368         110 :             pLeftBorderWidthState->maValue >>= aLeft;
     369         110 :             pRightBorderWidthState->maValue >>= aRight;
     370         110 :             pTopBorderWidthState->maValue >>= aTop;
     371         110 :             pBottomBorderWidthState->maValue >>= aBottom;
     372         218 :             if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
     373         324 :                 aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
     374         216 :                 aLeft.LineStyle == aRight.LineStyle &&
     375         216 :                 aLeft.LineWidth == aRight.LineWidth &&
     376         324 :                 aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
     377         324 :                 aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
     378         216 :                 aLeft.LineStyle == aTop.LineStyle &&
     379         216 :                 aLeft.LineWidth == aTop.LineWidth &&
     380         324 :                 aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
     381         324 :                 aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance &&
     382         216 :                 aLeft.LineStyle == aBottom.LineStyle &&
     383         108 :                 aLeft.LineWidth == aBottom.LineWidth )
     384             :             {
     385         108 :                 pLeftBorderWidthState->mnIndex = -1;
     386         108 :                 pLeftBorderWidthState->maValue.clear();
     387         108 :                 pRightBorderWidthState->mnIndex = -1;
     388         108 :                 pRightBorderWidthState->maValue.clear();
     389         108 :                 pTopBorderWidthState->mnIndex = -1;
     390         108 :                 pTopBorderWidthState->maValue.clear();
     391         108 :                 pBottomBorderWidthState->mnIndex = -1;
     392         108 :                 pBottomBorderWidthState->maValue.clear();
     393             :             }
     394             :             else
     395             :             {
     396           2 :                 pAllBorderWidthState->mnIndex = -1;
     397           2 :                 pAllBorderWidthState->maValue.clear();
     398         110 :             }
     399             :         }
     400             :         else
     401             :         {
     402           0 :             pAllBorderWidthState->mnIndex = -1;
     403           0 :             pAllBorderWidthState->maValue.clear();
     404             :         }
     405             :     }
     406             : 
     407       33672 :     if( pAllBorderDistanceState )
     408             :     {
     409         110 :         if( pLeftBorderDistanceState && pRightBorderDistanceState && pTopBorderDistanceState && pBottomBorderDistanceState )
     410             :         {
     411         110 :             sal_Int32 aLeft = 0, aRight = 0, aTop = 0, aBottom = 0;
     412             : 
     413         110 :             pLeftBorderDistanceState->maValue >>= aLeft;
     414         110 :             pRightBorderDistanceState->maValue >>= aRight;
     415         110 :             pTopBorderDistanceState->maValue >>= aTop;
     416         110 :             pBottomBorderDistanceState->maValue >>= aBottom;
     417         110 :             if( aLeft == aRight && aLeft == aTop && aLeft == aBottom )
     418             :             {
     419          80 :                 pLeftBorderDistanceState->mnIndex = -1;
     420          80 :                 pLeftBorderDistanceState->maValue.clear();
     421          80 :                 pRightBorderDistanceState->mnIndex = -1;
     422          80 :                 pRightBorderDistanceState->maValue.clear();
     423          80 :                 pTopBorderDistanceState->mnIndex = -1;
     424          80 :                 pTopBorderDistanceState->maValue.clear();
     425          80 :                 pBottomBorderDistanceState->mnIndex = -1;
     426          80 :                 pBottomBorderDistanceState->maValue.clear();
     427             :             }
     428             :             else
     429             :             {
     430          30 :                 pAllBorderDistanceState->mnIndex = -1;
     431          30 :                 pAllBorderDistanceState->maValue.clear();
     432         110 :             }
     433             :         }
     434             :         else
     435             :         {
     436           0 :             pAllBorderDistanceState->mnIndex = -1;
     437           0 :             pAllBorderDistanceState->maValue.clear();
     438             :         }
     439             :     }
     440             : 
     441       33672 :     if( pAllBorderState )
     442             :     {
     443         110 :         if( pLeftBorderState && pRightBorderState && pTopBorderState && pBottomBorderState )
     444             :         {
     445         110 :             table::BorderLine2 aLeft, aRight, aTop, aBottom;
     446             : 
     447         110 :             pLeftBorderState->maValue >>= aLeft;
     448         110 :             pRightBorderState->maValue >>= aRight;
     449         110 :             pTopBorderState->maValue >>= aTop;
     450         110 :             pBottomBorderState->maValue >>= aBottom;
     451         218 :             if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
     452         324 :                 aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
     453         216 :                 aLeft.LineStyle == aRight.LineStyle &&
     454         216 :                 aLeft.LineWidth == aRight.LineWidth &&
     455         324 :                 aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
     456         324 :                 aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
     457         216 :                 aLeft.LineStyle == aTop.LineStyle  &&
     458         216 :                 aLeft.LineWidth == aTop.LineWidth  &&
     459         324 :                 aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
     460         324 :                 aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance &&
     461         216 :                 aLeft.LineWidth == aBottom.LineWidth &&
     462         108 :                 aLeft.LineStyle == aBottom.LineStyle )
     463             :             {
     464         108 :                 pLeftBorderState->mnIndex = -1;
     465         108 :                 pLeftBorderState->maValue.clear();
     466         108 :                 pRightBorderState->mnIndex = -1;
     467         108 :                 pRightBorderState->maValue.clear();
     468         108 :                 pTopBorderState->mnIndex = -1;
     469         108 :                 pTopBorderState->maValue.clear();
     470         108 :                 pBottomBorderState->mnIndex = -1;
     471         108 :                 pBottomBorderState->maValue.clear();
     472             :             }
     473             :             else
     474             :             {
     475           2 :                 pAllBorderState->mnIndex = -1;
     476           2 :                 pAllBorderState->maValue.clear();
     477         110 :             }
     478             :         }
     479             :         else
     480             :         {
     481           0 :             pAllBorderState->mnIndex = -1;
     482           0 :             pAllBorderState->maValue.clear();
     483             :         }
     484             :     }
     485       33672 : }
     486             : 
     487             : }
     488             : 
     489       16836 : void XMLTextExportPropertySetMapper::ContextFilter(
     490             :     bool bEnableFoFontFamily,
     491             :     ::std::vector< XMLPropertyState >& rProperties,
     492             :     Reference< XPropertySet > rPropSet ) const
     493             : {
     494             :     // filter font
     495       16836 :     XMLPropertyState *pFontNameState = 0;
     496       16836 :     XMLPropertyState *pFontFamilyNameState = 0;
     497       16836 :     XMLPropertyState *pFontStyleNameState = 0;
     498       16836 :     XMLPropertyState *pFontFamilyState = 0;
     499       16836 :     XMLPropertyState *pFontPitchState = 0;
     500       16836 :     XMLPropertyState *pFontCharsetState = 0;
     501       16836 :     XMLPropertyState *pFontNameCJKState = 0;
     502       16836 :     XMLPropertyState *pFontFamilyNameCJKState = 0;
     503       16836 :     XMLPropertyState *pFontStyleNameCJKState = 0;
     504       16836 :     XMLPropertyState *pFontFamilyCJKState = 0;
     505       16836 :     XMLPropertyState *pFontPitchCJKState = 0;
     506       16836 :     XMLPropertyState *pFontCharsetCJKState = 0;
     507       16836 :     XMLPropertyState *pFontNameCTLState = 0;
     508       16836 :     XMLPropertyState *pFontFamilyNameCTLState = 0;
     509       16836 :     XMLPropertyState *pFontStyleNameCTLState = 0;
     510       16836 :     XMLPropertyState *pFontFamilyCTLState = 0;
     511       16836 :     XMLPropertyState *pFontPitchCTLState = 0;
     512       16836 :     XMLPropertyState *pFontCharsetCTLState = 0;
     513             : 
     514             :     // filter char height point/percent
     515       16836 :     XMLPropertyState* pCharHeightState = NULL;
     516       16836 :     XMLPropertyState* pCharPropHeightState = NULL;
     517       16836 :     XMLPropertyState* pCharDiffHeightState = NULL;
     518       16836 :     XMLPropertyState* pCharHeightCJKState = NULL;
     519       16836 :     XMLPropertyState* pCharPropHeightCJKState = NULL;
     520       16836 :     XMLPropertyState* pCharDiffHeightCJKState = NULL;
     521       16836 :     XMLPropertyState* pCharHeightCTLState = NULL;
     522       16836 :     XMLPropertyState* pCharPropHeightCTLState = NULL;
     523       16836 :     XMLPropertyState* pCharDiffHeightCTLState = NULL;
     524             : 
     525             :     // filter left margin measure/percent
     526       16836 :     XMLPropertyState* pParaLeftMarginState = NULL;
     527       16836 :     XMLPropertyState* pParaLeftMarginRelState = NULL;
     528             : 
     529             :     // filter right margin measure/percent
     530       16836 :     XMLPropertyState* pParaRightMarginState = NULL;
     531       16836 :     XMLPropertyState* pParaRightMarginRelState = NULL;
     532             : 
     533             :     // filter first line indent measure/percent
     534       16836 :     XMLPropertyState* pParaFirstLineState = NULL;
     535       16836 :     XMLPropertyState* pParaFirstLineRelState = NULL;
     536             : 
     537             :     // filter ParaTopMargin/Relative
     538       16836 :     XMLPropertyState* pParaTopMarginState = NULL;
     539       16836 :     XMLPropertyState* pParaTopMarginRelState = NULL;
     540             : 
     541             :     // filter ParaTopMargin/Relative
     542       16836 :     XMLPropertyState* pParaBottomMarginState = NULL;
     543       16836 :     XMLPropertyState* pParaBottomMarginRelState = NULL;
     544             : 
     545             :     // filter (Left|Right|Top|Bottom|)BorderWidth
     546       16836 :     XMLPropertyState* pAllBorderWidthState = NULL;
     547       16836 :     XMLPropertyState* pLeftBorderWidthState = NULL;
     548       16836 :     XMLPropertyState* pRightBorderWidthState = NULL;
     549       16836 :     XMLPropertyState* pTopBorderWidthState = NULL;
     550       16836 :     XMLPropertyState* pBottomBorderWidthState = NULL;
     551             : 
     552             :     // filter (Left|Right|Top|)BorderDistance
     553       16836 :     XMLPropertyState* pAllBorderDistanceState = NULL;
     554       16836 :     XMLPropertyState* pLeftBorderDistanceState = NULL;
     555       16836 :     XMLPropertyState* pRightBorderDistanceState = NULL;
     556       16836 :     XMLPropertyState* pTopBorderDistanceState = NULL;
     557       16836 :     XMLPropertyState* pBottomBorderDistanceState = NULL;
     558             : 
     559             :     // filter (Left|Right|Top|Bottom|)Border
     560       16836 :     XMLPropertyState* pAllBorderState = NULL;
     561       16836 :     XMLPropertyState* pLeftBorderState = NULL;
     562       16836 :     XMLPropertyState* pRightBorderState = NULL;
     563       16836 :     XMLPropertyState* pTopBorderState = NULL;
     564       16836 :     XMLPropertyState* pBottomBorderState = NULL;
     565             : 
     566             :     // filter Char(Left|Right|Top|Bottom|)BorderWidth
     567       16836 :     XMLPropertyState* pCharAllBorderWidthState = NULL;
     568       16836 :     XMLPropertyState* pCharLeftBorderWidthState = NULL;
     569       16836 :     XMLPropertyState* pCharRightBorderWidthState = NULL;
     570       16836 :     XMLPropertyState* pCharTopBorderWidthState = NULL;
     571       16836 :     XMLPropertyState* pCharBottomBorderWidthState = NULL;
     572             : 
     573             :     // filter Char(Left|Right|Top|)BorderDistance
     574       16836 :     XMLPropertyState* pCharAllBorderDistanceState = NULL;
     575       16836 :     XMLPropertyState* pCharLeftBorderDistanceState = NULL;
     576       16836 :     XMLPropertyState* pCharRightBorderDistanceState = NULL;
     577       16836 :     XMLPropertyState* pCharTopBorderDistanceState = NULL;
     578       16836 :     XMLPropertyState* pCharBottomBorderDistanceState = NULL;
     579             : 
     580             :     // filter Char(Left|Right|Top|Bottom|)Border
     581       16836 :     XMLPropertyState* pCharAllBorderState = NULL;
     582       16836 :     XMLPropertyState* pCharLeftBorderState = NULL;
     583       16836 :     XMLPropertyState* pCharRightBorderState = NULL;
     584       16836 :     XMLPropertyState* pCharTopBorderState = NULL;
     585       16836 :     XMLPropertyState* pCharBottomBorderState = NULL;
     586             : 
     587             :     // filter height properties
     588       16836 :     XMLPropertyState* pHeightMinAbsState = NULL;
     589       16836 :     XMLPropertyState* pHeightMinRelState = NULL;
     590       16836 :     XMLPropertyState* pHeightAbsState = NULL;
     591       16836 :     XMLPropertyState* pHeightRelState = NULL;
     592       16836 :     XMLPropertyState* pSizeTypeState = NULL;
     593             : 
     594             :     // filter width properties
     595       16836 :     XMLPropertyState* pWidthMinAbsState = NULL;
     596       16836 :     XMLPropertyState* pWidthMinRelState = NULL;
     597       16836 :     XMLPropertyState* pWidthAbsState = NULL;
     598       16836 :     XMLPropertyState* pWidthRelState = NULL;
     599       16836 :     XMLPropertyState* pWidthTypeState = NULL;
     600             : 
     601             :     // wrap
     602       16836 :     XMLPropertyState* pWrapState = NULL;
     603       16836 :     XMLPropertyState* pWrapContourState = NULL;
     604       16836 :     XMLPropertyState* pWrapContourModeState = NULL;
     605       16836 :     XMLPropertyState* pWrapParagraphOnlyState = NULL;
     606             : 
     607             :     // anchor
     608       16836 :     XMLPropertyState* pAnchorTypeState = NULL;
     609             : 
     610             :     // horizontal position and relation
     611       16836 :     XMLPropertyState* pHoriOrientState = NULL;
     612       16836 :     XMLPropertyState* pHoriOrientMirroredState = NULL;
     613       16836 :     XMLPropertyState* pHoriOrientRelState = NULL;
     614       16836 :     XMLPropertyState* pHoriOrientRelFrameState = NULL;
     615       16836 :     XMLPropertyState* pHoriOrientMirrorState = NULL;
     616             :     // Horizontal position and relation for shapes (#i28749#)
     617       16836 :     XMLPropertyState* pShapeHoriOrientState = NULL;
     618       16836 :     XMLPropertyState* pShapeHoriOrientMirroredState = NULL;
     619       16836 :     XMLPropertyState* pShapeHoriOrientRelState = NULL;
     620       16836 :     XMLPropertyState* pShapeHoriOrientRelFrameState = NULL;
     621       16836 :     XMLPropertyState* pShapeHoriOrientMirrorState = NULL;
     622             : 
     623             :     // vertical position and relation
     624       16836 :     XMLPropertyState* pVertOrientState = NULL;
     625       16836 :     XMLPropertyState* pVertOrientAtCharState = NULL;
     626       16836 :     XMLPropertyState* pVertOrientRelState = NULL;
     627       16836 :     XMLPropertyState* pVertOrientRelPageState = NULL;
     628       16836 :     XMLPropertyState* pVertOrientRelFrameState = NULL;
     629       16836 :     XMLPropertyState* pVertOrientRelAsCharState = NULL;
     630       16836 :     XMLPropertyState* pRelWidthRel = NULL;
     631       16836 :     XMLPropertyState* pRelHeightRel = NULL;
     632             : 
     633             :     // Vertical position and relation for shapes (#i28749#)
     634       16836 :     XMLPropertyState* pShapeVertOrientState = NULL;
     635       16836 :     XMLPropertyState* pShapeVertOrientAtCharState = NULL;
     636       16836 :     XMLPropertyState* pShapeVertOrientRelState = NULL;
     637       16836 :     XMLPropertyState* pShapeVertOrientRelPageState = NULL;
     638       16836 :     XMLPropertyState* pShapeVertOrientRelFrameState = NULL;
     639             : 
     640             :     // filter underline color
     641       16836 :     XMLPropertyState* pUnderlineState = NULL;
     642       16836 :     XMLPropertyState* pUnderlineColorState = NULL;
     643       16836 :     XMLPropertyState* pUnderlineHasColorState = NULL;
     644             : 
     645             :     // filter list style name
     646       16836 :     XMLPropertyState* pListStyleName = NULL;
     647             : 
     648             :     // filter fo:clip
     649       16836 :     XMLPropertyState* pClip11State = NULL;
     650       16836 :     XMLPropertyState* pClipState = NULL;
     651             : 
     652             :     // filter fo:margin
     653       16836 :     XMLPropertyState* pAllParaMarginRel = NULL;
     654       16836 :     XMLPropertyState* pAllParaMargin = NULL;
     655       16836 :     XMLPropertyState* pAllMargin = NULL;
     656             : 
     657             :     //UUUU
     658       16836 :     XMLPropertyState* pRepeatOffsetX = NULL;
     659       16836 :     XMLPropertyState* pRepeatOffsetY = NULL;
     660             : 
     661       16836 :     bool bNeedsAnchor = false;
     662             : 
     663      684696 :     for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
     664      456464 :          aIter != rProperties.end();
     665             :          ++aIter )
     666             :     {
     667      211396 :         XMLPropertyState *propertie = &(*aIter);
     668      211396 :         if( propertie->mnIndex == -1 )
     669       15740 :             continue;
     670             : 
     671      195656 :         switch( getPropertySetMapper()->GetEntryContextId( propertie->mnIndex ) )
     672             :         {
     673        8068 :         case CTF_CHARHEIGHT:            pCharHeightState = propertie; break;
     674         274 :         case CTF_CHARHEIGHT_REL:        pCharPropHeightState = propertie; break;
     675         274 :         case CTF_CHARHEIGHT_DIFF:       pCharDiffHeightState = propertie; break;
     676        7734 :         case CTF_CHARHEIGHT_CJK:        pCharHeightCJKState = propertie; break;
     677         346 :         case CTF_CHARHEIGHT_REL_CJK:    pCharPropHeightCJKState = propertie; break;
     678         346 :         case CTF_CHARHEIGHT_DIFF_CJK:   pCharDiffHeightCJKState = propertie; break;
     679        7634 :         case CTF_CHARHEIGHT_CTL:        pCharHeightCTLState = propertie; break;
     680         250 :         case CTF_CHARHEIGHT_REL_CTL:    pCharPropHeightCTLState = propertie; break;
     681         250 :         case CTF_CHARHEIGHT_DIFF_CTL:   pCharDiffHeightCTLState = propertie; break;
     682         194 :         case CTF_PARALEFTMARGIN:        pParaLeftMarginState = propertie; break;
     683          34 :         case CTF_PARALEFTMARGIN_REL:    pParaLeftMarginRelState = propertie; break;
     684         194 :         case CTF_PARARIGHTMARGIN:       pParaRightMarginState = propertie; break;
     685          34 :         case CTF_PARARIGHTMARGIN_REL:   pParaRightMarginRelState = propertie; break;
     686         194 :         case CTF_PARAFIRSTLINE:         pParaFirstLineState = propertie; break;
     687          34 :         case CTF_PARAFIRSTLINE_REL:     pParaFirstLineRelState = propertie; break;
     688         516 :         case CTF_PARATOPMARGIN:         pParaTopMarginState = propertie; break;
     689         206 :         case CTF_PARATOPMARGIN_REL:     pParaTopMarginRelState = propertie; break;
     690         516 :         case CTF_PARABOTTOMMARGIN:      pParaBottomMarginState = propertie; break;
     691         206 :         case CTF_PARABOTTOMMARGIN_REL:  pParaBottomMarginRelState = propertie; break;
     692             : 
     693         100 :         case CTF_ALLBORDERWIDTH:        pAllBorderWidthState = propertie; break;
     694         100 :         case CTF_LEFTBORDERWIDTH:       pLeftBorderWidthState = propertie; break;
     695         100 :         case CTF_RIGHTBORDERWIDTH:      pRightBorderWidthState = propertie; break;
     696         100 :         case CTF_TOPBORDERWIDTH:        pTopBorderWidthState = propertie; break;
     697         100 :         case CTF_BOTTOMBORDERWIDTH:     pBottomBorderWidthState = propertie; break;
     698         100 :         case CTF_ALLBORDERDISTANCE:     pAllBorderDistanceState = propertie; break;
     699         100 :         case CTF_LEFTBORDERDISTANCE:    pLeftBorderDistanceState = propertie; break;
     700         100 :         case CTF_RIGHTBORDERDISTANCE:   pRightBorderDistanceState = propertie; break;
     701         100 :         case CTF_TOPBORDERDISTANCE:     pTopBorderDistanceState = propertie; break;
     702         100 :         case CTF_BOTTOMBORDERDISTANCE:  pBottomBorderDistanceState = propertie; break;
     703         100 :         case CTF_ALLBORDER:             pAllBorderState = propertie; break;
     704         100 :         case CTF_LEFTBORDER:            pLeftBorderState = propertie; break;
     705         100 :         case CTF_RIGHTBORDER:           pRightBorderState = propertie; break;
     706         100 :         case CTF_TOPBORDER:             pTopBorderState = propertie; break;
     707         100 :         case CTF_BOTTOMBORDER:          pBottomBorderState = propertie; break;
     708             : 
     709          10 :         case CTF_CHARALLBORDERWIDTH:        pCharAllBorderWidthState = propertie; break;
     710          10 :         case CTF_CHARLEFTBORDERWIDTH:       pCharLeftBorderWidthState = propertie; break;
     711          10 :         case CTF_CHARRIGHTBORDERWIDTH:      pCharRightBorderWidthState = propertie; break;
     712          10 :         case CTF_CHARTOPBORDERWIDTH:        pCharTopBorderWidthState = propertie; break;
     713          10 :         case CTF_CHARBOTTOMBORDERWIDTH:     pCharBottomBorderWidthState = propertie; break;
     714          10 :         case CTF_CHARALLBORDERDISTANCE:     pCharAllBorderDistanceState = propertie; break;
     715          10 :         case CTF_CHARLEFTBORDERDISTANCE:    pCharLeftBorderDistanceState = propertie; break;
     716          10 :         case CTF_CHARRIGHTBORDERDISTANCE:   pCharRightBorderDistanceState = propertie; break;
     717          10 :         case CTF_CHARTOPBORDERDISTANCE:     pCharTopBorderDistanceState = propertie; break;
     718          10 :         case CTF_CHARBOTTOMBORDERDISTANCE:  pCharBottomBorderDistanceState = propertie; break;
     719          10 :         case CTF_CHARALLBORDER:             pCharAllBorderState = propertie; break;
     720          10 :         case CTF_CHARLEFTBORDER:            pCharLeftBorderState = propertie; break;
     721          10 :         case CTF_CHARRIGHTBORDER:           pCharRightBorderState = propertie; break;
     722          10 :         case CTF_CHARTOPBORDER:             pCharTopBorderState = propertie; break;
     723          10 :         case CTF_CHARBOTTOMBORDER:          pCharBottomBorderState = propertie; break;
     724             : 
     725           0 :         case CTF_FRAMEHEIGHT_MIN_ABS:   pHeightMinAbsState = propertie; break;
     726           0 :         case CTF_FRAMEHEIGHT_MIN_REL:   pHeightMinRelState = propertie; break;
     727           0 :         case CTF_FRAMEHEIGHT_ABS:       pHeightAbsState = propertie; break;
     728           0 :         case CTF_FRAMEHEIGHT_REL:       pHeightRelState = propertie; break;
     729           0 :         case CTF_SIZETYPE:              pSizeTypeState = propertie; break;
     730             : 
     731           0 :         case CTF_FRAMEWIDTH_MIN_ABS:    pWidthMinAbsState = propertie; break;
     732           0 :         case CTF_FRAMEWIDTH_MIN_REL:    pWidthMinRelState = propertie; break;
     733           0 :         case CTF_FRAMEWIDTH_ABS:        pWidthAbsState = propertie; break;
     734           0 :         case CTF_FRAMEWIDTH_REL:        pWidthRelState = propertie; break;
     735           0 :         case CTF_FRAMEWIDTH_TYPE:       pWidthTypeState = propertie; break;
     736             : 
     737         120 :         case CTF_WRAP:                  pWrapState = propertie; break;
     738          64 :         case CTF_WRAP_CONTOUR:          pWrapContourState = propertie; break;
     739          64 :         case CTF_WRAP_CONTOUR_MODE:     pWrapContourModeState = propertie; break;
     740         120 :         case CTF_WRAP_PARAGRAPH_ONLY:   pWrapParagraphOnlyState = propertie; break;
     741          30 :         case CTF_ANCHORTYPE:            pAnchorTypeState = propertie; break;
     742             : 
     743         134 :         case CTF_HORIZONTALPOS:             pHoriOrientState = propertie; bNeedsAnchor = true; break;
     744         134 :         case CTF_HORIZONTALPOS_MIRRORED:    pHoriOrientMirroredState = propertie; bNeedsAnchor = true; break;
     745         134 :         case CTF_HORIZONTALREL:             pHoriOrientRelState = propertie; bNeedsAnchor = true; break;
     746         134 :         case CTF_HORIZONTALREL_FRAME:       pHoriOrientRelFrameState = propertie; bNeedsAnchor = true; break;
     747         134 :         case CTF_HORIZONTALMIRROR:          pHoriOrientMirrorState = propertie; bNeedsAnchor = true; break;
     748         130 :         case CTF_RELWIDTHREL:               pRelWidthRel = propertie; break;
     749         142 :         case CTF_VERTICALPOS:           pVertOrientState = propertie; bNeedsAnchor = true; break;
     750         142 :         case CTF_VERTICALPOS_ATCHAR:    pVertOrientAtCharState = propertie; bNeedsAnchor = true; break;
     751         142 :         case CTF_VERTICALREL:           pVertOrientRelState = propertie; bNeedsAnchor = true; break;
     752         142 :         case CTF_VERTICALREL_PAGE:      pVertOrientRelPageState = propertie; bNeedsAnchor = true; break;
     753         142 :         case CTF_VERTICALREL_FRAME:     pVertOrientRelFrameState = propertie; bNeedsAnchor = true; break;
     754         156 :         case CTF_VERTICALREL_ASCHAR:    pVertOrientRelAsCharState = propertie; bNeedsAnchor = true; break;
     755         130 :         case CTF_RELHEIGHTREL:          pRelHeightRel = propertie; break;
     756             : 
     757             :         // Handle new CTFs for shape positioning properties (#i28749#)
     758          14 :         case CTF_SHAPE_HORIZONTALPOS:             pShapeHoriOrientState = propertie; bNeedsAnchor = true; break;
     759          14 :         case CTF_SHAPE_HORIZONTALPOS_MIRRORED:    pShapeHoriOrientMirroredState = propertie; bNeedsAnchor = true; break;
     760          14 :         case CTF_SHAPE_HORIZONTALREL:             pShapeHoriOrientRelState = propertie; bNeedsAnchor = true; break;
     761          14 :         case CTF_SHAPE_HORIZONTALREL_FRAME:       pShapeHoriOrientRelFrameState = propertie; bNeedsAnchor = true; break;
     762          14 :         case CTF_SHAPE_HORIZONTALMIRROR:          pShapeHoriOrientMirrorState = propertie; bNeedsAnchor = true; break;
     763          14 :         case CTF_SHAPE_VERTICALPOS:           pShapeVertOrientState = propertie; bNeedsAnchor = true; break;
     764          14 :         case CTF_SHAPE_VERTICALPOS_ATCHAR:    pShapeVertOrientAtCharState = propertie; bNeedsAnchor = true; break;
     765          14 :         case CTF_SHAPE_VERTICALREL:           pShapeVertOrientRelState = propertie; bNeedsAnchor = true; break;
     766          14 :         case CTF_SHAPE_VERTICALREL_PAGE:      pShapeVertOrientRelPageState = propertie; bNeedsAnchor = true; break;
     767          14 :         case CTF_SHAPE_VERTICALREL_FRAME:     pShapeVertOrientRelFrameState = propertie; bNeedsAnchor = true; break;
     768        6220 :         case CTF_FONTNAME:              pFontNameState = propertie; break;
     769        6150 :         case CTF_FONTFAMILYNAME:        pFontFamilyNameState = propertie; break;
     770         452 :         case CTF_FONTSTYLENAME:         pFontStyleNameState = propertie; break;
     771        6150 :         case CTF_FONTFAMILY:            pFontFamilyState = propertie; break;
     772        6150 :         case CTF_FONTPITCH:             pFontPitchState = propertie; break;
     773         486 :         case CTF_FONTCHARSET:           pFontCharsetState = propertie; break;
     774             : 
     775         576 :         case CTF_FONTNAME_CJK:          pFontNameCJKState = propertie; break;
     776         482 :         case CTF_FONTFAMILYNAME_CJK:    pFontFamilyNameCJKState = propertie; break;
     777         412 :         case CTF_FONTSTYLENAME_CJK:     pFontStyleNameCJKState = propertie; break;
     778         482 :         case CTF_FONTFAMILY_CJK:        pFontFamilyCJKState = propertie; break;
     779         482 :         case CTF_FONTPITCH_CJK:         pFontPitchCJKState = propertie; break;
     780         434 :         case CTF_FONTCHARSET_CJK:       pFontCharsetCJKState = propertie; break;
     781             : 
     782         696 :         case CTF_FONTNAME_CTL:          pFontNameCTLState = propertie; break;
     783         602 :         case CTF_FONTFAMILYNAME_CTL:    pFontFamilyNameCTLState = propertie; break;
     784         532 :         case CTF_FONTSTYLENAME_CTL:     pFontStyleNameCTLState = propertie; break;
     785         602 :         case CTF_FONTFAMILY_CTL:        pFontFamilyCTLState = propertie; break;
     786         602 :         case CTF_FONTPITCH_CTL:         pFontPitchCTLState = propertie; break;
     787         554 :         case CTF_FONTCHARSET_CTL:       pFontCharsetCTLState = propertie; break;
     788         156 :         case CTF_UNDERLINE:             pUnderlineState = propertie; break;
     789         134 :         case CTF_UNDERLINE_COLOR:       pUnderlineColorState = propertie; break;
     790         134 :         case CTF_UNDERLINE_HASCOLOR:    pUnderlineHasColorState = propertie; break;
     791           0 :         case CTF_NUMBERINGSTYLENAME:    pListStyleName = propertie; break;
     792           4 :         case CTF_TEXT_CLIP11:           pClip11State = propertie; break;
     793           4 :         case CTF_TEXT_CLIP:             pClipState = propertie; break;
     794          34 :         case CTF_PARAMARGINALL_REL:     pAllParaMarginRel = propertie; break;
     795         140 :         case CTF_PARAMARGINALL:         pAllParaMargin = propertie; break;
     796          48 :         case CTF_MARGINALL:             pAllMargin = propertie; break;
     797             : 
     798             :         //UUUU
     799             :         case CTF_REPEAT_OFFSET_X:
     800          32 :             pRepeatOffsetX = propertie;
     801          32 :             break;
     802             : 
     803             :         //UUUU
     804             :         case CTF_REPEAT_OFFSET_Y:
     805          16 :             pRepeatOffsetY = propertie;
     806          16 :             break;
     807             : 
     808             :         //UUUU
     809             :         case CTF_FILLGRADIENTNAME:
     810             :         case CTF_FILLHATCHNAME:
     811             :         case CTF_FILLBITMAPNAME:
     812             :         case CTF_FILLTRANSNAME:
     813             :             {
     814         192 :                 OUString aStr;
     815         192 :                 if( (propertie->maValue >>= aStr) && 0 == aStr.getLength() )
     816          16 :                     propertie->mnIndex = -1;
     817             :             }
     818         192 :             break;
     819             :         }
     820             :     }
     821             : 
     822             :     //UUUU
     823       16836 :     if( pRepeatOffsetX && pRepeatOffsetY )
     824             :     {
     825           0 :         sal_Int32 nOffset = 0;
     826           0 :         if( ( pRepeatOffsetX->maValue >>= nOffset ) && ( nOffset == 0 ) )
     827           0 :             pRepeatOffsetX->mnIndex = -1;
     828             :         else
     829           0 :             pRepeatOffsetY->mnIndex = -1;
     830             :     }
     831             : 
     832       16836 :     if( pFontNameState )
     833             :         ContextFontFilter( bEnableFoFontFamily, pFontNameState, pFontFamilyNameState,
     834             :                            pFontStyleNameState, pFontFamilyState,
     835        6220 :                            pFontPitchState, pFontCharsetState );
     836       16836 :     if( pFontNameCJKState )
     837             :         ContextFontFilter( bEnableFoFontFamily, pFontNameCJKState, pFontFamilyNameCJKState,
     838             :                            pFontStyleNameCJKState, pFontFamilyCJKState,
     839         576 :                            pFontPitchCJKState, pFontCharsetCJKState );
     840       16836 :     if( pFontNameCTLState )
     841             :         ContextFontFilter( bEnableFoFontFamily, pFontNameCTLState, pFontFamilyNameCTLState,
     842             :                            pFontStyleNameCTLState, pFontFamilyCTLState,
     843         696 :                            pFontPitchCTLState, pFontCharsetCTLState );
     844             : 
     845       16836 :     if( pCharHeightState && (pCharPropHeightState || pCharDiffHeightState ) )
     846             :         ContextFontHeightFilter( pCharHeightState, pCharPropHeightState,
     847         274 :                                  pCharDiffHeightState  );
     848       16836 :     if( pCharHeightCJKState &&
     849        7388 :         (pCharPropHeightCJKState || pCharDiffHeightCJKState ) )
     850             :         ContextFontHeightFilter( pCharHeightCJKState, pCharPropHeightCJKState,
     851         346 :                                  pCharDiffHeightCJKState  );
     852       16836 :     if( pCharHeightCTLState &&
     853        7384 :         (pCharPropHeightCTLState || pCharDiffHeightCTLState ) )
     854             :         ContextFontHeightFilter( pCharHeightCTLState, pCharPropHeightCTLState,
     855         250 :                                  pCharDiffHeightCTLState  );
     856       16836 :     if( pUnderlineColorState || pUnderlineHasColorState )
     857             :     {
     858         134 :         bool bClear = !pUnderlineState;
     859         134 :         if( !bClear )
     860             :         {
     861         134 :             sal_Int16 nUnderline = 0;
     862         134 :             pUnderlineState->maValue >>= nUnderline;
     863         134 :             bClear = awt::FontUnderline::NONE == nUnderline;
     864             :         }
     865         134 :         if( bClear )
     866             :         {
     867          84 :             if( pUnderlineColorState )
     868          84 :                 pUnderlineColorState->mnIndex = -1;
     869          84 :             if( pUnderlineHasColorState )
     870          84 :                 pUnderlineHasColorState->mnIndex = -1;
     871             :         }
     872             :     }
     873             : 
     874       16836 :     lcl_checkMultiProperty(pParaLeftMarginState, pParaLeftMarginRelState);
     875       16836 :     lcl_checkMultiProperty(pParaRightMarginState, pParaRightMarginRelState);
     876       16836 :     lcl_checkMultiProperty(pParaTopMarginState, pParaTopMarginRelState);
     877       16836 :     lcl_checkMultiProperty(pParaBottomMarginState, pParaBottomMarginRelState);
     878       16836 :     lcl_checkMultiProperty(pParaFirstLineState, pParaFirstLineRelState);
     879             : 
     880       16836 :     if (pAllParaMarginRel)
     881             :     {   // because older OOo/LO versions can't read fo:margin:
     882          34 :         pAllParaMarginRel->mnIndex = -1; // just export individual attributes...
     883          34 :         pAllParaMarginRel->maValue.clear();
     884             :     }
     885       16836 :     if (pAllParaMargin)
     886             :     {
     887         140 :         pAllParaMargin->mnIndex = -1; // just export individual attributes...
     888         140 :         pAllParaMargin->maValue.clear();
     889             :     }
     890       16836 :     if (pAllMargin)
     891             :     {
     892          48 :         pAllMargin->mnIndex = -1; // just export individual attributes...
     893          48 :         pAllMargin->maValue.clear();
     894             :     }
     895             : 
     896             :     lcl_FilterBorders(
     897             :         pAllBorderWidthState, pLeftBorderWidthState, pRightBorderWidthState,
     898             :         pTopBorderWidthState, pBottomBorderWidthState, pAllBorderDistanceState,
     899             :         pLeftBorderDistanceState, pRightBorderDistanceState, pTopBorderDistanceState,
     900             :         pBottomBorderDistanceState, pAllBorderState, pLeftBorderState,
     901       16836 :         pRightBorderState, pTopBorderState, pBottomBorderState);
     902             : 
     903             :     lcl_FilterBorders(
     904             :         pCharAllBorderWidthState, pCharLeftBorderWidthState, pCharRightBorderWidthState,
     905             :         pCharTopBorderWidthState, pCharBottomBorderWidthState, pCharAllBorderDistanceState,
     906             :         pCharLeftBorderDistanceState, pCharRightBorderDistanceState, pCharTopBorderDistanceState,
     907             :         pCharBottomBorderDistanceState, pCharAllBorderState, pCharLeftBorderState,
     908       16836 :         pCharRightBorderState, pCharTopBorderState, pCharBottomBorderState);
     909             : 
     910       16836 :     sal_Int16 nSizeType = SizeType::FIX;
     911       16836 :     if( pSizeTypeState )
     912             :     {
     913           0 :         pSizeTypeState->maValue >>= nSizeType;
     914           0 :         pSizeTypeState->mnIndex = -1;
     915             :     }
     916             : 
     917       16836 :     if( pHeightMinAbsState )
     918             :     {
     919           0 :         sal_Int16 nRel = sal_Int16();
     920           0 :         if( (SizeType::FIX == nSizeType) ||
     921           0 :             ( pHeightMinRelState &&
     922           0 :               ( !(pHeightMinRelState->maValue >>= nRel) || nRel > 0 ) ) )
     923             :         {
     924           0 :             pHeightMinAbsState->mnIndex = -1;
     925             :         }
     926             : 
     927             :         // export SizeType::VARIABLE als min-width="0"
     928           0 :         if( SizeType::VARIABLE == nSizeType )
     929           0 :             pHeightMinAbsState->maValue <<= static_cast<sal_Int32>( 0 );
     930             :     }
     931       16836 :     if( pHeightMinRelState  && SizeType::MIN != nSizeType)
     932           0 :         pHeightMinRelState->mnIndex = -1;
     933       16836 :     if( pHeightAbsState && pHeightMinAbsState &&
     934           0 :         -1 != pHeightMinAbsState->mnIndex )
     935           0 :         pHeightAbsState->mnIndex = -1;
     936       16836 :     if( pHeightRelState && SizeType::FIX != nSizeType)
     937           0 :         pHeightRelState->mnIndex = -1;
     938             : 
     939             :     // frame width
     940       16836 :     nSizeType = SizeType::FIX;
     941       16836 :     if( pWidthTypeState )
     942             :     {
     943           0 :         pWidthTypeState->maValue >>= nSizeType;
     944           0 :         pWidthTypeState->mnIndex = -1;
     945             :     }
     946       16836 :     if( pWidthMinAbsState )
     947             :     {
     948           0 :         sal_Int16 nRel = sal_Int16();
     949           0 :         if( (SizeType::FIX == nSizeType) ||
     950           0 :             ( pWidthMinRelState &&
     951           0 :               ( !(pWidthMinRelState->maValue >>= nRel) || nRel > 0 ) ) )
     952             :         {
     953           0 :             pWidthMinAbsState->mnIndex = -1;
     954             :         }
     955             : 
     956             :         // export SizeType::VARIABLE als min-width="0"
     957           0 :         if( SizeType::VARIABLE == nSizeType )
     958           0 :             pWidthMinAbsState->maValue <<= static_cast<sal_Int32>( 0 );
     959             :     }
     960       16836 :     if( pWidthMinRelState  && SizeType::MIN != nSizeType)
     961           0 :         pWidthMinRelState->mnIndex = -1;
     962       16836 :     if( pWidthAbsState && pWidthMinAbsState &&
     963           0 :         -1 != pWidthMinAbsState->mnIndex )
     964           0 :         pWidthAbsState->mnIndex = -1;
     965       16836 :     if( pWidthRelState && SizeType::FIX != nSizeType)
     966           0 :         pWidthRelState->mnIndex = -1;
     967             : 
     968       16836 :     if( pWrapState )
     969             :     {
     970             :         WrapTextMode eVal;
     971         120 :         pWrapState->maValue >>= eVal;
     972         120 :         switch( eVal )
     973             :         {
     974             :         case WrapTextMode_NONE:
     975             :             // no wrapping: disable para-only and contour
     976           2 :             if( pWrapParagraphOnlyState )
     977           2 :                 pWrapParagraphOnlyState->mnIndex = -1;
     978             :             // no break
     979             :         case WrapTextMode_THROUGHT:
     980             :             // wrap through: disable only contour
     981          96 :             if( pWrapContourState )
     982          40 :                 pWrapContourState->mnIndex = -1;
     983          96 :             break;
     984             :         default:
     985          24 :             break;
     986             :         }
     987         184 :         if( pWrapContourModeState  &&
     988          64 :             (!pWrapContourState ||
     989          64 :              !*(sal_Bool *)pWrapContourState ->maValue.getValue() ) )
     990          64 :             pWrapContourModeState->mnIndex = -1;
     991             :     }
     992             : 
     993       16836 :     TextContentAnchorType eAnchor = TextContentAnchorType_AT_PARAGRAPH;
     994       16836 :     if( pAnchorTypeState )
     995          30 :         pAnchorTypeState->maValue >>= eAnchor;
     996       16806 :     else if( bNeedsAnchor )
     997             :     {
     998         130 :         Any aAny = rPropSet->getPropertyValue("AnchorType");
     999         130 :         aAny >>= eAnchor;
    1000             :     }
    1001             : 
    1002             :     // states for frame positioning attributes
    1003             :     {
    1004       16836 :         if( pHoriOrientState && pHoriOrientMirroredState )
    1005             :         {
    1006         268 :             if( pHoriOrientMirrorState &&
    1007         134 :                 *(sal_Bool *)pHoriOrientMirrorState->maValue.getValue() )
    1008           0 :                 pHoriOrientState->mnIndex = -1;
    1009             :             else
    1010         134 :                 pHoriOrientMirroredState->mnIndex = -1;
    1011             :         }
    1012       16836 :         if( pHoriOrientMirrorState )
    1013         134 :             pHoriOrientMirrorState->mnIndex = -1;
    1014             : 
    1015       16836 :         if( pHoriOrientRelState && TextContentAnchorType_AT_FRAME == eAnchor )
    1016           0 :             pHoriOrientRelState->mnIndex = -1;
    1017       16836 :         if( pHoriOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
    1018         134 :             pHoriOrientRelFrameState->mnIndex = -1;
    1019       16836 :         if (pRelWidthRel)
    1020             :         {
    1021         130 :             sal_Int16 nRelWidth = 0;
    1022         130 :             rPropSet->getPropertyValue("RelativeWidth") >>= nRelWidth;
    1023         130 :             if (!nRelWidth)
    1024         120 :                 pRelWidthRel->mnIndex = -1;
    1025             :         }
    1026             : 
    1027       16836 :         if( pVertOrientState && TextContentAnchorType_AT_CHARACTER == eAnchor )
    1028           8 :             pVertOrientState->mnIndex = -1;
    1029       16836 :         if( pVertOrientAtCharState && TextContentAnchorType_AT_CHARACTER != eAnchor )
    1030         134 :             pVertOrientAtCharState->mnIndex = -1;
    1031       16888 :         if( pVertOrientRelState && TextContentAnchorType_AT_PARAGRAPH != eAnchor &&
    1032          52 :             TextContentAnchorType_AT_CHARACTER != eAnchor )
    1033          44 :             pVertOrientRelState->mnIndex = -1;
    1034       16836 :         if( pVertOrientRelPageState && TextContentAnchorType_AT_PAGE != eAnchor )
    1035         138 :             pVertOrientRelPageState->mnIndex = -1;
    1036       16836 :         if( pVertOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
    1037         142 :             pVertOrientRelFrameState->mnIndex = -1;
    1038       16836 :         if( pVertOrientRelAsCharState && TextContentAnchorType_AS_CHARACTER != eAnchor )
    1039         116 :             pVertOrientRelAsCharState->mnIndex = -1;
    1040       16836 :         if (pRelHeightRel)
    1041             :         {
    1042         130 :             sal_Int16 nRelHeight = 0;
    1043         130 :             rPropSet->getPropertyValue("RelativeHeight") >>= nRelHeight;
    1044         130 :             if (!nRelHeight)
    1045         120 :                 pRelHeightRel->mnIndex = -1;
    1046             :         }
    1047             :     }
    1048             : 
    1049             :     // States for shape positioning properties (#i28749#)
    1050       33632 :     if ( eAnchor != TextContentAnchorType_AS_CHARACTER &&
    1051       16796 :          ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 )
    1052             :     {
    1053             :         // no export of shape positioning properties,
    1054             :         // if shape isn't anchored as-character and
    1055             :         // destination file format is OpenOffice.org file format
    1056         136 :         if ( pShapeHoriOrientState )
    1057           0 :             pShapeHoriOrientState->mnIndex = -1;
    1058         136 :         if ( pShapeHoriOrientMirroredState )
    1059           0 :             pShapeHoriOrientMirroredState->mnIndex = -1;
    1060         136 :         if ( pShapeHoriOrientRelState )
    1061           0 :             pShapeHoriOrientRelState->mnIndex = -1;
    1062         136 :         if ( pShapeHoriOrientRelFrameState )
    1063           0 :             pShapeHoriOrientRelFrameState->mnIndex = -1;
    1064         136 :         if ( pShapeHoriOrientMirrorState )
    1065           0 :             pShapeHoriOrientMirrorState->mnIndex = -1;
    1066         136 :         if ( pShapeVertOrientState )
    1067           0 :             pShapeVertOrientState->mnIndex = -1;
    1068         136 :         if ( pShapeVertOrientAtCharState )
    1069           0 :             pShapeVertOrientAtCharState->mnIndex = -1;
    1070         136 :         if ( pShapeVertOrientRelState )
    1071           0 :             pShapeVertOrientRelState->mnIndex = -1;
    1072         136 :         if ( pShapeVertOrientRelPageState )
    1073           0 :             pShapeVertOrientRelPageState->mnIndex = -1;
    1074         136 :         if ( pShapeVertOrientRelFrameState )
    1075           0 :             pShapeVertOrientRelFrameState->mnIndex = -1;
    1076             :     }
    1077             :     else
    1078             :     {
    1079             :         // handling of shape positioning property states as for frames - see above
    1080       16700 :         if( pShapeHoriOrientState && pShapeHoriOrientMirroredState )
    1081             :         {
    1082          28 :             if( pShapeHoriOrientMirrorState &&
    1083          14 :                 *(sal_Bool *)pShapeHoriOrientMirrorState->maValue.getValue() )
    1084           0 :                 pShapeHoriOrientState->mnIndex = -1;
    1085             :             else
    1086          14 :                 pShapeHoriOrientMirroredState->mnIndex = -1;
    1087             :         }
    1088       16700 :         if( pShapeHoriOrientMirrorState )
    1089          14 :             pShapeHoriOrientMirrorState->mnIndex = -1;
    1090             : 
    1091       16700 :         if( pShapeHoriOrientRelState && TextContentAnchorType_AT_FRAME == eAnchor )
    1092           0 :             pShapeHoriOrientRelState->mnIndex = -1;
    1093       16700 :         if( pShapeHoriOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
    1094          14 :             pShapeHoriOrientRelFrameState->mnIndex = -1;
    1095             : 
    1096       16700 :         if( pShapeVertOrientState && TextContentAnchorType_AT_CHARACTER == eAnchor )
    1097           0 :             pShapeVertOrientState->mnIndex = -1;
    1098       16700 :         if( pShapeVertOrientAtCharState && TextContentAnchorType_AT_CHARACTER != eAnchor )
    1099          14 :             pShapeVertOrientAtCharState->mnIndex = -1;
    1100       16704 :         if( pShapeVertOrientRelState && TextContentAnchorType_AT_PARAGRAPH != eAnchor &&
    1101           4 :             TextContentAnchorType_AT_CHARACTER != eAnchor )
    1102           4 :             pShapeVertOrientRelState->mnIndex = -1;
    1103       16700 :         if( pShapeVertOrientRelPageState && TextContentAnchorType_AT_PAGE != eAnchor )
    1104          10 :             pShapeVertOrientRelPageState->mnIndex = -1;
    1105       16700 :         if( pShapeVertOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
    1106          14 :             pShapeVertOrientRelFrameState->mnIndex = -1;
    1107             :     }
    1108             : 
    1109             :     // list style name: remove list style if it is the default outline style
    1110       16836 :     if( pListStyleName != NULL )
    1111             :     {
    1112           0 :         OUString sListStyleName;
    1113           0 :         pListStyleName->maValue >>= sListStyleName;
    1114           0 :         if( lcl_IsOutlineStyle( GetExport(), sListStyleName ) )
    1115           0 :             pListStyleName->mnIndex = -1;
    1116             :     }
    1117             : 
    1118       16836 :     if( pClipState != NULL && pClip11State != NULL  )
    1119           4 :         pClip11State->mnIndex = -1;
    1120             : 
    1121       16836 :     SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet);
    1122       16836 : }
    1123             : 
    1124             : namespace {
    1125             : 
    1126           0 : static bool lcl_IsOutlineStyle(const SvXMLExport &rExport, const OUString & rName)
    1127             : {
    1128             :     Reference< XChapterNumberingSupplier >
    1129           0 :         xCNSupplier(rExport.GetModel(), UNO_QUERY);
    1130             : 
    1131           0 :     OUString sOutlineName;
    1132           0 :     OUString sName("Name");
    1133             : 
    1134           0 :     if (xCNSupplier.is())
    1135             :     {
    1136             :         Reference<XPropertySet> xNumRule(
    1137           0 :             xCNSupplier->getChapterNumberingRules(), UNO_QUERY );
    1138             :         DBG_ASSERT( xNumRule.is(), "no chapter numbering rules" );
    1139           0 :         if (xNumRule.is())
    1140             :         {
    1141           0 :             xNumRule->getPropertyValue(sName) >>= sOutlineName;
    1142           0 :         }
    1143             :     }
    1144             : 
    1145           0 :     return rName == sOutlineName;
    1146             : }
    1147             : 
    1148             : }
    1149             : 
    1150             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10