diff options
author | Oliver Specht <oliver.specht@cib.de> | 2015-09-11 10:30:45 +0200 |
---|---|---|
committer | Oliver Specht <oliver.specht@cib.de> | 2015-09-11 12:00:19 +0000 |
commit | 2062d5d6f472ffa22ab4a769f4cb992f3a91894c (patch) | |
tree | b6653b2311fb3d0eabe06ac600a2c495e49a91c0 | |
parent | cb0e8c4feb9ef671a2305335a87b120a1077eb50 (diff) |
tdf#94045: negative margins in OOXML reenabled
OOXMLUniversalMeasureValue is an integer value and needs to be converted
to a signed integer. unit test included
Change-Id: I7fe3fdf4b8b12df55e9cea2a968b9537676687eb
Reviewed-on: https://gerrit.libreoffice.org/18496
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Oliver Specht <oliver.specht@cib.de>
-rwxr-xr-x | sw/qa/extras/ooxmlimport/data/indents.docx | bin | 0 -> 11553 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 38 | ||||
-rw-r--r-- | writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx | 2 |
3 files changed, 37 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/indents.docx b/sw/qa/extras/ooxmlimport/data/indents.docx Binary files differnew file mode 100755 index 000000000000..b16736791c2e --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/indents.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index a32dd9006ec5..0f43ba9b7572 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -18,8 +18,6 @@ #include <swmodeltestbase.hxx> -#if !defined(WNT) - #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <com/sun/star/awt/XBitmap.hpp> #include <com/sun/star/awt/FontUnderline.hpp> @@ -133,6 +131,8 @@ public: } }; +#if !defined(WNT) + DECLARE_SW_IMPORT_TEST(testMathMalformedXml, "math-malformed_xml.docx", FailTest) { CPPUNIT_ASSERT(!mxComponent.is()); @@ -2785,6 +2785,40 @@ DECLARE_OOXMLIMPORT_TEST(testTdf87924, "tdf87924.docx") #endif +DECLARE_OOXMLIMPORT_TEST(testIndents, "indents.docx") +{ + //expected left margin and first line indent values + static const sal_Int32 indents[] = + { + 0, 0, + -2000, 0, + -2000, 1000, + -1000, -1000, + 2000, -1000 + }; + uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(textDocument->getText(), uno::UNO_QUERY); + // list of paragraphs + uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); + size_t paraIndex = 0; + do + { + uno::Reference<lang::XServiceInfo> xServiceInfo; + if (xParaEnum->nextElement() >>= xServiceInfo) + { + uno::Reference<beans::XPropertySet> const xPropertySet(xServiceInfo, uno::UNO_QUERY_THROW); + sal_Int32 nIndent = 0; + sal_Int32 nFirstLine = 0; + xPropertySet->getPropertyValue("ParaLeftMargin") >>= nIndent; + xPropertySet->getPropertyValue("ParaFirstLineIndent") >>= nFirstLine; + CPPUNIT_ASSERT_EQUAL(indents[paraIndex * 2], nIndent); + CPPUNIT_ASSERT_EQUAL(indents[paraIndex * 2 + 1], nFirstLine); + ++paraIndex; + } + } while (xParaEnum->hasMoreElements()); +} + + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx b/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx index 81d5bd02402a..b95883485544 100644 --- a/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx @@ -624,7 +624,7 @@ string OOXMLHexValue::toString() const OOXMLUniversalMeasureValue::OOXMLUniversalMeasureValue(const char * pValue) { - mnValue = rtl_str_toUInt32(pValue, 10); // will ignore the trailing 'pt' + mnValue = rtl_str_toInt32(pValue, 10); // will ignore the trailing 'pt' int nLen = strlen(pValue); if (nLen > 2 && |