chart2/inc/ChartModel.hxx | 2 chart2/inc/ChartView.hxx | 2 chart2/qa/extras/xshape/chart2xshape.cxx | 6 - chart2/source/controller/main/ChartController_Window.cxx | 2 chart2/source/model/main/ChartModel.cxx | 4 chart2/source/view/main/ChartView.cxx | 2 include/comphelper/dumpxmltostring.hxx | 42 +++++++++ offapi/com/sun/star/qa/XDumper.idl | 2 sw/source/uibase/inc/unotxvw.hxx | 5 + sw/source/uibase/uno/unotxvw.cxx | 19 ++++ writerfilter/CppunitTest_writerfilter_dmapper.mk | 1 writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx | 32 ++++++- writerfilter/qa/cppunittests/dmapper/data/floattable-vertical-frame-offset.rtf | 43 ++++++++++ writerfilter/source/dmapper/SettingsTable.cxx | 2 writerfilter/source/filter/WriterFilter.cxx | 1 15 files changed, 151 insertions(+), 14 deletions(-)
New commits: commit 5e430a08cb5bd3f292836c044b9700572a7d8f00 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue Oct 24 09:06:54 2023 +0200 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Thu Oct 26 09:54:10 2023 +0200 tdf#155040 sw floattable, RTF: fix table is overlapped by subsequent inline one The document had overlapping text on load since commit 05425f73bfa41d3f7591461e2ad0beb4fafc39b4 (sw floatable: teach the RTF import about SwFormatFlySplit, 2023-04-21). Interestingly the DOCX equivalent was fine, there the inline table is shifted down, below the floating table, so the overlap doesn't happen. Fix the problem by moving the AddVerticalFrameOffsets=true code from the DOCX filter to the shared dmapper, because RTF needs the same. See commit 50223ea6e212b60b7d33839c2753c5601fb50f95 (tdf#98987 sw: add AddVerticalFrameOffsets compat mode, 2016-03-31) for more details about this compat flag. It was already enabled for DOC, too. (cherry picked from commit 612629f4a81acd7b851b7eccc97aba9a5915d13c) [ The backport also contains a subset of commit 56e17186ffcda7e93530bef3a06120584bb7d579 ([API CHANGE] Merge sfx2::XmlDump into css::qa::XDumper, 2022-12-10), otherwise it's hard to verify the layout from writerfilter/. ] Conflicts: chart2/source/model/main/ChartModel.cxx chart2/source/view/main/ChartView.cxx include/comphelper/dumpxmltostring.hxx sw/source/uibase/inc/unotxvw.hxx Change-Id: I948b179c9ec5fa24377014b0e86826568c417b6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158481 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index b877e47db5e0..c80ee1487ece 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -452,7 +452,7 @@ public: virtual void SAL_CALL update() override; // XDumper - virtual OUString SAL_CALL dump() override; + virtual OUString SAL_CALL dump(const OUString& rKind) override; // normal methods css::uno::Reference< css::util::XNumberFormatsSupplier > const & diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx index 5c7e70e97900..232b030d7040 100644 --- a/chart2/inc/ChartView.hxx +++ b/chart2/inc/ChartView.hxx @@ -180,7 +180,7 @@ public: virtual ::sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< ::sal_Int8 >& aIdentifier ) override; // XDumper - virtual OUString SAL_CALL dump() override; + virtual OUString SAL_CALL dump(const OUString& rKind) override; void setViewDirty(); diff --git a/chart2/qa/extras/xshape/chart2xshape.cxx b/chart2/qa/extras/xshape/chart2xshape.cxx index 23e3f93eaafa..3592ebee02f1 100644 --- a/chart2/qa/extras/xshape/chart2xshape.cxx +++ b/chart2/qa/extras/xshape/chart2xshape.cxx @@ -81,7 +81,7 @@ OUString Chart2XShapeTest::getXShapeDumpString() uno::Reference<chart::XChartDocument> xChartDoc(getChartCompFromSheet(0, 0, mxComponent), UNO_QUERY_THROW); uno::Reference<qa::XDumper> xDumper(xChartDoc, UNO_QUERY_THROW); - return xDumper->dump(); + return xDumper->dump(""); } xmlDocUniquePtr Chart2XShapeTest::getXShapeDumpXmlDoc() @@ -133,7 +133,7 @@ void Chart2XShapeTest::testTdf149204() loadFromURL(u"pptx/tdf149204.pptx"); uno::Reference<chart::XChartDocument> xChartDoc = getChartDocFromDrawImpress(0, 0); uno::Reference<qa::XDumper> xDumper(xChartDoc, UNO_QUERY_THROW); - compareAgainstReference(xDumper->dump(), u"tdf149204.xml"); + compareAgainstReference(xDumper->dump(""), u"tdf149204.xml"); } void Chart2XShapeTest::testTdf151424() @@ -252,7 +252,7 @@ void Chart2XShapeTest::testTdf88154LabelRotatedLayout() loadFromURL(u"pptx/tdf88154_LabelRotatedLayout.pptx"); uno::Reference<chart::XChartDocument> xChartDoc = getChartDocFromDrawImpress(0, 5); uno::Reference<qa::XDumper> xDumper(xChartDoc, UNO_QUERY_THROW); - OUString rDump = xDumper->dump(); + OUString rDump = xDumper->dump(""); OString aXmlDump = OUStringToOString(rDump, RTL_TEXTENCODING_UTF8); xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast<const xmlChar*>(aXmlDump.getStr()))); diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 018419b0eacf..25910034175a 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -1563,7 +1563,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) rtl::Reference< ChartModel > xChartModel = getChartModel(); if(xChartModel.is()) { - OUString aDump = xChartModel->dump(); + OUString aDump = xChartModel->dump(""); SAL_WARN("chart2", aDump); } } diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 781fc7c8e08a..9805410eb1d4 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -1257,12 +1257,12 @@ uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > SAL_CALL ChartM } //XDumper -OUString SAL_CALL ChartModel::dump() +OUString SAL_CALL ChartModel::dump(const OUString& rKind) { uno::Reference< qa::XDumper > xDumper( createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY ); if (xDumper.is()) - return xDumper->dump(); + return xDumper->dump(rKind); return OUString(); } diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 0cb29255f06d..4bb1737133fd 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1796,7 +1796,7 @@ uno::Sequence< OUString > ChartView::getAvailableServiceNames() return aServiceNames; } -OUString ChartView::dump() +OUString ChartView::dump(const OUString& /*rKind*/) { #if HAVE_FEATURE_DESKTOP // Used for unit tests and in chartcontroller only, no need to drag in this when cross-compiling diff --git a/include/comphelper/dumpxmltostring.hxx b/include/comphelper/dumpxmltostring.hxx new file mode 100644 index 000000000000..72cdafee35fe --- /dev/null +++ b/include/comphelper/dumpxmltostring.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +#pragma once + +#include <sal/config.h> + +#include <libxml/tree.h> +#include <libxml/xmlwriter.h> + +#include <new> + +namespace comphelper +{ +template <typename F> OUString dumpXmlToString(F f) +{ + auto const buf = xmlBufferCreate(); + if (buf == nullptr) + { + throw std::bad_alloc(); + } + auto const writer = xmlNewTextWriterMemory(buf, 0); + if (writer == nullptr) + { + throw std::bad_alloc(); + } + f(writer); + xmlFreeTextWriter(writer); + std::string_view s(reinterpret_cast<char const*>(xmlBufferContent(buf)), xmlBufferLength(buf)); + OUString rv = OStringToOUString(s, RTL_TEXTENCODING_ISO_8859_1); //TODO + xmlBufferFree(buf); + return rv; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/offapi/com/sun/star/qa/XDumper.idl b/offapi/com/sun/star/qa/XDumper.idl index f980ac04a02d..114b74f46115 100644 --- a/offapi/com/sun/star/qa/XDumper.idl +++ b/offapi/com/sun/star/qa/XDumper.idl @@ -27,7 +27,7 @@ interface XDumper : com::sun::star::uno::XInterface * @since LibreOffice 3.6 */ - string dump(); + string dump([in] string kind); }; } ; // chart2 diff --git a/sw/source/uibase/inc/unotxvw.hxx b/sw/source/uibase/inc/unotxvw.hxx index 9608ed619be0..5dd78ffc9864 100644 --- a/sw/source/uibase/inc/unotxvw.hxx +++ b/sw/source/uibase/inc/unotxvw.hxx @@ -38,6 +38,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/datatransfer/XTransferableSupplier.hpp> #include <com/sun/star/datatransfer/XTransferableTextSupplier.hpp> +#include <com/sun/star/qa/XDumper.hpp> #include <cppuhelper/implbase.hxx> #include <svl/itemprop.hxx> #include <TextCursorHelper.hxx> @@ -59,6 +60,7 @@ class SwXTextView final : public css::beans::XPropertySet, public css::datatransfer::XTransferableSupplier, public css::datatransfer::XTransferableTextSupplier, + public css::qa::XDumper, public SfxBaseController { ::comphelper::OInterfaceContainerHelper3<css::view::XSelectionChangeListener> m_SelChangedListeners; @@ -139,6 +141,9 @@ public: // XTransferableTextSupplier virtual css::uno::Reference<css::datatransfer::XTransferable> SAL_CALL getTransferableForTextRange(css::uno::Reference<css::text::XTextRange> const& xTextRange) override; + // XDumper + OUString SAL_CALL dump(const OUString& rKind) override; + void NotifySelChanged(); void NotifyDBChanged(); diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index 7bb391586e5a..ca344d40718a 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -72,6 +72,7 @@ #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> #include <tools/UnitConversion.hxx> +#include <comphelper/dumpxmltostring.hxx> #include <fmtanchr.hxx> using namespace ::com::sun::star; @@ -139,6 +140,7 @@ Sequence< uno::Type > SAL_CALL SwXTextView::getTypes( ) cppu::UnoType<XPropertySet>::get(), cppu::UnoType<datatransfer::XTransferableSupplier>::get(), cppu::UnoType<datatransfer::XTransferableTextSupplier>::get(), + cppu::UnoType<qa::XDumper>::get(), SfxBaseController::getTypes() ).getTypes(); } @@ -216,6 +218,11 @@ uno::Any SAL_CALL SwXTextView::queryInterface( const uno::Type& aType ) uno::Reference<datatransfer::XTransferableTextSupplier> xRet = this; aRet <<= xRet; } + else if(aType == cppu::UnoType<qa::XDumper>::get()) + { + uno::Reference<qa::XDumper> xRet = this; + aRet <<= xRet; + } else aRet = SfxBaseController::queryInterface(aType); return aRet; @@ -1757,6 +1764,18 @@ SwXTextView::getTransferableForTextRange(uno::Reference<text::XTextRange> const& return pTransfer; } +OUString SAL_CALL SwXTextView::dump(const OUString& rKind) +{ + if (rKind == "layout") + { + SwRootFrame* pLayout = GetView()->GetWrtShell().GetLayout(); + return comphelper::dumpXmlToString([pLayout](xmlTextWriterPtr pWriter) + { pLayout->dumpAsXml(pWriter); }); + } + + return OUString(); +} + uno::Reference< datatransfer::XTransferable > SAL_CALL SwXTextView::getTransferable() { SolarMutexGuard aGuard; diff --git a/writerfilter/CppunitTest_writerfilter_dmapper.mk b/writerfilter/CppunitTest_writerfilter_dmapper.mk index 6b7611b41996..8a4745630c29 100644 --- a/writerfilter/CppunitTest_writerfilter_dmapper.mk +++ b/writerfilter/CppunitTest_writerfilter_dmapper.mk @@ -13,6 +13,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,writerfilter_dmapper)) $(eval $(call gb_CppunitTest_use_externals,writerfilter_dmapper,\ boost_headers \ + libxml2 \ )) $(eval $(call gb_CppunitTest_add_exception_objects,writerfilter_dmapper, \ diff --git a/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx b/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx index 00d4147bfb05..5afad898f8e4 100644 --- a/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx +++ b/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx @@ -7,20 +7,23 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include <test/unoapi_test.hxx> +#include <test/unoapixml_test.hxx> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/qa/XDumper.hpp> + +#include <test/xmldocptr.hxx> using namespace com::sun::star; namespace { /// Tests for writerfilter/source/dmapper/SettingsTable.cxx. -class Test : public UnoApiTest +class Test : public UnoApiXmlTest { public: Test() - : UnoApiTest("/writerfilter/qa/cppunittests/dmapper/data/") + : UnoApiXmlTest("/writerfilter/qa/cppunittests/dmapper/data/") { } }; @@ -59,6 +62,29 @@ CPPUNIT_TEST_FIXTURE(Test, testAllowTextAfterFloatingTableBreak) // set. CPPUNIT_ASSERT(bAllowTextAfterFloatingTableBreak); } + +CPPUNIT_TEST_FIXTURE(Test, testAddVerticalFrameOffsetsRTF) +{ + // Given a document with a floating table, immediately followed by an inline table: + // When importing that document: + loadFromURL(u"floattable-vertical-frame-offset.rtf"); + + // Then make sure the floating and the inline tables don't overlap: + uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); + css::uno::Reference<qa::XDumper> xDumper(xModel->getCurrentController(), uno::UNO_QUERY); + OString aDump = xDumper->dump("layout").toUtf8(); + auto pCharBuffer = reinterpret_cast<const xmlChar*>(aDump.getStr()); + xmlDocUniquePtr pXmlDoc(xmlParseDoc(pCharBuffer)); + sal_Int32 nFlyBottom = getXPath(pXmlDoc, "//fly/infos/bounds", "bottom").toInt32(); + sal_Int32 nTableFrameTop = getXPath(pXmlDoc, "//body/tab/infos/bounds", "top").toInt32(); + sal_Int32 nTableTopMargin = getXPath(pXmlDoc, "//body/tab/infos/prtBounds", "top").toInt32(); + sal_Int32 nTableTop = nTableFrameTop + nTableTopMargin; + // Without the accompanying fix in place, this test would have failed with: + // - Expected greater than: 2747 + // - Actual : 1449 + // i.e. table top should be ~2748, but was less, leading to an overlap. + CPPUNIT_ASSERT_GREATER(nFlyBottom, nTableTop); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/qa/cppunittests/dmapper/data/floattable-vertical-frame-offset.rtf b/writerfilter/qa/cppunittests/dmapper/data/floattable-vertical-frame-offset.rtf new file mode 100644 index 000000000000..a7f8c45e83c8 --- /dev/null +++ b/writerfilter/qa/cppunittests/dmapper/data/floattable-vertical-frame-offset.rtf @@ -0,0 +1,43 @@ +{\rtf1 +\paperw11907\paperh16840\margl567\margr397\margt567\margb397 +\pard\plain\par +\par +\trowd +\trgaph70\trrh1315\trleft-70\tpvpara\tphmrg\tposx211\tposnegy-16\trautofit1\tblind0\tblindtype3 \clvertalt\clbrdrt +\brdrs\brdrw30 \clbrdrl\brdrs\brdrw30 \clbrdrb\brdrs\brdrw30 \clbrdrr\brdrtbl \cltxlrtb\clshdrawnil \cellx2694 +\cellx4678\pard \ltrpar\ql \li0\ri0\widctlpar\intbl\pvpara\phmrg\posx211\posnegy-16\dxfrtext141\dfrmtxtx141\dfrmtxty0\wraparound\faauto\adjustright\rin0\lin0\pararsid5002879 +{\rtlch\fcs1 \ab\af1 \ltrch\fcs0 +\b\fs14\lang1053\langfe1033\langnp1053\insrsid1249889 Table1:A1} +{\rtlch\fcs1 \af1 \ltrch\fcs0 \fs14\lang1053\langfe1033\langnp1053\insrsid1249889 \cell } +\pard \ltrpar\ql \li0\ri0\widctlpar\intbl +\tx2694\pvpara\phmrg\posx211\posnegy-16\dxfrtext141\dfrmtxtx141\dfrmtxty0\wraparound\faauto\adjustright\rin0\lin0\pararsid935586 +{\rtlch\fcs1 \af1 \ltrch\fcs0 \fs14\insrsid1249889 Table1:B1} +{\rtlch\fcs1 \af1\afs4 \ltrch\fcs0 +\fs14\lang1053\langfe1033\langnp1053\insrsid1249889 \cell } +\pard \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 +{\rtlch\fcs1 \af1 \ltrch\fcs0 \lang1053\langfe1033\langnp1053\insrsid1249889\charrsid15953318 +\trowd \irow0\irowband0\lastrow \ltrrow\ts11\trgaph70\trrh1315\trleft-70\tpvpara\tphmrg\tposx211\tposnegy-16\trautofit1\trpaddl70\trpaddr70\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid5002879 +\tblind0\tblindtype3\cltxlrtb\clshdrawnil \cellx2694\clvertalt\clbrdrt\brdrs\brdrw30 \clbrdrl\brdrtbl \clbrdrb\brdrs\brdrw30 \clbrdrr +\brdrtbl \cltxlrtb\clshdrawnil \cellx4678\row } +\pard \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\faauto\adjustright\rin0\lin0\itap0 +{\rtlch\fcs1 \af1\afs4 \ltrch\fcs0 \fs4\lang1053\langfe1033\langnp1053\insrsid16530204 +\par \ltrrow} +\trowd \irow0\irowband0\lastrow \ltrrow\trqc\trgaph108\trrh-609\trleft-57\trkeep\trbrdrt\brdrs\brdrw10 +\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid1533051\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalc\clbrdrt\brdrs\brdrw30 \clbrdrl\brdrs\brdrw30 +\clbrdrb\brdrs\brdrw30 \clbrdrr\brdrnone \cltxlrtb\clpadt57\clpadr57\clpadft3\clpadfr3\clshdrawnil \cellx1303\clvertalc\clbrdrt\brdrs\brdrw30 \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw30 \clbrdrr\brdrs\brdrw30 +\cltxlrtb\clpadt57\clpadr57\clpadft3\clpadfr3\clshdrawnil \cellx7294\pard \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\faauto\adjustright\rin0\lin0 +{\rtlch\fcs1 \af1 \ltrch\fcs0 \insrsid1533051 Table2:A1} +{\rtlch\fcs1 \af1 +\ltrch\fcs0 \fs18\insrsid1533051 \cell } +{\rtlch\fcs1 \ab\af1 \ltrch\fcs0 \b\fs14\insrsid1533051 Table2:B1} +{\rtlch\fcs1 \ab\af1\afs18 \ltrch\fcs0 \b\fs14\insrsid1533051 \cell } +\pard \ltrpar +\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 +{\rtlch\fcs1 \af1 \ltrch\fcs0 \insrsid1533051 \trowd \irow0\irowband0\lastrow \ltrrow\ts11\trqc\trgaph108\trrh-609\trleft-57\trkeep\trbrdrt\brdrs\brdrw10 \trbrdrl +\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid1533051\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalc\clbrdrt\brdrs\brdrw30 \clbrdrl\brdrs\brdrw30 +\clbrdrb\brdrs\brdrw30 \clbrdrr\brdrnone \cltxlrtb\clpadt57\clpadr57\clpadft3\clpadfr3\clshdrawnil \cellx1303\clvertalc\clbrdrt\brdrs\brdrw30 \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw30 \clbrdrr\brdrs\brdrw30 +\cltxlrtb\clpadt57\clpadr57\clpadft3\clpadfr3\clshdrawnil \cellx7294\row } +\pard \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\faauto\adjustright\rin0\lin0\itap0 +\par +} diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index a6bae79e1e69..43ef02f68134 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -592,7 +592,9 @@ void SettingsTable::ApplyProperties(uno::Reference<text::XTextDocument> const& x uno::Reference<lang::XMultiServiceFactory> xTextFactory(xDoc, uno::UNO_QUERY_THROW); uno::Reference<beans::XPropertySet> xDocumentSettings(xTextFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY_THROW); + // Shared between DOCX and RTF, unconditional flags. xDocumentSettings->setPropertyValue("TableRowKeep", uno::Any(true)); + xDocumentSettings->setPropertyValue("AddVerticalFrameOffsets", uno::Any(true)); if (GetWordCompatibilityMode() <= 14) { diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx index 0b3d86be6b04..196bfa2c47ca 100644 --- a/writerfilter/source/filter/WriterFilter.cxx +++ b/writerfilter/source/filter/WriterFilter.cxx @@ -304,7 +304,6 @@ void WriterFilter::setTargetDocument(const uno::Reference<lang::XComponent>& xDo uno::Reference<beans::XPropertySet> xSettings( xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); - xSettings->setPropertyValue("AddVerticalFrameOffsets", uno::Any(true)); xSettings->setPropertyValue("UseOldNumbering", uno::Any(false)); xSettings->setPropertyValue("IgnoreFirstLineIndentInNumbering", uno::Any(false)); xSettings->setPropertyValue("DoNotResetParaAttrsForNumFont", uno::Any(false));