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_ACCESSIBLEDOCUMENT_HXX 26cdf0e10cSrcweir #define _SC_ACCESSIBLEDOCUMENT_HXX 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include "AccessibleDocumentBase.hxx" 29cdf0e10cSrcweir #include "viewdata.hxx" 30cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 31cdf0e10cSrcweir #include <com/sun/star/view/XSelectionChangeListener.hpp> 32*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 33*0deba7fbSSteve Yin //#include <cppuhelper/implbase2.hxx> 34*0deba7fbSSteve Yin #include <cppuhelper/implbase3.hxx> 35*0deba7fbSSteve Yin #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp> 36*0deba7fbSSteve Yin #include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp> 37*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 38cdf0e10cSrcweir #include <svx/IAccessibleViewForwarder.hxx> 39cdf0e10cSrcweir 40cdf0e10cSrcweir class ScTabViewShell; 41cdf0e10cSrcweir class ScAccessibleSpreadsheet; 42cdf0e10cSrcweir class ScChildrenShapes; 43cdf0e10cSrcweir class ScAccessibleEditObject; 44cdf0e10cSrcweir 45cdf0e10cSrcweir namespace accessibility 46cdf0e10cSrcweir { 47cdf0e10cSrcweir class AccessibleShape; 48cdf0e10cSrcweir } 49cdf0e10cSrcweir namespace utl 50cdf0e10cSrcweir { 51cdf0e10cSrcweir class AccessibleRelationSetHelper; 52cdf0e10cSrcweir } 53cdf0e10cSrcweir 54cdf0e10cSrcweir /** @descr 55cdf0e10cSrcweir This base class provides an implementation of the 56cdf0e10cSrcweir <code>AccessibleContext</code> service. 57cdf0e10cSrcweir */ 58cdf0e10cSrcweir 59*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 60*0deba7fbSSteve Yin typedef cppu::ImplHelper3< ::com::sun::star::accessibility::XAccessibleSelection, 61*0deba7fbSSteve Yin ::com::sun::star::accessibility::XAccessibleExtendedAttributes, 62*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 63cdf0e10cSrcweir ::com::sun::star::view::XSelectionChangeListener > 64cdf0e10cSrcweir ScAccessibleDocumentImpl; 65cdf0e10cSrcweir 66cdf0e10cSrcweir class ScAccessibleDocument 67cdf0e10cSrcweir : public ScAccessibleDocumentBase, 68cdf0e10cSrcweir public ScAccessibleDocumentImpl, 69*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 70*0deba7fbSSteve Yin public com::sun::star::accessibility::XAccessibleGetAccFlowTo, 71*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 72cdf0e10cSrcweir public accessibility::IAccessibleViewForwarder 73cdf0e10cSrcweir { 74cdf0e10cSrcweir public: 75cdf0e10cSrcweir //===== internal ======================================================== 76cdf0e10cSrcweir ScAccessibleDocument( 77cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 78cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessible>& rxParent, 79cdf0e10cSrcweir ScTabViewShell* pViewShell, 80cdf0e10cSrcweir ScSplitPos eSplitPos); 81cdf0e10cSrcweir 82cdf0e10cSrcweir virtual void Init(); 83cdf0e10cSrcweir 84cdf0e10cSrcweir 85cdf0e10cSrcweir DECL_LINK( WindowChildEventListener, VclSimpleEvent* ); 86cdf0e10cSrcweir protected: 87cdf0e10cSrcweir virtual ~ScAccessibleDocument(void); 88cdf0e10cSrcweir 89cdf0e10cSrcweir using ScAccessibleDocumentBase::IsDefunc; 90cdf0e10cSrcweir 91cdf0e10cSrcweir public: 92cdf0e10cSrcweir 93cdf0e10cSrcweir virtual void SAL_CALL disposing(); 94cdf0e10cSrcweir 95cdf0e10cSrcweir ///===== SfxListener ===================================================== 96cdf0e10cSrcweir 97cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 98cdf0e10cSrcweir 99cdf0e10cSrcweir ///===== XInterface ===================================================== 100cdf0e10cSrcweir 101cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 102cdf0e10cSrcweir ::com::sun::star::uno::Type const & rType ) 103cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 104cdf0e10cSrcweir 105cdf0e10cSrcweir virtual void SAL_CALL acquire() throw (); 106cdf0e10cSrcweir 107cdf0e10cSrcweir virtual void SAL_CALL release() throw (); 108cdf0e10cSrcweir 109cdf0e10cSrcweir ///===== XAccessibleComponent ============================================ 110cdf0e10cSrcweir 111cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > 112cdf0e10cSrcweir SAL_CALL getAccessibleAtPoint( 113cdf0e10cSrcweir const ::com::sun::star::awt::Point& rPoint ) 114cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 115cdf0e10cSrcweir 116cdf0e10cSrcweir virtual void SAL_CALL grabFocus( ) 117cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 118cdf0e10cSrcweir 119cdf0e10cSrcweir ///===== XAccessibleContext ============================================== 120cdf0e10cSrcweir 121cdf0e10cSrcweir /// Return the number of currently visible children. 122cdf0e10cSrcweir virtual sal_Int32 SAL_CALL 123cdf0e10cSrcweir getAccessibleChildCount(void) 124cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 125cdf0e10cSrcweir 126cdf0e10cSrcweir /// Return the specified child or NULL if index is invalid. 127cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 128cdf0e10cSrcweir getAccessibleChild(sal_Int32 nIndex) 129cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException, 130cdf0e10cSrcweir ::com::sun::star::lang::IndexOutOfBoundsException); 131cdf0e10cSrcweir 132cdf0e10cSrcweir /// Return the set of current states. 133cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 134cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL 135cdf0e10cSrcweir getAccessibleStateSet(void) 136cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 137cdf0e10cSrcweir 138*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 139*0deba7fbSSteve Yin virtual ::rtl::OUString SAL_CALL 140*0deba7fbSSteve Yin getAccessibleName(void) 141*0deba7fbSSteve Yin throw (::com::sun::star::uno::RuntimeException); 142*0deba7fbSSteve Yin 143*0deba7fbSSteve Yin virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() 144*0deba7fbSSteve Yin throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; 145*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 146cdf0e10cSrcweir ///===== XAccessibleSelection =========================================== 147cdf0e10cSrcweir 148cdf0e10cSrcweir virtual void SAL_CALL 149cdf0e10cSrcweir selectAccessibleChild( sal_Int32 nChildIndex ) 150cdf0e10cSrcweir throw (::com::sun::star::lang::IndexOutOfBoundsException, 151cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 152cdf0e10cSrcweir 153cdf0e10cSrcweir virtual sal_Bool SAL_CALL 154cdf0e10cSrcweir isAccessibleChildSelected( sal_Int32 nChildIndex ) 155cdf0e10cSrcweir throw (::com::sun::star::lang::IndexOutOfBoundsException, 156cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 157cdf0e10cSrcweir 158cdf0e10cSrcweir virtual void SAL_CALL 159cdf0e10cSrcweir clearAccessibleSelection( ) 160cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 161cdf0e10cSrcweir 162cdf0e10cSrcweir virtual void SAL_CALL 163cdf0e10cSrcweir selectAllAccessibleChildren( ) 164cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 165cdf0e10cSrcweir 166cdf0e10cSrcweir virtual sal_Int32 SAL_CALL 167cdf0e10cSrcweir getSelectedAccessibleChildCount( ) 168cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 169cdf0e10cSrcweir 170cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 171cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessible > SAL_CALL 172cdf0e10cSrcweir getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) 173cdf0e10cSrcweir throw (::com::sun::star::lang::IndexOutOfBoundsException, 174cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 175cdf0e10cSrcweir 176cdf0e10cSrcweir virtual void SAL_CALL 177cdf0e10cSrcweir deselectAccessibleChild( sal_Int32 nChildIndex ) 178cdf0e10cSrcweir throw (::com::sun::star::lang::IndexOutOfBoundsException, 179cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 180cdf0e10cSrcweir 181cdf0e10cSrcweir ///===== XSelectionListener ============================================= 182cdf0e10cSrcweir 183cdf0e10cSrcweir virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) 184cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 185cdf0e10cSrcweir 186cdf0e10cSrcweir virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) 187cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 188cdf0e10cSrcweir 189cdf0e10cSrcweir ///===== XServiceInfo =================================================== 190cdf0e10cSrcweir 191cdf0e10cSrcweir /** Returns an identifier for the implementation of this object. 192cdf0e10cSrcweir */ 193cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL 194cdf0e10cSrcweir getImplementationName(void) 195cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 196cdf0e10cSrcweir 197cdf0e10cSrcweir /** Returns a list of all supported services. 198cdf0e10cSrcweir */ 199cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL 200cdf0e10cSrcweir getSupportedServiceNames(void) 201cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 202cdf0e10cSrcweir 203cdf0e10cSrcweir ///===== XTypeProvider =================================================== 204cdf0e10cSrcweir 205cdf0e10cSrcweir /// returns the possible types 206cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL 207cdf0e10cSrcweir getTypes() 208cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 209cdf0e10cSrcweir 210cdf0e10cSrcweir /** Returns a implementation id. 211cdf0e10cSrcweir */ 212cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL 213cdf0e10cSrcweir getImplementationId(void) 214cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 215cdf0e10cSrcweir 216cdf0e10cSrcweir ///===== IAccessibleViewForwarder ======================================== 217cdf0e10cSrcweir 218cdf0e10cSrcweir /** This method informs you about the state of the forwarder. Do not 219cdf0e10cSrcweir use it when the returned value is <false/>. 220cdf0e10cSrcweir 221cdf0e10cSrcweir @return 222cdf0e10cSrcweir Return <true/> if the view forwarder is valid and <false/> else. 223cdf0e10cSrcweir */ 224cdf0e10cSrcweir virtual sal_Bool IsValid (void) const; 225cdf0e10cSrcweir 226cdf0e10cSrcweir /** Returns the area of the underlying document that is visible in the 227cdf0e10cSrcweir * corresponding window. 228cdf0e10cSrcweir 229cdf0e10cSrcweir @return 230cdf0e10cSrcweir The rectangle of the visible part of the document. The values 231cdf0e10cSrcweir are, contrary to the base class, in internal coordinates. 232cdf0e10cSrcweir */ 233cdf0e10cSrcweir virtual Rectangle GetVisibleArea() const; 234cdf0e10cSrcweir 235cdf0e10cSrcweir /** Transform the specified point from internal coordinates to an 236cdf0e10cSrcweir absolute screen position. 237cdf0e10cSrcweir 238cdf0e10cSrcweir @param rPoint 239cdf0e10cSrcweir Point in internal coordinates. 240cdf0e10cSrcweir 241cdf0e10cSrcweir @return 242cdf0e10cSrcweir The same point but in screen coordinates relative to the upper 243cdf0e10cSrcweir left corner of the (current) screen. 244cdf0e10cSrcweir */ 245cdf0e10cSrcweir virtual Point LogicToPixel (const Point& rPoint) const; 246cdf0e10cSrcweir 247cdf0e10cSrcweir /** Transform the specified size from internal coordinates to a screen 248cdf0e10cSrcweir * oriented pixel size. 249cdf0e10cSrcweir 250cdf0e10cSrcweir @param rSize 251cdf0e10cSrcweir Size in internal coordinates. 252cdf0e10cSrcweir 253cdf0e10cSrcweir @return 254cdf0e10cSrcweir The same size but in screen coordinates. 255cdf0e10cSrcweir */ 256cdf0e10cSrcweir virtual Size LogicToPixel (const Size& rSize) const; 257cdf0e10cSrcweir 258cdf0e10cSrcweir /** Transform the specified point from absolute screen coordinates to 259cdf0e10cSrcweir internal coordinates. 260cdf0e10cSrcweir 261cdf0e10cSrcweir @param rPoint 262cdf0e10cSrcweir Point in screen coordinates relative to the upper left corner of 263cdf0e10cSrcweir the (current) screen. 264cdf0e10cSrcweir 265cdf0e10cSrcweir @return 266cdf0e10cSrcweir The same point but in internal coordinates. 267cdf0e10cSrcweir */ 268cdf0e10cSrcweir virtual Point PixelToLogic (const Point& rPoint) const; 269cdf0e10cSrcweir 270cdf0e10cSrcweir /** Transform the specified size from screen coordinates to internal 271cdf0e10cSrcweir coordinates. 272cdf0e10cSrcweir 273cdf0e10cSrcweir @param rSize 274cdf0e10cSrcweir Size in screen coordinates. 275cdf0e10cSrcweir 276cdf0e10cSrcweir @return 277cdf0e10cSrcweir The same size but in internal coordinates. 278cdf0e10cSrcweir */ 279cdf0e10cSrcweir virtual Size PixelToLogic (const Size& rSize) const; 280cdf0e10cSrcweir 281cdf0e10cSrcweir ///======== internal ===================================================== 282cdf0e10cSrcweir 283cdf0e10cSrcweir utl::AccessibleRelationSetHelper* GetRelationSet(const ScAddress* pAddress) const; 284cdf0e10cSrcweir 285cdf0e10cSrcweir ::com::sun::star::uno::Reference 286cdf0e10cSrcweir < ::com::sun::star::accessibility::XAccessible > 287cdf0e10cSrcweir GetAccessibleSpreadsheet(); 288cdf0e10cSrcweir 289cdf0e10cSrcweir protected: 290cdf0e10cSrcweir /// Return this object's description. 291cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL 292cdf0e10cSrcweir createAccessibleDescription(void) 293cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 294cdf0e10cSrcweir 295cdf0e10cSrcweir /// Return the object's current name. 296cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL 297cdf0e10cSrcweir createAccessibleName(void) 298cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 299cdf0e10cSrcweir 300cdf0e10cSrcweir /// Return the object's current bounding box relative to the desktop. 301cdf0e10cSrcweir virtual Rectangle GetBoundingBoxOnScreen(void) const 302cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 303cdf0e10cSrcweir 304cdf0e10cSrcweir /// Return the object's current bounding box relative to the parent object. 305cdf0e10cSrcweir virtual Rectangle GetBoundingBox(void) const 306cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 307cdf0e10cSrcweir 308cdf0e10cSrcweir private: 309cdf0e10cSrcweir ScTabViewShell* mpViewShell; 310cdf0e10cSrcweir ScSplitPos meSplitPos; 311cdf0e10cSrcweir ScAccessibleSpreadsheet* mpAccessibleSpreadsheet; 312cdf0e10cSrcweir ScChildrenShapes* mpChildrenShapes; 313cdf0e10cSrcweir ScAccessibleEditObject* mpTempAccEdit; 314cdf0e10cSrcweir com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible> mxTempAcc; 315cdf0e10cSrcweir Rectangle maVisArea; 316cdf0e10cSrcweir sal_Bool mbCompleteSheetSelected; 317cdf0e10cSrcweir 318cdf0e10cSrcweir public: 319cdf0e10cSrcweir SCTAB getVisibleTable() const; // use it in ScChildrenShapes 320cdf0e10cSrcweir 321cdf0e10cSrcweir private: 322cdf0e10cSrcweir void FreeAccessibleSpreadsheet(); 323cdf0e10cSrcweir 324cdf0e10cSrcweir sal_Bool IsTableSelected() const; 325cdf0e10cSrcweir 326cdf0e10cSrcweir sal_Bool IsDefunc( 327cdf0e10cSrcweir const com::sun::star::uno::Reference< 328cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates); 329cdf0e10cSrcweir sal_Bool IsEditable( 330cdf0e10cSrcweir const com::sun::star::uno::Reference< 331cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates); 332cdf0e10cSrcweir 333cdf0e10cSrcweir void AddChild(const com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible>& xAcc, sal_Bool bFireEvent); 334cdf0e10cSrcweir void RemoveChild(const com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible>& xAcc, sal_Bool bFireEvent); 335cdf0e10cSrcweir 336cdf0e10cSrcweir rtl::OUString GetCurrentCellName() const; 337cdf0e10cSrcweir rtl::OUString GetCurrentCellDescription() const; 338cdf0e10cSrcweir 339cdf0e10cSrcweir Rectangle GetVisibleArea_Impl() const; 340*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009----- 341*0deba7fbSSteve Yin com::sun::star::uno::Sequence< com::sun::star::uno::Any > GetScAccFlowToSequence(); 342*0deba7fbSSteve Yin public: 343*0deba7fbSSteve Yin ScDocument *GetDocument() const ; 344*0deba7fbSSteve Yin ScAddress GetCurCellAddress() const; 345*0deba7fbSSteve Yin //===== XAccessibleGetAccFromXShape ============================================ 346*0deba7fbSSteve Yin ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > 347*0deba7fbSSteve Yin SAL_CALL get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType) 348*0deba7fbSSteve Yin throw ( ::com::sun::star::uno::RuntimeException ); 349*0deba7fbSSteve Yin 350*0deba7fbSSteve Yin virtual sal_Int32 SAL_CALL getForeground( ) 351*0deba7fbSSteve Yin throw (::com::sun::star::uno::RuntimeException); 352*0deba7fbSSteve Yin 353*0deba7fbSSteve Yin virtual sal_Int32 SAL_CALL getBackground( ) 354*0deba7fbSSteve Yin throw (::com::sun::star::uno::RuntimeException); 355*0deba7fbSSteve Yin protected: 356*0deba7fbSSteve Yin void SwitchViewFireFocus(); 357*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009 358cdf0e10cSrcweir }; 359cdf0e10cSrcweir 360cdf0e10cSrcweir 361cdf0e10cSrcweir #endif 362