desktop/qa/desktop_lib/test_desktop_lib.cxx   |   37 +++++++++++++++++++-------
 desktop/source/lib/init.cxx                   |   12 +++++++-
 include/sfx2/sidebar/SidebarDockingWindow.hxx |    1 
 sfx2/source/sidebar/SidebarDockingWindow.cxx  |   15 +++++++++-
 vcl/inc/salvtables.hxx                        |    4 ++
 vcl/jsdialog/jsdialogbuilder.cxx              |    6 +++-
 6 files changed, 60 insertions(+), 15 deletions(-)

New commits:
commit cd0e3d61f2285b81d9c2bd8fa3d12e0deb505681
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Fri Sep 9 16:05:12 2022 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Mon Sep 26 10:23:48 2022 +0200

    lok: create sidebar on demand
    
    Change-Id: I5393bba647aa4667643262e77acc6b6873afb571
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139729
    Reviewed-by: Ashod Nakashian <a...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140580
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index aa52f3edc16b..54c8a8189ab5 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -45,6 +45,8 @@
 #include <sfx2/viewsh.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/bindings.hxx>
+#include <sfx2/sidebar/SidebarController.hxx>
+#include <sfx2/sidebar/SidebarDockingWindow.hxx>
 #include <unotools/datetime.hxx>
 #include <unotools/syslocaleoptions.hxx>
 #include <comphelper/string.hxx>
@@ -3270,10 +3272,35 @@ void DesktopLOKTest::testMultiDocuments()
     }
 }
 
