summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2023-12-12 16:46:49 -0500
committerXisco Fauli <xiscofauli@libreoffice.org>2023-12-19 18:58:02 +0100
commitee4a371e7cd6029978260b7692fe5b5db00dce8b (patch)
tree1091ee81c07518d3b90a652d20203ad82b4f4f61 /sw
parent7eac2d2fded789a3dd64b738d816ce0b6270decc (diff)
tdf#158583 tdf#158586 RTF writerfilter: only startRun for real frame
This fixes a LO 7.6.4 regression of a lost page break, as well as another example where part of the paragraph moves to next page, from mstahl's commit 4e2f2489c4c7436f8b3a21a530bc625cbef4e365 It seems likely that the run should only be checked when we know that there is a real frame here, which essentially becomes a run for most purposes (except perhaps for page breaks - as seen for DOCX). This code block was introduced with commit 0d9132c5046e15540abc20e45d64080708626441 Author: Miklos Vajna on Sat Mar 24 13:04:54 2012 +0100 fdo#47036 fix RTF import of shapes inside text frames at the start of the doc and in the other block of touched code, it did test inFrame. The unit test works when compiling right after the regression, but has broken because of tdf#153194. Since this will get backported way back and all over, it is a good time to introduce rtfexport8. make CppunitTest_sw_rtfexport8 CPPUNIT_TEST_NAME=testTdf158586_0 make CppunitTest_sw_rtfexport8 CPPUNIT_TEST_NAME=testTdf158586_1 Change-Id: Ib4b75efb8422d96e693da337cbef97520e975f3f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160655 Reviewed-by: Justin Luth <jluth@mail.com> Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit 0984b022aab805571f40bdefad6e418cdfe69a81) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160939 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit da8f10f1cc13fd53a9af185e2506bc14d901e907) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160945
Diffstat (limited to 'sw')
-rw-r--r--sw/CppunitTest_sw_rtfexport8.mk14
-rw-r--r--sw/Module_sw.mk1
-rw-r--r--sw/qa/extras/rtfexport/data/tdf158586_pageBreak0.rtf15
-rw-r--r--sw/qa/extras/rtfexport/data/tdf158586_pageBreak1.rtf15
-rw-r--r--sw/qa/extras/rtfexport/rtfexport8.cxx72
5 files changed, 117 insertions, 0 deletions
diff --git a/sw/CppunitTest_sw_rtfexport8.mk b/sw/CppunitTest_sw_rtfexport8.mk
new file mode 100644
index 000000000000..9f0a2d85ab4f
--- /dev/null
+++ b/sw/CppunitTest_sw_rtfexport8.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_rtfexport_test,8))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 5be870597a2c..c8c8b964dde6 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -67,6 +67,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
CppunitTest_sw_rtfexport5 \
CppunitTest_sw_rtfexport6 \
CppunitTest_sw_rtfexport7 \
+ CppunitTest_sw_rtfexport8 \
CppunitTest_sw_docbookexport \
CppunitTest_sw_fodfexport \
CppunitTest_sw_htmlexport \
diff --git a/sw/qa/extras/rtfexport/data/tdf158586_pageBreak0.rtf b/sw/qa/extras/rtfexport/data/tdf158586_pageBreak0.rtf
new file mode 100644
index 000000000000..53c619265156
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf158586_pageBreak0.rtf
@@ -0,0 +1,15 @@
+{\rtf1
+
+\paperw8419\paperh5953
+
+\spltpgpar
+
+\ltrpar \sectd
+
+\pard\plain \wraptight
+
+\page \sect \sectd \sbknone
+
+\pard\plain First page
+\par
+}
diff --git a/sw/qa/extras/rtfexport/data/tdf158586_pageBreak1.rtf b/sw/qa/extras/rtfexport/data/tdf158586_pageBreak1.rtf
new file mode 100644
index 000000000000..bc09fe02aa2f
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf158586_pageBreak1.rtf
@@ -0,0 +1,15 @@
+{\rtf1
+
+\paperw8419\paperh5953
+
+\spltpgpar
+
+\ltrpar \sectd
+
+\pard\plain \wrapdefault\pvmrg\posxl\absw0\absh0\phcol \posyil\abslock\dxfrtext10
+
+\page \sect \sectd \sbknone
+
+\pard\plain Second page
+\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx b/sw/qa/extras/rtfexport/rtfexport8.cxx
new file mode 100644
index 000000000000..80309ff9b65e
--- /dev/null
+++ b/sw/qa/extras/rtfexport/rtfexport8.cxx
@@ -0,0 +1,72 @@
+/* -*- 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/text/XFootnote.hpp>
+#include <com/sun/star/text/XFootnotesSupplier.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/text/XEndnotesSupplier.hpp>
+#include <com/sun/star/text/XTextFieldsSupplier.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/style/TabStop.hpp>
+
+#include <comphelper/sequenceashashmap.hxx>
+#include <tools/UnitConversion.hxx>
+#include <comphelper/propertyvalue.hxx>
+
+#include <unotxdoc.hxx>
+#include <docsh.hxx>
+#include <wrtsh.hxx>
+#include <fmtpdsc.hxx>
+#include <IDocumentContentOperations.hxx>
+#include <IDocumentSettingAccess.hxx>
+#include <itabenum.hxx>
+#include <frmmgr.hxx>
+#include <formatflysplit.hxx>
+#include <fmtwrapinfluenceonobjpos.hxx>
+
+using namespace css;
+
+class Test : public SwModelTestBase
+{
+public:
+ Test()
+ : SwModelTestBase("/sw/qa/extras/rtfexport/data/", "Rich Text Format")
+ {
+ }
+};
+
+DECLARE_RTFEXPORT_TEST(testTdf158586_0, "tdf158586_pageBreak0.rtf")
+{
+ // The specified page break must be lost because it is in a text frame
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+ // CPPUNIT_ASSERT_EQUAL(1, getParagraphs());
+
+ // There should be no empty carriage return at the start of the second page
+ // const auto& pLayout = parseLayoutDump();
+ // assertXPathContent(pLayout, "//page[1]/body/txt"_ostr, "First page");}
+}
+
+DECLARE_RTFEXPORT_TEST(testTdf158586_1, "tdf158586_pageBreak1.rtf")
+{
+ // None of the specified text frame settings initiates a real text frame - page break not lost
+ // CPPUNIT_ASSERT_EQUAL(2, getPages());
+ // CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
+
+ // There should be no empty carriage return at the start of the second page
+ // const auto& pLayout = parseLayoutDump();
+ // assertXPathContent(pLayout, "//page[2]/body/txt"_ostr, "Second page");
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */