diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-05-03 22:58:47 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-06-01 11:18:36 +0200 |
commit | 1b5e37186e8b7676a2e6234266dfc601762e11f7 (patch) | |
tree | 50e943fd70987e7f7f0f7fe7af8fc681e1278739 /docmodel | |
parent | f4eb56b8b9ff3492e0a02fb76eb4ea7b851f4774 (diff) |
change model::ColorSet to be stored in a shared_ptr in model::Theme
Change-Id: Ic3067f1681c047cd944e64179c568f4e972e0c95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151447
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit 8bafae3656f7a0a6b74bb0985403a96f9a3f61be)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152232
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'docmodel')
-rw-r--r-- | docmodel/source/theme/Theme.cxx | 18 | ||||
-rw-r--r-- | docmodel/source/uno/UnoTheme.cxx | 2 |
2 files changed, 5 insertions, 15 deletions
diff --git a/docmodel/source/theme/Theme.cxx b/docmodel/source/theme/Theme.cxx index b8fad072144a..d4095eeb3ebd 100644 --- a/docmodel/source/theme/Theme.cxx +++ b/docmodel/source/theme/Theme.cxx @@ -33,20 +33,11 @@ Theme::Theme(OUString const& rName) Theme::Theme(Theme const& rTheme) : maName(rTheme.maName) - , mpColorSet(new ColorSet(*rTheme.GetColorSet())) + , mpColorSet(new ColorSet(*rTheme.getColorSet())) , maFontScheme(rTheme.maFontScheme) { } -void Theme::SetColorSet(std::unique_ptr<model::ColorSet> pColorSet) -{ - mpColorSet = std::move(pColorSet); -} - -const model::ColorSet* Theme::GetColorSet() const { return mpColorSet.get(); } - -model::ColorSet* Theme::GetColorSet() { return mpColorSet.get(); } - void Theme::SetName(const OUString& rName) { maName = rName; } const OUString& Theme::GetName() const { return maName; } @@ -94,7 +85,7 @@ std::unique_ptr<Theme> Theme::FromAny(const uno::Any& rVal) { comphelper::SequenceAsHashMap aMap(rVal); std::unique_ptr<Theme> pTheme; - model::ColorSet* pColorSet = nullptr; + std::shared_ptr<model::ColorSet> pColorSet; auto it = aMap.find("Name"); if (it != aMap.end()) @@ -109,9 +100,8 @@ std::unique_ptr<Theme> Theme::FromAny(const uno::Any& rVal) { OUString aName; it->second >>= aName; - auto pSet = std::make_unique<model::ColorSet>(aName); - pTheme->SetColorSet(std::move(pSet)); - pColorSet = pTheme->GetColorSet(); + pColorSet = std::make_shared<model::ColorSet>(aName); + pTheme->setColorSet(pColorSet); } it = aMap.find("ColorScheme"); diff --git a/docmodel/source/uno/UnoTheme.cxx b/docmodel/source/uno/UnoTheme.cxx index 30d3f827fea2..a7eac05cbd9b 100644 --- a/docmodel/source/uno/UnoTheme.cxx +++ b/docmodel/source/uno/UnoTheme.cxx @@ -22,7 +22,7 @@ OUString UnoTheme::getName() { return mpTheme->GetName(); } css::uno::Sequence<sal_Int32> UnoTheme::getColorSet() { std::vector<sal_Int32> aColorScheme(12); - auto* pColorSet = mpTheme->GetColorSet(); + auto pColorSet = mpTheme->getColorSet(); if (pColorSet) { size_t i = 0; |