include/oox/drawingml/theme.hxx | 12 + include/svx/ColorSets.hxx | 169 ++++++++++++++++++++++++-- oox/inc/drawingml/textfont.hxx | 3 oox/source/drawingml/textfont.cxx | 9 + oox/source/drawingml/theme.cxx | 69 ++++++++++ oox/source/drawingml/themeelementscontext.cxx | 23 ++- svx/CppunitTest_svx_unit.mk | 1 svx/qa/unit/ThemeTest.cxx | 40 ++++++ svx/source/styles/ColorSets.cxx | 30 ++-- 9 files changed, 322 insertions(+), 34 deletions(-)
New commits: commit e15372dd4ce43bb867d0b4d66cbcee993d4c5449 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Dec 12 22:12:58 2022 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Sun Jan 15 11:23:36 2023 +0000 oox: add support for importing font scheme into a svx::Theme Change-Id: I862256a17ce84c85174678f3fd03c8ef6661f2c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143995 Tested-by: Tomaž Vajngerl <qui...@gmail.com> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit d5a71bc6a28f8a3d726b2ac4688c7cef9d77ddf0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145387 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/include/oox/drawingml/theme.hxx b/include/oox/drawingml/theme.hxx index a554fc618657..e084f6f0b0fb 100644 --- a/include/oox/drawingml/theme.hxx +++ b/include/oox/drawingml/theme.hxx @@ -35,8 +35,12 @@ namespace com::sun::star { namespace drawing { class XDrawPage; } namespace xml::dom { class XDocument; } } +namespace svx { + class Theme; +} -namespace oox::drawingml { +namespace oox::drawingml +{ struct EffectProperties; struct FillProperties; @@ -82,6 +86,10 @@ public: FontScheme& getFontScheme() { return maFontScheme; } const FontScheme& getFontScheme() const { return maFontScheme; } + + std::map<sal_Int32, std::vector<std::pair<OUString, OUString>>>& getSupplementalFontMap() { return maSupplementalFontMap; } + std::map<sal_Int32, std::vector<std::pair<OUString, OUString>>> const& getSupplementalFontMap() const { return maSupplementalFontMap; } + /** Returns theme font properties by scheme type (major/minor). */ const TextCharacterProperties* getFontStyle( sal_Int32 nSchemeType ) const; /** Returns theme font by placeholder name, e.g. the major latin theme font for the font name '+mj-lt'. */ @@ -99,6 +107,7 @@ public: const css::uno::Reference<css::xml::dom::XDocument>& getFragment() const { return mxFragment; } void setFragment( const css::uno::Reference< css::xml::dom::XDocument>& xRef ) { mxFragment=xRef; } + std::unique_ptr<svx::Theme> createSvxTheme() const; void addTheme(const css::uno::Reference<css::drawing::XDrawPage>& xDrawPage) const; private: @@ -111,6 +120,7 @@ private: LineStyleList maLineStyleList; EffectStyleList maEffectStyleList; FontScheme maFontScheme; + std::map<sal_Int32, std::vector<std::pair<OUString, OUString>>> maSupplementalFontMap; Shape maSpDef; Shape maLnDef; Shape maTxDef; diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx index 4bb4a9111731..411b32cfe805 100644 --- a/include/svx/ColorSets.hxx +++ b/include/svx/ColorSets.hxx @@ -95,6 +95,146 @@ public: const ColorSet& getColorSet(std::u16string_view rName); }; +struct SVXCORE_DLLPUBLIC ThemeSupplementalFont +{ + OUString maScript; + OUString maTypeface; +}; + +struct SVXCORE_DLLPUBLIC ThemeFont +{ + OUString maTypeface; + OUString maPanose; + sal_Int16 maPitch; + sal_Int16 maFamily; + sal_Int32 maCharset; + + sal_Int16 getPitchFamily() const + { + return (maPitch & 0x0F) | (maFamily & 0x0F) << 4; + } +}; + +class SVXCORE_DLLPUBLIC FontScheme +{ +private: + OUString maName; + + ThemeFont maMinorLatin; + ThemeFont maMinorAsian; + ThemeFont maMinorComplex; + + ThemeFont maMajorLatin; + ThemeFont maMajorAsian; + ThemeFont maMajorComplex; + + std::vector<ThemeSupplementalFont> maMinorSupplementalFontList; + std::vector<ThemeSupplementalFont> maMajorSupplementalFontList; + +public: + FontScheme() = default; + FontScheme(OUString const& rName) + : maName(rName) + {} + + const OUString& getName() const + { + return maName; + } + + ThemeFont const& getMinorLatin() const + { + return maMinorLatin; + } + void setMinorLatin(ThemeFont const& aMinor) + { + maMinorLatin = aMinor; + } + + ThemeFont const& getMinorAsian() const + { + return maMinorAsian; + } + void setMinorAsian(ThemeFont const& aMinor) + { + maMinorAsian = aMinor; + } + + ThemeFont const& getMinorComplex() const + { + return maMinorComplex; + } + void setMinorComplex(ThemeFont const& aMinor) + { + maMinorComplex = aMinor; + } + + ThemeFont const& getMajorLatin() const + { + return maMajorLatin; + } + void setMajorLatin(ThemeFont const& aMajor) + { + maMajorLatin = aMajor; + } + + ThemeFont const& getMajorAsian() const + { + return maMajorAsian; + } + void setMajorAsian(ThemeFont const& aMajor) + { + maMajorAsian = aMajor; + } + + ThemeFont const& getMajorComplex() const + { + return maMajorComplex; + } + void setMajorComplex(ThemeFont const& aMajor) + { + maMajorComplex = aMajor; + } + + OUString findMinorSupplementalTypeface(std::u16string_view rScript) const + { + for (auto const& rSupplementalFont : maMinorSupplementalFontList) + { + if (rSupplementalFont.maScript == rScript) + return rSupplementalFont.maTypeface; + } + return OUString(); + } + + std::vector<ThemeSupplementalFont> const& getMinorSupplementalFontList() const + { + return maMinorSupplementalFontList; + } + void setMinorSupplementalFontList(std::vector<ThemeSupplementalFont> const& rSupplementalFont) + { + maMinorSupplementalFontList = rSupplementalFont; + } + + OUString findMajorSupplementalTypeface(std::u16string_view rScript) const + { + for (auto const& rSupplementalFont : maMajorSupplementalFontList) + { + if (rSupplementalFont.maScript == rScript) + return rSupplementalFont.maTypeface; + } + return OUString(); + } + + std::vector<ThemeSupplementalFont> const& getMajorSupplementalFontList() const + { + return maMajorSupplementalFontList; + } + void setMajorSupplementalFontList(std::vector<ThemeSupplementalFont> const& rSupplementalFont) + { + maMajorSupplementalFontList = rSupplementalFont; + } +}; + /// A named theme has a named color set. class SVXCORE_DLLPUBLIC Theme { @@ -102,9 +242,18 @@ private: OUString maName; std::unique_ptr<ColorSet> mpColorSet; + FontScheme maFontScheme; + public: Theme(OUString const& rName); + void setFontScheme(FontScheme const& rFontScheme) + { + maFontScheme = rFontScheme; + } + + FontScheme const& getFontScheme() const { return maFontScheme; } + void SetColorSet(std::unique_ptr<ColorSet> pColorSet); const ColorSet* GetColorSet() const; ColorSet* GetColorSet(); diff --git a/oox/inc/drawingml/textfont.hxx b/oox/inc/drawingml/textfont.hxx index 231b18cffecb..3847ed8c61be 100644 --- a/oox/inc/drawingml/textfont.hxx +++ b/oox/inc/drawingml/textfont.hxx @@ -24,6 +24,7 @@ namespace oox { class AttributeList; } namespace oox::core { class XmlFilterBase; } +namespace svx { struct ThemeFont; } namespace oox::drawingml { @@ -51,6 +52,8 @@ public: sal_Int16& rnFontFamily, const ::oox::core::XmlFilterBase& rFilter ) const; + void fillThemeFont(svx::ThemeFont& rThemeFont) const; + static void resolvePitch(sal_Int32 nOoxPitch, sal_Int16& rnFontPitch, sal_Int16& rnFontFamily); private: diff --git a/oox/source/drawingml/textfont.cxx b/oox/source/drawingml/textfont.cxx index ab50e821e5ec..1320d8963826 100644 --- a/oox/source/drawingml/textfont.cxx +++ b/oox/source/drawingml/textfont.cxx @@ -24,6 +24,7 @@ #include <oox/core/xmlfilterbase.hxx> #include <oox/helper/attributelist.hxx> #include <oox/token/tokens.hxx> +#include <svx/ColorSets.hxx> using ::oox::core::XmlFilterBase; @@ -90,6 +91,14 @@ bool TextFont::implGetFontData( OUString& rFontName, sal_Int16& rnFontPitch, sal return !rFontName.isEmpty(); } +void TextFont::fillThemeFont(svx::ThemeFont& rThemeFont) const +{ + rThemeFont.maTypeface = maTypeface; + rThemeFont.maPanose = maPanose; + rThemeFont.maCharset = mnCharset; + resolvePitch(mnPitchFamily, rThemeFont.maPitch, rThemeFont.maFamily); +} + void TextFont::resolvePitch(sal_Int32 nOoxPitchFamily, sal_Int16& rnFontPitch, sal_Int16& rnFontFamily) { rnFontPitch = lclGetFontPitch(extractValue<sal_Int16>(nOoxPitchFamily, 0, 4)); diff --git a/oox/source/drawingml/theme.cxx b/oox/source/drawingml/theme.cxx index 18f80e56ee97..82ec4ff91c74 100644 --- a/oox/source/drawingml/theme.cxx +++ b/oox/source/drawingml/theme.cxx @@ -108,6 +108,70 @@ const TextFont* Theme::resolveFont( const OUString& rName ) const return nullptr; } +std::unique_ptr<svx::Theme> Theme::createSvxTheme() const +{ + auto pTheme = std::make_unique<svx::Theme>(maThemeName); + auto pColorSet = std::make_unique<svx::ColorSet>(maClrScheme.GetName()); + maClrScheme.fill(*pColorSet); + pTheme->SetColorSet(std::move(pColorSet)); + + svx::FontScheme aFontScheme(maFontSchemeName); + + if (auto* pCharProps = getFontStyle(XML_minor)) + { + svx::ThemeFont aMinorLatin; + pCharProps->maLatinFont.fillThemeFont(aMinorLatin); + aFontScheme.setMinorLatin(aMinorLatin); + + svx::ThemeFont aMinorAsian; + pCharProps->maAsianFont.fillThemeFont(aMinorAsian); + aFontScheme.setMinorAsian(aMinorAsian); + + svx::ThemeFont aMinorComplex; + pCharProps->maComplexFont.fillThemeFont(aMinorComplex); + aFontScheme.setMinorComplex(aMinorComplex); + } + + if (auto* pCharProps = getFontStyle(XML_major)) + { + svx::ThemeFont aMajorLatin; + pCharProps->maLatinFont.fillThemeFont(aMajorLatin); + aFontScheme.setMajorLatin(aMajorLatin); + + svx::ThemeFont aMajorAsian; + pCharProps->maAsianFont.fillThemeFont(aMajorAsian); + aFontScheme.setMajorAsian(aMajorAsian); + + svx::ThemeFont aMajorComplex; + pCharProps->maComplexFont.fillThemeFont(aMajorComplex); + aFontScheme.setMajorComplex(aMajorComplex); + } + + if (maSupplementalFontMap.find(XML_minor) != maSupplementalFontMap.cend()) + { + std::vector<svx::ThemeSupplementalFont> aList; + for (auto const& [rScript, rTypeface] : maSupplementalFontMap.at(XML_minor)) + { + aList.push_back(svx::ThemeSupplementalFont{rScript, rTypeface}); + } + aFontScheme.setMinorSupplementalFontList(aList); + } + + if (maSupplementalFontMap.find(XML_major) != maSupplementalFontMap.cend()) + { + std::vector<svx::ThemeSupplementalFont> aList; + for (auto const& [rScript, rTypeface] : maSupplementalFontMap.at(XML_major)) + { + aList.push_back(svx::ThemeSupplementalFont{rScript, rTypeface}); + } + aFontScheme.setMajorSupplementalFontList(aList); + } + + pTheme->setFontScheme(aFontScheme); + + return pTheme; +} + void Theme::addTheme(const css::uno::Reference<css::drawing::XDrawPage>& xDrawPage) const { SAL_WARN_IF(!xDrawPage.is(), "oox", "DrawPage is not set"); @@ -119,10 +183,7 @@ void Theme::addTheme(const css::uno::Reference<css::drawing::XDrawPage>& xDrawPa if (!pPage) return; - auto pTheme = std::make_unique<svx::Theme>(maThemeName); - auto pColorSet = std::make_unique<svx::ColorSet>(maClrScheme.GetName()); - maClrScheme.fill(*pColorSet); - pTheme->SetColorSet(std::move(pColorSet)); + std::unique_ptr<svx::Theme> pTheme = createSvxTheme(); pPage->getSdrPageProperties().SetTheme(std::move(pTheme)); } diff --git a/oox/source/drawingml/themeelementscontext.cxx b/oox/source/drawingml/themeelementscontext.cxx index 2be1e7702f27..7a279852c325 100644 --- a/oox/source/drawingml/themeelementscontext.cxx +++ b/oox/source/drawingml/themeelementscontext.cxx @@ -145,20 +145,25 @@ namespace { class FontSchemeContext : public ContextHandler2 { public: - FontSchemeContext( ContextHandler2Helper const & rParent, FontScheme& rFontScheme ); + FontSchemeContext(ContextHandler2Helper const & rParent, FontScheme& rFontScheme, + std::map<sal_Int32, std::vector<std::pair<OUString, OUString>>>& rSupplementalFontMap); virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; virtual void onEndElement() override; private: FontScheme& mrFontScheme; TextCharacterPropertiesPtr mxCharProps; + std::map<sal_Int32, std::vector<std::pair<OUString, OUString>>>& mrSupplementalFontMap; + sal_Int32 maCurrentFont = 0; }; } -FontSchemeContext::FontSchemeContext( ContextHandler2Helper const & rParent, FontScheme& rFontScheme ) : - ContextHandler2( rParent ), - mrFontScheme( rFontScheme ) +FontSchemeContext::FontSchemeContext(ContextHandler2Helper const & rParent, FontScheme& rFontScheme, + std::map<sal_Int32, std::vector<std::pair<OUString, OUString>>>& rSupplementalFontMap) + : ContextHandler2(rParent) + , mrFontScheme(rFontScheme) + , mrSupplementalFontMap(rSupplementalFontMap) { } @@ -169,12 +174,13 @@ ContextHandlerRef FontSchemeContext::onCreateContext( sal_Int32 nElement, const case A_TOKEN( majorFont ): mxCharProps = std::make_shared<TextCharacterProperties>(); mrFontScheme[ XML_major ] = mxCharProps; + maCurrentFont = XML_major; return this; case A_TOKEN( minorFont ): mxCharProps = std::make_shared<TextCharacterProperties>(); mrFontScheme[ XML_minor ] = mxCharProps; + maCurrentFont = XML_minor; return this; - case A_TOKEN( latin ): if( mxCharProps ) mxCharProps->maLatinFont.setAttributes( rAttribs ); @@ -187,6 +193,11 @@ ContextHandlerRef FontSchemeContext::onCreateContext( sal_Int32 nElement, const if( mxCharProps ) mxCharProps->maComplexFont.setAttributes( rAttribs ); break; + case A_TOKEN(font): + OUString aScript = rAttribs.getStringDefaulted(XML_script); + OUString aTypeface = rAttribs.getStringDefaulted(XML_typeface); + mrSupplementalFontMap[maCurrentFont].emplace_back(std::pair<OUString, OUString>{aScript, aTypeface}); + break; } return nullptr; } @@ -223,7 +234,7 @@ ContextHandlerRef ThemeElementsContext::onCreateContext( sal_Int32 nElement, con { if (rAttribs.hasAttribute(XML_name)) mrTheme.setFontSchemeName(rAttribs.getString(XML_name).get()); - return new FontSchemeContext(*this, mrTheme.getFontScheme()); + return new FontSchemeContext(*this, mrTheme.getFontScheme(), mrTheme.getSupplementalFontMap()); } case A_TOKEN( fmtScheme ): // CT_StyleMatrix diff --git a/svx/CppunitTest_svx_unit.mk b/svx/CppunitTest_svx_unit.mk index fe165c88bc82..5595d70ea8e9 100644 --- a/svx/CppunitTest_svx_unit.mk +++ b/svx/CppunitTest_svx_unit.mk @@ -33,6 +33,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,svx_unit, \ svx/qa/unit/xoutdev \ svx/qa/unit/xml \ svx/qa/unit/XTableImportExportTest \ + svx/qa/unit/ThemeTest \ )) $(eval $(call gb_CppunitTest_use_libraries,svx_unit, \ diff --git a/svx/qa/unit/ThemeTest.cxx b/svx/qa/unit/ThemeTest.cxx new file mode 100644 index 000000000000..757561b1bd17 --- /dev/null +++ b/svx/qa/unit/ThemeTest.cxx @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <cppunit/TestAssert.h> +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> + +#include <config_features.h> + +#include <svx/ColorSets.hxx> + +namespace +{ +class ThemeTest : public CppUnit::TestFixture +{ +}; + +CPPUNIT_TEST_FIXTURE(ThemeTest, testPitchFamilyConversion) +{ + svx::ThemeFont aFont; + aFont.maPitch = 2; + aFont.maFamily = 1; + + CPPUNIT_ASSERT_EQUAL(sal_Int16(0x12), aFont.getPitchFamily()); + + aFont.maPitch = sal_Int16(0x7FF2); // only lower 4-bit + aFont.maFamily = sal_Int16(0x7FF3); // only lower 4-bit + + CPPUNIT_ASSERT_EQUAL(sal_Int16(0x32), aFont.getPitchFamily()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit a9dd747987eaa79d11f296bbd01e005289c7dd52 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Dec 12 21:48:17 2022 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Sun Jan 15 11:23:27 2023 +0000 svx: use array for colors in ColorSet, add consts, rename vars Use std::array for colors in ColorSet as there are always only 12 colors for a color scheme. Add "const" to getters where appropriate. Rename maColorSetName to maName in ColorSet - long variable name is not needed. Change-Id: Iacb976a22af2d2585d627b0ba65d98cbe1b825c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143994 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit 29c2bba1f3ef216d226c97197185066880fc1ab5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145386 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx index b9c79eb23bf6..4bb4a9111731 100644 --- a/include/svx/ColorSets.hxx +++ b/include/svx/ColorSets.hxx @@ -11,6 +11,7 @@ #ifndef INCLUDED_SVX_COLORSETS_HXX #define INCLUDED_SVX_COLORSETS_HXX +#include <array> #include <vector> #include <rtl/ustring.hxx> @@ -52,19 +53,17 @@ constexpr ThemeColorType convertToThemeColorType(sal_Int32 nIndex) class SVXCORE_DLLPUBLIC ColorSet { - OUString maColorSetName; - std::vector<Color> maColors; + OUString maName; + std::array<Color, 12> maColors; + public: - ColorSet(OUString const & aName); + ColorSet(OUString const& rName); - void add(sal_uInt32 nIndex, ::Color aColorData) - { - maColors[nIndex] = aColorData; - } + void add(sal_uInt32 nIndex, Color aColorData); const OUString& getName() const { - return maColorSetName; + return maName; } Color getColor(ThemeColorType nType) const @@ -88,7 +87,7 @@ public: return maColorSets; } - const ColorSet& getColorSet(sal_uInt32 nIndex) + const ColorSet& getColorSet(sal_uInt32 nIndex) const { return maColorSets[nIndex]; } @@ -99,14 +98,15 @@ public: /// A named theme has a named color set. class SVXCORE_DLLPUBLIC Theme { +private: OUString maName; std::unique_ptr<ColorSet> mpColorSet; public: Theme(OUString const& rName); - ~Theme(); void SetColorSet(std::unique_ptr<ColorSet> pColorSet); + const ColorSet* GetColorSet() const; ColorSet* GetColorSet(); void SetName(const OUString& rName); diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx index 5dc82cf67947..bc87f280504f 100644 --- a/svx/source/styles/ColorSets.cxx +++ b/svx/source/styles/ColorSets.cxx @@ -37,7 +37,7 @@ namespace { /// Updates a text portion to match a new color set, in case it already uses theme colors. void UpdateTextPortionColorSet(const uno::Reference<beans::XPropertySet>& xPortion, - svx::ColorSet& rColorSet) + svx::ColorSet const& rColorSet) { sal_Int16 nCharColorTheme = -1; xPortion->getPropertyValue(UNO_NAME_EDIT_CHAR_COLOR_THEME) >>= nCharColorTheme; @@ -67,7 +67,7 @@ void UpdateTextPortionColorSet(const uno::Reference<beans::XPropertySet>& xPorti uno::makeAny(static_cast<sal_Int32>(aColor))); } -void UpdateFillColorSet(const uno::Reference<beans::XPropertySet>& xShape, svx::ColorSet& rColorSet) +void UpdateFillColorSet(const uno::Reference<beans::XPropertySet>& xShape, svx::ColorSet const& rColorSet) { if (!xShape->getPropertySetInfo()->hasPropertyByName(UNO_NAME_FILLCOLOR_THEME)) { @@ -95,7 +95,7 @@ void UpdateFillColorSet(const uno::Reference<beans::XPropertySet>& xShape, svx:: void UpdateSdrObject(svx::Theme* pTheme, SdrObject* pObject) { - svx::ColorSet* pColorSet = pTheme->GetColorSet(); + const svx::ColorSet* pColorSet = pTheme->GetColorSet(); if (!pColorSet) { return; @@ -128,20 +128,21 @@ void UpdateSdrObject(svx::Theme* pTheme, SdrObject* pObject) namespace svx { -ColorSet::ColorSet(OUString const & aColorSetName) - : maColorSetName(aColorSetName) - , maColors(12) +ColorSet::ColorSet(OUString const & rName) + : maName(rName) {} -ColorSets::ColorSets() -{} +void ColorSet::add(sal_uInt32 nIndex, Color aColorData) +{ + maColors[nIndex] = aColorData; +} void ColorSet::dumpAsXml(xmlTextWriterPtr pWriter) const { (void)xmlTextWriterStartElement(pWriter, BAD_CAST("ColorSet")); (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); - (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("maColorSetName"), - BAD_CAST(maColorSetName.toUtf8().getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("maName"), + BAD_CAST(maName.toUtf8().getStr())); for (const auto& rColor : maColors) { @@ -155,6 +156,9 @@ void ColorSet::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterEndElement(pWriter); } +ColorSets::ColorSets() +{} + ColorSets::~ColorSets() {} @@ -236,15 +240,15 @@ const ColorSet& ColorSets::getColorSet(std::u16string_view rName) return maColorSets[0]; } -Theme::Theme(const OUString& rName) +Theme::Theme(OUString const& rName) : maName(rName) { } -Theme::~Theme() {} - void Theme::SetColorSet(std::unique_ptr<ColorSet> pColorSet) { mpColorSet = std::move(pColorSet); } +const ColorSet* Theme::GetColorSet() const { return mpColorSet.get(); } + ColorSet* Theme::GetColorSet() { return mpColorSet.get(); } void Theme::SetName(const OUString& rName) { maName = rName; }