1*9877b273SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*9877b273SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*9877b273SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*9877b273SAndrew Rist * distributed with this work for additional information 6*9877b273SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*9877b273SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*9877b273SAndrew Rist * "License"); you may not use this file except in compliance 9*9877b273SAndrew Rist * with the License. You may obtain a copy of the License at 10*9877b273SAndrew Rist * 11*9877b273SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*9877b273SAndrew Rist * 13*9877b273SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*9877b273SAndrew Rist * software distributed under the License is distributed on an 15*9877b273SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*9877b273SAndrew Rist * KIND, either express or implied. See the License for the 17*9877b273SAndrew Rist * specific language governing permissions and limitations 18*9877b273SAndrew Rist * under the License. 19*9877b273SAndrew Rist * 20*9877b273SAndrew Rist *************************************************************/ 21*9877b273SAndrew Rist 22*9877b273SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef COMPHELPER_ACCESSIBLE_SELECTION_HELPER_HXX 25cdf0e10cSrcweir #define COMPHELPER_ACCESSIBLE_SELECTION_HELPER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <comphelper/uno3.hxx> 28cdf0e10cSrcweir #ifndef COMPHELPER_ACCESSIBLE_CONTEXT_HELPER_HXX 29cdf0e10cSrcweir #include <comphelper/accessiblecomponenthelper.hxx> 30cdf0e10cSrcweir #endif 31cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 32cdf0e10cSrcweir #include <comphelper/uno3.hxx> 33cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 34cdf0e10cSrcweir #include "comphelper/comphelperdllapi.h" 35cdf0e10cSrcweir 36cdf0e10cSrcweir #define ACCESSIBLE_SELECTION_CHILD_ALL ((sal_Int32)-1) 37cdf0e10cSrcweir #define ACCESSIBLE_SELECTION_CHILD_SELF ((sal_Int32)-2) 38cdf0e10cSrcweir 39cdf0e10cSrcweir //......................................................................... 40cdf0e10cSrcweir namespace comphelper 41cdf0e10cSrcweir { 42cdf0e10cSrcweir //......................................................................... 43cdf0e10cSrcweir 44cdf0e10cSrcweir //===================================================================== 45cdf0e10cSrcweir //= OCommonAccessibleSelection 46cdf0e10cSrcweir //===================================================================== 47cdf0e10cSrcweir /** base class encapsulating common functionality for the helper classes implementing 48cdf0e10cSrcweir the XAccessibleSelection 49cdf0e10cSrcweir */ 50cdf0e10cSrcweir class COMPHELPER_DLLPUBLIC OCommonAccessibleSelection 51cdf0e10cSrcweir { 52cdf0e10cSrcweir protected: 53cdf0e10cSrcweir 54cdf0e10cSrcweir OCommonAccessibleSelection(); 55cdf0e10cSrcweir 56cdf0e10cSrcweir protected: 57cdf0e10cSrcweir 58cdf0e10cSrcweir // access to context - still waiting to be overwritten 59cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > 60cdf0e10cSrcweir implGetAccessibleContext() 61cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ) = 0; 62cdf0e10cSrcweir 63cdf0e10cSrcweir // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) 64cdf0e10cSrcweir virtual sal_Bool 65cdf0e10cSrcweir implIsSelected( sal_Int32 nAccessibleChildIndex ) 66cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) = 0; 67cdf0e10cSrcweir 68cdf0e10cSrcweir // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) 69cdf0e10cSrcweir virtual void 70cdf0e10cSrcweir implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect ) 71cdf0e10cSrcweir throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) = 0; 72cdf0e10cSrcweir 73cdf0e10cSrcweir protected: 74cdf0e10cSrcweir 75cdf0e10cSrcweir /** non-virtual versions of the methods which can be implemented using <method>implIsSelected</method> and <method>implSelect</method> 76cdf0e10cSrcweir */ 77cdf0e10cSrcweir void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 78cdf0e10cSrcweir sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 79cdf0e10cSrcweir void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); 80cdf0e10cSrcweir void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); 81cdf0e10cSrcweir sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); 82cdf0e10cSrcweir ::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); 83cdf0e10cSrcweir void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 84cdf0e10cSrcweir }; 85cdf0e10cSrcweir 86cdf0e10cSrcweir //===================================================================== 87cdf0e10cSrcweir //= OAccessibleSelectionHelper 88cdf0e10cSrcweir //===================================================================== 89cdf0e10cSrcweir 90cdf0e10cSrcweir typedef ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleSelection > OAccessibleSelectionHelper_Base; 91cdf0e10cSrcweir 92cdf0e10cSrcweir /** a helper class for implementing an AccessibleSelection which at the same time 93cdf0e10cSrcweir supports an XAccessibleSelection interface. 94cdf0e10cSrcweir */ 95cdf0e10cSrcweir class COMPHELPER_DLLPUBLIC OAccessibleSelectionHelper : public OAccessibleComponentHelper, 96cdf0e10cSrcweir public OCommonAccessibleSelection, 97cdf0e10cSrcweir public OAccessibleSelectionHelper_Base 98cdf0e10cSrcweir { 99cdf0e10cSrcweir protected: 100cdf0e10cSrcweir 101cdf0e10cSrcweir OAccessibleSelectionHelper( ); 102cdf0e10cSrcweir 103cdf0e10cSrcweir /// see the respective base class ctor for an extensive comment on this, please 104cdf0e10cSrcweir OAccessibleSelectionHelper( IMutex* _pExternalLock ); 105cdf0e10cSrcweir 106cdf0e10cSrcweir // return ourself here by default 107cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > implGetAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException ); 108cdf0e10cSrcweir 109cdf0e10cSrcweir public: 110cdf0e10cSrcweir 111cdf0e10cSrcweir // XInterface 112cdf0e10cSrcweir DECLARE_XINTERFACE( ) 113cdf0e10cSrcweir DECLARE_XTYPEPROVIDER( ) 114cdf0e10cSrcweir 115cdf0e10cSrcweir // XAccessibleSelection - default implementations 116cdf0e10cSrcweir virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 117cdf0e10cSrcweir virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 118cdf0e10cSrcweir virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); 119cdf0e10cSrcweir virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); 120cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); 121cdf0e10cSrcweir 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); 122cdf0e10cSrcweir virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 123cdf0e10cSrcweir }; 124cdf0e10cSrcweir 125cdf0e10cSrcweir //......................................................................... 126cdf0e10cSrcweir } // namespace comphelper 127cdf0e10cSrcweir //......................................................................... 128cdf0e10cSrcweir 129cdf0e10cSrcweir #endif // COMPHELPER_ACCESSIBLE_SELECTION_HELPER_HXX 130cdf0e10cSrcweir 131