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