From b6b05f5c386069458412d56675b29e0b2dea3915 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Mon, 5 Aug 2002 12:19:53 +0000 Subject: #101758# allow usage of enums --- .../source/style/XMLConstantsPropertyHandler.cxx | 43 +++++++++++++++++++--- 1 file 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 +#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( 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; } -- cgit