include/sfx2/sidebar/Deck.hxx | 2 ++ sfx2/source/sidebar/Deck.cxx | 16 ++++++++++++++++ sfx2/source/sidebar/DeckLayouter.cxx | 7 ------- sfx2/source/sidebar/SidebarController.cxx | 3 +++ 4 files changed, 21 insertions(+), 7 deletions(-)
New commits: commit 1eb31531051ea1abd36905b252618374700cc0a5 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Jun 21 17:36:09 2023 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Jun 23 18:37:35 2023 +0200 lok: sidebar: send full update only when changed panels we only need to send update when: - we switch to other deck - panels were hidden, shown, created this helps to avoid full updates in navigator when clicking on images, what causes context change Change-Id: If1bca6167cdc3e9294eb5aefb923e92bc9043edc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153401 Reviewed-by: Attila Szűcs <attila.sz...@collabora.com> Tested-by: Attila Szűcs <attila.sz...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx index fe73e6332d90..215d3d215674 100644 --- a/include/sfx2/sidebar/Deck.hxx +++ b/include/sfx2/sidebar/Deck.hxx @@ -66,6 +66,8 @@ public: sal_Int32 GetMinimalWidth() const { return mnMinimalWidth; } + static void LOKSendSidebarFullUpdate(); + private: void RequestLayoutInternal(); diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index b6ddffa89550..f9c8140bc9ff 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -29,6 +29,7 @@ #include <vcl/event.hxx> #include <comphelper/lok.hxx> +#include <vcl/jsdialog/executor.hxx> #include <tools/json_writer.hxx> using namespace css; @@ -36,6 +37,15 @@ using namespace css::uno; namespace sfx2::sidebar { +void Deck::LOKSendSidebarFullUpdate() +{ + if (comphelper::LibreOfficeKit::isActive()) + { + sal_uInt64 nShellId = reinterpret_cast<sal_uInt64>(SfxViewShell::Current()); + jsdialog::SendFullUpdate(std::to_string(nShellId) + "sidebar", "Panel"); + } +} + Deck::Deck(const DeckDescriptor& rDeckDescriptor, SidebarDockingWindow* pParentWindow, const std::function<void()>& rCloserAction) : InterimItemWindow(pParentWindow, "sfx/ui/deck.ui", "Deck") @@ -117,6 +127,7 @@ void Deck::DataChanged(const DataChangedEvent&) rpPanel->DataChanged(); RequestLayoutInternal(); + Deck::LOKSendSidebarFullUpdate(); } /* @@ -181,12 +192,17 @@ void Deck::ResetPanels(SharedPanelContainer&& rPanelContainer) aHiddens.push_back(rpPanel); } } + + bool bDifferent = maPanels.size() != rPanelContainer.size() || aHiddens.size(); maPanels = std::move(rPanelContainer); // Hidden ones always at the end maPanels.insert(std::end(maPanels), std::begin(aHiddens), std::end(aHiddens)); RequestLayoutInternal(); + + if (bDifferent) + Deck::LOKSendSidebarFullUpdate(); } void Deck::RequestLayoutInternal() diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx index 5473aa95f001..824b66ac1aff 100644 --- a/sfx2/source/sidebar/DeckLayouter.cxx +++ b/sfx2/source/sidebar/DeckLayouter.cxx @@ -37,7 +37,6 @@ #include <com/sun/star/ui/XSidebarPanel.hpp> #include <utility> -#include <vcl/jsdialog/executor.hxx> using namespace css; using namespace css::uno; @@ -307,12 +306,6 @@ sal_Int32 PlacePanels ( } } - if (comphelper::LibreOfficeKit::isActive()) - { - sal_uInt64 nShellId = reinterpret_cast<sal_uInt64>(SfxViewShell::Current()); - jsdialog::SendFullUpdate(std::to_string(nShellId) + "sidebar", "Panel"); - } - return nY; } diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 3546297df79c..459bf9fb2ff8 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -686,7 +686,10 @@ void SidebarController::SwitchToDeck ( std::shared_ptr<DeckDescriptor> xDeckDescriptor = mpResourceManager->GetDeckDescriptor(rsDeckId); if (xDeckDescriptor) + { SwitchToDeck(*xDeckDescriptor, maCurrentContext); + Deck::LOKSendSidebarFullUpdate(); + } } }