diff options
author | Michael Stahl <mst@openoffice.org> | 2011-10-11 14:19:00 +0200 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2011-10-11 17:57:00 +0200 |
commit | 3ca2bef76886450058d1667703aeafe4c2e456c3 (patch) | |
tree | b18d70f79bfcfd2b2e34790e86edafb4c4337a80 /xmloff/source/draw | |
parent | 02c32e0f0e75a9df80888051d1ec189fa14129bd (diff) |
#i108468#: clean up xmluconv code duplication, part 1:
move convertNumber64 from SvXMLUnitConverter to sax::converter.
remove duplicate methods from SvXMLUnitConverter:
convertBool, convertPercent, convertColor, convertNumber, convertDouble,
indexOfComma, encodeBase64, decodeBase64, decodeBase64SomeChars,
clearUndefinedChars
Diffstat (limited to 'xmloff/source/draw')
-rw-r--r-- | xmloff/source/draw/animationexport.cxx | 22 | ||||
-rw-r--r-- | xmloff/source/draw/animationimport.cxx | 12 | ||||
-rw-r--r-- | xmloff/source/draw/animexp.cxx | 14 | ||||
-rw-r--r-- | xmloff/source/draw/animimp.cxx | 11 | ||||
-rw-r--r-- | xmloff/source/draw/eventimp.cxx | 7 | ||||
-rw-r--r-- | xmloff/source/draw/propimp0.cxx | 11 | ||||
-rw-r--r-- | xmloff/source/draw/sdpropls.cxx | 10 | ||||
-rw-r--r-- | xmloff/source/draw/shapeexport2.cxx | 9 | ||||
-rw-r--r-- | xmloff/source/draw/shapeexport3.cxx | 23 | ||||
-rw-r--r-- | xmloff/source/draw/shapeexport4.cxx | 56 | ||||
-rw-r--r-- | xmloff/source/draw/xexptran.cxx | 12 | ||||
-rw-r--r-- | xmloff/source/draw/ximp3dscene.cxx | 19 | ||||
-rw-r--r-- | xmloff/source/draw/ximpcustomshape.cxx | 36 | ||||
-rw-r--r-- | xmloff/source/draw/ximpshap.cxx | 7 |
14 files changed, 158 insertions, 91 deletions
diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx index 851209b13a8a..57c1cd22f7d4 100644 --- a/xmloff/source/draw/animationexport.cxx +++ b/xmloff/source/draw/animationexport.cxx @@ -62,6 +62,8 @@ #include <com/sun/star/presentation/EffectCommands.hpp> #include <com/sun/star/drawing/XShape.hpp> +#include <sax/tools/converter.hxx> + #include <tools/debug.hxx> #include <tools/time.hxx> #include <xmloff/unointerfacetouniqueidentifiermapper.hxx> @@ -619,7 +621,7 @@ void AnimationsExporterImpl::exportTransitionNode() mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionFadeColor" ) ) ) >>= nFadeColor; mxPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionDuration" ) ) ) >>= fDuration; - SvXMLUnitConverter::convertDouble( sTmp, fDuration ); + ::sax::Converter::convertDouble( sTmp, fDuration ); sTmp.append( sal_Unicode('s')); mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DUR, sTmp.makeStringAndClear() ); @@ -637,7 +639,7 @@ void AnimationsExporterImpl::exportTransitionNode() if( (nTransition == TransitionType::FADE) && ((nSubtype == TransitionSubType::FADETOCOLOR) || (nSubtype == TransitionSubType::FADEFROMCOLOR) )) { - SvXMLUnitConverter::convertColor( sTmp, nFadeColor ); + ::sax::Converter::convertColor( sTmp, nFadeColor ); mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FADECOLOR, sTmp.makeStringAndClear() ); } SvXMLElementExport aElement2( mrExport, XML_NAMESPACE_ANIMATION, XML_TRANSITIONFILTER, sal_True, sal_True ); @@ -804,7 +806,7 @@ void AnimationsExporterImpl::exportNode( const Reference< XAnimationNode >& xNod { if( aTemp >>= fTemp ) { - SvXMLUnitConverter::convertDouble( sTmp, fTemp ); + ::sax::Converter::convertDouble( sTmp, fTemp ); sTmp.append( sal_Unicode('s')); mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DUR, sTmp.makeStringAndClear() ); } @@ -854,21 +856,21 @@ void AnimationsExporterImpl::exportNode( const Reference< XAnimationNode >& xNod fTemp = xNode->getAcceleration(); if( fTemp != 0.0 ) { - SvXMLUnitConverter::convertDouble( sTmp, fTemp ); + ::sax::Converter::convertDouble( sTmp, fTemp ); mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ACCELERATE, sTmp.makeStringAndClear() ); } fTemp = xNode->getDecelerate(); if( fTemp != 0.0 ) { - SvXMLUnitConverter::convertDouble( sTmp, fTemp ); + ::sax::Converter::convertDouble( sTmp, fTemp ); mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DECELERATE, sTmp.makeStringAndClear() ); } sal_Bool bTemp = xNode->getAutoReverse(); if( bTemp ) { - SvXMLUnitConverter::convertBool( sTmp, bTemp ); + ::sax::Converter::convertBool( sTmp, bTemp ); mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_AUTOREVERSE, sTmp.makeStringAndClear() ); } @@ -880,7 +882,7 @@ void AnimationsExporterImpl::exportNode( const Reference< XAnimationNode >& xNod mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATCOUNT, XML_INDEFINITE ); else if( aTemp >>= fTemp ) { - SvXMLUnitConverter::convertDouble( sTmp, fTemp ); + ::sax::Converter::convertDouble( sTmp, fTemp ); mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATCOUNT, sTmp.makeStringAndClear() ); } } @@ -895,7 +897,7 @@ void AnimationsExporterImpl::exportNode( const Reference< XAnimationNode >& xNod } else if( aTemp >>= fTemp ) { - SvXMLUnitConverter::convertDouble( sTmp, fTemp ); + ::sax::Converter::convertDouble( sTmp, fTemp ); mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATDUR, sTmp.makeStringAndClear() ); } } @@ -1354,7 +1356,7 @@ void AnimationsExporterImpl::exportAnimate( const Reference< XAnimate >& xAnimat if( (nTransition == TransitionType::FADE) && ((nSubtype == TransitionSubType::FADETOCOLOR) || (nSubtype == TransitionSubType::FADEFROMCOLOR) )) { nTemp = xTransitionFilter->getFadeColor(); - SvXMLUnitConverter::convertColor( sTmp, nTemp ); + ::sax::Converter::convertColor( sTmp, nTemp ); mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FADECOLOR, sTmp.makeStringAndClear() ); } } @@ -1384,7 +1386,7 @@ void AnimationsExporterImpl::exportAudio( const Reference< XAudio >& xAudio ) if( fVolume != 1.0 ) { OUStringBuffer sTmp; - SvXMLUnitConverter::convertDouble( sTmp, fVolume ); + ::sax::Converter::convertDouble( sTmp, fVolume ); mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_AUDIO_LEVEL, sTmp.makeStringAndClear() ); } diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx index 85528e83ceba..81a53fe8a280 100644 --- a/xmloff/source/draw/animationimport.cxx +++ b/xmloff/source/draw/animationimport.cxx @@ -63,6 +63,8 @@ #include <comphelper/processfactory.hxx> #include <cppuhelper/implbase1.hxx> +#include <sax/tools/converter.hxx> + #include <list> #include <xmloff/xmltypes.hxx> #include "sdpropls.hxx" @@ -843,7 +845,7 @@ void AnimationNodeContext::init_node( const ::com::sun::star::uno::Reference< : case ANA_AutoReverse: { bool bTemp; - if( SvXMLUnitConverter::convertBool( bTemp, rValue ) ) + if (::sax::Converter::convertBool( bTemp, rValue )) mxNode->setAutoReverse( bTemp ); } break; @@ -888,7 +890,7 @@ void AnimationNodeContext::init_node( const ::com::sun::star::uno::Reference< : case ANA_After_Effect: { bool bTemp; - if( SvXMLUnitConverter::convertBool( bTemp, rValue ) ) + if (::sax::Converter::convertBool( bTemp, rValue )) aUserData.push_back( NamedValue( GetXMLToken( XML_AFTER_EFFECT ), makeAny( bTemp ) ) ); } break; @@ -1153,9 +1155,9 @@ void AnimationNodeContext::init_node( const ::com::sun::star::uno::Reference< : { if( xTransitionFilter.is() ) { - Color aColor; - SvXMLUnitConverter::convertColor( aColor, rValue ); - xTransitionFilter->setFadeColor( static_cast< sal_Int32 >( aColor.GetRGBColor() ) ); + sal_Int32 nColor(0); + ::sax::Converter::convertColor(nColor, rValue); + xTransitionFilter->setFadeColor(nColor); } } break; diff --git a/xmloff/source/draw/animexp.cxx b/xmloff/source/draw/animexp.cxx index f6bb306d9a4d..8cd68c87be26 100644 --- a/xmloff/source/draw/animexp.cxx +++ b/xmloff/source/draw/animexp.cxx @@ -34,9 +34,10 @@ #include <com/sun/star/presentation/AnimationSpeed.hpp> #include <xmloff/unointerfacetouniqueidentifiermapper.hxx> +#include <sax/tools/converter.hxx> + #include <list> #include <comphelper/extract.hxx> -#include <tools/color.hxx> #include <xmloff/xmltoken.hxx> #include "xmloff/xmlnmspe.hxx" #include <xmloff/xmluconv.hxx> @@ -217,7 +218,7 @@ struct XMLEffectHint sal_Int16 mnStartScale; AnimationSpeed meSpeed; - Color maDimColor; + sal_Int32 maDimColor; OUString maSoundURL; sal_Bool mbPlayFull; sal_Int32 mnPresId; @@ -417,9 +418,8 @@ void XMLAnimationsExporter::collect( Reference< XShape > xShape, SvXMLExport& rE aEffect.meSpeed = AnimationSpeed_MEDIUM; if( bDimPrev ) { - sal_Int32 nColor = 0; - xProps->getPropertyValue( mpImpl->msDimColor ) >>= nColor; - aEffect.maDimColor.SetColor( nColor ); + xProps->getPropertyValue( mpImpl->msDimColor ) + >>= aEffect.maDimColor; } if( !aEffect.mxShape.is() ) @@ -465,7 +465,7 @@ void XMLAnimationsExporter::exportAnimations( SvXMLExport& rExport ) { // export a dim action; - SvXMLUnitConverter::convertColor( sTmp, rEffect.maDimColor ); + ::sax::Converter::convertColor( sTmp, rEffect.maDimColor ); rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_COLOR, sTmp.makeStringAndClear() ); SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, XML_DIM, sal_True, sal_True ); @@ -497,7 +497,7 @@ void XMLAnimationsExporter::exportAnimations( SvXMLExport& rExport ) if( rEffect.mnStartScale != -1 ) { - SvXMLUnitConverter::convertPercent( sTmp, rEffect.mnStartScale ); + ::sax::Converter::convertPercent(sTmp, rEffect.mnStartScale); rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_START_SCALE, sTmp.makeStringAndClear() ); } diff --git a/xmloff/source/draw/animimp.cxx b/xmloff/source/draw/animimp.cxx index 89c90e2ae05b..4a3f6581bd9b 100644 --- a/xmloff/source/draw/animimp.cxx +++ b/xmloff/source/draw/animimp.cxx @@ -37,8 +37,9 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <sax/tools/converter.hxx> + #include <list> -#include <tools/color.hxx> #include <comphelper/extract.hxx> #include <xmloff/xmltoken.hxx> #include <xmloff/xmlimp.hxx> @@ -396,7 +397,7 @@ public: sal_Int16 mnStartScale; AnimationSpeed meSpeed; - Color maDimColor; + sal_Int32 maDimColor; OUString maSoundURL; sal_Bool mbPlayFull; OUString maPathShapeId; @@ -525,7 +526,7 @@ XMLAnimationsEffectContext::XMLAnimationsEffectContext( SvXMLImport& rImport, s } else if( IsXMLToken( aLocalName, XML_COLOR ) ) { - SvXMLUnitConverter::convertColor(maDimColor, sValue); + ::sax::Converter::convertColor(maDimColor, sValue); } break; @@ -545,7 +546,7 @@ XMLAnimationsEffectContext::XMLAnimationsEffectContext( SvXMLImport& rImport, s else if( IsXMLToken( aLocalName, XML_START_SCALE ) ) { sal_Int32 nScale; - if( SvXMLUnitConverter::convertPercent( nScale, sValue ) ) + if (::sax::Converter::convertPercent( nScale, sValue )) mnStartScale = (sal_Int16)nScale; } else if( IsXMLToken( aLocalName, XML_SPEED ) ) @@ -612,7 +613,7 @@ void XMLAnimationsEffectContext::EndElement() aAny <<= (sal_Bool)sal_True; xSet->setPropertyValue( mpImpl->msDimPrev, aAny ); - aAny <<= (sal_Int32)maDimColor.GetColor(); + aAny <<= maDimColor; xSet->setPropertyValue( mpImpl->msDimColor, aAny ); } else if( meKind == XMLE_PLAY ) diff --git a/xmloff/source/draw/eventimp.cxx b/xmloff/source/draw/eventimp.cxx index 6d82798bd283..8bb10ef3446b 100644 --- a/xmloff/source/draw/eventimp.cxx +++ b/xmloff/source/draw/eventimp.cxx @@ -38,6 +38,9 @@ #include <com/sun/star/presentation/ClickAction.hpp> #include <tools/urlobj.hxx> #include <comphelper/extract.hxx> + +#include <sax/tools/converter.hxx> + #include <xmloff/xmltoken.hxx> #include <xmloff/xmlimp.hxx> #include "xmloff/xmlnmspe.hxx" @@ -225,7 +228,7 @@ SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, cons else if( IsXMLToken( aAttrLocalName, XML_START_SCALE ) ) { sal_Int32 nScale; - if( SvXMLUnitConverter::convertPercent( nScale, sValue ) ) + if (::sax::Converter::convertPercent( nScale, sValue )) mnStartScale = (sal_Int16)nScale; } else if( IsXMLToken( aAttrLocalName, XML_SPEED ) ) @@ -236,7 +239,7 @@ SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, cons } else if( IsXMLToken( aAttrLocalName, XML_VERB ) ) { - SvXMLUnitConverter::convertNumber( mnVerb, sValue ); + ::sax::Converter::convertNumber( mnVerb, sValue ); } break; diff --git a/xmloff/source/draw/propimp0.cxx b/xmloff/source/draw/propimp0.cxx index c1e97269427e..34deab9fd332 100644 --- a/xmloff/source/draw/propimp0.cxx +++ b/xmloff/source/draw/propimp0.cxx @@ -34,6 +34,9 @@ #include <com/sun/star/drawing/LineDash.hpp> #include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/uno/Any.hxx> + +#include <sax/tools/converter.hxx> + #include <xmloff/xmluconv.hxx> #include <xmloff/xmlimp.hxx> @@ -114,7 +117,7 @@ sal_Bool XMLOpacityPropertyHdl::importXML( if( rStrImpValue.indexOf( sal_Unicode('%') ) != -1 ) { - if( SvXMLUnitConverter::convertPercent( nValue, rStrImpValue ) ) + if (::sax::Converter::convertPercent( nValue, rStrImpValue )) bRet = sal_True; } else @@ -165,7 +168,7 @@ sal_Bool XMLOpacityPropertyHdl::exportXML( OUStringBuffer aOut; nVal = 100 - nVal; - SvXMLUnitConverter::convertPercent( aOut, nVal ); + ::sax::Converter::convertPercent( aOut, nVal ); rStrExpValue = aOut.makeStringAndClear(); bRet = sal_True; } @@ -192,7 +195,7 @@ sal_Bool XMLTextAnimationStepPropertyHdl::importXML( sal_Int32 nPos = rStrImpValue.indexOf( aPX ); if( nPos != -1 ) { - if( rUnitConverter.convertNumber( nValue, rStrImpValue.copy( 0, nPos ) ) ) + if (::sax::Converter::convertNumber(nValue, rStrImpValue.copy(0, nPos))) { rValue <<= sal_Int16( -nValue ); bRet = sal_True; @@ -225,7 +228,7 @@ sal_Bool XMLTextAnimationStepPropertyHdl::exportXML( if( nVal < 0 ) { const OUString aPX( RTL_CONSTASCII_USTRINGPARAM( "px" ) ); - rUnitConverter.convertNumber( aOut, (sal_Int32)-nVal ); + ::sax::Converter::convertNumber( aOut, (sal_Int32)-nVal ); aOut.append( aPX ); } else diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx index 8b68b1d5d5b3..3fc565318ddd 100644 --- a/xmloff/source/draw/sdpropls.cxx +++ b/xmloff/source/draw/sdpropls.cxx @@ -71,7 +71,7 @@ #include "XMLIsPercentagePropertyHandler.hxx" #include "XMLPercentOrMeasurePropertyHandler.hxx" #include "animations.hxx" -#include <xmloff/xmluconv.hxx> +#include <sax/tools/converter.hxx> #include "sdxmlexp_impl.hxx" @@ -744,7 +744,7 @@ sal_Bool XMLCaptionEscapeRelative::importXML( const OUString& rStrImpValue, Any& { sal_Int32 nValue; - if( !SvXMLUnitConverter::convertPercent( nValue, rStrImpValue ) ) + if (!::sax::Converter::convertPercent( nValue, rStrImpValue )) return sal_False; nValue *= 100; @@ -759,8 +759,8 @@ sal_Bool XMLCaptionEscapeRelative::exportXML( OUString& rStrExpValue, const Any& return sal_False; nValue /= 100; - OUStringBuffer aOut; - SvXMLUnitConverter::convertPercent( aOut, nValue ); + OUStringBuffer aOut; + ::sax::Converter::convertPercent( aOut, nValue ); rStrExpValue = aOut.makeStringAndClear(); return sal_True; } @@ -848,7 +848,7 @@ sal_Bool XMLSdHeaderFooterVisibilityTypeHdl::exportXML( if (rValue >>= bValue) { - SvXMLUnitConverter::convertBool( aOut, bValue ); + ::sax::Converter::convertBool( aOut, bValue ); rStrExpValue = aOut.makeStringAndClear(); bRet = sal_True; diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx index aaf4acb6f1f5..515dde639fdb 100644 --- a/xmloff/source/draw/shapeexport2.cxx +++ b/xmloff/source/draw/shapeexport2.cxx @@ -39,6 +39,9 @@ #include <com/sun/star/document/XEventsSupplier.hpp> #include <com/sun/star/drawing/HomogenMatrix3.hpp> #include <com/sun/star/media/ZoomLevel.hpp> + +#include <sax/tools/converter.hxx> + #include "anim.hxx" #include <xmloff/shapeexport.hxx> @@ -443,7 +446,7 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x if( nStartScale != -1 ) { - SvXMLUnitConverter::convertPercent( msBuffer, nStartScale ); + ::sax::Converter::convertPercent( msBuffer, nStartScale ); mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_START_SCALE, msBuffer.makeStringAndClear() ); } } @@ -900,11 +903,11 @@ void XMLShapeExport::ImpExportEllipseShape( mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_KIND, sStringBuffer.makeStringAndClear() ); // export start angle - SvXMLUnitConverter::convertDouble( sStringBuffer, dStartAngle ); + ::sax::Converter::convertDouble( sStringBuffer, dStartAngle ); mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_ANGLE, sStringBuffer.makeStringAndClear() ); // export end angle - SvXMLUnitConverter::convertDouble( sStringBuffer, dEndAngle ); + ::sax::Converter::convertDouble( sStringBuffer, dEndAngle ); mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_ANGLE, sStringBuffer.makeStringAndClear() ); } diff --git a/xmloff/source/draw/shapeexport3.cxx b/xmloff/source/draw/shapeexport3.cxx index 759509f112d8..f8f8e0194565 100644 --- a/xmloff/source/draw/shapeexport3.cxx +++ b/xmloff/source/draw/shapeexport3.cxx @@ -38,6 +38,8 @@ #include <com/sun/star/drawing/DoubleSequence.hpp> #include <tools/gen.hxx> +#include <sax/tools/converter.hxx> + #include <xmloff/shapeexport.hxx> #include "sdpropls.hxx" #include <tools/debug.hxx> @@ -394,7 +396,7 @@ void XMLShapeExport::export3DSceneAttributes( const com::sun::star::uno::Referen aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadowSlant"))); sal_Int16 nShadowSlant = 0; aAny >>= nShadowSlant; - mrExport.GetMM100UnitConverter().convertNumber(sStringBuffer, (sal_Int32)nShadowSlant); + ::sax::Converter::convertNumber(sStringBuffer, (sal_Int32)nShadowSlant); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SHADOW_SLANT, aStr); @@ -421,10 +423,9 @@ void XMLShapeExport::export3DSceneAttributes( const com::sun::star::uno::Referen // ambientColor aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneAmbientColor"))); - sal_Int32 aColTemp = 0; - Color aAmbientColor; - aAny >>= aColTemp; aAmbientColor.SetColor(aColTemp); - mrExport.GetMM100UnitConverter().convertColor(sStringBuffer, aAmbientColor); + sal_Int32 nAmbientColor = 0; + aAny >>= nAmbientColor; + ::sax::Converter::convertColor(sStringBuffer, nAmbientColor); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_AMBIENT_COLOR, aStr); @@ -432,7 +433,7 @@ void XMLShapeExport::export3DSceneAttributes( const com::sun::star::uno::Referen aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneTwoSidedLighting"))); sal_Bool bTwoSidedLighting = false; aAny >>= bTwoSidedLighting; - mrExport.GetMM100UnitConverter().convertBool(sStringBuffer, bTwoSidedLighting); + ::sax::Converter::convertBool(sStringBuffer, bTwoSidedLighting); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_LIGHTING_MODE, aStr); } @@ -450,8 +451,6 @@ void XMLShapeExport::export3DLamps( const com::sun::star::uno::Reference< com::s OUString aPropName; OUString aIndexStr; - sal_Int32 aColTemp = 0; - Color aLightColor; ::basegfx::B3DVector aLightDirection; drawing::Direction3D xLightDir; sal_Bool bLightOnOff = false; @@ -462,9 +461,9 @@ void XMLShapeExport::export3DLamps( const com::sun::star::uno::Reference< com::s // lightcolor aPropName = aColorPropName; aPropName += aIndexStr; - xPropSet->getPropertyValue( aPropName ) >>= aColTemp; - aLightColor.SetColor(aColTemp); - mrExport.GetMM100UnitConverter().convertColor(sStringBuffer, aLightColor); + sal_Int32 nLightColor = 0; + xPropSet->getPropertyValue( aPropName ) >>= nLightColor; + ::sax::Converter::convertColor(sStringBuffer, nLightColor); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DIFFUSE_COLOR, aStr); @@ -481,7 +480,7 @@ void XMLShapeExport::export3DLamps( const com::sun::star::uno::Reference< com::s aPropName = aLightOnPropName; aPropName += aIndexStr; xPropSet->getPropertyValue(aPropName) >>= bLightOnOff; - mrExport.GetMM100UnitConverter().convertBool(sStringBuffer, bLightOnOff); + ::sax::Converter::convertBool(sStringBuffer, bLightOnOff); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_ENABLED, aStr); diff --git a/xmloff/source/draw/shapeexport4.cxx b/xmloff/source/draw/shapeexport4.cxx index 13d6730a028a..767026e9953f 100644 --- a/xmloff/source/draw/shapeexport4.cxx +++ b/xmloff/source/draw/shapeexport4.cxx @@ -45,6 +45,8 @@ #include <com/sun/star/table/XColumnRowRange.hpp> +#include <sax/tools/converter.hxx> + #include <xmloff/shapeexport.hxx> #include "sdpropls.hxx" #include <tools/debug.hxx> @@ -519,7 +521,8 @@ void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< bean double fTextRotateAngle = 0; if ( rGeoProp.Value >>= fTextRotateAngle ) { - rUnitConverter.convertDouble( aStrBuffer, fTextRotateAngle ); + ::sax::Converter::convertDouble( + aStrBuffer, fTextRotateAngle ); aStr = aStrBuffer.makeStringAndClear(); rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_ROTATE_ANGLE, aStr ); } @@ -549,7 +552,12 @@ void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< bean double fExtrusionBrightness = 0; if ( rProp.Value >>= fExtrusionBrightness ) { - rUnitConverter.convertDouble( aStrBuffer, fExtrusionBrightness, sal_False, MAP_RELATIVE, MAP_RELATIVE ); + ::sax::Converter::convertDouble( + aStrBuffer, + fExtrusionBrightness, + false, + util::MeasureUnit::PERCENT, + util::MeasureUnit::PERCENT); aStrBuffer.append( (sal_Unicode)'%' ); aStr = aStrBuffer.makeStringAndClear(); rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_BRIGHTNESS, aStr ); @@ -577,7 +585,12 @@ void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< bean double fExtrusionDiffusion = 0; if ( rProp.Value >>= fExtrusionDiffusion ) { - rUnitConverter.convertDouble( aStrBuffer, fExtrusionDiffusion, sal_False, MAP_RELATIVE, MAP_RELATIVE ); + ::sax::Converter::convertDouble( + aStrBuffer, + fExtrusionDiffusion, + false, + util::MeasureUnit::PERCENT, + util::MeasureUnit::PERCENT); aStrBuffer.append( (sal_Unicode)'%' ); aStr = aStrBuffer.makeStringAndClear(); rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_DIFFUSION, aStr ); @@ -620,7 +633,12 @@ void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< bean double fExtrusionFirstLightLevel = 0; if ( rProp.Value >>= fExtrusionFirstLightLevel ) { - rUnitConverter.convertDouble( aStrBuffer, fExtrusionFirstLightLevel, sal_False, MAP_RELATIVE, MAP_RELATIVE ); + ::sax::Converter::convertDouble( + aStrBuffer, + fExtrusionFirstLightLevel, + false, + util::MeasureUnit::PERCENT, + util::MeasureUnit::PERCENT); aStrBuffer.append( (sal_Unicode)'%' ); aStr = aStrBuffer.makeStringAndClear(); rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_FIRST_LIGHT_LEVEL, aStr ); @@ -632,7 +650,12 @@ void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< bean double fExtrusionSecondLightLevel = 0; if ( rProp.Value >>= fExtrusionSecondLightLevel ) { - rUnitConverter.convertDouble( aStrBuffer, fExtrusionSecondLightLevel, sal_False, MAP_RELATIVE, MAP_RELATIVE ); + ::sax::Converter::convertDouble( + aStrBuffer, + fExtrusionSecondLightLevel, + false, + util::MeasureUnit::PERCENT, + util::MeasureUnit::PERCENT); aStrBuffer.append( (sal_Unicode)'%' ); aStr = aStrBuffer.makeStringAndClear(); rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SECOND_LIGHT_LEVEL, aStr ); @@ -726,7 +749,12 @@ void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< bean double fExtrusionShininess = 0; if ( rProp.Value >>= fExtrusionShininess ) { - rUnitConverter.convertDouble( aStrBuffer, fExtrusionShininess, sal_False, MAP_RELATIVE, MAP_RELATIVE ); + ::sax::Converter::convertDouble( + aStrBuffer, + fExtrusionShininess, + false, + util::MeasureUnit::PERCENT, + util::MeasureUnit::PERCENT); aStrBuffer.append( (sal_Unicode)'%' ); aStr = aStrBuffer.makeStringAndClear(); rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SHININESS, aStr ); @@ -750,7 +778,12 @@ void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< bean double fExtrusionSpecularity = 0; if ( rProp.Value >>= fExtrusionSpecularity ) { - rUnitConverter.convertDouble( aStrBuffer, fExtrusionSpecularity, sal_False, MAP_RELATIVE, MAP_RELATIVE ); + ::sax::Converter::convertDouble( + aStrBuffer, + fExtrusionSpecularity, + false, + util::MeasureUnit::PERCENT, + util::MeasureUnit::PERCENT); aStrBuffer.append( (sal_Unicode)'%' ); aStr = aStrBuffer.makeStringAndClear(); rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SPECULARITY, aStr ); @@ -1027,16 +1060,19 @@ void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< bean { double fValue = 0.0; rAdj.Value >>= fValue; - rUnitConverter.convertDouble( aStrBuffer, fValue ); + ::sax::Converter::convertDouble(aStrBuffer, fValue); } else { rAdj.Value >>= nValue; - rUnitConverter.convertNumber( aStrBuffer, nValue ); + ::sax::Converter::convertNumber(aStrBuffer, nValue); } } else - rUnitConverter.convertNumber( aStrBuffer, 0 ); // this should not be, but better than setting nothing + { + // this should not be, but better than setting nothing + ::sax::Converter::convertNumber( aStrBuffer, 0 ); + } } aStr = aStrBuffer.makeStringAndClear(); rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MODIFIERS, aStr ); diff --git a/xmloff/source/draw/xexptran.cxx b/xmloff/source/draw/xexptran.cxx index 75d0ff1a654a..aab16133f8c9 100644 --- a/xmloff/source/draw/xexptran.cxx +++ b/xmloff/source/draw/xexptran.cxx @@ -31,6 +31,7 @@ #include "xexptran.hxx" #include <tools/debug.hxx> #include <rtl/ustrbuf.hxx> +#include <sax/tools/converter.hxx> #include <xmloff/xmluconv.hxx> #include <tools/gen.hxx> #include <basegfx/vector/b2dvector.hxx> @@ -150,7 +151,7 @@ void Imp_SkipNumberAndSpacesAndCommas(const OUString& rStr, sal_Int32& rPos, void Imp_PutNumberChar(OUString& rStr, sal_Int32 nValue) { OUStringBuffer sStringBuffer; - SvXMLUnitConverter::convertNumber(sStringBuffer, nValue); + ::sax::Converter::convertNumber(sStringBuffer, nValue); rStr += OUString(sStringBuffer.makeStringAndClear()); } @@ -243,7 +244,10 @@ double Imp_GetDoubleChar(const OUString& rStr, sal_Int32& rPos, const sal_Int32 if(bLookForUnits) rConv.convertDouble(fRetval, sNumberString.makeStringAndClear(), true); else - rConv.convertDouble(fRetval, sNumberString.makeStringAndClear()); + { + ::sax::Converter::convertDouble(fRetval, + sNumberString.makeStringAndClear()); + } } return fRetval; @@ -257,7 +261,9 @@ void Imp_PutDoubleChar(OUString& rStr, const SvXMLUnitConverter& rConv, double f if(bConvertUnits) rConv.convertDouble(sStringBuffer, fValue, true); else - rConv.convertDouble(sStringBuffer, fValue); + { + ::sax::Converter::convertDouble(sStringBuffer, fValue); + } rStr += OUString(sStringBuffer.makeStringAndClear()); } diff --git a/xmloff/source/draw/ximp3dscene.cxx b/xmloff/source/draw/ximp3dscene.cxx index e82c5635c784..b71ae0d9394b 100644 --- a/xmloff/source/draw/ximp3dscene.cxx +++ b/xmloff/source/draw/ximp3dscene.cxx @@ -28,6 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" + +#include <sax/tools/converter.hxx> + #include "ximp3dscene.hxx" #include <xmloff/xmluconv.hxx> #include "xexptran.hxx" @@ -72,7 +75,7 @@ SdXML3DLightContext::SdXML3DLightContext( { case XML_TOK_3DLIGHT_DIFFUSE_COLOR: { - GetImport().GetMM100UnitConverter().convertColor(maDiffuseColor, sValue); + ::sax::Converter::convertColor(maDiffuseColor, sValue); break; } case XML_TOK_3DLIGHT_DIRECTION: @@ -82,12 +85,12 @@ SdXML3DLightContext::SdXML3DLightContext( } case XML_TOK_3DLIGHT_ENABLED: { - GetImport().GetMM100UnitConverter().convertBool(mbEnabled, sValue); + ::sax::Converter::convertBool(mbEnabled, sValue); break; } case XML_TOK_3DLIGHT_SPECULAR: { - GetImport().GetMM100UnitConverter().convertBool(mbSpecular, sValue); + ::sax::Converter::convertBool(mbSpecular, sValue); break; } } @@ -333,7 +336,7 @@ void SdXML3DSceneAttributesHelper::processSceneAttribute( sal_uInt16 nPrefix, co } else if( IsXMLToken( rLocalName, XML_SHADOW_SLANT ) ) { - mrImport.GetMM100UnitConverter().convertNumber(mnShadowSlant, rValue); + ::sax::Converter::convertNumber(mnShadowSlant, rValue); return; } else if( IsXMLToken( rLocalName, XML_SHADE_MODE ) ) @@ -350,12 +353,12 @@ void SdXML3DSceneAttributesHelper::processSceneAttribute( sal_uInt16 nPrefix, co } else if( IsXMLToken( rLocalName, XML_AMBIENT_COLOR ) ) { - mrImport.GetMM100UnitConverter().convertColor(maAmbientColor, rValue); + ::sax::Converter::convertColor(maAmbientColor, rValue); return; } else if( IsXMLToken( rLocalName, XML_LIGHTING_MODE ) ) { - mrImport.GetMM100UnitConverter().convertBool(mbLightingMode, rValue); + ::sax::Converter::convertBool(mbLightingMode, rValue); return; } } @@ -390,7 +393,7 @@ void SdXML3DSceneAttributesHelper::setSceneAttributes( const com::sun::star::uno xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadeMode")), aAny); // ambientColor - aAny <<= maAmbientColor.GetColor(); + aAny <<= maAmbientColor; xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneAmbientColor")), aAny); // lightingMode @@ -408,7 +411,7 @@ void SdXML3DSceneAttributesHelper::setSceneAttributes( const com::sun::star::uno SdXML3DLightContext* pCtx = (SdXML3DLightContext*)maList[ a ]; // set anys - aAny <<= pCtx->GetDiffuseColor().GetColor(); + aAny <<= pCtx->GetDiffuseColor(); drawing::Direction3D xLightDir; xLightDir.DirectionX = pCtx->GetDirection().getX(); xLightDir.DirectionY = pCtx->GetDirection().getY(); diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx index f7b135ef561b..0308eafdaa8f 100644 --- a/xmloff/source/draw/ximpcustomshape.cxx +++ b/xmloff/source/draw/ximpcustomshape.cxx @@ -30,7 +30,6 @@ #include "precompiled_xmloff.hxx" #include "ximpcustomshape.hxx" #include "ximpshap.hxx" -#include "xmlehelp.hxx" #include <rtl/math.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/ustring.hxx> @@ -58,6 +57,7 @@ #include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp> #include <com/sun/star/drawing/ProjectionMode.hpp> #include <boost/unordered_map.hpp> +#include <sax/tools/converter.hxx> using namespace ::com::sun::star; using namespace ::xmloff::token; @@ -88,7 +88,7 @@ void GetBool( std::vector< com::sun::star::beans::PropertyValue >& rDest, const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) { bool bAttrBool; - if ( SvXMLUnitConverter::convertBool( bAttrBool, rValue ) ) + if (::sax::Converter::convertBool( bAttrBool, rValue )) { beans::PropertyValue aProp; aProp.Name = EASGet( eDestProp ); @@ -101,7 +101,7 @@ void GetInt32( std::vector< com::sun::star::beans::PropertyValue >& rDest, const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) { sal_Int32 nAttrNumber; - if ( SvXMLUnitConverter::convertNumber( nAttrNumber, rValue ) ) + if (::sax::Converter::convertNumber( nAttrNumber, rValue )) { beans::PropertyValue aProp; aProp.Name = EASGet( eDestProp ); @@ -114,7 +114,7 @@ void GetDouble( std::vector< com::sun::star::beans::PropertyValue >& rDest, const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) { double fAttrDouble; - if ( SvXMLUnitConverter::convertDouble( fAttrDouble, rValue ) ) + if (::sax::Converter::convertDouble( fAttrDouble, rValue )) { beans::PropertyValue aProp; aProp.Name = EASGet( eDestProp ); @@ -127,8 +127,10 @@ void GetDistance( std::vector< com::sun::star::beans::PropertyValue >& rDest, const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) { double fAttrDouble; - MapUnit eSrcUnit( SvXMLExportHelper::GetUnitFromString( rValue, MAP_100TH_MM ) ); - if ( SvXMLUnitConverter::convertDouble( fAttrDouble, rValue, eSrcUnit, MAP_100TH_MM ) ) + sal_Int16 const eSrcUnit( ::sax::Converter::GetUnitFromString( + rValue, util::MeasureUnit::MM_100TH) ); + if (::sax::Converter::convertDouble(fAttrDouble, rValue, eSrcUnit, + util::MeasureUnit::MM_100TH)) { beans::PropertyValue aProp; aProp.Name = EASGet( eDestProp ); @@ -164,8 +166,9 @@ void GetEnum( std::vector< com::sun::star::beans::PropertyValue >& rDest, void GetDoublePercentage( std::vector< com::sun::star::beans::PropertyValue >& rDest, const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) { - MapUnit eSrcUnit = SvXMLExportHelper::GetUnitFromString( rValue, MAP_100TH_MM ); - if ( eSrcUnit == MAP_RELATIVE ) + sal_Int16 const eSrcUnit = ::sax::Converter::GetUnitFromString( + rValue, util::MeasureUnit::MM_100TH); + if (util::MeasureUnit::PERCENT == eSrcUnit) { rtl_math_ConversionStatus eStatus; double fAttrDouble = ::rtl::math::stringToDouble( rValue, @@ -410,7 +413,7 @@ sal_Bool GetNextParameter( com::sun::star::drawing::EnhancedCustomShapeParameter if ( bE || bDot ) { double fAttrDouble; - if ( SvXMLUnitConverter::convertDouble( fAttrDouble, aNumber ) ) + if (::sax::Converter::convertDouble(fAttrDouble, aNumber)) rParameter.Value <<= fAttrDouble; else bValid = sal_False; @@ -418,7 +421,7 @@ sal_Bool GetNextParameter( com::sun::star::drawing::EnhancedCustomShapeParameter else { sal_Int32 nValue; - if ( SvXMLUnitConverter::convertNumber( nValue, aNumber ) ) + if (::sax::Converter::convertNumber(nValue, aNumber)) rParameter.Value <<= nValue; else bValid = sal_False; @@ -457,7 +460,7 @@ void GetDoubleSequence( std::vector< com::sun::star::beans::PropertyValue >& rDe { double fAttrDouble; rtl::OUString aToken( rValue.getToken( 0, ',', nIndex ) ); - if ( !SvXMLUnitConverter::convertDouble( fAttrDouble, aToken ) ) + if (!::sax::Converter::convertDouble( fAttrDouble, aToken )) break; else vDirection.push_back( fAttrDouble ); @@ -889,10 +892,13 @@ void XMLEnhancedCustomShapeContext::StartElement( const uno::Reference< xml::sax if ( GetNextParameter( rDepth, nIndex, rValue ) ) { // try to catch the unit for the depth - MapUnit eSrcUnit( SvXMLExportHelper::GetUnitFromString( rValue, MAP_100TH_MM ) ); + sal_Int16 const eSrcUnit( + ::sax::Converter::GetUnitFromString( + rValue, util::MeasureUnit::MM_100TH)); rtl::OUStringBuffer aUnitStr; - double fFactor = SvXMLExportHelper::GetConversionFactor( aUnitStr, MAP_100TH_MM, eSrcUnit ); + double fFactor = ::sax::Converter::GetConversionFactor( + aUnitStr, util::MeasureUnit::MM_100TH, eSrcUnit); if ( ( fFactor != 1.0 ) && ( fFactor != 0.0 ) ) { double fDepth(0.0); @@ -1006,7 +1012,7 @@ void XMLEnhancedCustomShapeContext::StartElement( const uno::Reference< xml::sax break; case EAS_path_stretchpoint_x : { - if ( SvXMLUnitConverter::convertNumber( nAttrNumber, rValue ) ) + if (::sax::Converter::convertNumber(nAttrNumber, rValue)) { beans::PropertyValue aProp; aProp.Name = EASGet( EAS_StretchX ); @@ -1017,7 +1023,7 @@ void XMLEnhancedCustomShapeContext::StartElement( const uno::Reference< xml::sax break; case EAS_path_stretchpoint_y : { - if ( SvXMLUnitConverter::convertNumber( nAttrNumber, rValue ) ) + if (::sax::Converter::convertNumber(nAttrNumber, rValue)) { beans::PropertyValue aProp; aProp.Name = EASGet( EAS_StretchY ); diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 15fba1a45f64..5a8b16d4ab49 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -69,6 +69,9 @@ #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/drawing/ConnectorType.hpp> #include <com/sun/star/drawing/HomogenMatrix3.hpp> + +#include <sax/tools/converter.hxx> + #include "PropertySetMerger.hxx" #include <xmloff/families.hxx> #include "ximpstyl.hxx" @@ -1199,14 +1202,14 @@ void SdXMLEllipseShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl if( IsXMLToken( rLocalName, XML_START_ANGLE ) ) { double dStartAngle; - if( SvXMLUnitConverter::convertDouble( dStartAngle, rValue ) ) + if (::sax::Converter::convertDouble( dStartAngle, rValue )) mnStartAngle = (sal_Int32)(dStartAngle * 100.0); return; } if( IsXMLToken( rLocalName, XML_END_ANGLE ) ) { double dEndAngle; - if( SvXMLUnitConverter::convertDouble( dEndAngle, rValue ) ) + if (::sax::Converter::convertDouble( dEndAngle, rValue )) mnEndAngle = (sal_Int32)(dEndAngle * 100.0); return; } |