[Libreoffice-commits] core.git: 32 commits - extras/source include/sfx2 include/svx sc/inc sc/source sd/source sfx2/source svx/Library_svxcore.mk svx/source svx/uiconfig svx/UIConfig_svx.mk sw/inc sw/source vcl/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Wed Sep 17 01:21:09 PDT 2014


 extras/source/glade/libreoffice-catalog.xml.in |    7 
 include/sfx2/objsh.hxx                         |    2 
 include/svx/Palette.hxx                        |   83 +++++++
 include/svx/PaletteManager.hxx                 |   76 ++++++
 include/svx/SvxColorValueSet.hxx               |    1 
 include/svx/tbcontrl.hxx                       |   30 --
 sc/inc/document.hxx                            |    2 
 sc/source/core/data/document10.cxx             |   51 ++++
 sc/source/ui/app/scdll.cxx                     |    2 
 sc/source/ui/docshell/docsh.cxx                |    5 
 sc/source/ui/inc/docsh.hxx                     |    2 
 sd/source/ui/app/sddll.cxx                     |    2 
 sfx2/source/doc/objcont.cxx                    |    7 
 sfx2/source/toolbox/tbxitem.cxx                |    2 
 svx/Library_svxcore.mk                         |    2 
 svx/UIConfig_svx.mk                            |    1 
 svx/source/tbxctrls/Palette.cxx                |  209 +++++++++++++++++
 svx/source/tbxctrls/PaletteManager.cxx         |  250 +++++++++++++++++++++
 svx/source/tbxctrls/SvxColorValueSet.cxx       |   22 +
 svx/source/tbxctrls/colorwindow.hxx            |   24 +-
 svx/source/tbxctrls/tbcontrl.cxx               |  293 ++++++++++++-------------
 svx/uiconfig/ui/colorwindow.ui                 |  146 ++++++++++++
 sw/inc/doc.hxx                                 |    2 
 sw/inc/docsh.hxx                               |    2 
 sw/source/core/doc/docfmt.cxx                  |   43 +++
 sw/source/uibase/app/docst.cxx                 |    5 
 sw/source/uibase/app/swmodule.cxx              |    2 
 vcl/source/app/settings.cxx                    |    2 
 28 files changed, 1095 insertions(+), 180 deletions(-)

New commits:
commit e03223d4c3cdc5d89598f0afefbd3eaee8a69736
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed Sep 17 10:18:12 2014 +0200

    Don't manually set the SvxColorWindow size
    
    Change-Id: Idd5ba4480c5323fb15dbb4c850b46e3f0604737b

diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx
index 37ca5a8..faffc67 100644
--- a/svx/source/tbxctrls/colorwindow.hxx
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -37,7 +37,7 @@ private:
     const sal_uInt16    theSlotId;
     SvxColorValueSet*   mpColorSet;
     SvxColorValueSet*   mpRecentColorSet;
-    Size                maWindowSize;
+
     ListBox*            mpPaletteListBox;
     PushButton*         mpButtonAutoColor;
     PushButton*         mpButtonPicker;
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index ae02c6e..1afb936 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1009,7 +1009,6 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
                     "palette_popup_window", "svx/ui/colorwindow.ui",
                     rFrame ),
     theSlotId( nSlotId ),
-    maWindowSize( 250, 350 ),
     maCommand( rCommand ),
     mrPaletteManager( rPaletteManager ),
     mnColorSetCols( 10 )
@@ -1186,7 +1185,6 @@ void SvxColorWindow_Impl::Resize()
 {
     mpColorSet->SetSizePixel( this->GetOutputSizePixel() );
     mpRecentColorSet->SetSizePixel( this->GetOutputSizePixel() );
-    SetOutputSizePixel(maWindowSize);
 }
 
 void SvxColorWindow_Impl::StartSelection()
commit 83eefb378bbfc6bcdc6db9630a70c32a6ef4acc8
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed Sep 17 10:16:16 2014 +0200

    Adjust color window UI & align with FloatWindow changes
    
    Change-Id: I6a402bf29af6edc153e661b28e53166c509823af

diff --git a/svx/uiconfig/ui/colorwindow.ui b/svx/uiconfig/ui/colorwindow.ui
index f33366a..d15eb42 100644
--- a/svx/uiconfig/ui/colorwindow.ui
+++ b/svx/uiconfig/ui/colorwindow.ui
@@ -1,9 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.18.3 -->
 <interface>
   <requires lib="gtk+" version="3.10"/>
+  <requires lib="LibreOffice" version="1.0"/>
   <object class="GtkWindow" id="palette_popup_window">
     <property name="can_focus">False</property>
+    <property name="hexpand">True</property>
+    <property name="vexpand">True</property>
+    <property name="border_width">6</property>
+    <property name="resizable">False</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="type_hint">popup-menu</property>
+    <property name="skip_pager_hint">True</property>
+    <property name="deletable">False</property>
     <child>
       <object class="GtkBox" id="box1">
         <property name="visible">True</property>
@@ -15,6 +24,7 @@
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">True</property>
+            <property name="relief">none</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -46,6 +56,8 @@
         </child>
         <child>
           <object class="svxlo-SvxColorValueSet" id="colorset">
+            <property name="width_request">200</property>
+            <property name="height_request">150</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">True</property>
@@ -109,6 +121,7 @@
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">True</property>
+            <property name="relief">none</property>
           </object>
           <packing>
             <property name="expand">False</property>
commit 9df22b4ac0f97346701d0284abc74499310e660f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed Sep 17 10:13:46 2014 +0200

    Add svxlo-SvxColorValueSet to the glade catalog
    
    Change-Id: I2f6e9e7dbca3b2cd8a7d712c5516b526ddda83b8

diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 12ff8b4..31dd5ee 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -364,7 +364,10 @@
     <glade-widget-class title="Document Info Preview" name="svtlo-ODocumentInfoPreview"
                         generic-name="Document Info Preview" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
-    <glade-widget-class title="SvxColorValueSet" name="svxcorelo-SvxColorValueSet"
+    <glade-widget-class title="SvxCoreColorValueSet" name="svxcorelo-SvxColorValueSet"
+                        generic-name="Set of Value Options" parent="GtkDrawingArea"
+                        icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="SvxColorValueSet" name="svxlo-SvxColorValueSet"
                         generic-name="Set of Value Options" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
     <glade-widget-class title="SwColumnValueSet" name="swuilo-ColumnValueSet"
@@ -691,7 +694,7 @@
     <glade-widget-class title="Open Document ListBox" name="dbulo-OpenDocumentListBox"
                         generic-name="Open Document ListBox" parent="GtkComboBox"
                         icon-name="widget-gtk-combobox"/>
-                        
+
     <glade-widget-class title="Fade Effect ListBox" name="sdlo-FadeEffectLB"
                         generic-name="Fade Effect ListBox" parent="GtkComboBox"
                         icon-name="widget-gtk-combobox"/>
commit 10fee3d3bcc358177ffb9578e631099b17e828c8
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Tue Sep 16 23:07:27 2014 +0200

    SFX_ITEM_SET to SfxItemState::SET
    
    Change-Id: I95dc8872d702cbe63d5fdab10a9ddd0e86d49e06

diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx
index 0e12001..8702e4c 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -270,7 +270,7 @@ std::vector<Color> ScDocument::GetDocColors()
             while( nWhich )
             {
                 const SfxPoolItem *pItem;
-                if( SFX_ITEM_SET == rItemSet.GetItemState( nWhich, false, &pItem ) )
+                if( SfxItemState::SET == rItemSet.GetItemState( nWhich, false, &pItem ) )
                 {
                     sal_uInt16 aWhich = pItem->Which();
                     if( std::find(aColAttrs.begin(), aColAttrs.end(), aWhich) != aColAttrs.end() )
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 539e3a2..4cd06b2 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1934,7 +1934,7 @@ std::vector<Color> SwDoc::GetDocColors()
         while( nWhich )
         {
             const SfxPoolItem *pItem;
-            if( SFX_ITEM_SET == pItemSet->GetItemState( nWhich, false, &pItem ) )
+            if( SfxItemState::SET == pItemSet->GetItemState( nWhich, false, &pItem ) )
             {
                 sal_uInt16 aWhich = pItem->Which();
                 if( std::find(aColAttrs.begin(), aColAttrs.end(), aWhich) != aColAttrs.end() )
commit 93c4e3c9349a1ea07b822a2824559ad28f4a9a5e
Author: Krisztian Pinter <pin.terminator at 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::pair<Color, 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_uInt16        mnMaxRecentColors;
 
-    long        mnColorCount;
+    sal_uInt16              mnNumOfPalettes;
+    sal_uInt16              mnCurrentPalette;
+
+    long                    mnColorCount;
     svx::ToolboxButtonColorUpdater* mpBtnUpdater;
 
-    Color       mLastColor;
+    Color                   mLastColor;
+    std::deque<Color>       maRecentColors;
     boost::ptr_vector<Palette> maPalettes;
 public:
     PaletteManager();
     ~PaletteManager();
     void        LoadPalettes();
     void        ReloadColorSet(SvxColorValueSet& rColorSet);
+    void        ReloadRecentColorSet(SvxColorValueSet& rColorSet);
     std::vector<OUString> GetPaletteList();
     void        SetPalette( sal_Int32 nPos );
     sal_Int32   GetPalette();
 
     long        GetColorCount();
+    long        GetRecentColorCount();
     OUString    GetPaletteName();
+
     const Color& GetLastColor();
     void        SetLastColor(const Color& rLastColor);
+    void        AddRecentColor(const Color& rRecentColor);
+
     void        SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater);
     void        PopupColorPicker(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_PREFIX    "Document 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::deque<Color>::const_iterator it = maRecentColors.begin();
+        it != maRecentColors.end(); ++it)
+    {
+        rColorSet.InsertItem(nIx, *it, "");
+        ++nIx;
+    }
+}
+
 std::vector<OUString> PaletteManager::GetPaletteList()
 {
     std::vector<OUString> 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::deque<Color>::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 );
+    if( maRecentColors.size() > mnMaxRecentColors )
+        maRecentColors.pop_back();
+}
+
 void PaletteManager::SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater)
 {
     mpBtnUpdater = pBtnUpdater;
@@ -182,6 +213,7 @@ void PaletteManager::PopupColorPicker(const OUString aCommand)
     {
         mpBtnUpdater->Update( aColorDlg.GetColor() );
         mLastColor = aColorDlg.GetColor();
+        AddRecentColor( mLastColor );
         DispatchColorCommand(aCommand, mLastColor);
     }
 }
diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx
index 68829dc..37ca5a8 100644
--- a/svx/source/tbxctrls/colorwindow.hxx
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -36,16 +36,22 @@ class SvxColorWindow_Impl : public SfxPopupWindow
 private:
     const sal_uInt16    theSlotId;
     SvxColorValueSet*   mpColorSet;
+    SvxColorValueSet*   mpRecentColorSet;
     Size                maWindowSize;
     ListBox*            mpPaletteListBox;
+    PushButton*         mpButtonAutoColor;
     PushButton*         mpButtonPicker;
     OUString            maCommand;
     Link                maSelectedLink;
 
     PaletteManager&     mrPaletteManager;
 
+    const sal_uInt16    mnColorSetCols;
+
     DECL_LINK( SelectHdl, void * );
+    DECL_LINK( SelectRecentHdl, void * );
     DECL_LINK( SelectPaletteHdl, void *);
+    DECL_LINK( AutoColorClickHdl, void * );
     DECL_LINK( OpenPickerClickHdl, void * );
 
 protected:
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index bfd275d..ae02c6e 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1011,18 +1011,27 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
     theSlotId( nSlotId ),
     maWindowSize( 250, 350 ),
     maCommand( rCommand ),
-    mrPaletteManager( rPaletteManager )
+    mrPaletteManager( rPaletteManager ),
+    mnColorSetCols( 10 )
 
 {
     get(mpPaletteListBox,   "palette_listbox");
+    get(mpButtonAutoColor,  "auto_color_button");
     get(mpButtonPicker,     "color_picker_button");
     get(mpColorSet,         "colorset");
+    get(mpRecentColorSet,   "recent_colorset");
+
+    mpColorSet->SetStyle( WinBits(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT) );
+    mpRecentColorSet->SetStyle( WinBits(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT) );
+
+    mpColorSet->SetColCount( mnColorSetCols );
+    mpColorSet->layoutAllVisible(mrPaletteManager.GetColorCount());
+    mpRecentColorSet->SetColCount( mnColorSetCols );
+    mpRecentColorSet->SetLineCount( 1 );
+    mpRecentColorSet->layoutAllVisible(mrPaletteManager.GetRecentColorCount());
 
-    mpColorSet->SetStyle( WinBits(WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT) );
-    mpColorSet->SetEdgeBlending( false );
     if ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR == theSlotId )
     {
-        mpColorSet->SetStyle( mpColorSet->GetStyle() | WB_NONEFIELD );
         mpColorSet->SetText( SVX_RESSTR( RID_SVXSTR_TRANSPARENT ) );
         mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_BACKGROUND ) );
     }
@@ -1037,7 +1046,6 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
         SfxItemState eState = aQueryStatus.QueryState( pDummy );
         if( (SfxItemState::DEFAULT > eState) || ( SID_EXTRUSION_3D_COLOR == theSlotId ) )
         {
-            mpColorSet->SetStyle( mpColorSet->GetStyle() | WB_NONEFIELD );
             mpColorSet->SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) );
             mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_TEXTCOLOR ) );
         }
@@ -1061,9 +1069,11 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
     }
     mpPaletteListBox->SelectEntryPos(mrPaletteManager.GetPalette(), true);
 
+    mpButtonAutoColor->SetClickHdl( LINK( this, SvxColorWindow_Impl, AutoColorClickHdl ) );
     mpButtonPicker->SetClickHdl( LINK( this, SvxColorWindow_Impl, OpenPickerClickHdl ) );
 
     mpColorSet->SetSelectHdl( LINK( this, SvxColorWindow_Impl, SelectHdl ) );
+    mpRecentColorSet->SetSelectHdl( LINK( this, SvxColorWindow_Impl, SelectRecentHdl ) );
     SetHelpId( HID_POPUP_COLOR );
     mpColorSet->SetHelpId( HID_POPUP_COLOR_CTRL );
     SetText( rWndTitle );
@@ -1071,9 +1081,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
     AddStatusListener( maCommand );
 
     mrPaletteManager.ReloadColorSet(*mpColorSet);
-    mpPaletteListBox->Show();
-    mpButtonPicker->Show();
-    mpColorSet->Show();
+    mrPaletteManager.ReloadRecentColorSet(*mpRecentColorSet);
 }
 
 SvxColorWindow_Impl::~SvxColorWindow_Impl()
@@ -1113,6 +1121,28 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectHdl)
         maSelectedLink.Call(&aColor);
 
     PaletteManager::DispatchColorCommand(maCommand, aColor);
+    mrPaletteManager.AddRecentColor(aColor);
+    return 0;
+}
+
+IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectRecentHdl)
+{
+    sal_uInt16 nItemId = mpRecentColorSet->GetSelectItemId();
+    Color aColor;
+    aColor = mpRecentColorSet->GetItemColor( nItemId );
+
+    /*  #i33380# DR 2004-09-03 Moved the following line above the Dispatch() calls.
+        This instance may be deleted in the meantime (i.e. when a dialog is opened
+        while in Dispatch()), accessing members will crash in this case. */
+    mpRecentColorSet->SetNoSelection();
+
+    if ( IsInPopupMode() )
+        EndPopupMode();
+
+    if ( maSelectedLink.IsSet() )
+        maSelectedLink.Call(&aColor);
+
+    PaletteManager::DispatchColorCommand(maCommand, aColor);
     return 0;
 }
 
@@ -1124,6 +1154,26 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectPaletteHdl)
     return 0;
 }
 
+IMPL_LINK_NOARG(SvxColorWindow_Impl, AutoColorClickHdl)
+{
+    Color aColor;
+    if (SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR == theSlotId)
+        aColor = COL_TRANSPARENT;
+    else if (SID_ATTR_CHAR_COLOR == theSlotId || SID_ATTR_CHAR_COLOR2 == theSlotId || SID_EXTRUSION_3D_COLOR == theSlotId)
+        aColor = COL_AUTO;
+
+    mpRecentColorSet->SetNoSelection();
+
+    if ( IsInPopupMode() )
+        EndPopupMode();
+
+    if ( maSelectedLink.IsSet() )
+        maSelectedLink.Call(&aColor);
+
+    PaletteManager::DispatchColorCommand(maCommand, aColor);
+    return 0;
+}
+
 IMPL_LINK_NOARG(SvxColorWindow_Impl, OpenPickerClickHdl)
 {
     if ( IsInPopupMode() )
@@ -1135,6 +1185,7 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, OpenPickerClickHdl)
 void SvxColorWindow_Impl::Resize()
 {
     mpColorSet->SetSizePixel( this->GetOutputSizePixel() );
+    mpRecentColorSet->SetSizePixel( this->GetOutputSizePixel() );
     SetOutputSizePixel(maWindowSize);
 }
 
@@ -1155,6 +1206,10 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co
         if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorListItem )))
         {
             mrPaletteManager.ReloadColorSet(*mpColorSet);
+            mrPaletteManager.ReloadRecentColorSet(*mpRecentColorSet);
+
+            mpColorSet->layoutAllVisible(mrPaletteManager.GetColorCount());
+            mpRecentColorSet->layoutAllVisible(mrPaletteManager.GetRecentColorCount());
         }
         else if ( SfxItemState::DEFAULT <= eState )
         {
diff --git a/svx/uiconfig/ui/colorwindow.ui b/svx/uiconfig/ui/colorwindow.ui
index 0527e78..f33366a 100644
--- a/svx/uiconfig/ui/colorwindow.ui
+++ b/svx/uiconfig/ui/colorwindow.ui
@@ -10,33 +10,11 @@
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <child>
-          <object class="GtkBox" id="box2">
+          <object class="GtkButton" id="auto_color_button">
+            <property name="label" translatable="yes">Automatic</property>
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <child>
-              <object class="GtkComboBox" id="palette_listbox">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="color_picker_button">
-                <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">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -45,6 +23,28 @@
           </packing>
         </child>
         <child>
+          <object class="GtkSeparator" id="separator4">
+            <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">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkComboBox" id="palette_listbox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
           <object class="svxlo-SvxColorValueSet" id="colorset">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
@@ -53,7 +53,7 @@
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">1</property>
+            <property name="position">3</property>
           </packing>
         </child>
         <child>
@@ -64,7 +64,67 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">2</property>
+            <property name="position">4</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">0.019999999552965164</property>
+            <property name="label" translatable="yes">Recent</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">5</property>
+          </packing>
+        </child>
+        <child>
+          <object class="svxlo-SvxColorValueSet" id="recent_colorset">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">7</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkSeparator" id="separator3">
+            <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">8</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="color_picker_button">
+            <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">False</property>
+            <property name="position">9</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkSeparator" id="separator2">
+            <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">10</property>
           </packing>
         </child>
       </object>
commit 43b896d20abf500a882fc67f16cd0902918e5794
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date:   Tue Aug 5 17:21:08 2014 +0200

    Make small UI tweaks to SvxColorWindow_Impl
    
    Change-Id: I604cbf8ca6f7ebb14c1c95e62f997c3150370119

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index cdd6e97..bfd275d 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1019,6 +1019,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
     get(mpColorSet,         "colorset");
 
     mpColorSet->SetStyle( WinBits(WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT) );
+    mpColorSet->SetEdgeBlending( false );
     if ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR == theSlotId )
     {
         mpColorSet->SetStyle( mpColorSet->GetStyle() | WB_NONEFIELD );
@@ -1133,6 +1134,7 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, OpenPickerClickHdl)
 
 void SvxColorWindow_Impl::Resize()
 {
+    mpColorSet->SetSizePixel( this->GetOutputSizePixel() );
     SetOutputSizePixel(maWindowSize);
 }
 
commit 67bde2460bab738701765f345863c969aa77a8ae
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date:   Tue Aug 5 15:39:20 2014 +0200

    Remove redundant class SvxLineColorToolBoxControl
    
    Change-Id: I882ee959baae429307218d3076a2a198ff960ddd

diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 762f33d..3d2fa35 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -42,7 +42,8 @@
         SvxColorToolBoxControl
         ----------------------
         Item type:      SvxColorItem
