LCOV - code coverage report
Current view: top level - xmloff/source/text - txtimppr.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 337 365 92.3 %
Date: 2015-06-13 12:38:46 Functions: 9 9 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 <osl/thread.h>
      21             : #include <com/sun/star/awt/FontFamily.hpp>
      22             : #include <com/sun/star/awt/FontPitch.hpp>
      23             : #include <com/sun/star/table/BorderLine2.hpp>
      24             : #include <com/sun/star/text/VertOrientation.hpp>
      25             : #include <com/sun/star/text/SizeType.hpp>
      26             : #include <xmloff/XMLFontStylesContext.hxx>
      27             : #include <xmloff/txtprmap.hxx>
      28             : #include <xmloff/xmlimp.hxx>
      29             : #include <xmloff/txtimppr.hxx>
      30             : #include <xmloff/maptype.hxx>
      31             : 
      32             : #define XML_LINE_LEFT 0
      33             : #define XML_LINE_RIGHT 1
      34             : #define XML_LINE_TOP 2
      35             : #define XML_LINE_BOTTOM 3
      36             : 
      37             : 
      38             : using namespace ::com::sun::star;
      39             : using namespace ::com::sun::star::uno;
      40             : using namespace ::com::sun::star::table;
      41             : using namespace ::com::sun::star::text;
      42             : 
      43       12789 : bool XMLTextImportPropertyMapper::handleSpecialItem(
      44             :             XMLPropertyState& rProperty,
      45             :             ::std::vector< XMLPropertyState >& rProperties,
      46             :             const OUString& rValue,
      47             :             const SvXMLUnitConverter& rUnitConverter,
      48             :             const SvXMLNamespaceMap& rNamespaceMap ) const
      49             : {
      50       12789 :     bool bRet = false;
      51       12789 :     sal_Int32 nIndex = rProperty.mnIndex;
      52       12789 :     switch( getPropertySetMapper()->GetEntryContextId( nIndex  ) )
      53             :     {
      54             :     case CTF_FONTNAME:
      55             :     case CTF_FONTNAME_CJK:
      56             :     case CTF_FONTNAME_CTL:
      57        9712 :         if( GetImport().GetFontDecls() != NULL )
      58             :         {
      59             :             assert((
      60             :                 ( CTF_FONTFAMILYNAME ==
      61             :                     getPropertySetMapper()->GetEntryContextId(nIndex+1) &&
      62             :                   CTF_FONTSTYLENAME ==
      63             :                     getPropertySetMapper()->GetEntryContextId(nIndex+2) &&
      64             :                   CTF_FONTFAMILY ==
      65             :                     getPropertySetMapper()->GetEntryContextId(nIndex+3) &&
      66             :                   CTF_FONTPITCH ==
      67             :                     getPropertySetMapper()->GetEntryContextId(nIndex+4) &&
      68             :                   CTF_FONTCHARSET ==
      69             :                     getPropertySetMapper()->GetEntryContextId(nIndex+5) ) ||
      70             :                 ( CTF_FONTFAMILYNAME_CJK ==
      71             :                     getPropertySetMapper()->GetEntryContextId(nIndex+1) &&
      72             :                   CTF_FONTSTYLENAME_CJK ==
      73             :                     getPropertySetMapper()->GetEntryContextId(nIndex+2) &&
      74             :                   CTF_FONTFAMILY_CJK ==
      75             :                     getPropertySetMapper()->GetEntryContextId(nIndex+3) &&
      76             :                   CTF_FONTPITCH_CJK ==
      77             :                     getPropertySetMapper()->GetEntryContextId(nIndex+4) &&
      78             :                   CTF_FONTCHARSET_CJK ==
      79             :                     getPropertySetMapper()->GetEntryContextId(nIndex+5) ) ||
      80             :                 ( CTF_FONTFAMILYNAME_CTL ==
      81             :                     getPropertySetMapper()->GetEntryContextId(nIndex+1) &&
      82             :                   CTF_FONTSTYLENAME_CTL ==
      83             :                     getPropertySetMapper()->GetEntryContextId(nIndex+2) &&
      84             :                   CTF_FONTFAMILY_CTL ==
      85             :                     getPropertySetMapper()->GetEntryContextId(nIndex+3) &&
      86             :                   CTF_FONTPITCH_CTL ==
      87             :                     getPropertySetMapper()->GetEntryContextId(nIndex+4) &&
      88             :                   CTF_FONTCHARSET_CTL ==
      89             :                     getPropertySetMapper()->GetEntryContextId(nIndex+5) )
      90             :               ) && "illegal property map" );
      91             : 
      92        9712 :             GetImport().GetFontDecls()->FillProperties(
      93             :                             rValue, rProperties,
      94             :                             rProperty.mnIndex+1, rProperty.mnIndex+2,
      95             :                             rProperty.mnIndex+3, rProperty.mnIndex+4,
      96       19424 :                             rProperty.mnIndex+5 );
      97        9712 :             bRet = false; // the property hasn't been filled
      98             :         }
      99        9712 :         break;
     100             : 
     101             :     // If we want to do StarMath/StarSymbol font conversion, then we'll
     102             :     // want these special items to be treated just like regular ones...
     103             :     // For the Writer, we'll catch and convert them in _FillPropertySet;
     104             :     // the other apps probably don't care. For the other apps, we just
     105             :     // imitate the default non-special-item mechanism.
     106             :     case CTF_FONTFAMILYNAME:
     107             :     case CTF_FONTFAMILYNAME_CJK:
     108             :     case CTF_FONTFAMILYNAME_CTL:
     109        3063 :         bRet = getPropertySetMapper()->importXML( rValue, rProperty,
     110        3063 :                                                   rUnitConverter );
     111        3063 :         break;
     112             : 
     113             :     case CTF_TEXT_DISPLAY:
     114          14 :         bRet = getPropertySetMapper()->importXML( rValue, rProperty,
     115          14 :                                                   rUnitConverter );
     116          14 :         if( SvXMLImport::OOo_2x == GetImport().getGeneratorVersion() )
     117             :         {
     118           0 :             bool bHidden = false;
     119           0 :             rProperty.maValue >>= bHidden;
     120           0 :             bHidden = !bHidden;
     121           0 :             rProperty.maValue <<= bHidden;
     122             :         }
     123          14 :     break;
     124             :     default:
     125             :         bRet = SvXMLImportPropertyMapper::handleSpecialItem( rProperty,
     126           0 :                     rProperties, rValue, rUnitConverter, rNamespaceMap );
     127           0 :         break;
     128             :     }
     129             : 
     130       12789 :     return bRet;
     131             : }
     132             : 
     133       12310 : XMLTextImportPropertyMapper::XMLTextImportPropertyMapper(
     134             :             const rtl::Reference< XMLPropertySetMapper >& rMapper,
     135             :             SvXMLImport& rImp ) :
     136             :     SvXMLImportPropertyMapper( rMapper, rImp ),
     137             :     nSizeTypeIndex( -2 ),
     138       12310 :     nWidthTypeIndex( -2 )
     139             : {
     140       12310 : }
     141             : 
     142       24620 : XMLTextImportPropertyMapper::~XMLTextImportPropertyMapper()
     143             : {
     144       24620 : }
     145             : 
     146       10830 : void XMLTextImportPropertyMapper::FontFinished(
     147             :     XMLPropertyState *pFontFamilyNameState,
     148             :     XMLPropertyState *pFontStyleNameState,
     149             :     XMLPropertyState *pFontFamilyState,
     150             :     XMLPropertyState *pFontPitchState,
     151             :     XMLPropertyState *pFontCharsetState )
     152             : {
     153       10830 :     if( pFontFamilyNameState && pFontFamilyNameState->mnIndex != -1 )
     154             :     {
     155       10830 :         OUString sName;
     156       10830 :         pFontFamilyNameState->maValue >>= sName;
     157       10830 :         if( sName.isEmpty() )
     158          54 :             pFontFamilyNameState->mnIndex = -1;
     159             :     }
     160       10830 :     if( !pFontFamilyNameState || pFontFamilyNameState->mnIndex == -1 )
     161             :     {
     162          54 :         if( pFontStyleNameState )
     163          54 :             pFontStyleNameState->mnIndex = -1;
     164          54 :         if( pFontFamilyState )
     165          54 :             pFontFamilyState->mnIndex = -1;
     166          54 :         if( pFontPitchState )
     167          54 :             pFontPitchState->mnIndex = -1;
     168          54 :         if( pFontCharsetState )
     169          54 :             pFontCharsetState->mnIndex = -1;
     170             :     }
     171       10830 : }
     172             : 
     173             : /** since the properties "CharFontFamilyName", "CharFontStyleName", "CharFontFamily",
     174             :     "CharFontPitch" and "CharFontSet" and theire CJK and CTL counterparts are only
     175             :     usable as a union, we add defaults to all values that are not set as long as we
     176             :     have an "CharFontFamilyName"
     177             : 
     178             :     #99928# CL */
     179       55737 : void XMLTextImportPropertyMapper::FontDefaultsCheck(
     180             :                                         XMLPropertyState* pFontFamilyName,
     181             :                                         XMLPropertyState* pFontStyleName,
     182             :                                         XMLPropertyState* pFontFamily,
     183             :                                         XMLPropertyState* pFontPitch,
     184             :                                         XMLPropertyState* pFontCharSet,
     185             :                                         XMLPropertyState** ppNewFontStyleName,
     186             :                                         XMLPropertyState** ppNewFontFamily,
     187             :                                         XMLPropertyState** ppNewFontPitch,
     188             :                                         XMLPropertyState** ppNewFontCharSet ) const
     189             : {
     190       55737 :     if( pFontFamilyName )
     191             :     {
     192       10830 :         OUString sEmpty;
     193       21660 :         Any aAny;
     194             : 
     195       10830 :         if( !pFontStyleName )
     196             :         {
     197         131 :             aAny <<= sEmpty;
     198             :     #if OSL_DEBUG_LEVEL > 0
     199             :                 sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
     200             :                                                 pFontFamilyName->mnIndex + 1 );
     201             :                 assert(nTmp == CTF_FONTSTYLENAME || nTmp == CTF_FONTSTYLENAME_CJK || nTmp == CTF_FONTSTYLENAME_CTL);
     202             :     #endif
     203             :                 *ppNewFontStyleName = new XMLPropertyState( pFontFamilyName->mnIndex + 1,
     204         131 :                                                        aAny );
     205             :         }
     206             : 
     207       10830 :         if( !pFontFamily )
     208             :         {
     209           6 :             aAny <<= (sal_Int16)com::sun::star::awt::FontFamily::DONTKNOW;
     210             : 
     211             :     #if OSL_DEBUG_LEVEL > 0
     212             :                 sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
     213             :                                                 pFontFamilyName->mnIndex + 2 );
     214             :                 assert(nTmp == CTF_FONTFAMILY || nTmp == CTF_FONTFAMILY_CJK || nTmp == CTF_FONTFAMILY_CTL);
     215             :     #endif
     216             :                 *ppNewFontFamily = new XMLPropertyState( pFontFamilyName->mnIndex + 2,
     217           6 :                                                        aAny );
     218             :         }
     219             : 
     220       10830 :         if( !pFontPitch )
     221             :         {
     222           4 :             aAny <<= (sal_Int16)com::sun::star::awt::FontPitch::DONTKNOW;
     223             :     #if OSL_DEBUG_LEVEL > 0
     224             :                 sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
     225             :                                                 pFontFamilyName->mnIndex + 3 );
     226             :                 assert(nTmp == CTF_FONTPITCH || nTmp == CTF_FONTPITCH_CJK || nTmp == CTF_FONTPITCH_CTL);
     227             :     #endif
     228             :                 *ppNewFontPitch = new XMLPropertyState( pFontFamilyName->mnIndex + 3,
     229           4 :                                                        aAny );
     230             :         }
     231             : 
     232       10830 :         if( !pFontCharSet )
     233             :         {
     234         131 :             aAny <<= (sal_Int16)osl_getThreadTextEncoding();
     235             :     #if OSL_DEBUG_LEVEL > 0
     236             :                 sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
     237             :                                                 pFontFamilyName->mnIndex + 4 );
     238             :                 assert(nTmp == CTF_FONTCHARSET || nTmp == CTF_FONTCHARSET_CJK || nTmp == CTF_FONTCHARSET_CTL);
     239             :     #endif
     240             :                 *ppNewFontCharSet = new XMLPropertyState( pFontFamilyName->mnIndex + 4,
     241         131 :                                                        aAny );
     242       10830 :         }
     243             :     }
     244       55737 : }
     245             : 
     246             : namespace {
     247             : //fdo#58730 The [UL|LR]Space class has a deficiency where "100%" also serves as
     248             : //a flag that the value is an absolute value so we can't truly handle an
     249             : //up/lower space property which wants to specify its 200% upper but 100% lower
     250             : //of its parent (try typing 100% vs 200% into the edit style dialog and revisit
     251             : //your style). So on xml load that ends up meaning 200%, 0 lower. This is a
     252             : //crock.
     253             : 
     254             : //On import clear 100% all-margins relative sizes.
     255             : static bool
     256           2 : isNotDefaultRelSize(const XMLPropertyState* pRelState, const rtl::Reference<XMLPropertySetMapper>& rPrMap)
     257             : {
     258           2 :     if (rPrMap->GetEntryContextId(pRelState->mnIndex) == CTF_PARAMARGINALL_REL)
     259             :     {
     260           2 :         sal_Int32 nTemp = 0;
     261           2 :         pRelState->maValue >>= nTemp;
     262           2 :         return nTemp != 100;
     263             :     }
     264           0 :     return true;
     265             : }
     266             : 
     267             : /**
     268             :  * Separate compressed border attributes.
     269             :  * During export, border attributes are compressed if there are equal to all four side.
     270             :  * Since Writer hasn't the same compressed attributes, but has distinct ones for all
     271             :  * four side, we have to duplicate the compressed attribute during import.
     272             : **/
     273      148632 : static void lcl_SeparateBorder(
     274             :     sal_uInt16 nIndex, XMLPropertyState* pAllBorderDistance,
     275             :     XMLPropertyState* pBorderDistances[4], XMLPropertyState* pNewBorderDistances[4],
     276             :     XMLPropertyState* pAllBorder, XMLPropertyState* pBorders[4],
     277             :     XMLPropertyState* pNewBorders[4], XMLPropertyState* pAllBorderWidth,
     278             :     XMLPropertyState* pBorderWidths[4]
     279             : #if OSL_DEBUG_LEVEL > 0
     280             :     , const rtl::Reference< XMLPropertySetMapper >& rMapper
     281             : #endif
     282             : )
     283             : {
     284      148632 :     if( pAllBorderDistance && !pBorderDistances[nIndex] )
     285             :     {
     286             : #if OSL_DEBUG_LEVEL > 0
     287             :         sal_Int16 nTmp = rMapper->GetEntryContextId(
     288             :                                     pAllBorderDistance->mnIndex + nIndex + 1 );
     289             :         if (CTF_CHARALLBORDERDISTANCE ==
     290             :                 rMapper->GetEntryContextId(pAllBorderDistance->mnIndex))
     291             :         {
     292             :             assert(nTmp >= CTF_CHARLEFTBORDERDISTANCE &&
     293             :                    nTmp <= CTF_CHARBOTTOMBORDERDISTANCE);
     294             :         }
     295             :         else
     296             :         {
     297             :             assert(nTmp >= CTF_LEFTBORDERDISTANCE &&
     298             :                    nTmp <= CTF_BOTTOMBORDERDISTANCE);
     299             :         }
     300             : #endif
     301         880 :         pNewBorderDistances[nIndex] =
     302         880 :             new XMLPropertyState( pAllBorderDistance->mnIndex + nIndex + 1,
     303        2640 :                                     pAllBorderDistance->maValue );
     304         880 :         pBorderDistances[nIndex] = pNewBorderDistances[nIndex];
     305             :     }
     306      148632 :     if( pAllBorder && !pBorders[nIndex] )
     307             :     {
     308             : #if OSL_DEBUG_LEVEL > 0
     309             :         sal_Int16 nTmp = rMapper->GetEntryContextId(
     310             :                                         pAllBorder->mnIndex + nIndex + 1 );
     311             :         if (CTF_CHARALLBORDER ==
     312             :                 rMapper->GetEntryContextId(pAllBorder->mnIndex))
     313             :         {
     314             :             assert(nTmp >= CTF_CHARLEFTBORDER && nTmp <= CTF_CHARBOTTOMBORDER);
     315             :         }
     316             :         else
     317             :         {
     318             :             assert(nTmp >= CTF_LEFTBORDER && nTmp <= CTF_BOTTOMBORDER);
     319             :         }
     320             : #endif
     321        1816 :         pNewBorders[nIndex] = new XMLPropertyState( pAllBorder->mnIndex + nIndex + 1,
     322        2724 :                                                    pAllBorder->maValue );
     323         908 :         pBorders[nIndex] = pNewBorders[nIndex];
     324             :     }
     325      148632 :     if( !pBorderWidths[nIndex] )
     326      148616 :         pBorderWidths[nIndex] = pAllBorderWidth;
     327             :     else
     328          16 :         pBorderWidths[nIndex]->mnIndex = -1;
     329             : 
     330      148632 :     if( pBorders[nIndex] && pBorderWidths[nIndex] )
     331             :     {
     332          40 :         table::BorderLine2 aBorderLine;
     333          40 :         pBorders[nIndex]->maValue >>= aBorderLine;
     334             : 
     335          40 :         table::BorderLine2 aBorderLineWidth;
     336          40 :         pBorderWidths[nIndex]->maValue >>= aBorderLineWidth;
     337             : 
     338          40 :         aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
     339          40 :         aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
     340          40 :         aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
     341          40 :         aBorderLine.LineWidth = aBorderLineWidth.LineWidth;
     342             : 
     343          40 :         pBorders[nIndex]->maValue <<= aBorderLine;
     344             :     }
     345      148632 : }
     346             : 
     347             : }
     348             : 
     349       18579 : void XMLTextImportPropertyMapper::finished(
     350             :             ::std::vector< XMLPropertyState >& rProperties,
     351             :             sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/ ) const
     352             : {
     353       18579 :     bool bHasAnyHeight = false;
     354       18579 :     bool bHasAnyMinHeight = false;
     355       18579 :     bool bHasAnyWidth = false;
     356       18579 :     bool bHasAnyMinWidth = false;
     357             : 
     358       18579 :     XMLPropertyState* pFontFamilyName = 0;
     359       18579 :     XMLPropertyState* pFontStyleName = 0;
     360       18579 :     XMLPropertyState* pFontFamily = 0;
     361       18579 :     XMLPropertyState* pFontPitch = 0;
     362       18579 :     XMLPropertyState* pFontCharSet = 0;
     363       18579 :     XMLPropertyState* pNewFontStyleName = 0;
     364       18579 :     XMLPropertyState* pNewFontFamily = 0;
     365       18579 :     XMLPropertyState* pNewFontPitch = 0;
     366       18579 :     XMLPropertyState* pNewFontCharSet = 0;
     367       18579 :     XMLPropertyState* pFontFamilyNameCJK = 0;
     368       18579 :     XMLPropertyState* pFontStyleNameCJK = 0;
     369       18579 :     XMLPropertyState* pFontFamilyCJK = 0;
     370       18579 :     XMLPropertyState* pFontPitchCJK = 0;
     371       18579 :     XMLPropertyState* pFontCharSetCJK = 0;
     372       18579 :     XMLPropertyState* pNewFontStyleNameCJK = 0;
     373       18579 :     XMLPropertyState* pNewFontFamilyCJK = 0;
     374       18579 :     XMLPropertyState* pNewFontPitchCJK = 0;
     375       18579 :     XMLPropertyState* pNewFontCharSetCJK = 0;
     376       18579 :     XMLPropertyState* pFontFamilyNameCTL = 0;
     377       18579 :     XMLPropertyState* pFontStyleNameCTL = 0;
     378       18579 :     XMLPropertyState* pFontFamilyCTL = 0;
     379       18579 :     XMLPropertyState* pFontPitchCTL = 0;
     380       18579 :     XMLPropertyState* pFontCharSetCTL = 0;
     381       18579 :     XMLPropertyState* pNewFontStyleNameCTL = 0;
     382       18579 :     XMLPropertyState* pNewFontFamilyCTL = 0;
     383       18579 :     XMLPropertyState* pNewFontPitchCTL = 0;
     384       18579 :     XMLPropertyState* pNewFontCharSetCTL = 0;
     385       18579 :     XMLPropertyState* pAllBorderDistance = 0;
     386       18579 :     XMLPropertyState* pBorderDistances[4] = { 0, 0, 0, 0 };
     387       18579 :     XMLPropertyState* pNewBorderDistances[4] = { 0, 0, 0, 0 };
     388       18579 :     XMLPropertyState* pAllBorder = 0;
     389       18579 :     XMLPropertyState* pBorders[4] = { 0, 0, 0, 0 };
     390       18579 :     XMLPropertyState* pNewBorders[4] = { 0, 0, 0, 0 };
     391       18579 :     XMLPropertyState* pAllBorderWidth = 0;
     392       18579 :     XMLPropertyState* pBorderWidths[4] = { 0, 0, 0, 0 };
     393       18579 :     XMLPropertyState* pCharAllBorderDistance = 0;
     394       18579 :     XMLPropertyState* pCharBorderDistances[4] = { 0, 0, 0, 0 };
     395       18579 :     XMLPropertyState* pCharNewBorderDistances[4] = { 0, 0, 0, 0 };
     396       18579 :     XMLPropertyState* pCharAllBorder = 0;
     397       18579 :     XMLPropertyState* pCharBorders[4] = { 0, 0, 0, 0 };
     398       18579 :     XMLPropertyState* pCharNewBorders[4] = { 0, 0, 0, 0 };
     399       18579 :     XMLPropertyState* pCharAllBorderWidth = 0;
     400       18579 :     XMLPropertyState* pCharBorderWidths[4] = { 0, 0, 0, 0 };
     401       18579 :     XMLPropertyState* pVertOrient = 0;
     402       18579 :     XMLPropertyState* pVertOrientRelAsChar = 0;
     403       18579 :     XMLPropertyState* pBackTransparency = NULL; // transparency in %
     404       18579 :     XMLPropertyState* pBackTransparent = NULL;  // transparency as boolean
     405       18579 :     XMLPropertyState* pAllParaMargin = 0;
     406       18579 :     XMLPropertyState* pParaMargins[4] = { 0, 0, 0, 0 };
     407       92895 :     ::std::unique_ptr<XMLPropertyState> pNewParaMargins[4];
     408       18579 :     XMLPropertyState* pAllMargin = 0;
     409       18579 :     XMLPropertyState* pMargins[4] = { 0, 0, 0, 0 };
     410       37158 :     ::std::unique_ptr<XMLPropertyState> pNewMargins[4];
     411             : 
     412      606843 :     for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
     413      404562 :          aIter != rProperties.end();
     414             :          ++aIter )
     415             :     {
     416      183702 :         XMLPropertyState* property = &(*aIter);
     417      183702 :         if( -1 == property->mnIndex )
     418        2982 :             continue;
     419             : 
     420      180720 :         switch( getPropertySetMapper()->GetEntryContextId( property->mnIndex ) )
     421             :         {
     422        4865 :         case CTF_FONTFAMILYNAME:    pFontFamilyName = property; break;
     423        4032 :         case CTF_FONTSTYLENAME: pFontStyleName = property;  break;
     424        4665 :         case CTF_FONTFAMILY:    pFontFamily = property; break;
     425        4754 :         case CTF_FONTPITCH: pFontPitch = property;  break;
     426        3926 :         case CTF_FONTCHARSET:   pFontCharSet = property;    break;
     427             : 
     428        3633 :         case CTF_FONTFAMILYNAME_CJK:    pFontFamilyNameCJK = property;  break;
     429        3062 :         case CTF_FONTSTYLENAME_CJK: pFontStyleNameCJK = property;   break;
     430        3572 :         case CTF_FONTFAMILY_CJK:    pFontFamilyCJK = property;  break;
     431        3610 :         case CTF_FONTPITCH_CJK: pFontPitchCJK = property;   break;
     432        3081 :         case CTF_FONTCHARSET_CJK:   pFontCharSetCJK = property; break;
     433             : 
     434        5001 :         case CTF_FONTFAMILYNAME_CTL:    pFontFamilyNameCTL = property;  break;
     435        3891 :         case CTF_FONTSTYLENAME_CTL: pFontStyleNameCTL = property;   break;
     436        4808 :         case CTF_FONTFAMILY_CTL:    pFontFamilyCTL = property;  break;
     437        4462 :         case CTF_FONTPITCH_CTL: pFontPitchCTL = property;   break;
     438        3918 :         case CTF_FONTCHARSET_CTL:   pFontCharSetCTL = property; break;
     439             : 
     440         202 :         case CTF_ALLBORDERDISTANCE:     pAllBorderDistance = property; break;
     441         120 :         case CTF_LEFTBORDERDISTANCE:    pBorderDistances[XML_LINE_LEFT] = property; break;
     442         120 :         case CTF_RIGHTBORDERDISTANCE:   pBorderDistances[XML_LINE_RIGHT] = property; break;
     443         120 :         case CTF_TOPBORDERDISTANCE:     pBorderDistances[XML_LINE_TOP] = property; break;
     444         120 :         case CTF_BOTTOMBORDERDISTANCE:  pBorderDistances[XML_LINE_BOTTOM] = property; break;
     445         209 :         case CTF_ALLBORDER:             pAllBorder = property; break;
     446          96 :         case CTF_LEFTBORDER:            pBorders[XML_LINE_LEFT] = property; break;
     447          96 :         case CTF_RIGHTBORDER:           pBorders[XML_LINE_RIGHT] = property; break;
     448          96 :         case CTF_TOPBORDER:             pBorders[XML_LINE_TOP] = property; break;
     449          96 :         case CTF_BOTTOMBORDER:          pBorders[XML_LINE_BOTTOM] = property; break;
     450           6 :         case CTF_ALLBORDERWIDTH:        pAllBorderWidth = property; break;
     451           1 :         case CTF_LEFTBORDERWIDTH:       pBorderWidths[XML_LINE_LEFT] = property; break;
     452           2 :         case CTF_RIGHTBORDERWIDTH:      pBorderWidths[XML_LINE_RIGHT] = property; break;
     453           2 :         case CTF_TOPBORDERWIDTH:        pBorderWidths[XML_LINE_TOP] = property; break;
     454           7 :         case CTF_BOTTOMBORDERWIDTH:     pBorderWidths[XML_LINE_BOTTOM] = property; break;
     455             : 
     456          18 :         case CTF_CHARALLBORDERDISTANCE:     pCharAllBorderDistance = property; break;
     457          12 :         case CTF_CHARLEFTBORDERDISTANCE:    pCharBorderDistances[XML_LINE_LEFT] = property; break;
     458          12 :         case CTF_CHARRIGHTBORDERDISTANCE:   pCharBorderDistances[XML_LINE_RIGHT] = property; break;
     459          12 :         case CTF_CHARTOPBORDERDISTANCE:     pCharBorderDistances[XML_LINE_TOP] = property; break;
     460          12 :         case CTF_CHARBOTTOMBORDERDISTANCE:  pCharBorderDistances[XML_LINE_BOTTOM] = property; break;
     461          18 :         case CTF_CHARALLBORDER:             pCharAllBorder = property; break;
     462          12 :         case CTF_CHARLEFTBORDER:            pCharBorders[XML_LINE_LEFT] = property; break;
     463          12 :         case CTF_CHARRIGHTBORDER:           pCharBorders[XML_LINE_RIGHT] = property; break;
     464          12 :         case CTF_CHARTOPBORDER:             pCharBorders[XML_LINE_TOP] = property; break;
     465          12 :         case CTF_CHARBOTTOMBORDER:          pCharBorders[XML_LINE_BOTTOM] = property; break;
     466           0 :         case CTF_CHARALLBORDERWIDTH:        pCharAllBorderWidth = property; break;
     467           0 :         case CTF_CHARLEFTBORDERWIDTH:       pCharBorderWidths[XML_LINE_LEFT] = property; break;
     468           0 :         case CTF_CHARRIGHTBORDERWIDTH:      pCharBorderWidths[XML_LINE_RIGHT] = property; break;
     469           4 :         case CTF_CHARTOPBORDERWIDTH:        pCharBorderWidths[XML_LINE_TOP] = property; break;
     470           0 :         case CTF_CHARBOTTOMBORDERWIDTH:     pCharBorderWidths[XML_LINE_BOTTOM] = property; break;
     471             : 
     472         191 :         case CTF_ANCHORTYPE:            break;
     473         449 :         case CTF_VERTICALPOS:           pVertOrient = property; break;
     474          37 :         case CTF_VERTICALREL_ASCHAR:    pVertOrientRelAsChar = property; break;
     475             : 
     476             :         case CTF_FRAMEHEIGHT_MIN_ABS:
     477             :         case CTF_FRAMEHEIGHT_MIN_REL:
     478             : //      case CTF_SYNCHEIGHT_MIN:
     479          48 :                                         bHasAnyMinHeight = true;
     480             :                                         // no break here!
     481             :         case CTF_FRAMEHEIGHT_ABS:
     482             :         case CTF_FRAMEHEIGHT_REL:
     483             : //      case CTF_SYNCHEIGHT:
     484          51 :                                         bHasAnyHeight = true; break;
     485             :         case CTF_FRAMEWIDTH_MIN_ABS:
     486             :         case CTF_FRAMEWIDTH_MIN_REL:
     487          55 :                                         bHasAnyMinWidth = true;
     488             :                                         // no break here!
     489             :         case CTF_FRAMEWIDTH_ABS:
     490             :         case CTF_FRAMEWIDTH_REL:
     491          61 :                                         bHasAnyWidth = true; break;
     492          59 :         case CTF_BACKGROUND_TRANSPARENCY: pBackTransparency = property; break;
     493          80 :         case CTF_BACKGROUND_TRANSPARENT:  pBackTransparent = property; break;
     494             :         case CTF_PARAMARGINALL:
     495             :         case CTF_PARAMARGINALL_REL:
     496          18 :                 pAllParaMargin = property; break;
     497             :         case CTF_PARALEFTMARGIN:
     498             :         case CTF_PARALEFTMARGIN_REL:
     499        2157 :                 pParaMargins[XML_LINE_LEFT] = property; break;
     500             :         case CTF_PARARIGHTMARGIN:
     501             :         case CTF_PARARIGHTMARGIN_REL:
     502        2137 :                 pParaMargins[XML_LINE_RIGHT] = property; break;
     503             :         case CTF_PARATOPMARGIN:
     504             :         case CTF_PARATOPMARGIN_REL:
     505        4459 :                 pParaMargins[XML_LINE_TOP] = property; break;
     506             :         case CTF_PARABOTTOMMARGIN:
     507             :         case CTF_PARABOTTOMMARGIN_REL:
     508        4472 :                 pParaMargins[XML_LINE_BOTTOM] = property; break;
     509             :         case CTF_MARGINALL:
     510           0 :                 pAllMargin = property; break;
     511             :         case CTF_MARGINLEFT:
     512         121 :                 pMargins[XML_LINE_LEFT] = property; break;
     513             :         case CTF_MARGINRIGHT:
     514         121 :                 pMargins[XML_LINE_RIGHT] = property; break;
     515             :         case CTF_MARGINTOP:
     516         121 :                 pMargins[XML_LINE_TOP] = property; break;
     517             :         case CTF_MARGINBOTTOM:
     518         121 :                 pMargins[XML_LINE_BOTTOM] = property; break;
     519             :         }
     520             :     }
     521             : 
     522       18579 :     if( pFontFamilyName || pFontStyleName || pFontFamily ||
     523       14749 :         pFontPitch || pFontCharSet )
     524             :         FontFinished( pFontFamilyName, pFontStyleName, pFontFamily,
     525        3830 :                       pFontPitch, pFontCharSet );
     526       18579 :     if( pFontFamilyNameCJK || pFontStyleNameCJK || pFontFamilyCJK ||
     527       15494 :         pFontPitchCJK || pFontCharSetCJK )
     528             :         FontFinished( pFontFamilyNameCJK, pFontStyleNameCJK, pFontFamilyCJK,
     529        3085 :                       pFontPitchCJK, pFontCharSetCJK );
     530       18579 :     if( pFontFamilyNameCTL || pFontStyleNameCTL || pFontFamilyCTL ||
     531       14664 :         pFontPitchCTL || pFontCharSetCTL )
     532             :         FontFinished( pFontFamilyNameCTL, pFontStyleNameCTL, pFontFamilyCTL,
     533        3915 :                       pFontPitchCTL, pFontCharSetCTL );
     534             : 
     535       92895 :     for (sal_uInt16 i = 0; i < 4; i++)
     536             :     {
     537       74388 :         if (pAllParaMargin && !pParaMargins[i]
     538       74318 :             && isNotDefaultRelSize(pAllParaMargin, getPropertySetMapper()))
     539             :         {
     540             : #if OSL_DEBUG_LEVEL > 0
     541             :             sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
     542             :                                         pAllParaMargin->mnIndex + (2*i) + 2 );
     543             :             assert(nTmp >= CTF_PARALEFTMARGIN &&
     544             :                    nTmp <= CTF_PARABOTTOMMARGIN_REL);
     545             : #endif
     546           0 :             pNewParaMargins[i].reset(new XMLPropertyState(
     547           0 :                 pAllParaMargin->mnIndex + (2*i) + 2, pAllParaMargin->maValue));
     548             :         }
     549       74316 :         if (pAllMargin && !pMargins[i])
     550             :         {
     551             : #if OSL_DEBUG_LEVEL > 0
     552             :             sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
     553             :                                         pAllMargin->mnIndex + i + 1 );
     554             :             assert(nTmp >= CTF_MARGINLEFT && nTmp <= CTF_MARGINBOTTOM);
     555             : #endif
     556           0 :             pNewMargins[i].reset(new XMLPropertyState(
     557           0 :                 pAllMargin->mnIndex + i + 1, pAllMargin->maValue));
     558             :         }
     559             : 
     560             :         lcl_SeparateBorder(
     561             :             i, pAllBorderDistance, pBorderDistances, pNewBorderDistances,
     562             :             pAllBorder, pBorders, pNewBorders,
     563             :             pAllBorderWidth, pBorderWidths
     564             : #if OSL_DEBUG_LEVEL > 0
     565             :             , getPropertySetMapper()
     566             : #endif
     567       74316 :             );
     568             : 
     569             :         lcl_SeparateBorder(
     570             :             i, pCharAllBorderDistance, pCharBorderDistances,
     571             :             pCharNewBorderDistances, pCharAllBorder, pCharBorders,
     572             :             pCharNewBorders, pCharAllBorderWidth, pCharBorderWidths
     573             : #if OSL_DEBUG_LEVEL > 0
     574             :             , getPropertySetMapper()
     575             : #endif
     576       74316 :             );
     577             :     }
     578             : 
     579       18579 :     if (pAllParaMargin)
     580             :     {
     581          18 :         pAllParaMargin->mnIndex = -1;
     582             :     }
     583       18579 :     if (pAllMargin)
     584             :     {
     585           0 :         pAllMargin->mnIndex = -1;
     586             :     }
     587             : 
     588       18579 :     if( pAllBorderDistance )
     589         202 :         pAllBorderDistance->mnIndex = -1;
     590             : 
     591       18579 :     if( pAllBorder )
     592         209 :         pAllBorder->mnIndex = -1;
     593             : 
     594       18579 :     if( pAllBorderWidth )
     595           6 :         pAllBorderWidth->mnIndex = -1;
     596             : 
     597       18579 :     if( pCharAllBorderDistance )
     598          18 :         pCharAllBorderDistance->mnIndex = -1;
     599             : 
     600       18579 :     if( pCharAllBorder )
     601          18 :         pCharAllBorder->mnIndex = -1;
     602             : 
     603       18579 :     if( pCharAllBorderWidth )
     604           0 :         pCharAllBorderWidth->mnIndex = -1;
     605             : 
     606       18579 :     if( pVertOrient && pVertOrientRelAsChar )
     607             :     {
     608             :         sal_Int16 nVertOrient;
     609          37 :         pVertOrient->maValue >>= nVertOrient;
     610          37 :         sal_Int16 nVertOrientRel = 0;
     611          37 :         pVertOrientRelAsChar->maValue >>= nVertOrientRel;
     612          37 :         switch( nVertOrient )
     613             :         {
     614             :         case VertOrientation::TOP:
     615          23 :             nVertOrient = nVertOrientRel;
     616          23 :             break;
     617             :         case VertOrientation::CENTER:
     618          13 :             switch( nVertOrientRel )
     619             :             {
     620             :             case VertOrientation::CHAR_TOP:
     621           3 :                 nVertOrient = VertOrientation::CHAR_CENTER;
     622           3 :                 break;
     623             :             case VertOrientation::LINE_TOP:
     624           2 :                 nVertOrient = VertOrientation::LINE_CENTER;
     625           2 :                 break;
     626             :             }
     627          13 :             break;
     628             :         case VertOrientation::BOTTOM:
     629           0 :             switch( nVertOrientRel )
     630             :             {
     631             :             case VertOrientation::CHAR_TOP:
     632           0 :                 nVertOrient = VertOrientation::CHAR_BOTTOM;
     633           0 :                 break;
     634             :             case VertOrientation::LINE_TOP:
     635           0 :                 nVertOrient = VertOrientation::LINE_BOTTOM;
     636           0 :                 break;
     637             :             }
     638           0 :             break;
     639             :         }
     640          37 :         pVertOrient->maValue <<= nVertOrient;
     641          37 :         pVertOrientRelAsChar->mnIndex = -1;
     642             :     }
     643             : 
     644             :     FontDefaultsCheck( pFontFamilyName,
     645             :                        pFontStyleName, pFontFamily, pFontPitch, pFontCharSet,
     646       18579 :                        &pNewFontStyleName, &pNewFontFamily, &pNewFontPitch, &pNewFontCharSet );
     647             : 
     648             :     FontDefaultsCheck( pFontFamilyNameCJK,
     649             :                        pFontStyleNameCJK, pFontFamilyCJK, pFontPitchCJK, pFontCharSetCJK,
     650       18579 :                        &pNewFontStyleNameCJK, &pNewFontFamilyCJK, &pNewFontPitchCJK, &pNewFontCharSetCJK );
     651             : 
     652             :     FontDefaultsCheck( pFontFamilyNameCTL,
     653             :                        pFontStyleNameCTL, pFontFamilyCTL, pFontPitchCTL, pFontCharSetCTL,
     654       18579 :                        &pNewFontStyleNameCTL, &pNewFontFamilyCTL, &pNewFontPitchCTL, &pNewFontCharSetCTL );
     655             : 
     656             :     // #i5775# don't overwrite %transparency with binary transparency
     657       18579 :     if( ( pBackTransparency != NULL ) && ( pBackTransparent != NULL ) )
     658             :     {
     659          58 :         if( ! *static_cast<sal_Bool const *>(pBackTransparent->maValue.getValue()) )
     660          47 :             pBackTransparent->mnIndex = -1;
     661             :     }
     662             : 
     663             : 
     664             :     // insert newly created properties. This invalidates all iterators!
     665             :     // Most of the pXXX variables in this method are iterators and will be
     666             :     // invalidated!!!
     667             : 
     668       18579 :     if( pNewFontStyleName )
     669             :     {
     670          84 :         rProperties.push_back( *pNewFontStyleName );
     671          84 :         delete pNewFontStyleName;
     672             :     }
     673             : 
     674       18579 :     if( pNewFontFamily )
     675             :     {
     676           2 :         rProperties.push_back( *pNewFontFamily );
     677           2 :         delete pNewFontFamily;
     678             :     }
     679             : 
     680       18579 :     if( pNewFontPitch )
     681             :     {
     682           2 :         rProperties.push_back( *pNewFontPitch );
     683           2 :         delete pNewFontPitch;
     684             :     }
     685             : 
     686       18579 :     if( pNewFontCharSet )
     687             :     {
     688          84 :         rProperties.push_back( *pNewFontCharSet );
     689          84 :         delete pNewFontCharSet;
     690             :     }
     691             : 
     692       18579 :     if( pNewFontStyleNameCJK )
     693             :     {
     694          23 :         rProperties.push_back( *pNewFontStyleNameCJK );
     695          23 :         delete pNewFontStyleNameCJK;
     696             :     }
     697             : 
     698       18579 :     if( pNewFontFamilyCJK )
     699             :     {
     700           1 :         rProperties.push_back( *pNewFontFamilyCJK );
     701           1 :         delete pNewFontFamilyCJK;
     702             :     }
     703             : 
     704       18579 :     if( pNewFontPitchCJK )
     705             :     {
     706           0 :         rProperties.push_back( *pNewFontPitchCJK );
     707           0 :         delete pNewFontPitchCJK;
     708             :     }
     709             : 
     710       18579 :     if( pNewFontCharSetCJK )
     711             :     {
     712          23 :         rProperties.push_back( *pNewFontCharSetCJK );
     713          23 :         delete pNewFontCharSetCJK;
     714             :     }
     715             : 
     716       18579 :     if( pNewFontStyleNameCTL)
     717             :     {
     718          24 :         rProperties.push_back( *pNewFontStyleNameCTL );
     719          24 :         delete pNewFontStyleNameCTL;
     720             :     }
     721             : 
     722       18579 :     if( pNewFontFamilyCTL )
     723             :     {
     724           3 :         rProperties.push_back( *pNewFontFamilyCTL );
     725           3 :         delete pNewFontFamilyCTL;
     726             :     }
     727             : 
     728       18579 :     if( pNewFontPitchCTL )
     729             :     {
     730           2 :         rProperties.push_back( *pNewFontPitchCTL );
     731           2 :         delete pNewFontPitchCTL;
     732             :     }
     733             : 
     734       18579 :     if( pNewFontCharSetCTL )
     735             :     {
     736          24 :         rProperties.push_back( *pNewFontCharSetCTL );
     737          24 :         delete pNewFontCharSetCTL;
     738             :     }
     739             : 
     740       92895 :     for (sal_uInt16 i=0; i<4; i++)
     741             :     {
     742       74316 :         if (pNewParaMargins[i].get())
     743             :         {
     744           0 :             rProperties.push_back(*pNewParaMargins[i]);
     745             :         }
     746       74316 :         if (pNewMargins[i].get())
     747             :         {
     748           0 :             rProperties.push_back(*pNewMargins[i]);
     749             :         }
     750       74316 :         if( pNewBorderDistances[i] )
     751             :         {
     752         808 :             rProperties.push_back( *pNewBorderDistances[i] );
     753         808 :             delete pNewBorderDistances[i];
     754             :         }
     755       74316 :         if( pNewBorders[i] )
     756             :         {
     757         836 :             rProperties.push_back( *pNewBorders[i] );
     758         836 :             delete pNewBorders[i];
     759             :         }
     760       74316 :         if( pCharNewBorderDistances[i] )
     761             :         {
     762          72 :             rProperties.push_back( *pCharNewBorderDistances[i] );
     763          72 :             delete pCharNewBorderDistances[i];
     764             :         }
     765       74316 :         if( pCharNewBorders[i] )
     766             :         {
     767          72 :             rProperties.push_back( *pCharNewBorders[i] );
     768          72 :             delete pCharNewBorders[i];
     769             :         }
     770             :     }
     771             : 
     772       18579 :     if( bHasAnyHeight )
     773             :     {
     774          51 :         if( nSizeTypeIndex == -2 )
     775             :         {
     776             :             const_cast < XMLTextImportPropertyMapper * > ( this )
     777          35 :                 ->nSizeTypeIndex  = -1;
     778          35 :             sal_Int32 nPropCount = getPropertySetMapper()->GetEntryCount();
     779        5950 :             for( sal_Int32 j=0; j < nPropCount; j++ )
     780             :             {
     781       11900 :                 if( CTF_SIZETYPE == getPropertySetMapper()
     782        5950 :                         ->GetEntryContextId( j ) )
     783             :                 {
     784             :                     const_cast < XMLTextImportPropertyMapper * > ( this )
     785          35 :                         ->nSizeTypeIndex = j;
     786          35 :                     break;
     787             :                 }
     788             :             }
     789             :         }
     790          51 :         if( nSizeTypeIndex != -1 )
     791             :         {
     792          51 :             XMLPropertyState aSizeTypeState( nSizeTypeIndex );
     793         102 :             aSizeTypeState.maValue <<= (sal_Int16)( bHasAnyMinHeight
     794             :                                                         ? SizeType::MIN
     795          51 :                                                         : SizeType::FIX);
     796          51 :             rProperties.push_back( aSizeTypeState );
     797             :         }
     798             :     }
     799             : 
     800       18579 :     if( bHasAnyWidth )
     801             :     {
     802          61 :         if( nWidthTypeIndex == -2 )
     803             :         {
     804             :             const_cast < XMLTextImportPropertyMapper * > ( this )
     805          44 :                 ->nWidthTypeIndex  = -1;
     806          44 :             sal_Int32 nCount = getPropertySetMapper()->GetEntryCount();
     807        7260 :             for( sal_Int32 j=0; j < nCount; j++ )
     808             :             {
     809       14520 :                 if( CTF_FRAMEWIDTH_TYPE  == getPropertySetMapper()
     810        7260 :                         ->GetEntryContextId( j ) )
     811             :                 {
     812             :                     const_cast < XMLTextImportPropertyMapper * > ( this )
     813          44 :                         ->nWidthTypeIndex = j;
     814          44 :                     break;
     815             :                 }
     816             :             }
     817             :         }
     818          61 :         if( nWidthTypeIndex != -1 )
     819             :         {
     820          61 :             XMLPropertyState aSizeTypeState( nWidthTypeIndex );
     821         122 :             aSizeTypeState.maValue <<= (sal_Int16)( bHasAnyMinWidth
     822             :                                                         ? SizeType::MIN
     823          61 :                                                         : SizeType::FIX);
     824          61 :             rProperties.push_back( aSizeTypeState );
     825             :         }
     826       92895 :     }
     827             : 
     828             :     // DO NOT USE ITERATORS/POINTERS INTO THE rProperties-VECTOR AFTER
     829             :     // THIS LINE.  All iterators into the rProperties-vector, especially all
     830             :     // pXXX-type variables set in the first switch statement of this method,
     831             :     // may have been invalidated by the above push_back() calls!
     832       18579 : }
     833             : 
     834             : 
     835             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11