desktop/qa/desktop_lib/test_desktop_lib.cxx            |    3 
 desktop/source/lib/init.cxx                            |   21 +
 include/LibreOfficeKit/LibreOfficeKit.h                |    5 
 include/LibreOfficeKit/LibreOfficeKit.hxx              |   14 
 include/LibreOfficeKit/LibreOfficeKitEnums.h           |    1 
 include/sfx2/dockwin.hxx                               |    2 
 include/sfx2/sidebar/Deck.hxx                          |    6 
 include/sfx2/sidebar/DeckLayouter.hxx                  |    1 
 include/sfx2/sidebar/SidebarChildWindow.hxx            |    5 
 include/sfx2/sidebar/SidebarController.hxx             |   13 
 include/sfx2/sidebar/SidebarDockingWindow.hxx          |    6 
 include/sfx2/sidebar/TabBar.hxx                        |    3 
 sd/inc/app.hrc                                         |    1 
 sd/sdi/SlideSorterController.sdi                       |    5 
 sd/sdi/drviewsh.sdi                                    |    5 
 sd/sdi/sdraw.sdi                                       |   18 
 sd/source/ui/animations/CustomAnimationPane.cxx        |   18 
 sd/source/ui/animations/SlideTransitionPane.cxx        |   14 
 sd/source/ui/slidesorter/controller/SlsSlotManager.cxx |   11 
 sd/source/ui/view/ViewShellImplementation.cxx          |    2 
 sd/source/ui/view/drviews2.cxx                         |    5 
 sd/source/ui/view/drviewse.cxx                         |    5 
 sfx2/source/sidebar/Deck.cxx                           |   31 +
 sfx2/source/sidebar/DeckLayouter.cxx                   |   35 +
 sfx2/source/sidebar/ResourceManager.cxx                |   12 
 sfx2/source/sidebar/SidebarChildWindow.cxx             |   57 +-
 sfx2/source/sidebar/SidebarController.cxx              |  328 ++++++++++++-----
 sfx2/source/sidebar/SidebarDockingWindow.cxx           |   50 ++
 sfx2/source/sidebar/TabBar.cxx                         |    5 
 vcl/source/window/dockwin.cxx                          |    5 
 vcl/source/window/window.cxx                           |    2 
 31 files changed, 541 insertions(+), 148 deletions(-)

New commits:
commit 7be22a8bdef111bb0ee382ab96646930ca829b5d
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Feb 3 10:53:21 2019 -0500
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:32 2019 +0200

    sfx2: LOK: better fit of sidebar decks
    
    As the patch comment explains, the properties
    deck needs to be rendered with height long
    enough to avoid scrolling, but others would
    be greedy in using up all the available height,
    so we render them in more restricted space.
    
    Change-Id: I361e653239e22a7be0e5d75505cdcde18f2367d3

diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index bc901a42c33a..420847351e53 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -416,13 +416,18 @@ void SidebarController::NotifyResize()
         {
             if (comphelper::LibreOfficeKit::isActive())
             {
+                // We want to let the layouter use up as much of the
+                // height as necessary to make sure no scrollbar is
+                // visible. This only works when there are no greedy
+                // panes that fill up all available area. So we only
+                // use this for the PropertyDeck, which has no such
+                // panes, while most other do. This is fine, since
+                // it's the PropertyDeck that really has many panes
+                // that can collapse or expand. For others, limit
+                // the height to something sensible.
+                const sal_Int32 nExtHeight = (msCurrentDeckId == 
"PropertyDeck" ? 2000 : 600);
                 // No TabBar in LOK (use nWidth in full).
-                // Use the minimum height that is large enough to let the
-                // layouter expand the panes maximally (that have a minimal
-                // height before the scrollbar is shown), so we never get
-                // scrollbars (we want scrolling to be done on the rendered
-                // image in the client, which is much faster).
-                mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth, 650);
+                mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth, nExtHeight);
             }
             else
                 mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth - 
nTabBarDefaultWidth, nHeight);
commit 94d7d8bcdcd609a5b714696259a8d4dcdd8f86a9
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Fri Feb 1 10:56:46 2019 -0500
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:32 2019 +0200

    sfx2: LOK: resize the sidebar after layouting to avoid scrollbars
    
    By resizing the deck we ensure that if the contents do not fit
    in the existing height, they will after we expand to the minimum
    height. Also, the minimum height is now the correct one.
    
    This prevents seeing vertical scrollbar in LOK, which is very
    slow and unfriendly, instead renders the full sidebar and lets
    the client scroll, if necessary.
    
    Change-Id: Idc2a622a65074b7afb26263624f2df0b5968f40d

diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx
index a38757de1ce1..da50f9dfdc33 100644
--- a/include/sfx2/sidebar/Deck.hxx
+++ b/include/sfx2/sidebar/Deck.hxx
@@ -84,6 +84,9 @@ public:
     };
 
 private:
