LCOV - code coverage report
Current view: top level - sd/source/ui/accessibility - AccessibleSlideSorterView.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 415 0.0 %
Date: 2012-08-25 Functions: 0 67 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 698 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include "AccessibleSlideSorterView.hxx"
      31                 :            : #include "AccessibleSlideSorterObject.hxx"
      32                 :            : 
      33                 :            : #include "SlideSorter.hxx"
      34                 :            : #include "controller/SlideSorterController.hxx"
      35                 :            : #include "controller/SlsPageSelector.hxx"
      36                 :            : #include "controller/SlsFocusManager.hxx"
      37                 :            : #include "controller/SlsSelectionManager.hxx"
      38                 :            : #include "view/SlideSorterView.hxx"
      39                 :            : #include "model/SlideSorterModel.hxx"
      40                 :            : #include "model/SlsPageDescriptor.hxx"
      41                 :            : #include "SlideSorterViewShell.hxx"
      42                 :            : 
      43                 :            : #include "ViewShellHint.hxx"
      44                 :            : #include "sdpage.hxx"
      45                 :            : #include "drawdoc.hxx"
      46                 :            : 
      47                 :            : #include "sdresid.hxx"
      48                 :            : #include "accessibility.hrc"
      49                 :            : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      50                 :            : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      51                 :            : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      52                 :            : #include <comphelper/accessibleeventnotifier.hxx>
      53                 :            : #include <unotools/accessiblestatesethelper.hxx>
      54                 :            : #include <rtl/ref.hxx>
      55                 :            : #include <vcl/svapp.hxx>
      56                 :            : 
      57                 :            : using ::rtl::OUString;
      58                 :            : using namespace ::com::sun::star;
      59                 :            : using namespace ::com::sun::star::uno;
      60                 :            : using namespace ::com::sun::star::accessibility;
      61                 :            : 
      62                 :            : namespace accessibility {
      63                 :            : 
      64                 :            : 
      65                 :            : /** Inner implementation class of the AccessibleSlideSorterView.
      66                 :            : 
      67                 :            :     Note that some event broadcasting is done asynchronously because
      68                 :            :     otherwise it could lead to deadlocks on (at least) some Solaris
      69                 :            :     machines.  Probably (but unverified) this can happen on all GTK based
      70                 :            :     systems.  The asynchronous broadcasting is just a workaround for a
      71                 :            :     poorly understood problem.
      72                 :            : */
      73                 :            : class AccessibleSlideSorterView::Implementation
      74                 :            :     : public SfxListener
      75                 :            : {
      76                 :            : public:
      77                 :            :     Implementation (
      78                 :            :         AccessibleSlideSorterView& rAccessibleSlideSorter,
      79                 :            :         ::sd::slidesorter::SlideSorter& rSlideSorter,
      80                 :            :         ::Window* pWindow);
      81                 :            :     ~Implementation (void);
      82                 :            : 
      83                 :            :     void RequestUpdateChildren (void);
      84                 :            :     void Clear (void);
      85                 :            :     sal_Int32 GetVisibleChildCount (void) const;
      86                 :            :     AccessibleSlideSorterObject* GetAccessibleChild (sal_Int32 nIndex);
      87                 :            :     AccessibleSlideSorterObject* GetVisibleChild (sal_Int32 nIndex);
      88                 :            : 
      89                 :            :     void ConnectListeners (void);
      90                 :            :     void ReleaseListeners (void);
      91                 :            :     void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint);
      92                 :            :     DECL_LINK(WindowEventListener, VclWindowEvent*);
      93                 :            :     DECL_LINK(SelectionChangeListener, void*);
      94                 :            :     DECL_LINK(BroadcastSelectionChange, void*);
      95                 :            :     DECL_LINK(FocusChangeListener, void*);
      96                 :            :     DECL_LINK(VisibilityChangeListener, void*);
      97                 :            :     DECL_LINK(UpdateChildrenCallback, void*);
      98                 :            : 
      99                 :            : private:
     100                 :            :     AccessibleSlideSorterView& mrAccessibleSlideSorter;
     101                 :            :     ::sd::slidesorter::SlideSorter& mrSlideSorter;
     102                 :            :     typedef ::std::vector<rtl::Reference<AccessibleSlideSorterObject> > PageObjectList;
     103                 :            :     PageObjectList maPageObjects;
     104                 :            :     sal_Int32 mnFirstVisibleChild;
     105                 :            :     sal_Int32 mnLastVisibleChild;
     106                 :            :     bool mbListeningToDocument;
     107                 :            :     ::Window* mpWindow;
     108                 :            :     sal_Int32 mnFocusedIndex;
     109                 :            :     bool mbModelChangeLocked;
     110                 :            :     sal_uLong mnUpdateChildrenUserEventId;
     111                 :            :     sal_uLong mnSelectionChangeUserEventId;
     112                 :            : 
     113                 :            :     void UpdateChildren (void);
     114                 :            : };
     115                 :            : 
     116                 :            : 
     117                 :            : 
     118                 :            : 
     119                 :            : //===== AccessibleSlideSorterView =============================================
     120                 :            : 
     121                 :          0 : AccessibleSlideSorterView::AccessibleSlideSorterView(
     122                 :            :     ::sd::slidesorter::SlideSorter& rSlideSorter,
     123                 :            :     const Reference<XAccessible>& rxParent,
     124                 :            :     ::Window* pContentWindow)
     125                 :            :     : AccessibleSlideSorterViewBase(MutexOwner::maMutex),
     126                 :            :       mrSlideSorter(rSlideSorter),
     127                 :            :       mxParent(rxParent),
     128                 :            :       mnClientId(0),
     129                 :          0 :       mpContentWindow(pContentWindow)
     130                 :            : {
     131                 :          0 : }
     132                 :            : 
     133                 :            : 
     134                 :            : 
     135                 :            : 
     136                 :            : 
     137                 :          0 : void AccessibleSlideSorterView::Init()
     138                 :            : {
     139         [ #  # ]:          0 :     mpImpl.reset(new Implementation(*this,mrSlideSorter,mpContentWindow));
     140                 :          0 : }
     141                 :            : 
     142                 :            : 
     143                 :            : 
     144                 :            : 
     145                 :            : 
     146 [ #  # ][ #  # ]:          0 : AccessibleSlideSorterView::~AccessibleSlideSorterView (void)
     147                 :            : {
     148         [ #  # ]:          0 :     Destroyed ();
     149         [ #  # ]:          0 : }
     150                 :            : 
     151                 :            : 
     152                 :            : 
     153                 :            : 
     154                 :          0 : void AccessibleSlideSorterView::FireAccessibleEvent (
     155                 :            :     short nEventId,
     156                 :            :     const uno::Any& rOldValue,
     157                 :            :     const uno::Any& rNewValue )
     158                 :            : {
     159         [ #  # ]:          0 :     if (mnClientId != 0)
     160                 :            :     {
     161         [ #  # ]:          0 :         AccessibleEventObject aEventObject;
     162                 :            : 
     163 [ #  # ][ #  # ]:          0 :         aEventObject.Source = Reference<XWeak>(this);
     164                 :          0 :         aEventObject.EventId = nEventId;
     165                 :          0 :         aEventObject.NewValue = rNewValue;
     166                 :          0 :         aEventObject.OldValue = rOldValue;
     167                 :            : 
     168 [ #  # ][ #  # ]:          0 :         comphelper::AccessibleEventNotifier::addEvent (mnClientId, aEventObject);
     169                 :            :     }
     170                 :          0 : }
     171                 :            : 
     172                 :            : 
     173                 :            : 
     174                 :            : 
     175                 :          0 : void SAL_CALL AccessibleSlideSorterView::disposing (void)
     176                 :            : {
     177         [ #  # ]:          0 :     if (mnClientId != 0)
     178                 :            :     {
     179         [ #  # ]:          0 :         comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
     180                 :          0 :         mnClientId = 0;
     181                 :            :     }
     182                 :          0 :     mpImpl.reset(NULL);
     183                 :          0 : }
     184                 :            : 
     185                 :            : 
     186                 :            : 
     187                 :            : 
     188                 :          0 : AccessibleSlideSorterObject* AccessibleSlideSorterView::GetAccessibleChildImplementation (
     189                 :            :     sal_Int32 nIndex)
     190                 :            : {
     191                 :          0 :     AccessibleSlideSorterObject* pResult = NULL;
     192         [ #  # ]:          0 :     ::osl::MutexGuard aGuard (maMutex);
     193                 :            : 
     194 [ #  # ][ #  # ]:          0 :     if (nIndex>=0 && nIndex<mpImpl->GetVisibleChildCount())
                 [ #  # ]
     195         [ #  # ]:          0 :         pResult = mpImpl->GetVisibleChild(nIndex);
     196                 :            : 
     197         [ #  # ]:          0 :     return pResult;
     198                 :            : }
     199                 :            : 
     200                 :          0 : void AccessibleSlideSorterView::Destroyed (void)
     201                 :            : {
     202         [ #  # ]:          0 :     ::osl::MutexGuard aGuard (maMutex);
     203                 :            : 
     204                 :            :     // Send a disposing to all listeners.
     205         [ #  # ]:          0 :     if (mnClientId != 0)
     206                 :            :     {
     207 [ #  # ][ #  # ]:          0 :         comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
     208                 :          0 :         mnClientId = 0;
     209         [ #  # ]:          0 :     }
     210                 :          0 : }
     211                 :            : 
     212                 :            : //=====  XAccessible  =========================================================
     213                 :            : 
     214                 :            : Reference<XAccessibleContext > SAL_CALL
     215                 :          0 :     AccessibleSlideSorterView::getAccessibleContext (void)
     216                 :            :     throw (uno::RuntimeException)
     217                 :            : {
     218                 :          0 :     ThrowIfDisposed ();
     219                 :          0 :     return this;
     220                 :            : }
     221                 :            : 
     222                 :            : //=====  XAccessibleContext  ==================================================
     223                 :            : 
     224                 :          0 : sal_Int32 SAL_CALL AccessibleSlideSorterView::getAccessibleChildCount (void)
     225                 :            :     throw (RuntimeException)
     226                 :            : {
     227         [ #  # ]:          0 :     ThrowIfDisposed();
     228         [ #  # ]:          0 :     ::osl::MutexGuard aGuard (maMutex);
     229         [ #  # ]:          0 :     return mpImpl->GetVisibleChildCount();
     230                 :            : }
     231                 :            : 
     232                 :            : Reference<XAccessible > SAL_CALL
     233                 :          0 :     AccessibleSlideSorterView::getAccessibleChild (sal_Int32 nIndex)
     234                 :            :     throw (lang::IndexOutOfBoundsException, RuntimeException)
     235                 :            : {
     236         [ #  # ]:          0 :     ThrowIfDisposed();
     237         [ #  # ]:          0 :     ::osl::MutexGuard aGuard (maMutex);
     238                 :            : 
     239 [ #  # ][ #  # ]:          0 :     if (nIndex<0 || nIndex>=mpImpl->GetVisibleChildCount())
                 [ #  # ]
     240         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
     241                 :            : 
     242 [ #  # ][ #  # ]:          0 :     return  mpImpl->GetVisibleChild(nIndex);
         [ #  # ][ #  # ]
     243                 :            : }
     244                 :            : 
     245                 :          0 : Reference<XAccessible > SAL_CALL AccessibleSlideSorterView::getAccessibleParent (void)
     246                 :            :     throw (uno::RuntimeException)
     247                 :            : {
     248         [ #  # ]:          0 :     ThrowIfDisposed();
     249         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     250                 :          0 :     Reference<XAccessible> xParent;
     251                 :            : 
     252         [ #  # ]:          0 :     if (mpContentWindow != NULL)
     253                 :            :     {
     254         [ #  # ]:          0 :         ::Window* pParent = mpContentWindow->GetAccessibleParentWindow();
     255         [ #  # ]:          0 :         if (pParent != NULL)
     256 [ #  # ][ #  # ]:          0 :             xParent = pParent->GetAccessible();
     257                 :            :     }
     258                 :            : 
     259         [ #  # ]:          0 :     return xParent;
     260                 :            : }
     261                 :            : 
     262                 :          0 : sal_Int32 SAL_CALL AccessibleSlideSorterView::getAccessibleIndexInParent (void)
     263                 :            :     throw (uno::RuntimeException)
     264                 :            : {
     265                 :            :     OSL_ASSERT(getAccessibleParent().is());
     266         [ #  # ]:          0 :     ThrowIfDisposed();
     267         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     268                 :          0 :     sal_Int32 nIndexInParent(-1);
     269                 :            : 
     270                 :            : 
     271 [ #  # ][ #  # ]:          0 :     Reference<XAccessibleContext> xParentContext (getAccessibleParent()->getAccessibleContext());
                 [ #  # ]
     272         [ #  # ]:          0 :     if (xParentContext.is())
     273                 :            :     {
     274 [ #  # ][ #  # ]:          0 :         sal_Int32 nChildCount (xParentContext->getAccessibleChildCount());
     275         [ #  # ]:          0 :         for (sal_Int32 i=0; i<nChildCount; ++i)
     276 [ #  # ][ #  # ]:          0 :             if (xParentContext->getAccessibleChild(i).get()
         [ #  # ][ #  # ]
     277                 :            :                     == static_cast<XAccessible*>(this))
     278                 :            :             {
     279                 :          0 :                 nIndexInParent = i;
     280                 :          0 :                 break;
     281                 :            :             }
     282                 :            :     }
     283                 :            : 
     284         [ #  # ]:          0 :     return nIndexInParent;
     285                 :            : }
     286                 :            : 
     287                 :            : 
     288                 :            : 
     289                 :            : 
     290                 :          0 : sal_Int16 SAL_CALL AccessibleSlideSorterView::getAccessibleRole (void)
     291                 :            :     throw (uno::RuntimeException)
     292                 :            : {
     293                 :          0 :     ThrowIfDisposed();
     294                 :            :     static sal_Int16 nRole = AccessibleRole::DOCUMENT;
     295                 :          0 :     return nRole;
     296                 :            : }
     297                 :            : 
     298                 :            : 
     299                 :            : 
     300                 :            : 
     301                 :          0 : ::rtl::OUString SAL_CALL AccessibleSlideSorterView::getAccessibleDescription (void)
     302                 :            :     throw (uno::RuntimeException)
     303                 :            : {
     304         [ #  # ]:          0 :     ThrowIfDisposed();
     305         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     306                 :            : 
     307 [ #  # ][ #  # ]:          0 :     return String(SdResId(SID_SD_A11Y_I_SLIDEVIEW_D));
         [ #  # ][ #  # ]
                 [ #  # ]
     308                 :            : }
     309                 :            : 
     310                 :            : 
     311                 :            : 
     312                 :            : 
     313                 :          0 : ::rtl::OUString SAL_CALL AccessibleSlideSorterView::getAccessibleName (void)
     314                 :            :     throw (uno::RuntimeException)
     315                 :            : {
     316         [ #  # ]:          0 :     ThrowIfDisposed();
     317         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     318                 :            : 
     319 [ #  # ][ #  # ]:          0 :     return String(SdResId(SID_SD_A11Y_I_SLIDEVIEW_N));
         [ #  # ][ #  # ]
                 [ #  # ]
     320                 :            : }
     321                 :            : 
     322                 :            : 
     323                 :            : 
     324                 :            : 
     325                 :            : Reference<XAccessibleRelationSet> SAL_CALL
     326                 :          0 :     AccessibleSlideSorterView::getAccessibleRelationSet (void)
     327                 :            :     throw (uno::RuntimeException)
     328                 :            : {
     329                 :          0 :     return Reference<XAccessibleRelationSet>();
     330                 :            : }
     331                 :            : 
     332                 :            : 
     333                 :            : 
     334                 :            : 
     335                 :            : Reference<XAccessibleStateSet > SAL_CALL
     336                 :          0 :     AccessibleSlideSorterView::getAccessibleStateSet (void)
     337                 :            :     throw (uno::RuntimeException)
     338                 :            : {
     339         [ #  # ]:          0 :     ThrowIfDisposed();
     340         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     341         [ #  # ]:          0 :     ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper();
     342                 :            : 
     343         [ #  # ]:          0 :     pStateSet->AddState(AccessibleStateType::FOCUSABLE);
     344         [ #  # ]:          0 :     pStateSet->AddState(AccessibleStateType::SELECTABLE);
     345         [ #  # ]:          0 :     pStateSet->AddState(AccessibleStateType::ENABLED);
     346         [ #  # ]:          0 :     pStateSet->AddState(AccessibleStateType::ACTIVE);
     347         [ #  # ]:          0 :     pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE);
     348         [ #  # ]:          0 :     pStateSet->AddState(AccessibleStateType::OPAQUE);
     349         [ #  # ]:          0 :     if (mpContentWindow!=NULL)
     350                 :            :     {
     351 [ #  # ][ #  # ]:          0 :         if (mpContentWindow->IsVisible())
     352         [ #  # ]:          0 :             pStateSet->AddState(AccessibleStateType::VISIBLE);
     353 [ #  # ][ #  # ]:          0 :         if (mpContentWindow->IsReallyVisible())
     354         [ #  # ]:          0 :             pStateSet->AddState(AccessibleStateType::SHOWING);
     355                 :            :     }
     356                 :            : 
     357 [ #  # ][ #  # ]:          0 :     return pStateSet;
                 [ #  # ]
     358                 :            : }
     359                 :            : 
     360                 :            : 
     361                 :            : 
     362                 :            : 
     363                 :          0 : lang::Locale SAL_CALL AccessibleSlideSorterView::getLocale (void)
     364                 :            :     throw (IllegalAccessibleComponentStateException,
     365                 :            :         RuntimeException)
     366                 :            : {
     367         [ #  # ]:          0 :     ThrowIfDisposed ();
     368                 :          0 :     Reference<XAccessibleContext> xParentContext;
     369         [ #  # ]:          0 :     Reference<XAccessible> xParent (getAccessibleParent());
     370         [ #  # ]:          0 :     if (xParent.is())
     371 [ #  # ][ #  # ]:          0 :         xParentContext = xParent->getAccessibleContext();
                 [ #  # ]
     372                 :            : 
     373         [ #  # ]:          0 :     if (xParentContext.is())
     374 [ #  # ][ #  # ]:          0 :         return xParentContext->getLocale();
     375                 :            :     else
     376                 :            :         // Strange, no parent!  Anyway, return the default locale.
     377 [ #  # ][ #  # ]:          0 :         return Application::GetSettings().GetLocale();
     378                 :            : }
     379                 :            : 
     380                 :            : 
     381                 :            : 
     382                 :            : 
     383                 :          0 : void SAL_CALL AccessibleSlideSorterView::addEventListener(
     384                 :            :     const Reference<XAccessibleEventListener >& rxListener)
     385                 :            :     throw (RuntimeException)
     386                 :            : {
     387         [ #  # ]:          0 :     if (rxListener.is())
     388                 :            :     {
     389         [ #  # ]:          0 :         const osl::MutexGuard aGuard(maMutex);
     390                 :            : 
     391         [ #  # ]:          0 :         if (IsDisposed())
     392                 :            :         {
     393         [ #  # ]:          0 :             uno::Reference<uno::XInterface> x ((lang::XComponent *)this, uno::UNO_QUERY);
     394 [ #  # ][ #  # ]:          0 :             rxListener->disposing (lang::EventObject (x));
         [ #  # ][ #  # ]
     395                 :            :         }
     396                 :            :         else
     397                 :            :         {
     398         [ #  # ]:          0 :             if ( ! mnClientId)
     399         [ #  # ]:          0 :                 mnClientId = comphelper::AccessibleEventNotifier::registerClient();
     400         [ #  # ]:          0 :             comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener);
     401         [ #  # ]:          0 :         }
     402                 :            :     }
     403                 :          0 : }
     404                 :            : 
     405                 :            : 
     406                 :            : 
     407                 :            : 
     408                 :          0 : void SAL_CALL AccessibleSlideSorterView::removeEventListener(
     409                 :            :     const Reference<XAccessibleEventListener >& rxListener)
     410                 :            :     throw (RuntimeException)
     411                 :            : {
     412                 :          0 :     ThrowIfDisposed();
     413         [ #  # ]:          0 :     if (rxListener.is())
     414                 :            :     {
     415         [ #  # ]:          0 :         const osl::MutexGuard aGuard(maMutex);
     416                 :            : 
     417         [ #  # ]:          0 :         if (mnClientId != 0)
     418                 :            :         {
     419                 :            :             sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener(
     420         [ #  # ]:          0 :                 mnClientId, rxListener );
     421         [ #  # ]:          0 :             if ( !nListenerCount )
     422                 :            :             {
     423                 :            :                 // no listeners anymore -> revoke ourself. This may lead to
     424                 :            :                 // the notifier thread dying (if we were the last client),
     425                 :            :                 // and at least to us not firing any events anymore, in case
     426                 :            :                 // somebody calls NotifyAccessibleEvent, again
     427         [ #  # ]:          0 :                 comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
     428                 :          0 :                 mnClientId = 0;
     429                 :            :             }
     430         [ #  # ]:          0 :         }
     431                 :            :     }
     432                 :          0 : }
     433                 :            : 
     434                 :            : 
     435                 :            : 
     436                 :            : 
     437                 :            : //===== XAccessibleComponent ==================================================
     438                 :            : 
     439                 :          0 : sal_Bool SAL_CALL AccessibleSlideSorterView::containsPoint (const awt::Point& aPoint)
     440                 :            :     throw (RuntimeException)
     441                 :            : {
     442         [ #  # ]:          0 :     ThrowIfDisposed();
     443         [ #  # ]:          0 :     const awt::Rectangle aBBox (getBounds());
     444                 :            :     return (aPoint.X >= 0)
     445                 :            :         && (aPoint.X < aBBox.Width)
     446                 :            :         && (aPoint.Y >= 0)
     447 [ #  # ][ #  # ]:          0 :         && (aPoint.Y < aBBox.Height);
         [ #  # ][ #  # ]
     448                 :            : }
     449                 :            : 
     450                 :            : 
     451                 :            : 
     452                 :            : 
     453                 :            : Reference<XAccessible> SAL_CALL
     454                 :          0 :     AccessibleSlideSorterView::getAccessibleAtPoint (const awt::Point& aPoint)
     455                 :            :     throw (RuntimeException)
     456                 :            : {
     457         [ #  # ]:          0 :     ThrowIfDisposed();
     458                 :          0 :     Reference<XAccessible> xAccessible;
     459         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     460                 :            : 
     461                 :          0 :     const Point aTestPoint (aPoint.X, aPoint.Y);
     462                 :            :     ::sd::slidesorter::model::SharedPageDescriptor pHitDescriptor (
     463 [ #  # ][ #  # ]:          0 :         mrSlideSorter.GetController().GetPageAt(aTestPoint));
     464         [ #  # ]:          0 :     if (pHitDescriptor.get() != NULL)
     465                 :            :         xAccessible = mpImpl->GetAccessibleChild(
     466 [ #  # ][ #  # ]:          0 :             (pHitDescriptor->GetPage()->GetPageNum()-1)/2);
         [ #  # ][ #  # ]
                 [ #  # ]
     467                 :            : 
     468 [ #  # ][ #  # ]:          0 :     return xAccessible;
     469                 :            : }
     470                 :            : 
     471                 :            : 
     472                 :            : 
     473                 :            : 
     474                 :          0 : awt::Rectangle SAL_CALL AccessibleSlideSorterView::getBounds (void)
     475                 :            :     throw (uno::RuntimeException)
     476                 :            : {
     477         [ #  # ]:          0 :     ThrowIfDisposed();
     478         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     479                 :          0 :     awt::Rectangle aBBox;
     480                 :            : 
     481         [ #  # ]:          0 :     if (mpContentWindow != NULL)
     482                 :            :     {
     483         [ #  # ]:          0 :         const Point aPosition (mpContentWindow->GetPosPixel());
     484                 :          0 :         const Size aSize (mpContentWindow->GetOutputSizePixel());
     485                 :            : 
     486                 :          0 :         aBBox.X = aPosition.X();
     487                 :          0 :         aBBox.Y = aPosition.Y();
     488                 :          0 :         aBBox.Width = aSize.Width();
     489                 :          0 :         aBBox.Height = aSize.Height();
     490                 :            :     }
     491                 :            : 
     492         [ #  # ]:          0 :     return aBBox;
     493                 :            : }
     494                 :            : 
     495                 :            : 
     496                 :            : 
     497                 :            : 
     498                 :          0 : awt::Point SAL_CALL AccessibleSlideSorterView::getLocation (void)
     499                 :            :     throw (uno::RuntimeException)
     500                 :            : {
     501                 :          0 :     ThrowIfDisposed();
     502                 :          0 :     awt::Point aLocation;
     503                 :            : 
     504         [ #  # ]:          0 :     if (mpContentWindow != NULL)
     505                 :            :     {
     506         [ #  # ]:          0 :         const Point aPosition (mpContentWindow->GetPosPixel());
     507                 :          0 :         aLocation.X = aPosition.X();
     508                 :          0 :         aLocation.Y = aPosition.Y();
     509                 :            :     }
     510                 :            : 
     511                 :          0 :     return aLocation;
     512                 :            : }
     513                 :            : 
     514                 :            : 
     515                 :            : 
     516                 :            : 
     517                 :            : /** Calculate the location on screen from the parent's location on screen
     518                 :            :     and our own relative location.
     519                 :            : */
     520                 :          0 : awt::Point SAL_CALL AccessibleSlideSorterView::getLocationOnScreen()
     521                 :            :     throw (uno::RuntimeException)
     522                 :            : {
     523         [ #  # ]:          0 :     ThrowIfDisposed();
     524         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     525                 :          0 :     awt::Point aParentLocationOnScreen;
     526                 :            : 
     527         [ #  # ]:          0 :     Reference<XAccessible> xParent (getAccessibleParent());
     528         [ #  # ]:          0 :     if (xParent.is())
     529                 :            :     {
     530                 :            :         Reference<XAccessibleComponent> xParentComponent (
     531 [ #  # ][ #  # ]:          0 :             xParent->getAccessibleContext(), uno::UNO_QUERY);
                 [ #  # ]
     532         [ #  # ]:          0 :         if (xParentComponent.is())
     533 [ #  # ][ #  # ]:          0 :             aParentLocationOnScreen = xParentComponent->getLocationOnScreen();
     534                 :            :     }
     535                 :            : 
     536         [ #  # ]:          0 :     awt::Point aLocationOnScreen (getLocation());
     537                 :          0 :     aLocationOnScreen.X += aParentLocationOnScreen.X;
     538                 :          0 :     aLocationOnScreen.Y += aParentLocationOnScreen.Y;
     539                 :            : 
     540         [ #  # ]:          0 :     return aLocationOnScreen;
     541                 :            : }
     542                 :            : 
     543                 :            : 
     544                 :            : 
     545                 :            : 
     546                 :          0 : awt::Size SAL_CALL AccessibleSlideSorterView::getSize (void)
     547                 :            :     throw (uno::RuntimeException)
     548                 :            : {
     549                 :          0 :     ThrowIfDisposed();
     550                 :          0 :     awt::Size aSize;
     551                 :            : 
     552         [ #  # ]:          0 :     if (mpContentWindow != NULL)
     553                 :            :     {
     554                 :          0 :         const Size aOutputSize (mpContentWindow->GetOutputSizePixel());
     555                 :          0 :         aSize.Width = aOutputSize.Width();
     556                 :          0 :         aSize.Height = aOutputSize.Height();
     557                 :            :     }
     558                 :            : 
     559                 :          0 :     return aSize;
     560                 :            : }
     561                 :            : 
     562                 :            : 
     563                 :            : 
     564                 :            : 
     565                 :          0 : void SAL_CALL AccessibleSlideSorterView::grabFocus (void)
     566                 :            :     throw (uno::RuntimeException)
     567                 :            : {
     568         [ #  # ]:          0 :     ThrowIfDisposed();
     569         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     570                 :            : 
     571         [ #  # ]:          0 :     if (mpContentWindow)
     572 [ #  # ][ #  # ]:          0 :         mpContentWindow->GrabFocus();
     573                 :          0 : }
     574                 :            : 
     575                 :            : 
     576                 :            : 
     577                 :            : 
     578                 :          0 : sal_Int32 SAL_CALL AccessibleSlideSorterView::getForeground (void)
     579                 :            :     throw (RuntimeException)
     580                 :            : {
     581         [ #  # ]:          0 :     ThrowIfDisposed();
     582         [ #  # ]:          0 :     svtools::ColorConfig aColorConfig;
     583         [ #  # ]:          0 :     sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
     584         [ #  # ]:          0 :     return static_cast<sal_Int32>(nColor);
     585                 :            : }
     586                 :            : 
     587                 :            : 
     588                 :            : 
     589                 :            : 
     590                 :          0 : sal_Int32 SAL_CALL AccessibleSlideSorterView::getBackground (void)
     591                 :            :     throw (RuntimeException)
     592                 :            : {
     593                 :          0 :     ThrowIfDisposed();
     594                 :          0 :     sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
     595                 :          0 :     return static_cast<sal_Int32>(nColor);
     596                 :            : }
     597                 :            : 
     598                 :            : 
     599                 :            : 
     600                 :            : 
     601                 :            : //===== XAccessibleSelection ==================================================
     602                 :            : 
     603                 :          0 : void SAL_CALL AccessibleSlideSorterView::selectAccessibleChild (sal_Int32 nChildIndex)
     604                 :            :     throw (lang::IndexOutOfBoundsException,
     605                 :            :         RuntimeException)
     606                 :            : {
     607         [ #  # ]:          0 :     ThrowIfDisposed();
     608         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     609                 :            : 
     610         [ #  # ]:          0 :     AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
     611         [ #  # ]:          0 :     if (pChild != NULL)
     612 [ #  # ][ #  # ]:          0 :         mrSlideSorter.GetController().GetPageSelector().SelectPage(pChild->GetPageNumber());
         [ #  # ][ #  # ]
     613                 :            :     else
     614 [ #  # ][ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
     615                 :          0 : }
     616                 :            : 
     617                 :            : 
     618                 :            : 
     619                 :            : 
     620                 :          0 : sal_Bool SAL_CALL AccessibleSlideSorterView::isAccessibleChildSelected (sal_Int32 nChildIndex)
     621                 :            :     throw (lang::IndexOutOfBoundsException,
     622                 :            :         RuntimeException)
     623                 :            : {
     624         [ #  # ]:          0 :     ThrowIfDisposed();
     625                 :          0 :     sal_Bool bIsSelected = sal_False;
     626         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     627                 :            : 
     628         [ #  # ]:          0 :     AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
     629         [ #  # ]:          0 :     if (pChild != NULL)
     630 [ #  # ][ #  # ]:          0 :         bIsSelected = mrSlideSorter.GetController().GetPageSelector().IsPageSelected(
     631 [ #  # ][ #  # ]:          0 :             pChild->GetPageNumber());
     632                 :            :     else
     633         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
     634                 :            : 
     635         [ #  # ]:          0 :     return bIsSelected;
     636                 :            : }
     637                 :            : 
     638                 :            : 
     639                 :            : 
     640                 :            : 
     641                 :          0 : void SAL_CALL AccessibleSlideSorterView::clearAccessibleSelection (void)
     642                 :            :     throw (uno::RuntimeException)
     643                 :            : {
     644         [ #  # ]:          0 :     ThrowIfDisposed();
     645         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     646                 :            : 
     647 [ #  # ][ #  # ]:          0 :     mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
         [ #  # ][ #  # ]
     648                 :          0 : }
     649                 :            : 
     650                 :            : 
     651                 :            : 
     652                 :            : 
     653                 :          0 : void SAL_CALL AccessibleSlideSorterView::selectAllAccessibleChildren (void)
     654                 :            :     throw (uno::RuntimeException)
     655                 :            : {
     656         [ #  # ]:          0 :     ThrowIfDisposed();
     657         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     658                 :            : 
     659 [ #  # ][ #  # ]:          0 :     mrSlideSorter.GetController().GetPageSelector().SelectAllPages();
         [ #  # ][ #  # ]
     660                 :          0 : }
     661                 :            : 
     662                 :            : 
     663                 :            : 
     664                 :            : 
     665                 :          0 : sal_Int32 SAL_CALL AccessibleSlideSorterView::getSelectedAccessibleChildCount (void)
     666                 :            :     throw (uno::RuntimeException)
     667                 :            : {
     668         [ #  # ]:          0 :     ThrowIfDisposed ();
     669         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     670 [ #  # ][ #  # ]:          0 :     return mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount();
         [ #  # ][ #  # ]
     671                 :            : }
     672                 :            : 
     673                 :            : 
     674                 :            : 
     675                 :            : 
     676                 :            : Reference<XAccessible > SAL_CALL
     677                 :          0 :     AccessibleSlideSorterView::getSelectedAccessibleChild (sal_Int32 nSelectedChildIndex )
     678                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     679                 :            : {
     680         [ #  # ]:          0 :     ThrowIfDisposed ();
     681         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     682                 :          0 :     Reference<XAccessible> xChild;
     683                 :            : 
     684                 :            :     ::sd::slidesorter::controller::PageSelector& rSelector (
     685 [ #  # ][ #  # ]:          0 :         mrSlideSorter.GetController().GetPageSelector());
     686         [ #  # ]:          0 :     sal_Int32 nPageCount(rSelector.GetPageCount());
     687                 :          0 :     sal_Int32 nSelectedCount = 0;
     688         [ #  # ]:          0 :     for (sal_Int32 i=0; i<nPageCount; i++)
     689 [ #  # ][ #  # ]:          0 :         if (rSelector.IsPageSelected(i))
     690                 :            :         {
     691         [ #  # ]:          0 :             if (nSelectedCount == nSelectedChildIndex)
     692                 :            :             {
     693 [ #  # ][ #  # ]:          0 :                 xChild = mpImpl->GetAccessibleChild(i);
                 [ #  # ]
     694                 :          0 :                 break;
     695                 :            :             }
     696                 :          0 :             ++nSelectedCount;
     697                 :            :         }
     698                 :            : 
     699                 :            : 
     700         [ #  # ]:          0 :     if ( ! xChild.is() )
     701         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
     702                 :            : 
     703         [ #  # ]:          0 :     return xChild;
     704                 :            : }
     705                 :            : 
     706                 :            : 
     707                 :            : 
     708                 :            : 
     709                 :          0 : void SAL_CALL AccessibleSlideSorterView::deselectAccessibleChild (sal_Int32 nChildIndex)
     710                 :            :     throw (lang::IndexOutOfBoundsException,
     711                 :            :         RuntimeException)
     712                 :            : {
     713         [ #  # ]:          0 :     ThrowIfDisposed();
     714         [ #  # ]:          0 :     const SolarMutexGuard aSolarGuard;
     715                 :            : 
     716         [ #  # ]:          0 :     AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
     717         [ #  # ]:          0 :     if (pChild != NULL)
     718 [ #  # ][ #  # ]:          0 :         mrSlideSorter.GetController().GetPageSelector().DeselectPage(pChild->GetPageNumber());
         [ #  # ][ #  # ]
     719                 :            :     else
     720 [ #  # ][ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
     721                 :          0 : }
     722                 :            : 
     723                 :            : 
     724                 :            : 
     725                 :            : 
     726                 :            : //=====  XServiceInfo  ========================================================
     727                 :            : 
     728                 :            : ::rtl::OUString SAL_CALL
     729                 :          0 :        AccessibleSlideSorterView::getImplementationName (void)
     730                 :            :     throw (::com::sun::star::uno::RuntimeException)
     731                 :            : {
     732                 :          0 :     return OUString("AccessibleSlideSorterView");
     733                 :            : }
     734                 :            : 
     735                 :            : 
     736                 :            : 
     737                 :            : 
     738                 :            : sal_Bool SAL_CALL
     739                 :          0 :      AccessibleSlideSorterView::supportsService (const OUString& sServiceName)
     740                 :            :     throw (::com::sun::star::uno::RuntimeException)
     741                 :            : {
     742         [ #  # ]:          0 :     ThrowIfDisposed ();
     743                 :            : 
     744                 :            :     //  Iterate over all supported service names and return true if on of them
     745                 :            :     //  matches the given name.
     746                 :            :     uno::Sequence< ::rtl::OUString> aSupportedServices (
     747         [ #  # ]:          0 :         getSupportedServiceNames ());
     748         [ #  # ]:          0 :     for (int i=0; i<aSupportedServices.getLength(); i++)
     749 [ #  # ][ #  # ]:          0 :         if (sServiceName == aSupportedServices[i])
     750                 :          0 :             return sal_True;
     751         [ #  # ]:          0 :     return sal_False;
     752                 :            : }
     753                 :            : 
     754                 :            : 
     755                 :            : 
     756                 :            : 
     757                 :            : uno::Sequence< ::rtl::OUString> SAL_CALL
     758                 :          0 :        AccessibleSlideSorterView::getSupportedServiceNames (void)
     759                 :            :     throw (::com::sun::star::uno::RuntimeException)
     760                 :            : {
     761                 :          0 :     ThrowIfDisposed ();
     762                 :            : 
     763                 :            :     static const OUString sServiceNames[3] = {
     764                 :            :             OUString("com.sun.star.accessibility.Accessible"),
     765                 :            :             OUString("com.sun.star.accessibility.AccessibleContext"),
     766                 :            :             OUString("com.sun.star.drawing.AccessibleSlideSorterView")
     767 [ #  # ][ #  # ]:          0 :     };
                 [ #  # ]
     768                 :          0 :     return uno::Sequence<OUString> (sServiceNames, 3);
     769                 :            : }
     770                 :            : 
     771                 :            : 
     772                 :            : 
     773                 :            : 
     774                 :          0 : void AccessibleSlideSorterView::ThrowIfDisposed (void)
     775                 :            :     throw (lang::DisposedException)
     776                 :            : {
     777 [ #  # ][ #  # ]:          0 :     if (rBHelper.bDisposed || rBHelper.bInDispose)
     778                 :            :     {
     779                 :            :         OSL_TRACE ("Calling disposed object. Throwing exception:");
     780                 :            :         throw lang::DisposedException ("object has been already disposed",
     781 [ #  # ][ #  # ]:          0 :             static_cast<uno::XWeak*>(this));
     782                 :            :     }
     783                 :          0 : }
     784                 :            : 
     785                 :            : 
     786                 :            : 
     787                 :          0 : sal_Bool AccessibleSlideSorterView::IsDisposed (void)
     788                 :            : {
     789 [ #  # ][ #  # ]:          0 :     return (rBHelper.bDisposed || rBHelper.bInDispose);
     790                 :            : }
     791                 :            : 
     792                 :            : 
     793                 :            : 
     794                 :            : 
     795                 :            : //===== AccessibleSlideSorterView::Implementation =============================
     796                 :            : 
     797                 :          0 : AccessibleSlideSorterView::Implementation::Implementation (
     798                 :            :     AccessibleSlideSorterView& rAccessibleSlideSorter,
     799                 :            :     ::sd::slidesorter::SlideSorter& rSlideSorter,
     800                 :            :     ::Window* pWindow)
     801                 :            :     : mrAccessibleSlideSorter(rAccessibleSlideSorter),
     802                 :            :       mrSlideSorter(rSlideSorter),
     803                 :            :       maPageObjects(),
     804                 :            :       mnFirstVisibleChild(0),
     805                 :            :       mnLastVisibleChild(-1),
     806                 :            :       mbListeningToDocument(false),
     807                 :            :       mpWindow(pWindow),
     808                 :            :       mnFocusedIndex(-1),
     809                 :            :       mbModelChangeLocked(false),
     810                 :            :       mnUpdateChildrenUserEventId(0),
     811         [ #  # ]:          0 :       mnSelectionChangeUserEventId(0)
     812                 :            : {
     813         [ #  # ]:          0 :     ConnectListeners();
     814         [ #  # ]:          0 :     UpdateChildren();
     815                 :          0 : }
     816                 :            : 
     817                 :            : 
     818                 :            : 
     819                 :            : 
     820                 :          0 : AccessibleSlideSorterView::Implementation::~Implementation (void)
     821                 :            : {
     822         [ #  # ]:          0 :     if (mnUpdateChildrenUserEventId != 0)
     823         [ #  # ]:          0 :         Application::RemoveUserEvent(mnUpdateChildrenUserEventId);
     824         [ #  # ]:          0 :     if (mnSelectionChangeUserEventId != 0)
     825         [ #  # ]:          0 :         Application::RemoveUserEvent(mnSelectionChangeUserEventId);
     826         [ #  # ]:          0 :     ReleaseListeners();
     827         [ #  # ]:          0 :     Clear();
     828         [ #  # ]:          0 : }
     829                 :            : 
     830                 :            : 
     831                 :            : 
     832                 :            : 
     833                 :          0 : void AccessibleSlideSorterView::Implementation::RequestUpdateChildren (void)
     834                 :            : {
     835         [ #  # ]:          0 :     if (mnUpdateChildrenUserEventId == 0)
     836                 :            :         mnUpdateChildrenUserEventId = Application::PostUserEvent(
     837                 :            :             LINK(this, AccessibleSlideSorterView::Implementation,
     838         [ #  # ]:          0 :             UpdateChildrenCallback));
     839                 :          0 : }
     840                 :            : 
     841                 :            : 
     842                 :            : 
     843                 :            : 
     844                 :          0 : void AccessibleSlideSorterView::Implementation::UpdateChildren (void)
     845                 :            : {
     846         [ #  # ]:          0 :     if (mbModelChangeLocked)
     847                 :            :     {
     848                 :            :         // Do nothing right now.  When the flag is reset, this method is
     849                 :            :         // called again.
     850                 :            :         return;
     851                 :            :     }
     852                 :            : 
     853 [ #  # ][ #  # ]:          0 :     const Pair aRange (mrSlideSorter.GetView().GetVisiblePageRange());
     854                 :          0 :     mnFirstVisibleChild = aRange.A();
     855                 :          0 :     mnLastVisibleChild = aRange.B();
     856                 :            : 
     857                 :            :     // Release all children.
     858         [ #  # ]:          0 :     Clear();
     859                 :            : 
     860                 :            :     // Create new children for the modified visible range.
     861 [ #  # ][ #  # ]:          0 :     maPageObjects.resize(mrSlideSorter.GetModel().GetPageCount());
                 [ #  # ]
     862                 :            : 
     863                 :            :     // No Visible children
     864 [ #  # ][ #  # ]:          0 :     if (mnFirstVisibleChild == -1 && mnLastVisibleChild == -1)
     865                 :            :         return;
     866                 :            : 
     867         [ #  # ]:          0 :     for (sal_Int32 nIndex(mnFirstVisibleChild); nIndex<=mnLastVisibleChild; ++nIndex)
     868         [ #  # ]:          0 :         GetAccessibleChild(nIndex);
     869                 :            : }
     870                 :            : 
     871                 :            : 
     872                 :            : 
     873                 :            : 
     874                 :          0 : void AccessibleSlideSorterView::Implementation::Clear (void)
     875                 :            : {
     876                 :          0 :     PageObjectList::iterator iPageObject;
     877                 :          0 :     PageObjectList::iterator iEnd = maPageObjects.end();
     878 [ #  # ][ #  # ]:          0 :     for (iPageObject=maPageObjects.begin(); iPageObject!=iEnd; ++iPageObject)
     879         [ #  # ]:          0 :         if (*iPageObject != NULL)
     880                 :            :         {
     881                 :            :             mrAccessibleSlideSorter.FireAccessibleEvent(
     882                 :            :                 AccessibleEventId::CHILD,
     883         [ #  # ]:          0 :                 Any(Reference<XAccessible>(iPageObject->get())),
     884 [ #  # ][ #  # ]:          0 :                 Any());
                 [ #  # ]
     885                 :            : 
     886 [ #  # ][ #  # ]:          0 :             Reference<XComponent> xComponent (Reference<XWeak>(iPageObject->get()), UNO_QUERY);
     887         [ #  # ]:          0 :             if (xComponent.is())
     888 [ #  # ][ #  # ]:          0 :                 xComponent->dispose();
     889         [ #  # ]:          0 :             *iPageObject = NULL;
     890                 :            :         }
     891                 :          0 :     maPageObjects.clear();
     892                 :          0 : }
     893                 :            : 
     894                 :            : 
     895                 :            : 
     896                 :            : 
     897                 :          0 : sal_Int32 AccessibleSlideSorterView::Implementation::GetVisibleChildCount (void) const
     898                 :            : {
     899 [ #  # ][ #  # ]:          0 :     if (mnFirstVisibleChild<=mnLastVisibleChild && mnFirstVisibleChild>=0)
     900                 :          0 :         return mnLastVisibleChild - mnFirstVisibleChild + 1;
     901                 :            :     else
     902                 :          0 :         return 0;
     903                 :            : }
     904                 :            : 
     905                 :            : 
     906                 :            : 
     907                 :            : 
     908                 :          0 : AccessibleSlideSorterObject* AccessibleSlideSorterView::Implementation::GetVisibleChild (
     909                 :            :     sal_Int32 nIndex)
     910                 :            : {
     911                 :            :     assert(nIndex>=0 && nIndex<GetVisibleChildCount());
     912                 :            : 
     913                 :          0 :     return GetAccessibleChild(nIndex+mnFirstVisibleChild);
     914                 :            : }
     915                 :            : 
     916                 :            : 
     917                 :            : 
     918                 :            : 
     919                 :          0 : AccessibleSlideSorterObject* AccessibleSlideSorterView::Implementation::GetAccessibleChild (
     920                 :            :     sal_Int32 nIndex)
     921                 :            : {
     922                 :          0 :     AccessibleSlideSorterObject* pChild = NULL;
     923                 :            : 
     924 [ #  # ][ #  # ]:          0 :     if (nIndex>=0 && (sal_uInt32)nIndex<maPageObjects.size())
                 [ #  # ]
     925                 :            :     {
     926         [ #  # ]:          0 :         if (maPageObjects[nIndex] == NULL)
     927                 :            :         {
     928                 :            :             ::sd::slidesorter::model::SharedPageDescriptor pDescriptor(
     929 [ #  # ][ #  # ]:          0 :                 mrSlideSorter.GetModel().GetPageDescriptor(nIndex));
     930         [ #  # ]:          0 :             if (pDescriptor.get() != NULL)
     931                 :            :             {
     932                 :          0 :                 maPageObjects[nIndex] = new AccessibleSlideSorterObject(
     933                 :            :                     &mrAccessibleSlideSorter,
     934                 :            :                     mrSlideSorter,
     935 [ #  # ][ #  # ]:          0 :                     (pDescriptor->GetPage()->GetPageNum()-1)/2);
                 [ #  # ]
           [ #  #  #  # ]
     936                 :            : 
     937                 :            :                 mrAccessibleSlideSorter.FireAccessibleEvent(
     938                 :            :                     AccessibleEventId::CHILD,
     939                 :            :                     Any(),
     940 [ #  # ][ #  # ]:          0 :                     Any(Reference<XAccessible>(maPageObjects[nIndex].get())));
         [ #  # ][ #  # ]
     941         [ #  # ]:          0 :             }
     942                 :            : 
     943                 :            :         }
     944                 :            : 
     945                 :          0 :         pChild = maPageObjects[nIndex].get();
     946                 :            :     }
     947                 :            :     else
     948                 :            :     {
     949                 :            :         OSL_ASSERT(nIndex>=0 && (sal_uInt32)nIndex<maPageObjects.size());
     950                 :            :     }
     951                 :            : 
     952                 :          0 :     return pChild;
     953                 :            : }
     954                 :            : 
     955                 :            : 
     956                 :            : 
     957                 :            : 
     958                 :          0 : void AccessibleSlideSorterView::Implementation::ConnectListeners (void)
     959                 :            : {
     960                 :          0 :     StartListening (*mrSlideSorter.GetModel().GetDocument());
     961         [ #  # ]:          0 :     if (mrSlideSorter.GetViewShell() != NULL)
     962                 :          0 :         StartListening (*mrSlideSorter.GetViewShell());
     963                 :          0 :     mbListeningToDocument = true;
     964                 :            : 
     965         [ #  # ]:          0 :     if (mpWindow != NULL)
     966                 :            :         mpWindow->AddEventListener(
     967         [ #  # ]:          0 :             LINK(this,AccessibleSlideSorterView::Implementation,WindowEventListener));
     968                 :            : 
     969         [ #  # ]:          0 :     mrSlideSorter.GetController().GetSelectionManager()->AddSelectionChangeListener(
     970 [ #  # ][ #  # ]:          0 :         LINK(this,AccessibleSlideSorterView::Implementation,SelectionChangeListener));
                 [ #  # ]
     971 [ #  # ][ #  # ]:          0 :     mrSlideSorter.GetController().GetFocusManager().AddFocusChangeListener(
     972         [ #  # ]:          0 :         LINK(this,AccessibleSlideSorterView::Implementation,FocusChangeListener));
     973         [ #  # ]:          0 :     mrSlideSorter.GetView().AddVisibilityChangeListener(
     974         [ #  # ]:          0 :         LINK(this,AccessibleSlideSorterView::Implementation,VisibilityChangeListener));
     975                 :          0 : }
     976                 :            : 
     977                 :            : 
     978                 :            : 
     979                 :            : 
     980                 :          0 : void AccessibleSlideSorterView::Implementation::ReleaseListeners (void)
     981                 :            : {
     982 [ #  # ][ #  # ]:          0 :     mrSlideSorter.GetController().GetFocusManager().RemoveFocusChangeListener(
     983         [ #  # ]:          0 :         LINK(this,AccessibleSlideSorterView::Implementation,FocusChangeListener));
     984         [ #  # ]:          0 :     mrSlideSorter.GetController().GetSelectionManager()->RemoveSelectionChangeListener(
     985 [ #  # ][ #  # ]:          0 :         LINK(this,AccessibleSlideSorterView::Implementation,SelectionChangeListener));
                 [ #  # ]
     986         [ #  # ]:          0 :     mrSlideSorter.GetView().RemoveVisibilityChangeListener(
     987         [ #  # ]:          0 :         LINK(this,AccessibleSlideSorterView::Implementation,VisibilityChangeListener));
     988                 :            : 
     989         [ #  # ]:          0 :     if (mpWindow != NULL)
     990                 :            :         mpWindow->RemoveEventListener(
     991         [ #  # ]:          0 :             LINK(this,AccessibleSlideSorterView::Implementation,WindowEventListener));
     992                 :            : 
     993         [ #  # ]:          0 :     if (mbListeningToDocument)
     994                 :            :     {
     995         [ #  # ]:          0 :         if (mrSlideSorter.GetViewShell() != NULL)
     996                 :          0 :             StartListening(*mrSlideSorter.GetViewShell());
     997                 :          0 :         EndListening (*mrSlideSorter.GetModel().GetDocument());
     998                 :          0 :         mbListeningToDocument = false;
     999                 :            :     }
    1000                 :          0 : }
    1001                 :            : 
    1002                 :            : 
    1003                 :            : 
    1004                 :            : 
    1005                 :          0 : void AccessibleSlideSorterView::Implementation::Notify (
    1006                 :            :     SfxBroadcaster&,
    1007                 :            :     const SfxHint& rHint)
    1008                 :            : {
    1009         [ #  # ]:          0 :     if (rHint.ISA(SdrHint))
    1010                 :            :     {
    1011 [ #  # ][ #  # ]:          0 :         SdrHint& rSdrHint (*PTR_CAST(SdrHint,&rHint));
    1012         [ #  # ]:          0 :         switch (rSdrHint.GetKind())
    1013                 :            :         {
    1014                 :            :             case HINT_PAGEORDERCHG:
    1015                 :          0 :                 RequestUpdateChildren();
    1016                 :          0 :                 break;
    1017                 :            :             default:
    1018                 :          0 :                 break;
    1019                 :            :         }
    1020                 :            :     }
    1021         [ #  # ]:          0 :     else if (rHint.ISA(sd::ViewShellHint))
    1022                 :            :     {
    1023 [ #  # ][ #  # ]:          0 :         sd::ViewShellHint& rViewShellHint (*PTR_CAST(sd::ViewShellHint, &rHint));
    1024      [ #  #  # ]:          0 :         switch (rViewShellHint.GetHintId())
    1025                 :            :         {
    1026                 :            :             case sd::ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START:
    1027                 :          0 :                 mbModelChangeLocked = true;
    1028                 :          0 :                 break;
    1029                 :            : 
    1030                 :            :             case sd::ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END:
    1031                 :          0 :                 mbModelChangeLocked = false;
    1032                 :          0 :                 RequestUpdateChildren();
    1033                 :          0 :                 break;
    1034                 :            :             default:
    1035                 :          0 :                 break;
    1036                 :            :         }
    1037                 :            :     }
    1038                 :          0 : }
    1039                 :            : 
    1040                 :            : 
    1041                 :            : 
    1042                 :            : 
    1043                 :          0 : IMPL_LINK(AccessibleSlideSorterView::Implementation, WindowEventListener, VclWindowEvent*, pEvent)
    1044                 :            : {
    1045      [ #  #  # ]:          0 :     switch (pEvent->GetId())
    1046                 :            :     {
    1047                 :            :         case VCLEVENT_WINDOW_MOVE:
    1048                 :            :         case VCLEVENT_WINDOW_RESIZE:
    1049                 :          0 :             RequestUpdateChildren();
    1050                 :          0 :             break;
    1051                 :            : 
    1052                 :            :         case VCLEVENT_WINDOW_GETFOCUS:
    1053                 :            :         case VCLEVENT_WINDOW_LOSEFOCUS:
    1054                 :            :             mrAccessibleSlideSorter.FireAccessibleEvent(
    1055                 :            :                 AccessibleEventId::SELECTION_CHANGED,
    1056                 :            :                 Any(),
    1057         [ #  # ]:          0 :                 Any());
    1058                 :          0 :             break;
    1059                 :            :         default:
    1060                 :          0 :             break;
    1061                 :            :     }
    1062                 :          0 :     return 1;
    1063                 :            : }
    1064                 :            : 
    1065                 :            : 
    1066                 :            : 
    1067                 :            : 
    1068                 :          0 : IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, SelectionChangeListener)
    1069                 :            : {
    1070         [ #  # ]:          0 :     if (mnSelectionChangeUserEventId == 0)
    1071                 :            :         mnSelectionChangeUserEventId = Application::PostUserEvent(
    1072         [ #  # ]:          0 :             LINK(this, AccessibleSlideSorterView::Implementation, BroadcastSelectionChange));
    1073                 :          0 :     return 1;
    1074                 :            : }
    1075                 :            : 
    1076                 :            : 
    1077                 :            : 
    1078                 :            : 
    1079                 :          0 : IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, BroadcastSelectionChange)
    1080                 :            : {
    1081                 :          0 :     mnSelectionChangeUserEventId = 0;
    1082                 :            :     mrAccessibleSlideSorter.FireAccessibleEvent(
    1083                 :            :         AccessibleEventId::SELECTION_CHANGED,
    1084                 :            :         Any(),
    1085         [ #  # ]:          0 :         Any());
    1086                 :          0 :     return 1;
    1087                 :            : }
    1088                 :            : 
    1089                 :            : 
    1090                 :            : 
    1091                 :            : 
    1092                 :          0 : IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, FocusChangeListener)
    1093                 :            : {
    1094                 :            :     sal_Int32 nNewFocusedIndex (
    1095                 :          0 :         mrSlideSorter.GetController().GetFocusManager().GetFocusedPageIndex());
    1096                 :            : 
    1097         [ #  # ]:          0 :     if (nNewFocusedIndex != mnFocusedIndex)
    1098                 :            :     {
    1099         [ #  # ]:          0 :         if (mnFocusedIndex >= 0)
    1100                 :            :         {
    1101                 :          0 :             AccessibleSlideSorterObject* pObject = GetAccessibleChild(mnFocusedIndex);
    1102         [ #  # ]:          0 :             if (pObject != NULL)
    1103                 :            :                 pObject->FireAccessibleEvent(
    1104                 :            :                     AccessibleEventId::STATE_CHANGED,
    1105                 :            :                     Any(AccessibleStateType::FOCUSED),
    1106 [ #  # ][ #  # ]:          0 :                     Any());
    1107                 :            :         }
    1108         [ #  # ]:          0 :         if (nNewFocusedIndex >= 0)
    1109                 :            :         {
    1110                 :          0 :             AccessibleSlideSorterObject* pObject = GetAccessibleChild(nNewFocusedIndex);
    1111         [ #  # ]:          0 :             if (pObject != NULL)
    1112                 :            :                 pObject->FireAccessibleEvent(
    1113                 :            :                     AccessibleEventId::STATE_CHANGED,
    1114                 :            :                     Any(),
    1115         [ #  # ]:          0 :                     Any(AccessibleStateType::FOCUSED));
    1116                 :            :         }
    1117                 :          0 :         mnFocusedIndex = nNewFocusedIndex;
    1118                 :            :     }
    1119                 :          0 :     return 1;
    1120                 :            : }
    1121                 :            : 
    1122                 :            : 
    1123                 :            : 
    1124                 :            : 
    1125                 :          0 : IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, UpdateChildrenCallback)
    1126                 :            : {
    1127                 :          0 :     mnUpdateChildrenUserEventId = 0;
    1128                 :          0 :     UpdateChildren();
    1129                 :            : 
    1130                 :          0 :     return 1;
    1131                 :            : }
    1132                 :            : 
    1133                 :            : 
    1134                 :            : 
    1135                 :            : 
    1136                 :          0 : IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, VisibilityChangeListener)
    1137                 :            : {
    1138                 :          0 :     UpdateChildren();
    1139                 :          0 :     return 1;
    1140                 :            : }
    1141                 :            : 
    1142                 :            : } // end of namespace ::accessibility
    1143                 :            : 
    1144                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10