From 7c15750cecea2aeb05653c0ee67b933d969b1f0b Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 22 Aug 2023 19:51:37 +0200 Subject: [PATCH] tdf#155510 ODT import: ignore props of covered table cells, unless in comp mode The problem was that the A5 cell on page 2 used to have a solid background, but this was lost after commit 1001dbaef4dec2b51c25ed8343bab6910f1219e1 (ODT import: handle style name of covered cells, 2021-03-19). Covered cell formatting was interesting for cell borders, in Word compat mode the covered cell can have its own border style, so e.g. there is left border on a vertically merged cell till its center, but not after its center. Fix the problem by limiting the import of covered cell formatting to the case when the TABLE_ROW_KEEP compat flag is on, to keep both native ODT and ODT-from-Word documents happy. If there is a need, some smarter way of merging properties could be implemented in the future. Change-Id: Icc1e6f48d9f5a0379d9a9052a1f5b9ae3f294477 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155957 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- sw/CppunitTest_sw_filter_xml.mk | 76 ++++++++++++++++++ sw/Module_sw.mk | 1 + .../xml/data/covered-cell-background.odt | Bin 0 -> 11710 bytes sw/qa/filter/xml/xml.cxx | 61 ++++++++++++++ sw/source/filter/xml/xmltbli.cxx | 9 +++ 5 files changed, 147 insertions(+) create mode 100644 sw/CppunitTest_sw_filter_xml.mk create mode 100644 sw/qa/filter/xml/data/covered-cell-background.odt create mode 100644 sw/qa/filter/xml/xml.cxx diff --git a/sw/CppunitTest_sw_filter_xml.mk b/sw/CppunitTest_sw_filter_xml.mk new file mode 100644 index 000000000000..5833d58c53a1 --- /dev/null +++ b/sw/CppunitTest_sw_filter_xml.mk @@ -0,0 +1,76 @@ +# -*- 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_filter_xml)) + +$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_filter_xml)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sw_filter_xml, \ + sw/qa/filter/xml/xml \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,sw_filter_xml, \ + comphelper \ + cppu \ + cppuhelper \ + editeng \ + sal \ + sfx \ + subsequenttest \ + svl \ + svx \ + svxcore \ + sw \ + swqahelper \ + test \ + unotest \ + utl \ + vcl \ + tl \ +)) + +$(eval $(call gb_CppunitTest_use_externals,sw_filter_xml,\ + boost_headers \ + libxml2 \ +)) + +$(eval $(call gb_CppunitTest_set_include,sw_filter_xml,\ + -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_filter_xml,\ + udkapi \ + offapi \ + oovbaapi \ +)) + +$(eval $(call gb_CppunitTest_use_ure,sw_filter_xml)) +$(eval $(call gb_CppunitTest_use_vcl,sw_filter_xml)) + +$(eval $(call gb_CppunitTest_use_rdb,sw_filter_xml,services)) + +$(eval $(call gb_CppunitTest_use_custom_headers,sw_filter_xml,\ + officecfg/registry \ +)) + +$(eval $(call gb_CppunitTest_use_configuration,sw_filter_xml)) + +$(eval $(call gb_CppunitTest_use_uiconfigs,sw_filter_xml, \ + modules/swriter \ +)) + +$(eval $(call gb_CppunitTest_use_more_fonts,sw_filter_xml)) + +# vim: set noet sw=4 ts=4: diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index 2a9cc7233d63..5be870597a2c 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -159,6 +159,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\ CppunitTest_sw_core_attr \ CppunitTest_sw_filter_ww8 \ CppunitTest_sw_filter_html \ + CppunitTest_sw_filter_xml \ CppunitTest_sw_a11y \ CppunitTest_sw_core_theme \ CppunitTest_sw_pdf_test \ diff --git a/sw/qa/filter/xml/data/covered-cell-background.odt b/sw/qa/filter/xml/data/covered-cell-background.odt new file mode 100644 index 0000000000000000000000000000000000000000..99b77630a00d3009391c74b98a00c7110b679569 GIT binary patch literal 11710 zcmc(FbyS?m(*7_&7@QCY?hqgZ3-0b3+}+*X-8D#n03o=$y9L+aZox9R>ksyx-R$0P z_kO?cuUm8GobEnVPxVyy+f#4XBP#(3g$4kC0D#YGjY?X*?-9rW0KoJ2X$W9xYH8@; zYGbHtV`E{euj^oHZAI&3Wk6%CYj0{#V{Kz-WniuEXlZEWK;vNO;voAMuqXRJ1oNpS zU~Oe&YV2tD8;t#X+9xwdJzYE6|C^POg|)7O;eWEi{u^I5);5kd&kp~CH{8Fov$Hm~ zGqkt=&-45{kM<6_4vzne-QPvU!P?s5|L*PC%0}19(BeP*K7zmbeWsSW#)kH^{H6|; zx;FOz!T9fjqpPoPXkqxYp4PuF2M7fEZ67^(`a=+&T9&$2rbdSL4m5TKM#J&LR{nG- z0f(G{h9k4Qw9wFY6ax)r8SP9#D$ukiDX7b>QSnM2vJ3YzzHgKYGps~ar-F5H`@$>p zI}{l8Dai&zO=@R=(@|&J-dSJ7Stiu{9e{k5(jB&jr+EOlX|C zh!JlQin>p%m#{DxihH;{X%S;7blVtCJsxuJox8tQaHG{RH$0mrC%WJo>lDoiFL~6z zWShOZylxue(-f<%F^9}igz zt@`j@Y&^WqOP`6MS&3=#4vNX%?-SgaMTb^{MF`Wh+&d*j{lN}VI4H8SEbQ2r%unt# z30|!U5!t3;K?jmdz3;lYdsq)Sg(G_1bdjeXqv*g^n0hy@DlVJbr%t!3rxwX7rdw#V zkh;Dc`lrZbX$^@wT!-fR*Hsf(jbgZ40#jH}OD9Bm$-)p?(2UD32k4Ag;gm_W$ODQe zchk&;-at1czTrS+2%CG0NGbJ|HMEaifT3jjk!nxK9RXAsUJ}mh6tT?wD9sIK))u|7 z95@ZKDS6c<1nanLTpt*{31pn@IOD^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V&S@WPWN#z#Ek(>urTtBQN&f(E~rXE4bvQ?>2ZZ(9~ z0b~1H_OwQ8Z^3ZV-Azv!BGbGY_oe!KG zvpwzlzF7-(I#kA)lko;(P2)UHNZAZf(6NX2Ku2GJjqOWuXz9Uz{8s;K=58NX zt+SwHo*IgP*JsZ?YR(mpWhm_0Bl-jByW726?dQzvqeL(~^%FUV>^E`_1P~4I&m_vH zp#MpJr&P*H{MG7DD!&y6fAyuFn*Yq5{QpJq{~MHFT*`k&dFD3$l7^?|zt82*+{%B( zc_tA4lH;f5|G@bR*Ycl{{yHP7r&aiOq(5^n{~71G1p7<${|4t57xSM{{yLja|A6v4 zH}juyp4pkdWc+V%{s&j{pTYhbY^101@xO=YuiVXlA^m=2{F#{e%rE;TqEASFoEuME z&fhoj@0Ne&tUVJKe@XCD?fQvJ{2Pt&->v>!G5@Q-Ty_)@4gY+4JfF$GWb%o5{kJEy WtOWFnXSJ74AH%0ZM}YFV_x}LTbhVBE literal 0 HcmV?d00001 diff --git a/sw/qa/filter/xml/xml.cxx b/sw/qa/filter/xml/xml.cxx new file mode 100644 index 000000000000..a0a21f5f4335 --- /dev/null +++ b/sw/qa/filter/xml/xml.cxx @@ -0,0 +1,61 @@ +/* -*- 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 + +namespace +{ +/** + * Covers sw/source/filter/xml/ fixes. + * + * Note that these tests are meant to be simple: either load a file and assert some result or build + * a document model with code, export and assert that result. + * + * Keep using the various sw_import/export suites for multiple filter calls inside a single + * test. + */ +class Test : public SwModelTestBase +{ +public: + Test() + : SwModelTestBase("/sw/qa/filter/xml/data/", "writer8") + { + } +}; + +CPPUNIT_TEST_FIXTURE(Test, testCoveredCellBackground) +{ + // Given a document with a table with vertically merged cells, with a solid background: + createSwDoc("covered-cell-background.odt"); + + // When checking the background of the last row's first covered table cell: + SwDoc* pDoc = getSwDoc(); + const SwTableFormat* pTableFormat = (*pDoc->GetTableFrameFormats())[0]; + SwTable* pTable = SwTable::FindTable(pTableFormat); + SwTableBox* pBox = const_cast(pTable->GetTableBox("A5")); + SwFrameFormat* pCellFormat = pBox->GetFrameFormat(); + const SvxBrushItem& rBackground = pCellFormat->GetAttrSet().GetBackground(); + + // Then make sure the covered cell has a solid background, just like other cells in the first + // column: + // Without the accompanying fix in place, this test would have failed with: + // - Expected: rgba[e8f2a1ff] + // - Actual : rgba[ffffff00] + // i.e. part of the merged cell had a bad white background. + CPPUNIT_ASSERT_EQUAL(Color(0xe8f2a1), rBackground.GetColor()); +} +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 7ed118565476..9578b45cdfe7 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -66,6 +66,7 @@ #include #include #include +#include #include #include @@ -1502,6 +1503,14 @@ void SwXMLTableContext::InsertCell( const OUString& rStyleName, void SwXMLTableContext::InsertCoveredCell(const OUString& rStyleName) { + const IDocumentSettingAccess& rIDSA = GetSwImport().getDoc()->getIDocumentSettingAccess(); + bool bWordTableCell = rIDSA.get(DocumentSettingId::TABLE_ROW_KEEP); + if (!bWordTableCell) + { + // Compatibility flag not active, ignore formatting of covered cells. + return; + } + SwXMLTableCell_Impl* pCell = GetCell(m_nCurRow, m_nNonMergedCurCol); ++m_nNonMergedCurCol; if (!pCell)