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 ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_ 25 #define ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_ 26 27 #include <deque> 28 #include <com/sun/star/accessibility/XAccessible.hpp> 29 #include <com/sun/star/accessibility/XAccessibleComponent.hpp> 30 #include <com/sun/star/accessibility/XAccessibleContext.hpp> 31 #include <com/sun/star/accessibility/XAccessibleStateSet.hpp> 32 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> 33 #include <com/sun/star/accessibility/XAccessibleAction.hpp> 34 #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 35 #include <com/sun/star/lang/DisposedException.hpp> 36 #include <com/sun/star/lang/XEventListener.hpp> 37 #include <com/sun/star/lang/XServiceInfo.hpp> 38 /* 39 #include <cppuhelper/compbase8.hxx> 40 */ 41 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEVALUE_HPP_ 42 #include <com/sun/star/accessibility/XAccessibleValue.hpp> 43 #endif 44 #ifndef _CPPUHELPER_COMPBASE9_HXX_ 45 #include <cppuhelper/compbase9.hxx> 46 #endif 47 #include <comphelper/broadcasthelper.hxx> 48 #include <comphelper/accessibletexthelper.hxx> 49 #include <tools/gen.hxx> 50 #include "accessibility/extended/listboxaccessible.hxx" 51 52 // forward --------------------------------------------------------------- 53 54 namespace com { namespace sun { namespace star { namespace awt { 55 struct Point; 56 struct Rectangle; 57 struct Size; 58 class XFocusListener; 59 } } } } 60 61 class SvTreeListBox; 62 class SvLBoxEntry; 63 64 //........................................................................ 65 namespace accessibility 66 { 67 //........................................................................ 68 69 // class AccessibleListBoxEntry ------------------------------------------ 70 /* 71 typedef ::cppu::WeakAggComponentImplHelper8< ::com::sun::star::accessibility::XAccessible 72 , ::com::sun::star::accessibility::XAccessibleContext 73 , ::com::sun::star::accessibility::XAccessibleComponent 74 , ::com::sun::star::accessibility::XAccessibleEventBroadcaster 75 , ::com::sun::star::accessibility::XAccessibleAction 76 , ::com::sun::star::accessibility::XAccessibleSelection 77 , ::com::sun::star::accessibility::XAccessibleText 78 , ::com::sun::star::lang::XServiceInfo > AccessibleListBoxEntry_BASE; 79 */ 80 typedef ::cppu::WeakAggComponentImplHelper9< ::com::sun::star::accessibility::XAccessible 81 , ::com::sun::star::accessibility::XAccessibleContext 82 , ::com::sun::star::accessibility::XAccessibleComponent 83 , ::com::sun::star::accessibility::XAccessibleEventBroadcaster 84 , ::com::sun::star::accessibility::XAccessibleAction 85 , ::com::sun::star::accessibility::XAccessibleSelection 86 , ::com::sun::star::accessibility::XAccessibleText 87 , ::com::sun::star::accessibility::XAccessibleValue 88 , ::com::sun::star::lang::XServiceInfo > AccessibleListBoxEntry_BASE; 89 90 /** the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry */ 91 class AccessibleListBoxEntry:public ::comphelper::OBaseMutex 92 ,public AccessibleListBoxEntry_BASE 93 ,public ::comphelper::OCommonAccessibleText 94 ,public ListBoxAccessibleBase 95 { 96 friend class AccessibleListBox; 97 98 private: 99 /** The treelistbox control */ 100 SvTreeListBox* m_pListBox; 101 ::std::deque< sal_Int32 > m_aEntryPath; 102 SvLBoxEntry* m_pSvLBoxEntry; // IA2 CWS. Needed for focused item... 103 104 105 protected: 106 /// client id in the AccessibleEventNotifier queue 107 sal_uInt32 m_nClientId; 108 109 ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > 110 m_aParent; 111 112 private: 113 Rectangle GetBoundingBox_Impl() const; 114 Rectangle GetBoundingBoxOnScreen_Impl() const; 115 sal_Bool IsAlive_Impl() const; 116 sal_Bool IsShowing_Impl() const; 117 118 Rectangle GetBoundingBox() throw ( ::com::sun::star::lang::DisposedException ); 119 Rectangle GetBoundingBoxOnScreen() throw ( ::com::sun::star::lang::DisposedException ); 120 void EnsureIsAlive() const throw ( ::com::sun::star::lang::DisposedException ); 121 122 void NotifyAccessibleEvent( sal_Int16 _nEventId, const ::com::sun::star::uno::Any& _aOldValue, const ::com::sun::star::uno::Any& _aNewValue ); 123 124 protected: 125 virtual ~AccessibleListBoxEntry(); 126 127 /** this function is called upon disposing the component 128 */ 129 virtual void SAL_CALL disposing(); 130 131 // ListBoxAccessible/XComponent 132 virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); 133 134 // OCommonAccessibleText 135 virtual ::rtl::OUString implGetText(); 136 virtual ::com::sun::star::lang::Locale implGetLocale(); 137 virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); 138 139 public: 140 /** Ctor() 141 @param _rListBox 142 the view control 143 @param _pEntry 144 the entry 145 @param _xParent 146 is our parent accessible object 147 */ 148 AccessibleListBoxEntry( SvTreeListBox& _rListBox, SvLBoxEntry* _pEntry, 149 const ::com::sun::star::uno::Reference< 150 ::com::sun::star::accessibility::XAccessible >& _xParent ); 151 GetSvLBoxEntry() const152 SvLBoxEntry* GetSvLBoxEntry() const { return m_pSvLBoxEntry; } 153 154 155 protected: 156 // XTypeProvider 157 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException); 158 159 // XServiceInfo 160 virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException); 161 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); 162 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException); 163 164 // XServiceInfo - static methods 165 static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException); 166 static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException); 167 168 // XAccessible 169 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); 170 171 // XAccessibleContext 172 virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); 173 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 174 ::com::sun::star::uno::RuntimeException ); 175 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); 176 virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); 177 virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); 178 virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); 179 virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); 180 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); 181 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); 182 virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); 183 184 // XAccessibleComponent 185 virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); 186 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); 187 virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException); 188 virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException); 189 virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException); 190 virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException); 191 virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); 192 virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); 193 virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); 194 195 // XAccessibleText 196 virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); 197 virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 198 virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 199 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 200 virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 201 virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); 202 virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); 203 virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); 204 virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); 205 virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); 206 virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 207 virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); 208 virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 209 virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 210 virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 211 virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 212 virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 213 214 // XAccessibleEventBroadcaster 215 using cppu::WeakAggComponentImplHelperBase::addEventListener; 216 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 217 using cppu::WeakAggComponentImplHelperBase::removeEventListener; 218 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 219 220 // XAccessibleAction 221 virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException); 222 virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 223 virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 224 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 225 226 // XAccessibleSelection 227 void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 228 sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 229 void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); 230 void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); 231 sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); 232 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 233 void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 234 virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException); 235 virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException); 236 virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException); 237 virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException); 238 private: 239 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > implGetParentAccessible( ) const; 240 SvLBoxEntry* GetRealChild(sal_Int32 nIndex); 241 public: 242 sal_Int32 SAL_CALL getRoleType(); 243 }; 244 245 //........................................................................ 246 }// namespace accessibility 247 //........................................................................ 248 249 #endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_ 250 251