1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlbahdl.cxx,v $
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 <xmlbahdl.hxx>
35 #include <xmloff/xmluconv.hxx>
36 #include <com/sun/star/uno/Any.hxx>
37 #include <xmloff/xmltoken.hxx>
39 using ::rtl::OUString
;
40 using ::rtl::OUStringBuffer
;
42 using namespace ::com::sun::star::uno
;
43 using namespace ::xmloff::token
;
45 void lcl_xmloff_setAny( Any
& rValue
, sal_Int32 nValue
, sal_Int8 nBytes
)
50 if( nValue
< SCHAR_MIN
)
52 else if( nValue
> SCHAR_MAX
)
54 rValue
<<= (sal_Int8
)nValue
;
57 if( nValue
< SHRT_MIN
)
59 else if( nValue
> SHRT_MAX
)
61 rValue
<<= (sal_Int16
)nValue
;
69 sal_Bool
lcl_xmloff_getAny( const Any
& rValue
, sal_Int32
& nValue
,
72 sal_Bool bRet
= sal_False
;
79 bRet
= rValue
>>= nValue8
;
85 sal_Int16 nValue16
= 0;
86 bRet
= rValue
>>= nValue16
;
91 bRet
= rValue
>>= nValue
;
98 ///////////////////////////////////////////////////////////////////////////////
100 // class XMLNumberPropHdl
103 XMLNumberPropHdl::~XMLNumberPropHdl()
108 sal_Bool
XMLNumberPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
110 sal_Bool bRet
= sal_False
;
112 sal_Int32 nValue
= 0;
113 bRet
= SvXMLUnitConverter::convertNumber( nValue
, rStrImpValue
);
114 lcl_xmloff_setAny( rValue
, nValue
, nBytes
);
119 sal_Bool
XMLNumberPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
121 sal_Bool bRet
= sal_False
;
125 if( lcl_xmloff_getAny( rValue
, nValue
, nBytes
) )
127 SvXMLUnitConverter::convertNumber( aOut
, nValue
);
128 rStrExpValue
= aOut
.makeStringAndClear();
136 ///////////////////////////////////////////////////////////////////////////////
137 // class XMLNumberNonePropHdl
140 XMLNumberNonePropHdl::XMLNumberNonePropHdl( sal_Int8 nB
) :
141 sZeroStr( GetXMLToken(XML_NO_LIMIT
) ),
146 XMLNumberNonePropHdl::XMLNumberNonePropHdl( enum XMLTokenEnum eZeroString
, sal_Int8 nB
) :
147 sZeroStr( GetXMLToken( eZeroString
) ),
152 XMLNumberNonePropHdl::~XMLNumberNonePropHdl()
157 sal_Bool
XMLNumberNonePropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
159 sal_Bool bRet
= sal_False
;
161 sal_Int32 nValue
= 0;
162 if( rStrImpValue
== sZeroStr
)
168 bRet
= SvXMLUnitConverter::convertNumber( nValue
, rStrImpValue
);
170 lcl_xmloff_setAny( rValue
, nValue
, nBytes
);
175 sal_Bool
XMLNumberNonePropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
177 sal_Bool bRet
= sal_False
;
180 if( lcl_xmloff_getAny( rValue
, nValue
, nBytes
) )
186 aOut
.append( sZeroStr
);
190 SvXMLUnitConverter::convertNumber( aOut
, nValue
);
193 rStrExpValue
= aOut
.makeStringAndClear();
201 ///////////////////////////////////////////////////////////////////////////////
203 // class XMLMeasurePropHdl
206 XMLMeasurePropHdl::~XMLMeasurePropHdl()
211 sal_Bool
XMLMeasurePropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const
213 sal_Bool bRet
= sal_False
;
215 sal_Int32 nValue
= 0;
216 bRet
= rUnitConverter
.convertMeasure( nValue
, rStrImpValue
);
217 lcl_xmloff_setAny( rValue
, nValue
, nBytes
);
222 sal_Bool
XMLMeasurePropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const
224 sal_Bool bRet
= sal_False
;
228 if( lcl_xmloff_getAny( rValue
, nValue
, nBytes
) )
230 rUnitConverter
.convertMeasure( aOut
, nValue
);
231 rStrExpValue
= aOut
.makeStringAndClear();
239 ///////////////////////////////////////////////////////////////////////////////
241 // class XMLBoolPropHdl
244 XMLBoolPropHdl::~XMLBoolPropHdl()
249 sal_Bool
XMLBoolPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
251 sal_Bool bRet
= sal_False
;
254 bRet
= SvXMLUnitConverter::convertBool( bValue
, rStrImpValue
);
255 rValue
<<= sal_Bool(bValue
);
260 sal_Bool
XMLBoolPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
262 sal_Bool bRet
= sal_False
;
264 sal_Bool bValue
= sal_Bool();
266 if (rValue
>>= bValue
)
268 SvXMLUnitConverter::convertBool( aOut
, bValue
);
269 rStrExpValue
= aOut
.makeStringAndClear();
277 ///////////////////////////////////////////////////////////////////////////////
279 // class XMLNBoolPropHdl
282 XMLNBoolPropHdl::~XMLNBoolPropHdl()
287 sal_Bool
XMLNBoolPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
289 sal_Bool bRet
= sal_False
;
292 bRet
= SvXMLUnitConverter::convertBool( bValue
, rStrImpValue
);
293 rValue
<<= sal_Bool(!bValue
);
298 sal_Bool
XMLNBoolPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
300 sal_Bool bRet
= sal_False
;
302 sal_Bool bValue
= sal_Bool();
304 if (rValue
>>= bValue
)
306 SvXMLUnitConverter::convertBool( aOut
, !bValue
);
307 rStrExpValue
= aOut
.makeStringAndClear();
315 ///////////////////////////////////////////////////////////////////////////////
317 // class XMLPercentPropHdl
320 XMLPercentPropHdl::~XMLPercentPropHdl()
325 sal_Bool
XMLPercentPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
327 sal_Bool bRet
= sal_False
;
329 sal_Int32 nValue
= 0;
330 bRet
= SvXMLUnitConverter::convertPercent( nValue
, rStrImpValue
);
331 lcl_xmloff_setAny( rValue
, nValue
, nBytes
);
336 sal_Bool
XMLPercentPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
338 sal_Bool bRet
= sal_False
;
342 if( lcl_xmloff_getAny( rValue
, nValue
, nBytes
) )
344 SvXMLUnitConverter::convertPercent( aOut
, nValue
);
345 rStrExpValue
= aOut
.makeStringAndClear();
353 ///////////////////////////////////////////////////////////////////////////////
355 // class XMLDoublePercentPropHdl
358 sal_Bool
XMLDoublePercentPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
360 sal_Bool bRet
= sal_False
;
364 if( rStrImpValue
.indexOf( (sal_Unicode
)'%' ) == -1 )
366 fValue
= rStrImpValue
.toDouble();
370 sal_Int32 nValue
= 0;
371 bRet
= SvXMLUnitConverter::convertPercent( nValue
, rStrImpValue
);
372 fValue
= ((double)nValue
) / 100.0;
379 sal_Bool
XMLDoublePercentPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
381 sal_Bool bRet
= sal_False
;
384 if( rValue
>>= fValue
)
387 if( fValue
> 0 ) fValue
+= 0.5; else fValue
-= 0.5;
389 sal_Int32 nValue
= (sal_Int32
)fValue
;
392 SvXMLUnitConverter::convertPercent( aOut
, nValue
);
393 rStrExpValue
= aOut
.makeStringAndClear();
402 ///////////////////////////////////////////////////////////////////////////////
404 // class XMLNegPercentPropHdl
407 XMLNegPercentPropHdl::~XMLNegPercentPropHdl()
412 sal_Bool
XMLNegPercentPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
414 sal_Bool bRet
= sal_False
;
416 sal_Int32 nValue
= 0;
417 bRet
= SvXMLUnitConverter::convertPercent( nValue
, rStrImpValue
);
418 lcl_xmloff_setAny( rValue
, 100-nValue
, nBytes
);
423 sal_Bool
XMLNegPercentPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
425 sal_Bool bRet
= sal_False
;
429 if( lcl_xmloff_getAny( rValue
, nValue
, nBytes
) )
431 SvXMLUnitConverter::convertPercent( aOut
, 100-nValue
);
432 rStrExpValue
= aOut
.makeStringAndClear();
441 ///////////////////////////////////////////////////////////////////////////////
443 // class XMLMeasurePxPropHdl
446 XMLMeasurePxPropHdl::~XMLMeasurePxPropHdl()
451 sal_Bool
XMLMeasurePxPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
453 sal_Bool bRet
= sal_False
;
455 sal_Int32 nValue
= 0;
456 bRet
= SvXMLUnitConverter::convertMeasurePx( nValue
, rStrImpValue
);
457 lcl_xmloff_setAny( rValue
, nValue
, nBytes
);
462 sal_Bool
XMLMeasurePxPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
464 sal_Bool bRet
= sal_False
;
468 if( lcl_xmloff_getAny( rValue
, nValue
, nBytes
) )
470 SvXMLUnitConverter::convertMeasurePx( aOut
, nValue
);
471 rStrExpValue
= aOut
.makeStringAndClear();
479 ///////////////////////////////////////////////////////////////////////////////
481 // class XMLColorPropHdl
484 XMLColorPropHdl::~XMLColorPropHdl()
489 sal_Bool
XMLColorPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
491 sal_Bool bRet
= sal_False
;
494 const OUString
astrHSL( RTL_CONSTASCII_USTRINGPARAM( "hsl" ) );
495 if( rStrImpValue
.matchIgnoreAsciiCase( astrHSL
) )
497 sal_Int32 nOpen
= rStrImpValue
.indexOf( '(' );
498 sal_Int32 nClose
= rStrImpValue
.lastIndexOf( ')' );
500 if( (nOpen
!= -1) && (nClose
> nOpen
) )
502 const OUString
aTmp( rStrImpValue
.copy( nOpen
+1, nClose
- nOpen
-1) );
504 sal_Int32 nIndex
= 0;
506 Sequence
< double > aHSL(3);
507 aHSL
[0] = aTmp
.getToken( 0, ',', nIndex
).toDouble();
508 aHSL
[1] = aTmp
.getToken( 0, ',', nIndex
).toDouble() / 100.0;
509 aHSL
[2] = aTmp
.getToken( 0, ',', nIndex
).toDouble() / 100.0;
516 bRet
= SvXMLUnitConverter::convertColor( aColor
, rStrImpValue
);
517 rValue
<<= (sal_Int32
)( aColor
.GetColor() );
523 sal_Bool
XMLColorPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
525 sal_Bool bRet
= sal_False
;
527 sal_Int32 nColor
= 0;
530 if( rValue
>>= nColor
)
532 aColor
.SetColor( nColor
);
534 SvXMLUnitConverter::convertColor( aOut
, aColor
);
535 rStrExpValue
= aOut
.makeStringAndClear();
541 Sequence
< double > aHSL
;
542 if( (rValue
>>= aHSL
) && (aHSL
.getLength() == 3) )
544 aOut
.append( OUString::createFromAscii("hsl(") );
545 aOut
.append( aHSL
[0] );
546 aOut
.append( OUString::createFromAscii(",") );
547 aOut
.append( aHSL
[1] * 100.0 );
548 aOut
.append( OUString::createFromAscii("%,") );
549 aOut
.append( aHSL
[2] * 100.0 );
550 aOut
.append( OUString::createFromAscii("%)") );
551 rStrExpValue
= aOut
.makeStringAndClear();
560 ///////////////////////////////////////////////////////////////////////////////
562 // class XMLStringPropHdl
565 XMLStringPropHdl::~XMLStringPropHdl()
570 sal_Bool
XMLStringPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
572 sal_Bool bRet
= sal_False
;
574 rValue
<<= rStrImpValue
;
580 sal_Bool
XMLStringPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
582 sal_Bool bRet
= sal_False
;
584 if( rValue
>>= rStrExpValue
)
590 ///////////////////////////////////////////////////////////////////////////////
592 // class XMLStyleNamePropHdl
595 XMLStyleNamePropHdl::~XMLStyleNamePropHdl()
600 sal_Bool
XMLStyleNamePropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const
602 sal_Bool bRet
= sal_False
;
604 if( rValue
>>= rStrExpValue
)
606 rStrExpValue
= rUnitConverter
.encodeStyleName( rStrExpValue
);
614 ///////////////////////////////////////////////////////////////////////////////
616 // class XMLDoublePropHdl
619 XMLDoublePropHdl::~XMLDoublePropHdl()
624 sal_Bool
XMLDoublePropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
627 sal_Bool bRet
= SvXMLUnitConverter::convertDouble( fDblValue
, rStrImpValue
);
628 rValue
<<= fDblValue
;
632 sal_Bool
XMLDoublePropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
634 sal_Bool bRet
= sal_False
;
638 if( rValue
>>= fValue
)
641 SvXMLUnitConverter::convertDouble( aOut
, fValue
);
642 rStrExpValue
= aOut
.makeStringAndClear();
649 ///////////////////////////////////////////////////////////////////////////////
651 // class XMLColorTransparentPropHdl
654 XMLColorTransparentPropHdl::XMLColorTransparentPropHdl(
655 enum XMLTokenEnum eTransparent
) :
656 sTransparent( GetXMLToken(
657 eTransparent
!= XML_TOKEN_INVALID
? eTransparent
: XML_TRANSPARENT
) )
662 XMLColorTransparentPropHdl::~XMLColorTransparentPropHdl()
667 sal_Bool
XMLColorTransparentPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
669 sal_Bool bRet
= sal_False
;
671 if( rStrImpValue
!= sTransparent
)
674 bRet
= SvXMLUnitConverter::convertColor( aColor
, rStrImpValue
);
675 rValue
<<= (sal_Int32
)( aColor
.GetColor() );
681 sal_Bool
XMLColorTransparentPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
683 sal_Bool bRet
= sal_False
;
684 sal_Int32 nColor
= 0;
686 if( rStrExpValue
== sTransparent
)
688 else if( rValue
>>= nColor
)
690 Color
aColor( nColor
);
692 SvXMLUnitConverter::convertColor( aOut
, aColor
);
693 rStrExpValue
= aOut
.makeStringAndClear();
702 ///////////////////////////////////////////////////////////////////////////////
704 // class XMLIsTransparentPropHdl
707 XMLIsTransparentPropHdl::XMLIsTransparentPropHdl(
708 enum XMLTokenEnum eTransparent
, sal_Bool bTransPropVal
) :
709 sTransparent( GetXMLToken(
710 eTransparent
!= XML_TOKEN_INVALID
? eTransparent
: XML_TRANSPARENT
) ),
711 bTransPropValue( bTransPropVal
)
715 XMLIsTransparentPropHdl::~XMLIsTransparentPropHdl()
720 sal_Bool
XMLIsTransparentPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
722 sal_Bool bValue
= ( (rStrImpValue
== sTransparent
) == bTransPropValue
);
723 rValue
.setValue( &bValue
, ::getBooleanCppuType() );
728 sal_Bool
XMLIsTransparentPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
730 sal_Bool bRet
= sal_False
;
732 // MIB: This looks a bit strange, because bTransPropValue == bValue should
733 // do the same, but this only applies if 'true' is represented by the same
734 // 8 bit value in bValue and bTransPropValue. Who will ensure this?
735 sal_Bool bValue
= *(sal_Bool
*)rValue
.getValue();
736 sal_Bool bIsTrans
= bTransPropValue
? bValue
: !bValue
;
740 rStrExpValue
= sTransparent
;
747 ///////////////////////////////////////////////////////////////////////////////
749 // class XMLColorAutoPropHdl
752 XMLColorAutoPropHdl::XMLColorAutoPropHdl()
757 XMLColorAutoPropHdl::~XMLColorAutoPropHdl()
762 sal_Bool
XMLColorAutoPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
764 sal_Bool bRet
= sal_False
;
766 // This is a multi property: the value might be set to AUTO_COLOR
767 // already by the XMLIsAutoColorPropHdl!
768 sal_Int32 nColor
= 0;
769 if( !(rValue
>>= nColor
) || -1 != nColor
)
772 bRet
= SvXMLUnitConverter::convertColor( aColor
, rStrImpValue
);
774 rValue
<<= (sal_Int32
)( aColor
.GetColor() );
780 sal_Bool
XMLColorAutoPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
782 sal_Bool bRet
= sal_False
;
784 sal_Int32 nColor
= 0;
785 if( (rValue
>>= nColor
) && -1 != nColor
)
787 Color
aColor( nColor
);
789 SvXMLUnitConverter::convertColor( aOut
, aColor
);
790 rStrExpValue
= aOut
.makeStringAndClear();
798 ///////////////////////////////////////////////////////////////////////////////
800 // class XMLIsAutoColorPropHdl
803 XMLIsAutoColorPropHdl::XMLIsAutoColorPropHdl()
807 XMLIsAutoColorPropHdl::~XMLIsAutoColorPropHdl()
812 sal_Bool
XMLIsAutoColorPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
816 // An auto color overrides any other color set!
817 sal_Bool bRet
= SvXMLUnitConverter::convertBool( bValue
, rStrImpValue
);
819 rValue
<<= (sal_Int32
)-1;
824 sal_Bool
XMLIsAutoColorPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
826 sal_Bool bRet
= sal_False
;
827 sal_Int32 nColor
= 0;
829 if( (rValue
>>= nColor
) && -1 == nColor
)
832 SvXMLUnitConverter::convertBool( aOut
, sal_True
);
833 rStrExpValue
= aOut
.makeStringAndClear();
841 ///////////////////////////////////////////////////////////////////////////////
843 // class XMLCompareOnlyPropHdl
846 XMLCompareOnlyPropHdl::~XMLCompareOnlyPropHdl()
851 sal_Bool
XMLCompareOnlyPropHdl::importXML( const OUString
&, Any
&, const SvXMLUnitConverter
& ) const
853 DBG_ASSERT( !this, "importXML called for compare-only-property" );
857 sal_Bool
XMLCompareOnlyPropHdl::exportXML( OUString
&, const Any
&, const SvXMLUnitConverter
& ) const
859 DBG_ASSERT( !this, "exportXML called for compare-only-property" );
863 ///////////////////////////////////////////////////////////////////////////////
864 // class XMLNumberWithoutZeroPropHdl
867 XMLNumberWithoutZeroPropHdl::XMLNumberWithoutZeroPropHdl( sal_Int8 nB
) :
872 XMLNumberWithoutZeroPropHdl::~XMLNumberWithoutZeroPropHdl()
876 sal_Bool
XMLNumberWithoutZeroPropHdl::importXML(
877 const OUString
& rStrImpValue
,
879 const SvXMLUnitConverter
& ) const
881 sal_Int32 nValue
= 0;
882 sal_Bool bRet
= SvXMLUnitConverter::convertNumber( nValue
, rStrImpValue
);
884 lcl_xmloff_setAny( rValue
, nValue
, nBytes
);
888 sal_Bool
XMLNumberWithoutZeroPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
891 sal_Int32 nValue
= 0;
892 sal_Bool bRet
= lcl_xmloff_getAny( rValue
, nValue
, nBytes
);
897 OUStringBuffer aBuffer
;
898 SvXMLUnitConverter::convertNumber( aBuffer
, nValue
);
899 rStrExpValue
= aBuffer
.makeStringAndClear();
905 ///////////////////////////////////////////////////////////////////////////////
906 // class XMLNumberWithAutoInsteadZeroPropHdl
909 XMLNumberWithAutoInsteadZeroPropHdl::~XMLNumberWithAutoInsteadZeroPropHdl()
913 sal_Bool
XMLNumberWithAutoInsteadZeroPropHdl::importXML(
914 const OUString
& rStrImpValue
,
916 const SvXMLUnitConverter
& ) const
918 sal_Int32 nValue
= 0;
919 sal_Bool bRet
= SvXMLUnitConverter::convertNumber( nValue
, rStrImpValue
);
921 lcl_xmloff_setAny( rValue
, nValue
, 2 );
922 else if( rStrImpValue
== GetXMLToken( XML_AUTO
) )
924 rValue
<<= (sal_Int16
)nValue
;
930 sal_Bool
XMLNumberWithAutoInsteadZeroPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
933 sal_Int32 nValue
= 0;
934 lcl_xmloff_getAny( rValue
, nValue
, 2 );
937 rStrExpValue
= GetXMLToken( XML_AUTO
);
940 OUStringBuffer aBuffer
;
941 SvXMLUnitConverter::convertNumber( aBuffer
, nValue
);
942 rStrExpValue
= aBuffer
.makeStringAndClear();