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