summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMarcel Metz <mmetz@adrian-broher.net>2011-12-12 16:02:22 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-12-12 16:05:36 +0000
commit26c0c9d404a65d5ab7a5a9c227132594e467cef4 (patch)
treea36165bece28cc2935061be889628d040c87a80f /vcl
parent87becfbd2a4d440925f1680c1cc85afa0cef350a (diff)
Related: fdo#38832 Replace ImplAccesTable with std::map
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/accel.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx
index f45b1459d738..e755d486eefb 100644
--- a/vcl/source/window/accel.cxx
+++ b/vcl/source/window/accel.cxx
@@ -27,18 +27,18 @@
************************************************************************/
-#include <tools/table.hxx>
#include <tools/debug.hxx>
#include <tools/rc.h>
#include <vcl/svapp.hxx>
#include <accel.h>
#include <vcl/accel.hxx>
+#include <map>
#include <vector>
// =======================================================================
-DECLARE_TABLE( ImplAccelTable, ImplAccelEntry* )
+typedef ::std::map< sal_uLong, ImplAccelEntry* > ImplAccelMap;
typedef ::std::vector< ImplAccelEntry* > ImplAccelList;
#define ACCELENTRY_NOTFOUND ((sal_uInt16)0xFFFF)
@@ -48,8 +48,8 @@ typedef ::std::vector< ImplAccelEntry* > ImplAccelList;
class ImplAccelData
{
public:
- ImplAccelTable maKeyTable; // for keycodes, generated with a code
- ImplAccelList maIdList; // Id-List
+ ImplAccelMap maKeyMap; // for keycodes, generated with a code
+ ImplAccelList maIdList; // Id-List
};
// =======================================================================
@@ -179,7 +179,11 @@ void Accelerator::ImplInit()
ImplAccelEntry* Accelerator::ImplGetAccelData( const KeyCode& rKeyCode ) const
{
- return mpData->maKeyTable.Get( rKeyCode.GetFullKeyCode() );
+ ImplAccelMap::iterator it = mpData->maKeyMap.find( rKeyCode.GetFullKeyCode() );
+ if( it != mpData->maKeyMap.end() )
+ return it->second;
+ else
+ return NULL;
}
// -----------------------------------------------------------------------
@@ -200,7 +204,7 @@ void Accelerator::ImplCopyData( ImplAccelData& rAccelData )
else
pEntry->mpAutoAccel = NULL;
- mpData->maKeyTable.Insert( (sal_uLong)pEntry->maKeyCode.GetFullKeyCode(), pEntry );
+ mpData->maKeyMap.insert( std::make_pair( pEntry->maKeyCode.GetFullKeyCode(), pEntry ) );
mpData->maIdList.push_back( pEntry );
}
}
@@ -267,7 +271,7 @@ void Accelerator::ImplInsertAccel( sal_uInt16 nItemId, const KeyCode& rKeyCode,
OSL_FAIL( "Accelerator::InsertItem(): KeyCode with KeyCode 0 not allowed" );
delete pEntry;
}
- else if ( !mpData->maKeyTable.Insert( nCode, pEntry ) )
+ else if ( mpData->maKeyMap.insert( std::make_pair( nCode, pEntry ) ).second )
{
OSL_TRACE( "Accelerator::InsertItem(): KeyCode (Key: %lx) already exists", nCode );
delete pEntry;
@@ -470,7 +474,7 @@ Accelerator& Accelerator::operator=( const Accelerator& rAccel )
// delete and copy tables
ImplDeleteData();
- mpData->maKeyTable.Clear();
+ mpData->maKeyMap.clear();
ImplCopyData( *((ImplAccelData*)(rAccel.mpData)) );
return *this;