summaryrefslogtreecommitdiff
path: root/sw/source/uibase/utlui
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2023-10-09 20:22:04 -0800
committerJim Raykowski <raykowj@gmail.com>2023-10-17 07:24:37 +0200
commit2a05fd0fd2b6c4ad8fd900565f3640f1ef47a165 (patch)
tree563257e1fac5b9fc9d629586701856d88497e3a6 /sw/source/uibase/utlui
parentb97aa4eada3164b20f663a9817e92af78495109f (diff)
tdf#144349 related: Make master document navigator track Text content
Done, with a related patch to make the master document navigator track TOX content, to make the Navigator less likely not to have an item selected, which may be enough to resolve tdf#155741 - Allow insertion of items into master without a selected item Change-Id: I1a9d2a12a01ca2c5f3f162e8da932c04ced9a461 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157741 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw/source/uibase/utlui')
-rw-r--r--sw/source/uibase/utlui/glbltree.cxx28
1 files changed, 27 insertions, 1 deletions
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index fe18195e7c22..8c8fef089161 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -787,12 +787,12 @@ IMPL_LINK_NOARG(SwGlobalTree, Timeout, Timer *, void)
}
}
+// track GlobalDocContentType at the cursor position in the document
void SwGlobalTree::UpdateTracking()
{
if (!m_pActiveShell)
return;
- // track section at cursor position in document
m_xTreeView->unselect_all();
const SwSection* pActiveShellCurrSection = m_pActiveShell->GetCurrSection();
@@ -816,6 +816,32 @@ void SwGlobalTree::UpdateTracking()
}
}
}
+ else
+ {
+ const SwCursor* pCursor = m_pActiveShell->GetCursor();
+ const SwNode& rNode = pCursor->GetPoint()->GetNode();
+ if (rNode.IsTextNode())
+ {
+ // only the first text node in each series of text nodes is stored in the
+ // SwGlblDocContents array
+ SwNodeIndex aIdx(rNode);
+ do
+ {
+ --aIdx;
+ } while (aIdx.GetNode().IsTextNode());
+ ++aIdx;
+ SwNodeOffset aTextNodeIndex(aIdx.GetNode().GetIndex());
+ for (const std::unique_ptr<SwGlblDocContent>& rGlblDocContent : *m_pSwGlblDocContents)
+ {
+ if (rGlblDocContent->GetType() == GlobalDocContentType::GLBLDOC_UNKNOWN
+ && rGlblDocContent->GetDocPos() == aTextNodeIndex)
+ {
+ const OUString& rId(weld::toId(rGlblDocContent.get()));
+ m_xTreeView->select(m_xTreeView->find_id(rId));
+ }
+ }
+ }
+ }
Select();
}