diff options
author | obo <obo@openoffice.org> | 2010-06-21 15:43:09 +0200 |
---|---|---|
committer | obo <obo@openoffice.org> | 2010-06-21 15:43:09 +0200 |
commit | 2fdd360a3255609ed2c445019cdc7866d8ed3010 (patch) | |
tree | 30f76642e3c1a88e3e19b00e0a1adb8a21acf1a1 /sd | |
parent | db68edb033a9f8e5e40065e258992d1086c1d873 (diff) | |
parent | 510d424f855b70320b27f074fa0bf4fc8cd9b164 (diff) |
CWS-TOOLING: integrate CWS impressaccessibility7
Diffstat (limited to 'sd')
-rwxr-xr-x[-rw-r--r--] | sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx | 20 | ||||
-rwxr-xr-x[-rw-r--r--] | sd/source/ui/accessibility/AccessibleSlideSorterView.cxx | 82 | ||||
-rwxr-xr-x | sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx | 17 | ||||
-rwxr-xr-x | sd/source/ui/slidesorter/view/SlideSorterView.cxx | 52 |
4 files changed, 120 insertions, 51 deletions
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx index 1f5e99d69f58..ae1f6f633edc 100644..100755 --- a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx @@ -255,25 +255,21 @@ Reference<XAccessibleStateSet> SAL_CALL if (mxParent.is()) { - // SELECTABLE + // Unconditional states. pStateSet->AddState(AccessibleStateType::SELECTABLE); + pStateSet->AddState(AccessibleStateType::FOCUSABLE); + pStateSet->AddState(AccessibleStateType::ENABLED); + pStateSet->AddState(AccessibleStateType::VISIBLE); + pStateSet->AddState(AccessibleStateType::SHOWING); + pStateSet->AddState(AccessibleStateType::ACTIVE); + pStateSet->AddState(AccessibleStateType::SENSITIVE); - // SELECTED + // Conditional states. if (mrSlideSorter.GetController().GetPageSelector().IsPageSelected(mnPageNumber)) pStateSet->AddState(AccessibleStateType::SELECTED); - - // FOCUSABLE - pStateSet->AddState(AccessibleStateType::FOCUSABLE); - - // FOCUSED if (mrSlideSorter.GetController().GetFocusManager().GetFocusedPageIndex() == mnPageNumber) if (mrSlideSorter.GetController().GetFocusManager().IsFocusShowing()) pStateSet->AddState(AccessibleStateType::FOCUSED); - - pStateSet->AddState(AccessibleStateType::ENABLED); - pStateSet->AddState(AccessibleStateType::VISIBLE); - pStateSet->AddState(AccessibleStateType::SHOWING); - pStateSet->AddState(AccessibleStateType::ACTIVE); } return pStateSet; diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx index 10596bd5f793..6f3508d731a8 100644..100755 --- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx @@ -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,24 +803,27 @@ AccessibleSlideSorterView::Implementation::~Implementation (void) -void AccessibleSlideSorterView::Implementation::UpdateVisibility (void) +void AccessibleSlideSorterView::Implementation::UpdateChildren (void) { + if (mbModelChangeLocked) + { + // Do nothing right now. When the flag is reset, this method is + // called again. + return; + } + ::sd::slidesorter::view::SlideSorterView::PageRange aRange ( mrSlideSorter.GetView().GetVisiblePageRange()); mnFirstVisibleChild = aRange.first; mnLastVisibleChild = aRange.second; -} - - - -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. + // 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); } @@ -834,6 +836,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(); @@ -870,8 +877,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()) @@ -881,14 +886,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; } @@ -909,9 +926,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)); } @@ -921,9 +939,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( @@ -951,14 +970,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; @@ -976,10 +988,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; @@ -996,11 +1004,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: @@ -1062,4 +1066,16 @@ IMPL_LINK(AccessibleSlideSorterView::Implementation, FocusChangeListener, void*, } + + +IMPL_LINK(AccessibleSlideSorterView::Implementation, VisibilityChangeListener, void*, EMPTYARG ) +{ + UpdateChildren(); + + return 1; +} + + + + } // end of namespace ::accessibility diff --git a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx index 6c16a154ecfd..2ef520b1df89 100755 --- a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx @@ -219,6 +219,21 @@ public: */ 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); + protected: virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint); @@ -253,6 +268,8 @@ private: Orientation meOrientation; + ::std::vector<Link> maVisibilityChangeListeners; + /** Adapt the coordinates of the given bounding box according to the other parameters. @param rModelPageObjectBoundingBox diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx index 47ce907be637..6ff6a1bf3109 100755 --- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx +++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx @@ -70,10 +70,9 @@ #include <svx/sdr/contact/objectcontact.hxx> #include <svx/sdrpagewindow.hxx> #include <svl/itempool.hxx> - -#ifndef _SFXITEMPOOL_HXX #include <svl/itempool.hxx> -#endif + +#include <boost/foreach.hpp> using namespace std; using namespace ::sd::slidesorter::model; @@ -420,12 +419,23 @@ void SlideSorterView::DeterminePageObjectVisibilities (void) pContact = pDescriptor->GetViewObjectContact(); if (pDescriptor.get() != NULL) - pDescriptor->SetVisible (bIsVisible); + pDescriptor->SetVisible(bIsVisible); } } - mnFirstVisiblePageIndex = nFirstIndex; - mnLastVisiblePageIndex = nLastIndex; + + if (mnFirstVisiblePageIndex != nFirstIndex + || mnLastVisiblePageIndex != nLastIndex) + { + mnFirstVisiblePageIndex = nFirstIndex; + mnLastVisiblePageIndex = nLastIndex; + + // Tell the listeners that the visibility of some objects has changed. + ::std::vector<Link> aChangeListeners (maVisibilityChangeListeners); + BOOST_FOREACH(Link& rLink, aChangeListeners) + rLink.Call(NULL); + } + } } @@ -773,4 +783,34 @@ void SlideSorterView::AddSdrObject (SdrObject& rObject) rObject.SetModel(&maPageModel); } + + + +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)); +} + + + + + } } } // end of namespace ::sd::slidesorter::view |