-                    and SfxBoolItem
+                        SfxBoolItem
+                    and XLineColorItem
 
         for font color (writer, ...)
         Execute-Id      SID_ATTR_CHAR_COLOR2
@@ -66,9 +67,7 @@
         for 3D extrusion
         Execute-Id      SID_EXTRUSION_3D_COLOR
 
-        SvxLineColorToolBoxControl
-        --------------------------
-        Item type:      XLineColorItem
+        for line color
         Execute-Id      SID_ATTR_LINE_COLOR
 
         SvxPatternToolBoxControl
@@ -236,26 +235,6 @@ public:
 };
 
 
-// class SvxLineColorToolBoxControl --------------------------------------
-
-class SVX_DLLPUBLIC SvxLineColorToolBoxControl : public SfxToolBoxControl
-{
-    ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > pBtnUpdater;
-    PaletteManager                      mPaletteManager;
-    DECL_LINK( SelectedHdl, Color* );
-public:
-    SFX_DECL_TOOLBOX_CONTROL();
-    SvxLineColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
-    virtual ~SvxLineColorToolBoxControl();
-
-    virtual void                StateChanged( sal_uInt16 nSID, SfxItemState eState,
-                                              const SfxPoolItem* pState ) SAL_OVERRIDE;
-    virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
-    virtual void                Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE;
-};
-
-
 // class SvxFrameToolBoxControl ------------------------------------------
 
 class SVX_DLLPUBLIC SvxFrameToolBoxControl : public SfxToolBoxControl
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 12c40a5..2772993 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -171,7 +171,7 @@ void ScDLL::Init()
     SvxFillToolBoxControl           ::RegisterControl(0, pMod);
     SvxLineStyleToolBoxControl      ::RegisterControl(0, pMod);
     SvxLineWidthToolBoxControl      ::RegisterControl(0, pMod);
-    SvxLineColorToolBoxControl      ::RegisterControl(0, pMod);
+    SvxColorToolBoxControl          ::RegisterControl(0, pMod);
     SvxLineEndToolBoxControl        ::RegisterControl(SID_ATTR_LINEEND_STYLE,   pMod);
     SvxStyleToolBoxControl          ::RegisterControl(SID_STYLE_APPLY,          pMod);
     SvxFontNameToolBoxControl       ::RegisterControl(SID_ATTR_CHAR_FONT,       pMod);
diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx
index a29b6f7..22c21f0 100644
--- a/sd/source/ui/app/sddll.cxx
+++ b/sd/source/ui/app/sddll.cxx
@@ -207,7 +207,7 @@ void SdDLL::RegisterControllers()
     SvxFillToolBoxControl::RegisterControl(0, pMod);
     SvxLineStyleToolBoxControl::RegisterControl(0, pMod);
     SvxLineWidthToolBoxControl::RegisterControl(0, pMod);
-    SvxLineColorToolBoxControl::RegisterControl(0, pMod);
+    SvxColorToolBoxControl::RegisterControl(0, pMod);
 
     SvxLineEndToolBoxControl::RegisterControl( SID_ATTR_LINEEND_STYLE, pMod );
 
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 64e00e7..cdd6e97 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -108,8 +108,6 @@ using namespace ::com::sun::star::lang;
 
 SFX_IMPL_TOOLBOX_CONTROL( SvxStyleToolBoxControl, SfxTemplateItem );
 SFX_IMPL_TOOLBOX_CONTROL( SvxFontNameToolBoxControl, SvxFontItem );
-SFX_IMPL_TOOLBOX_CONTROL( SvxColorToolBoxControl, SvxColorItem );
-SFX_IMPL_TOOLBOX_CONTROL( SvxLineColorToolBoxControl, XLineColorItem );
 SFX_IMPL_TOOLBOX_CONTROL( SvxFrameToolBoxControl, SvxBoxItem );
 SFX_IMPL_TOOLBOX_CONTROL( SvxFrameLineStyleToolBoxControl, SvxLineItem );
 SFX_IMPL_TOOLBOX_CONTROL( SvxSimpleUndoRedoController, SfxStringItem );
@@ -2329,73 +2327,18 @@ void SvxColorToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/)
     Dispatch( aCommand, aArgs );
 }
 
-// class SvxLineColorToolBoxControl ----------------------------------------
-
-SvxLineColorToolBoxControl::SvxLineColorToolBoxControl(
-    sal_uInt16 nSlotId,
-    sal_uInt16 nId,
-    ToolBox& rTbx ) :
-
-    SfxToolBoxControl( nSlotId, nId, rTbx )
-{
-    rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
-    addStatusListener( OUString( ".uno:XLineColor" ) );
-    pBtnUpdater.reset( new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox() ) );
-    mPaletteManager.SetLastColor( COL_BLACK );
-    mPaletteManager.SetBtnUpdater( pBtnUpdater.get() );
-}
-
-SvxLineColorToolBoxControl::~SvxLineColorToolBoxControl()
-{
-}
-
-SfxPopupWindowType SvxLineColorToolBoxControl::GetPopupWindowType() const
-{
-    return SFX_POPUPWINDOW_ONTIMEOUT;
-}
-
-SfxPopupWindow* SvxLineColorToolBoxControl::CreatePopupWindow()
-{
-    SvxColorWindow_Impl* pColorWin =
-        new SvxColorWindow_Impl(
-                            m_aCommandURL,
-                            mPaletteManager,
-                            GetSlotId(),
-                            m_xFrame,
-                            SVX_RESSTR( RID_SVXSTR_LINECOLOR ),
-                            &GetToolBox() );
-
-    pColorWin->StartPopupMode( &GetToolBox(),
-        FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
-    pColorWin->StartSelection();
-    SetPopupWindow( pColorWin );
-    pColorWin->SetSelectedHdl( LINK( this, SvxLineColorToolBoxControl, SelectedHdl ) );
-    return pColorWin;
-}
-
-IMPL_LINK(SvxLineColorToolBoxControl, SelectedHdl, Color*, pColor)
+SfxToolBoxControl* SvxColorToolBoxControl::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx )
 {
-    pBtnUpdater->Update( *pColor );
-    mPaletteManager.SetLastColor( *pColor );
-    return 0;
+    return new SvxColorToolBoxControl( nSlotId, nId, rTbx );
 }
 
-void SvxLineColorToolBoxControl::StateChanged(
-    sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* /*pState*/ )
+void SvxColorToolBoxControl::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod)
 {
-    ToolBox& rTbx = GetToolBox();
-    sal_uInt16 nId = GetId();
-    rTbx.EnableItem( nId, SfxItemState::DISABLED != eState );
-    rTbx.SetItemState( nId, ( SfxItemState::DONTCARE == eState ) ? TRISTATE_INDET : TRISTATE_FALSE );
+    SfxToolBoxControl::RegisterToolBoxControl( pMod, new SfxTbxCtrlFactory( SvxColorToolBoxControl::CreateImpl, TYPE(SvxColorItem), nSlotId ) );
+    SfxToolBoxControl::RegisterToolBoxControl( pMod, new SfxTbxCtrlFactory( SvxColorToolBoxControl::CreateImpl, TYPE(XLineColorItem), nSlotId ) );
 }
 
