summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-09-08 12:45:38 +0200
committerNoel Grandin <noel@peralex.com>2015-09-09 10:06:12 +0200
commit78b124143a3c2bd82984c1c06aa3265c211cef13 (patch)
treeb48ab1bf75f7b9d548bec8b1c0427d733cc48ecf
parent6f4e11a95bcd7a591cb93d1a842bbc8ad1ed31c9 (diff)
convert Link<> to typed
Change-Id: I2f36a123662488ef5534f7bf0845d61e497fb0ec
-rw-r--r--basctl/source/basicide/baside2.hxx2
-rw-r--r--basctl/source/basicide/baside2b.cxx4
-rw-r--r--basctl/source/basicide/bastype3.hxx8
-rw-r--r--basctl/source/basicide/bastypes.cxx5
-rw-r--r--include/svtools/treelistbox.hxx4
-rw-r--r--include/vcl/accel.hxx10
-rw-r--r--sc/source/ui/inc/anyrefdg.hxx2
-rw-r--r--sc/source/ui/miscdlgs/anyrefdg.cxx8
-rw-r--r--svtools/source/contnr/imivctl1.cxx10
-rw-r--r--svtools/source/contnr/treelistbox.cxx6
-rw-r--r--vcl/inc/accmgr.hxx4
-rw-r--r--vcl/source/window/accel.cxx9
-rw-r--r--vcl/source/window/accmgr.cxx17
-rw-r--r--vcl/source/window/toolbox.cxx8
14 files changed, 35 insertions, 62 deletions
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 81351a3aeba3..fbadefdc1905 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -236,7 +236,7 @@ protected:
DECL_LINK_TYPED( ButtonHdl, Button *, void );
DECL_LINK_TYPED(TreeListHdl, SvTreeListBox*, void);
DECL_LINK_TYPED( implEndDragHdl, HeaderBar *, void );
- DECL_LINK_TYPED( EditAccHdl, Accelerator *, void );
+ DECL_LINK_TYPED( EditAccHdl, Accelerator&, void );
public:
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 95924e329404..b389792fe1b8 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1827,9 +1827,9 @@ IMPL_LINK_NOARG_TYPED( WatchWindow, implEndDragHdl, HeaderBar *, void )
}
}
-IMPL_LINK_TYPED( WatchWindow, EditAccHdl, Accelerator *, pAcc, void )
+IMPL_LINK_TYPED( WatchWindow, EditAccHdl, Accelerator&, rAcc, void )
{
- switch ( pAcc->GetCurKeyCode().GetCode() )
+ switch ( rAcc.GetCurKeyCode().GetCode() )
{
case KEY_RETURN:
{
diff --git a/basctl/source/basicide/bastype3.hxx b/basctl/source/basicide/bastype3.hxx
index 5974db7c2788..3106cf767fca 100644
--- a/basctl/source/basicide/bastype3.hxx
+++ b/basctl/source/basicide/bastype3.hxx
@@ -29,19 +29,19 @@ namespace basctl
class ExtendedEdit : public Edit
{
private:
- Accelerator aAcc;
- Link<Accelerator*,void> aAccHdl;
+ Accelerator aAcc;
+ Link<Accelerator&,void> aAccHdl;
Link<ExtendedEdit*,void> aLoseFocusHdl;
protected:
- DECL_LINK( EditAccHdl, Accelerator * );
+ DECL_LINK_TYPED( EditAccHdl, Accelerator&, void );
DECL_LINK(ImplGetFocusHdl, void *);
DECL_LINK(ImplLoseFocusHdl, void *);
public:
ExtendedEdit( vcl::Window* pParent, IDEResId nRes );
- void SetAccHdl( const Link<Accelerator*,void>& rLink ) { aAccHdl = rLink; }
+ void SetAccHdl( const Link<Accelerator&,void>& rLink ) { aAccHdl = rLink; }
Accelerator& GetAccelerator() { return aAcc; }
};
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index 8b88008adc5e..92f921c7e04f 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -452,10 +452,9 @@ IMPL_LINK_NOARG(ExtendedEdit, ImplLoseFocusHdl)
}
-IMPL_LINK( ExtendedEdit, EditAccHdl, Accelerator *, pAcc )
+IMPL_LINK_TYPED( ExtendedEdit, EditAccHdl, Accelerator&, rAcc, void )
{
- aAccHdl.Call( pAcc );
- return 0;
+ aAccHdl.Call( rAcc );
}
// TabBar
diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx
index 56b9609dea18..700a0e5d3274 100644
--- a/include/svtools/treelistbox.hxx
+++ b/include/svtools/treelistbox.hxx
@@ -822,8 +822,8 @@ class SvInplaceEdit2
void CallCallBackHdl_Impl();
DECL_LINK_TYPED( Timeout_Impl, Idle *, void );
- DECL_LINK( ReturnHdl_Impl, void * );
- DECL_LINK( EscapeHdl_Impl, void * );
+ DECL_LINK_TYPED( ReturnHdl_Impl, Accelerator&, void );
+ DECL_LINK_TYPED( EscapeHdl_Impl, Accelerator&, void );
public:
SvInplaceEdit2( vcl::Window* pParent, const Point& rPos, const Size& rSize,
diff --git a/include/vcl/accel.hxx b/include/vcl/accel.hxx
index f8491bcbf168..7e965809277c 100644
--- a/include/vcl/accel.hxx
+++ b/include/vcl/accel.hxx
@@ -36,9 +36,8 @@ class VCL_DLLPUBLIC Accelerator : public Resource
private:
ImplAccelData* mpData;
OUString maHelpStr;
- Link<> maActivateHdl;
- Link<> maDeactivateHdl;
- Link<> maSelectHdl;
+ Link<Accelerator&,void> maActivateHdl;
+ Link<Accelerator&,void> maSelectHdl;
// Will be set by AcceleratorManager
vcl::KeyCode maCurKeyCode;
@@ -69,7 +68,6 @@ public:
virtual ~Accelerator();
void Activate();
- void Deactivate();
void Select();
void InsertItem( sal_uInt16 nItemId, const vcl::KeyCode& rKeyCode );
@@ -84,8 +82,8 @@ public:
Accelerator* GetAccel( sal_uInt16 nItemId ) const;
- void SetActivateHdl( const Link<>& rLink ) { maActivateHdl = rLink; }
- void SetSelectHdl( const Link<>& rLink ) { maSelectHdl = rLink; }
+ void SetActivateHdl( const Link<Accelerator&,void>& rLink ) { maActivateHdl = rLink; }
+ void SetSelectHdl( const Link<Accelerator&,void>& rLink ) { maSelectHdl = rLink; }
Accelerator& operator=( const Accelerator& rAccel );
};
diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx
index 77b073a89751..df1f723d1dfa 100644
--- a/sc/source/ui/inc/anyrefdg.hxx
+++ b/sc/source/ui/inc/anyrefdg.hxx
@@ -69,7 +69,7 @@ class ScFormulaReferenceHelper
bool bHighlightRef;
bool bAccInserted;
- DECL_LINK( AccelSelectHdl, Accelerator* );
+ DECL_LINK_TYPED( AccelSelectHdl, Accelerator&, void );
public:
ScFormulaReferenceHelper(IAnyRefDialog* _pDlg,SfxBindings* _pBindings);
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 422ca25103c9..28ec44d1b46d 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -339,12 +339,9 @@ void ScFormulaReferenceHelper::Init()
}
}
-IMPL_LINK( ScFormulaReferenceHelper, AccelSelectHdl, Accelerator *, pSelAccel )
+IMPL_LINK_TYPED( ScFormulaReferenceHelper, AccelSelectHdl, Accelerator&, rSelAccel, void )
{
- if ( !pSelAccel )
- return long(false);
-
- switch ( pSelAccel->GetCurKeyCode().GetCode() )
+ switch ( rSelAccel.GetCurKeyCode().GetCode() )
{
case KEY_RETURN:
case KEY_ESCAPE:
@@ -353,7 +350,6 @@ IMPL_LINK( ScFormulaReferenceHelper, AccelSelectHdl, Accelerator *, pSelAccel )
m_pDlg->RefInputDone( true );
break;
}
- return long(true);
}
void ScFormulaReferenceHelper::RefInputDone( bool bForced )
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 81fb69675e3b..4c232868fa78 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -65,8 +65,8 @@ class IcnViewEdit_Impl : public MultiLineEdit
void CallCallBackHdl_Impl();
DECL_LINK_TYPED(Timeout_Impl, Idle *, void);
- DECL_LINK( ReturnHdl_Impl, Accelerator * );
- DECL_LINK( EscapeHdl_Impl, Accelerator * );
+ DECL_LINK_TYPED( ReturnHdl_Impl, Accelerator&, void );
+ DECL_LINK_TYPED( EscapeHdl_Impl, Accelerator&, void );
public:
@@ -3187,20 +3187,18 @@ IMPL_LINK_NOARG_TYPED(IcnViewEdit_Impl, Timeout_Impl, Idle *, void)
CallCallBackHdl_Impl();
}
-IMPL_LINK( IcnViewEdit_Impl, ReturnHdl_Impl, Accelerator*, )
+IMPL_LINK_NOARG_TYPED( IcnViewEdit_Impl, ReturnHdl_Impl, Accelerator&, void )
{
bCanceled = false;
bGrabFocus = true;
CallCallBackHdl_Impl();
- return 1;
}
-IMPL_LINK( IcnViewEdit_Impl, EscapeHdl_Impl, Accelerator*, )
+IMPL_LINK_NOARG_TYPED( IcnViewEdit_Impl, EscapeHdl_Impl, Accelerator&, void )
{
bCanceled = true;
bGrabFocus = true;
CallCallBackHdl_Impl();
- return 1;
}
void IcnViewEdit_Impl::KeyInput( const KeyEvent& rKEvt )
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index e2b496b79412..d5bce70a2a34 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -185,18 +185,16 @@ void SvInplaceEdit2::Hide()
}
-IMPL_LINK_NOARG(SvInplaceEdit2, ReturnHdl_Impl)
+IMPL_LINK_NOARG_TYPED(SvInplaceEdit2, ReturnHdl_Impl, Accelerator&, void)
{
bCanceled = false;
CallCallBackHdl_Impl();
- return 1;
}
-IMPL_LINK_NOARG(SvInplaceEdit2, EscapeHdl_Impl)
+IMPL_LINK_NOARG_TYPED(SvInplaceEdit2, EscapeHdl_Impl, Accelerator&, void)
{
bCanceled = true;
CallCallBackHdl_Impl();
- return 1;
}
bool SvInplaceEdit2::KeyInput( const KeyEvent& rKEvt )
diff --git a/vcl/inc/accmgr.hxx b/vcl/inc/accmgr.hxx
index 671c34715ff9..4f8e553d4bb4 100644
--- a/vcl/inc/accmgr.hxx
+++ b/vcl/inc/accmgr.hxx
@@ -45,8 +45,8 @@ public:
bool InsertAccel( Accelerator* pAccel );
void RemoveAccel( Accelerator* pAccel );
- void EndSequence( bool bCancel = false );
- void FlushAccel() { EndSequence( true ); }
+ void EndSequence();
+ void FlushAccel() { EndSequence(); }
bool IsAccelKey( const vcl::KeyCode& rKeyCode, sal_uInt16 nRepeat );
};
diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx
index 6905142f0b9d..75ea7bc7b731 100644
--- a/vcl/source/window/accel.cxx
+++ b/vcl/source/window/accel.cxx
@@ -300,17 +300,12 @@ Accelerator::~Accelerator()
void Accelerator::Activate()
{
- maActivateHdl.Call( this );
-}
-
-void Accelerator::Deactivate()
-{
- maDeactivateHdl.Call( this );
+ maActivateHdl.Call( *this );
}
void Accelerator::Select()
{
- maSelectHdl.Call( this );
+ maSelectHdl.Call( *this );
}
void Accelerator::InsertItem( sal_uInt16 nItemId, const vcl::KeyCode& rKeyCode )
diff --git a/vcl/source/window/accmgr.cxx b/vcl/source/window/accmgr.cxx
index 5bc762739c40..e855193ca7a2 100644
--- a/vcl/source/window/accmgr.cxx
+++ b/vcl/source/window/accmgr.cxx
@@ -60,7 +60,7 @@ void ImplAccelManager::RemoveAccel( Accelerator* pAccel )
Accelerator* pSubAccel = pAccel->GetAccel( pAccel->GetItemId(i) );
for ( size_t j = 0, n = mpSequenceList->size(); j < n; ++j ) {
if ( (*mpSequenceList)[ j ] == pSubAccel ) {
- EndSequence( true );
+ EndSequence();
i = pAccel->GetItemCount();
break;
}
@@ -80,25 +80,17 @@ void ImplAccelManager::RemoveAccel( Accelerator* pAccel )
}
}
-void ImplAccelManager::EndSequence( bool bCancel )
+void ImplAccelManager::EndSequence()
{
// are we in a list ?
if ( !mpSequenceList )
return;
- // call all deactivate-handler of the accelerators in the list
for ( size_t i = 0, n = mpSequenceList->size(); i < n; ++i )
{
Accelerator* pTempAccel = (*mpSequenceList)[ i ];
- bool bDel = false;
- pTempAccel->mbIsCancel = bCancel;
- pTempAccel->mpDel = &bDel;
- pTempAccel->Deactivate();
- if ( !bDel )
- {
- pTempAccel->mbIsCancel = false;
- pTempAccel->mpDel = NULL;
- }
+ pTempAccel->mbIsCancel = false;
+ pTempAccel->mpDel = NULL;
}
// delete sequence-list
@@ -222,7 +214,6 @@ bool ImplAccelManager::IsAccelKey( const vcl::KeyCode& rKeyCode, sal_uInt16 nRep
{
// first call activate/deactivate-Handler
pAccel->Activate();
- pAccel->Deactivate();
// define accelerator of the actual item
// and call the handler
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 5e75a1548903..f6cf52536eb7 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -129,7 +129,7 @@ public:
void EndDragging( bool bOK = true );
void HideDragRect() { if ( mbShowDragRect ) mpDragBox->HideTracking(); }
void UpdateDragRect();
- DECL_LINK( SelectHdl, Accelerator* );
+ DECL_LINK_TYPED( SelectHdl, Accelerator&, void );
};
static ImplTBDragMgr* ImplGetTBDragMgr()
@@ -1336,14 +1336,12 @@ void ImplTBDragMgr::UpdateDragRect()
mpDragBox->ShowTracking( maRect );
}
-IMPL_LINK( ImplTBDragMgr, SelectHdl, Accelerator*, pAccel )
+IMPL_LINK_TYPED( ImplTBDragMgr, SelectHdl, Accelerator&, rAccel, void )
{
- if ( pAccel->GetCurItemId() == KEY_ESCAPE )
+ if ( rAccel.GetCurItemId() == KEY_ESCAPE )
EndDragging( false );
else
EndDragging();
-
- return (long) true;
}
void ToolBox::ImplInit( vcl::Window* pParent, WinBits nStyle )