15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
35b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55b190011SAndrew Rist  * distributed with this work for additional information
65b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist  * "License"); you may not use this file except in compliance
95b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
105b190011SAndrew Rist  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
125b190011SAndrew Rist  *
135b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist  * software distributed under the License is distributed on an
155b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
175b190011SAndrew Rist  * specific language governing permissions and limitations
185b190011SAndrew Rist  * under the License.
195b190011SAndrew Rist  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "precompiled_sd.hxx"
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "AccessibleSlideSorterView.hxx"
27cdf0e10cSrcweir #include "AccessibleSlideSorterObject.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "SlideSorter.hxx"
30cdf0e10cSrcweir #include "controller/SlideSorterController.hxx"
31cdf0e10cSrcweir #include "controller/SlsPageSelector.hxx"
32cdf0e10cSrcweir #include "controller/SlsFocusManager.hxx"
33cdf0e10cSrcweir #include "controller/SlsSelectionManager.hxx"
34cdf0e10cSrcweir #include "view/SlideSorterView.hxx"
35cdf0e10cSrcweir #include "model/SlideSorterModel.hxx"
36cdf0e10cSrcweir #include "model/SlsPageDescriptor.hxx"
37cdf0e10cSrcweir #include "SlideSorterViewShell.hxx"
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #include "ViewShellHint.hxx"
40cdf0e10cSrcweir #include "sdpage.hxx"
41cdf0e10cSrcweir #include "drawdoc.hxx"
42cdf0e10cSrcweir 
43cdf0e10cSrcweir #include "sdresid.hxx"
44cdf0e10cSrcweir #include "accessibility.hrc"
45cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
46cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
47cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp>
48cdf0e10cSrcweir #include <comphelper/accessibleeventnotifier.hxx>
49cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx>
50cdf0e10cSrcweir #include <rtl/ref.hxx>
51cdf0e10cSrcweir #include <vcl/svapp.hxx>
52cdf0e10cSrcweir 
53cdf0e10cSrcweir using ::rtl::OUString;
54cdf0e10cSrcweir using namespace ::com::sun::star;
55cdf0e10cSrcweir using namespace ::com::sun::star::uno;
56cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir namespace accessibility {
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 
61cdf0e10cSrcweir /** Inner implementation class of the AccessibleSlideSorterView.
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     Note that some event broadcasting is done asynchronously because
64cdf0e10cSrcweir     otherwise it could lead to deadlocks on (at least) some Solaris
65cdf0e10cSrcweir     machines.  Probably (but unverified) this can happen on all GTK based
66cdf0e10cSrcweir     systems.  The asynchronous broadcasting is just a workaround for a
67cdf0e10cSrcweir     poorly understood problem.
68cdf0e10cSrcweir */
69cdf0e10cSrcweir class AccessibleSlideSorterView::Implementation
70cdf0e10cSrcweir     : public SfxListener
71cdf0e10cSrcweir {
72cdf0e10cSrcweir public:
73cdf0e10cSrcweir     Implementation (
74cdf0e10cSrcweir         AccessibleSlideSorterView& rAccessibleSlideSorter,
75cdf0e10cSrcweir         ::sd::slidesorter::SlideSorter& rSlideSorter,
76cdf0e10cSrcweir         ::Window* pWindow);
77cdf0e10cSrcweir     ~Implementation (void);
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     void RequestUpdateChildren (void);
80cdf0e10cSrcweir     void Clear (void);
81cdf0e10cSrcweir     sal_Int32 GetVisibleChildCount (void) const;
82cdf0e10cSrcweir     AccessibleSlideSorterObject* GetAccessibleChild (sal_Int32 nIndex);
83cdf0e10cSrcweir     AccessibleSlideSorterObject* GetVisibleChild (sal_Int32 nIndex);
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     void ConnectListeners (void);
86cdf0e10cSrcweir     void ReleaseListeners (void);
87cdf0e10cSrcweir     void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint);
88cdf0e10cSrcweir     DECL_LINK(WindowEventListener, VclWindowEvent*);
89cdf0e10cSrcweir     DECL_LINK(SelectionChangeListener, void*);
90cdf0e10cSrcweir     DECL_LINK(BroadcastSelectionChange, void*);
91cdf0e10cSrcweir     DECL_LINK(FocusChangeListener, void*);
92cdf0e10cSrcweir     DECL_LINK(UpdateChildrenCallback, void*);
93cdf0e10cSrcweir 
940deba7fbSSteve Yin     void Activated(void);
95cdf0e10cSrcweir private:
96cdf0e10cSrcweir     AccessibleSlideSorterView& mrAccessibleSlideSorter;
97cdf0e10cSrcweir     ::sd::slidesorter::SlideSorter& mrSlideSorter;
98cdf0e10cSrcweir     typedef ::std::vector<rtl::Reference<AccessibleSlideSorterObject> > PageObjectList;
99cdf0e10cSrcweir     PageObjectList maPageObjects;
100cdf0e10cSrcweir     sal_Int32 mnFirstVisibleChild;
101cdf0e10cSrcweir     sal_Int32 mnLastVisibleChild;
102cdf0e10cSrcweir     bool mbListeningToDocument;
103cdf0e10cSrcweir     ::Window* mpWindow;
104cdf0e10cSrcweir     sal_Int32 mnFocusedIndex;
105cdf0e10cSrcweir     bool mbModelChangeLocked;
106cdf0e10cSrcweir     sal_uLong mnUpdateChildrenUserEventId;
107cdf0e10cSrcweir     sal_uLong mnSelectionChangeUserEventId;
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     void UpdateChildren (void);
110cdf0e10cSrcweir };
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 
115cdf0e10cSrcweir //===== AccessibleSlideSorterView =============================================
116cdf0e10cSrcweir 
AccessibleSlideSorterView(::sd::slidesorter::SlideSorter & rSlideSorter,const Reference<XAccessible> & rxParent,::Window * pContentWindow)117cdf0e10cSrcweir AccessibleSlideSorterView::AccessibleSlideSorterView(
118cdf0e10cSrcweir     ::sd::slidesorter::SlideSorter& rSlideSorter,
119cdf0e10cSrcweir     const Reference<XAccessible>& rxParent,
120cdf0e10cSrcweir     ::Window* pContentWindow)
121cdf0e10cSrcweir     : AccessibleSlideSorterViewBase(MutexOwner::maMutex),
122cdf0e10cSrcweir       mpImpl(new Implementation(*this,rSlideSorter,pContentWindow)),
123cdf0e10cSrcweir       mrSlideSorter(rSlideSorter),
124cdf0e10cSrcweir       mxParent(rxParent),
125cdf0e10cSrcweir       mnClientId(0),
126cdf0e10cSrcweir       mpContentWindow(pContentWindow)
127cdf0e10cSrcweir {
128cdf0e10cSrcweir }
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 
~AccessibleSlideSorterView(void)133cdf0e10cSrcweir AccessibleSlideSorterView::~AccessibleSlideSorterView (void)
134cdf0e10cSrcweir {
135cdf0e10cSrcweir     Destroyed ();
136cdf0e10cSrcweir }
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 
FireAccessibleEvent(short nEventId,const uno::Any & rOldValue,const uno::Any & rNewValue)141cdf0e10cSrcweir void AccessibleSlideSorterView::FireAccessibleEvent (
142cdf0e10cSrcweir     short nEventId,
143cdf0e10cSrcweir     const uno::Any& rOldValue,
144cdf0e10cSrcweir     const uno::Any& rNewValue )
145cdf0e10cSrcweir {
146cdf0e10cSrcweir     if (mnClientId != 0)
147cdf0e10cSrcweir     {
148cdf0e10cSrcweir         AccessibleEventObject aEventObject;
149cdf0e10cSrcweir 
150cdf0e10cSrcweir         aEventObject.Source = Reference<XWeak>(this);
151cdf0e10cSrcweir         aEventObject.EventId = nEventId;
152cdf0e10cSrcweir         aEventObject.NewValue = rNewValue;
153cdf0e10cSrcweir 	    aEventObject.OldValue = rOldValue;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 		comphelper::AccessibleEventNotifier::addEvent (mnClientId, aEventObject);
156cdf0e10cSrcweir     }
157cdf0e10cSrcweir }
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 
disposing(void)162cdf0e10cSrcweir void SAL_CALL AccessibleSlideSorterView::disposing (void)
163cdf0e10cSrcweir {
164cdf0e10cSrcweir     if (mnClientId != 0)
165cdf0e10cSrcweir     {
166cdf0e10cSrcweir         comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
167cdf0e10cSrcweir         mnClientId = 0;
168cdf0e10cSrcweir     }
169*3d762826SHerbert Dürr     mpImpl.reset();
170cdf0e10cSrcweir }
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 
GetAccessibleChildImplementation(sal_Int32 nIndex)175cdf0e10cSrcweir AccessibleSlideSorterObject* AccessibleSlideSorterView::GetAccessibleChildImplementation (
176cdf0e10cSrcweir     sal_Int32 nIndex)
177cdf0e10cSrcweir {
178cdf0e10cSrcweir     AccessibleSlideSorterObject* pResult = NULL;
179cdf0e10cSrcweir     ::osl::MutexGuard aGuard (maMutex);
180cdf0e10cSrcweir 
181cdf0e10cSrcweir     if (nIndex>=0 && nIndex<mpImpl->GetVisibleChildCount())
182cdf0e10cSrcweir         pResult = mpImpl->GetVisibleChild(nIndex);
183cdf0e10cSrcweir 
184cdf0e10cSrcweir     return pResult;
185cdf0e10cSrcweir }
186cdf0e10cSrcweir 
Destroyed(void)187cdf0e10cSrcweir void AccessibleSlideSorterView::Destroyed (void)
188cdf0e10cSrcweir {
189cdf0e10cSrcweir     ::osl::MutexGuard aGuard (maMutex);
190cdf0e10cSrcweir 
191cdf0e10cSrcweir     // Send a disposing to all listeners.
192cdf0e10cSrcweir 	if (mnClientId != 0)
193cdf0e10cSrcweir 	{
194cdf0e10cSrcweir         comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
195cdf0e10cSrcweir 		mnClientId = 0;
196cdf0e10cSrcweir 	}
197cdf0e10cSrcweir }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir //=====  XAccessible  =========================================================
200cdf0e10cSrcweir 
201cdf0e10cSrcweir Reference<XAccessibleContext > SAL_CALL
getAccessibleContext(void)202cdf0e10cSrcweir     AccessibleSlideSorterView::getAccessibleContext (void)
203cdf0e10cSrcweir     throw (uno::RuntimeException)
204cdf0e10cSrcweir {
205cdf0e10cSrcweir     ThrowIfDisposed ();
206cdf0e10cSrcweir     return this;
207cdf0e10cSrcweir }
208cdf0e10cSrcweir 
209cdf0e10cSrcweir //=====  XAccessibleContext  ==================================================
210cdf0e10cSrcweir 
getAccessibleChildCount(void)211cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleSlideSorterView::getAccessibleChildCount (void)
212cdf0e10cSrcweir     throw (RuntimeException)
213cdf0e10cSrcweir {
214cdf0e10cSrcweir     ThrowIfDisposed();
215cdf0e10cSrcweir     ::osl::MutexGuard aGuard (maMutex);
216cdf0e10cSrcweir     return mpImpl->GetVisibleChildCount();
217cdf0e10cSrcweir }
218cdf0e10cSrcweir 
219cdf0e10cSrcweir Reference<XAccessible > SAL_CALL
getAccessibleChild(sal_Int32 nIndex)220cdf0e10cSrcweir     AccessibleSlideSorterView::getAccessibleChild (sal_Int32 nIndex)
221cdf0e10cSrcweir     throw (lang::IndexOutOfBoundsException, RuntimeException)
222cdf0e10cSrcweir {
223cdf0e10cSrcweir     ThrowIfDisposed();
224cdf0e10cSrcweir     ::osl::MutexGuard aGuard (maMutex);
225cdf0e10cSrcweir 
226cdf0e10cSrcweir     if (nIndex<0 || nIndex>=mpImpl->GetVisibleChildCount())
227cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
228cdf0e10cSrcweir 
229cdf0e10cSrcweir     return  mpImpl->GetVisibleChild(nIndex);
230cdf0e10cSrcweir }
231cdf0e10cSrcweir 
getAccessibleParent(void)232cdf0e10cSrcweir Reference<XAccessible > SAL_CALL AccessibleSlideSorterView::getAccessibleParent (void)
233cdf0e10cSrcweir     throw (uno::RuntimeException)
234cdf0e10cSrcweir {
235cdf0e10cSrcweir     ThrowIfDisposed();
236cdf0e10cSrcweir     const vos::OGuard aSolarGuard (Application::GetSolarMutex());
237cdf0e10cSrcweir     Reference<XAccessible> xParent;
238cdf0e10cSrcweir 
239cdf0e10cSrcweir     if (mpContentWindow != NULL)
240cdf0e10cSrcweir     {
241cdf0e10cSrcweir         ::Window* pParent = mpContentWindow->GetAccessibleParentWindow();
242cdf0e10cSrcweir         if (pParent != NULL)
243cdf0e10cSrcweir             xParent = pParent->GetAccessible();
244cdf0e10cSrcweir     }
245cdf0e10cSrcweir 
246cdf0e10cSrcweir     return xParent;
247cdf0e10cSrcweir }
248cdf0e10cSrcweir 
getAccessibleIndexInParent(void)249cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleSlideSorterView::getAccessibleIndexInParent (void)
250cdf0e10cSrcweir     throw (uno::RuntimeException)
251cdf0e10cSrcweir {
252cdf0e10cSrcweir     OSL_ASSERT(getAccessibleParent().is());
253cdf0e10cSrcweir     ThrowIfDisposed();
254cdf0e10cSrcweir     const vos::OGuard aSolarGuard (Application::GetSolarMutex());
255cdf0e10cSrcweir     sal_Int32 nIndexInParent(-1);
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 
258cdf0e10cSrcweir     Reference<XAccessibleContext> xParentContext (getAccessibleParent()->getAccessibleContext());
259cdf0e10cSrcweir     if (xParentContext.is())
260cdf0e10cSrcweir     {
261cdf0e10cSrcweir         sal_Int32 nChildCount (xParentContext->getAccessibleChildCount());
262cdf0e10cSrcweir         for (sal_Int32 i=0; i<nChildCount; ++i)
263cdf0e10cSrcweir             if (xParentContext->getAccessibleChild(i).get()
264cdf0e10cSrcweir                     == static_cast<XAccessible*>(this))
265cdf0e10cSrcweir             {
266cdf0e10cSrcweir                 nIndexInParent = i;
267cdf0e10cSrcweir                 break;
268cdf0e10cSrcweir             }
269cdf0e10cSrcweir     }
270cdf0e10cSrcweir 
271cdf0e10cSrcweir     return nIndexInParent;
272cdf0e10cSrcweir }
273cdf0e10cSrcweir 
274cdf0e10cSrcweir 
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 
getAccessibleRole(void)277cdf0e10cSrcweir sal_Int16 SAL_CALL AccessibleSlideSorterView::getAccessibleRole (void)
278cdf0e10cSrcweir     throw (uno::RuntimeException)
279cdf0e10cSrcweir {
280cdf0e10cSrcweir     ThrowIfDisposed();
281cdf0e10cSrcweir     static sal_Int16 nRole = AccessibleRole::DOCUMENT;
282cdf0e10cSrcweir     return nRole;
283cdf0e10cSrcweir }
284cdf0e10cSrcweir 
285cdf0e10cSrcweir 
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 
getAccessibleDescription(void)288cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleSlideSorterView::getAccessibleDescription (void)
289cdf0e10cSrcweir     throw (uno::RuntimeException)
290cdf0e10cSrcweir {
291cdf0e10cSrcweir     ThrowIfDisposed();
292cdf0e10cSrcweir     ::vos::OGuard aGuard (Application::GetSolarMutex());
293cdf0e10cSrcweir 
294cdf0e10cSrcweir     return String(SdResId(SID_SD_A11Y_I_SLIDEVIEW_D));
295cdf0e10cSrcweir }
296cdf0e10cSrcweir 
297cdf0e10cSrcweir 
298cdf0e10cSrcweir 
299cdf0e10cSrcweir 
getAccessibleName(void)300cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleSlideSorterView::getAccessibleName (void)
301cdf0e10cSrcweir     throw (uno::RuntimeException)
302cdf0e10cSrcweir {
303cdf0e10cSrcweir     ThrowIfDisposed();
304cdf0e10cSrcweir     ::vos::OGuard aGuard (Application::GetSolarMutex());
305cdf0e10cSrcweir 
306cdf0e10cSrcweir     return String(SdResId(SID_SD_A11Y_I_SLIDEVIEW_N));
307cdf0e10cSrcweir }
308cdf0e10cSrcweir 
309cdf0e10cSrcweir 
310cdf0e10cSrcweir 
311cdf0e10cSrcweir 
312cdf0e10cSrcweir Reference<XAccessibleRelationSet> SAL_CALL
getAccessibleRelationSet(void)313cdf0e10cSrcweir     AccessibleSlideSorterView::getAccessibleRelationSet (void)
314cdf0e10cSrcweir     throw (uno::RuntimeException)
315cdf0e10cSrcweir {
316cdf0e10cSrcweir     return Reference<XAccessibleRelationSet>();
317cdf0e10cSrcweir }
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 
322cdf0e10cSrcweir Reference<XAccessibleStateSet > SAL_CALL
getAccessibleStateSet(void)323cdf0e10cSrcweir     AccessibleSlideSorterView::getAccessibleStateSet (void)
324cdf0e10cSrcweir     throw (uno::RuntimeException)
325cdf0e10cSrcweir {
326cdf0e10cSrcweir     ThrowIfDisposed();
327cdf0e10cSrcweir     const vos::OGuard aSolarGuard (Application::GetSolarMutex());
328cdf0e10cSrcweir     ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper();
329cdf0e10cSrcweir 
330cdf0e10cSrcweir     pStateSet->AddState(AccessibleStateType::FOCUSABLE);
331cdf0e10cSrcweir     pStateSet->AddState(AccessibleStateType::SELECTABLE);
332cdf0e10cSrcweir     pStateSet->AddState(AccessibleStateType::ENABLED);
333cdf0e10cSrcweir     pStateSet->AddState(AccessibleStateType::ACTIVE);
334cdf0e10cSrcweir     pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE);
335cdf0e10cSrcweir     pStateSet->AddState(AccessibleStateType::OPAQUE);
336cdf0e10cSrcweir     if (mpContentWindow!=NULL)
337cdf0e10cSrcweir     {
338cdf0e10cSrcweir         if (mpContentWindow->IsVisible())
339cdf0e10cSrcweir             pStateSet->AddState(AccessibleStateType::VISIBLE);
340cdf0e10cSrcweir         if (mpContentWindow->IsReallyVisible())
341cdf0e10cSrcweir             pStateSet->AddState(AccessibleStateType::SHOWING);
342cdf0e10cSrcweir     }
343cdf0e10cSrcweir 
344cdf0e10cSrcweir     return pStateSet;
345cdf0e10cSrcweir }
346cdf0e10cSrcweir 
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 
349cdf0e10cSrcweir 
getLocale(void)350cdf0e10cSrcweir lang::Locale SAL_CALL AccessibleSlideSorterView::getLocale (void)
351cdf0e10cSrcweir     throw (IllegalAccessibleComponentStateException,
352cdf0e10cSrcweir         RuntimeException)
353cdf0e10cSrcweir {
354cdf0e10cSrcweir     ThrowIfDisposed ();
355cdf0e10cSrcweir     Reference<XAccessibleContext> xParentContext;
356cdf0e10cSrcweir     Reference<XAccessible> xParent (getAccessibleParent());
357cdf0e10cSrcweir     if (xParent.is())
358cdf0e10cSrcweir         xParentContext = xParent->getAccessibleContext();
359cdf0e10cSrcweir 
360cdf0e10cSrcweir     if (xParentContext.is())
361cdf0e10cSrcweir         return xParentContext->getLocale();
362cdf0e10cSrcweir     else
363cdf0e10cSrcweir         // Strange, no parent!  Anyway, return the default locale.
364cdf0e10cSrcweir         return Application::GetSettings().GetLocale();
365cdf0e10cSrcweir }
366cdf0e10cSrcweir 
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 
369cdf0e10cSrcweir 
addEventListener(const Reference<XAccessibleEventListener> & rxListener)370cdf0e10cSrcweir void SAL_CALL AccessibleSlideSorterView::addEventListener(
371cdf0e10cSrcweir     const Reference<XAccessibleEventListener >& rxListener)
372cdf0e10cSrcweir     throw (RuntimeException)
373cdf0e10cSrcweir {
374cdf0e10cSrcweir 	if (rxListener.is())
375cdf0e10cSrcweir     {
376cdf0e10cSrcweir         const osl::MutexGuard aGuard(maMutex);
377cdf0e10cSrcweir 
378cdf0e10cSrcweir         if (IsDisposed())
379cdf0e10cSrcweir         {
380cdf0e10cSrcweir             uno::Reference<uno::XInterface> x ((lang::XComponent *)this, uno::UNO_QUERY);
381cdf0e10cSrcweir 		    rxListener->disposing (lang::EventObject (x));
382cdf0e10cSrcweir 	    }
383cdf0e10cSrcweir         else
384cdf0e10cSrcweir         {
385cdf0e10cSrcweir             if ( ! mnClientId)
386cdf0e10cSrcweir                 mnClientId = comphelper::AccessibleEventNotifier::registerClient();
387cdf0e10cSrcweir             comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener);
388cdf0e10cSrcweir         }
389cdf0e10cSrcweir     }
390cdf0e10cSrcweir }
391cdf0e10cSrcweir 
392cdf0e10cSrcweir 
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 
removeEventListener(const Reference<XAccessibleEventListener> & rxListener)395cdf0e10cSrcweir void SAL_CALL AccessibleSlideSorterView::removeEventListener(
396cdf0e10cSrcweir     const Reference<XAccessibleEventListener >& rxListener)
397cdf0e10cSrcweir     throw (RuntimeException)
398cdf0e10cSrcweir {
399cdf0e10cSrcweir     ThrowIfDisposed();
400cdf0e10cSrcweir 	if (rxListener.is())
401cdf0e10cSrcweir 	{
402cdf0e10cSrcweir         const osl::MutexGuard aGuard(maMutex);
403cdf0e10cSrcweir 
404cdf0e10cSrcweir         if (mnClientId != 0)
405cdf0e10cSrcweir         {
406cdf0e10cSrcweir             sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener(
407cdf0e10cSrcweir                 mnClientId, rxListener );
408cdf0e10cSrcweir             if ( !nListenerCount )
409cdf0e10cSrcweir             {
410cdf0e10cSrcweir                 // no listeners anymore -> revoke ourself. This may lead to
411cdf0e10cSrcweir                 // the notifier thread dying (if we were the last client),
412cdf0e10cSrcweir                 // and at least to us not firing any events anymore, in case
413cdf0e10cSrcweir                 // somebody calls NotifyAccessibleEvent, again
414cdf0e10cSrcweir                 comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
415cdf0e10cSrcweir                 mnClientId = 0;
416cdf0e10cSrcweir             }
417cdf0e10cSrcweir         }
418cdf0e10cSrcweir 	}
419cdf0e10cSrcweir }
420cdf0e10cSrcweir 
421cdf0e10cSrcweir 
422cdf0e10cSrcweir 
423cdf0e10cSrcweir 
424cdf0e10cSrcweir //===== XAccessibleComponent ==================================================
425cdf0e10cSrcweir 
containsPoint(const awt::Point & aPoint)426cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleSlideSorterView::containsPoint (const awt::Point& aPoint)
427cdf0e10cSrcweir     throw (RuntimeException)
428cdf0e10cSrcweir {
429cdf0e10cSrcweir     ThrowIfDisposed();
430cdf0e10cSrcweir     const awt::Rectangle aBBox (getBounds());
431cdf0e10cSrcweir     return (aPoint.X >= 0)
432cdf0e10cSrcweir         && (aPoint.X < aBBox.Width)
433cdf0e10cSrcweir         && (aPoint.Y >= 0)
434cdf0e10cSrcweir         && (aPoint.Y < aBBox.Height);
435cdf0e10cSrcweir }
436cdf0e10cSrcweir 
437cdf0e10cSrcweir 
438cdf0e10cSrcweir 
439cdf0e10cSrcweir 
440cdf0e10cSrcweir Reference<XAccessible> SAL_CALL
getAccessibleAtPoint(const awt::Point & aPoint)441cdf0e10cSrcweir     AccessibleSlideSorterView::getAccessibleAtPoint (const awt::Point& aPoint)
442cdf0e10cSrcweir     throw (RuntimeException)
443cdf0e10cSrcweir {
444cdf0e10cSrcweir     ThrowIfDisposed();
445cdf0e10cSrcweir     Reference<XAccessible> xAccessible;
446cdf0e10cSrcweir     const vos::OGuard aSolarGuard (Application::GetSolarMutex());
447cdf0e10cSrcweir 
448cdf0e10cSrcweir     const Point aTestPoint (aPoint.X, aPoint.Y);
449cdf0e10cSrcweir     ::sd::slidesorter::model::SharedPageDescriptor pHitDescriptor (
450cdf0e10cSrcweir         mrSlideSorter.GetController().GetPageAt(aTestPoint));
451cdf0e10cSrcweir     if (pHitDescriptor.get() != NULL)
452cdf0e10cSrcweir         xAccessible = mpImpl->GetAccessibleChild(
453cdf0e10cSrcweir             (pHitDescriptor->GetPage()->GetPageNum()-1)/2);
454cdf0e10cSrcweir 
455cdf0e10cSrcweir     return xAccessible;
456cdf0e10cSrcweir }
457cdf0e10cSrcweir 
458cdf0e10cSrcweir 
459cdf0e10cSrcweir 
460cdf0e10cSrcweir 
getBounds(void)461cdf0e10cSrcweir awt::Rectangle SAL_CALL AccessibleSlideSorterView::getBounds (void)
462cdf0e10cSrcweir     throw (uno::RuntimeException)
463cdf0e10cSrcweir {
464cdf0e10cSrcweir     ThrowIfDisposed();
465cdf0e10cSrcweir     const vos::OGuard aSolarGuard (Application::GetSolarMutex());
466cdf0e10cSrcweir     awt::Rectangle aBBox;
467cdf0e10cSrcweir 
468cdf0e10cSrcweir     if (mpContentWindow != NULL)
469cdf0e10cSrcweir     {
470cdf0e10cSrcweir         const Point aPosition (mpContentWindow->GetPosPixel());
471cdf0e10cSrcweir         const Size aSize (mpContentWindow->GetOutputSizePixel());
472cdf0e10cSrcweir 
473cdf0e10cSrcweir         aBBox.X = aPosition.X();
474cdf0e10cSrcweir         aBBox.Y = aPosition.Y();
475cdf0e10cSrcweir         aBBox.Width = aSize.Width();
476cdf0e10cSrcweir         aBBox.Height = aSize.Height();
477cdf0e10cSrcweir     }
478cdf0e10cSrcweir 
479cdf0e10cSrcweir     return aBBox;
480cdf0e10cSrcweir }
481cdf0e10cSrcweir 
482cdf0e10cSrcweir 
483cdf0e10cSrcweir 
484cdf0e10cSrcweir 
getLocation(void)485cdf0e10cSrcweir awt::Point SAL_CALL AccessibleSlideSorterView::getLocation (void)
486cdf0e10cSrcweir     throw (uno::RuntimeException)
487cdf0e10cSrcweir {
488cdf0e10cSrcweir     ThrowIfDisposed();
489cdf0e10cSrcweir     awt::Point aLocation;
490cdf0e10cSrcweir 
491cdf0e10cSrcweir     if (mpContentWindow != NULL)
492cdf0e10cSrcweir     {
493cdf0e10cSrcweir         const Point aPosition (mpContentWindow->GetPosPixel());
494cdf0e10cSrcweir         aLocation.X = aPosition.X();
495cdf0e10cSrcweir         aLocation.Y = aPosition.Y();
496cdf0e10cSrcweir     }
497cdf0e10cSrcweir 
498cdf0e10cSrcweir     return aLocation;
499cdf0e10cSrcweir }
500cdf0e10cSrcweir 
501cdf0e10cSrcweir 
502cdf0e10cSrcweir 
503cdf0e10cSrcweir 
504cdf0e10cSrcweir /** Calculate the location on screen from the parent's location on screen
505cdf0e10cSrcweir     and our own relative location.
506cdf0e10cSrcweir */
getLocationOnScreen()507cdf0e10cSrcweir awt::Point SAL_CALL AccessibleSlideSorterView::getLocationOnScreen()
508cdf0e10cSrcweir     throw (uno::RuntimeException)
509cdf0e10cSrcweir {
510cdf0e10cSrcweir     ThrowIfDisposed();
511cdf0e10cSrcweir     const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
512cdf0e10cSrcweir     awt::Point aParentLocationOnScreen;
513cdf0e10cSrcweir 
514cdf0e10cSrcweir     Reference<XAccessible> xParent (getAccessibleParent());
515cdf0e10cSrcweir     if (xParent.is())
516cdf0e10cSrcweir     {
517cdf0e10cSrcweir         Reference<XAccessibleComponent> xParentComponent (
518cdf0e10cSrcweir             xParent->getAccessibleContext(), uno::UNO_QUERY);
519cdf0e10cSrcweir         if (xParentComponent.is())
520cdf0e10cSrcweir             aParentLocationOnScreen = xParentComponent->getLocationOnScreen();
521cdf0e10cSrcweir     }
522cdf0e10cSrcweir 
523cdf0e10cSrcweir     awt::Point aLocationOnScreen (getLocation());
524cdf0e10cSrcweir     aLocationOnScreen.X += aParentLocationOnScreen.X;
525cdf0e10cSrcweir     aLocationOnScreen.Y += aParentLocationOnScreen.Y;
526cdf0e10cSrcweir 
527cdf0e10cSrcweir     return aLocationOnScreen;
528cdf0e10cSrcweir }
529cdf0e10cSrcweir 
530cdf0e10cSrcweir 
531cdf0e10cSrcweir 
532cdf0e10cSrcweir 
getSize(void)533cdf0e10cSrcweir awt::Size SAL_CALL AccessibleSlideSorterView::getSize (void)
534cdf0e10cSrcweir     throw (uno::RuntimeException)
535cdf0e10cSrcweir {
536cdf0e10cSrcweir     ThrowIfDisposed();
537cdf0e10cSrcweir     awt::Size aSize;
538cdf0e10cSrcweir 
539cdf0e10cSrcweir     if (mpContentWindow != NULL)
540cdf0e10cSrcweir     {
541cdf0e10cSrcweir         const Size aOutputSize (mpContentWindow->GetOutputSizePixel());
542cdf0e10cSrcweir         aSize.Width = aOutputSize.Width();
543cdf0e10cSrcweir         aSize.Height = aOutputSize.Height();
544cdf0e10cSrcweir     }
545cdf0e10cSrcweir 
546cdf0e10cSrcweir     return aSize;
547cdf0e10cSrcweir }
548cdf0e10cSrcweir 
549cdf0e10cSrcweir 
550cdf0e10cSrcweir 
551cdf0e10cSrcweir 
grabFocus(void)552cdf0e10cSrcweir void SAL_CALL AccessibleSlideSorterView::grabFocus (void)
553cdf0e10cSrcweir     throw (uno::RuntimeException)
554cdf0e10cSrcweir {
555cdf0e10cSrcweir     ThrowIfDisposed();
556cdf0e10cSrcweir     const vos::OGuard aSolarGuard (Application::GetSolarMutex());
557cdf0e10cSrcweir 
558cdf0e10cSrcweir     if (mpContentWindow)
559cdf0e10cSrcweir         mpContentWindow->GrabFocus();
560cdf0e10cSrcweir }
561cdf0e10cSrcweir 
562cdf0e10cSrcweir 
563cdf0e10cSrcweir 
564cdf0e10cSrcweir 
getForeground(void)565cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleSlideSorterView::getForeground (void)
566cdf0e10cSrcweir     throw (RuntimeException)
567cdf0e10cSrcweir {
568cdf0e10cSrcweir     ThrowIfDisposed();
569cdf0e10cSrcweir 	svtools::ColorConfig aColorConfig;
570cdf0e10cSrcweir     sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
571cdf0e10cSrcweir     return static_cast<sal_Int32>(nColor);
572cdf0e10cSrcweir }
573cdf0e10cSrcweir 
574cdf0e10cSrcweir 
575cdf0e10cSrcweir 
576cdf0e10cSrcweir 
getBackground(void)577cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleSlideSorterView::getBackground (void)
578cdf0e10cSrcweir     throw (RuntimeException)
579cdf0e10cSrcweir {
580cdf0e10cSrcweir     ThrowIfDisposed();
581cdf0e10cSrcweir     sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
582cdf0e10cSrcweir     return static_cast<sal_Int32>(nColor);
583cdf0e10cSrcweir }
584cdf0e10cSrcweir 
585cdf0e10cSrcweir 
586cdf0e10cSrcweir 
587cdf0e10cSrcweir 
588cdf0e10cSrcweir //===== XAccessibleSelection ==================================================
589cdf0e10cSrcweir 
selectAccessibleChild(sal_Int32 nChildIndex)590cdf0e10cSrcweir void SAL_CALL AccessibleSlideSorterView::selectAccessibleChild (sal_Int32 nChildIndex)
591cdf0e10cSrcweir     throw (lang::IndexOutOfBoundsException,
592cdf0e10cSrcweir         RuntimeException)
593cdf0e10cSrcweir {
594cdf0e10cSrcweir     ThrowIfDisposed();
595cdf0e10cSrcweir     const vos::OGuard aSolarGuard (Application::GetSolarMutex());
596cdf0e10cSrcweir 
597cdf0e10cSrcweir     AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
598cdf0e10cSrcweir     if (pChild != NULL)
599cdf0e10cSrcweir         mrSlideSorter.GetController().GetPageSelector().SelectPage(pChild->GetPageNumber());
600cdf0e10cSrcweir     else
601cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
602cdf0e10cSrcweir }
603cdf0e10cSrcweir 
604cdf0e10cSrcweir 
605cdf0e10cSrcweir 
606cdf0e10cSrcweir 
isAccessibleChildSelected(sal_Int32 nChildIndex)607cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleSlideSorterView::isAccessibleChildSelected (sal_Int32 nChildIndex)
608cdf0e10cSrcweir     throw (lang::IndexOutOfBoundsException,
609cdf0e10cSrcweir         RuntimeException)
610cdf0e10cSrcweir {
611cdf0e10cSrcweir     ThrowIfDisposed();
612cdf0e10cSrcweir     sal_Bool bIsSelected = sal_False;
613cdf0e10cSrcweir     const vos::OGuard aSolarGuard (Application::GetSolarMutex());
614cdf0e10cSrcweir 
615cdf0e10cSrcweir     AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
616cdf0e10cSrcweir     if (pChild != NULL)
617cdf0e10cSrcweir         bIsSelected = mrSlideSorter.GetController().GetPageSelector().IsPageSelected(
618cdf0e10cSrcweir             pChild->GetPageNumber());
619cdf0e10cSrcweir     else
620cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
621cdf0e10cSrcweir 
622cdf0e10cSrcweir     return bIsSelected;
623cdf0e10cSrcweir }
624cdf0e10cSrcweir 
625cdf0e10cSrcweir 
626cdf0e10cSrcweir 
627cdf0e10cSrcweir 
clearAccessibleSelection(void)628cdf0e10cSrcweir void SAL_CALL AccessibleSlideSorterView::clearAccessibleSelection (void)
629cdf0e10cSrcweir     throw (uno::RuntimeException)
630cdf0e10cSrcweir {
631cdf0e10cSrcweir     ThrowIfDisposed();
632cdf0e10cSrcweir     const vos::OGuard aSolarGuard (Application::GetSolarMutex());
633cdf0e10cSrcweir 
634cdf0e10cSrcweir     mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
635cdf0e10cSrcweir }
636cdf0e10cSrcweir 
637cdf0e10cSrcweir 
638cdf0e10cSrcweir 
639cdf0e10cSrcweir 
selectAllAccessibleChildren(void)640cdf0e10cSrcweir void SAL_CALL AccessibleSlideSorterView::selectAllAccessibleChildren (void)
641cdf0e10cSrcweir     throw (uno::RuntimeException)
642cdf0e10cSrcweir {
643cdf0e10cSrcweir     ThrowIfDisposed();
644cdf0e10cSrcweir     const vos::OGuard aSolarGuard (Application::GetSolarMutex());
645cdf0e10cSrcweir 
646cdf0e10cSrcweir     mrSlideSorter.GetController().GetPageSelector().SelectAllPages();
647cdf0e10cSrcweir }
648cdf0e10cSrcweir 
649cdf0e10cSrcweir 
650cdf0e10cSrcweir 
651cdf0e10cSrcweir 
getSelectedAccessibleChildCount(void)652cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleSlideSorterView::getSelectedAccessibleChildCount (void)
653cdf0e10cSrcweir     throw (uno::RuntimeException)
654cdf0e10cSrcweir {
655cdf0e10cSrcweir     ThrowIfDisposed ();
656cdf0e10cSrcweir     const vos::OGuard aSolarGuard (Application::GetSolarMutex());
657cdf0e10cSrcweir     return mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount();
658cdf0e10cSrcweir }
659cdf0e10cSrcweir 
660cdf0e10cSrcweir 
661cdf0e10cSrcweir 
662cdf0e10cSrcweir 
663cdf0e10cSrcweir Reference<XAccessible > SAL_CALL
getSelectedAccessibleChild(sal_Int32 nSelectedChildIndex)664cdf0e10cSrcweir     AccessibleSlideSorterView::getSelectedAccessibleChild (sal_Int32 nSelectedChildIndex )
665cdf0e10cSrcweir     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
666cdf0e10cSrcweir {
667cdf0e10cSrcweir     ThrowIfDisposed ();
668cdf0e10cSrcweir     const vos::OGuard aSolarGuard (Application::GetSolarMutex());
669cdf0e10cSrcweir     Reference<XAccessible> xChild;
670cdf0e10cSrcweir 
671cdf0e10cSrcweir     ::sd::slidesorter::controller::PageSelector& rSelector (
672cdf0e10cSrcweir         mrSlideSorter.GetController().GetPageSelector());
673cdf0e10cSrcweir     sal_Int32 nPageCount(rSelector.GetPageCount());
674cdf0e10cSrcweir     sal_Int32 nSelectedCount = 0;
675cdf0e10cSrcweir     for (sal_Int32 i=0; i<nPageCount; i++)
676cdf0e10cSrcweir         if (rSelector.IsPageSelected(i))
677cdf0e10cSrcweir         {
678cdf0e10cSrcweir             if (nSelectedCount == nSelectedChildIndex)
679cdf0e10cSrcweir             {
680cdf0e10cSrcweir                 xChild = mpImpl->GetAccessibleChild(i);
681cdf0e10cSrcweir                 break;
682cdf0e10cSrcweir             }
683cdf0e10cSrcweir             ++nSelectedCount;
684cdf0e10cSrcweir         }
685cdf0e10cSrcweir 
686cdf0e10cSrcweir 
687cdf0e10cSrcweir     if ( ! xChild.is() )
688cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
689cdf0e10cSrcweir 
690cdf0e10cSrcweir     return xChild;
691cdf0e10cSrcweir }
692cdf0e10cSrcweir 
693cdf0e10cSrcweir 
694cdf0e10cSrcweir 
695cdf0e10cSrcweir 
deselectAccessibleChild(sal_Int32 nChildIndex)696cdf0e10cSrcweir void SAL_CALL AccessibleSlideSorterView::deselectAccessibleChild (sal_Int32 nChildIndex)
697cdf0e10cSrcweir     throw (lang::IndexOutOfBoundsException,
698cdf0e10cSrcweir         RuntimeException)
699cdf0e10cSrcweir {
700cdf0e10cSrcweir     ThrowIfDisposed();
701cdf0e10cSrcweir     const vos::OGuard aSolarGuard (Application::GetSolarMutex());
702cdf0e10cSrcweir 
703cdf0e10cSrcweir     AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
704cdf0e10cSrcweir     if (pChild != NULL)
705cdf0e10cSrcweir         mrSlideSorter.GetController().GetPageSelector().DeselectPage(pChild->GetPageNumber());
706cdf0e10cSrcweir     else
707cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
708cdf0e10cSrcweir }
709cdf0e10cSrcweir 
710cdf0e10cSrcweir 
711cdf0e10cSrcweir 
712cdf0e10cSrcweir 
713cdf0e10cSrcweir //=====  XServiceInfo  ========================================================
714cdf0e10cSrcweir 
715cdf0e10cSrcweir ::rtl::OUString SAL_CALL
getImplementationName(void)716cdf0e10cSrcweir    	AccessibleSlideSorterView::getImplementationName (void)
717cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
718cdf0e10cSrcweir {
719cdf0e10cSrcweir 	return OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleSlideSorterView"));
720cdf0e10cSrcweir }
721cdf0e10cSrcweir 
722cdf0e10cSrcweir 
723cdf0e10cSrcweir 
724cdf0e10cSrcweir 
725cdf0e10cSrcweir sal_Bool SAL_CALL
supportsService(const OUString & sServiceName)726cdf0e10cSrcweir  	AccessibleSlideSorterView::supportsService (const OUString& sServiceName)
727cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
728cdf0e10cSrcweir {
729cdf0e10cSrcweir     ThrowIfDisposed ();
730cdf0e10cSrcweir 
731cdf0e10cSrcweir     //  Iterate over all supported service names and return true if on of them
732cdf0e10cSrcweir     //  matches the given name.
733cdf0e10cSrcweir     uno::Sequence< ::rtl::OUString> aSupportedServices (
734cdf0e10cSrcweir         getSupportedServiceNames ());
735cdf0e10cSrcweir     for (int i=0; i<aSupportedServices.getLength(); i++)
736cdf0e10cSrcweir         if (sServiceName == aSupportedServices[i])
737cdf0e10cSrcweir             return sal_True;
738cdf0e10cSrcweir     return sal_False;
739cdf0e10cSrcweir }
740cdf0e10cSrcweir 
741cdf0e10cSrcweir 
742cdf0e10cSrcweir 
743cdf0e10cSrcweir 
744cdf0e10cSrcweir uno::Sequence< ::rtl::OUString> SAL_CALL
getSupportedServiceNames(void)745cdf0e10cSrcweir    	AccessibleSlideSorterView::getSupportedServiceNames (void)
746cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
747cdf0e10cSrcweir {
748cdf0e10cSrcweir     ThrowIfDisposed ();
749cdf0e10cSrcweir 
750cdf0e10cSrcweir 	static const OUString sServiceNames[3] = {
751cdf0e10cSrcweir         OUString(RTL_CONSTASCII_USTRINGPARAM(
752cdf0e10cSrcweir             "com.sun.star.accessibility.Accessible")),
753cdf0e10cSrcweir         OUString(RTL_CONSTASCII_USTRINGPARAM(
754cdf0e10cSrcweir             "com.sun.star.accessibility.AccessibleContext")),
755cdf0e10cSrcweir         OUString(RTL_CONSTASCII_USTRINGPARAM(
756cdf0e10cSrcweir             "com.sun.star.drawing.AccessibleSlideSorterView"))
757cdf0e10cSrcweir     };
758cdf0e10cSrcweir 	return uno::Sequence<OUString> (sServiceNames, 3);
759cdf0e10cSrcweir }
760cdf0e10cSrcweir 
761cdf0e10cSrcweir 
762cdf0e10cSrcweir 
763cdf0e10cSrcweir 
ThrowIfDisposed(void)764cdf0e10cSrcweir void AccessibleSlideSorterView::ThrowIfDisposed (void)
765cdf0e10cSrcweir     throw (lang::DisposedException)
766cdf0e10cSrcweir {
767cdf0e10cSrcweir 	if (rBHelper.bDisposed || rBHelper.bInDispose)
768cdf0e10cSrcweir 	{
769cdf0e10cSrcweir         OSL_TRACE ("Calling disposed object. Throwing exception:");
770cdf0e10cSrcweir         throw lang::DisposedException (
771cdf0e10cSrcweir             OUString(RTL_CONSTASCII_USTRINGPARAM("object has been already disposed")),
772cdf0e10cSrcweir             static_cast<uno::XWeak*>(this));
773cdf0e10cSrcweir     }
774cdf0e10cSrcweir }
775cdf0e10cSrcweir 
776cdf0e10cSrcweir 
777cdf0e10cSrcweir 
IsDisposed(void)778cdf0e10cSrcweir sal_Bool AccessibleSlideSorterView::IsDisposed (void)
779cdf0e10cSrcweir {
780cdf0e10cSrcweir 	return (rBHelper.bDisposed || rBHelper.bInDispose);
781cdf0e10cSrcweir }
782cdf0e10cSrcweir 
783cdf0e10cSrcweir 
784cdf0e10cSrcweir 
785cdf0e10cSrcweir 
786cdf0e10cSrcweir //===== AccessibleSlideSorterView::Implementation =============================
787cdf0e10cSrcweir 
Implementation(AccessibleSlideSorterView & rAccessibleSlideSorter,::sd::slidesorter::SlideSorter & rSlideSorter,::Window * pWindow)788cdf0e10cSrcweir AccessibleSlideSorterView::Implementation::Implementation (
789cdf0e10cSrcweir     AccessibleSlideSorterView& rAccessibleSlideSorter,
790cdf0e10cSrcweir     ::sd::slidesorter::SlideSorter& rSlideSorter,
791cdf0e10cSrcweir     ::Window* pWindow)
792cdf0e10cSrcweir     : mrAccessibleSlideSorter(rAccessibleSlideSorter),
793cdf0e10cSrcweir       mrSlideSorter(rSlideSorter),
794cdf0e10cSrcweir       maPageObjects(),
795cdf0e10cSrcweir       mnFirstVisibleChild(0),
796cdf0e10cSrcweir       mnLastVisibleChild(-1),
797cdf0e10cSrcweir       mbListeningToDocument(false),
798cdf0e10cSrcweir       mpWindow(pWindow),
799cdf0e10cSrcweir       mnFocusedIndex(-1),
800cdf0e10cSrcweir       mbModelChangeLocked(false),
801cdf0e10cSrcweir       mnUpdateChildrenUserEventId(0),
802cdf0e10cSrcweir       mnSelectionChangeUserEventId(0)
803cdf0e10cSrcweir {
804cdf0e10cSrcweir     ConnectListeners();
805cdf0e10cSrcweir     UpdateChildren();
806cdf0e10cSrcweir }
807cdf0e10cSrcweir 
808cdf0e10cSrcweir 
809cdf0e10cSrcweir 
810cdf0e10cSrcweir 
~Implementation(void)811cdf0e10cSrcweir AccessibleSlideSorterView::Implementation::~Implementation (void)
812cdf0e10cSrcweir {
813cdf0e10cSrcweir     if (mnUpdateChildrenUserEventId != 0)
814cdf0e10cSrcweir         Application::RemoveUserEvent(mnUpdateChildrenUserEventId);
815cdf0e10cSrcweir     if (mnSelectionChangeUserEventId != 0)
816cdf0e10cSrcweir         Application::RemoveUserEvent(mnSelectionChangeUserEventId);
817cdf0e10cSrcweir     ReleaseListeners();
818cdf0e10cSrcweir     Clear();
819cdf0e10cSrcweir }
820cdf0e10cSrcweir 
821cdf0e10cSrcweir 
822cdf0e10cSrcweir 
823cdf0e10cSrcweir 
RequestUpdateChildren(void)824cdf0e10cSrcweir void AccessibleSlideSorterView::Implementation::RequestUpdateChildren (void)
825cdf0e10cSrcweir {
826cdf0e10cSrcweir     if (mnUpdateChildrenUserEventId == 0)
827cdf0e10cSrcweir         mnUpdateChildrenUserEventId = Application::PostUserEvent(
828cdf0e10cSrcweir             LINK(this, AccessibleSlideSorterView::Implementation,
829cdf0e10cSrcweir             UpdateChildrenCallback));
830cdf0e10cSrcweir }
831cdf0e10cSrcweir 
832cdf0e10cSrcweir 
833cdf0e10cSrcweir 
834cdf0e10cSrcweir 
UpdateChildren(void)835cdf0e10cSrcweir void AccessibleSlideSorterView::Implementation::UpdateChildren (void)
836cdf0e10cSrcweir {
8370deba7fbSSteve Yin   	//By default, all children should be accessable. So here workaround is to make all children visible.
8380deba7fbSSteve Yin   	// MT: THis was in UpdateVisibility, which has some similarity, and hg merge automatically has put it here. Correct?!
8390deba7fbSSteve Yin   	// In the IA2 CWS, also setting mnFirst/LastVisibleChild was commented out!
8400deba7fbSSteve Yin   	mnLastVisibleChild = maPageObjects.size();
8410deba7fbSSteve Yin 
842cdf0e10cSrcweir     if (mbModelChangeLocked)
843cdf0e10cSrcweir     {
844cdf0e10cSrcweir         // Do nothing right now.  When the flag is reset, this method is
845cdf0e10cSrcweir         // called again.
846cdf0e10cSrcweir         return;
847cdf0e10cSrcweir     }
848cdf0e10cSrcweir 
849cdf0e10cSrcweir     const Pair aRange (mrSlideSorter.GetView().GetVisiblePageRange());
850cdf0e10cSrcweir     mnFirstVisibleChild = aRange.A();
851cdf0e10cSrcweir     mnLastVisibleChild = aRange.B();
852cdf0e10cSrcweir 
853cdf0e10cSrcweir     // Release all children.
854cdf0e10cSrcweir     Clear();
855cdf0e10cSrcweir 
856cdf0e10cSrcweir     // Create new children for the modified visible range.
857cdf0e10cSrcweir     maPageObjects.resize(mrSlideSorter.GetModel().GetPageCount());
858cdf0e10cSrcweir     for (sal_Int32 nIndex(mnFirstVisibleChild); nIndex<=mnLastVisibleChild; ++nIndex)
859cdf0e10cSrcweir         GetAccessibleChild(nIndex);
860cdf0e10cSrcweir }
861cdf0e10cSrcweir 
862cdf0e10cSrcweir 
863cdf0e10cSrcweir 
864cdf0e10cSrcweir 
Clear(void)865cdf0e10cSrcweir void AccessibleSlideSorterView::Implementation::Clear (void)
866cdf0e10cSrcweir {
867cdf0e10cSrcweir     PageObjectList::iterator iPageObject;
868cdf0e10cSrcweir     PageObjectList::iterator iEnd = maPageObjects.end();
869cdf0e10cSrcweir     for (iPageObject=maPageObjects.begin(); iPageObject!=iEnd; ++iPageObject)
870cdf0e10cSrcweir         if (*iPageObject != NULL)
871cdf0e10cSrcweir         {
872cdf0e10cSrcweir             mrAccessibleSlideSorter.FireAccessibleEvent(
873cdf0e10cSrcweir                 AccessibleEventId::CHILD,
874cdf0e10cSrcweir                 Any(Reference<XAccessible>(iPageObject->get())),
875cdf0e10cSrcweir                 Any());
876cdf0e10cSrcweir 
877cdf0e10cSrcweir             Reference<XComponent> xComponent (Reference<XWeak>(iPageObject->get()), UNO_QUERY);
878cdf0e10cSrcweir             if (xComponent.is())
879cdf0e10cSrcweir                 xComponent->dispose();
880cdf0e10cSrcweir             *iPageObject = NULL;
881cdf0e10cSrcweir         }
882cdf0e10cSrcweir     maPageObjects.clear();
883cdf0e10cSrcweir }
884cdf0e10cSrcweir 
885cdf0e10cSrcweir 
886cdf0e10cSrcweir 
887cdf0e10cSrcweir 
GetVisibleChildCount(void) const888cdf0e10cSrcweir sal_Int32 AccessibleSlideSorterView::Implementation::GetVisibleChildCount (void) const
889cdf0e10cSrcweir {
890cdf0e10cSrcweir     if (mnFirstVisibleChild<=mnLastVisibleChild && mnFirstVisibleChild>=0)
891cdf0e10cSrcweir         return mnLastVisibleChild - mnFirstVisibleChild + 1;
892cdf0e10cSrcweir     else
893cdf0e10cSrcweir         return 0;
894cdf0e10cSrcweir }
895cdf0e10cSrcweir 
896cdf0e10cSrcweir 
897cdf0e10cSrcweir 
898cdf0e10cSrcweir 
GetVisibleChild(sal_Int32 nIndex)899cdf0e10cSrcweir AccessibleSlideSorterObject* AccessibleSlideSorterView::Implementation::GetVisibleChild (
900cdf0e10cSrcweir     sal_Int32 nIndex)
901cdf0e10cSrcweir {
902cdf0e10cSrcweir     assert(nIndex>=0 && nIndex<GetVisibleChildCount());
903cdf0e10cSrcweir 
904cdf0e10cSrcweir     return GetAccessibleChild(nIndex+mnFirstVisibleChild);
905cdf0e10cSrcweir }
906cdf0e10cSrcweir 
907cdf0e10cSrcweir 
908cdf0e10cSrcweir 
909cdf0e10cSrcweir 
GetAccessibleChild(sal_Int32 nIndex)910cdf0e10cSrcweir AccessibleSlideSorterObject* AccessibleSlideSorterView::Implementation::GetAccessibleChild (
911cdf0e10cSrcweir     sal_Int32 nIndex)
912cdf0e10cSrcweir {
913cdf0e10cSrcweir     AccessibleSlideSorterObject* pChild = NULL;
914cdf0e10cSrcweir 
915cdf0e10cSrcweir     if (nIndex>=0 && (sal_uInt32)nIndex<maPageObjects.size())
916cdf0e10cSrcweir     {
917cdf0e10cSrcweir         if (maPageObjects[nIndex] == NULL)
918cdf0e10cSrcweir         {
919cdf0e10cSrcweir             ::sd::slidesorter::model::SharedPageDescriptor pDescriptor(
920cdf0e10cSrcweir                 mrSlideSorter.GetModel().GetPageDescriptor(nIndex));
921cdf0e10cSrcweir             if (pDescriptor.get() != NULL)
922cdf0e10cSrcweir             {
923cdf0e10cSrcweir                 maPageObjects[nIndex] = new AccessibleSlideSorterObject(
924cdf0e10cSrcweir                     &mrAccessibleSlideSorter,
925cdf0e10cSrcweir                     mrSlideSorter,
926cdf0e10cSrcweir                     (pDescriptor->GetPage()->GetPageNum()-1)/2);
927cdf0e10cSrcweir 
928cdf0e10cSrcweir                 mrAccessibleSlideSorter.FireAccessibleEvent(
929cdf0e10cSrcweir                     AccessibleEventId::CHILD,
930cdf0e10cSrcweir                     Any(),
931cdf0e10cSrcweir                     Any(Reference<XAccessible>(maPageObjects[nIndex].get())));
932cdf0e10cSrcweir             }
933cdf0e10cSrcweir 
934cdf0e10cSrcweir         }
935cdf0e10cSrcweir 
936cdf0e10cSrcweir         pChild = maPageObjects[nIndex].get();
937cdf0e10cSrcweir     }
938cdf0e10cSrcweir     else
939cdf0e10cSrcweir     {
940cdf0e10cSrcweir         OSL_ASSERT(nIndex>=0 && (sal_uInt32)nIndex<maPageObjects.size());
941cdf0e10cSrcweir     }
942cdf0e10cSrcweir 
943cdf0e10cSrcweir     return pChild;
944cdf0e10cSrcweir }
945cdf0e10cSrcweir 
946cdf0e10cSrcweir 
947cdf0e10cSrcweir 
948cdf0e10cSrcweir 
ConnectListeners(void)949cdf0e10cSrcweir void AccessibleSlideSorterView::Implementation::ConnectListeners (void)
950cdf0e10cSrcweir {
951cdf0e10cSrcweir     StartListening (*mrSlideSorter.GetModel().GetDocument());
952cdf0e10cSrcweir     if (mrSlideSorter.GetViewShell() != NULL)
953cdf0e10cSrcweir         StartListening (*mrSlideSorter.GetViewShell());
954cdf0e10cSrcweir     mbListeningToDocument = true;
955cdf0e10cSrcweir 
956cdf0e10cSrcweir     if (mpWindow != NULL)
957cdf0e10cSrcweir         mpWindow->AddEventListener(
958cdf0e10cSrcweir             LINK(this,AccessibleSlideSorterView::Implementation,WindowEventListener));
959cdf0e10cSrcweir 
960cdf0e10cSrcweir     mrSlideSorter.GetController().GetSelectionManager()->AddSelectionChangeListener(
961cdf0e10cSrcweir         LINK(this,AccessibleSlideSorterView::Implementation,SelectionChangeListener));
962cdf0e10cSrcweir     mrSlideSorter.GetController().GetFocusManager().AddFocusChangeListener(
963cdf0e10cSrcweir         LINK(this,AccessibleSlideSorterView::Implementation,FocusChangeListener));
964cdf0e10cSrcweir     mrSlideSorter.GetView().AddVisibilityChangeListener(
965cdf0e10cSrcweir         LINK(this,AccessibleSlideSorterView::Implementation,UpdateChildrenCallback));
966cdf0e10cSrcweir }
967cdf0e10cSrcweir 
968cdf0e10cSrcweir 
969cdf0e10cSrcweir 
970cdf0e10cSrcweir 
ReleaseListeners(void)971cdf0e10cSrcweir void AccessibleSlideSorterView::Implementation::ReleaseListeners (void)
972cdf0e10cSrcweir {
973cdf0e10cSrcweir     mrSlideSorter.GetController().GetFocusManager().RemoveFocusChangeListener(
974cdf0e10cSrcweir         LINK(this,AccessibleSlideSorterView::Implementation,FocusChangeListener));
975cdf0e10cSrcweir     mrSlideSorter.GetController().GetSelectionManager()->RemoveSelectionChangeListener(
976cdf0e10cSrcweir         LINK(this,AccessibleSlideSorterView::Implementation,SelectionChangeListener));
977cdf0e10cSrcweir     mrSlideSorter.GetView().RemoveVisibilityChangeListener(
978cdf0e10cSrcweir         LINK(this,AccessibleSlideSorterView::Implementation,UpdateChildrenCallback));
979cdf0e10cSrcweir 
980cdf0e10cSrcweir     if (mpWindow != NULL)
981cdf0e10cSrcweir         mpWindow->RemoveEventListener(
982cdf0e10cSrcweir             LINK(this,AccessibleSlideSorterView::Implementation,WindowEventListener));
983cdf0e10cSrcweir 
984cdf0e10cSrcweir     if (mbListeningToDocument)
985cdf0e10cSrcweir     {
986cdf0e10cSrcweir         if (mrSlideSorter.GetViewShell() != NULL)
987cdf0e10cSrcweir             StartListening(*mrSlideSorter.GetViewShell());
988cdf0e10cSrcweir         EndListening (*mrSlideSorter.GetModel().GetDocument());
989cdf0e10cSrcweir         mbListeningToDocument = false;
990cdf0e10cSrcweir     }
991cdf0e10cSrcweir }
992cdf0e10cSrcweir 
993cdf0e10cSrcweir 
994cdf0e10cSrcweir 
995cdf0e10cSrcweir 
Notify(SfxBroadcaster &,const SfxHint & rHint)996cdf0e10cSrcweir void AccessibleSlideSorterView::Implementation::Notify (
997cdf0e10cSrcweir     SfxBroadcaster&,
998cdf0e10cSrcweir     const SfxHint& rHint)
999cdf0e10cSrcweir {
1000cdf0e10cSrcweir     if (rHint.ISA(SdrHint))
1001cdf0e10cSrcweir     {
1002cdf0e10cSrcweir         SdrHint& rSdrHint (*PTR_CAST(SdrHint,&rHint));
1003cdf0e10cSrcweir         switch (rSdrHint.GetKind())
1004cdf0e10cSrcweir         {
1005cdf0e10cSrcweir             case HINT_PAGEORDERCHG:
1006cdf0e10cSrcweir                 RequestUpdateChildren();
1007cdf0e10cSrcweir                 break;
1008cdf0e10cSrcweir             default:
1009cdf0e10cSrcweir                 break;
1010cdf0e10cSrcweir         }
1011cdf0e10cSrcweir     }
1012cdf0e10cSrcweir     else if (rHint.ISA(sd::ViewShellHint))
1013cdf0e10cSrcweir     {
1014cdf0e10cSrcweir         sd::ViewShellHint& rViewShellHint (*PTR_CAST(sd::ViewShellHint, &rHint));
1015cdf0e10cSrcweir         switch (rViewShellHint.GetHintId())
1016cdf0e10cSrcweir         {
1017cdf0e10cSrcweir             case sd::ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START:
1018cdf0e10cSrcweir                 mbModelChangeLocked = true;
1019cdf0e10cSrcweir                 break;
1020cdf0e10cSrcweir 
1021cdf0e10cSrcweir             case sd::ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END:
1022cdf0e10cSrcweir                 mbModelChangeLocked = false;
1023cdf0e10cSrcweir                 RequestUpdateChildren();
1024cdf0e10cSrcweir                 break;
1025cdf0e10cSrcweir             default:
1026cdf0e10cSrcweir                 break;
1027cdf0e10cSrcweir         }
1028cdf0e10cSrcweir     }
1029cdf0e10cSrcweir }
1030cdf0e10cSrcweir 
1031cdf0e10cSrcweir 
SwitchViewActivated(void)10320deba7fbSSteve Yin void AccessibleSlideSorterView::SwitchViewActivated (void)
10330deba7fbSSteve Yin {
10340deba7fbSSteve Yin 	// Firstly, set focus to view
10350deba7fbSSteve Yin 	this->FireAccessibleEvent(AccessibleEventId::STATE_CHANGED,
10360deba7fbSSteve Yin                     Any(),
10370deba7fbSSteve Yin                     Any(AccessibleStateType::FOCUSED));
10380deba7fbSSteve Yin 
10390deba7fbSSteve Yin 	mpImpl->Activated();
10400deba7fbSSteve Yin }
10410deba7fbSSteve Yin 
Activated()10420deba7fbSSteve Yin void AccessibleSlideSorterView::Implementation::Activated()
10430deba7fbSSteve Yin {
10440deba7fbSSteve Yin 	mrSlideSorter.GetController().GetFocusManager().ShowFocus();
10450deba7fbSSteve Yin 
10460deba7fbSSteve Yin }
10470deba7fbSSteve Yin 
1048cdf0e10cSrcweir 
1049cdf0e10cSrcweir 
IMPL_LINK(AccessibleSlideSorterView::Implementation,WindowEventListener,VclWindowEvent *,pEvent)1050cdf0e10cSrcweir IMPL_LINK(AccessibleSlideSorterView::Implementation, WindowEventListener, VclWindowEvent*, pEvent)
1051cdf0e10cSrcweir {
1052cdf0e10cSrcweir 	switch (pEvent->GetId())
1053cdf0e10cSrcweir     {
1054cdf0e10cSrcweir         case VCLEVENT_WINDOW_MOVE:
1055cdf0e10cSrcweir         case VCLEVENT_WINDOW_RESIZE:
1056cdf0e10cSrcweir             RequestUpdateChildren();
1057cdf0e10cSrcweir             break;
1058cdf0e10cSrcweir 
1059cdf0e10cSrcweir         case VCLEVENT_WINDOW_GETFOCUS:
1060cdf0e10cSrcweir         case VCLEVENT_WINDOW_LOSEFOCUS:
1061cdf0e10cSrcweir             mrAccessibleSlideSorter.FireAccessibleEvent(
1062cdf0e10cSrcweir                 AccessibleEventId::SELECTION_CHANGED,
1063cdf0e10cSrcweir                 Any(),
1064cdf0e10cSrcweir                 Any());
1065cdf0e10cSrcweir             break;
1066cdf0e10cSrcweir         default:
1067cdf0e10cSrcweir             break;
1068cdf0e10cSrcweir     }
1069cdf0e10cSrcweir     return 1;
1070cdf0e10cSrcweir }
1071cdf0e10cSrcweir 
1072cdf0e10cSrcweir 
1073cdf0e10cSrcweir 
1074cdf0e10cSrcweir 
IMPL_LINK(AccessibleSlideSorterView::Implementation,SelectionChangeListener,void *,EMPTYARG)1075cdf0e10cSrcweir IMPL_LINK(AccessibleSlideSorterView::Implementation, SelectionChangeListener, void*, EMPTYARG )
1076cdf0e10cSrcweir {
1077cdf0e10cSrcweir     if (mnSelectionChangeUserEventId == 0)
1078cdf0e10cSrcweir         mnSelectionChangeUserEventId = Application::PostUserEvent(
1079cdf0e10cSrcweir             LINK(this, AccessibleSlideSorterView::Implementation, BroadcastSelectionChange));
1080cdf0e10cSrcweir     return 1;
1081cdf0e10cSrcweir }
1082cdf0e10cSrcweir 
1083cdf0e10cSrcweir 
1084cdf0e10cSrcweir 
1085cdf0e10cSrcweir 
IMPL_LINK(AccessibleSlideSorterView::Implementation,BroadcastSelectionChange,void *,EMPTYARG)1086cdf0e10cSrcweir IMPL_LINK(AccessibleSlideSorterView::Implementation, BroadcastSelectionChange, void*, EMPTYARG )
1087cdf0e10cSrcweir {
1088cdf0e10cSrcweir     mnSelectionChangeUserEventId = 0;
1089cdf0e10cSrcweir     mrAccessibleSlideSorter.FireAccessibleEvent(
1090cdf0e10cSrcweir         AccessibleEventId::SELECTION_CHANGED,
1091cdf0e10cSrcweir         Any(),
1092cdf0e10cSrcweir         Any());
1093cdf0e10cSrcweir     return 1;
1094cdf0e10cSrcweir }
1095cdf0e10cSrcweir 
1096cdf0e10cSrcweir 
1097cdf0e10cSrcweir 
1098cdf0e10cSrcweir 
IMPL_LINK(AccessibleSlideSorterView::Implementation,FocusChangeListener,void *,EMPTYARG)1099cdf0e10cSrcweir IMPL_LINK(AccessibleSlideSorterView::Implementation, FocusChangeListener, void*, EMPTYARG )
1100cdf0e10cSrcweir {
1101cdf0e10cSrcweir     sal_Int32 nNewFocusedIndex (
1102cdf0e10cSrcweir         mrSlideSorter.GetController().GetFocusManager().GetFocusedPageIndex());
1103cdf0e10cSrcweir 
11040deba7fbSSteve Yin     sal_Bool bHasFocus = mrSlideSorter.GetController().GetFocusManager().IsFocusShowing();
11050deba7fbSSteve Yin     if (!bHasFocus)
11060deba7fbSSteve Yin     	nNewFocusedIndex = -1;
11070deba7fbSSteve Yin 
11080deba7fbSSteve Yin     // add a checker whether the focus event is sent out. Only after sent, the mnFocusedIndex should be updated.
11090deba7fbSSteve Yin     sal_Bool bSentFocus = sal_False;
1110cdf0e10cSrcweir     if (nNewFocusedIndex != mnFocusedIndex)
1111cdf0e10cSrcweir     {
1112cdf0e10cSrcweir         if (mnFocusedIndex >= 0)
1113cdf0e10cSrcweir         {
1114cdf0e10cSrcweir             AccessibleSlideSorterObject* pObject = GetAccessibleChild(mnFocusedIndex);
1115cdf0e10cSrcweir             if (pObject != NULL)
11160deba7fbSSteve Yin 			{
1117cdf0e10cSrcweir                 pObject->FireAccessibleEvent(
1118cdf0e10cSrcweir                     AccessibleEventId::STATE_CHANGED,
1119cdf0e10cSrcweir                     Any(AccessibleStateType::FOCUSED),
1120cdf0e10cSrcweir                     Any());
11210deba7fbSSteve Yin 				bSentFocus = sal_True;
11220deba7fbSSteve Yin 			}
1123cdf0e10cSrcweir         }
1124cdf0e10cSrcweir         if (nNewFocusedIndex >= 0)
1125cdf0e10cSrcweir         {
1126cdf0e10cSrcweir             AccessibleSlideSorterObject* pObject = GetAccessibleChild(nNewFocusedIndex);
1127cdf0e10cSrcweir             if (pObject != NULL)
11280deba7fbSSteve Yin 			{
1129cdf0e10cSrcweir                 pObject->FireAccessibleEvent(
1130cdf0e10cSrcweir                     AccessibleEventId::STATE_CHANGED,
1131cdf0e10cSrcweir                     Any(),
1132cdf0e10cSrcweir                     Any(AccessibleStateType::FOCUSED));
11330deba7fbSSteve Yin 				bSentFocus = sal_True;
11340deba7fbSSteve Yin 			}
1135cdf0e10cSrcweir         }
11360deba7fbSSteve Yin 		if (bSentFocus == sal_True)
11370deba7fbSSteve Yin 			mnFocusedIndex = nNewFocusedIndex;
1138cdf0e10cSrcweir     }
1139cdf0e10cSrcweir     return 1;
1140cdf0e10cSrcweir }
1141cdf0e10cSrcweir 
1142cdf0e10cSrcweir 
1143cdf0e10cSrcweir 
1144cdf0e10cSrcweir 
IMPL_LINK(AccessibleSlideSorterView::Implementation,UpdateChildrenCallback,void *,EMPTYARG)1145cdf0e10cSrcweir IMPL_LINK(AccessibleSlideSorterView::Implementation, UpdateChildrenCallback, void*, EMPTYARG )
1146cdf0e10cSrcweir {
1147cdf0e10cSrcweir     mnUpdateChildrenUserEventId = 0;
1148cdf0e10cSrcweir     UpdateChildren();
1149cdf0e10cSrcweir 
1150cdf0e10cSrcweir     return 1;
1151cdf0e10cSrcweir }
1152cdf0e10cSrcweir 
1153cdf0e10cSrcweir 
1154cdf0e10cSrcweir 
1155cdf0e10cSrcweir 
1156cdf0e10cSrcweir } // end of namespace ::accessibility
1157