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 24 #ifndef SD_ACCESSIBILITY_ACCESSIBLE_SLIDE_SORTER_VIEW_HXX 25 #define SD_ACCESSIBILITY_ACCESSIBLE_SLIDE_SORTER_VIEW_HXX 26 27 #include "MutexOwner.hxx" 28 #include <cppuhelper/compbase6.hxx> 29 #include <com/sun/star/accessibility/XAccessible.hpp> 30 #include <com/sun/star/accessibility/XAccessibleContext.hpp> 31 #include <com/sun/star/accessibility/XAccessibleComponent.hpp> 32 #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 33 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> 34 #include <com/sun/star/lang/XServiceInfo.hpp> 35 #include <com/sun/star/lang/DisposedException.hpp> 36 #include <com/sun/star/awt/XFocusListener.hpp> 37 #include <com/sun/star/document/XEventListener.hpp> 38 39 40 #include <memory> 41 42 class Window; 43 44 namespace sd { namespace slidesorter { 45 class SlideSorter; 46 } } 47 48 namespace accessibility { 49 50 51 class AccessibleSlideSorterObject; 52 53 typedef ::cppu::WeakComponentImplHelper6< 54 ::com::sun::star::accessibility::XAccessible, 55 ::com::sun::star::accessibility::XAccessibleEventBroadcaster, 56 ::com::sun::star::accessibility::XAccessibleContext, 57 ::com::sun::star::accessibility::XAccessibleComponent, 58 ::com::sun::star::accessibility::XAccessibleSelection, 59 ::com::sun::star::lang::XServiceInfo 60 > AccessibleSlideSorterViewBase; 61 62 /** This class makes the SlideSorterViewShell accessible. It uses objects 63 of the AccessibleSlideSorterObject class to the make the page objects 64 accessible. 65 */ 66 class AccessibleSlideSorterView 67 : public ::sd::MutexOwner, 68 public AccessibleSlideSorterViewBase 69 { 70 public: 71 AccessibleSlideSorterView( 72 ::sd::slidesorter::SlideSorter& rSlideSorter, 73 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> & rxParent, 74 ::Window* pParentWindow); 75 76 virtual ~AccessibleSlideSorterView (void); 77 78 /** This method acts like a dispose call. It sends a disposing to all 79 of its listeners. It may be called twice. 80 */ 81 void Destroyed (void); 82 83 void FireAccessibleEvent ( 84 short nEventId, 85 const ::com::sun::star::uno::Any& rOldValue, 86 const ::com::sun::star::uno::Any& rNewValue); 87 88 virtual void SAL_CALL disposing (void); 89 90 /** Return the implementation object of the specified child. 91 @param nIndex 92 Index of the child for which to return the implementation object. 93 */ 94 AccessibleSlideSorterObject* GetAccessibleChildImplementation (sal_Int32 nIndex); 95 96 //===== XAccessible ======================================================= 97 98 virtual ::com::sun::star::uno::Reference< 99 ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL 100 getAccessibleContext (void) 101 throw (::com::sun::star::uno::RuntimeException); 102 103 104 //===== XAccessibleEventBroadcaster ======================================= 105 virtual void SAL_CALL 106 addEventListener( 107 const ::com::sun::star::uno::Reference< 108 ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener) 109 throw (::com::sun::star::uno::RuntimeException); 110 111 virtual void SAL_CALL 112 removeEventListener( 113 const ::com::sun::star::uno::Reference< 114 ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener ) 115 throw (::com::sun::star::uno::RuntimeException); 116 117 using cppu::WeakComponentImplHelperBase::addEventListener; 118 using cppu::WeakComponentImplHelperBase::removeEventListener; 119 120 //===== XAccessibleContext ============================================== 121 122 /// Return the number of currently visible children. 123 virtual sal_Int32 SAL_CALL 124 getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException); 125 126 /// Return the specified child or throw exception. 127 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 128 getAccessibleChild (sal_Int32 nIndex) 129 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 130 131 /// Return a reference to the parent. 132 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 133 getAccessibleParent (void) 134 throw (::com::sun::star::uno::RuntimeException); 135 136 /// Return this objects index among the parents children. 137 virtual sal_Int32 SAL_CALL 138 getAccessibleIndexInParent (void) 139 throw (::com::sun::star::uno::RuntimeException); 140 141 /// Return this object's role. 142 virtual sal_Int16 SAL_CALL 143 getAccessibleRole (void) 144 throw (::com::sun::star::uno::RuntimeException); 145 146 /// Return this object's description. 147 virtual ::rtl::OUString SAL_CALL 148 getAccessibleDescription (void) 149 throw (::com::sun::star::uno::RuntimeException); 150 151 /// Return the object's current name. 152 virtual ::rtl::OUString SAL_CALL 153 getAccessibleName (void) 154 throw (::com::sun::star::uno::RuntimeException); 155 156 /// Return NULL to indicate that an empty relation set. 157 virtual ::com::sun::star::uno::Reference< 158 ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL 159 getAccessibleRelationSet (void) 160 throw (::com::sun::star::uno::RuntimeException); 161 162 /// Return the set of current states. 163 virtual ::com::sun::star::uno::Reference< 164 ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL 165 getAccessibleStateSet (void) 166 throw (::com::sun::star::uno::RuntimeException); 167 168 /** Return the parents locale or throw exception if this object has no 169 parent yet/anymore. 170 */ 171 virtual ::com::sun::star::lang::Locale SAL_CALL 172 getLocale (void) 173 throw (::com::sun::star::uno::RuntimeException, 174 ::com::sun::star::accessibility::IllegalAccessibleComponentStateException); 175 176 //===== XAccessibleComponent ================================================ 177 178 /** The default implementation uses the result of 179 <member>getBounds</member> to determine whether the given point lies 180 inside this object. 181 */ 182 virtual sal_Bool SAL_CALL containsPoint ( 183 const ::com::sun::star::awt::Point& aPoint) 184 throw (::com::sun::star::uno::RuntimeException); 185 186 /** The default implementation returns an empty reference. 187 */ 188 virtual ::com::sun::star::uno::Reference< 189 ::com::sun::star::accessibility::XAccessible > SAL_CALL 190 getAccessibleAtPoint ( 191 const ::com::sun::star::awt::Point& aPoint) 192 throw (::com::sun::star::uno::RuntimeException); 193 194 /** The default implementation returns an empty rectangle. 195 */ 196 virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (void) 197 throw (::com::sun::star::uno::RuntimeException); 198 199 /** The default implementation uses the result of 200 <member>getBounds</member> to determine the location. 201 */ 202 virtual ::com::sun::star::awt::Point SAL_CALL getLocation (void) 203 throw (::com::sun::star::uno::RuntimeException); 204 205 /** The default implementation returns an empty position, i.e. the 206 * result of the default constructor of <type>com::sun::star::awt::Point</type>. 207 */ 208 virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen (void) 209 throw (::com::sun::star::uno::RuntimeException); 210 211 /** The default implementation uses the result of 212 <member>getBounds</member> to determine the size. 213 */ 214 virtual ::com::sun::star::awt::Size SAL_CALL getSize (void) 215 throw (::com::sun::star::uno::RuntimeException); 216 217 /** The default implementation does nothing. 218 */ 219 virtual void SAL_CALL grabFocus (void) 220 throw (::com::sun::star::uno::RuntimeException); 221 222 /** Returns black as the default foreground color. 223 */ 224 virtual sal_Int32 SAL_CALL getForeground (void) 225 throw (::com::sun::star::uno::RuntimeException); 226 227 /** Returns white as the default background color. 228 */ 229 virtual sal_Int32 SAL_CALL getBackground (void) 230 throw (::com::sun::star::uno::RuntimeException); 231 232 233 //===== XAccessibleSelection ============================================== 234 235 virtual void SAL_CALL 236 selectAccessibleChild (sal_Int32 nChildIndex) 237 throw (::com::sun::star::lang::IndexOutOfBoundsException, 238 ::com::sun::star::uno::RuntimeException); 239 240 virtual sal_Bool SAL_CALL 241 isAccessibleChildSelected( sal_Int32 nChildIndex ) 242 throw (::com::sun::star::lang::IndexOutOfBoundsException, 243 ::com::sun::star::uno::RuntimeException); 244 245 virtual void SAL_CALL 246 clearAccessibleSelection( ) 247 throw (::com::sun::star::uno::RuntimeException); 248 249 virtual void SAL_CALL 250 selectAllAccessibleChildren( ) 251 throw (::com::sun::star::uno::RuntimeException); 252 253 virtual sal_Int32 SAL_CALL 254 getSelectedAccessibleChildCount( ) 255 throw (::com::sun::star::uno::RuntimeException); 256 257 virtual ::com::sun::star::uno::Reference< 258 ::com::sun::star::accessibility::XAccessible > SAL_CALL 259 getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) 260 throw (::com::sun::star::lang::IndexOutOfBoundsException, 261 ::com::sun::star::uno::RuntimeException); 262 263 virtual void SAL_CALL 264 deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) 265 throw (::com::sun::star::lang::IndexOutOfBoundsException, 266 ::com::sun::star::uno::RuntimeException); 267 268 269 //===== XServiceInfo ==================================================== 270 271 /** Returns an identifier for the implementation of this object. 272 */ 273 virtual ::rtl::OUString SAL_CALL 274 getImplementationName (void) 275 throw (::com::sun::star::uno::RuntimeException); 276 277 /** Return whether the specified service is supported by this class. 278 */ 279 virtual sal_Bool SAL_CALL 280 supportsService (const ::rtl::OUString& sServiceName) 281 throw (::com::sun::star::uno::RuntimeException); 282 283 /** Returns a list of all supported services. 284 */ 285 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL 286 getSupportedServiceNames (void) 287 throw (::com::sun::star::uno::RuntimeException); 288 289 virtual void SwitchViewActivated (void); 290 private: 291 class Implementation; 292 ::std::auto_ptr<Implementation> mpImpl; 293 294 ::sd::slidesorter::SlideSorter& mrSlideSorter; 295 296 ::com::sun::star::uno::Reference< 297 ::com::sun::star::accessibility::XAccessible> mxParent; 298 299 sal_uInt32 mnClientId; 300 301 ::Window* mpContentWindow; 302 303 /** Check whether or not the object has been disposed (or is in the 304 state of beeing disposed). If that is the case then 305 DisposedException is thrown to inform the (indirect) caller of the 306 foul deed. 307 */ 308 void ThrowIfDisposed (void) 309 throw (::com::sun::star::lang::DisposedException); 310 311 /** Check whether or not the object has been disposed (or is in the 312 state of beeing disposed). 313 314 @return sal_True, if the object is disposed or in the course 315 of being disposed. Otherwise, sal_False is returned. 316 */ 317 sal_Bool IsDisposed (void); 318 }; 319 320 } // end of namespace ::accessibility 321 322 #endif 323