-void SvxLineColorToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/)
-{
-    Sequence< PropertyValue > aArgs( 1 );
-    aArgs[0].Name  = "XLineColor";
-    aArgs[0].Value = makeAny( (sal_uInt32)( mPaletteManager.GetLastColor().GetColor() ));
-    Dispatch( OUString( ".uno:XLineColor" ), aArgs );
-}
+// class SvxFrameToolBoxControl --------------------------------------------
 
 SvxFrameToolBoxControl::SvxFrameToolBoxControl(
     sal_uInt16      nSlotId,
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index ae7527c..ecec7df 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -320,7 +320,7 @@ void SwDLL::RegisterControls()
     SvxFillToolBoxControl::RegisterControl(SID_ATTR_FILL_STYLE, pMod );
     SvxLineStyleToolBoxControl::RegisterControl(SID_ATTR_LINE_STYLE, pMod );
     SvxLineWidthToolBoxControl::RegisterControl(SID_ATTR_LINE_WIDTH, pMod );
-    SvxLineColorToolBoxControl::RegisterControl(SID_ATTR_LINE_COLOR, pMod );
+    SvxColorToolBoxControl::RegisterControl(SID_ATTR_LINE_COLOR, pMod );
     SvxLineEndToolBoxControl::RegisterControl(SID_ATTR_LINEEND_STYLE, pMod );
 
     SvxFontNameToolBoxControl::RegisterControl(SID_ATTR_CHAR_FONT, pMod );
commit cb02490a1e35886bc2dc4a9889fdd6db742e5899
Author: Krisztian Pinter <pin.terminator at 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
+    bool            mbLoadedPalette;
+    OUString        maFPath;
     OUString        maName;
     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: */
commit b39f15cfcc28266c5c680d19eaa394960cb7c0ff
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date:   Wed Jul 30 19:45:37 2014 +0200

    Change vector<Palette*> to ptr_vector<Palette>
    
    Change-Id: I1f2832235e8d2ea3517efdce809970ed5f1c6769

diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index 9d40d48..e4144f9 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -25,12 +25,14 @@
 #include <svx/tbxcolorupdate.hxx>
 
 #include <tools/urlobj.hxx>
+#include <comphelper/processfactory.hxx>
 #include <com/sun/star/util/XURLTransformer.hpp>
 #include <com/sun/star/util/URLTransformer.hpp>
 #include <com/sun/star/frame/XDispatch.hpp>
 #include <com/sun/star/frame/Desktop.hpp>
 #include <com/sun/star/frame/XDispatchProvider.hpp>
-#include <comphelper/processfactory.hxx>
+
+#include <boost/ptr_container/ptr_vector.hpp>
 
 class PaletteManager
 {
@@ -41,7 +43,7 @@ class PaletteManager
     svx::ToolboxButtonColorUpdater* mpBtnUpdater;
 
     Color       mLastColor;
-    std::vector<Palette*> maPalettes;
+    boost::ptr_vector<Palette> maPalettes;
 public:
     PaletteManager();
     ~PaletteManager();
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index da80f23..98ae0b2 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -41,20 +41,14 @@ PaletteManager::PaletteManager() :
 
 PaletteManager::~PaletteManager()
 {
-    for( std::vector<Palette*>::iterator it = maPalettes.begin();
-         it != maPalettes.end();
-         ++it)
-    {
-        delete *it;
-    }
 }
 
 void PaletteManager::LoadPalettes()
 {
+    maPalettes.clear();
     OUString aPalPath = SvtPathOptions().GetPalettePath();
 
     osl::Directory aDir(aPalPath);
-    maPalettes.clear();
     osl::DirectoryItem aDirItem;
     osl::FileStatus aFileStat( osl_FileStatus_Mask_FileName |
                                osl_FileStatus_Mask_FileURL  |
@@ -116,7 +110,7 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet)
     }
     else
     {
-        maPalettes[mnCurrentPalette-1]->LoadColorSet( rColorSet );
+        maPalettes[mnCurrentPalette-1].LoadColorSet( rColorSet );
         mnColorCount = rColorSet.GetItemCount();
     }
 }
@@ -127,11 +121,11 @@ std::vector<OUString> PaletteManager::GetPaletteList()
 
     aPaletteNames.push_back( STR_DEFAULT_PAL );
 
-    for( std::vector<Palette*>::iterator it = maPalettes.begin();
+    for( boost::ptr_vector<Palette>::iterator it = maPalettes.begin();
          it != maPalettes.end();
          ++it)
     {
-        aPaletteNames.push_back( (*it)->GetName() );
+        aPaletteNames.push_back( (*it).GetName() );
     }
 
     aPaletteNames.push_back( STR_DOC_COLORS );
@@ -161,7 +155,7 @@ OUString PaletteManager::GetPaletteName()
     else if( mnCurrentPalette == mnNumOfPalettes - 1 )
         return OUString( STR_DOC_COLORS );
     else
-        return maPalettes[mnCurrentPalette - 1]->GetName();
+        return maPalettes[mnCurrentPalette - 1].GetName();
 }
 
 const Color& PaletteManager::GetLastColor()
commit 1bf3b9f2da8fe6e79e1e20d57784b55958ee3db4
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date:   Wed Jul 30 17:15:49 2014 +0200

    Make color picker apply color immediately
    
    Change-Id: I38695a43ced63bd5207b631a072231d81aa7e0f9

diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index 1bd0bd1..9d40d48 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -24,6 +24,14 @@
 #include <rtl/ustring.hxx>
 #include <svx/tbxcolorupdate.hxx>
 
+#include <tools/urlobj.hxx>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/util/URLTransformer.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <comphelper/processfactory.hxx>
+
 class PaletteManager
 {
     sal_uInt16  mnNumOfPalettes;
@@ -48,7 +56,8 @@ public:
     const Color& GetLastColor();
     void        SetLastColor(const Color& rLastColor);
     void        SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater);
-    void        PopupColorPicker();
+    void        PopupColorPicker(const OUString aCommand);
+    static void DispatchColorCommand(const OUString aCommand, const Color aColor);
 };
 
 #endif // INCLUDED_SVX_PALETTEMANAGER_HXX
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index 95485ce..da80f23 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -21,7 +21,7 @@
 #include <osl/file.hxx>
 #include <unotools/pathoptions.hxx>
 #include <sfx2/objsh.hxx>
-#include "svx/drawitem.hxx"
+#include <svx/drawitem.hxx>
 #include <svx/dialogs.hrc>
 #include <svtools/colrdlg.hxx>
 
@@ -179,7 +179,7 @@ void PaletteManager::SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater)
     mpBtnUpdater = pBtnUpdater;
 }
 
-void PaletteManager::PopupColorPicker()
+void PaletteManager::PopupColorPicker(const OUString aCommand)
 {
     SvColorDialog aColorDlg( 0 );
     aColorDlg.SetColor ( mLastColor );
@@ -188,6 +188,36 @@ void PaletteManager::PopupColorPicker()
     {
         mpBtnUpdater->Update( aColorDlg.GetColor() );
         mLastColor = aColorDlg.GetColor();
+        DispatchColorCommand(aCommand, mLastColor);
+    }
+}
+
+void PaletteManager::DispatchColorCommand(const OUString aCommand, const Color aColor)
+{
+    using namespace css::uno;
+    using namespace css::frame;
+    using namespace css::beans;
+    using namespace css::util;
+
+    Reference<XComponentContext> xContext(comphelper::getProcessComponentContext());
+    Reference<XDesktop2> xDesktop = Desktop::create(xContext);
+    Reference<XDispatchProvider> xDispatchProvider(xDesktop->getCurrentFrame(), UNO_QUERY );
+    if (xDispatchProvider.is())
+    {
+        INetURLObject aObj( aCommand );
+
+        Sequence<PropertyValue> aArgs(1);
+        aArgs[0].Name = aObj.GetURLPath();
+        aArgs[0].Value = makeAny(sal_Int32(aColor.GetColor()));
+
+        URL aTargetURL;
+        aTargetURL.Complete = aCommand;
+        Reference<XURLTransformer> xURLTransformer(URLTransformer::create(comphelper::getProcessComponentContext()));
+        xURLTransformer->parseStrict(aTargetURL);
+
+        Reference<XDispatch> xDispatch = xDispatchProvider->queryDispatch(aTargetURL, OUString(), 0);
+        if (xDispatch.is())
+            xDispatch->dispatch(aTargetURL, aArgs);
     }
 }
 
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index f55fc29..64e00e7 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1102,7 +1102,6 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectHdl)
     else
         aColor = mpColorSet->GetItemColor( nItemId );
 
-    SvxColorItem aColorItem( aColor, theSlotId );
     /*  #i33380# DR 2004-09-03 Moved the following line above the Dispatch() calls.
         This instance may be deleted in the meantime (i.e. when a dialog is opened
         while in Dispatch()), accessing members will crash in this case. */
@@ -1111,20 +1110,10 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectHdl)
     if ( IsInPopupMode() )
         EndPopupMode();
 
-    INetURLObject aObj( maCommand );
-
-    Any a;
-    Sequence< PropertyValue > aArgs( 1 );
-    aArgs[0].Name = aObj.GetURLPath();
-    aColorItem.QueryValue( a );
-    aArgs[0].Value = a;
-    SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
-                                 maCommand,
-                                 aArgs );
-
     if ( maSelectedLink.IsSet() )
         maSelectedLink.Call(&aColor);
 
+    PaletteManager::DispatchColorCommand(maCommand, aColor);
     return 0;
 }
 
@@ -1138,7 +1127,9 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectPaletteHdl)
 
 IMPL_LINK_NOARG(SvxColorWindow_Impl, OpenPickerClickHdl)
 {
-    mrPaletteManager.PopupColorPicker();
+    if ( IsInPopupMode() )
+        EndPopupMode();
+    mrPaletteManager.PopupColorPicker(maCommand);
     return 0;
 }
 
commit ec4a78420e4a6ea9e3ded6c14ff8143e96f159d6
Author: Krisztian Pinter <pin.terminator at 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 df574d8..68829dc 100644
--- a/svx/source/tbxctrls/colorwindow.hxx
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -27,7 +27,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 : public SfxPopupWindow
 {
@@ -37,7 +37,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 5177544..f55fc29 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1016,7 +1016,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");
 
@@ -1052,15 +1052,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 ) );
 
@@ -1072,7 +1072,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
     AddStatusListener( maCommand );
 
     mrPaletteManager.ReloadColorSet(*mpColorSet);
-    mpPaletteComboBox->Show();
+    mpPaletteListBox->Show();
     mpButtonPicker->Show();
     mpColorSet->Show();
 }
@@ -1130,11 +1130,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;
 }
 
@@ -1146,7 +1144,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 d5109b2fcf1ed7880e7e68c70daaa2f05b0b3cea
Author: Krisztian Pinter <pin.terminator at 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 9d15099..0e12001 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -248,6 +248,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 )
@@ -271,8 +273,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 e78b524..539e3a2 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1915,6 +1915,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)
@@ -1935,9 +1937,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 78afbfa1cb0f99a62dc643fc64e38c1eaa2014f1
Author: Krisztian Pinter <pin.terminator at 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));
 }
commit 2d37d10ebdc67e38e2c96735ef38266e5a24b90f
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date:   Sat Jul 26 10:51:45 2014 +0200

    Fix build error
    
    Change-Id: I5c992189dc21683fc9e5244f4824d7c42e4ed9cd

diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index 542d316..8b9b02a 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -1233,7 +1233,7 @@ sal_uInt16 SwDocShell::MakeByExample( const OUString &rName, sal_uInt16 nFamily,
 
 std::vector<Color> SwDocShell::GetDocColors()
 {
-    return pDoc->GetDocColors();
+    return mpDoc->GetDocColors();
 }
 
 void  SwDocShell::LoadStyles( SfxObjectShell& rSource )
commit cfdefe488fedbd12f7a3daf578c889ef82e962fc
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date:   Fri Jul 25 16:45:13 2014 +0200

    Add loading .soc palettes
    
    Change-Id: Ie0d084a70d9b135658840bb7529f2099a702d280

diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx
index d31e958..c659e06 100644
--- a/include/svx/Palette.hxx
+++ b/include/svx/Palette.hxx
@@ -19,16 +19,30 @@
 #ifndef INCLUDED_SVX_PALETTE_HXX
 #define INCLUDED_SVX_PALETTE_HXX
 
+#include <svx/SvxColorValueSet.hxx>
+#include <svx/xtable.hxx>
 #include <rtl/ustring.hxx>
 #include <tools/color.hxx>
 #include <tools/stream.hxx>
 
+
+typedef std::pair<Color, OString> NamedColor;
+typedef std::vector< NamedColor > ColorList;
+
+
 class Palette
 {
 public:
-    typedef std::pair<Color, OString> NamedColor;
-    typedef std::vector< NamedColor > ColorList;
-private:
+    virtual ~Palette();
+
+    virtual const OUString&     GetName() = 0;
+    virtual void                LoadColorSet( SvxColorValueSet& rColorSet ) = 0;
+
+    virtual bool                IsValid() = 0;
+};
+
+class PaletteGPL : public Palette
+{
     bool        mbLoadedPalette;
     bool        mbValidPalette;
     OUString    maFName;
@@ -40,12 +54,28 @@ private:
     void        LoadPaletteHeader();
     void        LoadPalette();
 public:
-    Palette( const OUString &rFPath, const OUString &rFName );
+    PaletteGPL( const OUString &rFPath, const OUString &rFName );
+    virtual ~PaletteGPL();
+
+    virtual const OUString&     GetName();
+    virtual void                LoadColorSet( SvxColorValueSet& rColorSet );
+
+    virtual bool                IsValid();
+};
+
+class PaletteSOC : public Palette
+{
+    //TODO add lazy loading
+    OUString        maName;
+    XColorListRef   mpColorList;
+public:
+    PaletteSOC( const OUString &rFPath, const OUString &rFName );
+    virtual ~PaletteSOC();
 
-    const OUString&     GetName();
-    const ColorList&    GetPaletteColors();
+    virtual const OUString&     GetName();
+    virtual void                LoadColorSet( SvxColorValueSet& rColorSet );
 
-    bool                IsValid();
+    virtual bool                IsValid();
 };
 
 #endif // INCLUDED_SVX_PALETTE_HXX
diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index 925f67b..1bd0bd1 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_SVX_PALETTEMANAGER_HXX
 
 #include <svx/SvxColorValueSet.hxx>
+#include <svx/Palette.hxx>
 #include <rtl/ustring.hxx>
 #include <svx/tbxcolorupdate.hxx>
 
@@ -32,9 +33,10 @@ class PaletteManager
     svx::ToolboxButtonColorUpdater* mpBtnUpdater;
 
     Color       mLastColor;
-    std::vector<Palette> maPalettes;
+    std::vector<Palette*> maPalettes;
 public:
     PaletteManager();
+    ~PaletteManager();
     void        LoadPalettes();
     void        ReloadColorSet(SvxColorValueSet& rColorSet);
     std::vector<OUString> GetPaletteList();
diff --git a/include/svx/SvxColorValueSet.hxx b/include/svx/SvxColorValueSet.hxx
index 7db9f4c..a3130ed 100644
--- a/include/svx/SvxColorValueSet.hxx
+++ b/include/svx/SvxColorValueSet.hxx
@@ -19,7 +19,6 @@
 #ifndef INCLUDED_SVX_SVXCOLORVALUESET_HXX
 #define INCLUDED_SVX_SVXCOLORVALUESET_HXX
 
-#include <svx/Palette.hxx>
 #include <svtools/valueset.hxx>
 #include <svx/svxdllapi.h>
 
@@ -41,7 +40,6 @@ public:
 
     void addEntriesForXColorList(const XColorList& rXColorList, sal_uInt32 nStartIndex = 1);
     void loadColorVector(const std::vector<Color>& rColorVector, const OUString& rNamePrefix, sal_uInt32 nStartIndex = 1);
-    void loadPalette(Palette& rPalette);
     Size layoutAllVisible(sal_uInt32 nEntryCount);
     Size layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntryCount);
 };
diff --git a/svx/source/tbxctrls/Palette.cxx b/svx/source/tbxctrls/Palette.cxx
index f84f2d5..f499b98 100644
--- a/svx/source/tbxctrls/Palette.cxx
+++ b/svx/source/tbxctrls/Palette.cxx
@@ -19,39 +19,16 @@
 
 #include <svx/Palette.hxx>
 
-// finds first token in rStr from index, separated by whitespace
-// returns position of next token in index
-OString lcl_getToken(const OString& rStr, sal_Int32& index)
-{
-    sal_Int32 substart, toklen = 0;
-
-    while(index < rStr.getLength() &&
-          (rStr[index] == ' ' || rStr[index] == '\n' || rStr[index] == '\t'))
-        ++index;
-    if(index == rStr.getLength())
-    {
-        index = -1;
-        return OString();
-    }
-    substart = index;
 
-    while(index < rStr.getLength() &&
-          !(rStr[index] == ' ' || rStr[index] == '\n' || rStr[index] == '\t'))
-    {
-        ++index;
-        ++toklen;
-    }
+Palette::~Palette()
+{
+}
 
-    while(index < rStr.getLength() &&
-          (rStr[index] == ' ' || rStr[index] == '\n' || rStr[index] == '\t'))
-        ++index;
-    if(index == rStr.getLength())
-        index = -1;
+// PaletteGPL ------------------------------------------------------------------
 
-    return rStr.copy(substart, toklen);
-}
+OString lcl_getToken(const OString& rStr, sal_Int32& index);
 
-Palette::Palette( const OUString &rFPath, const OUString &rFName ) :
+PaletteGPL::PaletteGPL( const OUString &rFPath, const OUString &rFName ) :
     mbLoadedPalette( false ),
     mbValidPalette( false ),
     maFName( rFName ),
@@ -60,23 +37,36 @@ Palette::Palette( const OUString &rFPath, const OUString &rFName ) :
     LoadPaletteHeader();
 }
 
-const OUString& Palette::GetName()
+PaletteGPL::~PaletteGPL()
+{
+}
+
+const OUString& PaletteGPL::GetName()
 {
     return maName;
 }
 
-const Palette::ColorList& Palette::GetPaletteColors()
+void PaletteGPL::LoadColorSet( SvxColorValueSet& rColorSet )
 {
     LoadPalette();
-    return maColors;
+
+    rColorSet.Clear();
+    int nIx = 1;
+    for(ColorList::const_iterator it = maColors.begin();
+        it != maColors.end(); ++it)
+    {
+        // TODO make it->second OUString
+        rColorSet.InsertItem(nIx, it->first, OStringToOUString(it->second, RTL_TEXTENCODING_ASCII_US));
+        ++nIx;
+    }
 }
 
-bool Palette::IsValid()
+bool PaletteGPL::IsValid()
 {
     return mbValidPalette;
 }
 
-bool Palette::ReadPaletteHeader(SvFileStream& rFileStream)
+bool PaletteGPL::ReadPaletteHeader(SvFileStream& rFileStream)
 {
     OString aLine;
     OString aName;
@@ -98,14 +88,13 @@ bool Palette::ReadPaletteHeader(SvFileStream& rFileStream)
     return true;
 }
 
-//TODO make this LoadPaletteHeader and set a bool if palette is incorrect
-void Palette::LoadPaletteHeader()
+void PaletteGPL::LoadPaletteHeader()
 {
     SvFileStream aFile(maFPath, STREAM_READ);
     mbValidPalette = ReadPaletteHeader( aFile );
 }
 
-void Palette::LoadPalette()
+void PaletteGPL::LoadPalette()
 {
     if( mbLoadedPalette ) return;
     mbLoadedPalette = true;
@@ -145,4 +134,68 @@ void Palette::LoadPalette()
     } while (aFile.ReadLine(aLine));
 }
 
+// finds first token in rStr from index, separated by whitespace
+// returns position of next token in index
+OString lcl_getToken(const OString& rStr, sal_Int32& index)
+{
+    sal_Int32 substart, toklen = 0;
+    OUString aWhitespaceChars( " \n\t" );
+
+    while(index < rStr.getLength() &&
+            aWhitespaceChars.indexOf( rStr[index] ) != -1)
+        ++index;
+    if(index == rStr.getLength())
+    {
+        index = -1;
+        return OString();
+    }
+    substart = index;
+
+    //counts length of token
+    while(index < rStr.getLength() &&
+            aWhitespaceChars.indexOf( rStr[index] ) == -1 )
+    {
+        ++index;
+        ++toklen;
+    }
+
+    //counts to position of next token
+    while(index < rStr.getLength() &&
+            aWhitespaceChars.indexOf( rStr[index] ) != -1 )
+        ++index;
+    if(index == rStr.getLength())
+        index = -1;
+
+    return rStr.copy(substart, toklen);
+}
+
+// PaletteSOC ------------------------------------------------------------------
+
+PaletteSOC::PaletteSOC( const OUString &rFPath, const OUString &rFName )
+{
+    maName = rFName;
+    mpColorList = XPropertyList::AsColorList(XPropertyList::CreatePropertyListFromURL(XCOLOR_LIST, rFPath));
+    mpColorList->Load();
+}
+
+PaletteSOC::~PaletteSOC()
+{
+}
+
+const OUString& PaletteSOC::GetName()
+{
+    return maName;
+}
+
+void PaletteSOC::LoadColorSet( SvxColorValueSet& rColorSet )
+{
+    rColorSet.Clear();
+    rColorSet.addEntriesForXColorList( *mpColorList );
+}
+
+bool PaletteSOC::IsValid()
+{
+    return mpColorList.is();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index 95c351d..95485ce 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -39,6 +39,16 @@ PaletteManager::PaletteManager() :
     mnNumOfPalettes += maPalettes.size();
 }
 
+PaletteManager::~PaletteManager()
+{
+    for( std::vector<Palette*>::iterator it = maPalettes.begin();
+         it != maPalettes.end();
+         ++it)
+    {
+        delete *it;
+    }
+}
+
 void PaletteManager::LoadPalettes()
 {
     OUString aPalPath = SvtPathOptions().GetPalettePath();
@@ -57,12 +67,14 @@ void PaletteManager::LoadPalettes()
             if(aFileStat.isRegular() || aFileStat.isLink())
             {
                 OUString aFName = aFileStat.getFileName();
+                Palette* pPalette = 0;
                 if( aFName.endsWithIgnoreAsciiCase(".gpl") )
-                {
-                    Palette aPalette( aFileStat.getFileURL(), aFName );
-                    if( aPalette.IsValid() )
-                        maPalettes.push_back( aPalette );
-                }
+                    pPalette = new PaletteGPL( aFileStat.getFileURL(), aFName );
+                else if( aFName.endsWithIgnoreAsciiCase(".soc") )
+                    pPalette = new PaletteSOC( aFileStat.getFileURL(), aFName );
+
+                if( pPalette && pPalette->IsValid() )
+                    maPalettes.push_back( pPalette );
             }
         }
     }
@@ -104,10 +116,8 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet)
     }
     else
     {
-        Palette& rPal = maPalettes[mnCurrentPalette-1];
-        mnColorCount = rPal.GetPaletteColors().size();
-        rColorSet.Clear();
-        rColorSet.loadPalette(rPal);
+        maPalettes[mnCurrentPalette-1]->LoadColorSet( rColorSet );
+        mnColorCount = rColorSet.GetItemCount();
     }
 }
 
