svx/source/tbxctrls/colorwindow.hxx |    1 
 svx/source/tbxctrls/tbcontrl.cxx    |   40 ++++++++++++++----------------------
 svx/uiconfig/ui/colorwindow.ui      |    1 
 3 files changed, 17 insertions(+), 25 deletions(-)

New commits:
commit 746b51de3d3bb267e02df5712cadfcf03654b587
Author: Maxim Monastirsky <momonas...@gmail.com>
Date:   Thu Sep 18 15:20:33 2014 +0300

    Update the status only after colors load
    
    This is required to get the current color
    selection on the palette upon opening.
    
    Change-Id: I1660b9d17a76bf6c7ae4b6b860c7ee75c5fc857e

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 0c3c227..9562072 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1081,11 +1081,11 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const 
OUString&            rCommand,
     SetHelpId( HID_POPUP_COLOR );
     mpColorSet->SetHelpId( HID_POPUP_COLOR_CTRL );
     SetText( rWndTitle );
-    AddStatusListener( OUString( ".uno:ColorTableState" ));
-    AddStatusListener( maCommand );
 
     mrPaletteManager.ReloadColorSet(*mpColorSet);
     mrPaletteManager.ReloadRecentColorSet(*mpRecentColorSet);
+    AddStatusListener( ".uno:ColorTableState" );
+    AddStatusListener( maCommand );
 }
 
 SvxColorWindow_Impl::~SvxColorWindow_Impl()
commit 05ed3a5da62b1c552f24d559f4a35c314f23a4f0
Author: Maxim Monastirsky <momonas...@gmail.com>
Date:   Thu Sep 18 15:17:40 2014 +0300

    Adapt the code for the new automatic button
    
    It's now used instead of the 0 item of the ValueSet,
    but part of the code wasn't adapted:
    
    * Set the correct text (Automatic/No Fill) depending on
      the command.
    * Hide the button for frame/line colors, since there is
      no such thing as "Automatic" color.
    * Remove the selection and the status update code of the
      0 item.
    
    Change-Id: Ib7d3d97a16368f2a59373efd6b81a220151881d5

diff --git a/svx/source/tbxctrls/colorwindow.hxx 
b/svx/source/tbxctrls/colorwindow.hxx
index faffc67..2d25c7e 100644
--- a/svx/source/tbxctrls/colorwindow.hxx
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -41,6 +41,7 @@ private:
     ListBox*            mpPaletteListBox;
     PushButton*         mpButtonAutoColor;
     PushButton*         mpButtonPicker;
+    FixedLine*          mpAutomaticSeparator;
     OUString            maCommand;
     Link                maSelectedLink;
 
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index f6f189c..0c3c227 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1014,11 +1014,12 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const 
OUString&            rCommand,
     mnColorSetCols( 10 )
 
 {
-    get(mpPaletteListBox,   "palette_listbox");
-    get(mpButtonAutoColor,  "auto_color_button");
-    get(mpButtonPicker,     "color_picker_button");
-    get(mpColorSet,         "colorset");
-    get(mpRecentColorSet,   "recent_colorset");
+    get(mpPaletteListBox,     "palette_listbox");
+    get(mpButtonAutoColor,    "auto_color_button");
+    get(mpButtonPicker,       "color_picker_button");
+    get(mpColorSet,           "colorset");
+    get(mpRecentColorSet,     "recent_colorset");
+    get(mpAutomaticSeparator, "separator4");
 
     mpColorSet->SetStyle( WinBits(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK 
| WB_NO_DIRECTSELECT) );
     mpRecentColorSet->SetStyle( WinBits(WB_FLATVALUESET | WB_ITEMBORDER | 
WB_3DLOOK | WB_NO_DIRECTSELECT) );
@@ -1031,7 +1032,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& 
           rCommand,
 
     if ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR 
== theSlotId )
     {
-        mpColorSet->SetText( SVX_RESSTR( RID_SVXSTR_TRANSPARENT ) );
+        mpButtonAutoColor->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 )
@@ -1045,16 +1046,20 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const 
OUString&            rCommand,
         SfxItemState eState = aQueryStatus.QueryState( pDummy );
         if( (SfxItemState::DEFAULT > eState) || ( SID_EXTRUSION_3D_COLOR == 
theSlotId ) )
         {
-            mpColorSet->SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) );
+            mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) );
             mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_TEXTCOLOR ) 
);
         }
     }
     else if ( SID_FRAME_LINECOLOR == theSlotId )
     {
+        mpButtonAutoColor->Hide();
+        mpAutomaticSeparator->Hide();
         mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_FRAME_COLOR ) );
     }
     else
     {
+        mpButtonAutoColor->Hide();
+        mpAutomaticSeparator->Hide();
         mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_LINECOLOR ) );
     }
 
@@ -1099,15 +1104,7 @@ SfxPopupWindow* SvxColorWindow_Impl::Clone() const
 
 IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectHdl)
 {
-    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 = mpColorSet->GetItemColor( nItemId );
-
+    Color aColor = mpColorSet->GetItemColor( mpColorSet->GetSelectItemId() );
     /*  #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. */
@@ -1126,10 +1123,7 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectHdl)
 
 IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectRecentHdl)
 {
-    sal_uInt16 nItemId = mpRecentColorSet->GetSelectItemId();
-    Color aColor;
-    aColor = mpRecentColorSet->GetItemColor( nItemId );
-
+    Color aColor = mpRecentColorSet->GetItemColor( 
mpRecentColorSet->GetSelectItemId() );
     /*  #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. */
@@ -1227,8 +1221,6 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, 
SfxItemState eState, co
                     return;
                 }
             }
-            if ( aColor == COL_AUTO || aColor == COL_TRANSPARENT )
-                mpColorSet->SelectItem(0);
         }
     }
 }
diff --git a/svx/uiconfig/ui/colorwindow.ui b/svx/uiconfig/ui/colorwindow.ui
index 8daa9b2..0cbeaad 100644
--- a/svx/uiconfig/ui/colorwindow.ui
+++ b/svx/uiconfig/ui/colorwindow.ui
@@ -20,7 +20,6 @@
         <property name="orientation">vertical</property>
         <child>
           <object class="GtkButton" id="auto_color_button">
-            <property name="label" translatable="yes">Automatic</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">True</property>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to