diff options
author | Christian Lippka <cl@openoffice.org> | 2002-08-05 12:19:53 +0000 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2002-08-05 12:19:53 +0000 |
commit | b6b05f5c386069458412d56675b29e0b2dea3915 (patch) | |
tree | 6f2ea5dcca452d2535eeb5a2e471b97aeb9e49d5 /xmloff | |
parent | 5ed76096216d7b5dae72ccf97a2672b076cae0eb (diff) |
#101758# allow usage of enums
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/style/XMLConstantsPropertyHandler.cxx | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/xmloff/source/style/XMLConstantsPropertyHandler.cxx b/xmloff/source/style/XMLConstantsPropertyHandler.cxx index bc0d2c8820af..57f06fc0c9b9 100644 --- a/xmloff/source/style/XMLConstantsPropertyHandler.cxx +++ b/xmloff/source/style/XMLConstantsPropertyHandler.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLConstantsPropertyHandler.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dvo $ $Date: 2001-06-15 10:37:07 $ + * last change: $Author: cl $ $Date: 2002-08-05 13:19:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,6 +59,10 @@ * ************************************************************************/ +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif + #ifndef _XMLOFF_XMLUCONV_HXX #include "xmluconv.hxx" #endif @@ -112,12 +116,39 @@ sal_Bool XMLConstantsPropertyHandler::exportXML( { OUStringBuffer aOut; - sal_Int16 nEnum; - rValue >>= nEnum; + sal_Bool bRet = false; - sal_Bool bRet = rUnitConverter.convertEnum( aOut, nEnum, pMap, eDefault ); + sal_Int32 nEnum; - rStrExpValue = aOut.makeStringAndClear(); + if( rValue.hasValue() && (rValue.getValueTypeClass() == TypeClass_ENUM)) + { + nEnum = *((sal_Int32*)rValue.getValue()); + bRet = true; + } + else + { + bRet = (rValue >>= nEnum ); + } + + if( bRet ) + { + if( (nEnum >= 0) && (nEnum <= 0xffff) ) + { + sal_uInt16 nConst = static_cast<sal_uInt16>( nEnum ); + + bRet = rUnitConverter.convertEnum( aOut, nConst, pMap, eDefault ); + + rStrExpValue = aOut.makeStringAndClear(); + } + else + { + DBG_ERROR("XMLConstantsPropertyHandler::exportXML() constant is out of range for implementation using sal_uInt16"); + } + } + else + { + DBG_ERROR("XMLConstantsPropertyHandler::exportXML() could not convert any to sal_Int32"); + } return bRet; } |