renaissance1: #i107215# Integrated accessibility fix from other CWS impressaccessibility7.
This commit is contained in:
parent
6efdc84459
commit
0832b196ad
@ -72,7 +72,6 @@ public:
|
||||
::Window* pWindow);
|
||||
~Implementation (void);
|
||||
|
||||
void UpdateVisibility (void);
|
||||
void UpdateChildren (void);
|
||||
void Clear (void);
|
||||
sal_Int32 GetVisibleChildCount (void) const;
|
||||
@ -85,6 +84,7 @@ public:
|
||||
DECL_LINK(WindowEventListener, VclWindowEvent*);
|
||||
DECL_LINK(SelectionChangeListener, void*);
|
||||
DECL_LINK(FocusChangeListener, void*);
|
||||
DECL_LINK(VisibilityChangeListener, void*);
|
||||
|
||||
private:
|
||||
AccessibleSlideSorterView& mrAccessibleSlideSorter;
|
||||
@ -789,7 +789,6 @@ AccessibleSlideSorterView::Implementation::Implementation (
|
||||
{
|
||||
ConnectListeners();
|
||||
UpdateChildren();
|
||||
UpdateVisibility();
|
||||
}
|
||||
|
||||
|
||||
@ -804,23 +803,26 @@ AccessibleSlideSorterView::Implementation::~Implementation (void)
|
||||
|
||||
|
||||
|
||||
void AccessibleSlideSorterView::Implementation::UpdateVisibility (void)
|
||||
{
|
||||
Pair aRange (mrSlideSorter.GetView().GetVisiblePageRange());
|
||||
mnFirstVisibleChild = aRange.A();
|
||||
mnLastVisibleChild = aRange.B();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void AccessibleSlideSorterView::Implementation::UpdateChildren (void)
|
||||
{
|
||||
// Clear the list of accessible children and adapt its size. It is
|
||||
// refilled on demand when later the children are requested.
|
||||
if (mbModelChangeLocked)
|
||||
{
|
||||
// Do nothing right now. When the flag is reset, this method is
|
||||
// called again.
|
||||
return;
|
||||
}
|
||||
|
||||
const Pair aRange (mrSlideSorter.GetView().GetVisiblePageRange());
|
||||
mnFirstVisibleChild = aRange.A();
|
||||
mnLastVisibleChild = aRange.B();
|
||||
|
||||
// Release all children.
|
||||
Clear();
|
||||
|
||||
// Create new children for the modified visible range.
|
||||
maPageObjects.resize(mrSlideSorter.GetModel().GetPageCount());
|
||||
UpdateVisibility();
|
||||
for (sal_Int32 nIndex(mnFirstVisibleChild); nIndex<=mnLastVisibleChild; ++nIndex)
|
||||
GetAccessibleChild(nIndex);
|
||||
}
|
||||
|
||||
|
||||
@ -833,6 +835,11 @@ void AccessibleSlideSorterView::Implementation::Clear (void)
|
||||
for (iPageObject=maPageObjects.begin(); iPageObject!=iEnd; ++iPageObject)
|
||||
if (*iPageObject != NULL)
|
||||
{
|
||||
mrAccessibleSlideSorter.FireAccessibleEvent(
|
||||
AccessibleEventId::CHILD,
|
||||
Any(Reference<XAccessible>(iPageObject->get())),
|
||||
Any());
|
||||
|
||||
Reference<XComponent> xComponent (Reference<XWeak>(iPageObject->get()), UNO_QUERY);
|
||||
if (xComponent.is())
|
||||
xComponent->dispose();
|
||||
@ -846,7 +853,7 @@ void AccessibleSlideSorterView::Implementation::Clear (void)
|
||||
|
||||
sal_Int32 AccessibleSlideSorterView::Implementation::GetVisibleChildCount (void) const
|
||||
{
|
||||
if (mnFirstVisibleChild <= mnLastVisibleChild && mnFirstVisibleChild>=0)
|
||||
if (mnFirstVisibleChild<=mnLastVisibleChild && mnFirstVisibleChild>=0)
|
||||
return mnLastVisibleChild - mnFirstVisibleChild + 1;
|
||||
else
|
||||
return 0;
|
||||
@ -869,8 +876,6 @@ AccessibleSlideSorterObject* AccessibleSlideSorterView::Implementation::GetVisib
|
||||
AccessibleSlideSorterObject* AccessibleSlideSorterView::Implementation::GetAccessibleChild (
|
||||
sal_Int32 nIndex)
|
||||
{
|
||||
OSL_ASSERT(nIndex>=0 && (sal_uInt32)nIndex<maPageObjects.size());
|
||||
|
||||
AccessibleSlideSorterObject* pChild = NULL;
|
||||
|
||||
if (nIndex>=0 && (sal_uInt32)nIndex<maPageObjects.size())
|
||||
@ -880,14 +885,26 @@ AccessibleSlideSorterObject* AccessibleSlideSorterView::Implementation::GetAcces
|
||||
::sd::slidesorter::model::SharedPageDescriptor pDescriptor(
|
||||
mrSlideSorter.GetModel().GetPageDescriptor(nIndex));
|
||||
if (pDescriptor.get() != NULL)
|
||||
{
|
||||
maPageObjects[nIndex] = new AccessibleSlideSorterObject(
|
||||
&mrAccessibleSlideSorter,
|
||||
mrSlideSorter,
|
||||
(pDescriptor->GetPage()->GetPageNum()-1)/2);
|
||||
|
||||
mrAccessibleSlideSorter.FireAccessibleEvent(
|
||||
AccessibleEventId::CHILD,
|
||||
Any(),
|
||||
Any(Reference<XAccessible>(maPageObjects[nIndex].get())));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pChild = maPageObjects[nIndex].get();
|
||||
}
|
||||
else
|
||||
{
|
||||
OSL_ASSERT(nIndex>=0 && (sal_uInt32)nIndex<maPageObjects.size());
|
||||
}
|
||||
|
||||
return pChild;
|
||||
}
|
||||
@ -908,9 +925,10 @@ void AccessibleSlideSorterView::Implementation::ConnectListeners (void)
|
||||
|
||||
mrSlideSorter.GetController().GetSelectionManager()->AddSelectionChangeListener(
|
||||
LINK(this,AccessibleSlideSorterView::Implementation,SelectionChangeListener));
|
||||
|
||||
mrSlideSorter.GetController().GetFocusManager().AddFocusChangeListener(
|
||||
LINK(this,AccessibleSlideSorterView::Implementation,FocusChangeListener));
|
||||
mrSlideSorter.GetView().AddVisibilityChangeListener(
|
||||
LINK(this,AccessibleSlideSorterView::Implementation,VisibilityChangeListener));
|
||||
}
|
||||
|
||||
|
||||
@ -920,9 +938,10 @@ void AccessibleSlideSorterView::Implementation::ReleaseListeners (void)
|
||||
{
|
||||
mrSlideSorter.GetController().GetFocusManager().RemoveFocusChangeListener(
|
||||
LINK(this,AccessibleSlideSorterView::Implementation,FocusChangeListener));
|
||||
|
||||
mrSlideSorter.GetController().GetSelectionManager()->RemoveSelectionChangeListener(
|
||||
LINK(this,AccessibleSlideSorterView::Implementation,SelectionChangeListener));
|
||||
mrSlideSorter.GetView().RemoveVisibilityChangeListener(
|
||||
LINK(this,AccessibleSlideSorterView::Implementation,VisibilityChangeListener));
|
||||
|
||||
if (mpWindow != NULL)
|
||||
mpWindow->RemoveEventListener(
|
||||
@ -950,14 +969,7 @@ void AccessibleSlideSorterView::Implementation::Notify (
|
||||
switch (rSdrHint.GetKind())
|
||||
{
|
||||
case HINT_PAGEORDERCHG:
|
||||
if ( ! mbModelChangeLocked)
|
||||
{
|
||||
UpdateChildren();
|
||||
mrAccessibleSlideSorter.FireAccessibleEvent(
|
||||
AccessibleEventId::INVALIDATE_ALL_CHILDREN,
|
||||
Any(),
|
||||
Any());
|
||||
}
|
||||
UpdateChildren();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -975,10 +987,6 @@ void AccessibleSlideSorterView::Implementation::Notify (
|
||||
case sd::ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END:
|
||||
mbModelChangeLocked = false;
|
||||
UpdateChildren();
|
||||
mrAccessibleSlideSorter.FireAccessibleEvent(
|
||||
AccessibleEventId::INVALIDATE_ALL_CHILDREN,
|
||||
Any(),
|
||||
Any());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -995,11 +1003,7 @@ IMPL_LINK(AccessibleSlideSorterView::Implementation, WindowEventListener, VclWin
|
||||
{
|
||||
case VCLEVENT_WINDOW_MOVE:
|
||||
case VCLEVENT_WINDOW_RESIZE:
|
||||
UpdateVisibility();
|
||||
mrAccessibleSlideSorter.FireAccessibleEvent(
|
||||
AccessibleEventId::INVALIDATE_ALL_CHILDREN,
|
||||
Any(),
|
||||
Any());
|
||||
UpdateChildren();
|
||||
break;
|
||||
|
||||
case VCLEVENT_WINDOW_GETFOCUS:
|
||||
@ -1061,4 +1065,16 @@ IMPL_LINK(AccessibleSlideSorterView::Implementation, FocusChangeListener, void*,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
IMPL_LINK(AccessibleSlideSorterView::Implementation, VisibilityChangeListener, void*, EMPTYARG )
|
||||
{
|
||||
UpdateChildren();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // end of namespace ::accessibility
|
||||
|
@ -528,9 +528,9 @@ void Clipboard::DragFinished (sal_Int8 nDropAction)
|
||||
aDraggedPage!=maPagesToRemove.end();
|
||||
aDraggedPage++)
|
||||
{
|
||||
rSelector.SelectPage (*aDraggedPage);
|
||||
rSelector.SelectPage(*aDraggedPage);
|
||||
}
|
||||
mrController.GetSelectionManager()->DeleteSelectedPages ();
|
||||
mrController.GetSelectionManager()->DeleteSelectedPages();
|
||||
}
|
||||
mpUndoContext.reset();
|
||||
mpSelectionObserverContext.reset();
|
||||
|
@ -160,6 +160,7 @@ void SelectionManager::DeleteSelectedPages (const bool bSelectFollowingPage)
|
||||
nNewCurrentSlide = 0;
|
||||
else if (nNewCurrentSlide >= mrSlideSorter.GetModel().GetPageCount())
|
||||
nNewCurrentSlide = mrSlideSorter.GetModel().GetPageCount()-1;
|
||||
mrController.GetPageSelector().CountSelectedPages();
|
||||
mrController.GetPageSelector().SelectPage(nNewCurrentSlide);
|
||||
mrController.GetFocusManager().SetFocusedPage(nNewCurrentSlide);
|
||||
}
|
||||
|
@ -161,6 +161,11 @@ public:
|
||||
const ::boost::shared_ptr<PageSelection>& rSelection,
|
||||
const bool bUpdateCurrentPage = true);
|
||||
|
||||
/** Call this method after the the model has changed to set the number
|
||||
of selected pages.
|
||||
*/
|
||||
void CountSelectedPages (void);
|
||||
|
||||
/** Use the UpdateLock whenever you do a complex selection, i.e. call
|
||||
more than one method in a row. An active lock prevents intermediate
|
||||
changes of the current slide.
|
||||
@ -214,7 +219,6 @@ private:
|
||||
*/
|
||||
void DisableBroadcasting (void);
|
||||
|
||||
void CountSelectedPages (void);
|
||||
void UpdateCurrentPage (const bool bUpdateOnlyWhenPending = false);
|
||||
|
||||
void CheckConsistency (void) const;
|
||||
|
@ -195,7 +195,22 @@ public:
|
||||
/** Add a shape to the page. Typically used from inside
|
||||
PostModelChange().
|
||||
*/
|
||||
void AddSdrObject (SdrObject& rObject);
|
||||
// void AddSdrObject (SdrObject& rObject);
|
||||
|
||||
/** Add a listener that is called when the set of visible slides.
|
||||
@param rListener
|
||||
When this method is called multiple times for the same listener
|
||||
the second and all following calls are ignored. Each listener
|
||||
is added only once.
|
||||
*/
|
||||
void AddVisibilityChangeListener (const Link& rListener);
|
||||
|
||||
/** Remove a listener that is called when the set of visible slides changes.
|
||||
@param rListener
|
||||
It is save to pass a listener that was not added or has been
|
||||
removed previously. Such calls are ignored.
|
||||
*/
|
||||
void RemoveVisibilityChangeListener (const Link& rListener);
|
||||
|
||||
/** The page under the mouse is not highlighted in some contexts. Call
|
||||
this method on context changes.
|
||||
@ -269,6 +284,7 @@ private:
|
||||
::boost::scoped_ptr<ButtonBar> mpButtonBar;
|
||||
::boost::scoped_ptr<ToolTip> mpToolTip;
|
||||
bool mbIsRearrangePending;
|
||||
::std::vector<Link> maVisibilityChangeListeners;
|
||||
|
||||
/** Determine the visibility of all page objects.
|
||||
*/
|
||||
|
@ -81,6 +81,7 @@
|
||||
#include <vector>
|
||||
#endif
|
||||
|
||||
|
||||
using namespace std;
|
||||
using namespace ::sd::slidesorter::model;
|
||||
using namespace ::drawinglayer::primitive2d;
|
||||
@ -167,7 +168,8 @@ SlideSorterView::SlideSorterView (SlideSorter& rSlideSorter)
|
||||
new BackgroundPainter(mrSlideSorter.GetTheme()->GetColor(Theme::Color_Background))),
|
||||
mpButtonBar(new ButtonBar(mrSlideSorter)),
|
||||
mpToolTip(new ToolTip(mrSlideSorter)),
|
||||
mbIsRearrangePending(true)
|
||||
mbIsRearrangePending(true),
|
||||
maVisibilityChangeListeners()
|
||||
{
|
||||
// Hide the page that contains the page objects.
|
||||
SetPageVisible (FALSE);
|
||||
@ -561,7 +563,25 @@ void SlideSorterView::DeterminePageObjectVisibilities (void)
|
||||
PageDescriptor::ST_Visible,
|
||||
aRange.IsInside(nIndex));
|
||||
}
|
||||
maVisiblePageRange = aRange;
|
||||
|
||||
// Broadcast a change of the set of visible page objects.
|
||||
if (maVisiblePageRange != aRange)
|
||||
{
|
||||
maVisiblePageRange = aRange;
|
||||
|
||||
// Tell the listeners that the visibility of some objects has
|
||||
// changed.
|
||||
::std::vector<Link>& aChangeListeners (maVisibilityChangeListeners);
|
||||
for (::std::vector<Link>::const_iterator
|
||||
iLink(aChangeListeners.begin()),
|
||||
iEnd(aChangeListeners.end());
|
||||
iLink!=iEnd;
|
||||
++iLink)
|
||||
{
|
||||
iLink->Call(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Restore the mouse over state.
|
||||
UpdatePageUnderMouse(true);
|
||||
@ -831,6 +851,32 @@ Pair SlideSorterView::GetVisiblePageRange (void)
|
||||
|
||||
|
||||
|
||||
void SlideSorterView::AddVisibilityChangeListener (const Link& rListener)
|
||||
{
|
||||
if (::std::find (
|
||||
maVisibilityChangeListeners.begin(),
|
||||
maVisibilityChangeListeners.end(),
|
||||
rListener) == maVisibilityChangeListeners.end())
|
||||
{
|
||||
maVisibilityChangeListeners.push_back(rListener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void SlideSorterView::RemoveVisibilityChangeListener(const Link&rListener)
|
||||
{
|
||||
maVisibilityChangeListeners.erase (
|
||||
::std::find (
|
||||
maVisibilityChangeListeners.begin(),
|
||||
maVisibilityChangeListeners.end(),
|
||||
rListener));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ButtonBar& SlideSorterView::GetButtonBar (void) const
|
||||
{
|
||||
OSL_ASSERT(mpButtonBar);
|
||||
|
Loading…
x
Reference in New Issue
Block a user