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

Generated by: LCOV version 1.10