diff --git a/sw/CppunitTest_sw_ooxmlexport25.mk b/sw/CppunitTest_sw_ooxmlexport25.mk new file mode 100644 index 000000000000..a02541c92ad5 --- /dev/null +++ b/sw/CppunitTest_sw_ooxmlexport25.mk @@ -0,0 +1,18 @@ +# -*- 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,25)) + +$(eval $(call gb_CppunitTest_use_custom_headers,sw_ooxmlexport25,\ + officecfg/registry \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index a6376dc0742b..b00830e0fe2f 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -102,6 +102,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\ CppunitTest_sw_ooxmlexport22 \ CppunitTest_sw_ooxmlexport23 \ CppunitTest_sw_ooxmlexport24 \ + CppunitTest_sw_ooxmlexport25 \ CppunitTest_sw_ooxmlexport_template \ CppunitTest_sw_ooxmlfieldexport \ CppunitTest_sw_ooxmllinks \ diff --git a/sw/qa/extras/ooxmlexport/data/tdf166544_noTopMargin_fields.docx b/sw/qa/extras/ooxmlexport/data/tdf166544_noTopMargin_fields.docx new file mode 100644 index 000000000000..3070ef81977c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf166544_noTopMargin_fields.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport25.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport25.cxx new file mode 100644 index 000000000000..cf48755a7765 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/ooxmlexport25.cxx @@ -0,0 +1,49 @@ +/* -*- 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 + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace +{ +class Test : public SwModelTestBase +{ +public: + Test() + : SwModelTestBase(u"/sw/qa/extras/ooxmlexport/data/"_ustr, u"Office Open XML Text"_ustr) + { + } +}; + +DECLARE_OOXMLEXPORT_TEST(testTdf166544_noTopMargin_fields, "tdf166544_noTopMargin_fields.docx") +{ + // given a document with a hyperlink field containing a page break + auto pXmlDoc = parseLayoutDump(); + + // The top margin is applied before the page break - since the page break follows the field end + sal_Int32 nHeight = getXPath(pXmlDoc, "//page[2]//txt/infos/bounds", "height").toInt32(); + // Without the fix, the text height (showing a large top margin) was 569 + CPPUNIT_ASSERT_EQUAL(sal_Int32(269), nHeight); +} + +} // end of anonymous namespace +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx index 54bd39cb0f5f..7f2f0d213d3c 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx @@ -9199,6 +9199,8 @@ void DomainMapper_Impl::PopFieldContext() } } } + + SetIsFirstRun(false); // the end marker counts as a run - affecting page breaks } catch(const lang::IllegalArgumentException&) {