1c142477cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3c142477cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4c142477cSAndrew Rist * or more contributor license agreements. See the NOTICE file
5c142477cSAndrew Rist * distributed with this work for additional information
6c142477cSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7c142477cSAndrew Rist * to you under the Apache License, Version 2.0 (the
8c142477cSAndrew Rist * "License"); you may not use this file except in compliance
9c142477cSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11c142477cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13c142477cSAndrew Rist * Unless required by applicable law or agreed to in writing,
14c142477cSAndrew Rist * software distributed under the License is distributed on an
15c142477cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c142477cSAndrew Rist * KIND, either express or implied. See the License for the
17c142477cSAndrew Rist * specific language governing permissions and limitations
18c142477cSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20c142477cSAndrew Rist *************************************************************/
21c142477cSAndrew Rist
22c142477cSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #include "precompiled_sdext.hxx"
25cdf0e10cSrcweir
26cdf0e10cSrcweir #include "PresenterAccessibility.hxx"
27cdf0e10cSrcweir #include "PresenterTextView.hxx"
28cdf0e10cSrcweir #include "PresenterConfigurationAccess.hxx"
29cdf0e10cSrcweir #include "PresenterNotesView.hxx"
30cdf0e10cSrcweir #include "PresenterPaneBase.hxx"
31cdf0e10cSrcweir #include "PresenterPaneContainer.hxx"
32cdf0e10cSrcweir #include "PresenterPaneFactory.hxx"
33cdf0e10cSrcweir #include "PresenterViewFactory.hxx"
34cdf0e10cSrcweir
35cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
36cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
37cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
38cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
39cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleContext.hpp>
40cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
41cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
42cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleText.hpp>
43cdf0e10cSrcweir #include <com/sun/star/drawing/framework/ResourceId.hpp>
44cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XPane.hpp>
45cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XView.hpp>
46cdf0e10cSrcweir #include <cppuhelper/compbase1.hxx>
47cdf0e10cSrcweir #include <cppuhelper/compbase5.hxx>
48cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
49cdf0e10cSrcweir #include <boost/bind.hpp>
50cdf0e10cSrcweir
51cdf0e10cSrcweir using namespace ::com::sun::star;
52cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
53cdf0e10cSrcweir using namespace ::com::sun::star::uno;
54cdf0e10cSrcweir using namespace ::com::sun::star::drawing::framework;
55cdf0e10cSrcweir using ::rtl::OUString;
56cdf0e10cSrcweir
57cdf0e10cSrcweir #define A2S(s) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)))
58cdf0e10cSrcweir
59cdf0e10cSrcweir #define VERBOSE
60cdf0e10cSrcweir
61cdf0e10cSrcweir //===== PresenterAccessibleObject =============================================
62cdf0e10cSrcweir
63cdf0e10cSrcweir namespace sdext { namespace presenter {
64cdf0e10cSrcweir
65cdf0e10cSrcweir namespace {
66cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper5 <
67cdf0e10cSrcweir cssa::XAccessible,
68cdf0e10cSrcweir cssa::XAccessibleContext,
69cdf0e10cSrcweir cssa::XAccessibleComponent,
70cdf0e10cSrcweir cssa::XAccessibleEventBroadcaster,
71cdf0e10cSrcweir css::awt::XWindowListener
72cdf0e10cSrcweir > PresenterAccessibleObjectInterfaceBase;
73cdf0e10cSrcweir }
74cdf0e10cSrcweir
75cdf0e10cSrcweir class PresenterAccessible::AccessibleObject
76cdf0e10cSrcweir : public ::cppu::BaseMutex,
77cdf0e10cSrcweir public PresenterAccessibleObjectInterfaceBase
78cdf0e10cSrcweir {
79cdf0e10cSrcweir public:
80cdf0e10cSrcweir AccessibleObject (
81cdf0e10cSrcweir const css::lang::Locale aLocale,
82cdf0e10cSrcweir const sal_Int16 nRole,
83cdf0e10cSrcweir const ::rtl::OUString& rsName);
84cdf0e10cSrcweir void LateInitialization (void);
85cdf0e10cSrcweir
86cdf0e10cSrcweir virtual ~AccessibleObject (void);
87cdf0e10cSrcweir
88cdf0e10cSrcweir virtual void SetWindow (
89cdf0e10cSrcweir const cssu::Reference<css::awt::XWindow>& rxContentWindow,
90cdf0e10cSrcweir const cssu::Reference<css::awt::XWindow>& rxBorderWindow);
91cdf0e10cSrcweir void SetAccessibleParent (const cssu::Reference<cssa::XAccessible>& rxAccessibleParent);
92cdf0e10cSrcweir
93cdf0e10cSrcweir virtual void SAL_CALL disposing (void);
94cdf0e10cSrcweir
95cdf0e10cSrcweir void NotifyCurrentSlideChange (const sal_Int32 nCurrentSlideIndex);
96cdf0e10cSrcweir
97cdf0e10cSrcweir void AddChild (const ::rtl::Reference<AccessibleObject>& rpChild);
98cdf0e10cSrcweir void RemoveChild (const ::rtl::Reference<AccessibleObject>& rpChild);
99cdf0e10cSrcweir
100cdf0e10cSrcweir void SetIsFocused (const bool bIsFocused);
101cdf0e10cSrcweir void SetAccessibleName (const ::rtl::OUString& rsName);
102cdf0e10cSrcweir
103cdf0e10cSrcweir void FireAccessibleEvent (
104cdf0e10cSrcweir const sal_Int16 nEventId,
105cdf0e10cSrcweir const cssu::Any& rOldValue,
106cdf0e10cSrcweir const cssu::Any& rNewValue);
107cdf0e10cSrcweir
108cdf0e10cSrcweir void UpdateStateSet (void);
109cdf0e10cSrcweir
110cdf0e10cSrcweir
111cdf0e10cSrcweir //----- XAccessible -------------------------------------------------------
112cdf0e10cSrcweir
113cdf0e10cSrcweir virtual cssu::Reference<cssa::XAccessibleContext> SAL_CALL
114cdf0e10cSrcweir getAccessibleContext (void)
115cdf0e10cSrcweir throw (cssu::RuntimeException);
116cdf0e10cSrcweir
117cdf0e10cSrcweir
118*aa9633e7Smseidel //----- XAccessibleContext ------------------------------------------------
119cdf0e10cSrcweir
120cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getAccessibleChildCount (void)
121cdf0e10cSrcweir throw (cssu::RuntimeException);
122cdf0e10cSrcweir
123cdf0e10cSrcweir virtual cssu::Reference< cssa::XAccessible> SAL_CALL
124cdf0e10cSrcweir getAccessibleChild (sal_Int32 nIndex)
125cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException);
126cdf0e10cSrcweir
127cdf0e10cSrcweir virtual cssu::Reference< cssa::XAccessible> SAL_CALL getAccessibleParent (void)
128cdf0e10cSrcweir throw (cssu::RuntimeException);
129cdf0e10cSrcweir
130cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getAccessibleIndexInParent (void)
131cdf0e10cSrcweir throw (cssu::RuntimeException);
132cdf0e10cSrcweir
133cdf0e10cSrcweir virtual sal_Int16 SAL_CALL getAccessibleRole (void)
134cdf0e10cSrcweir throw (cssu::RuntimeException);
135cdf0e10cSrcweir
136cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getAccessibleDescription (void)
137cdf0e10cSrcweir throw (cssu::RuntimeException);
138cdf0e10cSrcweir
139cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getAccessibleName (void)
140cdf0e10cSrcweir throw (cssu::RuntimeException);
141cdf0e10cSrcweir
142cdf0e10cSrcweir virtual cssu::Reference<cssa::XAccessibleRelationSet> SAL_CALL
143cdf0e10cSrcweir getAccessibleRelationSet (void)
144cdf0e10cSrcweir throw (cssu::RuntimeException);
145cdf0e10cSrcweir
146cdf0e10cSrcweir virtual cssu::Reference<cssa::XAccessibleStateSet> SAL_CALL
147cdf0e10cSrcweir getAccessibleStateSet (void)
148cdf0e10cSrcweir throw (cssu::RuntimeException);
149cdf0e10cSrcweir
150cdf0e10cSrcweir virtual css::lang::Locale SAL_CALL getLocale (void)
151cdf0e10cSrcweir throw (cssu::RuntimeException,
152cdf0e10cSrcweir cssa::IllegalAccessibleComponentStateException);
153cdf0e10cSrcweir
154cdf0e10cSrcweir
155*aa9633e7Smseidel //----- XAccessibleComponent ----------------------------------------------
156cdf0e10cSrcweir
157cdf0e10cSrcweir virtual sal_Bool SAL_CALL containsPoint (
158cdf0e10cSrcweir const css::awt::Point& aPoint)
159cdf0e10cSrcweir throw (cssu::RuntimeException);
160cdf0e10cSrcweir
161cdf0e10cSrcweir virtual cssu::Reference<cssa::XAccessible> SAL_CALL
162cdf0e10cSrcweir getAccessibleAtPoint (
163cdf0e10cSrcweir const css::awt::Point& aPoint)
164cdf0e10cSrcweir throw (cssu::RuntimeException);
165cdf0e10cSrcweir
166cdf0e10cSrcweir virtual css::awt::Rectangle SAL_CALL getBounds (void)
167cdf0e10cSrcweir throw (cssu::RuntimeException);
168cdf0e10cSrcweir
169cdf0e10cSrcweir virtual css::awt::Point SAL_CALL getLocation (void)
170cdf0e10cSrcweir throw (cssu::RuntimeException);
171cdf0e10cSrcweir
172cdf0e10cSrcweir virtual css::awt::Point SAL_CALL getLocationOnScreen (void)
173cdf0e10cSrcweir throw (cssu::RuntimeException);
174cdf0e10cSrcweir
175cdf0e10cSrcweir virtual css::awt::Size SAL_CALL getSize (void)
176cdf0e10cSrcweir throw (cssu::RuntimeException);
177cdf0e10cSrcweir
178cdf0e10cSrcweir virtual void SAL_CALL grabFocus (void)
179cdf0e10cSrcweir throw (cssu::RuntimeException);
180cdf0e10cSrcweir
181cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getForeground (void)
182cdf0e10cSrcweir throw (cssu::RuntimeException);
183cdf0e10cSrcweir
184cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getBackground (void)
185cdf0e10cSrcweir throw (cssu::RuntimeException);
186cdf0e10cSrcweir
187cdf0e10cSrcweir
188*aa9633e7Smseidel //----- XAccessibleEventBroadcaster ---------------------------------------
189cdf0e10cSrcweir
190cdf0e10cSrcweir virtual void SAL_CALL addEventListener (
191cdf0e10cSrcweir const cssu::Reference<cssa::XAccessibleEventListener>& rxListener)
192cdf0e10cSrcweir throw (cssu::RuntimeException);
193cdf0e10cSrcweir
194cdf0e10cSrcweir virtual void SAL_CALL removeEventListener (
195cdf0e10cSrcweir const cssu::Reference<cssa::XAccessibleEventListener>& rxListener)
196cdf0e10cSrcweir throw (cssu::RuntimeException);
197cdf0e10cSrcweir
198cdf0e10cSrcweir using PresenterAccessibleObjectInterfaceBase::addEventListener;
199cdf0e10cSrcweir using PresenterAccessibleObjectInterfaceBase::removeEventListener;
200cdf0e10cSrcweir
201cdf0e10cSrcweir //----- XWindowListener ---------------------------------------------------
202cdf0e10cSrcweir
203cdf0e10cSrcweir virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
204cdf0e10cSrcweir throw (cssu::RuntimeException);
205cdf0e10cSrcweir
206cdf0e10cSrcweir virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
207cdf0e10cSrcweir throw (cssu::RuntimeException);
208cdf0e10cSrcweir
209cdf0e10cSrcweir virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
210cdf0e10cSrcweir throw (cssu::RuntimeException);
211cdf0e10cSrcweir
212cdf0e10cSrcweir virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
213cdf0e10cSrcweir throw (cssu::RuntimeException);
214cdf0e10cSrcweir
215cdf0e10cSrcweir
216cdf0e10cSrcweir //----- XEventListener ----------------------------------------------------
217cdf0e10cSrcweir
218cdf0e10cSrcweir virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
219cdf0e10cSrcweir throw (cssu::RuntimeException);
220cdf0e10cSrcweir
221cdf0e10cSrcweir
222cdf0e10cSrcweir protected:
223cdf0e10cSrcweir ::rtl::OUString msName;
224cdf0e10cSrcweir cssu::Reference<css::awt::XWindow2> mxContentWindow;
225cdf0e10cSrcweir cssu::Reference<css::awt::XWindow2> mxBorderWindow;
226cdf0e10cSrcweir const css::lang::Locale maLocale;
227cdf0e10cSrcweir const sal_Int16 mnRole;
228cdf0e10cSrcweir sal_uInt32 mnStateSet;
229cdf0e10cSrcweir bool mbIsFocused;
230cdf0e10cSrcweir cssu::Reference<cssa::XAccessible> mxParentAccessible;
231cdf0e10cSrcweir ::std::vector<rtl::Reference<AccessibleObject> > maChildren;
232cdf0e10cSrcweir ::std::vector<Reference<XAccessibleEventListener> > maListeners;
233cdf0e10cSrcweir
234cdf0e10cSrcweir virtual awt::Point GetRelativeLocation (void);
235cdf0e10cSrcweir virtual awt::Size GetSize (void);
236cdf0e10cSrcweir virtual awt::Point GetAbsoluteParentLocation (void);
237cdf0e10cSrcweir
238cdf0e10cSrcweir virtual bool GetWindowState (const sal_Int16 nType) const;
239cdf0e10cSrcweir
240cdf0e10cSrcweir void UpdateState (const sal_Int16 aState, const bool bValue);
241cdf0e10cSrcweir
242cdf0e10cSrcweir sal_Bool IsDisposed (void) const;
243cdf0e10cSrcweir
244cdf0e10cSrcweir void ThrowIfDisposed (void) const
245cdf0e10cSrcweir throw (css::lang::DisposedException);
246cdf0e10cSrcweir
247cdf0e10cSrcweir enum ExceptionType { ET_Runtime, ET_Disposed, ET_IndexOutOfBounds };
248cdf0e10cSrcweir void ThrowException (const sal_Char* pMessage, const ExceptionType eExceptionType) const;
249cdf0e10cSrcweir };
250cdf0e10cSrcweir
251cdf0e10cSrcweir
252cdf0e10cSrcweir
253cdf0e10cSrcweir
254cdf0e10cSrcweir //===== AccessibleStateSet ====================================================
255cdf0e10cSrcweir
256cdf0e10cSrcweir namespace {
257cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper1 <
258cdf0e10cSrcweir cssa::XAccessibleStateSet
259cdf0e10cSrcweir > AccessibleStateSetInterfaceBase;
260cdf0e10cSrcweir }
261cdf0e10cSrcweir
262cdf0e10cSrcweir class AccessibleStateSet
263cdf0e10cSrcweir : public ::cppu::BaseMutex,
264cdf0e10cSrcweir public AccessibleStateSetInterfaceBase
265cdf0e10cSrcweir {
266cdf0e10cSrcweir public:
267cdf0e10cSrcweir AccessibleStateSet (const sal_Int32 nStateSet);
268cdf0e10cSrcweir virtual ~AccessibleStateSet (void);
269cdf0e10cSrcweir
270cdf0e10cSrcweir static sal_uInt32 GetStateMask (const sal_Int16 nType);
271cdf0e10cSrcweir
272cdf0e10cSrcweir //----- XAccessibleStateSet -----------------------------------------------
273cdf0e10cSrcweir
274cdf0e10cSrcweir virtual sal_Bool SAL_CALL isEmpty (void)
275cdf0e10cSrcweir throw (cssu::RuntimeException);
276cdf0e10cSrcweir
277cdf0e10cSrcweir virtual sal_Bool SAL_CALL contains (sal_Int16 nState)
278cdf0e10cSrcweir throw (cssu::RuntimeException);
279cdf0e10cSrcweir
280cdf0e10cSrcweir virtual sal_Bool SAL_CALL containsAll (const cssu::Sequence<sal_Int16>& rStateSet)
281cdf0e10cSrcweir throw (cssu::RuntimeException);
282cdf0e10cSrcweir
283cdf0e10cSrcweir virtual cssu::Sequence<sal_Int16> SAL_CALL getStates (void)
284cdf0e10cSrcweir throw (cssu::RuntimeException);
285cdf0e10cSrcweir
286cdf0e10cSrcweir private:
287cdf0e10cSrcweir const sal_Int32 mnStateSet;
288cdf0e10cSrcweir };
289cdf0e10cSrcweir
290cdf0e10cSrcweir
291cdf0e10cSrcweir
292cdf0e10cSrcweir
293cdf0e10cSrcweir //===== AccessibleRelationSet =================================================
294cdf0e10cSrcweir
295cdf0e10cSrcweir namespace {
296cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper1 <
297cdf0e10cSrcweir cssa::XAccessibleRelationSet
298cdf0e10cSrcweir > AccessibleRelationSetInterfaceBase;
299cdf0e10cSrcweir }
300cdf0e10cSrcweir
301cdf0e10cSrcweir class AccessibleRelationSet
302cdf0e10cSrcweir : public ::cppu::BaseMutex,
303cdf0e10cSrcweir public AccessibleRelationSetInterfaceBase
304cdf0e10cSrcweir {
305cdf0e10cSrcweir public:
306cdf0e10cSrcweir AccessibleRelationSet (void);
307cdf0e10cSrcweir virtual ~AccessibleRelationSet (void);
308cdf0e10cSrcweir
309cdf0e10cSrcweir void AddRelation (
310cdf0e10cSrcweir const sal_Int16 nRelationType,
311cdf0e10cSrcweir const Reference<XInterface>& rxObject);
312cdf0e10cSrcweir
313cdf0e10cSrcweir
314cdf0e10cSrcweir //----- XAccessibleRelationSet --------------------------------------------
315cdf0e10cSrcweir
316cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getRelationCount (void)
317cdf0e10cSrcweir throw (cssu::RuntimeException);
318cdf0e10cSrcweir
319cdf0e10cSrcweir virtual AccessibleRelation SAL_CALL getRelation (sal_Int32 nIndex)
320cdf0e10cSrcweir throw (cssu::RuntimeException, css::lang::IndexOutOfBoundsException);
321cdf0e10cSrcweir
322cdf0e10cSrcweir virtual sal_Bool SAL_CALL containsRelation (sal_Int16 nRelationType)
323cdf0e10cSrcweir throw (cssu::RuntimeException);
324cdf0e10cSrcweir
325cdf0e10cSrcweir virtual AccessibleRelation SAL_CALL getRelationByType (sal_Int16 nRelationType)
326cdf0e10cSrcweir throw (cssu::RuntimeException);
327cdf0e10cSrcweir
328cdf0e10cSrcweir private:
329cdf0e10cSrcweir ::std::vector<AccessibleRelation> maRelations;
330cdf0e10cSrcweir };
331cdf0e10cSrcweir
332cdf0e10cSrcweir
333cdf0e10cSrcweir
334cdf0e10cSrcweir
335cdf0e10cSrcweir //===== PresenterAccessibleParagraph ==========================================
336cdf0e10cSrcweir
337cdf0e10cSrcweir namespace {
338cdf0e10cSrcweir typedef ::cppu::ImplInheritanceHelper1 <
339cdf0e10cSrcweir PresenterAccessible::AccessibleObject,
340cdf0e10cSrcweir cssa::XAccessibleText
341cdf0e10cSrcweir > PresenterAccessibleParagraphInterfaceBase;
342cdf0e10cSrcweir }
343cdf0e10cSrcweir
344cdf0e10cSrcweir
345cdf0e10cSrcweir
346cdf0e10cSrcweir
347cdf0e10cSrcweir class PresenterAccessible::AccessibleParagraph
348cdf0e10cSrcweir : public PresenterAccessibleParagraphInterfaceBase
349cdf0e10cSrcweir {
350cdf0e10cSrcweir public:
351cdf0e10cSrcweir AccessibleParagraph (
352cdf0e10cSrcweir const css::lang::Locale aLocale,
353cdf0e10cSrcweir const sal_Int16 nRole,
354cdf0e10cSrcweir const ::rtl::OUString& rsName,
355cdf0e10cSrcweir const SharedPresenterTextParagraph& rpParagraph,
356cdf0e10cSrcweir const sal_Int32 nParagraphIndex);
357cdf0e10cSrcweir
358cdf0e10cSrcweir virtual ~AccessibleParagraph (void);
359cdf0e10cSrcweir
360cdf0e10cSrcweir
361cdf0e10cSrcweir //----- XAccessibleContext ------------------------------------------------
362cdf0e10cSrcweir
363cdf0e10cSrcweir virtual cssu::Reference<cssa::XAccessibleRelationSet> SAL_CALL
364cdf0e10cSrcweir getAccessibleRelationSet (void)
365cdf0e10cSrcweir throw (cssu::RuntimeException);
366cdf0e10cSrcweir
367cdf0e10cSrcweir
368cdf0e10cSrcweir //----- XAccessibleText ---------------------------------------------------
369cdf0e10cSrcweir
370cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCaretPosition (void)
371cdf0e10cSrcweir throw (cssu::RuntimeException);
372cdf0e10cSrcweir
373cdf0e10cSrcweir virtual sal_Bool SAL_CALL setCaretPosition (sal_Int32 nIndex)
374cdf0e10cSrcweir throw (::com::sun::star::lang::IndexOutOfBoundsException, cssu::RuntimeException);
375cdf0e10cSrcweir
376cdf0e10cSrcweir virtual sal_Unicode SAL_CALL getCharacter (sal_Int32 nIndex)
377cdf0e10cSrcweir throw (::com::sun::star::lang::IndexOutOfBoundsException, cssu::RuntimeException);
378cdf0e10cSrcweir
379cdf0e10cSrcweir virtual cssu::Sequence<css::beans::PropertyValue> SAL_CALL
380cdf0e10cSrcweir getCharacterAttributes (
381cdf0e10cSrcweir ::sal_Int32 nIndex,
382cdf0e10cSrcweir const cssu::Sequence<rtl::OUString>& rRequestedAttributes)
383cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException);
384cdf0e10cSrcweir
385cdf0e10cSrcweir virtual css::awt::Rectangle SAL_CALL getCharacterBounds (sal_Int32 nIndex)
386cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException);
387cdf0e10cSrcweir
388cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCharacterCount (void)
389cdf0e10cSrcweir throw (cssu::RuntimeException);
390cdf0e10cSrcweir
391cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getIndexAtPoint (const css::awt::Point& rPoint)
392cdf0e10cSrcweir throw (cssu::RuntimeException);
393cdf0e10cSrcweir
394cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getSelectedText (void)
395cdf0e10cSrcweir throw (cssu::RuntimeException);
396cdf0e10cSrcweir
397cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getSelectionStart (void)
398cdf0e10cSrcweir throw (cssu::RuntimeException);
399cdf0e10cSrcweir
400cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getSelectionEnd (void)
401cdf0e10cSrcweir throw (cssu::RuntimeException);
402cdf0e10cSrcweir
403cdf0e10cSrcweir virtual sal_Bool SAL_CALL setSelection (sal_Int32 nStartIndex, sal_Int32 nEndIndex)
404cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException);
405cdf0e10cSrcweir
406cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getText (void)
407cdf0e10cSrcweir throw (cssu::RuntimeException);
408cdf0e10cSrcweir
409cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getTextRange (
410cdf0e10cSrcweir sal_Int32 nStartIndex,
411cdf0e10cSrcweir sal_Int32 nEndIndex)
412cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException);
413cdf0e10cSrcweir
414cdf0e10cSrcweir virtual cssa::TextSegment SAL_CALL getTextAtIndex (
415cdf0e10cSrcweir sal_Int32 nIndex,
416cdf0e10cSrcweir sal_Int16 nTextType)
417cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException,
418cdf0e10cSrcweir css::lang::IllegalArgumentException,
419cdf0e10cSrcweir cssu::RuntimeException);
420cdf0e10cSrcweir
421cdf0e10cSrcweir virtual cssa::TextSegment SAL_CALL getTextBeforeIndex (
422cdf0e10cSrcweir sal_Int32 nIndex,
423cdf0e10cSrcweir sal_Int16 nTextType)
424cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException,
425cdf0e10cSrcweir css::lang::IllegalArgumentException,
426cdf0e10cSrcweir cssu::RuntimeException);
427cdf0e10cSrcweir
428cdf0e10cSrcweir virtual cssa::TextSegment SAL_CALL getTextBehindIndex (
429cdf0e10cSrcweir sal_Int32 nIndex,
430cdf0e10cSrcweir sal_Int16 nTextType)
431cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException,
432cdf0e10cSrcweir css::lang::IllegalArgumentException,
433cdf0e10cSrcweir cssu::RuntimeException);
434cdf0e10cSrcweir
435cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL copyText (sal_Int32 nStartIndex, sal_Int32 nEndIndex)
436cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException);
437cdf0e10cSrcweir
438cdf0e10cSrcweir
439cdf0e10cSrcweir protected:
440cdf0e10cSrcweir virtual awt::Point GetRelativeLocation (void);
441cdf0e10cSrcweir virtual awt::Size GetSize (void);
442cdf0e10cSrcweir virtual awt::Point GetAbsoluteParentLocation (void);
443cdf0e10cSrcweir virtual bool GetWindowState (const sal_Int16 nType) const;
444cdf0e10cSrcweir
445cdf0e10cSrcweir private:
446cdf0e10cSrcweir SharedPresenterTextParagraph mpParagraph;
447cdf0e10cSrcweir const sal_Int32 mnParagraphIndex;
448cdf0e10cSrcweir };
449cdf0e10cSrcweir
450cdf0e10cSrcweir
451cdf0e10cSrcweir
452cdf0e10cSrcweir
453cdf0e10cSrcweir //===== AccessibleConsole =====================================================
454cdf0e10cSrcweir
455cdf0e10cSrcweir class AccessibleConsole
456cdf0e10cSrcweir {
457cdf0e10cSrcweir public:
Create(const css::uno::Reference<css::uno::XComponentContext> & rxContext,const lang::Locale aLocale)458cdf0e10cSrcweir static rtl::Reference<PresenterAccessible::AccessibleObject> Create (
459cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext,
460cdf0e10cSrcweir const lang::Locale aLocale)
461cdf0e10cSrcweir {
462cdf0e10cSrcweir OUString sName (A2S("Presenter Console"));
463cdf0e10cSrcweir PresenterConfigurationAccess aConfiguration (
464cdf0e10cSrcweir rxContext,
46579e0a548SAriel Constenla-Haile OUString::createFromAscii("/org.openoffice.Office.PresenterScreen/"),
466cdf0e10cSrcweir PresenterConfigurationAccess::READ_ONLY);
467cdf0e10cSrcweir aConfiguration.GetConfigurationNode(A2S("Presenter/Accessibility/Console/String"))
468cdf0e10cSrcweir >>= sName;
469cdf0e10cSrcweir
470cdf0e10cSrcweir rtl::Reference<PresenterAccessible::AccessibleObject> pObject (
471cdf0e10cSrcweir new PresenterAccessible::AccessibleObject(
472cdf0e10cSrcweir aLocale, AccessibleRole::PANEL, sName));
473cdf0e10cSrcweir pObject->LateInitialization();
474cdf0e10cSrcweir pObject->UpdateStateSet();
475cdf0e10cSrcweir
476cdf0e10cSrcweir return pObject;
477cdf0e10cSrcweir }
478cdf0e10cSrcweir };
479cdf0e10cSrcweir
480cdf0e10cSrcweir
481cdf0e10cSrcweir
482cdf0e10cSrcweir
483cdf0e10cSrcweir //===== AccessiblePreview =====================================================
484cdf0e10cSrcweir
485cdf0e10cSrcweir class AccessiblePreview
486cdf0e10cSrcweir {
487cdf0e10cSrcweir public:
Create(const Reference<css::uno::XComponentContext> & rxContext,const lang::Locale aLocale,const Reference<awt::XWindow> & rxContentWindow,const Reference<awt::XWindow> & rxBorderWindow)488cdf0e10cSrcweir static rtl::Reference<PresenterAccessible::AccessibleObject> Create (
489cdf0e10cSrcweir const Reference<css::uno::XComponentContext>& rxContext,
490cdf0e10cSrcweir const lang::Locale aLocale,
491cdf0e10cSrcweir const Reference<awt::XWindow>& rxContentWindow,
492cdf0e10cSrcweir const Reference<awt::XWindow>& rxBorderWindow)
493cdf0e10cSrcweir {
494cdf0e10cSrcweir OUString sName (A2S("Presenter Notes Window"));
495cdf0e10cSrcweir {
496cdf0e10cSrcweir PresenterConfigurationAccess aConfiguration (
497cdf0e10cSrcweir rxContext,
49879e0a548SAriel Constenla-Haile OUString::createFromAscii("/org.openoffice.Office.PresenterScreen/"),
499cdf0e10cSrcweir PresenterConfigurationAccess::READ_ONLY);
500cdf0e10cSrcweir aConfiguration.GetConfigurationNode(A2S("Presenter/Accessibility/Preview/String"))
501cdf0e10cSrcweir >>= sName;
502cdf0e10cSrcweir }
503cdf0e10cSrcweir
504cdf0e10cSrcweir rtl::Reference<PresenterAccessible::AccessibleObject> pObject (
505cdf0e10cSrcweir new PresenterAccessible::AccessibleObject(
506cdf0e10cSrcweir aLocale,
507cdf0e10cSrcweir AccessibleRole::LABEL,
508cdf0e10cSrcweir sName));
509cdf0e10cSrcweir pObject->LateInitialization();
510cdf0e10cSrcweir pObject->UpdateStateSet();
511cdf0e10cSrcweir pObject->SetWindow(rxContentWindow, rxBorderWindow);
512cdf0e10cSrcweir
513cdf0e10cSrcweir return pObject;
514cdf0e10cSrcweir }
515cdf0e10cSrcweir };
516cdf0e10cSrcweir
517cdf0e10cSrcweir
518cdf0e10cSrcweir
519cdf0e10cSrcweir
520cdf0e10cSrcweir //===== AccessibleNotes =======================================================
521cdf0e10cSrcweir
522cdf0e10cSrcweir class AccessibleNotes : public PresenterAccessible::AccessibleObject
523cdf0e10cSrcweir {
524cdf0e10cSrcweir public:
525cdf0e10cSrcweir AccessibleNotes (
526cdf0e10cSrcweir const css::lang::Locale aLocale,
527cdf0e10cSrcweir const sal_Int16 nRole,
528cdf0e10cSrcweir const ::rtl::OUString& rsName);
529cdf0e10cSrcweir
530cdf0e10cSrcweir
531cdf0e10cSrcweir static rtl::Reference<PresenterAccessible::AccessibleObject> Create (
532cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext,
533cdf0e10cSrcweir const lang::Locale aLocale,
534cdf0e10cSrcweir const Reference<awt::XWindow>& rxContentWindow,
535cdf0e10cSrcweir const Reference<awt::XWindow>& rxBorderWindow,
536cdf0e10cSrcweir const ::boost::shared_ptr<PresenterTextView>& rpTextView);
537cdf0e10cSrcweir
538cdf0e10cSrcweir void SetTextView (const ::boost::shared_ptr<PresenterTextView>& rpTextView);
539cdf0e10cSrcweir
540cdf0e10cSrcweir virtual void SetWindow (
541cdf0e10cSrcweir const cssu::Reference<css::awt::XWindow>& rxContentWindow,
542cdf0e10cSrcweir const cssu::Reference<css::awt::XWindow>& rxBorderWindow);
543cdf0e10cSrcweir
544cdf0e10cSrcweir private:
545cdf0e10cSrcweir ::boost::shared_ptr<PresenterTextView> mpTextView;
546cdf0e10cSrcweir
547cdf0e10cSrcweir void NotifyCaretChange (
548cdf0e10cSrcweir const sal_Int32 nOldParagraphIndex,
549cdf0e10cSrcweir const sal_Int32 nOldCharacterIndex,
550cdf0e10cSrcweir const sal_Int32 nNewParagraphIndex,
551cdf0e10cSrcweir const sal_Int32 nNewCharacterIndex);
552cdf0e10cSrcweir void HandleTextChange (void);
553cdf0e10cSrcweir };
554cdf0e10cSrcweir
555cdf0e10cSrcweir
556cdf0e10cSrcweir
557cdf0e10cSrcweir
558cdf0e10cSrcweir //===== AccessibleFocusManager ================================================
559cdf0e10cSrcweir
560cdf0e10cSrcweir /** A singleton class that makes sure that only one accessibility object in
561cdf0e10cSrcweir the PresenterConsole hierarchy has the focus.
562cdf0e10cSrcweir */
563cdf0e10cSrcweir class AccessibleFocusManager
564cdf0e10cSrcweir {
565cdf0e10cSrcweir public:
566cdf0e10cSrcweir static ::boost::shared_ptr<AccessibleFocusManager> Instance (void);
567cdf0e10cSrcweir
568cdf0e10cSrcweir void AddFocusableObject (const ::rtl::Reference<PresenterAccessible::AccessibleObject>& rpObject);
569cdf0e10cSrcweir void RemoveFocusableObject (const ::rtl::Reference<PresenterAccessible::AccessibleObject>& rpObject);
570cdf0e10cSrcweir
571cdf0e10cSrcweir void FocusObject (const ::rtl::Reference<PresenterAccessible::AccessibleObject>& rpObject);
572cdf0e10cSrcweir
573cdf0e10cSrcweir private:
574cdf0e10cSrcweir static ::boost::shared_ptr<AccessibleFocusManager> mpInstance;
575cdf0e10cSrcweir ::std::vector<rtl::Reference<PresenterAccessible::AccessibleObject> > maFocusableObjects;
576cdf0e10cSrcweir
577cdf0e10cSrcweir AccessibleFocusManager (void);
578cdf0e10cSrcweir };
579cdf0e10cSrcweir
580cdf0e10cSrcweir
581cdf0e10cSrcweir
582cdf0e10cSrcweir
583cdf0e10cSrcweir //===== PresenterAccessible ===================================================
584cdf0e10cSrcweir
PresenterAccessible(const css::uno::Reference<css::uno::XComponentContext> & rxContext,const::rtl::Reference<PresenterController> & rpPresenterController,const Reference<drawing::framework::XPane> & rxMainPane)585cdf0e10cSrcweir PresenterAccessible::PresenterAccessible (
586cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext,
587cdf0e10cSrcweir const ::rtl::Reference<PresenterController>& rpPresenterController,
588cdf0e10cSrcweir const Reference<drawing::framework::XPane>& rxMainPane)
589cdf0e10cSrcweir : PresenterAccessibleInterfaceBase(m_aMutex),
590cdf0e10cSrcweir mxComponentContext(rxContext),
591cdf0e10cSrcweir mpPresenterController(rpPresenterController),
592cdf0e10cSrcweir mxMainPaneId(rxMainPane.is() ? rxMainPane->getResourceId() : Reference<XResourceId>()),
593cdf0e10cSrcweir mxMainPane(rxMainPane, UNO_QUERY),
594cdf0e10cSrcweir mxMainWindow(),
595cdf0e10cSrcweir mxPreviewContentWindow(),
596cdf0e10cSrcweir mxPreviewBorderWindow(),
597cdf0e10cSrcweir mxNotesContentWindow(),
598cdf0e10cSrcweir mxNotesBorderWindow(),
599cdf0e10cSrcweir mpAccessibleConsole(),
600cdf0e10cSrcweir mpAccessiblePreview(),
601cdf0e10cSrcweir mpAccessibleNotes(),
602cdf0e10cSrcweir mxAccessibleParent()
603cdf0e10cSrcweir {
604cdf0e10cSrcweir if (mxMainPane.is())
605cdf0e10cSrcweir mxMainPane->setAccessible(this);
606cdf0e10cSrcweir }
607cdf0e10cSrcweir
608cdf0e10cSrcweir
609cdf0e10cSrcweir
610cdf0e10cSrcweir
~PresenterAccessible(void)611cdf0e10cSrcweir PresenterAccessible::~PresenterAccessible (void)
612cdf0e10cSrcweir {
613cdf0e10cSrcweir }
614cdf0e10cSrcweir
615cdf0e10cSrcweir
616cdf0e10cSrcweir
617cdf0e10cSrcweir
GetPreviewPane(void) const618cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor PresenterAccessible::GetPreviewPane (void) const
619cdf0e10cSrcweir {
620cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pPreviewPane;
621cdf0e10cSrcweir
622cdf0e10cSrcweir if ( ! mpPresenterController.is())
623cdf0e10cSrcweir return pPreviewPane;
624cdf0e10cSrcweir
625cdf0e10cSrcweir rtl::Reference<PresenterPaneContainer> pContainer (mpPresenterController->GetPaneContainer());
626cdf0e10cSrcweir if ( ! pContainer.is())
627cdf0e10cSrcweir return pPreviewPane;
628cdf0e10cSrcweir
629cdf0e10cSrcweir pPreviewPane = pContainer->FindPaneURL(PresenterPaneFactory::msCurrentSlidePreviewPaneURL);
630cdf0e10cSrcweir Reference<drawing::framework::XPane> xPreviewPane;
631cdf0e10cSrcweir if (pPreviewPane)
632cdf0e10cSrcweir xPreviewPane = pPreviewPane->mxPane.get();
633cdf0e10cSrcweir if ( ! xPreviewPane.is())
634cdf0e10cSrcweir {
635cdf0e10cSrcweir pPreviewPane = pContainer->FindPaneURL(PresenterPaneFactory::msSlideSorterPaneURL);
636cdf0e10cSrcweir }
637cdf0e10cSrcweir return pPreviewPane;
638cdf0e10cSrcweir }
639cdf0e10cSrcweir
640cdf0e10cSrcweir
641cdf0e10cSrcweir
642cdf0e10cSrcweir
UpdateAccessibilityHierarchy(void)643cdf0e10cSrcweir void PresenterAccessible::UpdateAccessibilityHierarchy (void)
644cdf0e10cSrcweir {
645cdf0e10cSrcweir if ( ! mpPresenterController.is())
646cdf0e10cSrcweir return;
647cdf0e10cSrcweir
648cdf0e10cSrcweir Reference<drawing::framework::XConfigurationController> xConfigurationController(
649cdf0e10cSrcweir mpPresenterController->GetConfigurationController());
650cdf0e10cSrcweir if ( ! xConfigurationController.is())
651cdf0e10cSrcweir return;
652cdf0e10cSrcweir
653cdf0e10cSrcweir rtl::Reference<PresenterPaneContainer> pPaneContainer (
654cdf0e10cSrcweir mpPresenterController->GetPaneContainer());
655cdf0e10cSrcweir if ( ! pPaneContainer.is())
656cdf0e10cSrcweir return;
657cdf0e10cSrcweir
658cdf0e10cSrcweir if ( ! mpAccessibleConsole.is())
659cdf0e10cSrcweir return;
660cdf0e10cSrcweir
661cdf0e10cSrcweir // Get the preview pane (standard or notes view) or the slide overview
662cdf0e10cSrcweir // pane.
663cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pPreviewPane(GetPreviewPane());
664cdf0e10cSrcweir Reference<drawing::framework::XPane> xPreviewPane;
665cdf0e10cSrcweir if (pPreviewPane)
666cdf0e10cSrcweir xPreviewPane = pPreviewPane->mxPane.get();
667cdf0e10cSrcweir
668cdf0e10cSrcweir // Get the notes pane.
669cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pNotesPane(
670cdf0e10cSrcweir pPaneContainer->FindPaneURL(PresenterPaneFactory::msNotesPaneURL));
671cdf0e10cSrcweir Reference<drawing::framework::XPane> xNotesPane;
672cdf0e10cSrcweir if (pNotesPane)
673cdf0e10cSrcweir xNotesPane = pNotesPane->mxPane.get();
674cdf0e10cSrcweir
675cdf0e10cSrcweir // Get the notes view.
676cdf0e10cSrcweir Reference<drawing::framework::XView> xNotesView;
677cdf0e10cSrcweir if (pNotesPane)
678cdf0e10cSrcweir xNotesView = pNotesPane->mxView;
679cdf0e10cSrcweir rtl::Reference<PresenterNotesView> pNotesView (
680cdf0e10cSrcweir dynamic_cast<PresenterNotesView*>(xNotesView.get()));
681cdf0e10cSrcweir
682cdf0e10cSrcweir UpdateAccessibilityHierarchy(
683cdf0e10cSrcweir pPreviewPane ? pPreviewPane->mxContentWindow : Reference<awt::XWindow>(),
684cdf0e10cSrcweir pPreviewPane ? pPreviewPane->mxBorderWindow : Reference<awt::XWindow>(),
685cdf0e10cSrcweir (pPreviewPane&&pPreviewPane->mxPane.is()) ? pPreviewPane->mxPane->GetTitle() : OUString(),
686cdf0e10cSrcweir pNotesPane ? pNotesPane->mxContentWindow : Reference<awt::XWindow>(),
687cdf0e10cSrcweir pNotesPane ? pNotesPane->mxBorderWindow : Reference<awt::XWindow>(),
688cdf0e10cSrcweir pNotesView.is()
689cdf0e10cSrcweir ? pNotesView->GetTextView()
690cdf0e10cSrcweir : ::boost::shared_ptr<PresenterTextView>());
691cdf0e10cSrcweir }
692cdf0e10cSrcweir
693cdf0e10cSrcweir
694cdf0e10cSrcweir
695cdf0e10cSrcweir
696cdf0e10cSrcweir
UpdateAccessibilityHierarchy(const Reference<awt::XWindow> & rxPreviewContentWindow,const Reference<awt::XWindow> & rxPreviewBorderWindow,const::rtl::OUString & rsTitle,const Reference<awt::XWindow> & rxNotesContentWindow,const Reference<awt::XWindow> & rxNotesBorderWindow,const::boost::shared_ptr<PresenterTextView> & rpNotesTextView)697cdf0e10cSrcweir void PresenterAccessible::UpdateAccessibilityHierarchy (
698cdf0e10cSrcweir const Reference<awt::XWindow>& rxPreviewContentWindow,
699cdf0e10cSrcweir const Reference<awt::XWindow>& rxPreviewBorderWindow,
700cdf0e10cSrcweir const ::rtl::OUString& rsTitle,
701cdf0e10cSrcweir const Reference<awt::XWindow>& rxNotesContentWindow,
702cdf0e10cSrcweir const Reference<awt::XWindow>& rxNotesBorderWindow,
703cdf0e10cSrcweir const ::boost::shared_ptr<PresenterTextView>& rpNotesTextView)
704cdf0e10cSrcweir {
705cdf0e10cSrcweir if ( ! mpAccessibleConsole.is())
706cdf0e10cSrcweir return;
707cdf0e10cSrcweir
708cdf0e10cSrcweir if (mxPreviewContentWindow != rxPreviewContentWindow)
709cdf0e10cSrcweir {
710cdf0e10cSrcweir if (mpAccessiblePreview.is())
711cdf0e10cSrcweir {
712cdf0e10cSrcweir mpAccessibleConsole->RemoveChild(mpAccessiblePreview);
713cdf0e10cSrcweir mpAccessiblePreview = NULL;
714cdf0e10cSrcweir }
715cdf0e10cSrcweir
716cdf0e10cSrcweir mxPreviewContentWindow = rxPreviewContentWindow;
717cdf0e10cSrcweir mxPreviewBorderWindow = rxPreviewBorderWindow;
718cdf0e10cSrcweir
719cdf0e10cSrcweir if (mxPreviewContentWindow.is())
720cdf0e10cSrcweir {
721cdf0e10cSrcweir mpAccessiblePreview = AccessiblePreview::Create(
722cdf0e10cSrcweir mxComponentContext,
723cdf0e10cSrcweir lang::Locale(),
724cdf0e10cSrcweir mxPreviewContentWindow,
725cdf0e10cSrcweir mxPreviewBorderWindow);
726cdf0e10cSrcweir mpAccessibleConsole->AddChild(mpAccessiblePreview);
727cdf0e10cSrcweir mpAccessiblePreview->SetAccessibleName(rsTitle);
728cdf0e10cSrcweir }
729cdf0e10cSrcweir }
730cdf0e10cSrcweir
731cdf0e10cSrcweir if (mxNotesContentWindow != rxNotesContentWindow)
732cdf0e10cSrcweir {
733cdf0e10cSrcweir if (mpAccessibleNotes.is())
734cdf0e10cSrcweir {
735cdf0e10cSrcweir mpAccessibleConsole->RemoveChild(mpAccessibleConsole.get());
736cdf0e10cSrcweir mpAccessibleNotes = NULL;
737cdf0e10cSrcweir }
738cdf0e10cSrcweir
739cdf0e10cSrcweir mxNotesContentWindow = rxNotesContentWindow;
740cdf0e10cSrcweir mxNotesBorderWindow = rxNotesBorderWindow;
741cdf0e10cSrcweir
742cdf0e10cSrcweir if (mxNotesContentWindow.is())
743cdf0e10cSrcweir {
744cdf0e10cSrcweir mpAccessibleNotes = AccessibleNotes::Create(
745cdf0e10cSrcweir mxComponentContext,
746cdf0e10cSrcweir lang::Locale(),
747cdf0e10cSrcweir mxNotesContentWindow,
748cdf0e10cSrcweir mxNotesBorderWindow,
749cdf0e10cSrcweir rpNotesTextView);
750cdf0e10cSrcweir mpAccessibleConsole->AddChild(mpAccessibleNotes.get());
751cdf0e10cSrcweir }
752cdf0e10cSrcweir }
753cdf0e10cSrcweir }
754cdf0e10cSrcweir
755cdf0e10cSrcweir
756cdf0e10cSrcweir
757cdf0e10cSrcweir
NotifyCurrentSlideChange(const sal_Int32 nCurrentSlideIndex,const sal_Int32 nSlideCount)758cdf0e10cSrcweir void PresenterAccessible::NotifyCurrentSlideChange (
759cdf0e10cSrcweir const sal_Int32 nCurrentSlideIndex,
760cdf0e10cSrcweir const sal_Int32 nSlideCount)
761cdf0e10cSrcweir {
762cdf0e10cSrcweir (void)nCurrentSlideIndex;
763cdf0e10cSrcweir (void)nSlideCount;
764cdf0e10cSrcweir
765cdf0e10cSrcweir if (mpAccessiblePreview.is())
766cdf0e10cSrcweir {
767cdf0e10cSrcweir PresenterPaneContainer::SharedPaneDescriptor pPreviewPane (GetPreviewPane());
768cdf0e10cSrcweir mpAccessiblePreview->SetAccessibleName(
769cdf0e10cSrcweir (pPreviewPane&&pPreviewPane->mxPane.is()
770cdf0e10cSrcweir ? pPreviewPane->mxPane->GetTitle()
771cdf0e10cSrcweir : rtl::OUString()));
772cdf0e10cSrcweir }
773cdf0e10cSrcweir
774cdf0e10cSrcweir // Play some focus ping-pong to trigger AT tools.
775cdf0e10cSrcweir //AccessibleFocusManager::Instance()->FocusObject(mpAccessibleConsole);
776cdf0e10cSrcweir AccessibleFocusManager::Instance()->FocusObject(mpAccessiblePreview);
777cdf0e10cSrcweir }
778cdf0e10cSrcweir
779cdf0e10cSrcweir
780cdf0e10cSrcweir
781cdf0e10cSrcweir
IsAccessibilityActive(void) const782cdf0e10cSrcweir bool PresenterAccessible::IsAccessibilityActive (void) const
783cdf0e10cSrcweir {
784cdf0e10cSrcweir return mpAccessibleConsole.is();
785cdf0e10cSrcweir }
786cdf0e10cSrcweir
787cdf0e10cSrcweir
788cdf0e10cSrcweir
789cdf0e10cSrcweir
disposing(void)790cdf0e10cSrcweir void SAL_CALL PresenterAccessible::disposing (void)
791cdf0e10cSrcweir {
792cdf0e10cSrcweir UpdateAccessibilityHierarchy(
793cdf0e10cSrcweir NULL,
794cdf0e10cSrcweir NULL,
795cdf0e10cSrcweir OUString(),
796cdf0e10cSrcweir NULL,
797cdf0e10cSrcweir NULL,
798cdf0e10cSrcweir ::boost::shared_ptr<PresenterTextView>());
799cdf0e10cSrcweir
800cdf0e10cSrcweir if (mxMainWindow.is())
801cdf0e10cSrcweir {
802cdf0e10cSrcweir mxMainWindow->removeFocusListener(this);
803cdf0e10cSrcweir
804cdf0e10cSrcweir if (mxMainPane.is())
805cdf0e10cSrcweir mxMainPane->setAccessible(NULL);
806cdf0e10cSrcweir }
807cdf0e10cSrcweir
808cdf0e10cSrcweir mpAccessiblePreview = NULL;
809cdf0e10cSrcweir mpAccessibleNotes = NULL;
810cdf0e10cSrcweir mpAccessibleConsole = NULL;
811cdf0e10cSrcweir }
812cdf0e10cSrcweir
813cdf0e10cSrcweir
814cdf0e10cSrcweir
815cdf0e10cSrcweir
816cdf0e10cSrcweir //----- XAccessible -----------------------------------------------------------
817cdf0e10cSrcweir
getAccessibleContext(void)818cdf0e10cSrcweir Reference<XAccessibleContext> SAL_CALL PresenterAccessible::getAccessibleContext (void)
819cdf0e10cSrcweir throw (cssu::RuntimeException)
820cdf0e10cSrcweir {
821cdf0e10cSrcweir if ( ! mpAccessibleConsole.is())
822cdf0e10cSrcweir {
823cdf0e10cSrcweir Reference<XPane> xMainPane (mxMainPane, UNO_QUERY);
824cdf0e10cSrcweir if (xMainPane.is())
825cdf0e10cSrcweir {
826cdf0e10cSrcweir mxMainWindow = Reference<awt::XWindow>(xMainPane->getWindow(), UNO_QUERY);
827cdf0e10cSrcweir mxMainWindow->addFocusListener(this);
828cdf0e10cSrcweir }
829cdf0e10cSrcweir mpAccessibleConsole = AccessibleConsole::Create(
830cdf0e10cSrcweir mxComponentContext, css::lang::Locale());
831cdf0e10cSrcweir mpAccessibleConsole->SetWindow(mxMainWindow, NULL);
832cdf0e10cSrcweir mpAccessibleConsole->SetAccessibleParent(mxAccessibleParent);
833cdf0e10cSrcweir UpdateAccessibilityHierarchy();
834cdf0e10cSrcweir if (mpPresenterController.is())
835cdf0e10cSrcweir mpPresenterController->SetAccessibilityActiveState(true);
836cdf0e10cSrcweir }
837cdf0e10cSrcweir return mpAccessibleConsole->getAccessibleContext();
838cdf0e10cSrcweir }
839cdf0e10cSrcweir
840cdf0e10cSrcweir
841cdf0e10cSrcweir
842cdf0e10cSrcweir
843cdf0e10cSrcweir
844cdf0e10cSrcweir //----- XFocusListener ----------------------------------------------------
845cdf0e10cSrcweir
focusGained(const css::awt::FocusEvent & rEvent)846cdf0e10cSrcweir void SAL_CALL PresenterAccessible::focusGained (const css::awt::FocusEvent& rEvent)
847cdf0e10cSrcweir throw (cssu::RuntimeException)
848cdf0e10cSrcweir {
849cdf0e10cSrcweir (void)rEvent;
850cdf0e10cSrcweir
851cdf0e10cSrcweir #ifdef VERBOSE
852cdf0e10cSrcweir OSL_TRACE("PresenterAccessible::focusGained at %x and window %x\r", this,
853cdf0e10cSrcweir mxMainWindow.get());
854cdf0e10cSrcweir #endif
855cdf0e10cSrcweir
856cdf0e10cSrcweir AccessibleFocusManager::Instance()->FocusObject(mpAccessibleConsole);
857cdf0e10cSrcweir }
858cdf0e10cSrcweir
859cdf0e10cSrcweir
860cdf0e10cSrcweir
861cdf0e10cSrcweir
focusLost(const css::awt::FocusEvent & rEvent)862cdf0e10cSrcweir void SAL_CALL PresenterAccessible::focusLost (const css::awt::FocusEvent& rEvent)
863cdf0e10cSrcweir throw (cssu::RuntimeException)
864cdf0e10cSrcweir {
865cdf0e10cSrcweir (void)rEvent;
866cdf0e10cSrcweir
867cdf0e10cSrcweir #ifdef VERBOSE
868cdf0e10cSrcweir OSL_TRACE("PresenterAccessible::focusLost at %x\r", this);
869cdf0e10cSrcweir #endif
870cdf0e10cSrcweir
871cdf0e10cSrcweir AccessibleFocusManager::Instance()->FocusObject(NULL);
872cdf0e10cSrcweir }
873cdf0e10cSrcweir
874cdf0e10cSrcweir
875cdf0e10cSrcweir
876cdf0e10cSrcweir
877cdf0e10cSrcweir //----- XEventListener ----------------------------------------------------
878cdf0e10cSrcweir
disposing(const css::lang::EventObject & rEvent)879cdf0e10cSrcweir void SAL_CALL PresenterAccessible::disposing (const css::lang::EventObject& rEvent)
880cdf0e10cSrcweir throw (cssu::RuntimeException)
881cdf0e10cSrcweir {
882cdf0e10cSrcweir if (rEvent.Source == mxMainWindow)
883cdf0e10cSrcweir mxMainWindow = NULL;
884cdf0e10cSrcweir }
885cdf0e10cSrcweir
886cdf0e10cSrcweir
887cdf0e10cSrcweir
888cdf0e10cSrcweir
889cdf0e10cSrcweir //----- XInitialize -----------------------------------------------------------
890cdf0e10cSrcweir
initialize(const cssu::Sequence<cssu::Any> & rArguments)891cdf0e10cSrcweir void SAL_CALL PresenterAccessible::initialize (const cssu::Sequence<cssu::Any>& rArguments)
892cdf0e10cSrcweir throw (cssu::RuntimeException)
893cdf0e10cSrcweir {
894cdf0e10cSrcweir if (rArguments.getLength() >= 1)
895cdf0e10cSrcweir {
896cdf0e10cSrcweir mxAccessibleParent = Reference<XAccessible>(rArguments[0], UNO_QUERY);
897cdf0e10cSrcweir if (mpAccessibleConsole.is())
898cdf0e10cSrcweir mpAccessibleConsole->SetAccessibleParent(mxAccessibleParent);
899cdf0e10cSrcweir }
900cdf0e10cSrcweir }
901cdf0e10cSrcweir
902cdf0e10cSrcweir
903cdf0e10cSrcweir
904cdf0e10cSrcweir
905cdf0e10cSrcweir //===== PresenterAccessible::AccessibleObject =========================================
906cdf0e10cSrcweir
AccessibleObject(const lang::Locale aLocale,const sal_Int16 nRole,const OUString & rsName)907cdf0e10cSrcweir PresenterAccessible::AccessibleObject::AccessibleObject (
908cdf0e10cSrcweir const lang::Locale aLocale,
909cdf0e10cSrcweir const sal_Int16 nRole,
910cdf0e10cSrcweir const OUString& rsName)
911cdf0e10cSrcweir : PresenterAccessibleObjectInterfaceBase(m_aMutex),
912cdf0e10cSrcweir msName(rsName),
913cdf0e10cSrcweir mxContentWindow(),
914cdf0e10cSrcweir mxBorderWindow(),
915cdf0e10cSrcweir maLocale(aLocale),
916cdf0e10cSrcweir mnRole(nRole),
917cdf0e10cSrcweir mnStateSet(0),
918cdf0e10cSrcweir mbIsFocused(false),
919cdf0e10cSrcweir mxParentAccessible(),
920cdf0e10cSrcweir maChildren(),
921cdf0e10cSrcweir maListeners()
922cdf0e10cSrcweir {
923cdf0e10cSrcweir }
924cdf0e10cSrcweir
925cdf0e10cSrcweir
926cdf0e10cSrcweir
927cdf0e10cSrcweir
LateInitialization(void)928cdf0e10cSrcweir void PresenterAccessible::AccessibleObject::LateInitialization (void)
929cdf0e10cSrcweir {
930cdf0e10cSrcweir AccessibleFocusManager::Instance()->AddFocusableObject(this);
931cdf0e10cSrcweir }
932cdf0e10cSrcweir
933cdf0e10cSrcweir
934cdf0e10cSrcweir
935cdf0e10cSrcweir
~AccessibleObject(void)936cdf0e10cSrcweir PresenterAccessible::AccessibleObject::~AccessibleObject (void)
937cdf0e10cSrcweir {
938cdf0e10cSrcweir }
939cdf0e10cSrcweir
940cdf0e10cSrcweir
941cdf0e10cSrcweir
942cdf0e10cSrcweir
SetWindow(const Reference<awt::XWindow> & rxContentWindow,const Reference<awt::XWindow> & rxBorderWindow)943cdf0e10cSrcweir void PresenterAccessible::AccessibleObject::SetWindow (
944cdf0e10cSrcweir const Reference<awt::XWindow>& rxContentWindow,
945cdf0e10cSrcweir const Reference<awt::XWindow>& rxBorderWindow)
946cdf0e10cSrcweir {
947cdf0e10cSrcweir Reference<awt::XWindow2> xContentWindow (rxContentWindow, UNO_QUERY);
948cdf0e10cSrcweir
949cdf0e10cSrcweir if (mxContentWindow.get() != xContentWindow.get())
950cdf0e10cSrcweir {
951cdf0e10cSrcweir if (mxContentWindow.is())
952cdf0e10cSrcweir {
953cdf0e10cSrcweir mxContentWindow->removeWindowListener(this);
954cdf0e10cSrcweir }
955cdf0e10cSrcweir
956cdf0e10cSrcweir mxContentWindow = xContentWindow;
957cdf0e10cSrcweir mxBorderWindow = Reference<awt::XWindow2>(rxBorderWindow, UNO_QUERY);
958cdf0e10cSrcweir
959cdf0e10cSrcweir if (mxContentWindow.is())
960cdf0e10cSrcweir {
961cdf0e10cSrcweir mxContentWindow->addWindowListener(this);
962cdf0e10cSrcweir }
963cdf0e10cSrcweir
964cdf0e10cSrcweir UpdateStateSet();
965cdf0e10cSrcweir }
966cdf0e10cSrcweir }
967cdf0e10cSrcweir
968cdf0e10cSrcweir
969cdf0e10cSrcweir
970cdf0e10cSrcweir
SetAccessibleParent(const Reference<XAccessible> & rxAccessibleParent)971cdf0e10cSrcweir void PresenterAccessible::AccessibleObject::SetAccessibleParent (
972cdf0e10cSrcweir const Reference<XAccessible>& rxAccessibleParent)
973cdf0e10cSrcweir {
974cdf0e10cSrcweir mxParentAccessible = rxAccessibleParent;
975cdf0e10cSrcweir }
976cdf0e10cSrcweir
977cdf0e10cSrcweir
978cdf0e10cSrcweir
979cdf0e10cSrcweir
disposing(void)980cdf0e10cSrcweir void SAL_CALL PresenterAccessible::AccessibleObject::disposing (void)
981cdf0e10cSrcweir {
982cdf0e10cSrcweir AccessibleFocusManager::Instance()->RemoveFocusableObject(this);
983cdf0e10cSrcweir SetWindow(NULL, NULL);
984cdf0e10cSrcweir }
985cdf0e10cSrcweir
986cdf0e10cSrcweir
987cdf0e10cSrcweir
988cdf0e10cSrcweir
989cdf0e10cSrcweir //----- XAccessible -------------------------------------------------------
990cdf0e10cSrcweir
991cdf0e10cSrcweir Reference<XAccessibleContext> SAL_CALL
getAccessibleContext(void)992cdf0e10cSrcweir PresenterAccessible::AccessibleObject::getAccessibleContext (void)
993cdf0e10cSrcweir throw (RuntimeException)
994cdf0e10cSrcweir {
995cdf0e10cSrcweir ThrowIfDisposed();
996cdf0e10cSrcweir
997cdf0e10cSrcweir return this;
998cdf0e10cSrcweir }
999cdf0e10cSrcweir
1000cdf0e10cSrcweir
1001cdf0e10cSrcweir
1002cdf0e10cSrcweir
1003*aa9633e7Smseidel //----- XAccessibleContext ------------------------------------------------
1004cdf0e10cSrcweir
getAccessibleChildCount(void)1005cdf0e10cSrcweir sal_Int32 SAL_CALL PresenterAccessible::AccessibleObject::getAccessibleChildCount (void)
1006cdf0e10cSrcweir throw (cssu::RuntimeException)
1007cdf0e10cSrcweir {
1008cdf0e10cSrcweir ThrowIfDisposed();
1009cdf0e10cSrcweir
1010cdf0e10cSrcweir const sal_Int32 nChildCount (maChildren.size());
1011cdf0e10cSrcweir
1012cdf0e10cSrcweir return nChildCount;
1013cdf0e10cSrcweir }
1014cdf0e10cSrcweir
1015cdf0e10cSrcweir
1016cdf0e10cSrcweir
1017cdf0e10cSrcweir
1018cdf0e10cSrcweir Reference<XAccessible> SAL_CALL
getAccessibleChild(sal_Int32 nIndex)1019cdf0e10cSrcweir PresenterAccessible::AccessibleObject::getAccessibleChild (sal_Int32 nIndex)
1020cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, RuntimeException)
1021cdf0e10cSrcweir {
1022cdf0e10cSrcweir ThrowIfDisposed();
1023cdf0e10cSrcweir
1024cdf0e10cSrcweir if (nIndex<0 || nIndex>=sal_Int32(maChildren.size()))
1025cdf0e10cSrcweir ThrowException("invalid child index", ET_IndexOutOfBounds);
1026cdf0e10cSrcweir
1027cdf0e10cSrcweir return Reference<XAccessible>(maChildren[nIndex].get());
1028cdf0e10cSrcweir }
1029cdf0e10cSrcweir
1030cdf0e10cSrcweir
1031cdf0e10cSrcweir
1032cdf0e10cSrcweir
1033cdf0e10cSrcweir Reference<XAccessible> SAL_CALL
getAccessibleParent(void)1034cdf0e10cSrcweir PresenterAccessible::AccessibleObject::getAccessibleParent (void)
1035cdf0e10cSrcweir throw (RuntimeException)
1036cdf0e10cSrcweir {
1037cdf0e10cSrcweir ThrowIfDisposed();
1038cdf0e10cSrcweir
1039cdf0e10cSrcweir return mxParentAccessible;
1040cdf0e10cSrcweir }
1041cdf0e10cSrcweir
1042cdf0e10cSrcweir
1043cdf0e10cSrcweir
1044cdf0e10cSrcweir
1045cdf0e10cSrcweir sal_Int32 SAL_CALL
getAccessibleIndexInParent(void)1046cdf0e10cSrcweir PresenterAccessible::AccessibleObject::getAccessibleIndexInParent (void)
1047cdf0e10cSrcweir throw (RuntimeException)
1048cdf0e10cSrcweir {
1049cdf0e10cSrcweir ThrowIfDisposed();
1050cdf0e10cSrcweir
1051cdf0e10cSrcweir const Reference<XAccessible> xThis (this);
1052cdf0e10cSrcweir if (mxParentAccessible.is())
1053cdf0e10cSrcweir {
1054cdf0e10cSrcweir const Reference<XAccessibleContext> xContext (mxParentAccessible->getAccessibleContext());
1055cdf0e10cSrcweir for (sal_Int32 nIndex=0,nCount=xContext->getAccessibleChildCount();
1056cdf0e10cSrcweir nIndex<nCount;
1057cdf0e10cSrcweir ++nIndex)
1058cdf0e10cSrcweir {
1059cdf0e10cSrcweir if (xContext->getAccessibleChild(nIndex) == xThis)
1060cdf0e10cSrcweir return nIndex;
1061cdf0e10cSrcweir }
1062cdf0e10cSrcweir }
1063cdf0e10cSrcweir
1064cdf0e10cSrcweir return 0;
1065cdf0e10cSrcweir }
1066cdf0e10cSrcweir
1067cdf0e10cSrcweir
1068cdf0e10cSrcweir
1069cdf0e10cSrcweir
1070cdf0e10cSrcweir sal_Int16 SAL_CALL
getAccessibleRole(void)1071cdf0e10cSrcweir PresenterAccessible::AccessibleObject::getAccessibleRole (void)
1072cdf0e10cSrcweir throw (RuntimeException)
1073cdf0e10cSrcweir {
1074cdf0e10cSrcweir ThrowIfDisposed();
1075cdf0e10cSrcweir
1076cdf0e10cSrcweir return mnRole;
1077cdf0e10cSrcweir }
1078cdf0e10cSrcweir
1079cdf0e10cSrcweir
1080cdf0e10cSrcweir
1081cdf0e10cSrcweir
1082cdf0e10cSrcweir OUString SAL_CALL
getAccessibleDescription(void)1083cdf0e10cSrcweir PresenterAccessible::AccessibleObject::getAccessibleDescription (void)
1084cdf0e10cSrcweir throw (RuntimeException)
1085cdf0e10cSrcweir {
1086cdf0e10cSrcweir ThrowIfDisposed();
1087cdf0e10cSrcweir
1088cdf0e10cSrcweir return msName;
1089cdf0e10cSrcweir }
1090cdf0e10cSrcweir
1091cdf0e10cSrcweir
1092cdf0e10cSrcweir
1093cdf0e10cSrcweir
1094cdf0e10cSrcweir OUString SAL_CALL
getAccessibleName(void)1095cdf0e10cSrcweir PresenterAccessible::AccessibleObject::getAccessibleName (void)
1096cdf0e10cSrcweir throw (cssu::RuntimeException)
1097cdf0e10cSrcweir {
1098cdf0e10cSrcweir ThrowIfDisposed();
1099cdf0e10cSrcweir
1100cdf0e10cSrcweir return msName;
1101cdf0e10cSrcweir }
1102cdf0e10cSrcweir
1103cdf0e10cSrcweir
1104cdf0e10cSrcweir
1105cdf0e10cSrcweir
1106cdf0e10cSrcweir Reference<XAccessibleRelationSet> SAL_CALL
getAccessibleRelationSet(void)1107cdf0e10cSrcweir PresenterAccessible::AccessibleObject::getAccessibleRelationSet (void)
1108cdf0e10cSrcweir throw (RuntimeException)
1109cdf0e10cSrcweir {
1110cdf0e10cSrcweir ThrowIfDisposed();
1111cdf0e10cSrcweir
1112cdf0e10cSrcweir return NULL;
1113cdf0e10cSrcweir }
1114cdf0e10cSrcweir
1115cdf0e10cSrcweir
1116cdf0e10cSrcweir
1117cdf0e10cSrcweir
1118cdf0e10cSrcweir Reference<XAccessibleStateSet> SAL_CALL
getAccessibleStateSet(void)1119cdf0e10cSrcweir PresenterAccessible::AccessibleObject::getAccessibleStateSet (void)
1120cdf0e10cSrcweir throw (RuntimeException)
1121cdf0e10cSrcweir {
1122cdf0e10cSrcweir ThrowIfDisposed();
1123cdf0e10cSrcweir
1124cdf0e10cSrcweir return Reference<XAccessibleStateSet>(new AccessibleStateSet(mnStateSet));
1125cdf0e10cSrcweir }
1126cdf0e10cSrcweir
1127cdf0e10cSrcweir
1128cdf0e10cSrcweir
1129cdf0e10cSrcweir
1130cdf0e10cSrcweir lang::Locale SAL_CALL
getLocale(void)1131cdf0e10cSrcweir PresenterAccessible::AccessibleObject::getLocale (void)
1132cdf0e10cSrcweir throw (RuntimeException,
1133cdf0e10cSrcweir IllegalAccessibleComponentStateException)
1134cdf0e10cSrcweir {
1135cdf0e10cSrcweir ThrowIfDisposed();
1136cdf0e10cSrcweir
1137cdf0e10cSrcweir if (mxParentAccessible.is())
1138cdf0e10cSrcweir {
1139cdf0e10cSrcweir Reference<XAccessibleContext> xParentContext (mxParentAccessible->getAccessibleContext());
1140cdf0e10cSrcweir if (xParentContext.is())
1141cdf0e10cSrcweir return xParentContext->getLocale();
1142cdf0e10cSrcweir }
1143cdf0e10cSrcweir return maLocale;
1144cdf0e10cSrcweir }
1145cdf0e10cSrcweir
1146cdf0e10cSrcweir
1147cdf0e10cSrcweir
1148cdf0e10cSrcweir
1149*aa9633e7Smseidel //----- XAccessibleComponent ----------------------------------------------
1150cdf0e10cSrcweir
containsPoint(const awt::Point & rPoint)1151cdf0e10cSrcweir sal_Bool SAL_CALL PresenterAccessible::AccessibleObject::containsPoint (
1152cdf0e10cSrcweir const awt::Point& rPoint)
1153cdf0e10cSrcweir throw (RuntimeException)
1154cdf0e10cSrcweir {
1155cdf0e10cSrcweir ThrowIfDisposed();
1156cdf0e10cSrcweir
1157cdf0e10cSrcweir if (mxContentWindow.is())
1158cdf0e10cSrcweir {
1159cdf0e10cSrcweir const awt::Rectangle aBox (getBounds());
1160cdf0e10cSrcweir return rPoint.X>=aBox.X
1161cdf0e10cSrcweir && rPoint.Y>=aBox.Y
1162cdf0e10cSrcweir && rPoint.X<aBox.X+aBox.Width
1163cdf0e10cSrcweir && rPoint.Y<aBox.Y+aBox.Height;
1164cdf0e10cSrcweir }
1165cdf0e10cSrcweir else
1166cdf0e10cSrcweir return false;
1167cdf0e10cSrcweir }
1168cdf0e10cSrcweir
1169cdf0e10cSrcweir
1170cdf0e10cSrcweir
1171cdf0e10cSrcweir
1172cdf0e10cSrcweir Reference<XAccessible> SAL_CALL
getAccessibleAtPoint(const awt::Point & rPoint)1173cdf0e10cSrcweir PresenterAccessible::AccessibleObject::getAccessibleAtPoint (const awt::Point& rPoint)
1174cdf0e10cSrcweir throw (RuntimeException)
1175cdf0e10cSrcweir {
1176cdf0e10cSrcweir (void)rPoint;
1177cdf0e10cSrcweir ThrowIfDisposed();
1178cdf0e10cSrcweir
1179cdf0e10cSrcweir return Reference<XAccessible>();
1180cdf0e10cSrcweir }
1181cdf0e10cSrcweir
1182cdf0e10cSrcweir
1183cdf0e10cSrcweir
1184cdf0e10cSrcweir
getBounds(void)1185cdf0e10cSrcweir awt::Rectangle SAL_CALL PresenterAccessible::AccessibleObject::getBounds (void)
1186cdf0e10cSrcweir throw (RuntimeException)
1187cdf0e10cSrcweir {
1188cdf0e10cSrcweir ThrowIfDisposed();
1189cdf0e10cSrcweir
1190cdf0e10cSrcweir awt::Rectangle aBox;
1191cdf0e10cSrcweir
1192cdf0e10cSrcweir const awt::Point aLocation (GetRelativeLocation());
1193cdf0e10cSrcweir const awt::Size aSize (GetSize());
1194cdf0e10cSrcweir
1195cdf0e10cSrcweir return awt::Rectangle (aLocation.X, aLocation.Y, aSize.Width, aSize.Height);
1196cdf0e10cSrcweir }
1197cdf0e10cSrcweir
1198cdf0e10cSrcweir
1199cdf0e10cSrcweir
1200cdf0e10cSrcweir
getLocation(void)1201cdf0e10cSrcweir awt::Point SAL_CALL PresenterAccessible::AccessibleObject::getLocation (void)
1202cdf0e10cSrcweir throw (RuntimeException)
1203cdf0e10cSrcweir {
1204cdf0e10cSrcweir ThrowIfDisposed();
1205cdf0e10cSrcweir
1206cdf0e10cSrcweir const awt::Point aLocation (GetRelativeLocation());
1207cdf0e10cSrcweir
1208cdf0e10cSrcweir return aLocation;
1209cdf0e10cSrcweir }
1210cdf0e10cSrcweir
1211cdf0e10cSrcweir
1212cdf0e10cSrcweir
1213cdf0e10cSrcweir
getLocationOnScreen(void)1214cdf0e10cSrcweir awt::Point SAL_CALL PresenterAccessible::AccessibleObject::getLocationOnScreen (void)
1215cdf0e10cSrcweir throw (RuntimeException)
1216cdf0e10cSrcweir {
1217cdf0e10cSrcweir ThrowIfDisposed();
1218cdf0e10cSrcweir
1219cdf0e10cSrcweir awt::Point aRelativeLocation (GetRelativeLocation());
1220cdf0e10cSrcweir awt::Point aParentLocationOnScreen (GetAbsoluteParentLocation());
1221cdf0e10cSrcweir
1222cdf0e10cSrcweir return awt::Point(
1223cdf0e10cSrcweir aRelativeLocation.X + aParentLocationOnScreen.X,
1224cdf0e10cSrcweir aRelativeLocation.Y + aParentLocationOnScreen.Y);
1225cdf0e10cSrcweir }
1226cdf0e10cSrcweir
1227cdf0e10cSrcweir
1228cdf0e10cSrcweir
1229cdf0e10cSrcweir
getSize(void)1230cdf0e10cSrcweir awt::Size SAL_CALL PresenterAccessible::AccessibleObject::getSize (void)
1231cdf0e10cSrcweir throw (RuntimeException)
1232cdf0e10cSrcweir {
1233cdf0e10cSrcweir ThrowIfDisposed();
1234cdf0e10cSrcweir
1235cdf0e10cSrcweir const awt::Size aSize (GetSize());
1236cdf0e10cSrcweir
1237cdf0e10cSrcweir return aSize;
1238cdf0e10cSrcweir }
1239cdf0e10cSrcweir
1240cdf0e10cSrcweir
1241cdf0e10cSrcweir
1242cdf0e10cSrcweir
grabFocus(void)1243cdf0e10cSrcweir void SAL_CALL PresenterAccessible::AccessibleObject::grabFocus (void)
1244cdf0e10cSrcweir throw (RuntimeException)
1245cdf0e10cSrcweir {
1246cdf0e10cSrcweir ThrowIfDisposed();
1247cdf0e10cSrcweir if (mxBorderWindow.is())
1248cdf0e10cSrcweir mxBorderWindow->setFocus();
1249cdf0e10cSrcweir else if (mxContentWindow.is())
1250cdf0e10cSrcweir mxContentWindow->setFocus();
1251cdf0e10cSrcweir }
1252cdf0e10cSrcweir
1253cdf0e10cSrcweir
1254cdf0e10cSrcweir
1255cdf0e10cSrcweir
getForeground(void)1256cdf0e10cSrcweir sal_Int32 SAL_CALL PresenterAccessible::AccessibleObject::getForeground (void)
1257cdf0e10cSrcweir throw (RuntimeException)
1258cdf0e10cSrcweir {
1259cdf0e10cSrcweir ThrowIfDisposed();
1260cdf0e10cSrcweir
1261cdf0e10cSrcweir return 0x00ffffff;
1262cdf0e10cSrcweir }
1263cdf0e10cSrcweir
1264cdf0e10cSrcweir
1265cdf0e10cSrcweir
1266cdf0e10cSrcweir
getBackground(void)1267cdf0e10cSrcweir sal_Int32 SAL_CALL PresenterAccessible::AccessibleObject::getBackground (void)
1268cdf0e10cSrcweir throw (RuntimeException)
1269cdf0e10cSrcweir {
1270cdf0e10cSrcweir ThrowIfDisposed();
1271cdf0e10cSrcweir
1272cdf0e10cSrcweir return 0x00000000;
1273cdf0e10cSrcweir }
1274cdf0e10cSrcweir
1275cdf0e10cSrcweir
1276cdf0e10cSrcweir
1277cdf0e10cSrcweir
1278*aa9633e7Smseidel //----- XAccessibleEventBroadcaster ---------------------------------------
1279cdf0e10cSrcweir
addEventListener(const Reference<XAccessibleEventListener> & rxListener)1280cdf0e10cSrcweir void SAL_CALL PresenterAccessible::AccessibleObject::addEventListener (
1281cdf0e10cSrcweir const Reference<XAccessibleEventListener>& rxListener)
1282cdf0e10cSrcweir throw (RuntimeException)
1283cdf0e10cSrcweir {
1284cdf0e10cSrcweir if (rxListener.is())
1285cdf0e10cSrcweir {
1286cdf0e10cSrcweir const osl::MutexGuard aGuard(m_aMutex);
1287cdf0e10cSrcweir
1288cdf0e10cSrcweir if (IsDisposed())
1289cdf0e10cSrcweir {
1290cdf0e10cSrcweir uno::Reference<uno::XInterface> xThis (static_cast<XWeak*>(this), UNO_QUERY);
1291cdf0e10cSrcweir rxListener->disposing (lang::EventObject(xThis));
1292cdf0e10cSrcweir }
1293cdf0e10cSrcweir else
1294cdf0e10cSrcweir {
1295cdf0e10cSrcweir maListeners.push_back(rxListener);
1296cdf0e10cSrcweir }
1297cdf0e10cSrcweir }
1298cdf0e10cSrcweir }
1299cdf0e10cSrcweir
1300cdf0e10cSrcweir
1301cdf0e10cSrcweir
1302cdf0e10cSrcweir
removeEventListener(const Reference<XAccessibleEventListener> & rxListener)1303cdf0e10cSrcweir void SAL_CALL PresenterAccessible::AccessibleObject::removeEventListener (
1304cdf0e10cSrcweir const Reference<XAccessibleEventListener>& rxListener)
1305cdf0e10cSrcweir throw (RuntimeException)
1306cdf0e10cSrcweir {
1307cdf0e10cSrcweir ThrowIfDisposed();
1308cdf0e10cSrcweir if (rxListener.is())
1309cdf0e10cSrcweir {
1310cdf0e10cSrcweir const osl::MutexGuard aGuard(m_aMutex);
1311cdf0e10cSrcweir
1312cdf0e10cSrcweir maListeners.erase(std::remove(maListeners.begin(), maListeners.end(), rxListener));
1313cdf0e10cSrcweir }
1314cdf0e10cSrcweir }
1315cdf0e10cSrcweir
1316cdf0e10cSrcweir
1317cdf0e10cSrcweir
1318cdf0e10cSrcweir
1319cdf0e10cSrcweir //----- XWindowListener ---------------------------------------------------
1320cdf0e10cSrcweir
windowResized(const css::awt::WindowEvent & rEvent)1321cdf0e10cSrcweir void SAL_CALL PresenterAccessible::AccessibleObject::windowResized (
1322cdf0e10cSrcweir const css::awt::WindowEvent& rEvent)
1323cdf0e10cSrcweir throw (cssu::RuntimeException)
1324cdf0e10cSrcweir {
1325cdf0e10cSrcweir (void)rEvent;
1326cdf0e10cSrcweir
1327cdf0e10cSrcweir FireAccessibleEvent(AccessibleEventId::BOUNDRECT_CHANGED, Any(), Any());
1328cdf0e10cSrcweir }
1329cdf0e10cSrcweir
1330cdf0e10cSrcweir
1331cdf0e10cSrcweir
1332cdf0e10cSrcweir
windowMoved(const css::awt::WindowEvent & rEvent)1333cdf0e10cSrcweir void SAL_CALL PresenterAccessible::AccessibleObject::windowMoved (
1334cdf0e10cSrcweir const css::awt::WindowEvent& rEvent)
1335cdf0e10cSrcweir throw (cssu::RuntimeException)
1336cdf0e10cSrcweir {
1337cdf0e10cSrcweir (void)rEvent;
1338cdf0e10cSrcweir
1339cdf0e10cSrcweir FireAccessibleEvent(AccessibleEventId::BOUNDRECT_CHANGED, Any(), Any());
1340cdf0e10cSrcweir }
1341cdf0e10cSrcweir
1342cdf0e10cSrcweir
1343cdf0e10cSrcweir
1344cdf0e10cSrcweir
windowShown(const css::lang::EventObject & rEvent)1345cdf0e10cSrcweir void SAL_CALL PresenterAccessible::AccessibleObject::windowShown (
1346cdf0e10cSrcweir const css::lang::EventObject& rEvent)
1347cdf0e10cSrcweir throw (cssu::RuntimeException)
1348cdf0e10cSrcweir {
1349cdf0e10cSrcweir (void)rEvent;
1350cdf0e10cSrcweir UpdateStateSet();
1351cdf0e10cSrcweir }
1352cdf0e10cSrcweir
1353cdf0e10cSrcweir
1354cdf0e10cSrcweir
1355cdf0e10cSrcweir
windowHidden(const css::lang::EventObject & rEvent)1356cdf0e10cSrcweir void SAL_CALL PresenterAccessible::AccessibleObject::windowHidden (
1357cdf0e10cSrcweir const css::lang::EventObject& rEvent)
1358cdf0e10cSrcweir throw (cssu::RuntimeException)
1359cdf0e10cSrcweir {
1360cdf0e10cSrcweir (void)rEvent;
1361cdf0e10cSrcweir UpdateStateSet();
1362cdf0e10cSrcweir }
1363cdf0e10cSrcweir
1364cdf0e10cSrcweir
1365cdf0e10cSrcweir
1366cdf0e10cSrcweir
1367cdf0e10cSrcweir //----- XEventListener --------------------------------------------------------
1368cdf0e10cSrcweir
disposing(const css::lang::EventObject & rEvent)1369cdf0e10cSrcweir void SAL_CALL PresenterAccessible::AccessibleObject::disposing (const css::lang::EventObject& rEvent)
1370cdf0e10cSrcweir throw (cssu::RuntimeException)
1371cdf0e10cSrcweir {
1372cdf0e10cSrcweir if (rEvent.Source == mxContentWindow)
1373cdf0e10cSrcweir {
1374cdf0e10cSrcweir mxContentWindow = NULL;
1375cdf0e10cSrcweir mxBorderWindow = NULL;
1376cdf0e10cSrcweir }
1377cdf0e10cSrcweir else
1378cdf0e10cSrcweir {
1379cdf0e10cSrcweir SetWindow(NULL, NULL);
1380cdf0e10cSrcweir }
1381cdf0e10cSrcweir }
1382cdf0e10cSrcweir
1383cdf0e10cSrcweir
1384cdf0e10cSrcweir
1385cdf0e10cSrcweir
1386cdf0e10cSrcweir //----- private ---------------------------------------------------------------
1387cdf0e10cSrcweir
GetWindowState(const sal_Int16 nType) const1388cdf0e10cSrcweir bool PresenterAccessible::AccessibleObject::GetWindowState (const sal_Int16 nType) const
1389cdf0e10cSrcweir {
1390cdf0e10cSrcweir switch (nType)
1391cdf0e10cSrcweir {
1392cdf0e10cSrcweir case AccessibleStateType::ENABLED:
1393cdf0e10cSrcweir return mxContentWindow.is() && mxContentWindow->isEnabled();
1394cdf0e10cSrcweir
1395cdf0e10cSrcweir case AccessibleStateType::FOCUSABLE:
1396cdf0e10cSrcweir return true;
1397cdf0e10cSrcweir
1398cdf0e10cSrcweir case AccessibleStateType::FOCUSED:
1399cdf0e10cSrcweir return mbIsFocused;
1400cdf0e10cSrcweir
1401cdf0e10cSrcweir case AccessibleStateType::SHOWING:
1402cdf0e10cSrcweir return mxContentWindow.is() && mxContentWindow->isVisible();
1403cdf0e10cSrcweir
1404cdf0e10cSrcweir default:
1405cdf0e10cSrcweir return false;
1406cdf0e10cSrcweir }
1407cdf0e10cSrcweir }
1408cdf0e10cSrcweir
1409cdf0e10cSrcweir
1410cdf0e10cSrcweir
1411cdf0e10cSrcweir
UpdateStateSet(void)1412cdf0e10cSrcweir void PresenterAccessible::AccessibleObject::UpdateStateSet (void)
1413cdf0e10cSrcweir {
1414cdf0e10cSrcweir UpdateState(AccessibleStateType::FOCUSABLE, true);
1415cdf0e10cSrcweir UpdateState(AccessibleStateType::VISIBLE, true);
1416cdf0e10cSrcweir UpdateState(AccessibleStateType::ENABLED, true);
1417cdf0e10cSrcweir UpdateState(AccessibleStateType::MULTI_LINE, true);
1418cdf0e10cSrcweir UpdateState(AccessibleStateType::SENSITIVE, true);
1419cdf0e10cSrcweir
1420cdf0e10cSrcweir UpdateState(AccessibleStateType::ENABLED, GetWindowState(AccessibleStateType::ENABLED));
1421cdf0e10cSrcweir UpdateState(AccessibleStateType::FOCUSED, GetWindowState(AccessibleStateType::FOCUSED));
1422cdf0e10cSrcweir UpdateState(AccessibleStateType::SHOWING, GetWindowState(AccessibleStateType::SHOWING));
1423cdf0e10cSrcweir // UpdateState(AccessibleStateType::ACTIVE, GetWindowState(AccessibleStateType::ACTIVE));
1424cdf0e10cSrcweir }
1425cdf0e10cSrcweir
1426cdf0e10cSrcweir
1427cdf0e10cSrcweir
1428cdf0e10cSrcweir
UpdateState(const sal_Int16 nState,const bool bValue)1429cdf0e10cSrcweir void PresenterAccessible::AccessibleObject::UpdateState(
1430cdf0e10cSrcweir const sal_Int16 nState,
1431cdf0e10cSrcweir const bool bValue)
1432cdf0e10cSrcweir {
1433cdf0e10cSrcweir const sal_uInt32 nStateMask (AccessibleStateSet::GetStateMask(nState));
1434cdf0e10cSrcweir if (((mnStateSet & nStateMask)!=0) != bValue)
1435cdf0e10cSrcweir {
1436cdf0e10cSrcweir if (bValue)
1437cdf0e10cSrcweir {
1438cdf0e10cSrcweir mnStateSet |= nStateMask;
1439cdf0e10cSrcweir FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(), Any(nState));
1440cdf0e10cSrcweir }
1441cdf0e10cSrcweir else
1442cdf0e10cSrcweir {
1443cdf0e10cSrcweir mnStateSet &= ~nStateMask;
1444cdf0e10cSrcweir FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(nState), Any());
1445cdf0e10cSrcweir }
1446cdf0e10cSrcweir }
1447cdf0e10cSrcweir }
1448cdf0e10cSrcweir
1449cdf0e10cSrcweir
1450cdf0e10cSrcweir
1451cdf0e10cSrcweir
AddChild(const::rtl::Reference<AccessibleObject> & rpChild)1452cdf0e10cSrcweir void PresenterAccessible::AccessibleObject::AddChild (
1453cdf0e10cSrcweir const ::rtl::Reference<AccessibleObject>& rpChild)
1454cdf0e10cSrcweir {
1455cdf0e10cSrcweir maChildren.push_back(rpChild);
1456cdf0e10cSrcweir rpChild->SetAccessibleParent(this);
1457cdf0e10cSrcweir FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any());
1458cdf0e10cSrcweir }
1459cdf0e10cSrcweir
1460cdf0e10cSrcweir
1461cdf0e10cSrcweir
1462cdf0e10cSrcweir
RemoveChild(const::rtl::Reference<AccessibleObject> & rpChild)1463cdf0e10cSrcweir void PresenterAccessible::AccessibleObject::RemoveChild (
1464cdf0e10cSrcweir const ::rtl::Reference<AccessibleObject>& rpChild)
1465cdf0e10cSrcweir {
1466cdf0e10cSrcweir rpChild->SetAccessibleParent(Reference<XAccessible>());
1467cdf0e10cSrcweir maChildren.erase(::std::find(maChildren.begin(), maChildren.end(), rpChild));
1468cdf0e10cSrcweir FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any());
1469cdf0e10cSrcweir }
1470cdf0e10cSrcweir
1471cdf0e10cSrcweir
1472cdf0e10cSrcweir
1473cdf0e10cSrcweir
SetIsFocused(const bool bIsFocused)1474cdf0e10cSrcweir void PresenterAccessible::AccessibleObject::SetIsFocused (const bool bIsFocused)
1475cdf0e10cSrcweir {
1476cdf0e10cSrcweir if (mbIsFocused != bIsFocused)
1477cdf0e10cSrcweir {
1478cdf0e10cSrcweir mbIsFocused = bIsFocused;
1479cdf0e10cSrcweir UpdateStateSet();
1480cdf0e10cSrcweir }
1481cdf0e10cSrcweir }
1482cdf0e10cSrcweir
1483cdf0e10cSrcweir
1484cdf0e10cSrcweir
1485cdf0e10cSrcweir
SetAccessibleName(const::rtl::OUString & rsName)1486cdf0e10cSrcweir void PresenterAccessible::AccessibleObject::SetAccessibleName (const ::rtl::OUString& rsName)
1487cdf0e10cSrcweir {
1488cdf0e10cSrcweir if (msName != rsName)
1489cdf0e10cSrcweir {
1490cdf0e10cSrcweir const OUString sOldName(msName);
1491cdf0e10cSrcweir msName = rsName;
1492cdf0e10cSrcweir FireAccessibleEvent(AccessibleEventId::NAME_CHANGED, Any(sOldName), Any(msName));
1493cdf0e10cSrcweir }
1494cdf0e10cSrcweir }
1495cdf0e10cSrcweir
1496cdf0e10cSrcweir
1497cdf0e10cSrcweir
1498cdf0e10cSrcweir
FireAccessibleEvent(const sal_Int16 nEventId,const uno::Any & rOldValue,const uno::Any & rNewValue)1499cdf0e10cSrcweir void PresenterAccessible::AccessibleObject::FireAccessibleEvent (
1500cdf0e10cSrcweir const sal_Int16 nEventId,
1501cdf0e10cSrcweir const uno::Any& rOldValue,
1502cdf0e10cSrcweir const uno::Any& rNewValue )
1503cdf0e10cSrcweir {
1504cdf0e10cSrcweir AccessibleEventObject aEventObject;
1505cdf0e10cSrcweir
1506cdf0e10cSrcweir aEventObject.Source = Reference<XWeak>(this);
1507cdf0e10cSrcweir aEventObject.EventId = nEventId;
1508cdf0e10cSrcweir aEventObject.NewValue = rNewValue;
1509cdf0e10cSrcweir aEventObject.OldValue = rOldValue;
1510cdf0e10cSrcweir
1511cdf0e10cSrcweir ::std::vector<Reference<XAccessibleEventListener> > aListenerCopy(maListeners);
1512cdf0e10cSrcweir for (::std::vector<Reference<XAccessibleEventListener> >::const_iterator
1513cdf0e10cSrcweir iListener(aListenerCopy.begin()),
1514cdf0e10cSrcweir iEnd(aListenerCopy.end());
1515cdf0e10cSrcweir iListener!=iEnd;
1516cdf0e10cSrcweir ++iListener)
1517cdf0e10cSrcweir {
1518cdf0e10cSrcweir try
1519cdf0e10cSrcweir {
1520cdf0e10cSrcweir (*iListener)->notifyEvent(aEventObject);
1521cdf0e10cSrcweir }
1522cdf0e10cSrcweir catch(lang::DisposedException&)
1523cdf0e10cSrcweir {
1524cdf0e10cSrcweir // Listener has been disposed and should have been removed
1525cdf0e10cSrcweir // already.
1526cdf0e10cSrcweir removeEventListener(*iListener);
1527cdf0e10cSrcweir }
1528cdf0e10cSrcweir catch(Exception&)
1529cdf0e10cSrcweir {
1530cdf0e10cSrcweir // Ignore all other exceptions and assume that they are
1531cdf0e10cSrcweir // caused by a temporary problem.
1532cdf0e10cSrcweir }
1533cdf0e10cSrcweir }
1534cdf0e10cSrcweir }
1535cdf0e10cSrcweir
1536cdf0e10cSrcweir
1537cdf0e10cSrcweir
GetRelativeLocation(void)1538cdf0e10cSrcweir awt::Point PresenterAccessible::AccessibleObject::GetRelativeLocation (void)
1539cdf0e10cSrcweir {
1540cdf0e10cSrcweir awt::Point aLocation;
1541cdf0e10cSrcweir if (mxContentWindow.is())
1542cdf0e10cSrcweir {
1543cdf0e10cSrcweir const awt::Rectangle aContentBox (mxContentWindow->getPosSize());
1544cdf0e10cSrcweir aLocation.X = aContentBox.X;
1545cdf0e10cSrcweir aLocation.Y = aContentBox.Y;
1546cdf0e10cSrcweir if (mxBorderWindow.is())
1547cdf0e10cSrcweir {
1548cdf0e10cSrcweir const awt::Rectangle aBorderBox (mxBorderWindow->getPosSize());
1549cdf0e10cSrcweir aLocation.X += aBorderBox.X;
1550cdf0e10cSrcweir aLocation.Y += aBorderBox.Y;
1551cdf0e10cSrcweir }
1552cdf0e10cSrcweir }
1553cdf0e10cSrcweir return aLocation;
1554cdf0e10cSrcweir }
1555cdf0e10cSrcweir
1556cdf0e10cSrcweir
1557cdf0e10cSrcweir
1558cdf0e10cSrcweir
GetSize(void)1559cdf0e10cSrcweir awt::Size PresenterAccessible::AccessibleObject::GetSize (void)
1560cdf0e10cSrcweir {
1561cdf0e10cSrcweir if (mxContentWindow.is())
1562cdf0e10cSrcweir {
1563cdf0e10cSrcweir const awt::Rectangle aBox (mxContentWindow->getPosSize());
1564cdf0e10cSrcweir return awt::Size(aBox.Width, aBox.Height);
1565cdf0e10cSrcweir }
1566cdf0e10cSrcweir else
1567cdf0e10cSrcweir return awt::Size();
1568cdf0e10cSrcweir }
1569cdf0e10cSrcweir
1570cdf0e10cSrcweir
1571cdf0e10cSrcweir
1572cdf0e10cSrcweir
GetAbsoluteParentLocation(void)1573cdf0e10cSrcweir awt::Point PresenterAccessible::AccessibleObject::GetAbsoluteParentLocation (void)
1574cdf0e10cSrcweir {
1575cdf0e10cSrcweir Reference<XAccessibleComponent> xParentComponent;
1576cdf0e10cSrcweir if (mxParentAccessible.is())
1577cdf0e10cSrcweir xParentComponent = Reference<XAccessibleComponent>(
1578cdf0e10cSrcweir mxParentAccessible->getAccessibleContext(), UNO_QUERY);
1579cdf0e10cSrcweir if (xParentComponent.is())
1580cdf0e10cSrcweir return xParentComponent->getLocationOnScreen();
1581cdf0e10cSrcweir else
1582cdf0e10cSrcweir return awt::Point();
1583cdf0e10cSrcweir }
1584cdf0e10cSrcweir
1585cdf0e10cSrcweir
1586cdf0e10cSrcweir
1587cdf0e10cSrcweir
IsDisposed(void) const1588cdf0e10cSrcweir sal_Bool PresenterAccessible::AccessibleObject::IsDisposed (void) const
1589cdf0e10cSrcweir {
1590cdf0e10cSrcweir return (rBHelper.bDisposed || rBHelper.bInDispose);
1591cdf0e10cSrcweir }
1592cdf0e10cSrcweir
1593cdf0e10cSrcweir
1594cdf0e10cSrcweir
1595cdf0e10cSrcweir
ThrowIfDisposed(void) const1596cdf0e10cSrcweir void PresenterAccessible::AccessibleObject::ThrowIfDisposed (void) const
1597cdf0e10cSrcweir throw (lang::DisposedException)
1598cdf0e10cSrcweir {
1599cdf0e10cSrcweir if (rBHelper.bDisposed || rBHelper.bInDispose)
1600cdf0e10cSrcweir ThrowException("object has already been disposed", ET_Disposed);
1601cdf0e10cSrcweir }
1602cdf0e10cSrcweir
1603cdf0e10cSrcweir
1604cdf0e10cSrcweir
1605cdf0e10cSrcweir
ThrowException(const sal_Char * pMessage,const ExceptionType eExceptionType) const1606cdf0e10cSrcweir void PresenterAccessible::AccessibleObject::ThrowException (
1607cdf0e10cSrcweir const sal_Char* pMessage,
1608cdf0e10cSrcweir const ExceptionType eExceptionType) const
1609cdf0e10cSrcweir {
1610cdf0e10cSrcweir const OUString sMessage (OUString(A2S("PresenterAccessible: ")) + OUString(A2S(pMessage)));
1611cdf0e10cSrcweir const Reference<XInterface> xObject (
1612cdf0e10cSrcweir const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
1613cdf0e10cSrcweir switch (eExceptionType)
1614cdf0e10cSrcweir {
1615cdf0e10cSrcweir default:
1616cdf0e10cSrcweir case ET_Runtime:
1617cdf0e10cSrcweir throw RuntimeException(sMessage, xObject);
1618cdf0e10cSrcweir case ET_Disposed:
1619cdf0e10cSrcweir throw lang::DisposedException(sMessage, xObject);
1620cdf0e10cSrcweir case ET_IndexOutOfBounds:
1621cdf0e10cSrcweir throw lang::IndexOutOfBoundsException(sMessage, xObject);
1622cdf0e10cSrcweir }
1623cdf0e10cSrcweir }
1624cdf0e10cSrcweir
1625cdf0e10cSrcweir
1626cdf0e10cSrcweir
1627cdf0e10cSrcweir
1628cdf0e10cSrcweir
1629cdf0e10cSrcweir //===== AccessibleStateSet ====================================================
1630cdf0e10cSrcweir
AccessibleStateSet(const sal_Int32 nStateSet)1631cdf0e10cSrcweir AccessibleStateSet::AccessibleStateSet (const sal_Int32 nStateSet)
1632cdf0e10cSrcweir : AccessibleStateSetInterfaceBase(m_aMutex),
1633cdf0e10cSrcweir mnStateSet (nStateSet)
1634cdf0e10cSrcweir {
1635cdf0e10cSrcweir }
1636cdf0e10cSrcweir
1637cdf0e10cSrcweir
1638cdf0e10cSrcweir
1639cdf0e10cSrcweir
~AccessibleStateSet(void)1640cdf0e10cSrcweir AccessibleStateSet::~AccessibleStateSet (void)
1641cdf0e10cSrcweir {
1642cdf0e10cSrcweir }
1643cdf0e10cSrcweir
1644cdf0e10cSrcweir
1645cdf0e10cSrcweir
1646cdf0e10cSrcweir
GetStateMask(const sal_Int16 nState)1647cdf0e10cSrcweir sal_uInt32 AccessibleStateSet::GetStateMask (const sal_Int16 nState)
1648cdf0e10cSrcweir {
1649cdf0e10cSrcweir if (nState<0 || nState>=sal_Int16(sizeof(sal_uInt32)*8))
1650cdf0e10cSrcweir {
1651cdf0e10cSrcweir throw RuntimeException(A2S("AccessibleStateSet::GetStateMask: invalid state"), NULL);
1652cdf0e10cSrcweir }
1653cdf0e10cSrcweir
1654cdf0e10cSrcweir return 1<<nState;
1655cdf0e10cSrcweir }
1656cdf0e10cSrcweir
1657cdf0e10cSrcweir
1658cdf0e10cSrcweir
1659cdf0e10cSrcweir
1660cdf0e10cSrcweir //----- XAccessibleStateSet ---------------------------------------------------
1661cdf0e10cSrcweir
isEmpty(void)1662cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleStateSet::isEmpty (void)
1663cdf0e10cSrcweir throw (cssu::RuntimeException)
1664cdf0e10cSrcweir {
1665cdf0e10cSrcweir return mnStateSet==0;
1666cdf0e10cSrcweir }
1667cdf0e10cSrcweir
1668cdf0e10cSrcweir
1669cdf0e10cSrcweir
1670cdf0e10cSrcweir
contains(sal_Int16 nState)1671cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleStateSet::contains (sal_Int16 nState)
1672cdf0e10cSrcweir throw (cssu::RuntimeException)
1673cdf0e10cSrcweir {
1674cdf0e10cSrcweir return (mnStateSet & GetStateMask(nState)) != 0;
1675cdf0e10cSrcweir }
1676cdf0e10cSrcweir
1677cdf0e10cSrcweir
1678cdf0e10cSrcweir
1679cdf0e10cSrcweir
containsAll(const cssu::Sequence<sal_Int16> & rStateSet)1680cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleStateSet::containsAll (const cssu::Sequence<sal_Int16>& rStateSet)
1681cdf0e10cSrcweir throw (cssu::RuntimeException)
1682cdf0e10cSrcweir {
1683cdf0e10cSrcweir for (sal_Int32 nIndex=0,nCount=rStateSet.getLength(); nIndex<nCount; ++nIndex)
1684cdf0e10cSrcweir {
1685cdf0e10cSrcweir if ((mnStateSet & GetStateMask(rStateSet[nIndex])) == 0)
1686cdf0e10cSrcweir return sal_False;
1687cdf0e10cSrcweir }
1688cdf0e10cSrcweir return sal_True;
1689cdf0e10cSrcweir }
1690cdf0e10cSrcweir
1691cdf0e10cSrcweir
1692cdf0e10cSrcweir
1693cdf0e10cSrcweir
getStates(void)1694cdf0e10cSrcweir cssu::Sequence<sal_Int16> SAL_CALL AccessibleStateSet::getStates (void)
1695cdf0e10cSrcweir throw (cssu::RuntimeException)
1696cdf0e10cSrcweir {
1697cdf0e10cSrcweir ::std::vector<sal_Int16> aStates;
1698cdf0e10cSrcweir aStates.reserve(sizeof(mnStateSet)*8);
1699cdf0e10cSrcweir for (sal_uInt16 nIndex=0; nIndex<sizeof(mnStateSet)*8; ++nIndex)
1700cdf0e10cSrcweir if ((mnStateSet & GetStateMask(nIndex)) != 0)
1701cdf0e10cSrcweir aStates.push_back(nIndex);
1702cdf0e10cSrcweir return Sequence<sal_Int16>(&aStates.front(), aStates.size());
1703cdf0e10cSrcweir }
1704cdf0e10cSrcweir
1705cdf0e10cSrcweir
1706cdf0e10cSrcweir
1707cdf0e10cSrcweir
1708cdf0e10cSrcweir //===== AccessibleRelationSet =================================================
1709cdf0e10cSrcweir
AccessibleRelationSet(void)1710cdf0e10cSrcweir AccessibleRelationSet::AccessibleRelationSet (void)
1711cdf0e10cSrcweir : AccessibleRelationSetInterfaceBase(m_aMutex),
1712cdf0e10cSrcweir maRelations()
1713cdf0e10cSrcweir {
1714cdf0e10cSrcweir }
1715cdf0e10cSrcweir
1716cdf0e10cSrcweir
1717cdf0e10cSrcweir
1718cdf0e10cSrcweir
~AccessibleRelationSet(void)1719cdf0e10cSrcweir AccessibleRelationSet::~AccessibleRelationSet (void)
1720cdf0e10cSrcweir {
1721cdf0e10cSrcweir }
1722cdf0e10cSrcweir
1723cdf0e10cSrcweir
1724cdf0e10cSrcweir
1725cdf0e10cSrcweir
AddRelation(const sal_Int16 nRelationType,const Reference<XInterface> & rxObject)1726cdf0e10cSrcweir void AccessibleRelationSet::AddRelation (
1727cdf0e10cSrcweir const sal_Int16 nRelationType,
1728cdf0e10cSrcweir const Reference<XInterface>& rxObject)
1729cdf0e10cSrcweir {
1730cdf0e10cSrcweir maRelations.resize(maRelations.size()+1);
1731cdf0e10cSrcweir maRelations.back().RelationType = nRelationType;
1732cdf0e10cSrcweir maRelations.back().TargetSet.realloc(1);
1733cdf0e10cSrcweir maRelations.back().TargetSet[0] = rxObject;
1734cdf0e10cSrcweir }
1735cdf0e10cSrcweir
1736cdf0e10cSrcweir
1737cdf0e10cSrcweir
1738cdf0e10cSrcweir
1739cdf0e10cSrcweir //----- XAccessibleRelationSet ------------------------------------------------
1740cdf0e10cSrcweir
getRelationCount(void)1741cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleRelationSet::getRelationCount (void)
1742cdf0e10cSrcweir throw (cssu::RuntimeException)
1743cdf0e10cSrcweir {
1744cdf0e10cSrcweir return maRelations.size();
1745cdf0e10cSrcweir }
1746cdf0e10cSrcweir
1747cdf0e10cSrcweir
1748cdf0e10cSrcweir
1749cdf0e10cSrcweir
getRelation(sal_Int32 nIndex)1750cdf0e10cSrcweir AccessibleRelation SAL_CALL AccessibleRelationSet::getRelation (sal_Int32 nIndex)
1751cdf0e10cSrcweir throw (cssu::RuntimeException, css::lang::IndexOutOfBoundsException)
1752cdf0e10cSrcweir {
1753cdf0e10cSrcweir if (nIndex<0 && sal_uInt32(nIndex)>=maRelations.size())
1754cdf0e10cSrcweir return AccessibleRelation();
1755cdf0e10cSrcweir else
1756cdf0e10cSrcweir return maRelations[nIndex];
1757cdf0e10cSrcweir }
1758cdf0e10cSrcweir
1759cdf0e10cSrcweir
1760cdf0e10cSrcweir
1761cdf0e10cSrcweir
containsRelation(sal_Int16 nRelationType)1762cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleRelationSet::containsRelation (sal_Int16 nRelationType)
1763cdf0e10cSrcweir throw (cssu::RuntimeException)
1764cdf0e10cSrcweir {
1765cdf0e10cSrcweir for (::std::vector<AccessibleRelation>::const_iterator iRelation(maRelations.begin());
1766cdf0e10cSrcweir iRelation!=maRelations.end();
1767cdf0e10cSrcweir ++iRelation)
1768cdf0e10cSrcweir {
1769cdf0e10cSrcweir if (iRelation->RelationType == nRelationType)
1770cdf0e10cSrcweir return sal_True;
1771cdf0e10cSrcweir }
1772cdf0e10cSrcweir return sal_False;
1773cdf0e10cSrcweir }
1774cdf0e10cSrcweir
1775cdf0e10cSrcweir
1776cdf0e10cSrcweir
1777cdf0e10cSrcweir
getRelationByType(sal_Int16 nRelationType)1778cdf0e10cSrcweir AccessibleRelation SAL_CALL AccessibleRelationSet::getRelationByType (sal_Int16 nRelationType)
1779cdf0e10cSrcweir throw (cssu::RuntimeException)
1780cdf0e10cSrcweir {
1781cdf0e10cSrcweir for (::std::vector<AccessibleRelation>::const_iterator iRelation(maRelations.begin());
1782cdf0e10cSrcweir iRelation!=maRelations.end();
1783cdf0e10cSrcweir ++iRelation)
1784cdf0e10cSrcweir {
1785cdf0e10cSrcweir if (iRelation->RelationType == nRelationType)
1786cdf0e10cSrcweir return *iRelation;
1787cdf0e10cSrcweir }
1788cdf0e10cSrcweir return AccessibleRelation();
1789cdf0e10cSrcweir }
1790cdf0e10cSrcweir
1791cdf0e10cSrcweir
1792cdf0e10cSrcweir
1793cdf0e10cSrcweir
1794cdf0e10cSrcweir //===== PresenterAccessible::AccessibleParagraph ==============================
1795cdf0e10cSrcweir
AccessibleParagraph(const lang::Locale aLocale,const sal_Int16 nRole,const OUString & rsName,const SharedPresenterTextParagraph & rpParagraph,const sal_Int32 nParagraphIndex)1796cdf0e10cSrcweir PresenterAccessible::AccessibleParagraph::AccessibleParagraph (
1797cdf0e10cSrcweir const lang::Locale aLocale,
1798cdf0e10cSrcweir const sal_Int16 nRole,
1799cdf0e10cSrcweir const OUString& rsName,
1800cdf0e10cSrcweir const SharedPresenterTextParagraph& rpParagraph,
1801cdf0e10cSrcweir const sal_Int32 nParagraphIndex)
1802cdf0e10cSrcweir : PresenterAccessibleParagraphInterfaceBase(aLocale, nRole, rsName),
1803cdf0e10cSrcweir mpParagraph(rpParagraph),
1804cdf0e10cSrcweir mnParagraphIndex(nParagraphIndex)
1805cdf0e10cSrcweir {
1806cdf0e10cSrcweir }
1807cdf0e10cSrcweir
1808cdf0e10cSrcweir
1809cdf0e10cSrcweir
1810cdf0e10cSrcweir
~AccessibleParagraph(void)1811cdf0e10cSrcweir PresenterAccessible::AccessibleParagraph::~AccessibleParagraph (void)
1812cdf0e10cSrcweir {
1813cdf0e10cSrcweir }
1814cdf0e10cSrcweir
1815cdf0e10cSrcweir
1816cdf0e10cSrcweir
1817cdf0e10cSrcweir
1818cdf0e10cSrcweir //----- XAccessibleContext ----------------------------------------------------
1819cdf0e10cSrcweir
1820cdf0e10cSrcweir Reference<XAccessibleRelationSet> SAL_CALL
getAccessibleRelationSet(void)1821cdf0e10cSrcweir PresenterAccessible::AccessibleParagraph::getAccessibleRelationSet (void)
1822cdf0e10cSrcweir throw (RuntimeException)
1823cdf0e10cSrcweir {
1824cdf0e10cSrcweir ThrowIfDisposed();
1825cdf0e10cSrcweir
1826cdf0e10cSrcweir rtl::Reference<AccessibleRelationSet> pSet (new AccessibleRelationSet);
1827cdf0e10cSrcweir
1828cdf0e10cSrcweir if (mxParentAccessible.is())
1829cdf0e10cSrcweir {
1830cdf0e10cSrcweir Reference<XAccessibleContext> xParentContext (mxParentAccessible->getAccessibleContext());
1831cdf0e10cSrcweir if (xParentContext.is())
1832cdf0e10cSrcweir {
1833cdf0e10cSrcweir if (mnParagraphIndex>0)
1834cdf0e10cSrcweir pSet->AddRelation(
1835cdf0e10cSrcweir AccessibleRelationType::CONTENT_FLOWS_FROM,
1836cdf0e10cSrcweir xParentContext->getAccessibleChild(mnParagraphIndex-1));
1837cdf0e10cSrcweir
1838cdf0e10cSrcweir if (mnParagraphIndex<xParentContext->getAccessibleChildCount()-1)
1839cdf0e10cSrcweir pSet->AddRelation(
1840cdf0e10cSrcweir AccessibleRelationType::CONTENT_FLOWS_TO,
1841cdf0e10cSrcweir xParentContext->getAccessibleChild(mnParagraphIndex+1));
1842cdf0e10cSrcweir }
1843cdf0e10cSrcweir }
1844cdf0e10cSrcweir
1845cdf0e10cSrcweir return Reference<XAccessibleRelationSet>(pSet.get());
1846cdf0e10cSrcweir }
1847cdf0e10cSrcweir
1848cdf0e10cSrcweir
1849cdf0e10cSrcweir
1850cdf0e10cSrcweir
1851cdf0e10cSrcweir
1852cdf0e10cSrcweir
1853cdf0e10cSrcweir //----- XAccessibleText -------------------------------------------------------
1854cdf0e10cSrcweir
getCaretPosition(void)1855cdf0e10cSrcweir sal_Int32 SAL_CALL PresenterAccessible::AccessibleParagraph::getCaretPosition (void)
1856cdf0e10cSrcweir throw (cssu::RuntimeException)
1857cdf0e10cSrcweir {
1858cdf0e10cSrcweir ThrowIfDisposed();
1859cdf0e10cSrcweir
1860cdf0e10cSrcweir sal_Int32 nPosition (-1);
1861cdf0e10cSrcweir if (mpParagraph)
1862cdf0e10cSrcweir nPosition = mpParagraph->GetCaretPosition();
1863cdf0e10cSrcweir
1864cdf0e10cSrcweir return nPosition;
1865cdf0e10cSrcweir }
1866cdf0e10cSrcweir
1867cdf0e10cSrcweir
1868cdf0e10cSrcweir
1869cdf0e10cSrcweir
setCaretPosition(sal_Int32 nIndex)1870cdf0e10cSrcweir sal_Bool SAL_CALL PresenterAccessible::AccessibleParagraph::setCaretPosition (sal_Int32 nIndex)
1871cdf0e10cSrcweir throw (::com::sun::star::lang::IndexOutOfBoundsException, cssu::RuntimeException)
1872cdf0e10cSrcweir {
1873cdf0e10cSrcweir ThrowIfDisposed();
1874cdf0e10cSrcweir
1875cdf0e10cSrcweir if (mpParagraph)
1876cdf0e10cSrcweir {
1877cdf0e10cSrcweir mpParagraph->SetCaretPosition(nIndex);
1878cdf0e10cSrcweir return sal_True;
1879cdf0e10cSrcweir }
1880cdf0e10cSrcweir else
1881cdf0e10cSrcweir return sal_False;
1882cdf0e10cSrcweir }
1883cdf0e10cSrcweir
1884cdf0e10cSrcweir
1885cdf0e10cSrcweir
1886cdf0e10cSrcweir
getCharacter(sal_Int32 nIndex)1887cdf0e10cSrcweir sal_Unicode SAL_CALL PresenterAccessible::AccessibleParagraph::getCharacter (sal_Int32 nIndex)
1888cdf0e10cSrcweir throw (::com::sun::star::lang::IndexOutOfBoundsException, cssu::RuntimeException)
1889cdf0e10cSrcweir {
1890cdf0e10cSrcweir ThrowIfDisposed();
1891cdf0e10cSrcweir
1892cdf0e10cSrcweir if (mpParagraph)
1893cdf0e10cSrcweir return mpParagraph->GetCharacter(nIndex);
1894cdf0e10cSrcweir else
1895cdf0e10cSrcweir {
1896cdf0e10cSrcweir ThrowException("no text support in current mode", ET_IndexOutOfBounds);
1897cdf0e10cSrcweir // The method above throws an exception and the following line is
1898cdf0e10cSrcweir // never reached. But there is at least one compiler that can not
1899cdf0e10cSrcweir // detect this and we need the return to make it happy.
1900cdf0e10cSrcweir return sal_Unicode();
1901cdf0e10cSrcweir }
1902cdf0e10cSrcweir }
1903cdf0e10cSrcweir
1904cdf0e10cSrcweir
1905cdf0e10cSrcweir
1906cdf0e10cSrcweir
1907cdf0e10cSrcweir Sequence<css::beans::PropertyValue> SAL_CALL
getCharacterAttributes(::sal_Int32 nIndex,const cssu::Sequence<rtl::OUString> & rRequestedAttributes)1908cdf0e10cSrcweir PresenterAccessible::AccessibleParagraph::getCharacterAttributes (
1909cdf0e10cSrcweir ::sal_Int32 nIndex,
1910cdf0e10cSrcweir const cssu::Sequence<rtl::OUString>& rRequestedAttributes)
1911cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException)
1912cdf0e10cSrcweir {
1913cdf0e10cSrcweir ThrowIfDisposed();
1914cdf0e10cSrcweir
1915cdf0e10cSrcweir #ifdef VERBOSE
1916cdf0e10cSrcweir OSL_TRACE("PresenterAccessible::AccessibleParagraph::getCharacterAttributes at %x,%d returns empty set\r",
1917cdf0e10cSrcweir this,nIndex);
1918cdf0e10cSrcweir for (sal_Int32 nAttributeIndex(0),nAttributeCount(rRequestedAttributes.getLength());
1919cdf0e10cSrcweir nAttributeIndex<nAttributeCount;
1920cdf0e10cSrcweir ++nAttributeIndex)
1921cdf0e10cSrcweir {
1922cdf0e10cSrcweir OSL_TRACE(" requested attribute %d is %s\r",
1923cdf0e10cSrcweir nAttributeIndex,
1924cdf0e10cSrcweir OUStringToOString(rRequestedAttributes[nAttributeIndex], RTL_TEXTENCODING_UTF8).getStr());
1925cdf0e10cSrcweir }
1926cdf0e10cSrcweir #endif
1927cdf0e10cSrcweir
1928cdf0e10cSrcweir // Character properties are not supported.
1929cdf0e10cSrcweir (void)nIndex;
1930cdf0e10cSrcweir (void)rRequestedAttributes;
1931cdf0e10cSrcweir return Sequence<css::beans::PropertyValue>();
1932cdf0e10cSrcweir }
1933cdf0e10cSrcweir
1934cdf0e10cSrcweir
1935cdf0e10cSrcweir
1936cdf0e10cSrcweir
getCharacterBounds(sal_Int32 nIndex)1937cdf0e10cSrcweir awt::Rectangle SAL_CALL PresenterAccessible::AccessibleParagraph::getCharacterBounds (
1938cdf0e10cSrcweir sal_Int32 nIndex)
1939cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException)
1940cdf0e10cSrcweir {
1941cdf0e10cSrcweir ThrowIfDisposed();
1942cdf0e10cSrcweir
1943cdf0e10cSrcweir awt::Rectangle aCharacterBox;
1944cdf0e10cSrcweir if (nIndex < 0)
1945cdf0e10cSrcweir {
1946cdf0e10cSrcweir ThrowException("invalid text index", ET_IndexOutOfBounds);
1947cdf0e10cSrcweir }
1948cdf0e10cSrcweir else if (mpParagraph)
1949cdf0e10cSrcweir {
1950cdf0e10cSrcweir aCharacterBox = mpParagraph->GetCharacterBounds(nIndex, false);
1951cdf0e10cSrcweir // Convert coordinates relative to the window origin into absolute
1952cdf0e10cSrcweir // screen coordinates.
1953cdf0e10cSrcweir const awt::Point aWindowLocationOnScreen (getLocationOnScreen());
1954cdf0e10cSrcweir aCharacterBox.X += aWindowLocationOnScreen.X;
1955cdf0e10cSrcweir aCharacterBox.Y += aWindowLocationOnScreen.Y;
1956cdf0e10cSrcweir }
1957cdf0e10cSrcweir else
1958cdf0e10cSrcweir {
1959cdf0e10cSrcweir ThrowException("no text support in current mode", ET_IndexOutOfBounds);
1960cdf0e10cSrcweir }
1961cdf0e10cSrcweir
1962cdf0e10cSrcweir return aCharacterBox;
1963cdf0e10cSrcweir }
1964cdf0e10cSrcweir
1965cdf0e10cSrcweir
1966cdf0e10cSrcweir
1967cdf0e10cSrcweir
getCharacterCount(void)1968cdf0e10cSrcweir sal_Int32 SAL_CALL PresenterAccessible::AccessibleParagraph::getCharacterCount (void)
1969cdf0e10cSrcweir throw (cssu::RuntimeException)
1970cdf0e10cSrcweir {
1971cdf0e10cSrcweir ThrowIfDisposed();
1972cdf0e10cSrcweir
1973cdf0e10cSrcweir sal_Int32 nCount (0);
1974cdf0e10cSrcweir if (mpParagraph)
1975cdf0e10cSrcweir nCount = mpParagraph->GetCharacterCount();
1976cdf0e10cSrcweir
1977cdf0e10cSrcweir return nCount;
1978cdf0e10cSrcweir }
1979cdf0e10cSrcweir
1980cdf0e10cSrcweir
1981cdf0e10cSrcweir
1982cdf0e10cSrcweir
getIndexAtPoint(const css::awt::Point & rPoint)1983cdf0e10cSrcweir sal_Int32 SAL_CALL PresenterAccessible::AccessibleParagraph::getIndexAtPoint (
1984cdf0e10cSrcweir const css::awt::Point& rPoint)
1985cdf0e10cSrcweir throw (cssu::RuntimeException)
1986cdf0e10cSrcweir {
1987cdf0e10cSrcweir ThrowIfDisposed();
1988cdf0e10cSrcweir
1989cdf0e10cSrcweir sal_Int32 nIndex (-1);
1990cdf0e10cSrcweir if (mpParagraph)
1991cdf0e10cSrcweir nIndex = mpParagraph->GetIndexAtPoint(rPoint);
1992cdf0e10cSrcweir
1993cdf0e10cSrcweir return nIndex;
1994cdf0e10cSrcweir }
1995cdf0e10cSrcweir
1996cdf0e10cSrcweir
1997cdf0e10cSrcweir
1998cdf0e10cSrcweir
getSelectedText(void)1999cdf0e10cSrcweir ::rtl::OUString SAL_CALL PresenterAccessible::AccessibleParagraph::getSelectedText (void)
2000cdf0e10cSrcweir throw (cssu::RuntimeException)
2001cdf0e10cSrcweir {
2002cdf0e10cSrcweir ThrowIfDisposed();
2003cdf0e10cSrcweir
2004cdf0e10cSrcweir return getTextRange(getSelectionStart(), getSelectionEnd());
2005cdf0e10cSrcweir }
2006cdf0e10cSrcweir
2007cdf0e10cSrcweir
2008cdf0e10cSrcweir
2009cdf0e10cSrcweir
getSelectionStart(void)2010cdf0e10cSrcweir sal_Int32 SAL_CALL PresenterAccessible::AccessibleParagraph::getSelectionStart (void)
2011cdf0e10cSrcweir throw (cssu::RuntimeException)
2012cdf0e10cSrcweir {
2013cdf0e10cSrcweir ThrowIfDisposed();
2014cdf0e10cSrcweir
2015cdf0e10cSrcweir return getCaretPosition();
2016cdf0e10cSrcweir }
2017cdf0e10cSrcweir
2018cdf0e10cSrcweir
2019cdf0e10cSrcweir
2020cdf0e10cSrcweir
getSelectionEnd(void)2021cdf0e10cSrcweir sal_Int32 SAL_CALL PresenterAccessible::AccessibleParagraph::getSelectionEnd (void)
2022cdf0e10cSrcweir throw (cssu::RuntimeException)
2023cdf0e10cSrcweir {
2024cdf0e10cSrcweir ThrowIfDisposed();
2025cdf0e10cSrcweir
2026cdf0e10cSrcweir return getCaretPosition();
2027cdf0e10cSrcweir }
2028cdf0e10cSrcweir
2029cdf0e10cSrcweir
2030cdf0e10cSrcweir
2031cdf0e10cSrcweir
setSelection(sal_Int32 nStartIndex,sal_Int32 nEndIndex)2032cdf0e10cSrcweir sal_Bool SAL_CALL PresenterAccessible::AccessibleParagraph::setSelection (
2033cdf0e10cSrcweir sal_Int32 nStartIndex,
2034cdf0e10cSrcweir sal_Int32 nEndIndex)
2035cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException)
2036cdf0e10cSrcweir {
2037cdf0e10cSrcweir (void)nEndIndex;
2038cdf0e10cSrcweir ThrowIfDisposed();
2039cdf0e10cSrcweir
2040cdf0e10cSrcweir return setCaretPosition(nStartIndex);
2041cdf0e10cSrcweir }
2042cdf0e10cSrcweir
2043cdf0e10cSrcweir
2044cdf0e10cSrcweir
2045cdf0e10cSrcweir
getText(void)2046cdf0e10cSrcweir ::rtl::OUString SAL_CALL PresenterAccessible::AccessibleParagraph::getText (void)
2047cdf0e10cSrcweir throw (cssu::RuntimeException)
2048cdf0e10cSrcweir {
2049cdf0e10cSrcweir ThrowIfDisposed();
2050cdf0e10cSrcweir
2051cdf0e10cSrcweir ::rtl::OUString sText;
2052cdf0e10cSrcweir if (mpParagraph)
2053cdf0e10cSrcweir sText = mpParagraph->GetText();
2054cdf0e10cSrcweir
2055cdf0e10cSrcweir return sText;
2056cdf0e10cSrcweir }
2057cdf0e10cSrcweir
2058cdf0e10cSrcweir
2059cdf0e10cSrcweir
2060cdf0e10cSrcweir
getTextRange(sal_Int32 nLocalStartIndex,sal_Int32 nLocalEndIndex)2061cdf0e10cSrcweir ::rtl::OUString SAL_CALL PresenterAccessible::AccessibleParagraph::getTextRange (
2062cdf0e10cSrcweir sal_Int32 nLocalStartIndex,
2063cdf0e10cSrcweir sal_Int32 nLocalEndIndex)
2064cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException)
2065cdf0e10cSrcweir {
2066cdf0e10cSrcweir ThrowIfDisposed();
2067cdf0e10cSrcweir
2068cdf0e10cSrcweir ::rtl::OUString sText;
2069cdf0e10cSrcweir if (mpParagraph)
2070cdf0e10cSrcweir {
2071cdf0e10cSrcweir const TextSegment aSegment (
2072cdf0e10cSrcweir mpParagraph->CreateTextSegment(nLocalStartIndex, nLocalEndIndex));
2073cdf0e10cSrcweir sText = aSegment.SegmentText;
2074cdf0e10cSrcweir }
2075cdf0e10cSrcweir
2076cdf0e10cSrcweir return sText;
2077cdf0e10cSrcweir }
2078cdf0e10cSrcweir
2079cdf0e10cSrcweir
2080cdf0e10cSrcweir
2081cdf0e10cSrcweir
getTextAtIndex(sal_Int32 nLocalCharacterIndex,sal_Int16 nTextType)2082cdf0e10cSrcweir TextSegment SAL_CALL PresenterAccessible::AccessibleParagraph::getTextAtIndex (
2083cdf0e10cSrcweir sal_Int32 nLocalCharacterIndex,
2084cdf0e10cSrcweir sal_Int16 nTextType)
2085cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException,
2086cdf0e10cSrcweir css::lang::IllegalArgumentException,
2087cdf0e10cSrcweir cssu::RuntimeException)
2088cdf0e10cSrcweir {
2089cdf0e10cSrcweir ThrowIfDisposed();
2090cdf0e10cSrcweir
2091cdf0e10cSrcweir TextSegment aSegment;
2092cdf0e10cSrcweir if (mpParagraph)
2093cdf0e10cSrcweir aSegment = mpParagraph->GetTextSegment(0, nLocalCharacterIndex, nTextType);
2094cdf0e10cSrcweir
2095cdf0e10cSrcweir return aSegment;
2096cdf0e10cSrcweir }
2097cdf0e10cSrcweir
2098cdf0e10cSrcweir
2099cdf0e10cSrcweir
2100cdf0e10cSrcweir
getTextBeforeIndex(sal_Int32 nLocalCharacterIndex,sal_Int16 nTextType)2101cdf0e10cSrcweir TextSegment SAL_CALL PresenterAccessible::AccessibleParagraph::getTextBeforeIndex (
2102cdf0e10cSrcweir sal_Int32 nLocalCharacterIndex,
2103cdf0e10cSrcweir sal_Int16 nTextType)
2104cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException,
2105cdf0e10cSrcweir css::lang::IllegalArgumentException,
2106cdf0e10cSrcweir cssu::RuntimeException)
2107cdf0e10cSrcweir {
2108cdf0e10cSrcweir ThrowIfDisposed();
2109cdf0e10cSrcweir
2110cdf0e10cSrcweir TextSegment aSegment;
2111cdf0e10cSrcweir if (mpParagraph)
2112cdf0e10cSrcweir aSegment = mpParagraph->GetTextSegment(-1, nLocalCharacterIndex, nTextType);
2113cdf0e10cSrcweir
2114cdf0e10cSrcweir return aSegment;
2115cdf0e10cSrcweir }
2116cdf0e10cSrcweir
2117cdf0e10cSrcweir
2118cdf0e10cSrcweir
2119cdf0e10cSrcweir
getTextBehindIndex(sal_Int32 nLocalCharacterIndex,sal_Int16 nTextType)2120cdf0e10cSrcweir TextSegment SAL_CALL PresenterAccessible::AccessibleParagraph::getTextBehindIndex (
2121cdf0e10cSrcweir sal_Int32 nLocalCharacterIndex,
2122cdf0e10cSrcweir sal_Int16 nTextType)
2123cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException,
2124cdf0e10cSrcweir css::lang::IllegalArgumentException,
2125cdf0e10cSrcweir cssu::RuntimeException)
2126cdf0e10cSrcweir {
2127cdf0e10cSrcweir ThrowIfDisposed();
2128cdf0e10cSrcweir
2129cdf0e10cSrcweir TextSegment aSegment;
2130cdf0e10cSrcweir if (mpParagraph)
2131cdf0e10cSrcweir aSegment = mpParagraph->GetTextSegment(+1, nLocalCharacterIndex, nTextType);
2132cdf0e10cSrcweir
2133cdf0e10cSrcweir return aSegment;
2134cdf0e10cSrcweir }
2135cdf0e10cSrcweir
2136cdf0e10cSrcweir
2137cdf0e10cSrcweir
2138cdf0e10cSrcweir
copyText(sal_Int32 nStartIndex,sal_Int32 nEndIndex)2139cdf0e10cSrcweir sal_Bool SAL_CALL PresenterAccessible::AccessibleParagraph::copyText (
2140cdf0e10cSrcweir sal_Int32 nStartIndex,
2141cdf0e10cSrcweir sal_Int32 nEndIndex)
2142cdf0e10cSrcweir throw (css::lang::IndexOutOfBoundsException, cssu::RuntimeException)
2143cdf0e10cSrcweir {
2144cdf0e10cSrcweir ThrowIfDisposed();
2145cdf0e10cSrcweir
2146cdf0e10cSrcweir // Return false because copying to clipboard is not supported.
2147cdf0e10cSrcweir // It IS supported in the notes view. There is no need to duplicate
2148cdf0e10cSrcweir // this here.
2149cdf0e10cSrcweir (void)nStartIndex;
2150cdf0e10cSrcweir (void)nEndIndex;
2151cdf0e10cSrcweir return sal_False;
2152cdf0e10cSrcweir }
2153cdf0e10cSrcweir
2154cdf0e10cSrcweir
2155cdf0e10cSrcweir
2156cdf0e10cSrcweir
2157cdf0e10cSrcweir //----- protected -------------------------------------------------------------
2158cdf0e10cSrcweir
GetRelativeLocation(void)2159cdf0e10cSrcweir awt::Point PresenterAccessible::AccessibleParagraph::GetRelativeLocation (void)
2160cdf0e10cSrcweir {
2161cdf0e10cSrcweir awt::Point aLocation (AccessibleObject::GetRelativeLocation());
2162cdf0e10cSrcweir if (mpParagraph)
2163cdf0e10cSrcweir {
2164cdf0e10cSrcweir const awt::Point aParagraphLocation (mpParagraph->GetRelativeLocation());
2165cdf0e10cSrcweir aLocation.X += aParagraphLocation.X;
2166cdf0e10cSrcweir aLocation.Y += aParagraphLocation.Y;
2167cdf0e10cSrcweir }
2168cdf0e10cSrcweir
2169cdf0e10cSrcweir return aLocation;
2170cdf0e10cSrcweir }
2171cdf0e10cSrcweir
2172cdf0e10cSrcweir
2173cdf0e10cSrcweir
2174cdf0e10cSrcweir
GetSize(void)2175cdf0e10cSrcweir awt::Size PresenterAccessible::AccessibleParagraph::GetSize (void)
2176cdf0e10cSrcweir {
2177cdf0e10cSrcweir if (mpParagraph)
2178cdf0e10cSrcweir return mpParagraph->GetSize();
2179cdf0e10cSrcweir else
2180cdf0e10cSrcweir return AccessibleObject::GetSize();
2181cdf0e10cSrcweir }
2182cdf0e10cSrcweir
2183cdf0e10cSrcweir
2184cdf0e10cSrcweir
2185cdf0e10cSrcweir
GetAbsoluteParentLocation(void)2186cdf0e10cSrcweir awt::Point PresenterAccessible::AccessibleParagraph::GetAbsoluteParentLocation (void)
2187cdf0e10cSrcweir {
2188cdf0e10cSrcweir if (mxParentAccessible.is())
2189cdf0e10cSrcweir {
2190cdf0e10cSrcweir Reference<XAccessibleContext> xParentContext(
2191cdf0e10cSrcweir mxParentAccessible->getAccessibleContext(), UNO_QUERY);
2192cdf0e10cSrcweir if (xParentContext.is())
2193cdf0e10cSrcweir {
2194cdf0e10cSrcweir Reference<XAccessibleComponent> xGrandParentComponent(
2195cdf0e10cSrcweir xParentContext->getAccessibleParent(), UNO_QUERY);
2196cdf0e10cSrcweir if (xGrandParentComponent.is())
2197cdf0e10cSrcweir return xGrandParentComponent->getLocationOnScreen();
2198cdf0e10cSrcweir }
2199cdf0e10cSrcweir }
2200cdf0e10cSrcweir
2201cdf0e10cSrcweir return awt::Point();
2202cdf0e10cSrcweir }
2203cdf0e10cSrcweir
2204cdf0e10cSrcweir
2205cdf0e10cSrcweir
2206cdf0e10cSrcweir
GetWindowState(const sal_Int16 nType) const2207cdf0e10cSrcweir bool PresenterAccessible::AccessibleParagraph::GetWindowState (const sal_Int16 nType) const
2208cdf0e10cSrcweir {
2209cdf0e10cSrcweir switch (nType)
2210cdf0e10cSrcweir {
2211cdf0e10cSrcweir case AccessibleStateType::EDITABLE:
2212cdf0e10cSrcweir return mpParagraph.get()!=NULL;
2213cdf0e10cSrcweir
2214cdf0e10cSrcweir case AccessibleStateType::ACTIVE:
2215cdf0e10cSrcweir return true;
2216cdf0e10cSrcweir
2217cdf0e10cSrcweir default:
2218cdf0e10cSrcweir return AccessibleObject::GetWindowState(nType);
2219cdf0e10cSrcweir }
2220cdf0e10cSrcweir }
2221cdf0e10cSrcweir
2222cdf0e10cSrcweir
2223cdf0e10cSrcweir
2224cdf0e10cSrcweir
2225cdf0e10cSrcweir
2226cdf0e10cSrcweir
2227cdf0e10cSrcweir //===== AccessibleNotes =======================================================
2228cdf0e10cSrcweir
AccessibleNotes(const css::lang::Locale aLocale,const sal_Int16 nRole,const::rtl::OUString & rsName)2229cdf0e10cSrcweir AccessibleNotes::AccessibleNotes (
2230cdf0e10cSrcweir const css::lang::Locale aLocale,
2231cdf0e10cSrcweir const sal_Int16 nRole,
2232cdf0e10cSrcweir const ::rtl::OUString& rsName)
2233cdf0e10cSrcweir : AccessibleObject(aLocale,nRole,rsName),
2234cdf0e10cSrcweir mpTextView()
2235cdf0e10cSrcweir {
2236cdf0e10cSrcweir }
2237cdf0e10cSrcweir
2238cdf0e10cSrcweir
2239cdf0e10cSrcweir
2240cdf0e10cSrcweir
Create(const css::uno::Reference<css::uno::XComponentContext> & rxContext,const lang::Locale aLocale,const Reference<awt::XWindow> & rxContentWindow,const Reference<awt::XWindow> & rxBorderWindow,const::boost::shared_ptr<PresenterTextView> & rpTextView)2241cdf0e10cSrcweir rtl::Reference<PresenterAccessible::AccessibleObject> AccessibleNotes::Create (
2242cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext,
2243cdf0e10cSrcweir const lang::Locale aLocale,
2244cdf0e10cSrcweir const Reference<awt::XWindow>& rxContentWindow,
2245cdf0e10cSrcweir const Reference<awt::XWindow>& rxBorderWindow,
2246cdf0e10cSrcweir const ::boost::shared_ptr<PresenterTextView>& rpTextView)
2247cdf0e10cSrcweir {
2248cdf0e10cSrcweir OUString sName (A2S("Presenter Notes Text"));
2249cdf0e10cSrcweir {
2250cdf0e10cSrcweir PresenterConfigurationAccess aConfiguration (
2251cdf0e10cSrcweir rxContext,
225279e0a548SAriel Constenla-Haile OUString::createFromAscii("/org.openoffice.Office.PresenterScreen/"),
2253cdf0e10cSrcweir PresenterConfigurationAccess::READ_ONLY);
2254cdf0e10cSrcweir aConfiguration.GetConfigurationNode(A2S("Presenter/Accessibility/Notes/String"))
2255cdf0e10cSrcweir >>= sName;
2256cdf0e10cSrcweir }
2257cdf0e10cSrcweir
2258cdf0e10cSrcweir rtl::Reference<AccessibleNotes> pObject (
2259cdf0e10cSrcweir new AccessibleNotes(
2260cdf0e10cSrcweir aLocale,
2261cdf0e10cSrcweir AccessibleRole::PANEL,
2262cdf0e10cSrcweir sName));
2263cdf0e10cSrcweir pObject->LateInitialization();
2264cdf0e10cSrcweir pObject->SetTextView(rpTextView);
2265cdf0e10cSrcweir pObject->UpdateStateSet();
2266cdf0e10cSrcweir pObject->SetWindow(rxContentWindow, rxBorderWindow);
2267cdf0e10cSrcweir
2268cdf0e10cSrcweir return rtl::Reference<PresenterAccessible::AccessibleObject>(pObject.get());
2269cdf0e10cSrcweir }
2270cdf0e10cSrcweir
2271cdf0e10cSrcweir
2272cdf0e10cSrcweir
2273cdf0e10cSrcweir
SetTextView(const::boost::shared_ptr<PresenterTextView> & rpTextView)2274cdf0e10cSrcweir void AccessibleNotes::SetTextView (
2275cdf0e10cSrcweir const ::boost::shared_ptr<PresenterTextView>& rpTextView)
2276cdf0e10cSrcweir {
2277cdf0e10cSrcweir ::std::vector<rtl::Reference<PresenterAccessible::AccessibleObject> > aChildren;
2278cdf0e10cSrcweir
2279cdf0e10cSrcweir // Release any listeners to the current text view.
2280cdf0e10cSrcweir if (mpTextView)
2281cdf0e10cSrcweir {
2282cdf0e10cSrcweir mpTextView->GetCaret()->SetCaretMotionBroadcaster(
2283cdf0e10cSrcweir ::boost::function<void(sal_Int32,sal_Int32,sal_Int32,sal_Int32)>());
2284cdf0e10cSrcweir mpTextView->SetTextChangeBroadcaster(
2285cdf0e10cSrcweir ::boost::function<void(void)>());
2286cdf0e10cSrcweir }
2287cdf0e10cSrcweir
2288cdf0e10cSrcweir mpTextView = rpTextView;
2289cdf0e10cSrcweir
2290cdf0e10cSrcweir if (mpTextView)
2291cdf0e10cSrcweir {
2292cdf0e10cSrcweir // Create a new set of children, one for each paragraph.
2293cdf0e10cSrcweir const sal_Int32 nParagraphCount (mpTextView->GetParagraphCount());
2294cdf0e10cSrcweir for (sal_Int32 nIndex=0; nIndex<nParagraphCount; ++nIndex)
2295cdf0e10cSrcweir {
2296cdf0e10cSrcweir rtl::Reference<PresenterAccessible::AccessibleParagraph> pParagraph (
2297cdf0e10cSrcweir new PresenterAccessible::AccessibleParagraph(
2298cdf0e10cSrcweir css::lang::Locale(),
2299cdf0e10cSrcweir AccessibleRole::PARAGRAPH,
2300cdf0e10cSrcweir A2S("Paragraph")+OUString::valueOf(nIndex),
2301cdf0e10cSrcweir rpTextView->GetParagraph(nIndex),
2302cdf0e10cSrcweir nIndex));
2303cdf0e10cSrcweir pParagraph->LateInitialization();
2304cdf0e10cSrcweir pParagraph->SetWindow(
2305cdf0e10cSrcweir Reference<awt::XWindow>(mxContentWindow, UNO_QUERY),
2306cdf0e10cSrcweir Reference<awt::XWindow>(mxBorderWindow, UNO_QUERY));
2307cdf0e10cSrcweir pParagraph->SetAccessibleParent(this);
2308cdf0e10cSrcweir aChildren.push_back(
2309cdf0e10cSrcweir rtl::Reference<PresenterAccessible::AccessibleObject>(pParagraph.get()));
2310cdf0e10cSrcweir }
2311cdf0e10cSrcweir maChildren.swap(aChildren);
2312cdf0e10cSrcweir FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any());
2313cdf0e10cSrcweir
2314cdf0e10cSrcweir // Dispose the old children. (This will remove them from the focus
2315cdf0e10cSrcweir // manager).
2316cdf0e10cSrcweir for (std::vector<rtl::Reference<AccessibleObject> >::const_iterator
2317cdf0e10cSrcweir iChild(aChildren.begin()), iEnd(aChildren.end());
2318cdf0e10cSrcweir iChild!=iEnd;
2319cdf0e10cSrcweir ++iChild)
2320cdf0e10cSrcweir {
2321cdf0e10cSrcweir Reference<lang::XComponent> xComponent (static_cast<XWeak*>(iChild->get()), UNO_QUERY);
2322cdf0e10cSrcweir if (xComponent.is())
2323cdf0e10cSrcweir xComponent->dispose();
2324cdf0e10cSrcweir }
2325cdf0e10cSrcweir
2326cdf0e10cSrcweir // This class acts as a controller of who broadcasts caret motion
2327cdf0e10cSrcweir // events and handles text changes. Register the corresponding
2328cdf0e10cSrcweir // listeners here.
2329cdf0e10cSrcweir mpTextView->GetCaret()->SetCaretMotionBroadcaster(
2330cdf0e10cSrcweir ::boost::bind(&AccessibleNotes::NotifyCaretChange, this, _1, _2, _3, _4));
2331cdf0e10cSrcweir mpTextView->SetTextChangeBroadcaster(
2332cdf0e10cSrcweir ::boost::bind(&AccessibleNotes::HandleTextChange, this));
2333cdf0e10cSrcweir }
2334cdf0e10cSrcweir }
2335cdf0e10cSrcweir
2336cdf0e10cSrcweir
2337cdf0e10cSrcweir
2338cdf0e10cSrcweir
SetWindow(const cssu::Reference<css::awt::XWindow> & rxContentWindow,const cssu::Reference<css::awt::XWindow> & rxBorderWindow)2339cdf0e10cSrcweir void AccessibleNotes::SetWindow (
2340cdf0e10cSrcweir const cssu::Reference<css::awt::XWindow>& rxContentWindow,
2341cdf0e10cSrcweir const cssu::Reference<css::awt::XWindow>& rxBorderWindow)
2342cdf0e10cSrcweir {
2343cdf0e10cSrcweir AccessibleObject::SetWindow(rxContentWindow, rxBorderWindow);
2344cdf0e10cSrcweir
2345cdf0e10cSrcweir // Set the windows at the children as well, so that every paragraph can
2346cdf0e10cSrcweir // setup its geometry.
2347cdf0e10cSrcweir for (::std::vector<rtl::Reference<AccessibleObject> >::const_iterator
2348cdf0e10cSrcweir iChild(maChildren.begin()),
2349cdf0e10cSrcweir iEnd(maChildren.end());
2350cdf0e10cSrcweir iChild!=iEnd;
2351cdf0e10cSrcweir ++iChild)
2352cdf0e10cSrcweir {
2353cdf0e10cSrcweir (*iChild)->SetWindow(rxContentWindow, rxBorderWindow);
2354cdf0e10cSrcweir }
2355cdf0e10cSrcweir }
2356cdf0e10cSrcweir
2357cdf0e10cSrcweir
2358cdf0e10cSrcweir
2359cdf0e10cSrcweir
NotifyCaretChange(const sal_Int32 nOldParagraphIndex,const sal_Int32 nOldCharacterIndex,const sal_Int32 nNewParagraphIndex,const sal_Int32 nNewCharacterIndex)2360cdf0e10cSrcweir void AccessibleNotes::NotifyCaretChange (
2361cdf0e10cSrcweir const sal_Int32 nOldParagraphIndex,
2362cdf0e10cSrcweir const sal_Int32 nOldCharacterIndex,
2363cdf0e10cSrcweir const sal_Int32 nNewParagraphIndex,
2364cdf0e10cSrcweir const sal_Int32 nNewCharacterIndex)
2365cdf0e10cSrcweir {
2366cdf0e10cSrcweir AccessibleFocusManager::Instance()->FocusObject(
2367cdf0e10cSrcweir nNewParagraphIndex >= 0
2368cdf0e10cSrcweir ? maChildren[nNewParagraphIndex]
2369cdf0e10cSrcweir : this);
2370cdf0e10cSrcweir
2371cdf0e10cSrcweir if (nOldParagraphIndex != nNewParagraphIndex)
2372cdf0e10cSrcweir {
2373cdf0e10cSrcweir // Moved caret from one paragraph to another (or showed or
2374*aa9633e7Smseidel // hid the caret). Move focus from one accessible
2375cdf0e10cSrcweir // paragraph to another.
2376cdf0e10cSrcweir if (nOldParagraphIndex >= 0)
2377cdf0e10cSrcweir {
2378cdf0e10cSrcweir maChildren[nOldParagraphIndex]->FireAccessibleEvent(
2379cdf0e10cSrcweir AccessibleEventId::CARET_CHANGED,
2380cdf0e10cSrcweir Any(nOldCharacterIndex),
2381cdf0e10cSrcweir Any(sal_Int32(-1)));
2382cdf0e10cSrcweir }
2383cdf0e10cSrcweir if (nNewParagraphIndex >= 0)
2384cdf0e10cSrcweir {
2385cdf0e10cSrcweir maChildren[nNewParagraphIndex]->FireAccessibleEvent(
2386cdf0e10cSrcweir AccessibleEventId::CARET_CHANGED,
2387cdf0e10cSrcweir Any(sal_Int32(-1)),
2388cdf0e10cSrcweir Any(nNewCharacterIndex));
2389cdf0e10cSrcweir }
2390cdf0e10cSrcweir }
2391cdf0e10cSrcweir else if (nNewParagraphIndex >= 0)
2392cdf0e10cSrcweir {
2393cdf0e10cSrcweir // Caret moved inside one paragraph.
2394cdf0e10cSrcweir maChildren[nNewParagraphIndex]->FireAccessibleEvent(
2395cdf0e10cSrcweir AccessibleEventId::CARET_CHANGED,
2396cdf0e10cSrcweir Any(nOldCharacterIndex),
2397cdf0e10cSrcweir Any(nNewCharacterIndex));
2398cdf0e10cSrcweir }
2399cdf0e10cSrcweir }
2400cdf0e10cSrcweir
2401cdf0e10cSrcweir
2402cdf0e10cSrcweir
2403cdf0e10cSrcweir
HandleTextChange(void)2404cdf0e10cSrcweir void AccessibleNotes::HandleTextChange (void)
2405cdf0e10cSrcweir {
2406cdf0e10cSrcweir SetTextView(mpTextView);
2407cdf0e10cSrcweir }
2408cdf0e10cSrcweir
2409cdf0e10cSrcweir
2410cdf0e10cSrcweir
2411cdf0e10cSrcweir
2412cdf0e10cSrcweir //===== AccessibleFocusManager ================================================
2413cdf0e10cSrcweir
2414cdf0e10cSrcweir ::boost::shared_ptr<AccessibleFocusManager> AccessibleFocusManager::mpInstance;
2415cdf0e10cSrcweir
Instance(void)2416cdf0e10cSrcweir ::boost::shared_ptr<AccessibleFocusManager> AccessibleFocusManager::Instance (void)
2417cdf0e10cSrcweir {
2418cdf0e10cSrcweir if ( ! mpInstance)
2419cdf0e10cSrcweir {
2420cdf0e10cSrcweir mpInstance.reset(new AccessibleFocusManager());
2421cdf0e10cSrcweir }
2422cdf0e10cSrcweir return mpInstance;
2423cdf0e10cSrcweir }
2424cdf0e10cSrcweir
2425cdf0e10cSrcweir
2426cdf0e10cSrcweir
2427cdf0e10cSrcweir
AccessibleFocusManager(void)2428cdf0e10cSrcweir AccessibleFocusManager::AccessibleFocusManager (void)
2429cdf0e10cSrcweir : maFocusableObjects()
2430cdf0e10cSrcweir {
2431cdf0e10cSrcweir }
2432cdf0e10cSrcweir
2433cdf0e10cSrcweir
2434cdf0e10cSrcweir
2435cdf0e10cSrcweir
AddFocusableObject(const::rtl::Reference<PresenterAccessible::AccessibleObject> & rpObject)2436cdf0e10cSrcweir void AccessibleFocusManager::AddFocusableObject (
2437cdf0e10cSrcweir const ::rtl::Reference<PresenterAccessible::AccessibleObject>& rpObject)
2438cdf0e10cSrcweir {
2439cdf0e10cSrcweir OSL_ASSERT(rpObject.is());
2440cdf0e10cSrcweir OSL_ASSERT(::std::find(maFocusableObjects.begin(),maFocusableObjects.end(), rpObject)==maFocusableObjects.end());
2441cdf0e10cSrcweir
2442cdf0e10cSrcweir maFocusableObjects.push_back(rpObject);
2443cdf0e10cSrcweir }
2444cdf0e10cSrcweir
2445cdf0e10cSrcweir
2446cdf0e10cSrcweir
2447cdf0e10cSrcweir
RemoveFocusableObject(const::rtl::Reference<PresenterAccessible::AccessibleObject> & rpObject)2448cdf0e10cSrcweir void AccessibleFocusManager::RemoveFocusableObject (
2449cdf0e10cSrcweir const ::rtl::Reference<PresenterAccessible::AccessibleObject>& rpObject)
2450cdf0e10cSrcweir {
2451cdf0e10cSrcweir ::std::vector<rtl::Reference<PresenterAccessible::AccessibleObject> >::iterator iObject (
2452cdf0e10cSrcweir ::std::find(maFocusableObjects.begin(),maFocusableObjects.end(), rpObject));
2453cdf0e10cSrcweir
2454cdf0e10cSrcweir if (iObject != maFocusableObjects.end())
2455cdf0e10cSrcweir maFocusableObjects.erase(iObject);
2456cdf0e10cSrcweir else
2457cdf0e10cSrcweir {
2458cdf0e10cSrcweir OSL_ASSERT(iObject!=maFocusableObjects.end());
2459cdf0e10cSrcweir }
2460cdf0e10cSrcweir }
2461cdf0e10cSrcweir
2462cdf0e10cSrcweir
2463cdf0e10cSrcweir
2464cdf0e10cSrcweir
FocusObject(const::rtl::Reference<PresenterAccessible::AccessibleObject> & rpObject)2465cdf0e10cSrcweir void AccessibleFocusManager::FocusObject (
2466cdf0e10cSrcweir const ::rtl::Reference<PresenterAccessible::AccessibleObject>& rpObject)
2467cdf0e10cSrcweir {
2468cdf0e10cSrcweir // Remove the focus of any of the other focusable objects.
2469cdf0e10cSrcweir for (::std::vector<rtl::Reference<PresenterAccessible::AccessibleObject> >::const_iterator
2470cdf0e10cSrcweir iObject (maFocusableObjects.begin()),
2471cdf0e10cSrcweir iEnd (maFocusableObjects.end());
2472cdf0e10cSrcweir iObject != iEnd;
2473cdf0e10cSrcweir ++iObject)
2474cdf0e10cSrcweir {
2475cdf0e10cSrcweir if (*iObject!=rpObject)
2476cdf0e10cSrcweir (*iObject)->SetIsFocused(false);
2477cdf0e10cSrcweir }
2478cdf0e10cSrcweir
2479cdf0e10cSrcweir if (rpObject.is())
2480cdf0e10cSrcweir rpObject->SetIsFocused(true);
2481cdf0e10cSrcweir }
2482cdf0e10cSrcweir
2483cdf0e10cSrcweir } } // end of namespace ::sd::presenter
2484