[Libreoffice-commits] core.git: Branch 'feature/lok_dialog2' - 3 commits - desktop/qa desktop/source sfx2/source

Pranav Kant pranavk at collabora.co.uk
Tue Dec 5 08:48:50 UTC 2017


 desktop/qa/desktop_lib/test_desktop_lib.cxx |    2 ++
 desktop/source/lib/init.cxx                 |    6 ++++++
 sfx2/source/appl/workwin.cxx                |    6 +++++-
 sfx2/source/dialog/basedlgs.cxx             |    4 ++--
 sfx2/source/dialog/tabdlg.cxx               |    2 +-
 5 files changed, 16 insertions(+), 4 deletions(-)

New commits:
commit a00b653f55dd99f0e9ffcc585a66a15e7a7d845b
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Tue Dec 5 02:20:13 2017 +0530

    lokdialog: Don't hide dialogs in case of LOK
    
    We change views (using setView) a lot in case of LOK. Changing the view,
    without this patch, leads to InitShow on the dialog which means
    invalidation of the whole dialog even though there is nothing to
    invalidate. This decreases performance as it increases the dialog paint
    traffic through the LOK API. We don't need to hide the dialog once it's
    opened in case of LOK.
    
    This patch improves the multiview dialog performance considerably
    (can easily be noticed in GTV).
    
    Change-Id: If2b4ceb945ccd86da3d90bbbb0a0b9fbade43f30

diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 4e228b4ffd8b..bdd99728d55e 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <config_features.h>
+#include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
 
 #include <sfx2/docfile.hxx>
@@ -1461,6 +1462,9 @@ bool SfxWorkWindow::IsVisible_Impl()
 
 void SfxWorkWindow::HidePopups_Impl(bool bHide, bool bParent, sal_uInt16 nId )
 {
+    if (comphelper::LibreOfficeKit::isActive() && bHide)
+        return;
+
     for (SfxChildWin_Impl* i : aChildWins)
     {
         SfxChildWindow *pCW = i->pWin;
@@ -1473,7 +1477,7 @@ void SfxWorkWindow::HidePopups_Impl(bool bHide, bool bParent, sal_uInt16 nId )
                 pChild->nVisible &= ~SfxChildVisibility::ACTIVE;
                 pCW->Hide();
             }
-            else
+            else if ( SfxChildVisibility::VISIBLE != (pChild->nVisible & SfxChildVisibility::VISIBLE) )
             {
                 pChild->nVisible |= SfxChildVisibility::ACTIVE;
                 if ( SfxChildVisibility::VISIBLE == (pChild->nVisible & SfxChildVisibility::VISIBLE) )
commit 706707812b581cbc8f9afc2d72120cffd0c4c09d
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Tue Dec 5 01:24:21 2017 +0530

    lokdialog: InitShow can happen multiple times
    
    Change-Id: I120a49f8a3fa96eb93d6de6de1d0715134520678

diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 1de5c4fb2f79..c9865a50c37a 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -174,7 +174,7 @@ void SfxModalDialog::dispose()
 short SfxModalDialog::Execute()
 {
     SfxViewShell* pViewShell = SfxViewShell::Current();
-    if (comphelper::LibreOfficeKit::isActive() && pViewShell)
+    if (comphelper::LibreOfficeKit::isActive() && pViewShell && !GetLOKNotifier())
     {
         SetLOKNotifier(pViewShell);
         const Size aSize = GetOptimalSize();
@@ -246,7 +246,7 @@ void SfxModelessDialog::StateChanged( StateChangedType nStateChange )
         }
 
         SfxViewShell* pViewShell = SfxViewShell::Current();
-        if (comphelper::LibreOfficeKit::isActive() && pViewShell)
+        if (comphelper::LibreOfficeKit::isActive() && pViewShell && !GetLOKNotifier())
         {
             SetLOKNotifier(pViewShell);
             std::vector<vcl::LOKPayloadItem> aItems;
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index eac3ea1968ae..ea555008a152 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -519,7 +519,7 @@ short SfxTabDialog::Execute()
     Start_Impl();
 
     SfxViewShell* pViewShell = SfxViewShell::Current();
-    if (comphelper::LibreOfficeKit::isActive() && pViewShell)
+    if (comphelper::LibreOfficeKit::isActive() && pViewShell && !GetLOKNotifier())
     {
         SetLOKNotifier(pViewShell);
         const Size aSize = GetOptimalSize();
commit d2106ef4d506cd49bf7905493fa4aae33df5c611
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Nov 30 01:22:33 2017 +0530

    lokdialog: Execute all UNO commands asynchronously for LOK
    
    Especially in case of dialogs, Online cannot afford to wait till the
    call to UNO command returns as the same thread is responsible for doing
    many more tasks as well.
    
    And just adding this check doesn't seem to have any repurcussions, so I
    guess we are fine.
    
    Change-Id: Iac7c1413d90e8a264502dcf2bc280e09fd52683b
    Reviewed-on: https://gerrit.libreoffice.org/45527
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 2a995277081a..81a9f11e7eb5 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -529,6 +529,7 @@ void DesktopLOKTest::testPasteWriter()
     CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", aText.getStr(), aText.getLength()));
 
     pDocument->pClass->postUnoCommand(pDocument, ".uno:SelectAll", nullptr, false);
+    Scheduler::ProcessEventsToIdle();
     char* pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", nullptr);
     CPPUNIT_ASSERT_EQUAL(OString("hello"), OString(pText));
     free(pText);
@@ -902,6 +903,7 @@ void DesktopLOKTest::testSheetOperations()
     pDocument->pClass->postUnoCommand(pDocument, ".uno:Remove",
           "{ \"Index\": { \"type\": \"long\", \"value\": 3 } }", false);
 
+    Scheduler::ProcessEventsToIdle();
     CPPUNIT_ASSERT_EQUAL(pDocument->pClass->getParts(pDocument), 6);
 
     std::vector<OString> aExpected = { "FirstSheet", "Renamed", "Sheet3", "Sheet4", "Sheet5", "LastSheet" };
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 8efc5f2aff02..b5bc0f56a845 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2319,6 +2319,12 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
     LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
 
     std::vector<beans::PropertyValue> aPropertyValuesVector(jsonToPropertyValuesVector(pArguments));
+
+    beans::PropertyValue aSynchronMode;
+    aSynchronMode.Name = "SynchronMode";
+    aSynchronMode.Value <<= false;
+    aPropertyValuesVector.push_back(aSynchronMode);
+
     int nView = SfxLokHelper::getView();
     if (nView < 0)
         return;


More information about the Libreoffice-commits mailing list