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