1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_xmloff.hxx" 30*cdf0e10cSrcweir #include <tools/debug.hxx> 31*cdf0e10cSrcweir #include <com/sun/star/awt/FontFamily.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/awt/FontPitch.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/table/BorderLine.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/text/VertOrientation.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/text/SizeType.hpp> 36*cdf0e10cSrcweir #include <tools/string.hxx> 37*cdf0e10cSrcweir #include <xmloff/XMLFontStylesContext.hxx> 38*cdf0e10cSrcweir #include <xmloff/txtprmap.hxx> 39*cdf0e10cSrcweir #include <xmloff/xmlimp.hxx> 40*cdf0e10cSrcweir #include "xmloff/txtimppr.hxx" 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir #define XML_LINE_LEFT 0 43*cdf0e10cSrcweir #define XML_LINE_RIGHT 1 44*cdf0e10cSrcweir #define XML_LINE_TOP 2 45*cdf0e10cSrcweir #define XML_LINE_BOTTOM 3 46*cdf0e10cSrcweir #define MIN_BORDER_DIST 49 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir using ::rtl::OUString; 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir using namespace ::com::sun::star; 51*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 52*cdf0e10cSrcweir using namespace ::com::sun::star::table; 53*cdf0e10cSrcweir using namespace ::com::sun::star::text; 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir sal_Bool XMLTextImportPropertyMapper::handleSpecialItem( 56*cdf0e10cSrcweir XMLPropertyState& rProperty, 57*cdf0e10cSrcweir ::std::vector< XMLPropertyState >& rProperties, 58*cdf0e10cSrcweir const ::rtl::OUString& rValue, 59*cdf0e10cSrcweir const SvXMLUnitConverter& rUnitConverter, 60*cdf0e10cSrcweir const SvXMLNamespaceMap& rNamespaceMap ) const 61*cdf0e10cSrcweir { 62*cdf0e10cSrcweir sal_Bool bRet = sal_False; 63*cdf0e10cSrcweir sal_Int32 nIndex = rProperty.mnIndex; 64*cdf0e10cSrcweir switch( getPropertySetMapper()->GetEntryContextId( nIndex ) ) 65*cdf0e10cSrcweir { 66*cdf0e10cSrcweir case CTF_FONTNAME: 67*cdf0e10cSrcweir case CTF_FONTNAME_CJK: 68*cdf0e10cSrcweir case CTF_FONTNAME_CTL: 69*cdf0e10cSrcweir if( xFontDecls.Is() ) 70*cdf0e10cSrcweir { 71*cdf0e10cSrcweir DBG_ASSERT( 72*cdf0e10cSrcweir ( CTF_FONTFAMILYNAME == 73*cdf0e10cSrcweir getPropertySetMapper()->GetEntryContextId(nIndex+1) && 74*cdf0e10cSrcweir CTF_FONTSTYLENAME == 75*cdf0e10cSrcweir getPropertySetMapper()->GetEntryContextId(nIndex+2) && 76*cdf0e10cSrcweir CTF_FONTFAMILY == 77*cdf0e10cSrcweir getPropertySetMapper()->GetEntryContextId(nIndex+3) && 78*cdf0e10cSrcweir CTF_FONTPITCH == 79*cdf0e10cSrcweir getPropertySetMapper()->GetEntryContextId(nIndex+4) && 80*cdf0e10cSrcweir CTF_FONTCHARSET == 81*cdf0e10cSrcweir getPropertySetMapper()->GetEntryContextId(nIndex+5) ) || 82*cdf0e10cSrcweir ( CTF_FONTFAMILYNAME_CJK == 83*cdf0e10cSrcweir getPropertySetMapper()->GetEntryContextId(nIndex+1) && 84*cdf0e10cSrcweir CTF_FONTSTYLENAME_CJK == 85*cdf0e10cSrcweir getPropertySetMapper()->GetEntryContextId(nIndex+2) && 86*cdf0e10cSrcweir CTF_FONTFAMILY_CJK == 87*cdf0e10cSrcweir getPropertySetMapper()->GetEntryContextId(nIndex+3) && 88*cdf0e10cSrcweir CTF_FONTPITCH_CJK == 89*cdf0e10cSrcweir getPropertySetMapper()->GetEntryContextId(nIndex+4) && 90*cdf0e10cSrcweir CTF_FONTCHARSET_CJK == 91*cdf0e10cSrcweir getPropertySetMapper()->GetEntryContextId(nIndex+5) ) || 92*cdf0e10cSrcweir ( CTF_FONTFAMILYNAME_CTL == 93*cdf0e10cSrcweir getPropertySetMapper()->GetEntryContextId(nIndex+1) && 94*cdf0e10cSrcweir CTF_FONTSTYLENAME_CTL == 95*cdf0e10cSrcweir getPropertySetMapper()->GetEntryContextId(nIndex+2) && 96*cdf0e10cSrcweir CTF_FONTFAMILY_CTL == 97*cdf0e10cSrcweir getPropertySetMapper()->GetEntryContextId(nIndex+3) && 98*cdf0e10cSrcweir CTF_FONTPITCH_CTL == 99*cdf0e10cSrcweir getPropertySetMapper()->GetEntryContextId(nIndex+4) && 100*cdf0e10cSrcweir CTF_FONTCHARSET_CTL == 101*cdf0e10cSrcweir getPropertySetMapper()->GetEntryContextId(nIndex+5) ), 102*cdf0e10cSrcweir "illegal property map" ); 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir ((XMLFontStylesContext *)&xFontDecls)->FillProperties( 105*cdf0e10cSrcweir rValue, rProperties, 106*cdf0e10cSrcweir rProperty.mnIndex+1, rProperty.mnIndex+2, 107*cdf0e10cSrcweir rProperty.mnIndex+3, rProperty.mnIndex+4, 108*cdf0e10cSrcweir rProperty.mnIndex+5 ); 109*cdf0e10cSrcweir bRet = sal_False; // the property hasn't been filled 110*cdf0e10cSrcweir } 111*cdf0e10cSrcweir break; 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir // If we want to do StarMath/StarSymbol font conversion, then we'll 114*cdf0e10cSrcweir // want these special items to be treated just like regular ones... 115*cdf0e10cSrcweir // For the Writer, we'll catch and convert them in _FillPropertySet; 116*cdf0e10cSrcweir // the other apps probably don't care. For the other apps, we just 117*cdf0e10cSrcweir // imitate the default non-special-item mechanism. 118*cdf0e10cSrcweir case CTF_FONTFAMILYNAME: 119*cdf0e10cSrcweir case CTF_FONTFAMILYNAME_CJK: 120*cdf0e10cSrcweir case CTF_FONTFAMILYNAME_CTL: 121*cdf0e10cSrcweir bRet = getPropertySetMapper()->importXML( rValue, rProperty, 122*cdf0e10cSrcweir rUnitConverter ); 123*cdf0e10cSrcweir break; 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir case CTF_TEXT_DISPLAY: 126*cdf0e10cSrcweir bRet = getPropertySetMapper()->importXML( rValue, rProperty, 127*cdf0e10cSrcweir rUnitConverter ); 128*cdf0e10cSrcweir if( SvXMLImport::OOo_2x == GetImport().getGeneratorVersion() ) 129*cdf0e10cSrcweir { 130*cdf0e10cSrcweir sal_Bool bHidden; 131*cdf0e10cSrcweir rProperty.maValue >>= bHidden; 132*cdf0e10cSrcweir bHidden = !bHidden; 133*cdf0e10cSrcweir rProperty.maValue <<= bHidden; 134*cdf0e10cSrcweir } 135*cdf0e10cSrcweir break; 136*cdf0e10cSrcweir default: 137*cdf0e10cSrcweir bRet = SvXMLImportPropertyMapper::handleSpecialItem( rProperty, 138*cdf0e10cSrcweir rProperties, rValue, rUnitConverter, rNamespaceMap ); 139*cdf0e10cSrcweir break; 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir return bRet; 143*cdf0e10cSrcweir } 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir XMLTextImportPropertyMapper::XMLTextImportPropertyMapper( 146*cdf0e10cSrcweir const UniReference< XMLPropertySetMapper >& rMapper, 147*cdf0e10cSrcweir SvXMLImport& rImp, 148*cdf0e10cSrcweir XMLFontStylesContext *pFontDecls ) : 149*cdf0e10cSrcweir SvXMLImportPropertyMapper( rMapper, rImp ), 150*cdf0e10cSrcweir nSizeTypeIndex( -2 ), 151*cdf0e10cSrcweir nWidthTypeIndex( -2 ), 152*cdf0e10cSrcweir xFontDecls( pFontDecls ) 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir XMLTextImportPropertyMapper::~XMLTextImportPropertyMapper() 157*cdf0e10cSrcweir { 158*cdf0e10cSrcweir } 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir void XMLTextImportPropertyMapper::SetFontDecls( 161*cdf0e10cSrcweir XMLFontStylesContext *pFontDecls ) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir xFontDecls = pFontDecls; 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir void XMLTextImportPropertyMapper::FontFinished( 167*cdf0e10cSrcweir XMLPropertyState *pFontFamilyNameState, 168*cdf0e10cSrcweir XMLPropertyState *pFontStyleNameState, 169*cdf0e10cSrcweir XMLPropertyState *pFontFamilyState, 170*cdf0e10cSrcweir XMLPropertyState *pFontPitchState, 171*cdf0e10cSrcweir XMLPropertyState *pFontCharsetState ) const 172*cdf0e10cSrcweir { 173*cdf0e10cSrcweir if( pFontFamilyNameState && pFontFamilyNameState->mnIndex != -1 ) 174*cdf0e10cSrcweir { 175*cdf0e10cSrcweir OUString sName; 176*cdf0e10cSrcweir pFontFamilyNameState->maValue >>= sName; 177*cdf0e10cSrcweir if( !sName.getLength() ) 178*cdf0e10cSrcweir pFontFamilyNameState->mnIndex = -1; 179*cdf0e10cSrcweir } 180*cdf0e10cSrcweir if( !pFontFamilyNameState || pFontFamilyNameState->mnIndex == -1 ) 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir if( pFontStyleNameState ) 183*cdf0e10cSrcweir pFontStyleNameState->mnIndex = -1; 184*cdf0e10cSrcweir if( pFontFamilyState ) 185*cdf0e10cSrcweir pFontFamilyState->mnIndex = -1; 186*cdf0e10cSrcweir if( pFontPitchState ) 187*cdf0e10cSrcweir pFontPitchState->mnIndex = -1; 188*cdf0e10cSrcweir if( pFontCharsetState ) 189*cdf0e10cSrcweir pFontCharsetState->mnIndex = -1; 190*cdf0e10cSrcweir } 191*cdf0e10cSrcweir } 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir /** since the properties "CharFontFamilyName", "CharFontStyleName", "CharFontFamily", 194*cdf0e10cSrcweir "CharFontPitch" and "CharFontSet" and theire CJK and CTL counterparts are only 195*cdf0e10cSrcweir usable as a union, we add defaults to all values that are not set as long as we 196*cdf0e10cSrcweir have an "CharFontFamilyName" 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir #99928# CL */ 199*cdf0e10cSrcweir void XMLTextImportPropertyMapper::FontDefaultsCheck( 200*cdf0e10cSrcweir XMLPropertyState* pFontFamilyName, 201*cdf0e10cSrcweir XMLPropertyState* pFontStyleName, 202*cdf0e10cSrcweir XMLPropertyState* pFontFamily, 203*cdf0e10cSrcweir XMLPropertyState* pFontPitch, 204*cdf0e10cSrcweir XMLPropertyState* pFontCharSet, 205*cdf0e10cSrcweir XMLPropertyState** ppNewFontStyleName, 206*cdf0e10cSrcweir XMLPropertyState** ppNewFontFamily, 207*cdf0e10cSrcweir XMLPropertyState** ppNewFontPitch, 208*cdf0e10cSrcweir XMLPropertyState** ppNewFontCharSet ) const 209*cdf0e10cSrcweir { 210*cdf0e10cSrcweir if( pFontFamilyName ) 211*cdf0e10cSrcweir { 212*cdf0e10cSrcweir OUString sEmpty; 213*cdf0e10cSrcweir Any aAny; 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir if( !pFontStyleName ) 216*cdf0e10cSrcweir { 217*cdf0e10cSrcweir aAny <<= sEmpty; 218*cdf0e10cSrcweir #ifdef DBG_UTIL 219*cdf0e10cSrcweir sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( 220*cdf0e10cSrcweir pFontFamilyName->mnIndex + 1 ); 221*cdf0e10cSrcweir DBG_ASSERT( nTmp == CTF_FONTSTYLENAME || nTmp == CTF_FONTSTYLENAME_CJK || nTmp == CTF_FONTSTYLENAME_CTL, 222*cdf0e10cSrcweir "wrong property context id" ); 223*cdf0e10cSrcweir #endif 224*cdf0e10cSrcweir *ppNewFontStyleName = new XMLPropertyState( pFontFamilyName->mnIndex + 1, 225*cdf0e10cSrcweir aAny ); 226*cdf0e10cSrcweir } 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir if( !pFontFamily ) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir aAny <<= (sal_Int16)com::sun::star::awt::FontFamily::DONTKNOW; 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir #ifdef DBG_UTIL 233*cdf0e10cSrcweir sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( 234*cdf0e10cSrcweir pFontFamilyName->mnIndex + 2 ); 235*cdf0e10cSrcweir DBG_ASSERT( nTmp == CTF_FONTFAMILY || nTmp == CTF_FONTFAMILY_CJK || nTmp == CTF_FONTFAMILY_CTL, 236*cdf0e10cSrcweir "wrong property context id" ); 237*cdf0e10cSrcweir #endif 238*cdf0e10cSrcweir *ppNewFontFamily = new XMLPropertyState( pFontFamilyName->mnIndex + 2, 239*cdf0e10cSrcweir aAny ); 240*cdf0e10cSrcweir } 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir if( !pFontPitch ) 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir aAny <<= (sal_Int16)com::sun::star::awt::FontPitch::DONTKNOW; 245*cdf0e10cSrcweir #ifdef DBG_UTIL 246*cdf0e10cSrcweir sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( 247*cdf0e10cSrcweir pFontFamilyName->mnIndex + 3 ); 248*cdf0e10cSrcweir DBG_ASSERT( nTmp == CTF_FONTPITCH || nTmp == CTF_FONTPITCH_CJK || nTmp == CTF_FONTPITCH_CTL, 249*cdf0e10cSrcweir "wrong property context id" ); 250*cdf0e10cSrcweir #endif 251*cdf0e10cSrcweir *ppNewFontPitch = new XMLPropertyState( pFontFamilyName->mnIndex + 3, 252*cdf0e10cSrcweir aAny ); 253*cdf0e10cSrcweir } 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir if( !pFontCharSet ) 256*cdf0e10cSrcweir { 257*cdf0e10cSrcweir aAny <<= (sal_Int16)gsl_getSystemTextEncoding(); 258*cdf0e10cSrcweir #ifdef DBG_UTIL 259*cdf0e10cSrcweir sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( 260*cdf0e10cSrcweir pFontFamilyName->mnIndex + 4 ); 261*cdf0e10cSrcweir DBG_ASSERT( nTmp == CTF_FONTCHARSET || nTmp == CTF_FONTCHARSET_CJK || nTmp == CTF_FONTCHARSET_CTL, 262*cdf0e10cSrcweir "wrong property context id" ); 263*cdf0e10cSrcweir #endif 264*cdf0e10cSrcweir *ppNewFontCharSet = new XMLPropertyState( pFontFamilyName->mnIndex + 4, 265*cdf0e10cSrcweir aAny ); 266*cdf0e10cSrcweir } 267*cdf0e10cSrcweir } 268*cdf0e10cSrcweir } 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir void XMLTextImportPropertyMapper::finished( 271*cdf0e10cSrcweir ::std::vector< XMLPropertyState >& rProperties, 272*cdf0e10cSrcweir sal_Int32 /*nStartIndex*/, sal_Int32 /*nEndIndex*/ ) const 273*cdf0e10cSrcweir { 274*cdf0e10cSrcweir sal_Bool bHasAnyHeight = sal_False; 275*cdf0e10cSrcweir sal_Bool bHasAnyMinHeight = sal_False; 276*cdf0e10cSrcweir sal_Bool bHasAnyWidth = sal_False; 277*cdf0e10cSrcweir sal_Bool bHasAnyMinWidth = sal_False; 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir XMLPropertyState* pFontFamilyName = 0; 280*cdf0e10cSrcweir XMLPropertyState* pFontStyleName = 0; 281*cdf0e10cSrcweir XMLPropertyState* pFontFamily = 0; 282*cdf0e10cSrcweir XMLPropertyState* pFontPitch = 0; 283*cdf0e10cSrcweir XMLPropertyState* pFontCharSet = 0; 284*cdf0e10cSrcweir XMLPropertyState* pNewFontStyleName = 0; 285*cdf0e10cSrcweir XMLPropertyState* pNewFontFamily = 0; 286*cdf0e10cSrcweir XMLPropertyState* pNewFontPitch = 0; 287*cdf0e10cSrcweir XMLPropertyState* pNewFontCharSet = 0; 288*cdf0e10cSrcweir XMLPropertyState* pFontFamilyNameCJK = 0; 289*cdf0e10cSrcweir XMLPropertyState* pFontStyleNameCJK = 0; 290*cdf0e10cSrcweir XMLPropertyState* pFontFamilyCJK = 0; 291*cdf0e10cSrcweir XMLPropertyState* pFontPitchCJK = 0; 292*cdf0e10cSrcweir XMLPropertyState* pFontCharSetCJK = 0; 293*cdf0e10cSrcweir XMLPropertyState* pNewFontStyleNameCJK = 0; 294*cdf0e10cSrcweir XMLPropertyState* pNewFontFamilyCJK = 0; 295*cdf0e10cSrcweir XMLPropertyState* pNewFontPitchCJK = 0; 296*cdf0e10cSrcweir XMLPropertyState* pNewFontCharSetCJK = 0; 297*cdf0e10cSrcweir XMLPropertyState* pFontFamilyNameCTL = 0; 298*cdf0e10cSrcweir XMLPropertyState* pFontStyleNameCTL = 0; 299*cdf0e10cSrcweir XMLPropertyState* pFontFamilyCTL = 0; 300*cdf0e10cSrcweir XMLPropertyState* pFontPitchCTL = 0; 301*cdf0e10cSrcweir XMLPropertyState* pFontCharSetCTL = 0; 302*cdf0e10cSrcweir XMLPropertyState* pNewFontStyleNameCTL = 0; 303*cdf0e10cSrcweir XMLPropertyState* pNewFontFamilyCTL = 0; 304*cdf0e10cSrcweir XMLPropertyState* pNewFontPitchCTL = 0; 305*cdf0e10cSrcweir XMLPropertyState* pNewFontCharSetCTL = 0; 306*cdf0e10cSrcweir XMLPropertyState* pAllBorderDistance = 0; 307*cdf0e10cSrcweir XMLPropertyState* pBorderDistances[4] = { 0, 0, 0, 0 }; 308*cdf0e10cSrcweir XMLPropertyState* pNewBorderDistances[4] = { 0, 0, 0, 0 }; 309*cdf0e10cSrcweir XMLPropertyState* pAllBorder = 0; 310*cdf0e10cSrcweir XMLPropertyState* pBorders[4] = { 0, 0, 0, 0 }; 311*cdf0e10cSrcweir XMLPropertyState* pNewBorders[4] = { 0, 0, 0, 0 }; 312*cdf0e10cSrcweir XMLPropertyState* pAllBorderWidth = 0; 313*cdf0e10cSrcweir XMLPropertyState* pBorderWidths[4] = { 0, 0, 0, 0 }; 314*cdf0e10cSrcweir XMLPropertyState* pAnchorType = 0; 315*cdf0e10cSrcweir XMLPropertyState* pVertOrient = 0; 316*cdf0e10cSrcweir XMLPropertyState* pVertOrientRelAsChar = 0; 317*cdf0e10cSrcweir XMLPropertyState* pBackTransparency = NULL; // transparency in % 318*cdf0e10cSrcweir XMLPropertyState* pBackTransparent = NULL; // transparency as boolean 319*cdf0e10cSrcweir XMLPropertyState* pAllParaMargin = 0; 320*cdf0e10cSrcweir XMLPropertyState* pParaMargins[4] = { 0, 0, 0, 0 }; 321*cdf0e10cSrcweir ::std::auto_ptr<XMLPropertyState> pNewParaMargins[4]; 322*cdf0e10cSrcweir XMLPropertyState* pAllMargin = 0; 323*cdf0e10cSrcweir XMLPropertyState* pMargins[4] = { 0, 0, 0, 0 }; 324*cdf0e10cSrcweir ::std::auto_ptr<XMLPropertyState> pNewMargins[4]; 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); 327*cdf0e10cSrcweir aIter != rProperties.end(); 328*cdf0e10cSrcweir ++aIter ) 329*cdf0e10cSrcweir { 330*cdf0e10cSrcweir XMLPropertyState* property = &(*aIter); 331*cdf0e10cSrcweir if( -1 == property->mnIndex ) 332*cdf0e10cSrcweir continue; 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir switch( getPropertySetMapper()->GetEntryContextId( property->mnIndex ) ) 335*cdf0e10cSrcweir { 336*cdf0e10cSrcweir case CTF_FONTFAMILYNAME: pFontFamilyName = property; break; 337*cdf0e10cSrcweir case CTF_FONTSTYLENAME: pFontStyleName = property; break; 338*cdf0e10cSrcweir case CTF_FONTFAMILY: pFontFamily = property; break; 339*cdf0e10cSrcweir case CTF_FONTPITCH: pFontPitch = property; break; 340*cdf0e10cSrcweir case CTF_FONTCHARSET: pFontCharSet = property; break; 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir case CTF_FONTFAMILYNAME_CJK: pFontFamilyNameCJK = property; break; 343*cdf0e10cSrcweir case CTF_FONTSTYLENAME_CJK: pFontStyleNameCJK = property; break; 344*cdf0e10cSrcweir case CTF_FONTFAMILY_CJK: pFontFamilyCJK = property; break; 345*cdf0e10cSrcweir case CTF_FONTPITCH_CJK: pFontPitchCJK = property; break; 346*cdf0e10cSrcweir case CTF_FONTCHARSET_CJK: pFontCharSetCJK = property; break; 347*cdf0e10cSrcweir 348*cdf0e10cSrcweir case CTF_FONTFAMILYNAME_CTL: pFontFamilyNameCTL = property; break; 349*cdf0e10cSrcweir case CTF_FONTSTYLENAME_CTL: pFontStyleNameCTL = property; break; 350*cdf0e10cSrcweir case CTF_FONTFAMILY_CTL: pFontFamilyCTL = property; break; 351*cdf0e10cSrcweir case CTF_FONTPITCH_CTL: pFontPitchCTL = property; break; 352*cdf0e10cSrcweir case CTF_FONTCHARSET_CTL: pFontCharSetCTL = property; break; 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir case CTF_ALLBORDERDISTANCE: pAllBorderDistance = property; break; 355*cdf0e10cSrcweir case CTF_LEFTBORDERDISTANCE: pBorderDistances[XML_LINE_LEFT] = property; break; 356*cdf0e10cSrcweir case CTF_RIGHTBORDERDISTANCE: pBorderDistances[XML_LINE_RIGHT] = property; break; 357*cdf0e10cSrcweir case CTF_TOPBORDERDISTANCE: pBorderDistances[XML_LINE_TOP] = property; break; 358*cdf0e10cSrcweir case CTF_BOTTOMBORDERDISTANCE: pBorderDistances[XML_LINE_BOTTOM] = property; break; 359*cdf0e10cSrcweir case CTF_ALLBORDER: pAllBorder = property; break; 360*cdf0e10cSrcweir case CTF_LEFTBORDER: pBorders[XML_LINE_LEFT] = property; break; 361*cdf0e10cSrcweir case CTF_RIGHTBORDER: pBorders[XML_LINE_RIGHT] = property; break; 362*cdf0e10cSrcweir case CTF_TOPBORDER: pBorders[XML_LINE_TOP] = property; break; 363*cdf0e10cSrcweir case CTF_BOTTOMBORDER: pBorders[XML_LINE_BOTTOM] = property; break; 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir case CTF_ALLBORDERWIDTH: pAllBorderWidth = property; break; 366*cdf0e10cSrcweir case CTF_LEFTBORDERWIDTH: pBorderWidths[XML_LINE_LEFT] = property; break; 367*cdf0e10cSrcweir case CTF_RIGHTBORDERWIDTH: pBorderWidths[XML_LINE_RIGHT] = property; break; 368*cdf0e10cSrcweir case CTF_TOPBORDERWIDTH: pBorderWidths[XML_LINE_TOP] = property; break; 369*cdf0e10cSrcweir case CTF_BOTTOMBORDERWIDTH: pBorderWidths[XML_LINE_BOTTOM] = property; break; 370*cdf0e10cSrcweir case CTF_ANCHORTYPE: pAnchorType = property; break; 371*cdf0e10cSrcweir case CTF_VERTICALPOS: pVertOrient = property; break; 372*cdf0e10cSrcweir case CTF_VERTICALREL_ASCHAR: pVertOrientRelAsChar = property; break; 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir case CTF_FRAMEHEIGHT_MIN_ABS: 375*cdf0e10cSrcweir case CTF_FRAMEHEIGHT_MIN_REL: 376*cdf0e10cSrcweir // case CTF_SYNCHEIGHT_MIN: 377*cdf0e10cSrcweir bHasAnyMinHeight = sal_True; 378*cdf0e10cSrcweir // no break here! 379*cdf0e10cSrcweir case CTF_FRAMEHEIGHT_ABS: 380*cdf0e10cSrcweir case CTF_FRAMEHEIGHT_REL: 381*cdf0e10cSrcweir // case CTF_SYNCHEIGHT: 382*cdf0e10cSrcweir bHasAnyHeight = sal_True; break; 383*cdf0e10cSrcweir case CTF_FRAMEWIDTH_MIN_ABS: 384*cdf0e10cSrcweir case CTF_FRAMEWIDTH_MIN_REL: 385*cdf0e10cSrcweir bHasAnyMinWidth = sal_True; 386*cdf0e10cSrcweir // no break here! 387*cdf0e10cSrcweir case CTF_FRAMEWIDTH_ABS: 388*cdf0e10cSrcweir case CTF_FRAMEWIDTH_REL: 389*cdf0e10cSrcweir bHasAnyWidth = sal_True; break; 390*cdf0e10cSrcweir case CTF_BACKGROUND_TRANSPARENCY: pBackTransparency = property; break; 391*cdf0e10cSrcweir case CTF_BACKGROUND_TRANSPARENT: pBackTransparent = property; break; 392*cdf0e10cSrcweir case CTF_PARAMARGINALL: 393*cdf0e10cSrcweir case CTF_PARAMARGINALL_REL: 394*cdf0e10cSrcweir pAllParaMargin = property; break; 395*cdf0e10cSrcweir case CTF_PARALEFTMARGIN: 396*cdf0e10cSrcweir case CTF_PARALEFTMARGIN_REL: 397*cdf0e10cSrcweir pParaMargins[XML_LINE_LEFT] = property; break; 398*cdf0e10cSrcweir case CTF_PARARIGHTMARGIN: 399*cdf0e10cSrcweir case CTF_PARARIGHTMARGIN_REL: 400*cdf0e10cSrcweir pParaMargins[XML_LINE_RIGHT] = property; break; 401*cdf0e10cSrcweir case CTF_PARATOPMARGIN: 402*cdf0e10cSrcweir case CTF_PARATOPMARGIN_REL: 403*cdf0e10cSrcweir pParaMargins[XML_LINE_TOP] = property; break; 404*cdf0e10cSrcweir case CTF_PARABOTTOMMARGIN: 405*cdf0e10cSrcweir case CTF_PARABOTTOMMARGIN_REL: 406*cdf0e10cSrcweir pParaMargins[XML_LINE_BOTTOM] = property; break; 407*cdf0e10cSrcweir case CTF_MARGINALL: 408*cdf0e10cSrcweir pAllMargin = property; break; 409*cdf0e10cSrcweir case CTF_MARGINLEFT: 410*cdf0e10cSrcweir pMargins[XML_LINE_LEFT] = property; break; 411*cdf0e10cSrcweir case CTF_MARGINRIGHT: 412*cdf0e10cSrcweir pMargins[XML_LINE_RIGHT] = property; break; 413*cdf0e10cSrcweir case CTF_MARGINTOP: 414*cdf0e10cSrcweir pMargins[XML_LINE_TOP] = property; break; 415*cdf0e10cSrcweir case CTF_MARGINBOTTOM: 416*cdf0e10cSrcweir pMargins[XML_LINE_BOTTOM] = property; break; 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir } 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir if( pFontFamilyName || pFontStyleName || pFontFamily || 421*cdf0e10cSrcweir pFontPitch || pFontCharSet ) 422*cdf0e10cSrcweir FontFinished( pFontFamilyName, pFontStyleName, pFontFamily, 423*cdf0e10cSrcweir pFontPitch, pFontCharSet ); 424*cdf0e10cSrcweir if( pFontFamilyNameCJK || pFontStyleNameCJK || pFontFamilyCJK || 425*cdf0e10cSrcweir pFontPitchCJK || pFontCharSetCJK ) 426*cdf0e10cSrcweir FontFinished( pFontFamilyNameCJK, pFontStyleNameCJK, pFontFamilyCJK, 427*cdf0e10cSrcweir pFontPitchCJK, pFontCharSetCJK ); 428*cdf0e10cSrcweir if( pFontFamilyNameCTL || pFontStyleNameCTL || pFontFamilyCTL || 429*cdf0e10cSrcweir pFontPitchCTL || pFontCharSetCTL ) 430*cdf0e10cSrcweir FontFinished( pFontFamilyNameCTL, pFontStyleNameCTL, pFontFamilyCTL, 431*cdf0e10cSrcweir pFontPitchCTL, pFontCharSetCTL ); 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir for (sal_uInt16 i = 0; i < 4; i++) 434*cdf0e10cSrcweir { 435*cdf0e10cSrcweir if (pAllParaMargin && !pParaMargins[i]) 436*cdf0e10cSrcweir { 437*cdf0e10cSrcweir #ifdef DBG_UTIL 438*cdf0e10cSrcweir sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( 439*cdf0e10cSrcweir pAllParaMargin->mnIndex + (2*i) + 2 ); 440*cdf0e10cSrcweir OSL_ENSURE( nTmp >= CTF_PARALEFTMARGIN && 441*cdf0e10cSrcweir nTmp <= CTF_PARABOTTOMMARGIN_REL, 442*cdf0e10cSrcweir "wrong property context id" ); 443*cdf0e10cSrcweir #endif 444*cdf0e10cSrcweir pNewParaMargins[i].reset(new XMLPropertyState( 445*cdf0e10cSrcweir pAllParaMargin->mnIndex + (2*i) + 2, pAllParaMargin->maValue)); 446*cdf0e10cSrcweir } 447*cdf0e10cSrcweir if (pAllMargin && !pMargins[i]) 448*cdf0e10cSrcweir { 449*cdf0e10cSrcweir #ifdef DBG_UTIL 450*cdf0e10cSrcweir sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( 451*cdf0e10cSrcweir pAllMargin->mnIndex + i + 1 ); 452*cdf0e10cSrcweir OSL_ENSURE( nTmp >= CTF_MARGINLEFT && nTmp <= CTF_MARGINBOTTOM, 453*cdf0e10cSrcweir "wrong property context id" ); 454*cdf0e10cSrcweir #endif 455*cdf0e10cSrcweir pNewMargins[i].reset(new XMLPropertyState( 456*cdf0e10cSrcweir pAllMargin->mnIndex + i + 1, pAllMargin->maValue)); 457*cdf0e10cSrcweir } 458*cdf0e10cSrcweir if( pAllBorderDistance && !pBorderDistances[i] ) 459*cdf0e10cSrcweir { 460*cdf0e10cSrcweir #ifdef DBG_UTIL 461*cdf0e10cSrcweir sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( 462*cdf0e10cSrcweir pAllBorderDistance->mnIndex + i + 1 ); 463*cdf0e10cSrcweir DBG_ASSERT( nTmp >= CTF_LEFTBORDERDISTANCE && 464*cdf0e10cSrcweir nTmp <= CTF_BOTTOMBORDERDISTANCE, 465*cdf0e10cSrcweir "wrong property context id" ); 466*cdf0e10cSrcweir #endif 467*cdf0e10cSrcweir pNewBorderDistances[i] = 468*cdf0e10cSrcweir new XMLPropertyState( pAllBorderDistance->mnIndex + i + 1, 469*cdf0e10cSrcweir pAllBorderDistance->maValue ); 470*cdf0e10cSrcweir pBorderDistances[i] = pNewBorderDistances[i]; 471*cdf0e10cSrcweir } 472*cdf0e10cSrcweir if( pAllBorder && !pBorders[i] ) 473*cdf0e10cSrcweir { 474*cdf0e10cSrcweir #ifdef DBG_UTIL 475*cdf0e10cSrcweir sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( 476*cdf0e10cSrcweir pAllBorder->mnIndex + i + 1 ); 477*cdf0e10cSrcweir DBG_ASSERT( nTmp >= CTF_LEFTBORDER && nTmp <= CTF_BOTTOMBORDER, 478*cdf0e10cSrcweir "wrong property context id" ); 479*cdf0e10cSrcweir #endif 480*cdf0e10cSrcweir pNewBorders[i] = new XMLPropertyState( pAllBorder->mnIndex + i + 1, 481*cdf0e10cSrcweir pAllBorder->maValue ); 482*cdf0e10cSrcweir pBorders[i] = pNewBorders[i]; 483*cdf0e10cSrcweir } 484*cdf0e10cSrcweir if( !pBorderWidths[i] ) 485*cdf0e10cSrcweir pBorderWidths[i] = pAllBorderWidth; 486*cdf0e10cSrcweir else 487*cdf0e10cSrcweir pBorderWidths[i]->mnIndex = -1; 488*cdf0e10cSrcweir 489*cdf0e10cSrcweir #ifdef XML_CHECK_UI_CONSTRAINS 490*cdf0e10cSrcweir sal_Bool bHasBorder = sal_False; 491*cdf0e10cSrcweir if( pBorders[i] ) 492*cdf0e10cSrcweir { 493*cdf0e10cSrcweir table::BorderLine aBorderLine; 494*cdf0e10cSrcweir pBorders[i]->maValue >>= aBorderLine; 495*cdf0e10cSrcweir 496*cdf0e10cSrcweir if( pBorderWidths[i] ) 497*cdf0e10cSrcweir { 498*cdf0e10cSrcweir table::BorderLine aBorderLineWidth; 499*cdf0e10cSrcweir pBorderWidths[i]->maValue >>= aBorderLineWidth; 500*cdf0e10cSrcweir aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth; 501*cdf0e10cSrcweir aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth; 502*cdf0e10cSrcweir aBorderLine.LineDistance = aBorderLineWidth.LineDistance; 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir pBorders[i]->maValue <<= aBorderLine; 505*cdf0e10cSrcweir } 506*cdf0e10cSrcweir bHasBorder = (aBorderLine.OuterLineWidth + 507*cdf0e10cSrcweir aBorderLine.InnerLineWidth) > 0; 508*cdf0e10cSrcweir } 509*cdf0e10cSrcweir if( bHasBorder ) 510*cdf0e10cSrcweir { 511*cdf0e10cSrcweir if( !pBorderDistances[i] ) 512*cdf0e10cSrcweir { 513*cdf0e10cSrcweir #ifdef DBG_UTIL 514*cdf0e10cSrcweir sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId( 515*cdf0e10cSrcweir pBorders[i]->mnIndex + 5 ); 516*cdf0e10cSrcweir DBG_ASSERT( nTmp >= CTF_LEFTBORDERDISTANCE && 517*cdf0e10cSrcweir nTmp <= CTF_BOTTOMBORDERDISTANCE, 518*cdf0e10cSrcweir "wrong property context id" ); 519*cdf0e10cSrcweir #endif 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir pNewBorderDistances[i] = 522*cdf0e10cSrcweir new XMLPropertyState( pBorders[i]->mnIndex + 5 ); 523*cdf0e10cSrcweir pNewBorderDistances[i]->maValue <<= (sal_Int32)MIN_BORDER_DIST; 524*cdf0e10cSrcweir pBorderDistances[i] = pNewBorderDistances[i]; 525*cdf0e10cSrcweir } 526*cdf0e10cSrcweir else 527*cdf0e10cSrcweir { 528*cdf0e10cSrcweir sal_Int32 nDist; 529*cdf0e10cSrcweir pBorderDistances[i]->maValue >>= nDist; 530*cdf0e10cSrcweir if( nDist < MIN_BORDER_DIST ) 531*cdf0e10cSrcweir pBorderDistances[i]->maValue <<= (sal_Int32)MIN_BORDER_DIST; 532*cdf0e10cSrcweir } 533*cdf0e10cSrcweir } 534*cdf0e10cSrcweir else 535*cdf0e10cSrcweir { 536*cdf0e10cSrcweir if( pBorderDistances[i] ) 537*cdf0e10cSrcweir { 538*cdf0e10cSrcweir sal_Int32 nDist; 539*cdf0e10cSrcweir pBorderDistances[i]->maValue >>= nDist; 540*cdf0e10cSrcweir if( nDist > 0 ) 541*cdf0e10cSrcweir pBorderDistances[i]->maValue <<= (sal_Int32)0; 542*cdf0e10cSrcweir } 543*cdf0e10cSrcweir } 544*cdf0e10cSrcweir #else 545*cdf0e10cSrcweir if( pBorders[i] && pBorderWidths[i] ) 546*cdf0e10cSrcweir { 547*cdf0e10cSrcweir table::BorderLine aBorderLine; 548*cdf0e10cSrcweir pBorders[i]->maValue >>= aBorderLine; 549*cdf0e10cSrcweir 550*cdf0e10cSrcweir table::BorderLine aBorderLineWidth; 551*cdf0e10cSrcweir pBorderWidths[i]->maValue >>= aBorderLineWidth; 552*cdf0e10cSrcweir 553*cdf0e10cSrcweir aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth; 554*cdf0e10cSrcweir aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth; 555*cdf0e10cSrcweir aBorderLine.LineDistance = aBorderLineWidth.LineDistance; 556*cdf0e10cSrcweir 557*cdf0e10cSrcweir pBorders[i]->maValue <<= aBorderLine; 558*cdf0e10cSrcweir } 559*cdf0e10cSrcweir #endif 560*cdf0e10cSrcweir } 561*cdf0e10cSrcweir 562*cdf0e10cSrcweir if (pAllParaMargin) 563*cdf0e10cSrcweir { 564*cdf0e10cSrcweir pAllParaMargin->mnIndex = -1; 565*cdf0e10cSrcweir } 566*cdf0e10cSrcweir if (pAllMargin) 567*cdf0e10cSrcweir { 568*cdf0e10cSrcweir pAllMargin->mnIndex = -1; 569*cdf0e10cSrcweir } 570*cdf0e10cSrcweir 571*cdf0e10cSrcweir if( pAllBorderDistance ) 572*cdf0e10cSrcweir pAllBorderDistance->mnIndex = -1; 573*cdf0e10cSrcweir 574*cdf0e10cSrcweir if( pAllBorder ) 575*cdf0e10cSrcweir pAllBorder->mnIndex = -1; 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir if( pAllBorderWidth ) 578*cdf0e10cSrcweir pAllBorderWidth->mnIndex = -1; 579*cdf0e10cSrcweir 580*cdf0e10cSrcweir if( pVertOrient && pVertOrientRelAsChar ) 581*cdf0e10cSrcweir { 582*cdf0e10cSrcweir sal_Int16 nVertOrient; 583*cdf0e10cSrcweir pVertOrient->maValue >>= nVertOrient; 584*cdf0e10cSrcweir sal_Int16 nVertOrientRel = 0; 585*cdf0e10cSrcweir pVertOrientRelAsChar->maValue >>= nVertOrientRel; 586*cdf0e10cSrcweir switch( nVertOrient ) 587*cdf0e10cSrcweir { 588*cdf0e10cSrcweir case VertOrientation::TOP: 589*cdf0e10cSrcweir nVertOrient = nVertOrientRel; 590*cdf0e10cSrcweir break; 591*cdf0e10cSrcweir case VertOrientation::CENTER: 592*cdf0e10cSrcweir switch( nVertOrientRel ) 593*cdf0e10cSrcweir { 594*cdf0e10cSrcweir case VertOrientation::CHAR_TOP: 595*cdf0e10cSrcweir nVertOrient = VertOrientation::CHAR_CENTER; 596*cdf0e10cSrcweir break; 597*cdf0e10cSrcweir case VertOrientation::LINE_TOP: 598*cdf0e10cSrcweir nVertOrient = VertOrientation::LINE_CENTER; 599*cdf0e10cSrcweir break; 600*cdf0e10cSrcweir } 601*cdf0e10cSrcweir break; 602*cdf0e10cSrcweir case VertOrientation::BOTTOM: 603*cdf0e10cSrcweir switch( nVertOrientRel ) 604*cdf0e10cSrcweir { 605*cdf0e10cSrcweir case VertOrientation::CHAR_TOP: 606*cdf0e10cSrcweir nVertOrient = VertOrientation::CHAR_BOTTOM; 607*cdf0e10cSrcweir break; 608*cdf0e10cSrcweir case VertOrientation::LINE_TOP: 609*cdf0e10cSrcweir nVertOrient = VertOrientation::LINE_BOTTOM; 610*cdf0e10cSrcweir break; 611*cdf0e10cSrcweir } 612*cdf0e10cSrcweir break; 613*cdf0e10cSrcweir } 614*cdf0e10cSrcweir pVertOrient->maValue <<= nVertOrient; 615*cdf0e10cSrcweir pVertOrientRelAsChar->mnIndex = -1; 616*cdf0e10cSrcweir } 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir FontDefaultsCheck( pFontFamilyName, 619*cdf0e10cSrcweir pFontStyleName, pFontFamily, pFontPitch, pFontCharSet, 620*cdf0e10cSrcweir &pNewFontStyleName, &pNewFontFamily, &pNewFontPitch, &pNewFontCharSet ); 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir FontDefaultsCheck( pFontFamilyNameCJK, 623*cdf0e10cSrcweir pFontStyleNameCJK, pFontFamilyCJK, pFontPitchCJK, pFontCharSetCJK, 624*cdf0e10cSrcweir &pNewFontStyleNameCJK, &pNewFontFamilyCJK, &pNewFontPitchCJK, &pNewFontCharSetCJK ); 625*cdf0e10cSrcweir 626*cdf0e10cSrcweir FontDefaultsCheck( pFontFamilyNameCTL, 627*cdf0e10cSrcweir pFontStyleNameCTL, pFontFamilyCTL, pFontPitchCTL, pFontCharSetCTL, 628*cdf0e10cSrcweir &pNewFontStyleNameCTL, &pNewFontFamilyCTL, &pNewFontPitchCTL, &pNewFontCharSetCTL ); 629*cdf0e10cSrcweir 630*cdf0e10cSrcweir // #i5775# don't overwrite %transparency with binary transparency 631*cdf0e10cSrcweir if( ( pBackTransparency != NULL ) && ( pBackTransparent != NULL ) ) 632*cdf0e10cSrcweir { 633*cdf0e10cSrcweir if( ! *(sal_Bool*)(pBackTransparent->maValue.getValue()) ) 634*cdf0e10cSrcweir pBackTransparent->mnIndex = -1; 635*cdf0e10cSrcweir } 636*cdf0e10cSrcweir 637*cdf0e10cSrcweir 638*cdf0e10cSrcweir // insert newly created properties. This inavlidates all iterators! 639*cdf0e10cSrcweir // Most of the pXXX variables in this method are iterators and will be 640*cdf0e10cSrcweir // invalidated!!! 641*cdf0e10cSrcweir 642*cdf0e10cSrcweir if( pNewFontStyleName ) 643*cdf0e10cSrcweir { 644*cdf0e10cSrcweir rProperties.push_back( *pNewFontStyleName ); 645*cdf0e10cSrcweir delete pNewFontStyleName; 646*cdf0e10cSrcweir } 647*cdf0e10cSrcweir 648*cdf0e10cSrcweir if( pNewFontFamily ) 649*cdf0e10cSrcweir { 650*cdf0e10cSrcweir rProperties.push_back( *pNewFontFamily ); 651*cdf0e10cSrcweir delete pNewFontFamily; 652*cdf0e10cSrcweir } 653*cdf0e10cSrcweir 654*cdf0e10cSrcweir if( pNewFontPitch ) 655*cdf0e10cSrcweir { 656*cdf0e10cSrcweir rProperties.push_back( *pNewFontPitch ); 657*cdf0e10cSrcweir delete pNewFontPitch; 658*cdf0e10cSrcweir } 659*cdf0e10cSrcweir 660*cdf0e10cSrcweir if( pNewFontCharSet ) 661*cdf0e10cSrcweir { 662*cdf0e10cSrcweir rProperties.push_back( *pNewFontCharSet ); 663*cdf0e10cSrcweir delete pNewFontCharSet; 664*cdf0e10cSrcweir } 665*cdf0e10cSrcweir 666*cdf0e10cSrcweir if( pNewFontStyleNameCJK ) 667*cdf0e10cSrcweir { 668*cdf0e10cSrcweir rProperties.push_back( *pNewFontStyleNameCJK ); 669*cdf0e10cSrcweir delete pNewFontStyleNameCJK; 670*cdf0e10cSrcweir } 671*cdf0e10cSrcweir 672*cdf0e10cSrcweir if( pNewFontFamilyCJK ) 673*cdf0e10cSrcweir { 674*cdf0e10cSrcweir rProperties.push_back( *pNewFontFamilyCJK ); 675*cdf0e10cSrcweir delete pNewFontFamilyCJK; 676*cdf0e10cSrcweir } 677*cdf0e10cSrcweir 678*cdf0e10cSrcweir if( pNewFontPitchCJK ) 679*cdf0e10cSrcweir { 680*cdf0e10cSrcweir rProperties.push_back( *pNewFontPitchCJK ); 681*cdf0e10cSrcweir delete pNewFontPitchCJK; 682*cdf0e10cSrcweir } 683*cdf0e10cSrcweir 684*cdf0e10cSrcweir if( pNewFontCharSetCJK ) 685*cdf0e10cSrcweir { 686*cdf0e10cSrcweir rProperties.push_back( *pNewFontCharSetCJK ); 687*cdf0e10cSrcweir delete pNewFontCharSetCJK; 688*cdf0e10cSrcweir } 689*cdf0e10cSrcweir 690*cdf0e10cSrcweir if( pNewFontStyleNameCTL) 691*cdf0e10cSrcweir { 692*cdf0e10cSrcweir rProperties.push_back( *pNewFontStyleNameCTL ); 693*cdf0e10cSrcweir delete pNewFontStyleNameCTL; 694*cdf0e10cSrcweir } 695*cdf0e10cSrcweir 696*cdf0e10cSrcweir if( pNewFontFamilyCTL ) 697*cdf0e10cSrcweir { 698*cdf0e10cSrcweir rProperties.push_back( *pNewFontFamilyCTL ); 699*cdf0e10cSrcweir delete pNewFontFamilyCTL; 700*cdf0e10cSrcweir } 701*cdf0e10cSrcweir 702*cdf0e10cSrcweir if( pNewFontPitchCTL ) 703*cdf0e10cSrcweir { 704*cdf0e10cSrcweir rProperties.push_back( *pNewFontPitchCTL ); 705*cdf0e10cSrcweir delete pNewFontPitchCTL; 706*cdf0e10cSrcweir } 707*cdf0e10cSrcweir 708*cdf0e10cSrcweir if( pNewFontCharSetCTL ) 709*cdf0e10cSrcweir { 710*cdf0e10cSrcweir rProperties.push_back( *pNewFontCharSetCTL ); 711*cdf0e10cSrcweir delete pNewFontCharSetCTL; 712*cdf0e10cSrcweir } 713*cdf0e10cSrcweir 714*cdf0e10cSrcweir for (sal_uInt16 i=0; i<4; i++) 715*cdf0e10cSrcweir { 716*cdf0e10cSrcweir if (pNewParaMargins[i].get()) 717*cdf0e10cSrcweir { 718*cdf0e10cSrcweir rProperties.push_back(*pNewParaMargins[i]); 719*cdf0e10cSrcweir } 720*cdf0e10cSrcweir if (pNewMargins[i].get()) 721*cdf0e10cSrcweir { 722*cdf0e10cSrcweir rProperties.push_back(*pNewMargins[i]); 723*cdf0e10cSrcweir } 724*cdf0e10cSrcweir if( pNewBorderDistances[i] ) 725*cdf0e10cSrcweir { 726*cdf0e10cSrcweir rProperties.push_back( *pNewBorderDistances[i] ); 727*cdf0e10cSrcweir delete pNewBorderDistances[i]; 728*cdf0e10cSrcweir } 729*cdf0e10cSrcweir if( pNewBorders[i] ) 730*cdf0e10cSrcweir { 731*cdf0e10cSrcweir rProperties.push_back( *pNewBorders[i] ); 732*cdf0e10cSrcweir delete pNewBorders[i]; 733*cdf0e10cSrcweir } 734*cdf0e10cSrcweir } 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir if( bHasAnyHeight ) 737*cdf0e10cSrcweir { 738*cdf0e10cSrcweir if( nSizeTypeIndex == -2 ) 739*cdf0e10cSrcweir { 740*cdf0e10cSrcweir const_cast < XMLTextImportPropertyMapper * > ( this ) 741*cdf0e10cSrcweir ->nSizeTypeIndex = -1; 742*cdf0e10cSrcweir sal_Int32 nPropCount = getPropertySetMapper()->GetEntryCount(); 743*cdf0e10cSrcweir for( sal_Int32 j=0; j < nPropCount; j++ ) 744*cdf0e10cSrcweir { 745*cdf0e10cSrcweir if( CTF_SIZETYPE == getPropertySetMapper() 746*cdf0e10cSrcweir ->GetEntryContextId( j ) ) 747*cdf0e10cSrcweir { 748*cdf0e10cSrcweir const_cast < XMLTextImportPropertyMapper * > ( this ) 749*cdf0e10cSrcweir ->nSizeTypeIndex = j; 750*cdf0e10cSrcweir break; 751*cdf0e10cSrcweir } 752*cdf0e10cSrcweir } 753*cdf0e10cSrcweir } 754*cdf0e10cSrcweir if( nSizeTypeIndex != -1 ) 755*cdf0e10cSrcweir { 756*cdf0e10cSrcweir XMLPropertyState aSizeTypeState( nSizeTypeIndex ); 757*cdf0e10cSrcweir aSizeTypeState.maValue <<= (sal_Int16)( bHasAnyMinHeight 758*cdf0e10cSrcweir ? SizeType::MIN 759*cdf0e10cSrcweir : SizeType::FIX); 760*cdf0e10cSrcweir rProperties.push_back( aSizeTypeState ); 761*cdf0e10cSrcweir } 762*cdf0e10cSrcweir } 763*cdf0e10cSrcweir 764*cdf0e10cSrcweir if( bHasAnyWidth ) 765*cdf0e10cSrcweir { 766*cdf0e10cSrcweir if( nWidthTypeIndex == -2 ) 767*cdf0e10cSrcweir { 768*cdf0e10cSrcweir const_cast < XMLTextImportPropertyMapper * > ( this ) 769*cdf0e10cSrcweir ->nWidthTypeIndex = -1; 770*cdf0e10cSrcweir sal_Int32 nCount = getPropertySetMapper()->GetEntryCount(); 771*cdf0e10cSrcweir for( sal_Int32 j=0; j < nCount; j++ ) 772*cdf0e10cSrcweir { 773*cdf0e10cSrcweir if( CTF_FRAMEWIDTH_TYPE == getPropertySetMapper() 774*cdf0e10cSrcweir ->GetEntryContextId( j ) ) 775*cdf0e10cSrcweir { 776*cdf0e10cSrcweir const_cast < XMLTextImportPropertyMapper * > ( this ) 777*cdf0e10cSrcweir ->nWidthTypeIndex = j; 778*cdf0e10cSrcweir break; 779*cdf0e10cSrcweir } 780*cdf0e10cSrcweir } 781*cdf0e10cSrcweir } 782*cdf0e10cSrcweir if( nWidthTypeIndex != -1 ) 783*cdf0e10cSrcweir { 784*cdf0e10cSrcweir XMLPropertyState aSizeTypeState( nWidthTypeIndex ); 785*cdf0e10cSrcweir aSizeTypeState.maValue <<= (sal_Int16)( bHasAnyMinWidth 786*cdf0e10cSrcweir ? SizeType::MIN 787*cdf0e10cSrcweir : SizeType::FIX); 788*cdf0e10cSrcweir rProperties.push_back( aSizeTypeState ); 789*cdf0e10cSrcweir } 790*cdf0e10cSrcweir } 791*cdf0e10cSrcweir 792*cdf0e10cSrcweir // DO NOT USE ITERATORS/POINTERS INTO THE rProperties-VECTOR AFTER 793*cdf0e10cSrcweir // THIS LINE. All iterators into the rProperties-vector, especially all 794*cdf0e10cSrcweir // pXXX-type variables set in the first switch statement of this method, 795*cdf0e10cSrcweir // may have been invalidated by the above push_back() calls! 796*cdf0e10cSrcweir } 797*cdf0e10cSrcweir 798*cdf0e10cSrcweir 799