tdf#166544 writerfilter page break: field-end counts as a character run
For compat14, page breaks that are not the first run
do not apply the top margin after the page break.
That makes sense. The top margin has already been applied
before the break.
The end marker of a field (ToC, legacy text form field, hyperlinks...)
must be treated as one of these character runs,
since MS Word doesn't apply the top margn in these instances.
The bug report contains examples for ToC and formfield,
so I used the hyperlink example as my unit test.
make CppunitTest_sw_ooxmlexport25 \
CPPUNIT_TEST_NAME=testTdf166544_noTopMargin_fields
Change-Id: Ia3efced0d301c2345667937521beb8e7c895d326
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185375
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
This commit is contained in:
@@ -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:
|
||||
@@ -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 \
|
||||
|
||||
Binary file not shown.
@@ -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 <swmodeltestbase.hxx>
|
||||
|
||||
#include <com/sun/star/beans/XPropertyState.hpp>
|
||||
|
||||
#include <comphelper/configuration.hxx>
|
||||
#include <comphelper/sequenceashashmap.hxx>
|
||||
#include <comphelper/propertyvalue.hxx>
|
||||
#include <officecfg/Office/Common.hxx>
|
||||
|
||||
#include <pam.hxx>
|
||||
#include <unotxdoc.hxx>
|
||||
#include <docsh.hxx>
|
||||
#include <IDocumentSettingAccess.hxx>
|
||||
|
||||
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: */
|
||||
@@ -9199,6 +9199,8 @@ void DomainMapper_Impl::PopFieldContext()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetIsFirstRun(false); // the end marker counts as a run - affecting page breaks
|
||||
}
|
||||
catch(const lang::IllegalArgumentException&)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user