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

Generated by: LCOV version 1.11