Kaydet (Commit) ce9caa96 authored tarafından Daniel Rentz's avatar Daniel Rentz

rmv: XMLBoolValuesPropHdl

add: constructors for XMLNumberNonePropHdl
üst 943577be
......@@ -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;
......
......@@ -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;
}
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment