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