From 085e8a07e61ef2d3a82e11094d8773ab17cfdb3c Mon Sep 17 00:00:00 2001 From: Winfried Donkers Date: Thu, 1 Mar 2012 13:41:14 +0100 Subject: fdo#45671 calc cell background color simplified code for split button --- sc/source/ui/inc/tabvwsh.hxx | 4 ---- sc/source/ui/view/formatsh.cxx | 22 ++-------------------- sc/source/ui/view/tabvwsh4.cxx | 1 - svx/source/tbxctrls/tbcontrl.cxx | 12 +----------- svx/source/tbxctrls/tbxcolorupdate.cxx | 12 +++++++++++- sw/source/ui/docvw/edtwin.cxx | 6 ++++-- 6 files changed, 18 insertions(+), 39 deletions(-) diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 1bd0fb1aa5ce..05e68387d8ba 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -108,7 +108,6 @@ private: static sal_uInt16 nInsertCtrlState; static sal_uInt16 nInsCellsCtrlState; static sal_uInt16 nInsObjCtrlState; - static Color aBackgroundColor; SvxHtmlOptions aHTMLOpt; ObjectSelectionType eCurOST; @@ -424,9 +423,6 @@ public: bool ExecuteRetypePassDlg(ScPasswordHash eDesiredHash); - void SetBackgroundColor( const Color& aCol ) { aBackgroundColor = aCol; } - Color GetBackgroundColor() { return aBackgroundColor; } - using ScTabView::ShowCursor; // ugly hack to call Define Names from Manage Names diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 8a91f36ed35a..5ef7d4f727be 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -1421,13 +1421,12 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); SfxBindings& rBindings = pViewData->GetBindings(); const SfxItemSet* pNewAttrs = rReq.GetArgs(); + sal_uInt16 nSlot = rReq.GetSlot(); pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox if ( !pNewAttrs ) { - sal_uInt16 nSlot = rReq.GetSlot(); - switch ( nSlot ) { case SID_ATTR_CHAR_FONT: @@ -1449,25 +1448,10 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) rBindings.Invalidate( nSlot ); } break; - - case SID_BACKGROUND_COLOR: - { - // SID_BACKGROUND_COLOR without arguments -> set background to last used color - - SvxBrushItem aBrushItem( (const SvxBrushItem&) - pTabViewShell->GetSelectionPattern()-> - GetItem( ATTR_BACKGROUND ) ); - aBrushItem.SetColor( pTabViewShell->GetBackgroundColor() ); - - pTabViewShell->ApplyAttr( aBrushItem ); - } - break; } } else { - sal_uInt16 nSlot = rReq.GetSlot(); - switch ( nSlot ) { case SID_ATTR_CHAR_OVERLINE: @@ -1642,9 +1626,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) pTabViewShell->GetSelectionPattern()-> GetItem( ATTR_BACKGROUND ) ); - Color aSet = rNewColorItem.GetValue(); - pTabViewShell->SetBackgroundColor( aSet ); - aBrushItem.SetColor( aSet ); + aBrushItem.SetColor( rNewColorItem.GetValue() ); pTabViewShell->ApplyAttr( aBrushItem ); } diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 5ad0d03b843d..f8e2ab84d788 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -109,7 +109,6 @@ using namespace com::sun::star; sal_uInt16 ScTabViewShell::nInsertCtrlState = SID_INSERT_GRAPHIC; sal_uInt16 ScTabViewShell::nInsCellsCtrlState = 0; sal_uInt16 ScTabViewShell::nInsObjCtrlState = SID_INSERT_DIAGRAM; -Color ScTabViewShell::aBackgroundColor = COL_TRANSPARENT; // ----------------------------------------------------------------------- diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index d6a3244e6cfb..b750152735ae 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2327,16 +2327,6 @@ void SvxColorExtToolBoxControl::StateChanged( bChoiceFromPalette = sal_False; switch( nSID ) { - case SID_ATTR_CHAR_COLOR_EXT : - case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT : - if ( SFX_ITEM_DONTCARE != eState ) - { - const SfxBoolItem* pBool = PTR_CAST( SfxBoolItem, pState ); - rTbx.CheckItem( nId, pBool && pBool->GetValue()); - } - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - break; - case SID_ATTR_CHAR_COLOR2 : case SID_ATTR_CHAR_COLOR_BACKGROUND : case SID_BACKGROUND_COLOR : @@ -2381,7 +2371,7 @@ void SvxColorExtToolBoxControl::Select( sal_Bool ) Sequence< PropertyValue > aArgs( 1 ); aArgs[0].Name = aParamName; - aArgs[0].Value = makeAny( GetToolBox().IsItemChecked( GetId() )); + aArgs[0].Value = makeAny( (sal_uInt32)( mLastColor.GetColor() )); Dispatch( aCommand, aArgs ); } diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index f453619994b5..5c3453a2d619 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -60,7 +60,17 @@ namespace svx mnDrawMode = TBX_UPDATER_MODE_CHAR_COLOR_NEW; DBG_ASSERT( ptrTbx, "ToolBox not found :-(" ); mbWasHiContrastMode = ptrTbx ? ( ptrTbx->GetSettings().GetStyleSettings().GetHighContrastMode() ) : sal_False; - Update(mnSlotId == SID_ATTR_CHAR_COLOR2 ? COL_BLACK : COL_GRAY); + switch( mnSlotId ) + { + case SID_ATTR_CHAR_COLOR2 : + Update( COL_BLACK ); + break; + case SID_ATTR_CHAR_COLOR_BACKGROUND : + Update( COL_YELLOW ); + break; + default : + Update( COL_GRAY ); + } } // ----------------------------------------------------------------------- diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index df44378cbad8..19bdf865aed3 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -4340,11 +4340,13 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) switch( pApplyTempl->nColor ) { case SID_ATTR_CHAR_COLOR_EXT: + case SID_ATTR_CHAR_COLOR2: nId = RES_CHRATR_COLOR; - break; + break; case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT: + case SID_ATTR_CHAR_COLOR_BACKGROUND: nId = RES_CHRATR_BACKGROUND; - break; + break; } if( nId && (nsSelectionType::SEL_TXT|nsSelectionType::SEL_TBL) & eSelection) { -- cgit v1.2.3