summaryrefslogtreecommitdiff
path: root/sw/source/uibase/utlui
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2021-09-16 21:02:44 -0800
committerJim Raykowski <raykowj@gmail.com>2021-09-29 08:57:00 +0200
commit38eb9a0594393e263f57701702974a030d3327de (patch)
tree52e20b5213436e340aa835b82eff699849b26710 /sw/source/uibase/utlui
parenta69987dfd496413792d9bef5cb071615dd7ab375 (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/source/uibase/utlui')
-rw-r--r--sw/source/uibase/utlui/content.cxx21
1 files changed, 19 insertions, 2 deletions
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();