update credits
[LibreOffice.git] / include / comphelper / accessibleselectionhelper.hxx
blobe1bb5dd5f1eff969ba2739a4ea14a0b3f5c2d22a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 COMPHELPER_ACCESSIBLE_SELECTION_HELPER_HXX
21 #define COMPHELPER_ACCESSIBLE_SELECTION_HELPER_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)
32 //.........................................................................
33 namespace comphelper
35 //.........................................................................
37 //=====================================================================
38 //= OCommonAccessibleSelection
39 //=====================================================================
40 /** base class encapsulating common functionality for the helper classes implementing
41 the XAccessibleSelection
43 class COMPHELPER_DLLPUBLIC OCommonAccessibleSelection
45 protected:
47 OCommonAccessibleSelection();
49 ~OCommonAccessibleSelection();
51 protected:
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;
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;
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;
68 protected:
70 /** non-virtual versions of the methods which can be implemented using <method>implIsSelected</method> and <method>implSelect</method>
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);
81 //=====================================================================
82 //= OAccessibleSelectionHelper
83 //=====================================================================
85 typedef ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleSelection > OAccessibleSelectionHelper_Base;
87 /** a helper class for implementing an AccessibleSelection which at the same time
88 supports an XAccessibleSelection interface.
90 class COMPHELPER_DLLPUBLIC OAccessibleSelectionHelper : public OAccessibleComponentHelper,
91 public OCommonAccessibleSelection,
92 public OAccessibleSelectionHelper_Base
94 protected:
96 /// see the respective base class ctor for an extensive comment on this, please
97 OAccessibleSelectionHelper( IMutex* _pExternalLock );
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 );
102 public:
104 // XInterface
105 DECLARE_XINTERFACE( )
106 DECLARE_XTYPEPROVIDER( )
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);
118 //.........................................................................
119 } // namespace comphelper
120 //.........................................................................
122 #endif // COMPHELPER_ACCESSIBLE_SELECTION_HELPER_HXX
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */