diff options
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/app/docst.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/shells/basesh.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/ThemePanel.cxx | 22 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/ThemePanel.hxx | 2 |
4 files changed, 9 insertions, 23 deletions
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 84aacfa1d47d..cd1e3dcde925 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -1585,7 +1585,7 @@ std::vector<Color> SwDocShell::GetThemeColors() SdrPage* pPage = m_xDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); if (!pPage) return {}; - model::Theme* pTheme = pPage->getSdrPageProperties().GetTheme(); + auto const& pTheme = pPage->getSdrPageProperties().GetTheme(); if (!pTheme) return {}; return pTheme->GetColors(); diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 0006596a87fb..5e5d07565b5d 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -2217,7 +2217,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet ) SdrPage* pPage = pDocument->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); if (pPage) { - model::Theme* pTheme = pPage->getSdrPageProperties().GetTheme(); + auto const& pTheme = pPage->getSdrPageProperties().GetTheme(); if (pTheme) bDisable = false; } @@ -3058,11 +3058,11 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) if (pDocumentShell) { SdrPage* pPage = pDocument->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); - model::Theme* pTheme = pPage->getSdrPageProperties().GetTheme(); + auto const& pTheme = pPage->getSdrPageProperties().GetTheme(); if (pTheme) { std::shared_ptr<svx::IThemeColorChanger> pChanger(new sw::ThemeColorChanger(pDocumentShell)); - auto pDialog = std::make_shared<svx::ThemeDialog>(pMDI, pTheme, pChanger); + auto pDialog = std::make_shared<svx::ThemeDialog>(pMDI, pTheme.get(), pChanger); weld::DialogController::runAsync(pDialog, [](int) {}); } } diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx index 6a2647ebbbee..2dabadbba545 100644 --- a/sw/source/uibase/sidebar/ThemePanel.cxx +++ b/sw/source/uibase/sidebar/ThemePanel.cxx @@ -47,28 +47,15 @@ ThemePanel::ThemePanel(weld::Widget* pParent) mxApplyButton->connect_clicked(LINK(this, ThemePanel, ClickHdl)); mxValueSetColors->SetDoubleClickHdl(LINK(this, ThemePanel, DoubleClickValueSetHdl)); - maColorSets.init(); - - SwDocShell* pDocSh = static_cast<SwDocShell*>(SfxObjectShell::Current()); - SwDoc* pDocument = pDocSh->GetDoc(); - if (pDocument) - { - SdrPage* pPage = pDocument->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); - model::Theme* pTheme = pPage->getSdrPageProperties().GetTheme(); - if (pTheme) - maColorSets.insert(*pTheme->GetColorSet()); - } - - const std::vector<model::ColorSet>& aColorSets = maColorSets.getColorSets(); - for (size_t i = 0; i < aColorSets.size(); ++i) + auto const& rColorSets = svx::ColorSets::get(); + for (model::ColorSet const& rColorSet : rColorSets.getColorSetVector()) { - const model::ColorSet& rColorSet = aColorSets[i]; mxValueSetColors->insert(rColorSet); } mxValueSetColors->SetOptimalSize(); - if (!aColorSets.empty()) + if (!rColorSets.getColorSetVector().empty()) mxValueSetColors->SelectItem(1); // ItemId 1, position 0 } @@ -106,7 +93,8 @@ void ThemePanel::DoubleClickHdl() return; sal_uInt32 nIndex = nItemId - 1; - model::ColorSet const& rColorSet = maColorSets.getColorSet(nIndex); + auto const& rColorSets = svx::ColorSets::get(); + model::ColorSet const& rColorSet = rColorSets.getColorSet(nIndex); ThemeColorChanger aChanger(pDocSh); aChanger.apply(rColorSet); diff --git a/sw/source/uibase/sidebar/ThemePanel.hxx b/sw/source/uibase/sidebar/ThemePanel.hxx index 848d022ee0c6..12285286f546 100644 --- a/sw/source/uibase/sidebar/ThemePanel.hxx +++ b/sw/source/uibase/sidebar/ThemePanel.hxx @@ -43,8 +43,6 @@ private: std::unique_ptr<weld::CustomWeld> mxValueSetColorsWin; std::unique_ptr<weld::Button> mxApplyButton; - svx::ColorSets maColorSets; - DECL_LINK(ClickHdl, weld::Button&, void); DECL_LINK(DoubleClickHdl, weld::TreeView&, bool); DECL_LINK(DoubleClickValueSetHdl, ValueSet*, void); |