1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX_
21 #define _TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX_
23 #include <toolkit/dllapi.h>
24 #include <com/sun/star/accessibility/XAccessible.hpp>
25 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
26 #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
27 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
28 #include <com/sun/star/awt/XWindow.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <cppuhelper/compbase3.hxx>
31 #include <cppuhelper/implbase1.hxx>
32 #include <comphelper/accimplaccess.hxx>
33 #include <comphelper/accessiblecomponenthelper.hxx>
35 #include <tools/link.hxx>
43 class AccessibleRelationSetHelper
;
44 class AccessibleStateSetHelper
;
48 // ----------------------------------------------------
49 // class VCLXAccessibleComponent
50 // ----------------------------------------------------
52 typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE
;
54 typedef ::cppu::ImplHelper1
<
55 ::com::sun::star::lang::XServiceInfo
> VCLXAccessibleComponent_BASE
;
57 class VCLExternalSolarLock
;
59 class TOOLKIT_DLLPUBLIC VCLXAccessibleComponent
60 :public AccessibleExtendedComponentHelper_BASE
61 ,public ::comphelper::OAccessibleImplementationAccess
62 ,public VCLXAccessibleComponent_BASE
65 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> mxWindow
;
66 VCLXWindow
* mpVCLXindow
;
68 VCLExternalSolarLock
* m_pSolarLock
;
71 DECL_LINK( WindowEventListener
, VclSimpleEvent
* );
72 DECL_LINK( WindowChildEventListener
, VclSimpleEvent
* );
74 virtual void ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
);
75 virtual void ProcessWindowChildEvent( const VclWindowEvent
& rVclWindowEvent
);
76 virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper
& rRelationSet
);
77 virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper
& rStateSet
);
79 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> GetChildAccessible( const VclWindowEvent
& rVclWindowEvent
);
82 VCLXAccessibleComponent( VCLXWindow
* pVCLXindow
);
83 ~VCLXAccessibleComponent();
85 VCLXWindow
* GetVCLXWindow() const { return mpVCLXindow
; }
86 Window
* GetWindow() const;
88 virtual void SAL_CALL
disposing();
90 // ::com::sun::star::uno::XInterface
92 // ::com::sun::star::lang::XTypeProvider
93 DECLARE_XTYPEPROVIDER()
96 virtual OUString SAL_CALL
getImplementationName() throw (::com::sun::star::uno::RuntimeException
);
97 virtual sal_Bool SAL_CALL
supportsService( const OUString
& rServiceName
) throw (::com::sun::star::uno::RuntimeException
);
98 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException
);
100 // ::com::sun::star::accessibility::XAccessibleContext
101 sal_Int32 SAL_CALL
getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException
);
102 ::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
);
103 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException
);
104 sal_Int32 SAL_CALL
getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException
);
105 sal_Int16 SAL_CALL
getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException
);
106 OUString SAL_CALL
getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException
);
107 OUString SAL_CALL
getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException
);
108 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleRelationSet
> SAL_CALL
getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException
);
109 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleStateSet
> SAL_CALL
getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException
);
110 ::com::sun::star::lang::Locale SAL_CALL
getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException
, ::com::sun::star::uno::RuntimeException
);
112 // ::com::sun::star::accessibility::XAccessibleComponent
113 ::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
);
114 ::com::sun::star::awt::Point SAL_CALL
getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException
);
115 void SAL_CALL
grabFocus( ) throw (::com::sun::star::uno::RuntimeException
);
116 virtual sal_Int32 SAL_CALL
getForeground( ) throw (::com::sun::star::uno::RuntimeException
);
117 virtual sal_Int32 SAL_CALL
getBackground( ) throw (::com::sun::star::uno::RuntimeException
);
119 // ::com::sun::star::accessibility::XAccessibleExtendedComponent
120 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFont
> SAL_CALL
getFont( ) throw (::com::sun::star::uno::RuntimeException
);
121 virtual OUString SAL_CALL
getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException
);
122 virtual OUString SAL_CALL
getToolTipText( ) throw (::com::sun::star::uno::RuntimeException
);
125 // base class overridables
126 ::com::sun::star::awt::Rectangle SAL_CALL
implGetBounds( ) throw (::com::sun::star::uno::RuntimeException
);
129 /** we may be reparented (if external components use OAccessibleImplementationAccess base class),
130 so this method here returns the parent in the VCL world, in opposite to the parent
131 an external component gave us
133 the caller must ensure thread safety, i.e. our mutex must be locked
135 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>
136 getVclParent() const;
139 /* ----------------------------------------------------------
140 Accessibility only for the Window hierarchy!
141 Maybe derived classes must overwrite these Accessibility interfaces:
143 // XAccessibleContext:
144 sal_Int16 getAccessibleRole() => VCL Window::GetAccessibleRole()
145 OUString getAccessibleDescription() => VCL Window::GetAccessibleDescription
146 OUString getAccessibleName() => VCL Window::GetAccessibleText() => Most windows return Window::GetText()
147 Reference< XAccessibleRelationSet > getAccessibleRelationSet()
148 Reference< XAccessibleStateSet > getAccessibleStateSet() => overload FillAccessibleStateSet( ... )
150 ---------------------------------------------------------- */
153 #endif // _TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX_
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */