diff options
author | Daniel Rentz <dr@openoffice.org> | 2000-10-23 08:54:37 +0000 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2000-10-23 08:54:37 +0000 |
commit | ce9caa96ecb1b36d53b039d855bcee55a04e0985 (patch) | |
tree | 469fafcc1a9323875e2b474f37bd52ef03f410a4 /xmloff/source/style | |
parent | 943577be21bb066ed502cc49f8d2757a409cfc80 (diff) |
rmv: XMLBoolValuesPropHdl
add: constructors for XMLNumberNonePropHdl
Diffstat (limited to 'xmloff/source/style')
-rw-r--r-- | xmloff/source/style/prhdlfac.cxx | 10 | ||||
-rw-r--r-- | xmloff/source/style/xmlbahdl.cxx | 66 | ||||
-rw-r--r-- | xmloff/source/style/xmlbahdl.hxx | 26 |
3 files changed, 32 insertions, 70 deletions
diff --git a/xmloff/source/style/prhdlfac.cxx b/xmloff/source/style/prhdlfac.cxx index 2d9948efb0ee..f264a1cbc5c4 100644 --- a/xmloff/source/style/prhdlfac.cxx +++ b/xmloff/source/style/prhdlfac.cxx @@ -2,9 +2,9 @@ * * $RCSfile: prhdlfac.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: cl $ $Date: 2000-10-20 14:53:32 $ + * last change: $Author: dr $ $Date: 2000-10-23 09:54:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -230,6 +230,12 @@ const XMLPropertyHandler* XMLPropertyHandlerFactory::GetBasicHandler( sal_Int32 case XML_TYPE_NUMBER_NONE : pPropHdl = new XMLNumberNonePropHdl; break; + case XML_TYPE_NUMBER8_NONE : + pPropHdl = new XMLNumberNonePropHdl( 1 ); + break; + case XML_TYPE_NUMBER16_NONE : + pPropHdl = new XMLNumberNonePropHdl( 2 ); + break; case XML_TYPE_DOUBLE : pPropHdl = new XMLDoublePropHdl; break; diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx index eb6fcc121129..ab1744336137 100644 --- a/xmloff/source/style/xmlbahdl.cxx +++ b/xmloff/source/style/xmlbahdl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlbahdl.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: dr $ $Date: 2000-10-20 16:35:57 $ + * last change: $Author: dr $ $Date: 2000-10-23 09:54:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -179,6 +179,18 @@ sal_Bool XMLNumberPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, // class XMLNumberNonePropHdl // +XMLNumberNonePropHdl::XMLNumberNonePropHdl( sal_Int8 nB ) : + sZeroStr( RTL_CONSTASCII_USTRINGPARAM( sXML_no_limit ) ), + nBytes( nB ) +{ +} + +XMLNumberNonePropHdl::XMLNumberNonePropHdl( const sal_Char* sZeroString, sal_Int8 nB ) : + sZeroStr( OUString::createFromAscii( sZeroString ) ), + nBytes( nB ) +{ +} + XMLNumberNonePropHdl::~XMLNumberNonePropHdl() { // nothing to do @@ -189,7 +201,7 @@ sal_Bool XMLNumberNonePropHdl::importXML( const OUString& rStrImpValue, Any& rVa sal_Bool bRet = sal_False; sal_Int32 nValue; - if( rStrImpValue.compareToAscii( sXML_no_limit ) == 0 ) + if( rStrImpValue == sZeroStr ) { nValue = 0; bRet = sal_True; @@ -198,7 +210,7 @@ sal_Bool XMLNumberNonePropHdl::importXML( const OUString& rStrImpValue, Any& rVa { bRet = rUnitConverter.convertNumber( nValue, rStrImpValue ); } - rValue <<= nValue; + lcl_xmloff_setAny( rValue, nValue, nBytes ); return bRet; } @@ -208,13 +220,13 @@ sal_Bool XMLNumberNonePropHdl::exportXML( OUString& rStrExpValue, const Any& rVa sal_Bool bRet = sal_False; sal_Int32 nValue; - if( rValue >>= nValue ) + if( lcl_xmloff_getAny( rValue, nValue, nBytes ) ) { OUStringBuffer aOut; if( nValue == 0 ) { - aOut.appendAscii( sXML_no_limit ); + aOut.append( sZeroStr ); } else { @@ -586,45 +598,3 @@ sal_Bool XMLCompareOnlyPropHdl::exportXML( OUString& rStrExpValue, const Any& rV return sal_False; } - -/////////////////////////////////////////////////////////////////////////////// -// -// class XMLBoolValuesPropHdl -// - -XMLBoolValuesPropHdl::XMLBoolValuesPropHdl( - const sal_Char* sTrueValue, - const sal_Char* sFalseValue ) : - sTrueVal( OUString::createFromAscii( sTrueValue ) ), - sFalseVal( OUString::createFromAscii( sFalseValue ) ) -{ -} - -XMLBoolValuesPropHdl::~XMLBoolValuesPropHdl() -{ -} - -sal_Bool XMLBoolValuesPropHdl::importXML( - const OUString& rStrImpValue, - Any& rValue, - const SvXMLUnitConverter& rUnitConverter ) const -{ - sal_Bool bTrue = (rStrImpValue == sTrueVal); - sal_Bool bFalse = !bTrue && (rStrImpValue == sFalseVal); - - if( bTrue || bFalse ) - setBOOL( rValue, bTrue ); - - return (bTrue || bFalse); -} - -sal_Bool XMLBoolValuesPropHdl::exportXML( - OUString& rStrExpValue, - const Any& rValue, - const SvXMLUnitConverter& rUnitConverter ) const -{ - rStrExpValue = getBOOL( rValue ) ? sTrueVal : sFalseVal; - return sal_True; -} - - diff --git a/xmloff/source/style/xmlbahdl.hxx b/xmloff/source/style/xmlbahdl.hxx index f2d7edd1f3e5..8ab95846f8af 100644 --- a/xmloff/source/style/xmlbahdl.hxx +++ b/xmloff/source/style/xmlbahdl.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlbahdl.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: dr $ $Date: 2000-10-20 16:35:57 $ + * last change: $Author: dr $ $Date: 2000-10-23 09:54:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -90,7 +90,11 @@ public: */ class XMLNumberNonePropHdl : public XMLPropertyHandler { + ::rtl::OUString sZeroStr; + sal_Int8 nBytes; public: + XMLNumberNonePropHdl( sal_Int8 nB = 4 ); + XMLNumberNonePropHdl( const sal_Char* sZeroString, sal_Int8 nB = 4 ); virtual ~XMLNumberNonePropHdl(); virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const; @@ -222,23 +226,5 @@ public: virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const; }; -/** - A property handler for a boolean property that is represented by two - different strings -*/ -class XMLBoolValuesPropHdl : public XMLPropertyHandler -{ -protected: - ::rtl::OUString sTrueVal; - ::rtl::OUString sFalseVal; - -public: - XMLBoolValuesPropHdl( const sal_Char* sTrueValue, const sal_Char* sFalseValue ); - virtual ~XMLBoolValuesPropHdl(); - - virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const; - virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const; -}; - #endif // _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX |