summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2019-05-05 23:33:34 -0400
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-08-01 11:55:16 +0200
commit874b511b9587495c29455e61fb4ed0052eb8f45b (patch)
tree8332049ba676f795352d147a8a5fdf067096f5fb
parentcbbda5b9267f9f7c7028ebc3f0867ddc6715543a (diff)
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@collabora.com> Tested-by: Jan Holesovsky <kendy@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@collabora.co.uk>
-rw-r--r--sfx2/source/appl/workwin.cxx8
-rw-r--r--sfx2/source/sidebar/SidebarChildWindow.cxx4
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx37
-rw-r--r--sfx2/source/sidebar/SidebarDockingWindow.cxx2
4 files changed, 31 insertions, 20 deletions
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())