+    void RequestLayoutInternal();
+
+private:
     const OUString msId;
     sal_Int32 mnMinimalWidth;
     sal_Int32 mnMinimalHeight;
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 83873d7c9950..71f211b789e3 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -148,7 +148,7 @@ void Deck::Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle& /*r
 
 void Deck::DataChanged (const DataChangedEvent&)
 {
-    RequestLayout();
+    RequestLayoutInternal();
 }
 
 bool Deck::EventNotify(NotifyEvent& rEvent)
@@ -215,10 +215,10 @@ void Deck::ResetPanels(const SharedPanelContainer& 
rPanelContainer)
     }
     maPanels = rPanelContainer;
 
-    RequestLayout();
+    RequestLayoutInternal();
 }
 
-void Deck::RequestLayout()
+void Deck::RequestLayoutInternal()
 {
     mnMinimalWidth = 0;
     mnMinimalHeight = 0;
@@ -228,6 +228,17 @@ void Deck::RequestLayout()
                              *mpFiller, *mpVerticalScrollBar);
 }
 
+void Deck::RequestLayout()
+{
+    RequestLayoutInternal();
+    if (comphelper::LibreOfficeKit::isActive() && mnMinimalHeight > 0)
+    {
+        const Size aParentSize = Size(GetParent()->GetSizePixel().Width(), 
mnMinimalHeight);
+        GetParent()->SetSizePixel(aParentSize);
+        setPosSizePixel(0, 0, aParentSize.Width(), aParentSize.Height());
+    }
+}
+
 vcl::Window* Deck::GetPanelParentWindow()
 {
     return mpScrollContainer.get();
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx 
b/sfx2/source/sidebar/DeckLayouter.cxx
index 04dca5eb8989..2b4d98dff481 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -169,9 +169,6 @@ tools::Rectangle LayoutPanels (
         nTotalPreferredHeight += rItem.maLayoutSize.Preferred;
     }
 
-    // rMinimalHeight = nTotalMinimumHeight;
-    rMinimalHeight = aBox.GetHeight();
-
     if (nTotalMinimumHeight > nAvailableHeight
         && ! bShowVerticalScrollBar)
     {
@@ -244,6 +241,7 @@ tools::Rectangle LayoutPanels (
 
     const sal_Int32 nUsedHeight (PlacePanels(rLayoutItems, nWidth, eMode, 
rScrollContainer));
     aBox.Top() += nUsedHeight;
+    rMinimalHeight = nUsedHeight;
     return aBox;
 }
 
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 4604021fef22..bc901a42c33a 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -414,13 +414,15 @@ void SidebarController::NotifyResize()
         // Place the deck first.
         if (bIsDeckVisible)
         {
-            // No TabBar in LOK.
             if (comphelper::LibreOfficeKit::isActive())
             {
-                // The minimal deck height is unreliable because of
-                // the fluid way the panels are stretched. Fix minimum 
manually.
-                // const sal_Int32 nMinimalHeight = 
mpCurrentDeck->GetMinimalHeight();
-                mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth, 600);
+                // No TabBar in LOK (use nWidth in full).
+                // Use the minimum height that is large enough to let the
+                // layouter expand the panes maximally (that have a minimal
+                // height before the scrollbar is shown), so we never get
+                // scrollbars (we want scrolling to be done on the rendered
+                // image in the client, which is much faster).
+                mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth, 650);
             }
             else
                 mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth - 
nTabBarDefaultWidth, nHeight);
commit 7c3ba6b5954fb857f18f868c5ca8da75a03ed692
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Fri Feb 1 10:55:05 2019 -0500
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:31 2019 +0200

    sfx2: avoid unnecessary dynamic_cast
    
    And reformat.
    
    Change-Id: If8a3dd4d16dfd51f8006d2d5d47951db30390fd8

diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx 
b/sfx2/source/sidebar/SidebarChildWindow.cxx
index ac0a68852ea9..431d98e396f4 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -30,50 +30,48 @@ namespace sfx2 { namespace sidebar {
 
 SFX_IMPL_DOCKINGWINDOW_WITHID(SidebarChildWindow, SID_SIDEBAR);
 
-SidebarChildWindow::SidebarChildWindow (vcl::Window* pParentWindow, sal_uInt16 
nId,
-                                        SfxBindings* pBindings, 
SfxChildWinInfo* pInfo)
-    : SfxChildWindow(pParentWindow, nId),
-      mbSidebarVisibleInLOK(pInfo && pInfo->aModule == "simpress")
+SidebarChildWindow::SidebarChildWindow(vcl::Window* pParentWindow, sal_uInt16 
nId,
+                                       SfxBindings* pBindings, 
SfxChildWinInfo* pInfo)
+    : SfxChildWindow(pParentWindow, nId)
+    , mbSidebarVisibleInLOK(pInfo && pInfo->aModule == "simpress")
 {
-    SetWindow(VclPtr<SidebarDockingWindow>::Create(pBindings, *this, 
pParentWindow,
-                                                       WB_STDDOCKWIN | 
WB_OWNERDRAWDECORATION |
-                                                       WB_CLIPCHILDREN | 
WB_SIZEABLE |
-                                                       WB_3DLOOK | 
WB_ROLLABLE));
+    SfxDockingWindow* pDockWin = VclPtr<SidebarDockingWindow>::Create(
+        pBindings, *this, pParentWindow, WB_STDDOCKWIN | 
WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN
+                                             | WB_SIZEABLE | WB_3DLOOK | 
WB_ROLLABLE);
+    SetWindow(pDockWin);
     SetAlignment(SfxChildAlignment::RIGHT);
 
-    GetWindow()->SetHelpId(HID_SIDEBAR_WINDOW);
-    GetWindow()->SetOutputSizePixel(Size(GetDefaultWidth(GetWindow()), 450));
+    pDockWin->SetHelpId(HID_SIDEBAR_WINDOW);
+    pDockWin->SetOutputSizePixel(Size(GetDefaultWidth(pDockWin), 450));
 
-    SfxDockingWindow* pDockingParent = 
dynamic_cast<SfxDockingWindow*>(GetWindow());
-    if (pDockingParent != nullptr)
+    if (pInfo && pInfo->aExtraString.isEmpty() && pInfo->aModule != "sdraw"
+        && pInfo->aModule != "simpress")
     {
-        if (pInfo && pInfo->aExtraString.isEmpty() && pInfo->aModule != 
"sdraw" && pInfo->aModule != "simpress")
-        {
-            // When this is the first start (never had the sidebar open yet),
-            // default to non-expanded sidebars in Writer and Calc.
-            //
-            // HACK: unfortunately I haven't found a clean solution to do
-            // this, so do it this way:
-            //
-            pDockingParent->SetSizePixel(Size(TabBar::GetDefaultWidth() * 
GetWindow()->GetDPIScaleFactor(),
-                        pDockingParent->GetSizePixel().Height()));
-        }
-        pDockingParent->Initialize(pInfo);
+        // When this is the first start (never had the sidebar open yet),
+        // default to non-expanded sidebars in Writer and Calc.
+        //
+        // HACK: unfortunately I haven't found a clean solution to do
+        // this, so do it this way:
+        //
+        pDockWin->SetSizePixel(Size(TabBar::GetDefaultWidth() * 
GetWindow()->GetDPIScaleFactor(),
+                                    pDockWin->GetSizePixel().Height()));
+    }
+
+    pDockWin->Initialize(pInfo);
 
-        if (comphelper::LibreOfficeKit::isActive())
-        {
-            // 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.
-            pDockingParent->SetFloatingSize(
-                Size(TabBar::GetDefaultWidth() * 
GetWindow()->GetDPIScaleFactor(),
-                     pDockingParent->GetSizePixel().Height()));
-            pDockingParent->SetFloatingMode(true);
-        }
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        // 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->GetSizePixel().Height()));
+        pDockWin->SetFloatingMode(true);
     }
+
     SetHideNotDelete(true);
 
-    GetWindow()->Show();
+    pDockWin->Show();
 }
 
 sal_Int32 SidebarChildWindow::GetDefaultWidth (vcl::Window const * pWindow)
commit e4f212dbc59673573e452007cb515ae90587c81b
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Dec 16 12:25:18 2018 -0500
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:31 2019 +0200

    sfx: LOK: fix the minimum height of sidebars
    
    Change-Id: I29d4eb38c72db50061266f0cf0ace31bab690315

diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index e41d794eb699..4604021fef22 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -417,11 +417,10 @@ void SidebarController::NotifyResize()
             // No TabBar in LOK.
             if (comphelper::LibreOfficeKit::isActive())
             {
-                const sal_Int32 nMinimalHeight = 
mpCurrentDeck->GetMinimalHeight();
-                if (nMinimalHeight > 0)
-                    mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth, 
nMinimalHeight);
-                else
-                    mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth, nHeight);
+                // The minimal deck height is unreliable because of
+                // the fluid way the panels are stretched. Fix minimum 
manually.
+                // const sal_Int32 nMinimalHeight = 
mpCurrentDeck->GetMinimalHeight();
+                mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth, 600);
             }
             else
                 mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth - 
nTabBarDefaultWidth, nHeight);
commit 37e7ed49996ab22ecebc05b5e6ca58bc4ed3c43f
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Wed Dec 12 03:01:31 2018 -0500
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:30 2019 +0200

    sfx: LOK: notify clients of the sidebar state
    
    Change-Id: I35b174c3a5e302ce52ee4063fa71d47feffab624

diff --git a/include/sfx2/sidebar/SidebarController.hxx 
b/include/sfx2/sidebar/SidebarController.hxx
index 32340fe2c017..21b68f0f136c 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -28,6 +28,7 @@
 #include <sfx2/sidebar/Panel.hxx>
 #include <sfx2/sidebar/ResourceManager.hxx>
 #include <sfx2/sidebar/TabBar.hxx>
+#include <sfx2/viewfrm.hxx>
 
 #include <vcl/menu.hxx>
 
@@ -67,9 +68,8 @@ class SFX2_DLLPUBLIC SidebarController
       public SidebarControllerInterfaceBase
 {
 public:
-    static rtl::Reference<SidebarController> create(
-        SidebarDockingWindow* pParentWindow,
-        const css::uno::Reference<css::frame::XFrame>& rxFrame);
+    static rtl::Reference<SidebarController> create(SidebarDockingWindow* 
pParentWindow,
+                                                    const SfxViewFrame* 
pViewFrame);
     virtual ~SidebarController() override;
     SidebarController(const SidebarController&) = delete;
     SidebarController& operator=( const SidebarController& ) = delete;
@@ -163,14 +163,13 @@ public:
     void FadeOut();
 
 private:
-    SidebarController(
-        SidebarDockingWindow* pParentWindow,
-        const css::uno::Reference<css::frame::XFrame>& rxFrame);
+    SidebarController(SidebarDockingWindow* pParentWindow, const SfxViewFrame* 
pViewFrame);
 
     VclPtr<Deck> mpCurrentDeck;
     VclPtr<SidebarDockingWindow> mpParentWindow;
-    VclPtr<TabBar> mpTabBar;
+    const SfxViewFrame* mpViewFrame;
     css::uno::Reference<css::frame::XFrame> mxFrame;
+    VclPtr<TabBar> mpTabBar;
     Context maCurrentContext;
     Context maRequestedContext;
     css::uno::Reference<css::frame::XController> mxCurrentController;
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index 3bfb5bed4ece..93c3b0f9cb16 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/uno/Any.hxx>
 
 #include <comphelper/processfactory.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 #include <comphelper/lok.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
@@ -997,6 +998,10 @@ void DrawViewShell::FuSupport(SfxRequest& rReq)
 
         case SID_MASTERPAGE:          // BASIC
         {
+            if (comphelper::LibreOfficeKit::isActive())
+                
GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
+                                                           
".uno:SlideMasterPage=true");
+
             // AutoLayouts needs to be finished
             GetDoc()->StopWorkStartupDelay();
 
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index fb1d3ae17b05..e41d794eb699 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -45,6 +45,7 @@
 #include <comphelper/namedvaluecollection.hxx>
 #include <comphelper/lok.hxx>
 #include <o3tl/make_unique.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
@@ -63,6 +64,32 @@ namespace
     const static char gsReadOnlyCommandName[] = ".uno:EditDoc";
     const static sal_Int32 gnWidthCloseThreshold (70);
     const static sal_Int32 gnWidthOpenThreshold (40);
+
+    static std::string UnoNameFromDeckId(const OUString& rsDeckId)
+    {
+        if (rsDeckId == "SdCustomAnimationDeck")
+            return ".uno:CustomAnimation";
+
+        if (rsDeckId == "PropertyDeck")
+            return ".uno:ModifyPage";
+
+        if (rsDeckId == "SdLayoutsDeck")
+            return ".uno:ModifyPage";
+
+        if (rsDeckId == "SdSlideTransitionDeck")
+            return ".uno:SlideChangeWindow";
+
+        if (rsDeckId == "SdAllMasterPagesDeck")
+            return ".uno:MasterSlidesPanel";
+
+        if (rsDeckId == "SdMasterPagesDeck")
+            return ".uno:MasterSlidesPanel";
+
+        if (rsDeckId == "GalleryDeck")
+            return ".uno:Gallery";
+
+        return "";
+    }
 }
 
 namespace sfx2 { namespace sidebar {
@@ -84,47 +111,48 @@ namespace {
     static const char gsDefaultDeckId[] = "PropertyDeck";
 }
 
-SidebarController::SidebarController (
-    SidebarDockingWindow* pParentWindow,
-    const css::uno::Reference<css::frame::XFrame>& rxFrame)
-    : SidebarControllerInterfaceBase(m_aMutex),
-      mpCurrentDeck(),
-      mpParentWindow(pParentWindow),
-      mpTabBar(VclPtr<TabBar>::Create(
-              mpParentWindow,
-              rxFrame,
-              [this](const ::rtl::OUString& rsDeckId) { return 
this->OpenThenToggleDeck(rsDeckId); },
-              [this](const tools::Rectangle& rButtonBox,const 
::std::vector<TabBar::DeckMenuData>& rMenuData) { return 
this->ShowPopupMenu(rButtonBox,rMenuData); },
-              this)),
-      mxFrame(rxFrame),
-      maCurrentContext(OUString(), OUString()),
-      maRequestedContext(),
-      mnRequestedForceFlags(SwitchFlag_NoForce),
-      msCurrentDeckId(gsDefaultDeckId),
-      maPropertyChangeForwarder([this](){ return 
this->BroadcastPropertyChange(); }),
-      maContextChangeUpdate([this](){ return this->UpdateConfigurations(); }),
-      maAsynchronousDeckSwitch(),
-      mbIsDeckRequestedOpen(),
-      mbIsDeckOpen(),
-      mnSavedSidebarWidth(pParentWindow->GetSizePixel().Width()),
-      maFocusManager([this](const Panel& rPanel){ return 
this->ShowPanel(rPanel); }),
-      mxReadOnlyModeDispatch(),
-      mbIsDocumentReadOnly(false),
-      mpSplitWindow(nullptr),
-      mnWidthOnSplitterButtonDown(0),
-      mpResourceManager()
+SidebarController::SidebarController(SidebarDockingWindow* pParentWindow,
+                                     const SfxViewFrame* pViewFrame)
+    : SidebarControllerInterfaceBase(m_aMutex)
+    , mpCurrentDeck()
+    , mpParentWindow(pParentWindow)
+    , mpViewFrame(pViewFrame)
+    , mxFrame(pViewFrame->GetFrame().GetFrameInterface())
+    , mpTabBar(VclPtr<TabBar>::Create(
+          mpParentWindow, mxFrame,
+          [this](const ::rtl::OUString& rsDeckId) { return 
this->OpenThenToggleDeck(rsDeckId); },
+          [this](const tools::Rectangle& rButtonBox,
+                 const ::std::vector<TabBar::DeckMenuData>& rMenuData) {
+              return this->ShowPopupMenu(rButtonBox, rMenuData);
+          },
+          this))
+    , maCurrentContext(OUString(), OUString())
+    , maRequestedContext()
+    , mnRequestedForceFlags(SwitchFlag_NoForce)
+    , msCurrentDeckId(gsDefaultDeckId)
+    , maPropertyChangeForwarder([this]() { return 
this->BroadcastPropertyChange(); })
+    , maContextChangeUpdate([this]() { return this->UpdateConfigurations(); })
+    , maAsynchronousDeckSwitch()
+    , mbIsDeckRequestedOpen()
+    , mbIsDeckOpen()
+    , mnSavedSidebarWidth(pParentWindow->GetSizePixel().Width())
+    , maFocusManager([this](const Panel& rPanel) { return 
this->ShowPanel(rPanel); })
+    , mxReadOnlyModeDispatch()
+    , mbIsDocumentReadOnly(false)
+    , mpSplitWindow(nullptr)
+    , mnWidthOnSplitterButtonDown(0)
+    , mpResourceManager()
 {
     // Decks and panel collections for this sidebar
     mpResourceManager = o3tl::make_unique<ResourceManager>();
 }
 
-rtl::Reference<SidebarController> SidebarController::create(
-    SidebarDockingWindow* pParentWindow,
-    const css::uno::Reference<css::frame::XFrame>& rxFrame)
+rtl::Reference<SidebarController> 
SidebarController::create(SidebarDockingWindow* pParentWindow,
+                                                            const 
SfxViewFrame* pViewFrame)
 {
-    rtl::Reference<SidebarController> instance(
-        new SidebarController(pParentWindow, rxFrame));
+    rtl::Reference<SidebarController> instance(new 
SidebarController(pParentWindow, pViewFrame));
 
+    const css::uno::Reference<css::frame::XFrame>& rxFrame = 
pViewFrame->GetFrame().GetFrameInterface();
     registerSidebarForFrame(instance.get(), rxFrame->getController());
     rxFrame->addFrameActionListener(instance.get());
     // Listen for window events.
@@ -698,6 +726,22 @@ 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->HighlightDeck(msCurrentDeckId);
@@ -1173,9 +1217,19 @@ void SidebarController::UpdateDeckOpenState()
 
                 mpParentWindow->GetFloatingWindow()->SetPosSizePixel(aNewPos, 
aNewSize);
 
-                // Sidebar wide enought to render the menu; enable it.
                 if (comphelper::LibreOfficeKit::isActive())
+                {
+                    // Sidebar wide enought to render the menu; enable it.
                     mpTabBar->EnableMenuButton(true);
+
+                    if (const SfxViewShell* pViewShell = 
mpViewFrame->GetViewShell())
+                    {
+                        const std::string uno = 
UnoNameFromDeckId(msCurrentDeckId);
+                        if (!uno.empty())
+                            
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
+                                                                   (uno + 
"=true").c_str());
+                    }
+                }
             }
         }
         else
@@ -1201,9 +1255,19 @@ void SidebarController::UpdateDeckOpenState()
 
                 mpParentWindow->GetFloatingWindow()->SetPosSizePixel(aNewPos, 
aNewSize);
 
-                // Sidebar too narrow to render the menu; disable it.
                 if (comphelper::LibreOfficeKit::isActive())
+                {
+                    // Sidebar too narrow to render the menu; disable it.
                     mpTabBar->EnableMenuButton(false);
+
+                    if (const SfxViewShell* pViewShell = 
mpViewFrame->GetViewShell())
+                    {
+                        const std::string uno = 
UnoNameFromDeckId(msCurrentDeckId);
+                        if (!uno.empty())
+                            
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
+                                                                   (uno + 
"=false").c_str());
+                    }
+                }
             }
 
             if (mnWidthOnSplitterButtonDown > nTabBarDefaultWidth)
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx 
b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index e6f082e523b8..4264dbb234aa 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -47,8 +47,7 @@ SidebarDockingWindow::SidebarDockingWindow(SfxBindings* 
pSfxBindings, SidebarChi
     else
     {
         const SfxViewFrame* pViewFrame = 
pSfxBindings->GetDispatcher()->GetFrame();
-        const SfxFrame& rFrame = pViewFrame->GetFrame();
-        mpSidebarController.set(sfx2::sidebar::SidebarController::create(this, 
rFrame.GetFrameInterface()).get());
+        mpSidebarController.set(sfx2::sidebar::SidebarController::create(this, 
pViewFrame).get());
     }
 }
 
commit f14bd82933246211266ae1db2bb1e00857b02c3f
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Mon Dec 10 00:29:31 2018 -0500
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:30 2019 +0200

    sfx: LOK: don't shrink sidebar height below minimum
    
    This avoids scrolling within the sidebar and makes
    it possible to scroll the rendred sidebar image
    in the client, which is more responsive and lighter.
    
    Change-Id: I0713c699ba82bfc5fe503c9351402c67aef4494e

diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx
index c4cc7027961e..a38757de1ce1 100644
--- a/include/sfx2/sidebar/Deck.hxx
+++ b/include/sfx2/sidebar/Deck.hxx
@@ -71,6 +71,7 @@ public:
     static void PrintWindowSubTree (vcl::Window* pRoot, int nIndentation);
 
     sal_Int32 GetMinimalWidth() const { return mnMinimalWidth; }
+    sal_Int32 GetMinimalHeight() const { return mnMinimalHeight; }
 
     class ScrollContainerWindow : public vcl::Window
     {
@@ -85,6 +86,7 @@ public:
 private:
     const OUString msId;
     sal_Int32 mnMinimalWidth;
+    sal_Int32 mnMinimalHeight;
     SharedPanelContainer maPanels;
     VclPtr<DeckTitleBar> mpTitleBar;
     VclPtr<vcl::Window> mpScrollClipWindow;
diff --git a/include/sfx2/sidebar/DeckLayouter.hxx 
b/include/sfx2/sidebar/DeckLayouter.hxx
index 27a94dd7b3e9..4ce568ef10b8 100644
--- a/include/sfx2/sidebar/DeckLayouter.hxx
+++ b/include/sfx2/sidebar/DeckLayouter.hxx
@@ -42,6 +42,7 @@ namespace DeckLayouter
     void LayoutDeck (
         const tools::Rectangle& rContentArea,
         sal_Int32& rMinimalWidth,
+        sal_Int32& rMinimalHeight,
         SharedPanelContainer& rPanels,
         vcl::Window& pDeckTitleBar,
         vcl::Window& pScrollClipWindow,
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index b3ab0d22ad84..83873d7c9950 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -46,6 +46,7 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, 
vcl::Window* pParentWindow,
     : Window(pParentWindow, 0)
     , msId(rDeckDescriptor.msId)
     , mnMinimalWidth(0)
+    , mnMinimalHeight(0)
     , maPanels()
     , mpTitleBar(VclPtr<DeckTitleBar>::Create(rDeckDescriptor.msTitle, this, 
rCloserAction))
     , mpScrollClipWindow(VclPtr<vcl::Window>::Create(this))
@@ -220,8 +221,9 @@ void Deck::ResetPanels(const SharedPanelContainer& 
rPanelContainer)
 void Deck::RequestLayout()
 {
     mnMinimalWidth = 0;
+    mnMinimalHeight = 0;
 
-    DeckLayouter::LayoutDeck(GetContentArea(), mnMinimalWidth, maPanels,
+    DeckLayouter::LayoutDeck(GetContentArea(), mnMinimalWidth, 
mnMinimalHeight, maPanels,
                              *GetTitleBar(), *mpScrollClipWindow, 
*mpScrollContainer,
                              *mpFiller, *mpVerticalScrollBar);
 }
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx 
b/sfx2/source/sidebar/DeckLayouter.cxx
index 9ca553dd66c1..04dca5eb8989 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -49,13 +49,19 @@ namespace {
         sal_Int32 mnWeight;
         bool mbShowTitleBar;
 
-        LayoutItem()
-            : 
mpPanel(),maLayoutSize(0,0,0),mnDistributedHeight(0),mnWeight(0),mbShowTitleBar(true)
-        {}
+        LayoutItem(const VclPtr<Panel>& rPanel)
+            : mpPanel(rPanel)
+            , maLayoutSize(0, 0, 0)
+            , mnDistributedHeight(0)
+            , mnWeight(0)
+            , mbShowTitleBar(true)
+        {
+        }
     };
     tools::Rectangle LayoutPanels (
         const tools::Rectangle& rContentArea,
         sal_Int32& rMinimalWidth,
+        sal_Int32& rMinimalHeight,
         ::std::vector<LayoutItem>& rLayoutItems,
         vcl::Window& rScrollClipWindow,
         vcl::Window& rScrollContainer,
@@ -95,6 +101,7 @@ namespace {
 void DeckLayouter::LayoutDeck (
     const tools::Rectangle& rContentArea,
     sal_Int32& rMinimalWidth,
+    sal_Int32& rMinimalHeight,
     SharedPanelContainer& rPanels,
     vcl::Window& rDeckTitleBar,
     vcl::Window& rScrollClipWindow,
@@ -110,14 +117,14 @@ void DeckLayouter::LayoutDeck (
     {
         // Prepare the layout item container.
         ::std::vector<LayoutItem> aLayoutItems;
-        aLayoutItems.resize(rPanels.size());
-        for (sal_Int32 nIndex(0),nCount(rPanels.size()); nIndex<nCount; 
++nIndex)
-        {
-            aLayoutItems[nIndex].mpPanel = rPanels[nIndex];
-        }
+        aLayoutItems.reserve(rPanels.size());
+        for (const auto& rPanel : rPanels)
+            aLayoutItems.emplace_back(rPanel);
+
         aBox = LayoutPanels(
             aBox,
             rMinimalWidth,
+            rMinimalHeight,
             aLayoutItems,
             rScrollClipWindow,
             rScrollContainer,
@@ -132,6 +139,7 @@ namespace {
 tools::Rectangle LayoutPanels (
     const tools::Rectangle& rContentArea,
     sal_Int32& rMinimalWidth,
+    sal_Int32& rMinimalHeight,
     ::std::vector<LayoutItem>& rLayoutItems,
     vcl::Window& rScrollClipWindow,
     vcl::Window& rScrollContainer,
@@ -155,15 +163,14 @@ tools::Rectangle LayoutPanels (
     sal_Int32 nTotalPreferredHeight (0);
     sal_Int32 nTotalMinimumHeight (0);
 
-    for(::std::vector<LayoutItem>::const_iterator iItem(rLayoutItems.begin()),
-         iEnd(rLayoutItems.end());
-        iItem!=iEnd;
-        ++iItem)
+    for (const LayoutItem& rItem : rLayoutItems)
     {
-        nTotalMinimumHeight += iItem->maLayoutSize.Minimum;
-        nTotalPreferredHeight += iItem->maLayoutSize.Preferred;
+        nTotalMinimumHeight += rItem.maLayoutSize.Minimum;
+        nTotalPreferredHeight += rItem.maLayoutSize.Preferred;
     }
 
+    // rMinimalHeight = nTotalMinimumHeight;
+    rMinimalHeight = aBox.GetHeight();
 
     if (nTotalMinimumHeight > nAvailableHeight
         && ! bShowVerticalScrollBar)
@@ -174,6 +181,7 @@ tools::Rectangle LayoutPanels (
         return LayoutPanels(
             rContentArea,
             rMinimalWidth,
+            rMinimalHeight,
             rLayoutItems,
             rScrollClipWindow,
             rScrollContainer,
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 3018f24c03f3..fb1d3ae17b05 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -388,7 +388,13 @@ void SidebarController::NotifyResize()
         {
             // No TabBar in LOK.
             if (comphelper::LibreOfficeKit::isActive())
-                mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth, nHeight);
+            {
+                const sal_Int32 nMinimalHeight = 
mpCurrentDeck->GetMinimalHeight();
+                if (nMinimalHeight > 0)
+                    mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth, 
nMinimalHeight);
+                else
+                    mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth, nHeight);
+            }
             else
                 mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth - 
nTabBarDefaultWidth, nHeight);
             mpCurrentDeck->Show();
@@ -1184,7 +1190,14 @@ void SidebarController::UpdateDeckOpenState()
                 mnSavedSidebarWidth = aNewSize.Width(); // Save the current 
width to restore.
 
                 aNewPos.setX(aNewPos.X() + mnSavedSidebarWidth - 
nTabBarDefaultWidth);
-                aNewSize.setWidth(nTabBarDefaultWidth);
+                if (comphelper::LibreOfficeKit::isActive())
+                {
+                    // Hide by collapsing, otherwise with 0x0 the client might 
expect
+                    // to get valid dimensions on rendering and not collapse 
the sidebar.
+                    aNewSize.setWidth(1);
+                }
+                else
+                    aNewSize.setWidth(nTabBarDefaultWidth);
 
                 mpParentWindow->GetFloatingWindow()->SetPosSizePixel(aNewPos, 
aNewSize);
 
commit be9296d7219c95312191feebec05d25dfea75fc7
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Dec 9 17:27:48 2018 -0500
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:29 2019 +0200

    sfx: LOK: toggle sidebar decks
    
    Change-Id: I0559a2a4ae041bc61cf3a2d5979656a7941f4b02

diff --git a/sd/source/ui/view/ViewShellImplementation.cxx 
b/sd/source/ui/view/ViewShellImplementation.cxx
index f625b9a7a1af..1d9744b84f40 100644
--- a/sd/source/ui/view/ViewShellImplementation.cxx
+++ b/sd/source/ui/view/ViewShellImplementation.cxx
@@ -118,7 +118,7 @@ void ViewShell::Implementation::ProcessModifyPageSlot (
             mrViewShell.GetDrawView()->SdrEndTextEdit();
             mrViewShell.GetDrawView()->UnmarkAll();
             mrViewShell.GetViewFrame()->ShowChildWindow(SID_SIDEBAR);
-            sfx2::sidebar::Sidebar::ShowPanel(
+            sfx2::sidebar::Sidebar::TogglePanel(
                 "SdLayoutsPanel",
                 mrViewShell.GetViewFrame()->GetFrame().GetFrameInterface());
             break;
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index ed080d45ea2a..28848dd50bb9 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -3132,7 +3132,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
             else if (nSId == SID_MASTER_SLIDES_PANEL)
                 panelId = "SdAllMasterPagesPanel";
 
-            ::sfx2::sidebar::Sidebar::ShowPanel(
+            ::sfx2::sidebar::Sidebar::TogglePanel(
                 panelId,
                 GetViewFrame()->GetFrame().GetFrameInterface());
 
commit 7a87509de2eba6ade0e7df347c5ee597b7ec82b3
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sat Dec 8 11:50:28 2018 -0500
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:29 2019 +0200

    sfx: LOK: no sidebar tabbar
    
    Change-Id: I210df42fec4404ed9629c9b1c24c78b680212214

diff --git a/include/sfx2/dockwin.hxx b/include/sfx2/dockwin.hxx
index 7b078a96af35..e1c243e2cdcb 100644
--- a/include/sfx2/dockwin.hxx
+++ b/include/sfx2/dockwin.hxx
@@ -91,7 +91,7 @@ public:
     const tools::Rectangle&    GetInnerRect() const                    { 
return aInnerRect; }
     const tools::Rectangle&    GetOuterRect() const                    { 
return aOuterRect; }
     SfxBindings&        GetBindings() const                     { return 
*pBindings; }
-    sal_uInt16              GetType() const                         { return 
pMgr->GetType(); }
+    sal_uInt16          GetType() const                         { return 
pMgr->GetType(); }
     SfxChildAlignment   GetAlignment() const                    { return 
pMgr->GetAlignment(); }
     void                SetAlignment(SfxChildAlignment eAlign)  { 
pMgr->SetAlignment(eAlign); }
     const Size&         GetFloatingSize() const                 { return 
aFloatSize; }
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index d5ee25b6d21c..3018f24c03f3 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -348,7 +348,7 @@ void SidebarController::NotifyResize()
     }
 
     vcl::Window* pParentWindow = mpTabBar->GetParent();
-    sal_Int32 nTabBarDefaultWidth = TabBar::GetDefaultWidth() * 
mpTabBar->GetDPIScaleFactor();
+    const sal_Int32 nTabBarDefaultWidth = TabBar::GetDefaultWidth() * 
mpTabBar->GetDPIScaleFactor();
 
     const sal_Int32 nWidth (pParentWindow->GetSizePixel().Width());
     const sal_Int32 nHeight (pParentWindow->GetSizePixel().Height());
@@ -380,13 +380,17 @@ void SidebarController::NotifyResize()
         else   // attach the Sidebar towards the right-side of screen
         {
             nDeckX = 0;
-            nTabX = nWidth-nTabBarDefaultWidth;
+            nTabX = nWidth - nTabBarDefaultWidth;
         }
 
         // Place the deck first.
         if (bIsDeckVisible)
         {
-            mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth - 
nTabBarDefaultWidth, nHeight);
+            // No TabBar in LOK.
+            if (comphelper::LibreOfficeKit::isActive())
+                mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth, nHeight);
+            else
+                mpCurrentDeck->setPosSizePixel(nDeckX, 0, nWidth - 
nTabBarDefaultWidth, nHeight);
             mpCurrentDeck->Show();
             mpCurrentDeck->RequestLayout();
         }
@@ -395,8 +399,8 @@ void SidebarController::NotifyResize()
 
         // Now place the tab bar.
         mpTabBar->setPosSizePixel(nTabX, 0, nTabBarDefaultWidth, nHeight);
-        mpTabBar->Show();
-
+        if (!comphelper::LibreOfficeKit::isActive())
+            mpTabBar->Show(); // Don't show TabBar in LOK.
     }
 
     // Determine if the closer of the deck can be shown.
commit 5c726cdc20681ade4d303202fbd9d1a8773c5b2a
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Tue Nov 27 09:26:27 2018 -0500
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:28 2019 +0200

    LOK: sidebar: publish notifications to the correct view
    
    The ViewShell, which represents the view in question and therefore
    which view gets the window notifications, is incorrect when
    the sidebar is first created upon creating/attaching a new view.
    
    This leads us to a workaround to make sure that we publish
    notifications to the correct view.
    
    We also have to hide the sidebar instead of closing because
    the workaround wouldn't work when re-creating the sidebar
    on an existing view. See comments in code.
    
    Change-Id: I9d3be901688291b04d634b68e1e20c7add77381f

diff --git a/include/sfx2/sidebar/SidebarDockingWindow.hxx 
b/include/sfx2/sidebar/SidebarDockingWindow.hxx
index fbd29b3746f7..d03b04a41bef 100644
--- a/include/sfx2/sidebar/SidebarDockingWindow.hxx
+++ b/include/sfx2/sidebar/SidebarDockingWindow.hxx
@@ -56,6 +56,7 @@ private:
     void DoDispose();
 
     const bool mbSidebarVisibleInLOK;
+    const SfxViewShell* mpOldViewShell;
 };
 
 } } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 78d0c9ce4b18..d5ee25b6d21c 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -1059,10 +1059,20 @@ IMPL_LINK(SidebarController, OnMenuItemSelected, Menu*, 
pMenu, bool)
 
         case MID_HIDE_SIDEBAR:
         {
-            const util::URL aURL (Tools::GetURL(".uno:Sidebar"));
-            Reference<frame::XDispatch> xDispatch (Tools::GetDispatch(mxFrame, 
aURL));
-            if (xDispatch.is())
+            if (!comphelper::LibreOfficeKit::isActive())
+            {
+                const util::URL aURL(Tools::GetURL(".uno:Sidebar"));
+                Reference<frame::XDispatch> 
xDispatch(Tools::GetDispatch(mxFrame, aURL));
+                if (xDispatch.is())
                     xDispatch->dispatch(aURL, 
Sequence<beans::PropertyValue>());
+            }
+            else
+            {
+                // In LOK we don't really destroy the sidebar when "closing";
+                // we simply hide it. This is because recreating it is 
problematic
+                // See notes in SidebarDockingWindow::NotifyResize().
+                RequestCloseDeck();
+            }
             break;
         }
         default:
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx 
b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index a9ecb5a3496f..e6f082e523b8 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -36,6 +36,7 @@ SidebarDockingWindow::SidebarDockingWindow(SfxBindings* 
pSfxBindings, SidebarChi
     : SfxDockingWindow(pSfxBindings, &rChildWindow, pParentWindow, nBits)
     , mpSidebarController()
     , mbSidebarVisibleInLOK(rChildWindow.IsSidebarVisibleInLOK())
+    , mpOldViewShell(SfxViewShell::Current())
 {
     // Get the XFrame from the bindings.
     if (pSfxBindings==nullptr || pSfxBindings->GetDispatcher()==nullptr)
@@ -97,7 +98,19 @@ void SidebarDockingWindow::NotifyResize()
 {
     if (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() && 
mbSidebarVisibleInLOK)
     {
-        if (mpSidebarController.is() && !GetLOKNotifier())
+        // When a new view is attached, and Sidebar is created 
(SidebarDockingWindow is constructed),
+        // unfortunately we still have the *old* ViewShell (and ViewFrame). 
This happens because
+        // we get multiple NotifyResize are called while 
SfxBaseController::ConnectSfxFrame_Impl
+        // goes through the motions of creating and attaching a new frame/view.
+        // Problem is that once we SetLOKNotifier on a window, we can't change 
it. So we better
+        // set the correct one. Worse, if we set the old one, we will change 
the sidebar of the
+        // wrong view, messing things up badly for the users.
+        // Knowing the above, we wait until the dust settles, by observing 
when the ViewShell is
+        // changed from the time we were created.
+        // 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())
             SetLOKNotifier(SfxViewShell::Current());
 
         if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
commit 259ce91cb63baa049bc57db79fd922ab5fd8be57
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Fri Nov 23 08:02:04 2018 -0500
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:28 2019 +0200

    LOK: sd: no animation preview for LOK
    
    Change-Id: I67babe9b340bafd196dedb2918d6a24bfc9c0ad5

diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx 
b/sd/source/ui/animations/CustomAnimationPane.cxx
index 6375774cb999..d98c2952986f 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -2384,6 +2384,10 @@ void CustomAnimationPane::onPreview( bool bForcePreview )
     if( !bForcePreview && !mpCBAutoPreview->IsChecked() )
         return;
 
+    // No preview in LOK.
+    if (comphelper::LibreOfficeKit::isActive())
+        return;
+
     if( maListSelection.empty() )
     {
         rtl::Reference< MotionPathTag > xMotionPathTag;
commit fd7e06beb0d3dba8456f78aa4b25ea6e2a18d166
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Thu Nov 22 16:47:49 2018 -0500
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:27 2019 +0200

    LOK: sidebar: hide gallery, navigation and styles decks
    
    These aren't fully functional, so not very useful in LOK.
    
    Change-Id: If6330b1f7bf911bbb9edad00aaea7c4d37671746

diff --git a/sfx2/source/sidebar/ResourceManager.cxx 
b/sfx2/source/sidebar/ResourceManager.cxx
index 9267f296b17d..02de48d19d9d 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -22,6 +22,7 @@
 
 #include <officecfg/Office/UI/Sidebar.hxx>
 #include <unotools/confignode.hxx>
+#include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/namedvaluecollection.hxx>
 #include <comphelper/sequence.hxx>
@@ -273,7 +274,16 @@ void ResourceManager::ReadDeckList()
     maDecks.clear();
     for (sal_Int32 nReadIndex(0); nReadIndex<nCount; ++nReadIndex)
     {
-        const utl::OConfigurationNode 
aDeckNode(aDeckRootNode.openNode(aDeckNodeNames[nReadIndex]));
+        const OUString aDeckName = aDeckNodeNames[nReadIndex];
+        if (comphelper::LibreOfficeKit::isActive())
+        {
+            // Hide these decks in LOK as they aren't fully functional.
+            if (aDeckName == "GalleryDeck" || aDeckName == "NavigatorDeck"
+                || aDeckName == "StyleListDeck")
+                continue;
+        }
+
+        const utl::OConfigurationNode 
aDeckNode(aDeckRootNode.openNode(aDeckName));
         if (!aDeckNode.isValid())
             continue;
 
commit c7e54c1b56ee3eec4c794110d87bbb65259dd25e
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Tue Nov 20 12:04:58 2018 -0500
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:26 2019 +0200

    LOK: sidebar: start collapsed
    
    Change-Id: I589fce5ee207da0e0ac113b7ccc1ed1edd06c5da

diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx 
b/sfx2/source/sidebar/SidebarChildWindow.cxx
index e84d2fb4b379..ac0a68852ea9 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -62,8 +62,12 @@ SidebarChildWindow::SidebarChildWindow (vcl::Window* 
pParentWindow, sal_uInt16 n
 
         if (comphelper::LibreOfficeKit::isActive())
         {
-            // Undock for Lok.
-            pDockingParent->SetFloatingSize(Size(400, 600));
+            // 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.
+            pDockingParent->SetFloatingSize(
+                Size(TabBar::GetDefaultWidth() * 
GetWindow()->GetDPIScaleFactor(),
+                     pDockingParent->GetSizePixel().Height()));
             pDockingParent->SetFloatingMode(true);
         }
     }
commit f9564ae119be8bdd995d411fb934f6423be964af
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Nov 11 16:51:05 2018 -0500
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:26 2019 +0200

    LOK: sidebar: release LOKNotifier on destruction
    
    And enable sidebar routing only while we have a
    valid SidebarController instance (i.e. not disposed).
    
    Change-Id: I665f934f762c0ce9efdce5489ec9babe006376a8

diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 94976aa4191d..78d0c9ce4b18 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -194,6 +194,10 @@ void 
SidebarController::unregisterSidebarForFrame(SidebarController* pController
 void SidebarController::disposeDecks()
 {
     SolarMutexGuard aSolarMutexGuard;
+
+    if (comphelper::LibreOfficeKit::isActive())
+        mpParentWindow->ReleaseLOKNotifier();
+
     mpCurrentDeck.clear();
     maFocusManager.Clear();
     mpResourceManager->disposeDecks();
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx 
b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index ebbcd4143853..a9ecb5a3496f 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -97,7 +97,7 @@ void SidebarDockingWindow::NotifyResize()
 {
     if (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() && 
mbSidebarVisibleInLOK)
     {
-        if (!GetLOKNotifier())
+        if (mpSidebarController.is() && !GetLOKNotifier())
             SetLOKNotifier(SfxViewShell::Current());
 
         if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index c4286ae2c9a5..e22a0e34f25f 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3228,6 +3228,8 @@ void Window::SetLOKNotifier(const 
vcl::ILibreOfficeKitNotifier* pNotifier, bool
     // don't allow setting this twice
     assert(mpWindowImpl->mpLOKNotifier == nullptr);
     assert(pNotifier);
+    // never use this in the desktop case
+    assert(comphelper::LibreOfficeKit::isActive());
 
     if (!bParent)
     {
commit 8df69e01b9de65743ae5be8a8d277298ec7ebfea
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Thu Oct 25 01:35:37 2018 -0400
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:25 2019 +0200

    LOK: sidebar: enable only for Impress in LOK
    
    Change-Id: Idb361164db9ea8681b45fe99608d2cb5690db161

diff --git a/include/sfx2/sidebar/SidebarChildWindow.hxx 
b/include/sfx2/sidebar/SidebarChildWindow.hxx
index 1fcb25431d94..e37cf443ec86 100644
--- a/include/sfx2/sidebar/SidebarChildWindow.hxx
+++ b/include/sfx2/sidebar/SidebarChildWindow.hxx
@@ -39,6 +39,11 @@ public:
     SFX_DECL_CHILDWINDOW_WITHID(SidebarChildWindow);
 
     static sal_Int32 GetDefaultWidth(vcl::Window const * pWindow);
+
+    bool IsSidebarVisibleInLOK() const { return mbSidebarVisibleInLOK; }
+
+private:
+    const bool mbSidebarVisibleInLOK;
 };
 
 
diff --git a/include/sfx2/sidebar/SidebarDockingWindow.hxx 
b/include/sfx2/sidebar/SidebarDockingWindow.hxx
index 220b17ebdb2b..fbd29b3746f7 100644
--- a/include/sfx2/sidebar/SidebarDockingWindow.hxx
+++ b/include/sfx2/sidebar/SidebarDockingWindow.hxx
@@ -54,6 +54,8 @@ private:
     ::rtl::Reference<sfx2::sidebar::SidebarController> mpSidebarController;
 
     void DoDispose();
+
+    const bool mbSidebarVisibleInLOK;
 };
 
 } } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx 
b/sfx2/source/sidebar/SidebarChildWindow.cxx
index 0e5e73bbfdf5..e84d2fb4b379 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -32,7 +32,8 @@ SFX_IMPL_DOCKINGWINDOW_WITHID(SidebarChildWindow, 
SID_SIDEBAR);
 
 SidebarChildWindow::SidebarChildWindow (vcl::Window* pParentWindow, sal_uInt16 
nId,
                                         SfxBindings* pBindings, 
SfxChildWinInfo* pInfo)
-    : SfxChildWindow(pParentWindow, nId)
+    : SfxChildWindow(pParentWindow, nId),
+      mbSidebarVisibleInLOK(pInfo && pInfo->aModule == "simpress")
 {
     SetWindow(VclPtr<SidebarDockingWindow>::Create(pBindings, *this, 
pParentWindow,
                                                        WB_STDDOCKWIN | 
WB_OWNERDRAWDECORATION |
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx 
b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index 948ed7aa7ff2..ebbcd4143853 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -35,6 +35,7 @@ SidebarDockingWindow::SidebarDockingWindow(SfxBindings* 
pSfxBindings, SidebarChi
                                            vcl::Window* pParentWindow, WinBits 
nBits)
     : SfxDockingWindow(pSfxBindings, &rChildWindow, pParentWindow, nBits)
     , mpSidebarController()
+    , mbSidebarVisibleInLOK(rChildWindow.IsSidebarVisibleInLOK())
 {
     // Get the XFrame from the bindings.
     if (pSfxBindings==nullptr || pSfxBindings->GetDispatcher()==nullptr)
@@ -94,7 +95,7 @@ void SidebarDockingWindow::Resize()
 
 void SidebarDockingWindow::NotifyResize()
 {
-    if (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current())
+    if (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() && 
mbSidebarVisibleInLOK)
     {
         if (!GetLOKNotifier())
             SetLOKNotifier(SfxViewShell::Current());
commit a7e88ca804aecc567b27d54af9872e84b495a37c
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sat Oct 27 10:36:51 2018 -0400
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:25 2019 +0200

    LOK: sidebar: send close notification on disposing sidebar
    
    Change-Id: Ia8f197d07ba4b6a089571e9ca23b4697d04e7734

diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 43804ba3271a..94976aa4191d 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -1098,11 +1098,6 @@ IMPL_LINK(SidebarController, OnMenuItemSelected, Menu*, 
pMenu, bool)
 
 void SidebarController::RequestCloseDeck()
 {
-    if (comphelper::LibreOfficeKit::isActive())
-    {
-        
mpCurrentDeck->GetLOKNotifier()->notifyWindow(mpCurrentDeck->GetLOKWindowId(), 
"close");
-    }
-
     mbIsDeckRequestedOpen = false;
     UpdateDeckOpenState();
 
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx 
b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index 270234d8ddd1..948ed7aa7ff2 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -63,6 +63,12 @@ void SidebarDockingWindow::dispose()
 
 void SidebarDockingWindow::DoDispose()
 {
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+            pNotifier->notifyWindow(GetLOKWindowId(), "close");
+    }
+
     Reference<lang::XComponent> xComponent 
(static_cast<XWeak*>(mpSidebarController.get()), UNO_QUERY);
     mpSidebarController.clear();
     if (xComponent.is())
@@ -88,10 +94,8 @@ void SidebarDockingWindow::Resize()
 
 void SidebarDockingWindow::NotifyResize()
 {
-    SAL_WARN("sw", "SfxDockingWindow::Resize: " << 
(long)SfxViewShell::Current());
     if (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current())
     {
-        SAL_WARN("sw", "SfxDockingWindow::Resize: Creating!");
         if (!GetLOKNotifier())
             SetLOKNotifier(SfxViewShell::Current());
 
@@ -102,7 +106,6 @@ void SidebarDockingWindow::NotifyResize()
             aItems.emplace_back(std::make_pair("position", 
Point(GetOutOffXPixel(), GetOutOffYPixel()).toString()));
             aItems.emplace_back(std::make_pair("size", 
GetSizePixel().toString()));
             pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
-            SAL_WARN("sw", "SfxDockingWindow::Resize: Created!");
         }
     }
 }
commit 36cc2eab944aae6338234f31ac9bd54d4048729e
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Oct 21 19:29:38 2018 -0400
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:25 2019 +0200

    LOK: support resizing windows
    
    And delegate resizing of floating windows.
    
    Currently used for resizing sidebars in LOK.
    
    Change-Id: Iadc1b71c15a7d16a8c9dd7246490ae6bd645644c

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index a952dcd0a0a0..3df2a5645471 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2670,9 +2670,10 @@ void DesktopLOKTest::testABI()
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(48), offsetof(struct 
_LibreOfficeKitDocumentClass, postWindowGestureEvent));
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(49), offsetof(struct 
_LibreOfficeKitDocumentClass, selectPart));
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(50), offsetof(struct 
_LibreOfficeKitDocumentClass, moveSelectedParts));
+    CPPUNIT_ASSERT_EQUAL(documentClassOffset(51), offsetof(struct 
_LibreOfficeKitDocumentClass, resizeWindow));
     // Extending is fine, update this, and add new assert for the offsetof the
     // new method
-    CPPUNIT_ASSERT_EQUAL(documentClassOffset(51), sizeof(struct 
_LibreOfficeKitDocumentClass));
+    CPPUNIT_ASSERT_EQUAL(documentClassOffset(52), sizeof(struct 
_LibreOfficeKitDocumentClass));
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 853b0a7882dd..4a5bdc20fb9b 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -821,6 +821,9 @@ static int doc_getSignatureState(LibreOfficeKitDocument* 
pThis);
 
 static size_t doc_renderShapeSelection(LibreOfficeKitDocument* pThis, char** 
pOutput);
 
+static void doc_resizeWindow(LibreOfficeKitDocument* pThis, unsigned 
nLOKWindowId,
+                             const int nWidth, const int nHeight);
+
 LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 
<css::lang::XComponent> &xComponent)
     : mxComponent(xComponent)
 {
@@ -876,6 +879,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference 
<css::lang::XCompone
         m_pDocumentClass->paintWindow = doc_paintWindow;
         m_pDocumentClass->paintWindowDPI = doc_paintWindowDPI;
         m_pDocumentClass->postWindow = doc_postWindow;
+        m_pDocumentClass->resizeWindow = doc_resizeWindow;
 
         m_pDocumentClass->setViewLanguage = doc_setViewLanguage;
 
@@ -4425,6 +4429,23 @@ static int doc_getSignatureState(LibreOfficeKitDocument* 
pThis)
     return int(pObjectShell->GetDocumentSignatureState());
 }
 
+static void doc_resizeWindow(LibreOfficeKitDocument* /*pThis*/, unsigned 
nLOKWindowId,
+                             const int nWidth, const int nHeight)
+{
+    SolarMutexGuard aGuard;
+    if (gImpl)
+        gImpl->maLastExceptionMsg.clear();
+
+    VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId);
+    if (!pWindow)
+    {
+        gImpl->maLastExceptionMsg = "Document doesn't support dialog resizing, 
or window not found.";
+        return;
+    }
+
+    pWindow->SetSizePixel(Size(nWidth, nHeight));
+}
+
 static char* lo_getError (LibreOfficeKit *pThis)
 {
     comphelper::ProfileZone aZone("lo_getError");
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index f163660b0f68..1975a8d6ebf6 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -372,6 +372,11 @@ struct _LibreOfficeKitDocumentClass
     /// @see lok::Document::moveSelectedParts().
     void (*moveSelectedParts) (LibreOfficeKitDocument* pThis, int nPosition, 
bool bDuplicate);
 
+    /// Resize window with given id.
+    /// @see lok::Document::resizeWindow().
+    void (*resizeWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
+                          const int width, const int height);
+
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 8c0d0df145f9..61c2e44b5024 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -636,6 +636,20 @@ public:
         mpDoc->pClass->moveSelectedParts(mpDoc, nPosition, bDuplicate);
     }
 
