summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-06-04 20:57:19 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-06-05 13:06:57 +0200
commite86a0236e69d76769b91f96d71fe852b91c5db6e (patch)
tree88e8ca1a9f89556cdf5004daecaa772e59be3a7f /sw
parent6c4c040d2ebc4371a706c762e7e6707875c43535 (diff)
lok: callback to send the updated theme palette when theme changes
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 <quikee@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/view.hxx2
-rw-r--r--sw/source/uibase/uiview/view.cxx15
2 files changed, 16 insertions, 1 deletions
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 60fe6fdc7303..89b5ad6f391b 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -670,6 +670,8 @@ public:
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
void SetRedlineAuthor(const OUString& rAuthor);
const OUString& GetRedlineAuthor() const;
+ /// See SfxViewShell::afterCallbackRegistered().
+ void afterCallbackRegistered() override;
/// See SfxViewShell::NotifyCursor().
void NotifyCursor(SfxViewShell* pViewShell) const override;
void ShowUIElement(const OUString& sElementURL) const;
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 <stdlib.h>
#include <hintids.hxx>
#include <comphelper/string.hxx>
+#include <comphelper/lok.hxx>
#include <o3tl/any.hxx>
#include <o3tl/string_view.hxx>
#include <officecfg/Office/Common.hxx>
@@ -100,7 +101,7 @@
#include <PostItMgr.hxx>
#include <annotsh.hxx>
#include <swruler.hxx>
-
+#include <svx/theme/ThemeColorPaletteManager.hxx>
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
@@ -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();