From 8666469d7b0f450ec1448f80eda3c591f8d8d318 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 11 Oct 2011 14:19:09 +0200 Subject: #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 :) --- xmloff/source/style/xmlnume.cxx | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'xmloff/source/style/xmlnume.cxx') 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() ); -- cgit