LCOV - code coverage report
Current view: top level - sd/source/ui/inc - AccessibleDocumentViewBase.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1 0.0 %
Date: 2014-04-14 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_SD_SOURCE_UI_INC_ACCESSIBLEDOCUMENTVIEWBASE_HXX
      21             : #define INCLUDED_SD_SOURCE_UI_INC_ACCESSIBLEDOCUMENTVIEWBASE_HXX
      22             : 
      23             : #include <editeng/AccessibleContextBase.hxx>
      24             : #include <editeng/AccessibleComponentBase.hxx>
      25             : #include <editeng/AccessibleSelectionBase.hxx>
      26             : #include "AccessibleViewForwarder.hxx"
      27             : #include "AccessiblePageShape.hxx"
      28             : #include <svx/ChildrenManager.hxx>
      29             : #include <com/sun/star/frame/XModel.hpp>
      30             : #include <com/sun/star/awt/XWindowListener.hpp>
      31             : #include <com/sun/star/awt/XFocusListener.hpp>
      32             : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
      33             : #include <com/sun/star/accessibility/XAccessible.hpp>
      34             : #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
      35             : #include <tools/link.hxx>
      36             : 
      37             : #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
      38             : #include "DrawViewShell.hxx"
      39             : #include "sdpage.hxx"
      40             : #include "drawdoc.hxx"
      41             : #include "FrameView.hxx"
      42             : #include "PresentationViewShell.hxx"
      43             : #include <editeng/outlobj.hxx>
      44             : #include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>
      45             : class SdViewShell;
      46             : namespace sd {
      47             : class ViewShell;
      48             : class Window;
      49             : }
      50             : 
      51             : class VclSimpleEvent;
      52             : 
      53             : namespace accessibility {
      54             : 
      55             : 
      56             : /** Base class for the various document views of the Draw and
      57             :     Impress applications.
      58             : 
      59             :     <p>The different view modes of the Draw and Impress applications
      60             :     are made accessible by derived classes.  When the view mode is
      61             :     changed than the object representing the document view is
      62             :     disposed and replaced by a new instance of the then appropriate
      63             :     derived class.</p>
      64             : 
      65             :     <p>This base class also manages an optionally active accessible OLE
      66             :     object.  If you overwrite the <member>getAccessibleChildCount</member>
      67             :     and <member>getAccessibleChild</member> methods then make sure to first
      68             :     call the corresponding method of this class and adapt your child count
      69             :     and indices accordingly.  Only one active OLE object is allowed at a
      70             :     time.  This class does not listen for disposing calls at the moment
      71             :     because it does not use the accessible OLE object directly and trusts on
      72             :     getting informed through VCL window events.</p>
      73             : 
      74             :     <p>This class implements three kinds of listeners:
      75             :     <ol><li>The property change listener is not used directly but exists as
      76             :     convenience for derived classes.  May be moved to those classes
      77             :     instead.</li>
      78             :     <li>As window listener it waits for changes of the window geometry and
      79             :     forwards those as view forwarder changes.</li>
      80             :     <li>As focus listener it keeps track of the focus to give this class and
      81             :     derived classes the oportunity to set and remove the focus to/from
      82             :     shapes.</li>
      83             :     </ol>
      84             :     </p>
      85             : */
      86             : class AccessibleDocumentViewBase
      87             :     :   public AccessibleContextBase,
      88             :         public AccessibleComponentBase,
      89             :         public AccessibleSelectionBase,
      90             :         public IAccessibleViewForwarderListener,
      91             :         public ::com::sun::star::beans::XPropertyChangeListener,
      92             :         public ::com::sun::star::awt::XWindowListener,
      93             :         public ::com::sun::star::awt::XFocusListener
      94             :         ,public ::com::sun::star::accessibility::XAccessibleExtendedAttributes
      95             :         ,public com::sun::star::accessibility::XAccessibleGetAccFlowTo
      96             : {
      97             : public:
      98             :     //=====  internal  ========================================================
      99             : 
     100             :     /** Create a new object.  Note that the caller has to call the
     101             :         Init method directly after this constructor has finished.
     102             :     @param pSdWindow
     103             :         The window whose content is to be made accessible.
     104             :     @param pViewShell
     105             :         The view shell associated with the given window.
     106             :     @param rxController
     107             :         The controller from which to get the model.
     108             :     @param rxParent
     109             :         The accessible parent of the new object.  Note that this parent does
     110             :         not necessarily correspond with the parent of the given window.
     111             :      */
     112             :     AccessibleDocumentViewBase (
     113             :         ::sd::Window* pSdWindow,
     114             :         ::sd::ViewShell* pViewShell,
     115             :         const ::com::sun::star::uno::Reference<
     116             :             ::com::sun::star::frame::XController>& rxController,
     117             :         const ::com::sun::star::uno::Reference<
     118             :             ::com::sun::star::accessibility::XAccessible>& rxParent);
     119             : 
     120             :     virtual ~AccessibleDocumentViewBase (void);
     121             : 
     122             :     /** Initialize a new object.  Call this method directly after creating a
     123             :         new object.  It finished the initialization begun in the constructor
     124             :         but which needs a fully created object.
     125             :      */
     126             :     virtual void Init (void);
     127             : 
     128             :     /** Define callback for listening to window child events of VCL.
     129             :         Listen for creation or destruction of OLE objects.
     130             :     */
     131             :     DECL_LINK (WindowChildEventListener, VclSimpleEvent*);
     132             : 
     133             :     //=====  IAccessibleViewForwarderListener  ================================
     134             : 
     135             :     /** A view forwarder change is signalled for instance when any of the
     136             :         window events is received.  Thus, instead of overloading the four
     137             :         windowResized... methods it will be sufficient in most cases just to
     138             :         overload this method.
     139             :      */
     140             :     virtual void ViewForwarderChanged (ChangeType aChangeType,
     141             :         const IAccessibleViewForwarder* pViewForwarder) SAL_OVERRIDE;
     142             : 
     143             :     //=====  XAccessibleContext  ==============================================
     144             : 
     145             :     virtual ::com::sun::star::uno::Reference<
     146             :         ::com::sun::star::accessibility::XAccessible> SAL_CALL
     147             :         getAccessibleParent (void)
     148             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     149             : 
     150             :     /** This implementation returns either 1 or 0 depending on whether there
     151             :         is an active accessible OLE object or not.
     152             :     */
     153             :     virtual sal_Int32 SAL_CALL
     154             :         getAccessibleChildCount (void)
     155             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     156             : 
     157             :     /** This implementation either returns the active accessible OLE object
     158             :         if it exists and the given index is 0 or throws an exception.
     159             :     */
     160             :     virtual ::com::sun::star::uno::Reference<
     161             :         ::com::sun::star::accessibility::XAccessible> SAL_CALL
     162             :         getAccessibleChild (sal_Int32 nIndex)
     163             :         throw (::com::sun::star::uno::RuntimeException,
     164             :             ::com::sun::star::lang::IndexOutOfBoundsException, std::exception) SAL_OVERRIDE;
     165             : 
     166             : 
     167             :     //=====  XAccessibleComponent  ============================================
     168             : 
     169             :     virtual ::com::sun::star::uno::Reference<
     170             :         ::com::sun::star::accessibility::XAccessible > SAL_CALL
     171             :         getAccessibleAtPoint (const ::com::sun::star::awt::Point& aPoint)
     172             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     173             : 
     174             :     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (void)
     175             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     176             : 
     177             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocation (void)
     178             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     179             : 
     180             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen (void)
     181             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     182             : 
     183             :     virtual ::com::sun::star::awt::Size SAL_CALL getSize (void)
     184             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     185             : 
     186             : 
     187             :     //=====  XInterface  ======================================================
     188             : 
     189             :     virtual com::sun::star::uno::Any SAL_CALL
     190             :         queryInterface (const com::sun::star::uno::Type & rType)
     191             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     192             : 
     193             :     virtual void SAL_CALL
     194             :         acquire (void)
     195             :         throw () SAL_OVERRIDE;
     196             : 
     197             :     virtual void SAL_CALL
     198             :         release (void)
     199             :         throw () SAL_OVERRIDE;
     200             : 
     201             : 
     202             :     //=====  XServiceInfo  ====================================================
     203             : 
     204             :     /** Returns an identifier for the implementation of this object.
     205             :     */
     206             :     virtual OUString SAL_CALL
     207             :         getImplementationName (void)
     208             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     209             : 
     210             :     virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
     211             :         getSupportedServiceNames (void)
     212             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     213             : 
     214             : 
     215             :     //=====  XTypeProvider  ===================================================
     216             : 
     217             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
     218             :         getTypes (void)
     219             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     220             : 
     221             : 
     222             :     //=====  lang::XEventListener  ============================================
     223             : 
     224             :     virtual void SAL_CALL
     225             :         disposing (const ::com::sun::star::lang::EventObject& rEventObject)
     226             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     227             : 
     228             : 
     229             :     //=====  XPropertyChangeListener  =========================================
     230             : 
     231             :     virtual void SAL_CALL
     232             :         propertyChange (const ::com::sun::star::beans::PropertyChangeEvent& rEventObject)
     233             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     234             : 
     235             : 
     236             :     //=====  XWindowListener  =================================================
     237             : 
     238             :     virtual void SAL_CALL
     239             :         windowResized (const ::com::sun::star::awt::WindowEvent& e)
     240             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     241             : 
     242             :     virtual void SAL_CALL
     243             :         windowMoved (const ::com::sun::star::awt::WindowEvent& e)
     244             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     245             : 
     246             :     virtual void SAL_CALL
     247             :         windowShown (const ::com::sun::star::lang::EventObject& e)
     248             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     249             : 
     250             :     virtual void SAL_CALL
     251             :         windowHidden (const ::com::sun::star::lang::EventObject& e)
     252             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     253             : 
     254             :     //=====  XFocusListener  =================================================
     255             : 
     256             :     virtual void SAL_CALL focusGained (const ::com::sun::star::awt::FocusEvent& e)
     257             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     258             :     virtual void SAL_CALL focusLost (const ::com::sun::star::awt::FocusEvent& e)
     259             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     260             :     //----------------------------xAttribute----------------------------
     261             :     virtual com::sun::star::uno::Any SAL_CALL getExtendedAttributes()
     262             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     263             :                ::com::sun::star::uno::RuntimeException,
     264             :                std::exception) SAL_OVERRIDE;
     265             :      ::sd::ViewShell* mpViewShell;
     266             : private:
     267             : 
     268             :     // return the member maMutex;
     269             :     virtual ::osl::Mutex&
     270             :         implGetMutex() SAL_OVERRIDE;
     271             : 
     272             :     // return ourself as context in default case
     273             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
     274             :         implGetAccessibleContext()
     275             :         throw ( ::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
     276             : 
     277             :     // return sal_False in default case
     278             :     virtual bool
     279             :         implIsSelected( sal_Int32 nAccessibleChildIndex )
     280             :         throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     281             : 
     282             :     // return nothing in default case
     283             :     virtual void
     284             :         implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect )
     285             :         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     286             : 
     287             : protected:
     288             :     /// The core window that is made accessible.
     289             :     ::sd::Window* mpWindow;
     290             : 
     291             :     /// The API window that is made accessible.
     292             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>
     293             :          mxWindow;
     294             : 
     295             :     /// The controller of the window in which this view is displayed.
     296             :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController>
     297             :          mxController;
     298             : 
     299             :     /// Model of the document.
     300             :     ::com::sun::star::uno::Reference < ::com::sun::star::frame::XModel>
     301             :         mxModel;
     302             : 
     303             :     // Bundle of information that is passed down the shape tree.
     304             :     AccessibleShapeTreeInfo maShapeTreeInfo;
     305             : 
     306             :     /// The view forwarder passed to the children manager.
     307             :     AccessibleViewForwarder maViewForwarder;
     308             : 
     309             :     /** Accessible OLE object.  Set or removed by the
     310             :         <member>SetAccessibleOLEObject</member> method.
     311             :     */
     312             :     ::com::sun::star::uno::Reference <
     313             :         ::com::sun::star::accessibility::XAccessible>
     314             :         mxAccessibleOLEObject;
     315             : 
     316             :     Link maWindowLink;
     317             : 
     318             :     // This method is called from the component helper base class while
     319             :     // disposing.
     320             :     virtual void SAL_CALL disposing (void) SAL_OVERRIDE;
     321             : 
     322             :     /** Create a name string.  The current name is not modified and,
     323             :         therefore, no events are send.  This method is usually called once
     324             :         by the <member>getAccessibleName</member> method of the base class.
     325             :         @return
     326             :            A name string.
     327             :     */
     328             :     virtual OUString
     329             :         CreateAccessibleName ()
     330             :         throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     331             : 
     332             :     /** Create a description string.  The current description is not
     333             :         modified and, therefore, no events are send.  This method is usually
     334             :         called once by the <member>getAccessibleDescription</member> method
     335             :         of the base class.
     336             :         @return
     337             :            A description string.
     338             :     */
     339             :     virtual OUString
     340             :         CreateAccessibleDescription ()
     341             :         throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     342             : 
     343             :     /** This method is called when (after) the frame containing this
     344             :         document has been activated.  Can be used to send FOCUSED state
     345             :         changes for the currently selected element.
     346             : 
     347             :         Note: Currently used as a substitute for FocusGained.  Should be
     348             :         renamed in the future.
     349             :     */
     350             :     virtual void Activated (void);
     351             : 
     352             :     /** This method is called when (before or after?) the frame containing
     353             :         this document has been deactivated.  Can be used to send FOCUSED
     354             :         state changes for the currently selected element.
     355             : 
     356             :         Note: Currently used as a substitute for FocusLost.  Should be
     357             :         renamed in the future.
     358             :     */
     359             :     virtual void Deactivated (void);
     360             : 
     361             :     /** Set or remove the currently active accessible OLE object.
     362             :         @param xOLEObject
     363             :             If this is a valid reference then a child event is send that
     364             :             informs the listeners of a new child.  If there has already been
     365             :             an active accessible OLE object then this is removed first and
     366             :             appropriate events are send.
     367             : 
     368             :             If this is an empty reference then the currently active
     369             :             accessible OLE object (if there is one) is removed.
     370             :     */
     371             :     virtual void SetAccessibleOLEObject (
     372             :         const ::com::sun::star::uno::Reference <
     373             :         ::com::sun::star::accessibility::XAccessible>& xOLEObject);
     374             :     //=====  XAccessibleGetAccFromXShape  ============================================
     375             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
     376             :         SAL_CALL getAccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
     377             :         throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     378             : 
     379             : public:
     380           0 :     virtual void SwitchViewActivated (void) { Activated(); }
     381             :      virtual sal_Int32 SAL_CALL getForeground(  )
     382             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     383             : 
     384             :     virtual sal_Int32 SAL_CALL getBackground(  )
     385             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     386             :     virtual void impl_dispose (void);
     387             : };
     388             : 
     389             : } // end of namespace accessibility
     390             : 
     391             : #endif
     392             : 
     393             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10