office-gobmx/sw/CppunitTest_sw_core_layout.mk
Miklos Vajna 6200d89b90 tdf#160952 sw: ignore top margin of para on non-first pages with newer DOCX
The 2nd page of the bugdoc has a single paragraph, with a non-zero top
margin. This is ignored in Word, but wasn't ignored in Writer.

Experimenting with the document, it looks like old Word files also don't
ignore this top margin: it started when the compat mode is upgraded
(from binary DOC or Word 2010) to Word 2023 or newer. Also the top
margin is only ignored for the first paragraph on the page, and only in
case it's not on the first page.

Fix the problem by introducing a new SwFrame::IsCollapseUpper() function
to decide if the upper margin should be collapsed or not, and then by
using it in SwFlowFrame::CalcUpperSpace() at one place where we read the
top margin from the doc model. Take advantage of the fact that we have
related, existing compat flags that tell us if we're in "Word >= 2013"
compat mode: see e.g. GetFlyAnchorBottom(), which explains
DocumentSettingId::TAB_OVER_MARGIN is a good indicator that this is a
"Word <= 2010" document. Also, DocumentSettingId::TAB_OVER_SPACING is an
indicator that this is a Word document, so we want the "TabOverSpacing
&& !TabOverMargin" case.

This doesn't change all reads of the upper spacing of a text node, but
is enough to avoid the unwanted top spacing, as demonstrated by the
bugdoc.

Change-Id: Ibdebdf5f0555256a0b6ed85d07079f14ef69a576
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167252
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-05-07 09:18:06 +02:00

92 lines
2.3 KiB
Makefile

# -*- 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 gb_CppunitTest_CppunitTest,sw_core_layout))
$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_core_layout))
$(eval $(call gb_CppunitTest_add_exception_objects,sw_core_layout, \
sw/qa/core/layout/calcmove \
sw/qa/core/layout/fly \
sw/qa/core/layout/flycnt \
sw/qa/core/layout/frmtool \
sw/qa/core/layout/ftnfrm \
sw/qa/core/layout/layact \
sw/qa/core/layout/layout \
sw/qa/core/layout/paintfrm \
sw/qa/core/layout/sortedobjs \
sw/qa/core/layout/tabfrm \
sw/qa/core/layout/trvlfrm \
))
$(eval $(call gb_CppunitTest_use_libraries,sw_core_layout, \
editeng \
comphelper \
cppu \
cppuhelper \
sal \
sfx \
subsequenttest \
sw \
swqahelper \
test \
unotest \
utl \
vcl \
svt \
tl \
svl \
svxcore \
))
$(eval $(call gb_CppunitTest_use_externals,sw_core_layout,\
boost_headers \
libxml2 \
))
$(eval $(call gb_CppunitTest_set_include,sw_core_layout,\
-I$(SRCDIR)/sw/inc \
-I$(SRCDIR)/sw/source/core/inc \
-I$(SRCDIR)/sw/source/uibase/inc \
-I$(SRCDIR)/sw/qa/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_api,sw_core_layout,\
udkapi \
offapi \
oovbaapi \
))
$(eval $(call gb_CppunitTest_use_ure,sw_core_layout))
$(eval $(call gb_CppunitTest_use_vcl,sw_core_layout))
$(eval $(call gb_CppunitTest_use_rdb,sw_core_layout,services))
$(eval $(call gb_CppunitTest_use_custom_headers,sw_core_layout,\
officecfg/registry \
))
$(eval $(call gb_CppunitTest_use_configuration,sw_core_layout))
$(eval $(call gb_CppunitTest_use_uiconfigs,sw_core_layout, \
modules/swriter \
sfx \
svt \
svx \
))
# assert if font/glyph fallback occurs
$(eval $(call gb_CppunitTest_set_non_application_font_use,sw_core_layout,abort))
$(eval $(call gb_CppunitTest_use_more_fonts,sw_core_layout))
# vim: set noet sw=4 ts=4: