include/svx/Palette.hxx | 2 +- sc/source/core/data/document10.cxx | 5 +++-- svx/source/tbxctrls/Palette.cxx | 6 ++++-- svx/source/tbxctrls/colorwindow.hxx | 4 ++-- svx/source/tbxctrls/tbcontrl.cxx | 19 ++++++++----------- svx/uiconfig/ui/colorwindow.ui | 23 ++++++++++++++--------- sw/source/core/doc/docfmt.cxx | 6 +++--- 7 files changed, 35 insertions(+), 30 deletions(-)
New commits: commit ccea0834d79545369af70a7240e3480e183a6102 Author: Krisztian Pinter <pin.termina...@gmail.com> Date: Mon Jul 28 19:18:14 2014 +0200 Change palette selection ComboBox to ListBox Change-Id: Id844781c06e37d66f3eebac9d905c58a62682cb0 diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx index 2f2d318..70db254 100644 --- a/svx/source/tbxctrls/colorwindow.hxx +++ b/svx/source/tbxctrls/colorwindow.hxx @@ -30,7 +30,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <svx/SvxColorValueSet.hxx> #include <svx/PaletteManager.hxx> -#include <vcl/combobox.hxx> +#include <vcl/lstbox.hxx> // class SvxColorWindow_Impl -------------------------------------------------- @@ -44,7 +44,7 @@ private: const sal_uInt16 theSlotId; SvxColorValueSet* mpColorSet; Size maWindowSize; - ComboBox* mpPaletteComboBox; + ListBox* mpPaletteListBox; PushButton* mpButtonPicker; OUString maCommand; Link maSelectedLink; diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 591c51a..0574948 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1032,7 +1032,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, mrPaletteManager( rPaletteManager ) { - get(mpPaletteComboBox, "palette_list_combobox"); + get(mpPaletteListBox, "palette_listbox"); get(mpButtonPicker, "color_picker_button"); get(mpColorSet, "colorset"); @@ -1068,15 +1068,15 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_LINECOLOR ) ); } - mpPaletteComboBox->SetStyle( mpPaletteComboBox->GetStyle() | WB_BORDER | WB_AUTOSIZE ); - mpPaletteComboBox->SetSelectHdl( LINK( this, SvxColorWindow_Impl, SelectPaletteHdl ) ); - mpPaletteComboBox->AdaptDropDownLineCountToMaximum(); + mpPaletteListBox->SetStyle( mpPaletteListBox->GetStyle() | WB_BORDER | WB_AUTOSIZE ); + mpPaletteListBox->SetSelectHdl( LINK( this, SvxColorWindow_Impl, SelectPaletteHdl ) ); + mpPaletteListBox->AdaptDropDownLineCountToMaximum(); std::vector<OUString> aPaletteList = mrPaletteManager.GetPaletteList(); - mpPaletteComboBox->SetText( aPaletteList[ mrPaletteManager.GetPalette() ] ); for( std::vector<OUString>::iterator it = aPaletteList.begin(); it != aPaletteList.end(); ++it ) { - mpPaletteComboBox->InsertEntry( *it ); + mpPaletteListBox->InsertEntry( *it ); } + mpPaletteListBox->SelectEntryPos(mrPaletteManager.GetPalette(), true); mpButtonPicker->SetClickHdl( LINK( this, SvxColorWindow_Impl, OpenPickerClickHdl ) ); @@ -1088,7 +1088,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, AddStatusListener( maCommand ); mrPaletteManager.ReloadColorSet(*mpColorSet); - mpPaletteComboBox->Show(); + mpPaletteListBox->Show(); mpButtonPicker->Show(); mpColorSet->Show(); } @@ -1146,11 +1146,9 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectHdl) IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectPaletteHdl) { - OUString sSrchTxt = mpPaletteComboBox->GetText(); - sal_Int32 nPos = mpPaletteComboBox->GetEntryPos( sSrchTxt ); + sal_Int32 nPos = mpPaletteListBox->GetSelectEntryPos(); mrPaletteManager.SetPalette( nPos ); mrPaletteManager.ReloadColorSet(*mpColorSet); - Resize(); return 0; } @@ -1162,7 +1160,6 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, OpenPickerClickHdl) void SvxColorWindow_Impl::Resize() { - mpColorSet->layoutAllVisible(mrPaletteManager.GetColorCount()); SetOutputSizePixel(maWindowSize); } diff --git a/svx/uiconfig/ui/colorwindow.ui b/svx/uiconfig/ui/colorwindow.ui index 54b8f49..0527e78 100644 --- a/svx/uiconfig/ui/colorwindow.ui +++ b/svx/uiconfig/ui/colorwindow.ui @@ -14,15 +14,9 @@ <property name="visible">True</property> <property name="can_focus">False</property> <child> - <object class="GtkComboBox" id="palette_list_combobox"> + <object class="GtkComboBox" id="palette_listbox"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="has_entry">True</property> - <child internal-child="entry"> - <object class="GtkEntry" id="combobox-entry"> - <property name="can_focus">False</property> - </object> - </child> </object> <packing> <property name="expand">True</property> @@ -32,14 +26,14 @@ </child> <child> <object class="GtkButton" id="color_picker_button"> - <property name="label">Palette</property> + <property name="label">Color picker</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> </object> <packing> <property name="expand">False</property> - <property name="fill">True</property> + <property name="fill">False</property> <property name="position">1</property> </packing> </child> @@ -62,6 +56,17 @@ <property name="position">1</property> </packing> </child> + <child> + <object class="GtkSeparator" id="separator1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> </object> </child> </object> commit 1c5adcc87fd183282296f4f4ea84f3584525f228 Author: Krisztian Pinter <pin.termina...@gmail.com> Date: Mon Jul 28 16:21:35 2014 +0200 Make it easier to add new color attributes to GetDocColors Change-Id: I2098892fc44c7a8bde1eb30f6db1709e58925577 diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx index e723a68..902a447 100644 --- a/sc/source/core/data/document10.cxx +++ b/sc/source/core/data/document10.cxx @@ -242,6 +242,8 @@ void ScDocument::CopyCellValuesFrom( const ScAddress& rTopPos, const sc::CellVal std::vector<Color> ScDocument::GetDocColors() { + // list of color attributes to collect + const std::vector<sal_uInt16> aColAttrs({ATTR_FONT_COLOR, ATTR_BACKGROUND}); std::vector<Color> docColors; for( unsigned int nTabIx = 0; nTabIx < maTabs.size(); ++nTabIx ) @@ -265,8 +267,7 @@ std::vector<Color> ScDocument::GetDocColors() if( SFX_ITEM_SET == rItemSet.GetItemState( nWhich, false, &pItem ) ) { sal_uInt16 aWhich = pItem->Which(); - if( ATTR_FONT_COLOR == aWhich || - ATTR_BACKGROUND == aWhich ) + if( std::find(aColAttrs.begin(), aColAttrs.end(), aWhich) != aColAttrs.end() ) { Color aColor( ((SvxColorItem*)pItem)->GetValue() ); if( COL_AUTO != aColor.GetColor() && diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 15086c1..9cbcd2c 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1889,6 +1889,8 @@ void SwDoc::RenameFmt(SwFmt & rFmt, const OUString & sNewName, std::vector<Color> SwDoc::GetDocColors() { + // list of color attributes to collect + const std::vector<sal_uInt16> aColAttrs({RES_CHRATR_COLOR, RES_CHRATR_HIGHLIGHT, RES_BACKGROUND}); std::vector<Color> docColors; for(unsigned int i = 0; i < m_pNodes->Count(); ++i) @@ -1909,9 +1911,7 @@ std::vector<Color> SwDoc::GetDocColors() if( SFX_ITEM_SET == pItemSet->GetItemState( nWhich, false, &pItem ) ) { sal_uInt16 aWhich = pItem->Which(); - if( RES_CHRATR_COLOR == aWhich || - RES_CHRATR_HIGHLIGHT == aWhich || - RES_BACKGROUND == aWhich ) + if( std::find(aColAttrs.begin(), aColAttrs.end(), aWhich) != aColAttrs.end() ) { Color aColor( ((SvxColorItem*)pItem)->GetValue() ); if( COL_AUTO != aColor.GetColor() && commit 834554a743b5935a21abe2026325081f2807bb34 Author: Krisztian Pinter <pin.termina...@gmail.com> Date: Mon Jul 28 14:10:04 2014 +0200 Change NamedColor to use OUString Change-Id: Id84d761b33f12dfc50f980e61ab44565693f2e5a diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx index c659e06..2be4eb2 100644 --- a/include/svx/Palette.hxx +++ b/include/svx/Palette.hxx @@ -26,7 +26,7 @@ #include <tools/stream.hxx> -typedef std::pair<Color, OString> NamedColor; +typedef std::pair<Color, OUString> NamedColor; typedef std::vector< NamedColor > ColorList; diff --git a/svx/source/tbxctrls/Palette.cxx b/svx/source/tbxctrls/Palette.cxx index f499b98..95ebb58 100644 --- a/svx/source/tbxctrls/Palette.cxx +++ b/svx/source/tbxctrls/Palette.cxx @@ -56,7 +56,7 @@ void PaletteGPL::LoadColorSet( SvxColorValueSet& rColorSet ) it != maColors.end(); ++it) { // TODO make it->second OUString - rColorSet.InsertItem(nIx, it->first, OStringToOUString(it->second, RTL_TEXTENCODING_ASCII_US)); + rColorSet.InsertItem(nIx, it->first, it->second); ++nIx; } } @@ -129,7 +129,9 @@ void PaletteGPL::LoadPalette() if(nIndex != -1) name = aLine.copy(nIndex); - maColors.push_back(std::make_pair(Color(r, g, b), name)); + maColors.push_back(std::make_pair( + Color(r, g, b), + OStringToOUString(name, RTL_TEXTENCODING_ASCII_US))); } } while (aFile.ReadLine(aLine)); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits