diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-09-14 08:43:22 -0400 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-25 09:29:47 +0200 |
commit | 6cb3b009fc4e73cc0ea07d166c274f05306b0e75 (patch) | |
tree | c169f0768c7f04fc1f558c78125a84a978dd102e | |
parent | ae2720ab206c2ff4a677e7fad147a3037f07a9be (diff) |
sd: sidebars are now visible in LOOL
Change-Id: I7ceae056e3d6ce1c991fe1194faa8bebfd6aae1e
Reviewed-on: https://gerrit.libreoffice.org/73500
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKitEnums.h | 1 | ||||
-rw-r--r-- | include/sfx2/sidebar/Deck.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/sidebar/Deck.cxx | 53 |
3 files changed, 55 insertions, 0 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index 5b3dda95d7a3..a256a9629ac8 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -593,6 +593,7 @@ typedef enum * "type" tells the type of the window the action is associated with * - "dialog" - window is a dialog * - "child" - window is a floating window (combo boxes, etc.) + * - "deck" - window is a docked/floating deck (i.e. the sidebar) * * "action" can take following values: * - "created" - window is created in the backend, client can render it now diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx index e3a3570f199a..22ecb71536d0 100644 --- a/include/sfx2/sidebar/Deck.hxx +++ b/include/sfx2/sidebar/Deck.hxx @@ -64,6 +64,7 @@ public: virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rUpdateArea) override; virtual void DataChanged (const DataChangedEvent& rEvent) override; virtual bool EventNotify(NotifyEvent& rEvent) override; + virtual void Resize() override; static void PrintWindowSubTree (vcl::Window* pRoot, int nIndentation); diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index e0405c9c279c..f26a643a083a 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -27,11 +27,15 @@ #include <sfx2/sidebar/Panel.hxx> #include <sfx2/sidebar/Tools.hxx> #include <sfx2/sidebar/Theme.hxx> +#include <sfx2/viewsh.hxx> +#include <sfx2/lokhelper.hxx> #include <vcl/event.hxx> +#include <comphelper/lok.hxx> #include <vcl/dockwin.hxx> #include <vcl/scrbar.hxx> #include <vcl/commandevent.hxx> +#include <vcl/IDialogRenderable.hxx> #include <tools/svborder.hxx> #include <sal/log.hxx> @@ -61,6 +65,20 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, vcl::Window* pParentWindow, mpVerticalScrollBar->SetScrollHdl(LINK(this, Deck, HandleVerticalScrollBarChange)); + if (comphelper::LibreOfficeKit::isActive()) + { + SetLOKNotifier(SfxViewShell::Current()); + + if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) + { + std::vector<vcl::LOKPayloadItem> aItems; + aItems.emplace_back("type", "deck"); + aItems.emplace_back(std::make_pair("position", Point(GetOutOffXPixel(), GetOutOffYPixel()).toString())); + aItems.emplace_back(std::make_pair("size", GetSizePixel().toString())); + pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems); + } + } + #ifdef DEBUG SetText(OUString("Deck")); mpScrollClipWindow->SetText(OUString("ScrollClipWindow")); @@ -76,6 +94,9 @@ Deck::~Deck() void Deck::dispose() { + if (comphelper::LibreOfficeKit::isActive()) + ReleaseLOKNotifier(); + SharedPanelContainer aPanels; aPanels.swap(maPanels); @@ -168,6 +189,20 @@ bool Deck::EventNotify(NotifyEvent& rEvent) return Window::EventNotify(rEvent); } +void Deck::Resize() +{ + Window::Resize(); + + if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) + { + std::vector<vcl::LOKPayloadItem> aItems; + aItems.emplace_back("type", "deck"); + aItems.emplace_back(std::make_pair("position", Point(GetOutOffXPixel(), GetOutOffYPixel()).toString())); + aItems.emplace_back(std::make_pair("size", GetSizePixel().toString())); + pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems); + } +} + bool Deck::ProcessWheelEvent(CommandEvent const * pCommandEvent) { if ( ! mpVerticalScrollBar) @@ -218,6 +253,15 @@ void Deck::RequestLayout() DeckLayouter::LayoutDeck(GetContentArea(), mnMinimalWidth, maPanels, *GetTitleBar(), *mpScrollClipWindow, *mpScrollContainer, *mpFiller, *mpVerticalScrollBar); + + if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) + { + std::vector<vcl::LOKPayloadItem> aItems; + aItems.emplace_back("type", "deck"); + aItems.emplace_back(std::make_pair("position", Point(GetOutOffXPixel(), GetOutOffYPixel()).toString())); + aItems.emplace_back(std::make_pair("size", GetSizePixel().toString())); + pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems); + } } vcl::Window* Deck::GetPanelParentWindow() @@ -264,6 +308,15 @@ void Deck::ShowPanel(const Panel& rPanel) Point( mpScrollContainer->GetPosPixel().X(), -nNewThumbPos)); + + if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) + { + std::vector<vcl::LOKPayloadItem> aItems; + aItems.emplace_back("type", "deck"); + aItems.emplace_back(std::make_pair("position", Point(GetOutOffXPixel(), GetOutOffYPixel()).toString())); + aItems.emplace_back(std::make_pair("size", GetSizePixel().toString())); + pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems); + } } static const OUString GetWindowClassification(const vcl::Window* pWindow) |