summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorThomas Arnhold <thomas@arnhold.org>2011-07-19 17:23:58 +0200
committerThomas Arnhold <thomas@arnhold.org>2011-07-20 16:38:54 +0200
commitded34422f2e6cd7b795b7e51828cf9ff3e50b35d (patch)
tree8a44220f42b1aa623542c7508aaff285aa84e034 /vcl
parentd8a09482fb417d60fa3ff79070ef9e701b44d3ad (diff)
callcatcher: cleanup Accelerator
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/vcl/accel.hxx15
-rw-r--r--vcl/source/window/accel.cxx263
2 files changed, 5 insertions, 273 deletions
diff --git a/vcl/inc/vcl/accel.hxx b/vcl/inc/vcl/accel.hxx
index cf21000ee08a..79109e08cd4c 100644
--- a/vcl/inc/vcl/accel.hxx
+++ b/vcl/inc/vcl/accel.hxx
@@ -83,9 +83,6 @@ public:
void InsertItem( sal_uInt16 nItemId, const KeyCode& rKeyCode );
void InsertItem( const ResId& rResId );
- void RemoveItem( sal_uInt16 nItemId );
- void RemoveItem( const KeyCode rKeyCode );
- void Clear();
sal_uInt16 GetCurItemId() const { return mnCurId; }
const KeyCode& GetCurKeyCode() const { return maCurKeyCode; }
@@ -94,21 +91,9 @@ public:
sal_uInt16 GetItemCount() const;
sal_uInt16 GetItemId( sal_uInt16 nPos ) const;
- KeyCode GetItemKeyCode( sal_uInt16 nPos ) const;
- sal_uInt16 GetItemId( const KeyCode& rKeyCode ) const;
KeyCode GetKeyCode( sal_uInt16 nItemId ) const;
- sal_Bool IsIdValid( sal_uInt16 nItemId ) const;
- sal_Bool Call( const KeyCode& rKeyCode, sal_uInt16 nRepeat = 0 );
- void SetAccel( sal_uInt16 nItemId, Accelerator* pAccel );
Accelerator* GetAccel( sal_uInt16 nItemId ) const;
- void SetAccel( const KeyCode rKeyCode, Accelerator* pAccel );
- Accelerator* GetAccel( const KeyCode rKeyCode ) const;
-
- void EnableItem( sal_uInt16 nItemId, sal_Bool bEnable = sal_True );
- sal_Bool IsItemEnabled( sal_uInt16 nItemId ) const;
- void EnableItem( const KeyCode rKeyCode, sal_Bool bEnable = sal_True );
- sal_Bool IsItemEnabled( const KeyCode rKeyCode ) const;
void SetHelpText( const XubString& rHelpText ) { maHelpStr = rHelpText; }
const XubString& GetHelpText() const { return maHelpStr; }
diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx
index ebf15497b229..3fb5aabc4a35 100644
--- a/vcl/source/window/accel.cxx
+++ b/vcl/source/window/accel.cxx
@@ -410,85 +410,6 @@ void Accelerator::InsertItem( const ResId& rResId )
// -----------------------------------------------------------------------
-void Accelerator::RemoveItem( sal_uInt16 nItemId )
-{
- DBG_CHKTHIS( Accelerator, NULL );
-
- // Aus der Id-Liste entfernen
- sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId );
- if ( nIndex != ACCELENTRY_NOTFOUND )
- {
- sal_uInt16 nItemCount = GetItemCount();
- do
- {
- ImplAccelEntry* pEntry = ( nIndex < mpData->maIdList.size() ) ? mpData->maIdList[ nIndex ] : NULL;
- if ( pEntry && pEntry->mnId == nItemId )
- {
- mpData->maKeyTable.Remove( pEntry->maKeyCode.GetFullKeyCode() );
-
- ImplAccelList::iterator it = mpData->maIdList.begin();
- ::std::advance( it, nIndex );
- mpData->maIdList.erase( it );
-
- // AutoResAccel zerstoeren
- if ( pEntry->mpAutoAccel )
- delete pEntry->mpAutoAccel;
-
- delete pEntry;
- }
- else
- break;
- }
- while ( nIndex < nItemCount );
- }
-}
-
-// -----------------------------------------------------------------------
-
-void Accelerator::RemoveItem( const KeyCode rKeyCode )
-{
- DBG_CHKTHIS( Accelerator, NULL );
-
- ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
- if ( pEntry )
- {
- // Aus der Id-Liste entfernen
- sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), pEntry->mnId );
- sal_uInt16 nItemCount = GetItemCount();
- do
- {
- if ( mpData->maIdList[ nIndex ] == pEntry )
- break;
- nIndex++;
- }
- while ( nIndex < nItemCount );
-
- mpData->maKeyTable.Remove( rKeyCode.GetFullKeyCode() );
-
- ImplAccelList::iterator it = mpData->maIdList.begin();
- ::std::advance( it, nIndex );
- mpData->maIdList.erase( it );
-
- // AutoResAccel zerstoeren
- if ( pEntry->mpAutoAccel )
- delete pEntry->mpAutoAccel;
-
- delete pEntry;
- }
-}
-
-// -----------------------------------------------------------------------
-
-void Accelerator::Clear()
-{
- DBG_CHKTHIS( Accelerator, NULL );
-
- ImplDeleteData();
- mpData->maKeyTable.Clear();
-}
-
-// -----------------------------------------------------------------------
-
sal_uInt16 Accelerator::GetItemCount() const
{
DBG_CHKTHIS( Accelerator, NULL );
@@ -498,45 +419,6 @@ sal_uInt16 Accelerator::GetItemCount() const
// -----------------------------------------------------------------------
-sal_uInt16 Accelerator::GetItemId( sal_uInt16 nPos ) const
-{
- DBG_CHKTHIS( Accelerator, NULL );
-
- ImplAccelEntry* pEntry = ( nPos < mpData->maIdList.size() ) ? mpData->maIdList[ nPos ] : NULL;
- if ( pEntry )
- return pEntry->mnId;
- else
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-KeyCode Accelerator::GetItemKeyCode( sal_uInt16 nPos ) const
-{
- DBG_CHKTHIS( Accelerator, NULL );
-
- ImplAccelEntry* pEntry = ( nPos < mpData->maIdList.size() ) ? mpData->maIdList[ nPos ] : NULL;
- if ( pEntry )
- return pEntry->maKeyCode;
- else
- return KeyCode();
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 Accelerator::GetItemId( const KeyCode& rKeyCode ) const
-{
- DBG_CHKTHIS( Accelerator, NULL );
-
- ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
- if ( pEntry )
- return pEntry->mnId;
- else
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
KeyCode Accelerator::GetKeyCode( sal_uInt16 nItemId ) const
{
DBG_CHKTHIS( Accelerator, NULL );
@@ -550,66 +432,15 @@ KeyCode Accelerator::GetKeyCode( sal_uInt16 nItemId ) const
// -----------------------------------------------------------------------
-sal_Bool Accelerator::IsIdValid( sal_uInt16 nItemId ) const
-{
- DBG_CHKTHIS( Accelerator, NULL );
-
- sal_uInt16 nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId );
- return (nIndex != ACCELENTRY_NOTFOUND);
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool Accelerator::Call( const KeyCode& rKeyCode, sal_uInt16 nRepeat )
+sal_uInt16 Accelerator::GetItemId( sal_uInt16 nPos ) const
{
DBG_CHKTHIS( Accelerator, NULL );
- ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
+ ImplAccelEntry* pEntry = ( nPos < mpData->maIdList.size() ) ? mpData->maIdList[ nPos ] : NULL;
if ( pEntry )
- {
- if ( pEntry->mbEnabled )
- {
- sal_Bool bDel = sal_False;
- mnCurId = pEntry->mnId;
- maCurKeyCode = rKeyCode;
- mnCurRepeat = nRepeat;
- mpDel = &bDel;
- Select();
- if ( !bDel )
- {
- mnCurId = 0;
- maCurKeyCode = KeyCode();
- mnCurRepeat = 0;
- }
-
- return sal_True;
- }
- }
-
- return sal_False;
-}
-
-// -----------------------------------------------------------------------
-
-void Accelerator::SetAccel( sal_uInt16 nItemId, Accelerator* pAccel )
-{
- DBG_CHKTHIS( Accelerator, NULL );
-
- sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId );
- if ( nIndex != ACCELENTRY_NOTFOUND )
- {
- sal_uInt16 nItemCount = GetItemCount();
- do
- {
- ImplAccelEntry* pEntry = mpData->maIdList[ nIndex ];
- if ( pEntry->mnId != nItemId )
- break;
-
- pEntry->mpAccel = pAccel;
- nIndex++;
- }
- while ( nIndex < nItemCount );
- }
+ return pEntry->mnId;
+ else
+ return 0;
}
// -----------------------------------------------------------------------
@@ -627,90 +458,6 @@ Accelerator* Accelerator::GetAccel( sal_uInt16 nItemId ) const
// -----------------------------------------------------------------------
-void Accelerator::SetAccel( const KeyCode rKeyCode, Accelerator* pAccel )
-{
- DBG_CHKTHIS( Accelerator, NULL );
-
- ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
- if ( pEntry )
- pEntry->mpAccel = pAccel;
-}
-
-// -----------------------------------------------------------------------
-
-Accelerator* Accelerator::GetAccel( const KeyCode rKeyCode ) const
-{
- DBG_CHKTHIS( Accelerator, NULL );
-
- ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
- if ( pEntry )
- return pEntry->mpAccel;
- else
- return sal_False;
-}
-
-// -----------------------------------------------------------------------
-
-void Accelerator::EnableItem( sal_uInt16 nItemId, sal_Bool bEnable )
-{
- DBG_CHKTHIS( Accelerator, NULL );
-
- sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId );
- if ( nIndex != ACCELENTRY_NOTFOUND )
- {
- sal_uInt16 nItemCount = GetItemCount();
- do
- {
- ImplAccelEntry* pEntry = mpData->maIdList[ nIndex ];
- if ( pEntry->mnId != nItemId )
- break;
-
- pEntry->mbEnabled = bEnable;
- nIndex++;
- }
- while ( nIndex < nItemCount );
- }
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool Accelerator::IsItemEnabled( sal_uInt16 nItemId ) const
-{
- DBG_CHKTHIS( Accelerator, NULL );
-
- sal_uInt16 nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId );
- if ( nIndex != ACCELENTRY_NOTFOUND )
- return mpData->maIdList[ nIndex ]->mbEnabled;
- else
- return sal_False;
-}
-
-// -----------------------------------------------------------------------
-
-void Accelerator::EnableItem( const KeyCode rKeyCode, sal_Bool bEnable )
-{
- DBG_CHKTHIS( Accelerator, NULL );
-
- ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
- if ( pEntry )
- pEntry->mbEnabled = bEnable;
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool Accelerator::IsItemEnabled( const KeyCode rKeyCode ) const
-{
- DBG_CHKTHIS( Accelerator, NULL );
-
- ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
- if ( pEntry )
- return pEntry->mbEnabled;
- else
- return sal_False;
-}
-
-// -----------------------------------------------------------------------
-
Accelerator& Accelerator::operator=( const Accelerator& rAccel )
{
DBG_CHKTHIS( Accelerator, NULL );