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

New commits:
commit f7e2f5bca938aa916830e07895d2da6820282055
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Fri Mar 13 23:24:47 2020 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Sun Nov 29 20:52:19 2020 +0100

    tdf#131218 Assure standard mode at shell before goto content
    
    Also resolves tdf#133039
    
    This is a copy of SwPostItMgr::AssureStdModeAtShell with an addition of
    EnterStdMode used when not in frame mode and no object is selected. It
    makes focus on content, from Navigator goto content, work as expected
    for all content types.
    
    Change-Id: Id23ea8f603b7f5d90f1e23f1eb82db292c71c499
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90487
    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 9dd4e661370c..6eceb15435eb 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -4268,9 +4268,34 @@ void SwContentTree::EditEntry(const weld::TreeIter& 
rEntry, EditEntryMode nMode)
     }
 }
 
+static void lcl_AssureStdModeAtShell(SwWrtShell* pWrtShell)
+{
+    // deselect any drawing or frame and leave editing mode
+    SdrView* pSdrView = pWrtShell->GetDrawView();
+    if (pSdrView && pSdrView->IsTextEdit() )
+    {
+        bool bLockView = pWrtShell->IsViewLocked();
+        pWrtShell->LockView(true);
+        pWrtShell->EndTextEdit();
+        pWrtShell->LockView(bLockView);
+    }
+
+    if (pWrtShell->IsSelFrameMode() || pWrtShell->IsObjSelected())
+    {
+        pWrtShell->UnSelectFrame();
+        pWrtShell->LeaveSelFrameMode();
+        pWrtShell->GetView().LeaveDrawCreate();
+        pWrtShell->EnterStdMode();
+        pWrtShell->DrawSelChanged();
+        pWrtShell->GetView().StopShellTimer();
+    }
+    else
+        pWrtShell->EnterStdMode();
+}
+
 void SwContentTree::GotoContent(const SwContent* pCnt)
 {
-    m_pActiveShell->EnterStdMode();
+    lcl_AssureStdModeAtShell(m_pActiveShell);
 
     bool bSel = false;
     switch(pCnt->GetParent()->GetType())
@@ -4327,7 +4352,6 @@ void SwContentTree::GotoContent(const SwContent* pCnt)
         }
         break;
         case ContentTypeId::POSTIT:
-            m_pActiveShell->GetView().GetPostItMgr()->AssureStdModeAtShell();
             m_pActiveShell->GotoFormatField(*static_cast<const 
SwPostItContent*>(pCnt)->GetPostIt());
         break;
         case ContentTypeId::DRAWOBJECT:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to