[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa writerfilter/qa writerfilter/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jul 1 09:48:03 UTC 2020
sw/qa/uibase/shells/shells.cxx | 4 +-
writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx | 17 ++++++++++
writerfilter/qa/cppunittests/dmapper/data/draw-shape-inline-effect.docx |binary
writerfilter/source/dmapper/GraphicImport.cxx | 1
4 files changed, 20 insertions(+), 2 deletions(-)
New commits:
commit b3446f2dbe513ff3ca6a54bf3845df7a0787f61c
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Feb 11 09:51:14 2020 +0100
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Wed Jul 1 11:47:29 2020 +0200
DOCX import: fix margins of inline shapes with effects, imported as Draw shapes
Effects have an extent, and unhandled effects (like this blurred shadow)
need to take space in the margin of the shape to make sure they use the
correct amount of space in the layout.
This was working in general, but not in case the importer decided to
import the shape as Draw shape + the shape was inline.
(And also disable a new CppunitTest_sw_uibase_shells test on Windows,
which is only stable on Linux, it seems.)
Change-Id: I9d0531d9393d8c2cd274e6f54bbbfe8024bf270f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88427
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
(cherry picked from commit bf25e69f8f657d5e3bcdd0bd54c5fa0d66ec85fe)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96234
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx
index 05b5c6b5e27b..376f95b18c59 100644
--- a/sw/qa/uibase/shells/shells.cxx
+++ b/sw/qa/uibase/shells/shells.cxx
@@ -81,8 +81,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testTdf130179)
CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testShapeTextAlignment)
{
-// FIXME find out why this fails on macOS
-#ifndef MACOSX
+// FIXME find out why this fails on macOS/Windows
+#if !defined(MACOSX) && !defined(_WIN32)
// Create a document with a rectangle in it.
SwDoc* pDoc = createDoc();
SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
diff --git a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx
index d2143a2366c4..f20694b828cc 100644
--- a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx
+++ b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx
@@ -90,6 +90,23 @@ CPPUNIT_TEST_FIXTURE(Test, testRelfromhInsidemargin)
xShape->getPropertyValue("PageToggle") >>= bPageToggle;
CPPUNIT_ASSERT(bPageToggle);
}
+
+CPPUNIT_TEST_FIXTURE(Test, testDrawShapeInlineEffect)
+{
+ OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "draw-shape-inline-effect.docx";
+ getComponent() = loadFromDesktop(aURL);
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(getComponent(), uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+ uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
+ sal_Int32 nBottomMargin = 0;
+ xShape->getPropertyValue("BottomMargin") >>= nBottomMargin;
+ // 273 in mm100 is 98425 EMUs from the file.
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 273
+ // - Actual : 0
+ // i.e. the layout result had less pages than expected (compared to Word).
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(273), nBottomMargin);
+}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/qa/cppunittests/dmapper/data/draw-shape-inline-effect.docx b/writerfilter/qa/cppunittests/dmapper/data/draw-shape-inline-effect.docx
new file mode 100644
index 000000000000..3eb5b0e2f448
Binary files /dev/null and b/writerfilter/qa/cppunittests/dmapper/data/draw-shape-inline-effect.docx differ
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index a2c19383c95d..b69f4565fb13 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -897,6 +897,7 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
else if (bUseShape && m_pImpl->eGraphicImportType == IMPORT_AS_DETECTED_INLINE)
{
uno::Reference< beans::XPropertySet > xShapeProps(m_xShape, uno::UNO_QUERY_THROW);
+ m_pImpl->applyMargins(xShapeProps);
comphelper::SequenceAsHashMap aInteropGrabBag(xShapeProps->getPropertyValue("InteropGrabBag"));
aInteropGrabBag.update(m_pImpl->getInteropGrabBag());
xShapeProps->setPropertyValue("InteropGrabBag", uno::makeAny(aInteropGrabBag.getAsConstPropertyValueList()));
More information about the Libreoffice-commits
mailing list