1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _ACCDOC_HXX 28 #define _ACCDOC_HXX 29 #ifndef _ACCCONTEXT_HXX 30 #include "acccontext.hxx" 31 #endif 32 #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 33 #include <accselectionhelper.hxx> 34 35 class VclSimpleEvent; 36 37 /** 38 * base class for SwAccessibleDocument (in this same header file) and 39 * SwAccessiblePreview 40 */ 41 class SwAccessibleDocumentBase : public SwAccessibleContext 42 { 43 ::com::sun::star::uno::Reference< 44 ::com::sun::star::accessibility::XAccessible> mxParent; 45 46 Window* mpChildWin; // protected by solar mutext 47 48 using SwAccessibleFrame::SetVisArea; 49 50 protected: 51 52 virtual ~SwAccessibleDocumentBase(); 53 54 public: 55 56 SwAccessibleDocumentBase( SwAccessibleMap* pInitMap ); 57 58 void SetVisArea(); 59 60 virtual void AddChild( Window *pWin, sal_Bool bFireEvent = sal_True ); 61 virtual void RemoveChild( Window *pWin ); 62 63 //===== XAccessibleContext ============================================== 64 65 /// Return the number of currently visible children. 66 virtual sal_Int32 SAL_CALL getAccessibleChildCount (void) 67 throw (::com::sun::star::uno::RuntimeException); 68 69 /// Return the specified child or NULL if index is invalid. 70 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 71 getAccessibleChild (sal_Int32 nIndex) 72 throw (::com::sun::star::uno::RuntimeException, 73 ::com::sun::star::lang::IndexOutOfBoundsException); 74 75 /// Return a reference to the parent. 76 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 77 getAccessibleParent (void) 78 throw (::com::sun::star::uno::RuntimeException); 79 80 /// Return this objects index among the parents children. 81 virtual sal_Int32 SAL_CALL 82 getAccessibleIndexInParent (void) 83 throw (::com::sun::star::uno::RuntimeException); 84 85 /// Return this object's description. 86 virtual ::rtl::OUString SAL_CALL 87 getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException); 88 89 //===== XAccessibleComponent ============================================== 90 virtual sal_Bool SAL_CALL containsPoint( 91 const ::com::sun::star::awt::Point& aPoint ) 92 throw (::com::sun::star::uno::RuntimeException); 93 94 virtual ::com::sun::star::uno::Reference< 95 ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( 96 const ::com::sun::star::awt::Point& aPoint ) 97 throw (::com::sun::star::uno::RuntimeException); 98 99 virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() 100 throw (::com::sun::star::uno::RuntimeException); 101 102 virtual ::com::sun::star::awt::Point SAL_CALL getLocation() 103 throw (::com::sun::star::uno::RuntimeException); 104 105 virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() 106 throw (::com::sun::star::uno::RuntimeException); 107 108 virtual ::com::sun::star::awt::Size SAL_CALL getSize() 109 throw (::com::sun::star::uno::RuntimeException); 110 }; 111 112 113 114 /** 115 * access to an accessible Writer document 116 */ 117 class SwAccessibleDocument : public SwAccessibleDocumentBase, 118 public com::sun::star::accessibility::XAccessibleSelection 119 { 120 // Implementation for XAccessibleSelection interface 121 SwAccessibleSelectionHelper maSelectionHelper; 122 123 protected: 124 125 // Set states for getAccessibleStateSet. 126 // This drived class additinaly sets MULTISELECTABLE(1) 127 virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet ); 128 129 virtual ~SwAccessibleDocument(); 130 131 public: 132 133 SwAccessibleDocument( SwAccessibleMap* pInitMap ); 134 135 DECL_LINK( WindowChildEventListener, VclSimpleEvent* ); 136 137 //===== XServiceInfo ==================================================== 138 139 /** Returns an identifier for the implementation of this object. 140 */ 141 virtual ::rtl::OUString SAL_CALL 142 getImplementationName (void) 143 throw (::com::sun::star::uno::RuntimeException); 144 145 /** Return whether the specified service is supported by this class. 146 */ 147 virtual sal_Bool SAL_CALL 148 supportsService (const ::rtl::OUString& sServiceName) 149 throw (::com::sun::star::uno::RuntimeException); 150 151 /** Returns a list of all supported services. In this case that is just 152 the AccessibleContext service. 153 */ 154 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL 155 getSupportedServiceNames (void) 156 throw (::com::sun::star::uno::RuntimeException); 157 158 //===== XInterface ====================================================== 159 160 // XInterface is inherited through SwAcessibleContext and 161 // XAccessibleSelection. These methods are needed to avoid 162 // ambigiouties. 163 164 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 165 const ::com::sun::star::uno::Type& aType ) 166 throw (::com::sun::star::uno::RuntimeException); 167 168 virtual void SAL_CALL acquire( ) throw () 169 { SwAccessibleContext::acquire(); }; 170 171 virtual void SAL_CALL release( ) throw () 172 { SwAccessibleContext::release(); }; 173 174 //====== XTypeProvider ==================================================== 175 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); 176 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); 177 178 //===== XAccessibleSelection ============================================ 179 180 virtual void SAL_CALL selectAccessibleChild( 181 sal_Int32 nChildIndex ) 182 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 183 ::com::sun::star::uno::RuntimeException ); 184 185 virtual sal_Bool SAL_CALL isAccessibleChildSelected( 186 sal_Int32 nChildIndex ) 187 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 188 ::com::sun::star::uno::RuntimeException ); 189 virtual void SAL_CALL clearAccessibleSelection( ) 190 throw ( ::com::sun::star::uno::RuntimeException ); 191 virtual void SAL_CALL selectAllAccessibleChildren( ) 192 throw ( ::com::sun::star::uno::RuntimeException ); 193 virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) 194 throw ( ::com::sun::star::uno::RuntimeException ); 195 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( 196 sal_Int32 nSelectedChildIndex ) 197 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 198 ::com::sun::star::uno::RuntimeException); 199 200 // --> OD 2004-11-16 #111714# - index has to be treated as global child index. 201 virtual void SAL_CALL deselectAccessibleChild( 202 sal_Int32 nChildIndex ) 203 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 204 ::com::sun::star::uno::RuntimeException ); 205 206 //====== thread safe C++ interface ======================================== 207 208 // The object is not visible an longer and should be destroyed 209 virtual void Dispose( sal_Bool bRecursive = sal_False ); 210 }; 211 212 #endif 213 214