1*4c5491eaSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*4c5491eaSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*4c5491eaSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*4c5491eaSAndrew Rist * distributed with this work for additional information 6*4c5491eaSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*4c5491eaSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*4c5491eaSAndrew Rist * "License"); you may not use this file except in compliance 9*4c5491eaSAndrew Rist * with the License. You may obtain a copy of the License at 10*4c5491eaSAndrew Rist * 11*4c5491eaSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*4c5491eaSAndrew Rist * 13*4c5491eaSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*4c5491eaSAndrew Rist * software distributed under the License is distributed on an 15*4c5491eaSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*4c5491eaSAndrew Rist * KIND, either express or implied. See the License for the 17*4c5491eaSAndrew Rist * specific language governing permissions and limitations 18*4c5491eaSAndrew Rist * under the License. 19*4c5491eaSAndrew Rist * 20*4c5491eaSAndrew Rist *************************************************************/ 21*4c5491eaSAndrew Rist 22*4c5491eaSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SVX_ACCESSIBLE_IMAGE_BULLET_HXX 25cdf0e10cSrcweir #define _SVX_ACCESSIBLE_IMAGE_BULLET_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <tools/gen.hxx> 28cdf0e10cSrcweir #include <cppuhelper/weakref.hxx> 29cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #ifndef _CPPUHELPER_INTERFACECONTAINER_H_ 32cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx> 33cdf0e10cSrcweir #endif 34cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx> 35cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 36cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp> 37cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleContext.hpp> 38cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleComponent.hpp> 39cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> 40cdf0e10cSrcweir #include "editeng/AccessibleParaManager.hxx" 41cdf0e10cSrcweir #include <editeng/unoedsrc.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir namespace accessibility 44cdf0e10cSrcweir { 45cdf0e10cSrcweir typedef ::cppu::WeakImplHelper5< ::com::sun::star::accessibility::XAccessible, 46cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleContext, 47cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleComponent, 48cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleEventBroadcaster, 49cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo > AccessibleImageBulletInterfaceBase; 50cdf0e10cSrcweir 51cdf0e10cSrcweir /** This class implements the image bullets for the EditEngine/Outliner UAA 52cdf0e10cSrcweir */ 53cdf0e10cSrcweir class AccessibleImageBullet : public AccessibleImageBulletInterfaceBase 54cdf0e10cSrcweir { 55cdf0e10cSrcweir 56cdf0e10cSrcweir public: 57cdf0e10cSrcweir /// Create accessible object for given parent 58cdf0e10cSrcweir AccessibleImageBullet ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rParent ); 59cdf0e10cSrcweir 60cdf0e10cSrcweir virtual ~AccessibleImageBullet (); 61cdf0e10cSrcweir 62cdf0e10cSrcweir // XInterface 63cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryInterface (const ::com::sun::star::uno::Type & rType) throw (::com::sun::star::uno::RuntimeException); 64cdf0e10cSrcweir 65cdf0e10cSrcweir // XAccessible 66cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); 67cdf0e10cSrcweir 68cdf0e10cSrcweir // XAccessibleContext 69cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException); 70cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 71cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent() throw (::com::sun::star::uno::RuntimeException); 72cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException); 73cdf0e10cSrcweir virtual sal_Int16 SAL_CALL getAccessibleRole() throw (::com::sun::star::uno::RuntimeException); 74cdf0e10cSrcweir /// Maximal length of text returned by getAccessibleDescription() 75cdf0e10cSrcweir enum { MaxDescriptionLen = 40 }; 76cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException); 77cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException); 78cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() throw (::com::sun::star::uno::RuntimeException); 79cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException); 80cdf0e10cSrcweir virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); 81cdf0e10cSrcweir 82cdf0e10cSrcweir // XAccessibleEventBroadcaster 83cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 84cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 85cdf0e10cSrcweir 86cdf0e10cSrcweir // XAccessibleComponent 87cdf0e10cSrcweir virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); 88cdf0e10cSrcweir 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); 89cdf0e10cSrcweir virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException); 90cdf0e10cSrcweir virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException); 91cdf0e10cSrcweir virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException); 92cdf0e10cSrcweir virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException); 93cdf0e10cSrcweir virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); 94cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); 95cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); 96cdf0e10cSrcweir 97cdf0e10cSrcweir // XServiceInfo 98cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException); 99cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService (const ::rtl::OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException); 100cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException); 101cdf0e10cSrcweir 102cdf0e10cSrcweir // XServiceName 103cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException); 104cdf0e10cSrcweir 105cdf0e10cSrcweir /** Set the current index in the accessibility parent 106cdf0e10cSrcweir 107cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 108cdf0e10cSrcweir leaving that to the calling code. This is because only 109cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 110cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 111cdf0e10cSrcweir */ 112cdf0e10cSrcweir void SetIndexInParent( sal_Int32 nIndex ); 113cdf0e10cSrcweir 114cdf0e10cSrcweir /** Get the current index in the accessibility parent 115cdf0e10cSrcweir 116cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 117cdf0e10cSrcweir leaving that to the calling code. This is because only 118cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 119cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 120cdf0e10cSrcweir */ 121cdf0e10cSrcweir sal_Int32 GetIndexInParent() const; 122cdf0e10cSrcweir 123cdf0e10cSrcweir /** Set the edit engine offset 124cdf0e10cSrcweir 125cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 126cdf0e10cSrcweir leaving that to the calling code. This is because only 127cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 128cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 129cdf0e10cSrcweir */ 130cdf0e10cSrcweir void SetEEOffset( const Point& rOffset ); 131cdf0e10cSrcweir 132cdf0e10cSrcweir /** Set the EditEngine offset 133cdf0e10cSrcweir 134cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 135cdf0e10cSrcweir leaving that to the calling code. This is because only 136cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 137cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 138cdf0e10cSrcweir */ 139cdf0e10cSrcweir void SetEditSource( SvxEditSource* pEditSource ); 140cdf0e10cSrcweir 141cdf0e10cSrcweir /** Dispose this object 142cdf0e10cSrcweir 143cdf0e10cSrcweir Notifies and deregisters the listeners, drops all references. 144cdf0e10cSrcweir */ 145cdf0e10cSrcweir void Dispose(); 146cdf0e10cSrcweir 147cdf0e10cSrcweir /** Set the current paragraph number 148cdf0e10cSrcweir 149cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 150cdf0e10cSrcweir leaving that to the calling code. This is because only 151cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 152cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 153cdf0e10cSrcweir */ 154cdf0e10cSrcweir void SetParagraphIndex( sal_Int32 nIndex ); 155cdf0e10cSrcweir 156cdf0e10cSrcweir /** Query the current paragraph number (0 - nParas-1) 157cdf0e10cSrcweir 158cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 159cdf0e10cSrcweir leaving that to the calling code. This is because only 160cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 161cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 162cdf0e10cSrcweir */ 163cdf0e10cSrcweir sal_Int32 GetParagraphIndex() const SAL_THROW((::com::sun::star::uno::RuntimeException)); 164cdf0e10cSrcweir 165cdf0e10cSrcweir /// Calls all Listener objects to tell them the change. Don't hold locks when calling this! 166cdf0e10cSrcweir virtual void FireEvent(const sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(), const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const; 167cdf0e10cSrcweir 168cdf0e10cSrcweir private: 169cdf0e10cSrcweir 170cdf0e10cSrcweir // declared, but not defined 171cdf0e10cSrcweir AccessibleImageBullet( const AccessibleImageBullet& ); 172cdf0e10cSrcweir AccessibleImageBullet& operator= ( const AccessibleImageBullet& ); 173cdf0e10cSrcweir 174cdf0e10cSrcweir // syntactic sugar for FireEvent 175cdf0e10cSrcweir void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const; 176cdf0e10cSrcweir void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const; 177cdf0e10cSrcweir 178cdf0e10cSrcweir // maintain state set and send STATE_CHANGE events 179cdf0e10cSrcweir void SetState( const sal_Int16 nStateId ); 180cdf0e10cSrcweir void UnSetState( const sal_Int16 nStateId ); 181cdf0e10cSrcweir 182cdf0e10cSrcweir SvxEditSource& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException)); 183cdf0e10cSrcweir 184cdf0e10cSrcweir int getNotifierClientId() const; 185cdf0e10cSrcweir 186cdf0e10cSrcweir /** Query the SvxTextForwarder for EditEngine access. 187cdf0e10cSrcweir 188cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 189cdf0e10cSrcweir leaving that to the calling code. This is because only 190cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 191cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 192cdf0e10cSrcweir */ 193cdf0e10cSrcweir SvxTextForwarder& GetTextForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException)); 194cdf0e10cSrcweir 195cdf0e10cSrcweir /** Query the SvxViewForwarder for EditEngine access. 196cdf0e10cSrcweir 197cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 198cdf0e10cSrcweir leaving that to the calling code. This is because only 199cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 200cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 201cdf0e10cSrcweir */ 202cdf0e10cSrcweir SvxViewForwarder& GetViewForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException)); 203cdf0e10cSrcweir 204cdf0e10cSrcweir const Point& GetEEOffset() const; 205cdf0e10cSrcweir 206cdf0e10cSrcweir // the paragraph index in the edit engine (guarded by solar mutex) 207cdf0e10cSrcweir sal_Int32 mnParagraphIndex; 208cdf0e10cSrcweir 209cdf0e10cSrcweir // our current index in the parent (guarded by solar mutex) 210cdf0e10cSrcweir sal_Int32 mnIndexInParent; 211cdf0e10cSrcweir 212cdf0e10cSrcweir // the current edit source (guarded by solar mutex) 213cdf0e10cSrcweir SvxEditSource* mpEditSource; 214cdf0e10cSrcweir 215cdf0e10cSrcweir // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex) 216cdf0e10cSrcweir Point maEEOffset; 217cdf0e10cSrcweir 218cdf0e10cSrcweir // the current state set (updated from SetState/UnSetState and guarded by solar mutex) 219cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet; 220cdf0e10cSrcweir 221cdf0e10cSrcweir mutable osl::Mutex maMutex; 222cdf0e10cSrcweir 223cdf0e10cSrcweir /// The shape we're the accessible for (unguarded) 224cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent; 225cdf0e10cSrcweir 226cdf0e10cSrcweir /// Our listeners (guarded by maMutex) 227cdf0e10cSrcweir int mnNotifierClientId; 228cdf0e10cSrcweir }; 229cdf0e10cSrcweir 230cdf0e10cSrcweir } // end of namespace accessibility 231cdf0e10cSrcweir 232cdf0e10cSrcweir #endif 233cdf0e10cSrcweir 234