+    /**
+     * Resize a window (dialog, popup, etc.) with give id.
+     *
+     * @param nWindowId
+     * @param width The width of the window.
+     * @param height The height of the window.
+     */
+    void resizeWindow(unsigned nWindowId,
+                      const int width,
+                      const int height)
+    {
+        return mpDoc->pClass->resizeWindow(mpDoc, nWindowId, width, height);
+    }
+
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index 26a43bbde581..a3f3f6797810 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -834,6 +834,11 @@ void DockingWindow::setPosSizePixel( long nX, long nY,
     {
         if (!mpFloatWin)
             Window::setPosSizePixel( nX, nY, nWidth, nHeight, nFlags );
+        else
+        {
+            mpFloatWin->SetOutputSizePixel(Size(nWidth, nHeight));
+            mpFloatWin->SetPosPixel(Point(nX, nY));
+        }
     }
 
     if (::isLayoutEnabled(this))
commit 49fe72fe93d6b292da275fd0508a01b49a86fa3b
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Wed Oct 10 06:44:27 2018 -0400
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:24 2019 +0200

    sfx2: LOK: route the parent sidebar window instead of the deck
    
    Change-Id: I0269a67c637afbc63a81405918f620009e681ff6

diff --git a/include/sfx2/sidebar/SidebarDockingWindow.hxx 
b/include/sfx2/sidebar/SidebarDockingWindow.hxx
index 0a0a55c76c5e..220b17ebdb2b 100644
--- a/include/sfx2/sidebar/SidebarDockingWindow.hxx
+++ b/include/sfx2/sidebar/SidebarDockingWindow.hxx
@@ -37,11 +37,14 @@ public:
     virtual ~SidebarDockingWindow() override;
     virtual void dispose() override;
 
+    void NotifyResize();
+
     using SfxDockingWindow::Close;
 
 protected:
     // Window overridables
     virtual void GetFocus() override;
+    virtual void Resize() override;
 
     virtual SfxChildAlignment CheckAlignment (
         SfxChildAlignment eCurrentAlignment,
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index ba6ac1f36c95..b3ab0d22ad84 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -62,20 +62,6 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, 
vcl::Window* pParentWindow,
 
     mpVerticalScrollBar->SetScrollHdl(LINK(this, Deck, 
HandleVerticalScrollBarChange));
 
-    if (comphelper::LibreOfficeKit::isActive())
-    {
-        SetLOKNotifier(SfxViewShell::Current());
-
-        if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
-        {
-            std::vector<vcl::LOKPayloadItem> aItems;
-            aItems.emplace_back("type", "deck");
-            aItems.emplace_back(std::make_pair("position", 
Point(GetOutOffXPixel(), GetOutOffYPixel()).toString()));
-            aItems.emplace_back(std::make_pair("size", 
GetSizePixel().toString()));
-            pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
-        }
-    }
-
 #ifdef DEBUG
     SetText(OUString("Deck"));
     mpScrollClipWindow->SetText(OUString("ScrollClipWindow"));
@@ -186,15 +172,6 @@ bool Deck::EventNotify(NotifyEvent& rEvent)
 void Deck::Resize()
 {
     Window::Resize();
-
-    if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
-    {
-        std::vector<vcl::LOKPayloadItem> aItems;
-        aItems.emplace_back("type", "deck");
-        aItems.emplace_back(std::make_pair("position", 
Point(GetOutOffXPixel(), GetOutOffYPixel()).toString()));
-        aItems.emplace_back(std::make_pair("size", GetSizePixel().toString()));
-        pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
-    }
 }
 
 bool Deck::ProcessWheelEvent(CommandEvent const * pCommandEvent)
@@ -247,15 +224,6 @@ void Deck::RequestLayout()
     DeckLayouter::LayoutDeck(GetContentArea(), mnMinimalWidth, maPanels,
                              *GetTitleBar(), *mpScrollClipWindow, 
*mpScrollContainer,
                              *mpFiller, *mpVerticalScrollBar);
-
-    if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
-    {
-        std::vector<vcl::LOKPayloadItem> aItems;
-        aItems.emplace_back("type", "deck");
-        aItems.emplace_back(std::make_pair("position", 
Point(GetOutOffXPixel(), GetOutOffYPixel()).toString()));
-        aItems.emplace_back(std::make_pair("size", GetSizePixel().toString()));
-        pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
-    }
 }
 
 vcl::Window* Deck::GetPanelParentWindow()
@@ -301,15 +269,6 @@ void Deck::ShowPanel(const Panel& rPanel)
             Point(
                 mpScrollContainer->GetPosPixel().X(),
                 -nNewThumbPos));
-
-            if (const vcl::ILibreOfficeKitNotifier* pNotifier = 
GetLOKNotifier())
-            {
-                std::vector<vcl::LOKPayloadItem> aItems;
-                aItems.emplace_back("type", "deck");
-                aItems.emplace_back(std::make_pair("position", 
Point(GetOutOffXPixel(), GetOutOffYPixel()).toString()));
-                aItems.emplace_back(std::make_pair("size", 
GetSizePixel().toString()));
-                pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
-            }
     }
 }
 
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 805d25799121..43804ba3271a 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -406,6 +406,8 @@ void SidebarController::NotifyResize()
     }
 
     RestrictWidth(nMinimalWidth);
+
+    mpParentWindow->NotifyResize();
 }
 
 void SidebarController::ProcessNewWidth (const sal_Int32 nNewWidth)
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx 
b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index 84a2834e5a34..270234d8ddd1 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -20,9 +20,11 @@
 #include <sfx2/sidebar/SidebarChildWindow.hxx>
 #include <sfx2/sidebar/SidebarController.hxx>
 
+#include <sfx2/lokhelper.hxx>
 #include <sfx2/bindings.hxx>
 #include <sfx2/dispatch.hxx>
 #include <tools/link.hxx>
+#include <comphelper/lok.hxx>
 
 using namespace css;
 using namespace css::uno;
@@ -77,6 +79,34 @@ void SidebarDockingWindow::GetFocus()
         SfxDockingWindow::GetFocus();
 }
 
+void SidebarDockingWindow::Resize()
+{
+    SfxDockingWindow::Resize();
+
+    NotifyResize();
+}
+
+void SidebarDockingWindow::NotifyResize()
+{
+    SAL_WARN("sw", "SfxDockingWindow::Resize: " << 
(long)SfxViewShell::Current());
+    if (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current())
+    {
+        SAL_WARN("sw", "SfxDockingWindow::Resize: Creating!");
+        if (!GetLOKNotifier())
+            SetLOKNotifier(SfxViewShell::Current());
+
+        if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+        {
+            std::vector<vcl::LOKPayloadItem> aItems;
+            aItems.emplace_back("type", "deck");
+            aItems.emplace_back(std::make_pair("position", 
Point(GetOutOffXPixel(), GetOutOffYPixel()).toString()));
+            aItems.emplace_back(std::make_pair("size", 
GetSizePixel().toString()));
+            pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
+            SAL_WARN("sw", "SfxDockingWindow::Resize: Created!");
+        }
+    }
+}
+
 SfxChildAlignment SidebarDockingWindow::CheckAlignment (
     SfxChildAlignment eCurrentAlignment,
     SfxChildAlignment eRequestedAlignment)
commit fcafc6d737b26b5c0fc7b6f61356fa4290cd15f8
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Oct 7 11:32:55 2018 -0400
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:24 2019 +0200

    LOK: sfx2: disble sidebar menu-button when deck is hidden
    
    There is no render area on the sidebar virtual-device
    to render the popup menu when the sidebar is collapsed
    into the TabBar, so we disable it altogether as we
    can't properly display it in LoKit.
    
    Change-Id: I2edee9e734485bb685f0ddc0c30bfe584e42a550

diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx
index 08550dca70a4..1280c919ce23 100644
--- a/include/sfx2/sidebar/TabBar.hxx
+++ b/include/sfx2/sidebar/TabBar.hxx
@@ -91,6 +91,9 @@ public:
 
     void UpdateFocusManager (FocusManager& rFocusManager);
 
+    /// Enables/Disables the menu button. Used by LoKit.
+    void EnableMenuButton(const bool bEnable);
+
 private:
     css::uno::Reference<css::frame::XFrame> mxFrame;
     VclPtr<CheckBox> mpMenuButton;
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 6f81400499f1..805d25799121 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -1151,6 +1151,10 @@ void SidebarController::UpdateDeckOpenState()
                 aNewSize.setWidth(mnSavedSidebarWidth);
 
                 mpParentWindow->GetFloatingWindow()->SetPosSizePixel(aNewPos, 
aNewSize);
+
+                // Sidebar wide enought to render the menu; enable it.
+                if (comphelper::LibreOfficeKit::isActive())
+                    mpTabBar->EnableMenuButton(true);
             }
         }
         else
@@ -1168,6 +1172,10 @@ void SidebarController::UpdateDeckOpenState()
                 aNewSize.setWidth(nTabBarDefaultWidth);
 
                 mpParentWindow->GetFloatingWindow()->SetPosSizePixel(aNewPos, 
aNewSize);
+
+                // Sidebar too narrow to render the menu; disable it.
+                if (comphelper::LibreOfficeKit::isActive())
+                    mpTabBar->EnableMenuButton(false);
             }
 
             if (mnWidthOnSplitterButtonDown > nTabBarDefaultWidth)
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index a18de4f77171..a738d7dd4e18 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -402,6 +402,11 @@ IMPL_LINK_NOARG(TabBar, OnToolboxClicked, Button*, void)
     mpMenuButton->Check(false);
 }
 
+void TabBar::EnableMenuButton(const bool bEnable)
+{
+    mpMenuButton->Enable(bEnable);
+}
+
 } } // end of namespace sfx2::sidebar
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit ea17f288e19f2f227720600023dc804cb00e090e
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Oct 7 11:03:02 2018 -0400
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:23 2019 +0200

    sfx2: customize the sidebar popup menu for Lokit
    
    Don't show customization or docking options.
    
    Change-Id: I313868cb2b2d0444ee90cf9709a326a81d0e5ed8

diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 18093b6844e7..6f81400499f1 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -944,66 +944,83 @@ void SidebarController::ShowPopupMenu (
     // pass toolbox button rect so the menu can stay open on button up
     tools::Rectangle aBox (rButtonBox);
     aBox.Move(mpTabBar->GetPosPixel().X(), 0);
-    pMenu->Execute(mpParentWindow, aBox, PopupMenuFlags::ExecuteDown);
+    const PopupMenuFlags aMenuDirection
+        = (comphelper::LibreOfficeKit::isActive() ? PopupMenuFlags::ExecuteLeft
+                                                  : 
PopupMenuFlags::ExecuteDown);
+    pMenu->Execute(mpParentWindow, aBox, aMenuDirection);
     pMenu.disposeAndClear();
 }
 
