diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-11-05 20:28:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-11-07 21:04:50 +0000 |
commit | 64a708cba9b954afe3331f63c58218eb53b3d0ce (patch) | |
tree | ddc1bea3b63f32a1c6d377c1d1dd7aee0803fb70 /svx/source/tbxctrls/PaletteManager.cxx | |
parent | f01c49c4a89ecad2376fd0023625186e5cac642e (diff) |
Revert "Reverts a commit series that cripple windows ci."
with addition of...
- svxlo-SvxColorListBox
+ svxcorelo-SvxColorListBox
This reverts commit db380aab1063e8a5e40111c40ee9f7921aa82601.
Change-Id: I3af7aa0abb1a430bce64188244404fcbd480b128
Reviewed-on: https://gerrit.libreoffice.org/30598
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source/tbxctrls/PaletteManager.cxx')
-rw-r--r-- | svx/source/tbxctrls/PaletteManager.cxx | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index 3ba048559620..7f1d5a140437 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -254,18 +254,21 @@ void PaletteManager::SetLastColor(const Color& rLastColor) mLastColor = rLastColor; } -void PaletteManager::AddRecentColor(const Color& rRecentColor, const OUString& rName) +void PaletteManager::AddRecentColor(const Color& rRecentColor, const OUString& rName, bool bFront) { auto itColor = std::find_if(maRecentColors.begin(), maRecentColors.end(), - [rRecentColor] (const color_and_name &a) { return a.first == rRecentColor; }); + [rRecentColor] (const NamedColor &a) { return a.first == rRecentColor; }); // if recent color to be added is already in list, remove it if( itColor != maRecentColors.end() ) maRecentColors.erase( itColor ); - maRecentColors.push_front(std::make_pair(rRecentColor, rName)); - if( maRecentColors.size() > mnMaxRecentColors ) + if (maRecentColors.size() == mnMaxRecentColors) maRecentColors.pop_back(); + if (bFront) + maRecentColors.push_front(std::make_pair(rRecentColor, rName)); + else + maRecentColors.push_back(std::make_pair(rRecentColor, rName)); css::uno::Sequence< sal_Int32 > aColorList(maRecentColors.size()); css::uno::Sequence< OUString > aColorNameList(maRecentColors.size()); for (size_t i = 0; i < maRecentColors.size(); ++i) @@ -285,7 +288,7 @@ void PaletteManager::SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater) mLastColor = mpBtnUpdater->GetCurrentColor(); } -void PaletteManager::SetColorSelectFunction(const std::function<void(const OUString&, const Color&)>& aColorSelectFunction) +void PaletteManager::SetColorSelectFunction(const std::function<void(const OUString&, const NamedColor&)>& aColorSelectFunction) { maColorSelectFunction = aColorSelectFunction; } @@ -302,12 +305,14 @@ void PaletteManager::PopupColorPicker(const OUString& aCommand) if (mpBtnUpdater) mpBtnUpdater->Update( aColorDlg.GetColor() ); mLastColor = aColorDlg.GetColor(); - AddRecentColor(mLastColor, ("#" + mLastColor.AsRGBHexString().toAsciiUpperCase())); - maColorSelectFunction(aCommandCopy, mLastColor); + OUString sColorName = ("#" + mLastColor.AsRGBHexString().toAsciiUpperCase()); + NamedColor aNamedColor = std::make_pair(mLastColor, sColorName); + AddRecentColor(mLastColor, sColorName); + maColorSelectFunction(aCommandCopy, aNamedColor); } } -void PaletteManager::DispatchColorCommand(const OUString& aCommand, const Color& rColor) +void PaletteManager::DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor) { using namespace css::uno; using namespace css::frame; @@ -323,7 +328,7 @@ void PaletteManager::DispatchColorCommand(const OUString& aCommand, const Color& Sequence<PropertyValue> aArgs(1); aArgs[0].Name = aObj.GetURLPath(); - aArgs[0].Value = makeAny(sal_Int32(rColor.GetColor())); + aArgs[0].Value = makeAny(sal_Int32(rColor.first.GetColor())); URL aTargetURL; aTargetURL.Complete = aCommand; |