LCOV - code coverage report
Current view: top level - sw/source/core/access - accdoc.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 72 199 36.2 %
Date: 2012-08-25 Functions: 16 37 43.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 49 362 13.5 %

           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                 :            : #include <vcl/window.hxx>
      30                 :            : #include <rootfrm.hxx>
      31                 :            : 
      32                 :            : 
      33                 :            : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      34                 :            : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      35                 :            : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
      36                 :            : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      37                 :            : #include <unotools/accessiblestatesethelper.hxx>
      38                 :            : #include <sfx2/viewsh.hxx>
      39                 :            : #include <osl/mutex.hxx>
      40                 :            : #include <vcl/svapp.hxx>
      41                 :            : #include <comphelper/servicehelper.hxx>
      42                 :            : #include <viewsh.hxx>
      43                 :            : #include <doc.hxx>
      44                 :            : #include <accmap.hxx>
      45                 :            : #include <accdoc.hxx>
      46                 :            : #include "access.hrc"
      47                 :            : #include <pagefrm.hxx>
      48                 :            : 
      49                 :            : const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextDocumentView";
      50                 :            : const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleDocumentView";
      51                 :            : 
      52                 :            : 
      53                 :            : using namespace ::com::sun::star;
      54                 :            : using namespace ::com::sun::star::accessibility;
      55                 :            : using ::rtl::OUString;
      56                 :            : 
      57                 :            : using lang::IndexOutOfBoundsException;
      58                 :            : 
      59                 :            : 
      60                 :            : 
      61                 :            : //
      62                 :            : // SwAccessibleDocumentBase: base class for SwAccessibleDocument and
      63                 :            : // SwAccessiblePreview
      64                 :            : //
      65                 :            : 
      66                 :         24 : SwAccessibleDocumentBase::SwAccessibleDocumentBase ( SwAccessibleMap *_pMap ) :
      67                 :            :     SwAccessibleContext( _pMap, AccessibleRole::DOCUMENT,
      68                 :         24 :                          _pMap->GetShell()->GetLayout() ),//swmod 071107//swmod 071225
      69                 :            :     mxParent( _pMap->GetShell()->GetWin()->GetAccessibleParentWindow()->GetAccessible() ),
      70 [ +  - ][ +  - ]:         24 :     mpChildWin( 0 )
      71                 :            : {
      72                 :         24 : }
      73                 :            : 
      74                 :         24 : SwAccessibleDocumentBase::~SwAccessibleDocumentBase()
      75                 :            : {
      76         [ -  + ]:         24 : }
      77                 :            : 
      78                 :         38 : void SwAccessibleDocumentBase::SetVisArea()
      79                 :            : {
      80         [ +  - ]:         38 :     SolarMutexGuard aGuard;
      81                 :            : 
      82                 :         38 :     SwRect aOldVisArea( GetVisArea() );
      83         [ +  - ]:         38 :     const SwRect& rNewVisArea = GetMap()->GetVisArea();
      84         [ +  - ]:         38 :     if( aOldVisArea != rNewVisArea )
      85                 :            :     {
      86         [ +  - ]:         38 :         SwAccessibleFrame::SetVisArea( GetMap()->GetVisArea() );
      87                 :            :         // #i58139# - showing state of document view needs also be updated.
      88                 :            :         // Thus, call method <Scrolled(..)> instead of <ChildrenScrolled(..)>
      89                 :            : //        ChildrenScrolled( GetFrm(), aOldVisArea );
      90         [ +  - ]:         38 :         Scrolled( aOldVisArea );
      91         [ +  - ]:         38 :     }
      92                 :         38 : }
      93                 :            : 
      94                 :          0 : void SwAccessibleDocumentBase::AddChild( Window *pWin, sal_Bool bFireEvent )
      95                 :            : {
      96         [ #  # ]:          0 :     SolarMutexGuard aGuard;
      97                 :            : 
      98                 :            :     OSL_ENSURE( !mpChildWin, "only one child window is supported" );
      99         [ #  # ]:          0 :     if( !mpChildWin )
     100                 :            :     {
     101                 :          0 :         mpChildWin = pWin;
     102                 :            : 
     103         [ #  # ]:          0 :         if( bFireEvent )
     104                 :            :         {
     105         [ #  # ]:          0 :             AccessibleEventObject aEvent;
     106                 :          0 :             aEvent.EventId = AccessibleEventId::CHILD;
     107 [ #  # ][ #  # ]:          0 :             aEvent.NewValue <<= mpChildWin->GetAccessible();
     108 [ #  # ][ #  # ]:          0 :             FireAccessibleEvent( aEvent );
     109                 :            :         }
     110         [ #  # ]:          0 :     }
     111                 :          0 : }
     112                 :            : 
     113                 :          0 : void SwAccessibleDocumentBase::RemoveChild( Window *pWin )
     114                 :            : {
     115         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     116                 :            : 
     117                 :            :     OSL_ENSURE( !mpChildWin || pWin == mpChildWin, "invalid child window to remove" );
     118 [ #  # ][ #  # ]:          0 :     if( mpChildWin && pWin == mpChildWin )
     119                 :            :     {
     120         [ #  # ]:          0 :         AccessibleEventObject aEvent;
     121                 :          0 :         aEvent.EventId = AccessibleEventId::CHILD;
     122 [ #  # ][ #  # ]:          0 :         aEvent.OldValue <<= mpChildWin->GetAccessible();
     123         [ #  # ]:          0 :         FireAccessibleEvent( aEvent );
     124                 :            : 
     125         [ #  # ]:          0 :         mpChildWin = 0;
     126         [ #  # ]:          0 :     }
     127                 :          0 : }
     128                 :            : 
     129                 :         68 : sal_Int32 SAL_CALL SwAccessibleDocumentBase::getAccessibleChildCount( void )
     130                 :            :         throw (uno::RuntimeException)
     131                 :            : {
     132         [ +  - ]:         68 :     SolarMutexGuard aGuard;
     133                 :            : 
     134                 :            :     // CHECK_FOR_DEFUNC is called by parent
     135                 :            : 
     136         [ +  - ]:         68 :     sal_Int32 nChildren = SwAccessibleContext::getAccessibleChildCount();
     137 [ +  - ][ -  + ]:         68 :     if( !IsDisposing() && mpChildWin )
                 [ -  + ]
     138                 :          0 :         nChildren++;
     139                 :            : 
     140         [ +  - ]:         68 :     return nChildren;
     141                 :            : }
     142                 :            : 
     143                 :            : uno::Reference< XAccessible> SAL_CALL
     144                 :         44 :     SwAccessibleDocumentBase::getAccessibleChild( sal_Int32 nIndex )
     145                 :            :         throw (uno::RuntimeException,
     146                 :            :                 lang::IndexOutOfBoundsException)
     147                 :            : {
     148         [ +  - ]:         44 :     SolarMutexGuard aGuard;
     149                 :            : 
     150         [ -  + ]:         44 :     if( mpChildWin  )
     151                 :            :     {
     152 [ #  # ][ #  # ]:          0 :         CHECK_FOR_DEFUNC( XAccessibleContext )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     153 [ #  # ][ #  # ]:          0 :         if ( nIndex == GetChildCount( *(GetMap()) ) )
     154                 :            :         {
     155         [ #  # ]:          0 :             return mpChildWin->GetAccessible();
     156                 :            :         }
     157                 :            :     }
     158                 :            : 
     159 [ +  - ][ +  - ]:         44 :     return SwAccessibleContext::getAccessibleChild( nIndex );
     160                 :            : }
     161                 :            : 
     162                 :            : 
     163                 :         28 : uno::Reference< XAccessible> SAL_CALL SwAccessibleDocumentBase::getAccessibleParent (void)
     164                 :            :         throw (uno::RuntimeException)
     165                 :            : {
     166                 :         28 :     return mxParent;
     167                 :            : }
     168                 :            : 
     169                 :          0 : sal_Int32 SAL_CALL SwAccessibleDocumentBase::getAccessibleIndexInParent (void)
     170                 :            :         throw (uno::RuntimeException)
     171                 :            : {
     172         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     173                 :            : 
     174 [ #  # ][ #  # ]:          0 :     uno::Reference < XAccessibleContext > xAcc( mxParent->getAccessibleContext() );
     175         [ #  # ]:          0 :     uno::Reference < XAccessible > xThis( this );
     176 [ #  # ][ #  # ]:          0 :     sal_Int32 nCount = xAcc->getAccessibleChildCount();
     177                 :            : 
     178         [ #  # ]:          0 :     for( sal_Int32 i=0; i < nCount; i++ )
     179                 :            :     {
     180 [ #  # ][ #  # ]:          0 :         if( xAcc->getAccessibleChild( i ) == xThis )
         [ #  # ][ #  # ]
     181                 :          0 :             return i;
     182                 :            :     }
     183         [ #  # ]:          0 :     return -1L;
     184                 :            : }
     185                 :            : 
     186                 :         28 : OUString SAL_CALL SwAccessibleDocumentBase::getAccessibleDescription (void)
     187                 :            :     throw (uno::RuntimeException)
     188                 :            : {
     189                 :         28 :     return GetResource( STR_ACCESS_DOC_DESC );
     190                 :            : }
     191                 :            : 
     192                 :          0 : awt::Rectangle SAL_CALL SwAccessibleDocumentBase::getBounds()
     193                 :            :         throw (uno::RuntimeException)
     194                 :            : {
     195         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     196                 :            : 
     197         [ #  # ]:          0 :     Window *pWin = GetWindow();
     198                 :            : 
     199 [ #  # ][ #  # ]:          0 :     CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
         [ #  # ][ #  # ]
                 [ #  # ]
     200                 :            : 
     201 [ #  # ][ #  # ]:          0 :     Rectangle aPixBounds( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ) );
     202                 :          0 :     awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
     203 [ #  # ][ #  # ]:          0 :                          aPixBounds.GetWidth(), aPixBounds.GetHeight() );
     204                 :            : 
     205         [ #  # ]:          0 :     return aBox;
     206                 :            : }
     207                 :            : 
     208                 :            : 
     209                 :          0 : awt::Point SAL_CALL SwAccessibleDocumentBase::getLocation()
     210                 :            :         throw (uno::RuntimeException)
     211                 :            : {
     212         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     213                 :            : 
     214         [ #  # ]:          0 :     Window *pWin = GetWindow();
     215                 :            : 
     216 [ #  # ][ #  # ]:          0 :     CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
         [ #  # ][ #  # ]
                 [ #  # ]
     217                 :            : 
     218 [ #  # ][ #  # ]:          0 :     Point aPixPos( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ).TopLeft() );
     219                 :          0 :     awt::Point aLoc( aPixPos.X(), aPixPos.Y() );
     220                 :            : 
     221         [ #  # ]:          0 :     return aLoc;
     222                 :            : }
     223                 :            : 
     224                 :            : 
     225                 :          4 : ::com::sun::star::awt::Point SAL_CALL SwAccessibleDocumentBase::getLocationOnScreen()
     226                 :            :         throw (uno::RuntimeException)
     227                 :            : {
     228         [ +  - ]:          4 :     SolarMutexGuard aGuard;
     229                 :            : 
     230         [ +  - ]:          4 :     Window *pWin = GetWindow();
     231                 :            : 
     232 [ -  + ][ #  # ]:          4 :     CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
         [ #  # ][ #  # ]
                 [ #  # ]
     233                 :            : 
     234         [ +  - ]:          4 :     Point aPixPos( pWin->GetWindowExtentsRelative( 0 ).TopLeft() );
     235                 :          4 :     awt::Point aLoc( aPixPos.X(), aPixPos.Y() );
     236                 :            : 
     237         [ +  - ]:          4 :     return aLoc;
     238                 :            : }
     239                 :            : 
     240                 :            : 
     241                 :          0 : ::com::sun::star::awt::Size SAL_CALL SwAccessibleDocumentBase::getSize()
     242                 :            :         throw (uno::RuntimeException)
     243                 :            : {
     244         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     245                 :            : 
     246         [ #  # ]:          0 :     Window *pWin = GetWindow();
     247                 :            : 
     248 [ #  # ][ #  # ]:          0 :     CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
         [ #  # ][ #  # ]
                 [ #  # ]
     249                 :            : 
     250 [ #  # ][ #  # ]:          0 :     Size aPixSize( pWin->GetWindowExtentsRelative( 0 ).GetSize() );
     251                 :          0 :     awt::Size aSize( aPixSize.Width(), aPixSize.Height() );
     252                 :            : 
     253         [ #  # ]:          0 :     return aSize;
     254                 :            : }
     255                 :            : 
     256                 :          0 : sal_Bool SAL_CALL SwAccessibleDocumentBase::containsPoint(
     257                 :            :             const awt::Point& aPoint )
     258                 :            :         throw (uno::RuntimeException)
     259                 :            : {
     260         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     261                 :            : 
     262         [ #  # ]:          0 :     Window *pWin = GetWindow();
     263                 :            : 
     264 [ #  # ][ #  # ]:          0 :     CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
         [ #  # ][ #  # ]
                 [ #  # ]
     265                 :            : 
     266         [ #  # ]:          0 :     Rectangle aPixBounds( pWin->GetWindowExtentsRelative( 0 ) );
     267         [ #  # ]:          0 :     aPixBounds.Move(-aPixBounds.Left(), -aPixBounds.Top());
     268                 :            : 
     269                 :          0 :     Point aPixPoint( aPoint.X, aPoint.Y );
     270 [ #  # ][ #  # ]:          0 :     return aPixBounds.IsInside( aPixPoint );
     271                 :            : }
     272                 :            : 
     273                 :          0 : uno::Reference< XAccessible > SAL_CALL SwAccessibleDocumentBase::getAccessibleAtPoint(
     274                 :            :                 const awt::Point& aPoint )
     275                 :            :         throw (uno::RuntimeException)
     276                 :            : {
     277         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     278                 :            : 
     279         [ #  # ]:          0 :     if( mpChildWin  )
     280                 :            :     {
     281 [ #  # ][ #  # ]:          0 :         CHECK_FOR_DEFUNC( XAccessibleComponent )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     282                 :            : 
     283         [ #  # ]:          0 :         Window *pWin = GetWindow();
     284 [ #  # ][ #  # ]:          0 :         CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
         [ #  # ][ #  # ]
                 [ #  # ]
     285                 :            : 
     286                 :          0 :         Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to window
     287 [ #  # ][ #  # ]:          0 :         if( mpChildWin->GetWindowExtentsRelative( pWin ).IsInside( aPixPoint ) )
                 [ #  # ]
     288         [ #  # ]:          0 :             return mpChildWin->GetAccessible();
     289                 :            :     }
     290                 :            : 
     291 [ #  # ][ #  # ]:          0 :     return SwAccessibleContext::getAccessibleAtPoint( aPoint );
     292                 :            : }
     293                 :            : 
     294                 :            : //
     295                 :            : // SwAccessibeDocument
     296                 :            : //
     297                 :            : 
     298                 :         24 : void SwAccessibleDocument::GetStates(
     299                 :            :         ::utl::AccessibleStateSetHelper& rStateSet )
     300                 :            : {
     301                 :         24 :     SwAccessibleContext::GetStates( rStateSet );
     302                 :            : 
     303                 :            :     // MULTISELECTABLE
     304                 :         24 :     rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
     305                 :         24 : }
     306                 :            : 
     307                 :            : 
     308                 :         24 : SwAccessibleDocument::SwAccessibleDocument ( SwAccessibleMap* pInitMap ) :
     309                 :            :     SwAccessibleDocumentBase( pInitMap ),
     310         [ +  - ]:         24 :     maSelectionHelper( *this )
     311                 :            : {
     312         [ +  - ]:         24 :     SetName( GetResource( STR_ACCESS_DOC_NAME ) );
     313                 :         24 :     Window *pWin = pInitMap->GetShell()->GetWin();
     314         [ +  - ]:         24 :     if( pWin )
     315                 :            :     {
     316 [ +  - ][ +  - ]:         24 :         pWin->AddChildEventListener( LINK( this, SwAccessibleDocument, WindowChildEventListener ));
     317         [ +  - ]:         24 :         sal_uInt16 nCount =   pWin->GetChildCount();
     318         [ -  + ]:         24 :         for( sal_uInt16 i=0; i < nCount; i++ )
     319                 :            :         {
     320         [ #  # ]:          0 :             Window* pChildWin = pWin->GetChild( i );
     321 [ #  # ][ #  # ]:          0 :             if( pChildWin &&
                 [ #  # ]
     322         [ #  # ]:          0 :                 AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
     323         [ #  # ]:          0 :                 AddChild( pChildWin, sal_False );
     324                 :            :         }
     325                 :            :     }
     326                 :         24 : }
     327                 :            : 
     328         [ +  - ]:         24 : SwAccessibleDocument::~SwAccessibleDocument()
     329                 :            : {
     330         [ -  + ]:         24 :     Window *pWin = GetMap() ? GetMap()->GetShell()->GetWin() : 0;
     331         [ -  + ]:         24 :     if( pWin )
     332 [ #  # ][ #  # ]:          0 :         pWin->RemoveChildEventListener( LINK( this, SwAccessibleDocument, WindowChildEventListener ));
     333         [ -  + ]:         48 : }
     334                 :            : 
     335                 :         24 : void SwAccessibleDocument::Dispose( sal_Bool bRecursive )
     336                 :            : {
     337                 :            :     OSL_ENSURE( GetFrm() && GetMap(), "already disposed" );
     338                 :            : 
     339         [ +  - ]:         24 :     Window *pWin = GetMap() ? GetMap()->GetShell()->GetWin() : 0;
     340         [ +  - ]:         24 :     if( pWin )
     341         [ +  - ]:         24 :         pWin->RemoveChildEventListener( LINK( this, SwAccessibleDocument, WindowChildEventListener ));
     342                 :         24 :     SwAccessibleContext::Dispose( bRecursive );
     343                 :         24 : }
     344                 :            : 
     345                 :         86 : IMPL_LINK( SwAccessibleDocument, WindowChildEventListener, VclSimpleEvent*, pEvent )
     346                 :            : {
     347                 :            :     OSL_ENSURE( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
     348 [ +  - ][ +  - ]:         86 :     if ( pEvent && pEvent->ISA( VclWindowEvent ) )
                 [ +  - ]
     349                 :            :     {
     350                 :         86 :         VclWindowEvent *pVclEvent = static_cast< VclWindowEvent * >( pEvent );
     351                 :            :         OSL_ENSURE( pVclEvent->GetWindow(), "Window???" );
     352   [ -  +  -  + ]:         86 :         switch ( pVclEvent->GetId() )
     353                 :            :         {
     354                 :            :         case VCLEVENT_WINDOW_SHOW:  // send create on show for direct accessible children
     355                 :            :             {
     356                 :          0 :                 Window* pChildWin = static_cast< Window* >( pVclEvent->GetData() );
     357 [ #  # ][ #  # ]:          0 :                 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
                 [ #  # ]
     358                 :            :                 {
     359                 :          0 :                     AddChild( pChildWin );
     360                 :            :                 }
     361                 :            :             }
     362                 :          0 :             break;
     363                 :            :         case VCLEVENT_WINDOW_HIDE:  // send destroy on hide for direct accessible children
     364                 :            :             {
     365                 :         24 :                 Window* pChildWin = static_cast< Window* >( pVclEvent->GetData() );
     366 [ -  + ][ -  + ]:         24 :                 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
                 [ +  - ]
     367                 :            :                 {
     368                 :          0 :                     RemoveChild( pChildWin );
     369                 :            :                 }
     370                 :            :             }
     371                 :         24 :             break;
     372                 :            :         case VCLEVENT_OBJECT_DYING:  // send destroy on hide for direct accessible children
     373                 :            :             {
     374                 :          0 :                 Window* pChildWin = pVclEvent->GetWindow();
     375 [ #  # ][ #  # ]:          0 :                 if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
                 [ #  # ]
     376                 :            :                 {
     377                 :          0 :                     RemoveChild( pChildWin );
     378                 :            :                 }
     379                 :            :             }
     380                 :         86 :             break;
     381                 :            :         }
     382                 :            :     }
     383                 :         86 :     return 0;
     384                 :            : }
     385                 :            : 
     386                 :            : 
     387                 :          0 : OUString SAL_CALL SwAccessibleDocument::getImplementationName()
     388                 :            :         throw( uno::RuntimeException )
     389                 :            : {
     390                 :          0 :     return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName));
     391                 :            : }
     392                 :            : 
     393                 :          0 : sal_Bool SAL_CALL SwAccessibleDocument::supportsService(
     394                 :            :         const ::rtl::OUString& sTestServiceName)
     395                 :            :     throw (uno::RuntimeException)
     396                 :            : {
     397                 :            :     return sTestServiceName.equalsAsciiL( sServiceName,
     398                 :          0 :                                           sizeof(sServiceName)-1 ) ||
     399                 :            :            sTestServiceName.equalsAsciiL( sAccessibleServiceName,
     400 [ #  # ][ #  # ]:          0 :                                              sizeof(sAccessibleServiceName)-1 );
     401                 :            : }
     402                 :            : 
     403                 :          0 : uno::Sequence< OUString > SAL_CALL SwAccessibleDocument::getSupportedServiceNames()
     404                 :            :         throw( uno::RuntimeException )
     405                 :            : {
     406                 :          0 :     uno::Sequence< OUString > aRet(2);
     407         [ #  # ]:          0 :     OUString* pArray = aRet.getArray();
     408         [ #  # ]:          0 :     pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) );
     409         [ #  # ]:          0 :     pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
     410                 :          0 :     return aRet;
     411                 :            : }
     412                 :            : 
     413                 :            : //=====  XInterface  ======================================================
     414                 :            : 
     415                 :        356 : uno::Any SwAccessibleDocument::queryInterface(
     416                 :            :     const uno::Type& rType )
     417                 :            :     throw ( uno::RuntimeException )
     418                 :            : {
     419                 :        356 :     uno::Any aRet;
     420 [ -  + ][ +  - ]:        356 :     if ( rType == ::getCppuType( static_cast< uno::Reference< XAccessibleSelection > * >( 0 ) ) )
     421                 :            :     {
     422         [ #  # ]:          0 :         uno::Reference<XAccessibleSelection> aSelect = this;
     423         [ #  # ]:          0 :         aRet <<= aSelect;
     424                 :            :     }
     425                 :            :     else
     426         [ +  - ]:        356 :         aRet = SwAccessibleContext::queryInterface( rType );
     427                 :        356 :     return aRet;
     428                 :            : }
     429                 :            : 
     430                 :            : //====== XTypeProvider ====================================================
     431                 :          0 : uno::Sequence< uno::Type > SAL_CALL SwAccessibleDocument::getTypes()
     432                 :            :     throw(uno::RuntimeException)
     433                 :            : {
     434                 :          0 :     uno::Sequence< uno::Type > aTypes( SwAccessibleDocumentBase::getTypes() );
     435                 :            : 
     436                 :          0 :     sal_Int32 nIndex = aTypes.getLength();
     437         [ #  # ]:          0 :     aTypes.realloc( nIndex + 1 );
     438                 :            : 
     439         [ #  # ]:          0 :     uno::Type* pTypes = aTypes.getArray();
     440         [ #  # ]:          0 :     pTypes[nIndex] = ::getCppuType( static_cast< uno::Reference< XAccessibleSelection > * >( 0 ) );
     441                 :            : 
     442                 :          0 :     return aTypes;
     443                 :            : }
     444                 :            : 
     445                 :            : namespace
     446                 :            : {
     447                 :            :     class theSwAccessibleDocumentImplementationId : public rtl::Static< UnoTunnelIdInit, theSwAccessibleDocumentImplementationId > {};
     448                 :            : }
     449                 :            : 
     450                 :          0 : uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleDocument::getImplementationId()
     451                 :            :         throw(uno::RuntimeException)
     452                 :            : {
     453                 :          0 :     return theSwAccessibleDocumentImplementationId::get().getSeq();
     454                 :            : }
     455                 :            : 
     456                 :            : //=====  XAccessibleSelection  ============================================
     457                 :            : 
     458                 :          0 : void SwAccessibleDocument::selectAccessibleChild(
     459                 :            :     sal_Int32 nChildIndex )
     460                 :            :     throw ( lang::IndexOutOfBoundsException,
     461                 :            :             uno::RuntimeException )
     462                 :            : {
     463                 :          0 :     maSelectionHelper.selectAccessibleChild(nChildIndex);
     464                 :          0 : }
     465                 :            : 
     466                 :          0 : sal_Bool SwAccessibleDocument::isAccessibleChildSelected(
     467                 :            :     sal_Int32 nChildIndex )
     468                 :            :     throw ( lang::IndexOutOfBoundsException,
     469                 :            :             uno::RuntimeException )
     470                 :            : {
     471                 :          0 :     return maSelectionHelper.isAccessibleChildSelected(nChildIndex);
     472                 :            : }
     473                 :            : 
     474                 :          0 : void SwAccessibleDocument::clearAccessibleSelection(  )
     475                 :            :     throw ( uno::RuntimeException )
     476                 :            : {
     477                 :          0 :     maSelectionHelper.clearAccessibleSelection();
     478                 :          0 : }
     479                 :            : 
     480                 :          0 : void SwAccessibleDocument::selectAllAccessibleChildren(  )
     481                 :            :     throw ( uno::RuntimeException )
     482                 :            : {
     483                 :          0 :     maSelectionHelper.selectAllAccessibleChildren();
     484                 :          0 : }
     485                 :            : 
     486                 :          0 : sal_Int32 SwAccessibleDocument::getSelectedAccessibleChildCount(  )
     487                 :            :     throw ( uno::RuntimeException )
     488                 :            : {
     489                 :          0 :     return maSelectionHelper.getSelectedAccessibleChildCount();
     490                 :            : }
     491                 :            : 
     492                 :          0 : uno::Reference<XAccessible> SwAccessibleDocument::getSelectedAccessibleChild(
     493                 :            :     sal_Int32 nSelectedChildIndex )
     494                 :            :     throw ( lang::IndexOutOfBoundsException,
     495                 :            :             uno::RuntimeException)
     496                 :            : {
     497                 :          0 :     return maSelectionHelper.getSelectedAccessibleChild(nSelectedChildIndex);
     498                 :            : }
     499                 :            : 
     500                 :            : // index has to be treated as global child index.
     501                 :          0 : void SwAccessibleDocument::deselectAccessibleChild(
     502                 :            :     sal_Int32 nChildIndex )
     503                 :            :     throw ( lang::IndexOutOfBoundsException,
     504                 :            :             uno::RuntimeException )
     505                 :            : {
     506                 :          0 :     maSelectionHelper.deselectAccessibleChild( nChildIndex );
     507                 :          0 : }
     508                 :            : 
     509                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10