summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorRishabh Kumar <kris.kr296@gmail.com>2016-07-29 18:39:46 +0530
committerRishabh Kumar <kris.kr296@yahoo.in>2016-07-29 14:52:56 +0000
commit7f262a41017685709c288b57c8f03244e8c6149e (patch)
tree130677ce67e64e47ab6341fa59a9ecac8fae2b63 /svx
parentbb01247f71a46fb7cae18b51516096adfd059bbc (diff)
[GSoC] Fix recent colors in color popup widget
Save recent colors in user configuration. Change-Id: I1637e9fe3150bd1892f72ff9df06dc2a7c3e1e9e Reviewed-on: https://gerrit.libreoffice.org/27688 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/tbxctrls/PaletteManager.cxx20
1 files changed, 19 insertions, 1 deletions
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index 55123aa002f8..e14c172c371b 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -30,6 +30,8 @@
#include <vcl/settings.hxx>
#include <stack>
#include <set>
+#include <cppu/unotype.hxx>
+#include <officecfg/Office/Common.hxx>
PaletteManager::PaletteManager() :
mnMaxRecentColors(Application::GetSettings().GetStyleSettings().GetColorValueSetColumnCount()),
@@ -38,7 +40,8 @@ PaletteManager::PaletteManager() :
mnColorCount(0),
mpBtnUpdater(nullptr),
mLastColor(COL_AUTO),
- maColorSelectFunction(PaletteManager::DispatchColorCommand)
+ maColorSelectFunction(PaletteManager::DispatchColorCommand),
+ m_context(comphelper::getProcessComponentContext())
{
SfxObjectShell* pDocSh = SfxObjectShell::Current();
if(pDocSh)
@@ -134,6 +137,13 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet)
void PaletteManager::ReloadRecentColorSet(SvxColorValueSet& rColorSet)
{
+ maRecentColors.clear();
+ css::uno::Sequence< sal_Int32 > Colorlist(officecfg::Office::Common::UserColors::RecentColor::get());
+ for(int i = 0;i < Colorlist.getLength();i++)
+ {
+ Color aColor( Colorlist[i] );
+ maRecentColors.push_back( aColor );
+ }
rColorSet.Clear();
int nIx = 1;
for(std::deque<Color>::const_iterator it = maRecentColors.begin();
@@ -217,6 +227,14 @@ void PaletteManager::AddRecentColor(const Color& rRecentColor)
maRecentColors.push_front( rRecentColor );
if( maRecentColors.size() > mnMaxRecentColors )
maRecentColors.pop_back();
+ css::uno::Sequence< sal_Int32 > aColorList(maRecentColors.size());
+ for(sal_uInt16 i = 0;i < maRecentColors.size();i++)
+ {
+ aColorList[i] = (int)maRecentColors[i].GetColor();
+ }
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_context));
+ officecfg::Office::Common::UserColors::RecentColor::set(aColorList, batch);
+ batch->commit();
}
void PaletteManager::SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater)