sw/source/uibase/inc/conttree.hxx | 3 ++- sw/source/uibase/utlui/content.cxx | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-)
New commits: commit 80a24870491385ba145757bf517c5f1cf7939017 Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Sat Sep 16 21:33:49 2023 -0800 Commit: Jim Raykowski <rayk...@gmail.com> CommitDate: Sun Sep 17 22:38:40 2023 +0200 tdf#152029 Don't include frame area top margin in the bring headings to attention overlay Change-Id: I1ddd842b01d2a134a281f97d9377a3d41b3ecb41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156981 Tested-by: Jenkins Reviewed-by: Jim Raykowski <rayk...@gmail.com> diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index ee04aeabac40..3f3483351daf 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -151,7 +151,8 @@ class SwContentTree final : public SfxListener void BringDrawingObjectsToAttention(std::vector<const SdrObject*>& rDrawingObjectsArr); void BringTextFieldsToAttention(std::vector<const SwTextAttr*>& rTextAttrsArr); void BringFootnotesToAttention(std::vector<const SwTextAttr*>& rTextAttrsArr); - void BringTypesWithFlowFramesToAttention(const std::vector<const SwNode*>& rNodes); + void BringTypesWithFlowFramesToAttention(const std::vector<const SwNode*>& rNodes, + const bool bIncludeTopMargin = true); /** * Before any data will be deleted, the last active entry has to be found. diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index ca6a16dbe10d..8b77b9cc1449 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -5690,7 +5690,8 @@ void SwContentTree::BringEntryToAttention(const weld::TreeIter& rEntry) if (nType == ContentTypeId::OUTLINE) { BringTypesWithFlowFramesToAttention({m_pActiveShell->GetNodes(). - GetOutLineNds()[static_cast<SwOutlineContent*>(pCnt)->GetOutlinePos()]}); + GetOutLineNds()[static_cast<SwOutlineContent*>(pCnt)->GetOutlinePos()]}, + /*bIncludeTopMargin*/ false); } else if (nType == ContentTypeId::TABLE) { @@ -5786,7 +5787,7 @@ void SwContentTree::BringEntryToAttention(const weld::TreeIter& rEntry) std::vector<const SwNode*> aNodesArr( m_pActiveShell->GetNodes().GetOutLineNds().begin(), m_pActiveShell->GetNodes().GetOutLineNds().end()); - BringTypesWithFlowFramesToAttention(aNodesArr); + BringTypesWithFlowFramesToAttention(aNodesArr, /*bIncludeTopMargin*/ false); } else if (nType == ContentTypeId::TABLE) { @@ -6031,8 +6032,8 @@ void SwContentTree::BringBookmarksToAttention(const std::vector<OUString>& rName OverlayObject(std::move(aRanges)); } -void SwContentTree::BringTypesWithFlowFramesToAttention(const std::vector<const SwNode*>& rNodes) -{ +void SwContentTree::BringTypesWithFlowFramesToAttention(const std::vector<const SwNode*>& rNodes, + const bool bIncludeTopMargin){ std::vector<basegfx::B2DRange> aRanges; for (const auto* pNode : rNodes) { @@ -6044,8 +6045,10 @@ void SwContentTree::BringTypesWithFlowFramesToAttention(const std::vector<const { const SwRect& rFrameRect = pFrame->getFrameArea(); if (!rFrameRect.IsEmpty()) - aRanges.emplace_back(rFrameRect.Left(), rFrameRect.Top(), rFrameRect.Right(), - rFrameRect.Bottom()); + aRanges.emplace_back(rFrameRect.Left(), + bIncludeTopMargin ? rFrameRect.Top() : + rFrameRect.Top() + pFrame->GetTopMargin(), + rFrameRect.Right(), rFrameRect.Bottom()); if (!pFrame->IsFlowFrame()) break; SwFlowFrame *pFollow = SwFlowFrame::CastFlowFrame(pFrame)->GetFollow();