summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2021-01-08 18:42:30 -0900
committerCaolán McNamara <caolanm@redhat.com>2021-01-09 20:22:17 +0100
commit93add00ee5c90b2a7fec9046eaa0eea767f37875 (patch)
tree9f3dd3529eb18fe00e5aa1983cd693ce78f7234c
parent12d309940cd1aa26fb07c9dce2778e5811276190 (diff)
Navigator outline content visibility menu item related fixes
- 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 <caolanm@redhat.com>
-rw-r--r--sw/source/uibase/utlui/content.cxx28
1 files 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<SwOutlineContent*>(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;