sw/qa/extras/ooxmlexport/data/tdf159207_footerFramePrBorder.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 18 ++++++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 4 ++ 3 files changed, 22 insertions(+)
New commits: commit 3c0a6102ce26c546c0c448a8d7468dea92623273 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Sat Jan 20 19:54:54 2024 -0500 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue Jan 23 10:42:42 2024 +0100 tdf#154703 writerfilter framePr: avoid unexpected frame borders This fixes my regressive 7.6 commit 31ea6305b6a763ee48f639562313d9bd109a2923 The text's first border checked (the left one) returned void because the property SetState was DONTCARE. Then it SETS the text's left border to be nothing (I presume to remove the border from the paragraph since it is moving it onto frame). Well, apparently that act of setting one border sets all of them (which makes sense since it would be one box item, and once the box item exists, it has a definition for each border). Therefore on the the next steps of the for loop, the remaining borders will exist (as nothing) and be dutifully moved to the frame. Apparently the default for a frame is a box with DEFINED borders, so omitting the moving of a nothing border resulted in a stray edge. make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf159207_footerFramePrBorder Change-Id: I217d02678b368f70643be91c4466927b4ca53988 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162409 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> (cherry picked from commit f43efd5473862edbdad0feb7f78c7be02914e997) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162375 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/qa/extras/ooxmlexport/data/tdf159207_footerFramePrBorder.docx b/sw/qa/extras/ooxmlexport/data/tdf159207_footerFramePrBorder.docx new file mode 100644 index 000000000000..7a4c54cc5c75 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf159207_footerFramePrBorder.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index 3a5ae1f394ea..cdcdfe778577 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -44,6 +44,24 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, "tdf153909_followTextFlow CPPUNIT_ASSERT(nTableTop > nRectBottom); } +CPPUNIT_TEST_FIXTURE(Test, testTdf159207_footerFramePrBorder) +{ + loadFromFile(u"tdf159207_footerFramePrBorder.docx"); // re-imports as editeng Frame/Shape + + // given a doc with footer paragraphs frame (with a top border, but no left border) + uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), + uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xFrame0(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + auto aBorder = getProperty<table::BorderLine2>(xFrame0, "LeftBorder"); + sal_uInt32 nBorderWidth + = aBorder.OuterLineWidth + aBorder.InnerLineWidth + aBorder.LineDistance; + // Without patch it failed with Expected 0, Actual 26 + CPPUNIT_ASSERT_EQUAL_MESSAGE("Left border:", static_cast<sal_uInt32>(0), nBorderWidth); + + // TODO: there SHOULD BE a top border, and even if loaded, it would be lost on re-import... +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index db2a71270331..cea1585e42fe 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1731,7 +1731,11 @@ static void lcl_MoveBorderPropertiesToFrame(std::vector<beans::PropertyValue>& r aValue.Name = sPropertyName; aValue.Value = xTextRangeProperties->getPropertyValue(sPropertyName); if( nProperty < 4 ) + { xTextRangeProperties->setPropertyValue( sPropertyName, uno::Any(table::BorderLine2())); + if (!aValue.Value.hasValue()) + aValue.Value <<= table::BorderLine2(); + } else // border spacing { sal_Int32 nDistance = 0;