xref: /aoo41x/main/xmloff/source/text/txtimppr.cxx (revision 63bba73c)
1*63bba73cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*63bba73cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*63bba73cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*63bba73cSAndrew Rist  * distributed with this work for additional information
6*63bba73cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*63bba73cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*63bba73cSAndrew Rist  * "License"); you may not use this file except in compliance
9*63bba73cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*63bba73cSAndrew Rist  *
11*63bba73cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*63bba73cSAndrew Rist  *
13*63bba73cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*63bba73cSAndrew Rist  * software distributed under the License is distributed on an
15*63bba73cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*63bba73cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*63bba73cSAndrew Rist  * specific language governing permissions and limitations
18*63bba73cSAndrew Rist  * under the License.
19*63bba73cSAndrew Rist  *
20*63bba73cSAndrew Rist  *************************************************************/
21*63bba73cSAndrew Rist 
22*63bba73cSAndrew 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 
51cdf0e10cSrcweir 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 
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 
152cdf0e10cSrcweir XMLTextImportPropertyMapper::~XMLTextImportPropertyMapper()
153cdf0e10cSrcweir {
154cdf0e10cSrcweir }
155cdf0e10cSrcweir 
156cdf0e10cSrcweir void XMLTextImportPropertyMapper::SetFontDecls(
157cdf0e10cSrcweir 		XMLFontStylesContext *pFontDecls )
158cdf0e10cSrcweir {
159cdf0e10cSrcweir 	xFontDecls = pFontDecls;
160cdf0e10cSrcweir }
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 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 */
195cdf0e10cSrcweir 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 
266cdf0e10cSrcweir 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
315cdf0e10cSrcweir     XMLPropertyState* pAllParaMargin = 0;
316cdf0e10cSrcweir     XMLPropertyState* pParaMargins[4] = { 0, 0, 0, 0 };
317cdf0e10cSrcweir     ::std::auto_ptr<XMLPropertyState> pNewParaMargins[4];
318cdf0e10cSrcweir     XMLPropertyState* pAllMargin = 0;
319cdf0e10cSrcweir     XMLPropertyState* pMargins[4] = { 0, 0, 0, 0 };
320cdf0e10cSrcweir     ::std::auto_ptr<XMLPropertyState> pNewMargins[4];
321cdf0e10cSrcweir 
322cdf0e10cSrcweir 	for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
323cdf0e10cSrcweir 		 aIter != rProperties.end();
324cdf0e10cSrcweir 		 ++aIter )
325cdf0e10cSrcweir 	{
326cdf0e10cSrcweir         XMLPropertyState* property = &(*aIter);
327cdf0e10cSrcweir 		if( -1 == property->mnIndex )
328cdf0e10cSrcweir 			continue;
329cdf0e10cSrcweir 
330cdf0e10cSrcweir 		switch( getPropertySetMapper()->GetEntryContextId( property->mnIndex ) )
331cdf0e10cSrcweir 		{
332cdf0e10cSrcweir 		case CTF_FONTFAMILYNAME:	pFontFamilyName = property;	break;
333cdf0e10cSrcweir 		case CTF_FONTSTYLENAME:	pFontStyleName = property;	break;
334cdf0e10cSrcweir 		case CTF_FONTFAMILY:	pFontFamily = property;	break;
335cdf0e10cSrcweir 		case CTF_FONTPITCH:	pFontPitch = property;	break;
336cdf0e10cSrcweir 		case CTF_FONTCHARSET:	pFontCharSet = property;	break;
337cdf0e10cSrcweir 
338cdf0e10cSrcweir 		case CTF_FONTFAMILYNAME_CJK:	pFontFamilyNameCJK = property;	break;
339cdf0e10cSrcweir 		case CTF_FONTSTYLENAME_CJK:	pFontStyleNameCJK = property;	break;
340cdf0e10cSrcweir 		case CTF_FONTFAMILY_CJK:	pFontFamilyCJK = property;	break;
341cdf0e10cSrcweir 		case CTF_FONTPITCH_CJK:	pFontPitchCJK = property;	break;
342cdf0e10cSrcweir 		case CTF_FONTCHARSET_CJK:	pFontCharSetCJK = property;	break;
343cdf0e10cSrcweir 
344cdf0e10cSrcweir 		case CTF_FONTFAMILYNAME_CTL:	pFontFamilyNameCTL = property;	break;
345cdf0e10cSrcweir 		case CTF_FONTSTYLENAME_CTL:	pFontStyleNameCTL = property;	break;
346cdf0e10cSrcweir 		case CTF_FONTFAMILY_CTL:	pFontFamilyCTL = property;	break;
347cdf0e10cSrcweir 		case CTF_FONTPITCH_CTL:	pFontPitchCTL = property;	break;
348cdf0e10cSrcweir 		case CTF_FONTCHARSET_CTL:	pFontCharSetCTL = property;	break;
349cdf0e10cSrcweir 
350cdf0e10cSrcweir 		case CTF_ALLBORDERDISTANCE:		pAllBorderDistance = property; break;
351cdf0e10cSrcweir 		case CTF_LEFTBORDERDISTANCE:	pBorderDistances[XML_LINE_LEFT] = property; break;
352cdf0e10cSrcweir 		case CTF_RIGHTBORDERDISTANCE:	pBorderDistances[XML_LINE_RIGHT] = property; break;
353cdf0e10cSrcweir 		case CTF_TOPBORDERDISTANCE:		pBorderDistances[XML_LINE_TOP] = property; break;
354cdf0e10cSrcweir 		case CTF_BOTTOMBORDERDISTANCE:	pBorderDistances[XML_LINE_BOTTOM] = property; break;
355cdf0e10cSrcweir 		case CTF_ALLBORDER:				pAllBorder = property; break;
356cdf0e10cSrcweir 		case CTF_LEFTBORDER:			pBorders[XML_LINE_LEFT] = property; break;
357cdf0e10cSrcweir 		case CTF_RIGHTBORDER:			pBorders[XML_LINE_RIGHT] = property; break;
358cdf0e10cSrcweir 		case CTF_TOPBORDER:				pBorders[XML_LINE_TOP] = property; break;
359cdf0e10cSrcweir 		case CTF_BOTTOMBORDER:			pBorders[XML_LINE_BOTTOM] = property; break;
360cdf0e10cSrcweir 
361cdf0e10cSrcweir 		case CTF_ALLBORDERWIDTH:		pAllBorderWidth = property; break;
362cdf0e10cSrcweir 		case CTF_LEFTBORDERWIDTH:		pBorderWidths[XML_LINE_LEFT] = property; break;
363cdf0e10cSrcweir 		case CTF_RIGHTBORDERWIDTH:		pBorderWidths[XML_LINE_RIGHT] = property; break;
364cdf0e10cSrcweir 		case CTF_TOPBORDERWIDTH:		pBorderWidths[XML_LINE_TOP] = property; break;
365cdf0e10cSrcweir 		case CTF_BOTTOMBORDERWIDTH:		pBorderWidths[XML_LINE_BOTTOM] = property; break;
366cdf0e10cSrcweir 		case CTF_ANCHORTYPE:			pAnchorType = property; break;
367cdf0e10cSrcweir 		case CTF_VERTICALPOS:  			pVertOrient = property; break;
368cdf0e10cSrcweir 		case CTF_VERTICALREL_ASCHAR: 	pVertOrientRelAsChar = property; break;
369cdf0e10cSrcweir 
370cdf0e10cSrcweir 		case CTF_FRAMEHEIGHT_MIN_ABS:
371cdf0e10cSrcweir 		case CTF_FRAMEHEIGHT_MIN_REL:
372cdf0e10cSrcweir //		case CTF_SYNCHEIGHT_MIN:
373cdf0e10cSrcweir 										bHasAnyMinHeight = sal_True;
374cdf0e10cSrcweir 										// no break here!
375cdf0e10cSrcweir 		case CTF_FRAMEHEIGHT_ABS:
376cdf0e10cSrcweir 		case CTF_FRAMEHEIGHT_REL:
377cdf0e10cSrcweir //		case CTF_SYNCHEIGHT:
378cdf0e10cSrcweir 										bHasAnyHeight = sal_True; break;
379cdf0e10cSrcweir 		case CTF_FRAMEWIDTH_MIN_ABS:
380cdf0e10cSrcweir 		case CTF_FRAMEWIDTH_MIN_REL:
381cdf0e10cSrcweir 										bHasAnyMinWidth = sal_True;
382cdf0e10cSrcweir 										// no break here!
383cdf0e10cSrcweir 		case CTF_FRAMEWIDTH_ABS:
384cdf0e10cSrcweir 		case CTF_FRAMEWIDTH_REL:
385cdf0e10cSrcweir 										bHasAnyWidth = sal_True; break;
386cdf0e10cSrcweir         case CTF_BACKGROUND_TRANSPARENCY: pBackTransparency = property; break;
387cdf0e10cSrcweir         case CTF_BACKGROUND_TRANSPARENT:  pBackTransparent = property; break;
388cdf0e10cSrcweir         case CTF_PARAMARGINALL:
389cdf0e10cSrcweir         case CTF_PARAMARGINALL_REL:
390cdf0e10cSrcweir                 pAllParaMargin = property; break;
391cdf0e10cSrcweir         case CTF_PARALEFTMARGIN:
392cdf0e10cSrcweir         case CTF_PARALEFTMARGIN_REL:
393cdf0e10cSrcweir                 pParaMargins[XML_LINE_LEFT] = property; break;
394cdf0e10cSrcweir         case CTF_PARARIGHTMARGIN:
395cdf0e10cSrcweir         case CTF_PARARIGHTMARGIN_REL:
396cdf0e10cSrcweir                 pParaMargins[XML_LINE_RIGHT] = property; break;
397cdf0e10cSrcweir         case CTF_PARATOPMARGIN:
398cdf0e10cSrcweir         case CTF_PARATOPMARGIN_REL:
399cdf0e10cSrcweir                 pParaMargins[XML_LINE_TOP] = property; break;
400cdf0e10cSrcweir         case CTF_PARABOTTOMMARGIN:
401cdf0e10cSrcweir         case CTF_PARABOTTOMMARGIN_REL:
402cdf0e10cSrcweir                 pParaMargins[XML_LINE_BOTTOM] = property; break;
403cdf0e10cSrcweir         case CTF_MARGINALL:
404cdf0e10cSrcweir                 pAllMargin = property; break;
405cdf0e10cSrcweir         case CTF_MARGINLEFT:
406cdf0e10cSrcweir                 pMargins[XML_LINE_LEFT] = property; break;
407cdf0e10cSrcweir         case CTF_MARGINRIGHT:
408cdf0e10cSrcweir                 pMargins[XML_LINE_RIGHT] = property; break;
409cdf0e10cSrcweir         case CTF_MARGINTOP:
410cdf0e10cSrcweir                 pMargins[XML_LINE_TOP] = property; break;
411cdf0e10cSrcweir         case CTF_MARGINBOTTOM:
412cdf0e10cSrcweir                 pMargins[XML_LINE_BOTTOM] = property; break;
413cdf0e10cSrcweir 		}
414cdf0e10cSrcweir 	}
415cdf0e10cSrcweir 
416cdf0e10cSrcweir 	if( pFontFamilyName || pFontStyleName || pFontFamily ||
417cdf0e10cSrcweir 		pFontPitch || pFontCharSet )
418cdf0e10cSrcweir 		FontFinished( pFontFamilyName, pFontStyleName, pFontFamily,
419cdf0e10cSrcweir 					  pFontPitch, pFontCharSet );
420cdf0e10cSrcweir 	if( pFontFamilyNameCJK || pFontStyleNameCJK || pFontFamilyCJK ||
421cdf0e10cSrcweir 		pFontPitchCJK || pFontCharSetCJK )
422cdf0e10cSrcweir 		FontFinished( pFontFamilyNameCJK, pFontStyleNameCJK, pFontFamilyCJK,
423cdf0e10cSrcweir 					  pFontPitchCJK, pFontCharSetCJK );
424cdf0e10cSrcweir 	if( pFontFamilyNameCTL || pFontStyleNameCTL || pFontFamilyCTL ||
425cdf0e10cSrcweir 		pFontPitchCTL || pFontCharSetCTL )
426cdf0e10cSrcweir 		FontFinished( pFontFamilyNameCTL, pFontStyleNameCTL, pFontFamilyCTL,
427cdf0e10cSrcweir 					  pFontPitchCTL, pFontCharSetCTL );
428cdf0e10cSrcweir 
429cdf0e10cSrcweir     for (sal_uInt16 i = 0; i < 4; i++)
430cdf0e10cSrcweir     {
431cdf0e10cSrcweir         if (pAllParaMargin && !pParaMargins[i])
432cdf0e10cSrcweir         {
433cdf0e10cSrcweir #ifdef DBG_UTIL
434cdf0e10cSrcweir             sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
435cdf0e10cSrcweir                                         pAllParaMargin->mnIndex + (2*i) + 2 );
436cdf0e10cSrcweir             OSL_ENSURE( nTmp >= CTF_PARALEFTMARGIN &&
437cdf0e10cSrcweir                         nTmp <= CTF_PARABOTTOMMARGIN_REL,
438cdf0e10cSrcweir                         "wrong property context id" );
439cdf0e10cSrcweir #endif
440cdf0e10cSrcweir             pNewParaMargins[i].reset(new XMLPropertyState(
441cdf0e10cSrcweir                 pAllParaMargin->mnIndex + (2*i) + 2, pAllParaMargin->maValue));
442cdf0e10cSrcweir         }
443cdf0e10cSrcweir         if (pAllMargin && !pMargins[i])
444cdf0e10cSrcweir         {
445cdf0e10cSrcweir #ifdef DBG_UTIL
446cdf0e10cSrcweir             sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
447cdf0e10cSrcweir                                         pAllMargin->mnIndex + i + 1 );
448cdf0e10cSrcweir             OSL_ENSURE( nTmp >= CTF_MARGINLEFT && nTmp <= CTF_MARGINBOTTOM,
449cdf0e10cSrcweir                         "wrong property context id" );
450cdf0e10cSrcweir #endif
451cdf0e10cSrcweir             pNewMargins[i].reset(new XMLPropertyState(
452cdf0e10cSrcweir                 pAllMargin->mnIndex + i + 1, pAllMargin->maValue));
453cdf0e10cSrcweir         }
454cdf0e10cSrcweir 		if( pAllBorderDistance && !pBorderDistances[i] )
455cdf0e10cSrcweir 		{
456cdf0e10cSrcweir #ifdef DBG_UTIL
457cdf0e10cSrcweir 			sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
458cdf0e10cSrcweir 										pAllBorderDistance->mnIndex + i + 1 );
459cdf0e10cSrcweir 			DBG_ASSERT( nTmp >= CTF_LEFTBORDERDISTANCE &&
460cdf0e10cSrcweir 						nTmp <= CTF_BOTTOMBORDERDISTANCE,
461cdf0e10cSrcweir 						"wrong property context id" );
462cdf0e10cSrcweir #endif
463cdf0e10cSrcweir 			pNewBorderDistances[i] =
464cdf0e10cSrcweir 				new XMLPropertyState( pAllBorderDistance->mnIndex + i + 1,
465cdf0e10cSrcweir 									  pAllBorderDistance->maValue );
466cdf0e10cSrcweir 			pBorderDistances[i] = pNewBorderDistances[i];
467cdf0e10cSrcweir 		}
468cdf0e10cSrcweir 		if( pAllBorder && !pBorders[i] )
469cdf0e10cSrcweir 		{
470cdf0e10cSrcweir #ifdef DBG_UTIL
471cdf0e10cSrcweir 			sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
472cdf0e10cSrcweir 											pAllBorder->mnIndex + i + 1 );
473cdf0e10cSrcweir 			DBG_ASSERT( nTmp >= CTF_LEFTBORDER && nTmp <= CTF_BOTTOMBORDER,
474cdf0e10cSrcweir 						"wrong property context id" );
475cdf0e10cSrcweir #endif
476cdf0e10cSrcweir 			pNewBorders[i] = new XMLPropertyState( pAllBorder->mnIndex + i + 1,
477cdf0e10cSrcweir 												   pAllBorder->maValue );
478cdf0e10cSrcweir 			pBorders[i] = pNewBorders[i];
479cdf0e10cSrcweir 		}
480cdf0e10cSrcweir 		if( !pBorderWidths[i] )
481cdf0e10cSrcweir 			pBorderWidths[i] = pAllBorderWidth;
482cdf0e10cSrcweir 		else
483cdf0e10cSrcweir 			pBorderWidths[i]->mnIndex = -1;
484cdf0e10cSrcweir 
485cdf0e10cSrcweir #ifdef XML_CHECK_UI_CONSTRAINS
486cdf0e10cSrcweir 		sal_Bool bHasBorder = sal_False;
487cdf0e10cSrcweir 		if( pBorders[i] )
488cdf0e10cSrcweir 		{
489cdf0e10cSrcweir 			table::BorderLine aBorderLine;
490cdf0e10cSrcweir 			pBorders[i]->maValue >>= aBorderLine;
491cdf0e10cSrcweir 
492cdf0e10cSrcweir  			if( pBorderWidths[i] )
493cdf0e10cSrcweir 			{
494cdf0e10cSrcweir 				table::BorderLine aBorderLineWidth;
495cdf0e10cSrcweir 				pBorderWidths[i]->maValue >>= aBorderLineWidth;
496cdf0e10cSrcweir 				aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
497cdf0e10cSrcweir 				aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
498cdf0e10cSrcweir 				aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
499cdf0e10cSrcweir 
500cdf0e10cSrcweir 				pBorders[i]->maValue <<= aBorderLine;
501cdf0e10cSrcweir 			}
502cdf0e10cSrcweir 			bHasBorder = (aBorderLine.OuterLineWidth +
503cdf0e10cSrcweir 						  aBorderLine.InnerLineWidth) > 0;
504cdf0e10cSrcweir 		}
505cdf0e10cSrcweir 		if( bHasBorder )
506cdf0e10cSrcweir 		{
507cdf0e10cSrcweir 			if( !pBorderDistances[i] )
508cdf0e10cSrcweir 			{
509cdf0e10cSrcweir #ifdef DBG_UTIL
510cdf0e10cSrcweir 				sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
511cdf0e10cSrcweir 										pBorders[i]->mnIndex + 5 );
512cdf0e10cSrcweir 				DBG_ASSERT( nTmp >= CTF_LEFTBORDERDISTANCE &&
513cdf0e10cSrcweir 							nTmp <= CTF_BOTTOMBORDERDISTANCE,
514cdf0e10cSrcweir 							"wrong property context id" );
515cdf0e10cSrcweir #endif
516cdf0e10cSrcweir 
517cdf0e10cSrcweir 				pNewBorderDistances[i] =
518cdf0e10cSrcweir 					new XMLPropertyState( pBorders[i]->mnIndex + 5 );
519cdf0e10cSrcweir 				pNewBorderDistances[i]->maValue <<= (sal_Int32)MIN_BORDER_DIST;
520cdf0e10cSrcweir 				pBorderDistances[i] = pNewBorderDistances[i];
521cdf0e10cSrcweir 			}
522cdf0e10cSrcweir 			else
523cdf0e10cSrcweir 			{
524cdf0e10cSrcweir 				sal_Int32 nDist;
525cdf0e10cSrcweir 				pBorderDistances[i]->maValue >>= nDist;
526cdf0e10cSrcweir 				if( nDist < MIN_BORDER_DIST )
527cdf0e10cSrcweir 					pBorderDistances[i]->maValue <<= (sal_Int32)MIN_BORDER_DIST;
528cdf0e10cSrcweir 			}
529cdf0e10cSrcweir 		}
530cdf0e10cSrcweir 		else
531cdf0e10cSrcweir 		{
532cdf0e10cSrcweir 			if( pBorderDistances[i] )
533cdf0e10cSrcweir 			{
534cdf0e10cSrcweir 				sal_Int32 nDist;
535cdf0e10cSrcweir 				pBorderDistances[i]->maValue >>= nDist;
536cdf0e10cSrcweir 				if( nDist > 0 )
537cdf0e10cSrcweir 					pBorderDistances[i]->maValue <<= (sal_Int32)0;
538cdf0e10cSrcweir 			}
539cdf0e10cSrcweir 		}
540cdf0e10cSrcweir #else
541cdf0e10cSrcweir 		if( pBorders[i] && pBorderWidths[i] )
542cdf0e10cSrcweir 		{
543cdf0e10cSrcweir 			table::BorderLine aBorderLine;
544cdf0e10cSrcweir 			pBorders[i]->maValue >>= aBorderLine;
545cdf0e10cSrcweir 
546cdf0e10cSrcweir 			table::BorderLine aBorderLineWidth;
547cdf0e10cSrcweir 			pBorderWidths[i]->maValue >>= aBorderLineWidth;
548cdf0e10cSrcweir 
549cdf0e10cSrcweir 			aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
550cdf0e10cSrcweir 			aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
551cdf0e10cSrcweir 			aBorderLine.LineDistance = aBorderLineWidth.LineDistance;
552cdf0e10cSrcweir 
553cdf0e10cSrcweir 			pBorders[i]->maValue <<= aBorderLine;
554cdf0e10cSrcweir 		}
555cdf0e10cSrcweir #endif
556cdf0e10cSrcweir 	}
557cdf0e10cSrcweir 
558cdf0e10cSrcweir     if (pAllParaMargin)
559cdf0e10cSrcweir     {
560cdf0e10cSrcweir         pAllParaMargin->mnIndex = -1;
561cdf0e10cSrcweir     }
562cdf0e10cSrcweir     if (pAllMargin)
563cdf0e10cSrcweir     {
564cdf0e10cSrcweir         pAllMargin->mnIndex = -1;
565cdf0e10cSrcweir     }
566cdf0e10cSrcweir 
567cdf0e10cSrcweir 	if( pAllBorderDistance )
568cdf0e10cSrcweir 		pAllBorderDistance->mnIndex = -1;
569cdf0e10cSrcweir 
570cdf0e10cSrcweir 	if( pAllBorder )
571cdf0e10cSrcweir 		pAllBorder->mnIndex = -1;
572cdf0e10cSrcweir 
573cdf0e10cSrcweir 	if( pAllBorderWidth )
574cdf0e10cSrcweir 		pAllBorderWidth->mnIndex = -1;
575cdf0e10cSrcweir 
576cdf0e10cSrcweir 	if( pVertOrient && pVertOrientRelAsChar )
577cdf0e10cSrcweir 	{
578cdf0e10cSrcweir 		sal_Int16 nVertOrient;
579cdf0e10cSrcweir 		pVertOrient->maValue >>= nVertOrient;
580cdf0e10cSrcweir 		sal_Int16 nVertOrientRel = 0;
581cdf0e10cSrcweir 		pVertOrientRelAsChar->maValue >>= nVertOrientRel;
582cdf0e10cSrcweir 		switch( nVertOrient )
583cdf0e10cSrcweir 		{
584cdf0e10cSrcweir 		case VertOrientation::TOP:
585cdf0e10cSrcweir 			nVertOrient = nVertOrientRel;
586cdf0e10cSrcweir 			break;
587cdf0e10cSrcweir 		case VertOrientation::CENTER:
588cdf0e10cSrcweir 			switch( nVertOrientRel )
589cdf0e10cSrcweir 			{
590cdf0e10cSrcweir 			case VertOrientation::CHAR_TOP:
591cdf0e10cSrcweir 				nVertOrient = VertOrientation::CHAR_CENTER;
592cdf0e10cSrcweir 				break;
593cdf0e10cSrcweir 			case VertOrientation::LINE_TOP:
594cdf0e10cSrcweir 				nVertOrient = VertOrientation::LINE_CENTER;
595cdf0e10cSrcweir 				break;
596cdf0e10cSrcweir 			}
597cdf0e10cSrcweir 			break;
598cdf0e10cSrcweir 		case VertOrientation::BOTTOM:
599cdf0e10cSrcweir 			switch( nVertOrientRel )
600cdf0e10cSrcweir 			{
601cdf0e10cSrcweir 			case VertOrientation::CHAR_TOP:
602cdf0e10cSrcweir 				nVertOrient = VertOrientation::CHAR_BOTTOM;
603cdf0e10cSrcweir 				break;
604cdf0e10cSrcweir 			case VertOrientation::LINE_TOP:
605cdf0e10cSrcweir 				nVertOrient = VertOrientation::LINE_BOTTOM;
606cdf0e10cSrcweir 				break;
607cdf0e10cSrcweir 			}
608cdf0e10cSrcweir 			break;
609cdf0e10cSrcweir 		}
610cdf0e10cSrcweir 		pVertOrient->maValue <<= nVertOrient;
611cdf0e10cSrcweir 		pVertOrientRelAsChar->mnIndex = -1;
612cdf0e10cSrcweir 	}
613cdf0e10cSrcweir 
614cdf0e10cSrcweir 	FontDefaultsCheck( pFontFamilyName,
615cdf0e10cSrcweir 					   pFontStyleName, pFontFamily, pFontPitch, pFontCharSet,
616cdf0e10cSrcweir 					   &pNewFontStyleName, &pNewFontFamily, &pNewFontPitch, &pNewFontCharSet );
617cdf0e10cSrcweir 
618cdf0e10cSrcweir 	FontDefaultsCheck( pFontFamilyNameCJK,
619cdf0e10cSrcweir 					   pFontStyleNameCJK, pFontFamilyCJK, pFontPitchCJK, pFontCharSetCJK,
620cdf0e10cSrcweir 					   &pNewFontStyleNameCJK, &pNewFontFamilyCJK, &pNewFontPitchCJK, &pNewFontCharSetCJK );
621cdf0e10cSrcweir 
622cdf0e10cSrcweir 	FontDefaultsCheck( pFontFamilyNameCTL,
623cdf0e10cSrcweir 					   pFontStyleNameCTL, pFontFamilyCTL, pFontPitchCTL, pFontCharSetCTL,
624cdf0e10cSrcweir 					   &pNewFontStyleNameCTL, &pNewFontFamilyCTL, &pNewFontPitchCTL, &pNewFontCharSetCTL );
625cdf0e10cSrcweir 
626cdf0e10cSrcweir     // #i5775# don't overwrite %transparency with binary transparency
627cdf0e10cSrcweir     if( ( pBackTransparency != NULL ) && ( pBackTransparent != NULL ) )
628cdf0e10cSrcweir     {
629cdf0e10cSrcweir         if( ! *(sal_Bool*)(pBackTransparent->maValue.getValue()) )
630cdf0e10cSrcweir             pBackTransparent->mnIndex = -1;
631cdf0e10cSrcweir     }
632cdf0e10cSrcweir 
633cdf0e10cSrcweir 
634cdf0e10cSrcweir 	// insert newly created properties. This inavlidates all iterators!
635cdf0e10cSrcweir     // Most of the pXXX variables in this method are iterators and will be
636cdf0e10cSrcweir     // invalidated!!!
637cdf0e10cSrcweir 
638cdf0e10cSrcweir 	if( pNewFontStyleName )
639cdf0e10cSrcweir 	{
640cdf0e10cSrcweir 		rProperties.push_back( *pNewFontStyleName );
641cdf0e10cSrcweir 		delete pNewFontStyleName;
642cdf0e10cSrcweir 	}
643cdf0e10cSrcweir 
644cdf0e10cSrcweir 	if( pNewFontFamily )
645cdf0e10cSrcweir 	{
646cdf0e10cSrcweir 		rProperties.push_back( *pNewFontFamily );
647cdf0e10cSrcweir 		delete pNewFontFamily;
648cdf0e10cSrcweir 	}
649cdf0e10cSrcweir 
650cdf0e10cSrcweir 	if( pNewFontPitch )
651cdf0e10cSrcweir 	{
652cdf0e10cSrcweir 		rProperties.push_back( *pNewFontPitch );
653cdf0e10cSrcweir 		delete pNewFontPitch;
654cdf0e10cSrcweir 	}
655cdf0e10cSrcweir 
656cdf0e10cSrcweir 	if( pNewFontCharSet )
657cdf0e10cSrcweir 	{
658cdf0e10cSrcweir 		rProperties.push_back( *pNewFontCharSet );
659cdf0e10cSrcweir 		delete pNewFontCharSet;
660cdf0e10cSrcweir 	}
661cdf0e10cSrcweir 
662cdf0e10cSrcweir 	if( pNewFontStyleNameCJK )
663cdf0e10cSrcweir 	{
664cdf0e10cSrcweir 		rProperties.push_back( *pNewFontStyleNameCJK );
665cdf0e10cSrcweir 		delete pNewFontStyleNameCJK;
666cdf0e10cSrcweir 	}
667cdf0e10cSrcweir 
668cdf0e10cSrcweir 	if( pNewFontFamilyCJK )
669cdf0e10cSrcweir 	{
670cdf0e10cSrcweir 		rProperties.push_back( *pNewFontFamilyCJK );
671cdf0e10cSrcweir 		delete pNewFontFamilyCJK;
672cdf0e10cSrcweir 	}
673cdf0e10cSrcweir 
674cdf0e10cSrcweir 	if( pNewFontPitchCJK )
675cdf0e10cSrcweir 	{
676cdf0e10cSrcweir 		rProperties.push_back( *pNewFontPitchCJK );
677cdf0e10cSrcweir 		delete pNewFontPitchCJK;
678cdf0e10cSrcweir 	}
679cdf0e10cSrcweir 
680cdf0e10cSrcweir 	if( pNewFontCharSetCJK )
681cdf0e10cSrcweir 	{
682cdf0e10cSrcweir 		rProperties.push_back( *pNewFontCharSetCJK );
683cdf0e10cSrcweir 		delete pNewFontCharSetCJK;
684cdf0e10cSrcweir 	}
685cdf0e10cSrcweir 
686cdf0e10cSrcweir 	if( pNewFontStyleNameCTL)
687cdf0e10cSrcweir 	{
688cdf0e10cSrcweir 		rProperties.push_back( *pNewFontStyleNameCTL );
689cdf0e10cSrcweir 		delete pNewFontStyleNameCTL;
690cdf0e10cSrcweir 	}
691cdf0e10cSrcweir 
692cdf0e10cSrcweir 	if( pNewFontFamilyCTL )
693cdf0e10cSrcweir 	{
694cdf0e10cSrcweir 		rProperties.push_back( *pNewFontFamilyCTL );
695cdf0e10cSrcweir 		delete pNewFontFamilyCTL;
696cdf0e10cSrcweir 	}
697cdf0e10cSrcweir 
698cdf0e10cSrcweir 	if( pNewFontPitchCTL )
699cdf0e10cSrcweir 	{
700cdf0e10cSrcweir 		rProperties.push_back( *pNewFontPitchCTL );
701cdf0e10cSrcweir 		delete pNewFontPitchCTL;
702cdf0e10cSrcweir 	}
703cdf0e10cSrcweir 
704cdf0e10cSrcweir 	if( pNewFontCharSetCTL )
705cdf0e10cSrcweir 	{
706cdf0e10cSrcweir 		rProperties.push_back( *pNewFontCharSetCTL );
707cdf0e10cSrcweir 		delete pNewFontCharSetCTL;
708cdf0e10cSrcweir 	}
709cdf0e10cSrcweir 
710cdf0e10cSrcweir     for (sal_uInt16 i=0; i<4; i++)
711cdf0e10cSrcweir     {
712cdf0e10cSrcweir         if (pNewParaMargins[i].get())
713cdf0e10cSrcweir         {
714cdf0e10cSrcweir             rProperties.push_back(*pNewParaMargins[i]);
715cdf0e10cSrcweir         }
716cdf0e10cSrcweir         if (pNewMargins[i].get())
717cdf0e10cSrcweir         {
718cdf0e10cSrcweir             rProperties.push_back(*pNewMargins[i]);
719cdf0e10cSrcweir         }
720cdf0e10cSrcweir 		if( pNewBorderDistances[i] )
721cdf0e10cSrcweir 		{
722cdf0e10cSrcweir 			rProperties.push_back( *pNewBorderDistances[i] );
723cdf0e10cSrcweir 			delete pNewBorderDistances[i];
724cdf0e10cSrcweir 		}
725cdf0e10cSrcweir 		if( pNewBorders[i] )
726cdf0e10cSrcweir 		{
727cdf0e10cSrcweir 			rProperties.push_back( *pNewBorders[i] );
728cdf0e10cSrcweir 			delete pNewBorders[i];
729cdf0e10cSrcweir 		}
730cdf0e10cSrcweir 	}
731cdf0e10cSrcweir 
732cdf0e10cSrcweir 	if( bHasAnyHeight )
733cdf0e10cSrcweir 	{
734cdf0e10cSrcweir 		if( nSizeTypeIndex == -2 )
735cdf0e10cSrcweir 		{
736cdf0e10cSrcweir 			const_cast < XMLTextImportPropertyMapper * > ( this )
737cdf0e10cSrcweir 				->nSizeTypeIndex  = -1;
738cdf0e10cSrcweir 			sal_Int32 nPropCount = getPropertySetMapper()->GetEntryCount();
739cdf0e10cSrcweir 			for( sal_Int32 j=0; j < nPropCount; j++ )
740cdf0e10cSrcweir 			{
741cdf0e10cSrcweir 				if( CTF_SIZETYPE == getPropertySetMapper()
742cdf0e10cSrcweir 						->GetEntryContextId( j ) )
743cdf0e10cSrcweir 				{
744cdf0e10cSrcweir 					const_cast < XMLTextImportPropertyMapper * > ( this )
745cdf0e10cSrcweir 						->nSizeTypeIndex = j;
746cdf0e10cSrcweir 					break;
747cdf0e10cSrcweir 				}
748cdf0e10cSrcweir 			}
749cdf0e10cSrcweir 		}
750cdf0e10cSrcweir 		if( nSizeTypeIndex != -1 )
751cdf0e10cSrcweir 		{
752cdf0e10cSrcweir 			XMLPropertyState aSizeTypeState( nSizeTypeIndex );
753cdf0e10cSrcweir 			aSizeTypeState.maValue <<= (sal_Int16)( bHasAnyMinHeight
754cdf0e10cSrcweir 														? SizeType::MIN
755cdf0e10cSrcweir 														: SizeType::FIX);
756cdf0e10cSrcweir 			rProperties.push_back( aSizeTypeState );
757cdf0e10cSrcweir 		}
758cdf0e10cSrcweir 	}
759cdf0e10cSrcweir 
760cdf0e10cSrcweir 	if( bHasAnyWidth )
761cdf0e10cSrcweir 	{
762cdf0e10cSrcweir 		if( nWidthTypeIndex == -2 )
763cdf0e10cSrcweir 		{
764cdf0e10cSrcweir 			const_cast < XMLTextImportPropertyMapper * > ( this )
765cdf0e10cSrcweir 				->nWidthTypeIndex  = -1;
766cdf0e10cSrcweir 			sal_Int32 nCount = getPropertySetMapper()->GetEntryCount();
767cdf0e10cSrcweir 			for( sal_Int32 j=0; j < nCount; j++ )
768cdf0e10cSrcweir 			{
769cdf0e10cSrcweir 				if( CTF_FRAMEWIDTH_TYPE	 == getPropertySetMapper()
770cdf0e10cSrcweir 						->GetEntryContextId( j ) )
771cdf0e10cSrcweir 				{
772cdf0e10cSrcweir 					const_cast < XMLTextImportPropertyMapper * > ( this )
773cdf0e10cSrcweir 						->nWidthTypeIndex = j;
774cdf0e10cSrcweir 					break;
775cdf0e10cSrcweir 				}
776cdf0e10cSrcweir 			}
777cdf0e10cSrcweir 		}
778cdf0e10cSrcweir 		if( nWidthTypeIndex != -1 )
779cdf0e10cSrcweir 		{
780cdf0e10cSrcweir 			XMLPropertyState aSizeTypeState( nWidthTypeIndex );
781cdf0e10cSrcweir 			aSizeTypeState.maValue <<= (sal_Int16)( bHasAnyMinWidth
782cdf0e10cSrcweir 														? SizeType::MIN
783cdf0e10cSrcweir 														: SizeType::FIX);
784cdf0e10cSrcweir 			rProperties.push_back( aSizeTypeState );
785cdf0e10cSrcweir 		}
786cdf0e10cSrcweir 	}
787cdf0e10cSrcweir 
788cdf0e10cSrcweir     // DO NOT USE ITERATORS/POINTERS INTO THE rProperties-VECTOR AFTER
789cdf0e10cSrcweir     // THIS LINE.  All iterators into the rProperties-vector, especially all
790cdf0e10cSrcweir     // pXXX-type variables set in the first switch statement of this method,
791cdf0e10cSrcweir     // may have been invalidated by the above push_back() calls!
792cdf0e10cSrcweir }
793cdf0e10cSrcweir 
794cdf0e10cSrcweir 
795