diff options
author | Michael Stahl <mst@openoffice.org> | 2011-10-11 14:19:09 +0200 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2011-10-11 17:57:01 +0200 |
commit | 8666469d7b0f450ec1448f80eda3c591f8d8d318 (patch) | |
tree | ae63c5f07df7d3c2d45ea03e47f147661f280923 /xmloff | |
parent | #i108468#: clean up xmluconv code duplication, DateTime edition: (diff) | |
download | core-8666469d7b0f450ec1448f80eda3c591f8d8d318.tar.gz core-8666469d7b0f450ec1448f80eda3c591f8d8d318.zip |
#i108468#: clean up xmluconv code duplication, measured approach:
modify sax::Converter::convertMeasure to use sal_Int64 instead of BigInt:
should be sufficient, since the largest number is SAL_INT32_MAX * 10^7.
remove duplicate methods from SvXMLUnitConverter:
convertMeasurePx, convertMeasure (static variants)
remove entirely duplicative class SvXMLExportHelper:
GetConversionFactor, GetUnitFromString, AddLength
change SvXMLUnitConverter interface from MapUnit to css::util::MeasureUnit.
change SvXMLExport constructor params from MapUnit to css::util::MeasureUnit.
rename some methods to turn compiler into merge conflict detector :)
Diffstat (limited to 'xmloff')
60 files changed, 524 insertions, 1180 deletions
diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk index 333c486274c9..02723f37fed9 100644 --- a/xmloff/Library_xo.mk +++ b/xmloff/Library_xo.mk @@ -115,7 +115,6 @@ $(eval $(call gb_Library_add_exception_objects,xo,\ xmloff/source/core/unoatrcn \ xmloff/source/core/unointerfacetouniqueidentifiermapper \ xmloff/source/core/xmlcnimp \ - xmloff/source/core/xmlehelp \ xmloff/source/core/xmlerror \ xmloff/source/core/xmlexp \ xmloff/source/core/xmlictxt \ diff --git a/xmloff/inc/xmlehelp.hxx b/xmloff/inc/xmlehelp.hxx deleted file mode 100644 index 10595408092b..000000000000 --- a/xmloff/inc/xmlehelp.hxx +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _XMLOFF_XMLEHELP_HXX -#define _XMLOFF_XMLEHELP_HXX - -#include <tools/mapunit.hxx> - -namespace rtl { class OUStringBuffer; } - -class SvXMLExportHelper -{ -public: - static void AddLength( sal_Int32 nValue, MapUnit eValueUnit, - ::rtl::OUStringBuffer& rOut, - MapUnit eOutUnit ); - static void AddPercentage( sal_Int32 nVal, ::rtl::OUStringBuffer& rOut ); - static double GetConversionFactor(::rtl::OUStringBuffer& rUnit, - const MapUnit eCoreUnit, const MapUnit eDestUnit); - static MapUnit GetUnitFromString(const ::rtl::OUString& rString, - MapUnit eDefaultUnit); -}; - - - -#endif // _XMLOFF_XMLEHELP_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/xmloff/VisAreaContext.hxx b/xmloff/inc/xmloff/VisAreaContext.hxx index 62f9d4bb2728..0f9e7bd1a956 100644 --- a/xmloff/inc/xmloff/VisAreaContext.hxx +++ b/xmloff/inc/xmloff/VisAreaContext.hxx @@ -30,7 +30,6 @@ #define _XMLOFF_VISAREACONTEXT_HXX #include <xmloff/xmlictxt.hxx> -#include <tools/mapunit.hxx> class Rectangle; @@ -45,7 +44,8 @@ public: XMLVisAreaContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList, - Rectangle& rRect, const MapUnit aMapUnit); + Rectangle& rRect, + const sal_Int16 eMeasureUnit); virtual ~XMLVisAreaContext(); diff --git a/xmloff/inc/xmloff/xmlexp.hxx b/xmloff/inc/xmloff/xmlexp.hxx index b5199f2c2720..2ac801b06b60 100644 --- a/xmloff/inc/xmloff/xmlexp.hxx +++ b/xmloff/inc/xmloff/xmlexp.hxx @@ -43,7 +43,6 @@ #include <com/sun/star/util/XNumberFormatsSupplier.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <rtl/ustring.hxx> -#include <tools/mapunit.hxx> #include <xmloff/txtparae.hxx> #include <xmloff/formlayerexport.hxx> #include <xmloff/xmlnumfe.hxx> @@ -279,8 +278,8 @@ public: // const enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID, // sal_uInt16 nExportFlag = EXPORT_ALL ); SvXMLExport( + sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, - MapUnit eDfltUnit, const enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID, sal_uInt16 nExportFlag = EXPORT_ALL ); @@ -292,8 +291,8 @@ public: SvXMLExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, const ::rtl::OUString& rFileName, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, - MapUnit eDfltUnit = MAP_INCH ); + sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler); // #110680# //SvXMLExport( const ::rtl::OUString& rFileName, @@ -307,7 +306,7 @@ public: const ::rtl::OUString& rFileName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &, - sal_Int16 eDfltUnit ); + sal_Int16 const eDefaultFieldUnit ); // #110680# //SvXMLExport( const ::rtl::OUString& rFileName, @@ -324,7 +323,7 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &, const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver > &, - sal_Int16 eDfltUnit ); + sal_Int16 const eDefaultFieldUnit ); virtual ~SvXMLExport(); diff --git a/xmloff/inc/xmloff/xmluconv.hxx b/xmloff/inc/xmloff/xmluconv.hxx index c605f7bdc354..9fc53641c0fd 100644 --- a/xmloff/inc/xmloff/xmluconv.hxx +++ b/xmloff/inc/xmloff/xmluconv.hxx @@ -35,7 +35,6 @@ #include <limits.h> #include <tools/solar.h> -#include <tools/mapunit.hxx> #include <xmloff/xmlement.hxx> #include <xmloff/xmltoken.hxx> #include <com/sun/star/util/Date.hpp> @@ -93,8 +92,8 @@ public: class XMLOFF_DLLPUBLIC SvXMLUnitConverter { private: - MapUnit meCoreMeasureUnit; - MapUnit meXMLMeasureUnit; + sal_Int16 meCoreMeasureUnit; + sal_Int16 meXMLMeasureUnit; com::sun::star::util::Date aNullDate; ::com::sun::star::uno::Reference< ::com::sun::star::text::XNumberingTypeInfo > xNumTypeInfo; @@ -109,28 +108,27 @@ public: /** constructs a SvXMLUnitConverter. The core measure unit is the default unit for numerical measures, the XML measure unit is the default unit for textual measures */ - // #110680# - // SvXMLUnitConverter( MapUnit eCoreMeasureUnit, MapUnit eXMLMeasureUnit ); SvXMLUnitConverter( - MapUnit eCoreMeasureUnit, - MapUnit eXMLMeasureUnit, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory ); + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + sal_Int16 eCoreMeasureUnit, + sal_Int16 eXMLMeasureUnit); virtual ~SvXMLUnitConverter(); - static MapUnit GetMapUnit(sal_Int16 nFieldUnit); + static sal_Int16 GetMeasureUnit(sal_Int16 const nFieldUnit); /** sets the default unit for numerical measures */ - inline void setCoreMeasureUnit( MapUnit eCoreMeasureUnit ); + inline void SetCoreMeasureUnit( sal_Int16 const eCoreMeasureUnit ); /** gets the default unit for numerical measures */ - inline MapUnit getCoreMeasureUnit() const; + inline sal_Int16 GetCoreMeasureUnit() const; /** sets the default unit for textual measures */ - void setXMLMeasureUnit( MapUnit eXMLMeasureUnit ); + void SetXMLMeasureUnit( sal_Int16 const eXMLMeasureUnit ); /** gets the default unit for textual measures */ - MapUnit getXMLMeasureUnit() const; + sal_Int16 GetXMLMeasureUnit() const; /** gets XNumberingTypeInfo */ const ::com::sun::star::uno::Reference< @@ -141,42 +139,22 @@ public: return xNumTypeInfo; } - /** convert string to measure using optional min and max values*/ - sal_Bool convertMeasure( sal_Int32& rValue, + /** convert string to measure with meCoreMeasureUnit, + using optional min and max values*/ + bool convertMeasureToCore( sal_Int32& rValue, const ::rtl::OUString& rString, sal_Int32 nMin = SAL_MIN_INT32, sal_Int32 nMax = SAL_MAX_INT32) const; - /** convert measure to string */ - void convertMeasure( ::rtl::OUStringBuffer& rBuffer, + /** convert measure to string: from meCoreMeasureUnit to meXMLMeasureUnit */ + void convertMeasureToXML( ::rtl::OUStringBuffer& rBuffer, sal_Int32 nMeasure ) const; - /** convert measure with given unit to string */ - void convertMeasure( ::rtl::OUStringBuffer&, + /** convert measure with given unit to string with meXMLMeasureUnit */ + void convertMeasureToXML( ::rtl::OUStringBuffer&, sal_Int32 nMeasure, - MapUnit eSrcUnit ) const; - - /** convert string to measure in given unit - using optional min and max values */ - static sal_Bool convertMeasure( sal_Int32& rVal, - const ::rtl::OUString& rString, - MapUnit eDstUnit, - sal_Int32 nMin = SAL_MIN_INT32, - sal_Int32 nMax = SAL_MAX_INT32); - - /** convert measure in given unit to string with given unit */ - static void convertMeasure( ::rtl::OUStringBuffer& rBuffer, - sal_Int32 nMeasure, - MapUnit eSrcUnit, - MapUnit eDstUnit ); - - /** convert string to pixel measure unite */ - static sal_Bool convertMeasurePx( sal_Int32& rValue, - const ::rtl::OUString& rString ); + sal_Int16 eSrcUnit ) const; - /** convert pixel measure unit to string */ - static void convertMeasurePx( ::rtl::OUStringBuffer& rBuffer, - sal_Int32 nValue ); /** convert string to enum using given enum map, if the enum is not found in the map, this method will return false */ @@ -286,22 +264,24 @@ public: }; -inline void SvXMLUnitConverter::setCoreMeasureUnit( MapUnit eCoreMeasureUnit ) +inline void +SvXMLUnitConverter::SetCoreMeasureUnit( sal_Int16 const eCoreMeasureUnit ) { meCoreMeasureUnit = eCoreMeasureUnit; } -inline MapUnit SvXMLUnitConverter::getCoreMeasureUnit() const +inline sal_Int16 SvXMLUnitConverter::GetCoreMeasureUnit() const { return meCoreMeasureUnit; } -inline void SvXMLUnitConverter::setXMLMeasureUnit( MapUnit eXMLMeasureUnit ) +inline void +SvXMLUnitConverter::SetXMLMeasureUnit( sal_Int16 const eXMLMeasureUnit ) { meXMLMeasureUnit = eXMLMeasureUnit; } -inline MapUnit SvXMLUnitConverter::getXMLMeasureUnit() const +inline sal_Int16 SvXMLUnitConverter::GetXMLMeasureUnit() const { return meXMLMeasureUnit; } diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx index 7666cc800e48..a045f126b894 100644 --- a/xmloff/source/chart/PropertyMaps.cxx +++ b/xmloff/source/chart/PropertyMaps.cxx @@ -438,7 +438,7 @@ void XMLChartExportPropertyMapper::handleSpecialItem( { awt::Size aSize; rProperty.maValue >>= aSize; - rUnitConverter.convertMeasure( sValueBuffer, + rUnitConverter.convertMeasureToXML( sValueBuffer, nContextId == XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH ? aSize.Width : aSize.Height ); @@ -585,7 +585,8 @@ bool XMLChartImportPropertyMapper::handleSpecialItem( { awt::Size aSize; rProperty.maValue >>= aSize; - rUnitConverter.convertMeasure( nContextId == XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH + rUnitConverter.convertMeasureToCore( + (nContextId == XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH) ? aSize.Width : aSize.Height, rValue ); diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index 96d04db568a4..2aeb6e97ef45 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -319,11 +319,13 @@ void SchXMLChartContext::StartElement( const uno::Reference< xml::sax::XAttribut break; case XML_TOK_CHART_WIDTH: - GetImport().GetMM100UnitConverter().convertMeasure( maChartSize.Width, aValue ); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maChartSize.Width, aValue ); break; case XML_TOK_CHART_HEIGHT: - GetImport().GetMM100UnitConverter().convertMeasure( maChartSize.Height, aValue ); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maChartSize.Height, aValue ); break; case XML_TOK_CHART_STYLE_NAME: @@ -1183,12 +1185,14 @@ void SchXMLTitleContext::StartElement( const uno::Reference< xml::sax::XAttribut { if( IsXMLToken( aLocalName, XML_X ) ) { - GetImport().GetMM100UnitConverter().convertMeasure( maPosition.X, aValue ); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maPosition.X, aValue ); bHasXPosition = true; } else if( IsXMLToken( aLocalName, XML_Y ) ) { - GetImport().GetMM100UnitConverter().convertMeasure( maPosition.Y, aValue ); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maPosition.Y, aValue ); bHasYPosition = true; } } diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 089772832f08..8e4556c6a5c6 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -104,6 +104,7 @@ #include <com/sun/star/chart2/data/XTextualDataSequence.hpp> #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> #include <com/sun/star/util/XStringMapping.hpp> #include <com/sun/star/drawing/HomogenMatrix.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> @@ -122,6 +123,7 @@ using namespace ::xmloff::token; using ::rtl::OUString; using ::rtl::OUStringBuffer; using ::rtl::OUStringToOString; +using namespace ::com::sun::star; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; @@ -3557,11 +3559,13 @@ void SchXMLExportHelper_Impl::getCellAddress( sal_Int32 nCol, sal_Int32 nRow ) void SchXMLExportHelper_Impl::addPosition( const awt::Point & rPosition ) { - mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rPosition.X ); + mrExport.GetMM100UnitConverter().convertMeasureToXML( + msStringBuffer, rPosition.X ); msString = msStringBuffer.makeStringAndClear(); mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X, msString ); - mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rPosition.Y ); + mrExport.GetMM100UnitConverter().convertMeasureToXML( + msStringBuffer, rPosition.Y ); msString = msStringBuffer.makeStringAndClear(); mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y, msString ); } @@ -3574,12 +3578,14 @@ void SchXMLExportHelper_Impl::addPosition( Reference< drawing::XShape > xShape ) void SchXMLExportHelper_Impl::addSize( const awt::Size & rSize, bool bIsOOoNamespace) { - mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rSize.Width ); + mrExport.GetMM100UnitConverter().convertMeasureToXML( + msStringBuffer, rSize.Width ); msString = msStringBuffer.makeStringAndClear(); mrExport.AddAttribute( bIsOOoNamespace ? XML_NAMESPACE_CHART_EXT : XML_NAMESPACE_SVG , XML_WIDTH, msString ); - mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rSize.Height); + mrExport.GetMM100UnitConverter().convertMeasureToXML( + msStringBuffer, rSize.Height); msString = msStringBuffer.makeStringAndClear(); mrExport.AddAttribute( bIsOOoNamespace ? XML_NAMESPACE_CHART_EXT : XML_NAMESPACE_SVG, XML_HEIGHT, msString ); } @@ -3631,7 +3637,8 @@ void SchXMLExportHelper_Impl::exportText( const OUString& rText, bool bConvertTa SchXMLExport::SchXMLExport( const Reference< lang::XMultiServiceFactory >& xServiceFactory, sal_uInt16 nExportFlags ) -: SvXMLExport( xServiceFactory, MAP_CM, ::xmloff::token::XML_CHART, nExportFlags ), +: SvXMLExport( util::MeasureUnit::CM, xServiceFactory, + ::xmloff::token::XML_CHART, nExportFlags ), maAutoStylePool( *this ), maExportHelper( *this, maAutoStylePool ) { diff --git a/xmloff/source/chart/SchXMLLegendContext.cxx b/xmloff/source/chart/SchXMLLegendContext.cxx index 8df4ead8ba1e..c48d3dfecf8f 100644 --- a/xmloff/source/chart/SchXMLLegendContext.cxx +++ b/xmloff/source/chart/SchXMLLegendContext.cxx @@ -171,11 +171,13 @@ void SchXMLLegendContext::StartElement( const uno::Reference< xml::sax::XAttribu break; case XML_TOK_LEGEND_X: - GetImport().GetMM100UnitConverter().convertMeasure( aLegendPos.X, aValue ); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + aLegendPos.X, aValue ); bHasXPosition = true; break; case XML_TOK_LEGEND_Y: - GetImport().GetMM100UnitConverter().convertMeasure( aLegendPos.Y, aValue ); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + aLegendPos.Y, aValue ); bHasYPosition = true; break; case XML_TOK_LEGEND_STYLE_NAME: @@ -189,12 +191,14 @@ void SchXMLLegendContext::StartElement( const uno::Reference< xml::sax::XAttribu break; case XML_TOK_LEGEND_WIDTH: case XML_TOK_LEGEND_WIDTH_EXT: - GetImport().GetMM100UnitConverter().convertMeasure( aLegendSize.Width, aValue ); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + aLegendSize.Width, aValue ); bHasWidth = true; break; case XML_TOK_LEGEND_HEIGHT: case XML_TOK_LEGEND_HEIGHT_EXT: - GetImport().GetMM100UnitConverter().convertMeasure( aLegendSize.Height, aValue ); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + aLegendSize.Height, aValue ); bHasHeight = true; break; default: diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index ceeaa69f3982..22d3168509c2 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -776,22 +776,26 @@ bool SchXMLPositonAttributesHelper::readPositioningAttribute( sal_uInt16 nPrefix { if( IsXMLToken( rLocalName, XML_X ) ) { - m_rImport.GetMM100UnitConverter().convertMeasure( m_aPosition.X, rValue ); + m_rImport.GetMM100UnitConverter().convertMeasureToCore( + m_aPosition.X, rValue ); m_bHasPositionX = true; } else if( IsXMLToken( rLocalName, XML_Y ) ) { - m_rImport.GetMM100UnitConverter().convertMeasure( m_aPosition.Y, rValue ); + m_rImport.GetMM100UnitConverter().convertMeasureToCore( + m_aPosition.Y, rValue ); m_bHasPositionY = true; } else if( IsXMLToken( rLocalName, XML_WIDTH ) ) { - m_rImport.GetMM100UnitConverter().convertMeasure( m_aSize.Width, rValue ); + m_rImport.GetMM100UnitConverter().convertMeasureToCore( + m_aSize.Width, rValue ); m_bHasSizeWidth = true; } else if( IsXMLToken( rLocalName, XML_HEIGHT ) ) { - m_rImport.GetMM100UnitConverter().convertMeasure( m_aSize.Height, rValue ); + m_rImport.GetMM100UnitConverter().convertMeasureToCore( + m_aSize.Height, rValue ); m_bHasSizeHeight = true; } else @@ -1116,11 +1120,13 @@ void SchXMLEquationContext::StartElement( const uno::Reference< xml::sax::XAttri switch( rAttrTokenMap.Get( nPrefix, aLocalName )) { case XML_TOK_REGEQ_POS_X: - rImport.GetMM100UnitConverter().convertMeasure( aPosition.X, aValue ); + rImport.GetMM100UnitConverter().convertMeasureToCore( + aPosition.X, aValue ); bHasXPos = true; break; case XML_TOK_REGEQ_POS_Y: - rImport.GetMM100UnitConverter().convertMeasure( aPosition.Y, aValue ); + rImport.GetMM100UnitConverter().convertMeasureToCore( + aPosition.Y, aValue ); bHasYPos = true; break; case XML_TOK_REGEQ_DISPLAY_EQUATION: diff --git a/xmloff/source/core/xmlehelp.cxx b/xmloff/source/core/xmlehelp.cxx deleted file mode 100644 index fe38c798921b..000000000000 --- a/xmloff/source/core/xmlehelp.cxx +++ /dev/null @@ -1,501 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_xmloff.hxx" -#include <limits.h> -#include <tools/debug.hxx> -#include <tools/bigint.hxx> -#include <rtl/ustrbuf.hxx> -#include "xmlehelp.hxx" - -#include <xmloff/xmltoken.hxx> - -using ::rtl::OUString; -using ::rtl::OUStringBuffer; - -using namespace ::xmloff::token; - -void SvXMLExportHelper::AddLength( sal_Int32 nValue, MapUnit eValueUnit, - OUStringBuffer& rOut, - MapUnit eOutUnit ) -{ - // the sign is processed seperatly - if( nValue < 0 ) - { - nValue = -nValue; - rOut.append( sal_Unicode('-') ); - } - - // The new length is (nVal * nMul)/(nDiv*nFac*10) - sal_Int32 nMul = 1000; - sal_Int32 nDiv = 1; - sal_Int32 nFac = 100; - enum XMLTokenEnum eUnit = XML_TOKEN_INVALID; - switch( eValueUnit ) - { - case MAP_TWIP: - switch( eOutUnit ) - { - case MAP_100TH_MM: - case MAP_10TH_MM: - DBG_ASSERT( MAP_INCH == eOutUnit, - "output unit not supported for twip values" ); - case MAP_MM: - // 0.01mm = 0.57twip (exactly) - nMul = 25400; // 25.4 * 1000 - nDiv = 1440; // 72 * 20; - nFac = 100; - eUnit = XML_UNIT_MM; - break; - - case MAP_CM: - // 0.001cm = 0.57twip (exactly) - nMul = 25400; // 2.54 * 10000 - nDiv = 1440; // 72 * 20; - nFac = 1000; - eUnit = XML_UNIT_CM; - break; - - case MAP_POINT: - // 0.01pt = 0.2twip (exactly) - nMul = 1000; - nDiv = 20; - nFac = 100; - eUnit = XML_UNIT_PT; - break; - - case MAP_INCH: - default: - DBG_ASSERT( MAP_INCH == eOutUnit, - "output unit not supported for twip values" ); - // 0.0001in = 0.144twip (exactly) - nMul = 100000; - nDiv = 1440; // 72 * 20; - nFac = 10000; - eUnit = XML_UNIT_INCH; - break; - } - break; - - case MAP_POINT: - // 1pt = 1pt (exactly) - DBG_ASSERT( MAP_POINT == eOutUnit, - "output unit not supported for pt values" ); - nMul = 10; - nDiv = 1; - nFac = 1; - eUnit = XML_UNIT_PT; - break; - case MAP_10TH_MM: - case MAP_100TH_MM: - { - long nFac2 = (MAP_100TH_MM == eValueUnit) ? 100 : 10; - switch( eOutUnit ) - { - case MAP_100TH_MM: - case MAP_10TH_MM: - DBG_ASSERT( MAP_INCH == eOutUnit, - "output unit not supported for 1/100mm values" ); - case MAP_MM: - // 0.01mm = 1 mm/100 (exactly) - nMul = 10; - nDiv = 1; - nFac = nFac2; - eUnit = XML_UNIT_MM; - break; - - case MAP_CM: - // 0.001mm = 1 mm/100 (exactly) - nMul = 10; - nDiv = 1; // 72 * 20; - nFac = 10*nFac2; - eUnit = XML_UNIT_CM; - break; - - case MAP_POINT: - // 0.01pt = 0.35 mm/100 (exactly) - nMul = 72000; - nDiv = 2540; - nFac = nFac2; - eUnit = XML_UNIT_PT; - break; - - case MAP_INCH: - default: - DBG_ASSERT( MAP_INCH == eOutUnit, - "output unit not supported for 1/100mm values" ); - // 0.0001in = 0.254 mm/100 (exactly) - nMul = 100000; - nDiv = 2540; - nFac = 100*nFac2; - eUnit = XML_UNIT_INCH; - break; - } - break; - } - default: - DBG_ASSERT( 0, "input unit not handled" ); - break; - } - - - sal_Int32 nLongVal = 0; - sal_Bool bOutLongVal = sal_True; - if( nValue > SAL_MAX_INT32 / nMul ) - { - // A big int is required for calculation - BigInt nBigVal( nValue ); - nBigVal *= nMul; - nBigVal /= nDiv; - nBigVal += 5; - nBigVal /= 10; - - if( nBigVal.IsLong() ) - { - // To convert the value into a string a sal_Int32 is sufficient - nLongVal = sal_Int32( nBigVal ); - } - else - { - BigInt nBigFac( nFac ); - BigInt nBig10( 10 ); - rOut.append( (sal_Int32)(nBigVal / nBigFac) ); - if( !(nBigVal % nBigFac).IsZero() ) - { - rOut.append( sal_Unicode('.') ); - while( nFac > 1 && !(nBigVal % nBigFac).IsZero() ) - { - nFac /= 10; - nBigFac = nFac; - rOut.append( (sal_Int32)((nBigVal / nBigFac) % nBig10 ) ); - } - } - bOutLongVal = sal_False; - } - } - else - { - nLongVal = nValue * nMul; - nLongVal /= nDiv; - nLongVal += 5; - nLongVal /= 10; - } - - if( bOutLongVal ) - { - rOut.append( (sal_Int32)(nLongVal / nFac) ); - if( nFac > 1 && (nLongVal % nFac) != 0 ) - { - rOut.append( sal_Unicode('.') ); - while( nFac > 1 && (nLongVal % nFac) != 0 ) - { - nFac /= 10; - rOut.append( (sal_Int32)((nLongVal / nFac) % 10) ); - } - } - } - - if( eUnit != XML_TOKEN_INVALID ) - rOut.append( GetXMLToken(eUnit) ); -} - -void SvXMLExportHelper::AddPercentage( sal_Int32 nValue, OUStringBuffer& rOut ) -{ - rOut.append( nValue ); - rOut.append( sal_Unicode('%' ) ); -} - -double SvXMLExportHelper::GetConversionFactor(::rtl::OUStringBuffer& rUnit, - const MapUnit eCoreUnit, const MapUnit eDestUnit) -{ - double fRetval(1.0); - rUnit.setLength(0L); - - if(eCoreUnit != eDestUnit) - { - enum XMLTokenEnum eUnit = XML_TOKEN_INVALID; - - switch(eCoreUnit) - { - case MAP_TWIP: - { - switch(eDestUnit) - { - case MAP_100TH_MM: - case MAP_10TH_MM: - { - DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for twip values"); - } - case MAP_MM: - { - // 0.01mm = 0.57twip (exactly) - fRetval = ((25400.0 / 1440.0) / 1000.0); - eUnit = XML_UNIT_MM; - break; - } - case MAP_CM: - { - // 0.001cm = 0.57twip (exactly) - fRetval = ((25400.0 / 1440.0) / 10000.0); - eUnit = XML_UNIT_CM; - break; - } - case MAP_POINT: - { - // 0.01pt = 0.2twip (exactly) - fRetval = ((1000.0 / 20.0) / 1000.0); - eUnit = XML_UNIT_PT; - break; - } - case MAP_INCH: - default: - { - DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for twip values"); - // 0.0001in = 0.144twip (exactly) - fRetval = ((100000.0 / 1440.0) / 100000.0); - eUnit = XML_UNIT_INCH; - break; - } - } - break; - } - case MAP_POINT: - { - switch(eDestUnit) - { - case MAP_MM: - // 1mm = 72 / 25.4 pt (exactly) - fRetval = ( 25.4 / 72.0 ); - eUnit = XML_UNIT_MM; - break; - - case MAP_CM: - // 1cm = 72 / 2.54 pt (exactly) - fRetval = ( 2.54 / 72.0 ); - eUnit = XML_UNIT_CM; - break; - - case MAP_TWIP: - // 1twip = 72 / 1440 pt (exactly) - fRetval = 20.0; // 1440.0 / 72.0 - eUnit = XML_UNIT_PC; - break; - - case MAP_INCH: - default: - DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for pt values"); - // 1in = 72 pt (exactly) - fRetval = ( 1.0 / 72.0 ); - eUnit = XML_UNIT_INCH; - break; - } - break; - } - case MAP_10TH_MM: - { - switch(eDestUnit) - { - case MAP_100TH_MM: - case MAP_10TH_MM: - { - DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for 1/100mm values"); - } - case MAP_MM: - { - // 0.01mm = 1 mm/100 (exactly) - fRetval = ((10.0 / 1.0) / 100.0); - eUnit = XML_UNIT_MM; - break; - } - case MAP_CM: - { - // 0.001mm = 1 mm/100 (exactly) - fRetval = ((10.0 / 1.0) / 1000.0); - eUnit = XML_UNIT_CM; - break; - } - case MAP_POINT: - { - // 0.01pt = 0.35 mm/100 (exactly) - fRetval = ((72000.0 / 2540.0) / 100.0); - eUnit = XML_UNIT_PT; - break; - } - case MAP_INCH: - default: - { - DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for 1/100mm values"); - // 0.0001in = 0.254 mm/100 (exactly) - fRetval = ((100000.0 / 2540.0) / 10000.0); - eUnit = XML_UNIT_INCH; - break; - } - } - break; - } - case MAP_100TH_MM: - { - switch(eDestUnit) - { - case MAP_100TH_MM: - case MAP_10TH_MM: - { - DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for 1/100mm values"); - } - case MAP_MM: - { - // 0.01mm = 1 mm/100 (exactly) - fRetval = ((10.0 / 1.0) / 1000.0); - eUnit = XML_UNIT_MM; - break; - } - case MAP_CM: - { - // 0.001mm = 1 mm/100 (exactly) - fRetval = ((10.0 / 1.0) / 10000.0); - eUnit = XML_UNIT_CM; - break; - } - case MAP_POINT: - { - // 0.01pt = 0.35 mm/100 (exactly) - fRetval = ((72000.0 / 2540.0) / 1000.0); - eUnit = XML_UNIT_PT; - break; - } - case MAP_INCH: - default: - { - DBG_ASSERT(MAP_INCH == eDestUnit, "output unit not supported for 1/100mm values"); - // 0.0001in = 0.254 mm/100 (exactly) - fRetval = ((100000.0 / 2540.0) / 100000.0); - eUnit = XML_UNIT_INCH; - break; - } - } - break; - } - default: - OSL_FAIL("xmloff::SvXMLExportHelper::GetConversionFactor(), illegal eCoreUnit value!"); - break; - } - - if(eUnit != XML_TOKEN_INVALID) - rUnit.append(GetXMLToken(eUnit)); - } - - return fRetval; -} - -MapUnit SvXMLExportHelper::GetUnitFromString(const ::rtl::OUString& rString, MapUnit eDefaultUnit) -{ - sal_Int32 nPos = 0; - sal_Int32 nLen = rString.getLength(); - MapUnit eRetUnit = eDefaultUnit; - - // skip white space - while( nPos < nLen && sal_Unicode(' ') == rString[nPos] ) - nPos++; - - // skip negative - if( nPos < nLen && sal_Unicode('-') == rString[nPos] ) - nPos++; - - // skip number - while( nPos < nLen && sal_Unicode('0') <= rString[nPos] && sal_Unicode('9') >= rString[nPos] ) - nPos++; - - if( nPos < nLen && sal_Unicode('.') == rString[nPos] ) - { - nPos++; - while( nPos < nLen && sal_Unicode('0') <= rString[nPos] && sal_Unicode('9') >= rString[nPos] ) - nPos++; - } - - // skip white space - while( nPos < nLen && sal_Unicode(' ') == rString[nPos] ) - nPos++; - - if( nPos < nLen ) - { - switch(rString[nPos]) - { - case sal_Unicode('%') : - { - eRetUnit = MAP_RELATIVE; - break; - } - case sal_Unicode('c'): - case sal_Unicode('C'): - { - if(nPos+1 < nLen && (rString[nPos+1] == sal_Unicode('m') - || rString[nPos+1] == sal_Unicode('M'))) - eRetUnit = MAP_CM; - break; - } - case sal_Unicode('e'): - case sal_Unicode('E'): - { - // CSS1_EMS or CSS1_EMX later - break; - } - case sal_Unicode('i'): - case sal_Unicode('I'): - { - if(nPos+1 < nLen && (rString[nPos+1] == sal_Unicode('n') - || rString[nPos+1] == sal_Unicode('n'))) - eRetUnit = MAP_INCH; - break; - } - case sal_Unicode('m'): - case sal_Unicode('M'): - { - if(nPos+1 < nLen && (rString[nPos+1] == sal_Unicode('m') - || rString[nPos+1] == sal_Unicode('M'))) - eRetUnit = MAP_MM; - break; - } - case sal_Unicode('p'): - case sal_Unicode('P'): - { - if(nPos+1 < nLen && (rString[nPos+1] == sal_Unicode('t') - || rString[nPos+1] == sal_Unicode('T'))) - eRetUnit = MAP_POINT; - if(nPos+1 < nLen && (rString[nPos+1] == sal_Unicode('c') - || rString[nPos+1] == sal_Unicode('C'))) - eRetUnit = MAP_TWIP; - break; - } - } - } - - return eRetUnit; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index f244a5c65991..faf5d3963288 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/xml/sax/SAXInvalidCharacterException.hpp> #include <com/sun/star/uri/XUriReferenceFactory.hpp> #include <com/sun/star/uri/UriReferenceFactory.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/configurationhelper.hxx> #include <xmloff/attrlist.hxx> @@ -462,13 +463,15 @@ void SvXMLExport::_DetermineModelType() } SvXMLExport::SvXMLExport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, - MapUnit eDfltUnit, const enum XMLTokenEnum eClass, sal_uInt16 nExportFlags ) + sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/, + const uno::Reference< lang::XMultiServiceFactory >& xServiceFactory, + const enum XMLTokenEnum eClass, sal_uInt16 nExportFlags ) : mpImpl( new SvXMLExport_Impl ), mxServiceFactory(xServiceFactory), mpAttrList( new SvXMLAttributeList ), mpNamespaceMap( new SvXMLNamespaceMap ), - mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, eDfltUnit, getServiceFactory() ) ), + mpUnitConv( new SvXMLUnitConverter(getServiceFactory(), + util::MeasureUnit::MM_100TH, eDefaultMeasureUnit) ), mpNumExport(0L), mpProgressBarHelper( NULL ), mpEventExport( NULL ), @@ -488,8 +491,8 @@ SvXMLExport::SvXMLExport( SvXMLExport::SvXMLExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, const OUString &rFileName, - const uno::Reference< xml::sax::XDocumentHandler > & rHandler, - MapUnit eDfltUnit ) + sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/, + const uno::Reference< xml::sax::XDocumentHandler > & rHandler) : mpImpl( new SvXMLExport_Impl ), mxServiceFactory(xServiceFactory), mxHandler( rHandler ), @@ -497,7 +500,8 @@ SvXMLExport::SvXMLExport( mpAttrList( new SvXMLAttributeList ), msOrigFileName( rFileName ), mpNamespaceMap( new SvXMLNamespaceMap ), - mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, eDfltUnit, getServiceFactory() ) ), + mpUnitConv( new SvXMLUnitConverter(getServiceFactory(), + util::MeasureUnit::MM_100TH, eDefaultMeasureUnit) ), mpNumExport(0L), mpProgressBarHelper( NULL ), mpEventExport( NULL ), @@ -523,7 +527,7 @@ SvXMLExport::SvXMLExport( const OUString &rFileName, const uno::Reference< xml::sax::XDocumentHandler > & rHandler, const Reference< XModel >& rModel, - sal_Int16 eDfltUnit ) + sal_Int16 const eDefaultFieldUnit) : mpImpl( new SvXMLExport_Impl ), mxServiceFactory(xServiceFactory), mxModel( rModel ), @@ -533,7 +537,9 @@ SvXMLExport::SvXMLExport( mpAttrList( new SvXMLAttributeList ), msOrigFileName( rFileName ), mpNamespaceMap( new SvXMLNamespaceMap ), - mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, SvXMLUnitConverter::GetMapUnit(eDfltUnit), getServiceFactory() ) ), + mpUnitConv( new SvXMLUnitConverter(getServiceFactory(), + util::MeasureUnit::MM_100TH, + SvXMLUnitConverter::GetMeasureUnit(eDefaultFieldUnit)) ), mpNumExport(0L), mpProgressBarHelper( NULL ), mpEventExport( NULL ), @@ -560,7 +566,7 @@ SvXMLExport::SvXMLExport( const uno::Reference< xml::sax::XDocumentHandler > & rHandler, const Reference< XModel >& rModel, const Reference< document::XGraphicObjectResolver >& rEmbeddedGraphicObjects, - sal_Int16 eDfltUnit ) + sal_Int16 const eDefaultFieldUnit) : mpImpl( new SvXMLExport_Impl ), mxServiceFactory(xServiceFactory), mxModel( rModel ), @@ -571,7 +577,9 @@ SvXMLExport::SvXMLExport( mpAttrList( new SvXMLAttributeList ), msOrigFileName( rFileName ), mpNamespaceMap( new SvXMLNamespaceMap ), - mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, SvXMLUnitConverter::GetMapUnit(eDfltUnit), getServiceFactory() ) ), + mpUnitConv( new SvXMLUnitConverter(getServiceFactory(), + util::MeasureUnit::MM_100TH, + SvXMLUnitConverter::GetMeasureUnit(eDefaultFieldUnit)) ), mpNumExport(0L), mpProgressBarHelper( NULL ), mpEventExport( NULL ), diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index cb431db22eee..1fe7a1e6db55 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -53,6 +53,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/ServiceNotRegisteredException.hpp> #include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> #include <com/sun/star/document/XBinaryStreamResolver.hpp> #include <com/sun/star/document/XStorageBasedDocument.hpp> #include <com/sun/star/xml/sax/XLocator.hpp> @@ -352,8 +353,8 @@ SvXMLImport::SvXMLImport( : mpImpl( new SvXMLImport_Impl() ), mpNamespaceMap( new SvXMLNamespaceMap ), - // #110680# - mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, MAP_100TH_MM, xServiceFactory ) ), + mpUnitConv( new SvXMLUnitConverter( xServiceFactory, + util::MeasureUnit::MM_100TH, util::MeasureUnit::MM_100TH) ), mpContexts( new SvXMLImportContexts_Impl ), mpNumImport( NULL ), @@ -381,8 +382,8 @@ SvXMLImport::SvXMLImport( mxNumberFormatsSupplier (rModel, uno::UNO_QUERY), mpImpl( new SvXMLImport_Impl() ), mpNamespaceMap( new SvXMLNamespaceMap ), - // #110680# - mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, MAP_100TH_MM, xServiceFactory ) ), + mpUnitConv( new SvXMLUnitConverter(xServiceFactory, + util::MeasureUnit::MM_100TH, util::MeasureUnit::MM_100TH) ), mpContexts( new SvXMLImportContexts_Impl ), mpNumImport( NULL ), mpProgressBarHelper( NULL ), @@ -411,8 +412,8 @@ SvXMLImport::SvXMLImport( mxGraphicResolver( rGraphicObjects ), mpImpl( new SvXMLImport_Impl() ), mpNamespaceMap( new SvXMLNamespaceMap ), - // #110680# - mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, MAP_100TH_MM, xServiceFactory ) ), + mpUnitConv( new SvXMLUnitConverter(xServiceFactory, + util::MeasureUnit::MM_100TH, util::MeasureUnit::MM_100TH) ), mpContexts( new SvXMLImportContexts_Impl ), mpNumImport( NULL ), mpProgressBarHelper( NULL ), diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx index 1963fc80875f..23a61a4c3ac6 100644 --- a/xmloff/source/core/xmluconv.cxx +++ b/xmloff/source/core/xmluconv.cxx @@ -33,21 +33,14 @@ #include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/util/Date.hpp> -#include <com/sun/star/util/Time.hpp> #include <tools/debug.hxx> #include <rtl/ustrbuf.hxx> -#include "xmlehelp.hxx" #include <xmloff/xmlement.hxx> #include <xmloff/xmltoken.hxx> #include <rtl/math.hxx> #include <rtl/logfile.hxx> -#ifndef _TOOLS_DATE_HXX #include <tools/date.hxx> -#include <tools/string.hxx> -#endif - -#include <tools/time.hxx> #include <tools/fldunit.hxx> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> @@ -93,9 +86,10 @@ void SvXMLUnitConverter::createNumTypeInfo() const */ SvXMLUnitConverter::SvXMLUnitConverter( - MapUnit eCoreMeasureUnit, - MapUnit eXMLMeasureUnit, - const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory ) : + const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory, + sal_Int16 const eCoreMeasureUnit, + sal_Int16 const eXMLMeasureUnit) +: aNullDate(30, 12, 1899), mxServiceFactory( xServiceFactory ) { @@ -109,313 +103,62 @@ SvXMLUnitConverter::~SvXMLUnitConverter() { } -MapUnit SvXMLUnitConverter::GetMapUnit(sal_Int16 nFieldUnit) +sal_Int16 SvXMLUnitConverter::GetMeasureUnit(sal_Int16 const nFieldUnit) { - MapUnit eUnit = MAP_INCH; + sal_Int16 eUnit = util::MeasureUnit::INCH; switch( nFieldUnit ) { case FUNIT_MM: - eUnit = MAP_MM; + eUnit = util::MeasureUnit::MM; break; case FUNIT_CM: case FUNIT_M: case FUNIT_KM: - eUnit = MAP_CM; + eUnit = util::MeasureUnit::CM; break; case FUNIT_TWIP: - eUnit = MAP_TWIP; + eUnit = util::MeasureUnit::TWIP; break; case FUNIT_POINT: case FUNIT_PICA: - eUnit = MAP_POINT; + eUnit = util::MeasureUnit::POINT; break; case FUNIT_100TH_MM: - eUnit = MAP_100TH_MM; + eUnit = util::MeasureUnit::MM_100TH; break; } return eUnit; } /** convert string to measure using optional min and max values*/ -sal_Bool SvXMLUnitConverter::convertMeasure( sal_Int32& nValue, +bool SvXMLUnitConverter::convertMeasureToCore( sal_Int32& nValue, const OUString& rString, sal_Int32 nMin, sal_Int32 nMax ) const { - return SvXMLUnitConverter::convertMeasure( nValue, rString, + return ::sax::Converter::convertMeasure( nValue, rString, meCoreMeasureUnit, nMin, nMax ); } /** convert measure to string */ -void SvXMLUnitConverter::convertMeasure( OUStringBuffer& rString, +void SvXMLUnitConverter::convertMeasureToXML( OUStringBuffer& rString, sal_Int32 nMeasure ) const { - SvXMLUnitConverter::convertMeasure( rString, nMeasure, + ::sax::Converter::convertMeasure( rString, nMeasure, meCoreMeasureUnit, meXMLMeasureUnit ); } /** convert measure with given unit to string */ -void SvXMLUnitConverter::convertMeasure( OUStringBuffer& rString, +void SvXMLUnitConverter::convertMeasureToXML( OUStringBuffer& rString, sal_Int32 nMeasure, - MapUnit eSrcUnit ) const + sal_Int16 eSrcUnit ) const { - SvXMLUnitConverter::convertMeasure( rString, nMeasure, + ::sax::Converter::convertMeasure( rString, nMeasure, eSrcUnit, meXMLMeasureUnit ); } -/** convert the value from the given string to an int value - with the given map unit using optional min and max values -*/ -sal_Bool SvXMLUnitConverter::convertMeasure( sal_Int32& rValue, - const OUString& rString, - MapUnit eDstUnit, - sal_Int32 nMin, sal_Int32 nMax ) -{ - sal_Bool bNeg = sal_False; - double nVal = 0; - - sal_Int32 nPos = 0; - const sal_Int32 nLen = rString.getLength(); - - // skip white space - while( (nPos < nLen) && (rString[nPos] <= sal_Unicode(' ')) ) - nPos++; - - if( nPos < nLen && sal_Unicode('-') == rString[nPos] ) - { - bNeg = sal_True; - ++nPos; - } - - // get number - while( nPos < nLen && - sal_Unicode('0') <= rString[nPos] && - sal_Unicode('9') >= rString[nPos] ) - { - // TODO: check overflow! - nVal *= 10; - nVal += (rString[nPos] - sal_Unicode('0')); - ++nPos; - } - double nDiv = 1.; - if( nPos < nLen && sal_Unicode('.') == rString[nPos] ) - { - ++nPos; - - while( nPos < nLen && - sal_Unicode('0') <= rString[nPos] && - sal_Unicode('9') >= rString[nPos] ) - { - // TODO: check overflow! - nDiv *= 10; - nVal += ( ((double)(rString[nPos] - sal_Unicode('0'))) / nDiv ); - ++nPos; - } - } - - // skip white space - while( (nPos < nLen) && (rString[nPos] <= sal_Unicode(' ')) ) - ++nPos; - - if( nPos < nLen ) - { - - if( MAP_RELATIVE == eDstUnit ) - { - if( sal_Unicode('%') != rString[nPos] ) - return sal_False; - } - else if( MAP_PIXEL == eDstUnit ) - { - if( nPos + 1 >= nLen || - (sal_Unicode('p') != rString[nPos] && - sal_Unicode('P') != rString[nPos])|| - (sal_Unicode('x') != rString[nPos+1] && - sal_Unicode('X') != rString[nPos+1]) ) - return sal_False; - } - else - { - DBG_ASSERT( MAP_TWIP == eDstUnit || MAP_POINT == eDstUnit || - MAP_100TH_MM == eDstUnit || MAP_10TH_MM == eDstUnit, "unit is not supported"); - const sal_Char *aCmpsL[2] = { 0, 0 }; - const sal_Char *aCmpsU[2] = { 0, 0 }; - double aScales[2] = { 1., 1. }; - - if( MAP_TWIP == eDstUnit ) - { - switch( rString[nPos] ) - { - case sal_Unicode('c'): - case sal_Unicode('C'): - aCmpsL[0] = "cm"; - aCmpsU[0] = "CM"; - aScales[0] = (72.*20.)/2.54; // twip - break; - case sal_Unicode('e'): - case sal_Unicode('E'): - break; - case sal_Unicode('i'): - case sal_Unicode('I'): - aCmpsL[0] = "in"; - aCmpsU[0] = "IN"; - aScales[0] = 72.*20.; // twip - break; - case sal_Unicode('m'): - case sal_Unicode('M'): - aCmpsL[0] = "mm"; - aCmpsU[0] = "MM"; - aScales[0] = (72.*20.)/25.4; // twip - break; - case sal_Unicode('p'): - case sal_Unicode('P'): - aCmpsL[0] = "pt"; - aCmpsU[0] = "PT"; - aScales[0] = 20.; // twip - - aCmpsL[1] = "pc"; - aCmpsU[1] = "PC"; - aScales[1] = 12.*20.; // twip - break; - } - } - else if( MAP_100TH_MM == eDstUnit || MAP_10TH_MM == eDstUnit ) - { - double nScaleFactor = (MAP_100TH_MM == eDstUnit) ? 100.0 : 10.0; - switch( rString[nPos] ) - { - case sal_Unicode('c'): - case sal_Unicode('C'): - aCmpsL[0] = "cm"; - aCmpsU[0] = "CM"; - aScales[0] = 10.0 * nScaleFactor; // mm/100 - break; - case sal_Unicode('e'): - case sal_Unicode('E'): - break; - case sal_Unicode('i'): - case sal_Unicode('I'): - aCmpsL[0] = "in"; - aCmpsU[0] = "IN"; - aScales[0] = 1000.*2.54; // mm/100 - break; - case sal_Unicode('m'): - case sal_Unicode('M'): - aCmpsL[0] = "mm"; - aCmpsU[0] = "MM"; - aScales[0] = 1.0 * nScaleFactor; // mm/100 - break; - case sal_Unicode('p'): - case sal_Unicode('P'): - aCmpsL[0] = "pt"; - aCmpsU[0] = "PT"; - aScales[0] = (10.0 * nScaleFactor*2.54)/72.; // mm/100 - - aCmpsL[1] = "pc"; - aCmpsU[1] = "PC"; - aScales[1] = (10.0 * nScaleFactor*2.54)/12.; // mm/100 - break; - } - } - else if( MAP_POINT == eDstUnit ) - { - if( rString[nPos] == 'p' || rString[nPos] == 'P' ) - { - aCmpsL[0] = "pt"; - aCmpsU[0] = "PT"; - aScales[0] = 1; - } - } - - if( aCmpsL[0] == NULL ) - return sal_False; - - double nScale = 0.; - for( sal_uInt16 i= 0; i < 2; ++i ) - { - const sal_Char *pL = aCmpsL[i]; - if( pL ) - { - const sal_Char *pU = aCmpsU[i]; - while( nPos < nLen && *pL ) - { - sal_Unicode c = rString[nPos]; - if( c != *pL && c != *pU ) - break; - ++pL; - ++pU; - ++nPos; - } - if( !*pL && (nPos == nLen || ' ' == rString[nPos]) ) - { - nScale = aScales[i]; - break; - } - } - } - - if( 0. == nScale ) - return sal_False; - - // TODO: check overflow - if( nScale != 1. ) - nVal *= nScale; - } - } - - nVal += .5; - if( bNeg ) - nVal = -nVal; - - if( nVal <= (double)nMin ) - rValue = nMin; - else if( nVal >= (double)nMax ) - rValue = nMax; - else - rValue = (sal_Int32)nVal; - - return sal_True; -} - -/** convert measure in given unit to string with given unit */ -void SvXMLUnitConverter::convertMeasure( OUStringBuffer& rBuffer, - sal_Int32 nMeasure, - MapUnit eSrcUnit, - MapUnit eDstUnit ) -{ - if( eSrcUnit == MAP_RELATIVE ) - { - DBG_ASSERT( eDstUnit == MAP_RELATIVE, - "MAP_RELATIVE only maps to MAP_RELATIVE!" ); - - rBuffer.append( nMeasure ); - rBuffer.append( sal_Unicode('%' ) ); - } - else - { - SvXMLExportHelper::AddLength( nMeasure, eSrcUnit, - rBuffer, eDstUnit ); - } -} - -/** convert string to pixel measure */ -sal_Bool SvXMLUnitConverter::convertMeasurePx( sal_Int32& rPixel, - const OUString& rString ) -{ - return convertMeasure( rPixel, rString, MAP_PIXEL ); -} - -/** convert pixel measure to string */ -void SvXMLUnitConverter::convertMeasurePx( OUStringBuffer& rBuffer, - sal_Int32 nValue ) -{ - rBuffer.append( nValue ); - rBuffer.append( sal_Unicode('p' ) ); - rBuffer.append( sal_Unicode('x' ) ); -} - /** convert string to enum using given enum map, if the enum is not found in the map, this method will return false */ @@ -537,7 +280,6 @@ static sal_Char aHexTab[] = "0123456789abcdef"; void SvXMLUnitConverter::convertDouble(OUStringBuffer& rBuffer, double fNumber, sal_Bool bWriteUnits) const { - //FIXME TODO need to convert MapUnit to MeasureUnit here ::sax::Converter::convertDouble(rBuffer, fNumber, bWriteUnits, meCoreMeasureUnit, meXMLMeasureUnit); } @@ -548,9 +290,9 @@ sal_Bool SvXMLUnitConverter::convertDouble(double& rValue, { if(bLookForUnits) { - MapUnit eSrcUnit = SvXMLExportHelper::GetUnitFromString(rString, meCoreMeasureUnit); + sal_Int16 const eSrcUnit = + ::sax::Converter::GetUnitFromString(rString, meCoreMeasureUnit); - //FIXME TODO need to convert MapUnit to MeasureUnit here return ::sax::Converter::convertDouble(rValue, rString, eSrcUnit, meCoreMeasureUnit); } diff --git a/xmloff/source/draw/XMLImageMapContext.cxx b/xmloff/source/draw/XMLImageMapContext.cxx index d92bb7cab331..711bf1dd1921 100644 --- a/xmloff/source/draw/XMLImageMapContext.cxx +++ b/xmloff/source/draw/XMLImageMapContext.cxx @@ -385,7 +385,7 @@ void XMLImageMapRectangleContext::ProcessAttribute( switch (eToken) { case XML_TOK_IMAP_X: - if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp, + if (GetImport().GetMM100UnitConverter().convertMeasureToCore(nTmp, rValue)) { aRectangle.X = nTmp; @@ -393,7 +393,7 @@ void XMLImageMapRectangleContext::ProcessAttribute( } break; case XML_TOK_IMAP_Y: - if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp, + if (GetImport().GetMM100UnitConverter().convertMeasureToCore(nTmp, rValue)) { aRectangle.Y = nTmp; @@ -401,7 +401,7 @@ void XMLImageMapRectangleContext::ProcessAttribute( } break; case XML_TOK_IMAP_WIDTH: - if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp, + if (GetImport().GetMM100UnitConverter().convertMeasureToCore(nTmp, rValue)) { aRectangle.Width = nTmp; @@ -409,7 +409,7 @@ void XMLImageMapRectangleContext::ProcessAttribute( } break; case XML_TOK_IMAP_HEIGTH: - if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp, + if (GetImport().GetMM100UnitConverter().convertMeasureToCore(nTmp, rValue)) { aRectangle.Height = nTmp; @@ -593,7 +593,7 @@ void XMLImageMapCircleContext::ProcessAttribute( switch (eToken) { case XML_TOK_IMAP_CENTER_X: - if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp, + if (GetImport().GetMM100UnitConverter().convertMeasureToCore(nTmp, rValue)) { aCenter.X = nTmp; @@ -601,7 +601,7 @@ void XMLImageMapCircleContext::ProcessAttribute( } break; case XML_TOK_IMAP_CENTER_Y: - if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp, + if (GetImport().GetMM100UnitConverter().convertMeasureToCore(nTmp, rValue)) { aCenter.Y = nTmp; @@ -609,7 +609,7 @@ void XMLImageMapCircleContext::ProcessAttribute( } break; case XML_TOK_IMAP_RADIUS: - if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp, + if (GetImport().GetMM100UnitConverter().convertMeasureToCore(nTmp, rValue)) { nRadius = nTmp; diff --git a/xmloff/source/draw/XMLImageMapExport.cxx b/xmloff/source/draw/XMLImageMapExport.cxx index 40ae2660d066..961bd4970c84 100644 --- a/xmloff/source/draw/XMLImageMapExport.cxx +++ b/xmloff/source/draw/XMLImageMapExport.cxx @@ -285,16 +285,18 @@ void XMLImageMapExport::ExportRectangle( // parameters svg:x, svg:y, svg:width, svg:height OUStringBuffer aBuffer; - mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aRectangle.X); + mrExport.GetMM100UnitConverter().convertMeasureToXML(aBuffer, aRectangle.X); mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X, aBuffer.makeStringAndClear() ); - mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aRectangle.Y); + mrExport.GetMM100UnitConverter().convertMeasureToXML(aBuffer, aRectangle.Y); mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y, aBuffer.makeStringAndClear() ); - mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aRectangle.Width); + mrExport.GetMM100UnitConverter().convertMeasureToXML(aBuffer, + aRectangle.Width); mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH, aBuffer.makeStringAndClear() ); - mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aRectangle.Height); + mrExport.GetMM100UnitConverter().convertMeasureToXML(aBuffer, + aRectangle.Height); mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT, aBuffer.makeStringAndClear() ); } @@ -309,10 +311,10 @@ void XMLImageMapExport::ExportCircle( // parameters svg:cx, svg:cy OUStringBuffer aBuffer; - mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aCenter.X); + mrExport.GetMM100UnitConverter().convertMeasureToXML(aBuffer, aCenter.X); mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_CX, aBuffer.makeStringAndClear() ); - mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aCenter.Y); + mrExport.GetMM100UnitConverter().convertMeasureToXML(aBuffer, aCenter.Y); mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_CY, aBuffer.makeStringAndClear() ); @@ -320,7 +322,7 @@ void XMLImageMapExport::ExportCircle( aAny = rPropertySet->getPropertyValue(msRadius); sal_Int32 nRadius = 0; aAny >>= nRadius; - mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, nRadius); + mrExport.GetMM100UnitConverter().convertMeasureToXML(aBuffer, nRadius); mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_R, aBuffer.makeStringAndClear() ); } @@ -358,16 +360,16 @@ void XMLImageMapExport::ExportPolygon( // parameters svg:x, svg:y, svg:width, svg:height OUStringBuffer aBuffer; - mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0); + mrExport.GetMM100UnitConverter().convertMeasureToXML(aBuffer, 0); mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X, aBuffer.makeStringAndClear() ); - mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0); + mrExport.GetMM100UnitConverter().convertMeasureToXML(aBuffer, 0); mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y, aBuffer.makeStringAndClear() ); - mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, nWidth); + mrExport.GetMM100UnitConverter().convertMeasureToXML(aBuffer, nWidth); mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH, aBuffer.makeStringAndClear() ); - mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, nHeight); + mrExport.GetMM100UnitConverter().convertMeasureToXML(aBuffer, nHeight); mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT, aBuffer.makeStringAndClear() ); diff --git a/xmloff/source/draw/propimp0.cxx b/xmloff/source/draw/propimp0.cxx index 10db980509b8..c50438b69e91 100644 --- a/xmloff/source/draw/propimp0.cxx +++ b/xmloff/source/draw/propimp0.cxx @@ -205,7 +205,7 @@ sal_Bool XMLTextAnimationStepPropertyHdl::importXML( } else { - if( rUnitConverter.convertMeasure( nValue, rStrImpValue ) ) + if (rUnitConverter.convertMeasureToCore( nValue, rStrImpValue )) { rValue <<= sal_Int16( nValue ); bRet = sal_True; @@ -235,7 +235,7 @@ sal_Bool XMLTextAnimationStepPropertyHdl::exportXML( } else { - rUnitConverter.convertMeasure( aOut, nVal ); + rUnitConverter.convertMeasureToXML( aOut, nVal ); } rStrExpValue = aOut.makeStringAndClear(); diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 9b0dfae988c7..e31ffb807786 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -59,6 +59,7 @@ #include <com/sun/star/animations/XAnimationNodeSupplier.hpp> #include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/util/Duration.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> #include <rtl/ustrbuf.hxx> #include <tools/gen.hxx> #include <tools/debug.hxx> @@ -409,7 +410,8 @@ ImpXMLAutoLayoutInfo::ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterI SdXMLExport::SdXMLExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, sal_Bool bIsDraw, sal_uInt16 nExportFlags ) -: SvXMLExport( xServiceFactory, MAP_CM, bIsDraw ? XML_GRAPHICS : XML_PRESENTATION, nExportFlags ), +: SvXMLExport( util::MeasureUnit::CM, xServiceFactory, + (bIsDraw) ? XML_GRAPHICS : XML_PRESENTATION, nExportFlags ), mnDocMasterPageCount(0L), mnDocDrawPageCount(0L), mnShapeStyleInfoIndex(0L), @@ -1263,19 +1265,21 @@ void SdXMLExport::ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const Rectan AddAttribute(XML_NAMESPACE_PRESENTATION, XML_OBJECT, aStr); // svg:x,y,width,height - GetMM100UnitConverter().convertMeasure(sStringBuffer, rRect.Left()); + GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, rRect.Left()); aStr = sStringBuffer.makeStringAndClear(); AddAttribute(XML_NAMESPACE_SVG, XML_X, aStr); - GetMM100UnitConverter().convertMeasure(sStringBuffer, rRect.Top()); + GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, rRect.Top()); aStr = sStringBuffer.makeStringAndClear(); AddAttribute(XML_NAMESPACE_SVG, XML_Y, aStr); - GetMM100UnitConverter().convertMeasure(sStringBuffer, rRect.GetWidth()); + GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + rRect.GetWidth()); aStr = sStringBuffer.makeStringAndClear(); AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr); - GetMM100UnitConverter().convertMeasure(sStringBuffer, rRect.GetHeight()); + GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + rRect.GetHeight()); aStr = sStringBuffer.makeStringAndClear(); AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStr); @@ -1385,27 +1389,33 @@ void SdXMLExport::ImpWritePageMasterInfos() SvXMLElementExport aPME(*this, XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT, sal_True, sal_True); // prepare style:properties inside page-master - GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetBorderTop()); + GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + pInfo->GetBorderTop()); sString = sStringBuffer.makeStringAndClear(); AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_TOP, sString); - GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetBorderBottom()); + GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + pInfo->GetBorderBottom()); sString = sStringBuffer.makeStringAndClear(); AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, sString); - GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetBorderLeft()); + GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + pInfo->GetBorderLeft()); sString = sStringBuffer.makeStringAndClear(); AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_LEFT, sString); - GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetBorderRight()); + GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + pInfo->GetBorderRight()); sString = sStringBuffer.makeStringAndClear(); AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_RIGHT, sString); - GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetWidth()); + GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + pInfo->GetWidth()); sString = sStringBuffer.makeStringAndClear(); AddAttribute(XML_NAMESPACE_FO, XML_PAGE_WIDTH, sString); - GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetHeight()); + GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + pInfo->GetHeight()); sString = sStringBuffer.makeStringAndClear(); AddAttribute(XML_NAMESPACE_FO, XML_PAGE_HEIGHT, sString); @@ -2742,19 +2752,23 @@ void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage ) RealPoint2D aPosition( xAnnotation->getPosition() ); - GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aPosition.X * 100 ) ); + GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + static_cast<sal_Int32>( aPosition.X * 100 ) ); AddAttribute(XML_NAMESPACE_SVG, XML_X, sStringBuffer.makeStringAndClear()); - GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aPosition.Y * 100 ) ); + GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + static_cast<sal_Int32>( aPosition.Y * 100 ) ); AddAttribute(XML_NAMESPACE_SVG, XML_Y, sStringBuffer.makeStringAndClear()); RealSize2D aSize( xAnnotation->getSize() ); if( aSize.Width || aSize.Height ) { - GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aSize.Width * 100 ) ); + GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + static_cast<sal_Int32>( aSize.Width * 100 ) ); AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, sStringBuffer.makeStringAndClear()); - GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aSize.Height * 100 ) ); + GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + static_cast<sal_Int32>( aSize.Height * 100 ) ); AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, sStringBuffer.makeStringAndClear()); } diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index c6d07c291011..238013ba5575 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -1208,10 +1208,12 @@ void XMLShapeExport::ImpExportGluePoints( const uno::Reference< drawing::XShape const OUString sId( OUString::valueOf( nIdentifier ) ); mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_ID, sId ); - mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aGluePoint.Position.X); + mrExport.GetMM100UnitConverter().convertMeasureToXML(msBuffer, + aGluePoint.Position.X); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X, msBuffer.makeStringAndClear()); - mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aGluePoint.Position.Y); + mrExport.GetMM100UnitConverter().convertMeasureToXML(msBuffer, + aGluePoint.Position.Y); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y, msBuffer.makeStringAndClear()); if( !aGluePoint.IsRelative ) diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx index 515dde639fdb..9f6620d719fc 100644 --- a/xmloff/source/draw/shapeexport2.cxx +++ b/xmloff/source/draw/shapeexport2.cxx @@ -162,7 +162,8 @@ void XMLShapeExport::ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple& rTR aTRScale.setX(aTRScale.getX() + 1.0); } - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(aTRScale.getX())); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + FRound(aTRScale.getX())); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr); @@ -179,7 +180,8 @@ void XMLShapeExport::ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple& rTR aTRScale.setY(aTRScale.getY() + 1.0); } - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(aTRScale.getY())); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + FRound(aTRScale.getY())); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStr); @@ -213,7 +215,8 @@ void XMLShapeExport::ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple& rTR if(nFeatures & SEF_EXPORT_X) { // svg: x - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(rTRTranslate.getX())); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + FRound(rTRTranslate.getX())); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X, aStr); } @@ -221,7 +224,8 @@ void XMLShapeExport::ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple& rTR if(nFeatures & SEF_EXPORT_Y) { // svg: y - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(rTRTranslate.getY())); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + FRound(rTRTranslate.getY())); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y, aStr); } @@ -707,7 +711,8 @@ void XMLShapeExport::ImpExportTextBoxShape( if(nCornerRadius) { OUStringBuffer sStringBuffer; - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nCornerRadius); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + nCornerRadius); mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear()); } @@ -742,7 +747,8 @@ void XMLShapeExport::ImpExportRectangleShape( if(nCornerRadius) { OUStringBuffer sStringBuffer; - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nCornerRadius); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + nCornerRadius); mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear()); } @@ -825,7 +831,8 @@ void XMLShapeExport::ImpExportLineShape( if( nFeatures & SEF_EXPORT_X ) { // svg: x1 - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + aStart.X); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr); } @@ -837,7 +844,8 @@ void XMLShapeExport::ImpExportLineShape( if( nFeatures & SEF_EXPORT_Y ) { // svg: y1 - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + aStart.Y); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr); } @@ -847,12 +855,14 @@ void XMLShapeExport::ImpExportLineShape( } // svg: x2 - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + aEnd.X); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr); // svg: y2 - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + aEnd.Y); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr); @@ -1268,16 +1278,19 @@ void XMLShapeExport::ImpExportConnectorShape( if( nDelta1 != 0 || nDelta2 != 0 || nDelta3 != 0 ) { - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta1); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + nDelta1); if( nDelta2 != 0 || nDelta3 != 0 ) { const char aSpace = ' '; sStringBuffer.appendAscii( &aSpace, 1 ); - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta2); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + nDelta2); if( nDelta3 != 0 ) { sStringBuffer.appendAscii( &aSpace, 1 ); - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta3); + mrExport.GetMM100UnitConverter().convertMeasureToXML( + sStringBuffer, nDelta3); } } @@ -1327,7 +1340,8 @@ void XMLShapeExport::ImpExportConnectorShape( if( nFeatures & SEF_EXPORT_X ) { // svg: x1 - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + aStart.X); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr); } @@ -1339,7 +1353,8 @@ void XMLShapeExport::ImpExportConnectorShape( if( nFeatures & SEF_EXPORT_Y ) { // svg: y1 - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + aStart.Y); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr); } @@ -1349,12 +1364,12 @@ void XMLShapeExport::ImpExportConnectorShape( } // svg: x2 - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, aEnd.X); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr); // svg: y2 - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, aEnd.Y); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr); @@ -1499,7 +1514,8 @@ void XMLShapeExport::ImpExportMeasureShape( if( nFeatures & SEF_EXPORT_X ) { // svg: x1 - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + aStart.X); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr); } @@ -1511,7 +1527,8 @@ void XMLShapeExport::ImpExportMeasureShape( if( nFeatures & SEF_EXPORT_Y ) { // svg: y1 - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + aStart.Y); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr); } @@ -1521,12 +1538,12 @@ void XMLShapeExport::ImpExportMeasureShape( } // svg: x2 - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, aEnd.X); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr); // svg: y2 - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, aEnd.Y); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr); @@ -1751,16 +1768,19 @@ void XMLShapeExport::ImpExportCaptionShape( if(nCornerRadius) { OUStringBuffer sStringBuffer; - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nCornerRadius); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + nCornerRadius); mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear()); } awt::Point aCaptionPoint; xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CaptionPoint" ) ) ) >>= aCaptionPoint; - mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aCaptionPoint.X); + mrExport.GetMM100UnitConverter().convertMeasureToXML(msBuffer, + aCaptionPoint.X); mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_X, msBuffer.makeStringAndClear() ); - mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aCaptionPoint.Y); + mrExport.GetMM100UnitConverter().convertMeasureToXML(msBuffer, + aCaptionPoint.Y); mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_Y, msBuffer.makeStringAndClear() ); // write Caption shape. Add export later. diff --git a/xmloff/source/draw/shapeexport3.cxx b/xmloff/source/draw/shapeexport3.cxx index f8f8e0194565..8341b5c58b05 100644 --- a/xmloff/source/draw/shapeexport3.cxx +++ b/xmloff/source/draw/shapeexport3.cxx @@ -380,7 +380,8 @@ void XMLShapeExport::export3DSceneAttributes( const com::sun::star::uno::Referen aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneDistance"))); sal_Int32 nDistance = 0; aAny >>= nDistance; - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDistance); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + nDistance); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DISTANCE, aStr); @@ -388,7 +389,8 @@ void XMLShapeExport::export3DSceneAttributes( const com::sun::star::uno::Referen aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneFocalLength"))); sal_Int32 nFocalLength = 0; aAny >>= nFocalLength; - mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nFocalLength); + mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, + nFocalLength); aStr = sStringBuffer.makeStringAndClear(); mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_FOCAL_LENGTH, aStr); diff --git a/xmloff/source/draw/ximp3dscene.cxx b/xmloff/source/draw/ximp3dscene.cxx index b71ae0d9394b..6b180f61e189 100644 --- a/xmloff/source/draw/ximp3dscene.cxx +++ b/xmloff/source/draw/ximp3dscene.cxx @@ -326,12 +326,14 @@ void SdXML3DSceneAttributesHelper::processSceneAttribute( sal_uInt16 nPrefix, co } else if( IsXMLToken( rLocalName, XML_DISTANCE ) ) { - mrImport.GetMM100UnitConverter().convertMeasure(mnDistance, rValue); + mrImport.GetMM100UnitConverter().convertMeasureToCore(mnDistance, + rValue); return; } else if( IsXMLToken( rLocalName, XML_FOCAL_LENGTH ) ) { - mrImport.GetMM100UnitConverter().convertMeasure(mnFocalLength, rValue); + mrImport.GetMM100UnitConverter().convertMeasureToCore(mnFocalLength, + rValue); return; } else if( IsXMLToken( rLocalName, XML_SHADOW_SLANT ) ) diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx index 874ef34d166a..3f33ebd46966 100644 --- a/xmloff/source/draw/ximppage.cxx +++ b/xmloff/source/draw/ximppage.cxx @@ -111,25 +111,29 @@ DrawAnnotationContext::DrawAnnotationContext( SvXMLImport& rImport, sal_uInt16 n if( IsXMLToken( aLocalName, XML_X ) ) { sal_Int32 x; - GetImport().GetMM100UnitConverter().convertMeasure(x, sValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + x, sValue); aPosition.X = static_cast<double>(x) / 100.0; } else if( IsXMLToken( aLocalName, XML_Y ) ) { sal_Int32 y; - GetImport().GetMM100UnitConverter().convertMeasure(y, sValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + y, sValue); aPosition.Y = static_cast<double>(y) / 100.0; } else if( IsXMLToken( aLocalName, XML_WIDTH ) ) { sal_Int32 w; - GetImport().GetMM100UnitConverter().convertMeasure(w, sValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + w, sValue); aSize.Width = static_cast<double>(w) / 100.0; } else if( IsXMLToken( aLocalName, XML_HEIGHT ) ) { sal_Int32 h; - GetImport().GetMM100UnitConverter().convertMeasure(h, sValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + h, sValue); aSize.Height = static_cast<double>(h) / 100.0; } break; diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 5a8b16d4ab49..1318ce83ed7b 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -298,11 +298,13 @@ void SdXMLShapeContext::addGluePoint( const uno::Reference< xml::sax::XAttribute { if( IsXMLToken( aLocalName, XML_X ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(aGluePoint.Position.X, sValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + aGluePoint.Position.X, sValue); } else if( IsXMLToken( aLocalName, XML_Y ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(aGluePoint.Position.Y, sValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + aGluePoint.Position.Y, sValue); } } else if( nPrefix == XML_NAMESPACE_DRAW ) @@ -860,15 +862,18 @@ void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUStr { if( IsXMLToken( rLocalName, XML_X ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(maPosition.X, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maPosition.X, rValue); } else if( IsXMLToken( rLocalName, XML_Y ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(maPosition.Y, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maPosition.Y, rValue); } else if( IsXMLToken( rLocalName, XML_WIDTH ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(maSize.Width, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maSize.Width, rValue); if( maSize.Width > 0 ) maSize.Width += 1; else if( maSize.Width < 0 ) @@ -876,7 +881,8 @@ void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUStr } else if( IsXMLToken( rLocalName, XML_HEIGHT ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(maSize.Height, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maSize.Height, rValue); if( maSize.Height > 0 ) maSize.Height += 1; else if( maSize.Height < 0 ) @@ -960,7 +966,8 @@ void SdXMLRectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::O { if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(mnRadius, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + mnRadius, rValue); return; } } @@ -1037,22 +1044,26 @@ void SdXMLLineShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::O { if( IsXMLToken( rLocalName, XML_X1 ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(mnX1, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + mnX1, rValue); return; } if( IsXMLToken( rLocalName, XML_Y1 ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(mnY1, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + mnY1, rValue); return; } if( IsXMLToken( rLocalName, XML_X2 ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(mnX2, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + mnX2, rValue); return; } if( IsXMLToken( rLocalName, XML_Y2 ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(mnY2, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + mnY2, rValue); return; } } @@ -1162,28 +1173,33 @@ void SdXMLEllipseShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl { if( IsXMLToken( rLocalName, XML_RX ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(mnRX, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + mnRX, rValue); return; } if( IsXMLToken( rLocalName, XML_RY ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(mnRY, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + mnRY, rValue); return; } if( IsXMLToken( rLocalName, XML_CX ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(mnCX, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + mnCX, rValue); return; } if( IsXMLToken( rLocalName, XML_CY ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(mnCY, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + mnCY, rValue); return; } if( IsXMLToken( rLocalName, XML_R ) ) { // single radius, it's a circle and both radii are the same - GetImport().GetMM100UnitConverter().convertMeasure(mnRX, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + mnRX, rValue); mnRY = mnRX; return; } @@ -1514,7 +1530,8 @@ void SdXMLTextBoxShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl { if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(mnRadius, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + mnRadius, rValue); return; } } @@ -1793,13 +1810,16 @@ void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const ::r OUString aToken; if( aTokenEnum.getNextToken( aToken ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(mnDelta1, aToken); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + mnDelta1, aToken); if( aTokenEnum.getNextToken( aToken ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(mnDelta2, aToken); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + mnDelta2, aToken); if( aTokenEnum.getNextToken( aToken ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(mnDelta3, aToken); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + mnDelta3, aToken); } } } @@ -1815,22 +1835,26 @@ void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const ::r { if( IsXMLToken( rLocalName, XML_X1 ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(maStart.X, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maStart.X, rValue); return; } if( IsXMLToken( rLocalName, XML_Y1 ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(maStart.Y, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maStart.Y, rValue); return; } if( IsXMLToken( rLocalName, XML_X2 ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(maEnd.X, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maEnd.X, rValue); return; } if( IsXMLToken( rLocalName, XML_Y2 ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(maEnd.Y, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maEnd.Y, rValue); return; } if( IsXMLToken( rLocalName, XML_D ) ) @@ -1996,22 +2020,26 @@ void SdXMLMeasureShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl { if( IsXMLToken( rLocalName, XML_X1 ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(maStart.X, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maStart.X, rValue); return; } if( IsXMLToken( rLocalName, XML_Y1 ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(maStart.Y, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maStart.Y, rValue); return; } if( IsXMLToken( rLocalName, XML_X2 ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(maEnd.X, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maEnd.X, rValue); return; } if( IsXMLToken( rLocalName, XML_Y2 ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(maEnd.Y, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maEnd.Y, rValue); return; } } @@ -2263,17 +2291,20 @@ void SdXMLCaptionShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl { if( IsXMLToken( rLocalName, XML_CAPTION_POINT_X ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(maCaptionPoint.X, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maCaptionPoint.X, rValue); return; } if( IsXMLToken( rLocalName, XML_CAPTION_POINT_Y ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(maCaptionPoint.Y, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + maCaptionPoint.Y, rValue); return; } if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) ) { - GetImport().GetMM100UnitConverter().convertMeasure(mnRadius, rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + mnRadius, rValue); return; } } diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx index a22ed8a68e9f..4658ddb5fde5 100644 --- a/xmloff/source/draw/ximpstyl.cxx +++ b/xmloff/source/draw/ximpstyl.cxx @@ -352,32 +352,38 @@ SdXMLPageMasterStyleContext::SdXMLPageMasterStyleContext( { case XML_TOK_PAGEMASTERSTYLE_MARGIN_TOP: { - GetSdImport().GetMM100UnitConverter().convertMeasure(mnBorderTop, sValue); + GetSdImport().GetMM100UnitConverter().convertMeasureToCore( + mnBorderTop, sValue); break; } case XML_TOK_PAGEMASTERSTYLE_MARGIN_BOTTOM: { - GetSdImport().GetMM100UnitConverter().convertMeasure(mnBorderBottom, sValue); + GetSdImport().GetMM100UnitConverter().convertMeasureToCore( + mnBorderBottom, sValue); break; } case XML_TOK_PAGEMASTERSTYLE_MARGIN_LEFT: { - GetSdImport().GetMM100UnitConverter().convertMeasure(mnBorderLeft, sValue); + GetSdImport().GetMM100UnitConverter().convertMeasureToCore( + mnBorderLeft, sValue); break; } case XML_TOK_PAGEMASTERSTYLE_MARGIN_RIGHT: { - GetSdImport().GetMM100UnitConverter().convertMeasure(mnBorderRight, sValue); + GetSdImport().GetMM100UnitConverter().convertMeasureToCore( + mnBorderRight, sValue); break; } case XML_TOK_PAGEMASTERSTYLE_PAGE_WIDTH: { - GetSdImport().GetMM100UnitConverter().convertMeasure(mnWidth, sValue); + GetSdImport().GetMM100UnitConverter().convertMeasureToCore( + mnWidth, sValue); break; } case XML_TOK_PAGEMASTERSTYLE_PAGE_HEIGHT: { - GetSdImport().GetMM100UnitConverter().convertMeasure(mnHeight, sValue); + GetSdImport().GetMM100UnitConverter().convertMeasureToCore( + mnHeight, sValue); break; } case XML_TOK_PAGEMASTERSTYLE_PAGE_ORIENTATION: @@ -796,22 +802,26 @@ SdXMLPresentationPlaceholderContext::SdXMLPresentationPlaceholderContext( } case XML_TOK_PRESENTATIONPLACEHOLDER_X: { - GetSdImport().GetMM100UnitConverter().convertMeasure(mnX, sValue); + GetSdImport().GetMM100UnitConverter().convertMeasureToCore( + mnX, sValue); break; } case XML_TOK_PRESENTATIONPLACEHOLDER_Y: { - GetSdImport().GetMM100UnitConverter().convertMeasure(mnY, sValue); + GetSdImport().GetMM100UnitConverter().convertMeasureToCore( + mnY, sValue); break; } case XML_TOK_PRESENTATIONPLACEHOLDER_WIDTH: { - GetSdImport().GetMM100UnitConverter().convertMeasure(mnWidth, sValue); + GetSdImport().GetMM100UnitConverter().convertMeasureToCore( + mnWidth, sValue); break; } case XML_TOK_PRESENTATIONPLACEHOLDER_HEIGHT: { - GetSdImport().GetMM100UnitConverter().convertMeasure(mnHeight, sValue); + GetSdImport().GetMM100UnitConverter().convertMeasureToCore( + mnHeight, sValue); break; } } diff --git a/xmloff/source/forms/controlpropertyhdl.cxx b/xmloff/source/forms/controlpropertyhdl.cxx index 3b89eee6ea93..59d4c1ddc712 100644 --- a/xmloff/source/forms/controlpropertyhdl.cxx +++ b/xmloff/source/forms/controlpropertyhdl.cxx @@ -28,7 +28,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" + #include <xmloff/controlpropertyhdl.hxx> + +#include <com/sun/star/util/MeasureUnit.hpp> #include <com/sun/star/awt/TextAlign.hpp> #include <com/sun/star/awt/FontWidth.hpp> #include <com/sun/star/awt/FontEmphasisMark.hpp> @@ -50,6 +53,7 @@ namespace xmloff { //......................................................................... + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::beans; @@ -321,7 +325,8 @@ namespace xmloff sal_Bool OFontWidthHandler::importXML( const ::rtl::OUString& _rStrImpValue, Any& _rValue, const SvXMLUnitConverter& ) const { sal_Int32 nWidth = 0; - sal_Bool bSuccess = SvXMLUnitConverter::convertMeasure(nWidth, _rStrImpValue, MAP_POINT); + bool const bSuccess = ::sax::Converter::convertMeasure( + nWidth, _rStrImpValue, util::MeasureUnit::POINT); if (bSuccess) _rValue <<= (sal_Int16)nWidth; @@ -334,7 +339,10 @@ namespace xmloff sal_Int16 nWidth = 0; ::rtl::OUStringBuffer aResult; if (_rValue >>= nWidth) - SvXMLUnitConverter::convertMeasure(aResult, nWidth, MAP_POINT, MAP_POINT); + { + ::sax::Converter::convertMeasure(aResult, nWidth, + util::MeasureUnit::POINT, util::MeasureUnit::POINT); + } _rStrExpValue = aResult.makeStringAndClear(); return _rStrExpValue.getLength() != 0; diff --git a/xmloff/source/meta/MetaExportComponent.cxx b/xmloff/source/meta/MetaExportComponent.cxx index fac1984e3e39..17dfe97d7093 100644 --- a/xmloff/source/meta/MetaExportComponent.cxx +++ b/xmloff/source/meta/MetaExportComponent.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Exception.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <comphelper/genericpropertyset.hxx> #include <rtl/ustrbuf.hxx> @@ -54,7 +55,7 @@ using namespace ::xmloff::token; XMLMetaExportComponent::XMLMetaExportComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, sal_uInt16 nFlags ) -: SvXMLExport( xServiceFactory, MAP_INCH, XML_TEXT, nFlags ) +: SvXMLExport( util::MeasureUnit::CM, xServiceFactory, XML_TEXT, nFlags ) { } diff --git a/xmloff/source/meta/xmlversion.cxx b/xmloff/source/meta/xmlversion.cxx index c80f5f7a5e66..403bd621f234 100644 --- a/xmloff/source/meta/xmlversion.cxx +++ b/xmloff/source/meta/xmlversion.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> #include <com/sun/star/xml/sax/InputSource.hpp> #include <com/sun/star/xml/sax/XParser.hpp> @@ -61,7 +62,7 @@ XMLVersionListExport::XMLVersionListExport( const com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& rVersions, const OUString &rFileName, Reference< XDocumentHandler > &rHandler ) -: SvXMLExport( xServiceFactory, rFileName, rHandler ), +: SvXMLExport( xServiceFactory, rFileName, util::MeasureUnit::CM, rHandler ), maVersions( rVersions ) { _GetNamespaceMap().AddAtIndex( XML_NAMESPACE_DC_IDX, xmloff::token::GetXMLToken(xmloff::token::XML_NP_DC), diff --git a/xmloff/source/style/DashStyle.cxx b/xmloff/source/style/DashStyle.cxx index c81b22880fa7..f80375c80aeb 100644 --- a/xmloff/source/style/DashStyle.cxx +++ b/xmloff/source/style/DashStyle.cxx @@ -164,7 +164,8 @@ sal_Bool XMLDashStyleImport::importXML( } else { - rUnitConverter.convertMeasure( aLineDash.DotLen, rStrValue ); + rUnitConverter.convertMeasureToCore( aLineDash.DotLen, + rStrValue ); } } break; @@ -182,7 +183,8 @@ sal_Bool XMLDashStyleImport::importXML( } else { - rUnitConverter.convertMeasure( aLineDash.DashLen, rStrValue ); + rUnitConverter.convertMeasureToCore( aLineDash.DashLen, + rStrValue ); } } break; @@ -196,7 +198,8 @@ sal_Bool XMLDashStyleImport::importXML( } else { - rUnitConverter.convertMeasure( aLineDash.Distance, rStrValue ); + rUnitConverter.convertMeasureToCore( aLineDash.Distance, + rStrValue ); } } break; @@ -282,7 +285,8 @@ sal_Bool XMLDashStyleExport::exportXML( } else { - rUnitConverter.convertMeasure( aOut, aLineDash.DotLen ); + rUnitConverter.convertMeasureToXML( aOut, + aLineDash.DotLen ); } aStrValue = aOut.makeStringAndClear(); rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DOTS1_LENGTH, aStrValue ); @@ -303,7 +307,8 @@ sal_Bool XMLDashStyleExport::exportXML( } else { - rUnitConverter.convertMeasure( aOut, aLineDash.DashLen ); + rUnitConverter.convertMeasureToXML( aOut, + aLineDash.DashLen ); } aStrValue = aOut.makeStringAndClear(); rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DOTS2_LENGTH, aStrValue ); @@ -317,7 +322,8 @@ sal_Bool XMLDashStyleExport::exportXML( } else { - rUnitConverter.convertMeasure( aOut, aLineDash.Distance ); + rUnitConverter.convertMeasureToXML( aOut, + aLineDash.Distance ); } aStrValue = aOut.makeStringAndClear(); rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISTANCE, aStrValue ); diff --git a/xmloff/source/style/HatchStyle.cxx b/xmloff/source/style/HatchStyle.cxx index 2a0be91b6e87..833a8bb1593b 100644 --- a/xmloff/source/style/HatchStyle.cxx +++ b/xmloff/source/style/HatchStyle.cxx @@ -155,7 +155,8 @@ sal_Bool XMLHatchStyleImport::importXML( } break; case XML_TOK_HATCH_DISTANCE: - bHasDist = rUnitConverter.convertMeasure( (sal_Int32&)aHatch.Distance, rStrValue ); + bHasDist = rUnitConverter.convertMeasureToCore( + (sal_Int32&)aHatch.Distance, rStrValue ); break; case XML_TOK_HATCH_ROTATION: { @@ -243,7 +244,7 @@ sal_Bool XMLHatchStyleExport::exportXML( rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_COLOR, aStrValue ); // Distance - rUnitConverter.convertMeasure( aOut, aHatch.Distance ); + rUnitConverter.convertMeasureToXML( aOut, aHatch.Distance ); aStrValue = aOut.makeStringAndClear(); rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HATCH_DISTANCE, aStrValue ); diff --git a/xmloff/source/style/VisAreaContext.cxx b/xmloff/source/style/VisAreaContext.cxx index c804256c5242..1cc0a18a3d71 100644 --- a/xmloff/source/style/VisAreaContext.cxx +++ b/xmloff/source/style/VisAreaContext.cxx @@ -37,8 +37,8 @@ #include <xmloff/xmltoken.hxx> #include "xmloff/xmlnmspe.hxx" #include <xmloff/nmspmap.hxx> -#include <xmloff/xmluconv.hxx> #include <xmloff/xmlimp.hxx> +#include <sax/tools/converter.hxx> #include <tools/gen.hxx> using namespace com::sun::star; @@ -50,11 +50,13 @@ XMLVisAreaContext::XMLVisAreaContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName, const uno::Reference<xml::sax::XAttributeList>& xAttrList, - Rectangle& rRect, const MapUnit aMapUnit ) : + Rectangle& rRect, + const sal_Int16 eMeasureUnit ) +: SvXMLImportContext( rImport, nPrfx, rLName ) { awt::Rectangle rAwtRect( rRect.getX(), rRect.getY(), rRect.getWidth(), rRect.getHeight() ); - process( xAttrList, rAwtRect, (sal_Int16)aMapUnit ); + process( xAttrList, rAwtRect, eMeasureUnit ); rRect.setX( rAwtRect.X ); rRect.setY( rAwtRect.Y ); @@ -68,8 +70,6 @@ XMLVisAreaContext::~XMLVisAreaContext() void XMLVisAreaContext::process( const uno::Reference< xml::sax::XAttributeList>& xAttrList, awt::Rectangle& rRect, const sal_Int16 nMeasureUnit ) { - MapUnit aMapUnit = (MapUnit)nMeasureUnit; - sal_Int32 nX(0); sal_Int32 nY(0); sal_Int32 nWidth(0); @@ -87,22 +87,22 @@ void XMLVisAreaContext::process( const uno::Reference< xml::sax::XAttributeList> { if (IsXMLToken( aLocalName, XML_X )) { - SvXMLUnitConverter::convertMeasure(nX, sValue, aMapUnit); + ::sax::Converter::convertMeasure(nX, sValue, nMeasureUnit); rRect.X = nX; } else if (IsXMLToken( aLocalName, XML_Y )) { - SvXMLUnitConverter::convertMeasure(nY, sValue, aMapUnit); + ::sax::Converter::convertMeasure(nY, sValue, nMeasureUnit); rRect.Y = nY; } else if (IsXMLToken( aLocalName, XML_WIDTH )) { - SvXMLUnitConverter::convertMeasure(nWidth, sValue, aMapUnit); + ::sax::Converter::convertMeasure(nWidth, sValue, nMeasureUnit); rRect.Width = nWidth; } else if (IsXMLToken( aLocalName, XML_HEIGHT )) { - SvXMLUnitConverter::convertMeasure(nHeight, sValue, aMapUnit); + ::sax::Converter::convertMeasure(nHeight, sValue, nMeasureUnit); rRect.Height = nHeight; } } diff --git a/xmloff/source/style/XMLClipPropertyHandler.cxx b/xmloff/source/style/XMLClipPropertyHandler.cxx index af36556370ec..fa64f99ea2a0 100644 --- a/xmloff/source/style/XMLClipPropertyHandler.cxx +++ b/xmloff/source/style/XMLClipPropertyHandler.cxx @@ -93,7 +93,7 @@ sal_Bool XMLClipPropertyHandler::importXML( const OUString& rStrImpValue, uno::A { sal_Int32 nVal = 0; if( !IsXMLToken(aToken, XML_AUTO) && - !rUnitConverter.convertMeasure( nVal, aToken ) ) + !rUnitConverter.convertMeasureToCore( nVal, aToken ) ) break; switch( nPos ) @@ -124,19 +124,19 @@ sal_Bool XMLClipPropertyHandler::exportXML( OUString& rStrExpValue, const uno::A { aOut.append( GetXMLToken(XML_RECT) ); aOut.append( (sal_Unicode)'(' ); - rUnitConverter.convertMeasure( aOut, aCrop.Top ); + rUnitConverter.convertMeasureToXML( aOut, aCrop.Top ); if( !m_bODF11 ) aOut.append( (sal_Unicode)',' ); aOut.append( (sal_Unicode)' ' ); - rUnitConverter.convertMeasure( aOut, aCrop.Right ); + rUnitConverter.convertMeasureToXML( aOut, aCrop.Right ); if( !m_bODF11 ) aOut.append( (sal_Unicode)',' ); aOut.append( (sal_Unicode)' ' ); - rUnitConverter.convertMeasure( aOut, aCrop.Bottom ); + rUnitConverter.convertMeasureToXML( aOut, aCrop.Bottom ); if( !m_bODF11 ) aOut.append( (sal_Unicode)',' ); aOut.append( (sal_Unicode)' ' ); - rUnitConverter.convertMeasure( aOut, aCrop.Left ); + rUnitConverter.convertMeasureToXML( aOut, aCrop.Left ); aOut.append( (sal_Unicode)')' ); rStrExpValue = aOut.makeStringAndClear(); diff --git a/xmloff/source/style/XMLFillBitmapSizePropertyHandler.cxx b/xmloff/source/style/XMLFillBitmapSizePropertyHandler.cxx index 6f1363751214..19ccab8e4f33 100644 --- a/xmloff/source/style/XMLFillBitmapSizePropertyHandler.cxx +++ b/xmloff/source/style/XMLFillBitmapSizePropertyHandler.cxx @@ -65,7 +65,7 @@ sal_Bool XMLFillBitmapSizePropertyHandler::importXML( } else { - bRet = rUnitConverter.convertMeasure( nValue, rStrImpValue ); + bRet = rUnitConverter.convertMeasureToCore( nValue, rStrImpValue ); } if( bRet ) @@ -90,7 +90,7 @@ sal_Bool XMLFillBitmapSizePropertyHandler::exportXML( } else { - rUnitConverter.convertMeasure( aOut, nValue ); + rUnitConverter.convertMeasureToXML( aOut, nValue ); } rStrExpValue = aOut.makeStringAndClear(); diff --git a/xmloff/source/style/XMLFootnoteSeparatorExport.cxx b/xmloff/source/style/XMLFootnoteSeparatorExport.cxx index f8200a89cf94..2a441fb0df0c 100644 --- a/xmloff/source/style/XMLFootnoteSeparatorExport.cxx +++ b/xmloff/source/style/XMLFootnoteSeparatorExport.cxx @@ -123,7 +123,7 @@ void XMLFootnoteSeparatorExport::exportXML( // weight/width if (nLineWeight > 0) { - rExport.GetMM100UnitConverter().convertMeasure(sBuf, nLineWeight); + rExport.GetMM100UnitConverter().convertMeasureToXML(sBuf, nLineWeight); rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_WIDTH, sBuf.makeStringAndClear()); } @@ -131,7 +131,8 @@ void XMLFootnoteSeparatorExport::exportXML( // line text distance if (nLineTextDistance > 0) { - rExport.GetMM100UnitConverter().convertMeasure(sBuf,nLineTextDistance); + rExport.GetMM100UnitConverter().convertMeasureToXML(sBuf, + nLineTextDistance); rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_DISTANCE_BEFORE_SEP, sBuf.makeStringAndClear()); } @@ -139,7 +140,8 @@ void XMLFootnoteSeparatorExport::exportXML( // line distance if (nLineDistance > 0) { - rExport.GetMM100UnitConverter().convertMeasure(sBuf, nLineDistance); + rExport.GetMM100UnitConverter().convertMeasureToXML(sBuf, + nLineDistance); rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_DISTANCE_AFTER_SEP, sBuf.makeStringAndClear()); } diff --git a/xmloff/source/style/XMLFootnoteSeparatorImport.cxx b/xmloff/source/style/XMLFootnoteSeparatorImport.cxx index a9f2d6d43d37..eb1fd665a694 100644 --- a/xmloff/source/style/XMLFootnoteSeparatorImport.cxx +++ b/xmloff/source/style/XMLFootnoteSeparatorImport.cxx @@ -112,7 +112,7 @@ void XMLFootnoteSeparatorImport::StartElement( sal_Int32 nTmp; if (IsXMLToken( sLocalName, XML_WIDTH )) { - if (GetImport().GetMM100UnitConverter().convertMeasure( + if (GetImport().GetMM100UnitConverter().convertMeasureToCore( nTmp, sAttrValue)) { nLineWeight = (sal_Int16)nTmp; @@ -120,13 +120,13 @@ void XMLFootnoteSeparatorImport::StartElement( } else if (IsXMLToken( sLocalName, XML_DISTANCE_BEFORE_SEP )) { - if (GetImport().GetMM100UnitConverter().convertMeasure( + if (GetImport().GetMM100UnitConverter().convertMeasureToCore( nTmp, sAttrValue)) nLineTextDistance = nTmp; } else if (IsXMLToken( sLocalName, XML_DISTANCE_AFTER_SEP )) { - if (GetImport().GetMM100UnitConverter().convertMeasure( + if (GetImport().GetMM100UnitConverter().convertMeasureToCore( nTmp, sAttrValue)) nLineDistance = nTmp; } diff --git a/xmloff/source/style/XMLPercentOrMeasurePropertyHandler.cxx b/xmloff/source/style/XMLPercentOrMeasurePropertyHandler.cxx index 85f5691b44f1..6ff16276eb81 100644 --- a/xmloff/source/style/XMLPercentOrMeasurePropertyHandler.cxx +++ b/xmloff/source/style/XMLPercentOrMeasurePropertyHandler.cxx @@ -73,7 +73,7 @@ sal_Bool XMLPercentOrMeasurePropertyHandler::importXML( } else { - if( !rUnitConverter.convertMeasure( nValue, rStrImpValue ) ) + if (!rUnitConverter.convertMeasureToCore( nValue, rStrImpValue )) return sal_False; } @@ -98,7 +98,7 @@ sal_Bool XMLPercentOrMeasurePropertyHandler::exportXML( } else { - rUnitConverter.convertMeasure( aOut, nValue ); + rUnitConverter.convertMeasureToXML( aOut, nValue ); } rStrExpValue = aOut.makeStringAndClear(); diff --git a/xmloff/source/style/XMLRectangleMembersHandler.cxx b/xmloff/source/style/XMLRectangleMembersHandler.cxx index 9e9fef6d9c96..b2a99201e971 100644 --- a/xmloff/source/style/XMLRectangleMembersHandler.cxx +++ b/xmloff/source/style/XMLRectangleMembersHandler.cxx @@ -62,7 +62,7 @@ sal_Bool XMLRectangleMembersHdl::importXML( sal_Int32 nValue; - if( rUnitConverter.convertMeasure( nValue, rStrImpValue ) ) + if (rUnitConverter.convertMeasureToCore( nValue, rStrImpValue )) { switch( mnType ) { @@ -117,7 +117,7 @@ sal_Bool XMLRectangleMembersHdl::exportXML( } rtl::OUStringBuffer sBuffer; - rUnitConverter.convertMeasure( sBuffer, nValue ); + rUnitConverter.convertMeasureToXML( sBuffer, nValue ); rStrExpValue = sBuffer.makeStringAndClear(); return sal_True; } diff --git a/xmloff/source/style/bordrhdl.cxx b/xmloff/source/style/bordrhdl.cxx index bc9423621d90..13179811bd89 100644 --- a/xmloff/source/style/bordrhdl.cxx +++ b/xmloff/source/style/bordrhdl.cxx @@ -133,19 +133,19 @@ sal_Bool XMLBorderWidthHdl::importXML( const OUString& rStrImpValue, uno::Any& r if( !aTokenEnum.getNextToken( aToken ) ) return sal_False; - if( !rUnitConverter.convertMeasure( nInWidth, aToken, 0, 500 ) ) + if (!rUnitConverter.convertMeasureToCore( nInWidth, aToken, 0, 500 )) return sal_False; if( !aTokenEnum.getNextToken( aToken ) ) return sal_False; - if( !rUnitConverter.convertMeasure( nDistance, aToken, 0, 500 ) ) + if (!rUnitConverter.convertMeasureToCore( nDistance, aToken, 0, 500 )) return sal_False; if( !aTokenEnum.getNextToken( aToken ) ) return sal_False; - if( !rUnitConverter.convertMeasure( nOutWidth, aToken, 0, 500 ) ) + if (!rUnitConverter.convertMeasureToCore( nOutWidth, aToken, 0, 500 )) return sal_False; table::BorderLine2 aBorderLine; @@ -187,11 +187,11 @@ sal_Bool XMLBorderWidthHdl::exportXML( OUString& rStrExpValue, const uno::Any& r if( ( aBorderLine.LineDistance == 0 && aBorderLine.InnerLineWidth == 0 ) || !bDouble ) return sal_False; - rUnitConverter.convertMeasure( aOut, aBorderLine.InnerLineWidth ); + rUnitConverter.convertMeasureToXML( aOut, aBorderLine.InnerLineWidth ); aOut.append( sal_Unicode( ' ' ) ); - rUnitConverter.convertMeasure( aOut, aBorderLine.LineDistance ); + rUnitConverter.convertMeasureToXML( aOut, aBorderLine.LineDistance ); aOut.append( sal_Unicode( ' ' ) ); - rUnitConverter.convertMeasure( aOut, aBorderLine.OuterLineWidth ); + rUnitConverter.convertMeasureToXML( aOut, aBorderLine.OuterLineWidth ); rStrExpValue = aOut.makeStringAndClear(); return sal_True; @@ -241,7 +241,7 @@ sal_Bool XMLBorderHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue bHasColor = sal_True; } else if( !bHasWidth && - rUnitConverter.convertMeasure( nTemp, aToken, 0, + rUnitConverter.convertMeasureToCore( nTemp, aToken, 0, USHRT_MAX ) ) { nWidth = (sal_uInt16)nTemp; @@ -322,8 +322,8 @@ sal_Bool XMLBorderHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue } else { - SvXMLUnitConverter::convertMeasure( aOut, nWidth, - MAP_100TH_MM, MAP_POINT ); + ::sax::Converter::convertMeasure( aOut, nWidth, + util::MeasureUnit::MM_100TH, util::MeasureUnit::POINT); aOut.append( sal_Unicode( ' ' ) ); diff --git a/xmloff/source/style/chrhghdl.cxx b/xmloff/source/style/chrhghdl.cxx index 67c025951956..5096de202dc8 100644 --- a/xmloff/source/style/chrhghdl.cxx +++ b/xmloff/source/style/chrhghdl.cxx @@ -38,7 +38,6 @@ #include <sax/tools/converter.hxx> #include <xmloff/xmluconv.hxx> -#include "xmlehelp.hxx" using ::rtl::OUString; using ::rtl::OUStringBuffer; @@ -148,7 +147,8 @@ sal_Bool XMLCharHeightDiffHdl::importXML( const OUString& rStrImpValue, uno::Any { sal_Int32 nRel = 0; - if( SvXMLUnitConverter::convertMeasure( nRel, rStrImpValue, MAP_POINT ) ) + if (::sax::Converter::convertMeasure( nRel, rStrImpValue, + util::MeasureUnit::POINT )) { rValue <<= (float)nRel; return sal_True; @@ -164,7 +164,8 @@ sal_Bool XMLCharHeightDiffHdl::exportXML( OUString& rStrExpValue, const uno::Any float nRel = 0; if( (rValue >>= nRel) && (nRel != 0) ) { - SvXMLUnitConverter::convertMeasure( aOut, (sal_Int32)nRel, MAP_POINT, MAP_POINT ); + ::sax::Converter::convertMeasure( aOut, static_cast<sal_Int32>(nRel), + util::MeasureUnit::POINT, util::MeasureUnit::POINT ); rStrExpValue = aOut.makeStringAndClear(); } diff --git a/xmloff/source/style/kernihdl.cxx b/xmloff/source/style/kernihdl.cxx index 27ed1a5a318f..75bb7ceda107 100644 --- a/xmloff/source/style/kernihdl.cxx +++ b/xmloff/source/style/kernihdl.cxx @@ -59,7 +59,7 @@ sal_Bool XMLKerningPropHdl::importXML( const OUString& rStrImpValue, Any& rValue if( ! IsXMLToken( rStrImpValue, XML_KERNING_NORMAL ) ) { - bRet = rUnitConverter.convertMeasure( nKerning, rStrImpValue ); + bRet = rUnitConverter.convertMeasureToCore( nKerning, rStrImpValue ); } rValue <<= (sal_Int16)nKerning; @@ -79,7 +79,9 @@ sal_Bool XMLKerningPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue if( nValue == 0 ) aOut.append( GetXMLToken(XML_KERNING_NORMAL) ); else - rUnitConverter.convertMeasure( aOut, nValue ); + { + rUnitConverter.convertMeasureToXML( aOut, nValue ); + } rStrExpValue = aOut.makeStringAndClear(); diff --git a/xmloff/source/style/lspachdl.cxx b/xmloff/source/style/lspachdl.cxx index 7a2e86a70f4e..5f373472714f 100644 --- a/xmloff/source/style/lspachdl.cxx +++ b/xmloff/source/style/lspachdl.cxx @@ -81,7 +81,8 @@ sal_Bool XMLLineHeightHdl::importXML( const OUString& rStrImpValue, uno::Any& rV else { aLSp.Mode = style::LineSpacingMode::FIX; - if(!rUnitConverter.convertMeasure( nTemp, rStrImpValue, 0x0000, 0xffff )) + if (!rUnitConverter.convertMeasureToCore( + nTemp, rStrImpValue, 0x0000, 0xffff)) return sal_False; aLSp.Height = sal::static_int_cast< sal_Int16 >(nTemp); } @@ -107,7 +108,7 @@ sal_Bool XMLLineHeightHdl::exportXML( OUString& rStrExpValue, const uno::Any& rV } else { - rUnitConverter.convertMeasure( aOut, aLSp.Height ); + rUnitConverter.convertMeasureToXML( aOut, aLSp.Height ); } rStrExpValue = aOut.makeStringAndClear(); @@ -130,7 +131,7 @@ sal_Bool XMLLineHeightAtLeastHdl::importXML( const OUString& rStrImpValue, uno:: sal_Int32 nTemp; aLSp.Mode = style::LineSpacingMode::MINIMUM; - if(!rUnitConverter.convertMeasure( nTemp, rStrImpValue, 0x0000, 0xffff )) + if (!rUnitConverter.convertMeasureToCore( nTemp, rStrImpValue, 0, 0xffff)) return sal_False; aLSp.Height = sal::static_int_cast< sal_Int16 >(nTemp); @@ -149,7 +150,7 @@ sal_Bool XMLLineHeightAtLeastHdl::exportXML( OUString& rStrExpValue, const uno:: if( style::LineSpacingMode::MINIMUM != aLSp.Mode ) return sal_False; - rUnitConverter.convertMeasure( aOut, aLSp.Height ); + rUnitConverter.convertMeasureToXML( aOut, aLSp.Height ); rStrExpValue = aOut.makeStringAndClear(); return rStrExpValue.getLength() != 0; @@ -171,7 +172,7 @@ sal_Bool XMLLineSpacingHdl::importXML( const OUString& rStrImpValue, uno::Any& r sal_Int32 nTemp; aLSp.Mode = style::LineSpacingMode::LEADING; - if(!rUnitConverter.convertMeasure( nTemp, rStrImpValue, 0x0000, 0xffff )) + if (!rUnitConverter.convertMeasureToCore( nTemp, rStrImpValue, 0, 0xffff)) return sal_False; aLSp.Height = sal::static_int_cast< sal_Int16 >(nTemp); @@ -190,7 +191,7 @@ sal_Bool XMLLineSpacingHdl::exportXML( OUString& rStrExpValue, const uno::Any& r if( style::LineSpacingMode::LEADING != aLSp.Mode ) return sal_False; - rUnitConverter.convertMeasure( aOut, aLSp.Height ); + rUnitConverter.convertMeasureToXML( aOut, aLSp.Height ); rStrExpValue = aOut.makeStringAndClear(); return rStrExpValue.getLength() != 0; diff --git a/xmloff/source/style/shadwhdl.cxx b/xmloff/source/style/shadwhdl.cxx index 43a3bc1a3c89..8e5ba2a8f77c 100644 --- a/xmloff/source/style/shadwhdl.cxx +++ b/xmloff/source/style/shadwhdl.cxx @@ -89,9 +89,9 @@ sal_Bool XMLShadowPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rV { sal_Int32 nX = 0, nY = 0; - bRet = rUnitConverter.convertMeasure( nX, aToken ); + bRet = rUnitConverter.convertMeasureToCore( nX, aToken ); if( bRet && aTokenEnum.getNextToken( aToken ) ) - bRet = rUnitConverter.convertMeasure( nY, aToken ); + bRet = rUnitConverter.convertMeasureToCore( nY, aToken ); if( bRet ) { @@ -167,9 +167,9 @@ sal_Bool XMLShadowPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rV ::sax::Converter::convertColor( aOut, aShadow.Color ); aOut.append( sal_Unicode(' ') ); - rUnitConverter.convertMeasure( aOut, nX ); + rUnitConverter.convertMeasureToXML( aOut, nX ); aOut.append( sal_Unicode(' ') ); - rUnitConverter.convertMeasure( aOut, nY ); + rUnitConverter.convertMeasureToXML( aOut, nY ); rStrExpValue = aOut.makeStringAndClear(); diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx index 4602e53e8584..7fa894600708 100644 --- a/xmloff/source/style/xmlbahdl.cxx +++ b/xmloff/source/style/xmlbahdl.cxx @@ -212,7 +212,7 @@ sal_Bool XMLMeasurePropHdl::importXML( const OUString& rStrImpValue, Any& rValue sal_Bool bRet = sal_False; sal_Int32 nValue = 0; - bRet = rUnitConverter.convertMeasure( nValue, rStrImpValue ); + bRet = rUnitConverter.convertMeasureToCore( nValue, rStrImpValue ); lcl_xmloff_setAny( rValue, nValue, nBytes ); return bRet; @@ -226,7 +226,7 @@ sal_Bool XMLMeasurePropHdl::exportXML( OUString& rStrExpValue, const Any& rValue if( lcl_xmloff_getAny( rValue, nValue, nBytes ) ) { - rUnitConverter.convertMeasure( aOut, nValue ); + rUnitConverter.convertMeasureToXML( aOut, nValue ); rStrExpValue = aOut.makeStringAndClear(); bRet = sal_True; @@ -444,7 +444,7 @@ sal_Bool XMLMeasurePxPropHdl::importXML( const OUString& rStrImpValue, Any& rVal sal_Bool bRet = sal_False; sal_Int32 nValue = 0; - bRet = SvXMLUnitConverter::convertMeasurePx( nValue, rStrImpValue ); + bRet = ::sax::Converter::convertMeasurePx( nValue, rStrImpValue ); lcl_xmloff_setAny( rValue, nValue, nBytes ); return bRet; @@ -458,7 +458,7 @@ sal_Bool XMLMeasurePxPropHdl::exportXML( OUString& rStrExpValue, const Any& rVal if( lcl_xmloff_getAny( rValue, nValue, nBytes ) ) { - SvXMLUnitConverter::convertMeasurePx( aOut, nValue ); + ::sax::Converter::convertMeasurePx( aOut, nValue ); rStrExpValue = aOut.makeStringAndClear(); bRet = sal_True; diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx index 115c813712fd..58145c4d1378 100644 --- a/xmloff/source/style/xmlnume.cxx +++ b/xmloff/source/style/xmlnume.cxx @@ -399,19 +399,22 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel, nMinLabelWidth = -nMinLabelWidth; if( nSpaceBefore != 0 ) { - GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nSpaceBefore ); + GetExport().GetMM100UnitConverter().convertMeasureToXML( + sBuffer, nSpaceBefore ); GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_SPACE_BEFORE, sBuffer.makeStringAndClear() ); } if( nMinLabelWidth != 0 ) { - GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nMinLabelWidth ); + GetExport().GetMM100UnitConverter().convertMeasureToXML( + sBuffer, nMinLabelWidth ); GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_MIN_LABEL_WIDTH, sBuffer.makeStringAndClear() ); } if( nMinLabelDist > 0 ) { - GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nMinLabelDist ); + GetExport().GetMM100UnitConverter().convertMeasureToXML( + sBuffer, nMinLabelDist ); GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_MIN_LABEL_DISTANCE, sBuffer.makeStringAndClear() ); } @@ -488,14 +491,16 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel, if( nImageWidth > 0 ) { - GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nImageWidth ); + GetExport().GetMM100UnitConverter().convertMeasureToXML( + sBuffer, nImageWidth ); GetExport().AddAttribute( XML_NAMESPACE_FO, XML_WIDTH, sBuffer.makeStringAndClear() ); } if( nImageHeight > 0 ) { - GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nImageHeight ); + GetExport().GetMM100UnitConverter().convertMeasureToXML( + sBuffer, nImageHeight ); GetExport().AddAttribute( XML_NAMESPACE_FO, XML_HEIGHT, sBuffer.makeStringAndClear() ); } @@ -526,7 +531,8 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel, if ( eLabelFollowedBy == LabelFollow::LISTTAB && nListtabStopPosition > 0 ) { - GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nListtabStopPosition ); + GetExport().GetMM100UnitConverter().convertMeasureToXML( + sBuffer, nListtabStopPosition ); GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_LIST_TAB_STOP_POSITION, sBuffer.makeStringAndClear() ); @@ -534,7 +540,8 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel, if ( nFirstLineIndent != 0 ) { - GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nFirstLineIndent ); + GetExport().GetMM100UnitConverter().convertMeasureToXML( + sBuffer, nFirstLineIndent ); GetExport().AddAttribute( XML_NAMESPACE_FO, XML_TEXT_INDENT, sBuffer.makeStringAndClear() ); @@ -542,7 +549,8 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel, if ( nIndentAt != 0 ) { - GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nIndentAt ); + GetExport().GetMM100UnitConverter().convertMeasureToXML( + sBuffer, nIndentAt ); GetExport().AddAttribute( XML_NAMESPACE_FO, XML_MARGIN_LEFT, sBuffer.makeStringAndClear() ); diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx index 70b522a44569..9df897b05757 100644 --- a/xmloff/source/style/xmlnumi.cxx +++ b/xmloff/source/style/xmlnumi.cxx @@ -767,15 +767,15 @@ SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl( switch( aTokenMap.Get( nPrefix, aLocalName ) ) { case XML_TOK_STYLE_ATTRIBUTES_ATTR_SPACE_BEFORE: - if( rUnitConv.convertMeasure( nVal, rValue, SHRT_MIN, SHRT_MAX ) ) + if (rUnitConv.convertMeasureToCore(nVal, rValue, SHRT_MIN, SHRT_MAX)) rListLevel.SetSpaceBefore( nVal ); break; case XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_WIDTH: - if( rUnitConv.convertMeasure( nVal, rValue, 0, SHRT_MAX ) ) + if (rUnitConv.convertMeasureToCore( nVal, rValue, 0, SHRT_MAX )) rListLevel.SetMinLabelWidth( nVal ); break; case XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST: - if( rUnitConv.convertMeasure( nVal, rValue, 0, USHRT_MAX ) ) + if (rUnitConv.convertMeasureToCore( nVal, rValue, 0, USHRT_MAX )) rListLevel.SetMinLabelDist( nVal ); break; case XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN: @@ -814,11 +814,11 @@ SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl( sVerticalRel = rValue; break; case XML_TOK_STYLE_ATTRIBUTES_ATTR_WIDTH: - if( rUnitConv.convertMeasure( nVal, rValue, 0, SAL_MAX_INT32) ) + if (rUnitConv.convertMeasureToCore(nVal, rValue, 0, SAL_MAX_INT32)) rListLevel.SetImageWidth( nVal ); break; case XML_TOK_STYLE_ATTRIBUTES_ATTR_HEIGHT: - if( rUnitConv.convertMeasure( nVal, rValue, 0, SAL_MAX_INT32) ) + if (rUnitConv.convertMeasureToCore(nVal, rValue, 0, SAL_MAX_INT32)) rListLevel.SetImageHeight( nVal ); break; case XML_TOK_STYLE_ATTRIBUTES_ATTR_COLOR: @@ -1070,15 +1070,15 @@ SvxXMLListLevelStyleLabelAlignmentAttrContext_Impl::SvxXMLListLevelStyleLabelAli } break; case XML_TOK_STYLE_ATTRIBUTES_ATTR_LISTTAB_STOP_POSITION: - if( rUnitConv.convertMeasure( nVal, rValue, 0, SHRT_MAX ) ) + if (rUnitConv.convertMeasureToCore(nVal, rValue, 0, SHRT_MAX)) rListLevel.SetListtabStopPosition( nVal ); break; case XML_TOK_STYLE_ATTRIBUTES_ATTR_FIRST_LINE_INDENT: - if( rUnitConv.convertMeasure( nVal, rValue, SHRT_MIN, SHRT_MAX ) ) + if (rUnitConv.convertMeasureToCore(nVal, rValue, SHRT_MIN, SHRT_MAX)) rListLevel.SetFirstLineIndent( nVal ); break; case XML_TOK_STYLE_ATTRIBUTES_ATTR_INDENT_AT: - if( rUnitConv.convertMeasure( nVal, rValue, SHRT_MIN, SHRT_MAX ) ) + if (rUnitConv.convertMeasureToCore(nVal, rValue, SHRT_MIN, SHRT_MAX)) rListLevel.SetIndentAt( nVal ); break; } diff --git a/xmloff/source/style/xmltabe.cxx b/xmloff/source/style/xmltabe.cxx index d967e3d30618..aa203176a830 100644 --- a/xmloff/source/style/xmltabe.cxx +++ b/xmloff/source/style/xmltabe.cxx @@ -64,7 +64,7 @@ void SvxXMLTabStopExport::exportTabStop( const ::com::sun::star::style::TabStop* OUStringBuffer sBuffer; // position attribute - rUnitConv.convertMeasure( sBuffer, pTabStop->Position ); + rUnitConv.convertMeasureToXML( sBuffer, pTabStop->Position ); rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_POSITION, sBuffer.makeStringAndClear() ); diff --git a/xmloff/source/style/xmltabi.cxx b/xmloff/source/style/xmltabi.cxx index a5c92fb5469d..51915d77a584 100644 --- a/xmloff/source/style/xmltabi.cxx +++ b/xmloff/source/style/xmltabi.cxx @@ -125,9 +125,11 @@ SvxXMLTabStopContext_Impl::SvxXMLTabStopContext_Impl( switch( aTokenMap.Get( nPrefix, aLocalName ) ) { case XML_TOK_TABSTOP_POSITION: - if( GetImport().GetMM100UnitConverter().convertMeasure( nVal, - rValue ) ) + if (GetImport().GetMM100UnitConverter().convertMeasureToCore( + nVal, rValue)) + { aTabStop.Position = nVal; + } break; case XML_TOK_TABSTOP_TYPE: if( IsXMLToken( rValue, XML_LEFT ) ) diff --git a/xmloff/source/text/XMLAutoTextEventExport.cxx b/xmloff/source/text/XMLAutoTextEventExport.cxx index 30cc1246c700..f83570e70ba4 100644 --- a/xmloff/source/text/XMLAutoTextEventExport.cxx +++ b/xmloff/source/text/XMLAutoTextEventExport.cxx @@ -31,6 +31,7 @@ #include "XMLAutoTextEventExport.hxx" #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/document/XEventsSupplier.hpp> #include <com/sun/star/container/XNameReplace.hpp> @@ -44,6 +45,7 @@ #include <xmloff/xmltoken.hxx> #include <xmloff/XMLEventExport.hxx> #include <tools/debug.hxx> +#include <tools/fldunit.hxx> using namespace ::com::sun::star; @@ -75,7 +77,8 @@ XMLAutoTextEventExport::XMLAutoTextEventExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, sal_uInt16 nFlags ) -: SvXMLExport( xServiceFactory, MAP_INCH, XML_AUTO_TEXT, nFlags ), +: SvXMLExport(util::MeasureUnit::INCH, xServiceFactory, XML_AUTO_TEXT, nFlags) +, sEventType(RTL_CONSTASCII_USTRINGPARAM("EventType")), sNone(RTL_CONSTASCII_USTRINGPARAM("None")) { @@ -88,7 +91,7 @@ XMLAutoTextEventExport::XMLAutoTextEventExport( const Reference<XModel> & rModel, const Reference<XNameAccess> & rEvents, sal_uInt16 /*nFlags*/ ) -: SvXMLExport( xServiceFactory, rFileName, rHandler, rModel, MAP_INCH ), +: SvXMLExport( xServiceFactory, rFileName, rHandler, rModel, FUNIT_INCH), xEvents(rEvents), sEventType(RTL_CONSTASCII_USTRINGPARAM("EventType")), sNone(RTL_CONSTASCII_USTRINGPARAM("None")) diff --git a/xmloff/source/text/XMLIndexTabStopEntryContext.cxx b/xmloff/source/text/XMLIndexTabStopEntryContext.cxx index a6654f74c01e..784bd50cc8a0 100644 --- a/xmloff/source/text/XMLIndexTabStopEntryContext.cxx +++ b/xmloff/source/text/XMLIndexTabStopEntryContext.cxx @@ -101,7 +101,7 @@ void XMLIndexTabStopEntryContext::StartElement( { sal_Int32 nTmp; if (GetImport().GetMM100UnitConverter(). - convertMeasure(nTmp, sAttr)) + convertMeasureToCore(nTmp, sAttr)) { nTabPosition = nTmp; bTabPositionOK = sal_True; diff --git a/xmloff/source/text/XMLLineNumberingExport.cxx b/xmloff/source/text/XMLLineNumberingExport.cxx index 2e40898b2ddb..c3dc64337f8b 100644 --- a/xmloff/source/text/XMLLineNumberingExport.cxx +++ b/xmloff/source/text/XMLLineNumberingExport.cxx @@ -140,7 +140,8 @@ void XMLLineNumberingExport::Export() if (nLength != 0) { OUStringBuffer sBuf; - rExport.GetMM100UnitConverter().convertMeasure(sBuf, nLength); + rExport.GetMM100UnitConverter().convertMeasureToXML( + sBuf, nLength); rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_OFFSET, sBuf.makeStringAndClear()); } diff --git a/xmloff/source/text/XMLLineNumberingImportContext.cxx b/xmloff/source/text/XMLLineNumberingImportContext.cxx index 1378a3d856a6..d355085fc300 100644 --- a/xmloff/source/text/XMLLineNumberingImportContext.cxx +++ b/xmloff/source/text/XMLLineNumberingImportContext.cxx @@ -179,7 +179,7 @@ void XMLLineNumberingImportContext::ProcessAttribute( case XML_TOK_LINENUMBERING_OFFSET: if (GetImport().GetMM100UnitConverter(). - convertMeasure(nTmp, sValue)) + convertMeasureToCore(nTmp, sValue)) { nOffset = nTmp; } diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx index d26a5b8e0e93..2c9c981ea56b 100644 --- a/xmloff/source/text/XMLSectionExport.cxx +++ b/xmloff/source/text/XMLSectionExport.cxx @@ -1490,7 +1490,7 @@ void XMLSectionExport::ExportIndexTemplateElement( { // position for left tabs (convert to measure) OUStringBuffer sBuf; - GetExport().GetMM100UnitConverter().convertMeasure(sBuf, + GetExport().GetMM100UnitConverter().convertMeasureToXML(sBuf, nTabPosition); GetExport().AddAttribute(XML_NAMESPACE_STYLE, XML_POSITION, diff --git a/xmloff/source/text/XMLTextColumnsContext.cxx b/xmloff/source/text/XMLTextColumnsContext.cxx index a6e3d52c946c..98bdf4cb7eed 100644 --- a/xmloff/source/text/XMLTextColumnsContext.cxx +++ b/xmloff/source/text/XMLTextColumnsContext.cxx @@ -167,13 +167,13 @@ XMLTextColumnContext_Impl::XMLTextColumnContext_Impl( break; case XML_TOK_COLUMN_MARGIN_LEFT: if( GetImport().GetMM100UnitConverter(). - convertMeasure( nVal, rValue ) ) + convertMeasureToCore( nVal, rValue ) ) aColumn.LeftMargin = nVal; break; case XML_TOK_COLUMN_MARGIN_RIGHT: if( GetImport().GetMM100UnitConverter(). - convertMeasure( nVal, rValue ) ) + convertMeasureToCore( nVal, rValue ) ) aColumn.RightMargin = nVal; break; default: @@ -246,7 +246,7 @@ XMLTextColumnSepContext_Impl::XMLTextColumnSepContext_Impl( { case XML_TOK_COLUMN_SEP_WIDTH: if( GetImport().GetMM100UnitConverter(). - convertMeasure( nVal, rValue ) ) + convertMeasureToCore( nVal, rValue ) ) nWidth = nVal; break; case XML_TOK_COLUMN_SEP_HEIGHT: @@ -336,7 +336,7 @@ XMLTextColumnsContext::XMLTextColumnsContext( else if( IsXMLToken( aLocalName, XML_COLUMN_GAP ) ) { bAutomatic = GetImport().GetMM100UnitConverter(). - convertMeasure( nAutomaticDistance, rValue ); + convertMeasureToCore( nAutomaticDistance, rValue ); } } } diff --git a/xmloff/source/text/XMLTextColumnsExport.cxx b/xmloff/source/text/XMLTextColumnsExport.cxx index 18c4f74a2cb1..aef8d1a4fe1a 100644 --- a/xmloff/source/text/XMLTextColumnsExport.cxx +++ b/xmloff/source/text/XMLTextColumnsExport.cxx @@ -92,7 +92,7 @@ void XMLTextColumnsExport::exportXML( const Any& rAny ) sal_Int32 nDistance = 0; aAny >>= nDistance; OUStringBuffer aBuffer; - GetExport().GetMM100UnitConverter().convertMeasure( + GetExport().GetMM100UnitConverter().convertMeasureToXML( aBuffer, nDistance ); GetExport().AddAttribute( XML_NAMESPACE_FO, XML_COLUMN_GAP, @@ -112,7 +112,7 @@ void XMLTextColumnsExport::exportXML( const Any& rAny ) aAny = xPropSet->getPropertyValue( sSeparatorLineWidth ); sal_Int32 nWidth = 0; aAny >>= nWidth; - GetExport().GetMM100UnitConverter().convertMeasure( sValue, + GetExport().GetMM100UnitConverter().convertMeasureToXML( sValue, nWidth ); GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_WIDTH, sValue.makeStringAndClear() ); @@ -186,13 +186,13 @@ void XMLTextColumnsExport::exportXML( const Any& rAny ) sValue.makeStringAndClear() ); // fo:margin-left - GetExport().GetMM100UnitConverter().convertMeasure( sValue, + GetExport().GetMM100UnitConverter().convertMeasureToXML( sValue, pColumns->LeftMargin ); GetExport().AddAttribute( XML_NAMESPACE_FO, XML_START_INDENT, sValue.makeStringAndClear() ); // fo:margin-right - GetExport().GetMM100UnitConverter().convertMeasure( sValue, + GetExport().GetMM100UnitConverter().convertMeasureToXML( sValue, pColumns->RightMargin ); GetExport().AddAttribute( XML_NAMESPACE_FO, XML_END_INDENT, sValue.makeStringAndClear() ); diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 0ba202c465ce..a4c5af402dca 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -280,20 +280,18 @@ XMLTextFrameContourContext_Impl::XMLTextFrameContourContext_Impl( sPoints = rValue; break; case XML_TOK_TEXT_CONTOUR_WIDTH: - if( GetImport().GetMM100UnitConverter().convertMeasurePx( nWidth, - rValue) ) + if (::sax::Converter::convertMeasurePx(nWidth, rValue)) bPixelWidth = sal_True; else - GetImport().GetMM100UnitConverter().convertMeasure( nWidth, - rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + nWidth, rValue); break; case XML_TOK_TEXT_CONTOUR_HEIGHT: - if( GetImport().GetMM100UnitConverter().convertMeasurePx( nHeight, - rValue) ) + if (::sax::Converter::convertMeasurePx(nHeight, rValue)) bPixelHeight = sal_True; else - GetImport().GetMM100UnitConverter().convertMeasure( nHeight, - rValue); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + nHeight, rValue); break; case XML_TOK_TEXT_CONTOUR_AUTO: bAuto = IsXMLToken(rValue, XML_TRUE); @@ -914,10 +912,12 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( } break; case XML_TOK_TEXT_FRAME_X: - GetImport().GetMM100UnitConverter().convertMeasure( nX, rValue ); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + nX, rValue); break; case XML_TOK_TEXT_FRAME_Y: - GetImport().GetMM100UnitConverter().convertMeasure( nY, rValue ); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + nY, rValue ); break; case XML_TOK_TEXT_FRAME_WIDTH: // relative widths are obsolete since SRC617. Remove them some day! @@ -929,8 +929,8 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( } else { - GetImport().GetMM100UnitConverter().convertMeasure( nWidth, - rValue, 0 ); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + nWidth, rValue, 0 ); } break; case XML_TOK_TEXT_FRAME_REL_WIDTH: @@ -954,8 +954,8 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( } else { - GetImport().GetMM100UnitConverter().convertMeasure( nWidth, - rValue, 0 ); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + nWidth, rValue, 0 ); } bMinWidth = sal_True; break; @@ -969,8 +969,8 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( } else { - GetImport().GetMM100UnitConverter().convertMeasure( nHeight, - rValue, 0 ); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + nHeight, rValue, 0 ); } break; case XML_TOK_TEXT_FRAME_REL_HEIGHT: @@ -999,8 +999,8 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( } else { - GetImport().GetMM100UnitConverter().convertMeasure( nHeight, - rValue, 0 ); + GetImport().GetMM100UnitConverter().convertMeasureToCore( + nHeight, rValue, 0 ); } bMinHeight = sal_True; break; diff --git a/xmloff/source/text/XMLTextShapeImportHelper.cxx b/xmloff/source/text/XMLTextShapeImportHelper.cxx index 17f359bbab36..515a3063ce9a 100644 --- a/xmloff/source/text/XMLTextShapeImportHelper.cxx +++ b/xmloff/source/text/XMLTextShapeImportHelper.cxx @@ -127,7 +127,7 @@ void XMLTextShapeImportHelper::addShape( } break; case XML_TOK_TEXT_FRAME_Y: - rImport.GetMM100UnitConverter().convertMeasure( nY, rValue ); + rImport.GetMM100UnitConverter().convertMeasureToCore( nY, rValue ); break; } } diff --git a/xmloff/source/text/txtdrope.cxx b/xmloff/source/text/txtdrope.cxx index 13d2bc0b0cf4..5d093c30f4fe 100644 --- a/xmloff/source/text/txtdrope.cxx +++ b/xmloff/source/text/txtdrope.cxx @@ -89,7 +89,7 @@ void XMLTextDropCapExport::exportXML( const Any& rAny, // style:distance if( aFormat.Distance > 0 ) { - rUnitConv.convertMeasure( sBuffer, aFormat.Distance ); + rUnitConv.convertMeasureToXML( sBuffer, aFormat.Distance ); rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_DISTANCE, sBuffer.makeStringAndClear() ); } diff --git a/xmloff/source/text/txtdropi.cxx b/xmloff/source/text/txtdropi.cxx index 0bcae66af819..0a358b6b13d1 100644 --- a/xmloff/source/text/txtdropi.cxx +++ b/xmloff/source/text/txtdropi.cxx @@ -111,7 +111,8 @@ void XMLTextDropCapImportContext::ProcessAttrs( break; case XML_TOK_DROP_DISTANCE: - if( GetImport().GetMM100UnitConverter().convertMeasure( nTmp, rValue, 0 ) ) + if (GetImport().GetMM100UnitConverter().convertMeasureToCore( + nTmp, rValue, 0 )) { aFormat.Distance = (sal_uInt16)nTmp; } diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index b728f33ec87f..14501ae9f498 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -2542,7 +2542,8 @@ sal_Int32 XMLTextParagraphExport::addTextFrameAttributes( { sal_Int32 nPos = 0; rPropSet->getPropertyValue( sHoriOrientPosition ) >>= nPos; - GetExport().GetMM100UnitConverter().convertMeasure( sValue, nPos ); + GetExport().GetMM100UnitConverter().convertMeasureToXML( + sValue, nPos ); GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_X, sValue.makeStringAndClear() ); } @@ -2559,7 +2560,8 @@ sal_Int32 XMLTextParagraphExport::addTextFrameAttributes( { sal_Int32 nPos = 0; rPropSet->getPropertyValue( sVertOrientPosition ) >>= nPos; - GetExport().GetMM100UnitConverter().convertMeasure( sValue, nPos ); + GetExport().GetMM100UnitConverter().convertMeasureToXML( + sValue, nPos ); GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_Y, sValue.makeStringAndClear() ); } @@ -2584,7 +2586,7 @@ sal_Int32 XMLTextParagraphExport::addTextFrameAttributes( { rPropSet->getPropertyValue( sWidth ) >>= nWidth; } - GetExport().GetMM100UnitConverter().convertMeasure( sValue, nWidth ); + GetExport().GetMM100UnitConverter().convertMeasureToXML(sValue, nWidth); if( SizeType::FIX != nWidthType ) GetExport().AddAttribute( XML_NAMESPACE_FO, XML_MIN_WIDTH, sValue.makeStringAndClear() ); @@ -2637,7 +2639,7 @@ sal_Int32 XMLTextParagraphExport::addTextFrameAttributes( { rPropSet->getPropertyValue( sHeight ) >>= nHeight; } - GetExport().GetMM100UnitConverter().convertMeasure( sValue, + GetExport().GetMM100UnitConverter().convertMeasureToXML( sValue, nHeight ); if( SizeType::FIX != nSizeType && 0==nRelHeight && !bSyncHeight && pMinHeightValue ) @@ -2890,17 +2892,27 @@ void XMLTextParagraphExport::exportContour( // svg: width OUStringBuffer aStringBuffer( 10 ); if( bPixel ) - GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, aSize.Width); + { + ::sax::Converter::convertMeasurePx(aStringBuffer, aSize.Width); + } else - GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, aSize.Width); + { + GetExport().GetMM100UnitConverter().convertMeasureToXML( + aStringBuffer, aSize.Width); + } GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH, aStringBuffer.makeStringAndClear() ); // svg: height if( bPixel ) - GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, aSize.Height); + { + ::sax::Converter::convertMeasurePx(aStringBuffer, aSize.Height); + } else - GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, aSize.Height); + { + GetExport().GetMM100UnitConverter().convertMeasureToXML( + aStringBuffer, aSize.Height); + } GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT, aStringBuffer.makeStringAndClear() ); diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx index 59bd7a366b23..bbbe1096341e 100644 --- a/xmloff/source/transform/TransformerBase.cxx +++ b/xmloff/source/transform/TransformerBase.cxx @@ -32,6 +32,8 @@ #include <rtl/ustrbuf.hxx> #include <com/sun/star/i18n/XCharacterClassification.hpp> #include <com/sun/star/i18n/UnicodeType.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> +#include <sax/tools/converter.hxx> #include <comphelper/processfactory.hxx> #include <xmloff/nmspmap.hxx> #include "xmloff/xmlnmspe.hxx" @@ -46,7 +48,6 @@ #include "ElemTransformerAction.hxx" #include "PropertyActionsOOo.hxx" #include "TransformerTokenMap.hxx" -#include <xmloff/xmluconv.hxx> #include "TransformerBase.hxx" #include "TContextVector.hxx" @@ -55,6 +56,7 @@ using ::rtl::OUString; using ::rtl::OUStringBuffer; using namespace ::osl; using namespace ::xmloff::token; +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; @@ -501,16 +503,14 @@ void SAL_CALL XMLTransformerBase::initialize( const Sequence< Any >& aArguments } } -static MapUnit lcl_getUnit( const OUString& rValue ) +static sal_Int16 lcl_getUnit( const OUString& rValue ) { - MapUnit nDestUnit; if( rValue.endsWithIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "cm" ) ) ) - nDestUnit = MAP_CM; + return util::MeasureUnit::CM; else if ( rValue.endsWithIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "mm" ) ) ) - nDestUnit = MAP_MM; + return util::MeasureUnit::MM; else - nDestUnit = MAP_INCH; - return nDestUnit; + return util::MeasureUnit::INCH; } XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList( @@ -597,11 +597,12 @@ XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList( XMLTransformerBase::ReplaceSingleInchWithIn( aAttrValue ); if( isWriter() ) { - MapUnit nDestUnit = lcl_getUnit( aAttrValue ); + sal_Int16 const nDestUnit = lcl_getUnit(aAttrValue); // convert twips value to inch sal_Int32 nMeasure; - if( SvXMLUnitConverter::convertMeasure(nMeasure, aAttrValue, MAP_100TH_MM ) ) + if (::sax::Converter::convertMeasure(nMeasure, + aAttrValue, util::MeasureUnit::MM_100TH)) { // #i13778#,#i36248# apply correct twip-to-1/100mm @@ -610,7 +611,9 @@ XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList( : ((nMeasure*127-36)/72) ); rtl::OUStringBuffer aBuffer; - SvXMLUnitConverter::convertMeasure( aBuffer, nMeasure, MAP_100TH_MM, nDestUnit ); + ::sax::Converter::convertMeasure(aBuffer, + nMeasure, util::MeasureUnit::MM_100TH, + nDestUnit ); aAttrValue = aBuffer.makeStringAndClear(); } } @@ -757,11 +760,12 @@ XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList( if( isWriter() ) { - MapUnit nDestUnit = lcl_getUnit( aAttrValue ); + sal_Int16 const nDestUnit = lcl_getUnit(aAttrValue); // convert inch value to twips and export as faked inch sal_Int32 nMeasure; - if( SvXMLUnitConverter::convertMeasure(nMeasure, aAttrValue, MAP_100TH_MM ) ) + if (::sax::Converter::convertMeasure(nMeasure, + aAttrValue, util::MeasureUnit::MM_100TH)) { // #i13778#,#i36248#/ apply correct 1/100mm-to-twip conversion @@ -770,7 +774,9 @@ XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList( : ((nMeasure*72-63)/127) ); OUStringBuffer aBuffer; - SvXMLUnitConverter::convertMeasure( aBuffer, nMeasure, MAP_100TH_MM, nDestUnit ); + ::sax::Converter::convertMeasure( aBuffer, + nMeasure, util::MeasureUnit::MM_100TH, + nDestUnit ); aAttrValue = aBuffer.makeStringAndClear(); } } @@ -783,10 +789,11 @@ XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList( OUString aAttrValue( rAttrValue ); ReplaceSingleInchWithIn( aAttrValue ); - MapUnit nDestUnit = lcl_getUnit( aAttrValue ); + sal_Int16 const nDestUnit = lcl_getUnit( aAttrValue ); sal_Int32 nMeasure; - if( SvXMLUnitConverter::convertMeasure(nMeasure, aAttrValue, MAP_100TH_MM ) ) + if (::sax::Converter::convertMeasure(nMeasure, + aAttrValue, util::MeasureUnit::MM_100TH)) { if( nMeasure > 0 ) @@ -796,7 +803,8 @@ XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList( OUStringBuffer aBuffer; - SvXMLUnitConverter::convertMeasure( aBuffer, nMeasure, MAP_100TH_MM, nDestUnit ); + ::sax::Converter::convertMeasure(aBuffer, nMeasure, + util::MeasureUnit::MM_100TH, nDestUnit); aAttrValue = aBuffer.makeStringAndClear(); } @@ -808,10 +816,11 @@ XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList( OUString aAttrValue( rAttrValue ); ReplaceSingleInWithInch( aAttrValue ); - MapUnit nDestUnit = lcl_getUnit( aAttrValue ); + sal_Int16 const nDestUnit = lcl_getUnit( aAttrValue ); sal_Int32 nMeasure; - if( SvXMLUnitConverter::convertMeasure(nMeasure, aAttrValue, MAP_100TH_MM ) ) + if (::sax::Converter::convertMeasure(nMeasure, + aAttrValue, util::MeasureUnit::MM_100TH)) { if( nMeasure > 0 ) @@ -821,7 +830,8 @@ XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList( OUStringBuffer aBuffer; - SvXMLUnitConverter::convertMeasure( aBuffer, nMeasure, MAP_100TH_MM, nDestUnit ); + ::sax::Converter::convertMeasure(aBuffer, nMeasure, + util::MeasureUnit::MM_100TH, nDestUnit ); aAttrValue = aBuffer.makeStringAndClear(); } |