tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / xmloff / source / text / txtprhdl.cxx
blob6f1df66f68d5567d486fd6e8d108037f12b755aa
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 <sal/config.h>
22 #include <o3tl/any.hxx>
23 #include <osl/diagnose.h>
24 #include <rtl/ustrbuf.hxx>
25 #include <sal/log.hxx>
26 #include <com/sun/star/uno/Any.hxx>
27 #include <com/sun/star/style/DropCapFormat.hpp>
28 #include <com/sun/star/text/FontRelief.hpp>
29 #include <com/sun/star/text/WrapTextMode.hpp>
30 #include <com/sun/star/text/XTextColumns.hpp>
31 #include <com/sun/star/text/TextColumn.hpp>
32 #include <com/sun/star/text/RelOrientation.hpp>
33 #include <com/sun/star/text/HoriOrientation.hpp>
34 #include <com/sun/star/text/VertOrientation.hpp>
35 #include <com/sun/star/text/RubyAdjust.hpp>
36 #include <com/sun/star/text/RubyPosition.hpp>
37 #include <com/sun/star/text/FontEmphasis.hpp>
38 #include <com/sun/star/text/ParagraphHyphenationKeepType.hpp>
39 #include <com/sun/star/text/ParagraphVertAlign.hpp>
40 #include <com/sun/star/graphic/XGraphic.hpp>
41 #include <sax/tools/converter.hxx>
42 #include <xmloff/xmltypes.hxx>
43 #include <xmloff/xmluconv.hxx>
44 #include <xmloff/xmltoken.hxx>
45 #include <xmloff/xmlement.hxx>
46 #include "XMLAnchorTypePropHdl.hxx"
47 #include <enummaps.hxx>
48 #include <xmloff/XMLConstantsPropertyHandler.hxx>
49 #include <XMLClipPropertyHandler.hxx>
50 #include <XMLTextColumnsPropertyHandler.hxx>
51 #include <xmloff/NamedBoolPropertyHdl.hxx>
52 #include "txtprhdl.hxx"
53 #include <com/sun/star/text/WrapInfluenceOnPosition.hpp>
54 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
55 #include <xmloff/EnumPropertyHdl.hxx>
56 #include <XMLFillBitmapSizePropertyHandler.hxx>
57 #include <XMLBitmapLogicalSizePropertyHandler.hxx>
58 #include <XMLBitmapRepeatOffsetPropertyHandler.hxx>
59 #include <xmloff/XMLComplexColorHandler.hxx>
60 #include <vcl/graph.hxx>
62 using namespace ::com::sun::star;
63 using namespace ::com::sun::star::uno;
64 using namespace ::com::sun::star::style;
65 using namespace ::com::sun::star::text;
66 using namespace ::xmloff::token;
67 using namespace ::com::sun::star::drawing;
69 SvXMLEnumMapEntry<sal_uInt16> const pXML_HoriPos_Enum[] =
71 { XML_FROM_LEFT, HoriOrientation::NONE },
72 { XML_FROM_INSIDE, HoriOrientation::NONE }, // import only
73 { XML_LEFT, HoriOrientation::LEFT },
74 { XML_INSIDE, HoriOrientation::LEFT }, // import only
75 { XML_CENTER, HoriOrientation::CENTER },
76 { XML_RIGHT, HoriOrientation::RIGHT },
77 { XML_OUTSIDE, HoriOrientation::RIGHT }, // import only
78 { XML_TOKEN_INVALID, 0 }
81 SvXMLEnumMapEntry<sal_uInt16> const pXML_HoriPosMirrored_Enum[] =
83 { XML_FROM_INSIDE, HoriOrientation::NONE },
84 { XML_INSIDE, HoriOrientation::LEFT },
85 { XML_CENTER, HoriOrientation::CENTER },
86 { XML_OUTSIDE, HoriOrientation::RIGHT },
87 { XML_TOKEN_INVALID, 0 }
90 SvXMLEnumMapEntry<sal_uInt16> const pXML_HoriRel_Enum[] =
92 { XML_PARAGRAPH, RelOrientation::FRAME },
93 { XML_PARAGRAPH_CONTENT, RelOrientation::PRINT_AREA },
94 { XML_PAGE, RelOrientation::PAGE_FRAME },
95 { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
96 { XML_PARAGRAPH_START_MARGIN, RelOrientation::FRAME_LEFT },
97 { XML_PARAGRAPH_END_MARGIN, RelOrientation::FRAME_RIGHT },
98 { XML_PAGE_START_MARGIN, RelOrientation::PAGE_LEFT },
99 { XML_PAGE_END_MARGIN, RelOrientation::PAGE_RIGHT },
100 { XML_CHAR, RelOrientation::CHAR },
101 { XML_FRAME, RelOrientation::FRAME }, // import only
102 { XML_FRAME_CONTENT, RelOrientation::PRINT_AREA }, // import only
103 { XML_FRAME_START_MARGIN, RelOrientation::FRAME_LEFT }, // import only
104 { XML_FRAME_END_MARGIN, RelOrientation::FRAME_RIGHT }, // import only
105 { XML_TOKEN_INVALID, 0 }
108 SvXMLEnumMapEntry<sal_uInt16> const pXML_HoriRelFrame_Enum[] =
110 { XML_FRAME, RelOrientation::FRAME },
111 { XML_FRAME_CONTENT, RelOrientation::PRINT_AREA },
112 { XML_PAGE, RelOrientation::PAGE_FRAME },
113 { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
114 { XML_FRAME_START_MARGIN, RelOrientation::FRAME_LEFT },
115 { XML_FRAME_END_MARGIN, RelOrientation::FRAME_RIGHT },
116 { XML_PAGE_START_MARGIN, RelOrientation::PAGE_LEFT },
117 { XML_PAGE_END_MARGIN, RelOrientation::PAGE_RIGHT },
118 { XML_CHAR, RelOrientation::CHAR },
119 { XML_TOKEN_INVALID, 0 }
122 SvXMLEnumMapEntry<bool> const pXML_HoriMirror_Enum[] =
124 { XML_FROM_LEFT, false },
125 { XML_FROM_INSIDE, true },
126 { XML_LEFT, false },
127 { XML_INSIDE, true },
128 { XML_CENTER, false },
129 { XML_RIGHT, false },
130 { XML_OUTSIDE, true },
131 { XML_TOKEN_INVALID, false }
134 SvXMLEnumMapEntry<sal_uInt16> const pXML_VertPosAtChar_Enum[] =
136 { XML_FROM_TOP, VertOrientation::NONE },
137 { XML_TOP, VertOrientation::TOP },
138 { XML_TOP, VertOrientation::CHAR_TOP }, // export only
139 { XML_TOP, VertOrientation::LINE_TOP }, // export only
140 { XML_MIDDLE, VertOrientation::CENTER },
141 { XML_MIDDLE, VertOrientation::CHAR_CENTER }, // export only
142 { XML_MIDDLE, VertOrientation::LINE_CENTER }, // export only
143 { XML_BOTTOM, VertOrientation::BOTTOM },
144 { XML_BELOW, VertOrientation::CHAR_BOTTOM }, // export only
145 { XML_BOTTOM, VertOrientation::LINE_BOTTOM }, // export only
146 { XML_TOKEN_INVALID, 0 }
149 SvXMLEnumMapEntry<sal_uInt16> const pXML_VertRel_Enum[] =
151 { XML_PARAGRAPH, RelOrientation::FRAME },
152 { XML_PARAGRAPH_CONTENT, RelOrientation::PRINT_AREA },
153 { XML_CHAR, RelOrientation::CHAR },
154 // DVO, OD 17.09.2003 #i18732# - allow vertical alignment at page
155 { XML_PAGE, RelOrientation::PAGE_FRAME },
156 { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
157 { XML_PAGE_CONTENT_TOP, RelOrientation::PAGE_PRINT_AREA_TOP },
158 { XML_PAGE_CONTENT_BOTTOM, RelOrientation::PAGE_PRINT_AREA_BOTTOM },
159 { XML_FRAME, RelOrientation::FRAME }, // import only
160 { XML_FRAME_CONTENT, RelOrientation::PRINT_AREA }, // import only
161 // OD 13.11.2003 #i22341# - new vertical alignment at top of line
162 { XML_LINE, RelOrientation::TEXT_LINE },
163 { XML_TOKEN_INVALID, 0 }
166 SvXMLEnumMapEntry<sal_uInt16> const pXML_VertRelPage_Enum[] =
168 { XML_PAGE, RelOrientation::FRAME },
169 { XML_PAGE_CONTENT, RelOrientation::PRINT_AREA },
170 { XML_PAGE, RelOrientation::PAGE_FRAME },
171 { XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
172 { XML_PAGE_CONTENT_TOP, RelOrientation::PAGE_PRINT_AREA_TOP },
173 { XML_PAGE_CONTENT_BOTTOM, RelOrientation::PAGE_PRINT_AREA_BOTTOM },
174 { XML_TOKEN_INVALID, 0 }
177 SvXMLEnumMapEntry<sal_uInt16> const pXML_VertRelFrame_Enum[] =
179 { XML_FRAME, RelOrientation::FRAME },
180 { XML_FRAME_CONTENT, RelOrientation::PRINT_AREA },
181 { XML_TOKEN_INVALID, 0 }
184 SvXMLEnumMapEntry<sal_uInt16> const pXML_VertRelAsChar_Enum[] =
186 { XML_BASELINE, VertOrientation::TOP },
187 { XML_BASELINE, VertOrientation::CENTER }, // export only
188 { XML_BASELINE, VertOrientation::BOTTOM }, // export only
189 { XML_TEXT, VertOrientation::CHAR_TOP },
190 { XML_TEXT, VertOrientation::CHAR_CENTER }, // export only
191 { XML_TEXT, VertOrientation::CHAR_BOTTOM }, // export only
192 { XML_LINE, VertOrientation::LINE_TOP },
193 { XML_LINE, VertOrientation::LINE_CENTER }, // export only
194 { XML_LINE, VertOrientation::LINE_BOTTOM }, // export only
195 { XML_TOKEN_INVALID, 0 }
198 SvXMLEnumMapEntry<RubyAdjust> const pXML_RubyAdjust_Enum[] =
200 { XML_LEFT, RubyAdjust_LEFT },
201 { XML_CENTER, RubyAdjust_CENTER },
202 { XML_RIGHT, RubyAdjust_RIGHT },
203 { XML_DISTRIBUTE_LETTER, RubyAdjust_BLOCK },
204 { XML_DISTRIBUTE_SPACE, RubyAdjust_INDENT_BLOCK },
205 { XML_TOKEN_INVALID, RubyAdjust(0) }
208 SvXMLEnumMapEntry<sal_Int16> const pXML_RubyPosition_Enum[] =
210 { XML_ABOVE, RubyPosition::ABOVE},
211 { XML_BELOW, RubyPosition::BELOW},
212 { XML_INTER_CHARACTER, RubyPosition::INTER_CHARACTER},
213 { XML_TOKEN_INVALID, 0 }
216 SvXMLEnumMapEntry<sal_uInt16> const pXML_FontRelief_Enum[] =
218 { XML_NONE, FontRelief::NONE },
219 { XML_ENGRAVED, FontRelief::ENGRAVED },
220 { XML_EMBOSSED, FontRelief::EMBOSSED },
221 { XML_TOKEN_INVALID, 0 }
224 SvXMLEnumMapEntry<sal_uInt16> const pXML_ParaVerticalAlign_Enum[] =
226 { XML_TOP, ParagraphVertAlign::TOP },
227 { XML_MIDDLE, ParagraphVertAlign::CENTER },
228 { XML_BOTTOM, ParagraphVertAlign::BOTTOM },
229 { XML_BASELINE, ParagraphVertAlign::BASELINE },
230 { XML_AUTO, ParagraphVertAlign::AUTOMATIC },
231 { XML_TOKEN_INVALID, 0 }
234 SvXMLEnumMapEntry<sal_uInt16> const pXML_ParaHyphenationKeepType_Enum[] =
236 { XML_ALWAYS, ParagraphHyphenationKeepType::ALWAYS },
237 { XML_AUTO, ParagraphHyphenationKeepType::AUTO },
238 { XML_COLUMN, ParagraphHyphenationKeepType::COLUMN },
239 { XML_PAGE, ParagraphHyphenationKeepType::PAGE },
240 { XML_SPREAD, ParagraphHyphenationKeepType::SPREAD },
241 { XML_TOKEN_INVALID, 0 }
244 // OD 2004-05-05 #i28701#
245 SvXMLEnumMapEntry<sal_uInt16> const pXML_WrapInfluenceOnPosition_Enum[] =
247 // Tokens have been renamed and <XML_ITERATIVE> has been added (#i35017#)
248 { XML_ONCE_SUCCESSIVE, WrapInfluenceOnPosition::ONCE_SUCCESSIVE },
249 { XML_ONCE_CONCURRENT, WrapInfluenceOnPosition::ONCE_CONCURRENT },
250 { XML_ITERATIVE, WrapInfluenceOnPosition::ITERATIVE },
251 { XML_TOKEN_INVALID, 0 }
254 SvXMLEnumMapEntry<drawing::TextVerticalAdjust> const pXML_VerticalAlign_Enum[] =
256 { XML_TOP, drawing::TextVerticalAdjust_TOP },
257 { XML_MIDDLE, drawing::TextVerticalAdjust_CENTER },
258 { XML_BOTTOM, drawing::TextVerticalAdjust_BOTTOM },
259 { XML_JUSTIFY, drawing::TextVerticalAdjust_BLOCK },
260 { XML_TOKEN_INVALID, drawing::TextVerticalAdjust(0) }
263 namespace {
265 class XMLDropCapPropHdl_Impl : public XMLPropertyHandler
267 public:
268 virtual bool equals(
269 const css::uno::Any& r1,
270 const css::uno::Any& r2 ) const override;
272 /// TabStops will be imported/exported as XML-Elements. So the Import/Export-work must be done at another place.
273 virtual bool importXML(
274 const OUString& rStrImpValue,
275 css::uno::Any& rValue,
276 const SvXMLUnitConverter& ) const override;
277 virtual bool exportXML(
278 OUString& rStrExpValue,
279 const css::uno::Any& rValue,
280 const SvXMLUnitConverter& ) const override;
285 bool XMLDropCapPropHdl_Impl::equals(
286 const Any& r1,
287 const Any& r2 ) const
289 DropCapFormat aFormat1, aFormat2;
290 r1 >>= aFormat1;
291 r2 >>= aFormat2;
293 return (aFormat1.Lines <=1 && aFormat2.Lines <=1) ||
294 (aFormat1.Lines == aFormat2.Lines &&
295 aFormat1.Count == aFormat2.Count &&
296 aFormat1.Distance == aFormat2.Distance);
299 bool XMLDropCapPropHdl_Impl::importXML(
300 const OUString&,
301 Any&,
302 const SvXMLUnitConverter& ) const
304 SAL_WARN( "xmloff", "drop caps are an element import property" );
305 return false;
308 bool XMLDropCapPropHdl_Impl::exportXML(
309 OUString&,
310 const Any&,
311 const SvXMLUnitConverter& ) const
313 SAL_WARN( "xmloff", "drop caps are an element export property" );
314 return false;
317 namespace {
319 class XMLOpaquePropHdl_Impl : public XMLPropertyHandler
321 public:
322 virtual bool importXML(
323 const OUString& rStrImpValue,
324 css::uno::Any& rValue,
325 const SvXMLUnitConverter& ) const override;
326 virtual bool exportXML(
327 OUString& rStrExpValue,
328 const css::uno::Any& rValue,
329 const SvXMLUnitConverter& ) const override;
334 bool XMLOpaquePropHdl_Impl::importXML(
335 const OUString& rStrImpValue,
336 Any& rValue,
337 const SvXMLUnitConverter& ) const
339 bool bRet = true;
340 bool bVal = false;
341 if( IsXMLToken( rStrImpValue, XML_FOREGROUND ) )
342 bVal = true;
343 else if( !IsXMLToken( rStrImpValue, XML_BACKGROUND ) )
344 bRet = false;
346 if( bRet )
347 rValue <<= bVal;
349 return bRet;
352 bool XMLOpaquePropHdl_Impl::exportXML(
353 OUString& rStrExpValue,
354 const Any& rValue,
355 const SvXMLUnitConverter& ) const
357 if( *o3tl::doAccess<bool>(rValue) )
358 rStrExpValue = GetXMLToken( XML_FOREGROUND );
359 else
360 rStrExpValue = GetXMLToken( XML_BACKGROUND );
362 return true;
365 namespace {
367 class XMLContourModePropHdl_Impl : public XMLPropertyHandler
369 public:
370 virtual bool importXML(
371 const OUString& rStrImpValue,
372 css::uno::Any& rValue,
373 const SvXMLUnitConverter& ) const override;
374 virtual bool exportXML(
375 OUString& rStrExpValue,
376 const css::uno::Any& rValue,
377 const SvXMLUnitConverter& ) const override;
382 bool XMLContourModePropHdl_Impl::importXML(
383 const OUString& rStrImpValue,
384 Any& rValue,
385 const SvXMLUnitConverter& ) const
387 bool bRet = true;
388 bool bVal = false;
389 if( IsXMLToken( rStrImpValue, XML_OUTSIDE ) )
390 bVal = true;
391 else if( ! IsXMLToken( rStrImpValue, XML_FULL ) )
392 bRet = false;
394 if( bRet )
395 rValue <<= bVal;
397 return bRet;
400 bool XMLContourModePropHdl_Impl::exportXML(
401 OUString& rStrExpValue,
402 const Any& rValue,
403 const SvXMLUnitConverter& ) const
405 if( *o3tl::doAccess<bool>(rValue) )
406 rStrExpValue = GetXMLToken( XML_OUTSIDE );
407 else
408 rStrExpValue = GetXMLToken( XML_FULL );
410 return true;
413 namespace {
415 class XMLParagraphOnlyPropHdl_Impl : public XMLPropertyHandler
417 public:
418 virtual bool importXML(
419 const OUString& rStrImpValue,
420 css::uno::Any& rValue,
421 const SvXMLUnitConverter& ) const override;
422 virtual bool exportXML(
423 OUString& rStrExpValue,
424 const css::uno::Any& rValue,
425 const SvXMLUnitConverter& ) const override;
430 bool XMLParagraphOnlyPropHdl_Impl::importXML(
431 const OUString& rStrImpValue,
432 Any& rValue,
433 const SvXMLUnitConverter& ) const
435 bool bRet = true;
436 bool bVal = false;
438 if( ! IsXMLToken( rStrImpValue, XML_NO_LIMIT ) )
440 sal_Int32 nValue = 0;
441 bRet = ::sax::Converter::convertNumber( nValue, rStrImpValue );
442 bVal = 1 == nValue;
445 if( bRet )
446 rValue <<= bVal;
448 return bRet;
451 bool XMLParagraphOnlyPropHdl_Impl::exportXML(
452 OUString& rStrExpValue,
453 const Any& rValue,
454 const SvXMLUnitConverter& ) const
456 if( *o3tl::doAccess<bool>(rValue) )
457 rStrExpValue = GetXMLToken( XML_1 );
458 else
459 rStrExpValue = GetXMLToken( XML_NO_LIMIT );
461 return true;
464 SvXMLEnumMapEntry<WrapTextMode> const pXML_Wrap_Enum[] =
466 { XML_NONE, WrapTextMode_NONE },
467 { XML_RUN_THROUGH, WrapTextMode_THROUGH },
468 { XML_PARALLEL, WrapTextMode_PARALLEL },
469 { XML_DYNAMIC, WrapTextMode_DYNAMIC },
470 { XML_LEFT, WrapTextMode_LEFT },
471 { XML_RIGHT, WrapTextMode_RIGHT },
472 { XML_TOKEN_INVALID, WrapTextMode(0) }
475 namespace {
477 class XMLWrapPropHdl_Impl : public XMLPropertyHandler
479 public:
480 virtual bool importXML(
481 const OUString& rStrImpValue,
482 css::uno::Any& rValue,
483 const SvXMLUnitConverter& ) const override;
484 virtual bool exportXML(
485 OUString& rStrExpValue,
486 const css::uno::Any& rValue,
487 const SvXMLUnitConverter& ) const override;
492 bool XMLWrapPropHdl_Impl::importXML(
493 const OUString& rStrImpValue,
494 Any& rValue,
495 const SvXMLUnitConverter& ) const
497 WrapTextMode nWrap;
498 bool bRet = SvXMLUnitConverter::convertEnum( nWrap, rStrImpValue,
499 pXML_Wrap_Enum );
501 if( bRet )
502 rValue <<= nWrap;
504 return bRet;
507 bool XMLWrapPropHdl_Impl::exportXML(
508 OUString& rStrExpValue,
509 const Any& rValue,
510 const SvXMLUnitConverter& ) const
512 OUStringBuffer aOut;
513 WrapTextMode eVal;
515 rValue >>= eVal;
517 bool bRet = SvXMLUnitConverter::convertEnum( aOut, eVal, pXML_Wrap_Enum, XML_NONE );
519 rStrExpValue = aOut.makeStringAndClear();
521 return bRet;
524 namespace {
526 class XMLFrameProtectPropHdl_Impl : public XMLPropertyHandler
528 const OUString sVal;
529 public:
530 explicit XMLFrameProtectPropHdl_Impl( enum XMLTokenEnum eVal ) :
531 sVal( GetXMLToken(eVal) ) {}
533 virtual bool importXML(
534 const OUString& rStrImpValue,
535 css::uno::Any& rValue,
536 const SvXMLUnitConverter& ) const override;
537 virtual bool exportXML(
538 OUString& rStrExpValue,
539 const css::uno::Any& rValue,
540 const SvXMLUnitConverter& ) const override;
545 bool XMLFrameProtectPropHdl_Impl::importXML(
546 const OUString& rStrImpValue,
547 Any& rValue,
548 const SvXMLUnitConverter& ) const
550 bool bRet = true;
551 bool bVal = false;
552 if( ! IsXMLToken( rStrImpValue, XML_NONE ) )
554 bRet = false;
555 SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
556 std::u16string_view aToken;
557 while( aTokenEnum.getNextToken( aToken ) )
559 bRet = true;
560 if( aToken == sVal )
562 bVal = true;
563 break;
568 if( bRet )
569 rValue <<= bVal;
571 return bRet;
574 bool XMLFrameProtectPropHdl_Impl::exportXML(
575 OUString& rStrExpValue,
576 const Any& rValue,
577 const SvXMLUnitConverter& ) const
579 if( *o3tl::doAccess<bool>(rValue) )
581 if( rStrExpValue.isEmpty() ||
582 IsXMLToken( rStrExpValue, XML_NONE ) )
584 rStrExpValue = sVal;
586 else
588 rStrExpValue += " " + sVal;
591 else if( rStrExpValue.isEmpty() )
593 rStrExpValue = GetXMLToken( XML_NONE );
596 return true;
599 SvXMLEnumMapEntry<TextContentAnchorType> const pXML_Anchor_Enum[] =
601 { XML_CHAR, TextContentAnchorType_AT_CHARACTER },
602 { XML_PAGE, TextContentAnchorType_AT_PAGE },
603 { XML_FRAME, TextContentAnchorType_AT_FRAME },
604 { XML_PARAGRAPH, TextContentAnchorType_AT_PARAGRAPH },
605 { XML_AS_CHAR, TextContentAnchorType_AS_CHARACTER },
606 { XML_TOKEN_INVALID, TextContentAnchorType(0) }
609 bool XMLAnchorTypePropHdl::importXML(
610 const OUString& rStrImpValue,
611 Any& rValue,
612 const SvXMLUnitConverter& ) const
614 TextContentAnchorType nAnchor;
615 bool bRet = SvXMLUnitConverter::convertEnum( nAnchor, rStrImpValue,
616 pXML_Anchor_Enum );
618 if( bRet )
619 rValue <<= nAnchor;
621 return bRet;
624 bool XMLAnchorTypePropHdl::exportXML(
625 OUString& rStrExpValue,
626 const Any& rValue,
627 const SvXMLUnitConverter& ) const
629 OUStringBuffer aOut;
630 TextContentAnchorType eVal;
632 rValue >>= eVal;
634 bool bRet = SvXMLUnitConverter::convertEnum( aOut, eVal, pXML_Anchor_Enum, XML_PARAGRAPH );
636 rStrExpValue = aOut.makeStringAndClear();
638 return bRet;
641 XMLAnchorTypePropHdl::~XMLAnchorTypePropHdl()
645 bool XMLAnchorTypePropHdl::convert( std::string_view rStrImpValue,
646 TextContentAnchorType& rType )
648 TextContentAnchorType nAnchor;
649 bool bRet = SvXMLUnitConverter::convertEnum( nAnchor, rStrImpValue,
650 pXML_Anchor_Enum );
651 if( bRet )
652 rType = nAnchor;
653 return bRet;
656 XMLTextColumnsPropertyHandler::~XMLTextColumnsPropertyHandler ()
660 bool XMLTextColumnsPropertyHandler::equals(
661 const Any& r1,
662 const Any& r2 ) const
664 Reference < XTextColumns > xColumns1;
665 r1 >>= xColumns1;
667 Reference < XTextColumns > xColumns2;
668 r2 >>= xColumns2;
670 if (!xColumns1 || !xColumns2)
671 return (!xColumns1 && !xColumns2);
673 if( xColumns1->getColumnCount() != xColumns2->getColumnCount() ||
674 xColumns1->getReferenceValue() != xColumns2->getReferenceValue() )
675 return false;
677 const Sequence < TextColumn > aColumns1 = xColumns1->getColumns();
678 const Sequence < TextColumn > aColumns2 = xColumns2->getColumns();
680 return std::equal(aColumns1.begin(), aColumns1.end(), aColumns2.begin(), aColumns2.end(),
681 [](const TextColumn& a, const TextColumn& b) {
682 return a.Width == b.Width
683 && a.LeftMargin == b.LeftMargin
684 && a.RightMargin == b.RightMargin;
688 bool XMLTextColumnsPropertyHandler::importXML(
689 const OUString&,
690 Any&,
691 const SvXMLUnitConverter& ) const
693 SAL_WARN( "xmloff", "columns are an element import property" );
694 return false;
697 bool XMLTextColumnsPropertyHandler::exportXML(
698 OUString&,
699 const Any&,
700 const SvXMLUnitConverter& ) const
702 SAL_WARN( "xmloff", "columns are an element export property" );
703 return false;
706 namespace {
708 class XMLHoriMirrorPropHdl_Impl : public XMLPropertyHandler
710 public:
711 virtual bool importXML(
712 const OUString& rStrImpValue,
713 css::uno::Any& rValue,
714 const SvXMLUnitConverter& ) const override;
715 virtual bool exportXML(
716 OUString& rStrExpValue,
717 const css::uno::Any& rValue,
718 const SvXMLUnitConverter& ) const override;
723 bool XMLHoriMirrorPropHdl_Impl::importXML(
724 const OUString& rStrImpValue,
725 Any& rValue,
726 const SvXMLUnitConverter& ) const
728 bool nHoriMirror;
729 bool bRet = SvXMLUnitConverter::convertEnum( nHoriMirror, rStrImpValue,
730 pXML_HoriMirror_Enum );
732 if( bRet )
734 rValue <<= nHoriMirror;
737 return bRet;
740 bool XMLHoriMirrorPropHdl_Impl::exportXML(
741 OUString&,
742 const Any&,
743 const SvXMLUnitConverter& ) const
745 SAL_WARN( "xmloff", "HorMirror property shouldn't be exported" );
747 return false;
750 namespace {
752 class XMLGrfMirrorPropHdl_Impl : public XMLPropertyHandler
754 const OUString sVal;
755 bool bHori;
757 public:
758 XMLGrfMirrorPropHdl_Impl( enum XMLTokenEnum eVal, bool bH ) :
759 sVal( GetXMLToken( eVal ) ),
760 bHori( bH ) {}
762 virtual bool importXML(
763 const OUString& rStrImpValue,
764 css::uno::Any& rValue,
765 const SvXMLUnitConverter& ) const override;
766 virtual bool exportXML(
767 OUString& rStrExpValue,
768 const css::uno::Any& rValue,
769 const SvXMLUnitConverter& ) const override;
774 bool XMLGrfMirrorPropHdl_Impl::importXML(
775 const OUString& rStrImpValue,
776 Any& rValue,
777 const SvXMLUnitConverter& ) const
779 bool bRet = true;
780 bool bVal = false;
781 if( ! IsXMLToken( rStrImpValue, XML_NONE ) )
783 bRet = false;
784 SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
785 std::u16string_view aToken;
786 while( aTokenEnum.getNextToken( aToken ) )
788 bRet = true;
789 if( aToken == sVal ||
790 (bHori && IsXMLToken( aToken, XML_HORIZONTAL ) ) )
792 bVal = true;
793 break;
798 if( bRet )
799 rValue <<= bVal;
801 return bRet;
804 bool XMLGrfMirrorPropHdl_Impl::exportXML(
805 OUString& rStrExpValue,
806 const Any& rValue,
807 const SvXMLUnitConverter& ) const
809 if( *o3tl::doAccess<bool>(rValue) )
811 if( rStrExpValue.isEmpty() ||
812 IsXMLToken( rStrExpValue, XML_NONE ) )
814 rStrExpValue = sVal;
816 else if( bHori &&
817 /* XML_HORIZONTAL_ON_LEFT_PAGES and XML_HORIZONTAL_ON_RIGHT_PAGES
818 are replaced by XML_HORIZONTAL_ON_EVEN and XML_HORIZONTAL_ON_ODD.
819 (#i49139#)
821 ( IsXMLToken( rStrExpValue, XML_HORIZONTAL_ON_EVEN ) ||
822 IsXMLToken( rStrExpValue, XML_HORIZONTAL_ON_ODD ) ))
824 rStrExpValue = GetXMLToken( XML_HORIZONTAL );
826 else
828 rStrExpValue += " " + sVal;
831 else if( rStrExpValue.isEmpty() )
833 rStrExpValue = GetXMLToken( XML_NONE );
836 return true;
839 SvXMLEnumMapEntry<sal_uInt16> const pXML_Emphasize_Enum[] =
841 { XML_NONE, FontEmphasis::NONE },
842 { XML_DOT, FontEmphasis::DOT_ABOVE },
843 { XML_CIRCLE, FontEmphasis::CIRCLE_ABOVE },
844 { XML_DISC, FontEmphasis::DISK_ABOVE },
845 { XML_ACCENT, FontEmphasis::ACCENT_ABOVE },
846 { XML_TOKEN_INVALID, 0 }
849 namespace {
851 class XMLTextEmphasizePropHdl_Impl : public XMLPropertyHandler
853 public:
854 XMLTextEmphasizePropHdl_Impl() {}
856 virtual bool importXML(
857 const OUString& rStrImpValue,
858 css::uno::Any& rValue,
859 const SvXMLUnitConverter& ) const override;
860 virtual bool exportXML(
861 OUString& rStrExpValue,
862 const css::uno::Any& rValue,
863 const SvXMLUnitConverter& ) const override;
868 bool XMLTextEmphasizePropHdl_Impl::importXML(
869 const OUString& rStrImpValue,
870 Any& rValue,
871 const SvXMLUnitConverter& ) const
873 bool bRet = true;
874 sal_uInt16 nVal = FontEmphasis::NONE;
875 bool bBelow = false;
876 bool bHasPos = false, bHasType = false;
877 std::u16string_view aToken;
879 SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
880 while( aTokenEnum.getNextToken( aToken ) )
882 if( !bHasPos && IsXMLToken( aToken, XML_ABOVE ) )
884 bBelow = false;
885 bHasPos = true;
887 else if( !bHasPos && IsXMLToken( aToken, XML_BELOW ) )
889 bBelow = true;
890 bHasPos = true;
892 else if( !bHasType &&
893 SvXMLUnitConverter::convertEnum( nVal, aToken,
894 pXML_Emphasize_Enum ))
896 bHasType = true;
898 else
900 bRet = false;
901 break;
905 if( bRet )
907 if( FontEmphasis::NONE != nVal && bBelow )
908 nVal += 10;
909 rValue <<= static_cast<sal_Int16>(nVal);
912 return bRet;
915 bool XMLTextEmphasizePropHdl_Impl::exportXML(
916 OUString& rStrExpValue,
917 const Any& rValue,
918 const SvXMLUnitConverter& ) const
920 OUStringBuffer aOut( 15 );
921 bool bRet = true;
922 sal_uInt16 nType = sal_uInt16();
923 if( rValue >>= nType )
925 bool bBelow = false;
926 if( nType > 10 )
928 bBelow = true;
929 nType -= 10;
931 bRet = SvXMLUnitConverter::convertEnum( aOut, nType,
932 pXML_Emphasize_Enum,
933 XML_DOT );
934 if( bRet )
936 if( nType != 0 )
938 enum XMLTokenEnum ePos = bBelow ? XML_BELOW : XML_ABOVE;
939 aOut.append( " " + GetXMLToken(ePos) );
941 rStrExpValue = aOut.makeStringAndClear();
945 return bRet;
948 namespace {
950 class XMLTextCombineCharPropHdl_Impl : public XMLPropertyHandler
952 public:
953 XMLTextCombineCharPropHdl_Impl() {}
955 virtual bool importXML(
956 const OUString& rStrImpValue,
957 css::uno::Any& rValue,
958 const SvXMLUnitConverter& ) const override;
959 virtual bool exportXML(
960 OUString& rStrExpValue,
961 const css::uno::Any& rValue,
962 const SvXMLUnitConverter& ) const override;
967 bool XMLTextCombineCharPropHdl_Impl::importXML(
968 const OUString& rStrImpValue,
969 Any& rValue,
970 const SvXMLUnitConverter& ) const
972 if( !rStrImpValue.isEmpty() )
973 rValue <<= rStrImpValue.copy( 0, 1 );
974 else
975 rValue <<= rStrImpValue;
977 return true;
980 bool XMLTextCombineCharPropHdl_Impl::exportXML(
981 OUString& rStrExpValue,
982 const Any& rValue,
983 const SvXMLUnitConverter& ) const
985 rValue >>= rStrExpValue;
987 // #i114107# attribute of type "character": export only if length is 1
988 return (1 == rStrExpValue.getLength());
991 namespace {
993 class XMLTextRelWidthHeightPropHdl_Impl : public XMLPropertyHandler
995 public:
996 XMLTextRelWidthHeightPropHdl_Impl() {}
998 virtual bool importXML(
999 const OUString& rStrImpValue,
1000 css::uno::Any& rValue,
1001 const SvXMLUnitConverter& ) const override;
1002 virtual bool exportXML(
1003 OUString& rStrExpValue,
1004 const css::uno::Any& rValue,
1005 const SvXMLUnitConverter& ) const override;
1010 bool XMLTextRelWidthHeightPropHdl_Impl::importXML(
1011 const OUString& rStrImpValue,
1012 Any& rValue,
1013 const SvXMLUnitConverter& ) const
1015 sal_Int32 nValue;
1016 bool const bRet = ::sax::Converter::convertPercent( nValue, rStrImpValue );
1017 if( bRet )
1018 rValue <<= static_cast<sal_Int16>(nValue);
1020 return bRet;
1023 bool XMLTextRelWidthHeightPropHdl_Impl::exportXML(
1024 OUString& rStrExpValue,
1025 const Any& rValue,
1026 const SvXMLUnitConverter& ) const
1028 bool bRet = false;
1029 sal_Int16 nValue = sal_Int16();
1030 if( (rValue >>= nValue) && nValue > 0 )
1032 OUStringBuffer aOut;
1033 ::sax::Converter::convertPercent( aOut, nValue );
1034 rStrExpValue = aOut.makeStringAndClear();
1036 bRet = true;
1039 return bRet;
1042 namespace {
1044 class XMLTextSyncWidthHeightPropHdl_Impl : public XMLPropertyHandler
1046 const OUString sValue;
1048 public:
1049 explicit XMLTextSyncWidthHeightPropHdl_Impl( enum XMLTokenEnum eValue ) :
1050 sValue( GetXMLToken(eValue) ) {}
1052 virtual bool importXML(
1053 const OUString& rStrImpValue,
1054 css::uno::Any& rValue,
1055 const SvXMLUnitConverter& ) const override;
1056 virtual bool exportXML(
1057 OUString& rStrExpValue,
1058 const css::uno::Any& rValue,
1059 const SvXMLUnitConverter& ) const override;
1064 bool XMLTextSyncWidthHeightPropHdl_Impl::importXML(
1065 const OUString& rStrImpValue,
1066 Any& rValue,
1067 const SvXMLUnitConverter& ) const
1069 rValue <<= (rStrImpValue == sValue);
1071 return true;
1074 bool XMLTextSyncWidthHeightPropHdl_Impl::exportXML(
1075 OUString& rStrExpValue,
1076 const Any& rValue,
1077 const SvXMLUnitConverter& ) const
1079 bool bRet = false;
1080 if( *o3tl::doAccess<bool>(rValue) )
1082 rStrExpValue = sValue;
1083 bRet = true;
1086 return bRet;
1089 namespace {
1091 class XMLTextRotationAnglePropHdl_Impl : public XMLPropertyHandler
1094 public:
1095 XMLTextRotationAnglePropHdl_Impl() {}
1097 virtual bool importXML(
1098 const OUString& rStrImpValue,
1099 css::uno::Any& rValue,
1100 const SvXMLUnitConverter& ) const override;
1101 virtual bool exportXML(
1102 OUString& rStrExpValue,
1103 const css::uno::Any& rValue,
1104 const SvXMLUnitConverter& ) const override;
1109 bool XMLTextRotationAnglePropHdl_Impl::importXML(
1110 const OUString& rStrImpValue,
1111 Any& rValue,
1112 const SvXMLUnitConverter& ) const
1114 sal_Int32 nValue;
1115 bool const bRet = ::sax::Converter::convertNumber( nValue, rStrImpValue );
1116 if( bRet )
1118 nValue = (nValue % 360 );
1119 if( nValue < 0 )
1120 nValue = 360 + nValue;
1121 sal_Int16 nAngle;
1122 if( nValue < 45 || nValue > 315 )
1123 nAngle = 0;
1124 else if( nValue < 180 )
1125 nAngle = 900;
1126 else /* if nValue <= 315 ) */
1127 nAngle = 2700;
1128 rValue <<= nAngle;
1131 return bRet;
1134 bool XMLTextRotationAnglePropHdl_Impl::exportXML(
1135 OUString& rStrExpValue,
1136 const Any& rValue,
1137 const SvXMLUnitConverter& ) const
1139 sal_Int16 nAngle = sal_Int16();
1140 bool bRet = ( rValue >>= nAngle );
1141 if( bRet )
1143 rStrExpValue = OUString::number( nAngle / 10 );
1145 OSL_ENSURE( bRet, "illegal rotation angle" );
1147 return bRet;
1150 namespace {
1152 class XMLNumber8OneBasedHdl : public XMLPropertyHandler
1155 public:
1156 XMLNumber8OneBasedHdl() {}
1158 virtual bool importXML(
1159 const OUString& rStrImpValue,
1160 css::uno::Any& rValue,
1161 const SvXMLUnitConverter& ) const override;
1162 virtual bool exportXML(
1163 OUString& rStrExpValue,
1164 const css::uno::Any& rValue,
1165 const SvXMLUnitConverter& ) const override;
1170 bool XMLNumber8OneBasedHdl::importXML(
1171 const OUString& rStrImpValue,
1172 Any& rValue,
1173 const SvXMLUnitConverter& ) const
1175 sal_Int32 nValue = 0;
1176 bool const bRet = ::sax::Converter::convertNumber(nValue, rStrImpValue);
1177 if( bRet )
1178 rValue <<= static_cast<sal_Int8>( nValue - 1 );
1179 return bRet;
1182 bool XMLNumber8OneBasedHdl::exportXML(
1183 OUString& rStrExpValue,
1184 const Any& rValue,
1185 const SvXMLUnitConverter& ) const
1187 sal_Int8 nValue = sal_Int8();
1188 bool bRet = ( rValue >>= nValue );
1189 if( bRet )
1191 rStrExpValue = OUString::number( nValue + 1 );
1193 return bRet;
1196 namespace {
1198 class XMLGraphicPropertyHandler : public XMLPropertyHandler
1200 public:
1201 XMLGraphicPropertyHandler() {}
1203 virtual bool importXML(const OUString& , uno::Any& , const SvXMLUnitConverter& ) const override
1205 SAL_WARN( "xmloff", "drop caps are an element import property" );
1206 return false;
1209 virtual bool exportXML(OUString& , const uno::Any& , const SvXMLUnitConverter& ) const override
1211 SAL_WARN( "xmloff", "drop caps are an element import property" );
1212 return false;
1215 virtual bool equals(const css::uno::Any& rAny1, const css::uno::Any& rAny2) const override;
1220 bool XMLGraphicPropertyHandler::equals(const Any& rAny1, const Any& rAny2) const
1222 uno::Reference<graphic::XGraphic> xGraphic1;
1223 uno::Reference<graphic::XGraphic> xGraphic2;
1224 rAny1 >>= xGraphic1;
1225 rAny2 >>= xGraphic2;
1226 Graphic aGraphic1(xGraphic1);
1227 Graphic aGraphic2(xGraphic2);
1229 return aGraphic1 == aGraphic2;
1232 static const XMLPropertyHandler *GetPropertyHandler
1233 ( sal_Int32 nType )
1235 const XMLPropertyHandler* pHdl = nullptr;
1236 switch( nType )
1238 case XML_TYPE_TEXT_DROPCAP:
1239 pHdl = new XMLDropCapPropHdl_Impl;
1240 break;
1241 case XML_TYPE_TEXT_WRAP:
1242 pHdl = new XMLWrapPropHdl_Impl;
1243 break;
1244 case XML_TYPE_TEXT_PARAGRAPH_ONLY:
1245 pHdl = new XMLParagraphOnlyPropHdl_Impl;
1246 break;
1247 case XML_TYPE_TEXT_WRAP_OUTSIDE:
1248 pHdl = new XMLContourModePropHdl_Impl;
1249 break;
1250 case XML_TYPE_TEXT_OPAQUE:
1251 pHdl = new XMLOpaquePropHdl_Impl;
1252 break;
1253 case XML_TYPE_TEXT_PROTECT_CONTENT:
1254 pHdl = new XMLFrameProtectPropHdl_Impl( XML_CONTENT );
1255 break;
1256 case XML_TYPE_TEXT_PROTECT_SIZE:
1257 pHdl = new XMLFrameProtectPropHdl_Impl( XML_SIZE );
1258 break;
1259 case XML_TYPE_TEXT_PROTECT_POSITION:
1260 pHdl = new XMLFrameProtectPropHdl_Impl( XML_POSITION );
1261 break;
1262 case XML_TYPE_TEXT_ANCHOR_TYPE:
1263 pHdl = new XMLAnchorTypePropHdl;
1264 break;
1265 case XML_TYPE_TEXT_COLUMNS:
1266 pHdl = new XMLTextColumnsPropertyHandler;
1267 break;
1268 case XML_TYPE_TEXT_HORIZONTAL_POS:
1269 pHdl = new XMLConstantsPropertyHandler( pXML_HoriPos_Enum, XML_TOKEN_INVALID );
1270 break;
1271 case XML_TYPE_TEXT_HORIZONTAL_POS_MIRRORED:
1272 pHdl = new XMLConstantsPropertyHandler( pXML_HoriPosMirrored_Enum, XML_TOKEN_INVALID );
1273 break;
1274 case XML_TYPE_TEXT_HORIZONTAL_REL:
1275 pHdl = new XMLConstantsPropertyHandler( pXML_HoriRel_Enum, XML_TOKEN_INVALID );
1276 break;
1277 case XML_TYPE_TEXT_HORIZONTAL_REL_FRAME:
1278 pHdl = new XMLConstantsPropertyHandler( pXML_HoriRelFrame_Enum, XML_TOKEN_INVALID );
1279 break;
1280 case XML_TYPE_TEXT_HORIZONTAL_MIRROR:
1281 pHdl = new XMLHoriMirrorPropHdl_Impl;
1282 break;
1283 case XML_TYPE_TEXT_VERTICAL_POS_AT_CHAR:
1284 pHdl = new XMLConstantsPropertyHandler( pXML_VertPosAtChar_Enum, XML_TOKEN_INVALID );
1285 break;
1286 case XML_TYPE_TEXT_VERTICAL_REL:
1287 pHdl = new XMLConstantsPropertyHandler( pXML_VertRel_Enum, XML_TOKEN_INVALID );
1288 break;
1289 case XML_TYPE_TEXT_VERTICAL_REL_PAGE:
1290 pHdl = new XMLConstantsPropertyHandler( pXML_VertRelPage_Enum, XML_TOKEN_INVALID );
1291 break;
1292 case XML_TYPE_TEXT_VERTICAL_REL_FRAME:
1293 pHdl = new XMLConstantsPropertyHandler( pXML_VertRelFrame_Enum, XML_TOKEN_INVALID );
1294 break;
1295 case XML_TYPE_TEXT_VERTICAL_REL_AS_CHAR:
1296 pHdl = new XMLConstantsPropertyHandler( pXML_VertRelAsChar_Enum, XML_TOKEN_INVALID );
1297 break;
1298 case XML_TYPE_TEXT_MIRROR_VERTICAL:
1299 pHdl = new XMLGrfMirrorPropHdl_Impl( XML_VERTICAL, false );
1300 break;
1301 case XML_TYPE_TEXT_MIRROR_HORIZONTAL_LEFT:
1302 // XML_HORIZONTAL_ON_LEFT_PAGES is replaced by XML_HORIZONTAL_ON_EVEN. (#i49139#)
1303 pHdl = new XMLGrfMirrorPropHdl_Impl( XML_HORIZONTAL_ON_EVEN, true );
1304 break;
1305 case XML_TYPE_TEXT_MIRROR_HORIZONTAL_RIGHT:
1306 // XML_HORIZONTAL_ON_RIGHT_PAGES is replaced by XML_HORIZONTAL_ON_ODD. (#i49139#)
1307 pHdl = new XMLGrfMirrorPropHdl_Impl( XML_HORIZONTAL_ON_ODD, true );
1308 break;
1309 case XML_TYPE_TEXT_CLIP:
1310 pHdl = new XMLClipPropertyHandler( false );
1311 break;
1312 case XML_TYPE_TEXT_CLIP11:
1313 pHdl = new XMLClipPropertyHandler( true );
1314 break;
1315 case XML_TYPE_TEXT_EMPHASIZE:
1316 pHdl = new XMLTextEmphasizePropHdl_Impl;
1317 break;
1318 case XML_TYPE_TEXT_COMBINE:
1319 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_LINES ),
1320 GetXMLToken( XML_NONE ) );
1321 break;
1322 case XML_TYPE_TEXT_COMBINE_CHARACTERS:
1323 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_LETTERS ),
1324 GetXMLToken( XML_NONE ) );
1325 break;
1326 case XML_TYPE_TEXT_COMBINECHAR:
1327 pHdl = new XMLTextCombineCharPropHdl_Impl;
1328 break;
1329 case XML_TYPE_TEXT_AUTOSPACE:
1330 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_IDEOGRAPH_ALPHA ),
1331 GetXMLToken( XML_NONE ) );
1332 break;
1333 case XML_TYPE_TEXT_PUNCTUATION_WRAP:
1334 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_HANGING ),
1335 GetXMLToken( XML_SIMPLE ) );
1336 break;
1337 case XML_TYPE_TEXT_LINE_BREAK:
1338 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_STRICT ),
1339 GetXMLToken( XML_NORMAL ) );
1340 break;
1341 case XML_TYPE_TEXT_REL_WIDTH_HEIGHT:
1342 pHdl = new XMLTextRelWidthHeightPropHdl_Impl;
1343 break;
1344 case XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT:
1345 pHdl = new XMLTextSyncWidthHeightPropHdl_Impl( XML_SCALE );
1346 break;
1347 case XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT_MIN:
1348 pHdl = new XMLTextSyncWidthHeightPropHdl_Impl( XML_SCALE_MIN );
1349 break;
1350 case XML_TYPE_TEXT_RUBY_ADJUST:
1351 pHdl = new XMLConstantsPropertyHandler( pXML_RubyAdjust_Enum, XML_TOKEN_INVALID );
1352 break;
1353 case XML_TYPE_TEXT_FONT_RELIEF:
1354 pHdl = new XMLConstantsPropertyHandler( pXML_FontRelief_Enum, XML_TOKEN_INVALID );
1355 break;
1356 case XML_TYPE_TEXT_ROTATION_ANGLE:
1357 pHdl = new XMLTextRotationAnglePropHdl_Impl;
1358 break;
1359 case XML_TYPE_TEXT_ROTATION_SCALE:
1360 pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken( XML_FIXED ),
1361 GetXMLToken( XML_LINE_HEIGHT ) );
1362 break;
1363 case XML_TYPE_TEXT_VERTICAL_ALIGN:
1364 pHdl = new XMLConstantsPropertyHandler( pXML_ParaVerticalAlign_Enum, XML_TOKEN_INVALID );
1365 break;
1366 case XML_TYPE_TEXT_RUBY_POSITION:
1367 pHdl = new XMLConstantsPropertyHandler( pXML_RubyPosition_Enum, XML_TOKEN_INVALID );
1368 break;
1369 case XML_TYPE_TEXT_RUBY_IS_ABOVE:
1370 pHdl = new XMLNamedBoolPropertyHdl(::xmloff::token::XML_ABOVE, ::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 case XML_SW_TYPE_FILLSTYLE:
1404 pHdl = new XMLEnumPropertyHdl( aXML_FillStyle_EnumMap);
1405 break;
1406 case XML_SW_TYPE_FILLBITMAPSIZE:
1407 pHdl = new XMLFillBitmapSizePropertyHandler();
1408 break;
1409 case XML_SW_TYPE_LOGICAL_SIZE:
1410 pHdl = new XMLBitmapLogicalSizePropertyHandler();
1411 break;
1412 case XML_SW_TYPE_BITMAP_REFPOINT:
1413 pHdl = new XMLEnumPropertyHdl( aXML_RefPoint_EnumMap);
1414 break;
1415 case XML_SW_TYPE_BITMAP_MODE:
1416 pHdl = new XMLEnumPropertyHdl( aXML_BitmapMode_EnumMap);
1417 break;
1418 case XML_SW_TYPE_BITMAPREPOFFSETX:
1419 case XML_SW_TYPE_BITMAPREPOFFSETY:
1420 pHdl = new XMLBitmapRepeatOffsetPropertyHandler(XML_SW_TYPE_BITMAPREPOFFSETX == nType);
1421 break;
1422 case XML_TYPE_GRAPHIC:
1423 pHdl = new XMLGraphicPropertyHandler;
1424 break;
1425 case XML_TYPE_COMPLEX_COLOR:
1426 pHdl = new XMLComplexColorHandler;
1427 break;
1428 case XML_TYPE_HYPHENATION_KEEP:
1429 pHdl = new XMLNamedBoolPropertyHdl( ::xmloff::token::XML_PAGE, ::xmloff::token::XML_AUTO );
1430 break;
1431 case XML_TYPE_HYPHENATION_KEEP_TYPE:
1432 pHdl = new XMLConstantsPropertyHandler( pXML_ParaHyphenationKeepType_Enum, XML_TOKEN_INVALID );
1433 break;
1434 default:
1436 OSL_ENSURE(false, "XMLPropertyHandler missing (!)");
1437 break;
1441 return pHdl;
1444 XMLTextPropertyHandlerFactory::XMLTextPropertyHandlerFactory()
1448 const XMLPropertyHandler *XMLTextPropertyHandlerFactory::GetPropertyHandler(
1449 sal_Int32 nType ) const
1451 const XMLPropertyHandler *pHdl =
1452 XMLPropertyHandlerFactory::GetPropertyHandler( nType );
1454 if( !pHdl )
1456 const XMLPropertyHandler *pNewHdl = ::GetPropertyHandler( nType );
1458 if( pNewHdl )
1459 PutHdlCache( nType, pNewHdl );
1461 pHdl = pNewHdl;
1464 return pHdl;
1467 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */