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