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 /starmath | |
parent | ae3e2f170045a1525f67e9f3e9b7e03d94f2b56b (diff) |
#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 'starmath')
-rw-r--r-- | starmath/source/mathmlexport.cxx | 6 | ||||
-rw-r--r-- | starmath/source/mathmlimport.cxx | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index 93c75f843f59..869fd0fdc879 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -51,6 +51,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> #include <com/sun/star/uno/Any.h> #include <rtl/math.hxx> @@ -391,8 +392,9 @@ sal_Bool SmXMLExportWrapper::WriteThroughComponent( SmXMLExport::SmXMLExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, sal_uInt16 nExportFlags) -: SvXMLExport( xServiceFactory, MAP_INCH, XML_MATH, nExportFlags ) , - pTree(0) , +: SvXMLExport(util::MeasureUnit::INCH, xServiceFactory, XML_MATH, + nExportFlags) +, pTree(0) , bSuccess(sal_False) { } diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index eb0b0e34e248..f3547856ee33 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -698,7 +698,7 @@ void SmXMLContext_Helper::RetrieveAttrs(const uno::Reference< case XML_TOK_FONTSIZE: ::sax::Converter::convertDouble(nFontSize, sValue); rContext.GetSmImport().GetMM100UnitConverter(). - setXMLMeasureUnit(MAP_POINT); + SetXMLMeasureUnit(util::MeasureUnit::POINT); if (-1 == sValue.indexOf(GetXMLToken(XML_UNIT_PT))) { if (-1 == sValue.indexOf('%')) @@ -706,7 +706,7 @@ void SmXMLContext_Helper::RetrieveAttrs(const uno::Reference< else { rContext.GetSmImport().GetMM100UnitConverter(). - setXMLMeasureUnit(MAP_RELATIVE); + SetXMLMeasureUnit(util::MeasureUnit::PERCENT); } } break; @@ -767,8 +767,8 @@ void SmXMLContext_Helper::ApplyAttrs() aToken.eType = TSIZE; SmFontNode *pFontNode = new SmFontNode(aToken); - if (MAP_RELATIVE == rContext.GetSmImport().GetMM100UnitConverter(). - getXMLMeasureUnit()) + if (util::MeasureUnit::PERCENT == rContext.GetSmImport() + .GetMM100UnitConverter().GetXMLMeasureUnit()) { if (nFontSize < 100.00) pFontNode->SetSizeParameter(Fraction(100.00/nFontSize), |