diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-12-17 09:19:20 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-06-29 14:55:15 +0200 |
commit | e8b3609230406c6589c5d123f018edb38e543679 (patch) | |
tree | 25d360b7f9f6ad3f519291c8021e9b5a3d0aaf3f /sd/source | |
parent | 4b139336b89c99b60e25149c7871dbabcb8a41db (diff) |
sd theme: add a "theme" palette to the color picker
This implements listing the current theme colors (which depend on what
is the master page of the current slide) in the color picker and also
allows picking those colors.
The colors are picked as-is for now, not yet setting the color theme
index in the document model.
(cherry picked from commit 4bbbd15fb8e8269a8bdfd188d3ca2a2a84c00922)
Change-Id: I2553725c29c2a9f9de80f86b38d22a06bf9c0364
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136607
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/docshell/docshell.cxx | 25 | ||||
-rw-r--r-- | sd/source/ui/inc/DrawDocShell.hxx | 2 |
2 files changed, 27 insertions, 0 deletions
diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index 886efb0f7acb..78279687a039 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -59,6 +59,8 @@ #include <ViewShellBase.hxx> #include <sfx2/notebookbar/SfxNotebookBar.hxx> #include <comphelper/lok.hxx> +#include <DrawViewShell.hxx> +#include <sdpage.hxx> using namespace sd; #define ShellClass_DrawDocShell @@ -485,6 +487,29 @@ void DrawDocShell::ClearUndoBuffer() pUndoManager->Clear(); } +std::vector<Color> DrawDocShell::GetThemeColors() +{ + auto pViewShell = dynamic_cast<sd::DrawViewShell*>(GetViewShell()); + if (!pViewShell) + { + return {}; + } + + SdPage* pPage = pViewShell->getCurrentPage(); + svx::Theme* pTheme = pPage->getSdrPageProperties().GetTheme(); + if (!pPage->IsMasterPage()) + { + pTheme = pPage->TRG_GetMasterPage().getSdrPageProperties().GetTheme(); + } + + if (!pTheme) + { + return {}; + } + + return pTheme->GetColors(); +} + } // end of namespace sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx index 850d4f448a03..5f15ffe9922f 100644 --- a/sd/source/ui/inc/DrawDocShell.hxx +++ b/sd/source/ui/inc/DrawDocShell.hxx @@ -201,6 +201,8 @@ public: void ClearUndoBuffer(); + std::vector<Color> GetThemeColors() override; + protected: SdDrawDocument* mpDoc; |