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_OBJECT_HXX 25 #define SD_ACCESSIBILITY_ACCESSIBLE_SLIDE_SORTER_OBJECT_HXX 26 27 #include "MutexOwner.hxx" 28 #include <cppuhelper/compbase5.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/awt/XFocusListener.hpp> 35 #include <com/sun/star/lang/XServiceInfo.hpp> 36 #include <com/sun/star/lang/DisposedException.hpp> 37 38 class SdPage; 39 40 namespace sd { namespace slidesorter { 41 class SlideSorter; 42 } } 43 44 namespace accessibility { 45 46 47 typedef ::cppu::WeakComponentImplHelper5< 48 ::com::sun::star::accessibility::XAccessible, 49 ::com::sun::star::accessibility::XAccessibleEventBroadcaster, 50 ::com::sun::star::accessibility::XAccessibleContext, 51 ::com::sun::star::accessibility::XAccessibleComponent, 52 ::com::sun::star::lang::XServiceInfo > AccessibleSlideSorterObjectBase; 53 54 55 /** This class makes page objects of the slide sorter accessible. 56 */ 57 class AccessibleSlideSorterObject 58 : public ::sd::MutexOwner, 59 public AccessibleSlideSorterObjectBase 60 { 61 public: 62 /** Create a new object that represents a page object in the slide 63 sorter. 64 @param rxParent 65 The accessible parent. 66 @param rSlideSorter 67 The slide sorter whose model manages the page. 68 @param nPageNumber 69 The number of the page in the range [0,nPageCount). 70 */ 71 AccessibleSlideSorterObject( 72 const ::com::sun::star::uno::Reference< 73 ::com::sun::star::accessibility::XAccessible >& rxParent, 74 ::sd::slidesorter::SlideSorter& rSlideSorter, 75 sal_uInt16 nPageNumber); 76 ~AccessibleSlideSorterObject (void); 77 78 /** Return the page that is made accessible by the called object. 79 */ 80 SdPage* GetPage (void) const; 81 82 /** The page number as given to the constructor. 83 */ 84 sal_uInt16 GetPageNumber (void) const; 85 86 void FireAccessibleEvent ( 87 short nEventId, 88 const ::com::sun::star::uno::Any& rOldValue, 89 const ::com::sun::star::uno::Any& rNewValue); 90 91 virtual void SAL_CALL disposing (void); 92 93 94 95 //===== XAccessible ======================================================= 96 97 virtual ::com::sun::star::uno::Reference< 98 ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL 99 getAccessibleContext (void); 100 101 102 //===== XAccessibleEventBroadcaster ======================================= 103 virtual void SAL_CALL 104 addEventListener( 105 const ::com::sun::star::uno::Reference< 106 ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener); 107 108 virtual void SAL_CALL 109 removeEventListener( 110 const ::com::sun::star::uno::Reference< 111 ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener ); 112 113 using cppu::WeakComponentImplHelperBase::addEventListener; 114 using cppu::WeakComponentImplHelperBase::removeEventListener; 115 116 //===== XAccessibleContext ============================================== 117 118 virtual sal_Int32 SAL_CALL 119 getAccessibleChildCount (void); 120 121 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 122 getAccessibleChild (sal_Int32 nIndex); 123 124 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 125 getAccessibleParent (void); 126 127 virtual sal_Int32 SAL_CALL 128 getAccessibleIndexInParent (void); 129 130 virtual sal_Int16 SAL_CALL 131 getAccessibleRole (void); 132 133 virtual ::rtl::OUString SAL_CALL 134 getAccessibleDescription (void); 135 136 virtual ::rtl::OUString SAL_CALL 137 getAccessibleName (void); 138 139 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL 140 getAccessibleRelationSet (void); 141 142 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL 143 getAccessibleStateSet (void); 144 145 virtual ::com::sun::star::lang::Locale SAL_CALL 146 getLocale (void); 147 148 149 //===== XAccessibleComponent ================================================ 150 151 virtual sal_Bool SAL_CALL containsPoint ( 152 const ::com::sun::star::awt::Point& aPoint); 153 154 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL 155 getAccessibleAtPoint ( 156 const ::com::sun::star::awt::Point& aPoint); 157 158 virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (void); 159 160 virtual ::com::sun::star::awt::Point SAL_CALL getLocation (void); 161 162 virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen (void); 163 164 virtual ::com::sun::star::awt::Size SAL_CALL getSize (void); 165 166 virtual void SAL_CALL grabFocus (void); 167 168 virtual sal_Int32 SAL_CALL getForeground (void); 169 170 virtual sal_Int32 SAL_CALL getBackground (void); 171 172 173 174 //===== XServiceInfo ==================================================== 175 176 /** Returns an identifier for the implementation of this object. 177 */ 178 virtual ::rtl::OUString SAL_CALL 179 getImplementationName (void); 180 181 /** Return whether the specified service is supported by this class. 182 */ 183 virtual sal_Bool SAL_CALL 184 supportsService (const ::rtl::OUString& sServiceName); 185 186 /** Returns a list of all supported services. 187 */ 188 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL 189 getSupportedServiceNames (void); 190 191 192 private: 193 ::com::sun::star::uno::Reference< 194 ::com::sun::star::accessibility::XAccessible> mxParent; 195 sal_uInt16 mnPageNumber; 196 ::sd::slidesorter::SlideSorter& mrSlideSorter; 197 sal_uInt32 mnClientId; 198 199 /** Check whether or not the object has been disposed (or is in the 200 state of being disposed). If that is the case then 201 DisposedException is thrown to inform the (indirect) caller of the 202 foul deed. 203 */ 204 void ThrowIfDisposed (void); 205 206 /** Check whether or not the object has been disposed (or is in the 207 state of being disposed). 208 209 @return sal_True, if the object is disposed or in the course 210 of being disposed. Otherwise, sal_False is returned. 211 */ 212 sal_Bool IsDisposed (void); 213 }; 214 215 216 217 } // end of namespace ::accessibility 218 219 #endif 220