From f970963fd7438fe4a026febf2046a2f4430d0a9f Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Mon, 28 Nov 2011 17:50:25 +0100 Subject: added conversion from MeasureUnit::CM --- sax/source/tools/converter.cxx | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'sax') diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index e9a08c4b7d52..198ea4d14732 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -1966,6 +1966,49 @@ double Converter::GetConversionFactor(::rtl::OUStringBuffer& rUnit, sal_Int16 nS } break; } + case MeasureUnit::CM: + { + switch(nTargetUnit) + { + case MeasureUnit::MM_100TH: + { + fRetval = .001; + break; + } + case MeasureUnit::MM_10TH: + { + fRetval = .01; + break; + } + case MeasureUnit::MM: + { + fRetval = .1; + psUnit = gpsMM; + break; + } + case MeasureUnit::CM: + { + break; + } + case MeasureUnit::POINT: + { + // 0.01pt = 0.35 mm/100 (exactly) + fRetval = 2.54 / 72.0; + psUnit = gpsPT; + break; + } + case MeasureUnit::INCH: + default: + { + OSL_ENSURE( MeasureUnit::INCH == nTargetUnit, "output unit not supported for cm values"); + // 0.0001in = 0.254 mm/100 (exactly) + fRetval = 2.54; + psUnit = gpsINCH; + break; + } + } + break; + } default: OSL_ENSURE(false, "sax::Converter::GetConversionFactor(): " "source unit not supported"); -- cgit