external/clucene/patches/binary_function.patch | 23 ++++++++++++++++++ sw/qa/extras/layout/data/fdo56797-2-min.odt |binary sw/qa/extras/layout/layout2.cxx | 31 +++++++++++++++++++++++++ sw/source/core/layout/layact.cxx | 6 ++-- sw/source/core/layout/tabfrm.cxx | 12 ++++++--- 5 files changed, 65 insertions(+), 7 deletions(-)
New commits: commit af0a104cce7e4cd4704d663ef39af298ff2ffd62 Author: Michael Stahl <[email protected]> AuthorDate: Wed Aug 23 15:51:32 2023 +0200 Commit: Mike Kaganski <[email protected]> CommitDate: Thu Jul 25 12:47:33 2024 +0500 tdf#154775 sw: layout: avoid breaking this with following commits The problem with commit 1b5bc2ae2f19a190bf588a5a26c4d125c3960991 is that the fix only works in case the fly is invalid at the time when SwTabFrame::CalcFlyOffsets() is called; if it is valid (which will be the case with following commits, for non-obvious reasons) then the fix does nothing, causing testTablePrintAreaLeft to fail. In Word 2013, this fly causes the table to shift down, despite its HoriOrient being LEFT; so adapt SwTabFrame::CalcFlyOffsets() to also shift down in this case. Likely it would be best not to check HoriOrient at all for ShiftDown case, but needs checking first what Word does in other cases. Change-Id: I465a55bbf1a783abce8b8d6d65099bd9df5695f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155987 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 7b1c03ed87f7a21606e09863b23074e6b96e26d1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156964 Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index a1166b5ba2ac..2c6e7edc979a 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2887,9 +2887,13 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper, // text frame has already changed its page. const SwTextFrame* pAnchorCharFrame = pFly->FindAnchorCharFrame(); const SwFormatHoriOrient& rHori = pFly->GetFormat()->GetHoriOrient(); + // TODO: why not just ignore HoriOrient? + bool isHoriOrientShiftDown = + rHori.GetHoriOrient() == text::HoriOrientation::NONE + || rHori.GetHoriOrient() == text::HoriOrientation::LEFT; // Only consider invalid Writer fly frames if they'll be shifted down. bool bIgnoreFlyValidity - = bAddVerticalFlyOffsets && rHori.GetHoriOrient() == text::HoriOrientation::NONE; + = bAddVerticalFlyOffsets && isHoriOrientShiftDown; bool bConsiderFly = // #i46807# - do not consider invalid // Writer fly frames. @@ -2940,8 +2944,7 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper, bool bShiftDown = css::text::WrapTextMode_NONE == rSur.GetSurround(); if (!bShiftDown && bAddVerticalFlyOffsets) { - if (rSur.GetSurround() == text::WrapTextMode_PARALLEL - && rHori.GetHoriOrient() == text::HoriOrientation::NONE) + if (rSur.GetSurround() == text::WrapTextMode_PARALLEL && isHoriOrientShiftDown) { // We know that wrapping was requested and the table frame overlaps with // the fly frame. Check if the print area overlaps with the fly frame as @@ -3002,7 +3005,8 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper, } if ( (css::text::WrapTextMode_RIGHT == rSur.GetSurround() || css::text::WrapTextMode_PARALLEL == rSur.GetSurround())&& - text::HoriOrientation::LEFT == rHori.GetHoriOrient() ) + text::HoriOrientation::LEFT == rHori.GetHoriOrient() + && !bShiftDown) { const tools::Long nWidth = aRectFnSet.XDiff( aRectFnSet.GetRight(aFlyRect), commit d17dc9182b0a4863ad04eec141e51f55a6a1f635 Author: Michael Stahl <[email protected]> AuthorDate: Mon Aug 14 17:13:17 2023 +0200 Commit: Mike Kaganski <[email protected]> CommitDate: Thu Jul 25 12:23:53 2024 +0500 tdf#156724 tdf#156722 tdf#156745 sw: layout: partially remove IsPaintLocked() Having the layout algorithm dependend on IsPaintLocked() is very problematic; it is typically set when the layout is invoked from SwViewShell code, as happens several times when loading a document in response to window resize events etc., but not for idle formatting or from SwXTextDocument::getRendererCount(), hence these bugs only reproduce with soffice --convert-to pdf, not via UI. For tdf#156724 the problem is that the table is split, during formatting of the split row a new footnote is created on page 1, and this reduces the space, so splitting fails and is never attempted again. When the document is loaded from UI, when the table is split the footnote already exists and so splitting succeeds; it was created by a call from SwLayAction::FormatLayout() of the cell frame. It turns out that when the condition is removed completely, testUXTSOREL will take 5 minutes instead of 5 seconds, which seems excessive; the problem there appears to be that a text frame in a columned section moves forward and backward; plausibly columned section content should be formatted by ::CalcContent() only. (reportedly regression from commit c605283ad6785dea762feab5fdffd9d27e75c292 and commit 7e8b4756d95057f069467b34e7849f9354856578) Change-Id: I9ed73588efeec654a769eee8aa825186bd51e059 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155672 Tested-by: Michael Stahl <[email protected]> Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit dc5991ccc8f7d8e86c1e04be9095dda5c08b4763) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155691 Tested-by: Jenkins Reviewed-by: Miklos Vajna <[email protected]> diff --git a/sw/qa/extras/layout/data/fdo56797-2-min.odt b/sw/qa/extras/layout/data/fdo56797-2-min.odt new file mode 100644 index 000000000000..624149ec0248 Binary files /dev/null and b/sw/qa/extras/layout/data/fdo56797-2-min.odt differ diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index a597c16f412f..2c1e197fd95e 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -2929,6 +2929,37 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, TestTdf161508) assertXPath(pExportDump, "//page[2]/body/tab", 1); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf156724) +{ + discardDumpedLayout(); + if (mxComponent.is()) + mxComponent->dispose(); + + OUString const url(createFileURL(u"fdo56797-2-min.odt")); + + // note: must set Hidden property, so that SfxFrameViewWindow_Impl::Resize() + // does *not* forward initial VCL Window Resize and thereby triggers a + // layout which does not happen on soffice --convert-to pdf. + std::vector<beans::PropertyValue> aFilterOptions = { + { beans::PropertyValue("Hidden", -1, uno::Any(true), beans::PropertyState_DIRECT_VALUE) }, + }; + + // inline the loading because currently properties can't be passed... + mxComponent = loadFromDesktop(url, "com.sun.star.text.TextDocument", + comphelper::containerToSequence(aFilterOptions)); + save("writer_pdf_Export"); + + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + // both pages have a tab frame and one footnote + assertXPath(pXmlDoc, "/root/page[1]/body/tab", 1); + assertXPath(pXmlDoc, "/root/page[1]/ftncont", 1); + assertXPath(pXmlDoc, "/root/page[1]/ftncont/ftn", 1); + assertXPath(pXmlDoc, "/root/page[2]/body/tab", 1); + assertXPath(pXmlDoc, "/root/page[2]/ftncont", 1); + assertXPath(pXmlDoc, "/root/page[2]/ftncont/ftn", 1); + assertXPath(pXmlDoc, "/root/page", 2); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 971d2761639e..b044bbe358af 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1423,10 +1423,10 @@ bool SwLayAction::FormatLayout( OutputDevice *pRenderContext, SwLayoutFrame *pLa PopFormatLayout(); } } - else if ( m_pImp->GetShell()->IsPaintLocked() ) - // Shortcut to minimize the cycles. With Lock, the - // paint is coming either way (primarily for browse) + else if (m_pImp->GetShell()->IsPaintLocked() || !pLay->IsColBodyFrame()) + { // tdf#156724 unconditionally for frames in tables, so their footnotes exist before trying to split pLow->OptCalc(); + } if ( IsAgain() ) return false; commit 3373468973237bc9f690371900494adfe8166636 Author: Stephan Bergmann <[email protected]> AuthorDate: Mon Jul 17 17:11:37 2023 +0200 Commit: Mike Kaganski <[email protected]> CommitDate: Thu Jul 25 12:11:07 2024 +0500 external/clucene: More uses of obsolete std::binary_function ...as seen at least when building against VS 2022 Preview 17.7.0 Preview 3.0 and --with-latest-c++, > workdir\UnpackedTarball > C:\PROGRA~1\MICROS~3�2\Preview\VC\Tools\MSVCc7~1.328\Includeector(26): note: see declaration of 'std' > workdir\UnpackedTarball etc. Change-Id: Icea14fe0c0ad85501367ac6c81a3b8aada595383 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154551 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> diff --git a/external/clucene/patches/binary_function.patch b/external/clucene/patches/binary_function.patch index 5b6f8ece9bee..a7e4b867d0c7 100644 --- a/external/clucene/patches/binary_function.patch +++ b/external/clucene/patches/binary_function.patch @@ -1,3 +1,26 @@ +--- src/core/CLucene/search/BooleanQuery.cpp ++++ src/core/CLucene/search/BooleanQuery.cpp +@@ -25,7 +25,7 @@ + CL_NS_USE(util) + CL_NS_DEF(search) + +- class BooleanClause_Compare:public CL_NS_STD(binary_function)<const BooleanClause*,const BooleanClause*,bool> ++ class BooleanClause_Compare + { + public: + bool operator()( const BooleanClause* val1, const BooleanClause* val2 ) const { +--- src/core/CLucene/util/_Arrays.h ++++ src/core/CLucene/util/_Arrays.h +@@ -124,8 +124,7 @@ + + template <typename _kt, typename _comparator, + typename class1, typename class2> +- class CLListEquals: +- public CL_NS_STD(binary_function)<class1*,class2*,bool> ++ class CLListEquals + { + typedef typename class1::const_iterator _itr1; + typedef typename class2::const_iterator _itr2; --- src/core/CLucene/util/Equators.h +++ src/core/CLucene/util/Equators.h @@ -22,19 +22,19 @@
