diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-06-03 10:44:51 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-06-05 12:06:23 +0200 |
commit | 6c4c040d2ebc4371a706c762e7e6707875c43535 (patch) | |
tree | 940377966332042da96563af68e8efe8100a8e96 /sc | |
parent | adce63eb131f0b20a1d72797d92f07efcee75ec4 (diff) |
svx: extract theme color generation into ThemeColorPaletteManager
The generation of theme colors generation code is moved to the
ThemeColorPaletteManager class, so it can be reused.
Also change the GetThemeColors return type from std::vector<Color>
to std::shared_ptr<theme::ColorSet> as we can now safely do that
and simplifies things.
Change-Id: I4a54bff889a1f97cb1e30467188dc69e07e8c518
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152588
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 15 | ||||
-rw-r--r-- | sc/source/ui/inc/docsh.hxx | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 3d8647dc8ea8..16cb0655c94f 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -218,24 +218,29 @@ std::set<Color> ScDocShell::GetDocColors() return m_pDocument->GetDocColors(); } -std::vector<Color> ScDocShell::GetThemeColors() +std::shared_ptr<model::ColorSet> ScDocShell::GetThemeColors() { - ScTabViewShell* pSh = GetBestViewShell(); - if (!pSh) + ScTabViewShell* pShell = GetBestViewShell(); + if (!pShell) return {}; - ScTabView* pTabView = pSh->GetViewData().GetView(); + + ScTabView* pTabView = pShell->GetViewData().GetView(); if (!pTabView) return {}; + ScDrawView* pView = pTabView->GetScDrawView(); if (!pView) return {}; + SdrPage* pPage = pView->GetSdrPageView()->GetPage(); if (!pPage) return {}; + auto const& pTheme = pPage->getSdrPageProperties().GetTheme(); if (!pTheme) return {}; - return pTheme->GetColors(); + + return pTheme->getColorSet(); } void ScDocShell::DoEnterHandler() diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 5c8484a2fd32..096c219f89a6 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -181,7 +181,7 @@ public: bool bTemplate = false ) const override; virtual std::set<Color> GetDocColors() override; - virtual std::vector<Color> GetThemeColors() override; + virtual std::shared_ptr<model::ColorSet> GetThemeColors() override; virtual bool InitNew( const css::uno::Reference< css::embed::XStorage >& ) override; virtual bool Load( SfxMedium& rMedium ) override; |