[Libreoffice-commits] core.git: sw/qa writerfilter/source

Justin Luth justin_luth at sil.org
Tue Oct 17 16:36:08 UTC 2017


 sw/qa/extras/ooxmlexport/data/tdf79272_strictDxa.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx             |    7 +++++++
 writerfilter/source/ooxml/OOXMLPropertySet.cxx        |    6 +-----
 3 files changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 3a44d7058dd7f7addf21d9292104d7eb73ec9716
Author: Justin Luth <justin_luth at sil.org>
Date:   Sat Oct 14 11:22:10 2017 +0300

    tdf#79272 ooxmlimport: support strict dxa tblWidth
    
    This patch is also required for tdf#78508.
    
    ECMA-376-1:2016 indicates that MeasurementOrPercent
    is a union of ST_DecimalNumberOrPercent and
    ST_UniversalMeasure. For the elements that use
    MeasurementOrPercent, that is represented as
    1/50 of a percent or in Twips. This patch adds
    support for the ST_UniversalMeasure component of
    the union.
    
    Change-Id: I1bac30707f118a3d1f0eab3c27f8dcec96470592
    Reviewed-on: https://gerrit.libreoffice.org/43384
    Tested-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf79272_strictDxa.docx b/sw/qa/extras/ooxmlexport/data/tdf79272_strictDxa.docx
new file mode 100644
index 000000000000..4d5ea67bd8ea
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf79272_strictDxa.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 3587dbfd53a6..859baec2ab43 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -165,6 +165,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf106970, "tdf106970.docx")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(494), getProperty<sal_Int32>(getParagraph(4), "ParaBottomMargin"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf79272_strictDxa, "tdf79272_strictDxa.docx")
+{
+    uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(4318), getProperty<sal_Int32>(xTables->getByIndex(0), "Width"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testKern, "kern.docx")
 {
     CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(1), 1), "CharAutoKerning"));
diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.cxx b/writerfilter/source/ooxml/OOXMLPropertySet.cxx
index bd80f8dc5112..004e16f2eb6b 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySet.cxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySet.cxx
@@ -650,11 +650,7 @@ OOXMLMeasurementOrPercentValue::OOXMLMeasurementOrPercentValue(const char * pVal
     }
     else
     {
-        // TODO: also allow units. For that, we need to know
-        // how to represent the number to converter or store
-        // the value in the type as number + unit and have
-        // getter with unit specification
-        mnValue = static_cast<int>(val);
+        mnValue = OOXMLTwipsMeasureValue(pValue).getInt();
     }
 }
 


More information about the Libreoffice-commits mailing list