[Libreoffice-commits] core.git: sw/source sw/uiconfig
Jim Raykowski (via logerrit)
logerrit at kemper.freedesktop.org
Mon Oct 4 06:58:18 UTC 2021
sw/source/uibase/inc/conttree.hxx | 1
sw/source/uibase/utlui/content.cxx | 27 ++++++++++++++++++++-----
sw/uiconfig/swriter/ui/navigatorcontextmenu.ui | 8 +++++++
3 files changed, 31 insertions(+), 5 deletions(-)
New commits:
commit c8aa07cae1821560a5bc6f15168f11e2407556c1
Author: Jim Raykowski <raykowj at gmail.com>
AuthorDate: Wed Sep 29 20:56:57 2021 -0800
Commit: Jim Raykowski <raykowj at gmail.com>
CommitDate: Mon Oct 4 08:57:43 2021 +0200
tdf#144817 SwNavigator: Section tracking option
Add a check button to the section context menu in the content tree to
turn section tracking on or off.
Change-Id: Ib8c49626f31f41cf85818630d126dee98e1db809
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122844
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj at gmail.com>
diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx
index 9364e36c6181..2e321c9c23ba 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -113,6 +113,7 @@ class SwContentTree final : public SfxListener
sal_uInt32 m_nOutlineTracking = 1;
bool m_bTableTracking = true;
+ bool m_bSectionTracking = 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 dfb49bc7f6b3..da92775a4ba0 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1598,6 +1598,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
bool bRemoveChapterEntries = true;
bool bRemoveSendOutlineEntry = true;
bool bRemoveTableTracking = true;
+ bool bRemoveSectionTracking = true;
// Edit only if the shown content is coming from the current view.
if (State::HIDDEN != m_eState &&
@@ -1670,8 +1671,10 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
}
else if(ContentTypeId::REGION == nContentType)
{
+ xPop->set_active("sectiontracking", m_bSectionTracking);
bRemoveSelectEntry = false;
bRemoveEditEntry = false;
+ bRemoveSectionTracking = false;
}
else
{
@@ -1702,7 +1705,8 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
m_xTreeView->get_id(*xEntry).toInt64())->GetParent();
if (pType)
{
- if (ContentTypeId::OUTLINE == pType->GetType())
+ const ContentTypeId nContentType = pType->GetType();
+ if (ContentTypeId::OUTLINE == nContentType)
{
bOutline = true;
if (State::HIDDEN != m_eState)
@@ -1715,15 +1719,20 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
*xPop);
}
else if (State::HIDDEN != m_eState &&
- pType->GetType() == ContentTypeId::POSTIT &&
+ nContentType == ContentTypeId::POSTIT &&
!m_pActiveShell->GetView().GetDocShell()->IsReadOnly() &&
pType->GetMemberCount() > 0)
bRemovePostItEntries = false;
- else if (ContentTypeId::TABLE == pType->GetType())
+ else if (ContentTypeId::TABLE == nContentType)
{
xPop->set_active("tabletracking", m_bTableTracking);
bRemoveTableTracking = false;
}
+ else if (ContentTypeId::REGION == nContentType)
+ {
+ xPop->set_active("sectiontracking", m_bSectionTracking);
+ bRemoveSectionTracking = false;
+ }
}
}
@@ -1811,6 +1820,9 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
if (bRemoveTableTracking)
xPop->remove("tabletracking");
+ if (bRemoveSectionTracking)
+ xPop->remove("sectiontracking");
+
OString sCommand = xPop->popup_at_rect(m_xTreeView.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)));
if (!sCommand.isEmpty())
ExecuteContextMenuAction(sCommand);
@@ -3663,8 +3675,8 @@ void SwContentTree::UpdateTracking()
return;
}
// section
- if (const SwSection* pSection = m_pActiveShell->GetCurrSection(); pSection &&
- !(m_bIsRoot && m_nRootType != ContentTypeId::REGION))
+ if (const SwSection* pSection = m_pActiveShell->GetCurrSection(); m_bSectionTracking &&
+ pSection && !(m_bIsRoot && m_nRootType != ContentTypeId::REGION))
{
lcl_SelectByContentTypeAndName(this, *m_xTreeView, SwResId(STR_CONTENT_TYPE_REGION),
pSection->GetSectionName());
@@ -4164,6 +4176,11 @@ void SwContentTree::ExecuteContextMenuAction(const OString& rSelectedPopupEntry)
m_bTableTracking = !m_bTableTracking;
return;
}
+ if (rSelectedPopupEntry == "sectiontracking")
+ {
+ m_bSectionTracking = !m_bSectionTracking;
+ return;
+ }
std::unique_ptr<weld::TreeIter> xFirst(m_xTreeView->make_iterator());
if (!m_xTreeView->get_selected(xFirst.get()))
diff --git a/sw/uiconfig/swriter/ui/navigatorcontextmenu.ui b/sw/uiconfig/swriter/ui/navigatorcontextmenu.ui
index c3a5b64bde47..db918b084bb0 100644
--- a/sw/uiconfig/swriter/ui/navigatorcontextmenu.ui
+++ b/sw/uiconfig/swriter/ui/navigatorcontextmenu.ui
@@ -238,6 +238,14 @@
<property name="use_underline">True</property>
</object>
</child>
+ <child>
+ <object class="GtkCheckMenuItem" id="sectiontracking">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="navigatorcontextmenu|STR_SECTION_TRACKING">Section Tracking</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
<child>
<object class="GtkMenuItem" id="2">
<property name="visible">True</property>
More information about the Libreoffice-commits
mailing list