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 23 #ifndef _ACCDOC_HXX 24 #define _ACCDOC_HXX 25 #ifndef _ACCCONTEXT_HXX 26 #include "acccontext.hxx" 27 #endif 28 #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 29 #include <accselectionhelper.hxx> 30 31 class VclSimpleEvent; 32 33 /** 34 * base class for SwAccessibleDocument (in this same header file) and 35 * SwAccessiblePreview 36 */ 37 class SwAccessibleDocumentBase : public SwAccessibleContext 38 { 39 ::com::sun::star::uno::Reference< 40 ::com::sun::star::accessibility::XAccessible> mxParent; 41 42 Window* mpChildWin; // protected by solar mutext 43 44 using SwAccessibleFrame::SetVisArea; 45 46 protected: 47 48 virtual ~SwAccessibleDocumentBase(); 49 50 public: 51 52 SwAccessibleDocumentBase( SwAccessibleMap* pInitMap ); 53 54 void SetVisArea(); 55 56 virtual void AddChild( Window *pWin, sal_Bool bFireEvent = sal_True ); 57 virtual void RemoveChild( Window *pWin ); 58 59 //===== XAccessibleContext ============================================== 60 61 /// Return the number of currently visible children. 62 virtual sal_Int32 SAL_CALL getAccessibleChildCount (void) 63 throw (::com::sun::star::uno::RuntimeException); 64 65 /// Return the specified child or NULL if index is invalid. 66 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 67 getAccessibleChild (sal_Int32 nIndex) 68 throw (::com::sun::star::uno::RuntimeException, 69 ::com::sun::star::lang::IndexOutOfBoundsException); 70 71 /// Return a reference to the parent. 72 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 73 getAccessibleParent (void) 74 throw (::com::sun::star::uno::RuntimeException); 75 76 /// Return this objects index among the parents children. 77 virtual sal_Int32 SAL_CALL 78 getAccessibleIndexInParent (void) 79 throw (::com::sun::star::uno::RuntimeException); 80 81 /// Return this object's description. 82 virtual ::rtl::OUString SAL_CALL 83 getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException); 84 85 //===== XAccessibleComponent ============================================== 86 virtual sal_Bool SAL_CALL containsPoint( 87 const ::com::sun::star::awt::Point& aPoint ) 88 throw (::com::sun::star::uno::RuntimeException); 89 90 virtual ::com::sun::star::uno::Reference< 91 ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( 92 const ::com::sun::star::awt::Point& aPoint ) 93 throw (::com::sun::star::uno::RuntimeException); 94 95 virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() 96 throw (::com::sun::star::uno::RuntimeException); 97 98 virtual ::com::sun::star::awt::Point SAL_CALL getLocation() 99 throw (::com::sun::star::uno::RuntimeException); 100 101 virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() 102 throw (::com::sun::star::uno::RuntimeException); 103 104 virtual ::com::sun::star::awt::Size SAL_CALL getSize() 105 throw (::com::sun::star::uno::RuntimeException); 106 }; 107 108 109 110 /** 111 * access to an accessible Writer document 112 */ 113 class SwAccessibleDocument : public SwAccessibleDocumentBase, 114 public com::sun::star::accessibility::XAccessibleSelection 115 { 116 // Implementation for XAccessibleSelection interface 117 SwAccessibleSelectionHelper maSelectionHelper; 118 119 protected: 120 121 // Set states for getAccessibleStateSet. 122 // This drived class additinaly sets MULTISELECTABLE(1) 123 virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet ); 124 125 virtual ~SwAccessibleDocument(); 126 127 public: 128 129 SwAccessibleDocument( SwAccessibleMap* pInitMap ); 130 131 DECL_LINK( WindowChildEventListener, VclSimpleEvent* ); 132 133 //===== XServiceInfo ==================================================== 134 135 /** Returns an identifier for the implementation of this object. 136 */ 137 virtual ::rtl::OUString SAL_CALL 138 getImplementationName (void) 139 throw (::com::sun::star::uno::RuntimeException); 140 141 /** Return whether the specified service is supported by this class. 142 */ 143 virtual sal_Bool SAL_CALL 144 supportsService (const ::rtl::OUString& sServiceName) 145 throw (::com::sun::star::uno::RuntimeException); 146 147 /** Returns a list of all supported services. In this case that is just 148 the AccessibleContext service. 149 */ 150 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL 151 getSupportedServiceNames (void) 152 throw (::com::sun::star::uno::RuntimeException); 153 154 //===== XInterface ====================================================== 155 156 // XInterface is inherited through SwAcessibleContext and 157 // XAccessibleSelection. These methods are needed to avoid 158 // ambigiouties. 159 160 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 161 const ::com::sun::star::uno::Type& aType ) 162 throw (::com::sun::star::uno::RuntimeException); 163 164 virtual void SAL_CALL acquire( ) throw () 165 { SwAccessibleContext::acquire(); }; 166 167 virtual void SAL_CALL release( ) throw () 168 { SwAccessibleContext::release(); }; 169 170 //====== XTypeProvider ==================================================== 171 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); 172 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); 173 174 //===== XAccessibleSelection ============================================ 175 176 virtual void SAL_CALL selectAccessibleChild( 177 sal_Int32 nChildIndex ) 178 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 179 ::com::sun::star::uno::RuntimeException ); 180 181 virtual sal_Bool SAL_CALL isAccessibleChildSelected( 182 sal_Int32 nChildIndex ) 183 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 184 ::com::sun::star::uno::RuntimeException ); 185 virtual void SAL_CALL clearAccessibleSelection( ) 186 throw ( ::com::sun::star::uno::RuntimeException ); 187 virtual void SAL_CALL selectAllAccessibleChildren( ) 188 throw ( ::com::sun::star::uno::RuntimeException ); 189 virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) 190 throw ( ::com::sun::star::uno::RuntimeException ); 191 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( 192 sal_Int32 nSelectedChildIndex ) 193 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 194 ::com::sun::star::uno::RuntimeException); 195 196 // --> OD 2004-11-16 #111714# - index has to be treated as global child index. 197 virtual void SAL_CALL deselectAccessibleChild( 198 sal_Int32 nChildIndex ) 199 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 200 ::com::sun::star::uno::RuntimeException ); 201 202 //====== thread safe C++ interface ======================================== 203 204 // The object is not visible an longer and should be destroyed 205 virtual void Dispose( sal_Bool bRecursive = sal_False ); 206 }; 207 208 #endif 209 210