[Libreoffice-commits] core.git: sfx2/source

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 1 09:55:56 UTC 2019


 sfx2/source/appl/workwin.cxx                 |    8 +++++
 sfx2/source/sidebar/SidebarChildWindow.cxx   |    4 +-
 sfx2/source/sidebar/SidebarController.cxx    |   37 ++++++++++++++-------------
 sfx2/source/sidebar/SidebarDockingWindow.cxx |    2 -
 4 files changed, 31 insertions(+), 20 deletions(-)

New commits:
commit 874b511b9587495c29455e61fb4ed0052eb8f45b
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun May 5 23:33:34 2019 -0400
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Aug 1 11:55:16 2019 +0200

    LOK: support sidebars in writer and calc
    
    [ Miklos: added code to release LOK notifiers in
    SfxWorkWindow::DeleteControllers_Impl() during shutdown. ]
    
    Reviewed-on: https://gerrit.libreoffice.org/71843
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit 5ddf630222241bec4deda56d10992c35ae4efe06)
    
    Change-Id: I3a3bd1fb6922e435599f604328f558be60594729
    Reviewed-on: https://gerrit.libreoffice.org/76556
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 65a0a43d1c00..1f40902b9a77 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -580,6 +580,14 @@ void SfxWorkWindow::DeleteControllers_Impl()
         SfxChildWindow *pChild = pCW->pWin;
         if (pChild)
         {
+            if (comphelper::LibreOfficeKit::isActive())
+            {
+                vcl::Window* pWindow = pChild->GetWindow();
+                if (pWindow)
+                {
+                    pWindow->ReleaseLOKNotifier();
+                }
+            }
             pChild->Hide();
 
             // If the child window is a direct child window and not in a
diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx
index b958d840dd3b..058d5fd1516b 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -68,7 +68,7 @@ SidebarChildWindow::SidebarChildWindow(vcl::Window* pParentWindow, sal_uInt16 nI
         // Undock sidebar in LOK to allow for resizing freely
         // (i.e. when the client window is resized) and collapse
         // it so the client can open it on demand.
-        pDockWin->SetFloatingSize(Size(TabBar::GetDefaultWidth() * GetWindow()->GetDPIScaleFactor(),
+        pDockWin->SetFloatingSize(Size(pDockWin->GetSizePixel().Width() * GetWindow()->GetDPIScaleFactor(),
                                        pDockWin->GetSizePixel().Height()));
         pDockWin->SetFloatingMode(true);
     }
@@ -78,7 +78,7 @@ SidebarChildWindow::SidebarChildWindow(vcl::Window* pParentWindow, sal_uInt16 nI
     pDockWin->Show();
 }
 
-sal_Int32 SidebarChildWindow::GetDefaultWidth (vcl::Window const * pWindow)
+sal_Int32 SidebarChildWindow::GetDefaultWidth(vcl::Window const* pWindow)
 {
     if (pWindow != nullptr)
     {
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index f2f532ff12b2..55e1c3a5a29e 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -455,7 +455,7 @@ void SidebarController::ProcessNewWidth (const sal_Int32 nNewWidth)
         return;
 
     if (mbIsDeckRequestedOpen.get())
-     {
+    {
         // Deck became large enough to be shown.  Show it.
         mnSavedSidebarWidth = nNewWidth;
         RequestOpenDeck();
@@ -729,6 +729,25 @@ void SidebarController::SwitchToDeck (
     const DeckDescriptor& rDeckDescriptor,
     const Context& rContext)
 {
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        if (const SfxViewShell* pViewShell = mpViewFrame->GetViewShell())
+        {
+            if (msCurrentDeckId != rDeckDescriptor.msId)
+            {
+                const std::string hide = UnoNameFromDeckId(msCurrentDeckId);
+                if (!hide.empty())
+                    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
+                                                           (hide + "=false").c_str());
+            }
+
+            const std::string show = UnoNameFromDeckId(rDeckDescriptor.msId);
+            if (!show.empty())
+                pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
+                                                       (show + "=true").c_str());
+        }
+    }
+
     maFocusManager.Clear();
 
     const bool bForceNewDeck ((mnRequestedForceFlags&SwitchFlag_ForceNewDeck)!=0);
@@ -741,22 +760,6 @@ void SidebarController::SwitchToDeck (
         if (mpCurrentDeck)
             mpCurrentDeck->Hide();
 
-        if (comphelper::LibreOfficeKit::isActive())
-        {
-            if (const SfxViewShell* pViewShell = mpViewFrame->GetViewShell())
-            {
-                const std::string hide = UnoNameFromDeckId(msCurrentDeckId);
-                if (!hide.empty())
-                    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
-                                                           (hide + "=false").c_str());
-
-                const std::string show = UnoNameFromDeckId(rDeckDescriptor.msId);
-                if (!show.empty())
-                    pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
-                                                           (show + "=true").c_str());
-            }
-        }
-
         msCurrentDeckId = rDeckDescriptor.msId;
     }
     mpTabBar->Invalidate();
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index 08b1040f523e..7b94a468a08d 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -125,7 +125,7 @@ void SidebarDockingWindow::NotifyResize()
         // Note: this means we *cannot* create a sidebar post attaching a new view because the
         // ViewShell will not change, and therefore we will never SetLOKNotifier. To avoid that
         // we hide sidebars instead of closing (see OnMenuItemSelected in SidebarController).
-        if (mpSidebarController.is() && !GetLOKNotifier() && mpOldViewShell != SfxViewShell::Current())
+        if (mpSidebarController.is() && !GetLOKNotifier())
             SetLOKNotifier(SfxViewShell::Current());
 
         if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())


More information about the Libreoffice-commits mailing list