/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #ifndef INCLUDED_SC_SOURCE_UI_INC_ACCESSIBLEDOCUMENT_HXX #define INCLUDED_SC_SOURCE_UI_INC_ACCESSIBLEDOCUMENT_HXX #include "AccessibleDocumentBase.hxx" #include "viewdata.hxx" #include #include #include #include #include #include class ScTabViewShell; class ScAccessibleSpreadsheet; class ScChildrenShapes; class ScAccessibleEditObject; namespace utl { class AccessibleRelationSetHelper; } /** @descr This base class provides an implementation of the AccessibleContext service. */ typedef cppu::ImplHelper3< ::com::sun::star::accessibility::XAccessibleSelection, ::com::sun::star::accessibility::XAccessibleExtendedAttributes, ::com::sun::star::view::XSelectionChangeListener > ScAccessibleDocumentImpl; class ScAccessibleDocument : public ScAccessibleDocumentBase, public ScAccessibleDocumentImpl, public com::sun::star::accessibility::XAccessibleGetAccFlowTo, public accessibility::IAccessibleViewForwarder { public: //===== internal ======================================================== ScAccessibleDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, ScTabViewShell* pViewShell, ScSplitPos eSplitPos); virtual void Init() SAL_OVERRIDE; DECL_LINK( WindowChildEventListener, VclSimpleEvent* ); protected: virtual ~ScAccessibleDocument(); using ScAccessibleDocumentBase::IsDefunc; public: virtual void SAL_CALL disposing() SAL_OVERRIDE; ///===== SfxListener ===================================================== virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE; ///===== XInterface ===================================================== virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual void SAL_CALL acquire() throw () SAL_OVERRIDE; virtual void SAL_CALL release() throw () SAL_OVERRIDE; ///===== XAccessibleComponent ============================================ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; ///===== XAccessibleContext ============================================== /// Return the number of currently visible children. virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; /// Return the specified child or NULL if index is invalid. virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL getAccessibleChild(sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException, std::exception) SAL_OVERRIDE; /// Return the set of current states. virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE ; ///===== XAccessibleSelection =========================================== virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; ///===== XSelectionListener ============================================= virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; ///===== XServiceInfo =================================================== /** Returns an identifier for the implementation of this object. */ virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; /** Returns a list of all supported services. */ virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; ///===== XTypeProvider =================================================== /// returns the possible types virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; /** Returns a implementation id. */ virtual ::com::sun::star::uno::Sequence SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; ///===== IAccessibleViewForwarder ======================================== /** Returns the area of the underlying document that is visible in the * corresponding window. @return The rectangle of the visible part of the document. The values are, contrary to the base class, in internal coordinates. */ virtual Rectangle GetVisibleArea() const SAL_OVERRIDE; /** Transform the specified point from internal coordinates to an absolute screen position. @param rPoint Point in internal coordinates. @return The same point but in screen coordinates relative to the upper left corner of the (current) screen. */ virtual Point LogicToPixel (const Point& rPoint) const SAL_OVERRIDE; /** Transform the specified size from internal coordinates to a screen * oriented pixel size. @param rSize Size in internal coordinates. @return The same size but in screen coordinates. */ virtual Size LogicToPixel (const Size& rSize) const SAL_OVERRIDE; ///======== internal ===================================================== utl::AccessibleRelationSetHelper* GetRelationSet(const ScAddress* pAddress) const; ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > GetAccessibleSpreadsheet(); protected: /// Return this object's description. virtual OUString SAL_CALL createAccessibleDescription() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; /// Return the object's current name. virtual OUString SAL_CALL createAccessibleName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; /// Return the object's current bounding box relative to the desktop. virtual Rectangle GetBoundingBoxOnScreen() const throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; /// Return the object's current bounding box relative to the parent object. virtual Rectangle GetBoundingBox() const throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: ScTabViewShell* mpViewShell; ScSplitPos meSplitPos; ScAccessibleSpreadsheet* mpAccessibleSpreadsheet; ScChildrenShapes* mpChildrenShapes; ScAccessibleEditObject* mpTempAccEdit; com::sun::star::uno::Reference mxTempAcc; Rectangle maVisArea; bool mbCompleteSheetSelected; public: SCTAB getVisibleTable() const; // use it in ScChildrenShapes private: void FreeAccessibleSpreadsheet(); bool IsTableSelected() const; bool IsDefunc( const com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates); void AddChild(const com::sun::star::uno::Reference& xAcc, bool bFireEvent); void RemoveChild(const com::sun::star::uno::Reference& xAcc, bool bFireEvent); OUString GetCurrentCellName() const; static OUString GetCurrentCellDescription(); Rectangle GetVisibleArea_Impl() const; com::sun::star::uno::Sequence< com::sun::star::uno::Any > GetScAccFlowToSequence(); public: ScDocument *GetDocument() const ; ScAddress GetCurCellAddress() const; //===== XAccessibleGetAccFromXShape ============================================ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getAccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; }; #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */