SwNavigator: Fix outline select when table is the only content

Prior to this patch for outline content having only a table(s), right-
click on an outline entry without the cursor and choosing 'Select' from
the context menu only selects the outline paragraph when the current
cursor position in the document is after the outline to be selected.
The solution given here is to move the document cursor to the outline
being selected before the outline selection is made.

Change-Id: Ie25bfc81306dfb10a8ced8369e0ee7de0f3eacff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127884
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
This commit is contained in:
Jim Raykowski
2022-01-02 22:17:33 -09:00
parent 3a683edd9c
commit 35d8a3f152

View File

@@ -4645,10 +4645,16 @@ void SwContentTree::ExecuteContextMenuAction(const OString& rSelectedPopupEntry)
const ContentTypeId eTypeId = pCnt->GetParent()->GetType();
if (eTypeId == ContentTypeId::OUTLINE)
{
SwOutlineNodes::size_type nActPos = reinterpret_cast<SwOutlineContent*>(
m_xTreeView->get_id(*xFirst).toInt64())->GetOutlinePos();
m_pActiveShell->GotoOutline(nActPos);
m_xTreeView->selected_foreach([this](weld::TreeIter& rEntry){
SwOutlineNodes::size_type nPos = reinterpret_cast<SwOutlineContent*>(
m_xTreeView->get_id(rEntry).toInt64())->GetOutlinePos();
m_pActiveShell->SttSelect();
SwOutlineNodes::size_type nActPos = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(rEntry).toInt64())->GetOutlinePos();
m_pActiveShell->MakeOutlineSel(nActPos, nActPos, !m_xTreeView->get_row_expanded(rEntry), false); // select children if not expanded
// select children if not expanded and don't kill PaMs
m_pActiveShell->MakeOutlineSel(nPos, nPos,
!m_xTreeView->get_row_expanded(rEntry), false);
m_pActiveShell->EndSelect();
return false;
});