@@ -117,11 +127,11 @@ std::vector<OUString> PaletteManager::GetPaletteList()
 
     aPaletteNames.push_back( STR_DEFAULT_PAL );
 
-    for( std::vector<Palette>::iterator it = maPalettes.begin();
+    for( std::vector<Palette*>::iterator it = maPalettes.begin();
          it != maPalettes.end();
          ++it)
     {
-        aPaletteNames.push_back( it->GetName() );
+        aPaletteNames.push_back( (*it)->GetName() );
     }
 
     aPaletteNames.push_back( STR_DOC_COLORS );
@@ -151,7 +161,7 @@ OUString PaletteManager::GetPaletteName()
     else if( mnCurrentPalette == mnNumOfPalettes - 1 )
         return OUString( STR_DOC_COLORS );
     else
-        return maPalettes[mnCurrentPalette - 1].GetName();
+        return maPalettes[mnCurrentPalette - 1]->GetName();
 }
 
 const Color& PaletteManager::GetLastColor()
diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx
index e338109..2faeb6f 100644
--- a/svx/source/tbxctrls/SvxColorValueSet.cxx
+++ b/svx/source/tbxctrls/SvxColorValueSet.cxx
@@ -106,20 +106,6 @@ void SvxColorValueSet::loadColorVector(const std::vector<Color>& rColorVector, c
     }
 }
 
-
-void SvxColorValueSet::loadPalette(Palette& rPalette)
-{
-    const Palette::ColorList &rColors = rPalette.GetPaletteColors();
-    Clear();
-    int nIx = 1;
-    for(Palette::ColorList::const_iterator it = rColors.begin();
-        it != rColors.end(); ++it)
-    {
-        InsertItem(nIx, it->first, OStringToOUString(it->second, RTL_TEXTENCODING_ASCII_US));
-        ++nIx;
-    }
-}
-
 Size SvxColorValueSet::layoutAllVisible(sal_uInt32 nEntryCount)
 {
     if(!nEntryCount)
commit d1d5c9185f9d5231bdaa332d965b31b946411ac3
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date:   Thu Jul 24 12:20:21 2014 +0200

    Add SvxLineColorToolBoxControl functionality to SvxColorToolBoxControl
    
    This is the first step in merging SvxLineColorToolBoxControl into
    SvxColorToolBoxControl.
    
    Change-Id: I6a725fef5f9a08524d509b70de15c7a0202e7ed6

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 7031229..5177544 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1010,8 +1010,8 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
     SfxPopupWindow( nSlotId, pParentWindow,
                     "palette_popup_window", "svx/ui/colorwindow.ui",
                     rFrame ),
-    maWindowSize( 250, 350 ),
     theSlotId( nSlotId ),
+    maWindowSize( 250, 350 ),
     maCommand( rCommand ),
     mrPaletteManager( rPaletteManager )
 
@@ -2205,6 +2205,11 @@ SvxColorToolBoxControl::SvxColorToolBoxControl(
         case SID_EXTRUSION_3D_COLOR:
             addStatusListener( OUString( ".uno:Extrusion3DColor"));
             break;
+
+        case SID_ATTR_LINE_COLOR:
+            addStatusListener( OUString( ".uno:XLineColor" ));
+            mPaletteManager.SetLastColor( COL_BLACK );
+            break;
     }
 
     pBtnUpdater.reset( new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox() ) );
@@ -2248,6 +2253,10 @@ SfxPopupWindow* SvxColorToolBoxControl::CreatePopupWindow()
         case SID_EXTRUSION_3D_COLOR:
             pColorWin->SetText( SVX_RESSTR( RID_SVXSTR_EXTRUSION_COLOR ) );
             break;
+
+        case SID_ATTR_LINE_COLOR:
+            pColorWin->SetText( SVX_RESSTR( RID_SVXSTR_LINECOLOR ) );
+            break;
     }
 
     pColorWin->StartPopupMode( &GetToolBox(),
@@ -2319,6 +2328,11 @@ void SvxColorToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/)
             aCommand    = ".uno:Extrusion3DColor";
             aParamName  = "Extrusion3DColor";
             break;
+
+        case SID_ATTR_LINE_COLOR:
+            aCommand    = ".uno:XLineColor";
+            aParamName  = "XLineColor";
+            break;
     }
 
     Sequence< PropertyValue > aArgs( 1 );
commit 65973c5eedc0da72fffca300239a149bd7fc1aa4
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date:   Mon Jul 21 16:34:30 2014 +0200

    Convert SvxColorWindow_Impl to Widget Layout
    
    Change-Id: I8c830de56892fd8eb1c14add25f65c25046d47fd

diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 7133fef..dcd74ba 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -1189,7 +1189,7 @@ SfxPopupWindow::SfxPopupWindow(
     Window* pParentWindow,
     const OString& rID, const OUString& rUIXMLDescription,
     const Reference< XFrame >& rFrame ) :
-    FloatingWindow( pParentWindow, rID, rUIXMLDescription)
+    FloatingWindow( pParentWindow, rID, rUIXMLDescription, rFrame)
     , m_bFloating( false )
     , m_bCascading( false )
     , m_nId( nId )
diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index f313408..2e3cc8e 100644
--- a/svx/UIConfig_svx.mk
+++ b/svx/UIConfig_svx.mk
@@ -20,6 +20,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
 	svx/uiconfig/ui/asianphoneticguidedialog \
 	svx/uiconfig/ui/chineseconversiondialog \
 	svx/uiconfig/ui/chinesedictionary \
+	svx/uiconfig/ui/colorwindow \
 	svx/uiconfig/ui/compressgraphicdialog \
 	svx/uiconfig/ui/datanavigator \
 	svx/uiconfig/ui/deleteheaderdialog \
diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx
index 702cf87..df574d8 100644
--- a/svx/source/tbxctrls/colorwindow.hxx
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -34,16 +34,15 @@ class SvxColorWindow_Impl : public SfxPopupWindow
     using FloatingWindow::StateChanged;
 
 private:
-    const sal_uInt16 theSlotId;
-    SvxColorValueSet aColorSet;
-    ComboBox aPaletteComboBox;
-    PushButton aButtonPicker;
-    OUString  maCommand;
-    Link maSelectedLink;
+    const sal_uInt16    theSlotId;
+    SvxColorValueSet*   mpColorSet;
+    Size                maWindowSize;
+    ComboBox*           mpPaletteComboBox;
+    PushButton*         mpButtonPicker;
+    OUString            maCommand;
+    Link                maSelectedLink;
 
-    const sal_uInt16 nButtonWidth;
-    const sal_uInt16 nButtonHeight;
-    PaletteManager& mrPaletteManager;
+    PaletteManager&     mrPaletteManager;
 
     DECL_LINK( SelectHdl, void * );
     DECL_LINK( SelectPaletteHdl, void *);
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index f3bfbe5..7031229 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -999,28 +999,33 @@ void SvxFontNameBox_Impl::Select()
 #define WB_NO_DIRECTSELECT      ((WinBits)0x04000000)
 #endif
 
+
 SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
                                           PaletteManager&            rPaletteManager,
                                           sal_uInt16                 nSlotId,
                                           const Reference< XFrame >& rFrame,
                                           const OUString&            rWndTitle,
                                           Window*                    pParentWindow ):
-    SfxPopupWindow( nSlotId, rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ),
+
+    SfxPopupWindow( nSlotId, pParentWindow,
+                    "palette_popup_window", "svx/ui/colorwindow.ui",
+                    rFrame ),
+    maWindowSize( 250, 350 ),
     theSlotId( nSlotId ),
-    aColorSet   ( this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT) ),
-    aPaletteComboBox( this, WinBits( WB_BORDER | WB_DROPDOWN | WB_AUTOSIZE) ),
-    aButtonPicker( this ),
     maCommand( rCommand ),
-    nButtonWidth ( 28 ),
-    nButtonHeight( 28 ),
     mrPaletteManager( rPaletteManager )
 
 {
+    get(mpPaletteComboBox,  "palette_list_combobox");
+    get(mpButtonPicker,     "color_picker_button");
+    get(mpColorSet,         "colorset");
+
+    mpColorSet->SetStyle( WinBits(WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT) );
     if ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR == theSlotId )
     {
-        aColorSet.SetStyle( aColorSet.GetStyle() | WB_NONEFIELD );
-        aColorSet.SetText( SVX_RESSTR( RID_SVXSTR_TRANSPARENT ) );
-        aColorSet.SetAccessibleName( SVX_RESSTR( RID_SVXSTR_BACKGROUND ) );
+        mpColorSet->SetStyle( mpColorSet->GetStyle() | WB_NONEFIELD );
+        mpColorSet->SetText( SVX_RESSTR( RID_SVXSTR_TRANSPARENT ) );
+        mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_BACKGROUND ) );
     }
     else if ( SID_ATTR_CHAR_COLOR == theSlotId || SID_ATTR_CHAR_COLOR2 == theSlotId || SID_EXTRUSION_3D_COLOR == theSlotId )
     {
@@ -1033,45 +1038,43 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
         SfxItemState eState = aQueryStatus.QueryState( pDummy );
         if( (SfxItemState::DEFAULT > eState) || ( SID_EXTRUSION_3D_COLOR == theSlotId ) )
         {
-            aColorSet.SetStyle( aColorSet.GetStyle() | WB_NONEFIELD );
-            aColorSet.SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) );
-            aColorSet.SetAccessibleName( SVX_RESSTR( RID_SVXSTR_TEXTCOLOR ) );
+            mpColorSet->SetStyle( mpColorSet->GetStyle() | WB_NONEFIELD );
+            mpColorSet->SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) );
+            mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_TEXTCOLOR ) );
         }
     }
     else if ( SID_FRAME_LINECOLOR == theSlotId )
     {
-        aColorSet.SetAccessibleName( SVX_RESSTR( RID_SVXSTR_FRAME_COLOR ) );
+        mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_FRAME_COLOR ) );
     }
     else
     {
-        aColorSet.SetAccessibleName( SVX_RESSTR( RID_SVXSTR_LINECOLOR ) );
+        mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_LINECOLOR ) );
     }
 
-    aPaletteComboBox.SetSelectHdl( LINK( this, SvxColorWindow_Impl, SelectPaletteHdl ) );
-    aPaletteComboBox.AdaptDropDownLineCountToMaximum();
-    aPaletteComboBox.Show();
+    mpPaletteComboBox->SetStyle( mpPaletteComboBox->GetStyle() | WB_BORDER | WB_AUTOSIZE );
+    mpPaletteComboBox->SetSelectHdl( LINK( this, SvxColorWindow_Impl, SelectPaletteHdl ) );
+    mpPaletteComboBox->AdaptDropDownLineCountToMaximum();
     std::vector<OUString> aPaletteList = mrPaletteManager.GetPaletteList();
+    mpPaletteComboBox->SetText( aPaletteList[ mrPaletteManager.GetPalette() ] );
     for( std::vector<OUString>::iterator it = aPaletteList.begin(); it != aPaletteList.end(); ++it )
     {
-        aPaletteComboBox.InsertEntry( *it );
+        mpPaletteComboBox->InsertEntry( *it );
     }
-    aPaletteComboBox.SetText( aPaletteList[ mrPaletteManager.GetPalette() ] );
 
-    aButtonPicker.SetText("P");
-    aButtonPicker.SetClickHdl( LINK( this, SvxColorWindow_Impl, OpenPickerClickHdl ) );
-    aButtonPicker.Show();
+    mpButtonPicker->SetClickHdl( LINK( this, SvxColorWindow_Impl, OpenPickerClickHdl ) );
 
-    aColorSet.Show();
-
-    aColorSet.SetSelectHdl( LINK( this, SvxColorWindow_Impl, SelectHdl ) );
+    mpColorSet->SetSelectHdl( LINK( this, SvxColorWindow_Impl, SelectHdl ) );
     SetHelpId( HID_POPUP_COLOR );
-    aColorSet.SetHelpId( HID_POPUP_COLOR_CTRL );
+    mpColorSet->SetHelpId( HID_POPUP_COLOR_CTRL );
     SetText( rWndTitle );
-
     AddStatusListener( OUString( ".uno:ColorTableState" ));
     AddStatusListener( maCommand );
 
-    mrPaletteManager.ReloadColorSet(aColorSet);
+    mrPaletteManager.ReloadColorSet(*mpColorSet);
+    mpPaletteComboBox->Show();
+    mpButtonPicker->Show();
+    mpColorSet->Show();
 }
 
 SvxColorWindow_Impl::~SvxColorWindow_Impl()
@@ -1080,7 +1083,7 @@ SvxColorWindow_Impl::~SvxColorWindow_Impl()
 
 void SvxColorWindow_Impl::KeyInput( const KeyEvent& rKEvt )
 {
-    aColorSet.KeyInput(rKEvt);
+    mpColorSet->KeyInput(rKEvt);
 }
 
 SfxPopupWindow* SvxColorWindow_Impl::Clone() const
@@ -1090,20 +1093,20 @@ SfxPopupWindow* SvxColorWindow_Impl::Clone() const
 
 IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectHdl)
 {
-    sal_uInt16 nItemId = aColorSet.GetSelectItemId();
+    sal_uInt16 nItemId = mpColorSet->GetSelectItemId();
     Color aColor;
     if ( !nItemId && ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId  || SID_BACKGROUND_COLOR == theSlotId ) )
         aColor = COL_TRANSPARENT;
     else if ( !nItemId && (SID_ATTR_CHAR_COLOR == theSlotId || SID_ATTR_CHAR_COLOR2  == theSlotId || SID_EXTRUSION_3D_COLOR == theSlotId) )
         aColor = COL_AUTO;
     else
-        aColor = aColorSet.GetItemColor( nItemId );
+        aColor = mpColorSet->GetItemColor( nItemId );
 
     SvxColorItem aColorItem( aColor, theSlotId );
     /*  #i33380# DR 2004-09-03 Moved the following line above the Dispatch() calls.
         This instance may be deleted in the meantime (i.e. when a dialog is opened
         while in Dispatch()), accessing members will crash in this case. */
-    aColorSet.SetNoSelection();
+    mpColorSet->SetNoSelection();
 
     if ( IsInPopupMode() )
         EndPopupMode();
@@ -1127,10 +1130,10 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectHdl)
 
 IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectPaletteHdl)
 {
-    OUString sSrchTxt = aPaletteComboBox.GetText();
-    sal_Int32 nPos = aPaletteComboBox.GetEntryPos( sSrchTxt );
+    OUString sSrchTxt = mpPaletteComboBox->GetText();
+    sal_Int32 nPos = mpPaletteComboBox->GetEntryPos( sSrchTxt );
     mrPaletteManager.SetPalette( nPos );
-    mrPaletteManager.ReloadColorSet(aColorSet);
+    mrPaletteManager.ReloadColorSet(*mpColorSet);
     Resize();
     return 0;
 }
@@ -1143,21 +1146,13 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, OpenPickerClickHdl)
 
 void SvxColorWindow_Impl::Resize()
 {
-    const Size aSize(this->GetOutputSizePixel());
-    aColorSet.SetPosSizePixel( Point(2, nButtonHeight + 2), Size(aSize.Width()  - 4, aSize.Height() - 6 - nButtonHeight) );
-
-    const Size aNewSize(aColorSet.layoutAllVisible(mrPaletteManager.GetColorCount()));
-    aColorSet.SetOutputSizePixel(aNewSize);
-
-    SetOutputSizePixel(Size(aNewSize.Width() + 4, aNewSize.Height() + 4 + nButtonHeight));
-
-    aPaletteComboBox.SetPosSizePixel(Point(2, 0), Size(aNewSize.Width() - nButtonWidth, nButtonHeight));
-    aButtonPicker.SetPosSizePixel(Point(aNewSize.Width() + 4 - nButtonWidth, 0), Size(nButtonWidth, nButtonHeight));
+    mpColorSet->layoutAllVisible(mrPaletteManager.GetColorCount());
+    SetOutputSizePixel(maWindowSize);
 }
 
 void SvxColorWindow_Impl::StartSelection()
 {
-    aColorSet.StartSelection();
+    mpColorSet->StartSelection();
 }
 
 bool SvxColorWindow_Impl::Close()
@@ -1171,11 +1166,11 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co
     {
         if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorListItem )))
         {
-            mrPaletteManager.ReloadColorSet(aColorSet);
+            mrPaletteManager.ReloadColorSet(*mpColorSet);
         }
         else if ( SfxItemState::DEFAULT <= eState )
         {
-            aColorSet.SetNoSelection();
+            mpColorSet->SetNoSelection();
 
             Color aColor;
             if ( pState->ISA( SvxColorItem ) )
@@ -1183,16 +1178,16 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co
             else if ( pState->ISA( XLineColorItem ) )
                 aColor = ((const XLineColorItem*)pState)->GetColorValue();
 
-            for ( size_t i = 1; i <= aColorSet.GetItemCount(); ++i )
+            for ( size_t i = 1; i <= mpColorSet->GetItemCount(); ++i )
             {
-                if ( aColor == aColorSet.GetItemColor(i) )
+                if ( aColor == mpColorSet->GetItemColor(i) )
                 {
-                    aColorSet.SelectItem(i);
+                    mpColorSet->SelectItem(i);
                     return;
                 }
             }
             if ( aColor == COL_AUTO || aColor == COL_TRANSPARENT )
-                aColorSet.SelectItem(0);
+                mpColorSet->SelectItem(0);
         }
     }
 }
diff --git a/svx/uiconfig/ui/colorwindow.ui b/svx/uiconfig/ui/colorwindow.ui
new file mode 100644
index 0000000..54b8f49
--- /dev/null
+++ b/svx/uiconfig/ui/colorwindow.ui
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
+<interface>
+  <requires lib="gtk+" version="3.10"/>
+  <object class="GtkWindow" id="palette_popup_window">
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkBox" id="box1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkBox" id="box2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkComboBox" id="palette_list_combobox">
+                <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>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="color_picker_button">
+                <property name="label">Palette</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="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="svxlo-SvxColorValueSet" id="colorset">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
commit a1a52ee9fa916b4c0cc2493338ace2374c4d9563
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date:   Fri Jul 11 19:16:13 2014 +0200

    Move palette selection ComboBox to top of popup window
    
    Change-Id: Iff958cc8d2ef301a43db406aa38dd446bb2242a5

diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx
index 191c706..702cf87 100644
--- a/svx/source/tbxctrls/colorwindow.hxx
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -45,8 +45,6 @@ private:
     const sal_uInt16 nButtonHeight;
     PaletteManager& mrPaletteManager;
 
-    void UpdateGUI();
-
     DECL_LINK( SelectHdl, void * );
     DECL_LINK( SelectPaletteHdl, void *);
     DECL_LINK( OpenPickerClickHdl, void * );
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index f44f869..f3bfbe5 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -96,7 +96,6 @@
 // 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, sal_uInt16 nVertPadding );
 static void lcl_CalcSizeValueSet( Window &rWin, ValueSet &rValueSet, const Size &aItemSize );
 
 // namespaces
@@ -1059,7 +1058,6 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
     aPaletteComboBox.SetText( aPaletteList[ mrPaletteManager.GetPalette() ] );
 
     aButtonPicker.SetText("P");
-    aButtonPicker.SetSizePixel(Size(nButtonWidth, nButtonHeight));
     aButtonPicker.SetClickHdl( LINK( this, SvxColorWindow_Impl, OpenPickerClickHdl ) );
     aButtonPicker.Show();
 
@@ -1073,26 +1071,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
     AddStatusListener( OUString( ".uno:ColorTableState" ));
     AddStatusListener( maCommand );
 
-    UpdateGUI();
-}
-
-
-void SvxColorWindow_Impl::UpdateGUI()
-{
     mrPaletteManager.ReloadColorSet(aColorSet);
-
-    const Size aNewSize(aColorSet.layoutAllVisible(mrPaletteManager.GetColorCount()));
-    aColorSet.SetOutputSizePixel(aNewSize);
-    static sal_Int32 nAdd = 4;
-
-    //TODO: Move left/right buttons above the colors
-    SetOutputSizePixel(Size(aNewSize.Width() + nAdd, aNewSize.Height() + nAdd + nButtonHeight));
-
-    aPaletteComboBox.SetPosPixel(Point(0, aNewSize.Height() + nAdd + 1));
-
-    aButtonPicker.SetPosPixel(Point(aNewSize.Width() + nAdd - nButtonWidth, aNewSize.Height() + nAdd + 1));
-
-    aPaletteComboBox.SetSizePixel(Size(aNewSize.Width() - nButtonWidth, nButtonHeight));
 }
 
 SvxColorWindow_Impl::~SvxColorWindow_Impl()
@@ -1151,7 +1130,8 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectPaletteHdl)
     OUString sSrchTxt = aPaletteComboBox.GetText();
     sal_Int32 nPos = aPaletteComboBox.GetEntryPos( sSrchTxt );
     mrPaletteManager.SetPalette( nPos );
-    UpdateGUI();
+    mrPaletteManager.ReloadColorSet(aColorSet);
+    Resize();
     return 0;
 }
 
@@ -1163,7 +1143,16 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, OpenPickerClickHdl)
 
 void SvxColorWindow_Impl::Resize()
 {
-    lcl_ResizeValueSet( *this, aColorSet, nButtonHeight + 2);
+    const Size aSize(this->GetOutputSizePixel());
+    aColorSet.SetPosSizePixel( Point(2, nButtonHeight + 2), Size(aSize.Width()  - 4, aSize.Height() - 6 - nButtonHeight) );
+
+    const Size aNewSize(aColorSet.layoutAllVisible(mrPaletteManager.GetColorCount()));
+    aColorSet.SetOutputSizePixel(aNewSize);
+
+    SetOutputSizePixel(Size(aNewSize.Width() + 4, aNewSize.Height() + 4 + nButtonHeight));
+
+    aPaletteComboBox.SetPosSizePixel(Point(2, 0), Size(aNewSize.Width() - nButtonWidth, nButtonHeight));
+    aButtonPicker.SetPosSizePixel(Point(aNewSize.Width() + 4 - nButtonWidth, 0), Size(nButtonWidth, nButtonHeight));
 }
 
 void SvxColorWindow_Impl::StartSelection()
@@ -1182,7 +1171,7 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co
     {
         if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorListItem )))
         {
-            UpdateGUI();
+            mrPaletteManager.ReloadColorSet(aColorSet);
         }
         else if ( SfxItemState::DEFAULT <= eState )
         {
@@ -1420,7 +1409,8 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl)
 
 void SvxFrameWindow_Impl::Resize()
 {
-    lcl_ResizeValueSet( *this, aFrameSet, 0 );
+    const Size aSize(this->GetOutputSizePixel());
+    aFrameSet.SetPosSizePixel(Point(2,2), Size(aSize.Width() - 4, aSize.Height() - 4));
 }
 
 void SvxFrameWindow_Impl::StateChanged(
@@ -2516,14 +2506,6 @@ void SvxSimpleUndoRedoController::StateChanged( sal_uInt16, SfxItemState eState,
 
 
 
-static void lcl_ResizeValueSet( Window &rWin, ValueSet &rValueSet, sal_uInt16 nVertPadding)
-{
-    Size aSize = rWin.GetOutputSizePixel();
-    aSize.Width()  -= 4;
-    aSize.Height() -= 4 + nVertPadding;
-    rValueSet.SetPosSizePixel( Point(2,2), aSize );
-}
-
 static void lcl_CalcSizeValueSet( Window &rWin, ValueSet &rValueSet, const Size &aItemSize )
 {
     Size aSize = rValueSet.CalcWindowSizePixel( aItemSize );
commit ecbbf4c7cf26d4d38e3be10ec99eb941f6f7a16d
Author: Krisztian Pinter <pin.terminator at 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::pair<Color, OString> NamedColor;
     typedef std::vector< NamedColor > ColorList;
 private:
-    bool        mbLoaded;
-    OUString    maFname;
-    OString     maName;
+    bool        mbLoadedPalette;
+    bool        mbValidPalette;
+    OUString    maFName;
+    OUString    maFPath;
+    OUString    maName;
     ColorList   maColors;
 
-    void LoadPalette();
+    bool        ReadPaletteHeader(SvFileStream& rFileStream);
+    void        LoadPaletteHeader();
+    void        LoadPalette();
 public:
-    Palette(const OUString &rFname);
+    Palette( const OUString &rFPath, const OUString &rFName );
 
-    const OString&      GetPaletteName();
+    const OUString&     GetName();
     const ColorList&    GetPaletteColors();
+
+    bool                IsValid();
 };
 
 #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();
     void        LoadPalettes();
     void        ReloadColorSet(SvxColorValueSet& rColorSet);
-    void        PrevPalette();
-    void        NextPalette();
+    std::vector<OUString> GetPaletteList();
+    void        SetPalette( sal_Int32 nPos );
+    sal_Int32   GetPalette();
+
     long        GetColorCount();
     OUString    GetPaletteName();
     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( !mbValidPalette ) return;
+
+    OString aLine;
     do {
         if (aLine[0] != '#' && aLine[0] != '\n')
         {
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index e9933d4..95c351d 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -25,6 +25,10 @@
 #include <svx/dialogs.hrc>
 #include <svtools/colrdlg.hxx>
 
+#define STR_DEFAULT_PAL         "Default palette"
+#define STR_DOC_COLORS          "Document colors"
+#define STR_DOC_COLOR_PREFIX    "Document Color "
+
 PaletteManager::PaletteManager() :
     mnNumOfPalettes(2),
     mnCurrentPalette(0),
@@ -42,7 +46,9 @@ void PaletteManager::LoadPalettes()
     osl::Directory aDir(aPalPath);
     maPalettes.clear();
     osl::DirectoryItem aDirItem;
-    osl::FileStatus aFileStat(osl_FileStatus_Mask_FileURL|osl_FileStatus_Mask_Type);
+    osl::FileStatus aFileStat( osl_FileStatus_Mask_FileName |
+                               osl_FileStatus_Mask_FileURL  |
+                               osl_FileStatus_Mask_Type     );
     if( aDir.open() == osl::FileBase::E_None )
     {
         while( aDir.getNextItem(aDirItem) == osl::FileBase::E_None )
@@ -50,11 +56,12 @@ void PaletteManager::LoadPalettes()
             aDirItem.getFileStatus(aFileStat);
             if(aFileStat.isRegular() || aFileStat.isLink())
             {
-                OUString aPath = aFileStat.getFileURL();
-                if(aPath.getLength() > 4 &&
-                    aPath.copy(aPath.getLength()-4).toAsciiLowerCase() == ".gpl")
+                OUString aFName = aFileStat.getFileName();
+                if( aFName.endsWithIgnoreAsciiCase(".gpl") )
                 {
-                    maPalettes.push_back(Palette(aPath));
+                    Palette aPalette( aFileStat.getFileURL(), aFName );
+                    if( aPalette.IsValid() )
+                        maPalettes.push_back( aPalette );
                 }
             }
         }
@@ -93,7 +100,7 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet)
         std::vector<Color> aColors = pDocSh->GetDocColors();
         mnColorCount = aColors.size();
         rColorSet.Clear();
-        rColorSet.loadColorVector(aColors, "Document Color ");
+        rColorSet.loadColorVector(aColors, STR_DOC_COLOR_PREFIX );
     }
     else
     {
@@ -104,14 +111,32 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet)
     }
 }
 
-void PaletteManager::PrevPalette()
+std::vector<OUString> PaletteManager::GetPaletteList()
+{
+    std::vector<OUString> aPaletteNames;
+
+    aPaletteNames.push_back( STR_DEFAULT_PAL );
+
+    for( std::vector<Palette>::iterator it = maPalettes.begin();
+         it != maPalettes.end();
+         ++it)
+    {
+        aPaletteNames.push_back( it->GetName() );
+    }
+
+    aPaletteNames.push_back( STR_DOC_COLORS );
+
+    return aPaletteNames;
+}
+
+void PaletteManager::SetPalette( sal_Int32 nPos )
 {
-    mnCurrentPalette = mnCurrentPalette == 0 ? mnNumOfPalettes - 1 : mnCurrentPalette - 1;
+    mnCurrentPalette = nPos;
 }
 
-void PaletteManager::NextPalette()
+sal_Int32 PaletteManager::GetPalette()
 {
-    mnCurrentPalette = mnCurrentPalette == mnNumOfPalettes - 1 ? 0 : mnCurrentPalette + 1;
+    return mnCurrentPalette;
 }
 
 long PaletteManager::GetColorCount()
@@ -122,11 +147,11 @@ long PaletteManager::GetColorCount()
 OUString PaletteManager::GetPaletteName()
 {
     if( mnCurrentPalette == 0 )
-        return OUString("Default palette");
+        return OUString( STR_DEFAULT_PAL );
     else if( mnCurrentPalette == mnNumOfPalettes - 1 )
-        return OUString("Document colors");
+        return OUString( STR_DOC_COLORS );
     else
-        return OStringToOUString(maPalettes[mnCurrentPalette - 1].GetPaletteName(), RTL_TEXTENCODING_ASCII_US);
+        return maPalettes[mnCurrentPalette - 1].GetName();
 }
 
 const Color& PaletteManager::GetLastColor()
diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx
index bfd49e2..191c706 100644
--- a/svx/source/tbxctrls/colorwindow.hxx
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -27,6 +27,7 @@
 #include <com/sun/star/frame/XFrame.hpp>
 #include <svx/SvxColorValueSet.hxx>
 #include <svx/PaletteManager.hxx>
+#include <vcl/combobox.hxx>
 
 class SvxColorWindow_Impl : public SfxPopupWindow
 {
@@ -35,22 +36,19 @@ class SvxColorWindow_Impl : public SfxPopupWindow
 private:
     const sal_uInt16 theSlotId;
     SvxColorValueSet aColorSet;
-    PushButton aButtonLeft;
-    PushButton aButtonRight;
+    ComboBox aPaletteComboBox;
     PushButton aButtonPicker;
-    FixedText  aPaletteName;
     OUString  maCommand;
     Link maSelectedLink;
 
-    const sal_uInt16 nNavButtonWidth;
-    const sal_uInt16 nNavButtonHeight;
+    const sal_uInt16 nButtonWidth;
+    const sal_uInt16 nButtonHeight;
     PaletteManager& mrPaletteManager;
 
     void UpdateGUI();
 
     DECL_LINK( SelectHdl, void * );

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list