[Libreoffice-commits] core.git: 2 commits - svx/source

Katarina Behrens Katarina.Behrens at cib.de
Thu Jun 4 06:18:26 PDT 2015


 svx/source/tbxctrls/tbcontrl.cxx |  101 ++++++++++++++++++++++++---------------
 1 file changed, 63 insertions(+), 38 deletions(-)

New commits:
commit 42f4a65103a1a6d281ea201392aae97213421ff4
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Thu Jun 4 12:11:42 2015 +0200

    tdf#91840: Default to transparent text background
    
    (+ label the button)
    
    Change-Id: Icc6a0c5e3e715bcfe1392496bef2514fd1bdb62b

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 9db5611..2e668f2 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1230,6 +1230,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
     {
         case SID_ATTR_CHAR_COLOR_BACKGROUND:
         case SID_BACKGROUND_COLOR:
+        case SID_ATTR_CHAR_BACK_COLOR:
         {
             mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_TRANSPARENT ) );
             mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_BACKGROUND ) );
@@ -1380,6 +1381,7 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, AutoColorClickHdl)
     {
         case SID_ATTR_CHAR_COLOR_BACKGROUND:
         case SID_BACKGROUND_COLOR:
+        case SID_ATTR_CHAR_BACK_COLOR:
         {
             aColor = COL_TRANSPARENT;
             break;
commit 0deb0326b32cdb2b90b620b3403128196c2d4d74
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Thu Jun 4 12:07:24 2015 +0200

    Use switch-case instead of overly long 'if (a || b || ...)'
    
    they were growing a bit out of control
    
    Change-Id: I80441179b4d4aacc57c469fc8f3a3937866ceae8

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 25847fa..9db5611 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1226,43 +1226,54 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
     mpColorSet->SetStyle( WinBits(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT | WB_TABSTOP) );
     mpRecentColorSet->SetStyle( WinBits(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT | WB_TABSTOP) );
 
-    if ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR == theSlotId )
+    switch ( theSlotId )
     {
-        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 )
-    {
-        SfxPoolItem* pDummy;
-
-        Reference< XDispatchProvider > aDisp( GetFrame()->getController(), UNO_QUERY );
-        SfxQueryStatus aQueryStatus( aDisp,
-                                     SID_ATTR_AUTO_COLOR_INVALID,
-                                     OUString( ".uno:AutoColorInvalid" ));
-        SfxItemState eState = aQueryStatus.QueryState( pDummy );
-        if( (SfxItemState::DEFAULT > eState) || ( SID_EXTRUSION_3D_COLOR == theSlotId ) )
+        case SID_ATTR_CHAR_COLOR_BACKGROUND:
+        case SID_BACKGROUND_COLOR:
         {
-            mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) );
-            mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_TEXTCOLOR ) );
+            mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_TRANSPARENT ) );
+            mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_BACKGROUND ) );
+            break;
+        }
+        case SID_ATTR_CHAR_COLOR:
+        case SID_ATTR_CHAR_COLOR2:
+        case SID_EXTRUSION_3D_COLOR:
+        {
+            SfxPoolItem* pDummy;
+
+            Reference< XDispatchProvider > aDisp( GetFrame()->getController(), UNO_QUERY );
+            SfxQueryStatus aQueryStatus( aDisp,
+                                         SID_ATTR_AUTO_COLOR_INVALID,
+                                         OUString( ".uno:AutoColorInvalid" ));
+            SfxItemState eState = aQueryStatus.QueryState( pDummy );
+            if( (SfxItemState::DEFAULT > eState) || ( SID_EXTRUSION_3D_COLOR == theSlotId ) )
+            {
+                mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) );
+                mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_TEXTCOLOR ) );
+            }
+            break;
+        }
+        case SID_FRAME_LINECOLOR:
+        {
+            mpButtonAutoColor->Hide();
+            mpAutomaticSeparator->Hide();
+            mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_FRAME_COLOR ) );
+            break;
+        }
+        case SID_ATTR_LINE_COLOR:
+        {
+            mpButtonAutoColor->Hide();
+            mpAutomaticSeparator->Hide();
+            mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_LINECOLOR ) );
+            break;
+        }
+        case SID_ATTR_FILL_COLOR:
+        {
+            mpButtonAutoColor->Hide();
+            mpAutomaticSeparator->Hide();
+            mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_FILLCOLOR ) );
+            break;
         }
-    }
-    else if ( SID_FRAME_LINECOLOR == theSlotId )
-    {
-        mpButtonAutoColor->Hide();
-        mpAutomaticSeparator->Hide();
-        mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_FRAME_COLOR ) );
-    }
-    else if ( SID_ATTR_LINE_COLOR == theSlotId )
-    {
-        mpButtonAutoColor->Hide();
-        mpAutomaticSeparator->Hide();
-        mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_LINECOLOR ) );
-    }
-    else if ( SID_ATTR_FILL_COLOR == theSlotId )
-    {
-        mpButtonAutoColor->Hide();
-        mpAutomaticSeparator->Hide();
-        mpColorSet->SetAccessibleName( SVX_RESSTR( RID_SVXSTR_FILLCOLOR ) );
     }
 
     mpPaletteListBox->SetStyle( mpPaletteListBox->GetStyle() | WB_BORDER | WB_AUTOSIZE );
@@ -1365,10 +1376,22 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectPaletteHdl)
 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;
+    switch ( theSlotId )
+    {
+        case SID_ATTR_CHAR_COLOR_BACKGROUND:
+        case SID_BACKGROUND_COLOR:
+        {
+            aColor = COL_TRANSPARENT;
+            break;
+        }
+        case SID_ATTR_CHAR_COLOR:
+        case SID_ATTR_CHAR_COLOR2:
+        case SID_EXTRUSION_3D_COLOR:
+        {
+            aColor = COL_AUTO;
+            break;
+        }
+    }
 
     mpRecentColorSet->SetNoSelection();
 


More information about the Libreoffice-commits mailing list