39#include <com/sun/star/accessibility/AccessibleRole.hpp>
40#include <com/sun/star/accessibility/AccessibleEventId.hpp>
41#include <com/sun/star/accessibility/AccessibleStateType.hpp>
42#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
97 typedef ::std::vector<rtl::Reference<AccessibleSlideSorterObject> >
PageObjectList;
119 mpContentWindow(pContentWindow)
140 AccessibleEventObject aEventObject;
142 aEventObject.Source = Reference<XWeak>(
this);
143 aEventObject.EventId = nEventId;
144 aEventObject.NewValue = rNewValue;
145 aEventObject.OldValue = rOldValue;
165 ::osl::MutexGuard aGuard (
m_aMutex);
167 if (
nIndex>=0 && nIndex<mpImpl->GetVisibleChildCount())
175 ::osl::MutexGuard aGuard (
m_aMutex);
187Reference<XAccessibleContext > SAL_CALL
199 ::osl::MutexGuard aGuard (
m_aMutex);
200 return mpImpl->GetVisibleChildCount();
203Reference<XAccessible > SAL_CALL
207 ::osl::MutexGuard aGuard (
m_aMutex);
209 if (nIndex<0 || nIndex>=
mpImpl->GetVisibleChildCount())
210 throw lang::IndexOutOfBoundsException();
219 Reference<XAccessible> xParent;
224 if (pParent !=
nullptr)
236 sal_Int64 nIndexInParent(-1);
239 if (xParentContext.is())
241 sal_Int64 nChildCount (xParentContext->getAccessibleChildCount());
242 for (sal_Int64
i=0;
i<nChildCount; ++
i)
243 if (xParentContext->getAccessibleChild(
i).get()
244 ==
static_cast<XAccessible*
>(
this))
251 return nIndexInParent;
257 return AccessibleRole::DOCUMENT;
265 return SdResId(SID_SD_A11Y_I_SLIDEVIEW_D);
273 return SdResId(SID_SD_A11Y_I_SLIDEVIEW_N);
276Reference<XAccessibleRelationSet> SAL_CALL
279 return Reference<XAccessibleRelationSet>();
286 sal_Int64 nStateSet = 0;
288 nStateSet |= AccessibleStateType::FOCUSABLE;
289 nStateSet |= AccessibleStateType::SELECTABLE;
290 nStateSet |= AccessibleStateType::ENABLED;
291 nStateSet |= AccessibleStateType::ACTIVE;
292 nStateSet |= AccessibleStateType::MULTI_SELECTABLE;
293 nStateSet |= AccessibleStateType::OPAQUE;
299 nStateSet |= AccessibleStateType::SHOWING;
308 Reference<XAccessibleContext> xParentContext;
311 xParentContext = xParent->getAccessibleContext();
313 if (xParentContext.is())
314 return xParentContext->getLocale();
321 const Reference<XAccessibleEventListener >& rxListener)
323 if (!rxListener.is())
326 const osl::MutexGuard aGuard(
m_aMutex);
328 if (rBHelper.bDisposed || rBHelper.bInDispose)
330 uno::Reference<uno::XInterface>
x (
static_cast<lang::XComponent *
>(
this), uno::UNO_QUERY);
331 rxListener->disposing (lang::EventObject (
x));
342 const Reference<XAccessibleEventListener >& rxListener)
345 if (!rxListener.is())
348 const osl::MutexGuard aGuard(
m_aMutex);
355 if ( !nListenerCount )
371 const awt::Rectangle aBBox (
getBounds());
372 return (aPoint.X >= 0)
373 && (aPoint.X < aBBox.Width)
375 && (aPoint.Y < aBBox.Height);
378Reference<XAccessible> SAL_CALL
382 Reference<XAccessible> xAccessible;
385 const Point aTestPoint (aPoint.X, aPoint.Y);
389 xAccessible =
mpImpl->GetAccessibleChild(
390 (pHitDescriptor->GetPage()->GetPageNum()-1)/2);
399 awt::Rectangle aBBox;
406 aBBox.X = aPosition.
X();
407 aBBox.Y = aPosition.
Y();
408 aBBox.Width = aSize.
Width();
409 aBBox.Height = aSize.
Height();
418 awt::Point aLocation;
423 aLocation.X = aPosition.
X();
424 aLocation.Y = aPosition.
Y();
437 awt::Point aParentLocationOnScreen;
442 Reference<XAccessibleComponent> xParentComponent (
443 xParent->getAccessibleContext(), uno::UNO_QUERY);
444 if (xParentComponent.is())
445 aParentLocationOnScreen = xParentComponent->getLocationOnScreen();
449 aLocationOnScreen.X += aParentLocationOnScreen.X;
450 aLocationOnScreen.Y += aParentLocationOnScreen.Y;
452 return aLocationOnScreen;
463 aSize.Width = aOutputSize.
Width();
464 aSize.Height = aOutputSize.
Height();
484 return static_cast<sal_Int32
>(nColor);
491 return sal_Int32(nColor);
502 throw lang::IndexOutOfBoundsException();
505 if (pChild ==
nullptr)
506 throw lang::IndexOutOfBoundsException();
514 bool bIsSelected =
false;
518 throw lang::IndexOutOfBoundsException();
521 if (pChild ==
nullptr)
522 throw lang::IndexOutOfBoundsException();
553Reference<XAccessible > SAL_CALL
560 throw lang::IndexOutOfBoundsException();
562 Reference<XAccessible> xChild;
567 sal_Int32 nSelectedCount = 0;
568 for (sal_Int32
i=0;
i<nPageCount;
i++)
571 if (nSelectedCount == nSelectedChildIndex)
573 xChild =
mpImpl->GetAccessibleChild(
i);
580 throw lang::IndexOutOfBoundsException();
591 throw lang::IndexOutOfBoundsException();
594 if (pChild ==
nullptr)
595 throw lang::IndexOutOfBoundsException();
604 return "AccessibleSlideSorterView";
612uno::Sequence< OUString> SAL_CALL
617 return uno::Sequence<OUString> {
618 OUString(
"com.sun.star.accessibility.Accessible"),
619 OUString(
"com.sun.star.accessibility.AccessibleContext"),
620 OUString(
"com.sun.star.drawing.AccessibleSlideSorterView")
626 if (rBHelper.bDisposed || rBHelper.bInDispose)
628 SAL_WARN(
"sd",
"Calling disposed object. Throwing exception:");
629 throw lang::DisposedException (
"object has been already disposed",
630 static_cast<uno::XWeak*
>(
this));
640 : mrAccessibleSlideSorter(rAccessibleSlideSorter),
642 mnFirstVisibleChild(0),
643 mnLastVisibleChild(-1),
644 mbListeningToDocument(false),
647 mbModelChangeLocked(false),
648 mnUpdateChildrenUserEventId(nullptr),
649 mnSelectionChangeUserEventId(nullptr)
657 if (mnUpdateChildrenUserEventId !=
nullptr)
659 if (mnSelectionChangeUserEventId !=
nullptr)
667 if (mnUpdateChildrenUserEventId ==
nullptr)
670 UpdateChildrenCallback));
678 mnLastVisibleChild = maPageObjects.size();
680 if (mbModelChangeLocked)
688 mnFirstVisibleChild = aRange.
Min();
689 mnLastVisibleChild = aRange.
Max();
698 if (mnFirstVisibleChild == -1 && mnLastVisibleChild == -1)
702 GetAccessibleChild(
nIndex);
707 for (
auto& rxPageObject : maPageObjects)
708 if (rxPageObject !=
nullptr)
710 mrAccessibleSlideSorter.FireAccessibleEvent(
711 AccessibleEventId::CHILD,
712 Any(Reference<XAccessible>(rxPageObject)),
715 Reference<XComponent> xComponent (Reference<XWeak>(rxPageObject), UNO_QUERY);
717 xComponent->dispose();
718 rxPageObject =
nullptr;
720 maPageObjects.clear();
725 if (mnFirstVisibleChild<=mnLastVisibleChild && mnFirstVisibleChild>=0)
726 return mnLastVisibleChild - mnFirstVisibleChild + 1;
736 return GetAccessibleChild(
nIndex+mnFirstVisibleChild);
746 if (maPageObjects[
nIndex] ==
nullptr)
753 &mrAccessibleSlideSorter,
755 (pDescriptor->GetPage()->GetPageNum()-1)/2);
757 mrAccessibleSlideSorter.FireAccessibleEvent(
758 AccessibleEventId::CHILD,
760 Any(Reference<XAccessible>(maPageObjects[
nIndex])));
765 pChild = maPageObjects[
nIndex].get();
780 mbListeningToDocument =
true;
807 if (mbListeningToDocument)
815 mbListeningToDocument =
false;
823 if (rHint.
GetId() == SfxHintId::ThisIsAnSdrHint)
828 case SdrHintKind::PageOrderChange:
829 RequestUpdateChildren();
837 switch (pViewShellHint->GetHintId())
840 mbModelChangeLocked =
true;
844 mbModelChangeLocked =
false;
845 RequestUpdateChildren();
858 Any(AccessibleStateType::FOCUSED));
871 switch (rEvent.GetId())
873 case VclEventId::WindowMove:
874 case VclEventId::WindowResize:
875 RequestUpdateChildren();
878 case VclEventId::WindowGetFocus:
879 case VclEventId::WindowLoseFocus:
880 mrAccessibleSlideSorter.FireAccessibleEvent(
881 AccessibleEventId::SELECTION_CHANGED,
892 if (mnSelectionChangeUserEventId ==
nullptr)
899 mnSelectionChangeUserEventId =
nullptr;
900 mrAccessibleSlideSorter.FireAccessibleEvent(
901 AccessibleEventId::SELECTION_CHANGED,
908 sal_Int32 nNewFocusedIndex (
913 nNewFocusedIndex = -1;
916 bool bSentFocus =
false;
917 if (nNewFocusedIndex == mnFocusedIndex)
920 if (mnFocusedIndex >= 0)
926 AccessibleEventId::STATE_CHANGED,
927 Any(AccessibleStateType::FOCUSED),
932 if (nNewFocusedIndex >= 0)
938 AccessibleEventId::STATE_CHANGED,
940 Any(AccessibleStateType::FOCUSED));
945 mnFocusedIndex = nNewFocusedIndex;
950 mnUpdateChildrenUserEventId =
nullptr;
SlideSorter & mrSlideSorter
constexpr OUStringLiteral sServiceName
const LanguageTag & GetLanguageTag() const
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
constexpr tools::Long Y() const
constexpr tools::Long X() const
SdrHintKind GetKind() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const Color & GetWindowColor() const
This class makes page objects of the slide sorter accessible.
sal_uInt16 GetPageNumber() const
The page number as given to the constructor.
Inner implementation class of the AccessibleSlideSorterView.
Implementation(AccessibleSlideSorterView &rAccessibleSlideSorter, ::sd::slidesorter::SlideSorter &rSlideSorter, vcl::Window *pWindow)
DECL_LINK(FocusChangeListener, LinkParamNone *, void)
DECL_LINK(UpdateChildrenCallback, void *, void)
DECL_LINK(VisibilityChangeListener, LinkParamNone *, void)
DECL_LINK(SelectionChangeListener, LinkParamNone *, void)
AccessibleSlideSorterObject * GetVisibleChild(sal_Int32 nIndex)
ImplSVEvent * mnSelectionChangeUserEventId
::std::vector< rtl::Reference< AccessibleSlideSorterObject > > PageObjectList
void RequestUpdateChildren()
DECL_LINK(WindowEventListener, VclWindowEvent &, void)
VclPtr< vcl::Window > mpWindow
DECL_LINK(BroadcastSelectionChange, void *, void)
sal_Int32 mnFirstVisibleChild
::sd::slidesorter::SlideSorter & mrSlideSorter
AccessibleSlideSorterView & mrAccessibleSlideSorter
void Notify(SfxBroadcaster &rBroadcaster, const SfxHint &rHint) override
sal_Int32 mnLastVisibleChild
PageObjectList maPageObjects
AccessibleSlideSorterObject * GetAccessibleChild(sal_Int32 nIndex)
sal_Int32 GetVisibleChildCount() const
ImplSVEvent * mnUpdateChildrenUserEventId
virtual ~Implementation() override
bool mbListeningToDocument
This class makes the SlideSorterViewShell accessible.
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 nIndex) override
Return the specified child or throw exception.
virtual ~AccessibleSlideSorterView() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int64 nSelectedChildIndex) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
Return a reference to the parent.
VclPtr< vcl::Window > mpContentWindow
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &aPoint) override
The default implementation returns an empty reference.
::sd::slidesorter::SlideSorter & mrSlideSorter
virtual css::lang::Locale SAL_CALL getLocale() override
Return the parents locale or throw exception if this object has no parent yet/anymore.
virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int64 nChildIndex) override
virtual void SAL_CALL deselectAccessibleChild(sal_Int64 nSelectedChildIndex) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Returns a list of all supported services.
void SwitchViewActivated()
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
Return NULL to indicate that an empty relation set.
void ThrowIfDisposed()
Check whether or not the object has been disposed (or is in the state of being disposed).
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &aPoint) override
The default implementation uses the result of <member>getBounds</member> to determine whether the giv...
virtual sal_Int16 SAL_CALL getAccessibleRole() override
Return this object's role.
::std::unique_ptr< Implementation > mpImpl
virtual OUString SAL_CALL getImplementationName() override
Returns an identifier for the implementation of this object.
virtual OUString SAL_CALL getAccessibleDescription() override
Return this object's description.
virtual css::awt::Point SAL_CALL getLocationOnScreen() override
The default implementation returns an empty position, i.e.
virtual css::awt::Point SAL_CALL getLocation() override
The default implementation uses the result of <member>getBounds</member> to determine the location.
virtual sal_Int64 SAL_CALL getSelectedAccessibleChildCount() override
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
Return the number of currently visible children.
virtual void SAL_CALL selectAllAccessibleChildren() override
virtual sal_Int64 SAL_CALL getAccessibleStateSet() override
Return the set of current states.
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
virtual void SAL_CALL selectAccessibleChild(sal_Int64 nChildIndex) override
virtual css::awt::Rectangle SAL_CALL getBounds() override
The default implementation returns an empty rectangle.
virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
Return this objects index among the parents children.
virtual sal_Int32 SAL_CALL getForeground() override
Returns black as the default foreground color.
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
Return whether the specified service is supported by this class.
void FireAccessibleEvent(short nEventId, const css::uno::Any &rOldValue, const css::uno::Any &rNewValue)
virtual OUString SAL_CALL getAccessibleName() override
Return the object's current name.
virtual void SAL_CALL grabFocus() override
The default implementation does nothing.
AccessibleSlideSorterObject * GetAccessibleChildImplementation(sal_Int32 nIndex)
Return the implementation object of the specified child.
AccessibleSlideSorterView(::sd::slidesorter::SlideSorter &rSlideSorter, vcl::Window *pParentWindow)
virtual void SAL_CALL removeAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &rxListener) override
virtual css::awt::Size SAL_CALL getSize() override
The default implementation uses the result of <member>getBounds</member> to determine the size.
void Destroyed()
This method acts like a dispose call.
virtual void SAL_CALL disposing() override
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &rxListener) override
virtual sal_Int32 SAL_CALL getBackground() override
Returns white as the default background color.
virtual void SAL_CALL clearAccessibleSelection() override
static sal_Int32 addEventListener(const TClientId _nClient, const css::uno::Reference< css::accessibility::XAccessibleEventListener > &_rxListener)
static void addEvent(const TClientId _nClient, const css::accessibility::AccessibleEventObject &_rEvent)
static sal_Int32 removeEventListener(const TClientId _nClient, const css::uno::Reference< css::accessibility::XAccessibleEventListener > &_rxListener)
static TClientId registerClient()
static void revokeClient(const TClientId _nClient)
static void revokeClientNotifyDisposing(const TClientId _nClient, const css::uno::Reference< css::uno::XInterface > &_rxEventSource)
mutable::osl::Mutex m_aMutex
Local derivation of the SfxHint class that defines some hint ids that are used by the ViewShell class...
@ HINT_COMPLEX_MODEL_CHANGE_END
@ HINT_COMPLEX_MODEL_CHANGE_START
Show previews for all the slides in a document and allow the user to insert or delete slides and modi...
SD_DLLPUBLIC controller::SlideSorterController & GetController() const
ViewShell * GetViewShell() const
Return the view shell that was given at construction.
model::SlideSorterModel & GetModel() const
view::SlideSorterView & GetView() const
void RemoveFocusChangeListener(const Link< LinkParamNone *, void > &rListener)
Remove a focus change listener.
void ShowFocus(const bool bScrollToFocus=true)
Show the focus indicator of the current slide.
void AddFocusChangeListener(const Link< LinkParamNone *, void > &rListener)
Add a listener that is called when the focus is shown or hidden or set to another page object.
bool IsFocusShowing() const
Return <TRUE> when the focus indicator is currently shown.
sal_Int32 GetFocusedPageIndex() const
Return the index of the page that currently has the focus as it is accepted by the slide sorter model...
A sub-controller that handles page selection of the slide browser.
SD_DLLPUBLIC void SelectAllPages()
void DeselectPage(int nPageIndex)
Deselect the descriptor that is associated with the given page.
int GetSelectedPageCount() const
SD_DLLPUBLIC bool IsPageSelected(int nPageIndex)
Return whether the specified page is selected.
SD_DLLPUBLIC void DeselectAllPages()
int GetPageCount() const
This convenience method returns the same number of pages that SlideSorterModel.GetPageCount() returns...
void SelectPage(int nPageIndex)
Select the specified descriptor.
FocusManager & GetFocusManager()
model::SharedPageDescriptor GetPageAt(const Point &rPixelPosition)
Return the descriptor of the page that is rendered under the given position.
std::shared_ptr< SelectionManager > const & GetSelectionManager() const
SD_DLLPUBLIC PageSelector & GetPageSelector()
SdDrawDocument * GetDocument()
This method is present to let the view create a ShowView for displaying slides.
sal_Int32 GetPageCount() const
Return the number of slides in the document regardless of whether they are visible or not or whether ...
SharedPageDescriptor GetPageDescriptor(const sal_Int32 nPageIndex, const bool bCreate=true) const
Return a page descriptor for the page with the specified index.
void RemoveVisibilityChangeListener(const Link< LinkParamNone *, void > &rListener)
Remove a listener that is called when the set of visible slides changes.
Range const & GetVisiblePageRange()
Return the range of currently visible page objects including the first and last one in that range.
void AddVisibilityChangeListener(const Link< LinkParamNone *, void > &rListener)
Add a shape to the page.
css::uno::Reference< css::accessibility::XAccessible > GetAccessible(bool bCreate=true)
EmbeddedObjectRef * pObject
#define LINK(Instance, Class, Member)
#define SAL_WARN(area, stream)
void Clear(EHistoryType eHistory)
::cppu::WeakComponentImplHelper< css::accessibility::XAccessible, css::accessibility::XAccessibleEventBroadcaster, css::accessibility::XAccessibleContext, css::accessibility::XAccessibleComponent, css::accessibility::XAccessibleSelection, css::lang::XServiceInfo > AccessibleSlideSorterViewBase
IMPL_LINK(AccessibleListBoxEntry, WindowEventListener, VclWindowEvent &, rEvent, void)
IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, SelectionChangeListener, LinkParamNone *, void)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
std::shared_ptr< PageDescriptor > SharedPageDescriptor
OUString SdResId(TranslateId aId)
VclPtr< vcl::Window > mpWindow