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

Generated by: LCOV version 1.10