From fccbb557add457db16e0556c3f0172cafc2cf981 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 27 Apr 2020 10:54:27 +0200 Subject: DOCX import: handle This is the same as page, but it is from-left on odd pages and from-right on even pages, i.e. our "mirror on even pages" mode. Change-Id: I018e0ac165a3d802f64cfc314d5c5f58da3cb580 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92965 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- .../qa/cppunittests/dmapper/GraphicImport.cxx | 20 ++++++++++++++++++++ .../dmapper/data/relfromh-insidemargin.docx | Bin 0 -> 16119 bytes 2 files changed, 20 insertions(+) create mode 100644 writerfilter/qa/cppunittests/dmapper/data/relfromh-insidemargin.docx (limited to 'writerfilter/qa') diff --git a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx index a98288fc40d3..590a93273e92 100644 --- a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx +++ b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx @@ -14,6 +14,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -114,6 +115,25 @@ CPPUNIT_TEST_FIXTURE(Test, testInlineInShapeAnchoredZOrder) // i.e. the image was behind the textbox that was hosting it. CPPUNIT_ASSERT_EQUAL(OUString("Picture 1"), xOval->getName()); } + +CPPUNIT_TEST_FIXTURE(Test, testRelfromhInsidemargin) +{ + OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "relfromh-insidemargin.docx"; + getComponent() = loadFromDesktop(aURL); + uno::Reference xDrawPageSupplier(getComponent(), uno::UNO_QUERY); + uno::Reference xDrawPage = xDrawPageSupplier->getDrawPage(); + uno::Reference xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + sal_Int16 nRelation = 0; + xShape->getPropertyValue("HoriOrientRelation") >>= nRelation; + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 7 (PAGE_FRAME) + // - Actual : 0 (FRAME) + // i.e. the horizontal position was relative to the paragraph area, not to the entire page. + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, nRelation); + bool bPageToggle = false; + xShape->getPropertyValue("PageToggle") >>= bPageToggle; + CPPUNIT_ASSERT(bPageToggle); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/qa/cppunittests/dmapper/data/relfromh-insidemargin.docx b/writerfilter/qa/cppunittests/dmapper/data/relfromh-insidemargin.docx new file mode 100644 index 000000000000..1f7a281e8b63 Binary files /dev/null and b/writerfilter/qa/cppunittests/dmapper/data/relfromh-insidemargin.docx differ -- cgit v1.2.3