include/sfx2/sidebar/Deck.hxx | 2 + sfx2/source/sidebar/Deck.cxx | 47 +++++++++++++++++++++++++++++++----------- 2 files changed, 37 insertions(+), 12 deletions(-)
New commits: commit 7d9932ade30464abf297f2e3c3690cca68d6bf71 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Thu Oct 10 14:35:22 2019 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Thu Oct 10 19:41:54 2019 +0200 jsdialogs: emit JSON at idle to avoid repeated emission. Change-Id: If8ddfaf9097f706d82117e102a56b4a8b2a41cdd Reviewed-on: https://gerrit.libreoffice.org/80616 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.me...@collabora.com> diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx index 899ff838c74d..7d8efa1f914e 100644 --- a/include/sfx2/sidebar/Deck.hxx +++ b/include/sfx2/sidebar/Deck.hxx @@ -29,6 +29,7 @@ namespace sfx2 { namespace sidebar { class DeckDescriptor; class DeckTitleBar; +class DeckNotifyIdle; /** This is the parent window of the panels. It displays the deck title. @@ -88,6 +89,7 @@ private: sal_Int32 mnMinimalWidth; sal_Int32 mnMinimalHeight; SharedPanelContainer maPanels; + std::unique_ptr<DeckNotifyIdle> mpIdleNotify; VclPtr<DeckTitleBar> mpTitleBar; VclPtr<vcl::Window> mpScrollClipWindow; VclPtr<ScrollContainerWindow> mpScrollContainer; diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index af9ac0c68bb6..a2e9024433f6 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -44,8 +44,35 @@ using namespace css; using namespace css::uno; + namespace sfx2 { namespace sidebar { +class DeckNotifyIdle : public Idle +{ + Deck &mrDeck; +public: + DeckNotifyIdle(Deck &rDeck) : + Idle("Deck notify"), + mrDeck(rDeck) + { + SetPriority(TaskPriority::POST_PAINT); + } + void Invoke() override + { + auto pNotifier = mrDeck.GetLOKNotifier(); + try + { + std::stringstream aStream; + boost::property_tree::write_json(aStream, mrDeck.DumpAsPropertyTree()); + pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, aStream.str().c_str()); + } + catch(boost::property_tree::json_parser::json_parser_error& rError) + { + SAL_WARN("sfx.sidebar", rError.message()); + } + } +}; + Deck::Deck(const DeckDescriptor& rDeckDescriptor, vcl::Window* pParentWindow, const std::function<void()>& rCloserAction) : Window(pParentWindow, 0) @@ -53,6 +80,7 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, vcl::Window* pParentWindow, , mnMinimalWidth(0) , mnMinimalHeight(0) , maPanels() + , mpIdleNotify(new DeckNotifyIdle(*this)) , mpTitleBar(VclPtr<DeckTitleBar>::Create(rDeckDescriptor.msTitle, this, rCloserAction)) , mpScrollClipWindow(VclPtr<vcl::Window>::Create(this)) , mpScrollContainer(VclPtr<ScrollContainerWindow>::Create(mpScrollClipWindow.get())) @@ -187,21 +215,11 @@ void Deck::Resize() { Window::Resize(); - const vcl::ILibreOfficeKitNotifier *pNotifier; if (comphelper::LibreOfficeKit::isActive() && comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()) && - (pNotifier = GetLOKNotifier())) + GetLOKNotifier()) { - try - { - std::stringstream aStream; - boost::property_tree::write_json(aStream, DumpAsPropertyTree()); - pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, aStream.str().c_str()); - } - catch(boost::property_tree::json_parser::json_parser_error& rError) - { - SAL_WARN("sfx.sidebar", rError.message()); - } + mpIdleNotify->Start(); } } commit 5db9bfee77e560c46457a40aee3d2b0752ab2fd8 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Fri Sep 27 14:59:37 2019 +0200 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Thu Oct 10 19:41:30 2019 +0200 jsdialogs: set LOKNotifier in Deck Change-Id: I845e5f06694372c614972a09e9ab9db89006df16 Reviewed-on: https://gerrit.libreoffice.org/79718 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/80615 Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Michael Meeks <michael.me...@collabora.com> diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index 91ff5dc340a6..af9ac0c68bb6 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -68,6 +68,11 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, vcl::Window* pParentWindow, mpVerticalScrollBar->SetScrollHdl(LINK(this, Deck, HandleVerticalScrollBarChange)); + if (comphelper::LibreOfficeKit::isActive()) + { + SetLOKNotifier(SfxViewShell::Current()); + } + #ifdef DEBUG SetText(OUString("Deck")); mpScrollClipWindow->SetText(OUString("ScrollClipWindow")); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits