summaryrefslogtreecommitdiff
path: root/svx/source/tbxctrls/PaletteManager.cxx
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2016-11-05 13:28:17 -0500
committerNorbert Thiebaud <nthiebaud@gmail.com>2016-11-05 13:42:40 -0500
commitdb380aab1063e8a5e40111c40ee9f7921aa82601 (patch)
treef5057dfb205a7d7409251742888dfeaf4bfbee61 /svx/source/tbxctrls/PaletteManager.cxx
parentee2144aafc5b4be14630f723be9a2bb674671412 (diff)
Reverts a commit series that cripple windows ci.
Revert "SvxShadowTabPage::Construct was removed" f9a2c1c12ecad833c63b894c89d6008907477eb5. Revert "replace OColorPopup with SvxColorWindow" f300754bb1c6a347c92bb9548be7a65237176542. Revert "drop AutoColorInvalid/SID_ATTR_AUTO_COLOR_INVALID" 347c2c334589b18cc62af292674bb3df1dd54b71. Revert "replace last ColorLB use with a listbox of colors" 604b35bf55351751a396e34dcca3f85e75860fd5. Revert "simplify, its just a vector of colors" 351a97ce6bda3075677b59fa1387ba3d1ab17d7a. Revert "replace user draw with an Image of the color" df738e0f8ceedb4bad756960be14d9c41adc165d. Revert "strip down to the used pieces" commit 08d6cd788f2584ce10ab8fa10665245e953c59d9. Revert "move now combined ColorLB to location of last user" a19b18ad7c9eb0197c10e6d7e451ec4542e4bc9e. Revert "fold ColorListBox and ColorLB together" a989a0b1f2b425f05b58d0e44ce2de31c842ed65. Revert "move ColorListBox beside sole thing that uses it" 760a198e697f3070a5e0e029e4eff7be220eb9cd. Revert "extensions leaks out details of Color Selector, patch it up" 8bea644d6117a49405e6426dc97214220fc869d1. Revert "inherit FillAttrLB from ListBox not ColorListBox" d2ce812f1d3a7a2aad89ca0bd11948b63d2db7b0. Revert "unify color selectors" 43bc3031483d172eccd72c3804e2d4fc2ef37de4.
Diffstat (limited to 'svx/source/tbxctrls/PaletteManager.cxx')
-rw-r--r--svx/source/tbxctrls/PaletteManager.cxx23
1 files changed, 9 insertions, 14 deletions
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index 7f1d5a140437..3ba048559620 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -254,21 +254,18 @@ void PaletteManager::SetLastColor(const Color& rLastColor)
mLastColor = rLastColor;
}
-void PaletteManager::AddRecentColor(const Color& rRecentColor, const OUString& rName, bool bFront)
+void PaletteManager::AddRecentColor(const Color& rRecentColor, const OUString& rName)
{
auto itColor = std::find_if(maRecentColors.begin(),
maRecentColors.end(),
- [rRecentColor] (const NamedColor &a) { return a.first == rRecentColor; });
+ [rRecentColor] (const color_and_name &a) { return a.first == rRecentColor; });
// if recent color to be added is already in list, remove it
if( itColor != maRecentColors.end() )
maRecentColors.erase( itColor );
- if (maRecentColors.size() == mnMaxRecentColors)
+ maRecentColors.push_front(std::make_pair(rRecentColor, rName));
+ 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)
@@ -288,7 +285,7 @@ void PaletteManager::SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater)
mLastColor = mpBtnUpdater->GetCurrentColor();
}
-void PaletteManager::SetColorSelectFunction(const std::function<void(const OUString&, const NamedColor&)>& aColorSelectFunction)
+void PaletteManager::SetColorSelectFunction(const std::function<void(const OUString&, const Color&)>& aColorSelectFunction)
{
maColorSelectFunction = aColorSelectFunction;
}
@@ -305,14 +302,12 @@ void PaletteManager::PopupColorPicker(const OUString& aCommand)
if (mpBtnUpdater)
mpBtnUpdater->Update( aColorDlg.GetColor() );
mLastColor = aColorDlg.GetColor();
- OUString sColorName = ("#" + mLastColor.AsRGBHexString().toAsciiUpperCase());
- NamedColor aNamedColor = std::make_pair(mLastColor, sColorName);
- AddRecentColor(mLastColor, sColorName);
- maColorSelectFunction(aCommandCopy, aNamedColor);
+ AddRecentColor(mLastColor, ("#" + mLastColor.AsRGBHexString().toAsciiUpperCase()));
+ maColorSelectFunction(aCommandCopy, mLastColor);
}
}
-void PaletteManager::DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor)
+void PaletteManager::DispatchColorCommand(const OUString& aCommand, const Color& rColor)
{
using namespace css::uno;
using namespace css::frame;
@@ -328,7 +323,7 @@ void PaletteManager::DispatchColorCommand(const OUString& aCommand, const NamedC
Sequence<PropertyValue> aArgs(1);
aArgs[0].Name = aObj.GetURLPath();
- aArgs[0].Value = makeAny(sal_Int32(rColor.first.GetColor()));
+ aArgs[0].Value = makeAny(sal_Int32(rColor.GetColor()));
URL aTargetURL;
aTargetURL.Complete = aCommand;