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 : VclPtr<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 : void AddChild( vcl::Window *pWin, bool bFireEvent = true );
52 : void RemoveChild( vcl::Window *pWin );
53 :
54 : // XAccessibleContext
55 :
56 : // Return the number of currently visible children.
57 : virtual sal_Int32 SAL_CALL getAccessibleChildCount()
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()
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()
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() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
79 :
80 : virtual OUString SAL_CALL getAccessibleName() 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::accessibility::XAccessibleExtendedAttributes,
111 : public com::sun::star::accessibility::XAccessibleGetAccFlowTo
112 : {
113 : // Implementation for XAccessibleSelection interface
114 : SwAccessibleSelectionHelper maSelectionHelper;
115 :
116 : protected:
117 : // Set states for getAccessibleStateSet.
118 : // This derived class additionally sets MULTISELECTABLE(1)
119 : virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet ) SAL_OVERRIDE;
120 :
121 : virtual ~SwAccessibleDocument();
122 :
123 : public:
124 : SwAccessibleDocument( SwAccessibleMap* pInitMap );
125 :
126 : DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
127 :
128 : // XServiceInfo
129 :
130 : // Returns an identifier for the implementation of this object.
131 : virtual OUString SAL_CALL
132 : getImplementationName()
133 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 :
135 : // Return whether the specified service is supported by this class.
136 : virtual sal_Bool SAL_CALL
137 : supportsService (const OUString& sServiceName)
138 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
139 :
140 : // Returns a list of all supported services. In this case that is just
141 : // the AccessibleContext service.
142 : virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
143 : getSupportedServiceNames()
144 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
145 :
146 : // XInterface
147 :
148 : // XInterface is inherited through SwAcessibleContext and
149 : // XAccessibleSelection. These methods are needed to avoid
150 : // ambiguities.
151 :
152 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
153 : const ::com::sun::star::uno::Type& aType )
154 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
155 :
156 1035 : virtual void SAL_CALL acquire( ) throw () SAL_OVERRIDE
157 1035 : { SwAccessibleContext::acquire(); };
158 :
159 1035 : virtual void SAL_CALL release( ) throw () SAL_OVERRIDE
160 1035 : { SwAccessibleContext::release(); };
161 :
162 : // XTypeProvider
163 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
164 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
165 :
166 : // XAccessibleSelection
167 :
168 : virtual void SAL_CALL selectAccessibleChild(
169 : sal_Int32 nChildIndex )
170 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
171 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
172 :
173 : virtual sal_Bool SAL_CALL isAccessibleChildSelected(
174 : sal_Int32 nChildIndex )
175 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
176 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
177 : virtual void SAL_CALL clearAccessibleSelection( )
178 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
179 : virtual void SAL_CALL selectAllAccessibleChildren( )
180 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
181 : virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( )
182 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
183 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
184 : sal_Int32 nSelectedChildIndex )
185 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
186 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
187 :
188 : // index has to be treated as global child index.
189 : virtual void SAL_CALL deselectAccessibleChild(
190 : sal_Int32 nChildIndex )
191 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
192 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
193 :
194 : virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes()
195 : throw (::com::sun::star::lang::IndexOutOfBoundsException,
196 : ::com::sun::star::uno::RuntimeException,
197 : std::exception) SAL_OVERRIDE;
198 :
199 : // thread safe C++ interface
200 :
201 : // The object is not visible an longer and should be destroyed
202 : virtual void Dispose( bool bRecursive = false ) SAL_OVERRIDE;
203 :
204 : // XAccessibleComponent
205 : sal_Int32 SAL_CALL getBackground()
206 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
207 :
208 : // XAccessibleGetAccFlowTo
209 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
210 : SAL_CALL getAccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
211 : throw (::com::sun::star::uno::RuntimeException,
212 : std::exception) SAL_OVERRIDE;
213 : };
214 :
215 : #endif
216 :
217 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|