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 _SVX_ACCESSIBILITY_ACCESSIBLE_CELL_HXX 29 #define _SVX_ACCESSIBILITY_ACCESSIBLE_CELL_HXX 30 31 #include <com/sun/star/accessibility/XAccessible.hpp> 32 #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp> 33 #include <com/sun/star/accessibility/AccessibleRole.hpp> 34 #include <com/sun/star/drawing/XShape.hpp> 35 36 #include <rtl/ref.hxx> 37 38 #include <editeng/AccessibleContextBase.hxx> 39 #include <editeng/AccessibleComponentBase.hxx> 40 #include <svx/IAccessibleViewForwarderListener.hxx> 41 #include <svx/AccessibleTextHelper.hxx> 42 #include <svx/AccessibleShapeTreeInfo.hxx> 43 44 #include <cppuhelper/implbase1.hxx> 45 46 #include "cell.hxx" 47 48 #include <boost/noncopyable.hpp> 49 50 class SdrObject; 51 52 53 namespace accessibility 54 { 55 56 class AccessibleShapeInfo; 57 class AccessibleShapeTreeInfo; 58 class IAccessibleParent; 59 60 typedef ::cppu::ImplInheritanceHelper1< AccessibleContextBase, ::com::sun::star::accessibility::XAccessibleExtendedComponent > AccessibleCellBase; 61 62 class AccessibleCell : boost::noncopyable, public AccessibleCellBase, public AccessibleComponentBase, public IAccessibleViewForwarderListener 63 { 64 public: 65 AccessibleCell( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, const sdr::table::CellRef& rCell, sal_Int32 nIndex, const AccessibleShapeTreeInfo& rShapeTreeInfo); 66 virtual ~AccessibleCell (void); 67 68 virtual void Init (void); 69 70 virtual bool operator== (const AccessibleCell& rAccessibleCell); 71 72 virtual sal_Bool SetState (sal_Int16 aState); 73 virtual sal_Bool ResetState (sal_Int16 aState); 74 sal_Bool GetState (sal_Int16 aState); 75 76 // XInterface 77 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); 78 virtual void SAL_CALL acquire( ) throw (); 79 virtual void SAL_CALL release( ) throw (); 80 81 // XAccessibleContext 82 virtual sal_Int32 SAL_CALL getAccessibleChildCount(void) throw(::com::sun::star::uno::RuntimeException); 83 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL getAccessibleChild(sal_Int32 nIndex) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 84 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL getAccessibleStateSet(void) throw(::com::sun::star::uno::RuntimeException); 85 virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(void) throw(::com::sun::star::uno::RuntimeException); 86 virtual ::rtl::OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException); 87 88 // XAccessibleComponent 89 virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint) throw (::com::sun::star::uno::RuntimeException); 90 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); 91 virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(void) throw(::com::sun::star::uno::RuntimeException); 92 virtual ::com::sun::star::awt::Point SAL_CALL getLocation(void) throw(::com::sun::star::uno::RuntimeException); 93 virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(void) throw(::com::sun::star::uno::RuntimeException); 94 virtual ::com::sun::star::awt::Size SAL_CALL getSize(void) throw(::com::sun::star::uno::RuntimeException); 95 virtual void SAL_CALL addFocusListener ( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener) throw (::com::sun::star::uno::RuntimeException); 96 virtual void SAL_CALL removeFocusListener (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 97 virtual void SAL_CALL grabFocus (void) throw (::com::sun::star::uno::RuntimeException); 98 virtual sal_Int32 SAL_CALL getForeground(void) throw(::com::sun::star::uno::RuntimeException); 99 virtual sal_Int32 SAL_CALL getBackground(void) throw(::com::sun::star::uno::RuntimeException); 100 101 // XAccessibleExtendedComponent 102 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont (void) throw (::com::sun::star::uno::RuntimeException); 103 virtual ::rtl::OUString SAL_CALL getTitledBorderText (void) throw (::com::sun::star::uno::RuntimeException); 104 virtual ::rtl::OUString SAL_CALL getToolTipText (void) throw (::com::sun::star::uno::RuntimeException); 105 106 // XAccessibleEventBroadcaster 107 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener) throw(::com::sun::star::uno::RuntimeException); 108 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener) throw(::com::sun::star::uno::RuntimeException); 109 110 // XServiceInfo 111 virtual ::rtl::OUString SAL_CALL getImplementationName (void) throw(::com::sun::star::uno::RuntimeException); 112 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) throw(::com::sun::star::uno::RuntimeException); 113 114 // IAccessibleViewForwarderListener 115 virtual void ViewForwarderChanged (ChangeType aChangeType, const IAccessibleViewForwarder* pViewForwarder); 116 117 using cppu::WeakComponentImplHelperBase::addEventListener; 118 using cppu::WeakComponentImplHelperBase::removeEventListener; 119 120 // Misc 121 122 /** set the index _nIndex at the accessible cell param _nIndex The new index in parent. 123 */ 124 inline void setIndexInParent(sal_Int32 _nIndex) { mnIndexInParent = _nIndex; } 125 126 protected: 127 /// Bundle of information passed to all shapes in a document tree. 128 AccessibleShapeTreeInfo maShapeTreeInfo; 129 130 /// the index in parent. 131 sal_Int32 mnIndexInParent; 132 133 /// The accessible text engine. May be NULL if it can not be created. 134 AccessibleTextHelper* mpText; 135 136 sdr::table::CellRef mxCell; 137 138 /// This method is called from the component helper base class while disposing. 139 virtual void SAL_CALL disposing (void); 140 141 private: 142 explicit AccessibleCell(void); // not implemented 143 explicit AccessibleCell(const AccessibleCell&); // not implemented 144 AccessibleCell& operator=(const AccessibleCell&); // not implemented 145 }; 146 147 } // end of namespace accessibility 148 149 #endif 150