LCOV - code coverage report
Current view: top level - libreoffice/sfx2/source/control - thumbnailviewacc.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 7 0.0 %
Date: 2012-12-17 Functions: 0 4 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 THUMBNAILVIEWACC_HXX
      21             : #define THUMBNAILVIEWACC_HXX
      22             : 
      23             : #include <osl/mutex.hxx>
      24             : #include <cppuhelper/implbase5.hxx>
      25             : #include <cppuhelper/compbase6.hxx>
      26             : #include <comphelper/broadcasthelper.hxx>
      27             : 
      28             : #include <com/sun/star/lang/XUnoTunnel.hpp>
      29             : #include <com/sun/star/accessibility/XAccessible.hpp>
      30             : #include <com/sun/star/accessibility/XAccessibleContext.hpp>
      31             : #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
      32             : #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
      33             : #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
      34             : #include <com/sun/star/lang/DisposedException.hpp>
      35             : 
      36             : #include <vector>
      37             : 
      38             : class ThumbnailView;
      39             : class ThumbnailViewItem;
      40             : 
      41             : typedef ::cppu::PartialWeakComponentImplHelper6<
      42             :     ::com::sun::star::accessibility::XAccessible,
      43             :     ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
      44             :     ::com::sun::star::accessibility::XAccessibleContext,
      45             :     ::com::sun::star::accessibility::XAccessibleComponent,
      46             :     ::com::sun::star::accessibility::XAccessibleSelection,
      47             :     ::com::sun::star::lang::XUnoTunnel >
      48             :     ValueSetAccComponentBase;
      49             : 
      50             : class ThumbnailViewAcc :
      51             :     public ::comphelper::OBaseMutex,
      52             :     public ValueSetAccComponentBase
      53             : {
      54             : public:
      55             : 
      56             :     ThumbnailViewAcc( ThumbnailView* pParent, bool bIsTransientChildrenDisabled );
      57             :     ~ThumbnailViewAcc();
      58             : 
      59             :     void FireAccessibleEvent( short nEventId,
      60             :                               const ::com::sun::star::uno::Any& rOldValue,
      61             :                               const ::com::sun::star::uno::Any& rNewValue );
      62             : 
      63           0 :     sal_Bool HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); }
      64             : 
      65             :     static ThumbnailViewAcc* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData ) throw();
      66             : 
      67             : public:
      68             : 
      69             :     /** Called by the corresponding ValueSet when it gets the focus.
      70             :         Stores the new focus state and broadcasts a state change event.
      71             :     */
      72             :     void GetFocus (void);
      73             : 
      74             :     /** Called by the corresponding ValueSet when it loses the focus.
      75             :         Stores the new focus state and broadcasts a state change event.
      76             :     */
      77             :     void LoseFocus (void);
      78             : 
      79             :     // XComponent
      80           0 :     virtual void SAL_CALL dispose()throw (::com::sun::star::uno::RuntimeException)
      81           0 :         { WeakComponentImplHelperBase::dispose(); }
      82           0 :     virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
      83           0 :         { WeakComponentImplHelperBase::addEventListener(xListener); }
      84           0 :     virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
      85           0 :         { WeakComponentImplHelperBase::removeEventListener(xListener); }
      86             : 
      87             :     // XAccessible
      88             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
      89             : 
      90             :     // XAccessibleEventBroadcaster
      91             :     virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
      92             :     virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
      93             : 
      94             :     // XAccessibleContext
      95             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
      96             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
      97             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
      98             :     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
      99             :     virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
     100             :     virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
     101             :     virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
     102             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
     103             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
     104             :     virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
     105             : 
     106             :     // XAccessibleComponent
     107             :     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
     108             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
     109             :     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  ) throw (::com::sun::star::uno::RuntimeException);
     110             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  ) throw (::com::sun::star::uno::RuntimeException);
     111             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  ) throw (::com::sun::star::uno::RuntimeException);
     112             :     virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) 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             :     virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
     116             :     virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
     117             : 
     118             :     // XAccessibleSelection
     119             :     virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     120             :     virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     121             :     virtual void SAL_CALL clearAccessibleSelection(  ) throw (::com::sun::star::uno::RuntimeException);
     122             :     virtual void SAL_CALL selectAllAccessibleChildren(  ) throw (::com::sun::star::uno::RuntimeException);
     123             :     virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
     124             :     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);
     125             :     virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     126             : 
     127             :     // XUnoTunnel
     128             :     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
     129             : 
     130             : private:
     131             :     ::std::vector< ::com::sun::star::uno::Reference<
     132             :         ::com::sun::star::accessibility::XAccessibleEventListener > >   mxEventListeners;
     133             :     ThumbnailView*                                                           mpParent;
     134             :     bool                                                                mbIsTransientChildrenDisabled;
     135             :     /// The current FOCUSED state.
     136             :     bool mbIsFocused;
     137             : 
     138             :     static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
     139             : 
     140             :     /** Tell all listeners that the object is dying.  This callback is
     141             :         usually called from the WeakComponentImplHelper class.
     142             :     */
     143             :     virtual void SAL_CALL disposing (void);
     144             : 
     145             :     /** Return the number of items.  This takes the None-Item into account.
     146             :     */
     147             :     sal_uInt16 getItemCount (void) const;
     148             : 
     149             :     /** Return the item associated with the given index.  The None-Item is
     150             :         taken into account which, when present, is taken to be the first
     151             :         (with index 0) item.
     152             :         @param nIndex
     153             :             Index of the item to return.  The index 0 denotes the None-Item
     154             :             when present.
     155             :         @return
     156             :             Returns NULL when the given index is out of range.
     157             :     */
     158             :     ThumbnailViewItem* getItem (sal_uInt16 nIndex) const;
     159             : 
     160             :     /** Check whether or not the object has been disposed (or is in the
     161             :         state of beeing disposed).  If that is the case then
     162             :         DisposedException is thrown to inform the (indirect) caller of the
     163             :         foul deed.
     164             :     */
     165             :     void ThrowIfDisposed (void)
     166             :         throw (::com::sun::star::lang::DisposedException);
     167             : };
     168             : 
     169             : class ThumbnailViewItemAcc : public ::cppu::WeakImplHelper5< ::com::sun::star::accessibility::XAccessible,
     170             :                                                      ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
     171             :                                                      ::com::sun::star::accessibility::XAccessibleContext,
     172             :                                                      ::com::sun::star::accessibility::XAccessibleComponent,
     173             :                                                      ::com::sun::star::lang::XUnoTunnel >
     174             : {
     175             : private:
     176             : 
     177             :     ::std::vector< ::com::sun::star::uno::Reference<
     178             :         ::com::sun::star::accessibility::XAccessibleEventListener > >   mxEventListeners;
     179             :     ::osl::Mutex                                                        maMutex;
     180             :     ThumbnailViewItem*                                                       mpParent;
     181             :     bool                                                                mbIsTransientChildrenDisabled;
     182             : 
     183             :     static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
     184             : 
     185             : public:
     186             : 
     187             :     ThumbnailViewItemAcc( ThumbnailViewItem* pParent, bool bIsTransientChildrenDisabled );
     188             :     ~ThumbnailViewItemAcc();
     189             : 
     190             :     void    ParentDestroyed();
     191             : 
     192             :     void    FireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue );
     193             :     sal_Bool    HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); }
     194             : 
     195             : public:
     196             : 
     197             :     // XAccessible
     198             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
     199             : 
     200             :     // XAccessibleEventBroadcaster
     201             :     virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
     202             :     virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
     203             : 
     204             :     // XAccessibleContext
     205             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
     206             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     207             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
     208             :     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
     209             :     virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
     210             :     virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
     211             :     virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
     212             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
     213             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
     214             :     virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
     215             : 
     216             :     // XAccessibleComponent
     217             :     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
     218             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
     219             :     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  ) throw (::com::sun::star::uno::RuntimeException);
     220             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  ) throw (::com::sun::star::uno::RuntimeException);
     221             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  ) throw (::com::sun::star::uno::RuntimeException);
     222             :     virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException);
     223             :     virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
     224             :     virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding(  ) throw (::com::sun::star::uno::RuntimeException);
     225             :     virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
     226             :     virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
     227             : 
     228             :     // XUnoTunnel
     229             :     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
     230             : };
     231             : 
     232             : #endif // THUMBNAILVIEWACC_HXX
     233             : 
     234             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10