-VclPtr<PopupMenu> SidebarController::CreatePopupMenu (
-    const ::std::vector<TabBar::DeckMenuData>& rMenuData) const
+VclPtr<PopupMenu>
+SidebarController::CreatePopupMenu(const ::std::vector<TabBar::DeckMenuData>& 
rMenuData) const
 {
     // Create the top level popup menu.
     VclPtrInstance<PopupMenu> pMenu;
     FloatingWindow* pMenuWindow = 
dynamic_cast<FloatingWindow*>(pMenu->GetWindow());
     if (pMenuWindow != nullptr)
     {
-        pMenuWindow->SetPopupModeFlags(pMenuWindow->GetPopupModeFlags() | 
FloatWinPopupFlags::NoMouseUpClose);
+        pMenuWindow->SetPopupModeFlags(pMenuWindow->GetPopupModeFlags()
+                                       | FloatWinPopupFlags::NoMouseUpClose);
     }
 
-    // Create sub menu for customization (hiding of deck tabs.)
-    VclPtr<PopupMenu> pCustomizationMenu = VclPtr<PopupMenu>::Create();
+    // Create sub menu for customization (hiding of deck tabs), only on 
desktop.
+    VclPtr<PopupMenu> pCustomizationMenu
+        = (comphelper::LibreOfficeKit::isActive() ? nullptr : 
VclPtr<PopupMenu>::Create());
 
     // Add one entry for every tool panel element to individually make
     // them visible or hide them.
-    sal_Int32 nIndex (0);
-    for(::std::vector<TabBar::DeckMenuData>::const_iterator
-            iItem(rMenuData.begin()),
-            iEnd(rMenuData.end());
-        iItem!=iEnd;
-        ++iItem,++nIndex)
+    sal_Int32 nIndex(0);
+    for (const TabBar::DeckMenuData& item : rMenuData)
     {
-        const sal_Int32 nMenuIndex (nIndex+MID_FIRST_PANEL);
-        pMenu->InsertItem(nMenuIndex, iItem->msDisplayName, 
MenuItemBits::RADIOCHECK);
-        pMenu->CheckItem(nMenuIndex, iItem->mbIsCurrentDeck);
-        pMenu->EnableItem(nMenuIndex, iItem->mbIsEnabled&&iItem->mbIsActive);
+        const sal_Int32 nMenuIndex(nIndex + MID_FIRST_PANEL);
+        pMenu->InsertItem(nMenuIndex, item.msDisplayName, 
MenuItemBits::RADIOCHECK);
+        pMenu->CheckItem(nMenuIndex, item.mbIsCurrentDeck);
+        pMenu->EnableItem(nMenuIndex, item.mbIsEnabled && item.mbIsActive);
 
-        const sal_Int32 nSubMenuIndex (nIndex+MID_FIRST_HIDE);
-        if (iItem->mbIsCurrentDeck)
+        if (!comphelper::LibreOfficeKit::isActive())
         {
-            // Don't allow the currently visible deck to be disabled.
-            pCustomizationMenu->InsertItem(nSubMenuIndex, 
iItem->msDisplayName, MenuItemBits::RADIOCHECK);
-            pCustomizationMenu->CheckItem(nSubMenuIndex);
-        }
-        else
-        {
-            pCustomizationMenu->InsertItem(nSubMenuIndex, 
iItem->msDisplayName, MenuItemBits::CHECKABLE);
-            pCustomizationMenu->CheckItem(nSubMenuIndex, iItem->mbIsEnabled && 
iItem->mbIsActive);
+            const sal_Int32 nSubMenuIndex(nIndex + MID_FIRST_HIDE);
+            if (item.mbIsCurrentDeck)
+            {
+                // Don't allow the currently visible deck to be disabled.
+                pCustomizationMenu->InsertItem(nSubMenuIndex, 
item.msDisplayName,
+                                               MenuItemBits::RADIOCHECK);
+                pCustomizationMenu->CheckItem(nSubMenuIndex);
+            }
+            else
+            {
+                pCustomizationMenu->InsertItem(nSubMenuIndex, 
item.msDisplayName,
+                                               MenuItemBits::CHECKABLE);
+                pCustomizationMenu->CheckItem(nSubMenuIndex, item.mbIsEnabled 
&& item.mbIsActive);
+            }
         }
+
+        ++nIndex;
     }
 
     pMenu->InsertSeparator();
 
-    // Add entry for docking or un-docking the tool panel.
-    if (mpParentWindow->IsFloatingMode())
-        pMenu->InsertItem(MID_LOCK_TASK_PANEL, SfxResId(STR_SFX_DOCK));
-    else
-        pMenu->InsertItem(MID_UNLOCK_TASK_PANEL, SfxResId(STR_SFX_UNDOCK));
+    // LOK doesn't support docked/undocked; Sidebar is floating but rendered 
docked in browser.
+    if (!comphelper::LibreOfficeKit::isActive())
+    {
+        // Add entry for docking or un-docking the tool panel.
+        if (mpParentWindow->IsFloatingMode())
+            pMenu->InsertItem(MID_LOCK_TASK_PANEL, SfxResId(STR_SFX_DOCK));
+        else
+            pMenu->InsertItem(MID_UNLOCK_TASK_PANEL, SfxResId(STR_SFX_UNDOCK));
+    }
 
     pMenu->InsertItem(MID_HIDE_SIDEBAR, 
SfxResId(SFX_STR_SIDEBAR_HIDE_SIDEBAR));
-    pCustomizationMenu->InsertSeparator();
-    pCustomizationMenu->InsertItem(MID_RESTORE_DEFAULT, 
SfxResId(SFX_STR_SIDEBAR_RESTORE));
 
-    pMenu->InsertItem(MID_CUSTOMIZATION, 
SfxResId(SFX_STR_SIDEBAR_CUSTOMIZATION));
-    pMenu->SetPopupMenu(MID_CUSTOMIZATION, pCustomizationMenu);
+    // No Restore or Customize options for LoKit.
+    if (!comphelper::LibreOfficeKit::isActive())
+    {
+        pCustomizationMenu->InsertSeparator();
+        pCustomizationMenu->InsertItem(MID_RESTORE_DEFAULT, 
SfxResId(SFX_STR_SIDEBAR_RESTORE));
+
+        pMenu->InsertItem(MID_CUSTOMIZATION, 
SfxResId(SFX_STR_SIDEBAR_CUSTOMIZATION));
+        pMenu->SetPopupMenu(MID_CUSTOMIZATION, pCustomizationMenu);
+    }
 
     pMenu->RemoveDisabledEntries(false);
 
commit ba56203732f75597112f0a9a4d130d6674da37fd
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Oct 7 08:33:41 2018 -0400
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:23 2019 +0200

    sfx2: collapse the sidebar instead of closing on toggle
    
    When toggling a sidebar deck that is open, the default
    behavior when floating is to close the sidebar altogether.
    This is both inconsistent with the behaviour when docked
    and unexpected.
    
    Now we simply collapse the sidebar into the TabBar (toolbar)
    as is done when docked. This is also the behavior desired
    from LoKit since the sidebar is rendered floating (to allow
    arbitrary resizing).
    
    The collapsed sidebar into toolbar is shown in same-position.
    
    Change-Id: I0519c5ad012cc9df31758927a4dbcd774d47fcd3

diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 2a08fd675080..18093b6844e7 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -30,6 +30,7 @@
 #include <sfx2/sidebar/ContextList.hxx>
 
 
+#include <sfx2/lokhelper.hxx>
 #include <sfx2/sfxresid.hxx>
 #include <sfx2/sfxsids.hrc>
 #include <sfx2/titledockwin.hxx>
@@ -523,12 +524,8 @@ void SidebarController::OpenThenToggleDeck (
         pSplitWindow->FadeIn();
     else if ( IsDeckVisible( rsDeckId ) )
     {
-        if ( pSplitWindow )
-            // tdf#67627 Clicking a second time on a Deck icon will close the 
Deck
-            RequestCloseDeck();
-        else
-            // tdf#88241 Summoning an undocked sidebar a second time should 
close sidebar
-            mpParentWindow->Close();
+        // tdf#67627 Clicking a second time on a Deck icon will close the Deck
+        RequestCloseDeck();
         return;
     }
     RequestOpenDeck();
@@ -1111,7 +1108,7 @@ void SidebarController::UpdateDeckOpenState()
         // No state requested.
         return;
 
-    sal_Int32 nTabBarDefaultWidth = TabBar::GetDefaultWidth() * 
mpTabBar->GetDPIScaleFactor();
+    const sal_Int32 nTabBarDefaultWidth = TabBar::GetDefaultWidth() * 
mpTabBar->GetDPIScaleFactor();
 
     // Update (change) the open state when it either has not yet been 
initialized
     // or when its value differs from the requested state.
@@ -1120,15 +1117,42 @@ void SidebarController::UpdateDeckOpenState()
     {
         if (mbIsDeckRequestedOpen.get())
         {
-            if (mnSavedSidebarWidth <= nTabBarDefaultWidth)
-                
SetChildWindowWidth(SidebarChildWindow::GetDefaultWidth(mpParentWindow));
+            if (!mpParentWindow->IsFloatingMode())
+            {
+                if (mnSavedSidebarWidth <= nTabBarDefaultWidth)
+                    
SetChildWindowWidth(SidebarChildWindow::GetDefaultWidth(mpParentWindow));
+                else
+                    SetChildWindowWidth(mnSavedSidebarWidth);
+            }
             else
-                SetChildWindowWidth(mnSavedSidebarWidth);
+            {
+                // Show the Deck by resizing back to the original size (before 
hiding).
+                Size 
aNewSize(mpParentWindow->GetFloatingWindow()->GetSizePixel());
+                Point 
aNewPos(mpParentWindow->GetFloatingWindow()->GetPosPixel());
+
+                aNewPos.setX(aNewPos.X() - mnSavedSidebarWidth + 
nTabBarDefaultWidth);
+                aNewSize.setWidth(mnSavedSidebarWidth);
+
+                mpParentWindow->GetFloatingWindow()->SetPosSizePixel(aNewPos, 
aNewSize);
+            }
         }
         else
         {
             if ( ! mpParentWindow->IsFloatingMode())
                 mnSavedSidebarWidth = SetChildWindowWidth(nTabBarDefaultWidth);
+            else
+            {
+                // Hide the Deck by resizing to the width of the TabBar.
+                Size 
aNewSize(mpParentWindow->GetFloatingWindow()->GetSizePixel());
+                Point 
aNewPos(mpParentWindow->GetFloatingWindow()->GetPosPixel());
+                mnSavedSidebarWidth = aNewSize.Width(); // Save the current 
width to restore.
+
+                aNewPos.setX(aNewPos.X() + mnSavedSidebarWidth - 
nTabBarDefaultWidth);
+                aNewSize.setWidth(nTabBarDefaultWidth);
+
+                mpParentWindow->GetFloatingWindow()->SetPosSizePixel(aNewPos, 
aNewSize);
+            }
+
             if (mnWidthOnSplitterButtonDown > nTabBarDefaultWidth)
                 mnSavedSidebarWidth = mnWidthOnSplitterButtonDown;
             mpParentWindow->SetStyle(mpParentWindow->GetStyle() & 
~WB_SIZEABLE);
commit caff0ee7b163898d02c81c24dbe58b1f952df296
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Wed Oct 3 06:31:33 2018 -0400
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:22 2019 +0200

    sfx2: LOK: support resizing the sidebar
    
    Change-Id: I852c522f176a8d11d3a19709ab1cd75023645c66

diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx 
b/sfx2/source/sidebar/SidebarChildWindow.cxx
index 7153c1d461b1..0e5e73bbfdf5 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -24,6 +24,7 @@
 #include <sfx2/sfxsids.hrc>
 #include <helpids.h>
 #include <sfx2/dockwin.hxx>
+#include <comphelper/lok.hxx>
 
 namespace sfx2 { namespace sidebar {
 
@@ -57,6 +58,13 @@ SidebarChildWindow::SidebarChildWindow (vcl::Window* 
pParentWindow, sal_uInt16 n
                         pDockingParent->GetSizePixel().Height()));
         }
         pDockingParent->Initialize(pInfo);
+
+        if (comphelper::LibreOfficeKit::isActive())
+        {
+            // Undock for Lok.
+            pDockingParent->SetFloatingSize(Size(400, 600));
+            pDockingParent->SetFloatingMode(true);
+        }
     }
     SetHideNotDelete(true);
 
commit b0ebab98ff49fd6360a9e05d049cfc1f4a8964dd
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Sep 2 11:38:31 2018 -0400
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:22 2019 +0200

    sidebar: support closing the sidebar through the X button
    
    Change-Id: I078c27d22bbee3d02ad4a3fb97ba01a394f171e1

diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index af8dd99872f0..2a08fd675080 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -42,6 +42,7 @@
 #include <toolkit/helper/vclunohelper.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/lok.hxx>
 #include <o3tl/make_unique.hxx>
 
 #include <com/sun/star/lang/XInitialization.hpp>
@@ -1081,6 +1082,11 @@ IMPL_LINK(SidebarController, OnMenuItemSelected, Menu*, 
pMenu, bool)
 
 void SidebarController::RequestCloseDeck()
 {
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        
mpCurrentDeck->GetLOKNotifier()->notifyWindow(mpCurrentDeck->GetLOKWindowId(), 
"close");
+    }
+
     mbIsDeckRequestedOpen = false;
     UpdateDeckOpenState();
 
commit f308865d6e6921aeee9353174400d55b2679b4d1
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Aug 26 22:11:43 2018 -0400
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:21 2019 +0200

    sidebar: Add .uno:MasterSlidesPanel
    
    Change-Id: I578dc8b1f9c8df7f7cc9108c70d6fad8006871c6

diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index 81f83b2a8297..252b1133b02d 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -214,6 +214,7 @@
 #define SID_BEFORE_OBJ                      (SID_SD_START+181)
     // FREE
 #define SID_CUSTOM_ANIMATION_PANEL          (SID_SD_START+183)
+#define SID_MASTER_SLIDES_PANEL             (SID_SD_START+184)
     // FREE
 // and even more...
 #define ID_VAL_ENDINTENS                    (SID_SD_START+197)
diff --git a/sd/sdi/SlideSorterController.sdi b/sd/sdi/SlideSorterController.sdi
index 5937ba159cec..e9d1ae77d7b2 100644
--- a/sd/sdi/SlideSorterController.sdi
+++ b/sd/sdi/SlideSorterController.sdi
@@ -204,6 +204,11 @@ interface SlideSorterView
         ExecMethod = FuTemporary ;
         StateMethod = GetMenuState ;
     ]
+    SID_MASTER_SLIDES_PANEL // ole : no, status : ?
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetMenuState ;
+    ]
     SID_PRESENTATION_DLG
     [
         ExecMethod = FuTemporary ;
diff --git a/sd/sdi/drviewsh.sdi b/sd/sdi/drviewsh.sdi
index 931a54ee983d..453ffb4a5cec 100644
--- a/sd/sdi/drviewsh.sdi
+++ b/sd/sdi/drviewsh.sdi
@@ -52,6 +52,11 @@ interface ImpressEditView : DrawView
         ExecMethod = FuTemporary ;
         StateMethod = GetMenuState ;
     ]
