diff options
author | Jim Raykowski <raykowj@gmail.com> | 2020-09-24 18:12:59 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2020-09-26 03:46:57 +0200 |
commit | a5c830a81077319d753d8cadd857448f0a1952a9 (patch) | |
tree | e55ce6b5c69fa846e9448a47baed95c02e85257e | |
parent | 06b9e703f536e2751e3cd584873e00907672cf2d (diff) |
Writer Navigator hidden state fixes
Document drop on Writer Navigator creates a hidden shell. This patch
disallows context menu items that require non-hidden shell content.
Change-Id: I25fd86f923c9187fe4c37215ba2b84f9d11912b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103363
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 97dc04351d26..353ee2bad359 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1362,7 +1362,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) if (!m_xTreeView->get_selected(xEntry.get())) xEntry.reset(); - if (!xEntry || !lcl_IsContent(*xEntry, *m_xTreeView)) + if (State::HIDDEN == m_eState || !xEntry || !lcl_IsContent(*xEntry, *m_xTreeView)) xPop->remove(OString::number(900)); // go to bool bRemovePostItEntries = true; @@ -1377,7 +1377,8 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) bool bRemoveSendOutlineEntry = true; // Edit only if the shown content is coming from the current view. - if ((State::ACTIVE == m_eState || m_pActiveShell == pActiveView->GetWrtShellPtr()) + if (State::HIDDEN != m_eState && + (State::ACTIVE == m_eState || m_pActiveShell == pActiveView->GetWrtShellPtr()) && xEntry && lcl_IsContent(*xEntry, *m_xTreeView)) { assert(dynamic_cast<SwContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xEntry).toInt64()))); @@ -1468,17 +1469,32 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) } else if (xEntry) { - assert(dynamic_cast<SwContentType*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xEntry).toInt64()))); - SwContentType* pType = reinterpret_cast<SwContentType*>(m_xTreeView->get_id(*xEntry).toInt64()); - if (ContentTypeId::OUTLINE == pType->GetType()) + const SwContentType* pType; + if (lcl_IsContentType(*xEntry, *m_xTreeView)) + pType = reinterpret_cast<SwContentType*>(m_xTreeView->get_id(*xEntry).toInt64()); + else + pType = reinterpret_cast<SwContent*>( + m_xTreeView->get_id(*xEntry).toInt64())->GetParent(); + if (pType) { - bOutline = true; - lcl_SetOutlineContentEntriesSensitivities(this, *m_xTreeView, *xEntry, *xSubPopOutlineContent); - bRemoveToggleExpandEntry = lcl_InsertExpandCollapseAllItem(*m_xTreeView, *xEntry, *xPop); - bRemoveSendOutlineEntry = false; + if (ContentTypeId::OUTLINE == pType->GetType()) + { + bOutline = true; + if (State::HIDDEN != m_eState) + { + lcl_SetOutlineContentEntriesSensitivities(this, *m_xTreeView, *xEntry, + *xSubPopOutlineContent); + bRemoveSendOutlineEntry = false; + } + bRemoveToggleExpandEntry = lcl_InsertExpandCollapseAllItem(*m_xTreeView, *xEntry, + *xPop); + } + if (State::HIDDEN != m_eState && + pType->GetType() == ContentTypeId::POSTIT && + !m_pActiveShell->GetView().GetDocShell()->IsReadOnly() && + pType->GetMemberCount() > 0) + bRemovePostItEntries = false; } - if ( (pType->GetType() == ContentTypeId::POSTIT) && (!m_pActiveShell->GetView().GetDocShell()->IsReadOnly()) && ( pType->GetMemberCount() > 0) ) - bRemovePostItEntries = false; } if (bRemoveToggleExpandEntry) @@ -1547,12 +1563,15 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) { xSubPop1.reset(); xPop->remove(OString::number(1)); // outline level menu + } + if (!bOutline || State::HIDDEN == m_eState) + { xSubPopOutlineTracking.reset(); xPop->remove(OString::number(4)); // outline tracking menu } - if (!bOutline - || !m_pActiveShell->GetViewOptions()->IsShowOutlineContentVisibilityButton() - || m_pActiveShell->getIDocumentOutlineNodesAccess()->getOutlineNodesCount() == 0) + if (!bOutline || State::HIDDEN == m_eState || + !m_pActiveShell->GetViewOptions()->IsShowOutlineContentVisibilityButton() || + m_pActiveShell->getIDocumentOutlineNodesAccess()->getOutlineNodesCount() == 0) { xSubPopOutlineContent.reset(); xPop->remove(OString::number(5)); // outline content menu |