1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: accessiblekeybindinghelper.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_comphelper.hxx"
34 // includes --------------------------------------------------------------
35 #include <comphelper/accessiblekeybindinghelper.hxx>
38 //..............................................................................
41 //..............................................................................
43 using namespace ::com::sun::star
; // MT 04/2003: was ::drafts::com::sun::star - otherwise to many changes
44 using namespace ::com::sun::star::uno
;
45 using namespace ::com::sun::star::lang
;
46 using namespace ::com::sun::star::accessibility
;
48 //==============================================================================
49 // OAccessibleKeyBindingHelper
50 //==============================================================================
52 OAccessibleKeyBindingHelper::OAccessibleKeyBindingHelper()
56 // -----------------------------------------------------------------------------
58 OAccessibleKeyBindingHelper::OAccessibleKeyBindingHelper( const OAccessibleKeyBindingHelper
& rHelper
)
59 : cppu::WeakImplHelper1
<XAccessibleKeyBinding
>( rHelper
)
60 , m_aKeyBindings( rHelper
.m_aKeyBindings
)
64 // -----------------------------------------------------------------------------
66 OAccessibleKeyBindingHelper::~OAccessibleKeyBindingHelper()
70 // -----------------------------------------------------------------------------
72 void OAccessibleKeyBindingHelper::AddKeyBinding( const Sequence
< awt::KeyStroke
>& rKeyBinding
) throw (RuntimeException
)
74 ::osl::MutexGuard
aGuard( m_aMutex
);
76 m_aKeyBindings
.push_back( rKeyBinding
);
79 // -----------------------------------------------------------------------------
81 void OAccessibleKeyBindingHelper::AddKeyBinding( const awt::KeyStroke
& rKeyStroke
) throw (RuntimeException
)
83 ::osl::MutexGuard
aGuard( m_aMutex
);
85 Sequence
< awt::KeyStroke
> aSeq(1);
87 m_aKeyBindings
.push_back( aSeq
);
90 // -----------------------------------------------------------------------------
91 // XAccessibleKeyBinding
92 // -----------------------------------------------------------------------------
94 sal_Int32
OAccessibleKeyBindingHelper::getAccessibleKeyBindingCount() throw (RuntimeException
)
96 ::osl::MutexGuard
aGuard( m_aMutex
);
98 return m_aKeyBindings
.size();
101 // -----------------------------------------------------------------------------
103 Sequence
< awt::KeyStroke
> OAccessibleKeyBindingHelper::getAccessibleKeyBinding( sal_Int32 nIndex
) throw (IndexOutOfBoundsException
, RuntimeException
)
105 ::osl::MutexGuard
aGuard( m_aMutex
);
107 if ( nIndex
< 0 || nIndex
>= (sal_Int32
)m_aKeyBindings
.size() )
108 throw IndexOutOfBoundsException();
110 return m_aKeyBindings
[nIndex
];
113 // -----------------------------------------------------------------------------
115 //..............................................................................
116 } // namespace comphelper
117 //..............................................................................