[Libreoffice-commits] core.git: include/svx officecfg/registry svx/source
Rishabh Kumar
kris.kr296 at gmail.com
Fri Jul 29 14:53:28 UTC 2016
include/svx/PaletteManager.hxx | 2 -
officecfg/registry/schema/org/openoffice/Office/Common.xcs | 10 ++++++
svx/source/tbxctrls/PaletteManager.cxx | 20 ++++++++++++-
3 files changed, 30 insertions(+), 2 deletions(-)
New commits:
commit 7f262a41017685709c288b57c8f03244e8c6149e
Author: Rishabh Kumar <kris.kr296 at gmail.com>
Date: Fri Jul 29 18:39:46 2016 +0530
[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 at cib.de>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index 09adc36..c8eb922 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -52,7 +52,7 @@ class PaletteManager
std::vector<std::unique_ptr<Palette>> m_Palettes;
std::function<void(const OUString&, const Color&)> maColorSelectFunction;
-
+ css::uno::Reference < css::uno::XComponentContext > m_context;
public:
PaletteManager();
~PaletteManager();
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 2d9ea8c..5edc96c 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -3406,6 +3406,16 @@
</info>
</prop>
</group>
+ <group oor:name="UserColors">
+ <info>
+ <desc>Contains recent colors and custom colors</desc>
+ </info>
+ <prop oor:name="RecentColor" oor:type="oor:int-list" oor:nillable="false">
+ <info>
+ <desc>List of Recent colors</desc>
+ </info>
+ <value/> </prop>
+ </group>
<group oor:name="Help">
<info>
<desc>Contains settings that specify the common help settings.</desc>
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index 55123aa..e14c172 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)
More information about the Libreoffice-commits
mailing list