1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 #ifndef _ACCDOC_HXX 23 #define _ACCDOC_HXX 24 #ifndef _ACCCONTEXT_HXX 25 #include "acccontext.hxx" 26 #endif 27 #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 28 #include <com/sun/star/document/XEventListener.hpp> 29 #include <accselectionhelper.hxx> 30 31 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleExtendedAttributes_HPP_ 32 #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp> 33 #endif 34 35 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEGETACCFLOWTO_HPP_ 36 #include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp> 37 #endif 38 39 class VclSimpleEvent; 40 41 /** 42 * base class for SwAccessibleDocument (in this same header file) and 43 * SwAccessiblePreview 44 */ 45 class SwAccessibleDocumentBase : public SwAccessibleContext 46 { 47 ::com::sun::star::uno::Reference< 48 ::com::sun::star::accessibility::XAccessible> mxParent; 49 50 Window* mpChildWin; // protected by solar mutex 51 52 using SwAccessibleFrame::SetVisArea; 53 54 protected: 55 56 virtual ~SwAccessibleDocumentBase(); 57 58 public: 59 60 SwAccessibleDocumentBase( SwAccessibleMap* pInitMap ); 61 62 void SetVisArea(); 63 64 virtual void AddChild( Window *pWin, sal_Bool bFireEvent = sal_True ); 65 virtual void RemoveChild( Window *pWin ); 66 67 //===== XAccessibleContext ============================================== 68 69 /// Return the number of currently visible children. 70 virtual sal_Int32 SAL_CALL getAccessibleChildCount (void) 71 throw (::com::sun::star::uno::RuntimeException); 72 73 /// Return the specified child or NULL if index is invalid. 74 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 75 getAccessibleChild (sal_Int32 nIndex) 76 throw (::com::sun::star::uno::RuntimeException, 77 ::com::sun::star::lang::IndexOutOfBoundsException); 78 79 /// Return a reference to the parent. 80 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 81 getAccessibleParent (void) 82 throw (::com::sun::star::uno::RuntimeException); 83 84 /// Return this objects index among the parents children. 85 virtual sal_Int32 SAL_CALL 86 getAccessibleIndexInParent (void) 87 throw (::com::sun::star::uno::RuntimeException); 88 89 /// Return this object's description. 90 virtual ::rtl::OUString SAL_CALL 91 getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException); 92 virtual ::rtl::OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException); 93 94 //===== XAccessibleComponent ============================================== 95 virtual sal_Bool SAL_CALL containsPoint( 96 const ::com::sun::star::awt::Point& aPoint ) 97 throw (::com::sun::star::uno::RuntimeException); 98 99 virtual ::com::sun::star::uno::Reference< 100 ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( 101 const ::com::sun::star::awt::Point& aPoint ) 102 throw (::com::sun::star::uno::RuntimeException); 103 104 virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() 105 throw (::com::sun::star::uno::RuntimeException); 106 107 virtual ::com::sun::star::awt::Point SAL_CALL getLocation() 108 throw (::com::sun::star::uno::RuntimeException); 109 110 virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() 111 throw (::com::sun::star::uno::RuntimeException); 112 113 virtual ::com::sun::star::awt::Size SAL_CALL getSize() 114 throw (::com::sun::star::uno::RuntimeException); 115 }; 116 117 118 /** 119 * access to an accessible Writer document 120 */ 121 class SwAccessibleDocument : public SwAccessibleDocumentBase, 122 public com::sun::star::accessibility::XAccessibleSelection, 123 public com::sun::star::document::XEventListener, 124 public com::sun::star::accessibility::XAccessibleExtendedAttributes, 125 public com::sun::star::accessibility::XAccessibleGetAccFlowTo 126 { 127 // Implementation for XAccessibleSelection interface 128 SwAccessibleSelectionHelper maSelectionHelper; 129 130 protected: 131 132 // Set states for getAccessibleStateSet. 133 // This derived class additionally sets MULTISELECTABLE(1) 134 virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet ); 135 136 virtual ~SwAccessibleDocument(); 137 138 public: 139 140 SwAccessibleDocument( SwAccessibleMap* pInitMap ); 141 142 DECL_LINK( WindowChildEventListener, VclSimpleEvent* ); 143 //===== XEventListener==================================================== 144 virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event ) 145 throw (::com::sun::star::uno::RuntimeException); 146 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Event ) 147 throw (::com::sun::star::uno::RuntimeException); 148 149 //===== XServiceInfo ==================================================== 150 151 /** Returns an identifier for the implementation of this object. 152 */ 153 virtual ::rtl::OUString SAL_CALL 154 getImplementationName (void) 155 throw (::com::sun::star::uno::RuntimeException); 156 157 /** Return whether the specified service is supported by this class. 158 */ 159 virtual sal_Bool SAL_CALL 160 supportsService (const ::rtl::OUString& sServiceName) 161 throw (::com::sun::star::uno::RuntimeException); 162 163 /** Returns a list of all supported services. In this case that is just 164 the AccessibleContext service. 165 */ 166 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL 167 getSupportedServiceNames (void) 168 throw (::com::sun::star::uno::RuntimeException); 169 170 //===== XInterface ====================================================== 171 172 // XInterface is inherited through SwAcessibleContext and 173 // XAccessibleSelection. These methods are needed to avoid 174 // ambiguities. 175 176 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 177 const ::com::sun::star::uno::Type& aType ) 178 throw (::com::sun::star::uno::RuntimeException); 179 180 virtual void SAL_CALL acquire( ) throw () 181 { SwAccessibleContext::acquire(); }; 182 183 virtual void SAL_CALL release( ) throw () 184 { SwAccessibleContext::release(); }; 185 186 //====== XTypeProvider ==================================================== 187 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); 188 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); 189 190 //===== XAccessibleSelection ============================================ 191 192 virtual void SAL_CALL selectAccessibleChild( 193 sal_Int32 nChildIndex ) 194 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 195 ::com::sun::star::uno::RuntimeException ); 196 197 virtual sal_Bool SAL_CALL isAccessibleChildSelected( 198 sal_Int32 nChildIndex ) 199 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 200 ::com::sun::star::uno::RuntimeException ); 201 virtual void SAL_CALL clearAccessibleSelection( ) 202 throw ( ::com::sun::star::uno::RuntimeException ); 203 virtual void SAL_CALL selectAllAccessibleChildren( ) 204 throw ( ::com::sun::star::uno::RuntimeException ); 205 virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) 206 throw ( ::com::sun::star::uno::RuntimeException ); 207 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( 208 sal_Int32 nSelectedChildIndex ) 209 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 210 ::com::sun::star::uno::RuntimeException); 211 212 // --> OD 2004-11-16 #111714# - index has to be treated as global child index. 213 virtual void SAL_CALL deselectAccessibleChild( 214 sal_Int32 nChildIndex ) 215 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 216 ::com::sun::star::uno::RuntimeException ); 217 218 virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() 219 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; 220 //====== thread safe C++ interface ======================================== 221 222 // The object is not visible an longer and should be destroyed 223 virtual void Dispose( sal_Bool bRecursive = sal_False ); 224 225 //===== XAccessibleComponent ============================================ 226 sal_Int32 SAL_CALL getBackground() 227 throw (::com::sun::star::uno::RuntimeException); 228 229 //===== XAccessibleGetAccFlowTo ============================================ 230 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > 231 SAL_CALL get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType) 232 throw ( ::com::sun::star::uno::RuntimeException ); 233 }; 234 235 #endif 236 237 /* vim: set noet sw=4 ts=4: */ 238