LCOV - code coverage report
Current view: top level - libreoffice/svx/source/inc - GraphCtlAccessibleContext.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 2 0.0 %
Date: 2012-12-27 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 _SVXGRAPHACCESSIBLECONTEXT_HXX
      22             : #define _SVXGRAPHACCESSIBLECONTEXT_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 ::rtl::OUString*  pName = NULL,
      90             :         const ::rtl::OUString*  pDescription = NULL );
      91             : 
      92             :     void Notify( SfxBroadcaster& aBC, const SfxHint& aHint );
      93             : 
      94             : protected:
      95             :     virtual ~SvxGraphCtrlAccessibleContext();
      96             : public:
      97             :     //=====  XAccessible  =====================================================
      98             : 
      99             :     /// Return the XAccessibleContext.
     100             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
     101             :         getAccessibleContext (void) throw (::com::sun::star::uno::RuntimeException);
     102             : 
     103             :     //=====  XAccessibleComponent  ============================================
     104             : 
     105             :     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& rPoint ) throw (::com::sun::star::uno::RuntimeException);
     106             :     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);
     107             :     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException);
     108             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocation() throw (::com::sun::star::uno::RuntimeException);
     109             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException);
     110             :     virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException);
     111             :     virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
     112             :     virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
     113             :     virtual void SAL_CALL grabFocus() throw (::com::sun::star::uno::RuntimeException);
     114             :     virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() throw (::com::sun::star::uno::RuntimeException);
     115             : 
     116             :     virtual sal_Int32 SAL_CALL getForeground (void)
     117             :         throw (::com::sun::star::uno::RuntimeException);
     118             : 
     119             :     virtual sal_Int32 SAL_CALL getBackground (void)
     120             :         throw (::com::sun::star::uno::RuntimeException);
     121             : 
     122             : 
     123             :     //=====  XAccessibleContext  ==============================================
     124             : 
     125             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException);
     126             :     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);
     127             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL getAccessibleParent (void) throw (::com::sun::star::uno::RuntimeException);
     128             :     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent (void) throw (::com::sun::star::uno::RuntimeException);
     129             :     virtual sal_Int16 SAL_CALL getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException);
     130             :     virtual ::rtl::OUString SAL_CALL getAccessibleDescription (void) throw (::com::sun::star::uno::RuntimeException);
     131             :     virtual ::rtl::OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException);
     132             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL getAccessibleRelationSet (void) throw (::com::sun::star::uno::RuntimeException);
     133             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL getAccessibleStateSet (void) throw (::com::sun::star::uno::RuntimeException);
     134             :     virtual ::com::sun::star::lang::Locale SAL_CALL getLocale (void) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::accessibility::IllegalAccessibleComponentStateException);
     135             : //  virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) {}
     136             : //  virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) {}
     137             : 
     138             :     //=====  XAccessibleEventBroadcaster  =====================================
     139             : 
     140             :     virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) throw (com::sun::star::uno::RuntimeException);
     141             :     virtual void SAL_CALL removeAccessibleEventListener(  const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) throw (com::sun::star::uno::RuntimeException);
     142             : 
     143             :     //=====  XServiceInfo  ====================================================
     144             : 
     145             :     virtual ::rtl::OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException);
     146             :     virtual sal_Bool SAL_CALL supportsService (const ::rtl::OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException);
     147             :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException);
     148             : 
     149             :     //=====  XTypeProvider  ===================================================
     150             : 
     151             :     virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId (void) throw (::com::sun::star::uno::RuntimeException);
     152             : 
     153             :     //=====  XServiceName  ====================================================
     154             : 
     155             :     virtual ::rtl::OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException);
     156             : 
     157             :     //=====  XAccessibleSelection =============================================
     158             : 
     159             :     virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
     160             :     virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
     161             :     virtual void SAL_CALL clearAccessibleSelection() throw (::com::sun::star::uno::RuntimeException );
     162             :     virtual void SAL_CALL selectAllAccessibleChildren() throw (::com::sun::star::uno::RuntimeException );
     163             :     virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException );
     164             :     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 );
     165             :     virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
     166             : 
     167             :     //=====  IAccessibleViewforwarder  ========================================
     168             : 
     169             :     virtual sal_Bool IsValid (void) const;
     170             :     virtual Rectangle GetVisibleArea() const;
     171             :     virtual Point LogicToPixel (const Point& rPoint) const;
     172             :     virtual Size LogicToPixel (const Size& rSize) const;
     173             :     virtual Point PixelToLogic (const Point& rPoint) const;
     174             :     virtual Size PixelToLogic (const Size& rSize) const;
     175             : 
     176             : protected:
     177             :     //=====  internals ========================================================
     178             : 
     179             :     void checkChildIndexOnSelection( long nIndexOfChild ) throw (::com::sun::star::lang::IndexOutOfBoundsException );
     180             : 
     181             : public:
     182             : 
     183             :     /** This method is used by the graph control to tell the
     184             :         accessibility object about a new model and view.
     185             :     */
     186             :     void setModelAndView (SdrModel* pModel, SdrView* pView);
     187             : 
     188             : private:
     189             :     static ::com::sun::star::uno::Sequence< sal_Int8 > getUniqueId( void );
     190             : protected:
     191             : 
     192             :     /** Return the object's current bounding box relative to the desktop,
     193             :         i.e in absolute pixel coordinates.
     194             :         @return
     195             :             The returned rectangle is a bounding box of the object given in
     196             :             absolute screen coordinates.
     197             :         @raise DisposedException
     198             :             When the object is already disposed then a
     199             :             <type>DisposedException</type> is thrown.
     200             :     */
     201             :      virtual Rectangle GetBoundingBoxOnScreen(void) throw (::com::sun::star::uno::RuntimeException);
     202             : 
     203             :     /// Return the object's current bounding box relative to the parent object.
     204             :     virtual Rectangle GetBoundingBox(void) throw (::com::sun::star::uno::RuntimeException);
     205             : 
     206             :     virtual void SAL_CALL disposing();
     207             : 
     208             : private:
     209             :     SdrObject* getSdrObject( sal_Int32 nIndex )
     210             :         throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException );
     211             : 
     212             :     void CommitChange (sal_Int16 aEventId, const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue);
     213             :     void FireEvent (const ::com::sun::star::accessibility::AccessibleEventObject& aEvent);
     214             : 
     215             :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessible( const SdrObject* pObj );
     216             : 
     217             :     accessibility::AccessibleShapeTreeInfo maTreeInfo;
     218             : 
     219             :     /// Reference to the parent object.
     220             :     ::com::sun::star::uno::Reference<
     221             :          ::com::sun::star::accessibility::XAccessible> mxParent;
     222             : 
     223             :     /** Description of this object.  This is not a constant because it can
     224             :         be set from the outside.
     225             :     */
     226             :     ::rtl::OUString msDescription;
     227             : 
     228             :     /** Name of this object.
     229             :     */
     230             :     ::rtl::OUString msName;
     231             : 
     232             :     /// map of accessible shapes
     233             :     struct SdrObjectCompareLess
     234             :     {
     235           0 :         bool operator()(const SdrObject* p1, const SdrObject* p2) const
     236             :         {
     237           0 :             return p1 < p2;
     238             :         }
     239             :     };
     240             :     typedef ::std::map< const SdrObject*, ::accessibility::AccessibleShape*, SdrObjectCompareLess > ShapesMapType;
     241             :     ShapesMapType mxShapes;
     242             : 
     243             :     GraphCtrl*  mpControl;
     244             : 
     245             :     SdrModel* mpModel;
     246             :     SdrPage* mpPage;
     247             :     SdrView* mpView;
     248             : 
     249             :     /// client id in the AccessibleEventNotifier queue
     250             :     sal_uInt32 mnClientId;
     251             : 
     252             :     sal_Bool mbDisposed;
     253             : };
     254             : 
     255             : #endif
     256             : 
     257             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10