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 INCLUDED_SW_SOURCE_CORE_ACCESS_ACCDOC_HXX
21 : #define INCLUDED_SW_SOURCE_CORE_ACCESS_ACCDOC_HXX
22 :
23 : #include "acccontext.hxx"
24 : #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
25 : #include <com/sun/star/document/XEventListener.hpp>
26 : #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
27 : #include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>
28 : #include <accselectionhelper.hxx>
29 :
30 : class VclSimpleEvent;
31 :
32 : // base class for SwAccessibleDocument (in this same header file) and
33 : // SwAccessiblePreview
34 : class SwAccessibleDocumentBase : public SwAccessibleContext
35 : {
36 : ::com::sun::star::uno::Reference<
37 : ::com::sun::star::accessibility::XAccessible> mxParent;
38 :
39 : vcl::Window* mpChildWin; // protected by solar mutext
40 :
41 : using SwAccessibleFrame::SetVisArea;
42 :
43 : protected:
44 : virtual ~SwAccessibleDocumentBase();
45 :
46 : public:
47 : SwAccessibleDocumentBase( SwAccessibleMap* pInitMap );
48 :
49 : void SetVisArea();
50 :
51 : virtual void AddChild( vcl::Window *pWin, bool bFireEvent = true );
52 : virtual void RemoveChild( vcl::Window *pWin );
53 :
54 : // XAccessibleContext
55 :
56 : // Return the number of currently visible children.
57 : virtual sal_Int32 SAL_CALL getAccessibleChildCount (void)
58 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
59 :
60 : // Return the specified child or NULL if index is invalid.
61 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
62 : getAccessibleChild (sal_Int32 nIndex)
63 : throw (::com::sun::star::uno::RuntimeException,
64 : ::com::sun::star::lang::IndexOutOfBoundsException, std::exception) SAL_OVERRIDE;
65 :
66 : // Return a reference to the parent.
67 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
68 : getAccessibleParent (void)
69 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
70 :
71 : // Return this objects index among the parents children.
72 : virtual sal_Int32 SAL_CALL
73 : getAccessibleIndexInParent (void)
74 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
75 :
76 : // Return this object's description.
77 : virtual OUString SAL_CALL
78 : getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
79 :
80 : virtual OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
81 :
82 : // XAccessibleComponent
83 : virtual sal_Bool SAL_CALL containsPoint(
84 : const ::com::sun::star::awt::Point& aPoint )
85 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 :
87 : virtual ::com::sun::star::uno::Reference<
88 : ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(
89 : const ::com::sun::star::awt::Point& aPoint )
90 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 :
92 : virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds()
93 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 :
95 : virtual ::com::sun::star::awt::Point SAL_CALL getLocation()
96 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 :
98 : virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen()
99 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
100 :
101 : virtual ::com::sun::star::awt::Size SAL_CALL getSize()
102 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 : };
104 :
105 : /**
106 : * access to an accessible Writer document
107 : */
108 : class SwAccessibleDocument : public SwAccessibleDocumentBase,
109 : public com::sun::star::accessibility::XAccessibleSelection,
110 : public com::sun::star::document::XEventListener,
111 : public com::sun::star::accessibility::XAccessibleExtendedAttributes,
112 : public com::sun::star::accessibility::XAccessibleGetAccFlowTo
113 : {
114 : // Implementation for XAccessibleSelection interface
115 : SwAccessibleSelectionHelper maSelectionHelper;
116 :
117 : protected:
118 : // Set states for getAccessibleStateSet.
119 : // This derived class additionally sets MULTISELECTABLE(1)
120 : virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet ) SAL_OVERRIDE;
121 :
122 : virtual ~SwAccessibleDocument();
123 :
124 : public:
125 : SwAccessibleDocument( SwAccessibleMap* pInitMap );
126 :
127 : DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
128 : // XEventListener
129 : virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event )
130 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
131 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Event )
132 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
133 :
134 : // XServiceInfo
135 :
136 : // Returns an identifier for the implementation of this object.
137 : virtual OUString SAL_CALL
138 : getImplementationName (void)
139 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
140 :
141 : // Return whether the specified service is supported by this class.
142 : virtual sal_Bool SAL_CALL
143 : supportsService (const OUString& sServiceName)
144 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
145 :
146 : // Returns a list of all supported services. In this case that is just
147 : // the AccessibleContext service.
148 : virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
149 : getSupportedServiceNames (void)
150 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
151 :
152 : // XInterface
153 :
154 : // XInterface is inherited through SwAcessibleContext and
155 : // XAccessibleSelection. These methods are needed to avoid
156 : // ambiguities.
157 :
158 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
159 : const ::com::sun::star::uno::Type& aType )
160 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
161 :
162 2136 : virtual void SAL_CALL acquire( ) throw () SAL_OVERRIDE
163 2136 : { SwAccessibleContext::acquire(); };
164 :
165 2136 : virtual void SAL_CALL release( ) throw () SAL_OVERRIDE
166 2136 : { SwAccessibleContext::release(); };
167 :
168 : // XTypeProvider
169 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
170 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
171 :
172 : // XAccessibleSelection
173 :
174 : virtual void SAL_CALL selectAccessibleChild(
175 : sal_Int32 nChildIndex )
176 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
177 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
178 :
179 : virtual sal_Bool SAL_CALL isAccessibleChildSelected(
180 : sal_Int32 nChildIndex )
181 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
182 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
183 : virtual void SAL_CALL clearAccessibleSelection( )
184 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
185 : virtual void SAL_CALL selectAllAccessibleChildren( )
186 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
187 : virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( )
188 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
189 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
190 : sal_Int32 nSelectedChildIndex )
191 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
192 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
193 :
194 : // index has to be treated as global child index.
195 : virtual void SAL_CALL deselectAccessibleChild(
196 : sal_Int32 nChildIndex )
197 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
198 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
199 :
200 : virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes()
201 : throw (::com::sun::star::lang::IndexOutOfBoundsException,
202 : ::com::sun::star::uno::RuntimeException,
203 : std::exception) SAL_OVERRIDE;
204 :
205 : // thread safe C++ interface
206 :
207 : // The object is not visible an longer and should be destroyed
208 : virtual void Dispose( bool bRecursive = false ) SAL_OVERRIDE;
209 :
210 : // XAccessibleComponent
211 : sal_Int32 SAL_CALL getBackground()
212 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
213 :
214 : // XAccessibleGetAccFlowTo
215 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
216 : SAL_CALL getAccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
217 : throw (::com::sun::star::uno::RuntimeException,
218 : std::exception) SAL_OVERRIDE;
219 : };
220 :
221 : #endif
222 :
223 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|