summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2019-12-11 12:23:08 -0500
committerMichael Meeks <michael.meeks@collabora.com>2020-05-27 21:58:51 +0100
commit846dc98f51ed21ad1db97dce285a6b789839f287 (patch)
tree71f650bcee7e038779bf1a873127c61e64e7b90e
parent81bd5d98b3e29d8c9872d90e170fd5812bf2d14d (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>
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx18
1 files changed, 17 insertions, 1 deletions
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index a7ea09953d84..2a5a5ff01cc8 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>
@@ -1225,7 +1227,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");
}