From b9cc6653606c829805c6c01b9613a3a25d81c20b Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Mon, 26 Sep 2016 14:18:17 +0200
Subject: sw lok: fix cursor position after inserting a comment

Make sure SwVisibleCursor::SetPosAndShow() doesn't emit LOK callbacks
till a comment window is active.

Need to invoke the unit test from desktop/, as the sw tests have the
status bar disabled.

Change-Id: Iab26024e9bb4da9c939bbd6cf769ec5c4dcb9a19
---
 sw/source/core/crsr/viscrs.cxx | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'sw')

diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 0e848b88a859..7a886e964c21 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -59,6 +59,7 @@
 #include <sfx2/lokhelper.hxx>
 #include <comphelper/string.hxx>
 #include <paintfrm.hxx>
+#include <PostItMgr.hxx>
 
 // Here static members are defined. They will get changed on alteration of the
 // MapMode. This is done so that on ShowCursor the same size does not have to be
@@ -182,7 +183,14 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell* pViewShell)
 
     m_aTextCursor.SetPos( aRect.Pos() );
 
-    if (comphelper::LibreOfficeKit::isActive())
+    bool bPostItActive = false;
+    if (auto pView = dynamic_cast<SwView*>(m_pCursorShell->GetSfxViewShell()))
+    {
+        if (SwPostItMgr* pPostItMgr = pView->GetPostItMgr())
+            bPostItActive = pPostItMgr->GetActiveSidebarWin() != nullptr;
+    }
+
+    if (comphelper::LibreOfficeKit::isActive() && !bPostItActive)
     {
         // notify about page number change (if that happened)
         sal_uInt16 nPage, nVirtPage;
-- 
cgit