xref: /trunk/main/vcl/source/window/accel.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_vcl.hxx"
30 #include <tools/list.hxx>
31 #include <tools/table.hxx>
32 #include <tools/debug.hxx>
33 #include <tools/rc.h>
34 
35 #include <vcl/svapp.hxx>
36 #include <accel.h>
37 #include <vcl/accel.hxx>
38 
39 
40 
41 // =======================================================================
42 
43 DECLARE_TABLE( ImplAccelTable, ImplAccelEntry* )
44 DECLARE_LIST( ImplAccelList, ImplAccelEntry* )
45 
46 #define ACCELENTRY_NOTFOUND     ((sal_uInt16)0xFFFF)
47 
48 // =======================================================================
49 
50 class ImplAccelData
51 {
52 public:
53     ImplAccelTable  maKeyTable;     // Fuer KeyCodes, die mit einem Code erzeugt wurden
54     ImplAccelList   maIdList;       // Id-List
55 };
56 
57 // =======================================================================
58 
59 DBG_NAME( Accelerator )
60 
61 // =======================================================================
62 
63 sal_uInt16 ImplAccelEntryGetIndex( ImplAccelList* pList, sal_uInt16 nId,
64                                sal_uInt16* pIndex = NULL )
65 {
66     sal_uLong   nLow;
67     sal_uLong   nHigh;
68     sal_uLong   nMid;
69     sal_uLong   nCount = pList->Count();
70     sal_uInt16  nCompareId;
71 
72     // Abpruefen, ob der erste Key groesser als der Vergleichskey ist
73     if ( !nCount || (nId < pList->GetObject( 0 )->mnId) )
74     {
75         if ( pIndex )
76             *pIndex = 0;
77         return ACCELENTRY_NOTFOUND;
78     }
79 
80     // Binaeres Suchen
81     nLow  = 0;
82     nHigh = nCount-1;
83     do
84     {
85         nMid = (nLow + nHigh) / 2;
86         nCompareId = pList->GetObject( nMid )->mnId;
87         if ( nId < nCompareId )
88             nHigh = nMid-1;
89         else
90         {
91             if ( nId > nCompareId )
92                 nLow = nMid + 1;
93             else
94                 return (sal_uInt16)nMid;
95         }
96     }
97     while ( nLow <= nHigh );
98 
99     if ( pIndex )
100     {
101         if ( nId > nCompareId )
102             *pIndex = (sal_uInt16)(nMid+1);
103         else
104             *pIndex = (sal_uInt16)nMid;
105     }
106 
107     return ACCELENTRY_NOTFOUND;
108 }
109 
110 // -----------------------------------------------------------------------
111 
112 static void ImplAccelEntryInsert( ImplAccelList* pList, ImplAccelEntry* pEntry )
113 {
114     sal_uInt16  nInsIndex;
115     sal_uInt16  nIndex = ImplAccelEntryGetIndex( pList, pEntry->mnId, &nInsIndex );
116 
117     if ( nIndex != ACCELENTRY_NOTFOUND )
118     {
119         do
120         {
121             nIndex++;
122             ImplAccelEntry* pTempEntry = pList->GetObject( nIndex );
123             if ( !pTempEntry || (pTempEntry->mnId != pEntry->mnId) )
124                 break;
125         }
126         while ( nIndex < pList->Count() );
127 
128         pList->Insert( pEntry, (sal_uLong)nIndex );
129     }
130     else
131         pList->Insert( pEntry, (sal_uLong)nInsIndex );
132 }
133 
134 // -----------------------------------------------------------------------
135 
136 static sal_uInt16 ImplAccelEntryGetFirstPos( ImplAccelList* pList, sal_uInt16 nId )
137 {
138     sal_uInt16 nIndex = ImplAccelEntryGetIndex( pList, nId );
139     if ( nIndex != ACCELENTRY_NOTFOUND )
140     {
141         while ( nIndex )
142         {
143             nIndex--;
144             if ( pList->GetObject( nIndex )->mnId != nId )
145                 break;
146         }
147 
148         if ( pList->GetObject( nIndex )->mnId != nId )
149             nIndex++;
150     }
151 
152     return nIndex;
153 }
154 
155 // =======================================================================
156 
157 void Accelerator::ImplInit()
158 {
159     mnCurId             = 0;
160     mnCurRepeat         = 0;
161     mbIsCancel          = sal_False;
162     mpDel               = NULL;
163 }
164 
165 // -----------------------------------------------------------------------
166 
167 ImplAccelEntry* Accelerator::ImplGetAccelData( const KeyCode& rKeyCode ) const
168 {
169     return mpData->maKeyTable.Get( rKeyCode.GetFullKeyCode() );
170 }
171 
172 // -----------------------------------------------------------------------
173 
174 void Accelerator::ImplCopyData( ImplAccelData& rAccelData )
175 {
176     // Tabellen kopieren
177     ImplAccelEntry* pEntry = rAccelData.maIdList.First();
178     while ( pEntry )
179     {
180         pEntry = new ImplAccelEntry( *pEntry );
181 
182         // Folge-Accelerator, dann auch kopieren
183         if ( pEntry->mpAccel )
184         {
185             pEntry->mpAccel = new Accelerator( *(pEntry->mpAccel) );
186             pEntry->mpAutoAccel = pEntry->mpAccel;
187         }
188         else
189             pEntry->mpAutoAccel = NULL;
190 
191         mpData->maKeyTable.Insert( (sal_uLong)pEntry->maKeyCode.GetFullKeyCode(), pEntry );
192         mpData->maIdList.Insert( pEntry, LIST_APPEND );
193 
194         pEntry = rAccelData.maIdList.Next();
195     }
196 }
197 
198 // -----------------------------------------------------------------------
199 
200 void Accelerator::ImplDeleteData()
201 {
202     // Accelerator-Eintraege ueber die Id-Tabelle loeschen
203     ImplAccelEntry* pEntry = mpData->maIdList.First();
204     while ( pEntry )
205     {
206         // AutoResAccel zerstoeren
207         if ( pEntry->mpAutoAccel )
208             delete pEntry->mpAutoAccel;
209         delete pEntry;
210 
211         pEntry = mpData->maIdList.Next();
212     }
213 }
214 
215 // -----------------------------------------------------------------------
216 
217 void Accelerator::ImplInsertAccel( sal_uInt16 nItemId, const KeyCode& rKeyCode,
218                                    sal_Bool bEnable, Accelerator* pAutoAccel )
219 {
220     DBG_CHKTHIS( Accelerator, NULL );
221     DBG_ASSERT( nItemId, "Accelerator::InsertItem(): ItemId == 0" );
222 
223     if ( rKeyCode.IsFunction() )
224     {
225         sal_uInt16 nCode1;
226         sal_uInt16 nCode2;
227         sal_uInt16 nCode3;
228                 sal_uInt16 nCode4;
229         ImplGetKeyCode( rKeyCode.GetFunction(), nCode1, nCode2, nCode3, nCode4 );
230         if ( nCode1 )
231             ImplInsertAccel( nItemId, KeyCode( nCode1, nCode1 ), bEnable, pAutoAccel );
232         if ( nCode2 )
233         {
234             if ( pAutoAccel )
235                 pAutoAccel = new Accelerator( *pAutoAccel );
236             ImplInsertAccel( nItemId, KeyCode( nCode2, nCode2 ), bEnable, pAutoAccel );
237             if ( nCode3 )
238             {
239                 if ( pAutoAccel )
240                     pAutoAccel = new Accelerator( *pAutoAccel );
241                 ImplInsertAccel( nItemId, KeyCode( nCode3, nCode3 ), bEnable, pAutoAccel );
242             }
243         }
244         return;
245     }
246 
247     // Neuen Eintrag holen und fuellen
248     ImplAccelEntry* pEntry  = new ImplAccelEntry;
249     pEntry->mnId            = nItemId;
250     pEntry->maKeyCode       = rKeyCode;
251     pEntry->mpAccel         = pAutoAccel;
252     pEntry->mpAutoAccel     = pAutoAccel;
253     pEntry->mbEnabled       = bEnable;
254 
255     // Ab in die Tabellen
256     sal_uLong nCode = rKeyCode.GetFullKeyCode();
257     if ( !nCode )
258     {
259         DBG_ERROR( "Accelerator::InsertItem(): KeyCode with KeyCode 0 not allowed" );
260         delete pEntry;
261     }
262     else if ( !mpData->maKeyTable.Insert( nCode, pEntry ) )
263     {
264         DBG_ERROR1( "Accelerator::InsertItem(): KeyCode (Key: %lx) already exists", nCode );
265         delete pEntry;
266     }
267     else
268         ImplAccelEntryInsert( &(mpData->maIdList), pEntry );
269 }
270 
271 // -----------------------------------------------------------------------
272 
273 Accelerator::Accelerator()
274 {
275     DBG_CTOR( Accelerator, NULL );
276 
277     ImplInit();
278     mpData = new ImplAccelData;
279 }
280 
281 // -----------------------------------------------------------------------
282 
283 Accelerator::Accelerator( const Accelerator& rAccel ) :
284     Resource(),
285     maHelpStr( rAccel.maHelpStr ),
286     maCurKeyCode( rAccel.maCurKeyCode )
287 {
288     DBG_CTOR( Accelerator, NULL );
289     DBG_CHKOBJ( &rAccel, Accelerator, NULL );
290 
291     ImplInit();
292     mpData = new ImplAccelData;
293     ImplCopyData( *((ImplAccelData*)(rAccel.mpData)) );
294 }
295 
296 // -----------------------------------------------------------------------
297 
298 Accelerator::Accelerator( const ResId& rResId )
299 {
300     DBG_CTOR( Accelerator, NULL );
301 
302     ImplInit();
303     mpData = new ImplAccelData;
304     rResId.SetRT( RSC_ACCEL );
305     ImplLoadRes( rResId );
306 }
307 
308 // -----------------------------------------------------------------------
309 
310 void Accelerator::ImplLoadRes( const ResId& rResId )
311 {
312     GetRes( rResId );
313 
314     maHelpStr = ReadStringRes();
315     sal_uLong nObjFollows = ReadLongRes();
316 
317     for( sal_uLong i = 0; i < nObjFollows; i++ )
318     {
319         InsertItem( ResId( (RSHEADER_TYPE *)GetClassRes(), *rResId.GetResMgr() ) );
320         IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) );
321     }
322 }
323 
324 // -----------------------------------------------------------------------
325 
326 Accelerator::~Accelerator()
327 {
328     DBG_DTOR( Accelerator, NULL );
329 
330     // AccelManager benachrichtigen, das Accelrator geloescht wurde
331     if ( mpDel )
332         *mpDel = sal_True;
333 
334     ImplDeleteData();
335     delete mpData;
336 }
337 
338 // -----------------------------------------------------------------------
339 
340 void Accelerator::Activate()
341 {
342     maActivateHdl.Call( this );
343 }
344 
345 // -----------------------------------------------------------------------
346 
347 void Accelerator::Deactivate()
348 {
349     maDeactivateHdl.Call( this );
350 }
351 
352 // -----------------------------------------------------------------------
353 
354 void Accelerator::Select()
355 {
356     maSelectHdl.Call( this );
357 }
358 
359 // -----------------------------------------------------------------------
360 
361 void Accelerator::InsertItem( sal_uInt16 nItemId, const KeyCode& rKeyCode )
362 {
363     ImplInsertAccel( nItemId, rKeyCode, sal_True, NULL );
364 }
365 
366 // -----------------------------------------------------------------------
367 
368 void Accelerator::InsertItem( const ResId& rResId )
369 {
370     DBG_CHKTHIS( Accelerator, NULL );
371 
372     sal_uLong               nObjMask;
373     sal_uInt16              nAccelKeyId;
374     sal_uInt16              bDisable;
375     KeyCode             aKeyCode;
376     Accelerator*        pAutoAccel  = NULL;
377 
378     GetRes( rResId.SetRT( RSC_ACCELITEM ) );
379     nObjMask        = ReadLongRes();
380     nAccelKeyId     = sal::static_int_cast<sal_uInt16>(ReadLongRes());
381     bDisable        = ReadShortRes();
382 
383     if ( nObjMask & ACCELITEM_KEY )
384     {
385         // es wird ein neuer Kontext aufgespannt
386         RSHEADER_TYPE * pKeyCodeRes = (RSHEADER_TYPE *)GetClassRes();
387         ResId aResId( pKeyCodeRes, *rResId.GetResMgr());
388         aKeyCode = KeyCode( aResId );
389         IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) );
390     }
391 
392     if ( nObjMask & ACCELITEM_ACCEL )
393     {
394         pAutoAccel = new Accelerator( ResId( (RSHEADER_TYPE *)GetClassRes(), *rResId.GetResMgr() ) );
395         IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) );
396     }
397 
398     ImplInsertAccel( nAccelKeyId, aKeyCode, !bDisable, pAutoAccel );
399 }
400 
401 // -----------------------------------------------------------------------
402 
403 void Accelerator::RemoveItem( sal_uInt16 nItemId )
404 {
405     DBG_CHKTHIS( Accelerator, NULL );
406 
407     // Aus der Id-Liste entfernen
408     sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId );
409     if ( nIndex != ACCELENTRY_NOTFOUND )
410     {
411         sal_uInt16 nItemCount = GetItemCount();
412         do
413         {
414             ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (sal_uLong)nIndex );
415             if ( pEntry && pEntry->mnId == nItemId )
416             {
417                 mpData->maKeyTable.Remove( pEntry->maKeyCode.GetFullKeyCode() );
418                 mpData->maIdList.Remove( (sal_uLong)nIndex );
419 
420                 // AutoResAccel zerstoeren
421                 if ( pEntry->mpAutoAccel )
422                     delete pEntry->mpAutoAccel;
423 
424                 delete pEntry;
425             }
426             else
427                 break;
428         }
429         while ( nIndex < nItemCount );
430     }
431 }
432 
433 // -----------------------------------------------------------------------
434 
435 void Accelerator::RemoveItem( const KeyCode rKeyCode )
436 {
437     DBG_CHKTHIS( Accelerator, NULL );
438 
439     ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
440     if ( pEntry )
441     {
442         // Aus der Id-Liste entfernen
443         sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), pEntry->mnId );
444         sal_uInt16 nItemCount = GetItemCount();
445         do
446         {
447             if ( mpData->maIdList.GetObject( (sal_uLong)nIndex ) == pEntry )
448                 break;
449             nIndex++;
450         }
451         while ( nIndex < nItemCount );
452 
453         mpData->maKeyTable.Remove( rKeyCode.GetFullKeyCode() );
454         mpData->maIdList.Remove( (sal_uLong)nIndex );
455 
456         // AutoResAccel zerstoeren
457         if ( pEntry->mpAutoAccel )
458             delete pEntry->mpAutoAccel;
459 
460         delete pEntry;
461     }
462 }
463 
464 // -----------------------------------------------------------------------
465 
466 void Accelerator::Clear()
467 {
468     DBG_CHKTHIS( Accelerator, NULL );
469 
470     ImplDeleteData();
471     mpData->maKeyTable.Clear();
472     mpData->maIdList.Clear();
473 }
474 
475 // -----------------------------------------------------------------------
476 
477 sal_uInt16 Accelerator::GetItemCount() const
478 {
479     DBG_CHKTHIS( Accelerator, NULL );
480 
481     return (sal_uInt16)mpData->maIdList.Count();
482 }
483 
484 // -----------------------------------------------------------------------
485 
486 sal_uInt16 Accelerator::GetItemId( sal_uInt16 nPos ) const
487 {
488     DBG_CHKTHIS( Accelerator, NULL );
489 
490     ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (sal_uLong)nPos );
491     if ( pEntry )
492         return pEntry->mnId;
493     else
494         return 0;
495 }
496 
497 // -----------------------------------------------------------------------
498 
499 KeyCode Accelerator::GetItemKeyCode( sal_uInt16 nPos ) const
500 {
501     DBG_CHKTHIS( Accelerator, NULL );
502 
503     ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (sal_uLong)nPos );
504     if ( pEntry )
505         return pEntry->maKeyCode;
506     else
507         return KeyCode();
508 }
509 
510 // -----------------------------------------------------------------------
511 
512 sal_uInt16 Accelerator::GetItemId( const KeyCode& rKeyCode ) const
513 {
514     DBG_CHKTHIS( Accelerator, NULL );
515 
516     ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
517     if ( pEntry )
518         return pEntry->mnId;
519     else
520         return 0;
521 }
522 
523 // -----------------------------------------------------------------------
524 
525 KeyCode Accelerator::GetKeyCode( sal_uInt16 nItemId ) const
526 {
527     DBG_CHKTHIS( Accelerator, NULL );
528 
529     sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId );
530     if ( nIndex != ACCELENTRY_NOTFOUND )
531         return mpData->maIdList.GetObject( (sal_uLong)nIndex )->maKeyCode;
532     else
533         return KeyCode();
534 }
535 
536 // -----------------------------------------------------------------------
537 
538 sal_Bool Accelerator::IsIdValid( sal_uInt16 nItemId ) const
539 {
540     DBG_CHKTHIS( Accelerator, NULL );
541 
542     sal_uInt16 nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId );
543     return (nIndex != ACCELENTRY_NOTFOUND);
544 }
545 
546 // -----------------------------------------------------------------------
547 
548 sal_Bool Accelerator::IsKeyCodeValid( const KeyCode rKeyCode ) const
549 {
550     DBG_CHKTHIS( Accelerator, NULL );
551 
552     ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
553     return (pEntry != NULL);
554 }
555 
556 // -----------------------------------------------------------------------
557 
558 sal_Bool Accelerator::Call( const KeyCode& rKeyCode, sal_uInt16 nRepeat )
559 {
560     DBG_CHKTHIS( Accelerator, NULL );
561 
562     ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
563     if ( pEntry )
564     {
565         if ( pEntry->mbEnabled )
566         {
567             sal_Bool bDel = sal_False;
568             mnCurId         = pEntry->mnId;
569             maCurKeyCode    = rKeyCode;
570             mnCurRepeat     = nRepeat;
571             mpDel           = &bDel;
572             Select();
573             if ( !bDel )
574             {
575                 mnCurId         = 0;
576                 maCurKeyCode    = KeyCode();
577                 mnCurRepeat     = 0;
578             }
579 
580             return sal_True;
581         }
582     }
583 
584     return sal_False;
585 }
586 
587 // -----------------------------------------------------------------------
588 
589 void Accelerator::SetAccel( sal_uInt16 nItemId, Accelerator* pAccel )
590 {
591     DBG_CHKTHIS( Accelerator, NULL );
592 
593     sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId );
594     if ( nIndex != ACCELENTRY_NOTFOUND )
595     {
596         sal_uInt16 nItemCount = GetItemCount();
597         do
598         {
599             ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (sal_uLong)nIndex );
600             if ( pEntry->mnId != nItemId )
601                 break;
602 
603             pEntry->mpAccel = pAccel;
604             nIndex++;
605         }
606         while ( nIndex < nItemCount );
607     }
608 }
609 
610 // -----------------------------------------------------------------------
611 
612 Accelerator* Accelerator::GetAccel( sal_uInt16 nItemId ) const
613 {
614     DBG_CHKTHIS( Accelerator, NULL );
615 
616     sal_uInt16 nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId );
617     if ( nIndex != ACCELENTRY_NOTFOUND )
618         return mpData->maIdList.GetObject( (sal_uLong)nIndex )->mpAccel;
619     else
620         return NULL;
621 }
622 
623 // -----------------------------------------------------------------------
624 
625 void Accelerator::SetAccel( const KeyCode rKeyCode, Accelerator* pAccel )
626 {
627     DBG_CHKTHIS( Accelerator, NULL );
628 
629     ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
630     if ( pEntry )
631         pEntry->mpAccel = pAccel;
632 }
633 
634 // -----------------------------------------------------------------------
635 
636 Accelerator* Accelerator::GetAccel( const KeyCode rKeyCode ) const
637 {
638     DBG_CHKTHIS( Accelerator, NULL );
639 
640     ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
641     if ( pEntry )
642         return pEntry->mpAccel;
643     else
644         return sal_False;
645 }
646 
647 // -----------------------------------------------------------------------
648 
649 void Accelerator::EnableItem( sal_uInt16 nItemId, sal_Bool bEnable )
650 {
651     DBG_CHKTHIS( Accelerator, NULL );
652 
653     sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId );
654     if ( nIndex != ACCELENTRY_NOTFOUND )
655     {
656         sal_uInt16 nItemCount = GetItemCount();
657         do
658         {
659             ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (sal_uLong)nIndex );
660             if ( pEntry->mnId != nItemId )
661                 break;
662 
663             pEntry->mbEnabled = bEnable;
664             nIndex++;
665         }
666         while ( nIndex < nItemCount );
667     }
668 }
669 
670 // -----------------------------------------------------------------------
671 
672 sal_Bool Accelerator::IsItemEnabled( sal_uInt16 nItemId ) const
673 {
674     DBG_CHKTHIS( Accelerator, NULL );
675 
676     sal_uInt16 nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId );
677     if ( nIndex != ACCELENTRY_NOTFOUND )
678         return mpData->maIdList.GetObject( (sal_uLong)nIndex )->mbEnabled;
679     else
680         return sal_False;
681 }
682 
683 // -----------------------------------------------------------------------
684 
685 void Accelerator::EnableItem( const KeyCode rKeyCode, sal_Bool bEnable )
686 {
687     DBG_CHKTHIS( Accelerator, NULL );
688 
689     ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
690     if ( pEntry )
691         pEntry->mbEnabled = bEnable;
692 }
693 
694 // -----------------------------------------------------------------------
695 
696 sal_Bool Accelerator::IsItemEnabled( const KeyCode rKeyCode ) const
697 {
698     DBG_CHKTHIS( Accelerator, NULL );
699 
700     ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
701     if ( pEntry )
702         return pEntry->mbEnabled;
703     else
704         return sal_False;
705 }
706 
707 // -----------------------------------------------------------------------
708 
709 Accelerator& Accelerator::operator=( const Accelerator& rAccel )
710 {
711     DBG_CHKTHIS( Accelerator, NULL );
712     DBG_CHKOBJ( &rAccel, Accelerator, NULL );
713 
714     // Neue Daten zuweisen
715     maHelpStr       = rAccel.maHelpStr;
716     maCurKeyCode    = KeyCode();
717     mnCurId         = 0;
718     mnCurRepeat     = 0;
719     mbIsCancel      = sal_False;
720 
721     // Tabellen loeschen und kopieren
722     ImplDeleteData();
723     mpData->maKeyTable.Clear();
724     mpData->maIdList.Clear();
725     ImplCopyData( *((ImplAccelData*)(rAccel.mpData)) );
726 
727     return *this;
728 }
729