merge the formfield patch from ooo-build
[ooovba.git] / xmloff / source / text / txtprhdl.cxx
blobcff7eee8d94e96c2d2b1f3d619be62f9a94bdb75
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: txtprhdl.cxx,v $
10 * $Revision: 1.41 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
33 #include <tools/debug.hxx>
34 #include <rtl/ustrbuf.hxx>
35 #include <vcl/vclenum.hxx>
36 #include <com/sun/star/uno/Any.hxx>
37 #include <com/sun/star/style/DropCapFormat.hpp>
38 #include <com/sun/star/text/FontRelief.hpp>
39 #include <com/sun/star/text/WrapTextMode.hpp>
40 #include <com/sun/star/text/XTextColumns.hpp>
41 #include <com/sun/star/text/TextColumn.hpp>
42 #include <com/sun/star/text/RelOrientation.hpp>
43 #include <com/sun/star/text/HoriOrientation.hpp>
44 #include <com/sun/star/text/VertOrientation.hpp>
45 #include <com/sun/star/text/RubyAdjust.hpp>
46 #include <com/sun/star/text/FontEmphasis.hpp>
47 #include <com/sun/star/text/ParagraphVertAlign.hpp>
48 #include <xmloff/xmltypes.hxx>
49 #include <xmloff/xmluconv.hxx>
50 #include <xmloff/xmltoken.hxx>
51 #include "XMLAnchorTypePropHdl.hxx"
52 #include <xmloff/XMLConstantsPropertyHandler.hxx>
53 #include "XMLClipPropertyHandler.hxx"
54 #ifndef _XMLOFF_XMLTEXTCOLUMNSPPROPERTYHANDLER_HXX
55 #include "XMLTextColumnsPropertyHandler.hxx"
56 #endif
57 #include <xmloff/NamedBoolPropertyHdl.hxx>
58 #ifndef _XMLOFF_TXTPRHDL_HXX
59 #include "txtprhdl.hxx"
60 #endif
61 // OD 2004-05-05 #i28701#
62 #include <com/sun/star/text/WrapInfluenceOnPosition.hpp>
65 using ::rtl::OUString;
66 using ::rtl::OUStringBuffer;
68 //using namespace ::com::sun::star;
69 using namespace ::com::sun::star::uno;
70 using namespace ::com::sun::star::style;
71 //using namespace ::com::sun::star::container;
72 //using namespace ::com::sun::star::beans;
73 using namespace ::com::sun::star::text;
74 using namespace ::xmloff::token;
77 #define CONSTASCII_USTRINGPARAM_CMP(s) s, sizeof(s)-1
79 // ---------------------------------------------------------------------------
81 SvXMLEnumMapEntry __READONLY_DATA pXML_HoriPos_Enum[] =
83 { XML_FROM_LEFT, HoriOrientation::NONE },
84 { XML_FROM_INSIDE, HoriOrientation::NONE }, // import only
85 { XML_LEFT, HoriOrientation::LEFT },
86 { XML_INSIDE, HoriOrientation::LEFT }, // import only
87 { XML_CENTER, HoriOrientation::CENTER },
88 { XML_RIGHT, HoriOrientation::RIGHT },
89 { XML_OUTSIDE, HoriOrientation::RIGHT }, // import only
90 { XML_TOKEN_INVALID, 0 }
93 SvXMLEnumMapEntry __READONLY_DATA pXML_HoriPosMirrored_Enum[] =
95 { XML_FROM_INSIDE, HoriOrientation::NONE },
96 { XML_INSIDE, HoriOrientation::LEFT },
97 { XML_CENTER, HoriOrientation::CENTER },
98 { XML_OUTSIDE, HoriOrientation::RIGHT },
99 { XML_TOKEN_INVALID, 0 }
102 SvXMLEnumMapEntry __READONLY_DATA pXML_HoriRel_Enum[] =
104 { XML_PARAGRAPH, RelOrientation::FRAME },
105 { XML_PARAGRAPH_CONTENT, RelOrientation::PRINT_AREA },
106 { XML_PAGE, RelOrientation::PAGE_FRAME },
107 { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
108 { XML_PARAGRAPH_START_MARGIN, RelOrientation::FRAME_LEFT },
109 { XML_PARAGRAPH_END_MARGIN, RelOrientation::FRAME_RIGHT },
110 { XML_PAGE_START_MARGIN, RelOrientation::PAGE_LEFT },
111 { XML_PAGE_END_MARGIN, RelOrientation::PAGE_RIGHT },
112 { XML_CHAR, RelOrientation::CHAR },
113 { XML_FRAME, RelOrientation::FRAME }, // import only
114 { XML_FRAME_CONTENT, RelOrientation::PRINT_AREA }, // import only
115 { XML_FRAME_START_MARGIN, RelOrientation::FRAME_LEFT }, // import only
116 { XML_FRAME_END_MARGIN, RelOrientation::FRAME_RIGHT }, // import only
117 { XML_TOKEN_INVALID, 0 }
120 SvXMLEnumMapEntry __READONLY_DATA pXML_HoriRelFrame_Enum[] =
122 { XML_FRAME, RelOrientation::FRAME },
123 { XML_FRAME_CONTENT, RelOrientation::PRINT_AREA },
124 { XML_PAGE, RelOrientation::PAGE_FRAME },
125 { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
126 { XML_FRAME_START_MARGIN, RelOrientation::FRAME_LEFT },
127 { XML_FRAME_END_MARGIN, RelOrientation::FRAME_RIGHT },
128 { XML_PAGE_START_MARGIN, RelOrientation::PAGE_LEFT },
129 { XML_PAGE_END_MARGIN, RelOrientation::PAGE_RIGHT },
130 { XML_CHAR, RelOrientation::CHAR },
131 { XML_TOKEN_INVALID, 0 }
134 SvXMLEnumMapEntry __READONLY_DATA pXML_HoriMirror_Enum[] =
136 { XML_FROM_LEFT, sal_False },
137 { XML_FROM_INSIDE, sal_True },
138 { XML_LEFT, sal_False },
139 { XML_INSIDE, sal_True },
140 { XML_CENTER, sal_False },
141 { XML_RIGHT, sal_False },
142 { XML_OUTSIDE, sal_True },
143 { XML_TOKEN_INVALID, 0 }
146 SvXMLEnumMapEntry __READONLY_DATA pXML_VertPos_Enum[] =
148 { XML_FROM_TOP, VertOrientation::NONE },
149 { XML_TOP, VertOrientation::TOP },
150 { XML_TOP, VertOrientation::CHAR_TOP }, // export only
151 { XML_TOP, VertOrientation::LINE_TOP }, // export only
152 { XML_MIDDLE, VertOrientation::CENTER },
153 { XML_MIDDLE, VertOrientation::CHAR_CENTER }, // export only
154 { XML_MIDDLE, VertOrientation::LINE_CENTER }, // export only
155 { XML_BOTTOM, VertOrientation::BOTTOM },
156 { XML_BOTTOM, VertOrientation::CHAR_BOTTOM }, // export only
157 { XML_BOTTOM, VertOrientation::LINE_BOTTOM }, // export only
158 { XML_BELOW, VertOrientation::CHAR_BOTTOM }, // import only
159 { XML_TOKEN_INVALID, 0 }
162 SvXMLEnumMapEntry __READONLY_DATA pXML_VertPosAtChar_Enum[] =
164 { XML_FROM_TOP, VertOrientation::NONE },
165 { XML_TOP, VertOrientation::TOP },
166 { XML_TOP, VertOrientation::CHAR_TOP }, // export only
167 { XML_TOP, VertOrientation::LINE_TOP }, // export only
168 { XML_MIDDLE, VertOrientation::CENTER },
169 { XML_MIDDLE, VertOrientation::CHAR_CENTER }, // export only
170 { XML_MIDDLE, VertOrientation::LINE_CENTER }, // export only
171 { XML_BOTTOM, VertOrientation::BOTTOM },
172 { XML_BELOW, VertOrientation::CHAR_BOTTOM }, // export only
173 { XML_BOTTOM, VertOrientation::LINE_BOTTOM }, // export only
174 { XML_TOKEN_INVALID, 0 }
177 SvXMLEnumMapEntry __READONLY_DATA pXML_VertRel_Enum[] =
179 { XML_PARAGRAPH, RelOrientation::FRAME },
180 { XML_PARAGRAPH_CONTENT, RelOrientation::PRINT_AREA },
181 { XML_CHAR, RelOrientation::CHAR },
182 // DVO, OD 17.09.2003 #i18732# - allow vertical alignment at page
183 { XML_PAGE, RelOrientation::PAGE_FRAME },
184 { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
185 { XML_FRAME, RelOrientation::FRAME }, // import only
186 { XML_FRAME_CONTENT, RelOrientation::PRINT_AREA }, // import only
187 // OD 13.11.2003 #i22341# - new vertical alignment at top of line
188 { XML_LINE, RelOrientation::TEXT_LINE },
189 { XML_TOKEN_INVALID, 0 }
192 SvXMLEnumMapEntry __READONLY_DATA pXML_VertRelPage_Enum[] =
194 { XML_PAGE, RelOrientation::FRAME },
195 { XML_PAGE_CONTENT, RelOrientation::PRINT_AREA },
196 { XML_PAGE, RelOrientation::PAGE_FRAME },
197 { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
198 { XML_TOKEN_INVALID, 0 }
201 SvXMLEnumMapEntry __READONLY_DATA pXML_VertRelFrame_Enum[] =
203 { XML_FRAME, RelOrientation::FRAME },
204 { XML_FRAME_CONTENT, RelOrientation::PRINT_AREA },
205 { XML_TOKEN_INVALID, 0 }
208 SvXMLEnumMapEntry __READONLY_DATA pXML_VertRelAsChar_Enum[] =
210 { XML_BASELINE, VertOrientation::TOP },
211 { XML_BASELINE, VertOrientation::CENTER }, // export only
212 { XML_BASELINE, VertOrientation::BOTTOM }, // export only
213 { XML_TEXT, VertOrientation::CHAR_TOP },
214 { XML_TEXT, VertOrientation::CHAR_CENTER }, // export only
215 { XML_TEXT, VertOrientation::CHAR_BOTTOM }, // export only
216 { XML_LINE, VertOrientation::LINE_TOP },
217 { XML_LINE, VertOrientation::LINE_CENTER }, // export only
218 { XML_LINE, VertOrientation::LINE_BOTTOM }, // export only
219 { XML_TOKEN_INVALID, 0 }
222 SvXMLEnumMapEntry __READONLY_DATA pXML_RubyAdjust_Enum[] =
224 { XML_LEFT, RubyAdjust_LEFT },
225 { XML_CENTER, RubyAdjust_CENTER },
226 { XML_RIGHT, RubyAdjust_RIGHT },
227 { XML_DISTRIBUTE_LETTER, RubyAdjust_BLOCK },
228 { XML_DISTRIBUTE_SPACE, RubyAdjust_INDENT_BLOCK },
229 { XML_TOKEN_INVALID, 0 }
232 SvXMLEnumMapEntry __READONLY_DATA pXML_FontRelief_Enum[] =
234 { XML_NONE, FontRelief::NONE },
235 { XML_ENGRAVED, FontRelief::ENGRAVED },
236 { XML_EMBOSSED, FontRelief::EMBOSSED },
237 { XML_TOKEN_INVALID, 0 }
240 SvXMLEnumMapEntry __READONLY_DATA pXML_VerticalAlign_Enum[] =
242 { XML_TOP, ParagraphVertAlign::TOP },
243 { XML_MIDDLE, ParagraphVertAlign::CENTER },
244 { XML_BOTTOM, ParagraphVertAlign::BOTTOM },
245 { XML_BASELINE, ParagraphVertAlign::BASELINE },
246 { XML_AUTO, ParagraphVertAlign::AUTOMATIC },
247 { XML_TOKEN_INVALID, 0 }
250 // OD 2004-05-05 #i28701#
251 SvXMLEnumMapEntry __READONLY_DATA pXML_WrapInfluenceOnPosition_Enum[] =
253 // --> OD 2004-10-18 #i35017# - tokens have been renamed and
254 // <XML_ITERATIVE> has been added
255 { XML_ONCE_SUCCESSIVE, WrapInfluenceOnPosition::ONCE_SUCCESSIVE },
256 { XML_ONCE_CONCURRENT, WrapInfluenceOnPosition::ONCE_CONCURRENT },
257 { XML_ITERATIVE, WrapInfluenceOnPosition::ITERATIVE },
258 // <--
259 { XML_TOKEN_INVALID, 0 }
262 // ---------------------------------------------------------------------------
264 class XMLDropCapPropHdl_Impl : public XMLPropertyHandler
266 public:
267 virtual ~XMLDropCapPropHdl_Impl ();
269 virtual bool equals(
270 const ::com::sun::star::uno::Any& r1,
271 const ::com::sun::star::uno::Any& r2 ) const;
273 /// TabStops will be imported/exported as XML-Elements. So the Import/Export-work must be done at another place.
274 virtual sal_Bool importXML(
275 const ::rtl::OUString& rStrImpValue,
276 ::com::sun::star::uno::Any& rValue,
277 const SvXMLUnitConverter& ) const;
278 virtual sal_Bool exportXML(
279 ::rtl::OUString& rStrExpValue,
280 const ::com::sun::star::uno::Any& rValue,
281 const SvXMLUnitConverter& ) const;
284 XMLDropCapPropHdl_Impl::~XMLDropCapPropHdl_Impl ()
288 bool XMLDropCapPropHdl_Impl::equals(
289 const Any& r1,
290 const Any& r2 ) const
292 DropCapFormat aFormat1, aFormat2;
293 r1 >>= aFormat1;
294 r2 >>= aFormat2;
296 return (aFormat1.Lines <=1 && aFormat2.Lines <=1) ||
297 (aFormat1.Lines == aFormat2.Lines &&
298 aFormat1.Count == aFormat2.Count &&
299 aFormat1.Distance == aFormat2.Distance);
302 sal_Bool XMLDropCapPropHdl_Impl::importXML(
303 const OUString&,
304 Any&,
305 const SvXMLUnitConverter& ) const
307 DBG_ASSERT( !this, "drop caps are an element import property" );
308 return sal_False;
311 sal_Bool XMLDropCapPropHdl_Impl::exportXML(
312 OUString&,
313 const Any&,
314 const SvXMLUnitConverter& ) const
316 DBG_ASSERT( !this, "drop caps are an element export property" );
317 return sal_False;
320 // ---------------------------------------------------------------------------
322 class XMLOpaquePropHdl_Impl : public XMLPropertyHandler
324 public:
325 virtual ~XMLOpaquePropHdl_Impl ();
327 virtual sal_Bool importXML(
328 const ::rtl::OUString& rStrImpValue,
329 ::com::sun::star::uno::Any& rValue,
330 const SvXMLUnitConverter& ) const;
331 virtual sal_Bool exportXML(
332 ::rtl::OUString& rStrExpValue,
333 const ::com::sun::star::uno::Any& rValue,
334 const SvXMLUnitConverter& ) const;
337 sal_Bool XMLOpaquePropHdl_Impl::importXML(
338 const OUString& rStrImpValue,
339 Any& rValue,
340 const SvXMLUnitConverter& ) const
342 sal_Bool bRet = sal_True;
343 sal_Bool bVal = sal_False;
344 if( IsXMLToken( rStrImpValue, XML_FOREGROUND ) )
345 bVal = sal_True;
346 else if( !IsXMLToken( rStrImpValue, XML_BACKGROUND ) )
347 bRet = sal_False;
349 if( bRet )
350 rValue.setValue( &bVal, ::getBooleanCppuType() );
352 return bRet;
355 sal_Bool XMLOpaquePropHdl_Impl::exportXML(
356 OUString& rStrExpValue,
357 const Any& rValue,
358 const SvXMLUnitConverter& ) const
360 if( *(sal_Bool *)rValue.getValue() )
361 rStrExpValue = GetXMLToken( XML_FOREGROUND );
362 else
363 rStrExpValue = GetXMLToken( XML_BACKGROUND );
365 return sal_True;
368 XMLOpaquePropHdl_Impl::~XMLOpaquePropHdl_Impl ()
372 // ---------------------------------------------------------------------------
374 class XMLContourModePropHdl_Impl : public XMLPropertyHandler
376 public:
377 virtual ~XMLContourModePropHdl_Impl ();
379 virtual sal_Bool importXML(
380 const ::rtl::OUString& rStrImpValue,
381 ::com::sun::star::uno::Any& rValue,
382 const SvXMLUnitConverter& ) const;
383 virtual sal_Bool exportXML(
384 ::rtl::OUString& rStrExpValue,
385 const ::com::sun::star::uno::Any& rValue,
386 const SvXMLUnitConverter& ) const;
389 sal_Bool XMLContourModePropHdl_Impl::importXML(
390 const OUString& rStrImpValue,
391 Any& rValue,
392 const SvXMLUnitConverter& ) const
394 sal_Bool bRet = sal_True;
395 sal_Bool bVal = sal_False;
396 if( IsXMLToken( rStrImpValue, XML_OUTSIDE ) )
397 bVal = sal_True;
398 else if( ! IsXMLToken( rStrImpValue, XML_FULL ) )
399 bRet = sal_False;
401 if( bRet )
402 rValue.setValue( &bVal, ::getBooleanCppuType() );
404 return bRet;
407 sal_Bool XMLContourModePropHdl_Impl::exportXML(
408 OUString& rStrExpValue,
409 const Any& rValue,
410 const SvXMLUnitConverter& ) const
412 if( *(sal_Bool *)rValue.getValue() )
413 rStrExpValue = GetXMLToken( XML_OUTSIDE );
414 else
415 rStrExpValue = GetXMLToken( XML_FULL );
417 return sal_True;
420 XMLContourModePropHdl_Impl::~XMLContourModePropHdl_Impl()
424 // ---------------------------------------------------------------------------
426 class XMLParagraphOnlyPropHdl_Impl : public XMLPropertyHandler
428 public:
429 virtual ~XMLParagraphOnlyPropHdl_Impl ();
431 virtual sal_Bool importXML(
432 const ::rtl::OUString& rStrImpValue,
433 ::com::sun::star::uno::Any& rValue,
434 const SvXMLUnitConverter& ) const;
435 virtual sal_Bool exportXML(
436 ::rtl::OUString& rStrExpValue,
437 const ::com::sun::star::uno::Any& rValue,
438 const SvXMLUnitConverter& ) const;
441 sal_Bool XMLParagraphOnlyPropHdl_Impl::importXML(
442 const OUString& rStrImpValue,
443 Any& rValue,
444 const SvXMLUnitConverter& ) const
446 sal_Bool bRet = sal_True;
447 sal_Bool bVal = sal_False;
449 if( ! IsXMLToken( rStrImpValue, XML_NO_LIMIT ) )
451 sal_Int32 nValue = 0;
452 bRet = SvXMLUnitConverter::convertNumber( nValue, rStrImpValue );
453 bVal = 1 == nValue;
456 if( bRet )
457 rValue.setValue( &bVal, ::getBooleanCppuType() );
459 return bRet;
462 sal_Bool XMLParagraphOnlyPropHdl_Impl::exportXML(
463 OUString& rStrExpValue,
464 const Any& rValue,
465 const SvXMLUnitConverter& ) const
467 if( *(sal_Bool *)rValue.getValue() )
468 rStrExpValue = GetXMLToken( XML_1 );
469 else
470 rStrExpValue = GetXMLToken( XML_NO_LIMIT );
472 return sal_True;
475 XMLParagraphOnlyPropHdl_Impl::~XMLParagraphOnlyPropHdl_Impl()
479 // ---------------------------------------------------------------------------
481 SvXMLEnumMapEntry __READONLY_DATA pXML_Wrap_Enum[] =
483 { XML_NONE, WrapTextMode_NONE },
484 { XML_RUN_THROUGH, WrapTextMode_THROUGHT },
485 { XML_PARALLEL, WrapTextMode_PARALLEL },
486 { XML_DYNAMIC, WrapTextMode_DYNAMIC },
487 { XML_LEFT, WrapTextMode_LEFT },
488 { XML_RIGHT, WrapTextMode_RIGHT },
489 { XML_TOKEN_INVALID, 0 }
492 class XMLWrapPropHdl_Impl : public XMLPropertyHandler
494 public:
495 virtual ~XMLWrapPropHdl_Impl ();
497 virtual sal_Bool importXML(
498 const ::rtl::OUString& rStrImpValue,
499 ::com::sun::star::uno::Any& rValue,
500 const SvXMLUnitConverter& ) const;
501 virtual sal_Bool exportXML(
502 ::rtl::OUString& rStrExpValue,
503 const ::com::sun::star::uno::Any& rValue,
504 const SvXMLUnitConverter& ) const;
507 sal_Bool XMLWrapPropHdl_Impl::importXML(
508 const OUString& rStrImpValue,
509 Any& rValue,
510 const SvXMLUnitConverter& ) const
512 sal_uInt16 nWrap;
513 sal_Bool bRet = SvXMLUnitConverter::convertEnum( nWrap, rStrImpValue,
514 pXML_Wrap_Enum );
516 if( bRet )
517 rValue <<= (WrapTextMode)nWrap;
519 return bRet;
522 sal_Bool XMLWrapPropHdl_Impl::exportXML(
523 OUString& rStrExpValue,
524 const Any& rValue,
525 const SvXMLUnitConverter& ) const
527 OUStringBuffer aOut;
528 WrapTextMode eVal;
530 rValue >>= eVal;
532 sal_Bool bRet = SvXMLUnitConverter::convertEnum( aOut, eVal, pXML_Wrap_Enum, XML_NONE );
534 rStrExpValue = aOut.makeStringAndClear();
536 return bRet;
539 XMLWrapPropHdl_Impl::~XMLWrapPropHdl_Impl ()
543 // ---------------------------------------------------------------------------
545 class XMLFrameProtectPropHdl_Impl : public XMLPropertyHandler
547 const OUString sVal;
548 public:
549 XMLFrameProtectPropHdl_Impl( enum XMLTokenEnum eVal ) :
550 sVal( GetXMLToken(eVal) ) {}
551 virtual ~XMLFrameProtectPropHdl_Impl ();
553 virtual sal_Bool importXML(
554 const ::rtl::OUString& rStrImpValue,
555 ::com::sun::star::uno::Any& rValue,
556 const SvXMLUnitConverter& ) const;
557 virtual sal_Bool exportXML(
558 ::rtl::OUString& rStrExpValue,
559 const ::com::sun::star::uno::Any& rValue,
560 const SvXMLUnitConverter& ) const;
563 sal_Bool XMLFrameProtectPropHdl_Impl::importXML(
564 const OUString& rStrImpValue,
565 Any& rValue,
566 const SvXMLUnitConverter& ) const
568 sal_Bool bRet = sal_True;
569 sal_Bool bVal = sal_False;
570 if( ! IsXMLToken( rStrImpValue, XML_NONE ) )
572 bRet = sal_False;
573 SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
574 OUString aToken;
575 while( aTokenEnum.getNextToken( aToken ) )
577 bRet = sal_True;
578 if( aToken == sVal )
580 bVal = sal_True;
581 break;
586 if( bRet )
587 rValue.setValue( &bVal, ::getBooleanCppuType() );
589 return bRet;
592 sal_Bool XMLFrameProtectPropHdl_Impl::exportXML(
593 OUString& rStrExpValue,
594 const Any& rValue,
595 const SvXMLUnitConverter& ) const
597 if( *(sal_Bool *)rValue.getValue() )
599 if( !rStrExpValue.getLength() ||
600 IsXMLToken( rStrExpValue, XML_NONE ) )
602 rStrExpValue = sVal;
604 else
606 OUStringBuffer aOut( rStrExpValue.getLength() + 1 +
607 sVal.getLength() );
608 aOut.append( rStrExpValue );
609 aOut.append( (sal_Unicode)' ' );
610 aOut.append( sVal );
611 rStrExpValue = aOut.makeStringAndClear();
614 else if( !rStrExpValue.getLength() )
616 rStrExpValue = GetXMLToken( XML_NONE );
619 return sal_True;
622 XMLFrameProtectPropHdl_Impl::~XMLFrameProtectPropHdl_Impl()
626 // ---------------------------------------------------------------------------
628 SvXMLEnumMapEntry __READONLY_DATA pXML_Anchor_Enum[] =
630 { XML_CHAR, TextContentAnchorType_AT_CHARACTER },
631 { XML_PAGE, TextContentAnchorType_AT_PAGE },
632 { XML_FRAME, TextContentAnchorType_AT_FRAME },
633 { XML_PARAGRAPH, TextContentAnchorType_AT_PARAGRAPH },
634 { XML_AS_CHAR, TextContentAnchorType_AS_CHARACTER },
635 { XML_TOKEN_INVALID, 0 }
639 sal_Bool XMLAnchorTypePropHdl::importXML(
640 const OUString& rStrImpValue,
641 Any& rValue,
642 const SvXMLUnitConverter& ) const
644 sal_uInt16 nAnchor;
645 sal_Bool bRet = SvXMLUnitConverter::convertEnum( nAnchor, rStrImpValue,
646 pXML_Anchor_Enum );
648 if( bRet )
649 rValue <<= (TextContentAnchorType)nAnchor;
651 return bRet;
654 sal_Bool XMLAnchorTypePropHdl::exportXML(
655 OUString& rStrExpValue,
656 const Any& rValue,
657 const SvXMLUnitConverter& ) const
659 OUStringBuffer aOut;
660 TextContentAnchorType eVal;
662 rValue >>= eVal;
664 sal_Bool bRet = SvXMLUnitConverter::convertEnum( aOut, eVal, pXML_Anchor_Enum, XML_PARAGRAPH );
666 rStrExpValue = aOut.makeStringAndClear();
668 return bRet;
671 XMLAnchorTypePropHdl::~XMLAnchorTypePropHdl()
675 sal_Bool XMLAnchorTypePropHdl::convert( const OUString& rStrImpValue,
676 TextContentAnchorType& rType )
678 sal_uInt16 nAnchor;
679 sal_Bool bRet = SvXMLUnitConverter::convertEnum( nAnchor, rStrImpValue,
680 pXML_Anchor_Enum );
681 if( bRet )
682 rType = (TextContentAnchorType)nAnchor;
683 return bRet;
686 // ---------------------------------------------------------------------------
689 XMLTextColumnsPropertyHandler::~XMLTextColumnsPropertyHandler ()
693 bool XMLTextColumnsPropertyHandler::equals(
694 const Any& r1,
695 const Any& r2 ) const
697 Reference < XTextColumns > xColumns1;
698 r1 >>= xColumns1;
700 Reference < XTextColumns > xColumns2;
701 r2 >>= xColumns2;
703 if( xColumns1->getColumnCount() != xColumns2->getColumnCount() ||
704 xColumns1->getReferenceValue() != xColumns2->getReferenceValue() )
705 return sal_False;
707 Sequence < TextColumn > aColumns1 = xColumns1->getColumns();
708 Sequence < TextColumn > aColumns2 = xColumns2->getColumns();
709 sal_Int32 nCount = aColumns1.getLength();
710 if( aColumns2.getLength() != nCount )
711 return sal_False;
713 const TextColumn *pColumns1 = aColumns1.getArray();
714 const TextColumn *pColumns2 = aColumns2.getArray();
716 while( nCount-- )
718 if( pColumns1->Width != pColumns2->Width ||
719 pColumns1->LeftMargin != pColumns2->LeftMargin ||
720 pColumns1->RightMargin != pColumns2->RightMargin )
721 return sal_False;
723 pColumns1++;
724 pColumns2++;
727 return sal_True;
730 sal_Bool XMLTextColumnsPropertyHandler::importXML(
731 const OUString&,
732 Any&,
733 const SvXMLUnitConverter& ) const
735 DBG_ASSERT( !this, "columns are an element import property" );
736 return sal_False;
739 sal_Bool XMLTextColumnsPropertyHandler::exportXML(
740 OUString&,
741 const Any&,
742 const SvXMLUnitConverter& ) const
744 DBG_ASSERT( !this, "columns are an element export property" );
745 return sal_False;
748 // ---------------------------------------------------------------------------
750 class XMLHoriMirrorPropHdl_Impl : public XMLPropertyHandler
752 public:
753 virtual ~XMLHoriMirrorPropHdl_Impl ();
755 virtual sal_Bool importXML(
756 const ::rtl::OUString& rStrImpValue,
757 ::com::sun::star::uno::Any& rValue,
758 const SvXMLUnitConverter& ) const;
759 virtual sal_Bool exportXML(
760 ::rtl::OUString& rStrExpValue,
761 const ::com::sun::star::uno::Any& rValue,
762 const SvXMLUnitConverter& ) const;
765 sal_Bool XMLHoriMirrorPropHdl_Impl::importXML(
766 const OUString& rStrImpValue,
767 Any& rValue,
768 const SvXMLUnitConverter& ) const
770 sal_uInt16 nHoriMirror;
771 sal_Bool bRet = SvXMLUnitConverter::convertEnum( nHoriMirror, rStrImpValue,
772 pXML_HoriMirror_Enum );
774 if( bRet )
776 sal_Bool bTmp = nHoriMirror != 0;
777 rValue.setValue( &bTmp, ::getBooleanCppuType() );
780 return bRet;
783 sal_Bool XMLHoriMirrorPropHdl_Impl::exportXML(
784 OUString&,
785 const Any&,
786 const SvXMLUnitConverter& ) const
788 DBG_ASSERT( !this, "HorMirror properyt shouldn't be exported" );
790 return sal_False;
793 XMLHoriMirrorPropHdl_Impl::~XMLHoriMirrorPropHdl_Impl ()
797 // ---------------------------------------------------------------------------
799 class XMLGrfMirrorPropHdl_Impl : public XMLPropertyHandler
801 const OUString sVal;
802 sal_Bool bHori;
804 public:
805 XMLGrfMirrorPropHdl_Impl( enum XMLTokenEnum eVal, sal_Bool bH ) :
806 sVal( GetXMLToken( eVal ) ),
807 bHori( bH ) {}
808 virtual ~XMLGrfMirrorPropHdl_Impl ();
810 virtual sal_Bool importXML(
811 const ::rtl::OUString& rStrImpValue,
812 ::com::sun::star::uno::Any& rValue,
813 const SvXMLUnitConverter& ) const;
814 virtual sal_Bool exportXML(
815 ::rtl::OUString& rStrExpValue,
816 const ::com::sun::star::uno::Any& rValue,
817 const SvXMLUnitConverter& ) const;
820 sal_Bool XMLGrfMirrorPropHdl_Impl::importXML(
821 const OUString& rStrImpValue,
822 Any& rValue,
823 const SvXMLUnitConverter& ) const
825 sal_Bool bRet = sal_True;
826 sal_Bool bVal = sal_False;
827 if( ! IsXMLToken( rStrImpValue, XML_NONE ) )
829 bRet = sal_False;
830 SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
831 OUString aToken;
832 while( aTokenEnum.getNextToken( aToken ) )
834 bRet = sal_True;
835 if( aToken == sVal ||
836 (bHori && IsXMLToken( aToken, XML_HORIZONTAL ) ) )
838 bVal = sal_True;
839 break;
844 if( bRet )
845 rValue.setValue( &bVal, ::getBooleanCppuType() );
847 return bRet;
850 sal_Bool XMLGrfMirrorPropHdl_Impl::exportXML(
851 OUString& rStrExpValue,
852 const Any& rValue,
853 const SvXMLUnitConverter& ) const
855 if( *(sal_Bool *)rValue.getValue() )
857 if( !rStrExpValue.getLength() ||
858 IsXMLToken( rStrExpValue, XML_NONE ) )
860 rStrExpValue = sVal;
862 else if( bHori &&
863 // --> OD 2005-05-12 #i49139#
864 // XML_HORIZONTAL_ON_LEFT_PAGES and XML_HORIZONTAL_ON_RIGHT_PAGES
865 // are replaced by XML_HORIZONTAL_ON_EVEN and XML_HORIZONTAL_ON_ODD.
866 ( IsXMLToken( rStrExpValue, XML_HORIZONTAL_ON_EVEN ) ||
867 IsXMLToken( rStrExpValue, XML_HORIZONTAL_ON_ODD ) ))
868 // <--
870 rStrExpValue = GetXMLToken( XML_HORIZONTAL );
872 else
874 OUStringBuffer aOut( rStrExpValue.getLength() + 1 +
875 sVal.getLength() );
876 aOut.append( rStrExpValue );
877 aOut.append( (sal_Unicode)' ' );
878 aOut.append( sVal );
879 rStrExpValue = aOut.makeStringAndClear();
882 else if( !rStrExpValue.getLength() )
884 rStrExpValue = GetXMLToken( XML_NONE );
887 return sal_True;
890 XMLGrfMirrorPropHdl_Impl::~XMLGrfMirrorPropHdl_Impl()
894 // ---------------------------------------------------------------------------
896 SvXMLEnumMapEntry __READONLY_DATA pXML_Emphasize_Enum[] =
898 { XML_NONE, FontEmphasis::NONE },
899 { XML_DOT, FontEmphasis::DOT_ABOVE },
900 { XML_CIRCLE, FontEmphasis::CIRCLE_ABOVE },
901 { XML_DISC, FontEmphasis::DISK_ABOVE },
902 { XML_ACCENT, FontEmphasis::ACCENT_ABOVE },
903 { XML_TOKEN_INVALID, 0 }
905 class XMLTextEmphasizePropHdl_Impl : public XMLPropertyHandler
907 public:
908 XMLTextEmphasizePropHdl_Impl() {}
909 virtual ~XMLTextEmphasizePropHdl_Impl();
911 virtual sal_Bool importXML(
912 const ::rtl::OUString& rStrImpValue,
913 ::com::sun::star::uno::Any& rValue,
914 const SvXMLUnitConverter& ) const;
915 virtual sal_Bool exportXML(
916 ::rtl::OUString& rStrExpValue,
917 const ::com::sun::star::uno::Any& rValue,
918 const SvXMLUnitConverter& ) const;
921 sal_Bool XMLTextEmphasizePropHdl_Impl::importXML(
922 const OUString& rStrImpValue,
923 Any& rValue,
924 const SvXMLUnitConverter& ) const
926 sal_Bool bRet = sal_True;
927 sal_uInt16 nVal = FontEmphasis::NONE;
928 sal_Bool bBelow = sal_False;
929 sal_Bool bHasPos = sal_False, bHasType = sal_False;
930 OUString aToken;
932 SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
933 while( aTokenEnum.getNextToken( aToken ) )
935 if( !bHasPos && IsXMLToken( aToken, XML_ABOVE ) )
937 bBelow = sal_False;
938 bHasPos = sal_True;
940 else if( !bHasPos && IsXMLToken( aToken, XML_BELOW ) )
942 bBelow = sal_True;
943 bHasPos = sal_True;
945 else if( !bHasType &&
946 SvXMLUnitConverter::convertEnum( nVal, aToken,
947 pXML_Emphasize_Enum ))
949 bHasType = sal_True;
951 else
953 bRet = sal_False;
954 break;
958 if( bRet )
960 if( FontEmphasis::NONE != nVal && bBelow )
961 nVal += 10;
962 rValue <<= (sal_Int16)nVal;
965 return bRet;
968 sal_Bool XMLTextEmphasizePropHdl_Impl::exportXML(
969 OUString& rStrExpValue,
970 const Any& rValue,
971 const SvXMLUnitConverter& ) const
973 OUStringBuffer aOut( 15 );
974 sal_Bool bRet = sal_True;
975 sal_Int16 nType = sal_Int16();
976 if( rValue >>= nType )
978 sal_Bool bBelow = sal_False;
979 if( nType > 10 )
981 bBelow = sal_True;
982 nType -= 10;
984 bRet = SvXMLUnitConverter::convertEnum( aOut, nType,
985 pXML_Emphasize_Enum,
986 XML_DOT );
987 if( bRet )
989 if( nType != 0 )
991 enum XMLTokenEnum ePos = bBelow ? XML_BELOW : XML_ABOVE;
992 aOut.append( (sal_Unicode)' ' );
993 aOut.append( GetXMLToken(ePos) );
995 rStrExpValue = aOut.makeStringAndClear();
999 return bRet;
1002 XMLTextEmphasizePropHdl_Impl::~XMLTextEmphasizePropHdl_Impl()
1007 // ---------------------------------------------------------------------------
1009 class XMLTextCombineCharPropHdl_Impl : public XMLPropertyHandler
1011 public:
1012 XMLTextCombineCharPropHdl_Impl() {}
1013 virtual ~XMLTextCombineCharPropHdl_Impl();
1015 virtual sal_Bool importXML(
1016 const ::rtl::OUString& rStrImpValue,
1017 ::com::sun::star::uno::Any& rValue,
1018 const SvXMLUnitConverter& ) const;
1019 virtual sal_Bool exportXML(
1020 ::rtl::OUString& rStrExpValue,
1021 const ::com::sun::star::uno::Any& rValue,
1022 const SvXMLUnitConverter& ) const;
1025 sal_Bool XMLTextCombineCharPropHdl_Impl::importXML(
1026 const OUString& rStrImpValue,
1027 Any& rValue,
1028 const SvXMLUnitConverter& ) const
1030 if( rStrImpValue.getLength() )
1031 rValue <<= rStrImpValue.copy( 0, 1 );
1032 else
1033 rValue <<= rStrImpValue;
1035 return sal_True;
1038 sal_Bool XMLTextCombineCharPropHdl_Impl::exportXML(
1039 OUString& rStrExpValue,
1040 const Any& rValue,
1041 const SvXMLUnitConverter& ) const
1043 rValue >>= rStrExpValue;
1045 return sal_True;
1048 XMLTextCombineCharPropHdl_Impl::~XMLTextCombineCharPropHdl_Impl()
1052 // ---------------------------------------------------------------------------
1054 class XMLTextRelWidthHeightPropHdl_Impl : public XMLPropertyHandler
1056 public:
1057 XMLTextRelWidthHeightPropHdl_Impl() {}
1058 virtual ~XMLTextRelWidthHeightPropHdl_Impl();
1060 virtual sal_Bool importXML(
1061 const ::rtl::OUString& rStrImpValue,
1062 ::com::sun::star::uno::Any& rValue,
1063 const SvXMLUnitConverter& ) const;
1064 virtual sal_Bool exportXML(
1065 ::rtl::OUString& rStrExpValue,
1066 const ::com::sun::star::uno::Any& rValue,
1067 const SvXMLUnitConverter& ) const;
1070 sal_Bool XMLTextRelWidthHeightPropHdl_Impl::importXML(
1071 const OUString& rStrImpValue,
1072 Any& rValue,
1073 const SvXMLUnitConverter& ) const
1075 sal_Bool bRet;
1076 sal_Int32 nValue;
1077 bRet = SvXMLUnitConverter::convertPercent( nValue, rStrImpValue );
1078 if( bRet )
1079 rValue <<= (sal_Int16)nValue;
1081 return bRet;
1084 sal_Bool XMLTextRelWidthHeightPropHdl_Impl::exportXML(
1085 OUString& rStrExpValue,
1086 const Any& rValue,
1087 const SvXMLUnitConverter& ) const
1089 sal_Bool bRet = sal_False;
1090 sal_Int16 nValue = sal_Int16();
1091 if( (rValue >>= nValue) && nValue > 0 )
1093 OUStringBuffer aOut;
1094 SvXMLUnitConverter::convertPercent( aOut, nValue );
1095 rStrExpValue = aOut.makeStringAndClear();
1097 bRet = sal_True;
1100 return bRet;
1103 XMLTextRelWidthHeightPropHdl_Impl::~XMLTextRelWidthHeightPropHdl_Impl()
1107 // ---------------------------------------------------------------------------
1109 class XMLTextSyncWidthHeightPropHdl_Impl : public XMLPropertyHandler
1111 const OUString sValue;
1113 public:
1114 XMLTextSyncWidthHeightPropHdl_Impl( enum XMLTokenEnum eValue ) :
1115 sValue( GetXMLToken(eValue) ) {}
1116 virtual ~XMLTextSyncWidthHeightPropHdl_Impl();
1118 virtual sal_Bool importXML(
1119 const ::rtl::OUString& rStrImpValue,
1120 ::com::sun::star::uno::Any& rValue,
1121 const SvXMLUnitConverter& ) const;
1122 virtual sal_Bool exportXML(
1123 ::rtl::OUString& rStrExpValue,
1124 const ::com::sun::star::uno::Any& rValue,
1125 const SvXMLUnitConverter& ) const;
1128 sal_Bool XMLTextSyncWidthHeightPropHdl_Impl::importXML(
1129 const OUString& rStrImpValue,
1130 Any& rValue,
1131 const SvXMLUnitConverter& ) const
1133 sal_Bool bValue = (rStrImpValue == sValue );
1134 rValue.setValue( &bValue, ::getBooleanCppuType() );
1136 return sal_True;
1139 sal_Bool XMLTextSyncWidthHeightPropHdl_Impl::exportXML(
1140 OUString& rStrExpValue,
1141 const Any& rValue,
1142 const SvXMLUnitConverter& ) const
1144 sal_Bool bRet = sal_False;
1145 if( *(sal_Bool *)rValue.getValue() )
1147 rStrExpValue = sValue;
1148 bRet = sal_True;
1151 return bRet;
1154 XMLTextSyncWidthHeightPropHdl_Impl::~XMLTextSyncWidthHeightPropHdl_Impl()
1158 // ---------------------------------------------------------------------------
1160 class XMLTextRotationAnglePropHdl_Impl : public XMLPropertyHandler
1163 public:
1164 XMLTextRotationAnglePropHdl_Impl() {}
1165 virtual ~XMLTextRotationAnglePropHdl_Impl();
1167 virtual sal_Bool importXML(
1168 const ::rtl::OUString& rStrImpValue,
1169 ::com::sun::star::uno::Any& rValue,
1170 const SvXMLUnitConverter& ) const;
1171 virtual sal_Bool exportXML(
1172 ::rtl::OUString& rStrExpValue,
1173 const ::com::sun::star::uno::Any& rValue,
1174 const SvXMLUnitConverter& ) const;
1177 sal_Bool XMLTextRotationAnglePropHdl_Impl::importXML(
1178 const OUString& rStrImpValue,
1179 Any& rValue,
1180 const SvXMLUnitConverter& ) const
1182 sal_Int32 nValue;
1183 sal_Bool bRet = SvXMLUnitConverter::convertNumber( nValue, rStrImpValue );
1184 if( bRet )
1186 nValue = (nValue % 360 );
1187 if( nValue < 0 )
1188 nValue = 360 + nValue;
1189 sal_Int16 nAngle;
1190 if( nValue < 45 || nValue > 315 )
1191 nAngle = 0;
1192 else if( nValue < 180 )
1193 nAngle = 900;
1194 else /* if nValalue <= 315 ) */
1195 nAngle = 2700;
1196 rValue <<= nAngle;
1199 return bRet;
1202 sal_Bool XMLTextRotationAnglePropHdl_Impl::exportXML(
1203 OUString& rStrExpValue,
1204 const Any& rValue,
1205 const SvXMLUnitConverter& ) const
1207 sal_Int16 nAngle = sal_Int16();
1208 sal_Bool bRet = ( rValue >>= nAngle );
1209 if( bRet )
1211 OUStringBuffer aOut;
1212 SvXMLUnitConverter::convertNumber( aOut, nAngle / 10 );
1213 rStrExpValue = aOut.makeStringAndClear();
1215 OSL_ENSURE( bRet, "illegal rotation angle" );
1217 return bRet;
1220 XMLTextRotationAnglePropHdl_Impl::~XMLTextRotationAnglePropHdl_Impl()
1223 // ---------------------------------------------------------------------------
1224 class XMLNumber8OneBasedHdl : public XMLPropertyHandler
1227 public:
1228 XMLNumber8OneBasedHdl() {}
1229 virtual ~XMLNumber8OneBasedHdl() {};
1231 virtual sal_Bool importXML(
1232 const ::rtl::OUString& rStrImpValue,
1233 ::com::sun::star::uno::Any& rValue,
1234 const SvXMLUnitConverter& ) const;
1235 virtual sal_Bool exportXML(
1236 ::rtl::OUString& rStrExpValue,
1237 const ::com::sun::star::uno::Any& rValue,
1238 const SvXMLUnitConverter& ) const;
1241 sal_Bool XMLNumber8OneBasedHdl::importXML(
1242 const OUString& rStrImpValue,
1243 Any& rValue,
1244 const SvXMLUnitConverter& ) const
1246 sal_Int32 nValue = 0;
1247 sal_Bool bRet = SvXMLUnitConverter::convertNumber( nValue, rStrImpValue );
1248 if( bRet )
1249 rValue <<= static_cast<sal_Int8>( nValue - 1 );
1250 return bRet;
1253 sal_Bool XMLNumber8OneBasedHdl::exportXML(
1254 OUString& rStrExpValue,
1255 const Any& rValue,
1256 const SvXMLUnitConverter& ) const
1258 sal_Int8 nValue = sal_Int8();
1259 sal_Bool bRet = ( rValue >>= nValue );
1260 if( bRet )
1262 OUStringBuffer aOut;
1263 SvXMLUnitConverter::convertNumber( aOut, nValue + 1 );
1264 rStrExpValue = aOut.makeStringAndClear();
1266 return bRet;
1268 // ---------------------------------------------------------------------------
1269 class XMLTextPropertyHandlerFactory_Impl
1271 public:
1272 const XMLPropertyHandler *GetPropertyHandler( sal_Int32 nType ) const;
1274 XMLTextPropertyHandlerFactory_Impl();
1275 ~XMLTextPropertyHandlerFactory_Impl();
1278 const XMLPropertyHandler *XMLTextPropertyHandlerFactory_Impl::GetPropertyHandler
1279 ( sal_Int32 nType ) const
1281 const XMLPropertyHandler* pHdl = 0;
1282 switch( nType )
1284 case XML_TYPE_TEXT_DROPCAP:
1285 pHdl = new XMLDropCapPropHdl_Impl;
1286 break;
1287 case XML_TYPE_TEXT_WRAP:
1288 pHdl = new XMLWrapPropHdl_Impl;
1289 break;
1290 case XML_TYPE_TEXT_PARAGRAPH_ONLY:
1291 pHdl = new XMLParagraphOnlyPropHdl_Impl;
1292 break;
1293 case XML_TYPE_TEXT_WRAP_OUTSIDE:
1294 pHdl = new XMLContourModePropHdl_Impl;
1295 break;
1296 case XML_TYPE_TEXT_OPAQUE:
1297 pHdl = new XMLOpaquePropHdl_Impl;
1298 break;
1299 case XML_TYPE_TEXT_PROTECT_CONTENT:
1300 pHdl = new XMLFrameProtectPropHdl_Impl( XML_CONTENT );
1301 break;
1302 case XML_TYPE_TEXT_PROTECT_SIZE:
1303 pHdl = new XMLFrameProtectPropHdl_Impl( XML_SIZE );
1304 break;
1305 case XML_TYPE_TEXT_PROTECT_POSITION:
1306 pHdl = new XMLFrameProtectPropHdl_Impl( XML_POSITION );
1307 break;
1308 case XML_TYPE_TEXT_ANCHOR_TYPE:
1309 pHdl = new XMLAnchorTypePropHdl;
1310 break;
1311 case XML_TYPE_TEXT_COLUMNS:
1312 pHdl = new XMLTextColumnsPropertyHandler;
1313 break;
1314 case XML_TYPE_TEXT_HORIZONTAL_POS:
1315 pHdl = new XMLConstantsPropertyHandler( pXML_HoriPos_Enum, XML_TOKEN_INVALID );
1316 break;
1317 case XML_TYPE_TEXT_HORIZONTAL_POS_MIRRORED:
1318 pHdl = new XMLConstantsPropertyHandler( pXML_HoriPosMirrored_Enum, XML_TOKEN_INVALID );
1319 break;
1320 case XML_TYPE_TEXT_HORIZONTAL_REL:
1321 pHdl = new XMLConstantsPropertyHandler( pXML_HoriRel_Enum, XML_TOKEN_INVALID );
1322 break;
1323 case XML_TYPE_TEXT_HORIZONTAL_REL_FRAME:
1324 pHdl = new XMLConstantsPropertyHandler( pXML_HoriRelFrame_Enum, XML_TOKEN_INVALID );
1325 break;
1326 case XML_TYPE_TEXT_HORIZONTAL_MIRROR:
1327 pHdl = new XMLHoriMirrorPropHdl_Impl;
1328 break;
1329 case XML_TYPE_TEXT_VERTICAL_POS:
1330 pHdl = new XMLConstantsPropertyHandler( pXML_VertPos_Enum, XML_TOKEN_INVALID );
1331 break;
1332 case XML_TYPE_TEXT_VERTICAL_POS_AT_CHAR:
1333 pHdl = new XMLConstantsPropertyHandler( pXML_VertPosAtChar_Enum, XML_TOKEN_INVALID );
1334 break;
1335 case XML_TYPE_TEXT_VERTICAL_REL:
1336 pHdl = new XMLConstantsPropertyHandler( pXML_VertRel_Enum, XML_TOKEN_INVALID );
1337 break;
1338 case XML_TYPE_TEXT_VERTICAL_REL_PAGE:
1339 pHdl = new XMLConstantsPropertyHandler( pXML_VertRelPage_Enum, XML_TOKEN_INVALID );
1340 break;
1341 case XML_TYPE_TEXT_VERTICAL_REL_FRAME:
1342 pHdl = new XMLConstantsPropertyHandler( pXML_VertRelFrame_Enum, XML_TOKEN_INVALID );
1343 break;
1344 case XML_TYPE_TEXT_VERTICAL_REL_AS_CHAR:
1345 pHdl = new XMLConstantsPropertyHandler( pXML_VertRelAsChar_Enum, XML_TOKEN_INVALID );
1346 break;
1347 case XML_TYPE_TEXT_MIRROR_VERTICAL:
1348 pHdl = new XMLGrfMirrorPropHdl_Impl( XML_VERTICAL, sal_False );
1349 break;
1350 case XML_TYPE_TEXT_MIRROR_HORIZONTAL_LEFT:
1351 // --> OD 2005-05-12 #i49139#
1352 // XML_HORIZONTAL_ON_LEFT_PAGES is replaced by XML_HORIZONTAL_ON_EVEN.
1353 pHdl = new XMLGrfMirrorPropHdl_Impl( XML_HORIZONTAL_ON_EVEN, sal_True );
1354 // <--
1355 break;
1356 case XML_TYPE_TEXT_MIRROR_HORIZONTAL_RIGHT:
1357 // --> OD 2005-05-12 #i49139#
1358 // XML_HORIZONTAL_ON_RIGHT_PAGES is replaced by XML_HORIZONTAL_ON_ODD.
1359 pHdl = new XMLGrfMirrorPropHdl_Impl( XML_HORIZONTAL_ON_ODD, sal_True );
1360 // <--
1361 break;
1362 case XML_TYPE_TEXT_CLIP:
1363 pHdl = new XMLClipPropertyHandler( sal_False );
1364 break;
1365 case XML_TYPE_TEXT_CLIP11:
1366 pHdl = new XMLClipPropertyHandler( sal_True );
1367 break;
1368 case XML_TYPE_TEXT_EMPHASIZE:
1369 pHdl = new XMLTextEmphasizePropHdl_Impl;
1370 break;
1371 case XML_TYPE_TEXT_COMBINE:
1372 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_LINES ),
1373 GetXMLToken( XML_NONE ) );
1374 break;
1375 case XML_TYPE_TEXT_COMBINE_CHARACTERS:
1376 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_LETTERS ),
1377 GetXMLToken( XML_NONE ) );
1378 break;
1379 case XML_TYPE_TEXT_COMBINECHAR:
1380 pHdl = new XMLTextCombineCharPropHdl_Impl;
1381 break;
1382 case XML_TYPE_TEXT_AUTOSPACE:
1383 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_IDEOGRAPH_ALPHA ),
1384 GetXMLToken( XML_NONE ) );
1385 break;
1386 case XML_TYPE_TEXT_PUNCTUATION_WRAP:
1387 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_HANGING ),
1388 GetXMLToken( XML_SIMPLE ) );
1389 break;
1390 case XML_TYPE_TEXT_LINE_BREAK:
1391 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_STRICT ),
1392 GetXMLToken( XML_NORMAL ) );
1393 break;
1394 case XML_TYPE_TEXT_REL_WIDTH_HEIGHT:
1395 pHdl = new XMLTextRelWidthHeightPropHdl_Impl;
1396 break;
1397 case XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT:
1398 pHdl = new XMLTextSyncWidthHeightPropHdl_Impl( XML_SCALE );
1399 break;
1400 case XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT_MIN:
1401 pHdl = new XMLTextSyncWidthHeightPropHdl_Impl( XML_SCALE_MIN );
1402 break;
1403 case XML_TYPE_TEXT_RUBY_ADJUST:
1404 pHdl = new XMLConstantsPropertyHandler( pXML_RubyAdjust_Enum, XML_TOKEN_INVALID );
1405 break;
1406 case XML_TYPE_TEXT_FONT_RELIEF:
1407 pHdl = new XMLConstantsPropertyHandler( pXML_FontRelief_Enum, XML_TOKEN_INVALID );
1408 break;
1409 case XML_TYPE_TEXT_ROTATION_ANGLE:
1410 pHdl = new XMLTextRotationAnglePropHdl_Impl;
1411 break;
1412 case XML_TYPE_TEXT_ROTATION_SCALE:
1413 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_FIXED ),
1414 GetXMLToken( XML_LINE_HEIGHT ) );
1415 break;
1416 case XML_TYPE_TEXT_VERTICAL_ALIGN:
1417 pHdl = new XMLConstantsPropertyHandler( pXML_VerticalAlign_Enum, XML_TOKEN_INVALID );
1418 break;
1419 case XML_TYPE_TEXT_RUBY_POSITION:
1420 pHdl = new XMLNamedBoolPropertyHdl( ::xmloff::token::XML_ABOVE,
1421 ::xmloff::token::XML_BELOW );
1422 break;
1423 // OD 2004-05-05 #i28701#
1424 case XML_TYPE_WRAP_INFLUENCE_ON_POSITION:
1425 pHdl = new XMLConstantsPropertyHandler( pXML_WrapInfluenceOnPosition_Enum,
1426 XML_TOKEN_INVALID );
1427 break;
1428 case XML_TYPE_BORDER_MODEL:
1429 pHdl = new XMLNamedBoolPropertyHdl( xmloff::token::XML_COLLAPSING,
1430 xmloff::token::XML_SEPARATING );
1431 break;
1432 case XML_TYPE_TEXT_LINE_MODE:
1433 pHdl = new XMLNamedBoolPropertyHdl(
1434 ::xmloff::token::XML_SKIP_WHITE_SPACE,
1435 ::xmloff::token::XML_CONTINUOUS);
1436 break;
1437 case XML_TYPE_TEXT_KEEP:
1438 pHdl = new XMLNamedBoolPropertyHdl(
1439 ::xmloff::token::XML_ALWAYS,
1440 ::xmloff::token::XML_AUTO);
1441 break;
1442 case XML_TYPE_TEXT_NKEEP:
1443 pHdl = new XMLNamedBoolPropertyHdl(
1444 ::xmloff::token::XML_AUTO,
1445 ::xmloff::token::XML_ALWAYS);
1446 break;
1447 case XML_TYPE_TEXT_NUMBER8_ONE_BASED:
1448 pHdl = new XMLNumber8OneBasedHdl();
1449 break;
1452 return pHdl;
1455 XMLTextPropertyHandlerFactory_Impl::XMLTextPropertyHandlerFactory_Impl()
1459 XMLTextPropertyHandlerFactory_Impl::~XMLTextPropertyHandlerFactory_Impl()
1463 // ----------------------------------------------------------------------------
1465 XMLTextPropertyHandlerFactory::XMLTextPropertyHandlerFactory() :
1466 XMLPropertyHandlerFactory(),
1467 pImpl( new XMLTextPropertyHandlerFactory_Impl )
1471 XMLTextPropertyHandlerFactory::~XMLTextPropertyHandlerFactory()
1473 delete pImpl;
1476 const XMLPropertyHandler *XMLTextPropertyHandlerFactory::GetPropertyHandler(
1477 sal_Int32 nType ) const
1479 const XMLPropertyHandler *pHdl =
1480 XMLPropertyHandlerFactory::GetPropertyHandler( nType );
1482 if( !pHdl )
1484 const XMLPropertyHandler *pNewHdl = pImpl->GetPropertyHandler( nType );
1486 if( pNewHdl )
1487 PutHdlCache( nType, pNewHdl );
1489 pHdl = pNewHdl;
1492 return pHdl;