From c1d6af3e9a8937cef192e2764ad4afb572743d86 Mon Sep 17 00:00:00 2001 From: Paris Oplopoios Date: Thu, 2 Mar 2023 02:24:59 +0200 Subject: sw lok: notify clients about view option changes Send a string of the view options to the kit when the view changes Change-Id: I89f65ff1d22a83a54dde35e39eb487edda0b58e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148078 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- include/LibreOfficeKit/LibreOfficeKitEnums.h | 12 ++++++++++++ include/sfx2/lokhelper.hxx | 3 +++ include/vcl/ITiledRenderable.hxx | 6 ++++++ 3 files changed, 21 insertions(+) (limited to 'include') diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index 38b3e5e62a40..6e02c92596f1 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -907,6 +907,16 @@ typedef enum * "file:///tmp/hello-world.pdf" */ LOK_CALLBACK_EXPORT_FILE = 59, + + /** + * Some attribute of this view has changed, that will cause it + * to completely re-render, eg. non-printing characters or + * or dark mode was toggled, and then distinct from other views. + * + * Payload is an opaque string that matches this set of states. + * this will be emitted after creating a new view. + */ + LOK_CALLBACK_VIEW_RENDER_STATE = 60 } LibreOfficeKitCallbackType; @@ -1055,6 +1065,8 @@ static inline const char* lokCallbackTypeToString(int nType) return "LOK_CALLBACK_MEDIA_SHAPE"; case LOK_CALLBACK_EXPORT_FILE: return "LOK_CALLBACK_EXPORT_FILE"; + case LOK_CALLBACK_VIEW_RENDER_STATE: + return "LOK_CALLBACK_VIEW_RENDER_STATE"; } assert(!"Unknown LibreOfficeKitCallbackType type."); diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index f7de18112c04..b572ddf076b5 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -140,6 +140,9 @@ public: /// Notify about the editing context change. static void notifyContextChange(const css::ui::ContextChangeEventObject& rEvent); + /// Emits an LOK_CALLBACK_VIEW_RENDER_STATE + static void notifyViewRenderState(SfxViewShell const* pViewShell, vcl::ITiledRenderable* pDoc); + // Notify about the given type needing an update. static void notifyUpdate(SfxViewShell const* pViewShell, int nType); // Notify about the given type needing a per-viewid update. diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index d110e33f7e19..9fa61258fc7a 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -376,6 +376,12 @@ public: virtual void getCommandValues(tools::JsonWriter& /*rJsonWriter*/, std::string_view /*rCommand*/) { } + + /** + * Returns an opaque string reflecting the render state of a component + * eg. 'PD' - P for non-printing-characters, D for dark-mode. + */ + virtual OString getViewRenderState() { return rtl::OString(); } }; } // namespace vcl -- cgit