sw/inc/swrect.hxx | 2 - sw/source/core/text/widorp.cxx | 42 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-)
New commits: commit 5099c72ea8bfd469bf6e6ab9f8f47f447ab717f3 Author: Michael Stahl <[email protected]> AuthorDate: Thu Mar 10 12:49:56 2022 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Thu Mar 10 14:31:29 2022 +0100 sw: downgrade "SVRect() without Width or Height" to SAL_INFO This occurs 2500 times in CppunitTest logs. Change-Id: I946ed240d978f1588ca3bc51c82407cba85e8e1a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131316 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx index b4db7384f456..eeb02df23c95 100644 --- a/sw/inc/swrect.hxx +++ b/sw/inc/swrect.hxx @@ -291,7 +291,7 @@ inline SwRect &SwRect::operator-=( const Point &rPt ) // other inline tools::Rectangle SwRect::SVRect() const { - SAL_WARN_IF( IsEmpty(), "sw", "SVRect() without Width or Height" ); + SAL_INFO_IF( IsEmpty(), "sw.core", "SVRect() without Width or Height" ); return tools::Rectangle( m_Point.getX(), m_Point.getY(), m_Point.getX() + m_Size.getWidth() - 1, //Right() m_Point.getY() + m_Size.getHeight() - 1 ); //Bottom() commit c79bf7865bff4e88cc201357370d8faeef8e6ad9 Author: Michael Stahl <[email protected]> AuthorDate: Wed Mar 9 15:24:50 2022 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Thu Mar 10 14:31:17 2022 +0100 (related: tdf#139687) sw: ignore following footnotes in SwTextFrameBreak With the fix it now happens that after SwUndoDelete there is a gap at the bottom of page 21 and the paragraph at the bottom of it is split with 2 lines ("(here, wisdom), " etc.) on page 22. This is because when this SwTextFrame 1927 is formatted, there are next frames also on the page and those have footnotes on the page. These footnotes take up space and so SwTextFrameBreak::IsInside() breaks off the last 2 lines (1 may still fit but it has 2 widorp). A similar problem was fixed in commit 391613785ae6fbb735cf7a86ea2f6a93161a8769 for footnotes anchored in follow of the current frame, but here RemoveFootnotes() cannot be used as it requires the next frame to already have moved to a different footnote boss, which clearly hasn't happened yet. So try something similar to commit e37ffdd118da2d21c5e78e8c7b67252d0d1adc8c and count the space taken by such footnotes as available for the text frame. Change-Id: I8f4c1332dc471a68539306a8788a0f59d0b12b1d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131256 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> diff --git a/sw/source/core/text/widorp.cxx b/sw/source/core/text/widorp.cxx index 526f4ea1b794..f6b9ba20184f 100644 --- a/sw/source/core/text/widorp.cxx +++ b/sw/source/core/text/widorp.cxx @@ -135,6 +135,48 @@ bool SwTextFrameBreak::IsInside( SwTextMargin const &rLine ) const // If everything is inside the existing frame the result is true; bFit = nDiff >= 0; + // If it didn't fit, try to add the space of footnotes that are anchored + // in frames below (in next-chain of) this one as they will need to move + // forward anyway if this frame is split. + // - except if in tables (need to check if row is splittable? + // also, multiple columns looks difficult) + if (!bFit && !m_pFrame->IsInTab()) + { + if (SwFootnoteBossFrame const*const pBoss = m_pFrame->FindFootnoteBossFrame()) + { + if (SwFootnoteContFrame const*const pCont = pBoss->FindFootnoteCont()) + { + SwContentFrame const* pContent(m_pFrame); + while (pContent->HasFollow()) + { + pContent = pContent->GetFollow(); + } + // start with first text frame that isn't a follow + // (ignoring Keep attribute for now, MakeAll should handle it?) + pContent = pContent->GetNextContentFrame(); + ::std::set<SwContentFrame const*> nextFrames; + while (pBoss->IsAnLower(pContent)) + { + nextFrames.insert(pContent); + pContent = pContent->GetNextContentFrame(); + } + SwTwips nNextFootnotes(0); + for (SwFootnoteFrame const* pFootnote = static_cast<SwFootnoteFrame const*>(pCont->Lower()); + pFootnote != nullptr; + pFootnote = static_cast<SwFootnoteFrame const*>(pFootnote->GetNext())) + { + SwContentFrame const*const pAnchor = pFootnote->GetRef(); + if (nextFrames.find(pAnchor) != nextFrames.end()) + { + nNextFootnotes += aRectFnSet.GetHeight(pFootnote->getFrameArea()); + } + } + bFit = 0 <= nDiff + nNextFootnotes; + SAL_INFO_IF(bFit, "sw.core", "no text frame break because ignoring " + << nNextFootnotes << " footnote height"); + } + } + } if (!bFit && rLine.MaybeHasHints() && m_pFrame->GetFollow() // if using same footnote container as the follow, pointless to try? && m_pFrame->FindFootnoteBossFrame() != m_pFrame->GetFollow()->FindFootnoteBossFrame())
