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