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