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