summaryrefslogtreecommitdiff
path: root/include/svx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-02-07 16:13:27 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-03-01 00:29:23 +0000
commit4a7a89b97b0b6464f8375926d98044634d06b4ee (patch)
tree669bc858797ac675acebd6ee526dd5ef9213df9e /include/svx
parent1309e6332d7ff2bd1f9b6bf87385b8b570e59158 (diff)
create a default theme when SdrPage and SdrModel are created
For a document it is expected that it always has a theme available so we need to create a theme with some default attributes set (a default color scheme for now) when we create a SdrModel and SdrPage (only for Writer currently). This also changes some ColorSets, SdrPage, SdrModel methods, to use better return types (cost& instead of raw pointers and vice versa depending on the use case). Change-Id: I874247784b845109e42567e3f45647dda46ccf3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146816 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/svx')
-rw-r--r--include/svx/ColorSets.hxx12
-rw-r--r--include/svx/dialog/ThemeDialog.hxx4
-rw-r--r--include/svx/svdmodel.hxx4
-rw-r--r--include/svx/svdpage.hxx2
4 files changed, 12 insertions, 10 deletions
diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx
index faec6d2c2249..cb096dab0e87 100644
--- a/include/svx/ColorSets.hxx
+++ b/include/svx/ColorSets.hxx
@@ -15,19 +15,21 @@
#include <sal/log.hxx>
#include <svx/svxdllapi.h>
#include <docmodel/theme/ColorSet.hxx>
+#include <optional>
namespace svx
{
class SVXCORE_DLLPUBLIC ColorSets
{
+private:
std::vector<model::ColorSet> maColorSets;
-public:
ColorSets();
- ~ColorSets();
-
void init();
- const std::vector<model::ColorSet>& getColorSets() const
+public:
+ static ColorSets& get();
+
+ const std::vector<model::ColorSet>& getColorSetVector() const
{
return maColorSets;
}
@@ -37,7 +39,7 @@ public:
return maColorSets[nIndex];
}
- const model::ColorSet& getColorSet(std::u16string_view rName);
+ model::ColorSet const* getColorSet(std::u16string_view rName) const;
void insert(model::ColorSet const& rColorSet);
};
diff --git a/include/svx/dialog/ThemeDialog.hxx b/include/svx/dialog/ThemeDialog.hxx
index 1db4f2f43e6a..5d3fdc70f250 100644
--- a/include/svx/dialog/ThemeDialog.hxx
+++ b/include/svx/dialog/ThemeDialog.hxx
@@ -12,7 +12,6 @@
#include <svx/svxdllapi.h>
#include <vcl/weld.hxx>
#include <docmodel/theme/Theme.hxx>
-#include <svx/ColorSets.hxx>
#include <svx/svdpage.hxx>
#include <svx/theme/IThemeColorChanger.hxx>
#include <svx/dialog/ThemeColorValueSet.hxx>
@@ -23,7 +22,8 @@ class SVX_DLLPUBLIC ThemeDialog final : public weld::GenericDialogController
{
private:
model::Theme* mpTheme;
- svx::ColorSets maColorSets;
+ std::vector<model::ColorSet> maColorSets;
+
std::shared_ptr<IThemeColorChanger> mpChanger;
std::unique_ptr<svx::ThemeColorValueSet> mxValueSetThemeColors;
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index 63cc3bc1fb79..fe216d569919 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -538,8 +538,8 @@ public:
SfxStyleSheetBasePool* GetStyleSheetPool() const { return mxStyleSheetPool.get(); }
void SetStyleSheetPool(SfxStyleSheetBasePool* pPool) { mxStyleSheetPool=pPool; }
- void SetTheme(std::unique_ptr<model::Theme> pTheme);
- model::Theme* GetTheme();
+ void setTheme(std::unique_ptr<model::Theme> pTheme);
+ std::unique_ptr<model::Theme> const& getTheme() const;
void SetStarDrawPreviewMode(bool bPreview);
bool IsStarDrawPreviewMode() const { return m_bStarDrawPreviewMode; }
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index 186a49a028f8..fde15ccedcd9 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -347,7 +347,7 @@ public:
SfxStyleSheet* GetStyleSheet() const { return mpStyleSheet;}
void SetTheme(std::unique_ptr<model::Theme> pTheme);
- model::Theme* GetTheme();
+ std::unique_ptr<model::Theme> const& GetTheme() const;
void dumpAsXml(xmlTextWriterPtr pWriter) const;
};