1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
23 #include <tools/solar.h>
24 #include <vcl/dllapi.h>
25 #include <tools/link.hxx>
26 #include <tools/resid.hxx>
27 #include <tools/rc.hxx>
28 #include <vcl/keycod.hxx>
37 class VCL_DLLPUBLIC Accelerator
: public Resource
39 friend class ImplAccelManager
;
42 ImplAccelData
* mpData
;
48 // Will be set by AcceleratorManager
51 sal_uInt16 mnCurRepeat
;
55 SAL_DLLPRIVATE
void ImplInit();
56 SAL_DLLPRIVATE
void ImplCopyData( ImplAccelData
& rAccelData
);
57 SAL_DLLPRIVATE
void ImplDeleteData();
58 SAL_DLLPRIVATE
void ImplInsertAccel( sal_uInt16 nItemId
, const KeyCode
& rKeyCode
,
59 sal_Bool bEnable
, Accelerator
* pAutoAccel
);
61 SAL_DLLPRIVATE ImplAccelEntry
* ImplGetAccelData( const KeyCode
& rKeyCode
) const;
64 SAL_DLLPRIVATE
void ImplLoadRes( const ResId
& rResId
);
68 Accelerator( const Accelerator
& rAccel
);
69 Accelerator( const ResId
& rResId
);
70 virtual ~Accelerator();
72 virtual void Activate();
73 virtual void Deactivate();
74 virtual void Select();
76 void InsertItem( sal_uInt16 nItemId
, const KeyCode
& rKeyCode
);
77 void InsertItem( const ResId
& rResId
);
79 sal_uInt16
GetCurItemId() const { return mnCurId
; }
80 const KeyCode
& GetCurKeyCode() const { return maCurKeyCode
; }
81 sal_uInt16
GetCurRepeat() const { return mnCurRepeat
; }
82 sal_Bool
IsCancel() const { return mbIsCancel
; }
84 sal_uInt16
GetItemCount() const;
85 sal_uInt16
GetItemId( sal_uInt16 nPos
) const;
86 KeyCode
GetKeyCode( sal_uInt16 nItemId
) const;
88 Accelerator
* GetAccel( sal_uInt16 nItemId
) const;
90 void SetHelpText( const XubString
& rHelpText
) { maHelpStr
= rHelpText
; }
91 const XubString
& GetHelpText() const { return maHelpStr
; }
93 void SetActivateHdl( const Link
& rLink
) { maActivateHdl
= rLink
; }
94 const Link
& GetActivateHdl() const { return maActivateHdl
; }
95 void SetDeactivateHdl( const Link
& rLink
) { maDeactivateHdl
= rLink
; }
96 const Link
& GetDeactivateHdl() const { return maDeactivateHdl
; }
97 void SetSelectHdl( const Link
& rLink
) { maSelectHdl
= rLink
; }
98 const Link
& GetSelectHdl() const { return maSelectHdl
; }
100 Accelerator
& operator=( const Accelerator
& rAccel
);
103 #endif // _SV_ACCEL_HXX
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */