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 .
20 #ifndef INCLUDED_COMPHELPER_ACCESSIBLESELECTIONHELPER_HXX
21 #define INCLUDED_COMPHELPER_ACCESSIBLESELECTIONHELPER_HXX
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>
29 #define ACCESSIBLE_SELECTION_CHILD_ALL ((sal_Int32)-1)
30 #define ACCESSIBLE_SELECTION_CHILD_SELF ((sal_Int32)-2)
37 //= OCommonAccessibleSelection
39 /** base class encapsulating common functionality for the helper classes implementing
40 the XAccessibleSelection
42 class COMPHELPER_DLLPUBLIC OCommonAccessibleSelection
46 OCommonAccessibleSelection();
48 ~OCommonAccessibleSelection();
52 // access to context - still waiting to be overwritten
53 /// @throws css::uno::RuntimeException
54 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
>
55 implGetAccessibleContext() = 0;
57 // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
58 /// @throws css::uno::RuntimeException
60 implIsSelected( sal_Int32 nAccessibleChildIndex
) = 0;
62 // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
63 /// @throws css::uno::RuntimeException
65 implSelect( sal_Int32 nAccessibleChildIndex
, bool bSelect
) = 0;
69 /** non-virtual versions of the methods which can be implemented using <method>implIsSelected</method> and <method>implSelect</method>
71 @throws css::lang::IndexOutOfBoundsException
72 @throws css::uno::RuntimeException
74 void SAL_CALL
selectAccessibleChild( sal_Int32 nChildIndex
);
75 /// @throws css::lang::IndexOutOfBoundsException
76 /// @throws css::uno::RuntimeException
77 bool SAL_CALL
isAccessibleChildSelected( sal_Int32 nChildIndex
);
78 /// @throws css::uno::RuntimeException
79 void SAL_CALL
clearAccessibleSelection( );
80 /// @throws css::uno::RuntimeException
81 void SAL_CALL
selectAllAccessibleChildren( );
82 /// @throws css::uno::RuntimeException
83 sal_Int32 SAL_CALL
getSelectedAccessibleChildCount( );
84 /// @throws css::lang::IndexOutOfBoundsException
85 /// @throws css::uno::RuntimeException
86 css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex
);
87 /// @throws css::lang::IndexOutOfBoundsException
88 /// @throws css::uno::RuntimeException
89 void SAL_CALL
deselectAccessibleChild( sal_Int32 nSelectedChildIndex
);
93 //= OAccessibleSelectionHelper
96 typedef ::cppu::ImplHelper1
< css::accessibility::XAccessibleSelection
> OAccessibleSelectionHelper_Base
;
98 /** a helper class for implementing an AccessibleSelection which at the same time
99 supports an XAccessibleSelection interface.
101 class COMPHELPER_DLLPUBLIC OAccessibleSelectionHelper
: public OAccessibleComponentHelper
,
102 public OCommonAccessibleSelection
,
103 public OAccessibleSelectionHelper_Base
107 /// see the respective base class ctor for an extensive comment on this, please
108 OAccessibleSelectionHelper( IMutex
* _pExternalLock
);
110 // return ourself here by default
111 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
> implGetAccessibleContext() override
;
116 DECLARE_XINTERFACE( )
117 DECLARE_XTYPEPROVIDER( )
119 // XAccessibleSelection - default implementations
120 virtual void SAL_CALL
selectAccessibleChild( sal_Int32 nChildIndex
) override
;
121 virtual sal_Bool SAL_CALL
isAccessibleChildSelected( sal_Int32 nChildIndex
) override
;
122 virtual void SAL_CALL
clearAccessibleSelection( ) override
;
123 virtual void SAL_CALL
selectAllAccessibleChildren( ) override
;
124 virtual sal_Int32 SAL_CALL
getSelectedAccessibleChildCount( ) override
;
125 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex
) override
;
126 virtual void SAL_CALL
deselectAccessibleChild( sal_Int32 nSelectedChildIndex
) override
;
130 } // namespace comphelper
133 #endif // INCLUDED_COMPHELPER_ACCESSIBLESELECTIONHELPER_HXX
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */