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 _TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX_
21 : #define _TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX_
22 :
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>
34 :
35 : #include <tools/gen.hxx> // Size
36 : #include <tools/link.hxx> // Size
37 :
38 : class Window;
39 : class VCLXWindow;
40 : class VclSimpleEvent;
41 : class VclWindowEvent;
42 :
43 : namespace utl {
44 : class AccessibleRelationSetHelper;
45 : class AccessibleStateSetHelper;
46 : }
47 :
48 :
49 : // ----------------------------------------------------
50 : // class VCLXAccessibleComponent
51 : // ----------------------------------------------------
52 :
53 : typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE;
54 :
55 : typedef ::cppu::ImplHelper1<
56 : ::com::sun::star::lang::XServiceInfo > VCLXAccessibleComponent_BASE;
57 :
58 : class VCLExternalSolarLock;
59 :
60 : class TOOLKIT_DLLPUBLIC VCLXAccessibleComponent
61 : :public AccessibleExtendedComponentHelper_BASE
62 : ,public ::comphelper::OAccessibleImplementationAccess
63 : ,public VCLXAccessibleComponent_BASE
64 : {
65 : private:
66 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> mxWindow;
67 : VCLXWindow* mpVCLXindow;
68 :
69 : VCLExternalSolarLock* m_pSolarLock;
70 :
71 : protected:
72 : DECL_LINK( WindowEventListener, VclSimpleEvent* );
73 : DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
74 :
75 : virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
76 : virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent );
77 : virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet );
78 : virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
79 :
80 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& rVclWindowEvent );
81 :
82 : public:
83 : VCLXAccessibleComponent( VCLXWindow* pVCLXindow );
84 : ~VCLXAccessibleComponent();
85 :
86 0 : VCLXWindow* GetVCLXWindow() const { return mpVCLXindow; }
87 : Window* GetWindow() const;
88 :
89 : virtual void SAL_CALL disposing();
90 :
91 : // ::com::sun::star::uno::XInterface
92 : DECLARE_XINTERFACE()
93 : // ::com::sun::star::lang::XTypeProvider
94 : DECLARE_XTYPEPROVIDER()
95 :
96 : // XServiceInfo
97 : virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
98 : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
99 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
100 :
101 : // ::com::sun::star::accessibility::XAccessibleContext
102 : sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
103 : ::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);
104 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
105 : sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
106 : sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
107 : ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
108 : ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
109 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
110 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
111 : ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
112 :
113 : // ::com::sun::star::accessibility::XAccessibleComponent
114 : ::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);
115 : ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
116 : void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
117 : virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
118 : virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
119 :
120 : // ::com::sun::star::accessibility::XAccessibleExtendedComponent
121 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException);
122 : virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException);
123 : virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException);
124 :
125 : protected:
126 : // base class overridables
127 : ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
128 :
129 : private:
130 : /** we may be reparented (if external components use OAccessibleImplementationAccess base class),
131 : so this method here returns the parent in the VCL world, in opposite to the parent
132 : an external component gave us
133 : @precond
134 : the caller must ensure thread safety, i.e. our mutex must be locked
135 : */
136 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
137 : getVclParent() const;
138 : };
139 :
140 : /* ----------------------------------------------------------
141 : Accessibility only for the Window hierarchy!
142 : Maybe derived classes must overwrite these Accessibility interfaces:
143 :
144 : // XAccessibleContext:
145 : sal_Int16 getAccessibleRole() => VCL Window::GetAccessibleRole()
146 : OUString getAccessibleDescription() => VCL Window::GetAccessibleDescription
147 : OUString getAccessibleName() => VCL Window::GetAccessibleText() => Most windows return Window::GetText()
148 : Reference< XAccessibleRelationSet > getAccessibleRelationSet()
149 : Reference< XAccessibleStateSet > getAccessibleStateSet() => overload FillAccessibleStateSet( ... )
150 :
151 : ---------------------------------------------------------- */
152 :
153 :
154 : #endif // _TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX_
155 :
156 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|