diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2019-12-11 12:23:08 -0500 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-12-16 17:30:01 +0000 |
commit | b9d0e9e2776c4b8945f03b01473435641ee7ce06 (patch) | |
tree | 682cd8af32465d343ce402e50684f1845184c3e1 /sfx2 | |
parent | de833533ff6f1e994da2abe193b71500c1e231e9 (diff) |
sfx2: sidebar: notify mobile when the sidebar closes
Change-Id: Idb05346a9ccc8690cad566b74ec86d5fdd3bfb35
Reviewed-on: https://gerrit.libreoffice.org/84973
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 14c78d918494..335b634da6e3 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -53,6 +53,8 @@ #include <sal/log.hxx> #include <officecfg/Office/UI/Sidebar.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <boost/property_tree/ptree.hpp> +#include <boost/property_tree/json_parser.hpp> #include <com/sun/star/awt/XWindowPeer.hpp> #include <com/sun/star/frame/XDispatch.hpp> @@ -1215,7 +1217,21 @@ void SidebarController::RequestCloseDeck() if (comphelper::LibreOfficeKit::isActive() && mpCurrentDeck.get()) { const vcl::ILibreOfficeKitNotifier* pNotifier = mpCurrentDeck->GetLOKNotifier(); - if (pNotifier) + auto pMobileNotifier = SfxViewShell::Current(); + if (pMobileNotifier && comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView())) + { + // Mobile. + std::stringstream aStream; + boost::property_tree::ptree aTree; + aTree.put("id", mpParentWindow->get_id()); // TODO could be missing - sort out + aTree.put("type", "dockingwindow"); + aTree.put("text", mpParentWindow->GetText()); + aTree.put("enabled", false); + boost::property_tree::write_json(aStream, aTree); + const std::string message = aStream.str(); + pMobileNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str()); + } + else if (pNotifier) pNotifier->notifyWindow(mpCurrentDeck->GetLOKWindowId(), "close"); } |