bump product version to 5.0.4.1
[LibreOffice.git] / xmloff / source / text / txtprhdl.cxx
blob0cc3464bf3598a559dea2a3c10531ab104bb89f3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <tools/debug.hxx>
21 #include <osl/diagnose.h>
22 #include <rtl/ustrbuf.hxx>
23 #include <tools/fontenum.hxx>
24 #include <com/sun/star/uno/Any.hxx>
25 #include <com/sun/star/drawing/FillStyle.hpp>
26 #include <com/sun/star/style/DropCapFormat.hpp>
27 #include <com/sun/star/text/FontRelief.hpp>
28 #include <com/sun/star/text/WrapTextMode.hpp>
29 #include <com/sun/star/text/XTextColumns.hpp>
30 #include <com/sun/star/text/TextColumn.hpp>
31 #include <com/sun/star/text/RelOrientation.hpp>
32 #include <com/sun/star/text/HoriOrientation.hpp>
33 #include <com/sun/star/text/VertOrientation.hpp>
34 #include <com/sun/star/text/RubyAdjust.hpp>
35 #include <com/sun/star/text/FontEmphasis.hpp>
36 #include <com/sun/star/text/ParagraphVertAlign.hpp>
37 #include <sax/tools/converter.hxx>
38 #include <xmloff/xmltypes.hxx>
39 #include <xmloff/xmluconv.hxx>
40 #include <xmloff/xmltoken.hxx>
41 #include "XMLAnchorTypePropHdl.hxx"
42 #include <xmloff/XMLConstantsPropertyHandler.hxx>
43 #include "XMLClipPropertyHandler.hxx"
44 #include "XMLTextColumnsPropertyHandler.hxx"
45 #include <xmloff/NamedBoolPropertyHdl.hxx>
46 #include "txtprhdl.hxx"
47 #include <com/sun/star/text/WrapInfluenceOnPosition.hpp>
48 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
50 //UUUU
51 #include <xmloff/EnumPropertyHdl.hxx>
52 #include "XMLFillBitmapSizePropertyHandler.hxx"
53 #include "XMLBitmapLogicalSizePropertyHandler.hxx"
54 #include <com/sun/star/drawing/RectanglePoint.hpp>
55 #include <com/sun/star/drawing/BitmapMode.hpp>
56 #include "XMLBitmapRepeatOffsetPropertyHandler.hxx"
58 using namespace ::com::sun::star;
59 using namespace ::com::sun::star::uno;
60 using namespace ::com::sun::star::style;
61 using namespace ::com::sun::star::text;
62 using namespace ::xmloff::token;
64 //UUUU
65 using namespace ::com::sun::star::drawing;
67 //UUUU
68 extern SvXMLEnumMapEntry aXML_FillStyle_EnumMap[];
69 extern SvXMLEnumMapEntry aXML_RefPoint_EnumMap[];
70 extern SvXMLEnumMapEntry aXML_BitmapMode_EnumMap[];
72 static SvXMLEnumMapEntry const pXML_HoriPos_Enum[] =
74 { XML_FROM_LEFT, HoriOrientation::NONE },
75 { XML_FROM_INSIDE, HoriOrientation::NONE }, // import only
76 { XML_LEFT, HoriOrientation::LEFT },
77 { XML_INSIDE, HoriOrientation::LEFT }, // import only
78 { XML_CENTER, HoriOrientation::CENTER },
79 { XML_RIGHT, HoriOrientation::RIGHT },
80 { XML_OUTSIDE, HoriOrientation::RIGHT }, // import only
81 { XML_TOKEN_INVALID, 0 }
84 static SvXMLEnumMapEntry const pXML_HoriPosMirrored_Enum[] =
86 { XML_FROM_INSIDE, HoriOrientation::NONE },
87 { XML_INSIDE, HoriOrientation::LEFT },
88 { XML_CENTER, HoriOrientation::CENTER },
89 { XML_OUTSIDE, HoriOrientation::RIGHT },
90 { XML_TOKEN_INVALID, 0 }
93 static SvXMLEnumMapEntry const pXML_HoriRel_Enum[] =
95 { XML_PARAGRAPH, RelOrientation::FRAME },
96 { XML_PARAGRAPH_CONTENT, RelOrientation::PRINT_AREA },
97 { XML_PAGE, RelOrientation::PAGE_FRAME },
98 { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
99 { XML_PARAGRAPH_START_MARGIN, RelOrientation::FRAME_LEFT },
100 { XML_PARAGRAPH_END_MARGIN, RelOrientation::FRAME_RIGHT },
101 { XML_PAGE_START_MARGIN, RelOrientation::PAGE_LEFT },
102 { XML_PAGE_END_MARGIN, RelOrientation::PAGE_RIGHT },
103 { XML_CHAR, RelOrientation::CHAR },
104 { XML_FRAME, RelOrientation::FRAME }, // import only
105 { XML_FRAME_CONTENT, RelOrientation::PRINT_AREA }, // import only
106 { XML_FRAME_START_MARGIN, RelOrientation::FRAME_LEFT }, // import only
107 { XML_FRAME_END_MARGIN, RelOrientation::FRAME_RIGHT }, // import only
108 { XML_TOKEN_INVALID, 0 }
111 static SvXMLEnumMapEntry const pXML_HoriRelFrame_Enum[] =
113 { XML_FRAME, RelOrientation::FRAME },
114 { XML_FRAME_CONTENT, RelOrientation::PRINT_AREA },
115 { XML_PAGE, RelOrientation::PAGE_FRAME },
116 { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
117 { XML_FRAME_START_MARGIN, RelOrientation::FRAME_LEFT },
118 { XML_FRAME_END_MARGIN, RelOrientation::FRAME_RIGHT },
119 { XML_PAGE_START_MARGIN, RelOrientation::PAGE_LEFT },
120 { XML_PAGE_END_MARGIN, RelOrientation::PAGE_RIGHT },
121 { XML_CHAR, RelOrientation::CHAR },
122 { XML_TOKEN_INVALID, 0 }
125 static SvXMLEnumMapEntry const pXML_HoriMirror_Enum[] =
127 { XML_FROM_LEFT, sal_uInt16(false) },
128 { XML_FROM_INSIDE, sal_uInt16(true) },
129 { XML_LEFT, sal_uInt16(false) },
130 { XML_INSIDE, sal_uInt16(true) },
131 { XML_CENTER, sal_uInt16(false) },
132 { XML_RIGHT, sal_uInt16(false) },
133 { XML_OUTSIDE, sal_uInt16(true) },
134 { XML_TOKEN_INVALID, 0 }
137 static SvXMLEnumMapEntry const pXML_VertPos_Enum[] =
139 { XML_FROM_TOP, VertOrientation::NONE },
140 { XML_TOP, VertOrientation::TOP },
141 { XML_TOP, VertOrientation::CHAR_TOP }, // export only
142 { XML_TOP, VertOrientation::LINE_TOP }, // export only
143 { XML_MIDDLE, VertOrientation::CENTER },
144 { XML_MIDDLE, VertOrientation::CHAR_CENTER }, // export only
145 { XML_MIDDLE, VertOrientation::LINE_CENTER }, // export only
146 { XML_BOTTOM, VertOrientation::BOTTOM },
147 { XML_BOTTOM, VertOrientation::CHAR_BOTTOM }, // export only
148 { XML_BOTTOM, VertOrientation::LINE_BOTTOM }, // export only
149 { XML_BELOW, VertOrientation::CHAR_BOTTOM }, // import only
150 { XML_TOKEN_INVALID, 0 }
153 static SvXMLEnumMapEntry const pXML_VertPosAtChar_Enum[] =
155 { XML_FROM_TOP, VertOrientation::NONE },
156 { XML_TOP, VertOrientation::TOP },
157 { XML_TOP, VertOrientation::CHAR_TOP }, // export only
158 { XML_TOP, VertOrientation::LINE_TOP }, // export only
159 { XML_MIDDLE, VertOrientation::CENTER },
160 { XML_MIDDLE, VertOrientation::CHAR_CENTER }, // export only
161 { XML_MIDDLE, VertOrientation::LINE_CENTER }, // export only
162 { XML_BOTTOM, VertOrientation::BOTTOM },
163 { XML_BELOW, VertOrientation::CHAR_BOTTOM }, // export only
164 { XML_BOTTOM, VertOrientation::LINE_BOTTOM }, // export only
165 { XML_TOKEN_INVALID, 0 }
168 static SvXMLEnumMapEntry const pXML_VertRel_Enum[] =
170 { XML_PARAGRAPH, RelOrientation::FRAME },
171 { XML_PARAGRAPH_CONTENT, RelOrientation::PRINT_AREA },
172 { XML_CHAR, RelOrientation::CHAR },
173 // DVO, OD 17.09.2003 #i18732# - allow vertical alignment at page
174 { XML_PAGE, RelOrientation::PAGE_FRAME },
175 { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
176 { XML_FRAME, RelOrientation::FRAME }, // import only
177 { XML_FRAME_CONTENT, RelOrientation::PRINT_AREA }, // import only
178 // OD 13.11.2003 #i22341# - new vertical alignment at top of line
179 { XML_LINE, RelOrientation::TEXT_LINE },
180 { XML_TOKEN_INVALID, 0 }
183 static SvXMLEnumMapEntry const pXML_VertRelPage_Enum[] =
185 { XML_PAGE, RelOrientation::FRAME },
186 { XML_PAGE_CONTENT, RelOrientation::PRINT_AREA },
187 { XML_PAGE, RelOrientation::PAGE_FRAME },
188 { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
189 { XML_TOKEN_INVALID, 0 }
192 static SvXMLEnumMapEntry const pXML_VertRelFrame_Enum[] =
194 { XML_FRAME, RelOrientation::FRAME },
195 { XML_FRAME_CONTENT, RelOrientation::PRINT_AREA },
196 { XML_TOKEN_INVALID, 0 }
199 static SvXMLEnumMapEntry const pXML_VertRelAsChar_Enum[] =
201 { XML_BASELINE, VertOrientation::TOP },
202 { XML_BASELINE, VertOrientation::CENTER }, // export only
203 { XML_BASELINE, VertOrientation::BOTTOM }, // export only
204 { XML_TEXT, VertOrientation::CHAR_TOP },
205 { XML_TEXT, VertOrientation::CHAR_CENTER }, // export only
206 { XML_TEXT, VertOrientation::CHAR_BOTTOM }, // export only
207 { XML_LINE, VertOrientation::LINE_TOP },
208 { XML_LINE, VertOrientation::LINE_CENTER }, // export only
209 { XML_LINE, VertOrientation::LINE_BOTTOM }, // export only
210 { XML_TOKEN_INVALID, 0 }
213 static SvXMLEnumMapEntry const pXML_RubyAdjust_Enum[] =
215 { XML_LEFT, RubyAdjust_LEFT },
216 { XML_CENTER, RubyAdjust_CENTER },
217 { XML_RIGHT, RubyAdjust_RIGHT },
218 { XML_DISTRIBUTE_LETTER, RubyAdjust_BLOCK },
219 { XML_DISTRIBUTE_SPACE, RubyAdjust_INDENT_BLOCK },
220 { XML_TOKEN_INVALID, 0 }
223 static SvXMLEnumMapEntry const pXML_FontRelief_Enum[] =
225 { XML_NONE, FontRelief::NONE },
226 { XML_ENGRAVED, FontRelief::ENGRAVED },
227 { XML_EMBOSSED, FontRelief::EMBOSSED },
228 { XML_TOKEN_INVALID, 0 }
231 static SvXMLEnumMapEntry const pXML_ParaVerticalAlign_Enum[] =
233 { XML_TOP, ParagraphVertAlign::TOP },
234 { XML_MIDDLE, ParagraphVertAlign::CENTER },
235 { XML_BOTTOM, ParagraphVertAlign::BOTTOM },
236 { XML_BASELINE, ParagraphVertAlign::BASELINE },
237 { XML_AUTO, ParagraphVertAlign::AUTOMATIC },
238 { XML_TOKEN_INVALID, 0 }
241 // OD 2004-05-05 #i28701#
242 static SvXMLEnumMapEntry const pXML_WrapInfluenceOnPosition_Enum[] =
244 // Tokens have been renamed and <XML_ITERATIVE> has been added (#i35017#)
245 { XML_ONCE_SUCCESSIVE, WrapInfluenceOnPosition::ONCE_SUCCESSIVE },
246 { XML_ONCE_CONCURRENT, WrapInfluenceOnPosition::ONCE_CONCURRENT },
247 { XML_ITERATIVE, WrapInfluenceOnPosition::ITERATIVE },
248 { XML_TOKEN_INVALID, 0 }
251 static SvXMLEnumMapEntry const pXML_VerticalAlign_Enum[] =
253 { XML_TOP, drawing::TextVerticalAdjust_TOP },
254 { XML_MIDDLE, drawing::TextVerticalAdjust_CENTER },
255 { XML_BOTTOM, drawing::TextVerticalAdjust_BOTTOM },
256 { XML_JUSTIFY, drawing::TextVerticalAdjust_BLOCK },
257 { XML_TOKEN_INVALID, 0 }
260 class XMLDropCapPropHdl_Impl : public XMLPropertyHandler
262 public:
263 virtual ~XMLDropCapPropHdl_Impl ();
265 virtual bool equals(
266 const ::com::sun::star::uno::Any& r1,
267 const ::com::sun::star::uno::Any& r2 ) const SAL_OVERRIDE;
269 /// TabStops will be imported/exported as XML-Elements. So the Import/Export-work must be done at another place.
270 virtual bool importXML(
271 const OUString& rStrImpValue,
272 ::com::sun::star::uno::Any& rValue,
273 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
274 virtual bool exportXML(
275 OUString& rStrExpValue,
276 const ::com::sun::star::uno::Any& rValue,
277 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
280 XMLDropCapPropHdl_Impl::~XMLDropCapPropHdl_Impl ()
284 bool XMLDropCapPropHdl_Impl::equals(
285 const Any& r1,
286 const Any& r2 ) const
288 DropCapFormat aFormat1, aFormat2;
289 r1 >>= aFormat1;
290 r2 >>= aFormat2;
292 return (aFormat1.Lines <=1 && aFormat2.Lines <=1) ||
293 (aFormat1.Lines == aFormat2.Lines &&
294 aFormat1.Count == aFormat2.Count &&
295 aFormat1.Distance == aFormat2.Distance);
298 bool XMLDropCapPropHdl_Impl::importXML(
299 const OUString&,
300 Any&,
301 const SvXMLUnitConverter& ) const
303 DBG_ASSERT( false, "drop caps are an element import property" );
304 return false;
307 bool XMLDropCapPropHdl_Impl::exportXML(
308 OUString&,
309 const Any&,
310 const SvXMLUnitConverter& ) const
312 DBG_ASSERT( false, "drop caps are an element export property" );
313 return false;
316 class XMLOpaquePropHdl_Impl : public XMLPropertyHandler
318 public:
319 virtual ~XMLOpaquePropHdl_Impl ();
321 virtual bool importXML(
322 const OUString& rStrImpValue,
323 ::com::sun::star::uno::Any& rValue,
324 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
325 virtual bool exportXML(
326 OUString& rStrExpValue,
327 const ::com::sun::star::uno::Any& rValue,
328 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
331 bool XMLOpaquePropHdl_Impl::importXML(
332 const OUString& rStrImpValue,
333 Any& rValue,
334 const SvXMLUnitConverter& ) const
336 bool bRet = true;
337 sal_Bool bVal = sal_False;
338 if( IsXMLToken( rStrImpValue, XML_FOREGROUND ) )
339 bVal = sal_True;
340 else if( !IsXMLToken( rStrImpValue, XML_BACKGROUND ) )
341 bRet = false;
343 if( bRet )
344 rValue.setValue( &bVal, cppu::UnoType<bool>::get() );
346 return bRet;
349 bool XMLOpaquePropHdl_Impl::exportXML(
350 OUString& rStrExpValue,
351 const Any& rValue,
352 const SvXMLUnitConverter& ) const
354 if( *static_cast<sal_Bool const *>(rValue.getValue()) )
355 rStrExpValue = GetXMLToken( XML_FOREGROUND );
356 else
357 rStrExpValue = GetXMLToken( XML_BACKGROUND );
359 return true;
362 XMLOpaquePropHdl_Impl::~XMLOpaquePropHdl_Impl ()
366 class XMLContourModePropHdl_Impl : public XMLPropertyHandler
368 public:
369 virtual ~XMLContourModePropHdl_Impl ();
371 virtual bool importXML(
372 const OUString& rStrImpValue,
373 ::com::sun::star::uno::Any& rValue,
374 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
375 virtual bool exportXML(
376 OUString& rStrExpValue,
377 const ::com::sun::star::uno::Any& rValue,
378 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
381 bool XMLContourModePropHdl_Impl::importXML(
382 const OUString& rStrImpValue,
383 Any& rValue,
384 const SvXMLUnitConverter& ) const
386 bool bRet = true;
387 sal_Bool bVal = sal_False;
388 if( IsXMLToken( rStrImpValue, XML_OUTSIDE ) )
389 bVal = sal_True;
390 else if( ! IsXMLToken( rStrImpValue, XML_FULL ) )
391 bRet = false;
393 if( bRet )
394 rValue.setValue( &bVal, cppu::UnoType<bool>::get() );
396 return bRet;
399 bool XMLContourModePropHdl_Impl::exportXML(
400 OUString& rStrExpValue,
401 const Any& rValue,
402 const SvXMLUnitConverter& ) const
404 if( *static_cast<sal_Bool const *>(rValue.getValue()) )
405 rStrExpValue = GetXMLToken( XML_OUTSIDE );
406 else
407 rStrExpValue = GetXMLToken( XML_FULL );
409 return true;
412 XMLContourModePropHdl_Impl::~XMLContourModePropHdl_Impl()
416 class XMLParagraphOnlyPropHdl_Impl : public XMLPropertyHandler
418 public:
419 virtual ~XMLParagraphOnlyPropHdl_Impl ();
421 virtual bool importXML(
422 const OUString& rStrImpValue,
423 ::com::sun::star::uno::Any& rValue,
424 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
425 virtual bool exportXML(
426 OUString& rStrExpValue,
427 const ::com::sun::star::uno::Any& rValue,
428 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
431 bool XMLParagraphOnlyPropHdl_Impl::importXML(
432 const OUString& rStrImpValue,
433 Any& rValue,
434 const SvXMLUnitConverter& ) const
436 bool bRet = true;
437 sal_Bool bVal = sal_False;
439 if( ! IsXMLToken( rStrImpValue, XML_NO_LIMIT ) )
441 sal_Int32 nValue = 0;
442 bRet = ::sax::Converter::convertNumber( nValue, rStrImpValue );
443 bVal = 1 == nValue;
446 if( bRet )
447 rValue.setValue( &bVal, cppu::UnoType<bool>::get() );
449 return bRet;
452 bool XMLParagraphOnlyPropHdl_Impl::exportXML(
453 OUString& rStrExpValue,
454 const Any& rValue,
455 const SvXMLUnitConverter& ) const
457 if( *static_cast<sal_Bool const *>(rValue.getValue()) )
458 rStrExpValue = GetXMLToken( XML_1 );
459 else
460 rStrExpValue = GetXMLToken( XML_NO_LIMIT );
462 return true;
465 XMLParagraphOnlyPropHdl_Impl::~XMLParagraphOnlyPropHdl_Impl()
469 SvXMLEnumMapEntry const pXML_Wrap_Enum[] =
471 { XML_NONE, WrapTextMode_NONE },
472 { XML_RUN_THROUGH, WrapTextMode_THROUGHT },
473 { XML_PARALLEL, WrapTextMode_PARALLEL },
474 { XML_DYNAMIC, WrapTextMode_DYNAMIC },
475 { XML_LEFT, WrapTextMode_LEFT },
476 { XML_RIGHT, WrapTextMode_RIGHT },
477 { XML_TOKEN_INVALID, 0 }
480 class XMLWrapPropHdl_Impl : public XMLPropertyHandler
482 public:
483 virtual ~XMLWrapPropHdl_Impl ();
485 virtual bool importXML(
486 const OUString& rStrImpValue,
487 ::com::sun::star::uno::Any& rValue,
488 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
489 virtual bool exportXML(
490 OUString& rStrExpValue,
491 const ::com::sun::star::uno::Any& rValue,
492 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
495 bool XMLWrapPropHdl_Impl::importXML(
496 const OUString& rStrImpValue,
497 Any& rValue,
498 const SvXMLUnitConverter& ) const
500 sal_uInt16 nWrap;
501 bool bRet = SvXMLUnitConverter::convertEnum( nWrap, rStrImpValue,
502 pXML_Wrap_Enum );
504 if( bRet )
505 rValue <<= (WrapTextMode)nWrap;
507 return bRet;
510 bool XMLWrapPropHdl_Impl::exportXML(
511 OUString& rStrExpValue,
512 const Any& rValue,
513 const SvXMLUnitConverter& ) const
515 OUStringBuffer aOut;
516 WrapTextMode eVal;
518 rValue >>= eVal;
520 bool bRet = SvXMLUnitConverter::convertEnum( aOut, eVal, pXML_Wrap_Enum, XML_NONE );
522 rStrExpValue = aOut.makeStringAndClear();
524 return bRet;
527 XMLWrapPropHdl_Impl::~XMLWrapPropHdl_Impl ()
531 class XMLFrameProtectPropHdl_Impl : public XMLPropertyHandler
533 const OUString sVal;
534 public:
535 XMLFrameProtectPropHdl_Impl( enum XMLTokenEnum eVal ) :
536 sVal( GetXMLToken(eVal) ) {}
537 virtual ~XMLFrameProtectPropHdl_Impl ();
539 virtual bool importXML(
540 const OUString& rStrImpValue,
541 ::com::sun::star::uno::Any& rValue,
542 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
543 virtual bool exportXML(
544 OUString& rStrExpValue,
545 const ::com::sun::star::uno::Any& rValue,
546 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
549 bool XMLFrameProtectPropHdl_Impl::importXML(
550 const OUString& rStrImpValue,
551 Any& rValue,
552 const SvXMLUnitConverter& ) const
554 bool bRet = true;
555 sal_Bool bVal = sal_False;
556 if( ! IsXMLToken( rStrImpValue, XML_NONE ) )
558 bRet = false;
559 SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
560 OUString aToken;
561 while( aTokenEnum.getNextToken( aToken ) )
563 bRet = true;
564 if( aToken == sVal )
566 bVal = sal_True;
567 break;
572 if( bRet )
573 rValue.setValue( &bVal, cppu::UnoType<bool>::get() );
575 return bRet;
578 bool XMLFrameProtectPropHdl_Impl::exportXML(
579 OUString& rStrExpValue,
580 const Any& rValue,
581 const SvXMLUnitConverter& ) const
583 if( *static_cast<sal_Bool const *>(rValue.getValue()) )
585 if( rStrExpValue.isEmpty() ||
586 IsXMLToken( rStrExpValue, XML_NONE ) )
588 rStrExpValue = sVal;
590 else
592 rStrExpValue = rStrExpValue + " " + sVal;
595 else if( rStrExpValue.isEmpty() )
597 rStrExpValue = GetXMLToken( XML_NONE );
600 return true;
603 XMLFrameProtectPropHdl_Impl::~XMLFrameProtectPropHdl_Impl()
607 SvXMLEnumMapEntry const pXML_Anchor_Enum[] =
609 { XML_CHAR, TextContentAnchorType_AT_CHARACTER },
610 { XML_PAGE, TextContentAnchorType_AT_PAGE },
611 { XML_FRAME, TextContentAnchorType_AT_FRAME },
612 { XML_PARAGRAPH, TextContentAnchorType_AT_PARAGRAPH },
613 { XML_AS_CHAR, TextContentAnchorType_AS_CHARACTER },
614 { XML_TOKEN_INVALID, 0 }
617 bool XMLAnchorTypePropHdl::importXML(
618 const OUString& rStrImpValue,
619 Any& rValue,
620 const SvXMLUnitConverter& ) const
622 sal_uInt16 nAnchor;
623 bool bRet = SvXMLUnitConverter::convertEnum( nAnchor, rStrImpValue,
624 pXML_Anchor_Enum );
626 if( bRet )
627 rValue <<= (TextContentAnchorType)nAnchor;
629 return bRet;
632 bool XMLAnchorTypePropHdl::exportXML(
633 OUString& rStrExpValue,
634 const Any& rValue,
635 const SvXMLUnitConverter& ) const
637 OUStringBuffer aOut;
638 TextContentAnchorType eVal;
640 rValue >>= eVal;
642 bool bRet = SvXMLUnitConverter::convertEnum( aOut, eVal, pXML_Anchor_Enum, XML_PARAGRAPH );
644 rStrExpValue = aOut.makeStringAndClear();
646 return bRet;
649 XMLAnchorTypePropHdl::~XMLAnchorTypePropHdl()
653 bool XMLAnchorTypePropHdl::convert( const OUString& rStrImpValue,
654 TextContentAnchorType& rType )
656 sal_uInt16 nAnchor;
657 bool bRet = SvXMLUnitConverter::convertEnum( nAnchor, rStrImpValue,
658 pXML_Anchor_Enum );
659 if( bRet )
660 rType = (TextContentAnchorType)nAnchor;
661 return bRet;
664 XMLTextColumnsPropertyHandler::~XMLTextColumnsPropertyHandler ()
668 bool XMLTextColumnsPropertyHandler::equals(
669 const Any& r1,
670 const Any& r2 ) const
672 Reference < XTextColumns > xColumns1;
673 r1 >>= xColumns1;
675 Reference < XTextColumns > xColumns2;
676 r2 >>= xColumns2;
678 if( xColumns1->getColumnCount() != xColumns2->getColumnCount() ||
679 xColumns1->getReferenceValue() != xColumns2->getReferenceValue() )
680 return false;
682 Sequence < TextColumn > aColumns1 = xColumns1->getColumns();
683 Sequence < TextColumn > aColumns2 = xColumns2->getColumns();
684 sal_Int32 nCount = aColumns1.getLength();
685 if( aColumns2.getLength() != nCount )
686 return false;
688 const TextColumn *pColumns1 = aColumns1.getArray();
689 const TextColumn *pColumns2 = aColumns2.getArray();
691 while( nCount-- )
693 if( pColumns1->Width != pColumns2->Width ||
694 pColumns1->LeftMargin != pColumns2->LeftMargin ||
695 pColumns1->RightMargin != pColumns2->RightMargin )
696 return false;
698 pColumns1++;
699 pColumns2++;
702 return true;
705 bool XMLTextColumnsPropertyHandler::importXML(
706 const OUString&,
707 Any&,
708 const SvXMLUnitConverter& ) const
710 DBG_ASSERT( false, "columns are an element import property" );
711 return false;
714 bool XMLTextColumnsPropertyHandler::exportXML(
715 OUString&,
716 const Any&,
717 const SvXMLUnitConverter& ) const
719 DBG_ASSERT( false, "columns are an element export property" );
720 return false;
723 class XMLHoriMirrorPropHdl_Impl : public XMLPropertyHandler
725 public:
726 virtual ~XMLHoriMirrorPropHdl_Impl ();
728 virtual bool importXML(
729 const OUString& rStrImpValue,
730 ::com::sun::star::uno::Any& rValue,
731 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
732 virtual bool exportXML(
733 OUString& rStrExpValue,
734 const ::com::sun::star::uno::Any& rValue,
735 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
738 bool XMLHoriMirrorPropHdl_Impl::importXML(
739 const OUString& rStrImpValue,
740 Any& rValue,
741 const SvXMLUnitConverter& ) const
743 sal_uInt16 nHoriMirror;
744 bool bRet = SvXMLUnitConverter::convertEnum( nHoriMirror, rStrImpValue,
745 pXML_HoriMirror_Enum );
747 if( bRet )
749 sal_Bool bTmp = nHoriMirror != 0;
750 rValue.setValue( &bTmp, cppu::UnoType<bool>::get() );
753 return bRet;
756 bool XMLHoriMirrorPropHdl_Impl::exportXML(
757 OUString&,
758 const Any&,
759 const SvXMLUnitConverter& ) const
761 DBG_ASSERT( false, "HorMirror properyt shouldn't be exported" );
763 return false;
766 XMLHoriMirrorPropHdl_Impl::~XMLHoriMirrorPropHdl_Impl ()
770 class XMLGrfMirrorPropHdl_Impl : public XMLPropertyHandler
772 const OUString sVal;
773 bool bHori;
775 public:
776 XMLGrfMirrorPropHdl_Impl( enum XMLTokenEnum eVal, bool bH ) :
777 sVal( GetXMLToken( eVal ) ),
778 bHori( bH ) {}
779 virtual ~XMLGrfMirrorPropHdl_Impl ();
781 virtual bool importXML(
782 const OUString& rStrImpValue,
783 ::com::sun::star::uno::Any& rValue,
784 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
785 virtual bool exportXML(
786 OUString& rStrExpValue,
787 const ::com::sun::star::uno::Any& rValue,
788 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
791 bool XMLGrfMirrorPropHdl_Impl::importXML(
792 const OUString& rStrImpValue,
793 Any& rValue,
794 const SvXMLUnitConverter& ) const
796 bool bRet = true;
797 sal_Bool bVal = sal_False;
798 if( ! IsXMLToken( rStrImpValue, XML_NONE ) )
800 bRet = false;
801 SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
802 OUString aToken;
803 while( aTokenEnum.getNextToken( aToken ) )
805 bRet = true;
806 if( aToken == sVal ||
807 (bHori && IsXMLToken( aToken, XML_HORIZONTAL ) ) )
809 bVal = sal_True;
810 break;
815 if( bRet )
816 rValue.setValue( &bVal, cppu::UnoType<bool>::get() );
818 return bRet;
821 bool XMLGrfMirrorPropHdl_Impl::exportXML(
822 OUString& rStrExpValue,
823 const Any& rValue,
824 const SvXMLUnitConverter& ) const
826 if( *static_cast<sal_Bool const *>(rValue.getValue()) )
828 if( rStrExpValue.isEmpty() ||
829 IsXMLToken( rStrExpValue, XML_NONE ) )
831 rStrExpValue = sVal;
833 else if( bHori &&
834 /* XML_HORIZONTAL_ON_LEFT_PAGES and XML_HORIZONTAL_ON_RIGHT_PAGES
835 are replaced by XML_HORIZONTAL_ON_EVEN and XML_HORIZONTAL_ON_ODD.
836 (#i49139#)
838 ( IsXMLToken( rStrExpValue, XML_HORIZONTAL_ON_EVEN ) ||
839 IsXMLToken( rStrExpValue, XML_HORIZONTAL_ON_ODD ) ))
841 rStrExpValue = GetXMLToken( XML_HORIZONTAL );
843 else
845 rStrExpValue = rStrExpValue + " " + sVal;
848 else if( rStrExpValue.isEmpty() )
850 rStrExpValue = GetXMLToken( XML_NONE );
853 return true;
856 XMLGrfMirrorPropHdl_Impl::~XMLGrfMirrorPropHdl_Impl()
860 SvXMLEnumMapEntry const pXML_Emphasize_Enum[] =
862 { XML_NONE, FontEmphasis::NONE },
863 { XML_DOT, FontEmphasis::DOT_ABOVE },
864 { XML_CIRCLE, FontEmphasis::CIRCLE_ABOVE },
865 { XML_DISC, FontEmphasis::DISK_ABOVE },
866 { XML_ACCENT, FontEmphasis::ACCENT_ABOVE },
867 { XML_TOKEN_INVALID, 0 }
869 class XMLTextEmphasizePropHdl_Impl : public XMLPropertyHandler
871 public:
872 XMLTextEmphasizePropHdl_Impl() {}
873 virtual ~XMLTextEmphasizePropHdl_Impl();
875 virtual bool importXML(
876 const OUString& rStrImpValue,
877 ::com::sun::star::uno::Any& rValue,
878 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
879 virtual bool exportXML(
880 OUString& rStrExpValue,
881 const ::com::sun::star::uno::Any& rValue,
882 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
885 bool XMLTextEmphasizePropHdl_Impl::importXML(
886 const OUString& rStrImpValue,
887 Any& rValue,
888 const SvXMLUnitConverter& ) const
890 bool bRet = true;
891 sal_uInt16 nVal = FontEmphasis::NONE;
892 bool bBelow = false;
893 bool bHasPos = false, bHasType = false;
894 OUString aToken;
896 SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
897 while( aTokenEnum.getNextToken( aToken ) )
899 if( !bHasPos && IsXMLToken( aToken, XML_ABOVE ) )
901 bBelow = false;
902 bHasPos = true;
904 else if( !bHasPos && IsXMLToken( aToken, XML_BELOW ) )
906 bBelow = true;
907 bHasPos = true;
909 else if( !bHasType &&
910 SvXMLUnitConverter::convertEnum( nVal, aToken,
911 pXML_Emphasize_Enum ))
913 bHasType = true;
915 else
917 bRet = false;
918 break;
922 if( bRet )
924 if( FontEmphasis::NONE != nVal && bBelow )
925 nVal += 10;
926 rValue <<= (sal_Int16)nVal;
929 return bRet;
932 bool XMLTextEmphasizePropHdl_Impl::exportXML(
933 OUString& rStrExpValue,
934 const Any& rValue,
935 const SvXMLUnitConverter& ) const
937 OUStringBuffer aOut( 15 );
938 bool bRet = true;
939 sal_Int16 nType = sal_Int16();
940 if( rValue >>= nType )
942 bool bBelow = false;
943 if( nType > 10 )
945 bBelow = true;
946 nType -= 10;
948 bRet = SvXMLUnitConverter::convertEnum( aOut, nType,
949 pXML_Emphasize_Enum,
950 XML_DOT );
951 if( bRet )
953 if( nType != 0 )
955 enum XMLTokenEnum ePos = bBelow ? XML_BELOW : XML_ABOVE;
956 aOut.append( ' ' );
957 aOut.append( GetXMLToken(ePos) );
959 rStrExpValue = aOut.makeStringAndClear();
963 return bRet;
966 XMLTextEmphasizePropHdl_Impl::~XMLTextEmphasizePropHdl_Impl()
970 class XMLTextCombineCharPropHdl_Impl : public XMLPropertyHandler
972 public:
973 XMLTextCombineCharPropHdl_Impl() {}
974 virtual ~XMLTextCombineCharPropHdl_Impl();
976 virtual bool importXML(
977 const OUString& rStrImpValue,
978 ::com::sun::star::uno::Any& rValue,
979 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
980 virtual bool exportXML(
981 OUString& rStrExpValue,
982 const ::com::sun::star::uno::Any& rValue,
983 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
986 bool XMLTextCombineCharPropHdl_Impl::importXML(
987 const OUString& rStrImpValue,
988 Any& rValue,
989 const SvXMLUnitConverter& ) const
991 if( !rStrImpValue.isEmpty() )
992 rValue <<= rStrImpValue.copy( 0, 1 );
993 else
994 rValue <<= rStrImpValue;
996 return true;
999 bool XMLTextCombineCharPropHdl_Impl::exportXML(
1000 OUString& rStrExpValue,
1001 const Any& rValue,
1002 const SvXMLUnitConverter& ) const
1004 rValue >>= rStrExpValue;
1006 // #i114107# attribute of type "character": export only if length is 1
1007 return (1 == rStrExpValue.getLength());
1010 XMLTextCombineCharPropHdl_Impl::~XMLTextCombineCharPropHdl_Impl()
1014 class XMLTextRelWidthHeightPropHdl_Impl : public XMLPropertyHandler
1016 public:
1017 XMLTextRelWidthHeightPropHdl_Impl() {}
1018 virtual ~XMLTextRelWidthHeightPropHdl_Impl();
1020 virtual bool importXML(
1021 const OUString& rStrImpValue,
1022 ::com::sun::star::uno::Any& rValue,
1023 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
1024 virtual bool exportXML(
1025 OUString& rStrExpValue,
1026 const ::com::sun::star::uno::Any& rValue,
1027 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
1030 bool XMLTextRelWidthHeightPropHdl_Impl::importXML(
1031 const OUString& rStrImpValue,
1032 Any& rValue,
1033 const SvXMLUnitConverter& ) const
1035 sal_Int32 nValue;
1036 bool const bRet = ::sax::Converter::convertPercent( nValue, rStrImpValue );
1037 if( bRet )
1038 rValue <<= (sal_Int16)nValue;
1040 return bRet;
1043 bool XMLTextRelWidthHeightPropHdl_Impl::exportXML(
1044 OUString& rStrExpValue,
1045 const Any& rValue,
1046 const SvXMLUnitConverter& ) const
1048 bool bRet = false;
1049 sal_Int16 nValue = sal_Int16();
1050 if( (rValue >>= nValue) && nValue > 0 )
1052 OUStringBuffer aOut;
1053 ::sax::Converter::convertPercent( aOut, nValue );
1054 rStrExpValue = aOut.makeStringAndClear();
1056 bRet = true;
1059 return bRet;
1062 XMLTextRelWidthHeightPropHdl_Impl::~XMLTextRelWidthHeightPropHdl_Impl()
1066 class XMLTextSyncWidthHeightPropHdl_Impl : public XMLPropertyHandler
1068 const OUString sValue;
1070 public:
1071 XMLTextSyncWidthHeightPropHdl_Impl( enum XMLTokenEnum eValue ) :
1072 sValue( GetXMLToken(eValue) ) {}
1073 virtual ~XMLTextSyncWidthHeightPropHdl_Impl();
1075 virtual bool importXML(
1076 const OUString& rStrImpValue,
1077 ::com::sun::star::uno::Any& rValue,
1078 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
1079 virtual bool exportXML(
1080 OUString& rStrExpValue,
1081 const ::com::sun::star::uno::Any& rValue,
1082 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
1085 bool XMLTextSyncWidthHeightPropHdl_Impl::importXML(
1086 const OUString& rStrImpValue,
1087 Any& rValue,
1088 const SvXMLUnitConverter& ) const
1090 sal_Bool bValue = (rStrImpValue == sValue );
1091 rValue.setValue( &bValue, cppu::UnoType<bool>::get() );
1093 return true;
1096 bool XMLTextSyncWidthHeightPropHdl_Impl::exportXML(
1097 OUString& rStrExpValue,
1098 const Any& rValue,
1099 const SvXMLUnitConverter& ) const
1101 bool bRet = false;
1102 if( *static_cast<sal_Bool const *>(rValue.getValue()) )
1104 rStrExpValue = sValue;
1105 bRet = true;
1108 return bRet;
1111 XMLTextSyncWidthHeightPropHdl_Impl::~XMLTextSyncWidthHeightPropHdl_Impl()
1115 class XMLTextRotationAnglePropHdl_Impl : public XMLPropertyHandler
1118 public:
1119 XMLTextRotationAnglePropHdl_Impl() {}
1120 virtual ~XMLTextRotationAnglePropHdl_Impl();
1122 virtual bool importXML(
1123 const OUString& rStrImpValue,
1124 ::com::sun::star::uno::Any& rValue,
1125 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
1126 virtual bool exportXML(
1127 OUString& rStrExpValue,
1128 const ::com::sun::star::uno::Any& rValue,
1129 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
1132 bool XMLTextRotationAnglePropHdl_Impl::importXML(
1133 const OUString& rStrImpValue,
1134 Any& rValue,
1135 const SvXMLUnitConverter& ) const
1137 sal_Int32 nValue;
1138 bool const bRet = ::sax::Converter::convertNumber( nValue, rStrImpValue );
1139 if( bRet )
1141 nValue = (nValue % 360 );
1142 if( nValue < 0 )
1143 nValue = 360 + nValue;
1144 sal_Int16 nAngle;
1145 if( nValue < 45 || nValue > 315 )
1146 nAngle = 0;
1147 else if( nValue < 180 )
1148 nAngle = 900;
1149 else /* if nValalue <= 315 ) */
1150 nAngle = 2700;
1151 rValue <<= nAngle;
1154 return bRet;
1157 bool XMLTextRotationAnglePropHdl_Impl::exportXML(
1158 OUString& rStrExpValue,
1159 const Any& rValue,
1160 const SvXMLUnitConverter& ) const
1162 sal_Int16 nAngle = sal_Int16();
1163 bool bRet = ( rValue >>= nAngle );
1164 if( bRet )
1166 OUStringBuffer aOut;
1167 ::sax::Converter::convertNumber( aOut, nAngle / 10 );
1168 rStrExpValue = aOut.makeStringAndClear();
1170 OSL_ENSURE( bRet, "illegal rotation angle" );
1172 return bRet;
1175 XMLTextRotationAnglePropHdl_Impl::~XMLTextRotationAnglePropHdl_Impl()
1178 class XMLNumber8OneBasedHdl : public XMLPropertyHandler
1181 public:
1182 XMLNumber8OneBasedHdl() {}
1183 virtual ~XMLNumber8OneBasedHdl() {};
1185 virtual bool importXML(
1186 const OUString& rStrImpValue,
1187 ::com::sun::star::uno::Any& rValue,
1188 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
1189 virtual bool exportXML(
1190 OUString& rStrExpValue,
1191 const ::com::sun::star::uno::Any& rValue,
1192 const SvXMLUnitConverter& ) const SAL_OVERRIDE;
1195 bool XMLNumber8OneBasedHdl::importXML(
1196 const OUString& rStrImpValue,
1197 Any& rValue,
1198 const SvXMLUnitConverter& ) const
1200 sal_Int32 nValue = 0;
1201 bool const bRet = ::sax::Converter::convertNumber(nValue, rStrImpValue);
1202 if( bRet )
1203 rValue <<= static_cast<sal_Int8>( nValue - 1 );
1204 return bRet;
1207 bool XMLNumber8OneBasedHdl::exportXML(
1208 OUString& rStrExpValue,
1209 const Any& rValue,
1210 const SvXMLUnitConverter& ) const
1212 sal_Int8 nValue = sal_Int8();
1213 bool bRet = ( rValue >>= nValue );
1214 if( bRet )
1216 OUStringBuffer aOut;
1217 ::sax::Converter::convertNumber( aOut, nValue + 1 );
1218 rStrExpValue = aOut.makeStringAndClear();
1220 return bRet;
1222 class XMLTextPropertyHandlerFactory_Impl
1224 public:
1225 static const XMLPropertyHandler *GetPropertyHandler( sal_Int32 nType );
1227 XMLTextPropertyHandlerFactory_Impl();
1228 ~XMLTextPropertyHandlerFactory_Impl();
1231 const XMLPropertyHandler *XMLTextPropertyHandlerFactory_Impl::GetPropertyHandler
1232 ( sal_Int32 nType )
1234 const XMLPropertyHandler* pHdl = 0;
1235 switch( nType )
1237 case XML_TYPE_TEXT_DROPCAP:
1238 pHdl = new XMLDropCapPropHdl_Impl;
1239 break;
1240 case XML_TYPE_TEXT_WRAP:
1241 pHdl = new XMLWrapPropHdl_Impl;
1242 break;
1243 case XML_TYPE_TEXT_PARAGRAPH_ONLY:
1244 pHdl = new XMLParagraphOnlyPropHdl_Impl;
1245 break;
1246 case XML_TYPE_TEXT_WRAP_OUTSIDE:
1247 pHdl = new XMLContourModePropHdl_Impl;
1248 break;
1249 case XML_TYPE_TEXT_OPAQUE:
1250 pHdl = new XMLOpaquePropHdl_Impl;
1251 break;
1252 case XML_TYPE_TEXT_PROTECT_CONTENT:
1253 pHdl = new XMLFrameProtectPropHdl_Impl( XML_CONTENT );
1254 break;
1255 case XML_TYPE_TEXT_PROTECT_SIZE:
1256 pHdl = new XMLFrameProtectPropHdl_Impl( XML_SIZE );
1257 break;
1258 case XML_TYPE_TEXT_PROTECT_POSITION:
1259 pHdl = new XMLFrameProtectPropHdl_Impl( XML_POSITION );
1260 break;
1261 case XML_TYPE_TEXT_ANCHOR_TYPE:
1262 pHdl = new XMLAnchorTypePropHdl;
1263 break;
1264 case XML_TYPE_TEXT_COLUMNS:
1265 pHdl = new XMLTextColumnsPropertyHandler;
1266 break;
1267 case XML_TYPE_TEXT_HORIZONTAL_POS:
1268 pHdl = new XMLConstantsPropertyHandler( pXML_HoriPos_Enum, XML_TOKEN_INVALID );
1269 break;
1270 case XML_TYPE_TEXT_HORIZONTAL_POS_MIRRORED:
1271 pHdl = new XMLConstantsPropertyHandler( pXML_HoriPosMirrored_Enum, XML_TOKEN_INVALID );
1272 break;
1273 case XML_TYPE_TEXT_HORIZONTAL_REL:
1274 pHdl = new XMLConstantsPropertyHandler( pXML_HoriRel_Enum, XML_TOKEN_INVALID );
1275 break;
1276 case XML_TYPE_TEXT_HORIZONTAL_REL_FRAME:
1277 pHdl = new XMLConstantsPropertyHandler( pXML_HoriRelFrame_Enum, XML_TOKEN_INVALID );
1278 break;
1279 case XML_TYPE_TEXT_HORIZONTAL_MIRROR:
1280 pHdl = new XMLHoriMirrorPropHdl_Impl;
1281 break;
1282 case XML_TYPE_TEXT_VERTICAL_POS:
1283 pHdl = new XMLConstantsPropertyHandler( pXML_VertPos_Enum, XML_TOKEN_INVALID );
1284 break;
1285 case XML_TYPE_TEXT_VERTICAL_POS_AT_CHAR:
1286 pHdl = new XMLConstantsPropertyHandler( pXML_VertPosAtChar_Enum, XML_TOKEN_INVALID );
1287 break;
1288 case XML_TYPE_TEXT_VERTICAL_REL:
1289 pHdl = new XMLConstantsPropertyHandler( pXML_VertRel_Enum, XML_TOKEN_INVALID );
1290 break;
1291 case XML_TYPE_TEXT_VERTICAL_REL_PAGE:
1292 pHdl = new XMLConstantsPropertyHandler( pXML_VertRelPage_Enum, XML_TOKEN_INVALID );
1293 break;
1294 case XML_TYPE_TEXT_VERTICAL_REL_FRAME:
1295 pHdl = new XMLConstantsPropertyHandler( pXML_VertRelFrame_Enum, XML_TOKEN_INVALID );
1296 break;
1297 case XML_TYPE_TEXT_VERTICAL_REL_AS_CHAR:
1298 pHdl = new XMLConstantsPropertyHandler( pXML_VertRelAsChar_Enum, XML_TOKEN_INVALID );
1299 break;
1300 case XML_TYPE_TEXT_MIRROR_VERTICAL:
1301 pHdl = new XMLGrfMirrorPropHdl_Impl( XML_VERTICAL, false );
1302 break;
1303 case XML_TYPE_TEXT_MIRROR_HORIZONTAL_LEFT:
1304 // XML_HORIZONTAL_ON_LEFT_PAGES is replaced by XML_HORIZONTAL_ON_EVEN. (#i49139#)
1305 pHdl = new XMLGrfMirrorPropHdl_Impl( XML_HORIZONTAL_ON_EVEN, true );
1306 break;
1307 case XML_TYPE_TEXT_MIRROR_HORIZONTAL_RIGHT:
1308 // XML_HORIZONTAL_ON_RIGHT_PAGES is replaced by XML_HORIZONTAL_ON_ODD. (#i49139#)
1309 pHdl = new XMLGrfMirrorPropHdl_Impl( XML_HORIZONTAL_ON_ODD, true );
1310 break;
1311 case XML_TYPE_TEXT_CLIP:
1312 pHdl = new XMLClipPropertyHandler( false );
1313 break;
1314 case XML_TYPE_TEXT_CLIP11:
1315 pHdl = new XMLClipPropertyHandler( true );
1316 break;
1317 case XML_TYPE_TEXT_EMPHASIZE:
1318 pHdl = new XMLTextEmphasizePropHdl_Impl;
1319 break;
1320 case XML_TYPE_TEXT_COMBINE:
1321 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_LINES ),
1322 GetXMLToken( XML_NONE ) );
1323 break;
1324 case XML_TYPE_TEXT_COMBINE_CHARACTERS:
1325 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_LETTERS ),
1326 GetXMLToken( XML_NONE ) );
1327 break;
1328 case XML_TYPE_TEXT_COMBINECHAR:
1329 pHdl = new XMLTextCombineCharPropHdl_Impl;
1330 break;
1331 case XML_TYPE_TEXT_AUTOSPACE:
1332 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_IDEOGRAPH_ALPHA ),
1333 GetXMLToken( XML_NONE ) );
1334 break;
1335 case XML_TYPE_TEXT_PUNCTUATION_WRAP:
1336 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_HANGING ),
1337 GetXMLToken( XML_SIMPLE ) );
1338 break;
1339 case XML_TYPE_TEXT_LINE_BREAK:
1340 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_STRICT ),
1341 GetXMLToken( XML_NORMAL ) );
1342 break;
1343 case XML_TYPE_TEXT_REL_WIDTH_HEIGHT:
1344 pHdl = new XMLTextRelWidthHeightPropHdl_Impl;
1345 break;
1346 case XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT:
1347 pHdl = new XMLTextSyncWidthHeightPropHdl_Impl( XML_SCALE );
1348 break;
1349 case XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT_MIN:
1350 pHdl = new XMLTextSyncWidthHeightPropHdl_Impl( XML_SCALE_MIN );
1351 break;
1352 case XML_TYPE_TEXT_RUBY_ADJUST:
1353 pHdl = new XMLConstantsPropertyHandler( pXML_RubyAdjust_Enum, XML_TOKEN_INVALID );
1354 break;
1355 case XML_TYPE_TEXT_FONT_RELIEF:
1356 pHdl = new XMLConstantsPropertyHandler( pXML_FontRelief_Enum, XML_TOKEN_INVALID );
1357 break;
1358 case XML_TYPE_TEXT_ROTATION_ANGLE:
1359 pHdl = new XMLTextRotationAnglePropHdl_Impl;
1360 break;
1361 case XML_TYPE_TEXT_ROTATION_SCALE:
1362 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_FIXED ),
1363 GetXMLToken( XML_LINE_HEIGHT ) );
1364 break;
1365 case XML_TYPE_TEXT_VERTICAL_ALIGN:
1366 pHdl = new XMLConstantsPropertyHandler( pXML_ParaVerticalAlign_Enum, XML_TOKEN_INVALID );
1367 break;
1368 case XML_TYPE_TEXT_RUBY_POSITION:
1369 pHdl = new XMLNamedBoolPropertyHdl( ::xmloff::token::XML_ABOVE,
1370 ::xmloff::token::XML_BELOW );
1371 break;
1372 // OD 2004-05-05 #i28701#
1373 case XML_TYPE_WRAP_INFLUENCE_ON_POSITION:
1374 pHdl = new XMLConstantsPropertyHandler( pXML_WrapInfluenceOnPosition_Enum,
1375 XML_TOKEN_INVALID );
1376 break;
1377 case XML_TYPE_BORDER_MODEL:
1378 pHdl = new XMLNamedBoolPropertyHdl( xmloff::token::XML_COLLAPSING,
1379 xmloff::token::XML_SEPARATING );
1380 break;
1381 case XML_TYPE_TEXT_LINE_MODE:
1382 pHdl = new XMLNamedBoolPropertyHdl(
1383 ::xmloff::token::XML_SKIP_WHITE_SPACE,
1384 ::xmloff::token::XML_CONTINUOUS);
1385 break;
1386 case XML_TYPE_TEXT_KEEP:
1387 pHdl = new XMLNamedBoolPropertyHdl(
1388 ::xmloff::token::XML_ALWAYS,
1389 ::xmloff::token::XML_AUTO);
1390 break;
1391 case XML_TYPE_TEXT_NKEEP:
1392 pHdl = new XMLNamedBoolPropertyHdl(
1393 ::xmloff::token::XML_AUTO,
1394 ::xmloff::token::XML_ALWAYS);
1395 break;
1396 case XML_TYPE_TEXT_NUMBER8_ONE_BASED:
1397 pHdl = new XMLNumber8OneBasedHdl();
1398 break;
1399 case XML_TYPE_VERTICAL_ALIGN:
1400 pHdl = new XMLConstantsPropertyHandler( pXML_VerticalAlign_Enum, XML_TOKEN_INVALID );
1401 break;
1403 //UUUU
1404 case XML_SW_TYPE_FILLSTYLE:
1405 pHdl = new XMLEnumPropertyHdl( aXML_FillStyle_EnumMap, cppu::UnoType<FillStyle>::get());
1406 break;
1407 case XML_SW_TYPE_FILLBITMAPSIZE:
1408 pHdl = new XMLFillBitmapSizePropertyHandler();
1409 break;
1410 case XML_SW_TYPE_LOGICAL_SIZE:
1411 pHdl = new XMLBitmapLogicalSizePropertyHandler();
1412 break;
1413 case XML_SW_TYPE_BITMAP_REFPOINT:
1414 pHdl = new XMLEnumPropertyHdl( aXML_RefPoint_EnumMap, cppu::UnoType<RectanglePoint>::get());
1415 break;
1416 case XML_SW_TYPE_BITMAP_MODE:
1417 pHdl = new XMLEnumPropertyHdl( aXML_BitmapMode_EnumMap, cppu::UnoType<BitmapMode>::get());
1418 break;
1419 case XML_SW_TYPE_BITMAPREPOFFSETX:
1420 case XML_SW_TYPE_BITMAPREPOFFSETY:
1421 pHdl = new XMLBitmapRepeatOffsetPropertyHandler(XML_SW_TYPE_BITMAPREPOFFSETX == nType);
1422 break;
1424 //UUUU
1425 default:
1427 OSL_ENSURE(false, "XMLPropertyHandler missing (!)");
1428 break;
1432 return pHdl;
1435 XMLTextPropertyHandlerFactory_Impl::XMLTextPropertyHandlerFactory_Impl()
1439 XMLTextPropertyHandlerFactory_Impl::~XMLTextPropertyHandlerFactory_Impl()
1443 XMLTextPropertyHandlerFactory::XMLTextPropertyHandlerFactory() :
1444 XMLPropertyHandlerFactory(),
1445 pImpl( new XMLTextPropertyHandlerFactory_Impl )
1449 XMLTextPropertyHandlerFactory::~XMLTextPropertyHandlerFactory()
1451 delete pImpl;
1454 const XMLPropertyHandler *XMLTextPropertyHandlerFactory::GetPropertyHandler(
1455 sal_Int32 nType ) const
1457 const XMLPropertyHandler *pHdl =
1458 XMLPropertyHandlerFactory::GetPropertyHandler( nType );
1460 if( !pHdl )
1462 const XMLPropertyHandler *pNewHdl = XMLTextPropertyHandlerFactory_Impl::GetPropertyHandler( nType );
1464 if( pNewHdl )
1465 PutHdlCache( nType, pNewHdl );
1467 pHdl = pNewHdl;
1470 return pHdl;
1473 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */