[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - 2 commits - desktop/source sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Sep 23 07:40:46 UTC 2016


 desktop/source/lib/init.cxx                    |    2 +-
 sw/qa/extras/tiledrendering/tiledrendering.cxx |    8 +++++++-
 sw/source/core/crsr/crsrsh.cxx                 |    8 +++++++-
 sw/source/core/crsr/viscrs.cxx                 |    3 ---
 4 files changed, 15 insertions(+), 6 deletions(-)

New commits:
commit 53c803cf560f9b6bd4f1d5c72241755688adbf03
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Sep 22 10:52:45 2016 +0200

    sw: move LOK_CALLBACK_VIEW_CURSOR_VISIBLE to SwCursorShell
    
    That's where the non-view variant is emitted, and SwVisibleCursor
    said visibility=false even if the cursor was expected to be
    visible.
    
    Also fix the test callback that checked if the payload is equal to the
    "true" literal, but actually the payload was a JSON.
    
    (cherry picked from commit e387193eab0e4729d02b6ffd2c972c3d71942947)
    
    Conflicts:
    	sw/source/core/crsr/crsrsh.cxx
    
    Change-Id: Ifa0e23eb274925e8ab8ef5e7c21370ad2cd22282

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index f6fb64f..b61a110 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -707,7 +707,10 @@ public:
         break;
         case LOK_CALLBACK_VIEW_CURSOR_VISIBLE:
         {
-            m_bViewCursorVisible = OString("true") == pPayload;
+            std::stringstream aStream(pPayload);
+            boost::property_tree::ptree aTree;
+            boost::property_tree::read_json(aStream, aTree);
+            m_bViewCursorVisible = aTree.get_child("visible").get_value<std::string>() == "true";
         }
         break;
         case LOK_CALLBACK_GRAPHIC_VIEW_SELECTION:
@@ -871,6 +874,8 @@ void SwTiledRenderingTest::testViewCursorVisibility()
     pXTextDocument->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
     ViewCallback aView2;
     SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2);
+    // This failed, initially the view cursor in the second view wasn't visible.
+    CPPUNIT_ASSERT(aView2.m_bViewCursorVisible);
 
     // Click on the shape in the second view.
     aView1.m_bViewCursorVisible = true;
@@ -1374,6 +1379,7 @@ void SwTiledRenderingTest::testCreateViewGraphicSelection()
     SdrView* pView = pWrtShell->GetDrawView();
     aView1.m_bGraphicSelection = true;
     pView->MarkObj(pObject, pView->GetSdrPageView());
+    pWrtShell->HideCursor();
     CPPUNIT_ASSERT(aView1.m_bGraphicSelection);
 
     // Create a second view.
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 99f75a4..f45cc95 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1247,8 +1247,14 @@ void SwCursorShell::NotifyCursor(SfxViewShell* pOtherShell) const
     }
     else
     {
-        // Cursor position and visibility.
+        // Cursor position.
         m_pVisibleCursor->_SetPosAndShow(pOtherShell);
+        // Cursor visibility.
+        if (GetSfxViewShell() != pOtherShell)
+        {
+            OString aPayload = OString::boolean(m_bSVCursorVis);
+            SfxLokHelper::notifyOtherView(GetSfxViewShell(), pOtherShell, LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", aPayload);
+        }
         // Text selection.
         m_pCurrentCursor->Show(pOtherShell);
         // Graphic selection.
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 4ac52fb..01c851d 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -204,10 +204,7 @@ void SwVisibleCursor::_SetPosAndShow(SfxViewShell* pViewShell)
             if (pViewShell == m_pCursorShell->GetSfxViewShell())
                 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr());
             else
-            {
                 SfxLokHelper::notifyOtherView(m_pCursorShell->GetSfxViewShell(), pViewShell, LOK_CALLBACK_INVALIDATE_VIEW_CURSOR, "rectangle", sRect);
-                SfxLokHelper::notifyOtherView(m_pCursorShell->GetSfxViewShell(), pViewShell, LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", OString::boolean(m_bIsVisible));
-            }
         }
         else
         {
commit 0c5d3abd55ce8385642065aa28ad5d56a9fb62dd
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Sep 22 09:11:55 2016 +0200

    desktop: guard against nullptr frame in doc_registerCallback()
    
    Change-Id: I96956d6631ed574c06df62e9b633d7e1e4d5a5f2
    (cherry picked from commit a912ec7dad25bdb099f80f18b7f8d4892747000b)

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index fcb27d9..6e0d2c0 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1633,7 +1633,7 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis,
         }
     }
 
-    if (SfxViewShell* pViewShell = SfxViewFrame::Current()->GetViewShell())
+    if (SfxViewShell* pViewShell = SfxViewShell::Current())
         pViewShell->registerLibreOfficeKitViewCallback(CallbackFlushHandler::callback, pDocument->mpCallbackFlushHandlers[nView].get());
 }
 


More information about the Libreoffice-commits mailing list