LCOV - code coverage report
Current view: top level - sfx2/source/control - thumbnailviewacc.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 7 0.0 %
Date: 2014-04-14 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 INCLUDED_SFX2_SOURCE_CONTROL_THUMBNAILVIEWACC_HXX
      21             : #define INCLUDED_SFX2_SOURCE_CONTROL_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             :     virtual ~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 :     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, std::exception) SAL_OVERRIDE
      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, std::exception) SAL_OVERRIDE
      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, std::exception) SAL_OVERRIDE
      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, std::exception) SAL_OVERRIDE;
      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, std::exception) SAL_OVERRIDE;
      92             :     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;
      93             : 
      94             :     // XAccessibleContext
      95             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      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, std::exception) SAL_OVERRIDE;
      97             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      98             :     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      99             :     virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     100             :     virtual OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     101             :     virtual OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     102             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     103             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     104             :     virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     105             : 
     106             :     // XAccessibleComponent
     107             :     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     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, std::exception) SAL_OVERRIDE;
     109             :     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     110             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     111             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     112             :     virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     113             :     virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     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, std::exception) SAL_OVERRIDE;
     116             :     virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     117             : 
     118             :     // XAccessibleSelection
     119             :     virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     120             :     virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     121             :     virtual void SAL_CALL clearAccessibleSelection(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     122             :     virtual void SAL_CALL selectAllAccessibleChildren(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     123             :     virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     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, std::exception) SAL_OVERRIDE;
     125             :     virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     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, std::exception ) SAL_OVERRIDE;
     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) SAL_OVERRIDE;
     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             :     virtual ~ThumbnailViewItemAcc();
     189             : 
     190             :     void FireAccessibleEvent( short nEventId,
     191             :                               const ::com::sun::star::uno::Any& rOldValue,
     192             :                               const ::com::sun::star::uno::Any& rNewValue );
     193             : 
     194             :     void    ParentDestroyed();
     195             : 
     196             :     bool    HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); }
     197             : 
     198             :     static ThumbnailViewItemAcc* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData ) throw();
     199             : 
     200             : public:
     201             : 
     202             :     // XAccessible
     203             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     204             : 
     205             :     // XAccessibleEventBroadcaster
     206             :     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;
     207             :     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;
     208             : 
     209             :     // XAccessibleContext
     210             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     211             :     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, std::exception) SAL_OVERRIDE;
     212             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     213             :     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     214             :     virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     215             :     virtual OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     216             :     virtual OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     217             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     218             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     219             :     virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     220             : 
     221             :     // XAccessibleComponent
     222             :     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     223             :     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, std::exception) SAL_OVERRIDE;
     224             :     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     225             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     226             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     227             :     virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     228             :     virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     229             :     virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding(  ) throw (::com::sun::star::uno::RuntimeException);
     230             :     virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     231             :     virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     232             : 
     233             :     // XUnoTunnel
     234             :     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     235             : };
     236             : 
     237             : #endif // INCLUDED_SFX2_SOURCE_CONTROL_THUMBNAILVIEWACC_HXX
     238             : 
     239             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10