LibreOffice Module svx (master)  1
ColorSets.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  */
10 
11 #ifndef INCLUDED_SVX_COLORSETS_HXX
12 #define INCLUDED_SVX_COLORSETS_HXX
13 
14 #include <vector>
15 
16 #include <rtl/ustring.hxx>
17 #include <sal/types.h>
18 #include <svx/svxdllapi.h>
19 #include <tools/color.hxx>
20 
21 typedef struct _xmlTextWriter* xmlTextWriterPtr;
22 class SdrPage;
23 
24 namespace svx
25 {
26 
27 class ColorSet
28 {
29  OUString maColorSetName;
30  std::vector<Color> maColors;
31 public:
32  ColorSet(OUString const & aName);
33 
34  void add(sal_uInt32 nIndex, ::Color aColorData)
35  {
36  maColors[nIndex] = aColorData;
37  }
38 
39  const OUString& getName() const
40  {
41  return maColorSetName;
42  }
43  const Color& getColor(sal_uInt32 nIndex) const
44  {
45  return maColors[nIndex];
46  }
47 
48  void dumpAsXml(xmlTextWriterPtr pWriter) const;
49 };
50 
52 {
53  std::vector<ColorSet> maColorSets;
54 public:
55  ColorSets();
56  ~ColorSets();
57 
58  void init();
59  const std::vector<ColorSet>& getColorSets() const
60  {
61  return maColorSets;
62  }
63 
64  const ColorSet& getColorSet(sal_uInt32 nIndex)
65  {
66  return maColorSets[nIndex];
67  }
68 
69  const ColorSet& getColorSet(std::u16string_view rName);
70 };
71 
74 {
75  OUString maName;
76  std::unique_ptr<ColorSet> mpColorSet;
77 
78 public:
79  Theme(OUString const& rName);
80  ~Theme();
81 
82  void SetColorSet(std::unique_ptr<ColorSet> pColorSet);
83  ColorSet* GetColorSet();
84 
85  void SetName(const OUString& rName);
86  const OUString& GetName() const;
87 
88  void dumpAsXml(xmlTextWriterPtr pWriter) const;
89 
90  void ToAny(css::uno::Any& rVal) const;
91 
92  static std::unique_ptr<Theme> FromAny(const css::uno::Any& rVal);
93 
94  void UpdateSdrPage(const SdrPage* pPage);
95 
96  std::vector<Color> GetColors() const;
97 };
98 
99 } // end of namespace svx
100 
101 #endif // INCLUDED_SVX_COLORSETS_HXX
102 
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _xmlTextWriter * xmlTextWriterPtr
OUString maColorSetName
Definition: ColorSets.hxx:29
virtual OUString GetName() const override
const ColorSet & getColorSet(sal_uInt32 nIndex)
Definition: ColorSets.hxx:64
std::vector< ColorSet > maColorSets
Definition: ColorSets.hxx:53
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: ColorSets.cxx:136
void add(sal_uInt32 nIndex,::Color aColorData)
Definition: ColorSets.hxx:34
const OUString & getName() const
Definition: ColorSets.hxx:39
ColorSet(OUString const &aName)
Definition: ColorSets.cxx:128
const std::vector< ColorSet > & getColorSets() const
Definition: ColorSets.hxx:59
std::unique_ptr< ColorSet > mpColorSet
Definition: ColorSets.hxx:76
A named theme has a named color set.
Definition: ColorSets.hxx:73
std::vector< Color > maColors
Definition: ColorSets.hxx:30
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
const Color & getColor(sal_uInt32 nIndex) const
Definition: ColorSets.hxx:43
FILE * init(int, char **)
struct _xmlTextWriter * xmlTextWriterPtr
Definition: ColorSets.hxx:21
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:373
OUString maName
Definition: ColorSets.hxx:75