LibreOffice Module svx (master) 1
|
This class contains the actual implementation of the children manager. More...
#include <ChildrenManagerImpl.hxx>
Public Member Functions | |
ChildrenManagerImpl (css::uno::Reference< css::accessibility::XAccessible > xParent, css::uno::Reference< css::drawing::XShapes > xShapeList, const AccessibleShapeTreeInfo &rShapeTreeInfo, AccessibleContextBase &rContext) | |
Create a children manager, which manages the children of the given parent. More... | |
virtual | ~ChildrenManagerImpl () override |
If there still are managed children these are disposed and released. More... | |
void | Init () |
Do that part of the initialization that you can not or should not do in the constructor like registering at broadcasters. More... | |
sal_Int64 | GetChildCount () const noexcept |
Return the number of currently visible accessible children. More... | |
const css::uno::Reference< css::drawing::XShape > & | GetChildShape (sal_Int64 nIndex) |
css::uno::Reference< css::accessibility::XAccessible > | GetChild (sal_Int64 nIndex) |
Return the requested accessible child or throw and IndexOutOfBoundsException if the given index is invalid. More... | |
css::uno::Reference< css::accessibility::XAccessible > | GetChild (ChildDescriptor &aChildDescriptor, sal_Int32 _nIndex) |
Return the requested accessible child. More... | |
void | Update (bool bCreateNewObjectsOnDemand) |
Update the child manager. More... | |
void | SetShapeList (const css::uno::Reference< css::drawing::XShapes > &xShapeList) |
Set the list of UNO shapes to the given list. More... | |
void | AddAccessibleShape (rtl::Reference< AccessibleShape > const &shape) |
Add an accessible shape. More... | |
void | ClearAccessibleShapeList () |
Clear the lists of accessible shapes and that of visible accessible shapes. More... | |
void | SetInfo (const AccessibleShapeTreeInfo &rShapeTreeInfo) |
Set a new event shape tree info. More... | |
void | UpdateSelection () |
Update the SELECTED and FOCUSED states of all visible children according to the given selection. More... | |
bool | HasFocus () const |
Return whether one of the shapes managed by this object has currently the focus. More... | |
void | RemoveFocus () |
When there is a shape that currently has the focus, i.e. More... | |
virtual void SAL_CALL | disposing (const css::lang::EventObject &rEventObject) override |
virtual void SAL_CALL | notifyEvent (const css::document::EventObject &rEventObject) override |
Listen for new and removed shapes. More... | |
virtual void SAL_CALL | selectionChanged (const css::lang::EventObject &rEvent) override |
virtual void | ViewForwarderChanged () override |
Informs this children manager and its children about a change of one (or more) aspect of the view forwarder. More... | |
virtual bool | ReplaceChild (AccessibleShape *pCurrentChild, const css::uno::Reference< css::drawing::XShape > &_rxShape, const tools::Long _nIndex, const AccessibleShapeTreeInfo &_rShapeTreeInfo) override |
Replace the specified child with a replacement. More... | |
virtual AccessibleControlShape * | GetAccControlShapeFromModel (css::beans::XPropertySet *pSet) override |
virtual css::uno::Reference< css::accessibility::XAccessible > | GetAccessibleCaption (const css::uno::Reference< css::drawing::XShape > &xShape) override |
Public Member Functions inherited from comphelper::WeakComponentImplHelper< css::document::XEventListener, css::view::XSelectionChangeListener > | |
virtual void SAL_CALL | acquire () noexcept override |
virtual void SAL_CALL | release () noexcept override |
virtual void SAL_CALL | dispose () noexcept final override |
virtual void SAL_CALL | addEventListener (css::uno::Reference< css::lang::XEventListener > const &rxListener) final override |
virtual void SAL_CALL | removeEventListener (css::uno::Reference< css::lang::XEventListener > const &rxListener) final override |
virtual css::uno::Any SAL_CALL | queryInterface (css::uno::Type const &rType) override |
virtual css::uno::Sequence< css::uno::Type > SAL_CALL | getTypes () override |
virtual css::uno::Sequence< sal_Int8 > SAL_CALL | getImplementationId () override |
Public Member Functions inherited from comphelper::WeakComponentImplHelperBase | |
virtual | ~WeakComponentImplHelperBase () override |
virtual void SAL_CALL | dispose () override |
virtual void SAL_CALL | addEventListener (css::uno::Reference< css::lang::XEventListener > const &rxListener) override |
virtual void SAL_CALL | removeEventListener (css::uno::Reference< css::lang::XEventListener > const &rxListener) override |
virtual css::uno::Any SAL_CALL | queryInterface (css::uno::Type const &rType) override |
virtual void | disposing (std::unique_lock< std::mutex > &) |
Public Member Functions inherited from comphelper::UnoImplBase | |
virtual | ~UnoImplBase () |
virtual void | ViewForwarderChanged ()=0 |
This method is called to indicate a change of the specified view forwarder, specifically, a change in visible area. More... | |
Public Member Functions inherited from accessibility::IAccessibleParent | |
virtual | ~IAccessibleParent () |
Allow for a virtual destructor. More... | |
virtual bool | ReplaceChild (AccessibleShape *pCurrentChild, const css::uno::Reference< css::drawing::XShape > &_rxShape, const tools::Long _nIndex, const AccessibleShapeTreeInfo &_rShapeTreeInfo)=0 |
A call to this method requests the implementor to replace one child with another and send the appropriate notifications. More... | |
virtual AccessibleControlShape * | GetAccControlShapeFromModel (css::beans::XPropertySet *) |
virtual css::uno::Reference< css::accessibility::XAccessible > | GetAccessibleCaption (const css::uno::Reference< css::drawing::XShape > &) |
virtual bool | IsDocumentSelAll () |
Private Types | |
typedef std::vector< rtl::Reference< AccessibleShape > > | AccessibleShapeList |
This list of additional accessible shapes that can or shall not be created by the shape factory. More... | |
Private Member Functions | |
virtual void | disposing (std::unique_lock< std::mutex > &) override |
This method is called from the component helper base class while disposing. More... | |
void | impl_dispose () |
ChildrenManagerImpl (const ChildrenManagerImpl &)=delete | |
ChildrenManagerImpl & | operator= (const ChildrenManagerImpl &)=delete |
void | CreateListOfVisibleShapes (ChildDescriptorListType &raChildList) |
Three helper functions for the <member>Update</member> method. More... | |
void | RemoveNonVisibleChildren (const std::vector< ChildDescriptor * > &rNonVisibleChildren) |
From the old list of (former) visible shapes remove those that are not member of the new list. More... | |
std::vector< ChildDescriptor * > | MergeAccessibilityInformation (ChildDescriptorListType &raChildList) |
Merge the information that is already known about the visible shapes from the old list into the current list, and return a list of children that are in the old list, but not the current one. More... | |
void | CreateAccessibilityObjects (ChildDescriptorListType &raChildList) |
If children have to be created immediately and not on demand the create the missing accessible objects now. More... | |
void | AddShape (const css::uno::Reference< css::drawing::XShape > &xShape) |
Add a single shape. More... | |
void | RemoveShape (const css::uno::Reference< css::drawing::XShape > &xShape) |
Remove a single shape. More... | |
void | RegisterAsDisposeListener (const css::uno::Reference< css::drawing::XShape > &xShape) |
Add the children manager as dispose listener at the given shape so that the associated accessible object can be disposed when the shape is disposed. More... | |
void | UnregisterAsDisposeListener (const css::uno::Reference< css::drawing::XShape > &xShape) |
Remove the children manager as dispose listener at the given shape. More... | |
Static Private Member Functions | |
static void | SendVisibleAreaEvents (ChildDescriptorListType &raChildList) |
If the visible area has changed then send events that signal a change of their bounding boxes for all shapes that are members of both the current and the new list of visible shapes. More... | |
Private Attributes | |
ChildDescriptorListType | maVisibleChildren |
This list holds the descriptors of all currently visible shapes and associated accessible object. More... | |
css::uno::Reference< css::drawing::XShapes > | mxShapeList |
The original list of UNO shapes. More... | |
AccessibleShapeList | maAccessibleShapes |
tools::Rectangle | maVisibleArea |
Rectangle that describes the visible area in which a shape has to lie at least partly, to be accessible through this class. More... | |
css::uno::Reference< css::accessibility::XAccessible > | mxParent |
The parent of the shapes. More... | |
AccessibleShapeTreeInfo | maShapeTreeInfo |
Bundle of information passed down the shape tree. More... | |
AccessibleContextBase & | mrContext |
Reference to an accessible context object that is used to inform its listeners of new and removed children. More... | |
AccessibleShape * | mpFocusedShape |
This member points to the currently focused shape. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from comphelper::WeakComponentImplHelperBase | |
void | throwIfDisposed (std::unique_lock< std::mutex > &) |
Protected Member Functions inherited from accessibility::IAccessibleViewForwarderListener | |
~IAccessibleViewForwarderListener () | |
Protected Attributes inherited from comphelper::WeakComponentImplHelperBase | |
comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > | maEventListeners |
Protected Attributes inherited from comphelper::UnoImplBase | |
std::mutex | m_aMutex |
bool | m_bDisposed |
This class contains the actual implementation of the children manager.
It maintains a set of visible accessible shapes in <member>maVisibleChildren</member>. The objects in this list stem from two sources. The first is a list of UNO shapes like the list of shapes in a draw page. A reference to this list is held in <member>maShapeList</member>. Accessible objects for these shapes are created on demand. The list can be replaced by calls to the <member>SetShapeList</member> method. The second source is a list of already accessible objects. It can be modified by calls to the <member>AddAccessibleShape</member> and <member>ClearAccessibleShapeList</member> methods.
Each call of the <member>Update</member> method leads to a re-calculation of the visible shapes which then can be queried with the <member>GetChildCount</member> and <member>GetChild</member> methods. Events are sent informing all listeners about the removed shapes which are not visible anymore and about the added shapes.
The visible area which is used to determine the visibility of the shapes is taken from the view forwarder. Thus, to signal a change of the visible area call <member>ViewForwarderChanged</member>.
The children manager adds itself as disposing() listener at every UNO shape it creates an accessible object for so that when the UNO shape passes away it can dispose() the associated accessible object.
Definition at line 74 of file ChildrenManagerImpl.hxx.
|
private |
This list of additional accessible shapes that can or shall not be created by the shape factory.
Definition at line 292 of file ChildrenManagerImpl.hxx.
accessibility::ChildrenManagerImpl::ChildrenManagerImpl | ( | css::uno::Reference< css::accessibility::XAccessible > | xParent, |
css::uno::Reference< css::drawing::XShapes > | xShapeList, | ||
const AccessibleShapeTreeInfo & | rShapeTreeInfo, | ||
AccessibleContextBase & | rContext | ||
) |
Create a children manager, which manages the children of the given parent.
The parent is used for creating accessible objects. The list of shapes for which to create those objects is not derived from the parent and has to be provided separately by calling one of the update methods.
rxParent | The parent of the accessible objects which will be created on demand at some point of time in the future. |
rxShapeList | List of UNO shapes to manage. |
rShapeTreeInfo | Bundle of information passed down the shape tree. |
rContext | An accessible context object that is called for firing events for new and deleted children, i.e. that holds a list of listeners to be informed. |
|
overridevirtual |
If there still are managed children these are disposed and released.
Definition at line 83 of file ChildrenManagerImpl.cxx.
References DBG_ASSERT, and m_bDisposed.
|
privatedelete |
void accessibility::ChildrenManagerImpl::AddAccessibleShape | ( | rtl::Reference< AccessibleShape > const & | shape | ) |
Add an accessible shape.
This does not modify the list of UNO shapes or the list of visible shapes. Accessible shapes are, at the moment, not tested against the visible area but are always appended to the list of visible children.
shape | The new shape that is added to the list of accessible shapes; must be non-null. |
Definition at line 543 of file ChildrenManagerImpl.cxx.
|
private |
Add a single shape.
Update all relevant data structures accordingly. Use this method instead of <member>Update()</member> when only a single shape has been added.
Definition at line 457 of file ChildrenManagerImpl.cxx.
References mrContext, accessibility::ChildDescriptor::mxAccessibleShape, and tools::Rectangle::Overlaps().
void accessibility::ChildrenManagerImpl::ClearAccessibleShapeList | ( | ) |
Clear the lists of accessible shapes and that of visible accessible shapes.
The list of UNO shapes is not modified.
Definition at line 550 of file ChildrenManagerImpl.cxx.
References mrContext.
|
private |
If children have to be created immediately and not on demand the create the missing accessible objects now.
raDescriptorList | Create an accessible object for every member of this list where that object does not already exist. |
Definition at line 434 of file ChildrenManagerImpl.cxx.
|
private |
Three helper functions for the <member>Update</member> method.
Create a list of visible shapes from the list of UNO shapes <member>maShapeList</member> and the list of accessible objects.
raChildList | For every visible shape from the two sources mentioned above one descriptor is added to this list. |
Definition at line 268 of file ChildrenManagerImpl.cxx.
References i, tools::Rectangle::Overlaps(), tools::Rectangle::SetBottom(), tools::Rectangle::SetLeft(), tools::Rectangle::SetRight(), and tools::Rectangle::SetTop().
|
overridevirtual |
|
overrideprivatevirtual |
This method is called from the component helper base class while disposing.
Reimplemented from comphelper::WeakComponentImplHelperBase.
Definition at line 741 of file ChildrenManagerImpl.cxx.
|
overridevirtual |
css::uno::RuntimeException |
Reimplemented from accessibility::IAccessibleParent.
Definition at line 802 of file ChildrenManagerImpl.cxx.
References count, accessibility::DRAWING_CONTROL, accessibility::AccessibleShape::GetXShape(), index, and accessibility::ShapeTypeHandler::Instance().
|
overridevirtual |
css::uno::RuntimeException |
Reimplemented from accessibility::IAccessibleParent.
Definition at line 818 of file ChildrenManagerImpl.cxx.
References I.
uno::Reference< XAccessible > accessibility::ChildrenManagerImpl::GetChild | ( | ChildDescriptor & | rChildDescriptor, |
sal_Int32 | _nIndex | ||
) |
Return the requested accessible child.
Return the requested accessible child object.
aChildDescriptor | This object contains references to the original shape and its associated accessible object. |
_nIndex | The index which will be used in getAccessibleIndexInParent of the accessible shape. |
css::uno::RuntimeException |
Create it if it is not yet in the cache.
Definition at line 147 of file ChildrenManagerImpl.cxx.
References accessibility::ChildDescriptor::mxAccessibleShape, mxParent, and accessibility::ChildDescriptor::mxShape.
uno::Reference< XAccessible > accessibility::ChildrenManagerImpl::GetChild | ( | sal_Int64 | nIndex | ) |
Return the requested accessible child or throw and IndexOutOfBoundsException if the given index is invalid.
Return the requested accessible child object.
nIndex | Index of the requested child. Call getChildCount for obtaining the number of children. |
Throws | an IndexOutOfBoundsException if the index is not valid. |
Create it if it is not yet in the cache.
Definition at line 131 of file ChildrenManagerImpl.cxx.
References o3tl::make_unsigned(), mxParent, and nIndex.
|
noexcept |
Return the number of currently visible accessible children.
Definition at line 111 of file ChildrenManagerImpl.cxx.
const css::uno::Reference< css::drawing::XShape > & accessibility::ChildrenManagerImpl::GetChildShape | ( | sal_Int64 | nIndex | ) |
css::uno::RuntimeException | |
css::lang::IndexOutOfBoundsException |
Definition at line 117 of file ChildrenManagerImpl.cxx.
References o3tl::make_unsigned(), mxParent, and nIndex.
bool accessibility::ChildrenManagerImpl::HasFocus | ( | ) | const |
Return whether one of the shapes managed by this object has currently the focus.
Definition at line 1014 of file ChildrenManagerImpl.cxx.
|
private |
Definition at line 697 of file ChildrenManagerImpl.cxx.
References xController.
void accessibility::ChildrenManagerImpl::Init | ( | void | ) |
Do that part of the initialization that you can not or should not do in the constructor like registering at broadcasters.
Definition at line 89 of file ChildrenManagerImpl.cxx.
References xController.
|
private |
Merge the information that is already known about the visible shapes from the old list into the current list, and return a list of children that are in the old list, but not the current one.
raChildList | Information is merged to the current list of visible children from this list. The old list can get reordered. |
Definition at line 367 of file ChildrenManagerImpl.cxx.
|
overridevirtual |
Listen for new and removed shapes.
Definition at line 679 of file ChildrenManagerImpl.cxx.
|
privatedelete |
|
private |
Add the children manager as dispose listener at the given shape so that the associated accessible object can be disposed when the shape is disposed.
xShape | Register at this shape as dispose listener. |
Definition at line 1030 of file ChildrenManagerImpl.cxx.
void accessibility::ChildrenManagerImpl::RemoveFocus | ( | ) |
When there is a shape that currently has the focus, i.e.
<member>HasFocus()</member> returns <true> then remove the focus from that shape. Otherwise nothing changes.
Definition at line 1020 of file ChildrenManagerImpl.cxx.
References accessibility::AccessibleShape::ResetState().
|
private |
From the old list of (former) visible shapes remove those that are not member of the new list.
Send appropriate events for every such shape.
raNewChildList | The new list of visible children against which the old one is compared. |
raOldChildList | The old list of visible children against which the new one is compared. |
Definition at line 344 of file ChildrenManagerImpl.cxx.
References mrContext, and accessibility::AccessibleShape::ResetState().
|
private |
Remove a single shape.
Update all relevant data structures accordingly. Use this method instead of <member>Update()</member> when only a single shape has been removed.
Definition at line 508 of file ChildrenManagerImpl.cxx.
|
overridevirtual |
Replace the specified child with a replacement.
pCurrentChild | This child is to be replaced. |
pReplacement | The replacement for the current child. |
Implements accessibility::IAccessibleParent.
Definition at line 753 of file ChildrenManagerImpl.cxx.
References accessibility::AccessibleContextBase::getAccessibleParent(), I, and mrContext.
|
overridevirtual |
Definition at line 691 of file ChildrenManagerImpl.cxx.
|
staticprivate |
If the visible area has changed then send events that signal a change of their bounding boxes for all shapes that are members of both the current and the new list of visible shapes.
raChildList | Events are sent to all entries of this list that already contain an accessible object. |
Definition at line 419 of file ChildrenManagerImpl.cxx.
References accessibility::AccessibleShape::ViewForwarderChanged().
void accessibility::ChildrenManagerImpl::SetInfo | ( | const AccessibleShapeTreeInfo & | rShapeTreeInfo | ) |
Set a new event shape tree info.
If the broadcasters change at which this object is registered then unregister at old and register at new broadcasters.
Call this method to inform the children manager of a change of the info bundle.
rShapeTreeInfo | The new info that replaces the current one. |
Definition at line 591 of file ChildrenManagerImpl.cxx.
References accessibility::AccessibleShapeTreeInfo::GetModelBroadcaster().
void accessibility::ChildrenManagerImpl::SetShapeList | ( | const css::uno::Reference< css::drawing::XShapes > & | xShapeList | ) |
Set the list of UNO shapes to the given list.
This removes the old list and does not add to it. The list of accessible shapes that is build up by calls to <member>AddAccessibleShape</member> is not modified. Neither is the list of visible children. Accessible objects are created on demand.
xShapeList | The list of UNO shapes that replaces the old list. |
Definition at line 537 of file ChildrenManagerImpl.cxx.
|
private |
Remove the children manager as dispose listener at the given shape.
xShape | Unregister at this shape as dispose listener. |
Definition at line 1040 of file ChildrenManagerImpl.cxx.
void accessibility::ChildrenManagerImpl::Update | ( | bool | bCreateNewObjectsOnDemand | ) |
Update the child manager.
Find all shapes among the specified shapes that lie fully or partially inside the visible area.
Take care of a modified set of children and modified visible area. This method can optimize the update process with respect separate updates of a modified children list and visible area.
bCreateNewObjectsOnDemand | If </true> then accessible objects associated with the visible shapes are created only when asked for. No event is sent on creation. If </false> then the accessible objects are created before this method returns and events are sent to inform the listeners of the new object. |
Put those shapes into the cleared cache. The corresponding accessible objects will be created on demand.
At the moment, first all accessible objects are removed from the cache and the appropriate listeners are informed of this. Next, the list is created again. This should be optimized in the future to not remove and create objects that will be in the list before and after the update method.
Definition at line 189 of file ChildrenManagerImpl.cxx.
void accessibility::ChildrenManagerImpl::UpdateSelection | ( | ) |
Update the SELECTED and FOCUSED states of all visible children according to the given selection.
Update the <const>SELECTED</const> and the <const>FOCUSED</const> state of all visible children.
This includes setting and resetting the states.
Maybe this should be changed to all children.
Iterate over all descriptors of visible accessible shapes and look them up in the selection.
If there is no valid controller then all shapes are deselected and unfocused. If the controller's frame is not active then all shapes are unfocused.
Definition at line 837 of file ChildrenManagerImpl.cxx.
References accessibility::AccessibleShape::getAccessibleRole(), vcl::Window::GetParent(), accessibility::AccessibleShape::GetState(), vcl::Window::HasFocus(), i, mrContext, nCount, accessibility::AccessibleShape::ResetState(), accessibility::AccessibleShape::SetState(), and xController.
|
overridevirtual |
Informs this children manager and its children about a change of one (or more) aspect of the view forwarder.
aChangeType | A change type of <const>VISIBLE_AREA</const> leads to a call to the <member>Update</member> which creates accessible objects of new shapes immediately. Other change types are passed to the visible accessible children without calling <member>Update</member>. |
pViewForwarder | The modified view forwarder. Use this one from now on. |
Implements accessibility::IAccessibleViewForwarderListener.
Definition at line 747 of file ChildrenManagerImpl.cxx.
References Update.
|
private |
Definition at line 293 of file ChildrenManagerImpl.hxx.
|
private |
Bundle of information passed down the shape tree.
Definition at line 308 of file ChildrenManagerImpl.hxx.
|
private |
Rectangle that describes the visible area in which a shape has to lie at least partly, to be accessible through this class.
Used to detect changes of the visible area after changes of the view forwarder.
Definition at line 299 of file ChildrenManagerImpl.hxx.
|
private |
This list holds the descriptors of all currently visible shapes and associated accessible object.
With the descriptors it maintains a mapping of shapes to accessible objects. It acts as a cache in that accessible objects are only created on demand and released with every update (where the latter may be optimized by the update methods).
The list is realized as a vector because it remains unchanged between updates (i.e. complete rebuilds of the list) and allows a fast (constant time) access to its elements for given indices.
Definition at line 281 of file ChildrenManagerImpl.hxx.
|
private |
This member points to the currently focused shape.
It is NULL when there is no focused shape.
Definition at line 328 of file ChildrenManagerImpl.hxx.
|
private |
Reference to an accessible context object that is used to inform its listeners of new and removed children.
Definition at line 313 of file ChildrenManagerImpl.hxx.
|
private |
The parent of the shapes.
It is used for creating accessible objects for given shapes.
Definition at line 304 of file ChildrenManagerImpl.hxx.
|
private |
The original list of UNO shapes.
The visible shapes are inserted into the list of visible children <member>maVisibleChildren</member>.
Definition at line 287 of file ChildrenManagerImpl.hxx.