summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ooxmlimport
diff options
context:
space:
mode:
authorAttila Szűcs <szucs.attila3@nisz.hu>2021-02-03 16:50:30 +0100
committerLászló Németh <nemeth@numbertext.org>2021-02-15 11:33:10 +0100
commitb35f48d806f9e5ec689eda3828f1e4503644873b (patch)
treeadaf0fb3291aa1455a544a33d6a3dbe09afb191d /sw/qa/extras/ooxmlimport
parent76483d1348792a3d1c4c995ef0132ac79dfbc90f (diff)
tdf#74367 DOCX: fix page margins imported as border padding
Trying to import non-existing "none" borders of w:pgBorders zeroed page margins, removing their values to border padding. Note: according to OOXML standard 2.6.10. pgBorders (Page Borders), "nil" should be treated the same. Co-authored-by: Tibor Nagy (NISZ) Change-Id: Ibbc9375b2f8b3daf7b4bdea84e078676ce588586 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110396 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa/extras/ooxmlimport')
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf74367_MarginsZeroed.docxbin0 -> 12600 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx15
2 files changed, 15 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf74367_MarginsZeroed.docx b/sw/qa/extras/ooxmlimport/data/tdf74367_MarginsZeroed.docx
new file mode 100644
index 000000000000..9b9eb1c43965
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf74367_MarginsZeroed.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index cf9781f00606..16351d9fcb35 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -459,6 +459,21 @@ DECLARE_OOXMLIMPORT_TEST(testN758883, "n758883.docx")
CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, eAnchorType);
}
+DECLARE_OOXMLIMPORT_TEST(testTdf74367_MarginsZeroed, "tdf74367_MarginsZeroed.docx")
+{
+ // Do not import page borders with 'None' style, or else it will change the page margins.
+ uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
+ sal_Int32 nValue = 0;
+ xPropertySet->getPropertyValue("TopMargin") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2501), nValue);
+ xPropertySet->getPropertyValue("RightMargin") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2501), nValue);
+ xPropertySet->getPropertyValue("BottomMargin") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2501), nValue);
+ xPropertySet->getPropertyValue("LeftMargin") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2501), nValue);
+}
+
DECLARE_OOXMLIMPORT_TEST(testBnc773061, "bnc773061.docx")
{
uno::Reference< text::XTextRange > paragraph = getParagraph( 1 );