LCOV - code coverage report
Current view: top level - svx/source/inc - svxpixelctlaccessiblecontext.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 7 0.0 %
Date: 2015-06-13 12:38:46 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             : #ifndef INCLUDED_SVX_SOURCE_INC_SVXPIXELCTLACCESSIBLECONTEXT_HXX
      20             : #define INCLUDED_SVX_SOURCE_INC_SVXPIXELCTLACCESSIBLECONTEXT_HXX
      21             : 
      22             : #include <com/sun/star/accessibility/XAccessible.hpp>
      23             : #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
      24             : #include <com/sun/star/accessibility/XAccessibleContext.hpp>
      25             : #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
      26             : #include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
      27             : #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
      28             : #include <com/sun/star/accessibility/XAccessibleValue.hpp>
      29             : 
      30             : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
      31             : #include <com/sun/star/uno/Reference.hxx>
      32             : #include <cppuhelper/weak.hxx>
      33             : #include <com/sun/star/lang/XServiceInfo.hpp>
      34             : #include <com/sun/star/lang/XTypeProvider.hpp>
      35             : #include <com/sun/star/lang/XServiceName.hpp>
      36             : #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
      37             : #include <com/sun/star/lang/DisposedException.hpp>
      38             : #include <cppuhelper/interfacecontainer.h>
      39             : #include <cppuhelper/compbase6.hxx>
      40             : #include <cppuhelper/compbase7.hxx>
      41             : #include <cppuhelper/compbase5.hxx>
      42             : #include <comphelper/broadcasthelper.hxx>
      43             : #include <cppuhelper/implbase6.hxx>
      44             : #include <comphelper/servicehelper.hxx>
      45             : 
      46             : #include <svx/rectenum.hxx>
      47             : #include <tools/gen.hxx>
      48             : 
      49             : 
      50             : namespace com { namespace sun { namespace star { namespace awt {
      51             :     struct Point;
      52             :     struct Rectangle;
      53             :     struct Size;
      54             :     class XFocusListener;
      55             : } } } };
      56             : class SvxPixelCtl;
      57             : 
      58             : 
      59             : typedef ::cppu::WeakAggComponentImplHelper5<
      60             :             ::com::sun::star::accessibility::XAccessible,
      61             :             ::com::sun::star::accessibility::XAccessibleComponent,
      62             :             ::com::sun::star::accessibility::XAccessibleContext,
      63             :             ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
      64             :             ::com::sun::star::lang::XServiceInfo >
      65             :             SvxPixelCtlAccessibleChild_BASE;
      66             : 
      67             : class SvxPixelCtlAccessibleChild :
      68             :     public ::comphelper::OBaseMutex,
      69             :     public SvxPixelCtlAccessibleChild_BASE
      70             : {
      71             :     SvxPixelCtl& mrParentWindow;
      72             :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent;
      73             :        void IsValid() throw (::com::sun::star::uno::RuntimeException);
      74             :     bool m_bPixelColorOrBG;//Pixel Color Or BackGround Color
      75             :     Point maPoint;
      76             :     Rectangle*  mpBoundingBox;
      77             :     /// index of child in parent
      78             :     long                                mnIndexInParent;
      79             :     /// Mutex guarding this object.
      80             :     ::osl::Mutex                        m_aMutex;
      81             : public:
      82             :     SvxPixelCtlAccessibleChild(
      83             :                 SvxPixelCtl& rWindow,
      84             :                 bool bPixelColorOrBG,
      85             :                 const Point& aPoint,
      86             :                 const Rectangle& rBounds,
      87             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xParent,
      88             :                 long nIndexInParent );
      89             :     virtual ~SvxPixelCtlAccessibleChild();
      90             : 
      91             :     //XAccessible
      92             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) 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::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     103             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) 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             : 
     107             :     //XAccessibleComponent
     108             :     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     109             :     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;
     110             :     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     111             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     112             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     113             :     virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     114             :     virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     115             :     virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     116             :     virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     117             : 
     118             :     //XServiceInfo
     119             :     virtual OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     120             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     121             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     122             : 
     123             :     //Methods for XAccessibleEventBroadcaster
     124             :     sal_uInt32 mnClientId;
     125             : 
     126             :     virtual void SAL_CALL
     127             :         addAccessibleEventListener(
     128             :             const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
     129             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     130             : 
     131             :     virtual void SAL_CALL
     132             :         removeAccessibleEventListener(
     133             :             const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
     134             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     135             :     void CommitChange( const com::sun::star::accessibility::AccessibleEventObject& rEvent );
     136             : 
     137             :     //Solution: Add the event handling method
     138             :     void FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew);
     139             :     virtual void SAL_CALL disposing() SAL_OVERRIDE;
     140             : 
     141             :     Rectangle GetBoundingBoxOnScreen() throw( ::com::sun::star::uno::RuntimeException );
     142             : 
     143             :     Rectangle GetBoundingBox() throw( ::com::sun::star::uno::RuntimeException );
     144             : 
     145             :     /// @returns true if it's disposed or in disposing
     146             :     inline bool IsAlive() const;
     147             :     /// @returns true if it's not disposed and no in disposing
     148             :     inline bool IsNotAlive() const;
     149             :     /// throws the exception DisposedException if it's not alive
     150             :     void ThrowExceptionIfNotAlive() throw( ::com::sun::star::lang::DisposedException );
     151             : 
     152             : 
     153             :     void CheckChild();
     154             :     void SelectChild( bool bSelect);
     155           0 :     void ChangePixelColorOrBG(bool bPixelColorOrBG){ m_bPixelColorOrBG = bPixelColorOrBG ;}
     156             :     OUString GetName();
     157             : };
     158             : 
     159             : 
     160             : typedef ::cppu::WeakAggComponentImplHelper6<
     161             :             ::com::sun::star::accessibility::XAccessible,
     162             :             ::com::sun::star::accessibility::XAccessibleComponent,
     163             :             ::com::sun::star::accessibility::XAccessibleContext,
     164             :             ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
     165             :             ::com::sun::star::accessibility::XAccessibleSelection,
     166             : //          ::com::sun::star::accessibility::XAccessibleTable,
     167             :             ::com::sun::star::lang::XServiceInfo >
     168             :             SvxPixelCtlAccessible_BASE;
     169             : 
     170             : class SvxPixelCtlAccessible :
     171             :     public ::comphelper::OBaseMutex,
     172             :     public SvxPixelCtlAccessible_BASE
     173             : {
     174             :     SvxPixelCtl& mrPixelCtl;
     175             : 
     176             : public:
     177             :     SvxPixelCtlAccessible(SvxPixelCtl& rWindow);
     178             :     virtual ~SvxPixelCtlAccessible();
     179             : 
     180             :     void ensureIsAlive() const throw ( ::com::sun::star::lang::DisposedException );
     181             : 
     182             :     //XAccessible
     183             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     184             : 
     185             :     //XAccessibleContext
     186             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     187             :     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;
     188             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     189             :     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     190             :     virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     191             :     virtual OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     192             :     virtual OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     193             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     194             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     195             :     virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     196             : 
     197             : 
     198             :     //XAccessibleComponent
     199             :     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     200             :     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;
     201             :     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     202             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     203             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     204             :     virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     205             :     virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     206             :     virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     207             :     virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     208             :     //XServiceInfo
     209             :     virtual OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     210             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     211             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     212             :     // XAccessibleSelection
     213             :     void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     214             :     sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     215             :     void SAL_CALL clearAccessibleSelection(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     216             :     void SAL_CALL selectAllAccessibleChildren(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     217             :     sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     218             :     ::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;
     219             :     void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     220             : 
     221             :     //Methods for XAccessibleEventBroadcaster
     222             :     sal_uInt32 mnClientId;
     223             : 
     224             :     virtual void SAL_CALL
     225             :         addAccessibleEventListener(
     226             :             const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
     227             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     228             : 
     229             :     virtual void SAL_CALL
     230             :         removeAccessibleEventListener(
     231             :             const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
     232             :             throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     233             :     void CommitChange( const com::sun::star::accessibility::AccessibleEventObject& rEvent );
     234             :     //Solution: Add the event handling method
     235             :     void FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew);
     236             :     virtual void SAL_CALL disposing() SAL_OVERRIDE;
     237             : 
     238             :     /// select child
     239             :     void SelectChild( Point pos );
     240             :     void SelectChild( long nIndex);
     241             :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
     242             :          CreateChild (long nIndex, Point mPoint);
     243             : 
     244             : 
     245             :     void LoseFocus();
     246             : 
     247             :     /// @returns true if it's disposed or in disposing
     248             :     inline bool IsAlive() const;
     249             :     /// @returns true if it's not disposed and no in disposing
     250             :     inline bool IsNotAlive() const;
     251             : 
     252             : protected:
     253             :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> m_xCurChild;
     254             : public:
     255             :     void NotifyChild(long nIndex, bool bSelect, bool bCheck);
     256             : };
     257             : 
     258           0 : inline bool SvxPixelCtlAccessible::IsAlive() const
     259             : {
     260           0 :     return !rBHelper.bDisposed && !rBHelper.bInDispose;
     261             : }
     262             : 
     263             : inline bool SvxPixelCtlAccessible::IsNotAlive() const
     264             : {
     265             :     return rBHelper.bDisposed || rBHelper.bInDispose;
     266             : }
     267             : 
     268           0 : inline bool SvxPixelCtlAccessibleChild::IsAlive() const
     269             : {
     270           0 :     return !rBHelper.bDisposed && !rBHelper.bInDispose;
     271             : }
     272             : 
     273           0 : inline bool SvxPixelCtlAccessibleChild::IsNotAlive() const
     274             : {
     275           0 :     return rBHelper.bDisposed || rBHelper.bInDispose;
     276             : }
     277             : 
     278             : 
     279             : #endif
     280             : 
     281             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11