sw/source/uibase/utlui/content.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 35d8a3f15266e5280c9a1255417c47b5ad22a5e6
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Sun Jan 2 22:17:33 2022 -0900
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Sun Jan 9 04:50:29 2022 +0100

    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 <rayk...@gmail.com>

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 0be83743b438..19bf803c6fe9 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -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;
                 });

Reply via email to