sw/source/uibase/wrtsh/wrtsh1.cxx | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-)
New commits: commit 2be1605cdab5e3662ea0180fb607f3968cc8716c Author: Jim Raykowski <[email protected]> AuthorDate: Thu Sep 23 18:42:10 2021 -0800 Commit: Jim Raykowski <[email protected]> CommitDate: Fri Sep 24 06:58:32 2021 +0200 Fix outline folding when table or section node is the next node after an outline node Change-Id: I117b3f6253d5b64b3fc1b28f4b8a3e595c44abef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122547 Tested-by: Jenkins Reviewed-by: Jim Raykowski <[email protected]> diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index d0ca5fa4b4a8..3d9e09e5d065 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -2032,6 +2032,7 @@ void SwWrtShell::InsertPostIt(SwFieldMgr& rFieldMgr, const SfxRequest& rReq) pFormat->Broadcast( SwFormatFieldHint( nullptr, SwFormatFieldHintWhich::FOCUS, &GetView() ) ); } } + bool SwWrtShell::IsOutlineContentVisible(const size_t nPos) { const SwOutlineNodes& rOutlineNodes = GetDoc()->GetNodes().GetOutLineNds(); @@ -2047,20 +2048,37 @@ bool SwWrtShell::IsOutlineContentVisible(const size_t nPos) if (&aIdx.GetNode() == &aIdx.GetNodes().GetEndOfContent()) // end of regular content return false; - if (aIdx.GetNode().IsTextNode()) + if (aIdx.GetNode().IsTextNode() || aIdx.GetNode().IsTableNode() || + aIdx.GetNode().IsSectionNode()) { - // sublevels treated as outline content - // If next node (aIdx) doesn't have a layout frame - // then this outline node does not have visible outline content. - // sublevels NOT treated as outline content - // If the next node (aIdx) is the next outline node - // then return the outline content visible attribute value. + // * sublevels treated as outline content + // If next node (aIdx) doesn't have a layout frame + // then this outline node does not have visible outline content. + // * sublevels NOT treated as outline content + // If the next node (aIdx) is the next outline node + // then return the outline content visible attribute value. if (!GetViewOptions()->IsTreatSubOutlineLevelsAsContent() && nPos + 1 < rOutlineNodes.size() && rOutlineNodes[nPos + 1] == &aIdx.GetNode()) return GetAttrOutlineContentVisible(nPos); - return aIdx.GetNode().GetTextNode()->getLayoutFrame(nullptr); + if (aIdx.GetNode().IsTextNode()) + return aIdx.GetNode().GetTextNode()->getLayoutFrame(nullptr); + if (aIdx.GetNode().IsTableNode()) + { + SwTable& rTable = aIdx.GetNode().GetTableNode()->GetTable(); + return rTable.HasLayout(); + } + if (aIdx.GetNode().IsSectionNode()) + { + const SwSectionFormat* pFormat = + aIdx.GetNode().GetSectionNode()->GetSection().GetFormat(); + if (!pFormat) + return false; + SwPtrMsgPoolItem aAskItem(RES_CONTENT_VISIBLE, nullptr); + pFormat->GetInfo(aAskItem); + return aAskItem.pObject; + } } return true;
