1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_ 29*cdf0e10cSrcweir #define ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_ 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <deque> 32*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleComponent.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleContext.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleStateSet.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleAction.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 42*cdf0e10cSrcweir #include <cppuhelper/compbase8.hxx> 43*cdf0e10cSrcweir #include <comphelper/broadcasthelper.hxx> 44*cdf0e10cSrcweir #include <comphelper/accessibletexthelper.hxx> 45*cdf0e10cSrcweir #include <tools/gen.hxx> 46*cdf0e10cSrcweir #include "accessibility/extended/listboxaccessible.hxx" 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir // forward --------------------------------------------------------------- 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace awt { 51*cdf0e10cSrcweir struct Point; 52*cdf0e10cSrcweir struct Rectangle; 53*cdf0e10cSrcweir struct Size; 54*cdf0e10cSrcweir class XFocusListener; 55*cdf0e10cSrcweir } } } } 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir class SvTreeListBox; 58*cdf0e10cSrcweir class SvLBoxEntry; 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir //........................................................................ 61*cdf0e10cSrcweir namespace accessibility 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir //........................................................................ 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir // class AccessibleListBoxEntry ------------------------------------------ 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir typedef ::cppu::WeakAggComponentImplHelper8< ::com::sun::star::accessibility::XAccessible 68*cdf0e10cSrcweir , ::com::sun::star::accessibility::XAccessibleContext 69*cdf0e10cSrcweir , ::com::sun::star::accessibility::XAccessibleComponent 70*cdf0e10cSrcweir , ::com::sun::star::accessibility::XAccessibleEventBroadcaster 71*cdf0e10cSrcweir , ::com::sun::star::accessibility::XAccessibleAction 72*cdf0e10cSrcweir , ::com::sun::star::accessibility::XAccessibleSelection 73*cdf0e10cSrcweir , ::com::sun::star::accessibility::XAccessibleText 74*cdf0e10cSrcweir , ::com::sun::star::lang::XServiceInfo > AccessibleListBoxEntry_BASE; 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir /** the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry */ 77*cdf0e10cSrcweir class AccessibleListBoxEntry:public ::comphelper::OBaseMutex 78*cdf0e10cSrcweir ,public AccessibleListBoxEntry_BASE 79*cdf0e10cSrcweir ,public ::comphelper::OCommonAccessibleText 80*cdf0e10cSrcweir ,public ListBoxAccessibleBase 81*cdf0e10cSrcweir { 82*cdf0e10cSrcweir friend class AccessibleListBox; 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir private: 85*cdf0e10cSrcweir /** The treelistbox control */ 86*cdf0e10cSrcweir SvTreeListBox* m_pListBox; 87*cdf0e10cSrcweir ::std::deque< sal_Int32 > m_aEntryPath; 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir protected: 90*cdf0e10cSrcweir /// client id in the AccessibleEventNotifier queue 91*cdf0e10cSrcweir sal_uInt32 m_nClientId; 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > 94*cdf0e10cSrcweir m_aParent; 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir private: 97*cdf0e10cSrcweir Rectangle GetBoundingBox_Impl() const; 98*cdf0e10cSrcweir Rectangle GetBoundingBoxOnScreen_Impl() const; 99*cdf0e10cSrcweir sal_Bool IsAlive_Impl() const; 100*cdf0e10cSrcweir sal_Bool IsShowing_Impl() const; 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir Rectangle GetBoundingBox() throw ( ::com::sun::star::lang::DisposedException ); 103*cdf0e10cSrcweir Rectangle GetBoundingBoxOnScreen() throw ( ::com::sun::star::lang::DisposedException ); 104*cdf0e10cSrcweir void EnsureIsAlive() const throw ( ::com::sun::star::lang::DisposedException ); 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir protected: 107*cdf0e10cSrcweir virtual ~AccessibleListBoxEntry(); 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir /** this function is called upon disposing the component 110*cdf0e10cSrcweir */ 111*cdf0e10cSrcweir virtual void SAL_CALL disposing(); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir // ListBoxAccessible/XComponent 114*cdf0e10cSrcweir virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir // OCommonAccessibleText 117*cdf0e10cSrcweir virtual ::rtl::OUString implGetText(); 118*cdf0e10cSrcweir virtual ::com::sun::star::lang::Locale implGetLocale(); 119*cdf0e10cSrcweir virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir public: 122*cdf0e10cSrcweir /** Ctor() 123*cdf0e10cSrcweir @param _rListBox 124*cdf0e10cSrcweir the view control 125*cdf0e10cSrcweir @param _pEntry 126*cdf0e10cSrcweir the entry 127*cdf0e10cSrcweir @param _xParent 128*cdf0e10cSrcweir is our parent accessible object 129*cdf0e10cSrcweir */ 130*cdf0e10cSrcweir AccessibleListBoxEntry( SvTreeListBox& _rListBox, SvLBoxEntry* _pEntry, 131*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 132*cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessible >& _xParent ); 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir protected: 135*cdf0e10cSrcweir // XTypeProvider 136*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException); 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir // XServiceInfo 139*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException); 140*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); 141*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException); 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir // XServiceInfo - static methods 144*cdf0e10cSrcweir static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException); 145*cdf0e10cSrcweir static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir // XAccessible 148*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir // XAccessibleContext 151*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); 152*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 153*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException ); 154*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); 155*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); 156*cdf0e10cSrcweir virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); 157*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); 158*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); 159*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); 160*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); 161*cdf0e10cSrcweir virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir // XAccessibleComponent 164*cdf0e10cSrcweir virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); 165*cdf0e10cSrcweir 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); 166*cdf0e10cSrcweir virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException); 167*cdf0e10cSrcweir virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException); 168*cdf0e10cSrcweir virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException); 169*cdf0e10cSrcweir virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException); 170*cdf0e10cSrcweir virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); 171*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); 172*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir // XAccessibleText 175*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); 176*cdf0e10cSrcweir virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 177*cdf0e10cSrcweir virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 178*cdf0e10cSrcweir 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); 179*cdf0e10cSrcweir virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 180*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); 181*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); 182*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); 183*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); 184*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); 185*cdf0e10cSrcweir virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 186*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); 187*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 188*cdf0e10cSrcweir 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); 189*cdf0e10cSrcweir 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); 190*cdf0e10cSrcweir 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); 191*cdf0e10cSrcweir virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir // XAccessibleEventBroadcaster 194*cdf0e10cSrcweir using cppu::WeakAggComponentImplHelperBase::addEventListener; 195*cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 196*cdf0e10cSrcweir using cppu::WeakAggComponentImplHelperBase::removeEventListener; 197*cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir // XAccessibleAction 200*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException); 201*cdf0e10cSrcweir virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 202*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 203*cdf0e10cSrcweir 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); 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir // XAccessibleSelection 206*cdf0e10cSrcweir void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 207*cdf0e10cSrcweir sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 208*cdf0e10cSrcweir void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); 209*cdf0e10cSrcweir void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); 210*cdf0e10cSrcweir sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); 211*cdf0e10cSrcweir ::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); 212*cdf0e10cSrcweir void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir private: 215*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > implGetParentAccessible( ) const; 216*cdf0e10cSrcweir }; 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir //........................................................................ 219*cdf0e10cSrcweir }// namespace accessibility 220*cdf0e10cSrcweir //........................................................................ 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir #endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_ 223*cdf0e10cSrcweir 224