Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef COMPHELPER_ACCESSIBLE_SELECTION_HELPER_HXX
21 : : #define COMPHELPER_ACCESSIBLE_SELECTION_HELPER_HXX
22 : :
23 : : #include <comphelper/uno3.hxx>
24 : : #include <comphelper/accessiblecomponenthelper.hxx>
25 : : #include <cppuhelper/implbase1.hxx>
26 : : #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
27 : : #include "comphelper/comphelperdllapi.h"
28 : :
29 : : #define ACCESSIBLE_SELECTION_CHILD_ALL ((sal_Int32)-1)
30 : : #define ACCESSIBLE_SELECTION_CHILD_SELF ((sal_Int32)-2)
31 : :
32 : : //.........................................................................
33 : : namespace comphelper
34 : : {
35 : : //.........................................................................
36 : :
37 : : //=====================================================================
38 : : //= OCommonAccessibleSelection
39 : : //=====================================================================
40 : : /** base class encapsulating common functionality for the helper classes implementing
41 : : the XAccessibleSelection
42 : : */
43 : : class COMPHELPER_DLLPUBLIC OCommonAccessibleSelection
44 : : {
45 : : protected:
46 : :
47 : : OCommonAccessibleSelection();
48 : :
49 : : ~OCommonAccessibleSelection();
50 : :
51 : : protected:
52 : :
53 : : // access to context - still waiting to be overwritten
54 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
55 : : implGetAccessibleContext()
56 : : throw ( ::com::sun::star::uno::RuntimeException ) = 0;
57 : :
58 : : // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
59 : : virtual sal_Bool
60 : : implIsSelected( sal_Int32 nAccessibleChildIndex )
61 : : throw (::com::sun::star::uno::RuntimeException) = 0;
62 : :
63 : : // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
64 : : virtual void
65 : : implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect )
66 : : throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) = 0;
67 : :
68 : : protected:
69 : :
70 : : /** non-virtual versions of the methods which can be implemented using <method>implIsSelected</method> and <method>implSelect</method>
71 : : */
72 : : void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
73 : : sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
74 : : void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
75 : : void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
76 : : sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
77 : : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
78 : : void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
79 : : };
80 : :
81 : : //=====================================================================
82 : : //= OAccessibleSelectionHelper
83 : : //=====================================================================
84 : :
85 : : typedef ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleSelection > OAccessibleSelectionHelper_Base;
86 : :
87 : : /** a helper class for implementing an AccessibleSelection which at the same time
88 : : supports an XAccessibleSelection interface.
89 : : */
90 [ # # ][ # # ]: 0 : class COMPHELPER_DLLPUBLIC OAccessibleSelectionHelper : public OAccessibleComponentHelper,
91 : : public OCommonAccessibleSelection,
92 : : public OAccessibleSelectionHelper_Base
93 : : {
94 : : protected:
95 : :
96 : : /// see the respective base class ctor for an extensive comment on this, please
97 : : OAccessibleSelectionHelper( IMutex* _pExternalLock );
98 : :
99 : : // return ourself here by default
100 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > implGetAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException );
101 : :
102 : : public:
103 : :
104 : : // XInterface
105 : : DECLARE_XINTERFACE( )
106 : : DECLARE_XTYPEPROVIDER( )
107 : :
108 : : // XAccessibleSelection - default implementations
109 : : virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
110 : : virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
111 : : virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
112 : : virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
113 : : virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
114 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
115 : : virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
116 : : };
117 : :
118 : : //.........................................................................
119 : : } // namespace comphelper
120 : : //.........................................................................
121 : :
122 : : #endif // COMPHELPER_ACCESSIBLE_SELECTION_HELPER_HXX
123 : :
124 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|