desktop/source/lib/init.cxx                   |   19 ++++++++++++++++---
 include/sfx2/sidebar/SidebarDockingWindow.hxx |    2 +-
 sfx2/source/sidebar/ResourceManager.cxx       |    9 +++++++++
 3 files changed, 26 insertions(+), 4 deletions(-)

New commits:
commit 87c58f6a9351f2a2ec40fd99c4e5a63bfe29d0b8
Author:     Mert Tumer <mert.tu...@collabora.com>
AuthorDate: Wed Apr 29 16:29:57 2020 +0300
Commit:     Mert Tumer <mert.tu...@collabora.com>
CommitDate: Tue Aug 4 12:43:29 2020 +0200

    added ability to switch sidebar deck on init.cxx for mobilewizard
    
    Change-Id: I532398bc41e1c984c24b1d39e4844315a0a69847
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93162
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97062
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98247
    Tested-by: Jenkins
    Reviewed-by: Mert Tumer <mert.tu...@collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index dc1b6b1664fc..346c5174accd 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -111,6 +111,7 @@
 #include <sfx2/lokcharthelper.hxx>
 #include <sfx2/DocumentSigner.hxx>
 #include <sfx2/sidebar/SidebarDockingWindow.hxx>
+#include <sfx2/sidebar/SidebarController.hxx>
 #include <svx/dialmgr.hxx>
 #include <svx/strings.hrc>
 #include <svx/svdview.hxx>
@@ -883,10 +884,10 @@ void ExecuteOrientationChange()
         mxUndoManager->leaveUndoContext();
 }
 
-void setupSidebar(bool bShow)
+void setupSidebar(bool bShow, const OUString& sidebarDeckId = "")
 {
     SfxViewShell* pViewShell = SfxViewShell::Current();
-    SfxViewFrame* pViewFrame = pViewShell? pViewShell->GetViewFrame(): nullptr;
+    SfxViewFrame* pViewFrame = pViewShell ? pViewShell->GetViewFrame() : 
nullptr;
     if (pViewFrame)
     {
         if (bShow && !pViewFrame->GetChildWindow(SID_SIDEBAR))
@@ -905,6 +906,11 @@ void setupSidebar(bool bShow)
         auto pDockingWin = dynamic_cast<sfx2::sidebar::SidebarDockingWindow 
*>(pChild->GetWindow());
         if (!pDockingWin)
             return;
+
+        if (!sidebarDeckId.isEmpty())
+        {
+            pDockingWin->GetSidebarController()->SwitchToDeck(sidebarDeckId);
+        }
         pDockingWin->SyncUpdate();
     }
     else
@@ -3744,6 +3750,7 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* 
pThis, const char* pComma
     SfxObjectShell* pDocSh = SfxObjectShell::Current();
     OUString aCommand(pCommand, strlen(pCommand), RTL_TEXTENCODING_UTF8);
     LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+    OUString sidebarDeckId = "PropertyDeck";
 
     std::vector<beans::PropertyValue> 
aPropertyValuesVector(jsonToPropertyValuesVector(pArguments));
 
@@ -3897,9 +3904,15 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* 
pThis, const char* pComma
             return;
         }
     }
+    else if (gImpl && aCommand == ".uno:LOKSidebarWriterPage")
+    {
+        sidebarDeckId = "WriterPageDeck";
+        setupSidebar(true, sidebarDeckId);
+        return;
+    }
     else if (gImpl && aCommand == ".uno:SidebarShow")
     {
-        setupSidebar(true);
+        setupSidebar(true, sidebarDeckId);
         return;
     }
     else if (gImpl && aCommand == ".uno:SidebarHide")
diff --git a/include/sfx2/sidebar/SidebarDockingWindow.hxx 
b/include/sfx2/sidebar/SidebarDockingWindow.hxx
index 6d726ddd1260..f156ab0cb0fb 100644
--- a/include/sfx2/sidebar/SidebarDockingWindow.hxx
+++ b/include/sfx2/sidebar/SidebarDockingWindow.hxx
@@ -49,7 +49,7 @@ public:
     void SyncUpdate();
 
     void NotifyResize();
-
+    auto& GetSidebarController() const { return mpSidebarController; }
     using SfxDockingWindow::Close;
 
 private:
diff --git a/sfx2/source/sidebar/ResourceManager.cxx 
b/sfx2/source/sidebar/ResourceManager.cxx
index f3440e6dcb46..c61781643f49 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -429,6 +429,15 @@ void ResourceManager::ReadPanelList()
         if (!aPanelNode.isValid())
             continue;
 
+        if (comphelper::LibreOfficeKit::isActive())
+        {
+            // Hide these panels in LOK as they aren't fully functional.
+            OUString aPanelId = getString(aPanelNode, "Id");
+            if (aPanelId == "PageStylesPanel" || aPanelId == "PageHeaderPanel"
+                || aPanelId == "PageFooterPanel")
+                continue;
+        }
+
         maPanels.push_back(std::make_shared<PanelDescriptor>());
         PanelDescriptor& rPanelDescriptor(*maPanels.back());
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to