SwNavigator content tracking: clear selections and entry cursor

when entry is not found in content tree

This happens when the document cursor is positioned on table of content
hyperlinks.

Change-Id: I717b2dae31780b26cf5450fbea0c8f461659770c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132989
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
This commit is contained in:
Jim Raykowski
2022-04-13 18:44:19 -08:00
parent 7337c41813
commit f7102dafc4

View File

@@ -3257,7 +3257,11 @@ static void lcl_SelectByContentTypeAndAddress(SwContentTree* pThis, weld::TreeVi
ContentTypeId nType, const void* ptr) ContentTypeId nType, const void* ptr)
{ {
if (!ptr) if (!ptr)
{
rContentTree.set_cursor(-1);
pThis->Select();
return; return;
}
// find content type entry // find content type entry
std::unique_ptr<weld::TreeIter> xIter(rContentTree.make_iterator()); std::unique_ptr<weld::TreeIter> xIter(rContentTree.make_iterator());
@@ -3273,7 +3277,11 @@ static void lcl_SelectByContentTypeAndAddress(SwContentTree* pThis, weld::TreeVi
} }
if (!bFoundEntry) if (!bFoundEntry)
{
rContentTree.set_cursor(-1);
pThis->Select();
return; return;
}
// assure content type entry is expanded // assure content type entry is expanded
rContentTree.expand_row(*xIter); rContentTree.expand_row(*xIter);
@@ -3332,6 +3340,10 @@ static void lcl_SelectByContentTypeAndAddress(SwContentTree* pThis, weld::TreeVi
return; return;
} }
} }
rContentTree.set_cursor(-1);
pThis->Select();
return;
} }
static void lcl_SelectByContentTypeAndName(SwContentTree* pThis, weld::TreeView& rContentTree, static void lcl_SelectByContentTypeAndName(SwContentTree* pThis, weld::TreeView& rContentTree,