LCOV - code coverage report
Current view: top level - svx/source/inc - GraphCtlAccessibleContext.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 2 0.0 %
Date: 2014-11-03 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             : 
      21             : #ifndef INCLUDED_SVX_SOURCE_INC_GRAPHCTLACCESSIBLECONTEXT_HXX
      22             : #define INCLUDED_SVX_SOURCE_INC_GRAPHCTLACCESSIBLECONTEXT_HXX
      23             : 
      24             : #include <cppuhelper/compbase7.hxx>
      25             : #include <com/sun/star/uno/Reference.hxx>
      26             : #include <com/sun/star/accessibility/XAccessible.hpp>
      27             : #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
      28             : #include <com/sun/star/accessibility/XAccessibleContext.hpp>
      29             : #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
      30             : #include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
      31             : #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
      32             : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
      33             : #include <cppuhelper/weak.hxx>
      34             : #include <com/sun/star/lang/XServiceInfo.hpp>
      35             : #include <com/sun/star/lang/XTypeProvider.hpp>
      36             : #include <com/sun/star/lang/XServiceName.hpp>
      37             : #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
      38             : #include <osl/mutex.hxx>
      39             : #include <comphelper/broadcasthelper.hxx>
      40             : #include <svl/lstner.hxx>
      41             : 
      42             : #include <set>
      43             : #include <map>
      44             : 
      45             : #include <comphelper/servicehelper.hxx>
      46             : #include <svx/rectenum.hxx>
      47             : #include <svx/AccessibleShapeTreeInfo.hxx>
      48             : #include <svx/IAccessibleViewForwarder.hxx>
      49             : #include <svx/AccessibleShape.hxx>
      50             : 
      51             : namespace com { namespace sun { namespace star { namespace awt {
      52             :     struct Point;
      53             :     struct Rectangle;
      54             :     struct Size;
      55             :     class XFocusListener;
      56             : } } } }
      57             : 
      58             : class Rectangle;
      59             : class GraphCtrl;
      60             : class SdrObject;
      61             : class SdrModel;
      62             : class SdrPage;
      63             : class SdrView;
      64             : 
      65             : /** @descr
      66             :         This base class provides an implementation of the
      67             :         <code>AccessibleContext</code> service.
      68             : */
      69             : 
      70             : typedef ::cppu::WeakAggComponentImplHelper7<
      71             :                 ::com::sun::star::accessibility::XAccessible,
      72             :                 ::com::sun::star::accessibility::XAccessibleComponent,
      73             :                 ::com::sun::star::accessibility::XAccessibleContext,
      74             :                 ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
      75             :                 ::com::sun::star::accessibility::XAccessibleSelection,
      76             :                 ::com::sun::star::lang::XServiceInfo,
      77             :                 ::com::sun::star::lang::XServiceName >
      78             :                 SvxGraphCtrlAccessibleContext_Base;
      79             : 
      80             : class SvxGraphCtrlAccessibleContext : public SvxGraphCtrlAccessibleContext_Base, ::comphelper::OBaseMutex, SfxListener, ::accessibility::IAccessibleViewForwarder
      81             : {
      82             : public:
      83             :     friend class GraphCtrl;
      84             : 
      85             :     // internal
      86             :     SvxGraphCtrlAccessibleContext(
      87             :         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent,
      88             :         GraphCtrl&              rRepresentation,
      89             :         const OUString*  pName = NULL,
      90             :         const OUString*  pDescription = NULL );
      91             : 
      92             :     void Notify( SfxBroadcaster& aBC, const SfxHint& aHint ) SAL_OVERRIDE;
      93             : 
      94             : protected:
      95             :     virtual ~SvxGraphCtrlAccessibleContext();
      96             : public:
      97             :     // XAccessible
      98             :     /// Return the XAccessibleContext.
      99             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
     100             :         getAccessibleContext (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     101             : 
     102             :     // XAccessibleComponent
     103             :     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& rPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     104             :     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;
     105             :     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     106             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocation() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     107             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     108             :     virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     109             :     virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
     110             :     virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
     111             :     virtual void SAL_CALL grabFocus() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     112             :     virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() throw (::com::sun::star::uno::RuntimeException);
     113             : 
     114             :     virtual sal_Int32 SAL_CALL getForeground (void)
     115             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     116             : 
     117             :     virtual sal_Int32 SAL_CALL getBackground (void)
     118             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119             : 
     120             :     // XAccessibleContext
     121             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     122             :     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;
     123             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL getAccessibleParent (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     124             :     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     125             :     virtual sal_Int16 SAL_CALL getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     126             :     virtual OUString SAL_CALL getAccessibleDescription (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     127             :     virtual OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     128             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL getAccessibleRelationSet (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     129             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL getAccessibleStateSet (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     130             :     virtual ::com::sun::star::lang::Locale SAL_CALL getLocale (void) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::accessibility::IllegalAccessibleComponentStateException, std::exception) SAL_OVERRIDE;
     131             : //  virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) {}
     132             : //  virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) {}
     133             : 
     134             :     // XAccessibleEventBroadcaster
     135             :     virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     136             :     virtual void SAL_CALL removeAccessibleEventListener(  const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     137             : 
     138             :     // XServiceInfo
     139             :     virtual OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     140             :     virtual sal_Bool SAL_CALL supportsService (const OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     141             :     virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     142             : 
     143             :     // XTypeProvider
     144             :     virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     145             : 
     146             :     // XServiceName
     147             :     virtual OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     148             : 
     149             :     // XAccessibleSelection
     150             :     virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     151             :     virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     152             :     virtual void SAL_CALL clearAccessibleSelection() throw (::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     153             :     virtual void SAL_CALL selectAllAccessibleChildren() throw (::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     154             :     virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     155             :     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;
     156             :     virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     157             : 
     158             :     // IAccessibleViewforwarder
     159             :     virtual bool IsValid (void) const SAL_OVERRIDE;
     160             :     virtual Rectangle GetVisibleArea() const SAL_OVERRIDE;
     161             :     virtual Point LogicToPixel (const Point& rPoint) const SAL_OVERRIDE;
     162             :     virtual Size LogicToPixel (const Size& rSize) const SAL_OVERRIDE;
     163             :     virtual Point PixelToLogic (const Point& rPoint) const SAL_OVERRIDE;
     164             :     virtual Size PixelToLogic (const Size& rSize) const SAL_OVERRIDE;
     165             : 
     166             : protected:
     167             :     void checkChildIndexOnSelection( long nIndexOfChild ) throw (::com::sun::star::lang::IndexOutOfBoundsException );
     168             : 
     169             : public:
     170             : 
     171             :     /** This method is used by the graph control to tell the
     172             :         accessibility object about a new model and view.
     173             :     */
     174             :     void setModelAndView (SdrModel* pModel, SdrView* pView);
     175             : 
     176             : protected:
     177             : 
     178             :     /** Return the object's current bounding box relative to the desktop,
     179             :         i.e in absolute pixel coordinates.
     180             :         @return
     181             :             The returned rectangle is a bounding box of the object given in
     182             :             absolute screen coordinates.
     183             :         @raise DisposedException
     184             :             When the object is already disposed then a
     185             :             <type>DisposedException</type> is thrown.
     186             :     */
     187             :      virtual Rectangle GetBoundingBoxOnScreen(void) throw (::com::sun::star::uno::RuntimeException);
     188             : 
     189             :     /// Return the object's current bounding box relative to the parent object.
     190             :     virtual Rectangle GetBoundingBox(void) throw (::com::sun::star::uno::RuntimeException);
     191             : 
     192             :     virtual void SAL_CALL disposing() SAL_OVERRIDE;
     193             : 
     194             : private:
     195             :     SdrObject* getSdrObject( sal_Int32 nIndex )
     196             :         throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException );
     197             : 
     198             :     void CommitChange (sal_Int16 aEventId, const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue);
     199             :     void FireEvent (const ::com::sun::star::accessibility::AccessibleEventObject& aEvent);
     200             : 
     201             :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessible( const SdrObject* pObj );
     202             : 
     203             :     accessibility::AccessibleShapeTreeInfo maTreeInfo;
     204             : 
     205             :     /// Reference to the parent object.
     206             :     ::com::sun::star::uno::Reference<
     207             :          ::com::sun::star::accessibility::XAccessible> mxParent;
     208             : 
     209             :     /** Description of this object.  This is not a constant because it can
     210             :         be set from the outside.
     211             :     */
     212             :     OUString msDescription;
     213             : 
     214             :     /** Name of this object.
     215             :     */
     216             :     OUString msName;
     217             : 
     218             :     /// map of accessible shapes
     219             :     struct SdrObjectCompareLess
     220             :     {
     221           0 :         bool operator()(const SdrObject* p1, const SdrObject* p2) const
     222             :         {
     223           0 :             return p1 < p2;
     224             :         }
     225             :     };
     226             :     typedef ::std::map< const SdrObject*, ::accessibility::AccessibleShape*, SdrObjectCompareLess > ShapesMapType;
     227             :     ShapesMapType mxShapes;
     228             : 
     229             :     GraphCtrl*  mpControl;
     230             : 
     231             :     SdrModel* mpModel;
     232             :     SdrPage* mpPage;
     233             :     SdrView* mpView;
     234             : 
     235             :     /// client id in the AccessibleEventNotifier queue
     236             :     sal_uInt32 mnClientId;
     237             : 
     238             :     bool mbDisposed;
     239             : };
     240             : 
     241             : #endif
     242             : 
     243             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10