[Libreoffice-commits] .: 2 commits - sax/source xmloff/source

Radek Doulík rodo at kemper.freedesktop.org
Mon Nov 28 09:26:23 PST 2011


 sax/source/tools/converter.cxx  |   12 +++++-------
 xmloff/source/core/xmluconv.cxx |    2 +-
 2 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit adf84183d445b0a58a90770d681acaf4db97ff8d
Author: Radek Doulik <rodo at novell.com>
Date:   Mon Nov 28 18:25:01 2011 +0100

    fix conversions from cm

diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 198ea4d..b1629c8 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -1972,17 +1972,17 @@ double Converter::GetConversionFactor(::rtl::OUStringBuffer& rUnit, sal_Int16 nS
                 {
                     case MeasureUnit::MM_100TH:
                     {
-                        fRetval = .001;
+                        fRetval = 1000.0;
                         break;
                     }
                     case MeasureUnit::MM_10TH:
                     {
-                        fRetval = .01;
+                        fRetval = 100.0;
                         break;
                     }
                     case MeasureUnit::MM:
                     {
-                        fRetval = .1;
+                        fRetval = 10.0;
                         psUnit = gpsMM;
                         break;
                     }
@@ -1992,8 +1992,7 @@ double Converter::GetConversionFactor(::rtl::OUStringBuffer& rUnit, sal_Int16 nS
                     }
                     case MeasureUnit::POINT:
                     {
-                        // 0.01pt = 0.35 mm/100 (exactly)
-                        fRetval = 2.54 / 72.0;
+                        fRetval = 72.0 / 2.54;
                         psUnit = gpsPT;
                         break;
                     }
@@ -2001,8 +2000,7 @@ double Converter::GetConversionFactor(::rtl::OUStringBuffer& rUnit, sal_Int16 nS
                     default:
                     {
                         OSL_ENSURE( MeasureUnit::INCH == nTargetUnit, "output unit not supported for cm values");
-                        // 0.0001in = 0.254 mm/100 (exactly)
-                        fRetval = 2.54;
+                        fRetval = 1 / 2.54;
                         psUnit = gpsINCH;
                         break;
                     }
commit 7bf1fa3757133f12cf6ca624f8cee6ba5363e7d8
Author: Radek Doulik <rodo at novell.com>
Date:   Mon Nov 28 18:24:11 2011 +0100

    switch source and target units, so that it works right with sax conversions

diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
index 1cf482c..5ea85f1 100644
--- a/xmloff/source/core/xmluconv.cxx
+++ b/xmloff/source/core/xmluconv.cxx
@@ -340,7 +340,7 @@ sal_Bool SvXMLUnitConverter::convertDouble(double& rValue,
                 rString, m_pImpl->m_eCoreMeasureUnit);
 
         return ::sax::Converter::convertDouble(rValue, rString,
-            eSrcUnit, m_pImpl->m_eCoreMeasureUnit);
+            m_pImpl->m_eCoreMeasureUnit, eSrcUnit);
     }
     else
     {


More information about the Libreoffice-commits mailing list