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