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_ACCESSIBLEICONCHOICECTRLENTRY_HXX_ 25 #define ACCESSIBILITY_EXT_ACCESSIBLEICONCHOICECTRLENTRY_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 #include <cppuhelper/compbase8.hxx> 39 #include <comphelper/broadcasthelper.hxx> 40 #include <comphelper/accessibletexthelper.hxx> 41 #include <tools/gen.hxx> 42 43 // forward --------------------------------------------------------------- 44 45 class SvxIconChoiceCtrlEntry; 46 class SvtIconChoiceCtrl; 47 48 //........................................................................ 49 namespace accessibility 50 { 51 //........................................................................ 52 53 // class AccessibleIconChoiceCtrlEntry ------------------------------------------ 54 55 typedef ::cppu::WeakAggComponentImplHelper8< ::com::sun::star::accessibility::XAccessible 56 , ::com::sun::star::accessibility::XAccessibleContext 57 , ::com::sun::star::accessibility::XAccessibleComponent 58 , ::com::sun::star::accessibility::XAccessibleEventBroadcaster 59 , ::com::sun::star::accessibility::XAccessibleText 60 , ::com::sun::star::accessibility::XAccessibleAction 61 , ::com::sun::star::lang::XServiceInfo 62 , ::com::sun::star::lang::XEventListener > AccessibleIconChoiceCtrlEntry_BASE; 63 64 /** the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry */ 65 class AccessibleIconChoiceCtrlEntry : public ::comphelper::OBaseMutex, 66 public AccessibleIconChoiceCtrlEntry_BASE, 67 public ::comphelper::OCommonAccessibleText 68 { 69 private: 70 /** The treelistbox control */ 71 SvtIconChoiceCtrl* m_pIconCtrl; 72 sal_Int32 m_nIndex; 73 74 protected: 75 /// client id in the AccessibleEventNotifier queue 76 sal_uInt32 m_nClientId; 77 78 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent; 79 80 private: 81 #ifdef ACCESSIBLE_EVENT_NOTIFICATION_ENABLED 82 // (the following method is unused currently. If you need it, simply remove the #ifdef thing here and 83 // in the cxx) 84 /** notifies all listeners that this object has changed 85 @param _nEventId 86 is the event id 87 @param _aOldValue 88 is the old value 89 @param _aNewValue 90 is the new value 91 */ 92 void NotifyAccessibleEvent( sal_Int16 _nEventId, 93 const ::com::sun::star::uno::Any& _aOldValue, 94 const ::com::sun::star::uno::Any& _aNewValue ); 95 #endif 96 97 Rectangle GetBoundingBox_Impl() const; 98 Rectangle GetBoundingBoxOnScreen_Impl() const; 99 sal_Bool IsAlive_Impl() const; 100 sal_Bool IsShowing_Impl() const; 101 102 Rectangle GetBoundingBox() throw ( ::com::sun::star::lang::DisposedException ); 103 Rectangle GetBoundingBoxOnScreen() throw ( ::com::sun::star::lang::DisposedException ); 104 void EnsureIsAlive() const throw ( ::com::sun::star::lang::DisposedException ); 105 106 protected: 107 virtual ~AccessibleIconChoiceCtrlEntry(); 108 /** this function is called upon disposing the component 109 */ 110 virtual void SAL_CALL disposing(); 111 112 // OCommonAccessibleText 113 virtual ::rtl::OUString implGetText(); 114 virtual ::com::sun::star::lang::Locale implGetLocale(); 115 virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); 116 117 public: 118 /** Ctor() 119 @param _rListBox 120 the view control 121 @param _pEntry 122 the entry 123 @param _xParent 124 is our parent accessible object 125 */ 126 AccessibleIconChoiceCtrlEntry( SvtIconChoiceCtrl& _rIconCtrl, 127 sal_uLong _nPos, 128 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent ); 129 130 // XTypeProvider 131 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException); 132 133 // XServiceInfo 134 virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException); 135 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); 136 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException); 137 138 // XServiceInfo - static methods 139 static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException); 140 static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException); 141 142 // XEventListener 143 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); 144 145 // XAccessible 146 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); 147 148 // XAccessibleContext 149 virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); 150 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 151 ::com::sun::star::uno::RuntimeException ); 152 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); 153 virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); 154 virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); 155 virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); 156 virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); 157 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); 158 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); 159 virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); 160 161 // XAccessibleComponent 162 virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); 163 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); 164 virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException); 165 virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException); 166 virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException); 167 virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException); 168 virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); 169 virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); 170 virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); 171 172 // XAccessibleText 173 virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); 174 virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 175 virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 176 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); 177 virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 178 virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); 179 virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); 180 virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); 181 virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); 182 virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); 183 virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 184 virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); 185 virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 186 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); 187 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); 188 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); 189 virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 190 191 // XAccessibleEventBroadcaster 192 using cppu::WeakAggComponentImplHelperBase::addEventListener; 193 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 194 using cppu::WeakAggComponentImplHelperBase::removeEventListener; 195 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 196 197 // XAccessibleAction 198 virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException); 199 virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 200 virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 201 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); 202 }; 203 204 //........................................................................ 205 }// namespace accessibility 206 //........................................................................ 207 208 #endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_ 209 210