include/LibreOfficeKit/LibreOfficeKitEnums.h | 8 ++++++++ sfx2/source/sidebar/Deck.cxx | 16 ++++++++++++++++ 2 files changed, 24 insertions(+)
New commits: commit 11730bf818c2df6b471efbcc6254cca5ad6a6054 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Sep 24 17:29:53 2019 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Mon Sep 30 09:39:57 2019 +0200 jsdialogs: send JSON to the client Change-Id: If43a774e1e3a4bff4a8ec862f0091d60477090d4 Reviewed-on: https://gerrit.libreoffice.org/79695 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index aea463909da3..03c7085b9039 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -703,6 +703,12 @@ typedef enum * } */ LOK_CALLBACK_REFERENCE_MARKS = 45, + + /** + * Callback related to native dialogs generated in JavaScript from + * the description. + */ + LOK_CALLBACK_JSDIALOG = 46, } LibreOfficeKitCallbackType; @@ -823,6 +829,8 @@ static inline const char* lokCallbackTypeToString(int nType) return "LOK_CALLBACK_TABLE_SELECTED"; case LOK_CALLBACK_REFERENCE_MARKS: return "LOK_CALLBACK_REFERENCE_MARKS"; + case LOK_CALLBACK_JSDIALOG: + return "LOK_CALLBACK_JSDIALOG"; } assert(!"Unknown LibreOfficeKitCallbackType type."); diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index 15f591fd1e64..f1114982204c 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -38,6 +38,8 @@ #include <vcl/IDialogRenderable.hxx> #include <tools/svborder.hxx> #include <sal/log.hxx> +#include <boost/property_tree/json_parser.hpp> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> using namespace css; using namespace css::uno; @@ -179,6 +181,20 @@ bool Deck::EventNotify(NotifyEvent& rEvent) void Deck::Resize() { Window::Resize(); + + if (const vcl::ILibreOfficeKitNotifier* pNotifier = 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()); + } + } } bool Deck::ProcessWheelEvent(CommandEvent const * pCommandEvent) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits