LCOV - code coverage report
Current view: top level - svx/source/inc - GraphCtlAccessibleContext.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 2 0.0 %
Date: 2012-08-25 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #ifndef _SVXGRAPHACCESSIBLECONTEXT_HXX
      31                 :            : #define _SVXGRAPHACCESSIBLECONTEXT_HXX
      32                 :            : 
      33                 :            : #include <cppuhelper/compbase7.hxx>
      34                 :            : #include <com/sun/star/uno/Reference.hxx>
      35                 :            : #include <com/sun/star/accessibility/XAccessible.hpp>
      36                 :            : #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
      37                 :            : #include <com/sun/star/accessibility/XAccessibleContext.hpp>
      38                 :            : #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
      39                 :            : #include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
      40                 :            : #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
      41                 :            : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
      42                 :            : #include <cppuhelper/weak.hxx>
      43                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      44                 :            : #include <com/sun/star/lang/XTypeProvider.hpp>
      45                 :            : #include <com/sun/star/lang/XServiceName.hpp>
      46                 :            : #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
      47                 :            : #include <osl/mutex.hxx>
      48                 :            : #include <comphelper/broadcasthelper.hxx>
      49                 :            : #include <svl/lstner.hxx>
      50                 :            : 
      51                 :            : #include <set>
      52                 :            : #include <map>
      53                 :            : 
      54                 :            : #include <comphelper/servicehelper.hxx>
      55                 :            : #include <svx/rectenum.hxx>
      56                 :            : #include <svx/AccessibleShapeTreeInfo.hxx>
      57                 :            : #include <svx/IAccessibleViewForwarder.hxx>
      58                 :            : #include <svx/AccessibleShape.hxx>
      59                 :            : 
      60                 :            : namespace com { namespace sun { namespace star { namespace awt {
      61                 :            :     struct Point;
      62                 :            :     struct Rectangle;
      63                 :            :     struct Size;
      64                 :            :     class XFocusListener;
      65                 :            : } } } }
      66                 :            : 
      67                 :            : class Rectangle;
      68                 :            : class GraphCtrl;
      69                 :            : class SdrObject;
      70                 :            : class SdrModel;
      71                 :            : class SdrPage;
      72                 :            : class SdrView;
      73                 :            : 
      74                 :            : /** @descr
      75                 :            :         This base class provides an implementation of the
      76                 :            :         <code>AccessibleContext</code> service.
      77                 :            : */
      78                 :            : 
      79                 :            : typedef ::cppu::WeakAggComponentImplHelper7<
      80                 :            :                 ::com::sun::star::accessibility::XAccessible,
      81                 :            :                 ::com::sun::star::accessibility::XAccessibleComponent,
      82                 :            :                 ::com::sun::star::accessibility::XAccessibleContext,
      83                 :            :                 ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
      84                 :            :                 ::com::sun::star::accessibility::XAccessibleSelection,
      85                 :            :                 ::com::sun::star::lang::XServiceInfo,
      86                 :            :                 ::com::sun::star::lang::XServiceName >
      87                 :            :                 SvxGraphCtrlAccessibleContext_Base;
      88                 :            : 
      89                 :            : class SvxGraphCtrlAccessibleContext : public SvxGraphCtrlAccessibleContext_Base, ::comphelper::OBaseMutex, SfxListener, ::accessibility::IAccessibleViewForwarder
      90                 :            : {
      91                 :            : public:
      92                 :            :     friend class GraphCtrl;
      93                 :            : 
      94                 :            :     //=====  internal  ========================================================
      95                 :            :     SvxGraphCtrlAccessibleContext(
      96                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent,
      97                 :            :         GraphCtrl&              rRepresentation,
      98                 :            :         const ::rtl::OUString*  pName = NULL,
      99                 :            :         const ::rtl::OUString*  pDescription = NULL );
     100                 :            : 
     101                 :            :     void Notify( SfxBroadcaster& aBC, const SfxHint& aHint );
     102                 :            : 
     103                 :            : protected:
     104                 :            :     virtual ~SvxGraphCtrlAccessibleContext();
     105                 :            : public:
     106                 :            :     //=====  XAccessible  =====================================================
     107                 :            : 
     108                 :            :     /// Return the XAccessibleContext.
     109                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
     110                 :            :         getAccessibleContext (void) throw (::com::sun::star::uno::RuntimeException);
     111                 :            : 
     112                 :            :     //=====  XAccessibleComponent  ============================================
     113                 :            : 
     114                 :            :     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& rPoint ) throw (::com::sun::star::uno::RuntimeException);
     115                 :            :     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);
     116                 :            :     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException);
     117                 :            :     virtual ::com::sun::star::awt::Point SAL_CALL getLocation() throw (::com::sun::star::uno::RuntimeException);
     118                 :            :     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException);
     119                 :            :     virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException);
     120                 :            :     virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
     121                 :            :     virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
     122                 :            :     virtual void SAL_CALL grabFocus() throw (::com::sun::star::uno::RuntimeException);
     123                 :            :     virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() throw (::com::sun::star::uno::RuntimeException);
     124                 :            : 
     125                 :            :     virtual sal_Int32 SAL_CALL getForeground (void)
     126                 :            :         throw (::com::sun::star::uno::RuntimeException);
     127                 :            : 
     128                 :            :     virtual sal_Int32 SAL_CALL getBackground (void)
     129                 :            :         throw (::com::sun::star::uno::RuntimeException);
     130                 :            : 
     131                 :            : 
     132                 :            :     //=====  XAccessibleContext  ==============================================
     133                 :            : 
     134                 :            :     virtual sal_Int32 SAL_CALL getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException);
     135                 :            :     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);
     136                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL getAccessibleParent (void) throw (::com::sun::star::uno::RuntimeException);
     137                 :            :     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent (void) throw (::com::sun::star::uno::RuntimeException);
     138                 :            :     virtual sal_Int16 SAL_CALL getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException);
     139                 :            :     virtual ::rtl::OUString SAL_CALL getAccessibleDescription (void) throw (::com::sun::star::uno::RuntimeException);
     140                 :            :     virtual ::rtl::OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException);
     141                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL getAccessibleRelationSet (void) throw (::com::sun::star::uno::RuntimeException);
     142                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL getAccessibleStateSet (void) throw (::com::sun::star::uno::RuntimeException);
     143                 :            :     virtual ::com::sun::star::lang::Locale SAL_CALL getLocale (void) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::accessibility::IllegalAccessibleComponentStateException);
     144                 :            : //  virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) {}
     145                 :            : //  virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) {}
     146                 :            : 
     147                 :            :     //=====  XComponent  ========================================================
     148                 :            : 
     149                 :            :     using ::cppu::WeakAggComponentImplHelperBase::addEventListener;
     150                 :            :     using ::cppu::WeakAggComponentImplHelperBase::removeEventListener;
     151                 :            : 
     152                 :            :     //=====  XAccessibleEventBroadcaster  =====================================
     153                 :            : 
     154                 :            :     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) throw (com::sun::star::uno::RuntimeException);
     155                 :            :     virtual void SAL_CALL removeEventListener(  const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) throw (com::sun::star::uno::RuntimeException);
     156                 :            : 
     157                 :            :     //=====  XServiceInfo  ====================================================
     158                 :            : 
     159                 :            :     virtual ::rtl::OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException);
     160                 :            :     virtual sal_Bool SAL_CALL supportsService (const ::rtl::OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException);
     161                 :            :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException);
     162                 :            : 
     163                 :            :     //=====  XTypeProvider  ===================================================
     164                 :            : 
     165                 :            :     virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId (void) throw (::com::sun::star::uno::RuntimeException);
     166                 :            : 
     167                 :            :     //=====  XServiceName  ====================================================
     168                 :            : 
     169                 :            :     virtual ::rtl::OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException);
     170                 :            : 
     171                 :            :     //=====  XAccessibleSelection =============================================
     172                 :            : 
     173                 :            :     virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
     174                 :            :     virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
     175                 :            :     virtual void SAL_CALL clearAccessibleSelection() throw (::com::sun::star::uno::RuntimeException );
     176                 :            :     virtual void SAL_CALL selectAllAccessibleChildren() throw (::com::sun::star::uno::RuntimeException );
     177                 :            :     virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException );
     178                 :            :     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 );
     179                 :            :     virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
     180                 :            : 
     181                 :            :     //=====  IAccessibleViewforwarder  ========================================
     182                 :            : 
     183                 :            :     virtual sal_Bool IsValid (void) const;
     184                 :            :     virtual Rectangle GetVisibleArea() const;
     185                 :            :     virtual Point LogicToPixel (const Point& rPoint) const;
     186                 :            :     virtual Size LogicToPixel (const Size& rSize) const;
     187                 :            :     virtual Point PixelToLogic (const Point& rPoint) const;
     188                 :            :     virtual Size PixelToLogic (const Size& rSize) const;
     189                 :            : 
     190                 :            : protected:
     191                 :            :     //=====  internals ========================================================
     192                 :            : 
     193                 :            :     void checkChildIndexOnSelection( long nIndexOfChild ) throw (::com::sun::star::lang::IndexOutOfBoundsException );
     194                 :            : 
     195                 :            : public:
     196                 :            : 
     197                 :            :     /** This method is used by the graph control to tell the
     198                 :            :         accessibility object about a new model and view.
     199                 :            :     */
     200                 :            :     void setModelAndView (SdrModel* pModel, SdrView* pView);
     201                 :            : 
     202                 :            : private:
     203                 :            :     static ::com::sun::star::uno::Sequence< sal_Int8 > getUniqueId( void );
     204                 :            : protected:
     205                 :            : 
     206                 :            :     /** Return the object's current bounding box relative to the desktop,
     207                 :            :         i.e in absolute pixel coordinates.
     208                 :            :         @return
     209                 :            :             The returned rectangle is a bounding box of the object given in
     210                 :            :             absolute screen coordinates.
     211                 :            :         @raise DisposedException
     212                 :            :             When the object is already disposed then a
     213                 :            :             <type>DisposedException</type> is thrown.
     214                 :            :     */
     215                 :            :      virtual Rectangle GetBoundingBoxOnScreen(void) throw (::com::sun::star::uno::RuntimeException);
     216                 :            : 
     217                 :            :     /// Return the object's current bounding box relative to the parent object.
     218                 :            :     virtual Rectangle GetBoundingBox(void) throw (::com::sun::star::uno::RuntimeException);
     219                 :            : 
     220                 :            :     virtual void SAL_CALL disposing();
     221                 :            : 
     222                 :            : private:
     223                 :            :     SdrObject* getSdrObject( sal_Int32 nIndex )
     224                 :            :         throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException );
     225                 :            : 
     226                 :            :     void CommitChange (sal_Int16 aEventId, const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue);
     227                 :            :     void FireEvent (const ::com::sun::star::accessibility::AccessibleEventObject& aEvent);
     228                 :            : 
     229                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessible( const SdrObject* pObj );
     230                 :            : 
     231                 :            :     accessibility::AccessibleShapeTreeInfo maTreeInfo;
     232                 :            : 
     233                 :            :     /// Reference to the parent object.
     234                 :            :     ::com::sun::star::uno::Reference<
     235                 :            :          ::com::sun::star::accessibility::XAccessible> mxParent;
     236                 :            : 
     237                 :            :     /** Description of this object.  This is not a constant because it can
     238                 :            :         be set from the outside.
     239                 :            :     */
     240                 :            :     ::rtl::OUString msDescription;
     241                 :            : 
     242                 :            :     /** Name of this object.
     243                 :            :     */
     244                 :            :     ::rtl::OUString msName;
     245                 :            : 
     246                 :            :     /// map of accessible shapes
     247                 :            :     struct SdrObjectCompareLess
     248                 :            :     {
     249                 :          0 :         bool operator()(const SdrObject* p1, const SdrObject* p2) const
     250                 :            :         {
     251                 :          0 :             return p1 < p2;
     252                 :            :         }
     253                 :            :     };
     254                 :            :     typedef ::std::map< const SdrObject*, ::accessibility::AccessibleShape*, SdrObjectCompareLess > ShapesMapType;
     255                 :            :     ShapesMapType mxShapes;
     256                 :            : 
     257                 :            :     GraphCtrl*  mpControl;
     258                 :            : 
     259                 :            :     SdrModel* mpModel;
     260                 :            :     SdrPage* mpPage;
     261                 :            :     SdrView* mpView;
     262                 :            : 
     263                 :            :     /// client id in the AccessibleEventNotifier queue
     264                 :            :     sal_uInt32 mnClientId;
     265                 :            : 
     266                 :            :     sal_Bool mbDisposed;
     267                 :            : };
     268                 :            : 
     269                 :            : #endif
     270                 :            : 
     271                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10