138d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 338d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 438d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 538d50f7bSAndrew Rist * distributed with this work for additional information 638d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 738d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 838d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 938d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 1038d50f7bSAndrew Rist * 1138d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 1238d50f7bSAndrew Rist * 1338d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 1438d50f7bSAndrew Rist * software distributed under the License is distributed on an 1538d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1638d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 1738d50f7bSAndrew Rist * specific language governing permissions and limitations 1838d50f7bSAndrew Rist * under the License. 1938d50f7bSAndrew Rist * 2038d50f7bSAndrew Rist *************************************************************/ 2138d50f7bSAndrew Rist 2238d50f7bSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir 25cdf0e10cSrcweir #ifndef _SC_ACCESSIBLEEDITOBJECT_HXX 26cdf0e10cSrcweir #define _SC_ACCESSIBLEEDITOBJECT_HXX 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include "AccessibleContextBase.hxx" 29cdf0e10cSrcweir 30*0deba7fbSSteve Yin #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 31*0deba7fbSSteve Yin #include "global.hxx" 32cdf0e10cSrcweir namespace accessibility 33cdf0e10cSrcweir { 34cdf0e10cSrcweir class AccessibleTextHelper; 35cdf0e10cSrcweir } 36cdf0e10cSrcweir class EditView; 37cdf0e10cSrcweir class Window; 38cdf0e10cSrcweir 39cdf0e10cSrcweir enum EditObjectType 40cdf0e10cSrcweir { 41cdf0e10cSrcweir CellInEditMode, 42cdf0e10cSrcweir EditLine, 43cdf0e10cSrcweir EditControl 44cdf0e10cSrcweir }; 45cdf0e10cSrcweir 46cdf0e10cSrcweir /** @descr 47cdf0e10cSrcweir This base class provides an implementation of the 48cdf0e10cSrcweir <code>AccessibleCell</code> service. 49cdf0e10cSrcweir */ 50cdf0e10cSrcweir class ScAccessibleEditObject 51*0deba7fbSSteve Yin : public ScAccessibleContextBase, 52*0deba7fbSSteve Yin public ::com::sun::star::accessibility::XAccessibleSelection 53cdf0e10cSrcweir { 54cdf0e10cSrcweir public: 55cdf0e10cSrcweir //===== internal ======================================================== 56cdf0e10cSrcweir ScAccessibleEditObject( 57cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 58cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessible>& rxParent, 59cdf0e10cSrcweir EditView* pEditView, Window* pWin, const rtl::OUString& rName, 60cdf0e10cSrcweir const rtl::OUString& rDescription, EditObjectType eObjectType); 61cdf0e10cSrcweir 62cdf0e10cSrcweir protected: 63cdf0e10cSrcweir virtual ~ScAccessibleEditObject(); 64cdf0e10cSrcweir 65cdf0e10cSrcweir using ScAccessibleContextBase::IsDefunc; 66cdf0e10cSrcweir 67cdf0e10cSrcweir public: 68cdf0e10cSrcweir using ScAccessibleContextBase::addEventListener; 69cdf0e10cSrcweir using ScAccessibleContextBase::removeEventListener; 70cdf0e10cSrcweir using ScAccessibleContextBase::disposing; 71cdf0e10cSrcweir 72cdf0e10cSrcweir virtual void SAL_CALL disposing(); 73cdf0e10cSrcweir 74cdf0e10cSrcweir virtual void LostFocus(); 75cdf0e10cSrcweir 76cdf0e10cSrcweir virtual void GotFocus(); 77*0deba7fbSSteve Yin ///===== XInterface ===================================================== 78cdf0e10cSrcweir 79*0deba7fbSSteve Yin virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 80*0deba7fbSSteve Yin ::com::sun::star::uno::Type const & rType ) 81*0deba7fbSSteve Yin throw (::com::sun::star::uno::RuntimeException); 82*0deba7fbSSteve Yin 83*0deba7fbSSteve Yin virtual void SAL_CALL acquire() throw (); 84*0deba7fbSSteve Yin 85*0deba7fbSSteve Yin virtual void SAL_CALL release() throw (); 86cdf0e10cSrcweir ///===== XAccessibleComponent ============================================ 87cdf0e10cSrcweir 88cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > 89cdf0e10cSrcweir SAL_CALL getAccessibleAtPoint( 90cdf0e10cSrcweir const ::com::sun::star::awt::Point& rPoint ) 91cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 92cdf0e10cSrcweir 93cdf0e10cSrcweir protected: 94cdf0e10cSrcweir /// Return the object's current bounding box relative to the desktop. 95cdf0e10cSrcweir virtual Rectangle GetBoundingBoxOnScreen(void) const 96cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 97cdf0e10cSrcweir 98cdf0e10cSrcweir /// Return the object's current bounding box relative to the parent object. 99cdf0e10cSrcweir virtual Rectangle GetBoundingBox(void) const 100cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 101cdf0e10cSrcweir 102cdf0e10cSrcweir public: 103cdf0e10cSrcweir ///===== XAccessibleContext ============================================== 104cdf0e10cSrcweir 105cdf0e10cSrcweir /// Return the number of currently visible children. 106cdf0e10cSrcweir // is overloaded to calculate this on demand 107cdf0e10cSrcweir virtual sal_Int32 SAL_CALL 108cdf0e10cSrcweir getAccessibleChildCount(void) 109cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 110cdf0e10cSrcweir 111cdf0e10cSrcweir /// Return the specified child or NULL if index is invalid. 112cdf0e10cSrcweir // is overloaded to calculate this on demand 113cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 114cdf0e10cSrcweir getAccessibleChild(sal_Int32 nIndex) 115cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException, 116cdf0e10cSrcweir ::com::sun::star::lang::IndexOutOfBoundsException); 117cdf0e10cSrcweir 118cdf0e10cSrcweir /// Return the set of current states. 119cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 120cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL 121cdf0e10cSrcweir getAccessibleStateSet(void) 122cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 123cdf0e10cSrcweir 124*0deba7fbSSteve Yin //===== XAccessibleSelection ============================================ 125*0deba7fbSSteve Yin 126*0deba7fbSSteve Yin virtual void SAL_CALL selectAccessibleChild( 127*0deba7fbSSteve Yin sal_Int32 nChildIndex ) 128*0deba7fbSSteve Yin throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 129*0deba7fbSSteve Yin ::com::sun::star::uno::RuntimeException ); 130*0deba7fbSSteve Yin virtual sal_Bool SAL_CALL isAccessibleChildSelected( 131*0deba7fbSSteve Yin sal_Int32 nChildIndex ) 132*0deba7fbSSteve Yin throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 133*0deba7fbSSteve Yin ::com::sun::star::uno::RuntimeException ); 134*0deba7fbSSteve Yin virtual void SAL_CALL clearAccessibleSelection( ) 135*0deba7fbSSteve Yin throw ( ::com::sun::star::uno::RuntimeException ); 136*0deba7fbSSteve Yin virtual void SAL_CALL selectAllAccessibleChildren( ) 137*0deba7fbSSteve Yin throw ( ::com::sun::star::uno::RuntimeException ); 138*0deba7fbSSteve Yin virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) 139*0deba7fbSSteve Yin throw ( ::com::sun::star::uno::RuntimeException ); 140*0deba7fbSSteve Yin virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( 141*0deba7fbSSteve Yin sal_Int32 nSelectedChildIndex ) 142*0deba7fbSSteve Yin throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 143*0deba7fbSSteve Yin ::com::sun::star::uno::RuntimeException); 144*0deba7fbSSteve Yin virtual void SAL_CALL deselectAccessibleChild( 145*0deba7fbSSteve Yin sal_Int32 nSelectedChildIndex ) 146*0deba7fbSSteve Yin throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 147*0deba7fbSSteve Yin ::com::sun::star::uno::RuntimeException ); 148*0deba7fbSSteve Yin virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); 149cdf0e10cSrcweir protected: 150cdf0e10cSrcweir /// Return this object's description. 151cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL 152cdf0e10cSrcweir createAccessibleDescription(void) 153cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 154cdf0e10cSrcweir 155cdf0e10cSrcweir /// Return the object's current name. 156cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL 157cdf0e10cSrcweir createAccessibleName(void) 158cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 159cdf0e10cSrcweir 160cdf0e10cSrcweir public: 161cdf0e10cSrcweir ///===== XAccessibleEventBroadcaster ===================================== 162cdf0e10cSrcweir 163cdf0e10cSrcweir /** Add listener that is informed of future changes of name, 164cdf0e10cSrcweir description and so on events. 165cdf0e10cSrcweir */ 166cdf0e10cSrcweir virtual void SAL_CALL 167cdf0e10cSrcweir addEventListener( 168cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 169cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) 170cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 171cdf0e10cSrcweir 172cdf0e10cSrcweir // Remove an existing event listener. 173cdf0e10cSrcweir virtual void SAL_CALL 174cdf0e10cSrcweir removeEventListener( 175cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 176cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) 177cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 178cdf0e10cSrcweir 179cdf0e10cSrcweir ///===== XServiceInfo ==================================================== 180cdf0e10cSrcweir 181cdf0e10cSrcweir /** Returns an identifier for the implementation of this object. 182cdf0e10cSrcweir */ 183cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL 184cdf0e10cSrcweir getImplementationName(void) 185cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 186cdf0e10cSrcweir 187cdf0e10cSrcweir ///===== XTypeProvider =================================================== 188cdf0e10cSrcweir 189cdf0e10cSrcweir /** Returns a implementation id. 190cdf0e10cSrcweir */ 191cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL 192cdf0e10cSrcweir getImplementationId(void) 193cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 194cdf0e10cSrcweir 195cdf0e10cSrcweir private: 196cdf0e10cSrcweir accessibility::AccessibleTextHelper* mpTextHelper; 197cdf0e10cSrcweir EditView* mpEditView; 198cdf0e10cSrcweir Window* mpWindow; 199cdf0e10cSrcweir EditObjectType meObjectType; 200cdf0e10cSrcweir sal_Bool mbHasFocus; 201cdf0e10cSrcweir 202cdf0e10cSrcweir sal_Bool IsDefunc( 203cdf0e10cSrcweir const com::sun::star::uno::Reference< 204cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates); 205cdf0e10cSrcweir 206cdf0e10cSrcweir void CreateTextHelper(); 207*0deba7fbSSteve Yin ScDocument *m_pScDoc; 208*0deba7fbSSteve Yin ScAddress m_curCellAddress; 209*0deba7fbSSteve Yin 210*0deba7fbSSteve Yin 211*0deba7fbSSteve Yin ///===== XAccessibleComponent ============================================ 212*0deba7fbSSteve Yin virtual sal_Int32 SAL_CALL getForeground( ) 213*0deba7fbSSteve Yin throw (::com::sun::star::uno::RuntimeException); 214*0deba7fbSSteve Yin 215*0deba7fbSSteve Yin virtual sal_Int32 SAL_CALL getBackground( ) 216*0deba7fbSSteve Yin throw (::com::sun::star::uno::RuntimeException); 217*0deba7fbSSteve Yin 218*0deba7fbSSteve Yin sal_Int32 GetFgBgColor( const rtl::OUString &strPropColor) ; 219cdf0e10cSrcweir }; 220cdf0e10cSrcweir 221cdf0e10cSrcweir 222cdf0e10cSrcweir #endif 223