sw/source/uibase/docvw/edtwin.cxx | 5 ++++- sw/source/uibase/inc/edtwin.hxx | 2 ++ sw/source/uibase/uiview/view2.cxx | 13 +++---------- 3 files changed, 9 insertions(+), 11 deletions(-)
New commits: commit 96bb91de5b00e08b42352dcf34195f92029f01b6 Author: Jim Raykowski <[email protected]> AuthorDate: Fri Oct 28 16:19:33 2022 -0800 Commit: Jim Raykowski <[email protected]> CommitDate: Sun Oct 30 04:25:14 2022 +0100 Outline folding: Use ToggleOutlineContentVisibility function here and add comments to explain the bSubs parameter Change-Id: I4a6874363d7355af2709607496a8eb6197eb164b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142003 Tested-by: Jenkins Reviewed-by: Jim Raykowski <[email protected]> diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 1f2ebc2151db..89554aea9803 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -6810,6 +6810,9 @@ SwFrameControlsManager& SwEditWin::GetFrameControlsManager() void SwEditWin::ToggleOutlineContentVisibility(const size_t nOutlinePos, const bool bSubs) { + // bSubs purpose is to set all sub level outline content to the same visibility as + // nOutlinePos outline content visibility is toggled. It is only applicable when not treating + // sub ouline levels as content. SwWrtShell& rSh = GetView().GetWrtShell(); if (GetView().GetDrawView()->IsTextEdit()) @@ -6827,7 +6830,7 @@ void SwEditWin::ToggleOutlineContentVisibility(const size_t nOutlinePos, const b } else if (bSubs) { - // toggle including sub levels + // also toggle sub levels to the same content visibilty SwOutlineNodes::size_type nPos = nOutlinePos; SwOutlineNodes::size_type nOutlineNodesCount = rSh.getIDocumentOutlineNodesAccess()->getOutlineNodesCount(); diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx index f4dda4c92165..e2a7ca97bcab 100644 --- a/sw/source/uibase/inc/edtwin.hxx +++ b/sw/source/uibase/inc/edtwin.hxx @@ -288,6 +288,8 @@ public: const SwTextFrame* GetSavedOutlineFrame() const { return m_pSavedOutlineFrame; } void SetSavedOutlineFrame(SwTextFrame* pFrame) { m_pSavedOutlineFrame = pFrame; } + // bSubs set true, sets all sub level outline content to same visibility as nOutlinePos. + // It is only applicable when not treating sub outline levels as content. void ToggleOutlineContentVisibility(const size_t nOutlinePos, const bool bSubs); virtual FactoryFunction GetUITestFactory() const override; diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 05b340459e58..2ba8c135d800 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1345,16 +1345,9 @@ void SwView::Execute(SfxRequest &rReq) break; case FN_TOGGLE_OUTLINE_CONTENT_VISIBILITY: { - m_pWrtShell->EnterStdMode(); - size_t nPos(m_pWrtShell->GetOutlinePos()); - if (nPos != SwOutlineNodes::npos) - { - SwNode* pNode = m_pWrtShell->GetNodes().GetOutLineNds()[nPos]; - pNode->GetTextNode()->SetAttrOutlineContentVisible( - !m_pWrtShell->GetAttrOutlineContentVisible(nPos)); - m_pWrtShell->InvalidateOutlineContentVisibility(); - m_pWrtShell->GotoOutline(nPos); - } + size_t nPos(m_pWrtShell->GetOutlinePos()); + if (nPos != SwOutlineNodes::npos) + GetEditWin().ToggleOutlineContentVisibility(nPos, false); } break; case FN_NAV_ELEMENT:
