[Libreoffice-commits] core.git: sw/qa writerfilter/source
Oliver Specht
oliver.specht at cib.de
Fri Sep 11 05:00:42 PDT 2015
sw/qa/extras/ooxmlimport/data/indents.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 38 +++++++++++++++++++--
writerfilter/source/ooxml/OOXMLPropertySetImpl.cxx | 2 -
3 files changed, 37 insertions(+), 3 deletions(-)
New commits:
commit 2062d5d6f472ffa22ab4a769f4cb992f3a91894c
Author: Oliver Specht <oliver.specht at cib.de>
Date: Fri Sep 11 10:30:45 2015 +0200
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 at libreoffice.org>
Reviewed-by: Oliver Specht <oliver.specht at cib.de>
diff --git a/sw/qa/extras/ooxmlimport/data/indents.docx b/sw/qa/extras/ooxmlimport/data/indents.docx
new file mode 100755
index 0000000..b167367
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/indents.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index a32dd90..0f43ba9 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 81d5bd0..b958834 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 &&
More information about the Libreoffice-commits
mailing list