diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-08-19 23:43:39 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-08-20 00:14:51 +0200 |
commit | cf7db8226240ca7f425cf649e164767988c80001 (patch) | |
tree | 69b6b2c983ea7f417d58c862636c9d510ff8d9b1 /svx/source/tbxctrls | |
parent | 6038ba92be0a4c821ffa29ed0512905e4b3cd8f8 (diff) |
handle new color picker correctly in chart sidebar
This implements the basics for that and implements it in the AreaPanel.
Change-Id: I6d9e5012bbcc2c953d478a09a839f35f2ef64c5b
Diffstat (limited to 'svx/source/tbxctrls')
-rw-r--r-- | svx/source/tbxctrls/PaletteManager.cxx | 10 | ||||
-rw-r--r-- | svx/source/tbxctrls/colorwindow.hxx | 7 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 24 |
3 files changed, 31 insertions, 10 deletions
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index 658348fcf3eb..8f0ff658bf30 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -36,7 +36,8 @@ PaletteManager::PaletteManager() : mnCurrentPalette(0), mnColorCount(0), mpBtnUpdater(NULL), - mLastColor(COL_AUTO) + mLastColor(COL_AUTO), + maColorSelectFunction(PaletteManager::DispatchColorCommand) { LoadPalettes(); mnNumOfPalettes += m_Palettes.size(); @@ -217,6 +218,11 @@ void PaletteManager::SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater) mpBtnUpdater = pBtnUpdater; } +void PaletteManager::SetColorSelectFunction(std::function<void(const OUString&, const Color&)> aColorSelectFunction) +{ + maColorSelectFunction = aColorSelectFunction; +} + void PaletteManager::PopupColorPicker(const OUString& aCommand) { // The calling object goes away during aColorDlg.Execute(), so we must copy this @@ -230,7 +236,7 @@ void PaletteManager::PopupColorPicker(const OUString& aCommand) mpBtnUpdater->Update( aColorDlg.GetColor() ); mLastColor = aColorDlg.GetColor(); AddRecentColor( mLastColor ); - DispatchColorCommand(aCommandCopy, mLastColor); + maColorSelectFunction(aCommandCopy, mLastColor); } } diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx index 97cccc5ff4d2..9cb27fdf4c9d 100644 --- a/svx/source/tbxctrls/colorwindow.hxx +++ b/svx/source/tbxctrls/colorwindow.hxx @@ -29,6 +29,8 @@ #include <svx/PaletteManager.hxx> #include <vcl/lstbox.hxx> +#include <functional> + class BorderColorStatus; class SvxColorWindow_Impl : public SfxPopupWindow @@ -50,6 +52,8 @@ private: PaletteManager& mrPaletteManager; BorderColorStatus& mrBorderColorStatus; + std::function<void(const OUString&, const Color&)> maColorSelectFunction; + DECL_LINK( SelectHdl, SvxColorValueSet* ); DECL_LINK( SelectPaletteHdl, void *); DECL_LINK( AutoColorClickHdl, void * ); @@ -66,7 +70,8 @@ public: sal_uInt16 nSlotId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const OUString& rWndTitle, - vcl::Window* pParentWindow); + vcl::Window* pParentWindow, + std::function<void(const OUString&, const Color&)> maColorSelectFunction); virtual ~SvxColorWindow_Impl(); virtual void dispose() SAL_OVERRIDE; void StartSelection(); diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index bc0912ff1c12..528b4eac14ef 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1215,7 +1215,8 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, sal_uInt16 nSlotId, const Reference< XFrame >& rFrame, const OUString& rWndTitle, - vcl::Window* pParentWindow ): + vcl::Window* pParentWindow, + std::function<void(const OUString&, const Color&)> aFunction): SfxPopupWindow( nSlotId, pParentWindow, "palette_popup_window", "svx/ui/colorwindow.ui", @@ -1223,7 +1224,8 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, theSlotId( nSlotId ), maCommand( rCommand ), mrPaletteManager( rPaletteManager ), - mrBorderColorStatus( rBorderColorStatus ) + mrBorderColorStatus( rBorderColorStatus ), + maColorSelectFunction(aFunction) { get(mpPaletteListBox, "palette_listbox"); get(mpButtonAutoColor, "auto_color_button"); @@ -1365,7 +1367,7 @@ IMPL_LINK(SvxColorWindow_Impl, SelectHdl, SvxColorValueSet*, pColorSet) if ( maSelectedLink.IsSet() ) maSelectedLink.Call(&aColor); - PaletteManager::DispatchColorCommand(maCommand, aColor); + maColorSelectFunction(maCommand, aColor); return 0; } @@ -1407,7 +1409,7 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, AutoColorClickHdl) if ( maSelectedLink.IsSet() ) maSelectedLink.Call(&aColor); - PaletteManager::DispatchColorCommand(maCommand, aColor); + maColorSelectFunction(maCommand, aColor); return 0; } @@ -2537,8 +2539,9 @@ VclPtr<vcl::Window> SvxFontNameToolBoxControl::CreateItemWindow( vcl::Window *pP SvxColorToolBoxControl::SvxColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, - ToolBox& rTbx ) : - SfxToolBoxControl( nSlotId, nId, rTbx ) + ToolBox& rTbx ): + SfxToolBoxControl( nSlotId, nId, rTbx ), + maColorSelectFunction(PaletteManager::DispatchColorCommand) { if ( dynamic_cast< sfx2::sidebar::SidebarToolBox* >(&rTbx) ) bSidebarType = true; @@ -2611,6 +2614,12 @@ SvxColorToolBoxControl::~SvxColorToolBoxControl() { } +void SvxColorToolBoxControl::setColorSelectFunction(ColorSelectFunction aColorSelectFunction) +{ + maColorSelectFunction = aColorSelectFunction; + mPaletteManager.SetColorSelectFunction(aColorSelectFunction); +} + VclPtr<SfxPopupWindow> SvxColorToolBoxControl::CreatePopupWindow() { SvxColorWindow_Impl* pColorWin = @@ -2622,7 +2631,8 @@ VclPtr<SfxPopupWindow> SvxColorToolBoxControl::CreatePopupWindow() GetSlotId(), m_xFrame, SVX_RESSTR( RID_SVXITEMS_EXTRAS_CHARCOLOR ), - &GetToolBox() ); + &GetToolBox(), + maColorSelectFunction); switch( GetSlotId() ) { |