[Libreoffice-commits] core.git: Branch 'feature/gsoc14-colors' - include/svx svx/source svx/uiconfig
include/svx/Palette.hxx|1 include/svx/PaletteManager.hxx | 17 +++- svx/source/tbxctrls/Palette.cxx|3 svx/source/tbxctrls/PaletteManager.cxx | 32 + svx/source/tbxctrls/colorwindow.hxx|6 + svx/source/tbxctrls/tbcontrl.cxx | 71 +--- svx/uiconfig/ui/colorwindow.ui | 116 + 7 files changed, 203 insertions(+), 43 deletions(-) New commits: commit ed6e4c65965fefdf5b638d6a2f8ca5fac856aa3b Author: Krisztian Pinter pin.termina...@gmail.com Date: Mon Aug 11 17:35:50 2014 +0200 Add recent colors Change-Id: Id6b2239149bf7d0b3c9242efb7a72091e32c3384 diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx index 11a3462..6eab3f4 100644 --- a/include/svx/Palette.hxx +++ b/include/svx/Palette.hxx @@ -29,7 +29,6 @@ typedef std::pairColor, OUString NamedColor; typedef std::vector NamedColor ColorList; - class Palette { public: diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx index e4144f9..cb70d2c 100644 --- a/include/svx/PaletteManager.hxx +++ b/include/svx/PaletteManager.hxx @@ -23,6 +23,7 @@ #include svx/Palette.hxx #include rtl/ustring.hxx #include svx/tbxcolorupdate.hxx +#include deque #include tools/urlobj.hxx #include comphelper/processfactory.hxx @@ -36,27 +37,35 @@ class PaletteManager { -sal_uInt16 mnNumOfPalettes; -sal_uInt16 mnCurrentPalette; +const sal_uInt16mnMaxRecentColors; -longmnColorCount; +sal_uInt16 mnNumOfPalettes; +sal_uInt16 mnCurrentPalette; + +longmnColorCount; svx::ToolboxButtonColorUpdater* mpBtnUpdater; -Color mLastColor; +Color mLastColor; +std::dequeColor maRecentColors; boost::ptr_vectorPalette maPalettes; public: PaletteManager(); ~PaletteManager(); voidLoadPalettes(); voidReloadColorSet(SvxColorValueSet rColorSet); +voidReloadRecentColorSet(SvxColorValueSet rColorSet); std::vectorOUString GetPaletteList(); voidSetPalette( sal_Int32 nPos ); sal_Int32 GetPalette(); longGetColorCount(); +longGetRecentColorCount(); OUStringGetPaletteName(); + const Color GetLastColor(); voidSetLastColor(const Color rLastColor); +voidAddRecentColor(const Color rRecentColor); + voidSetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater); voidPopupColorPicker(const OUString aCommand); static void DispatchColorCommand(const OUString aCommand, const Color aColor); diff --git a/svx/source/tbxctrls/Palette.cxx b/svx/source/tbxctrls/Palette.cxx index 496e0fc..ba5bdbd 100644 --- a/svx/source/tbxctrls/Palette.cxx +++ b/svx/source/tbxctrls/Palette.cxx @@ -52,10 +52,9 @@ void PaletteGPL::LoadColorSet( SvxColorValueSet rColorSet ) rColorSet.Clear(); int nIx = 1; -for(ColorList::const_iterator it = maColors.begin(); +for(typename ColorList::const_iterator it = maColors.begin(); it != maColors.end(); ++it) { -// TODO make it-second OUString rColorSet.InsertItem(nIx, it-first, it-second); ++nIx; } diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index 98ae0b2..101c002 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -30,6 +30,7 @@ #define STR_DOC_COLOR_PREFIXDocument Color PaletteManager::PaletteManager() : +mnMaxRecentColors(10), mnNumOfPalettes(2), mnCurrentPalette(0), mnColorCount(0), @@ -115,6 +116,18 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet rColorSet) } } +void PaletteManager::ReloadRecentColorSet(SvxColorValueSet rColorSet) +{ +rColorSet.Clear(); +int nIx = 1; +for(std::dequeColor::const_iterator it = maRecentColors.begin(); +it != maRecentColors.end(); ++it) +{ +rColorSet.InsertItem(nIx, *it, ); +++nIx; +} +} + std::vectorOUString PaletteManager::GetPaletteList() { std::vectorOUString aPaletteNames; @@ -148,6 +161,11 @@ long PaletteManager::GetColorCount() return mnColorCount; } +long PaletteManager::GetRecentColorCount() +{ +return maRecentColors.size(); +} + OUString PaletteManager::GetPaletteName() { if( mnCurrentPalette == 0 ) @@ -168,6 +186,19 @@ void PaletteManager::SetLastColor(const Color rLastColor) mLastColor = rLastColor; } +void PaletteManager::AddRecentColor(const Color rRecentColor) +{ +std::dequeColor::iterator itColor = +std::find(maRecentColors.begin(), maRecentColors.end(), rRecentColor); +// if recent color to be added is already in list, remove it +if( itColor != maRecentColors.end() ) +maRecentColors.erase( itColor ); + +maRecentColors.push_front( rRecentColor ); +
[Libreoffice-commits] core.git: Branch 'feature/gsoc14-colors' - include/svx svx/source
include/svx/Palette.hxx |3 ++- svx/source/tbxctrls/Palette.cxx | 19 +-- 2 files changed, 15 insertions(+), 7 deletions(-) New commits: commit 771b951a806d956c2ae2dc7b64cb6e15f4839630 Author: Krisztian Pinter pin.termina...@gmail.com Date: Thu Jul 31 10:56:58 2014 +0200 Make .soc loading lazy Change-Id: If7475d6c46faaa6f6f6cde494990e6573b3aadff diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx index 2be4eb2..11a3462 100644 --- a/include/svx/Palette.hxx +++ b/include/svx/Palette.hxx @@ -65,7 +65,8 @@ public: class PaletteSOC : public Palette { -//TODO add lazy loading +boolmbLoadedPalette; +OUStringmaFPath; OUStringmaName; XColorListRef mpColorList; public: diff --git a/svx/source/tbxctrls/Palette.cxx b/svx/source/tbxctrls/Palette.cxx index 95ebb58..496e0fc 100644 --- a/svx/source/tbxctrls/Palette.cxx +++ b/svx/source/tbxctrls/Palette.cxx @@ -173,11 +173,11 @@ OString lcl_getToken(const OString rStr, sal_Int32 index) // PaletteSOC -- -PaletteSOC::PaletteSOC( const OUString rFPath, const OUString rFName ) +PaletteSOC::PaletteSOC( const OUString rFPath, const OUString rFName ) : +mbLoadedPalette( false ), +maFPath( rFPath ), +maName( rFName ) { -maName = rFName; -mpColorList = XPropertyList::AsColorList(XPropertyList::CreatePropertyListFromURL(XCOLOR_LIST, rFPath)); -mpColorList-Load(); } PaletteSOC::~PaletteSOC() @@ -191,13 +191,20 @@ const OUString PaletteSOC::GetName() void PaletteSOC::LoadColorSet( SvxColorValueSet rColorSet ) { +if( !mbLoadedPalette ) +{ +mbLoadedPalette = true; +mpColorList = XPropertyList::AsColorList(XPropertyList::CreatePropertyListFromURL(XCOLOR_LIST, maFPath)); +mpColorList-Load(); +} rColorSet.Clear(); -rColorSet.addEntriesForXColorList( *mpColorList ); +if( mpColorList.is() ) +rColorSet.addEntriesForXColorList( *mpColorList ); } bool PaletteSOC::IsValid() { -return mpColorList.is(); +return true; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/gsoc14-colors' - include/svx svx/source
include/svx/Palette.hxx| 19 ++--- include/svx/PaletteManager.hxx |6 ++- svx/source/tbxctrls/Palette.cxx| 66 +++-- svx/source/tbxctrls/PaletteManager.cxx | 51 +++-- svx/source/tbxctrls/colorwindow.hxx| 12 ++ svx/source/tbxctrls/tbcontrl.cxx | 57 +++- 6 files changed, 129 insertions(+), 82 deletions(-) New commits: commit 05f5059ed6d24cf31de8f824fc62d786c115b223 Author: Krisztian Pinter pin.termina...@gmail.com Date: Thu Jul 10 16:14:29 2014 +0200 Change SvxColorWindow_Impl to use ComboBox for palette selection Change-Id: I0fb9b46298f45bbdf9ae9198c145b9ea5e403bbf diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx index f7ced03..d31e958 100644 --- a/include/svx/Palette.hxx +++ b/include/svx/Palette.hxx @@ -21,6 +21,7 @@ #include rtl/ustring.hxx #include tools/color.hxx +#include tools/stream.hxx class Palette { @@ -28,17 +29,23 @@ public: typedef std::pairColor, OString NamedColor; typedef std::vector NamedColor ColorList; private: -boolmbLoaded; -OUStringmaFname; -OString maName; +boolmbLoadedPalette; +boolmbValidPalette; +OUStringmaFName; +OUStringmaFPath; +OUStringmaName; ColorList maColors; -void LoadPalette(); +boolReadPaletteHeader(SvFileStream rFileStream); +voidLoadPaletteHeader(); +voidLoadPalette(); public: -Palette(const OUString rFname); +Palette( const OUString rFPath, const OUString rFName ); -const OString GetPaletteName(); +const OUString GetName(); const ColorListGetPaletteColors(); + +boolIsValid(); }; #endif // INCLUDED_SVX_PALETTE_HXX diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx index e1d7201..925f67b 100644 --- a/include/svx/PaletteManager.hxx +++ b/include/svx/PaletteManager.hxx @@ -37,8 +37,10 @@ public: PaletteManager(); voidLoadPalettes(); voidReloadColorSet(SvxColorValueSet rColorSet); -voidPrevPalette(); -voidNextPalette(); +std::vectorOUString GetPaletteList(); +voidSetPalette( sal_Int32 nPos ); +sal_Int32 GetPalette(); + longGetColorCount(); OUStringGetPaletteName(); const Color GetLastColor(); diff --git a/svx/source/tbxctrls/Palette.cxx b/svx/source/tbxctrls/Palette.cxx index aebb7f0..f84f2d5 100644 --- a/svx/source/tbxctrls/Palette.cxx +++ b/svx/source/tbxctrls/Palette.cxx @@ -18,7 +18,6 @@ */ #include svx/Palette.hxx -#include tools/stream.hxx // finds first token in rStr from index, separated by whitespace // returns position of next token in index @@ -52,13 +51,17 @@ OString lcl_getToken(const OString rStr, sal_Int32 index) return rStr.copy(substart, toklen); } -Palette::Palette(const OUString rFname) : -mbLoaded( false ), -maFname( rFname ){} +Palette::Palette( const OUString rFPath, const OUString rFName ) : +mbLoadedPalette( false ), +mbValidPalette( false ), +maFName( rFName ), +maFPath( rFPath ) +{ +LoadPaletteHeader(); +} -const OString Palette::GetPaletteName() +const OUString Palette::GetName() { -LoadPalette(); return maName; } @@ -68,27 +71,52 @@ const Palette::ColorList Palette::GetPaletteColors() return maColors; } -void Palette::LoadPalette() +bool Palette::IsValid() { -if( mbLoaded ) return; - -mbLoaded = true; - -// TODO add error handling!!! -SvFileStream aFile(maFname, STREAM_READ); +return mbValidPalette; +} +bool Palette::ReadPaletteHeader(SvFileStream rFileStream) +{ OString aLine; +OString aName; -aFile.ReadLine(aLine); -if( !aLine.startsWith(GIMP Palette) ) return; -aFile.ReadLine(aLine); -if( aLine.startsWith(Name: , maName) ) +rFileStream.ReadLine(aLine); +if( !aLine.startsWith(GIMP Palette) ) return false; +rFileStream.ReadLine(aLine); +if( aLine.startsWith(Name: , aName) ) { -aFile.ReadLine(aLine); +maName = OStringToOUString(aName, RTL_TEXTENCODING_ASCII_US); +rFileStream.ReadLine(aLine); if( aLine.startsWith(Columns: )) -aFile.ReadLine(aLine); // we can ignore this +rFileStream.ReadLine(aLine); // we can ignore this +} +else +{ +maName = maFName; } +return true; +} + +//TODO make this LoadPaletteHeader and set a bool if palette is incorrect +void Palette::LoadPaletteHeader() +{ +SvFileStream aFile(maFPath, STREAM_READ); +mbValidPalette = ReadPaletteHeader( aFile ); +} +void Palette::LoadPalette() +{ +if( mbLoadedPalette ) return; +mbLoadedPalette = true; + +// TODO add error handling!!! +SvFileStream aFile(maFPath, STREAM_READ); +mbValidPalette = ReadPaletteHeader( aFile ); + +if(
[Libreoffice-commits] core.git: Branch 'feature/gsoc14-colors' - include/svx svx/source
include/svx/tbcontrl.hxx|4 ++-- svx/source/tbxctrls/colorwindow.hxx |2 +- svx/source/tbxctrls/tbcontrl.cxx| 14 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) New commits: commit ac6e95225340d92157278f8908b29e7cc4348e08 Author: Krisztian Pinter pin.termina...@gmail.com Date: Fri Jul 4 22:36:29 2014 +0200 Fix variable and method names Change-Id: I2f02dbeaa61e959d9420410100c6e958580a6567 diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx index 6d9975f..1e9c4b1 100644 --- a/include/svx/tbcontrl.hxx +++ b/include/svx/tbcontrl.hxx @@ -222,7 +222,7 @@ class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl ::boost::scoped_ptr ::svx::ToolboxButtonColorUpdater pBtnUpdater; Color mLastColor; -PaletteManager mrPaletteManager; +PaletteManager mPaletteManager; DECL_LINK( SelectedHdl, Color* ); public: SFX_DECL_TOOLBOX_CONTROL(); @@ -243,7 +243,7 @@ class SVX_DLLPUBLIC SvxLineColorToolBoxControl : public SfxToolBoxControl { ::boost::scoped_ptr ::svx::ToolboxButtonColorUpdater pBtnUpdater; Color mLastColor; -PaletteManager mrPaletteManager; +PaletteManager mPaletteManager; DECL_LINK( SelectedHdl, Color* ); public: SFX_DECL_TOOLBOX_CONTROL(); diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx index 5a700c7..3e19796 100644 --- a/svx/source/tbxctrls/colorwindow.hxx +++ b/svx/source/tbxctrls/colorwindow.hxx @@ -52,7 +52,7 @@ private: const sal_uInt16 nNavButtonHeight; PaletteManager mrPaletteManager; -void Update(); +void UpdateGUI(); DECL_LINK( SelectHdl, void * ); DECL_LINK( StepLeftClickHdl, void * ); diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index b94a3cf..d13d2ca 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1143,11 +1143,11 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUStringrCommand, AddStatusListener( OUString( .uno:ColorTableState )); AddStatusListener( maCommand ); -Update(); +UpdateGUI(); } -void SvxColorWindow_Impl::Update() +void SvxColorWindow_Impl::UpdateGUI() { mrPaletteManager.ReloadColorSet(aColorSet); @@ -1223,14 +1223,14 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectHdl) IMPL_LINK_NOARG(SvxColorWindow_Impl, StepLeftClickHdl) { mrPaletteManager.PrevPalette(); -Update(); +UpdateGUI(); return 0; } IMPL_LINK_NOARG(SvxColorWindow_Impl, StepRightClickHdl) { mrPaletteManager.NextPalette(); -Update(); +UpdateGUI(); return 0; } @@ -1255,7 +1255,7 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co { if (( nSID == SID_COLOR_TABLE ) ( pState-ISA( SvxColorListItem ))) { -Update(); +UpdateGUI(); } else if ( SFX_ITEM_DEFAULT = eState ) { @@ -2395,7 +2395,7 @@ SfxPopupWindow* SvxColorToolBoxControl::CreatePopupWindow() SvxColorWindow_Impl* pColorWin = new SvxColorWindow_Impl( m_aCommandURL, -mrPaletteManager, +mPaletteManager, GetSlotId(), m_xFrame, SVX_RESSTR( RID_SVXITEMS_EXTRAS_CHARCOLOR ), @@ -2529,7 +2529,7 @@ SfxPopupWindow* SvxLineColorToolBoxControl::CreatePopupWindow() SvxColorWindow_Impl* pColorWin = new SvxColorWindow_Impl( m_aCommandURL, -mrPaletteManager, +mPaletteManager, GetSlotId(), m_xFrame, SVX_RESSTR( RID_SVXSTR_LINECOLOR ), ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/gsoc14-colors' - include/svx svx/source
include/svx/SvxColorValueSet.hxx |1 svx/source/tbxctrls/SvxColorValueSet.cxx | 13 +++ svx/source/tbxctrls/colorwindow.hxx |3 svx/source/tbxctrls/tbcontrl.cxx | 113 ++- 4 files changed, 83 insertions(+), 47 deletions(-) New commits: commit 0d0c2fcb2fa2dfd0df8abc63e703d7f12fa6799f Author: Krisztian Pinter pin.termina...@gmail.com Date: Thu Jun 19 16:04:00 2014 +0200 Add ability to switch between default and document colors Change-Id: Ice8d58028a531b37d2c03fdc3e55eea850c53d44 diff --git a/include/svx/SvxColorValueSet.hxx b/include/svx/SvxColorValueSet.hxx index 8690a48..7502d93 100644 --- a/include/svx/SvxColorValueSet.hxx +++ b/include/svx/SvxColorValueSet.hxx @@ -39,6 +39,7 @@ public: sal_uInt32 getColumnCount() const; void addEntriesForXColorList(const XColorList rXColorList, sal_uInt32 nStartIndex = 1); +void addEntriesForColorVector(const std::vectorColor rColorVector, sal_uInt32 nStartIndex = 1); Size layoutAllVisible(sal_uInt32 nEntryCount); Size layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntryCount); }; diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx index 4f145fc..1ee94f1 100644 --- a/svx/source/tbxctrls/SvxColorValueSet.cxx +++ b/svx/source/tbxctrls/SvxColorValueSet.cxx @@ -88,6 +88,19 @@ void SvxColorValueSet::addEntriesForXColorList(const XColorList rXColorList, sa } } +void SvxColorValueSet::addEntriesForColorVector(const std::vectorColor rColorVector, sal_uInt32 nStartIndex) +{ +const sal_uInt32 nColorCount(rColorVector.size()); + +//for(sal_uInt32 nIndex(0); nIndex nColorCount; nIndex++, nStartIndex++) +for(std::vectorColor::const_iterator it = rColorVector.begin(); +it != rColorVector.end(); it++, nStartIndex++) +{ +const Color rEntry = *it; +InsertItem(nStartIndex, rEntry, ); +} +} + Size SvxColorValueSet::layoutAllVisible(sal_uInt32 nEntryCount) { if(!nEntryCount) diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx index 6bb9f92..c699986 100644 --- a/svx/source/tbxctrls/colorwindow.hxx +++ b/svx/source/tbxctrls/colorwindow.hxx @@ -49,6 +49,9 @@ private: const sal_uInt16 nNavButtonWidth; const sal_uInt16 nNavButtonHeight; sal_uInt16 rnCurrentPalette; +sal_uInt16 nNumOfPalettes; + +void ReloadColorSet(); DECL_LINK( SelectHdl, void * ); DECL_LINK( StepLeftClickHdl, void * ); diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 1c8763f..f2608bd 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1091,32 +1091,10 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUStringrCommand, maCommand( rCommand ), nNavButtonWidth ( 20 ), nNavButtonHeight( 20 ), -rnCurrentPalette( rnCurrentPalette_ ) +rnCurrentPalette( rnCurrentPalette_ ), +nNumOfPalettes( 1 ) { -SfxObjectShell* pDocSh = SfxObjectShell::Current(); -const SfxPoolItem* pItem = NULL; -XColorListRef pColorList; - -if ( pDocSh ) -{ -if ( 0 != ( pItem = pDocSh-GetItem( SID_COLOR_TABLE ) ) ) -pColorList = ( (SvxColorListItem*)pItem )-GetColorList(); -// Add doc colors to palette -XColorEntry* pEntry; -std::vectorColor aColors = pDocSh-GetDocColors(); -for( unsigned int i = 0; i aColors.size(); ++i ) -{ -pEntry = new XColorEntry( aColors[i], -Document Color + OUString::number(i) ); -pColorList-Insert( pEntry, pColorList-Count() ); -} -//- -} - -if ( !pColorList.is() ) -pColorList = XColorList::CreateStdColorList(); - if ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR == theSlotId ) { aColorSet.SetStyle( aColorSet.GetStyle() | WB_NONEFIELD ); @@ -1148,29 +1126,16 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUStringrCommand, aColorSet.SetAccessibleName( SVX_RESSTR( RID_SVXSTR_LINECOLOR ) ); } -if ( pColorList.is() ) -{ -const long nColorCount(pColorList-Count()); -const Size aNewSize(aColorSet.layoutAllVisible(nColorCount)); -aColorSet.SetOutputSizePixel(aNewSize); -static sal_Int32 nAdd = 4; +if( SfxObjectShell::Current()-GetDocColors().size() 0 ) +nNumOfPalettes++; -SetOutputSizePixel(Size(aNewSize.Width() + nAdd, aNewSize.Height() + nAdd + nNavButtonHeight)); -aColorSet.Clear(); -aColorSet.addEntriesForXColorList(*pColorList); +aButtonLeft.SetText(); +aButtonLeft.SetClickHdl( LINK( this, SvxColorWindow_Impl, StepLeftClickHdl ) ); +aButtonLeft.Show(); -aButtonLeft.SetText(); -aButtonLeft.SetClickHdl( LINK( this, SvxColorWindow_Impl, StepLeftClickHdl ) ); -
[Libreoffice-commits] core.git: Branch 'feature/gsoc14-colors' - include/svx svx/source
include/svx/tbcontrl.hxx|4 +- svx/source/tbxctrls/colorwindow.hxx | 10 +- svx/source/tbxctrls/tbcontrl.cxx| 55 3 files changed, 56 insertions(+), 13 deletions(-) New commits: commit 02fce2a4074d0e8e90c46da6059863ae6dd02838 Author: Krisztian Pinter pin.termina...@gmail.com Date: Tue Jun 17 18:56:29 2014 +0200 Add navigation buttons to SvxColorWindow_Impl Change-Id: I346af872f78396d51a458539f7d3038fc63dad8e diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx index 1694d13..b1b578f 100644 --- a/include/svx/tbcontrl.hxx +++ b/include/svx/tbcontrl.hxx @@ -221,6 +221,7 @@ class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl ::boost::scoped_ptr ::svx::ToolboxButtonColorUpdater pBtnUpdater; Color mLastColor; +sal_uInt16 nCurrentPalette; DECL_LINK( SelectedHdl, Color* ); public: SFX_DECL_TOOLBOX_CONTROL(); @@ -240,7 +241,8 @@ public: class SVX_DLLPUBLIC SvxLineColorToolBoxControl : public SfxToolBoxControl { ::boost::scoped_ptr ::svx::ToolboxButtonColorUpdater pBtnUpdater; -Color mLastColor; +Color mLastColor; +sal_uInt16 nCurrentPalette; DECL_LINK( SelectedHdl, Color* ); public: SFX_DECL_TOOLBOX_CONTROL(); diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx index 6ed74f3..6bb9f92 100644 --- a/svx/source/tbxctrls/colorwindow.hxx +++ b/svx/source/tbxctrls/colorwindow.hxx @@ -41,11 +41,18 @@ class SvxColorWindow_Impl : public SfxPopupWindow private: const sal_uInt16 theSlotId; SvxColorValueSet aColorSet; -SvxColorValueSet aDocColorSet; +PushButton aButtonLeft; +PushButton aButtonRight; OUString maCommand; Link maSelectedLink; +const sal_uInt16 nNavButtonWidth; +const sal_uInt16 nNavButtonHeight; +sal_uInt16 rnCurrentPalette; + DECL_LINK( SelectHdl, void * ); +DECL_LINK( StepLeftClickHdl, void * ); +DECL_LINK( StepRightClickHdl, void * ); protected: virtual voidResize() SAL_OVERRIDE; @@ -53,6 +60,7 @@ protected: public: SvxColorWindow_Impl( const OUString rCommand, + sal_uInt16 rnCurrentPalette_, sal_uInt16 nSlotId, const ::com::sun::star::uno::Reference ::com::sun::star::frame::XFrame rFrame, const OUString rWndTitle, diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index dd2c7b8..1c8763f 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -102,7 +102,7 @@ // don't make more than 15 entries visible at once #define MAX_STYLES_ENTRIES static_cast sal_uInt16 ( 15 ) -static void lcl_ResizeValueSet( Window rWin, ValueSet rValueSet ); +static void lcl_ResizeValueSet( Window rWin, ValueSet rValueSet, sal_uInt16 nVertPadding ); static void lcl_CalcSizeValueSet( Window rWin, ValueSet rValueSet, const Size aItemSize ); // namespaces @@ -1076,6 +1076,7 @@ void SvxFontNameBox_Impl::Select() #endif SvxColorWindow_Impl::SvxColorWindow_Impl( const OUStringrCommand, + sal_uInt16 rnCurrentPalette_, sal_uInt16 nSlotId, const Reference XFrame rFrame, const OUStringrWndTitle, @@ -1085,8 +1086,12 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUStringrCommand, theSlotId( nSlotId ), aColorSet ( this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT) ), -aDocColorSet( this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT) ), -maCommand( rCommand ) +aButtonLeft ( this ), +aButtonRight( this ), +maCommand( rCommand ), +nNavButtonWidth ( 20 ), +nNavButtonHeight( 20 ), +rnCurrentPalette( rnCurrentPalette_ ) { SfxObjectShell* pDocSh = SfxObjectShell::Current(); @@ -1150,9 +1155,21 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUStringrCommand, aColorSet.SetOutputSizePixel(aNewSize); static sal_Int32 nAdd = 4; -SetOutputSizePixel(Size(aNewSize.Width() + nAdd, aNewSize.Height() + nAdd)); +SetOutputSizePixel(Size(aNewSize.Width() + nAdd, aNewSize.Height() + nAdd + nNavButtonHeight)); aColorSet.Clear(); aColorSet.addEntriesForXColorList(*pColorList); + +aButtonLeft.SetText(); +aButtonLeft.SetClickHdl( LINK( this, SvxColorWindow_Impl, StepLeftClickHdl ) ); +aButtonLeft.SetSizePixel(Size(nNavButtonWidth, nNavButtonHeight)); +aButtonLeft.SetPosPixel(Point(0, aNewSize.Height() + nAdd + 1)); +aButtonLeft.Show(); +