diff options
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/styles/ColorSets.cxx | 15 | ||||
-rw-r--r-- | svx/source/tbxctrls/PaletteManager.cxx | 27 |
2 files changed, 40 insertions, 2 deletions
diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx index 30a9dd423d78..c77e6ccf2d76 100644 --- a/svx/source/styles/ColorSets.cxx +++ b/svx/source/styles/ColorSets.cxx @@ -312,6 +312,21 @@ void Theme::UpdateSdrPage(SdrPage* pPage) } } +std::vector<Color> Theme::GetColors() const +{ + if (!mpColorSet) + { + return {}; + } + + std::vector<Color> aColors; + for (size_t i = 0; i < 12; ++i) + { + aColors.push_back(mpColorSet->getColor(i)); + } + return aColors; +} + } // end of namespace svx /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index d2395778ff8f..8b0a85deb101 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -45,7 +45,7 @@ PaletteManager::PaletteManager() : mnMaxRecentColors(Application::GetSettings().GetStyleSettings().GetColorValueSetColumnCount()), - mnNumOfPalettes(2), + mnNumOfPalettes(3), mnCurrentPalette(0), mnColorCount(0), mpBtnUpdater(nullptr), @@ -141,6 +141,28 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet) ++nIx; } } + else if (mnCurrentPalette == mnNumOfPalettes - 2) + { + SfxObjectShell* pObjectShell = SfxObjectShell::Current(); + if (pObjectShell) + { + std::vector<Color> aColors = pObjectShell->GetThemeColors(); + mnColorCount = aColors.size(); + rColorSet.Clear(); + std::vector<OUString> aNames = { + SvxResId(RID_SVXSTR_THEME_COLOR1), SvxResId(RID_SVXSTR_THEME_COLOR2), + SvxResId(RID_SVXSTR_THEME_COLOR3), SvxResId(RID_SVXSTR_THEME_COLOR4), + SvxResId(RID_SVXSTR_THEME_COLOR5), SvxResId(RID_SVXSTR_THEME_COLOR6), + SvxResId(RID_SVXSTR_THEME_COLOR7), SvxResId(RID_SVXSTR_THEME_COLOR8), + SvxResId(RID_SVXSTR_THEME_COLOR9), SvxResId(RID_SVXSTR_THEME_COLOR10), + SvxResId(RID_SVXSTR_THEME_COLOR11), SvxResId(RID_SVXSTR_THEME_COLOR12), + }; + for (int i = 0; i < 12; ++i) + { + rColorSet.InsertItem(i, aColors[i], aNames[i]); + } + } + } else if( mnCurrentPalette == mnNumOfPalettes - 1 ) { // Add doc colors to palette @@ -188,6 +210,7 @@ std::vector<OUString> PaletteManager::GetPaletteList() { aPaletteNames.push_back( (*it).GetName() ); } + aPaletteNames.push_back(SvxResId(RID_SVXSTR_THEME_COLORS)); aPaletteNames.push_back( SvxResId ( RID_SVXSTR_DOC_COLORS ) ); return aPaletteNames; @@ -245,7 +268,7 @@ OUString PaletteManager::GetPaletteName() OUString PaletteManager::GetSelectedPalettePath() { - if(mnCurrentPalette != mnNumOfPalettes - 1 && mnCurrentPalette != 0) + if (mnCurrentPalette < m_Palettes.size() && mnCurrentPalette != 0) return m_Palettes[mnCurrentPalette - 1]->GetPath(); else return OUString(); |