+    SID_MASTER_SLIDES_PANEL // ole : no, status : ?
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetMenuState ;
+    ]
     SID_REHEARSE_TIMINGS // ole : no, status : ?
     [
         ExecMethod = FuSupport ;
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index cdccfd94df91..e182c1cb34f6 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -3542,6 +3542,24 @@ SfxBoolItem SlideChangeWindow SID_SLIDE_TRANSITIONS_PANEL
     GroupId = SfxGroupId::Modify;
 ]
 
+SfxBoolItem MasterSlidesPanel SID_MASTER_SLIDES_PANEL
+
+[
+    AutoUpdate = TRUE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = SfxGroupId::Modify;
+]
+
 SfxVoidItem SlideMasterPage SID_SLIDE_MASTER_MODE
 ()
 [
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx 
b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index a21f520af711..03d4a59d861a 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -180,6 +180,17 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
             break;
         }
 
+        case SID_MASTER_SLIDES_PANEL:
+        {
+            // First make sure that the sidebar is visible
+            pShell->GetViewFrame()->ShowChildWindow(SID_SIDEBAR);
+            ::sfx2::sidebar::Sidebar::ShowPanel(
+                "SdAllMasterPagesPanel",
+                pShell->GetViewFrame()->GetFrame().GetFrameInterface());
+            rRequest.Ignore ();
+            break;
+        }
+
         case SID_PRESENTATION_DLG:
             FuSlideShowDlg::Create (
                 pShell,
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index ce5f339326e7..ed080d45ea2a 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -3115,6 +3115,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         break;
 
         case SID_SLIDE_TRANSITIONS_PANEL:
+        case SID_MASTER_SLIDES_PANEL:
         case SID_CUSTOM_ANIMATION_PANEL:
         case SID_GALLERY:
         {
@@ -3128,6 +3129,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
                 panelId = "GalleryPanel";
             else if (nSId == SID_SLIDE_TRANSITIONS_PANEL)
                 panelId = "SdSlideTransitionPanel";
+            else if (nSId == SID_MASTER_SLIDES_PANEL)
+                panelId = "SdAllMasterPagesPanel";
 
             ::sfx2::sidebar::Sidebar::ShowPanel(
                 panelId,
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx 
b/sfx2/source/sidebar/DeckLayouter.cxx
index b0d177ec7406..9ca553dd66c1 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -164,6 +164,7 @@ tools::Rectangle LayoutPanels (
         nTotalPreferredHeight += iItem->maLayoutSize.Preferred;
     }
 
+
     if (nTotalMinimumHeight > nAvailableHeight
         && ! bShowVerticalScrollBar)
     {
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 70725c46bc86..af8dd99872f0 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -751,7 +751,6 @@ void SidebarController::SwitchToDeck (
         nDeckX = 0;
     }
 
-
     // Activate the deck and the new set of panels.
     mpCurrentDeck->setPosSizePixel(
         nDeckX,
commit 446ebf9ce4080861a423899aafab48f92966005c
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sat Aug 18 09:59:53 2018 -0400
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:21 2019 +0200

    sidebar: hide preview and play controls in lokit
    
    Change-Id: I7fc9470082612af4c4d7e56ff704936da5c63ce4

diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx 
b/sd/source/ui/animations/CustomAnimationPane.cxx
index 59a483e9e1f7..6375774cb999 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -50,6 +50,7 @@
 #include <vcl/combobox.hxx>
 #include <vcl/scrbar.hxx>
 
+#include <comphelper/lok.hxx>
 #include <comphelper/sequence.hxx>
 #include <sfx2/frame.hxx>
 #include <sfx2/sidebar/Theme.hxx>
@@ -497,8 +498,17 @@ void CustomAnimationPane::updateControls()
     mpFTDuration->Enable( mxView.is() );
     mpCBXDuration->Enable( mxView.is() );
     mpCustomAnimationList->Enable( mxView.is() );
-    mpPBPlay->Enable( mxView.is() );
-    mpCBAutoPreview->Enable( mxView.is() );
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        mpPBPlay->Hide();
+        mpCBAutoPreview->Check(false);
+        mpCBAutoPreview->Hide();
+    }
+    else
+    {
+        mpPBPlay->Enable( mxView.is() );
+        mpCBAutoPreview->Enable( mxView.is() );
+    }
 
     if( !mxView.is() )
     {
diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx 
b/sd/source/ui/animations/SlideTransitionPane.cxx
index df96aa23f34a..f08c171a3ae5 100644
--- a/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -33,6 +33,7 @@
 #include <DrawController.hxx>
 #include <com/sun/star/beans/XPropertySet.hpp>
 
+#include <comphelper/lok.hxx>
 #include <svtools/controldims.hxx>
 #include <svx/gallery.hxx>
 #include <unotools/pathoptions.hxx>
@@ -693,8 +694,17 @@ void SlideTransitionPane::updateControls()
         mpMF_ADVANCE_AUTO_AFTER->SetValue( aEffect.mfTime * 100.0);
     }
 
-    SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress);
-    mpCB_AUTO_PREVIEW->Check( pOptions->IsPreviewTransitions() );
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        mpPB_PLAY->Hide();
+        mpCB_AUTO_PREVIEW->Check(false);
+        mpCB_AUTO_PREVIEW->Hide();
+    }
+    else
+    {
+        SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress);
+        mpCB_AUTO_PREVIEW->Check( pOptions->IsPreviewTransitions() );
+    }
 
     mbUpdatingControls = false;
 
commit 2587e5423657d9e25accfbb7391fdc1acfa033fe
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Fri Sep 14 08:43:22 2018 -0400
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Tue Apr 30 18:06:20 2019 +0200

    sd: sidebars are now visible in LOOL
    
    Change-Id: I7ceae056e3d6ce1c991fe1194faa8bebfd6aae1e

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index fe252ca9bdbc..68b0b29d7d66 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -592,6 +592,7 @@ typedef enum
      * "type" tells the type of the window the action is associated with
      *  - "dialog" - window is a dialog
      *  - "child" - window is a floating window (combo boxes, etc.)
+     *  - "deck" - window is a docked/floating deck (i.e. the sidebar)
      *
      * "action" can take following values:
      * - "created" - window is created in the backend, client can render it now
diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx
index b1edcf942fcf..c4cc7027961e 100644
--- a/include/sfx2/sidebar/Deck.hxx
+++ b/include/sfx2/sidebar/Deck.hxx
@@ -66,6 +66,7 @@ public:
     virtual void Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rUpdateArea) override;
     virtual void DataChanged (const DataChangedEvent& rEvent) override;
     virtual bool EventNotify(NotifyEvent& rEvent) override;
+    virtual void Resize() override;
 
     static void PrintWindowSubTree (vcl::Window* pRoot, int nIndentation);
 
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 90bbe1ed8b0b..ba6ac1f36c95 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -27,9 +27,13 @@
 #include <sfx2/sidebar/Panel.hxx>
 #include <sfx2/sidebar/Tools.hxx>
 #include <sfx2/sidebar/Theme.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/lokhelper.hxx>
 
+#include <comphelper/lok.hxx>
 #include <vcl/dockwin.hxx>
 #include <vcl/scrbar.hxx>
+#include <vcl/IDialogRenderable.hxx>
 #include <tools/svborder.hxx>
 
 using namespace css;
@@ -58,6 +62,20 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, 
vcl::Window* pParentWindow,
 
     mpVerticalScrollBar->SetScrollHdl(LINK(this, Deck, 
HandleVerticalScrollBarChange));
 
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        SetLOKNotifier(SfxViewShell::Current());
+
+        if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+        {
+            std::vector<vcl::LOKPayloadItem> aItems;
+            aItems.emplace_back("type", "deck");
+            aItems.emplace_back(std::make_pair("position", 
Point(GetOutOffXPixel(), GetOutOffYPixel()).toString()));
+            aItems.emplace_back(std::make_pair("size", 
GetSizePixel().toString()));
+            pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
+        }
+    }
+
 #ifdef DEBUG
     SetText(OUString("Deck"));
     mpScrollClipWindow->SetText(OUString("ScrollClipWindow"));
@@ -165,6 +183,20 @@ bool Deck::EventNotify(NotifyEvent& rEvent)
     return Window::EventNotify(rEvent);
 }
 
+void Deck::Resize()
+{
+    Window::Resize();
+
+    if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+    {
+        std::vector<vcl::LOKPayloadItem> aItems;
+        aItems.emplace_back("type", "deck");
+        aItems.emplace_back(std::make_pair("position", 
Point(GetOutOffXPixel(), GetOutOffYPixel()).toString()));
+        aItems.emplace_back(std::make_pair("size", GetSizePixel().toString()));
+        pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
+    }
+}
+
 bool Deck::ProcessWheelEvent(CommandEvent const * pCommandEvent)
 {
     if ( ! mpVerticalScrollBar)
@@ -215,6 +247,15 @@ void Deck::RequestLayout()
     DeckLayouter::LayoutDeck(GetContentArea(), mnMinimalWidth, maPanels,
                              *GetTitleBar(), *mpScrollClipWindow, 
*mpScrollContainer,
                              *mpFiller, *mpVerticalScrollBar);
+
+    if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+    {
+        std::vector<vcl::LOKPayloadItem> aItems;
+        aItems.emplace_back("type", "deck");
+        aItems.emplace_back(std::make_pair("position", 
Point(GetOutOffXPixel(), GetOutOffYPixel()).toString()));
+        aItems.emplace_back(std::make_pair("size", GetSizePixel().toString()));
+        pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
+    }
 }
 
 vcl::Window* Deck::GetPanelParentWindow()
@@ -261,6 +302,14 @@ void Deck::ShowPanel(const Panel& rPanel)
                 mpScrollContainer->GetPosPixel().X(),
                 -nNewThumbPos));
 
+            if (const vcl::ILibreOfficeKitNotifier* pNotifier = 
GetLOKNotifier())
+            {
+                std::vector<vcl::LOKPayloadItem> aItems;
+                aItems.emplace_back("type", "deck");
+                aItems.emplace_back(std::make_pair("position", 
Point(GetOutOffXPixel(), GetOutOffYPixel()).toString()));
+                aItems.emplace_back(std::make_pair("size", 
GetSizePixel().toString()));
+                pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
+            }
     }
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to