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

New commits:
commit 7f578ebe3cd824c05492c8fce9a1ed60bb5cfdfa
Author:     Mert Tumer <mert.tu...@collabora.com>
AuthorDate: Wed Apr 29 16:29:57 2020 +0300
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Thu May 7 07:06:26 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>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 7c3a86ca5878..e6c2d6630a58 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -113,6 +113,7 @@
 #include <sfx2/DocumentSigner.hxx>
 #include <sfx2/sidebar/SidebarChildWindow.hxx>
 #include <sfx2/sidebar/SidebarDockingWindow.hxx>
+#include <sfx2/sidebar/SidebarController.hxx>
 #include <svx/dialmgr.hxx>
 #include <svx/dialogs.hrc>
 #include <svx/strings.hrc>
@@ -1120,7 +1121,7 @@ rtl::Reference<LOKClipboard> 
forceSetClipboardForCurrentView(LibreOfficeKitDocum
 
 #endif
 
-void setupSidebar(bool bShow)
+void setupSidebar(bool bShow, OUString sidebarDeckId = "")
 {
     SfxViewShell* pViewShell = SfxViewShell::Current();
     SfxViewFrame* pViewFrame = pViewShell ? pViewShell->GetViewFrame() : 
nullptr;
@@ -1142,6 +1143,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
@@ -3625,6 +3631,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));
 
@@ -3756,9 +3763,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 049cf241aacd..64287cfe74a5 100644
--- a/include/sfx2/sidebar/SidebarDockingWindow.hxx
+++ b/include/sfx2/sidebar/SidebarDockingWindow.hxx
@@ -47,6 +47,7 @@ public:
 
     void SetReadyToDrag( bool bStartDrag ) { mbIsReadyToDrag = bStartDrag; }
     bool IsReadyToDrag() const { return mbIsReadyToDrag; }
+    auto& GetSidebarController() const { return mpSidebarController; }
 
     /// Force generation of all panels by completion.
     void SyncUpdate();
diff --git a/sfx2/source/sidebar/ResourceManager.cxx 
b/sfx2/source/sidebar/ResourceManager.cxx
index f563943e150d..0642109b1dd2 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -430,6 +430,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