summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinfried Donkers <osc@dci-electronics.nl>2012-03-01 13:41:14 +0100
committerTor Lillqvist <tlillqvist@suse.com>2012-03-01 16:57:34 +0200
commit085e8a07e61ef2d3a82e11094d8773ab17cfdb3c (patch)
tree01256813b384c338882f0386ff9fc46644d99d5d
parent54442c917d7bb6b2e955c8c8315e0352dc6d2281 (diff)
fdo#45671 calc cell background color simplified code for split button
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx4
-rw-r--r--sc/source/ui/view/formatsh.cxx22
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx1
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx12
-rw-r--r--svx/source/tbxctrls/tbxcolorupdate.cxx12
-rw-r--r--sw/source/ui/docvw/edtwin.cxx6
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)
{