+namespace
+{
+    SfxChildWindow* lcl_initializeSidebar()
+    {
+        // in init.cxx we do setupSidebar which creaes the controller, do it 
here
+
+        SfxViewShell* pViewShell = SfxViewShell::Current();
+        CPPUNIT_ASSERT(pViewShell);
+
+        SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
+        CPPUNIT_ASSERT(pViewFrame);
+
+        SfxChildWindow* pSideBar = pViewFrame->GetChildWindow(SID_SIDEBAR);
+        CPPUNIT_ASSERT(pSideBar);
+
+        auto pDockingWin = dynamic_cast<sfx2::sidebar::SidebarDockingWindow 
*>(pSideBar->GetWindow());
+        CPPUNIT_ASSERT(pDockingWin);
+
+        pDockingWin->GetOrCreateSidebarController(); // just to create the 
controller
+
+        return pSideBar;
+    }
+};
+
 void DesktopLOKTest::testControlState()
 {
     LibLODocument_Impl* pDocument = loadDoc("search.ods");
     pDocument->pClass->postUnoCommand(pDocument, ".uno:StarShapes", nullptr, 
false);
+    lcl_initializeSidebar();
     Scheduler::ProcessEventsToIdle();
 
     boost::property_tree::ptree aState;
@@ -3287,17 +3314,9 @@ void DesktopLOKTest::testMetricField()
 {
     LibLODocument_Impl* pDocument = loadDoc("search.ods");
     pDocument->pClass->postUnoCommand(pDocument, ".uno:StarShapes", nullptr, 
false);
+    SfxChildWindow* pSideBar = lcl_initializeSidebar();
     Scheduler::ProcessEventsToIdle();
 
-    SfxViewShell* pViewShell = SfxViewShell::Current();
-    CPPUNIT_ASSERT(pViewShell);
-
-    SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
-    CPPUNIT_ASSERT(pViewFrame);
-
-    SfxChildWindow* pSideBar = pViewFrame->GetChildWindow(SID_SIDEBAR);
-    CPPUNIT_ASSERT(pSideBar);
-
     vcl::Window* pWin = pSideBar->GetWindow();
     CPPUNIT_ASSERT(pWin);
 
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 7d9c4cfc3643..b3fae56f721f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -874,13 +874,21 @@ void setupSidebar(std::u16string_view sidebarDeckId = u"")
         if (!pDockingWin)
             return;
 
+        pViewFrame->ShowChildWindow( SID_SIDEBAR );
+
+        const rtl::Reference<sfx2::sidebar::SidebarController>& xController
+            = pDockingWin->GetOrCreateSidebarController();
+
+        xController->FadeIn();
+        xController->RequestOpenDeck();
+
         if (!sidebarDeckId.empty())
         {
-            pDockingWin->GetSidebarController()->SwitchToDeck(sidebarDeckId);
+            xController->SwitchToDeck(sidebarDeckId);
         }
         else
         {
-            pDockingWin->GetSidebarController()->SwitchToDefaultDeck();
+            xController->SwitchToDefaultDeck();
         }
 
         pDockingWin->SyncUpdate();
diff --git a/include/sfx2/sidebar/SidebarDockingWindow.hxx 
b/include/sfx2/sidebar/SidebarDockingWindow.hxx
index 9bad1f5a8464..b22aefcb34a9 100644
--- a/include/sfx2/sidebar/SidebarDockingWindow.hxx
+++ b/include/sfx2/sidebar/SidebarDockingWindow.hxx
@@ -46,6 +46,7 @@ public:
     void SyncUpdate();
 
     auto& GetSidebarController() const { return mpSidebarController; }
+    rtl::Reference<sfx2::sidebar::SidebarController>& 
GetOrCreateSidebarController();
     using SfxDockingWindow::Close;
 
 private:
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx 
b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index 18000601bfd0..23c3b459c3be 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -22,6 +22,7 @@
 #include <sidebar/PanelDescriptor.hxx>
 
 #include <comphelper/dispatchcommand.hxx>
+#include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
 #include <sfx2/bindings.hxx>
 #include <sfx2/dispatch.hxx>
@@ -49,11 +50,21 @@ SidebarDockingWindow::SidebarDockingWindow(SfxBindings* 
pSfxBindings, SidebarChi
         OSL_ASSERT(pSfxBindings!=nullptr);
         OSL_ASSERT(pSfxBindings->GetDispatcher()!=nullptr);
     }
-    else
+    else if (!comphelper::LibreOfficeKit::isActive())
     {
-        const SfxViewFrame* pViewFrame = 
pSfxBindings->GetDispatcher()->GetFrame();
+        GetOrCreateSidebarController();
+    }
+}
+
+rtl::Reference<sfx2::sidebar::SidebarController>& 
SidebarDockingWindow::GetOrCreateSidebarController()
+{
+    if (!mpSidebarController)
+    {
+        const SfxViewFrame* pViewFrame = 
GetBindings().GetDispatcher()->GetFrame();
         mpSidebarController = sfx2::sidebar::SidebarController::create(this, 
pViewFrame);
     }
+
+    return mpSidebarController;
 }
 
 SidebarDockingWindow::~SidebarDockingWindow()
commit db106346a9797565e406cf9c26e762327446f59a
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Mon Aug 22 18:27:27 2022 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Mon Sep 26 10:23:36 2022 +0200

    jsdialog: send action not update for spin button value
    
    This will help us to reduce payload and fix bug where
    in Chrome regenerated spin field always focused "arrow
    down" button after click on the "arrow up".
    
    Use value from formatter - the same as generated in
    widget update JSON.
    
    Change-Id: I6ace90eb532e894daacb563bc9fb93332fd755ce
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138700
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Rashesh Padia <rashesh.pa...@collabora.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140579
    Tested-by: Jenkins

diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index ed6e35d6e48f..fe1e5078ef2f 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -622,10 +622,12 @@ public:
 
 class SalInstanceSpinButton : public SalInstanceEntry, public virtual 
weld::SpinButton
 {
-private:
     VclPtr<FormattedField> m_xButton;
+
+protected:
     Formatter& m_rFormatter;
 
+private:
     DECL_LINK(UpDownHdl, SpinField&, void);
     DECL_LINK(LoseFocusHdl, Control&, void);
     DECL_LINK(OutputHdl, LinkParamNone*, bool);
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 662caaf6a9f2..da30834b0568 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1368,7 +1368,11 @@ JSSpinButton::JSSpinButton(JSDialogSender* pSender, 
::FormattedField* pSpin,
 void JSSpinButton::set_value(sal_Int64 value)
 {
     SalInstanceSpinButton::set_value(value);
-    sendUpdate(true); // if input is limited we can receive the same JSON
+
+    std::unique_ptr<jsdialog::ActionDataMap> pMap = 
std::make_unique<jsdialog::ActionDataMap>();
+    (*pMap)[ACTION_TYPE] = "setText";
+    (*pMap)["text"] = OUString::number(m_rFormatter.GetValue());
+    sendAction(std::move(pMap));
 }
 
 JSMessageDialog::JSMessageDialog(JSDialogSender* pSender, ::MessageDialog* 
pDialog,

Reply via email to