From b750d8a8c7de083a2822dedf4d91e2ac77088cec Mon Sep 17 00:00:00 2001 From: Thomas Benisch Date: Mon, 26 Aug 2002 12:30:03 +0000 Subject: [PATCH] #100534# XServiceInfo --- .../toolkit/awt/vclxaccessiblecomponent.hxx | 24 ++++++++++-- .../source/awt/vclxaccessiblecomponent.cxx | 39 +++++++++++++++---- 2 files changed, 52 insertions(+), 11 deletions(-) diff --git a/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx b/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx index 2cde21161a4f..4f7684fca8ce 100644 --- a/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx +++ b/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx @@ -2,9 +2,9 @@ * * $RCSfile: vclxaccessiblecomponent.hxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: ssa $ $Date: 2002-06-03 15:54:17 $ + * last change: $Author: tbe $ $Date: 2002-08-26 13:27:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,10 +77,16 @@ #ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_ #include #endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include +#endif #ifndef _CPPUHELPER_COMPBASE3_HXX_ #include #endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include +#endif #ifndef COMPHELPER_ACCIMPLACCESS_HXX #include #endif @@ -100,16 +106,21 @@ namespace utl { class AccessibleStateSetHelper; } -typedef ::comphelper::OAccessibleExtendedComponentHelper VCLXAccessibleComponentBase; // ---------------------------------------------------- // class VCLXAccessibleComponent // ---------------------------------------------------- +typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE; + +typedef ::cppu::ImplHelper1< + ::com::sun::star::lang::XServiceInfo > VCLXAccessibleComponent_BASE; + class VCLExternalSolarLock; class VCLXAccessibleComponent - :public VCLXAccessibleComponentBase + :public AccessibleExtendedComponentHelper_BASE ,public ::comphelper::OAccessibleImplementationAccess + ,public VCLXAccessibleComponent_BASE { private: ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> mxWindow; @@ -144,6 +155,11 @@ public: // ::com::sun::star::lang::XTypeProvider DECLARE_XTYPEPROVIDER() + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + // ::drafts::com::sun::star::accessibility::XAccessibleContext sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index 4ae32a41094b..a66b5cec3966 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -2,9 +2,9 @@ * * $RCSfile: vclxaccessiblecomponent.cxx,v $ * - * $Revision: 1.30 $ + * $Revision: 1.31 $ * - * last change: $Author: pb $ $Date: 2002-08-23 10:31:52 $ + * last change: $Author: tbe $ $Date: 2002-08-26 13:30:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -138,7 +138,7 @@ DBG_NAME(VCLXAccessibleComponent); // class VCLXAccessibleComponent // ---------------------------------------------------- VCLXAccessibleComponent::VCLXAccessibleComponent( VCLXWindow* pVCLXindow ) - : VCLXAccessibleComponentBase( new VCLExternalSolarLock() ) + : AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() ) , OAccessibleImplementationAccess( ) { DBG_CTOR( VCLXAccessibleComponent, 0 ); @@ -180,8 +180,33 @@ VCLXAccessibleComponent::~VCLXAccessibleComponent() // @see OAccessibleContextHelper::OAccessibleContextHelper( IMutex* ) } -IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleComponent, VCLXAccessibleComponentBase, OAccessibleImplementationAccess ) -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleComponent, VCLXAccessibleComponentBase, OAccessibleImplementationAccess ) +IMPLEMENT_FORWARD_XINTERFACE3( VCLXAccessibleComponent, AccessibleExtendedComponentHelper_BASE, OAccessibleImplementationAccess, VCLXAccessibleComponent_BASE ) +IMPLEMENT_FORWARD_XTYPEPROVIDER3( VCLXAccessibleComponent, AccessibleExtendedComponentHelper_BASE, OAccessibleImplementationAccess, VCLXAccessibleComponent_BASE ) + +::rtl::OUString VCLXAccessibleComponent::getImplementationName() throw (uno::RuntimeException) +{ + return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleExtendedComponent" ); +} + +sal_Bool VCLXAccessibleComponent::supportsService( const ::rtl::OUString& rServiceName ) throw (uno::RuntimeException) +{ + uno::Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); + const ::rtl::OUString* pNames = aNames.getConstArray(); + const ::rtl::OUString* pEnd = pNames + aNames.getLength(); + for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) + ; + + return pNames != pEnd; +} + +uno::Sequence< ::rtl::OUString > VCLXAccessibleComponent::getSupportedServiceNames() throw (uno::RuntimeException) +{ + uno::Sequence< ::rtl::OUString > aNames(3); + aNames[0] = ::rtl::OUString::createFromAscii( "drafts.com.sun.star.accessibility.AccessibleContext" ); + aNames[1] = ::rtl::OUString::createFromAscii( "drafts.com.sun.star.accessibility.AccessibleComponent" ); + aNames[2] = ::rtl::OUString::createFromAscii( "drafts.com.sun.star.accessibility.AccessibleExtendedComponent" ); + return aNames; +} IMPL_LINK( VCLXAccessibleComponent, WindowEventListener, VclSimpleEvent*, pEvent ) { @@ -400,7 +425,7 @@ void VCLXAccessibleComponent::disposing() mpVCLXindow->GetWindow()->RemoveChildEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) ); } - VCLXAccessibleComponentBase::disposing(); + AccessibleExtendedComponentHelper_BASE::disposing(); mxWindow.clear(); mpVCLXindow = NULL; @@ -536,7 +561,7 @@ sal_Int32 VCLXAccessibleComponent::getAccessibleIndexInParent( ) throw (uno::Ru if ( xAcc.is() ) { // we _do_ have a foreign-controlled parent -> use the base class' implementation, // which goes the UNO way - nIndex = VCLXAccessibleComponentBase::getAccessibleIndexInParent( ); + nIndex = AccessibleExtendedComponentHelper_BASE::getAccessibleIndexInParent( ); } else {