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

Generated by: LCOV version 1.11