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>
This commit is contained in:
parent
cb0e8c4feb
commit
2062d5d6f4
BIN
sw/qa/extras/ooxmlimport/data/indents.docx
Executable file
BIN
sw/qa/extras/ooxmlimport/data/indents.docx
Executable file
Binary file not shown.
@ -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: */
|
||||
|
@ -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 &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user