1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #include <xmlbahdl.hxx>
23 #include <tools/debug.hxx>
24 #include <sax/tools/converter.hxx>
25 #include <xmloff/xmluconv.hxx>
26 #include <com/sun/star/uno/Any.hxx>
27 #include <xmloff/xmltoken.hxx>
30 using namespace ::com::sun::star::uno
;
31 using namespace ::xmloff::token
;
33 static void lcl_xmloff_setAny( Any
& rValue
, sal_Int32 nValue
, sal_Int8 nBytes
)
38 if( nValue
< SCHAR_MIN
)
40 else if( nValue
> SCHAR_MAX
)
42 rValue
<<= (sal_Int8
)nValue
;
45 if( nValue
< SHRT_MIN
)
47 else if( nValue
> SHRT_MAX
)
49 rValue
<<= (sal_Int16
)nValue
;
57 static sal_Bool
lcl_xmloff_getAny( const Any
& rValue
, sal_Int32
& nValue
,
60 sal_Bool bRet
= sal_False
;
67 bRet
= rValue
>>= nValue8
;
73 sal_Int16 nValue16
= 0;
74 bRet
= rValue
>>= nValue16
;
79 bRet
= rValue
>>= nValue
;
86 ///////////////////////////////////////////////////////////////////////////////
88 // class XMLNumberPropHdl
91 XMLNumberPropHdl::~XMLNumberPropHdl()
96 sal_Bool
XMLNumberPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
99 bool bRet
= ::sax::Converter::convertNumber( nValue
, rStrImpValue
);
100 lcl_xmloff_setAny( rValue
, nValue
, nBytes
);
105 sal_Bool
XMLNumberPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
107 sal_Bool bRet
= sal_False
;
111 if( lcl_xmloff_getAny( rValue
, nValue
, nBytes
) )
113 ::sax::Converter::convertNumber( aOut
, nValue
);
114 rStrExpValue
= aOut
.makeStringAndClear();
122 ///////////////////////////////////////////////////////////////////////////////
123 // class XMLNumberNonePropHdl
126 XMLNumberNonePropHdl::XMLNumberNonePropHdl( sal_Int8 nB
) :
127 sZeroStr( GetXMLToken(XML_NO_LIMIT
) ),
132 XMLNumberNonePropHdl::XMLNumberNonePropHdl( enum XMLTokenEnum eZeroString
, sal_Int8 nB
) :
133 sZeroStr( GetXMLToken( eZeroString
) ),
138 XMLNumberNonePropHdl::~XMLNumberNonePropHdl()
143 sal_Bool
XMLNumberNonePropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
145 sal_Bool bRet
= sal_False
;
147 sal_Int32 nValue
= 0;
148 if( rStrImpValue
== sZeroStr
)
154 bRet
= ::sax::Converter::convertNumber( nValue
, rStrImpValue
);
156 lcl_xmloff_setAny( rValue
, nValue
, nBytes
);
161 sal_Bool
XMLNumberNonePropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
163 sal_Bool bRet
= sal_False
;
166 if( lcl_xmloff_getAny( rValue
, nValue
, nBytes
) )
172 aOut
.append( sZeroStr
);
176 ::sax::Converter::convertNumber( aOut
, nValue
);
179 rStrExpValue
= aOut
.makeStringAndClear();
187 ///////////////////////////////////////////////////////////////////////////////
189 // class XMLMeasurePropHdl
192 XMLMeasurePropHdl::~XMLMeasurePropHdl()
197 sal_Bool
XMLMeasurePropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const
199 sal_Bool bRet
= sal_False
;
201 sal_Int32 nValue
= 0;
202 bRet
= rUnitConverter
.convertMeasureToCore( nValue
, rStrImpValue
);
203 lcl_xmloff_setAny( rValue
, nValue
, nBytes
);
208 sal_Bool
XMLMeasurePropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const
210 sal_Bool bRet
= sal_False
;
214 if( lcl_xmloff_getAny( rValue
, nValue
, nBytes
) )
216 rUnitConverter
.convertMeasureToXML( aOut
, nValue
);
217 rStrExpValue
= aOut
.makeStringAndClear();
225 ///////////////////////////////////////////////////////////////////////////////
227 // class XMLBoolFalsePropHdl
230 XMLBoolFalsePropHdl::~XMLBoolFalsePropHdl()
235 sal_Bool
XMLBoolFalsePropHdl::importXML( const OUString
&, Any
&, const SvXMLUnitConverter
& ) const
240 sal_Bool
XMLBoolFalsePropHdl::exportXML( OUString
& rStrExpValue
, const Any
& /*rValue*/, const SvXMLUnitConverter
& rCnv
) const
242 return XMLBoolPropHdl::exportXML( rStrExpValue
, makeAny( sal_False
), rCnv
);
245 ///////////////////////////////////////////////////////////////////////////////
247 // class XMLBoolPropHdl
250 XMLBoolPropHdl::~XMLBoolPropHdl()
255 sal_Bool
XMLBoolPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
258 bool const bRet
= ::sax::Converter::convertBool( bValue
, rStrImpValue
);
259 rValue
<<= sal_Bool(bValue
);
264 sal_Bool
XMLBoolPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
266 sal_Bool bRet
= sal_False
;
268 sal_Bool bValue
= sal_Bool();
270 if (rValue
>>= bValue
)
272 ::sax::Converter::convertBool( aOut
, bValue
);
273 rStrExpValue
= aOut
.makeStringAndClear();
281 ///////////////////////////////////////////////////////////////////////////////
283 // class XMLNBoolPropHdl
286 XMLNBoolPropHdl::~XMLNBoolPropHdl()
291 sal_Bool
XMLNBoolPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
294 bool const bRet
= ::sax::Converter::convertBool( bValue
, rStrImpValue
);
295 rValue
<<= sal_Bool(!bValue
);
300 sal_Bool
XMLNBoolPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
302 sal_Bool bRet
= sal_False
;
304 sal_Bool bValue
= sal_Bool();
306 if (rValue
>>= bValue
)
308 ::sax::Converter::convertBool( aOut
, !bValue
);
309 rStrExpValue
= aOut
.makeStringAndClear();
317 ///////////////////////////////////////////////////////////////////////////////
319 // class XMLPercentPropHdl
322 XMLPercentPropHdl::~XMLPercentPropHdl()
327 sal_Bool
XMLPercentPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
329 sal_Int32 nValue
= 0;
330 bool const bRet
= ::sax::Converter::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 ::sax::Converter::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
= ::sax::Converter::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 ::sax::Converter::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_Int32 nValue
= 0;
415 bool const bRet
= ::sax::Converter::convertPercent( nValue
, rStrImpValue
);
416 lcl_xmloff_setAny( rValue
, 100-nValue
, nBytes
);
421 sal_Bool
XMLNegPercentPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
423 sal_Bool bRet
= sal_False
;
427 if( lcl_xmloff_getAny( rValue
, nValue
, nBytes
) )
429 ::sax::Converter::convertPercent( aOut
, 100-nValue
);
430 rStrExpValue
= aOut
.makeStringAndClear();
439 ///////////////////////////////////////////////////////////////////////////////
441 // class XMLMeasurePxPropHdl
444 XMLMeasurePxPropHdl::~XMLMeasurePxPropHdl()
449 sal_Bool
XMLMeasurePxPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
451 sal_Bool bRet
= sal_False
;
453 sal_Int32 nValue
= 0;
454 bRet
= ::sax::Converter::convertMeasurePx( nValue
, rStrImpValue
);
455 lcl_xmloff_setAny( rValue
, nValue
, nBytes
);
460 sal_Bool
XMLMeasurePxPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
462 sal_Bool bRet
= sal_False
;
466 if( lcl_xmloff_getAny( rValue
, nValue
, nBytes
) )
468 ::sax::Converter::convertMeasurePx( aOut
, nValue
);
469 rStrExpValue
= aOut
.makeStringAndClear();
477 ///////////////////////////////////////////////////////////////////////////////
479 // class XMLColorPropHdl
482 XMLColorPropHdl::~XMLColorPropHdl()
487 sal_Bool
XMLColorPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
489 sal_Bool bRet
= sal_False
;
491 const OUString
astrHSL( "hsl" );
492 if( rStrImpValue
.matchIgnoreAsciiCase( astrHSL
) )
494 sal_Int32 nOpen
= rStrImpValue
.indexOf( '(' );
495 sal_Int32 nClose
= rStrImpValue
.lastIndexOf( ')' );
497 if( (nOpen
!= -1) && (nClose
> nOpen
) )
499 const OUString
aTmp( rStrImpValue
.copy( nOpen
+1, nClose
- nOpen
-1) );
501 sal_Int32 nIndex
= 0;
503 Sequence
< double > aHSL(3);
504 aHSL
[0] = aTmp
.getToken( 0, ',', nIndex
).toDouble();
505 aHSL
[1] = aTmp
.getToken( 0, ',', nIndex
).toDouble() / 100.0;
506 aHSL
[2] = aTmp
.getToken( 0, ',', nIndex
).toDouble() / 100.0;
514 bRet
= ::sax::Converter::convertColor( nColor
, rStrImpValue
);
521 sal_Bool
XMLColorPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
523 sal_Bool bRet
= sal_False
;
524 sal_Int32 nColor
= 0;
527 if( rValue
>>= nColor
)
529 ::sax::Converter::convertColor( aOut
, nColor
);
530 rStrExpValue
= aOut
.makeStringAndClear();
536 Sequence
< double > aHSL
;
537 if( (rValue
>>= aHSL
) && (aHSL
.getLength() == 3) )
539 aOut
.append( OUString("hsl(") );
540 aOut
.append( aHSL
[0] );
541 aOut
.append( OUString(",") );
542 aOut
.append( aHSL
[1] * 100.0 );
543 aOut
.append( OUString("%,") );
544 aOut
.append( aHSL
[2] * 100.0 );
545 aOut
.append( OUString("%)") );
546 rStrExpValue
= aOut
.makeStringAndClear();
555 ///////////////////////////////////////////////////////////////////////////////
557 // class XMLHexPropHdl
560 XMLHexPropHdl::~XMLHexPropHdl()
565 sal_Bool
XMLHexPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
567 sal_Bool bRet
= sal_False
;
570 bRet
= SvXMLUnitConverter::convertHex( nRsid
, rStrImpValue
);
576 sal_Bool
XMLHexPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
578 sal_Bool bRet
= sal_False
;
579 sal_uInt32 nRsid
= 0;
582 if( rValue
>>= nRsid
)
584 SvXMLUnitConverter::convertHex( aOut
, nRsid
);
585 rStrExpValue
= aOut
.makeStringAndClear();
597 ///////////////////////////////////////////////////////////////////////////////
599 // class XMLStringPropHdl
602 XMLStringPropHdl::~XMLStringPropHdl()
607 sal_Bool
XMLStringPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
609 sal_Bool bRet
= sal_False
;
611 rValue
<<= rStrImpValue
;
617 sal_Bool
XMLStringPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
619 sal_Bool bRet
= sal_False
;
621 if( rValue
>>= rStrExpValue
)
627 ///////////////////////////////////////////////////////////////////////////////
629 // class XMLStyleNamePropHdl
632 XMLStyleNamePropHdl::~XMLStyleNamePropHdl()
637 sal_Bool
XMLStyleNamePropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const
639 sal_Bool bRet
= sal_False
;
641 if( rValue
>>= rStrExpValue
)
643 rStrExpValue
= rUnitConverter
.encodeStyleName( rStrExpValue
);
651 ///////////////////////////////////////////////////////////////////////////////
653 // class XMLDoublePropHdl
656 XMLDoublePropHdl::~XMLDoublePropHdl()
661 sal_Bool
XMLDoublePropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
663 double fDblValue(0.0);
664 bool const bRet
= ::sax::Converter::convertDouble(fDblValue
, rStrImpValue
);
665 rValue
<<= fDblValue
;
669 sal_Bool
XMLDoublePropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
671 sal_Bool bRet
= sal_False
;
675 if( rValue
>>= fValue
)
678 ::sax::Converter::convertDouble( aOut
, fValue
);
679 rStrExpValue
= aOut
.makeStringAndClear();
686 ///////////////////////////////////////////////////////////////////////////////
688 // class XMLColorTransparentPropHdl
691 XMLColorTransparentPropHdl::XMLColorTransparentPropHdl(
692 enum XMLTokenEnum eTransparent
) :
693 sTransparent( GetXMLToken(
694 eTransparent
!= XML_TOKEN_INVALID
? eTransparent
: XML_TRANSPARENT
) )
699 XMLColorTransparentPropHdl::~XMLColorTransparentPropHdl()
704 sal_Bool
XMLColorTransparentPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
706 sal_Bool bRet
= sal_False
;
708 if( rStrImpValue
!= sTransparent
)
711 bRet
= ::sax::Converter::convertColor( nColor
, rStrImpValue
);
718 sal_Bool
XMLColorTransparentPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
720 sal_Bool bRet
= sal_False
;
721 sal_Int32 nColor
= 0;
723 if( rStrExpValue
== sTransparent
)
725 else if( rValue
>>= nColor
)
728 ::sax::Converter::convertColor( aOut
, nColor
);
729 rStrExpValue
= aOut
.makeStringAndClear();
738 ///////////////////////////////////////////////////////////////////////////////
740 // class XMLIsTransparentPropHdl
743 XMLIsTransparentPropHdl::XMLIsTransparentPropHdl(
744 enum XMLTokenEnum eTransparent
, sal_Bool bTransPropVal
) :
745 sTransparent( GetXMLToken(
746 eTransparent
!= XML_TOKEN_INVALID
? eTransparent
: XML_TRANSPARENT
) ),
747 bTransPropValue( bTransPropVal
)
751 XMLIsTransparentPropHdl::~XMLIsTransparentPropHdl()
756 sal_Bool
XMLIsTransparentPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
758 sal_Bool bValue
= ( (rStrImpValue
== sTransparent
) == bTransPropValue
);
759 rValue
.setValue( &bValue
, ::getBooleanCppuType() );
764 sal_Bool
XMLIsTransparentPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
766 sal_Bool bRet
= sal_False
;
768 // MIB: This looks a bit strange, because bTransPropValue == bValue should
769 // do the same, but this only applies if 'true' is represented by the same
770 // 8 bit value in bValue and bTransPropValue. Who will ensure this?
771 sal_Bool bValue
= *(sal_Bool
*)rValue
.getValue();
772 sal_Bool bIsTrans
= bTransPropValue
? bValue
: !bValue
;
776 rStrExpValue
= sTransparent
;
783 ///////////////////////////////////////////////////////////////////////////////
785 // class XMLColorAutoPropHdl
788 XMLColorAutoPropHdl::XMLColorAutoPropHdl()
793 XMLColorAutoPropHdl::~XMLColorAutoPropHdl()
798 sal_Bool
XMLColorAutoPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
800 sal_Bool bRet
= sal_False
;
802 // This is a multi property: the value might be set to AUTO_COLOR
803 // already by the XMLIsAutoColorPropHdl!
804 sal_Int32 nColor
= 0;
805 if( !(rValue
>>= nColor
) || -1 != nColor
)
807 bRet
= ::sax::Converter::convertColor( nColor
, rStrImpValue
);
815 sal_Bool
XMLColorAutoPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
817 sal_Bool bRet
= sal_False
;
819 sal_Int32 nColor
= 0;
820 if( (rValue
>>= nColor
) && -1 != nColor
)
823 ::sax::Converter::convertColor( aOut
, nColor
);
824 rStrExpValue
= aOut
.makeStringAndClear();
832 ///////////////////////////////////////////////////////////////////////////////
834 // class XMLIsAutoColorPropHdl
837 XMLIsAutoColorPropHdl::XMLIsAutoColorPropHdl()
841 XMLIsAutoColorPropHdl::~XMLIsAutoColorPropHdl()
846 sal_Bool
XMLIsAutoColorPropHdl::importXML( const OUString
& rStrImpValue
, Any
& rValue
, const SvXMLUnitConverter
& ) const
848 // An auto color overrides any other color set!
850 bool const bRet
= ::sax::Converter::convertBool( bValue
, rStrImpValue
);
852 rValue
<<= (sal_Int32
)-1;
857 sal_Bool
XMLIsAutoColorPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
859 sal_Bool bRet
= sal_False
;
860 sal_Int32 nColor
= 0;
862 if( (rValue
>>= nColor
) && -1 == nColor
)
865 ::sax::Converter::convertBool( aOut
, true );
866 rStrExpValue
= aOut
.makeStringAndClear();
874 ///////////////////////////////////////////////////////////////////////////////
876 // class XMLCompareOnlyPropHdl
879 XMLCompareOnlyPropHdl::~XMLCompareOnlyPropHdl()
884 sal_Bool
XMLCompareOnlyPropHdl::importXML( const OUString
&, Any
&, const SvXMLUnitConverter
& ) const
886 DBG_ASSERT( !this, "importXML called for compare-only-property" );
890 sal_Bool
XMLCompareOnlyPropHdl::exportXML( OUString
&, const Any
&, const SvXMLUnitConverter
& ) const
892 DBG_ASSERT( !this, "exportXML called for compare-only-property" );
896 ///////////////////////////////////////////////////////////////////////////////
897 // class XMLNumberWithoutZeroPropHdl
900 XMLNumberWithoutZeroPropHdl::XMLNumberWithoutZeroPropHdl( sal_Int8 nB
) :
905 XMLNumberWithoutZeroPropHdl::~XMLNumberWithoutZeroPropHdl()
909 sal_Bool
XMLNumberWithoutZeroPropHdl::importXML(
910 const OUString
& rStrImpValue
,
912 const SvXMLUnitConverter
& ) const
914 sal_Int32 nValue
= 0;
915 bool const bRet
= ::sax::Converter::convertNumber( nValue
, rStrImpValue
);
917 lcl_xmloff_setAny( rValue
, nValue
, nBytes
);
921 sal_Bool
XMLNumberWithoutZeroPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
924 sal_Int32 nValue
= 0;
925 sal_Bool bRet
= lcl_xmloff_getAny( rValue
, nValue
, nBytes
);
930 OUStringBuffer aBuffer
;
931 ::sax::Converter::convertNumber( aBuffer
, nValue
);
932 rStrExpValue
= aBuffer
.makeStringAndClear();
938 ///////////////////////////////////////////////////////////////////////////////
939 // class XMLNumberWithAutoInsteadZeroPropHdl
942 XMLNumberWithAutoInsteadZeroPropHdl::~XMLNumberWithAutoInsteadZeroPropHdl()
946 sal_Bool
XMLNumberWithAutoInsteadZeroPropHdl::importXML(
947 const OUString
& rStrImpValue
,
949 const SvXMLUnitConverter
& ) const
951 sal_Int32 nValue
= 0;
952 bool bRet
= ::sax::Converter::convertNumber( nValue
, rStrImpValue
);
954 lcl_xmloff_setAny( rValue
, nValue
, 2 );
955 else if( rStrImpValue
== GetXMLToken( XML_AUTO
) )
957 rValue
<<= (sal_Int16
)nValue
;
963 sal_Bool
XMLNumberWithAutoInsteadZeroPropHdl::exportXML( OUString
& rStrExpValue
, const Any
& rValue
, const SvXMLUnitConverter
& ) const
966 sal_Int32 nValue
= 0;
967 lcl_xmloff_getAny( rValue
, nValue
, 2 );
970 rStrExpValue
= GetXMLToken( XML_AUTO
);
973 OUStringBuffer aBuffer
;
974 ::sax::Converter::convertNumber( aBuffer
, nValue
);
975 rStrExpValue
= aBuffer
.makeStringAndClear();
981 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */