LCOV - code coverage report
Current view: top level - svx/source/inc - svxpixelctlaccessiblecontext.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 7 0.0 %
Date: 2014-04-11 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * This file is part of the LibreOffice project.
       3             :  *
       4             :  * This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       6             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       7             :  *
       8             :  * This file incorporates work covered by the following license notice:
       9             :  *
      10             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      11             :  *   contributor license agreements. See the NOTICE file distributed
      12             :  *   with this work for additional information regarding copyright
      13             :  *   ownership. The ASF licenses this file to you under the Apache
      14             :  *   License, Version 2.0 (the "License"); you may not use this file
      15             :  *   except in compliance with the License. You may obtain a copy of
      16             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      17             :  */
      18             : #ifndef _SVXPIXELACCESSIBLECONTEXT_HXX
      19             : #define _SVXPIXELACCESSIBLECONTEXT_HXX
      20             : 
      21             : #include <com/sun/star/accessibility/XAccessible.hpp>
      22             : #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
      23             : #include <com/sun/star/accessibility/XAccessibleContext.hpp>
      24             : #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
      25             : #include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
      26             : #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
      27             : #include <com/sun/star/accessibility/XAccessibleValue.hpp>
      28             : 
      29             : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
      30             : #include <com/sun/star/uno/Reference.hxx>
      31             : #include <cppuhelper/weak.hxx>
      32             : #include <com/sun/star/lang/XServiceInfo.hpp>
      33             : #include <com/sun/star/lang/XTypeProvider.hpp>
      34             : #include <com/sun/star/lang/XServiceName.hpp>
      35             : #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
      36             : #include <com/sun/star/lang/DisposedException.hpp>
      37             : #include <cppuhelper/interfacecontainer.h>
      38             : #include <cppuhelper/compbase6.hxx>
      39             : #include <cppuhelper/compbase7.hxx>
      40             : #include <cppuhelper/compbase5.hxx>
      41             : #include <comphelper/broadcasthelper.hxx>
      42             : #include <cppuhelper/implbase6.hxx>
      43             : #include <comphelper/servicehelper.hxx>
      44             : 
      45             : #include <svx/rectenum.hxx>
      46             : #include <tools/gen.hxx>
      47             : 
      48             : 
      49             : namespace com { namespace sun { namespace star { namespace awt {
      50             :     struct Point;
      51             :     struct Rectangle;
      52             :     struct Size;
      53             :     class XFocusListener;
      54             : } } } };
      55             : class SvxPixelCtl;
      56             : 
      57             : 
      58             : typedef ::cppu::WeakAggComponentImplHelper5<
      59             :             ::com::sun::star::accessibility::XAccessible,
      60             :             ::com::sun::star::accessibility::XAccessibleComponent,
      61             :             ::com::sun::star::accessibility::XAccessibleContext,
      62             :             ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
      63             :             ::com::sun::star::lang::XServiceInfo >
      64             :             SvxPixelCtlAccessibleChild_BASE;
      65             : 
      66             : class SvxPixelCtlAccessibleChild :
      67             :     public ::comphelper::OBaseMutex,
      68             :     public SvxPixelCtlAccessibleChild_BASE
      69             : {
      70             :     SvxPixelCtl& mrParentWindow;
      71             :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent;
      72             :        void IsValid() throw (::com::sun::star::uno::RuntimeException);
      73             :     sal_Bool m_bPixelColorOrBG;//Pixel Color Or BackGround Color
      74             :     Point maPoint;
      75             :     Rectangle*  mpBoundingBox;
      76             :     /// index of child in parent
      77             :     long                                mnIndexInParent;
      78             :     /// Mutex guarding this object.
      79             :     ::osl::Mutex                        m_aMutex;
      80             : public:
      81             :     SvxPixelCtlAccessibleChild(
      82             :                 SvxPixelCtl& rWindow,
      83             :                 sal_Bool bPixelColorOrBG,
      84             :                 const Point& aPoint,
      85             :                 const Rectangle& rBounds,
      86             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xParent,
      87             :                 long nIndexInParent );
      88             :     virtual ~SvxPixelCtlAccessibleChild();
      89             : 
      90             :     //XAccessible
      91             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      92             : 
      93             :     //XAccessibleContext
      94             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      95             :     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;
      96             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      97             :     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      98             :     virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      99             :     virtual OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     100             :     virtual OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     101             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) 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::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     104             : 
     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 sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     114             :     virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     115             :     virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     116             : 
     117             :     //XServiceInfo
     118             :     virtual OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     120             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     121             : 
     122             :     //Methods for XAccessibleEventBroadcaster
     123             :     sal_uInt32 mnClientId;
     124             : 
     125             :     virtual void SAL_CALL
     126             :         addAccessibleEventListener(
     127             :             const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
     128             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     129             : 
     130             :     virtual void SAL_CALL
     131             :         removeAccessibleEventListener(
     132             :             const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
     133             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     134             :     void CommitChange( const com::sun::star::accessibility::AccessibleEventObject& rEvent );
     135             : 
     136             :     //Solution: Add the event handling method
     137             :     void FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew);
     138             :     virtual void SAL_CALL disposing() SAL_OVERRIDE;
     139             : 
     140             :     virtual Rectangle GetBoundingBoxOnScreen( void ) throw( ::com::sun::star::uno::RuntimeException );
     141             : 
     142             :     virtual Rectangle GetBoundingBox( void ) throw( ::com::sun::star::uno::RuntimeException );
     143             : 
     144             :     /// @returns true if it's disposed or in disposing
     145             :     inline sal_Bool IsAlive( void ) const;
     146             :     /// @returns true if it's not disposed and no in disposing
     147             :     inline sal_Bool IsNotAlive( void ) const;
     148             :     /// throws the exception DisposedException if it's not alive
     149             :     void ThrowExceptionIfNotAlive( void ) throw( ::com::sun::star::lang::DisposedException );
     150             : 
     151             : 
     152             :     void CheckChild();
     153             :     void SelectChild( sal_Bool bSelect);
     154           0 :     void ChangePixelColorOrBG(sal_Bool bPixelColorOrBG){ m_bPixelColorOrBG = bPixelColorOrBG ;}
     155             :     OUString GetName();
     156             : };
     157             : 
     158             : 
     159             : typedef ::cppu::WeakAggComponentImplHelper6<
     160             :             ::com::sun::star::accessibility::XAccessible,
     161             :             ::com::sun::star::accessibility::XAccessibleComponent,
     162             :             ::com::sun::star::accessibility::XAccessibleContext,
     163             :             ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
     164             :             ::com::sun::star::accessibility::XAccessibleSelection,
     165             : //          ::com::sun::star::accessibility::XAccessibleTable,
     166             :             ::com::sun::star::lang::XServiceInfo >
     167             :             SvxPixelCtlAccessible_BASE;
     168             : 
     169             : class SvxPixelCtlAccessible :
     170             :     public ::comphelper::OBaseMutex,
     171             :     public SvxPixelCtlAccessible_BASE
     172             : {
     173             :     SvxPixelCtl& mrPixelCtl;
     174             : 
     175             : public:
     176             :     SvxPixelCtlAccessible(SvxPixelCtl& rWindow);
     177             :     virtual ~SvxPixelCtlAccessible();
     178             : 
     179             :     void ensureIsAlive() const throw ( ::com::sun::star::lang::DisposedException );
     180             : 
     181             :     //XAccessible
     182             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     183             : 
     184             :     //XAccessibleContext
     185             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     186             :     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;
     187             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     188             :     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     189             :     virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     190             :     virtual OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     191             :     virtual OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     192             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     193             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     194             :     virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     195             : 
     196             : 
     197             :     //XAccessibleComponent
     198             :     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     199             :     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;
     200             :     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     201             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     202             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     203             :     virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     204             :     virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     205             :     virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     206             :     virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     207             :     //XServiceInfo
     208             :     virtual OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     209             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     210             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     211             :     // XAccessibleSelection
     212             :     void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     213             :     sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     214             :     void SAL_CALL clearAccessibleSelection(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     215             :     void SAL_CALL selectAllAccessibleChildren(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     216             :     sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     217             :     ::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;
     218             :     void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     219             : 
     220             :     //Methods for XAccessibleEventBroadcaster
     221             :     sal_uInt32 mnClientId;
     222             : 
     223             :     virtual void SAL_CALL
     224             :         addAccessibleEventListener(
     225             :             const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
     226             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     227             : 
     228             :     virtual void SAL_CALL
     229             :         removeAccessibleEventListener(
     230             :             const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
     231             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     232             :     void CommitChange( const com::sun::star::accessibility::AccessibleEventObject& rEvent );
     233             :     //Solution: Add the event handling method
     234             :     void FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew);
     235             :     virtual void SAL_CALL disposing() SAL_OVERRIDE;
     236             : 
     237             :     /// select child
     238             :     void SelectChild( Point pos );
     239             :     void SelectChild( long nIndex);
     240             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
     241             :          CreateChild (long nIndex, Point mPoint);
     242             : 
     243             : 
     244             :     void LoseFocus();
     245             : 
     246             :     /// @returns true if it's disposed or in disposing
     247             :     inline sal_Bool IsAlive( void ) const;
     248             :     /// @returns true if it's not disposed and no in disposing
     249             :     inline sal_Bool IsNotAlive( void ) const;
     250             : 
     251             : protected:
     252             :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> m_xCurChild;
     253             : public:
     254             :     void NotifyChild(long nIndex,sal_Bool bSelect ,sal_Bool bCheck);
     255             : };
     256             : 
     257           0 : inline sal_Bool SvxPixelCtlAccessible::IsAlive( void ) const
     258             : {
     259           0 :     return !rBHelper.bDisposed && !rBHelper.bInDispose;
     260             : }
     261             : 
     262             : inline sal_Bool SvxPixelCtlAccessible::IsNotAlive( void ) const
     263             : {
     264             :     return rBHelper.bDisposed || rBHelper.bInDispose;
     265             : }
     266             : 
     267           0 : inline sal_Bool SvxPixelCtlAccessibleChild::IsAlive( void ) const
     268             : {
     269           0 :     return !rBHelper.bDisposed && !rBHelper.bInDispose;
     270             : }
     271             : 
     272           0 : inline sal_Bool SvxPixelCtlAccessibleChild::IsNotAlive( void ) const
     273             : {
     274           0 :     return rBHelper.bDisposed || rBHelper.bInDispose;
     275             : }
     276             : 
     277             : 
     278             : #endif

Generated by: LCOV version 1.10