diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-03-06 00:23:59 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-03-06 11:26:33 +0000 |
commit | 32079836d97c78cd415b8591ab9be0d5ef7a4db8 (patch) | |
tree | 959ab2316757f42a82097a187050236114487c74 /svx | |
parent | 8a8e3035045c9a72d644e56b597e7f7461134577 (diff) |
ClickLightHdl doesn't need to be a link
and ClickLightHdl always takes a non-NULL argument, so NULL test is
pointless. Turn it into a normal method that takes a reference.
GetLightSource can be const. Nothing calls DoubleClickHdl, remove it.
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/svx/float3d.hxx | 6 | ||||
-rw-r--r-- | svx/source/engine3d/float3d.cxx | 67 |
2 files changed, 28 insertions, 45 deletions
diff --git a/svx/inc/svx/float3d.hxx b/svx/inc/svx/float3d.hxx index b13cb6fd995b..576965759172 100644 --- a/svx/inc/svx/float3d.hxx +++ b/svx/inc/svx/float3d.hxx @@ -230,9 +230,7 @@ private: DECL_LINK( ClickColorHdl, PushButton * ); DECL_LINK( SelectHdl, void * ); DECL_LINK( ModifyHdl, void * ); - DECL_LINK( ClickLightHdl, PushButton * ); - - DECL_LINK( DoubleClickHdl, void * ); + void ClickLight(PushButton &rBtn); DECL_LINK( ChangeLightCallbackHdl, void * ); DECL_LINK( ChangeSelectionCallbackHdl, void * ); @@ -244,7 +242,7 @@ private: SVX_DLLPRIVATE sal_uInt16 GetLightSource( const PushButton* pBtn = NULL ); SVX_DLLPRIVATE ColorLB* GetLbByButton( const PushButton* pBtn = NULL ); - SVX_DLLPRIVATE bool GetUILightState( ImageButton& aBtn ) const; + SVX_DLLPRIVATE bool GetUILightState( const ImageButton& rBtn ) const; SVX_DLLPRIVATE void SetUILightState( ImageButton& aBtn, bool bState ); protected: diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx index 0162c2e3c75f..2518c009f27c 100644 --- a/svx/source/engine3d/float3d.cxx +++ b/svx/source/engine3d/float3d.cxx @@ -483,9 +483,9 @@ void Svx3DWin::Reset() aCtlLightPreview.GetSvx3DLightControl().SelectLight(0); } -bool Svx3DWin::GetUILightState( ImageButton& aBtn ) const +bool Svx3DWin::GetUILightState( const ImageButton& rBtn ) const { - return (aBtn.GetModeImage() == aImgLightOn); + return (rBtn.GetModeImage() == aImgLightOn); } void Svx3DWin::SetUILightState( ImageButton& aBtn, bool bState ) @@ -2718,7 +2718,7 @@ IMPL_LINK( Svx3DWin, ClickHdl, PushButton *, pBtn ) aBtnLightColor.Enable( bEnable ); pLb->Enable( bEnable ); - ClickLightHdl( pBtn ); + ClickLight(*pBtn); bUpdatePreview = sal_True; } // Textures @@ -2950,45 +2950,30 @@ IMPL_LINK( Svx3DWin, ModifyHdl, void*, pField ) // ----------------------------------------------------------------------- -IMPL_LINK( Svx3DWin, ClickLightHdl, PushButton*, pBtn ) +void Svx3DWin::ClickLight(PushButton& rBtn) { - - if( pBtn ) - { - sal_uInt16 nLightSource = GetLightSource( pBtn ); - ColorLB* pLb = GetLbByButton( pBtn ); - Color aColor( pLb->GetSelectEntryColor() ); - SfxItemSet aLightItemSet(aCtlLightPreview.GetSvx3DLightControl().Get3DAttributes()); - const bool bOnOff(GetUILightState( *(ImageButton*)pBtn )); - - switch(nLightSource) - { - case 0: aLightItemSet.Put(Svx3DLightcolor1Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff1Item(bOnOff)); break; - case 1: aLightItemSet.Put(Svx3DLightcolor2Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff2Item(bOnOff)); break; - case 2: aLightItemSet.Put(Svx3DLightcolor3Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff3Item(bOnOff)); break; - case 3: aLightItemSet.Put(Svx3DLightcolor4Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff4Item(bOnOff)); break; - case 4: aLightItemSet.Put(Svx3DLightcolor5Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff5Item(bOnOff)); break; - case 5: aLightItemSet.Put(Svx3DLightcolor6Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff6Item(bOnOff)); break; - case 6: aLightItemSet.Put(Svx3DLightcolor7Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff7Item(bOnOff)); break; - default: - case 7: aLightItemSet.Put(Svx3DLightcolor8Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff8Item(bOnOff)); break; - } - - aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes(aLightItemSet); - aCtlLightPreview.GetSvx3DLightControl().SelectLight(nLightSource); - aCtlLightPreview.CheckSelection(); - } - return( 0L ); -} - - -// ----------------------------------------------------------------------- -IMPL_LINK_NOARG(Svx3DWin, DoubleClickHdl) -{ - // and assign - ClickAssignHdl( NULL ); - - return( 0L ); + sal_uInt16 nLightSource = GetLightSource( &rBtn ); + ColorLB* pLb = GetLbByButton( &rBtn ); + Color aColor( pLb->GetSelectEntryColor() ); + SfxItemSet aLightItemSet(aCtlLightPreview.GetSvx3DLightControl().Get3DAttributes()); + const bool bOnOff(GetUILightState( (const ImageButton&)rBtn )); + + switch(nLightSource) + { + case 0: aLightItemSet.Put(Svx3DLightcolor1Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff1Item(bOnOff)); break; + case 1: aLightItemSet.Put(Svx3DLightcolor2Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff2Item(bOnOff)); break; + case 2: aLightItemSet.Put(Svx3DLightcolor3Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff3Item(bOnOff)); break; + case 3: aLightItemSet.Put(Svx3DLightcolor4Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff4Item(bOnOff)); break; + case 4: aLightItemSet.Put(Svx3DLightcolor5Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff5Item(bOnOff)); break; + case 5: aLightItemSet.Put(Svx3DLightcolor6Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff6Item(bOnOff)); break; + case 6: aLightItemSet.Put(Svx3DLightcolor7Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff7Item(bOnOff)); break; + default: + case 7: aLightItemSet.Put(Svx3DLightcolor8Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff8Item(bOnOff)); break; + } + + aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes(aLightItemSet); + aCtlLightPreview.GetSvx3DLightControl().SelectLight(nLightSource); + aCtlLightPreview.CheckSelection(); } // ----------------------------------------------------------------------- |