diff options
author | Jim Raykowski <raykowj@gmail.com> | 2021-09-16 21:02:44 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2021-09-29 08:57:00 +0200 |
commit | 38eb9a0594393e263f57701702974a030d3327de (patch) | |
tree | 52e20b5213436e340aa835b82eff699849b26710 /sw | |
parent | a69987dfd496413792d9bef5cb071615dd7ab375 (diff) |
tdf#144335 SwNavigator: Table tracking option
Adds a check button to the table context menu in the content tree to
turn table tracking on or off.
Change-Id: I787dc2f3e3b465d7f25a9e16b5f5491dc2d933d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122218
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/inc/conttree.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 21 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/navigatorcontextmenu.ui | 8 |
3 files changed, 28 insertions, 2 deletions
diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index 78e078cc78f3..9364e36c6181 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -112,6 +112,7 @@ class SwContentTree final : public SfxListener sal_uInt8 m_nOutlineLevel; sal_uInt32 m_nOutlineTracking = 1; + bool m_bTableTracking = true; enum class State { ACTIVE, CONSTANT, HIDDEN } m_eState; diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 5933b3cf26f8..ae46fe4272c6 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1570,6 +1570,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) bool bRemoveToggleExpandEntry = true; bool bRemoveChapterEntries = true; bool bRemoveSendOutlineEntry = true; + bool bRemoveTableTracking = true; // Edit only if the shown content is coming from the current view. if (State::HIDDEN != m_eState && @@ -1632,6 +1633,8 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) bool bProt = m_pActiveShell->HasTableAnyProtection( &sTableName, &bFull ); xPop->set_sensitive(OString::number(403), !bFull); xPop->set_sensitive(OString::number(404), bProt); + xPop->set_active("tabletracking", m_bTableTracking); + bRemoveTableTracking = false; bRemoveDeleteEntry = false; } else if(ContentTypeId::DRAWOBJECT == nContentType) @@ -1684,11 +1687,16 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) bRemoveToggleExpandEntry = lcl_InsertExpandCollapseAllItem(*m_xTreeView, *xEntry, *xPop); } - if (State::HIDDEN != m_eState && + else if (State::HIDDEN != m_eState && pType->GetType() == ContentTypeId::POSTIT && !m_pActiveShell->GetView().GetDocShell()->IsReadOnly() && pType->GetMemberCount() > 0) bRemovePostItEntries = false; + else if (ContentTypeId::TABLE == pType->GetType()) + { + xPop->set_active("tabletracking", m_bTableTracking); + bRemoveTableTracking = false; + } } } @@ -1773,6 +1781,9 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) xPop->remove("separator1511"); } + if (bRemoveTableTracking) + xPop->remove("tabletracking"); + OString sCommand = xPop->popup_at_rect(m_xTreeView.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))); if (!sCommand.isEmpty()) ExecuteContextMenuAction(sCommand); @@ -3552,7 +3563,7 @@ void SwContentTree::UpdateTracking() return; } // table - if (m_pActiveShell->IsCursorInTable() && + if (m_bTableTracking && m_pActiveShell->IsCursorInTable() && !(m_bIsRoot && m_nRootType != ContentTypeId::TABLE)) { if(m_pActiveShell->GetTableFormat()) @@ -4062,6 +4073,12 @@ IMPL_LINK(SwContentTree, QueryTooltipHdl, const weld::TreeIter&, rEntry, OUStrin void SwContentTree::ExecuteContextMenuAction(const OString& rSelectedPopupEntry) { + if (rSelectedPopupEntry == "tabletracking") + { + m_bTableTracking = !m_bTableTracking; + return; + } + std::unique_ptr<weld::TreeIter> xFirst(m_xTreeView->make_iterator()); if (!m_xTreeView->get_selected(xFirst.get())) xFirst.reset(); diff --git a/sw/uiconfig/swriter/ui/navigatorcontextmenu.ui b/sw/uiconfig/swriter/ui/navigatorcontextmenu.ui index 8c27c7e07c28..c3a5b64bde47 100644 --- a/sw/uiconfig/swriter/ui/navigatorcontextmenu.ui +++ b/sw/uiconfig/swriter/ui/navigatorcontextmenu.ui @@ -231,6 +231,14 @@ </object> </child> <child> + <object class="GtkCheckMenuItem" id="tabletracking"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="navigatorcontextmenu|STR_TABLE_TRACKING">Table Tracking</property> + <property name="use_underline">True</property> + </object> + </child> + <child> <object class="GtkMenuItem" id="2"> <property name="visible">True</property> <property name="can_focus">False</property> |