LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/xmloff/source/text - txtimppr.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 287 328 87.5 %
Date: 2013-07-09 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             : 
      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        1172 : 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        1172 :     sal_Bool bRet = sal_False;
      51        1172 :     sal_Int32 nIndex = rProperty.mnIndex;
      52        1172 :     switch( getPropertySetMapper()->GetEntryContextId( nIndex  ) )
      53             :     {
      54             :     case CTF_FONTNAME:
      55             :     case CTF_FONTNAME_CJK:
      56             :     case CTF_FONTNAME_CTL:
      57        1054 :         if( xFontDecls.Is() )
      58             :         {
      59             :             DBG_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        1018 :             ((XMLFontStylesContext *)&xFontDecls)->FillProperties(
      93             :                             rValue, rProperties,
      94             :                             rProperty.mnIndex+1, rProperty.mnIndex+2,
      95             :                             rProperty.mnIndex+3, rProperty.mnIndex+4,
      96        2036 :                             rProperty.mnIndex+5 );
      97        1018 :             bRet = sal_False; // the property hasn't been filled
      98             :         }
      99        1054 :         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         110 :         bRet = getPropertySetMapper()->importXML( rValue, rProperty,
     110         110 :                                                   rUnitConverter );
     111         110 :         break;
     112             : 
     113             :     case CTF_TEXT_DISPLAY:
     114           8 :         bRet = getPropertySetMapper()->importXML( rValue, rProperty,
     115           8 :                                                   rUnitConverter );
     116           8 :         if( SvXMLImport::OOo_2x == GetImport().getGeneratorVersion() )
     117             :         {
     118             :             sal_Bool bHidden;
     119           0 :             rProperty.maValue >>= bHidden;
     120           0 :             bHidden = !bHidden;
     121           0 :             rProperty.maValue <<= bHidden;
     122             :         }
     123           8 :     break;
     124             :     default:
     125             :         bRet = SvXMLImportPropertyMapper::handleSpecialItem( rProperty,
     126           0 :                     rProperties, rValue, rUnitConverter, rNamespaceMap );
     127           0 :         break;
     128             :     }
     129             : 
     130        1172 :     return bRet;
     131             : }
     132             : 
     133        2796 : XMLTextImportPropertyMapper::XMLTextImportPropertyMapper(
     134             :             const UniReference< XMLPropertySetMapper >& rMapper,
     135             :             SvXMLImport& rImp,
     136             :             XMLFontStylesContext *pFontDecls ) :
     137             :     SvXMLImportPropertyMapper( rMapper, rImp ),
     138             :     nSizeTypeIndex( -2 ),
     139             :     nWidthTypeIndex( -2 ),
     140        2796 :     xFontDecls( pFontDecls )
     141             : {
     142        2796 : }
     143             : 
     144        5592 : XMLTextImportPropertyMapper::~XMLTextImportPropertyMapper()
     145             : {
     146        5592 : }
     147             : 
     148         526 : void XMLTextImportPropertyMapper::SetFontDecls(
     149             :         XMLFontStylesContext *pFontDecls )
     150             : {
     151         526 :     xFontDecls = pFontDecls;
     152         526 : }
     153             : 
     154        1078 : void XMLTextImportPropertyMapper::FontFinished(
     155             :     XMLPropertyState *pFontFamilyNameState,
     156             :     XMLPropertyState *pFontStyleNameState,
     157             :     XMLPropertyState *pFontFamilyState,
     158             :     XMLPropertyState *pFontPitchState,
     159             :     XMLPropertyState *pFontCharsetState ) const
     160             : {
     161        1078 :     if( pFontFamilyNameState && pFontFamilyNameState->mnIndex != -1 )
     162             :     {
     163        1078 :         OUString sName;
     164        1078 :         pFontFamilyNameState->maValue >>= sName;
     165        1078 :         if( sName.isEmpty() )
     166          18 :             pFontFamilyNameState->mnIndex = -1;
     167             :     }
     168        1078 :     if( !pFontFamilyNameState || pFontFamilyNameState->mnIndex == -1 )
     169             :     {
     170          18 :         if( pFontStyleNameState )
     171          18 :             pFontStyleNameState->mnIndex = -1;
     172          18 :         if( pFontFamilyState )
     173          18 :             pFontFamilyState->mnIndex = -1;
     174          18 :         if( pFontPitchState )
     175          18 :             pFontPitchState->mnIndex = -1;
     176          18 :         if( pFontCharsetState )
     177          18 :             pFontCharsetState->mnIndex = -1;
     178             :     }
     179        1078 : }
     180             : 
     181             : /** since the properties "CharFontFamilyName", "CharFontStyleName", "CharFontFamily",
     182             :     "CharFontPitch" and "CharFontSet" and theire CJK and CTL counterparts are only
     183             :     usable as a union, we add defaults to all values that are not set as long as we
     184             :     have an "CharFontFamilyName"
     185             : 
     186             :     #99928# CL */
     187        7527 : void XMLTextImportPropertyMapper::FontDefaultsCheck(
     188             :                                         XMLPropertyState* pFontFamilyName,
     189             :                                         XMLPropertyState* pFontStyleName,
     190             :                                         XMLPropertyState* pFontFamily,
     191             :                                         XMLPropertyState* pFontPitch,
     192             :                                         XMLPropertyState* pFontCharSet,
     193             :                                         XMLPropertyState** ppNewFontStyleName,
     194             :                                         XMLPropertyState** ppNewFontFamily,
     195             :                                         XMLPropertyState** ppNewFontPitch,
     196             :                                         XMLPropertyState** ppNewFontCharSet ) const
     197             : {
     198        7527 :     if( pFontFamilyName )
     199             :     {
     200        1078 :         OUString sEmpty;
     201        2156 :         Any aAny;
     202             : 
     203        1078 :         if( !pFontStyleName )
     204             :         {
     205          68 :             aAny <<= sEmpty;
     206             :     #ifdef DBG_UTIL
     207             :                 sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
     208             :                                                 pFontFamilyName->mnIndex + 1 );
     209             :                 DBG_ASSERT( nTmp == CTF_FONTSTYLENAME || nTmp == CTF_FONTSTYLENAME_CJK || nTmp == CTF_FONTSTYLENAME_CTL,
     210             :                             "wrong property context id" );
     211             :     #endif
     212             :                 *ppNewFontStyleName = new XMLPropertyState( pFontFamilyName->mnIndex + 1,
     213          68 :                                                        aAny );
     214             :         }
     215             : 
     216        1078 :         if( !pFontFamily )
     217             :         {
     218           2 :             aAny <<= (sal_Int16)com::sun::star::awt::FontFamily::DONTKNOW;
     219             : 
     220             :     #ifdef DBG_UTIL
     221             :                 sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
     222             :                                                 pFontFamilyName->mnIndex + 2 );
     223             :                 DBG_ASSERT( nTmp == CTF_FONTFAMILY || nTmp == CTF_FONTFAMILY_CJK || nTmp == CTF_FONTFAMILY_CTL,
     224             :                             "wrong property context id" );
     225             :     #endif
     226             :                 *ppNewFontFamily = new XMLPropertyState( pFontFamilyName->mnIndex + 2,
     227           2 :                                                        aAny );
     228             :         }
     229             : 
     230        1078 :         if( !pFontPitch )
     231             :         {
     232           0 :             aAny <<= (sal_Int16)com::sun::star::awt::FontPitch::DONTKNOW;
     233             :     #ifdef DBG_UTIL
     234             :                 sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
     235             :                                                 pFontFamilyName->mnIndex + 3 );
     236             :                 DBG_ASSERT( nTmp == CTF_FONTPITCH || nTmp == CTF_FONTPITCH_CJK || nTmp == CTF_FONTPITCH_CTL,
     237             :                             "wrong property context id" );
     238             :     #endif
     239             :                 *ppNewFontPitch = new XMLPropertyState( pFontFamilyName->mnIndex + 3,
     240           0 :                                                        aAny );
     241             :         }
     242             : 
     243        1078 :         if( !pFontCharSet )
     244             :         {
     245          68 :             aAny <<= (sal_Int16)osl_getThreadTextEncoding();
     246             :     #ifdef DBG_UTIL
     247             :                 sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
     248             :                                                 pFontFamilyName->mnIndex + 4 );
     249             :                 DBG_ASSERT( nTmp == CTF_FONTCHARSET || nTmp == CTF_FONTCHARSET_CJK || nTmp == CTF_FONTCHARSET_CTL,
     250             :                             "wrong property context id" );
     251             :     #endif
     252             :                 *ppNewFontCharSet = new XMLPropertyState( pFontFamilyName->mnIndex + 4,
     253          68 :                                                        aAny );
     254        1078 :         }
     255             :     }
     256        7527 : }
     257             : 
     258             : //fdo#58730 The [UL|LR]Space class has a deficiency where "100%" also serves as
     259             : //a flag that the value is an absolute value so we can't truly handle an
     260             : //up/lower space property which wants to specify its 200% upper but 100% lower
     261             : //of its parent (try typing 100% vs 200% into the edit style dialog and revisit
     262             : //your style). So on xml load that ends up meaning 200%, 0 lower. This is a
     263             : //crock.
     264             : //
     265             : //On import clear 100% all-margins relative sizes.
     266             : static bool
     267           2 : isNotDefaultRelSize(const XMLPropertyState* pRelState, const UniReference<XMLPropertySetMapper>& rPrMap)
     268             : {
     269           2 :     if (rPrMap->GetEntryContextId(pRelState->mnIndex) == CTF_PARAMARGINALL_REL)
     270             :     {
     271           2 :         sal_Int32 nTemp = 0;
     272           2 :         pRelState->maValue >>= nTemp;
     273           2 :         return nTemp != 100;
     274             :     }
     275           0 :     return true;
     276             : }
     277             : 
     278        2509 : void XMLTextImportPropertyMapper::finished(
     279             :             ::std::vector< XMLPropertyState >& rProperties,
     280             :             sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/ ) const
     281             : {
     282        2509 :     sal_Bool bHasAnyHeight = sal_False;
     283        2509 :     sal_Bool bHasAnyMinHeight = sal_False;
     284        2509 :     sal_Bool bHasAnyWidth = sal_False;
     285        2509 :     sal_Bool bHasAnyMinWidth = sal_False;
     286             : 
     287        2509 :     XMLPropertyState* pFontFamilyName = 0;
     288        2509 :     XMLPropertyState* pFontStyleName = 0;
     289        2509 :     XMLPropertyState* pFontFamily = 0;
     290        2509 :     XMLPropertyState* pFontPitch = 0;
     291        2509 :     XMLPropertyState* pFontCharSet = 0;
     292        2509 :     XMLPropertyState* pNewFontStyleName = 0;
     293        2509 :     XMLPropertyState* pNewFontFamily = 0;
     294        2509 :     XMLPropertyState* pNewFontPitch = 0;
     295        2509 :     XMLPropertyState* pNewFontCharSet = 0;
     296        2509 :     XMLPropertyState* pFontFamilyNameCJK = 0;
     297        2509 :     XMLPropertyState* pFontStyleNameCJK = 0;
     298        2509 :     XMLPropertyState* pFontFamilyCJK = 0;
     299        2509 :     XMLPropertyState* pFontPitchCJK = 0;
     300        2509 :     XMLPropertyState* pFontCharSetCJK = 0;
     301        2509 :     XMLPropertyState* pNewFontStyleNameCJK = 0;
     302        2509 :     XMLPropertyState* pNewFontFamilyCJK = 0;
     303        2509 :     XMLPropertyState* pNewFontPitchCJK = 0;
     304        2509 :     XMLPropertyState* pNewFontCharSetCJK = 0;
     305        2509 :     XMLPropertyState* pFontFamilyNameCTL = 0;
     306        2509 :     XMLPropertyState* pFontStyleNameCTL = 0;
     307        2509 :     XMLPropertyState* pFontFamilyCTL = 0;
     308        2509 :     XMLPropertyState* pFontPitchCTL = 0;
     309        2509 :     XMLPropertyState* pFontCharSetCTL = 0;
     310        2509 :     XMLPropertyState* pNewFontStyleNameCTL = 0;
     311        2509 :     XMLPropertyState* pNewFontFamilyCTL = 0;
     312        2509 :     XMLPropertyState* pNewFontPitchCTL = 0;
     313        2509 :     XMLPropertyState* pNewFontCharSetCTL = 0;
     314        2509 :     XMLPropertyState* pAllBorderDistance = 0;
     315        2509 :     XMLPropertyState* pBorderDistances[4] = { 0, 0, 0, 0 };
     316        2509 :     XMLPropertyState* pNewBorderDistances[4] = { 0, 0, 0, 0 };
     317        2509 :     XMLPropertyState* pAllBorder = 0;
     318        2509 :     XMLPropertyState* pBorders[4] = { 0, 0, 0, 0 };
     319        2509 :     XMLPropertyState* pNewBorders[4] = { 0, 0, 0, 0 };
     320        2509 :     XMLPropertyState* pAllBorderWidth = 0;
     321        2509 :     XMLPropertyState* pBorderWidths[4] = { 0, 0, 0, 0 };
     322        2509 :     XMLPropertyState* pVertOrient = 0;
     323        2509 :     XMLPropertyState* pVertOrientRelAsChar = 0;
     324        2509 :     XMLPropertyState* pBackTransparency = NULL; // transparency in %
     325        2509 :     XMLPropertyState* pBackTransparent = NULL;  // transparency as boolean
     326        2509 :     XMLPropertyState* pAllParaMargin = 0;
     327        2509 :     XMLPropertyState* pParaMargins[4] = { 0, 0, 0, 0 };
     328             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     329       12545 :     ::std::auto_ptr<XMLPropertyState> pNewParaMargins[4];
     330             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     331        2509 :     XMLPropertyState* pAllMargin = 0;
     332        2509 :     XMLPropertyState* pMargins[4] = { 0, 0, 0, 0 };
     333             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     334        5018 :     ::std::auto_ptr<XMLPropertyState> pNewMargins[4];
     335             :     SAL_WNODEPRECATED_DECLARATIONS_POP
     336             : 
     337       67995 :     for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
     338       45330 :          aIter != rProperties.end();
     339             :          ++aIter )
     340             :     {
     341       20156 :         XMLPropertyState* property = &(*aIter);
     342       20156 :         if( -1 == property->mnIndex )
     343         471 :             continue;
     344             : 
     345       19685 :         switch( getPropertySetMapper()->GetEntryContextId( property->mnIndex ) )
     346             :         {
     347         325 :         case CTF_FONTFAMILYNAME:    pFontFamilyName = property; break;
     348         289 :         case CTF_FONTSTYLENAME: pFontStyleName = property;  break;
     349         325 :         case CTF_FONTFAMILY:    pFontFamily = property; break;
     350         325 :         case CTF_FONTPITCH: pFontPitch = property;  break;
     351         289 :         case CTF_FONTCHARSET:   pFontCharSet = property;    break;
     352             : 
     353         310 :         case CTF_FONTFAMILYNAME_CJK:    pFontFamilyNameCJK = property;  break;
     354         294 :         case CTF_FONTSTYLENAME_CJK: pFontStyleNameCJK = property;   break;
     355         309 :         case CTF_FONTFAMILY_CJK:    pFontFamilyCJK = property;  break;
     356         310 :         case CTF_FONTPITCH_CJK: pFontPitchCJK = property;   break;
     357         294 :         case CTF_FONTCHARSET_CJK:   pFontCharSetCJK = property; break;
     358             : 
     359         443 :         case CTF_FONTFAMILYNAME_CTL:    pFontFamilyNameCTL = property;  break;
     360         427 :         case CTF_FONTSTYLENAME_CTL: pFontStyleNameCTL = property;   break;
     361         442 :         case CTF_FONTFAMILY_CTL:    pFontFamilyCTL = property;  break;
     362         443 :         case CTF_FONTPITCH_CTL: pFontPitchCTL = property;   break;
     363         427 :         case CTF_FONTCHARSET_CTL:   pFontCharSetCTL = property; break;
     364             : 
     365          10 :         case CTF_ALLBORDERDISTANCE:     pAllBorderDistance = property; break;
     366           7 :         case CTF_LEFTBORDERDISTANCE:    pBorderDistances[XML_LINE_LEFT] = property; break;
     367           7 :         case CTF_RIGHTBORDERDISTANCE:   pBorderDistances[XML_LINE_RIGHT] = property; break;
     368           7 :         case CTF_TOPBORDERDISTANCE:     pBorderDistances[XML_LINE_TOP] = property; break;
     369           7 :         case CTF_BOTTOMBORDERDISTANCE:  pBorderDistances[XML_LINE_BOTTOM] = property; break;
     370          13 :         case CTF_ALLBORDER:             pAllBorder = property; break;
     371           3 :         case CTF_LEFTBORDER:            pBorders[XML_LINE_LEFT] = property; break;
     372           3 :         case CTF_RIGHTBORDER:           pBorders[XML_LINE_RIGHT] = property; break;
     373           3 :         case CTF_TOPBORDER:             pBorders[XML_LINE_TOP] = property; break;
     374           3 :         case CTF_BOTTOMBORDER:          pBorders[XML_LINE_BOTTOM] = property; break;
     375             : 
     376           0 :         case CTF_ALLBORDERWIDTH:        pAllBorderWidth = property; break;
     377           0 :         case CTF_LEFTBORDERWIDTH:       pBorderWidths[XML_LINE_LEFT] = property; break;
     378           0 :         case CTF_RIGHTBORDERWIDTH:      pBorderWidths[XML_LINE_RIGHT] = property; break;
     379           0 :         case CTF_TOPBORDERWIDTH:        pBorderWidths[XML_LINE_TOP] = property; break;
     380           1 :         case CTF_BOTTOMBORDERWIDTH:     pBorderWidths[XML_LINE_BOTTOM] = property; break;
     381          20 :         case CTF_ANCHORTYPE:            break;
     382          43 :         case CTF_VERTICALPOS:           pVertOrient = property; break;
     383           5 :         case CTF_VERTICALREL_ASCHAR:    pVertOrientRelAsChar = property; break;
     384             : 
     385             :         case CTF_FRAMEHEIGHT_MIN_ABS:
     386             :         case CTF_FRAMEHEIGHT_MIN_REL:
     387             : //      case CTF_SYNCHEIGHT_MIN:
     388           1 :                                         bHasAnyMinHeight = sal_True;
     389             :                                         // no break here!
     390             :         case CTF_FRAMEHEIGHT_ABS:
     391             :         case CTF_FRAMEHEIGHT_REL:
     392             : //      case CTF_SYNCHEIGHT:
     393           1 :                                         bHasAnyHeight = sal_True; break;
     394             :         case CTF_FRAMEWIDTH_MIN_ABS:
     395             :         case CTF_FRAMEWIDTH_MIN_REL:
     396           1 :                                         bHasAnyMinWidth = sal_True;
     397             :                                         // no break here!
     398             :         case CTF_FRAMEWIDTH_ABS:
     399             :         case CTF_FRAMEWIDTH_REL:
     400           1 :                                         bHasAnyWidth = sal_True; break;
     401           0 :         case CTF_BACKGROUND_TRANSPARENCY: pBackTransparency = property; break;
     402           0 :         case CTF_BACKGROUND_TRANSPARENT:  pBackTransparent = property; break;
     403             :         case CTF_PARAMARGINALL:
     404             :         case CTF_PARAMARGINALL_REL:
     405          18 :                 pAllParaMargin = property; break;
     406             :         case CTF_PARALEFTMARGIN:
     407             :         case CTF_PARALEFTMARGIN_REL:
     408         134 :                 pParaMargins[XML_LINE_LEFT] = property; break;
     409             :         case CTF_PARARIGHTMARGIN:
     410             :         case CTF_PARARIGHTMARGIN_REL:
     411         134 :                 pParaMargins[XML_LINE_RIGHT] = property; break;
     412             :         case CTF_PARATOPMARGIN:
     413             :         case CTF_PARATOPMARGIN_REL:
     414         500 :                 pParaMargins[XML_LINE_TOP] = property; break;
     415             :         case CTF_PARABOTTOMMARGIN:
     416             :         case CTF_PARABOTTOMMARGIN_REL:
     417         500 :                 pParaMargins[XML_LINE_BOTTOM] = property; break;
     418             :         case CTF_MARGINALL:
     419           0 :                 pAllMargin = property; break;
     420             :         case CTF_MARGINLEFT:
     421           9 :                 pMargins[XML_LINE_LEFT] = property; break;
     422             :         case CTF_MARGINRIGHT:
     423           9 :                 pMargins[XML_LINE_RIGHT] = property; break;
     424             :         case CTF_MARGINTOP:
     425           8 :                 pMargins[XML_LINE_TOP] = property; break;
     426             :         case CTF_MARGINBOTTOM:
     427           8 :                 pMargins[XML_LINE_BOTTOM] = property; break;
     428             :         }
     429             :     }
     430             : 
     431        2509 :     if( pFontFamilyName || pFontStyleName || pFontFamily ||
     432        2184 :         pFontPitch || pFontCharSet )
     433             :         FontFinished( pFontFamilyName, pFontStyleName, pFontFamily,
     434         325 :                       pFontPitch, pFontCharSet );
     435        2509 :     if( pFontFamilyNameCJK || pFontStyleNameCJK || pFontFamilyCJK ||
     436        2199 :         pFontPitchCJK || pFontCharSetCJK )
     437             :         FontFinished( pFontFamilyNameCJK, pFontStyleNameCJK, pFontFamilyCJK,
     438         310 :                       pFontPitchCJK, pFontCharSetCJK );
     439        2509 :     if( pFontFamilyNameCTL || pFontStyleNameCTL || pFontFamilyCTL ||
     440        2066 :         pFontPitchCTL || pFontCharSetCTL )
     441             :         FontFinished( pFontFamilyNameCTL, pFontStyleNameCTL, pFontFamilyCTL,
     442         443 :                       pFontPitchCTL, pFontCharSetCTL );
     443             : 
     444       12545 :     for (sal_uInt16 i = 0; i < 4; i++)
     445             :     {
     446       10108 :         if (pAllParaMargin && !pParaMargins[i]
     447       10038 :             && isNotDefaultRelSize(pAllParaMargin, getPropertySetMapper()))
     448             :         {
     449             : #if OSL_DEBUG_LEVEL > 0
     450             :             sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
     451             :                                         pAllParaMargin->mnIndex + (2*i) + 2 );
     452             :             OSL_ENSURE( nTmp >= CTF_PARALEFTMARGIN &&
     453             :                         nTmp <= CTF_PARABOTTOMMARGIN_REL,
     454             :                         "wrong property context id" );
     455             : #endif
     456           0 :             pNewParaMargins[i].reset(new XMLPropertyState(
     457           0 :                 pAllParaMargin->mnIndex + (2*i) + 2, pAllParaMargin->maValue));
     458             :         }
     459       10036 :         if (pAllMargin && !pMargins[i])
     460             :         {
     461             : #if OSL_DEBUG_LEVEL > 0
     462             :             sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
     463             :                                         pAllMargin->mnIndex + i + 1 );
     464             :             OSL_ENSURE( nTmp >= CTF_MARGINLEFT && nTmp <= CTF_MARGINBOTTOM,
     465             :                         "wrong property context id" );
     466             : #endif
     467           0 :             pNewMargins[i].reset(new XMLPropertyState(
     468           0 :                 pAllMargin->mnIndex + i + 1, pAllMargin->maValue));
     469             :         }
     470       10036 :         if( pAllBorderDistance && !pBorderDistances[i] )
     471             :         {
     472             : #ifdef DBG_UTIL
     473             :             sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
     474             :                                         pAllBorderDistance->mnIndex + i + 1 );
     475             :             DBG_ASSERT( nTmp >= CTF_LEFTBORDERDISTANCE &&
     476             :                         nTmp <= CTF_BOTTOMBORDERDISTANCE,
     477             :                         "wrong property context id" );
     478             : #endif
     479          40 :             pNewBorderDistances[i] =
     480          40 :                 new XMLPropertyState( pAllBorderDistance->mnIndex + i + 1,
     481         120 :                                       pAllBorderDistance->maValue );
     482          40 :             pBorderDistances[i] = pNewBorderDistances[i];
     483             :         }
     484       10036 :         if( pAllBorder && !pBorders[i] )
     485             :         {
     486             : #ifdef DBG_UTIL
     487             :             sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
     488             :                                             pAllBorder->mnIndex + i + 1 );
     489             :             DBG_ASSERT( nTmp >= CTF_LEFTBORDER && nTmp <= CTF_BOTTOMBORDER,
     490             :                         "wrong property context id" );
     491             : #endif
     492         104 :             pNewBorders[i] = new XMLPropertyState( pAllBorder->mnIndex + i + 1,
     493         156 :                                                    pAllBorder->maValue );
     494          52 :             pBorders[i] = pNewBorders[i];
     495             :         }
     496       10036 :         if( !pBorderWidths[i] )
     497       10035 :             pBorderWidths[i] = pAllBorderWidth;
     498             :         else
     499           1 :             pBorderWidths[i]->mnIndex = -1;
     500             : 
     501       10036 :         if( pBorders[i] && pBorderWidths[i] )
     502             :         {
     503           1 :             table::BorderLine2 aBorderLine;
     504           1 :             pBorders[i]->maValue >>= aBorderLine;
     505             : 
     506           1 :             table::BorderLine2 aBorderLineWidth;
     507           1 :             pBorderWidths[i]->maValue >>= aBorderLineWidth;
     508             : 
     509           1 :             aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
     510           1 :             aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
     511           1 :             aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
     512           1 :             aBorderLine.LineWidth = aBorderLineWidth.LineWidth;
     513             : 
     514           1 :             pBorders[i]->maValue <<= aBorderLine;
     515             :         }
     516             :     }
     517             : 
     518        2509 :     if (pAllParaMargin)
     519             :     {
     520          18 :         pAllParaMargin->mnIndex = -1;
     521             :     }
     522        2509 :     if (pAllMargin)
     523             :     {
     524           0 :         pAllMargin->mnIndex = -1;
     525             :     }
     526             : 
     527        2509 :     if( pAllBorderDistance )
     528          10 :         pAllBorderDistance->mnIndex = -1;
     529             : 
     530        2509 :     if( pAllBorder )
     531          13 :         pAllBorder->mnIndex = -1;
     532             : 
     533        2509 :     if( pAllBorderWidth )
     534           0 :         pAllBorderWidth->mnIndex = -1;
     535             : 
     536        2509 :     if( pVertOrient && pVertOrientRelAsChar )
     537             :     {
     538             :         sal_Int16 nVertOrient;
     539           5 :         pVertOrient->maValue >>= nVertOrient;
     540           5 :         sal_Int16 nVertOrientRel = 0;
     541           5 :         pVertOrientRelAsChar->maValue >>= nVertOrientRel;
     542           5 :         switch( nVertOrient )
     543             :         {
     544             :         case VertOrientation::TOP:
     545           3 :             nVertOrient = nVertOrientRel;
     546           3 :             break;
     547             :         case VertOrientation::CENTER:
     548           2 :             switch( nVertOrientRel )
     549             :             {
     550             :             case VertOrientation::CHAR_TOP:
     551           2 :                 nVertOrient = VertOrientation::CHAR_CENTER;
     552           2 :                 break;
     553             :             case VertOrientation::LINE_TOP:
     554           0 :                 nVertOrient = VertOrientation::LINE_CENTER;
     555           0 :                 break;
     556             :             }
     557           2 :             break;
     558             :         case VertOrientation::BOTTOM:
     559           0 :             switch( nVertOrientRel )
     560             :             {
     561             :             case VertOrientation::CHAR_TOP:
     562           0 :                 nVertOrient = VertOrientation::CHAR_BOTTOM;
     563           0 :                 break;
     564             :             case VertOrientation::LINE_TOP:
     565           0 :                 nVertOrient = VertOrientation::LINE_BOTTOM;
     566           0 :                 break;
     567             :             }
     568           0 :             break;
     569             :         }
     570           5 :         pVertOrient->maValue <<= nVertOrient;
     571           5 :         pVertOrientRelAsChar->mnIndex = -1;
     572             :     }
     573             : 
     574             :     FontDefaultsCheck( pFontFamilyName,
     575             :                        pFontStyleName, pFontFamily, pFontPitch, pFontCharSet,
     576        2509 :                        &pNewFontStyleName, &pNewFontFamily, &pNewFontPitch, &pNewFontCharSet );
     577             : 
     578             :     FontDefaultsCheck( pFontFamilyNameCJK,
     579             :                        pFontStyleNameCJK, pFontFamilyCJK, pFontPitchCJK, pFontCharSetCJK,
     580        2509 :                        &pNewFontStyleNameCJK, &pNewFontFamilyCJK, &pNewFontPitchCJK, &pNewFontCharSetCJK );
     581             : 
     582             :     FontDefaultsCheck( pFontFamilyNameCTL,
     583             :                        pFontStyleNameCTL, pFontFamilyCTL, pFontPitchCTL, pFontCharSetCTL,
     584        2509 :                        &pNewFontStyleNameCTL, &pNewFontFamilyCTL, &pNewFontPitchCTL, &pNewFontCharSetCTL );
     585             : 
     586             :     // #i5775# don't overwrite %transparency with binary transparency
     587        2509 :     if( ( pBackTransparency != NULL ) && ( pBackTransparent != NULL ) )
     588             :     {
     589           0 :         if( ! *(sal_Bool*)(pBackTransparent->maValue.getValue()) )
     590           0 :             pBackTransparent->mnIndex = -1;
     591             :     }
     592             : 
     593             : 
     594             :     // insert newly created properties. This invalidates all iterators!
     595             :     // Most of the pXXX variables in this method are iterators and will be
     596             :     // invalidated!!!
     597             : 
     598        2509 :     if( pNewFontStyleName )
     599             :     {
     600          36 :         rProperties.push_back( *pNewFontStyleName );
     601          36 :         delete pNewFontStyleName;
     602             :     }
     603             : 
     604        2509 :     if( pNewFontFamily )
     605             :     {
     606           0 :         rProperties.push_back( *pNewFontFamily );
     607           0 :         delete pNewFontFamily;
     608             :     }
     609             : 
     610        2509 :     if( pNewFontPitch )
     611             :     {
     612           0 :         rProperties.push_back( *pNewFontPitch );
     613           0 :         delete pNewFontPitch;
     614             :     }
     615             : 
     616        2509 :     if( pNewFontCharSet )
     617             :     {
     618          36 :         rProperties.push_back( *pNewFontCharSet );
     619          36 :         delete pNewFontCharSet;
     620             :     }
     621             : 
     622        2509 :     if( pNewFontStyleNameCJK )
     623             :     {
     624          16 :         rProperties.push_back( *pNewFontStyleNameCJK );
     625          16 :         delete pNewFontStyleNameCJK;
     626             :     }
     627             : 
     628        2509 :     if( pNewFontFamilyCJK )
     629             :     {
     630           1 :         rProperties.push_back( *pNewFontFamilyCJK );
     631           1 :         delete pNewFontFamilyCJK;
     632             :     }
     633             : 
     634        2509 :     if( pNewFontPitchCJK )
     635             :     {
     636           0 :         rProperties.push_back( *pNewFontPitchCJK );
     637           0 :         delete pNewFontPitchCJK;
     638             :     }
     639             : 
     640        2509 :     if( pNewFontCharSetCJK )
     641             :     {
     642          16 :         rProperties.push_back( *pNewFontCharSetCJK );
     643          16 :         delete pNewFontCharSetCJK;
     644             :     }
     645             : 
     646        2509 :     if( pNewFontStyleNameCTL)
     647             :     {
     648          16 :         rProperties.push_back( *pNewFontStyleNameCTL );
     649          16 :         delete pNewFontStyleNameCTL;
     650             :     }
     651             : 
     652        2509 :     if( pNewFontFamilyCTL )
     653             :     {
     654           1 :         rProperties.push_back( *pNewFontFamilyCTL );
     655           1 :         delete pNewFontFamilyCTL;
     656             :     }
     657             : 
     658        2509 :     if( pNewFontPitchCTL )
     659             :     {
     660           0 :         rProperties.push_back( *pNewFontPitchCTL );
     661           0 :         delete pNewFontPitchCTL;
     662             :     }
     663             : 
     664        2509 :     if( pNewFontCharSetCTL )
     665             :     {
     666          16 :         rProperties.push_back( *pNewFontCharSetCTL );
     667          16 :         delete pNewFontCharSetCTL;
     668             :     }
     669             : 
     670       12545 :     for (sal_uInt16 i=0; i<4; i++)
     671             :     {
     672       10036 :         if (pNewParaMargins[i].get())
     673             :         {
     674           0 :             rProperties.push_back(*pNewParaMargins[i]);
     675             :         }
     676       10036 :         if (pNewMargins[i].get())
     677             :         {
     678           0 :             rProperties.push_back(*pNewMargins[i]);
     679             :         }
     680       10036 :         if( pNewBorderDistances[i] )
     681             :         {
     682          40 :             rProperties.push_back( *pNewBorderDistances[i] );
     683          40 :             delete pNewBorderDistances[i];
     684             :         }
     685       10036 :         if( pNewBorders[i] )
     686             :         {
     687          52 :             rProperties.push_back( *pNewBorders[i] );
     688          52 :             delete pNewBorders[i];
     689             :         }
     690             :     }
     691             : 
     692        2509 :     if( bHasAnyHeight )
     693             :     {
     694           1 :         if( nSizeTypeIndex == -2 )
     695             :         {
     696             :             const_cast < XMLTextImportPropertyMapper * > ( this )
     697           1 :                 ->nSizeTypeIndex  = -1;
     698           1 :             sal_Int32 nPropCount = getPropertySetMapper()->GetEntryCount();
     699         170 :             for( sal_Int32 j=0; j < nPropCount; j++ )
     700             :             {
     701         340 :                 if( CTF_SIZETYPE == getPropertySetMapper()
     702         170 :                         ->GetEntryContextId( j ) )
     703             :                 {
     704             :                     const_cast < XMLTextImportPropertyMapper * > ( this )
     705           1 :                         ->nSizeTypeIndex = j;
     706           1 :                     break;
     707             :                 }
     708             :             }
     709             :         }
     710           1 :         if( nSizeTypeIndex != -1 )
     711             :         {
     712           1 :             XMLPropertyState aSizeTypeState( nSizeTypeIndex );
     713           2 :             aSizeTypeState.maValue <<= (sal_Int16)( bHasAnyMinHeight
     714             :                                                         ? SizeType::MIN
     715           1 :                                                         : SizeType::FIX);
     716           1 :             rProperties.push_back( aSizeTypeState );
     717             :         }
     718             :     }
     719             : 
     720        2509 :     if( bHasAnyWidth )
     721             :     {
     722           1 :         if( nWidthTypeIndex == -2 )
     723             :         {
     724             :             const_cast < XMLTextImportPropertyMapper * > ( this )
     725           1 :                 ->nWidthTypeIndex  = -1;
     726           1 :             sal_Int32 nCount = getPropertySetMapper()->GetEntryCount();
     727         165 :             for( sal_Int32 j=0; j < nCount; j++ )
     728             :             {
     729         330 :                 if( CTF_FRAMEWIDTH_TYPE  == getPropertySetMapper()
     730         165 :                         ->GetEntryContextId( j ) )
     731             :                 {
     732             :                     const_cast < XMLTextImportPropertyMapper * > ( this )
     733           1 :                         ->nWidthTypeIndex = j;
     734           1 :                     break;
     735             :                 }
     736             :             }
     737             :         }
     738           1 :         if( nWidthTypeIndex != -1 )
     739             :         {
     740           1 :             XMLPropertyState aSizeTypeState( nWidthTypeIndex );
     741           2 :             aSizeTypeState.maValue <<= (sal_Int16)( bHasAnyMinWidth
     742             :                                                         ? SizeType::MIN
     743           1 :                                                         : SizeType::FIX);
     744           1 :             rProperties.push_back( aSizeTypeState );
     745             :         }
     746       12545 :     }
     747             : 
     748             :     // DO NOT USE ITERATORS/POINTERS INTO THE rProperties-VECTOR AFTER
     749             :     // THIS LINE.  All iterators into the rProperties-vector, especially all
     750             :     // pXXX-type variables set in the first switch statement of this method,
     751             :     // may have been invalidated by the above push_back() calls!
     752        2509 : }
     753             : 
     754             : 
     755             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10