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 25 #ifndef _SC_ACCESSIBLEEDITOBJECT_HXX 26 #define _SC_ACCESSIBLEEDITOBJECT_HXX 27 28 #include "AccessibleContextBase.hxx" 29 30 //IAccessibility2 Implementation 2009----- 31 #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 32 #include "global.hxx" 33 //-----IAccessibility2 Implementation 2009 34 namespace accessibility 35 { 36 class AccessibleTextHelper; 37 } 38 class EditView; 39 class Window; 40 41 enum EditObjectType 42 { 43 CellInEditMode, 44 EditLine, 45 EditControl 46 }; 47 48 /** @descr 49 This base class provides an implementation of the 50 <code>AccessibleCell</code> service. 51 */ 52 class ScAccessibleEditObject 53 : public ScAccessibleContextBase, 54 //IAccessibility2 Implementation 2009----- 55 public ::com::sun::star::accessibility::XAccessibleSelection 56 //-----IAccessibility2 Implementation 2009 57 { 58 public: 59 //===== internal ======================================================== 60 ScAccessibleEditObject( 61 const ::com::sun::star::uno::Reference< 62 ::com::sun::star::accessibility::XAccessible>& rxParent, 63 EditView* pEditView, Window* pWin, const rtl::OUString& rName, 64 const rtl::OUString& rDescription, EditObjectType eObjectType); 65 66 protected: 67 virtual ~ScAccessibleEditObject(); 68 69 using ScAccessibleContextBase::IsDefunc; 70 71 public: 72 using ScAccessibleContextBase::addEventListener; 73 using ScAccessibleContextBase::removeEventListener; 74 using ScAccessibleContextBase::disposing; 75 76 virtual void SAL_CALL disposing(); 77 78 virtual void LostFocus(); 79 80 virtual void GotFocus(); 81 //IAccessibility2 Implementation 2009----- 82 ///===== XInterface ===================================================== 83 84 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 85 ::com::sun::star::uno::Type const & rType ) 86 throw (::com::sun::star::uno::RuntimeException); 87 88 virtual void SAL_CALL acquire() throw (); 89 90 virtual void SAL_CALL release() throw (); 91 //-----IAccessibility2 Implementation 2009 92 ///===== XAccessibleComponent ============================================ 93 94 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > 95 SAL_CALL getAccessibleAtPoint( 96 const ::com::sun::star::awt::Point& rPoint ) 97 throw (::com::sun::star::uno::RuntimeException); 98 99 protected: 100 /// Return the object's current bounding box relative to the desktop. 101 virtual Rectangle GetBoundingBoxOnScreen(void) const 102 throw (::com::sun::star::uno::RuntimeException); 103 104 /// Return the object's current bounding box relative to the parent object. 105 virtual Rectangle GetBoundingBox(void) const 106 throw (::com::sun::star::uno::RuntimeException); 107 108 public: 109 ///===== XAccessibleContext ============================================== 110 111 /// Return the number of currently visible children. 112 // is overloaded to calculate this on demand 113 virtual sal_Int32 SAL_CALL 114 getAccessibleChildCount(void) 115 throw (::com::sun::star::uno::RuntimeException); 116 117 /// Return the specified child or NULL if index is invalid. 118 // is overloaded to calculate this on demand 119 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 120 getAccessibleChild(sal_Int32 nIndex) 121 throw (::com::sun::star::uno::RuntimeException, 122 ::com::sun::star::lang::IndexOutOfBoundsException); 123 124 /// Return the set of current states. 125 virtual ::com::sun::star::uno::Reference< 126 ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL 127 getAccessibleStateSet(void) 128 throw (::com::sun::star::uno::RuntimeException); 129 130 //===== XAccessibleSelection ============================================ 131 132 virtual void SAL_CALL selectAccessibleChild( 133 sal_Int32 nChildIndex ) 134 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 135 ::com::sun::star::uno::RuntimeException ); 136 virtual sal_Bool SAL_CALL isAccessibleChildSelected( 137 sal_Int32 nChildIndex ) 138 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 139 ::com::sun::star::uno::RuntimeException ); 140 virtual void SAL_CALL clearAccessibleSelection( ) 141 throw ( ::com::sun::star::uno::RuntimeException ); 142 virtual void SAL_CALL selectAllAccessibleChildren( ) 143 throw ( ::com::sun::star::uno::RuntimeException ); 144 virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) 145 throw ( ::com::sun::star::uno::RuntimeException ); 146 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( 147 sal_Int32 nSelectedChildIndex ) 148 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 149 ::com::sun::star::uno::RuntimeException); 150 virtual void SAL_CALL deselectAccessibleChild( 151 sal_Int32 nSelectedChildIndex ) 152 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 153 ::com::sun::star::uno::RuntimeException ); 154 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); 155 //-----IAccessibility2 Implementation 2009 156 protected: 157 /// Return this object's description. 158 virtual ::rtl::OUString SAL_CALL 159 createAccessibleDescription(void) 160 throw (::com::sun::star::uno::RuntimeException); 161 162 /// Return the object's current name. 163 virtual ::rtl::OUString SAL_CALL 164 createAccessibleName(void) 165 throw (::com::sun::star::uno::RuntimeException); 166 167 public: 168 ///===== XAccessibleEventBroadcaster ===================================== 169 170 /** Add listener that is informed of future changes of name, 171 description and so on events. 172 */ 173 virtual void SAL_CALL 174 addEventListener( 175 const ::com::sun::star::uno::Reference< 176 ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) 177 throw (com::sun::star::uno::RuntimeException); 178 179 // Remove an existing event listener. 180 virtual void SAL_CALL 181 removeEventListener( 182 const ::com::sun::star::uno::Reference< 183 ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) 184 throw (com::sun::star::uno::RuntimeException); 185 186 ///===== XServiceInfo ==================================================== 187 188 /** Returns an identifier for the implementation of this object. 189 */ 190 virtual ::rtl::OUString SAL_CALL 191 getImplementationName(void) 192 throw (::com::sun::star::uno::RuntimeException); 193 194 ///===== XTypeProvider =================================================== 195 196 /** Returns a implementation id. 197 */ 198 virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL 199 getImplementationId(void) 200 throw (::com::sun::star::uno::RuntimeException); 201 202 private: 203 accessibility::AccessibleTextHelper* mpTextHelper; 204 EditView* mpEditView; 205 Window* mpWindow; 206 EditObjectType meObjectType; 207 sal_Bool mbHasFocus; 208 209 sal_Bool IsDefunc( 210 const com::sun::star::uno::Reference< 211 ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates); 212 213 void CreateTextHelper(); 214 //IAccessibility2 Implementation 2009----- 215 ScDocument *m_pScDoc; 216 ScAddress m_curCellAddress; 217 218 219 ///===== XAccessibleComponent ============================================ 220 virtual sal_Int32 SAL_CALL getForeground( ) 221 throw (::com::sun::star::uno::RuntimeException); 222 223 virtual sal_Int32 SAL_CALL getBackground( ) 224 throw (::com::sun::star::uno::RuntimeException); 225 226 sal_Int32 GetFgBgColor( const rtl::OUString &strPropColor) ; 227 //-----IAccessibility2 Implementation 2009 228 }; 229 230 231 #endif 232