From 93add00ee5c90b2a7fec9046eaa0eea767f37875 Mon Sep 17 00:00:00 2001 From: Jim Raykowski Date: Fri, 8 Jan 2021 18:42:30 -0900 Subject: Navigator outline content visibility menu item related fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fixes crash that occurs using Hide All - fixes logic used for Hide/Show All - adds comments for Toggle, Hide All and Show All popup menu items ids Change-Id: I87076c606e3d2bc49f5fe7d07119c6c74237f3e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109027 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sw/source/uibase/utlui/content.cxx | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index ec33b083d487..5ac56dbabc43 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1177,9 +1177,10 @@ static bool lcl_InsertExpandCollapseAllItem(const weld::TreeView& rContentTree, static void lcl_SetOutlineContentEntriesSensitivities(SwContentTree* pThis, const weld::TreeView& rContentTree, const weld::TreeIter& rEntry, weld::Menu& rPop) { - // If anybody knows what these magic numbers mean, please either - // add a comment here, or replace them with some suitable symbolic - // names that are defined somewhere else. + + // 1512 toggle outline content visibility of the selected outline entry + // 1513 make the outline content of the selected outline entry and children not visible + // 1514 make the outline content of the selected entry and children visible rPop.set_sensitive(OString::number(1512), false); rPop.set_sensitive(OString::number(1513), false); rPop.set_sensitive(OString::number(1514), false); @@ -3780,18 +3781,13 @@ void SwContentTree::ExecuteContextMenuAction(const OString& rSelectedPopupEntry) auto nSelectedPopupEntry = rSelectedPopupEntry.toUInt32(); switch (nSelectedPopupEntry) { - case 1512: // fold or unfold outline content of selected entry - case 1513: // fold outline content of selected entry and descendants - case 1514: // unfold outline content of selected entry and descendants + case 1512: // toggle outline content visibility of the selected outline entry + case 1513: // make the outline content of the selected outline entry and children not visible + case 1514: // make the outline content of the selected entry and children visible { m_pActiveShell->EnterStdMode(); m_bIgnoreViewChange = true; SwOutlineContent* pCntFirst = reinterpret_cast(m_xTreeView->get_id(*xFirst).toInt64()); - if (lcl_IsContentType(*xFirst, *m_xTreeView)) // Headings root entry - m_pActiveShell->GotoPage(1, true); - else - GotoContent(pCntFirst); - grab_focus(); if (nSelectedPopupEntry == 1512) { m_pActiveShell->ToggleOutlineContentVisibility(pCntFirst->GetOutlinePos()); @@ -3808,14 +3804,20 @@ void SwContentTree::ExecuteContextMenuAction(const OString& rSelectedPopupEntry) nLevel = m_pActiveShell->getIDocumentOutlineNodesAccess()->getOutlineLevel(nPos); else nPos = 0; - bool bFold(nSelectedPopupEntry == 1514); + bool bShow(nSelectedPopupEntry == 1514); do { - if (!m_pActiveShell->IsOutlineContentVisible(nPos) == bFold) + if (m_pActiveShell->IsOutlineContentVisible(nPos) != bShow) m_pActiveShell->ToggleOutlineContentVisibility(nPos); } while (++nPos < nOutlineNodesCount && (nLevel == -1 || m_pActiveShell->getIDocumentOutlineNodesAccess()->getOutlineLevel(nPos) > nLevel)); } + // show in the document what was toggled + if (lcl_IsContentType(*xFirst, *m_xTreeView)) // Headings root entry + m_pActiveShell->GotoPage(1, true); + else + GotoContent(pCntFirst); + grab_focus(); m_bIgnoreViewChange = false; } break; -- cgit v1.2.3