From e86a0236e69d76769b91f96d71fe852b91c5db6e Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Sun, 4 Jun 2023 20:57:19 +0900 Subject: lok: callback to send the updated theme palette when theme changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The callback sends the updated theme color palette when the theme changes or initially when the view is registered, so the client should always have the up-to-date theme color palette stored, so it can just show the color picker with the theme at any time without the need to call the server. Change-Id: I7cceccc46c2fad23ba89e6d3f3643e37f8dab292 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152589 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- sw/source/uibase/uiview/view.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'sw/source') diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index b035e53eb38f..dcd88c9e05d4 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -100,7 +101,7 @@ #include #include #include - +#include #include #include @@ -1177,6 +1178,18 @@ SwView::~SwView() m_pFormatClipboard.reset(); } +void SwView::afterCallbackRegistered() +{ + if (!comphelper::LibreOfficeKit::isActive()) + return; + auto* pDocShell = GetDocShell(); + if (pDocShell) + { + svx::ThemeColorPaletteManager aManager(pDocShell->GetThemeColors()); + libreOfficeKitViewCallback(LOK_CALLBACK_COLOR_PALETTES, aManager.generateJSON()); + } +} + SwDocShell* SwView::GetDocShell() { SfxObjectShell* pDocShell = GetViewFrame().GetObjectShell(); -- cgit