summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2024-01-19 13:50:36 -0500
committerXisco Fauli <xiscofauli@libreoffice.org>2024-01-22 22:19:58 +0100
commit15d19f48dc9eaf74d37b3da36a4bfc68be483547 (patch)
tree2a7a132c55f74a7ef824d47a7284973a468d3328 /sw
parent3fd80b31eb997847e04571b21ec512928a70bf81 (diff)
tdf#153909 docx import: wrap through shapes shouldn't FollowTextFlow
This resolves a NISZ 6.4.0 regression from commit 27d04f6dbf38aa28fb7215590d578c4567db5770 tdf#119038 DOCX: fix FollowTextFlow handling MSO is all over the place in how they implement layoutInCell (aka FollowTextFlow in LO). There are lots of compat15 differences for this, but I don't notice compat coming into play with this bug. For reference, see commit e993638d5ecd33783f2eebdccfa87a81e5a8a2c5 Author: Miklos Vajna on Mon Jan 24 12:53:25 2022 +0100 DOCX import: fix <wp:anchor layoutInCell="1"> with <wp:wrapNone> I'm sure this is the WRONG code spot for handling FollowTextFlow, but anywhere else and we lose the "it came from a vml shape" limiting information, so I'm not going to try to relocate this code. Inline (as-character) shapes ignore layoutInCell, so the type of anchor (floating or inline) shouldn't matter and therefore doesn't need to be part of the if () clause. The header can be special (in compat14 it means everything is wrap through), but at least in this case it is not limited to IsInHeaderHeader. Using a non-header as the unit test. make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf153909_followTextFlow The first patchset contains a list of all of the unit tests that were impacted by this patch: nothing interesting. Change-Id: I0c4c7924833550533ad1b0b7609840a666d4d589 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162324 Reviewed-by: Justin Luth <jluth@mail.com> Tested-by: Jenkins (cherry picked from commit ad0266eb84eafa32ccc4e0ddf3c6392860bc9b13) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162286 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162410 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/CppunitTest_sw_ooxmlexport21.mk14
-rw-r--r--sw/Module_sw.mk1
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf153909_followTextFlow.docxbin0 -> 23909 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport21.cxx50
4 files changed, 65 insertions, 0 deletions
diff --git a/sw/CppunitTest_sw_ooxmlexport21.mk b/sw/CppunitTest_sw_ooxmlexport21.mk
new file mode 100644
index 000000000000..999314b9c6c4
--- /dev/null
+++ b/sw/CppunitTest_sw_ooxmlexport21.mk
@@ -0,0 +1,14 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call sw_ooxmlexport_test,21))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 9b81a6f961fa..ab92e8d11571 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -94,6 +94,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
CppunitTest_sw_ooxmlexport17 \
CppunitTest_sw_ooxmlexport18 \
CppunitTest_sw_ooxmlexport19 \
+ CppunitTest_sw_ooxmlexport21 \
CppunitTest_sw_ooxmlexport_template \
CppunitTest_sw_ooxmlfieldexport \
CppunitTest_sw_ooxmllinks \
diff --git a/sw/qa/extras/ooxmlexport/data/tdf153909_followTextFlow.docx b/sw/qa/extras/ooxmlexport/data/tdf153909_followTextFlow.docx
new file mode 100644
index 000000000000..712e37aceabd
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf153909_followTextFlow.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
new file mode 100644
index 000000000000..9f6de0d155d5
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <swmodeltestbase.hxx>
+
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/text/XDocumentIndex.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/LineSpacingMode.hpp>
+
+#include <pam.hxx>
+#include <unotxdoc.hxx>
+#include <docsh.hxx>
+
+namespace
+{
+class Test : public SwModelTestBase
+{
+public:
+ Test()
+ : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open XML Text")
+ {
+ }
+};
+
+DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, "tdf153909_followTextFlow.docx")
+{
+ // Although MSO's UI reports "layoutInCell" for the rectangle, it isn't specified or honored
+ CPPUNIT_ASSERT(!getProperty<bool>(getShape(1), "IsFollowingTextFlow"));
+
+ // Given a table with a rectangle anchored in it (wrap-through) that appears above the table...
+ xmlDocUniquePtr pDump = parseLayoutDump();
+ sal_Int32 nRectBottom
+ = getXPath(pDump, "//anchored/SwAnchoredDrawObject/bounds", "bottom").toInt32();
+ sal_Int32 nTableTop = getXPath(pDump, "//tab/row/infos/bounds", "top").toInt32();
+ // The entire table must be below the rectangle
+ CPPUNIT_ASSERT(nTableTop > nRectBottom);
+}
+
+} // end of anonymous namespace
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */