1*38d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*38d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*38d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*38d50f7bSAndrew Rist * distributed with this work for additional information 6*38d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*38d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*38d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 9*38d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*38d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*38d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*38d50f7bSAndrew Rist * software distributed under the License is distributed on an 15*38d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*38d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 17*38d50f7bSAndrew Rist * specific language governing permissions and limitations 18*38d50f7bSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*38d50f7bSAndrew Rist *************************************************************/ 21*38d50f7bSAndrew Rist 22*38d50f7bSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir 25cdf0e10cSrcweir #ifndef _SC_ACCESSIBLEEDITOBJECT_HXX 26cdf0e10cSrcweir #define _SC_ACCESSIBLEEDITOBJECT_HXX 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include "AccessibleContextBase.hxx" 29cdf0e10cSrcweir 30cdf0e10cSrcweir namespace accessibility 31cdf0e10cSrcweir { 32cdf0e10cSrcweir class AccessibleTextHelper; 33cdf0e10cSrcweir } 34cdf0e10cSrcweir class EditView; 35cdf0e10cSrcweir class Window; 36cdf0e10cSrcweir 37cdf0e10cSrcweir enum EditObjectType 38cdf0e10cSrcweir { 39cdf0e10cSrcweir CellInEditMode, 40cdf0e10cSrcweir EditLine, 41cdf0e10cSrcweir EditControl 42cdf0e10cSrcweir }; 43cdf0e10cSrcweir 44cdf0e10cSrcweir /** @descr 45cdf0e10cSrcweir This base class provides an implementation of the 46cdf0e10cSrcweir <code>AccessibleCell</code> service. 47cdf0e10cSrcweir */ 48cdf0e10cSrcweir class ScAccessibleEditObject 49cdf0e10cSrcweir : public ScAccessibleContextBase 50cdf0e10cSrcweir { 51cdf0e10cSrcweir public: 52cdf0e10cSrcweir //===== internal ======================================================== 53cdf0e10cSrcweir ScAccessibleEditObject( 54cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 55cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessible>& rxParent, 56cdf0e10cSrcweir EditView* pEditView, Window* pWin, const rtl::OUString& rName, 57cdf0e10cSrcweir const rtl::OUString& rDescription, EditObjectType eObjectType); 58cdf0e10cSrcweir 59cdf0e10cSrcweir protected: 60cdf0e10cSrcweir virtual ~ScAccessibleEditObject(); 61cdf0e10cSrcweir 62cdf0e10cSrcweir using ScAccessibleContextBase::IsDefunc; 63cdf0e10cSrcweir 64cdf0e10cSrcweir public: 65cdf0e10cSrcweir using ScAccessibleContextBase::addEventListener; 66cdf0e10cSrcweir using ScAccessibleContextBase::removeEventListener; 67cdf0e10cSrcweir using ScAccessibleContextBase::disposing; 68cdf0e10cSrcweir 69cdf0e10cSrcweir virtual void SAL_CALL disposing(); 70cdf0e10cSrcweir 71cdf0e10cSrcweir virtual void LostFocus(); 72cdf0e10cSrcweir 73cdf0e10cSrcweir virtual void GotFocus(); 74cdf0e10cSrcweir 75cdf0e10cSrcweir ///===== XAccessibleComponent ============================================ 76cdf0e10cSrcweir 77cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > 78cdf0e10cSrcweir SAL_CALL getAccessibleAtPoint( 79cdf0e10cSrcweir const ::com::sun::star::awt::Point& rPoint ) 80cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 81cdf0e10cSrcweir 82cdf0e10cSrcweir protected: 83cdf0e10cSrcweir /// Return the object's current bounding box relative to the desktop. 84cdf0e10cSrcweir virtual Rectangle GetBoundingBoxOnScreen(void) const 85cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 86cdf0e10cSrcweir 87cdf0e10cSrcweir /// Return the object's current bounding box relative to the parent object. 88cdf0e10cSrcweir virtual Rectangle GetBoundingBox(void) const 89cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 90cdf0e10cSrcweir 91cdf0e10cSrcweir public: 92cdf0e10cSrcweir ///===== XAccessibleContext ============================================== 93cdf0e10cSrcweir 94cdf0e10cSrcweir /// Return the number of currently visible children. 95cdf0e10cSrcweir // is overloaded to calculate this on demand 96cdf0e10cSrcweir virtual sal_Int32 SAL_CALL 97cdf0e10cSrcweir getAccessibleChildCount(void) 98cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 99cdf0e10cSrcweir 100cdf0e10cSrcweir /// Return the specified child or NULL if index is invalid. 101cdf0e10cSrcweir // is overloaded to calculate this on demand 102cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 103cdf0e10cSrcweir getAccessibleChild(sal_Int32 nIndex) 104cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException, 105cdf0e10cSrcweir ::com::sun::star::lang::IndexOutOfBoundsException); 106cdf0e10cSrcweir 107cdf0e10cSrcweir /// Return the set of current states. 108cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 109cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL 110cdf0e10cSrcweir getAccessibleStateSet(void) 111cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 112cdf0e10cSrcweir 113cdf0e10cSrcweir protected: 114cdf0e10cSrcweir /// Return this object's description. 115cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL 116cdf0e10cSrcweir createAccessibleDescription(void) 117cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 118cdf0e10cSrcweir 119cdf0e10cSrcweir /// Return the object's current name. 120cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL 121cdf0e10cSrcweir createAccessibleName(void) 122cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 123cdf0e10cSrcweir 124cdf0e10cSrcweir public: 125cdf0e10cSrcweir ///===== XAccessibleEventBroadcaster ===================================== 126cdf0e10cSrcweir 127cdf0e10cSrcweir /** Add listener that is informed of future changes of name, 128cdf0e10cSrcweir description and so on events. 129cdf0e10cSrcweir */ 130cdf0e10cSrcweir virtual void SAL_CALL 131cdf0e10cSrcweir addEventListener( 132cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 133cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) 134cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 135cdf0e10cSrcweir 136cdf0e10cSrcweir // Remove an existing event listener. 137cdf0e10cSrcweir virtual void SAL_CALL 138cdf0e10cSrcweir removeEventListener( 139cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 140cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) 141cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 142cdf0e10cSrcweir 143cdf0e10cSrcweir ///===== XServiceInfo ==================================================== 144cdf0e10cSrcweir 145cdf0e10cSrcweir /** Returns an identifier for the implementation of this object. 146cdf0e10cSrcweir */ 147cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL 148cdf0e10cSrcweir getImplementationName(void) 149cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 150cdf0e10cSrcweir 151cdf0e10cSrcweir ///===== XTypeProvider =================================================== 152cdf0e10cSrcweir 153cdf0e10cSrcweir /** Returns a implementation id. 154cdf0e10cSrcweir */ 155cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL 156cdf0e10cSrcweir getImplementationId(void) 157cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 158cdf0e10cSrcweir 159cdf0e10cSrcweir private: 160cdf0e10cSrcweir accessibility::AccessibleTextHelper* mpTextHelper; 161cdf0e10cSrcweir EditView* mpEditView; 162cdf0e10cSrcweir Window* mpWindow; 163cdf0e10cSrcweir EditObjectType meObjectType; 164cdf0e10cSrcweir sal_Bool mbHasFocus; 165cdf0e10cSrcweir 166cdf0e10cSrcweir sal_Bool IsDefunc( 167cdf0e10cSrcweir const com::sun::star::uno::Reference< 168cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates); 169cdf0e10cSrcweir 170cdf0e10cSrcweir void CreateTextHelper(); 171cdf0e10cSrcweir }; 172cdf0e10cSrcweir 173cdf0e10cSrcweir 174cdf0e10cSrcweir #endif 175