Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <com/sun/star/table/BorderLine2.hpp>
21 :
22 : #include "txtexppr.hxx"
23 :
24 : #include <com/sun/star/text/SizeType.hpp>
25 : #include <com/sun/star/text/WrapTextMode.hpp>
26 : #include <com/sun/star/text/TextContentAnchorType.hpp>
27 : #include <com/sun/star/awt/FontUnderline.hpp>
28 : #include <com/sun/star/text/XChapterNumberingSupplier.hpp>
29 :
30 : #include <tools/debug.hxx>
31 :
32 : #include <xmloff/txtprmap.hxx>
33 : #include <xmloff/xmlexp.hxx>
34 : #include "XMLSectionFootnoteConfigExport.hxx"
35 :
36 :
37 : using namespace ::com::sun::star;
38 : using namespace ::com::sun::star::uno;
39 : using namespace ::com::sun::star::style;
40 : using namespace ::com::sun::star::beans;
41 : using namespace ::com::sun::star::text;
42 :
43 0 : void XMLTextExportPropertySetMapper::handleElementItem(
44 : SvXMLExport& rExp,
45 : const XMLPropertyState& rProperty,
46 : sal_uInt16 nFlags,
47 : const ::std::vector< XMLPropertyState > *pProperties,
48 : sal_uInt32 nIdx ) const
49 : {
50 : XMLTextExportPropertySetMapper *pThis =
51 0 : ((XMLTextExportPropertySetMapper *)this);
52 :
53 0 : switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
54 : {
55 : case CTF_DROPCAPFORMAT:
56 : pThis->maDropCapExport.exportXML( rProperty.maValue, bDropWholeWord,
57 0 : sDropCharStyle );
58 0 : pThis->bDropWholeWord = sal_False;
59 0 : pThis->sDropCharStyle = OUString();
60 0 : break;
61 :
62 : case CTF_TABSTOP:
63 0 : pThis->maTabStopExport.Export( rProperty.maValue );
64 0 : break;
65 :
66 : case CTF_TEXTCOLUMNS:
67 0 : pThis->maTextColumnsExport.exportXML( rProperty.maValue );
68 0 : break;
69 :
70 : case CTF_BACKGROUND_URL:
71 : {
72 : DBG_ASSERT( pProperties && nIdx >= 3,
73 : "property vector missing" );
74 0 : const Any *pPos = 0, *pFilter = 0, *pTrans = 0;
75 0 : if( pProperties && nIdx >= 3 )
76 : {
77 0 : const XMLPropertyState& rTrans = (*pProperties)[nIdx-3];
78 : // #99657# transparency may be there, but doesn't have to be.
79 : // If it's there, it must be in the right position.
80 0 : if( CTF_BACKGROUND_TRANSPARENCY == getPropertySetMapper()
81 0 : ->GetEntryContextId( rTrans.mnIndex ) )
82 0 : pTrans = &rTrans.maValue;
83 :
84 0 : const XMLPropertyState& rPos = (*pProperties)[nIdx-2];
85 : DBG_ASSERT( CTF_BACKGROUND_POS == getPropertySetMapper()
86 : ->GetEntryContextId( rPos.mnIndex ),
87 : "invalid property map: pos expected" );
88 0 : if( CTF_BACKGROUND_POS == getPropertySetMapper()
89 0 : ->GetEntryContextId( rPos.mnIndex ) )
90 0 : pPos = &rPos.maValue;
91 :
92 0 : const XMLPropertyState& rFilter = (*pProperties)[nIdx-1];
93 : DBG_ASSERT( CTF_BACKGROUND_FILTER == getPropertySetMapper()
94 : ->GetEntryContextId( rFilter.mnIndex ),
95 : "invalid property map: filter expected" );
96 0 : if( CTF_BACKGROUND_FILTER == getPropertySetMapper()
97 0 : ->GetEntryContextId( rFilter.mnIndex ) )
98 0 : pFilter = &rFilter.maValue;
99 : }
100 0 : sal_uInt32 nPropIndex = rProperty.mnIndex;
101 : pThis->maBackgroundImageExport.exportXML(
102 : rProperty.maValue, pPos, pFilter, pTrans,
103 0 : getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
104 0 : getPropertySetMapper()->GetEntryXMLName( nPropIndex ) );
105 : }
106 0 : break;
107 :
108 : case CTF_SECTION_FOOTNOTE_END:
109 : XMLSectionFootnoteConfigExport::exportXML(rExp, sal_False,
110 : pProperties, nIdx,
111 0 : getPropertySetMapper());
112 0 : break;
113 :
114 : case CTF_SECTION_ENDNOTE_END:
115 : XMLSectionFootnoteConfigExport::exportXML(rExp, sal_True,
116 : pProperties, nIdx,
117 0 : getPropertySetMapper());
118 0 : break;
119 :
120 : default:
121 0 : SvXMLExportPropertyMapper::handleElementItem( rExp, rProperty, nFlags, pProperties, nIdx );
122 0 : break;
123 : }
124 0 : }
125 :
126 0 : void XMLTextExportPropertySetMapper::handleSpecialItem(
127 : SvXMLAttributeList& rAttrList,
128 : const XMLPropertyState& rProperty,
129 : const SvXMLUnitConverter& rUnitConverter,
130 : const SvXMLNamespaceMap& rNamespaceMap,
131 : const ::std::vector< XMLPropertyState > *pProperties,
132 : sal_uInt32 nIdx ) const
133 : {
134 : XMLTextExportPropertySetMapper *pThis =
135 0 : ((XMLTextExportPropertySetMapper *)this);
136 :
137 0 : switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
138 : {
139 : case CTF_DROPCAPWHOLEWORD:
140 : DBG_ASSERT( !bDropWholeWord, "drop whole word is set already!" );
141 0 : pThis->bDropWholeWord = *(sal_Bool *)rProperty.maValue.getValue();
142 0 : break;
143 : case CTF_DROPCAPCHARSTYLE:
144 : DBG_ASSERT( sDropCharStyle.isEmpty(), "drop char style is set already!" );
145 0 : rProperty.maValue >>= pThis->sDropCharStyle;
146 0 : break;
147 : case CTF_NUMBERINGSTYLENAME:
148 : case CTF_PAGEDESCNAME:
149 : case CTF_OLDTEXTBACKGROUND:
150 : case CTF_BACKGROUND_POS:
151 : case CTF_BACKGROUND_FILTER:
152 : case CTF_BACKGROUND_TRANSPARENCY:
153 : case CTF_SECTION_FOOTNOTE_NUM_OWN:
154 : case CTF_SECTION_FOOTNOTE_NUM_RESTART:
155 : case CTF_SECTION_FOOTNOTE_NUM_RESTART_AT:
156 : case CTF_SECTION_FOOTNOTE_NUM_TYPE:
157 : case CTF_SECTION_FOOTNOTE_NUM_PREFIX:
158 : case CTF_SECTION_FOOTNOTE_NUM_SUFFIX:
159 : case CTF_SECTION_ENDNOTE_NUM_OWN:
160 : case CTF_SECTION_ENDNOTE_NUM_RESTART:
161 : case CTF_SECTION_ENDNOTE_NUM_RESTART_AT:
162 : case CTF_SECTION_ENDNOTE_NUM_TYPE:
163 : case CTF_SECTION_ENDNOTE_NUM_PREFIX:
164 : case CTF_SECTION_ENDNOTE_NUM_SUFFIX:
165 : case CTF_DEFAULT_OUTLINE_LEVEL:
166 : case CTF_OLD_FLOW_WITH_TEXT:
167 : // There's nothing to do here!
168 0 : break;
169 : default:
170 0 : SvXMLExportPropertyMapper::handleSpecialItem(rAttrList, rProperty, rUnitConverter, rNamespaceMap, pProperties, nIdx );
171 0 : break;
172 : }
173 0 : }
174 :
175 0 : XMLTextExportPropertySetMapper::XMLTextExportPropertySetMapper(
176 : const UniReference< XMLPropertySetMapper >& rMapper,
177 : SvXMLExport& rExp ) :
178 : SvXMLExportPropertyMapper( rMapper ),
179 : rExport( rExp ),
180 : bDropWholeWord( sal_False ),
181 : maDropCapExport( rExp ),
182 : maTabStopExport( rExp ),
183 : maTextColumnsExport( rExp ),
184 0 : maBackgroundImageExport( rExp )
185 : {
186 0 : }
187 :
188 0 : XMLTextExportPropertySetMapper::~XMLTextExportPropertySetMapper()
189 : {
190 0 : }
191 :
192 0 : void XMLTextExportPropertySetMapper::ContextFontFilter(
193 : bool bEnableFoFontFamily,
194 : XMLPropertyState *pFontNameState,
195 : XMLPropertyState *pFontFamilyNameState,
196 : XMLPropertyState *pFontStyleNameState,
197 : XMLPropertyState *pFontFamilyState,
198 : XMLPropertyState *pFontPitchState,
199 : XMLPropertyState *pFontCharsetState ) const
200 : {
201 0 : OUString sFamilyName;
202 0 : OUString sStyleName;
203 0 : FontFamily nFamily = FAMILY_DONTKNOW;
204 0 : FontPitch nPitch = PITCH_DONTKNOW;
205 0 : rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
206 :
207 0 : OUString sTmp;
208 0 : if( pFontFamilyNameState && (pFontFamilyNameState->maValue >>= sTmp ) )
209 0 : sFamilyName = sTmp;
210 0 : if( pFontStyleNameState && (pFontStyleNameState->maValue >>= sTmp ) )
211 0 : sStyleName = sTmp;
212 :
213 0 : sal_Int16 nTmp = sal_Int16();
214 0 : if( pFontFamilyState && (pFontFamilyState->maValue >>= nTmp ) )
215 0 : nFamily = static_cast< FontFamily >( nTmp );
216 0 : if( pFontPitchState && (pFontPitchState->maValue >>= nTmp ) )
217 0 : nPitch = static_cast< FontPitch >( nTmp );
218 0 : if( pFontCharsetState && (pFontCharsetState->maValue >>= nTmp ) )
219 0 : eEnc = (rtl_TextEncoding)nTmp;
220 :
221 : //Resolves: fdo#67665 The purpose here appears to be to replace
222 : //FontFamilyName and FontStyleName etc with a single FontName property. The
223 : //problem is that repeated calls to here will first set
224 : //pFontFamilyNameState->mnIndex to -1 to indicate it is disabled, so the
225 : //next time pFontFamilyNameState is not passed here at all, which gives an
226 : //empty sFamilyName resulting in disabling pFontNameState->mnIndex to -1.
227 : //That doesn't seem right to me.
228 :
229 : //So assuming that the main purpose is just to convert the properties in
230 : //the main when we can, and to leave them alone when we can't. And with a
231 : //secondary purpose to filter out empty font properties, then is would
232 : //appear to make sense to base attempting the conversion if we have
233 : //both of the major facts of the font description
234 :
235 : //An alternative solution is to *not* fill the FontAutoStylePool with
236 : //every font in the document, but to partition the fonts into the
237 : //hard-attribute fonts which go into that pool and the style-attribute
238 : //fonts which go into some additional pool which get merged just for
239 : //the purposes of writing the embedded fonts but are not queried by
240 : //"Find" which restores the original logic.
241 0 : if (pFontFamilyNameState || pFontStyleNameState)
242 : {
243 0 : OUString sName( ((SvXMLExport&)GetExport()).GetFontAutoStylePool()->Find(
244 0 : sFamilyName, sStyleName, nFamily, nPitch, eEnc ) );
245 0 : if (!sName.isEmpty())
246 : {
247 0 : pFontNameState->maValue <<= sName;
248 : //Resolves: fdo#68431 style:font-name unrecognized by LibreOffice
249 : //<= 4.1 in styles (but recognized in autostyles) so add
250 : //fo:font-family, etc
251 0 : if (!bEnableFoFontFamily)
252 : {
253 0 : if( pFontFamilyNameState )
254 0 : pFontFamilyNameState->mnIndex = -1;
255 0 : if( pFontStyleNameState )
256 0 : pFontStyleNameState->mnIndex = -1;
257 0 : if( pFontFamilyState )
258 0 : pFontFamilyState->mnIndex = -1;
259 0 : if( pFontPitchState )
260 0 : pFontPitchState->mnIndex = -1;
261 0 : if( pFontCharsetState )
262 0 : pFontCharsetState->mnIndex = -1;
263 : }
264 : }
265 : else
266 : {
267 0 : pFontNameState->mnIndex = -1;
268 0 : }
269 : }
270 :
271 0 : if( pFontFamilyNameState && sFamilyName.isEmpty() )
272 : {
273 0 : pFontFamilyNameState->mnIndex = -1;
274 : }
275 :
276 0 : if( pFontStyleNameState && sStyleName.isEmpty() )
277 : {
278 0 : pFontStyleNameState->mnIndex = -1;
279 0 : }
280 0 : }
281 :
282 0 : void XMLTextExportPropertySetMapper::ContextFontHeightFilter(
283 : XMLPropertyState* pCharHeightState,
284 : XMLPropertyState* pCharPropHeightState,
285 : XMLPropertyState* pCharDiffHeightState ) const
286 : {
287 0 : if( pCharPropHeightState )
288 : {
289 0 : sal_Int32 nTemp = 0;
290 0 : pCharPropHeightState->maValue >>= nTemp;
291 0 : if( nTemp == 100 )
292 : {
293 0 : pCharPropHeightState->mnIndex = -1;
294 0 : pCharPropHeightState->maValue.clear();
295 : }
296 : else
297 : {
298 0 : pCharHeightState->mnIndex = -1;
299 0 : pCharHeightState->maValue.clear();
300 : }
301 : }
302 0 : if( pCharDiffHeightState )
303 : {
304 0 : float nTemp = 0;
305 0 : pCharDiffHeightState->maValue >>= nTemp;
306 0 : if( nTemp == 0. )
307 : {
308 0 : pCharDiffHeightState->mnIndex = -1;
309 0 : pCharDiffHeightState->maValue.clear();
310 : }
311 : else
312 : {
313 0 : pCharHeightState->mnIndex = -1;
314 0 : pCharHeightState->maValue.clear();
315 : }
316 : }
317 :
318 0 : }
319 :
320 : namespace {
321 :
322 : // helper method; implementation below
323 : static bool lcl_IsOutlineStyle(const SvXMLExport&, const OUString&);
324 :
325 : static void
326 0 : lcl_checkMultiProperty(XMLPropertyState *const pState,
327 : XMLPropertyState *const pRelState)
328 : {
329 0 : if (pState && pRelState)
330 : {
331 0 : sal_Int32 nTemp = 0;
332 0 : pRelState->maValue >>= nTemp;
333 0 : if (100 == nTemp)
334 : {
335 0 : pRelState->mnIndex = -1;
336 0 : pRelState->maValue.clear();
337 : }
338 : else
339 : {
340 0 : pState->mnIndex = -1;
341 0 : pState->maValue.clear();
342 : }
343 : }
344 0 : }
345 :
346 : /**
347 : * Filter context of paragraph and character borders.
348 : * Compress border attriubtes. If one of groupable attributes (border type, border width, padding)
349 : * is equal for all four side then just one general attribute will be exported.
350 : **/
351 0 : static void lcl_FilterBorders(
352 : XMLPropertyState* pAllBorderWidthState, XMLPropertyState* pLeftBorderWidthState,
353 : XMLPropertyState* pRightBorderWidthState, XMLPropertyState* pTopBorderWidthState,
354 : XMLPropertyState* pBottomBorderWidthState, XMLPropertyState* pAllBorderDistanceState,
355 : XMLPropertyState* pLeftBorderDistanceState, XMLPropertyState* pRightBorderDistanceState,
356 : XMLPropertyState* pTopBorderDistanceState, XMLPropertyState* pBottomBorderDistanceState,
357 : XMLPropertyState* pAllBorderState, XMLPropertyState* pLeftBorderState,
358 : XMLPropertyState* pRightBorderState,XMLPropertyState* pTopBorderState,
359 : XMLPropertyState* pBottomBorderState )
360 : {
361 0 : if( pAllBorderWidthState )
362 : {
363 0 : if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState )
364 : {
365 0 : table::BorderLine2 aLeft, aRight, aTop, aBottom;
366 :
367 0 : pLeftBorderWidthState->maValue >>= aLeft;
368 0 : pRightBorderWidthState->maValue >>= aRight;
369 0 : pTopBorderWidthState->maValue >>= aTop;
370 0 : pBottomBorderWidthState->maValue >>= aBottom;
371 0 : if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
372 0 : aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
373 0 : aLeft.LineStyle == aRight.LineStyle &&
374 0 : aLeft.LineWidth == aRight.LineWidth &&
375 0 : aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
376 0 : aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
377 0 : aLeft.LineStyle == aTop.LineStyle &&
378 0 : aLeft.LineWidth == aTop.LineWidth &&
379 0 : aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
380 0 : aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance &&
381 0 : aLeft.LineStyle == aBottom.LineStyle &&
382 0 : aLeft.LineWidth == aBottom.LineWidth )
383 : {
384 0 : pLeftBorderWidthState->mnIndex = -1;
385 0 : pLeftBorderWidthState->maValue.clear();
386 0 : pRightBorderWidthState->mnIndex = -1;
387 0 : pRightBorderWidthState->maValue.clear();
388 0 : pTopBorderWidthState->mnIndex = -1;
389 0 : pTopBorderWidthState->maValue.clear();
390 0 : pBottomBorderWidthState->mnIndex = -1;
391 0 : pBottomBorderWidthState->maValue.clear();
392 : }
393 : else
394 : {
395 0 : pAllBorderWidthState->mnIndex = -1;
396 0 : pAllBorderWidthState->maValue.clear();
397 0 : }
398 : }
399 : else
400 : {
401 0 : pAllBorderWidthState->mnIndex = -1;
402 0 : pAllBorderWidthState->maValue.clear();
403 : }
404 : }
405 :
406 0 : if( pAllBorderDistanceState )
407 : {
408 0 : if( pLeftBorderDistanceState && pRightBorderDistanceState && pTopBorderDistanceState && pBottomBorderDistanceState )
409 : {
410 0 : sal_Int32 aLeft = 0, aRight = 0, aTop = 0, aBottom = 0;
411 :
412 0 : pLeftBorderDistanceState->maValue >>= aLeft;
413 0 : pRightBorderDistanceState->maValue >>= aRight;
414 0 : pTopBorderDistanceState->maValue >>= aTop;
415 0 : pBottomBorderDistanceState->maValue >>= aBottom;
416 0 : if( aLeft == aRight && aLeft == aTop && aLeft == aBottom )
417 : {
418 0 : pLeftBorderDistanceState->mnIndex = -1;
419 0 : pLeftBorderDistanceState->maValue.clear();
420 0 : pRightBorderDistanceState->mnIndex = -1;
421 0 : pRightBorderDistanceState->maValue.clear();
422 0 : pTopBorderDistanceState->mnIndex = -1;
423 0 : pTopBorderDistanceState->maValue.clear();
424 0 : pBottomBorderDistanceState->mnIndex = -1;
425 0 : pBottomBorderDistanceState->maValue.clear();
426 : }
427 : else
428 : {
429 0 : pAllBorderDistanceState->mnIndex = -1;
430 0 : pAllBorderDistanceState->maValue.clear();
431 0 : }
432 : }
433 : else
434 : {
435 0 : pAllBorderDistanceState->mnIndex = -1;
436 0 : pAllBorderDistanceState->maValue.clear();
437 : }
438 : }
439 :
440 0 : if( pAllBorderState )
441 : {
442 0 : if( pLeftBorderState && pRightBorderState && pTopBorderState && pBottomBorderState )
443 : {
444 0 : table::BorderLine2 aLeft, aRight, aTop, aBottom;
445 :
446 0 : pLeftBorderState->maValue >>= aLeft;
447 0 : pRightBorderState->maValue >>= aRight;
448 0 : pTopBorderState->maValue >>= aTop;
449 0 : pBottomBorderState->maValue >>= aBottom;
450 0 : if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
451 0 : aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
452 0 : aLeft.LineStyle == aRight.LineStyle &&
453 0 : aLeft.LineWidth == aRight.LineWidth &&
454 0 : aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
455 0 : aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
456 0 : aLeft.LineStyle == aTop.LineStyle &&
457 0 : aLeft.LineWidth == aTop.LineWidth &&
458 0 : aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
459 0 : aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance &&
460 0 : aLeft.LineWidth == aBottom.LineWidth &&
461 0 : aLeft.LineStyle == aBottom.LineStyle )
462 : {
463 0 : pLeftBorderState->mnIndex = -1;
464 0 : pLeftBorderState->maValue.clear();
465 0 : pRightBorderState->mnIndex = -1;
466 0 : pRightBorderState->maValue.clear();
467 0 : pTopBorderState->mnIndex = -1;
468 0 : pTopBorderState->maValue.clear();
469 0 : pBottomBorderState->mnIndex = -1;
470 0 : pBottomBorderState->maValue.clear();
471 : }
472 : else
473 : {
474 0 : pAllBorderState->mnIndex = -1;
475 0 : pAllBorderState->maValue.clear();
476 0 : }
477 : }
478 : else
479 : {
480 0 : pAllBorderState->mnIndex = -1;
481 0 : pAllBorderState->maValue.clear();
482 : }
483 : }
484 0 : }
485 :
486 : }
487 :
488 0 : void XMLTextExportPropertySetMapper::ContextFilter(
489 : bool bEnableFoFontFamily,
490 : ::std::vector< XMLPropertyState >& rProperties,
491 : Reference< XPropertySet > rPropSet ) const
492 : {
493 : // filter font
494 0 : XMLPropertyState *pFontNameState = 0;
495 0 : XMLPropertyState *pFontFamilyNameState = 0;
496 0 : XMLPropertyState *pFontStyleNameState = 0;
497 0 : XMLPropertyState *pFontFamilyState = 0;
498 0 : XMLPropertyState *pFontPitchState = 0;
499 0 : XMLPropertyState *pFontCharsetState = 0;
500 0 : XMLPropertyState *pFontNameCJKState = 0;
501 0 : XMLPropertyState *pFontFamilyNameCJKState = 0;
502 0 : XMLPropertyState *pFontStyleNameCJKState = 0;
503 0 : XMLPropertyState *pFontFamilyCJKState = 0;
504 0 : XMLPropertyState *pFontPitchCJKState = 0;
505 0 : XMLPropertyState *pFontCharsetCJKState = 0;
506 0 : XMLPropertyState *pFontNameCTLState = 0;
507 0 : XMLPropertyState *pFontFamilyNameCTLState = 0;
508 0 : XMLPropertyState *pFontStyleNameCTLState = 0;
509 0 : XMLPropertyState *pFontFamilyCTLState = 0;
510 0 : XMLPropertyState *pFontPitchCTLState = 0;
511 0 : XMLPropertyState *pFontCharsetCTLState = 0;
512 :
513 : // filter char height point/percent
514 0 : XMLPropertyState* pCharHeightState = NULL;
515 0 : XMLPropertyState* pCharPropHeightState = NULL;
516 0 : XMLPropertyState* pCharDiffHeightState = NULL;
517 0 : XMLPropertyState* pCharHeightCJKState = NULL;
518 0 : XMLPropertyState* pCharPropHeightCJKState = NULL;
519 0 : XMLPropertyState* pCharDiffHeightCJKState = NULL;
520 0 : XMLPropertyState* pCharHeightCTLState = NULL;
521 0 : XMLPropertyState* pCharPropHeightCTLState = NULL;
522 0 : XMLPropertyState* pCharDiffHeightCTLState = NULL;
523 :
524 : // filter left margin measure/percent
525 0 : XMLPropertyState* pParaLeftMarginState = NULL;
526 0 : XMLPropertyState* pParaLeftMarginRelState = NULL;
527 :
528 : // filter right margin measure/percent
529 0 : XMLPropertyState* pParaRightMarginState = NULL;
530 0 : XMLPropertyState* pParaRightMarginRelState = NULL;
531 :
532 : // filter first line indent measure/percent
533 0 : XMLPropertyState* pParaFirstLineState = NULL;
534 0 : XMLPropertyState* pParaFirstLineRelState = NULL;
535 :
536 : // filter ParaTopMargin/Relative
537 0 : XMLPropertyState* pParaTopMarginState = NULL;
538 0 : XMLPropertyState* pParaTopMarginRelState = NULL;
539 :
540 : // filter ParaTopMargin/Relative
541 0 : XMLPropertyState* pParaBottomMarginState = NULL;
542 0 : XMLPropertyState* pParaBottomMarginRelState = NULL;
543 :
544 : // filter (Left|Right|Top|Bottom|)BorderWidth
545 0 : XMLPropertyState* pAllBorderWidthState = NULL;
546 0 : XMLPropertyState* pLeftBorderWidthState = NULL;
547 0 : XMLPropertyState* pRightBorderWidthState = NULL;
548 0 : XMLPropertyState* pTopBorderWidthState = NULL;
549 0 : XMLPropertyState* pBottomBorderWidthState = NULL;
550 :
551 : // filter (Left|Right|Top|)BorderDistance
552 0 : XMLPropertyState* pAllBorderDistanceState = NULL;
553 0 : XMLPropertyState* pLeftBorderDistanceState = NULL;
554 0 : XMLPropertyState* pRightBorderDistanceState = NULL;
555 0 : XMLPropertyState* pTopBorderDistanceState = NULL;
556 0 : XMLPropertyState* pBottomBorderDistanceState = NULL;
557 :
558 : // filter (Left|Right|Top|Bottom|)Border
559 0 : XMLPropertyState* pAllBorderState = NULL;
560 0 : XMLPropertyState* pLeftBorderState = NULL;
561 0 : XMLPropertyState* pRightBorderState = NULL;
562 0 : XMLPropertyState* pTopBorderState = NULL;
563 0 : XMLPropertyState* pBottomBorderState = NULL;
564 :
565 : // filter Char(Left|Right|Top|Bottom|)BorderWidth
566 0 : XMLPropertyState* pCharAllBorderWidthState = NULL;
567 0 : XMLPropertyState* pCharLeftBorderWidthState = NULL;
568 0 : XMLPropertyState* pCharRightBorderWidthState = NULL;
569 0 : XMLPropertyState* pCharTopBorderWidthState = NULL;
570 0 : XMLPropertyState* pCharBottomBorderWidthState = NULL;
571 :
572 : // filter Char(Left|Right|Top|)BorderDistance
573 0 : XMLPropertyState* pCharAllBorderDistanceState = NULL;
574 0 : XMLPropertyState* pCharLeftBorderDistanceState = NULL;
575 0 : XMLPropertyState* pCharRightBorderDistanceState = NULL;
576 0 : XMLPropertyState* pCharTopBorderDistanceState = NULL;
577 0 : XMLPropertyState* pCharBottomBorderDistanceState = NULL;
578 :
579 : // filter Char(Left|Right|Top|Bottom|)Border
580 0 : XMLPropertyState* pCharAllBorderState = NULL;
581 0 : XMLPropertyState* pCharLeftBorderState = NULL;
582 0 : XMLPropertyState* pCharRightBorderState = NULL;
583 0 : XMLPropertyState* pCharTopBorderState = NULL;
584 0 : XMLPropertyState* pCharBottomBorderState = NULL;
585 :
586 : // filter height properties
587 0 : XMLPropertyState* pHeightMinAbsState = NULL;
588 0 : XMLPropertyState* pHeightMinRelState = NULL;
589 0 : XMLPropertyState* pHeightAbsState = NULL;
590 0 : XMLPropertyState* pHeightRelState = NULL;
591 0 : XMLPropertyState* pSizeTypeState = NULL;
592 :
593 : // filter width properties
594 0 : XMLPropertyState* pWidthMinAbsState = NULL;
595 0 : XMLPropertyState* pWidthMinRelState = NULL;
596 0 : XMLPropertyState* pWidthAbsState = NULL;
597 0 : XMLPropertyState* pWidthRelState = NULL;
598 0 : XMLPropertyState* pWidthTypeState = NULL;
599 :
600 : // wrap
601 0 : XMLPropertyState* pWrapState = NULL;
602 0 : XMLPropertyState* pWrapContourState = NULL;
603 0 : XMLPropertyState* pWrapContourModeState = NULL;
604 0 : XMLPropertyState* pWrapParagraphOnlyState = NULL;
605 :
606 : // anchor
607 0 : XMLPropertyState* pAnchorTypeState = NULL;
608 :
609 : // horizontal position and relation
610 0 : XMLPropertyState* pHoriOrientState = NULL;
611 0 : XMLPropertyState* pHoriOrientMirroredState = NULL;
612 0 : XMLPropertyState* pHoriOrientRelState = NULL;
613 0 : XMLPropertyState* pHoriOrientRelFrameState = NULL;
614 0 : XMLPropertyState* pHoriOrientMirrorState = NULL;
615 : // Horizontal position and relation for shapes (#i28749#)
616 0 : XMLPropertyState* pShapeHoriOrientState = NULL;
617 0 : XMLPropertyState* pShapeHoriOrientMirroredState = NULL;
618 0 : XMLPropertyState* pShapeHoriOrientRelState = NULL;
619 0 : XMLPropertyState* pShapeHoriOrientRelFrameState = NULL;
620 0 : XMLPropertyState* pShapeHoriOrientMirrorState = NULL;
621 :
622 : // vertical position and relation
623 0 : XMLPropertyState* pVertOrientState = NULL;
624 0 : XMLPropertyState* pVertOrientAtCharState = NULL;
625 0 : XMLPropertyState* pVertOrientRelState = NULL;
626 0 : XMLPropertyState* pVertOrientRelPageState = NULL;
627 0 : XMLPropertyState* pVertOrientRelFrameState = NULL;
628 0 : XMLPropertyState* pVertOrientRelAsCharState = NULL;
629 0 : XMLPropertyState* pRelWidthRel = NULL;
630 0 : XMLPropertyState* pRelHeightRel = NULL;
631 :
632 : // Vertical position and relation for shapes (#i28749#)
633 0 : XMLPropertyState* pShapeVertOrientState = NULL;
634 0 : XMLPropertyState* pShapeVertOrientAtCharState = NULL;
635 0 : XMLPropertyState* pShapeVertOrientRelState = NULL;
636 0 : XMLPropertyState* pShapeVertOrientRelPageState = NULL;
637 0 : XMLPropertyState* pShapeVertOrientRelFrameState = NULL;
638 :
639 : // filter underline color
640 0 : XMLPropertyState* pUnderlineState = NULL;
641 0 : XMLPropertyState* pUnderlineColorState = NULL;
642 0 : XMLPropertyState* pUnderlineHasColorState = NULL;
643 :
644 : // filter list style name
645 0 : XMLPropertyState* pListStyleName = NULL;
646 :
647 : // filter fo:clip
648 0 : XMLPropertyState* pClip11State = NULL;
649 0 : XMLPropertyState* pClipState = NULL;
650 :
651 : // filter fo:margin
652 0 : XMLPropertyState* pAllParaMarginRel = NULL;
653 0 : XMLPropertyState* pAllParaMargin = NULL;
654 0 : XMLPropertyState* pAllMargin = NULL;
655 :
656 : //UUUU
657 0 : XMLPropertyState* pRepeatOffsetX = NULL;
658 0 : XMLPropertyState* pRepeatOffsetY = NULL;
659 :
660 0 : sal_Bool bNeedsAnchor = sal_False;
661 :
662 0 : for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
663 0 : aIter != rProperties.end();
664 : ++aIter )
665 : {
666 0 : XMLPropertyState *propertie = &(*aIter);
667 0 : if( propertie->mnIndex == -1 )
668 0 : continue;
669 :
670 0 : switch( getPropertySetMapper()->GetEntryContextId( propertie->mnIndex ) )
671 : {
672 0 : case CTF_CHARHEIGHT: pCharHeightState = propertie; break;
673 0 : case CTF_CHARHEIGHT_REL: pCharPropHeightState = propertie; break;
674 0 : case CTF_CHARHEIGHT_DIFF: pCharDiffHeightState = propertie; break;
675 0 : case CTF_CHARHEIGHT_CJK: pCharHeightCJKState = propertie; break;
676 0 : case CTF_CHARHEIGHT_REL_CJK: pCharPropHeightCJKState = propertie; break;
677 0 : case CTF_CHARHEIGHT_DIFF_CJK: pCharDiffHeightCJKState = propertie; break;
678 0 : case CTF_CHARHEIGHT_CTL: pCharHeightCTLState = propertie; break;
679 0 : case CTF_CHARHEIGHT_REL_CTL: pCharPropHeightCTLState = propertie; break;
680 0 : case CTF_CHARHEIGHT_DIFF_CTL: pCharDiffHeightCTLState = propertie; break;
681 0 : case CTF_PARALEFTMARGIN: pParaLeftMarginState = propertie; break;
682 0 : case CTF_PARALEFTMARGIN_REL: pParaLeftMarginRelState = propertie; break;
683 0 : case CTF_PARARIGHTMARGIN: pParaRightMarginState = propertie; break;
684 0 : case CTF_PARARIGHTMARGIN_REL: pParaRightMarginRelState = propertie; break;
685 0 : case CTF_PARAFIRSTLINE: pParaFirstLineState = propertie; break;
686 0 : case CTF_PARAFIRSTLINE_REL: pParaFirstLineRelState = propertie; break;
687 0 : case CTF_PARATOPMARGIN: pParaTopMarginState = propertie; break;
688 0 : case CTF_PARATOPMARGIN_REL: pParaTopMarginRelState = propertie; break;
689 0 : case CTF_PARABOTTOMMARGIN: pParaBottomMarginState = propertie; break;
690 0 : case CTF_PARABOTTOMMARGIN_REL: pParaBottomMarginRelState = propertie; break;
691 :
692 0 : case CTF_ALLBORDERWIDTH: pAllBorderWidthState = propertie; break;
693 0 : case CTF_LEFTBORDERWIDTH: pLeftBorderWidthState = propertie; break;
694 0 : case CTF_RIGHTBORDERWIDTH: pRightBorderWidthState = propertie; break;
695 0 : case CTF_TOPBORDERWIDTH: pTopBorderWidthState = propertie; break;
696 0 : case CTF_BOTTOMBORDERWIDTH: pBottomBorderWidthState = propertie; break;
697 0 : case CTF_ALLBORDERDISTANCE: pAllBorderDistanceState = propertie; break;
698 0 : case CTF_LEFTBORDERDISTANCE: pLeftBorderDistanceState = propertie; break;
699 0 : case CTF_RIGHTBORDERDISTANCE: pRightBorderDistanceState = propertie; break;
700 0 : case CTF_TOPBORDERDISTANCE: pTopBorderDistanceState = propertie; break;
701 0 : case CTF_BOTTOMBORDERDISTANCE: pBottomBorderDistanceState = propertie; break;
702 0 : case CTF_ALLBORDER: pAllBorderState = propertie; break;
703 0 : case CTF_LEFTBORDER: pLeftBorderState = propertie; break;
704 0 : case CTF_RIGHTBORDER: pRightBorderState = propertie; break;
705 0 : case CTF_TOPBORDER: pTopBorderState = propertie; break;
706 0 : case CTF_BOTTOMBORDER: pBottomBorderState = propertie; break;
707 :
708 0 : case CTF_CHARALLBORDERWIDTH: pCharAllBorderWidthState = propertie; break;
709 0 : case CTF_CHARLEFTBORDERWIDTH: pCharLeftBorderWidthState = propertie; break;
710 0 : case CTF_CHARRIGHTBORDERWIDTH: pCharRightBorderWidthState = propertie; break;
711 0 : case CTF_CHARTOPBORDERWIDTH: pCharTopBorderWidthState = propertie; break;
712 0 : case CTF_CHARBOTTOMBORDERWIDTH: pCharBottomBorderWidthState = propertie; break;
713 0 : case CTF_CHARALLBORDERDISTANCE: pCharAllBorderDistanceState = propertie; break;
714 0 : case CTF_CHARLEFTBORDERDISTANCE: pCharLeftBorderDistanceState = propertie; break;
715 0 : case CTF_CHARRIGHTBORDERDISTANCE: pCharRightBorderDistanceState = propertie; break;
716 0 : case CTF_CHARTOPBORDERDISTANCE: pCharTopBorderDistanceState = propertie; break;
717 0 : case CTF_CHARBOTTOMBORDERDISTANCE: pCharBottomBorderDistanceState = propertie; break;
718 0 : case CTF_CHARALLBORDER: pCharAllBorderState = propertie; break;
719 0 : case CTF_CHARLEFTBORDER: pCharLeftBorderState = propertie; break;
720 0 : case CTF_CHARRIGHTBORDER: pCharRightBorderState = propertie; break;
721 0 : case CTF_CHARTOPBORDER: pCharTopBorderState = propertie; break;
722 0 : case CTF_CHARBOTTOMBORDER: pCharBottomBorderState = propertie; break;
723 :
724 0 : case CTF_FRAMEHEIGHT_MIN_ABS: pHeightMinAbsState = propertie; break;
725 0 : case CTF_FRAMEHEIGHT_MIN_REL: pHeightMinRelState = propertie; break;
726 0 : case CTF_FRAMEHEIGHT_ABS: pHeightAbsState = propertie; break;
727 0 : case CTF_FRAMEHEIGHT_REL: pHeightRelState = propertie; break;
728 0 : case CTF_SIZETYPE: pSizeTypeState = propertie; break;
729 :
730 0 : case CTF_FRAMEWIDTH_MIN_ABS: pWidthMinAbsState = propertie; break;
731 0 : case CTF_FRAMEWIDTH_MIN_REL: pWidthMinRelState = propertie; break;
732 0 : case CTF_FRAMEWIDTH_ABS: pWidthAbsState = propertie; break;
733 0 : case CTF_FRAMEWIDTH_REL: pWidthRelState = propertie; break;
734 0 : case CTF_FRAMEWIDTH_TYPE: pWidthTypeState = propertie; break;
735 :
736 0 : case CTF_WRAP: pWrapState = propertie; break;
737 0 : case CTF_WRAP_CONTOUR: pWrapContourState = propertie; break;
738 0 : case CTF_WRAP_CONTOUR_MODE: pWrapContourModeState = propertie; break;
739 0 : case CTF_WRAP_PARAGRAPH_ONLY: pWrapParagraphOnlyState = propertie; break;
740 0 : case CTF_ANCHORTYPE: pAnchorTypeState = propertie; break;
741 :
742 0 : case CTF_HORIZONTALPOS: pHoriOrientState = propertie; bNeedsAnchor = sal_True; break;
743 0 : case CTF_HORIZONTALPOS_MIRRORED: pHoriOrientMirroredState = propertie; bNeedsAnchor = sal_True; break;
744 0 : case CTF_HORIZONTALREL: pHoriOrientRelState = propertie; bNeedsAnchor = sal_True; break;
745 0 : case CTF_HORIZONTALREL_FRAME: pHoriOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
746 0 : case CTF_HORIZONTALMIRROR: pHoriOrientMirrorState = propertie; bNeedsAnchor = sal_True; break;
747 0 : case CTF_RELWIDTHREL: pRelWidthRel = propertie; break;
748 0 : case CTF_VERTICALPOS: pVertOrientState = propertie; bNeedsAnchor = sal_True; break;
749 0 : case CTF_VERTICALPOS_ATCHAR: pVertOrientAtCharState = propertie; bNeedsAnchor = sal_True; break;
750 0 : case CTF_VERTICALREL: pVertOrientRelState = propertie; bNeedsAnchor = sal_True; break;
751 0 : case CTF_VERTICALREL_PAGE: pVertOrientRelPageState = propertie; bNeedsAnchor = sal_True; break;
752 0 : case CTF_VERTICALREL_FRAME: pVertOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
753 0 : case CTF_VERTICALREL_ASCHAR: pVertOrientRelAsCharState = propertie; bNeedsAnchor = sal_True; break;
754 0 : case CTF_RELHEIGHTREL: pRelHeightRel = propertie; break;
755 :
756 : // Handle new CTFs for shape positioning properties (#i28749#)
757 0 : case CTF_SHAPE_HORIZONTALPOS: pShapeHoriOrientState = propertie; bNeedsAnchor = sal_True; break;
758 0 : case CTF_SHAPE_HORIZONTALPOS_MIRRORED: pShapeHoriOrientMirroredState = propertie; bNeedsAnchor = sal_True; break;
759 0 : case CTF_SHAPE_HORIZONTALREL: pShapeHoriOrientRelState = propertie; bNeedsAnchor = sal_True; break;
760 0 : case CTF_SHAPE_HORIZONTALREL_FRAME: pShapeHoriOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
761 0 : case CTF_SHAPE_HORIZONTALMIRROR: pShapeHoriOrientMirrorState = propertie; bNeedsAnchor = sal_True; break;
762 0 : case CTF_SHAPE_VERTICALPOS: pShapeVertOrientState = propertie; bNeedsAnchor = sal_True; break;
763 0 : case CTF_SHAPE_VERTICALPOS_ATCHAR: pShapeVertOrientAtCharState = propertie; bNeedsAnchor = sal_True; break;
764 0 : case CTF_SHAPE_VERTICALREL: pShapeVertOrientRelState = propertie; bNeedsAnchor = sal_True; break;
765 0 : case CTF_SHAPE_VERTICALREL_PAGE: pShapeVertOrientRelPageState = propertie; bNeedsAnchor = sal_True; break;
766 0 : case CTF_SHAPE_VERTICALREL_FRAME: pShapeVertOrientRelFrameState = propertie; bNeedsAnchor = sal_True; break;
767 0 : case CTF_FONTNAME: pFontNameState = propertie; break;
768 0 : case CTF_FONTFAMILYNAME: pFontFamilyNameState = propertie; break;
769 0 : case CTF_FONTSTYLENAME: pFontStyleNameState = propertie; break;
770 0 : case CTF_FONTFAMILY: pFontFamilyState = propertie; break;
771 0 : case CTF_FONTPITCH: pFontPitchState = propertie; break;
772 0 : case CTF_FONTCHARSET: pFontCharsetState = propertie; break;
773 :
774 0 : case CTF_FONTNAME_CJK: pFontNameCJKState = propertie; break;
775 0 : case CTF_FONTFAMILYNAME_CJK: pFontFamilyNameCJKState = propertie; break;
776 0 : case CTF_FONTSTYLENAME_CJK: pFontStyleNameCJKState = propertie; break;
777 0 : case CTF_FONTFAMILY_CJK: pFontFamilyCJKState = propertie; break;
778 0 : case CTF_FONTPITCH_CJK: pFontPitchCJKState = propertie; break;
779 0 : case CTF_FONTCHARSET_CJK: pFontCharsetCJKState = propertie; break;
780 :
781 0 : case CTF_FONTNAME_CTL: pFontNameCTLState = propertie; break;
782 0 : case CTF_FONTFAMILYNAME_CTL: pFontFamilyNameCTLState = propertie; break;
783 0 : case CTF_FONTSTYLENAME_CTL: pFontStyleNameCTLState = propertie; break;
784 0 : case CTF_FONTFAMILY_CTL: pFontFamilyCTLState = propertie; break;
785 0 : case CTF_FONTPITCH_CTL: pFontPitchCTLState = propertie; break;
786 0 : case CTF_FONTCHARSET_CTL: pFontCharsetCTLState = propertie; break;
787 0 : case CTF_UNDERLINE: pUnderlineState = propertie; break;
788 0 : case CTF_UNDERLINE_COLOR: pUnderlineColorState = propertie; break;
789 0 : case CTF_UNDERLINE_HASCOLOR: pUnderlineHasColorState = propertie; break;
790 0 : case CTF_NUMBERINGSTYLENAME: pListStyleName = propertie; break;
791 0 : case CTF_TEXT_CLIP11: pClip11State = propertie; break;
792 0 : case CTF_TEXT_CLIP: pClipState = propertie; break;
793 0 : case CTF_PARAMARGINALL_REL: pAllParaMarginRel = propertie; break;
794 0 : case CTF_PARAMARGINALL: pAllParaMargin = propertie; break;
795 0 : case CTF_MARGINALL: pAllMargin = propertie; break;
796 :
797 : //UUUU
798 : case CTF_SW_REPEAT_OFFSET_X:
799 0 : pRepeatOffsetX = propertie;
800 0 : break;
801 :
802 : //UUUU
803 : case CTF_SW_REPEAT_OFFSET_Y:
804 0 : pRepeatOffsetY = propertie;
805 0 : break;
806 :
807 : //UUUU
808 : case CTF_SW_FILLGRADIENTNAME:
809 : case CTF_SW_FILLHATCHNAME:
810 : case CTF_SW_FILLBITMAPNAME:
811 : case CTF_SW_FILLTRANSNAME:
812 : {
813 0 : OUString aStr;
814 0 : if( (propertie->maValue >>= aStr) && 0 == aStr.getLength() )
815 0 : propertie->mnIndex = -1;
816 : }
817 0 : break;
818 : }
819 : }
820 :
821 : //UUUU
822 0 : if( pRepeatOffsetX && pRepeatOffsetY )
823 : {
824 0 : sal_Int32 nOffset = 0;
825 0 : if( ( pRepeatOffsetX->maValue >>= nOffset ) && ( nOffset == 0 ) )
826 0 : pRepeatOffsetX->mnIndex = -1;
827 : else
828 0 : pRepeatOffsetY->mnIndex = -1;
829 : }
830 :
831 0 : if( pFontNameState )
832 : ContextFontFilter( bEnableFoFontFamily, pFontNameState, pFontFamilyNameState,
833 : pFontStyleNameState, pFontFamilyState,
834 0 : pFontPitchState, pFontCharsetState );
835 0 : if( pFontNameCJKState )
836 : ContextFontFilter( bEnableFoFontFamily, pFontNameCJKState, pFontFamilyNameCJKState,
837 : pFontStyleNameCJKState, pFontFamilyCJKState,
838 0 : pFontPitchCJKState, pFontCharsetCJKState );
839 0 : if( pFontNameCTLState )
840 : ContextFontFilter( bEnableFoFontFamily, pFontNameCTLState, pFontFamilyNameCTLState,
841 : pFontStyleNameCTLState, pFontFamilyCTLState,
842 0 : pFontPitchCTLState, pFontCharsetCTLState );
843 :
844 0 : if( pCharHeightState && (pCharPropHeightState || pCharDiffHeightState ) )
845 : ContextFontHeightFilter( pCharHeightState, pCharPropHeightState,
846 0 : pCharDiffHeightState );
847 0 : if( pCharHeightCJKState &&
848 0 : (pCharPropHeightCJKState || pCharDiffHeightCJKState ) )
849 : ContextFontHeightFilter( pCharHeightCJKState, pCharPropHeightCJKState,
850 0 : pCharDiffHeightCJKState );
851 0 : if( pCharHeightCTLState &&
852 0 : (pCharPropHeightCTLState || pCharDiffHeightCTLState ) )
853 : ContextFontHeightFilter( pCharHeightCTLState, pCharPropHeightCTLState,
854 0 : pCharDiffHeightCTLState );
855 0 : if( pUnderlineColorState || pUnderlineHasColorState )
856 : {
857 0 : sal_Bool bClear = !pUnderlineState;
858 0 : if( !bClear )
859 : {
860 0 : sal_Int16 nUnderline = 0;
861 0 : pUnderlineState->maValue >>= nUnderline;
862 0 : bClear = awt::FontUnderline::NONE == nUnderline;
863 : }
864 0 : if( bClear )
865 : {
866 0 : if( pUnderlineColorState )
867 0 : pUnderlineColorState->mnIndex = -1;
868 0 : if( pUnderlineHasColorState )
869 0 : pUnderlineHasColorState->mnIndex = -1;
870 : }
871 : }
872 :
873 0 : lcl_checkMultiProperty(pParaLeftMarginState, pParaLeftMarginRelState);
874 0 : lcl_checkMultiProperty(pParaRightMarginState, pParaRightMarginRelState);
875 0 : lcl_checkMultiProperty(pParaTopMarginState, pParaTopMarginRelState);
876 0 : lcl_checkMultiProperty(pParaBottomMarginState, pParaBottomMarginRelState);
877 0 : lcl_checkMultiProperty(pParaFirstLineState, pParaFirstLineRelState);
878 :
879 0 : if (pAllParaMarginRel)
880 : { // because older OOo/LO versions can't read fo:margin:
881 0 : pAllParaMarginRel->mnIndex = -1; // just export individual attributes...
882 0 : pAllParaMarginRel->maValue.clear();
883 : }
884 0 : if (pAllParaMargin)
885 : {
886 0 : pAllParaMargin->mnIndex = -1; // just export individual attributes...
887 0 : pAllParaMargin->maValue.clear();
888 : }
889 0 : if (pAllMargin)
890 : {
891 0 : pAllMargin->mnIndex = -1; // just export individual attributes...
892 0 : pAllMargin->maValue.clear();
893 : }
894 :
895 : lcl_FilterBorders(
896 : pAllBorderWidthState, pLeftBorderWidthState, pRightBorderWidthState,
897 : pTopBorderWidthState, pBottomBorderWidthState, pAllBorderDistanceState,
898 : pLeftBorderDistanceState, pRightBorderDistanceState, pTopBorderDistanceState,
899 : pBottomBorderDistanceState, pAllBorderState, pLeftBorderState,
900 0 : pRightBorderState, pTopBorderState, pBottomBorderState);
901 :
902 : lcl_FilterBorders(
903 : pCharAllBorderWidthState, pCharLeftBorderWidthState, pCharRightBorderWidthState,
904 : pCharTopBorderWidthState, pCharBottomBorderWidthState, pCharAllBorderDistanceState,
905 : pCharLeftBorderDistanceState, pCharRightBorderDistanceState, pCharTopBorderDistanceState,
906 : pCharBottomBorderDistanceState, pCharAllBorderState, pCharLeftBorderState,
907 0 : pCharRightBorderState, pCharTopBorderState, pCharBottomBorderState);
908 :
909 0 : sal_Int16 nSizeType = SizeType::FIX;
910 0 : if( pSizeTypeState )
911 : {
912 0 : pSizeTypeState->maValue >>= nSizeType;
913 0 : pSizeTypeState->mnIndex = -1;
914 : }
915 :
916 0 : if( pHeightMinAbsState )
917 : {
918 0 : sal_Int16 nRel = sal_Int16();
919 0 : if( (SizeType::FIX == nSizeType) ||
920 0 : ( pHeightMinRelState &&
921 0 : ( !(pHeightMinRelState->maValue >>= nRel) || nRel > 0 ) ) )
922 : {
923 0 : pHeightMinAbsState->mnIndex = -1;
924 : }
925 :
926 : // export SizeType::VARIABLE als min-width="0"
927 0 : if( SizeType::VARIABLE == nSizeType )
928 0 : pHeightMinAbsState->maValue <<= static_cast<sal_Int32>( 0 );
929 : }
930 0 : if( pHeightMinRelState && SizeType::MIN != nSizeType)
931 0 : pHeightMinRelState->mnIndex = -1;
932 0 : if( pHeightAbsState && pHeightMinAbsState &&
933 0 : -1 != pHeightMinAbsState->mnIndex )
934 0 : pHeightAbsState->mnIndex = -1;
935 0 : if( pHeightRelState && SizeType::FIX != nSizeType)
936 0 : pHeightRelState->mnIndex = -1;
937 :
938 : // frame width
939 0 : nSizeType = SizeType::FIX;
940 0 : if( pWidthTypeState )
941 : {
942 0 : pWidthTypeState->maValue >>= nSizeType;
943 0 : pWidthTypeState->mnIndex = -1;
944 : }
945 0 : if( pWidthMinAbsState )
946 : {
947 0 : sal_Int16 nRel = sal_Int16();
948 0 : if( (SizeType::FIX == nSizeType) ||
949 0 : ( pWidthMinRelState &&
950 0 : ( !(pWidthMinRelState->maValue >>= nRel) || nRel > 0 ) ) )
951 : {
952 0 : pWidthMinAbsState->mnIndex = -1;
953 : }
954 :
955 : // export SizeType::VARIABLE als min-width="0"
956 0 : if( SizeType::VARIABLE == nSizeType )
957 0 : pWidthMinAbsState->maValue <<= static_cast<sal_Int32>( 0 );
958 : }
959 0 : if( pWidthMinRelState && SizeType::MIN != nSizeType)
960 0 : pWidthMinRelState->mnIndex = -1;
961 0 : if( pWidthAbsState && pWidthMinAbsState &&
962 0 : -1 != pWidthMinAbsState->mnIndex )
963 0 : pWidthAbsState->mnIndex = -1;
964 0 : if( pWidthRelState && SizeType::FIX != nSizeType)
965 0 : pWidthRelState->mnIndex = -1;
966 :
967 0 : if( pWrapState )
968 : {
969 : WrapTextMode eVal;
970 0 : pWrapState->maValue >>= eVal;
971 0 : switch( eVal )
972 : {
973 : case WrapTextMode_NONE:
974 : // no wrapping: disable para-only and contour
975 0 : if( pWrapParagraphOnlyState )
976 0 : pWrapParagraphOnlyState->mnIndex = -1;
977 : // no break
978 : case WrapTextMode_THROUGHT:
979 : // wrap through: disable only contour
980 0 : if( pWrapContourState )
981 0 : pWrapContourState->mnIndex = -1;
982 0 : break;
983 : default:
984 0 : break;
985 : }
986 0 : if( pWrapContourModeState &&
987 0 : (!pWrapContourState ||
988 0 : !*(sal_Bool *)pWrapContourState ->maValue.getValue() ) )
989 0 : pWrapContourModeState->mnIndex = -1;
990 : }
991 :
992 0 : TextContentAnchorType eAnchor = TextContentAnchorType_AT_PARAGRAPH;
993 0 : if( pAnchorTypeState )
994 0 : pAnchorTypeState->maValue >>= eAnchor;
995 0 : else if( bNeedsAnchor )
996 : {
997 0 : Any aAny = rPropSet->getPropertyValue("AnchorType");
998 0 : aAny >>= eAnchor;
999 : }
1000 :
1001 : // states for frame positioning attributes
1002 : {
1003 0 : if( pHoriOrientState && pHoriOrientMirroredState )
1004 : {
1005 0 : if( pHoriOrientMirrorState &&
1006 0 : *(sal_Bool *)pHoriOrientMirrorState->maValue.getValue() )
1007 0 : pHoriOrientState->mnIndex = -1;
1008 : else
1009 0 : pHoriOrientMirroredState->mnIndex = -1;
1010 : }
1011 0 : if( pHoriOrientMirrorState )
1012 0 : pHoriOrientMirrorState->mnIndex = -1;
1013 :
1014 0 : if( pHoriOrientRelState && TextContentAnchorType_AT_FRAME == eAnchor )
1015 0 : pHoriOrientRelState->mnIndex = -1;
1016 0 : if( pHoriOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
1017 0 : pHoriOrientRelFrameState->mnIndex = -1;
1018 0 : if (pRelWidthRel)
1019 : {
1020 0 : sal_Int16 nRelWidth = 0;
1021 0 : rPropSet->getPropertyValue("RelativeWidth") >>= nRelWidth;
1022 0 : if (!nRelWidth)
1023 0 : pRelWidthRel->mnIndex = -1;
1024 : }
1025 :
1026 0 : if( pVertOrientState && TextContentAnchorType_AT_CHARACTER == eAnchor )
1027 0 : pVertOrientState->mnIndex = -1;
1028 0 : if( pVertOrientAtCharState && TextContentAnchorType_AT_CHARACTER != eAnchor )
1029 0 : pVertOrientAtCharState->mnIndex = -1;
1030 0 : if( pVertOrientRelState && TextContentAnchorType_AT_PARAGRAPH != eAnchor &&
1031 0 : TextContentAnchorType_AT_CHARACTER != eAnchor )
1032 0 : pVertOrientRelState->mnIndex = -1;
1033 0 : if( pVertOrientRelPageState && TextContentAnchorType_AT_PAGE != eAnchor )
1034 0 : pVertOrientRelPageState->mnIndex = -1;
1035 0 : if( pVertOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
1036 0 : pVertOrientRelFrameState->mnIndex = -1;
1037 0 : if( pVertOrientRelAsCharState && TextContentAnchorType_AS_CHARACTER != eAnchor )
1038 0 : pVertOrientRelAsCharState->mnIndex = -1;
1039 0 : if (pRelHeightRel)
1040 : {
1041 0 : sal_Int16 nRelHeight = 0;
1042 0 : rPropSet->getPropertyValue("RelativeHeight") >>= nRelHeight;
1043 0 : if (!nRelHeight)
1044 0 : pRelHeightRel->mnIndex = -1;
1045 : }
1046 : }
1047 :
1048 : // States for shape positioning properties (#i28749#)
1049 0 : if ( eAnchor != TextContentAnchorType_AS_CHARACTER &&
1050 0 : ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 )
1051 : {
1052 : // no export of shape positioning properties,
1053 : // if shape isn't anchored as-character and
1054 : // destination file format is OpenOffice.org file format
1055 0 : if ( pShapeHoriOrientState )
1056 0 : pShapeHoriOrientState->mnIndex = -1;
1057 0 : if ( pShapeHoriOrientMirroredState )
1058 0 : pShapeHoriOrientMirroredState->mnIndex = -1;
1059 0 : if ( pShapeHoriOrientRelState )
1060 0 : pShapeHoriOrientRelState->mnIndex = -1;
1061 0 : if ( pShapeHoriOrientRelFrameState )
1062 0 : pShapeHoriOrientRelFrameState->mnIndex = -1;
1063 0 : if ( pShapeHoriOrientMirrorState )
1064 0 : pShapeHoriOrientMirrorState->mnIndex = -1;
1065 0 : if ( pShapeVertOrientState )
1066 0 : pShapeVertOrientState->mnIndex = -1;
1067 0 : if ( pShapeVertOrientAtCharState )
1068 0 : pShapeVertOrientAtCharState->mnIndex = -1;
1069 0 : if ( pShapeVertOrientRelState )
1070 0 : pShapeVertOrientRelState->mnIndex = -1;
1071 0 : if ( pShapeVertOrientRelPageState )
1072 0 : pShapeVertOrientRelPageState->mnIndex = -1;
1073 0 : if ( pShapeVertOrientRelFrameState )
1074 0 : pShapeVertOrientRelFrameState->mnIndex = -1;
1075 : }
1076 : else
1077 : {
1078 : // handling of shape positioning property states as for frames - see above
1079 0 : if( pShapeHoriOrientState && pShapeHoriOrientMirroredState )
1080 : {
1081 0 : if( pShapeHoriOrientMirrorState &&
1082 0 : *(sal_Bool *)pShapeHoriOrientMirrorState->maValue.getValue() )
1083 0 : pShapeHoriOrientState->mnIndex = -1;
1084 : else
1085 0 : pShapeHoriOrientMirroredState->mnIndex = -1;
1086 : }
1087 0 : if( pShapeHoriOrientMirrorState )
1088 0 : pShapeHoriOrientMirrorState->mnIndex = -1;
1089 :
1090 0 : if( pShapeHoriOrientRelState && TextContentAnchorType_AT_FRAME == eAnchor )
1091 0 : pShapeHoriOrientRelState->mnIndex = -1;
1092 0 : if( pShapeHoriOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
1093 0 : pShapeHoriOrientRelFrameState->mnIndex = -1;
1094 :
1095 0 : if( pShapeVertOrientState && TextContentAnchorType_AT_CHARACTER == eAnchor )
1096 0 : pShapeVertOrientState->mnIndex = -1;
1097 0 : if( pShapeVertOrientAtCharState && TextContentAnchorType_AT_CHARACTER != eAnchor )
1098 0 : pShapeVertOrientAtCharState->mnIndex = -1;
1099 0 : if( pShapeVertOrientRelState && TextContentAnchorType_AT_PARAGRAPH != eAnchor &&
1100 0 : TextContentAnchorType_AT_CHARACTER != eAnchor )
1101 0 : pShapeVertOrientRelState->mnIndex = -1;
1102 0 : if( pShapeVertOrientRelPageState && TextContentAnchorType_AT_PAGE != eAnchor )
1103 0 : pShapeVertOrientRelPageState->mnIndex = -1;
1104 0 : if( pShapeVertOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
1105 0 : pShapeVertOrientRelFrameState->mnIndex = -1;
1106 : }
1107 :
1108 : // list style name: remove list style if it is the default outline style
1109 0 : if( pListStyleName != NULL )
1110 : {
1111 0 : OUString sListStyleName;
1112 0 : pListStyleName->maValue >>= sListStyleName;
1113 0 : if( lcl_IsOutlineStyle( GetExport(), sListStyleName ) )
1114 0 : pListStyleName->mnIndex = -1;
1115 : }
1116 :
1117 0 : if( pClipState != NULL && pClip11State != NULL )
1118 0 : pClip11State->mnIndex = -1;
1119 :
1120 0 : SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet);
1121 0 : }
1122 :
1123 : namespace {
1124 :
1125 0 : static bool lcl_IsOutlineStyle(const SvXMLExport &rExport, const OUString & rName)
1126 : {
1127 : Reference< XChapterNumberingSupplier >
1128 0 : xCNSupplier(rExport.GetModel(), UNO_QUERY);
1129 :
1130 0 : OUString sOutlineName;
1131 0 : OUString sName("Name");
1132 :
1133 0 : if (xCNSupplier.is())
1134 : {
1135 : Reference<XPropertySet> xNumRule(
1136 0 : xCNSupplier->getChapterNumberingRules(), UNO_QUERY );
1137 : DBG_ASSERT( xNumRule.is(), "no chapter numbering rules" );
1138 0 : if (xNumRule.is())
1139 : {
1140 0 : xNumRule->getPropertyValue(sName) >>= sOutlineName;
1141 0 : }
1142 : }
1143 :
1144 0 : return rName == sOutlineName;
1145 : }
1146 :
1147 : }
1148 :
1149 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|