[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 2 commits - framework/source sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Sep 18 06:10:24 PDT 2015


Rebased ref, commits from common ancestor:
commit 2aa9079c4709f18e5943bdc9c879d17b97cbb855
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Sep 18 14:32:53 2015 +0200

    sw: implement per-view LOK_CALLBACK_CURSOR_VISIBLE
    
    Change-Id: I4e00679547997cfb3dafe603b908f055011a3b30

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 46c4fc2..9f14b4d 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -23,6 +23,7 @@
 #include <hintids.hxx>
 #include <svx/svdmodel.hxx>
 #include <editeng/frmdiritem.hxx>
+#include <sfx2/viewsh.hxx>
 #include <SwSmartTagMgr.hxx>
 #include <doc.hxx>
 #include <rootfrm.hxx>
@@ -62,6 +63,7 @@
 #include <comcore.hrc>
 #include <IDocumentLayoutAccess.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <comphelper/lok.hxx>
 
 using namespace com::sun::star;
 using namespace util;
@@ -2109,8 +2111,13 @@ void SwCrsrShell::ShowCrsr()
         m_bSVCrsrVis = true;
         m_pCurCrsr->SetShowTextInputFieldOverlay( true );
 
-        if (isTiledRendering())
-            libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr());
+        if (comphelper::LibreOfficeKit::isActive())
+        {
+            if (comphelper::LibreOfficeKit::isViewCallback())
+                GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr());
+            else
+                libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr());
+        }
 
         UpdateCrsr();
     }
@@ -2126,8 +2133,13 @@ void SwCrsrShell::HideCrsr()
         m_pCurCrsr->SetShowTextInputFieldOverlay( false );
         m_pVisCrsr->Hide();
 
-        if (isTiledRendering())
-            libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr());
+        if (comphelper::LibreOfficeKit::isActive())
+        {
+            if (comphelper::LibreOfficeKit::isViewCallback())
+                GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr());
+            else
+                libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr());
+        }
     }
 }
 
commit a772bba744601f0e5938213dfa6781d9bdc91137
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Sep 18 14:29:18 2015 +0200

    sw: implement per-view LOK_CALLBACK_TEXT_SELECTION
    
    Also:
    
    - let the unit test set the global LOK flag, as sw code now depends on
      that
    - in framework, don't return early after emitting the LOK status
      indicator callback, otherwise CppunitTest_sw_tiledrendering shows how
      sw LOK callbacks are missing
    
    Change-Id: I0c4ac12f2ef5118d29afd131676bcb27d5db7746

diff --git a/framework/source/helper/statusindicator.cxx b/framework/source/helper/statusindicator.cxx
index 5c9dafc..ce8310a 100644
--- a/framework/source/helper/statusindicator.cxx
+++ b/framework/source/helper/statusindicator.cxx
@@ -43,7 +43,6 @@ void SAL_CALL StatusIndicator::start(const OUString& sText ,
         m_nLastCallbackPercent = -1;
 
         comphelper::LibreOfficeKit::statusIndicatorStart();
-        return;
     }
 
     css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory);
@@ -60,7 +59,6 @@ void SAL_CALL StatusIndicator::end()
     if (comphelper::LibreOfficeKit::isActive())
     {
         comphelper::LibreOfficeKit::statusIndicatorFinish();
-        return;
     }
 
     css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory);
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 07dd7e3..e7ab149 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -383,6 +383,8 @@ void SwTiledRenderingTest::testSearchViewArea()
 void SwTiledRenderingTest::testSearchTextFrame()
 {
 #if !defined(WNT) && !defined(MACOSX)
+    comphelper::LibreOfficeKit::setActive();
+
     SwXTextDocument* pXTextDocument = createDoc("search.odt");
     pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
     uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
@@ -393,6 +395,8 @@ void SwTiledRenderingTest::testSearchTextFrame()
     comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
     // This was empty: nothing was highlighted after searching for 'TextFrame'.
     CPPUNIT_ASSERT(!m_aTextSelection.isEmpty());
+
+    comphelper::LibreOfficeKit::setActive(false);
 #endif
 }
 
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index cd47acc..01a2da7 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -361,7 +361,7 @@ void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles)
         // talks about "the" cursor at the moment. As long as that's true,
         // don't say anything about the Writer cursor till a draw object is
         // being edited.
-        if (GetShell()->isTiledRendering() && !pView->GetTextEditObject())
+        if (comphelper::LibreOfficeKit::isActive() && !pView->GetTextEditObject())
         {
             if (!empty())
             {
@@ -377,12 +377,18 @@ void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles)
                 if (aStartRect.HasArea())
                 {
                     OString sRect = aStartRect.SVRect().toString();
-                    GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, sRect.getStr());
+                    if (comphelper::LibreOfficeKit::isViewCallback())
+                        GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, sRect.getStr());
+                    else
+                        GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, sRect.getStr());
                 }
                 if (aEndRect.HasArea())
                 {
                     OString sRect = aEndRect.SVRect().toString();
-                    GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, sRect.getStr());
+                    if (comphelper::LibreOfficeKit::isViewCallback())
+                        GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, sRect.getStr());
+                    else
+                        GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, sRect.getStr());
                 }
             }
 
@@ -396,7 +402,12 @@ void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles)
             }
             OString sRect = ss.str().c_str();
             if (!pSelectionRectangles)
-                GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr());
+            {
+                if (comphelper::LibreOfficeKit::isViewCallback())
+                    GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr());
+                else
+                    GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr());
+            }
             else
                 pSelectionRectangles->push_back(sRect);
         }
@@ -593,7 +604,7 @@ void SwShellCrsr::Show()
             pShCrsr->SwSelPaintRects::Show(&aSelectionRectangles);
     }
 
-    if (GetShell()->isTiledRendering())
+    if (comphelper::LibreOfficeKit::isActive())
     {
         std::stringstream ss;
         bool bFirst = true;
@@ -609,7 +620,10 @@ void SwShellCrsr::Show()
             ss << rSelectionRectangle.getStr();
         }
         OString sRect = ss.str().c_str();
-        GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr());
+        if (comphelper::LibreOfficeKit::isViewCallback())
+            GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr());
+        else
+            GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr());
     }
 }
 


More information about the Libreoffice-commits mailing list