2010-10-12 15:51:52 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-27 16:10:40 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2005-07-14 09:10:40 +00:00
|
|
|
|
2006-09-16 17:26:40 +00:00
|
|
|
|
2005-07-14 09:10:40 +00:00
|
|
|
#include "AccessibleSlideSorterView.hxx"
|
|
|
|
#include "AccessibleSlideSorterObject.hxx"
|
|
|
|
|
2008-04-03 12:24:14 +00:00
|
|
|
#include "SlideSorter.hxx"
|
2005-07-14 09:10:40 +00:00
|
|
|
#include "controller/SlideSorterController.hxx"
|
|
|
|
#include "controller/SlsPageSelector.hxx"
|
|
|
|
#include "controller/SlsFocusManager.hxx"
|
2008-04-03 12:24:14 +00:00
|
|
|
#include "controller/SlsSelectionManager.hxx"
|
2005-07-14 09:10:40 +00:00
|
|
|
#include "view/SlideSorterView.hxx"
|
|
|
|
#include "model/SlideSorterModel.hxx"
|
|
|
|
#include "model/SlsPageDescriptor.hxx"
|
|
|
|
#include "SlideSorterViewShell.hxx"
|
|
|
|
|
|
|
|
#include "ViewShellHint.hxx"
|
|
|
|
#include "sdpage.hxx"
|
|
|
|
#include "drawdoc.hxx"
|
|
|
|
|
|
|
|
#include "sdresid.hxx"
|
|
|
|
#include "accessibility.hrc"
|
|
|
|
#include <com/sun/star/accessibility/AccessibleRole.hpp>
|
|
|
|
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
|
|
|
|
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
|
|
|
|
#include <comphelper/accessibleeventnotifier.hxx>
|
|
|
|
#include <unotools/accessiblestatesethelper.hxx>
|
|
|
|
#include <rtl/ref.hxx>
|
2006-11-14 13:24:05 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
|
2005-07-14 09:10:40 +00:00
|
|
|
using ::rtl::OUString;
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::accessibility;
|
|
|
|
|
|
|
|
namespace accessibility {
|
|
|
|
|
|
|
|
|
2010-06-16 14:35:53 +02:00
|
|
|
/** Inner implementation class of the AccessibleSlideSorterView.
|
|
|
|
|
|
|
|
Note that some event broadcasting is done asynchronously because
|
2010-07-01 18:06:39 +02:00
|
|
|
otherwise it could lead to deadlocks on (at least) some Solaris
|
2010-06-16 14:35:53 +02:00
|
|
|
machines. Probably (but unverified) this can happen on all GTK based
|
|
|
|
systems. The asynchronous broadcasting is just a workaround for a
|
|
|
|
poorly understood problem.
|
|
|
|
*/
|
2005-07-14 09:10:40 +00:00
|
|
|
class AccessibleSlideSorterView::Implementation
|
|
|
|
: public SfxListener
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Implementation (
|
|
|
|
AccessibleSlideSorterView& rAccessibleSlideSorter,
|
2008-04-03 12:24:14 +00:00
|
|
|
::sd::slidesorter::SlideSorter& rSlideSorter,
|
2005-07-14 09:10:40 +00:00
|
|
|
::Window* pWindow);
|
|
|
|
~Implementation (void);
|
|
|
|
|
2010-06-16 14:35:53 +02:00
|
|
|
void RequestUpdateChildren (void);
|
2005-07-14 09:10:40 +00:00
|
|
|
void Clear (void);
|
|
|
|
sal_Int32 GetVisibleChildCount (void) const;
|
|
|
|
AccessibleSlideSorterObject* GetAccessibleChild (sal_Int32 nIndex);
|
|
|
|
AccessibleSlideSorterObject* GetVisibleChild (sal_Int32 nIndex);
|
|
|
|
|
|
|
|
void ConnectListeners (void);
|
|
|
|
void ReleaseListeners (void);
|
|
|
|
void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint);
|
|
|
|
DECL_LINK(WindowEventListener, VclWindowEvent*);
|
|
|
|
DECL_LINK(SelectionChangeListener, void*);
|
2010-06-16 14:35:53 +02:00
|
|
|
DECL_LINK(BroadcastSelectionChange, void*);
|
2005-07-14 09:10:40 +00:00
|
|
|
DECL_LINK(FocusChangeListener, void*);
|
2011-04-14 14:16:39 +01:00
|
|
|
DECL_LINK(VisibilityChangeListener, void*);
|
2010-06-16 14:35:53 +02:00
|
|
|
DECL_LINK(UpdateChildrenCallback, void*);
|
2005-07-14 09:10:40 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
AccessibleSlideSorterView& mrAccessibleSlideSorter;
|
2008-04-03 12:24:14 +00:00
|
|
|
::sd::slidesorter::SlideSorter& mrSlideSorter;
|
2005-07-14 09:10:40 +00:00
|
|
|
typedef ::std::vector<rtl::Reference<AccessibleSlideSorterObject> > PageObjectList;
|
|
|
|
PageObjectList maPageObjects;
|
|
|
|
sal_Int32 mnFirstVisibleChild;
|
|
|
|
sal_Int32 mnLastVisibleChild;
|
|
|
|
bool mbListeningToDocument;
|
|
|
|
::Window* mpWindow;
|
|
|
|
sal_Int32 mnFocusedIndex;
|
|
|
|
bool mbModelChangeLocked;
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uLong mnUpdateChildrenUserEventId;
|
|
|
|
sal_uLong mnSelectionChangeUserEventId;
|
2010-06-16 14:35:53 +02:00
|
|
|
|
|
|
|
void UpdateChildren (void);
|
2005-07-14 09:10:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//===== AccessibleSlideSorterView =============================================
|
|
|
|
|
|
|
|
AccessibleSlideSorterView::AccessibleSlideSorterView(
|
2008-04-03 12:24:14 +00:00
|
|
|
::sd::slidesorter::SlideSorter& rSlideSorter,
|
2005-07-14 09:10:40 +00:00
|
|
|
const Reference<XAccessible>& rxParent,
|
|
|
|
::Window* pContentWindow)
|
|
|
|
: AccessibleSlideSorterViewBase(MutexOwner::maMutex),
|
2008-04-03 12:24:14 +00:00
|
|
|
mrSlideSorter(rSlideSorter),
|
2005-07-14 09:10:40 +00:00
|
|
|
mxParent(rxParent),
|
|
|
|
mnClientId(0),
|
|
|
|
mpContentWindow(pContentWindow)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-30 17:34:35 +01:00
|
|
|
|
|
|
|
void AccessibleSlideSorterView::Init()
|
|
|
|
{
|
|
|
|
mpImpl.reset(new Implementation(*this,mrSlideSorter,mpContentWindow));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-14 09:10:40 +00:00
|
|
|
AccessibleSlideSorterView::~AccessibleSlideSorterView (void)
|
|
|
|
{
|
2005-10-20 07:39:43 +00:00
|
|
|
Destroyed ();
|
2005-07-14 09:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AccessibleSlideSorterView::FireAccessibleEvent (
|
|
|
|
short nEventId,
|
|
|
|
const uno::Any& rOldValue,
|
|
|
|
const uno::Any& rNewValue )
|
|
|
|
{
|
|
|
|
if (mnClientId != 0)
|
|
|
|
{
|
|
|
|
AccessibleEventObject aEventObject;
|
|
|
|
|
|
|
|
aEventObject.Source = Reference<XWeak>(this);
|
|
|
|
aEventObject.EventId = nEventId;
|
|
|
|
aEventObject.NewValue = rNewValue;
|
|
|
|
aEventObject.OldValue = rOldValue;
|
|
|
|
|
|
|
|
comphelper::AccessibleEventNotifier::addEvent (mnClientId, aEventObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SAL_CALL AccessibleSlideSorterView::disposing (void)
|
|
|
|
{
|
2005-10-19 11:23:54 +00:00
|
|
|
if (mnClientId != 0)
|
|
|
|
{
|
|
|
|
comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
|
|
|
|
mnClientId = 0;
|
|
|
|
}
|
|
|
|
mpImpl.reset(NULL);
|
2005-07-14 09:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-19 11:50:34 +00:00
|
|
|
AccessibleSlideSorterObject* AccessibleSlideSorterView::GetAccessibleChildImplementation (
|
|
|
|
sal_Int32 nIndex)
|
|
|
|
{
|
|
|
|
AccessibleSlideSorterObject* pResult = NULL;
|
|
|
|
::osl::MutexGuard aGuard (maMutex);
|
|
|
|
|
|
|
|
if (nIndex>=0 && nIndex<mpImpl->GetVisibleChildCount())
|
|
|
|
pResult = mpImpl->GetVisibleChild(nIndex);
|
|
|
|
|
|
|
|
return pResult;
|
|
|
|
}
|
|
|
|
|
2005-07-14 09:10:40 +00:00
|
|
|
void AccessibleSlideSorterView::Destroyed (void)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard (maMutex);
|
|
|
|
|
|
|
|
// Send a disposing to all listeners.
|
|
|
|
if (mnClientId != 0)
|
|
|
|
{
|
|
|
|
comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
|
|
|
|
mnClientId = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//===== XAccessible =========================================================
|
|
|
|
|
|
|
|
Reference<XAccessibleContext > SAL_CALL
|
|
|
|
AccessibleSlideSorterView::getAccessibleContext (void)
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2008-07-07 13:22:00 +00:00
|
|
|
ThrowIfDisposed ();
|
2005-07-14 09:10:40 +00:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
//===== XAccessibleContext ==================================================
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL AccessibleSlideSorterView::getAccessibleChildCount (void)
|
|
|
|
throw (RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
|
|
|
::osl::MutexGuard aGuard (maMutex);
|
|
|
|
return mpImpl->GetVisibleChildCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
Reference<XAccessible > SAL_CALL
|
|
|
|
AccessibleSlideSorterView::getAccessibleChild (sal_Int32 nIndex)
|
|
|
|
throw (lang::IndexOutOfBoundsException, RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
|
|
|
::osl::MutexGuard aGuard (maMutex);
|
|
|
|
|
|
|
|
if (nIndex<0 || nIndex>=mpImpl->GetVisibleChildCount())
|
|
|
|
throw lang::IndexOutOfBoundsException();
|
|
|
|
|
|
|
|
return mpImpl->GetVisibleChild(nIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
Reference<XAccessible > SAL_CALL AccessibleSlideSorterView::getAccessibleParent (void)
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
2010-10-13 02:37:50 -05:00
|
|
|
const SolarMutexGuard aSolarGuard;
|
2005-07-14 09:10:40 +00:00
|
|
|
Reference<XAccessible> xParent;
|
|
|
|
|
|
|
|
if (mpContentWindow != NULL)
|
|
|
|
{
|
|
|
|
::Window* pParent = mpContentWindow->GetAccessibleParentWindow();
|
|
|
|
if (pParent != NULL)
|
|
|
|
xParent = pParent->GetAccessible();
|
|
|
|
}
|
|
|
|
|
|
|
|
return xParent;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL AccessibleSlideSorterView::getAccessibleIndexInParent (void)
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(getAccessibleParent().is());
|
|
|
|
ThrowIfDisposed();
|
2010-10-13 02:37:50 -05:00
|
|
|
const SolarMutexGuard aSolarGuard;
|
2005-07-14 09:10:40 +00:00
|
|
|
sal_Int32 nIndexInParent(-1);
|
|
|
|
|
|
|
|
|
|
|
|
Reference<XAccessibleContext> xParentContext (getAccessibleParent()->getAccessibleContext());
|
|
|
|
if (xParentContext.is())
|
|
|
|
{
|
|
|
|
sal_Int32 nChildCount (xParentContext->getAccessibleChildCount());
|
|
|
|
for (sal_Int32 i=0; i<nChildCount; ++i)
|
|
|
|
if (xParentContext->getAccessibleChild(i).get()
|
|
|
|
== static_cast<XAccessible*>(this))
|
|
|
|
{
|
|
|
|
nIndexInParent = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nIndexInParent;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sal_Int16 SAL_CALL AccessibleSlideSorterView::getAccessibleRole (void)
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2006-01-19 11:50:34 +00:00
|
|
|
ThrowIfDisposed();
|
2008-07-07 13:22:00 +00:00
|
|
|
static sal_Int16 nRole = AccessibleRole::DOCUMENT;
|
2006-01-19 11:50:34 +00:00
|
|
|
return nRole;
|
2005-07-14 09:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
::rtl::OUString SAL_CALL AccessibleSlideSorterView::getAccessibleDescription (void)
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
2010-10-13 02:37:50 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2005-07-14 09:10:40 +00:00
|
|
|
|
|
|
|
return String(SdResId(SID_SD_A11Y_I_SLIDEVIEW_D));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
::rtl::OUString SAL_CALL AccessibleSlideSorterView::getAccessibleName (void)
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
2010-10-13 02:37:50 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2005-07-14 09:10:40 +00:00
|
|
|
|
|
|
|
return String(SdResId(SID_SD_A11Y_I_SLIDEVIEW_N));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reference<XAccessibleRelationSet> SAL_CALL
|
|
|
|
AccessibleSlideSorterView::getAccessibleRelationSet (void)
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return Reference<XAccessibleRelationSet>();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reference<XAccessibleStateSet > SAL_CALL
|
|
|
|
AccessibleSlideSorterView::getAccessibleStateSet (void)
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
2010-10-13 02:37:50 -05:00
|
|
|
const SolarMutexGuard aSolarGuard;
|
2005-07-14 09:10:40 +00:00
|
|
|
::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper();
|
|
|
|
|
|
|
|
pStateSet->AddState(AccessibleStateType::FOCUSABLE);
|
|
|
|
pStateSet->AddState(AccessibleStateType::SELECTABLE);
|
|
|
|
pStateSet->AddState(AccessibleStateType::ENABLED);
|
2006-01-19 11:50:34 +00:00
|
|
|
pStateSet->AddState(AccessibleStateType::ACTIVE);
|
2005-07-14 09:10:40 +00:00
|
|
|
pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE);
|
|
|
|
pStateSet->AddState(AccessibleStateType::OPAQUE);
|
|
|
|
if (mpContentWindow!=NULL)
|
|
|
|
{
|
|
|
|
if (mpContentWindow->IsVisible())
|
|
|
|
pStateSet->AddState(AccessibleStateType::VISIBLE);
|
|
|
|
if (mpContentWindow->IsReallyVisible())
|
|
|
|
pStateSet->AddState(AccessibleStateType::SHOWING);
|
|
|
|
}
|
|
|
|
|
|
|
|
return pStateSet;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lang::Locale SAL_CALL AccessibleSlideSorterView::getLocale (void)
|
|
|
|
throw (IllegalAccessibleComponentStateException,
|
|
|
|
RuntimeException)
|
|
|
|
{
|
2008-07-07 13:22:00 +00:00
|
|
|
ThrowIfDisposed ();
|
2005-07-14 09:10:40 +00:00
|
|
|
Reference<XAccessibleContext> xParentContext;
|
|
|
|
Reference<XAccessible> xParent (getAccessibleParent());
|
|
|
|
if (xParent.is())
|
|
|
|
xParentContext = xParent->getAccessibleContext();
|
|
|
|
|
|
|
|
if (xParentContext.is())
|
|
|
|
return xParentContext->getLocale();
|
|
|
|
else
|
|
|
|
// Strange, no parent! Anyway, return the default locale.
|
2012-11-22 12:26:52 +01:00
|
|
|
return Application::GetSettings().GetLanguageTag().getLocale();
|
2005-07-14 09:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SAL_CALL AccessibleSlideSorterView::addEventListener(
|
|
|
|
const Reference<XAccessibleEventListener >& rxListener)
|
|
|
|
throw (RuntimeException)
|
|
|
|
{
|
|
|
|
if (rxListener.is())
|
|
|
|
{
|
|
|
|
const osl::MutexGuard aGuard(maMutex);
|
|
|
|
|
|
|
|
if (IsDisposed())
|
|
|
|
{
|
|
|
|
uno::Reference<uno::XInterface> x ((lang::XComponent *)this, uno::UNO_QUERY);
|
|
|
|
rxListener->disposing (lang::EventObject (x));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( ! mnClientId)
|
|
|
|
mnClientId = comphelper::AccessibleEventNotifier::registerClient();
|
|
|
|
comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SAL_CALL AccessibleSlideSorterView::removeEventListener(
|
|
|
|
const Reference<XAccessibleEventListener >& rxListener)
|
|
|
|
throw (RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
|
|
|
if (rxListener.is())
|
|
|
|
{
|
|
|
|
const osl::MutexGuard aGuard(maMutex);
|
|
|
|
|
2005-10-19 11:23:54 +00:00
|
|
|
if (mnClientId != 0)
|
2005-07-14 09:10:40 +00:00
|
|
|
{
|
2005-10-19 11:23:54 +00:00
|
|
|
sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener(
|
|
|
|
mnClientId, rxListener );
|
|
|
|
if ( !nListenerCount )
|
|
|
|
{
|
|
|
|
// no listeners anymore -> revoke ourself. This may lead to
|
|
|
|
// the notifier thread dying (if we were the last client),
|
|
|
|
// and at least to us not firing any events anymore, in case
|
|
|
|
// somebody calls NotifyAccessibleEvent, again
|
|
|
|
comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
|
|
|
|
mnClientId = 0;
|
|
|
|
}
|
2005-07-14 09:10:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//===== XAccessibleComponent ==================================================
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL AccessibleSlideSorterView::containsPoint (const awt::Point& aPoint)
|
|
|
|
throw (RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
|
|
|
const awt::Rectangle aBBox (getBounds());
|
|
|
|
return (aPoint.X >= 0)
|
|
|
|
&& (aPoint.X < aBBox.Width)
|
|
|
|
&& (aPoint.Y >= 0)
|
|
|
|
&& (aPoint.Y < aBBox.Height);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reference<XAccessible> SAL_CALL
|
|
|
|
AccessibleSlideSorterView::getAccessibleAtPoint (const awt::Point& aPoint)
|
|
|
|
throw (RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
|
|
|
Reference<XAccessible> xAccessible;
|
2010-10-13 02:37:50 -05:00
|
|
|
const SolarMutexGuard aSolarGuard;
|
2005-07-14 09:10:40 +00:00
|
|
|
|
|
|
|
const Point aTestPoint (aPoint.X, aPoint.Y);
|
2006-04-06 15:17:15 +00:00
|
|
|
::sd::slidesorter::model::SharedPageDescriptor pHitDescriptor (
|
2008-04-03 12:24:14 +00:00
|
|
|
mrSlideSorter.GetController().GetPageAt(aTestPoint));
|
2006-04-06 15:17:15 +00:00
|
|
|
if (pHitDescriptor.get() != NULL)
|
2005-07-14 09:10:40 +00:00
|
|
|
xAccessible = mpImpl->GetAccessibleChild(
|
|
|
|
(pHitDescriptor->GetPage()->GetPageNum()-1)/2);
|
|
|
|
|
|
|
|
return xAccessible;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
awt::Rectangle SAL_CALL AccessibleSlideSorterView::getBounds (void)
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
2010-10-13 02:37:50 -05:00
|
|
|
const SolarMutexGuard aSolarGuard;
|
2005-07-14 09:10:40 +00:00
|
|
|
awt::Rectangle aBBox;
|
|
|
|
|
|
|
|
if (mpContentWindow != NULL)
|
|
|
|
{
|
|
|
|
const Point aPosition (mpContentWindow->GetPosPixel());
|
|
|
|
const Size aSize (mpContentWindow->GetOutputSizePixel());
|
|
|
|
|
|
|
|
aBBox.X = aPosition.X();
|
|
|
|
aBBox.Y = aPosition.Y();
|
|
|
|
aBBox.Width = aSize.Width();
|
|
|
|
aBBox.Height = aSize.Height();
|
|
|
|
}
|
|
|
|
|
|
|
|
return aBBox;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
awt::Point SAL_CALL AccessibleSlideSorterView::getLocation (void)
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
|
|
|
awt::Point aLocation;
|
|
|
|
|
|
|
|
if (mpContentWindow != NULL)
|
|
|
|
{
|
|
|
|
const Point aPosition (mpContentWindow->GetPosPixel());
|
|
|
|
aLocation.X = aPosition.X();
|
|
|
|
aLocation.Y = aPosition.Y();
|
|
|
|
}
|
|
|
|
|
|
|
|
return aLocation;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Calculate the location on screen from the parent's location on screen
|
|
|
|
and our own relative location.
|
|
|
|
*/
|
|
|
|
awt::Point SAL_CALL AccessibleSlideSorterView::getLocationOnScreen()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
2010-10-13 02:37:50 -05:00
|
|
|
const SolarMutexGuard aSolarGuard;
|
2005-07-14 09:10:40 +00:00
|
|
|
awt::Point aParentLocationOnScreen;
|
|
|
|
|
|
|
|
Reference<XAccessible> xParent (getAccessibleParent());
|
|
|
|
if (xParent.is())
|
|
|
|
{
|
|
|
|
Reference<XAccessibleComponent> xParentComponent (
|
|
|
|
xParent->getAccessibleContext(), uno::UNO_QUERY);
|
|
|
|
if (xParentComponent.is())
|
|
|
|
aParentLocationOnScreen = xParentComponent->getLocationOnScreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
awt::Point aLocationOnScreen (getLocation());
|
|
|
|
aLocationOnScreen.X += aParentLocationOnScreen.X;
|
|
|
|
aLocationOnScreen.Y += aParentLocationOnScreen.Y;
|
|
|
|
|
|
|
|
return aLocationOnScreen;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
awt::Size SAL_CALL AccessibleSlideSorterView::getSize (void)
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
|
|
|
awt::Size aSize;
|
|
|
|
|
|
|
|
if (mpContentWindow != NULL)
|
|
|
|
{
|
|
|
|
const Size aOutputSize (mpContentWindow->GetOutputSizePixel());
|
|
|
|
aSize.Width = aOutputSize.Width();
|
|
|
|
aSize.Height = aOutputSize.Height();
|
|
|
|
}
|
|
|
|
|
|
|
|
return aSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SAL_CALL AccessibleSlideSorterView::grabFocus (void)
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
2010-10-13 02:37:50 -05:00
|
|
|
const SolarMutexGuard aSolarGuard;
|
2005-07-14 09:10:40 +00:00
|
|
|
|
|
|
|
if (mpContentWindow)
|
|
|
|
mpContentWindow->GrabFocus();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL AccessibleSlideSorterView::getForeground (void)
|
|
|
|
throw (RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
|
|
|
svtools::ColorConfig aColorConfig;
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
|
2005-07-14 09:10:40 +00:00
|
|
|
return static_cast<sal_Int32>(nColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL AccessibleSlideSorterView::getBackground (void)
|
|
|
|
throw (RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
2011-01-17 11:41:00 +01:00
|
|
|
sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
|
2005-07-14 09:10:40 +00:00
|
|
|
return static_cast<sal_Int32>(nColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//===== XAccessibleSelection ==================================================
|
|
|
|
|
|
|
|
void SAL_CALL AccessibleSlideSorterView::selectAccessibleChild (sal_Int32 nChildIndex)
|
|
|
|
throw (lang::IndexOutOfBoundsException,
|
|
|
|
RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
2010-10-13 02:37:50 -05:00
|
|
|
const SolarMutexGuard aSolarGuard;
|
2005-07-14 09:10:40 +00:00
|
|
|
|
|
|
|
AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
|
|
|
|
if (pChild != NULL)
|
2008-04-03 12:24:14 +00:00
|
|
|
mrSlideSorter.GetController().GetPageSelector().SelectPage(pChild->GetPageNumber());
|
2005-07-14 09:10:40 +00:00
|
|
|
else
|
|
|
|
throw lang::IndexOutOfBoundsException();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL AccessibleSlideSorterView::isAccessibleChildSelected (sal_Int32 nChildIndex)
|
|
|
|
throw (lang::IndexOutOfBoundsException,
|
|
|
|
RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
|
|
|
sal_Bool bIsSelected = sal_False;
|
2010-10-13 02:37:50 -05:00
|
|
|
const SolarMutexGuard aSolarGuard;
|
2005-07-14 09:10:40 +00:00
|
|
|
|
|
|
|
AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
|
|
|
|
if (pChild != NULL)
|
2008-04-03 12:24:14 +00:00
|
|
|
bIsSelected = mrSlideSorter.GetController().GetPageSelector().IsPageSelected(
|
|
|
|
pChild->GetPageNumber());
|
2005-07-14 09:10:40 +00:00
|
|
|
else
|
|
|
|
throw lang::IndexOutOfBoundsException();
|
|
|
|
|
|
|
|
return bIsSelected;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SAL_CALL AccessibleSlideSorterView::clearAccessibleSelection (void)
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
2010-10-13 02:37:50 -05:00
|
|
|
const SolarMutexGuard aSolarGuard;
|
2005-07-14 09:10:40 +00:00
|
|
|
|
2008-04-03 12:24:14 +00:00
|
|
|
mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
|
2005-07-14 09:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SAL_CALL AccessibleSlideSorterView::selectAllAccessibleChildren (void)
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
2010-10-13 02:37:50 -05:00
|
|
|
const SolarMutexGuard aSolarGuard;
|
2005-07-14 09:10:40 +00:00
|
|
|
|
2008-04-03 12:24:14 +00:00
|
|
|
mrSlideSorter.GetController().GetPageSelector().SelectAllPages();
|
2005-07-14 09:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL AccessibleSlideSorterView::getSelectedAccessibleChildCount (void)
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2008-07-07 13:22:00 +00:00
|
|
|
ThrowIfDisposed ();
|
2010-10-13 02:37:50 -05:00
|
|
|
const SolarMutexGuard aSolarGuard;
|
2008-04-03 12:24:14 +00:00
|
|
|
return mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount();
|
2005-07-14 09:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reference<XAccessible > SAL_CALL
|
|
|
|
AccessibleSlideSorterView::getSelectedAccessibleChild (sal_Int32 nSelectedChildIndex )
|
|
|
|
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
|
|
|
|
{
|
2008-07-07 13:22:00 +00:00
|
|
|
ThrowIfDisposed ();
|
2010-10-13 02:37:50 -05:00
|
|
|
const SolarMutexGuard aSolarGuard;
|
2005-07-14 09:10:40 +00:00
|
|
|
Reference<XAccessible> xChild;
|
|
|
|
|
2008-04-03 12:24:14 +00:00
|
|
|
::sd::slidesorter::controller::PageSelector& rSelector (
|
|
|
|
mrSlideSorter.GetController().GetPageSelector());
|
2005-07-14 09:10:40 +00:00
|
|
|
sal_Int32 nPageCount(rSelector.GetPageCount());
|
|
|
|
sal_Int32 nSelectedCount = 0;
|
|
|
|
for (sal_Int32 i=0; i<nPageCount; i++)
|
|
|
|
if (rSelector.IsPageSelected(i))
|
|
|
|
{
|
|
|
|
if (nSelectedCount == nSelectedChildIndex)
|
|
|
|
{
|
|
|
|
xChild = mpImpl->GetAccessibleChild(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++nSelectedCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( ! xChild.is() )
|
|
|
|
throw lang::IndexOutOfBoundsException();
|
|
|
|
|
|
|
|
return xChild;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SAL_CALL AccessibleSlideSorterView::deselectAccessibleChild (sal_Int32 nChildIndex)
|
|
|
|
throw (lang::IndexOutOfBoundsException,
|
|
|
|
RuntimeException)
|
|
|
|
{
|
|
|
|
ThrowIfDisposed();
|
2010-10-13 02:37:50 -05:00
|
|
|
const SolarMutexGuard aSolarGuard;
|
2005-07-14 09:10:40 +00:00
|
|
|
|
|
|
|
AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
|
|
|
|
if (pChild != NULL)
|
2008-04-03 12:24:14 +00:00
|
|
|
mrSlideSorter.GetController().GetPageSelector().DeselectPage(pChild->GetPageNumber());
|
2005-07-14 09:10:40 +00:00
|
|
|
else
|
|
|
|
throw lang::IndexOutOfBoundsException();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//===== XServiceInfo ========================================================
|
|
|
|
|
|
|
|
::rtl::OUString SAL_CALL
|
|
|
|
AccessibleSlideSorterView::getImplementationName (void)
|
|
|
|
throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
2012-04-13 20:46:47 -03:00
|
|
|
return OUString("AccessibleSlideSorterView");
|
2005-07-14 09:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL
|
|
|
|
AccessibleSlideSorterView::supportsService (const OUString& sServiceName)
|
|
|
|
throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
2008-07-07 13:22:00 +00:00
|
|
|
ThrowIfDisposed ();
|
|
|
|
|
2005-07-14 09:10:40 +00:00
|
|
|
// Iterate over all supported service names and return true if on of them
|
|
|
|
// matches the given name.
|
|
|
|
uno::Sequence< ::rtl::OUString> aSupportedServices (
|
|
|
|
getSupportedServiceNames ());
|
|
|
|
for (int i=0; i<aSupportedServices.getLength(); i++)
|
|
|
|
if (sServiceName == aSupportedServices[i])
|
|
|
|
return sal_True;
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uno::Sequence< ::rtl::OUString> SAL_CALL
|
|
|
|
AccessibleSlideSorterView::getSupportedServiceNames (void)
|
|
|
|
throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
2008-07-07 13:22:00 +00:00
|
|
|
ThrowIfDisposed ();
|
|
|
|
|
2005-07-14 09:10:40 +00:00
|
|
|
static const OUString sServiceNames[3] = {
|
2012-04-16 19:15:28 +02:00
|
|
|
OUString("com.sun.star.accessibility.Accessible"),
|
|
|
|
OUString("com.sun.star.accessibility.AccessibleContext"),
|
|
|
|
OUString("com.sun.star.drawing.AccessibleSlideSorterView")
|
2005-07-14 09:10:40 +00:00
|
|
|
};
|
|
|
|
return uno::Sequence<OUString> (sServiceNames, 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AccessibleSlideSorterView::ThrowIfDisposed (void)
|
|
|
|
throw (lang::DisposedException)
|
|
|
|
{
|
|
|
|
if (rBHelper.bDisposed || rBHelper.bInDispose)
|
|
|
|
{
|
|
|
|
OSL_TRACE ("Calling disposed object. Throwing exception:");
|
2012-04-13 20:46:47 -03:00
|
|
|
throw lang::DisposedException ("object has been already disposed",
|
2005-07-14 09:10:40 +00:00
|
|
|
static_cast<uno::XWeak*>(this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sal_Bool AccessibleSlideSorterView::IsDisposed (void)
|
|
|
|
{
|
|
|
|
return (rBHelper.bDisposed || rBHelper.bInDispose);
|
|
|
|
}
|
|
|
|
|
2010-06-16 14:35:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-14 09:10:40 +00:00
|
|
|
//===== AccessibleSlideSorterView::Implementation =============================
|
|
|
|
|
|
|
|
AccessibleSlideSorterView::Implementation::Implementation (
|
|
|
|
AccessibleSlideSorterView& rAccessibleSlideSorter,
|
2008-04-03 12:24:14 +00:00
|
|
|
::sd::slidesorter::SlideSorter& rSlideSorter,
|
2005-07-14 09:10:40 +00:00
|
|
|
::Window* pWindow)
|
|
|
|
: mrAccessibleSlideSorter(rAccessibleSlideSorter),
|
2008-04-03 12:24:14 +00:00
|
|
|
mrSlideSorter(rSlideSorter),
|
2005-07-14 09:10:40 +00:00
|
|
|
maPageObjects(),
|
|
|
|
mnFirstVisibleChild(0),
|
|
|
|
mnLastVisibleChild(-1),
|
|
|
|
mbListeningToDocument(false),
|
|
|
|
mpWindow(pWindow),
|
|
|
|
mnFocusedIndex(-1),
|
2010-06-16 14:35:53 +02:00
|
|
|
mbModelChangeLocked(false),
|
|
|
|
mnUpdateChildrenUserEventId(0),
|
|
|
|
mnSelectionChangeUserEventId(0)
|
2005-07-14 09:10:40 +00:00
|
|
|
{
|
|
|
|
ConnectListeners();
|
|
|
|
UpdateChildren();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AccessibleSlideSorterView::Implementation::~Implementation (void)
|
|
|
|
{
|
2010-06-16 14:35:53 +02:00
|
|
|
if (mnUpdateChildrenUserEventId != 0)
|
|
|
|
Application::RemoveUserEvent(mnUpdateChildrenUserEventId);
|
|
|
|
if (mnSelectionChangeUserEventId != 0)
|
|
|
|
Application::RemoveUserEvent(mnSelectionChangeUserEventId);
|
2005-07-14 09:10:40 +00:00
|
|
|
ReleaseListeners();
|
|
|
|
Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-06-16 14:35:53 +02:00
|
|
|
void AccessibleSlideSorterView::Implementation::RequestUpdateChildren (void)
|
|
|
|
{
|
|
|
|
if (mnUpdateChildrenUserEventId == 0)
|
|
|
|
mnUpdateChildrenUserEventId = Application::PostUserEvent(
|
|
|
|
LINK(this, AccessibleSlideSorterView::Implementation,
|
|
|
|
UpdateChildrenCallback));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-06-11 14:03:26 +02:00
|
|
|
void AccessibleSlideSorterView::Implementation::UpdateChildren (void)
|
2005-07-14 09:10:40 +00:00
|
|
|
{
|
2010-06-11 14:03:26 +02:00
|
|
|
if (mbModelChangeLocked)
|
|
|
|
{
|
|
|
|
// Do nothing right now. When the flag is reset, this method is
|
|
|
|
// called again.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-06-15 17:45:26 +02:00
|
|
|
const Pair aRange (mrSlideSorter.GetView().GetVisiblePageRange());
|
2010-02-12 13:58:24 +01:00
|
|
|
mnFirstVisibleChild = aRange.A();
|
|
|
|
mnLastVisibleChild = aRange.B();
|
2005-07-14 09:10:40 +00:00
|
|
|
|
2010-06-11 14:03:26 +02:00
|
|
|
// Release all children.
|
2005-07-14 09:10:40 +00:00
|
|
|
Clear();
|
2010-06-11 14:03:26 +02:00
|
|
|
|
|
|
|
// Create new children for the modified visible range.
|
2008-04-03 12:24:14 +00:00
|
|
|
maPageObjects.resize(mrSlideSorter.GetModel().GetPageCount());
|
2011-04-13 16:01:36 +01:00
|
|
|
|
|
|
|
// No Visible children
|
|
|
|
if (mnFirstVisibleChild == -1 && mnLastVisibleChild == -1)
|
|
|
|
return;
|
|
|
|
|
2010-06-11 14:03:26 +02:00
|
|
|
for (sal_Int32 nIndex(mnFirstVisibleChild); nIndex<=mnLastVisibleChild; ++nIndex)
|
|
|
|
GetAccessibleChild(nIndex);
|
2005-07-14 09:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AccessibleSlideSorterView::Implementation::Clear (void)
|
|
|
|
{
|
|
|
|
PageObjectList::iterator iPageObject;
|
|
|
|
PageObjectList::iterator iEnd = maPageObjects.end();
|
|
|
|
for (iPageObject=maPageObjects.begin(); iPageObject!=iEnd; ++iPageObject)
|
|
|
|
if (*iPageObject != NULL)
|
|
|
|
{
|
2010-06-11 14:03:26 +02:00
|
|
|
mrAccessibleSlideSorter.FireAccessibleEvent(
|
|
|
|
AccessibleEventId::CHILD,
|
|
|
|
Any(Reference<XAccessible>(iPageObject->get())),
|
|
|
|
Any());
|
|
|
|
|
2005-07-14 09:10:40 +00:00
|
|
|
Reference<XComponent> xComponent (Reference<XWeak>(iPageObject->get()), UNO_QUERY);
|
|
|
|
if (xComponent.is())
|
|
|
|
xComponent->dispose();
|
|
|
|
*iPageObject = NULL;
|
|
|
|
}
|
|
|
|
maPageObjects.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sal_Int32 AccessibleSlideSorterView::Implementation::GetVisibleChildCount (void) const
|
|
|
|
{
|
2010-06-15 17:45:26 +02:00
|
|
|
if (mnFirstVisibleChild<=mnLastVisibleChild && mnFirstVisibleChild>=0)
|
2005-07-14 09:10:40 +00:00
|
|
|
return mnLastVisibleChild - mnFirstVisibleChild + 1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AccessibleSlideSorterObject* AccessibleSlideSorterView::Implementation::GetVisibleChild (
|
|
|
|
sal_Int32 nIndex)
|
|
|
|
{
|
|
|
|
assert(nIndex>=0 && nIndex<GetVisibleChildCount());
|
|
|
|
|
|
|
|
return GetAccessibleChild(nIndex+mnFirstVisibleChild);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AccessibleSlideSorterObject* AccessibleSlideSorterView::Implementation::GetAccessibleChild (
|
|
|
|
sal_Int32 nIndex)
|
|
|
|
{
|
|
|
|
AccessibleSlideSorterObject* pChild = NULL;
|
|
|
|
|
|
|
|
if (nIndex>=0 && (sal_uInt32)nIndex<maPageObjects.size())
|
|
|
|
{
|
|
|
|
if (maPageObjects[nIndex] == NULL)
|
|
|
|
{
|
2006-04-06 15:17:15 +00:00
|
|
|
::sd::slidesorter::model::SharedPageDescriptor pDescriptor(
|
2008-04-03 12:24:14 +00:00
|
|
|
mrSlideSorter.GetModel().GetPageDescriptor(nIndex));
|
2006-04-06 15:17:15 +00:00
|
|
|
if (pDescriptor.get() != NULL)
|
2010-06-11 14:03:26 +02:00
|
|
|
{
|
2005-07-14 09:10:40 +00:00
|
|
|
maPageObjects[nIndex] = new AccessibleSlideSorterObject(
|
|
|
|
&mrAccessibleSlideSorter,
|
2008-04-03 12:24:14 +00:00
|
|
|
mrSlideSorter,
|
2005-07-14 09:10:40 +00:00
|
|
|
(pDescriptor->GetPage()->GetPageNum()-1)/2);
|
2010-06-11 14:03:26 +02:00
|
|
|
|
|
|
|
mrAccessibleSlideSorter.FireAccessibleEvent(
|
|
|
|
AccessibleEventId::CHILD,
|
|
|
|
Any(),
|
|
|
|
Any(Reference<XAccessible>(maPageObjects[nIndex].get())));
|
|
|
|
}
|
|
|
|
|
2005-07-14 09:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pChild = maPageObjects[nIndex].get();
|
|
|
|
}
|
2010-06-11 14:03:26 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
OSL_ASSERT(nIndex>=0 && (sal_uInt32)nIndex<maPageObjects.size());
|
|
|
|
}
|
2005-07-14 09:10:40 +00:00
|
|
|
|
|
|
|
return pChild;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AccessibleSlideSorterView::Implementation::ConnectListeners (void)
|
|
|
|
{
|
2008-04-03 12:24:14 +00:00
|
|
|
StartListening (*mrSlideSorter.GetModel().GetDocument());
|
|
|
|
if (mrSlideSorter.GetViewShell() != NULL)
|
|
|
|
StartListening (*mrSlideSorter.GetViewShell());
|
2005-07-14 09:10:40 +00:00
|
|
|
mbListeningToDocument = true;
|
|
|
|
|
|
|
|
if (mpWindow != NULL)
|
|
|
|
mpWindow->AddEventListener(
|
|
|
|
LINK(this,AccessibleSlideSorterView::Implementation,WindowEventListener));
|
|
|
|
|
2008-04-03 12:24:14 +00:00
|
|
|
mrSlideSorter.GetController().GetSelectionManager()->AddSelectionChangeListener(
|
2005-07-14 09:10:40 +00:00
|
|
|
LINK(this,AccessibleSlideSorterView::Implementation,SelectionChangeListener));
|
2008-04-03 12:24:14 +00:00
|
|
|
mrSlideSorter.GetController().GetFocusManager().AddFocusChangeListener(
|
2005-07-14 09:10:40 +00:00
|
|
|
LINK(this,AccessibleSlideSorterView::Implementation,FocusChangeListener));
|
2010-06-11 14:03:26 +02:00
|
|
|
mrSlideSorter.GetView().AddVisibilityChangeListener(
|
2011-04-14 14:16:39 +01:00
|
|
|
LINK(this,AccessibleSlideSorterView::Implementation,VisibilityChangeListener));
|
2005-07-14 09:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AccessibleSlideSorterView::Implementation::ReleaseListeners (void)
|
|
|
|
{
|
2008-04-03 12:24:14 +00:00
|
|
|
mrSlideSorter.GetController().GetFocusManager().RemoveFocusChangeListener(
|
2005-07-14 09:10:40 +00:00
|
|
|
LINK(this,AccessibleSlideSorterView::Implementation,FocusChangeListener));
|
2008-04-03 12:24:14 +00:00
|
|
|
mrSlideSorter.GetController().GetSelectionManager()->RemoveSelectionChangeListener(
|
2005-07-14 09:10:40 +00:00
|
|
|
LINK(this,AccessibleSlideSorterView::Implementation,SelectionChangeListener));
|
2010-06-11 14:03:26 +02:00
|
|
|
mrSlideSorter.GetView().RemoveVisibilityChangeListener(
|
2011-04-14 14:16:39 +01:00
|
|
|
LINK(this,AccessibleSlideSorterView::Implementation,VisibilityChangeListener));
|
2005-07-14 09:10:40 +00:00
|
|
|
|
|
|
|
if (mpWindow != NULL)
|
|
|
|
mpWindow->RemoveEventListener(
|
|
|
|
LINK(this,AccessibleSlideSorterView::Implementation,WindowEventListener));
|
|
|
|
|
|
|
|
if (mbListeningToDocument)
|
|
|
|
{
|
2008-04-03 12:24:14 +00:00
|
|
|
if (mrSlideSorter.GetViewShell() != NULL)
|
|
|
|
StartListening(*mrSlideSorter.GetViewShell());
|
|
|
|
EndListening (*mrSlideSorter.GetModel().GetDocument());
|
2005-07-14 09:10:40 +00:00
|
|
|
mbListeningToDocument = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AccessibleSlideSorterView::Implementation::Notify (
|
2006-12-12 15:49:24 +00:00
|
|
|
SfxBroadcaster&,
|
2005-07-14 09:10:40 +00:00
|
|
|
const SfxHint& rHint)
|
|
|
|
{
|
|
|
|
if (rHint.ISA(SdrHint))
|
|
|
|
{
|
|
|
|
SdrHint& rSdrHint (*PTR_CAST(SdrHint,&rHint));
|
|
|
|
switch (rSdrHint.GetKind())
|
|
|
|
{
|
|
|
|
case HINT_PAGEORDERCHG:
|
2010-06-16 14:35:53 +02:00
|
|
|
RequestUpdateChildren();
|
2005-07-14 09:10:40 +00:00
|
|
|
break;
|
2006-12-12 15:49:24 +00:00
|
|
|
default:
|
|
|
|
break;
|
2005-07-14 09:10:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (rHint.ISA(sd::ViewShellHint))
|
|
|
|
{
|
|
|
|
sd::ViewShellHint& rViewShellHint (*PTR_CAST(sd::ViewShellHint, &rHint));
|
|
|
|
switch (rViewShellHint.GetHintId())
|
|
|
|
{
|
|
|
|
case sd::ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START:
|
|
|
|
mbModelChangeLocked = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case sd::ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END:
|
|
|
|
mbModelChangeLocked = false;
|
2010-06-16 14:35:53 +02:00
|
|
|
RequestUpdateChildren();
|
2005-07-14 09:10:40 +00:00
|
|
|
break;
|
2006-12-12 15:49:24 +00:00
|
|
|
default:
|
|
|
|
break;
|
2005-07-14 09:10:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IMPL_LINK(AccessibleSlideSorterView::Implementation, WindowEventListener, VclWindowEvent*, pEvent)
|
|
|
|
{
|
|
|
|
switch (pEvent->GetId())
|
|
|
|
{
|
|
|
|
case VCLEVENT_WINDOW_MOVE:
|
|
|
|
case VCLEVENT_WINDOW_RESIZE:
|
2010-06-16 14:35:53 +02:00
|
|
|
RequestUpdateChildren();
|
2005-07-14 09:10:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case VCLEVENT_WINDOW_GETFOCUS:
|
|
|
|
case VCLEVENT_WINDOW_LOSEFOCUS:
|
|
|
|
mrAccessibleSlideSorter.FireAccessibleEvent(
|
|
|
|
AccessibleEventId::SELECTION_CHANGED,
|
|
|
|
Any(),
|
|
|
|
Any());
|
|
|
|
break;
|
2008-07-07 13:22:00 +00:00
|
|
|
default:
|
|
|
|
break;
|
2005-07-14 09:10:40 +00:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, SelectionChangeListener)
|
2005-07-14 09:10:40 +00:00
|
|
|
{
|
2010-06-16 14:35:53 +02:00
|
|
|
if (mnSelectionChangeUserEventId == 0)
|
|
|
|
mnSelectionChangeUserEventId = Application::PostUserEvent(
|
|
|
|
LINK(this, AccessibleSlideSorterView::Implementation, BroadcastSelectionChange));
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, BroadcastSelectionChange)
|
2010-06-16 14:35:53 +02:00
|
|
|
{
|
|
|
|
mnSelectionChangeUserEventId = 0;
|
2005-07-14 09:10:40 +00:00
|
|
|
mrAccessibleSlideSorter.FireAccessibleEvent(
|
|
|
|
AccessibleEventId::SELECTION_CHANGED,
|
|
|
|
Any(),
|
|
|
|
Any());
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, FocusChangeListener)
|
2005-07-14 09:10:40 +00:00
|
|
|
{
|
2008-04-03 12:24:14 +00:00
|
|
|
sal_Int32 nNewFocusedIndex (
|
|
|
|
mrSlideSorter.GetController().GetFocusManager().GetFocusedPageIndex());
|
2005-07-14 09:10:40 +00:00
|
|
|
|
|
|
|
if (nNewFocusedIndex != mnFocusedIndex)
|
|
|
|
{
|
|
|
|
if (mnFocusedIndex >= 0)
|
|
|
|
{
|
|
|
|
AccessibleSlideSorterObject* pObject = GetAccessibleChild(mnFocusedIndex);
|
|
|
|
if (pObject != NULL)
|
|
|
|
pObject->FireAccessibleEvent(
|
|
|
|
AccessibleEventId::STATE_CHANGED,
|
|
|
|
Any(AccessibleStateType::FOCUSED),
|
|
|
|
Any());
|
|
|
|
}
|
|
|
|
if (nNewFocusedIndex >= 0)
|
|
|
|
{
|
|
|
|
AccessibleSlideSorterObject* pObject = GetAccessibleChild(nNewFocusedIndex);
|
|
|
|
if (pObject != NULL)
|
|
|
|
pObject->FireAccessibleEvent(
|
|
|
|
AccessibleEventId::STATE_CHANGED,
|
|
|
|
Any(),
|
|
|
|
Any(AccessibleStateType::FOCUSED));
|
|
|
|
}
|
|
|
|
mnFocusedIndex = nNewFocusedIndex;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-11 14:03:26 +02:00
|
|
|
|
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, UpdateChildrenCallback)
|
2010-06-11 14:03:26 +02:00
|
|
|
{
|
2010-06-16 14:35:53 +02:00
|
|
|
mnUpdateChildrenUserEventId = 0;
|
2010-06-11 14:03:26 +02:00
|
|
|
UpdateChildren();
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-01 18:00:32 +01:00
|
|
|
IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, VisibilityChangeListener)
|
2011-04-14 14:16:39 +01:00
|
|
|
{
|
|
|
|
UpdateChildren();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2005-07-14 09:10:40 +00:00
|
|
|
} // end of namespace ::accessibility
|
2010-10-12 15:51:52 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|