LCOV - code coverage report
Current view: top level - sw/source/core/access - acctable.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 123 736 16.7 %
Date: 2012-08-25 Functions: 14 91 15.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 116 1485 7.8 %

           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 <osl/mutex.hxx>
      30                 :            : #include <rtl/ustrbuf.hxx>
      31                 :            : 
      32                 :            : #include <list>
      33                 :            : #include <set>
      34                 :            : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      35                 :            : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      36                 :            : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      37                 :            : #include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
      38                 :            : #include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
      39                 :            : #include <unotools/accessiblestatesethelper.hxx>
      40                 :            : #include <vcl/svapp.hxx>
      41                 :            : #include <frmfmt.hxx>
      42                 :            : #include <tabfrm.hxx>
      43                 :            : #include <rowfrm.hxx>
      44                 :            : #include <cellfrm.hxx>
      45                 :            : #include <swtable.hxx>
      46                 :            : #include <crsrsh.hxx>
      47                 :            : #include <viscrs.hxx>
      48                 :            : #include <hints.hxx>
      49                 :            : #include <fesh.hxx>
      50                 :            : #include <accfrmobjslist.hxx>
      51                 :            : #include <accmap.hxx>
      52                 :            : #include <access.hrc>
      53                 :            : #include <acctable.hxx>
      54                 :            : 
      55                 :            : #include <com/sun/star/accessibility/XAccessibleText.hpp>
      56                 :            : #include <comphelper/servicehelper.hxx>
      57                 :            : 
      58                 :            : using namespace ::com::sun::star;
      59                 :            : using namespace ::com::sun::star::accessibility;
      60                 :            : using ::rtl::OUString;
      61                 :            : using ::rtl::OUStringBuffer;
      62                 :            : using namespace ::sw::access;
      63                 :            : 
      64                 :            : const sal_Char sServiceName[] = "com.sun.star.table.AccessibleTableView";
      65                 :            : const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleTableView";
      66                 :            : 
      67                 :            : typedef ::std::less < sal_Int32 > Int32Less_Impl;
      68                 :            : typedef ::std::set < sal_Int32, Int32Less_Impl > Int32Set_Impl;
      69                 :            : 
      70                 :            : typedef ::std::pair < sal_Int32, sal_Int32 > Int32Pair_Impl;
      71                 :            : typedef ::std::list < Int32Pair_Impl > Int32PairList_Impl;
      72                 :            : 
      73                 :          0 : class SwAccTableSelHander_Impl
      74                 :            : {
      75                 :            : public:
      76                 :            :     virtual void Unselect( sal_Int32 nRowOrCol, sal_Int32 nExt ) = 0;
      77                 :            : 
      78                 :            : protected:
      79                 :          0 :     ~SwAccTableSelHander_Impl() {}
      80                 :            : };
      81                 :            : 
      82                 :            : 
      83                 :            : //------------------------------------------------------------------------------
      84                 :            : 
      85                 :          0 : class SwAccessibleTableData_Impl
      86                 :            : {
      87                 :            :     SwAccessibleMap& mrAccMap;
      88                 :            :     Int32Set_Impl   maRows;
      89                 :            :     Int32Set_Impl   maColumns;
      90                 :            :     Int32PairList_Impl maExtents;   // cell extends for event processing only
      91                 :            :     Point   maTabFrmPos;
      92                 :            :     const SwTabFrm *mpTabFrm;
      93                 :            :     sal_Bool mbIsInPagePreview;
      94                 :            :     bool mbOnlyTableColumnHeader;
      95                 :            : 
      96                 :            :     void CollectData( const SwFrm *pFrm );
      97                 :            :     void CollectExtents( const SwFrm *pFrm );
      98                 :            : 
      99                 :            :     sal_Bool FindCell( const Point& rPos, const SwFrm *pFrm ,
     100                 :            :                            sal_Bool bExact, const SwFrm *& rFrm ) const;
     101                 :            : 
     102                 :            :     void GetSelection( const Point& rTabPos, const SwRect& rArea,
     103                 :            :                        const SwSelBoxes& rSelBoxes, const SwFrm *pFrm,
     104                 :            :                        SwAccTableSelHander_Impl& rSelHdl,
     105                 :            :                        sal_Bool bColumns ) const;
     106                 :            : 
     107                 :            :     // #i77106#
     108                 :          0 :     inline bool IncludeRow( const SwFrm& rFrm ) const
     109                 :            :     {
     110                 :          0 :         return !mbOnlyTableColumnHeader ||
     111 [ #  # ][ #  # ]:          0 :                mpTabFrm->IsInHeadline( rFrm );
     112                 :            :     }
     113                 :            : public:
     114                 :            :     // #i77106# - add third optional parameter <bOnlyTableColumnHeader>, default value <false>
     115                 :            :     SwAccessibleTableData_Impl( SwAccessibleMap& rAccMap,
     116                 :            :                                 const SwTabFrm *pTabFrm,
     117                 :            :                                 sal_Bool bIsInPagePreview,
     118                 :            :                                 bool bOnlyTableColumnHeader = false );
     119                 :            : 
     120                 :          0 :     const Int32Set_Impl& GetRows() const { return maRows; }
     121                 :          0 :     const Int32Set_Impl& GetColumns() const { return maColumns; }
     122                 :            : 
     123                 :            :     inline Int32Set_Impl::const_iterator GetRowIter( sal_Int32 nRow ) const;
     124                 :            :     inline Int32Set_Impl::const_iterator GetColumnIter( sal_Int32 nCol ) const;
     125                 :            : 
     126                 :            :     const SwFrm *GetCell( sal_Int32 nRow, sal_Int32 nColumn, sal_Bool bExact,
     127                 :            :                           SwAccessibleTable *pThis ) const
     128                 :            :         throw(lang::IndexOutOfBoundsException );
     129                 :            :     const SwFrm *GetCellAtPos( sal_Int32 nLeft, sal_Int32 nTop,
     130                 :            :                                          sal_Bool bExact ) const;
     131                 :            :     inline sal_Int32 GetRowCount() const;
     132                 :            :     inline sal_Int32 GetColumnCount() const;
     133                 :            :     sal_Bool CompareExtents( const SwAccessibleTableData_Impl& r ) const;
     134                 :            : 
     135                 :            :     void GetSelection( sal_Int32 nStart, sal_Int32 nEnd,
     136                 :            :                        const SwSelBoxes& rSelBoxes,
     137                 :            :                           SwAccTableSelHander_Impl& rSelHdl,
     138                 :            :                        sal_Bool bColumns ) const;
     139                 :            : 
     140                 :            :     void CheckRowAndCol( sal_Int32 nRow, sal_Int32 nCol,
     141                 :            :                          SwAccessibleTable *pThis ) const
     142                 :            :         throw(lang::IndexOutOfBoundsException );
     143                 :            : 
     144                 :            :     void GetRowColumnAndExtent( const SwRect& rBox,
     145                 :            :                                   sal_Int32& rRow, sal_Int32& rColumn,
     146                 :            :                                   sal_Int32& rRowExtent,
     147                 :            :                                   sal_Int32& rColumnExtent ) const;
     148                 :            : 
     149                 :            :     const Point& GetTablePos() const { return maTabFrmPos; }
     150                 :          0 :     void SetTablePos( const Point& rPos ) { maTabFrmPos = rPos; }
     151                 :            : };
     152                 :            : 
     153                 :          0 : void SwAccessibleTableData_Impl::CollectData( const SwFrm *pFrm )
     154                 :            : {
     155                 :          0 :     const SwAccessibleChildSList aList( *pFrm, mrAccMap );
     156         [ #  # ]:          0 :     SwAccessibleChildSList::const_iterator aIter( aList.begin() );
     157         [ #  # ]:          0 :     SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
     158 [ #  # ][ #  # ]:          0 :     while( aIter != aEndIter )
     159                 :            :     {
     160                 :          0 :         const SwAccessibleChild& rLower = *aIter;
     161         [ #  # ]:          0 :         const SwFrm *pLower = rLower.GetSwFrm();
     162         [ #  # ]:          0 :         if( pLower )
     163                 :            :         {
     164         [ #  # ]:          0 :             if( pLower->IsRowFrm() )
     165                 :            :             {
     166                 :            :                 // #i77106#
     167 [ #  # ][ #  # ]:          0 :                 if ( IncludeRow( *pLower ) )
     168                 :            :                 {
     169         [ #  # ]:          0 :                     maRows.insert( pLower->Frm().Top() - maTabFrmPos.Y() );
     170         [ #  # ]:          0 :                     CollectData( pLower );
     171                 :            :                 }
     172                 :            :             }
     173 [ #  # ][ #  # ]:          0 :             else if( pLower->IsCellFrm() &&
                 [ #  # ]
     174         [ #  # ]:          0 :                      rLower.IsAccessible( mbIsInPagePreview ) )
     175                 :            :             {
     176         [ #  # ]:          0 :                 maColumns.insert( pLower->Frm().Left() - maTabFrmPos.X() );
     177                 :            :             }
     178                 :            :             else
     179                 :            :             {
     180         [ #  # ]:          0 :                 CollectData( pLower );
     181                 :            :             }
     182                 :            :         }
     183         [ #  # ]:          0 :         ++aIter;
     184                 :            :     }
     185                 :          0 : }
     186                 :            : 
     187                 :          0 : void SwAccessibleTableData_Impl::CollectExtents( const SwFrm *pFrm )
     188                 :            : {
     189                 :          0 :     const SwAccessibleChildSList aList( *pFrm, mrAccMap );
     190         [ #  # ]:          0 :     SwAccessibleChildSList::const_iterator aIter( aList.begin() );
     191         [ #  # ]:          0 :     SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
     192 [ #  # ][ #  # ]:          0 :     while( aIter != aEndIter )
     193                 :            :     {
     194                 :          0 :         const SwAccessibleChild& rLower = *aIter;
     195         [ #  # ]:          0 :         const SwFrm *pLower = rLower.GetSwFrm();
     196         [ #  # ]:          0 :         if( pLower )
     197                 :            :         {
     198 [ #  # ][ #  # ]:          0 :             if( pLower->IsCellFrm() &&
                 [ #  # ]
     199         [ #  # ]:          0 :                 rLower.IsAccessible( mbIsInPagePreview ) )
     200                 :            :             {
     201                 :            :                 sal_Int32 nRow, nCol;
     202                 :          0 :                 Int32Pair_Impl aCellExtents;
     203                 :          0 :                 GetRowColumnAndExtent( pLower->Frm(), nRow, nCol,
     204                 :            :                                        aCellExtents.first,
     205         [ #  # ]:          0 :                                        aCellExtents.second );
     206                 :            : 
     207         [ #  # ]:          0 :                 maExtents.push_back( aCellExtents );
     208                 :            :             }
     209                 :            :             else
     210                 :            :             {
     211                 :            :                 // #i77106#
     212 [ #  # ][ #  # ]:          0 :                 if ( !pLower->IsRowFrm() ||
                 [ #  # ]
     213         [ #  # ]:          0 :                      IncludeRow( *pLower ) )
     214                 :            :                 {
     215         [ #  # ]:          0 :                     CollectExtents( pLower );
     216                 :            :                 }
     217                 :            :             }
     218                 :            :         }
     219         [ #  # ]:          0 :         ++aIter;
     220                 :            :     }
     221                 :          0 : }
     222                 :            : 
     223                 :          0 : sal_Bool SwAccessibleTableData_Impl::FindCell(
     224                 :            :         const Point& rPos, const SwFrm *pFrm, sal_Bool bExact,
     225                 :            :         const SwFrm *& rRet ) const
     226                 :            : {
     227                 :          0 :     sal_Bool bFound = sal_False;
     228                 :            : 
     229                 :          0 :     const SwAccessibleChildSList aList( *pFrm, mrAccMap );
     230         [ #  # ]:          0 :     SwAccessibleChildSList::const_iterator aIter( aList.begin() );
     231         [ #  # ]:          0 :     SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
     232 [ #  # ][ #  # ]:          0 :     while( !bFound && aIter != aEndIter )
         [ #  # ][ #  # ]
     233                 :            :     {
     234                 :          0 :         const SwAccessibleChild& rLower = *aIter;
     235         [ #  # ]:          0 :         const SwFrm *pLower = rLower.GetSwFrm();
     236                 :            :         OSL_ENSURE( pLower, "child should be a frame" );
     237         [ #  # ]:          0 :         if( pLower )
     238                 :            :         {
     239 [ #  # ][ #  # ]:          0 :             if( rLower.IsAccessible( mbIsInPagePreview ) )
     240                 :            :             {
     241                 :            :                 OSL_ENSURE( pLower->IsCellFrm(), "lower is not a cell frame" );
     242                 :          0 :                 const SwRect& rFrm = pLower->Frm();
     243 [ #  # ][ #  # ]:          0 :                 if( rFrm.Right() >= rPos.X() && rFrm.Bottom() >= rPos.Y() )
                 [ #  # ]
     244                 :            :                 {
     245                 :            :                     // We have found the cell
     246                 :            :                     OSL_ENSURE( rFrm.Left() <= rPos.X() && rFrm.Top() <= rPos.Y(),
     247                 :            :                             "find frame moved to far!" );
     248                 :          0 :                     bFound = sal_True;
     249   [ #  #  #  #  :          0 :                     if( !bExact ||
           #  # ][ #  # ]
     250                 :          0 :                         (rFrm.Top() == rPos.Y() && rFrm.Left() == rPos.Y() ) )
     251                 :            :                     {
     252                 :          0 :                         rRet = pLower;
     253                 :            :                     }
     254                 :            :                 }
     255                 :            :             }
     256                 :            :             else
     257                 :            :             {
     258                 :            :                 // #i77106#
     259 [ #  # ][ #  # ]:          0 :                 if ( !pLower->IsRowFrm() ||
                 [ #  # ]
     260         [ #  # ]:          0 :                      IncludeRow( *pLower ) )
     261                 :            :                 {
     262         [ #  # ]:          0 :                     bFound = FindCell( rPos, pLower, bExact, rRet );
     263                 :            :                 }
     264                 :            :             }
     265                 :            :         }
     266         [ #  # ]:          0 :         ++aIter;
     267                 :            :     }
     268                 :            : 
     269                 :          0 :     return bFound;
     270                 :            : }
     271                 :            : 
     272                 :          0 : void SwAccessibleTableData_Impl::GetSelection(
     273                 :            :             const Point& rTabPos,
     274                 :            :             const SwRect& rArea,
     275                 :            :             const SwSelBoxes& rSelBoxes,
     276                 :            :             const SwFrm *pFrm,
     277                 :            :             SwAccTableSelHander_Impl& rSelHdl,
     278                 :            :             sal_Bool bColumns ) const
     279                 :            : {
     280                 :          0 :     const SwAccessibleChildSList aList( *pFrm, mrAccMap );
     281         [ #  # ]:          0 :     SwAccessibleChildSList::const_iterator aIter( aList.begin() );
     282         [ #  # ]:          0 :     SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
     283 [ #  # ][ #  # ]:          0 :     while( aIter != aEndIter )
     284                 :            :     {
     285                 :          0 :         const SwAccessibleChild& rLower = *aIter;
     286         [ #  # ]:          0 :         const SwFrm *pLower = rLower.GetSwFrm();
     287                 :            :         OSL_ENSURE( pLower, "child should be a frame" );
     288         [ #  # ]:          0 :         const SwRect& rBox = rLower.GetBox( mrAccMap );
     289 [ #  # ][ #  # ]:          0 :         if( pLower && rBox.IsOver( rArea ) )
         [ #  # ][ #  # ]
     290                 :            :         {
     291 [ #  # ][ #  # ]:          0 :             if( rLower.IsAccessible( mbIsInPagePreview ) )
     292                 :            :             {
     293                 :            :                 OSL_ENSURE( pLower->IsCellFrm(), "lower is not a cell frame" );
     294                 :            :                 const SwCellFrm *pCFrm =
     295                 :          0 :                         static_cast < const SwCellFrm * >( pLower );
     296                 :            :                 SwTableBox *pBox =
     297                 :          0 :                     const_cast< SwTableBox *>( pCFrm->GetTabBox() );
     298 [ #  # ][ #  # ]:          0 :                 if( rSelBoxes.find( pBox ) == rSelBoxes.end() )
                 [ #  # ]
     299                 :            :                 {
     300                 :            :                     const Int32Set_Impl rRowsOrCols =
     301 [ #  # ][ #  # ]:          0 :                         bColumns ? maColumns : maRows;
     302                 :            : 
     303                 :          0 :                     sal_Int32 nPos = bColumns ? (rBox.Left() - rTabPos.X())
     304         [ #  # ]:          0 :                                               : (rBox.Top() - rTabPos.Y());
     305                 :            :                     Int32Set_Impl::const_iterator aSttRowOrCol(
     306         [ #  # ]:          0 :                         rRowsOrCols.lower_bound( nPos ) );
     307                 :            :                     sal_Int32 nRowOrCol =
     308                 :            :                         static_cast< sal_Int32 >( ::std::distance(
     309         [ #  # ]:          0 :                             rRowsOrCols.begin(), aSttRowOrCol ) );
     310                 :            : 
     311                 :          0 :                     nPos = bColumns ? (rBox.Right() - rTabPos.X())
     312         [ #  # ]:          0 :                                     : (rBox.Bottom() - rTabPos.Y());
     313                 :            :                     Int32Set_Impl::const_iterator aEndRowOrCol(
     314         [ #  # ]:          0 :                         rRowsOrCols.upper_bound( nPos ) );
     315                 :            :                     sal_Int32 nExt =
     316                 :            :                         static_cast< sal_Int32 >( ::std::distance(
     317         [ #  # ]:          0 :                             aSttRowOrCol, aEndRowOrCol ) );
     318                 :            : 
     319         [ #  # ]:          0 :                     rSelHdl.Unselect( nRowOrCol, nExt );
     320                 :            :                 }
     321                 :            :             }
     322                 :            :             else
     323                 :            :             {
     324                 :            :                 // #i77106#
     325 [ #  # ][ #  # ]:          0 :                 if ( !pLower->IsRowFrm() ||
                 [ #  # ]
     326         [ #  # ]:          0 :                      IncludeRow( *pLower ) )
     327                 :            :                 {
     328                 :            :                     GetSelection( rTabPos, rArea, rSelBoxes, pLower, rSelHdl,
     329         [ #  # ]:          0 :                                   bColumns );
     330                 :            :                 }
     331                 :            :             }
     332                 :            :         }
     333         [ #  # ]:          0 :         ++aIter;
     334                 :            :     }
     335                 :          0 : }
     336                 :            : 
     337                 :          0 : const SwFrm *SwAccessibleTableData_Impl::GetCell(
     338                 :            :         sal_Int32 nRow, sal_Int32 nColumn, sal_Bool,
     339                 :            :         SwAccessibleTable *pThis ) const
     340                 :            :     throw(lang::IndexOutOfBoundsException )
     341                 :            : {
     342         [ #  # ]:          0 :     CheckRowAndCol( nRow, nColumn, pThis );
     343                 :            : 
     344         [ #  # ]:          0 :     Int32Set_Impl::const_iterator aSttCol( GetColumnIter( nColumn ) );
     345         [ #  # ]:          0 :     Int32Set_Impl::const_iterator aSttRow( GetRowIter( nRow ) );
     346 [ #  # ][ #  # ]:          0 :     const SwFrm *pCellFrm = GetCellAtPos( *aSttCol, *aSttRow, sal_False );
                 [ #  # ]
     347                 :            : 
     348                 :          0 :     return pCellFrm;
     349                 :            : }
     350                 :            : 
     351                 :          0 : void SwAccessibleTableData_Impl::GetSelection(
     352                 :            :                        sal_Int32 nStart, sal_Int32 nEnd,
     353                 :            :                        const SwSelBoxes& rSelBoxes,
     354                 :            :                           SwAccTableSelHander_Impl& rSelHdl,
     355                 :            :                        sal_Bool bColumns ) const
     356                 :            : {
     357                 :          0 :     SwRect aArea( mpTabFrm->Frm() );
     358                 :          0 :     Point aPos( aArea.Pos() );
     359                 :            : 
     360         [ #  # ]:          0 :     const Int32Set_Impl& rRowsOrColumns = bColumns ? maColumns : maRows;
     361         [ #  # ]:          0 :     if( nStart > 0 )
     362                 :            :     {
     363                 :          0 :         Int32Set_Impl::const_iterator aStt( rRowsOrColumns.begin() );
     364                 :            :         ::std::advance( aStt,
     365         [ #  # ]:          0 :             static_cast< Int32Set_Impl::difference_type >( nStart ) );
     366         [ #  # ]:          0 :         if( bColumns )
     367         [ #  # ]:          0 :             aArea.Left( *aStt + aPos.X() );
     368                 :            :         else
     369         [ #  # ]:          0 :             aArea.Top( *aStt + aPos.Y() );
     370                 :            :     }
     371         [ #  # ]:          0 :     if( nEnd < static_cast< sal_Int32 >( rRowsOrColumns.size() ) )
     372                 :            :     {
     373                 :          0 :         Int32Set_Impl::const_iterator aEnd( rRowsOrColumns.begin() );
     374                 :            :         ::std::advance( aEnd,
     375         [ #  # ]:          0 :             static_cast< Int32Set_Impl::difference_type >( nEnd ) );
     376         [ #  # ]:          0 :         if( bColumns )
     377         [ #  # ]:          0 :             aArea.Right( *aEnd + aPos.X() - 1 );
     378                 :            :         else
     379         [ #  # ]:          0 :             aArea.Bottom( *aEnd + aPos.Y() - 1 );
     380                 :            :     }
     381                 :            : 
     382         [ #  # ]:          0 :     GetSelection( aPos, aArea, rSelBoxes, mpTabFrm, rSelHdl, bColumns );
     383                 :          0 : }
     384                 :            : 
     385                 :          0 : const SwFrm *SwAccessibleTableData_Impl::GetCellAtPos(
     386                 :            :         sal_Int32 nLeft, sal_Int32 nTop, sal_Bool bExact ) const
     387                 :            : {
     388                 :          0 :     Point aPos( mpTabFrm->Frm().Pos() );
     389                 :          0 :     aPos.Move( nLeft, nTop );
     390                 :          0 :     const SwFrm *pRet = 0;
     391         [ #  # ]:          0 :     FindCell( aPos, mpTabFrm, bExact, pRet );
     392                 :            : 
     393                 :          0 :     return pRet;
     394                 :            : }
     395                 :            : 
     396                 :          0 : inline sal_Int32 SwAccessibleTableData_Impl::GetRowCount() const
     397                 :            : {
     398                 :          0 :     return static_cast< sal_Int32 >( maRows.size() );
     399                 :            : }
     400                 :            : 
     401                 :          0 : inline sal_Int32 SwAccessibleTableData_Impl::GetColumnCount() const
     402                 :            : {
     403                 :          0 :     return static_cast< sal_Int32 >( maColumns.size() );
     404                 :            : }
     405                 :            : 
     406                 :          0 : sal_Bool SwAccessibleTableData_Impl::CompareExtents(
     407                 :            :                                 const SwAccessibleTableData_Impl& rCmp ) const
     408                 :            : {
     409         [ #  # ]:          0 :     if( maExtents.size() != rCmp.maExtents.size() )
     410                 :          0 :         return sal_False;
     411                 :            : 
     412                 :          0 :     Int32PairList_Impl::const_iterator aIter( maExtents.begin() );
     413                 :          0 :     Int32PairList_Impl::const_iterator aEndIter( maExtents.end() );
     414                 :          0 :     Int32PairList_Impl::const_iterator aCmpIter( rCmp.maExtents.begin() );
     415 [ #  # ][ #  # ]:          0 :     while( aIter != aEndIter )
     416                 :            :     {
     417 [ #  # ][ #  # ]:          0 :         if( *aIter != *aCmpIter )
         [ #  # ][ #  # ]
     418                 :          0 :             return sal_False;
     419                 :            : 
     420         [ #  # ]:          0 :         ++aIter;
     421         [ #  # ]:          0 :         ++aCmpIter;
     422                 :            :     }
     423                 :            : 
     424                 :          0 :     return sal_True;
     425                 :            : }
     426                 :            : 
     427                 :          0 : SwAccessibleTableData_Impl::SwAccessibleTableData_Impl( SwAccessibleMap& rAccMap,
     428                 :            :                                                         const SwTabFrm *pTabFrm,
     429                 :            :                                                         sal_Bool bIsInPagePreview,
     430                 :            :                                                         bool bOnlyTableColumnHeader )
     431                 :            :     : mrAccMap( rAccMap )
     432                 :          0 :     , maTabFrmPos( pTabFrm->Frm().Pos() )
     433                 :            :     , mpTabFrm( pTabFrm )
     434                 :            :     , mbIsInPagePreview( bIsInPagePreview )
     435 [ #  # ][ #  # ]:          0 :     , mbOnlyTableColumnHeader( bOnlyTableColumnHeader )
     436                 :            : {
     437         [ #  # ]:          0 :     CollectData( mpTabFrm );
     438         [ #  # ]:          0 :     CollectExtents( mpTabFrm );
     439                 :          0 : }
     440                 :            : 
     441                 :          0 : inline Int32Set_Impl::const_iterator SwAccessibleTableData_Impl::GetRowIter(
     442                 :            :         sal_Int32 nRow ) const
     443                 :            : {
     444                 :          0 :     Int32Set_Impl::const_iterator aCol( GetRows().begin() );
     445         [ #  # ]:          0 :     if( nRow > 0 )
     446                 :            :     {
     447                 :            :         ::std::advance( aCol,
     448                 :          0 :                     static_cast< Int32Set_Impl::difference_type >( nRow ) );
     449                 :            :     }
     450                 :          0 :     return aCol;
     451                 :            : }
     452                 :            : 
     453                 :          0 : inline Int32Set_Impl::const_iterator SwAccessibleTableData_Impl::GetColumnIter(
     454                 :            :         sal_Int32 nColumn ) const
     455                 :            : {
     456                 :          0 :     Int32Set_Impl::const_iterator aCol = GetColumns().begin();
     457         [ #  # ]:          0 :     if( nColumn > 0 )
     458                 :            :     {
     459                 :            :         ::std::advance( aCol,
     460                 :          0 :                     static_cast< Int32Set_Impl::difference_type >( nColumn ) );
     461                 :            :     }
     462                 :          0 :     return aCol;
     463                 :            : }
     464                 :            : 
     465                 :          0 : void SwAccessibleTableData_Impl::CheckRowAndCol(
     466                 :            :         sal_Int32 nRow, sal_Int32 nCol, SwAccessibleTable *pThis ) const
     467                 :            :     throw(lang::IndexOutOfBoundsException )
     468                 :            : {
     469 [ #  # ][ #  # ]:          0 :     if( ( nRow < 0 || nRow >= static_cast< sal_Int32 >( maRows.size() ) ) ||
           [ #  #  #  # ]
                 [ #  # ]
     470                 :          0 :         ( nCol < 0 || nCol >= static_cast< sal_Int32 >( maColumns.size() ) ) )
     471                 :            :     {
     472 [ #  # ][ #  # ]:          0 :         uno::Reference < XAccessibleTable > xThis( pThis );
     473                 :            :         lang::IndexOutOfBoundsException aExcept(
     474                 :            :                OUString( RTL_CONSTASCII_USTRINGPARAM(
     475                 :            :                        "row or column index out of range") ),
     476 [ #  # ][ #  # ]:          0 :                xThis );
     477         [ #  # ]:          0 :         throw aExcept;
     478                 :            :     }
     479                 :          0 : }
     480                 :            : 
     481                 :          0 : void SwAccessibleTableData_Impl::GetRowColumnAndExtent(
     482                 :            :         const SwRect& rBox,
     483                 :            :         sal_Int32& rRow, sal_Int32& rColumn,
     484                 :            :         sal_Int32& rRowExtent, sal_Int32& rColumnExtent ) const
     485                 :            : {
     486                 :            :     Int32Set_Impl::const_iterator aStt(
     487         [ #  # ]:          0 :                 maRows.lower_bound( rBox.Top() - maTabFrmPos.Y() ) );
     488                 :            :     Int32Set_Impl::const_iterator aEnd(
     489         [ #  # ]:          0 :                 maRows.upper_bound( rBox.Bottom() - maTabFrmPos.Y() ) );
     490                 :            :     rRow =
     491         [ #  # ]:          0 :          static_cast< sal_Int32 >( ::std::distance( maRows.begin(), aStt ) );
     492                 :            :     rRowExtent =
     493         [ #  # ]:          0 :          static_cast< sal_Int32 >( ::std::distance( aStt, aEnd ) );
     494                 :            : 
     495         [ #  # ]:          0 :     aStt = maColumns.lower_bound( rBox.Left() - maTabFrmPos.X() );
     496         [ #  # ]:          0 :     aEnd = maColumns.upper_bound( rBox.Right() - maTabFrmPos.X() );
     497                 :            :     rColumn =
     498         [ #  # ]:          0 :          static_cast< sal_Int32 >( ::std::distance( maColumns.begin(), aStt ) );
     499                 :            :     rColumnExtent =
     500         [ #  # ]:          0 :          static_cast< sal_Int32 >( ::std::distance( aStt, aEnd ) );
     501                 :          0 : }
     502                 :            : 
     503                 :            : //------------------------------------------------------------------------------
     504                 :            : 
     505                 :            : class SwAccSingleTableSelHander_Impl : public SwAccTableSelHander_Impl
     506                 :            : {
     507                 :            :     sal_Bool bSelected;
     508                 :            : 
     509                 :            : public:
     510                 :            : 
     511                 :            :     inline SwAccSingleTableSelHander_Impl();
     512                 :            : 
     513         [ #  # ]:          0 :     virtual ~SwAccSingleTableSelHander_Impl() {}
     514                 :            : 
     515                 :          0 :     inline sal_Bool IsSelected() const { return bSelected; }
     516                 :            : 
     517                 :            :     virtual void Unselect( sal_Int32, sal_Int32 );
     518                 :            : };
     519                 :            : 
     520                 :          0 : inline SwAccSingleTableSelHander_Impl::SwAccSingleTableSelHander_Impl() :
     521                 :          0 :     bSelected( sal_True )
     522                 :            : {
     523                 :          0 : }
     524                 :            : 
     525                 :          0 : void SwAccSingleTableSelHander_Impl::Unselect( sal_Int32, sal_Int32 )
     526                 :            : {
     527                 :          0 :     bSelected = sal_False;
     528                 :          0 : }
     529                 :            : 
     530                 :            : //------------------------------------------------------------------------------
     531                 :            : 
     532                 :            : class SwAccAllTableSelHander_Impl : public SwAccTableSelHander_Impl
     533                 :            : 
     534                 :            : {
     535                 :            :     ::std::vector< sal_Bool > aSelected;
     536                 :            :     sal_Int32 nCount;
     537                 :            : 
     538                 :            : public:
     539                 :            : 
     540                 :            :     inline SwAccAllTableSelHander_Impl( sal_Int32 nSize );
     541                 :            : 
     542                 :            :     uno::Sequence < sal_Int32 > GetSelSequence();
     543                 :            : 
     544                 :            :     virtual void Unselect( sal_Int32 nRowOrCol, sal_Int32 nExt );
     545                 :            :     virtual ~SwAccAllTableSelHander_Impl();
     546                 :            : };
     547                 :            : 
     548                 :          0 : SwAccAllTableSelHander_Impl::~SwAccAllTableSelHander_Impl()
     549                 :            : {
     550         [ #  # ]:          0 : }
     551                 :            : 
     552                 :          0 : inline SwAccAllTableSelHander_Impl::SwAccAllTableSelHander_Impl( sal_Int32 nSize ) :
     553                 :            :     aSelected( nSize, sal_True ),
     554         [ #  # ]:          0 :     nCount( nSize )
     555                 :            : {
     556                 :          0 : }
     557                 :            : 
     558                 :          0 : uno::Sequence < sal_Int32 > SwAccAllTableSelHander_Impl::GetSelSequence()
     559                 :            : {
     560                 :            :     OSL_ENSURE( nCount >= 0, "underflow" );
     561                 :          0 :     uno::Sequence < sal_Int32 > aRet( nCount );
     562         [ #  # ]:          0 :     sal_Int32 *pRet = aRet.getArray();
     563                 :          0 :     sal_Int32 nPos = 0;
     564                 :          0 :     size_t nSize = aSelected.size();
     565 [ #  # ][ #  # ]:          0 :     for( size_t i=0; i < nSize && nPos < nCount; i++ )
                 [ #  # ]
     566                 :            :     {
     567 [ #  # ][ #  # ]:          0 :         if( aSelected[i] )
     568                 :            :         {
     569                 :          0 :             *pRet++ = i;
     570                 :          0 :             nPos++;
     571                 :            :         }
     572                 :            :     }
     573                 :            : 
     574                 :            :     OSL_ENSURE( nPos == nCount, "count is wrong" );
     575                 :            : 
     576                 :          0 :     return aRet;
     577                 :            : }
     578                 :            : 
     579                 :          0 : void SwAccAllTableSelHander_Impl::Unselect( sal_Int32 nRowOrCol,
     580                 :            :                                             sal_Int32 nExt )
     581                 :            : {
     582                 :            :     OSL_ENSURE( static_cast< size_t >( nRowOrCol ) < aSelected.size(),
     583                 :            :              "index to large" );
     584                 :            :     OSL_ENSURE( static_cast< size_t >( nRowOrCol+nExt ) <= aSelected.size(),
     585                 :            :              "extent to large" );
     586         [ #  # ]:          0 :     while( nExt )
     587                 :            :     {
     588         [ #  # ]:          0 :         if( aSelected[static_cast< size_t >( nRowOrCol )] )
     589                 :            :         {
     590                 :          0 :             aSelected[static_cast< size_t >( nRowOrCol )] = sal_False;
     591                 :          0 :             nCount--;
     592                 :            :         }
     593                 :          0 :         nExt--;
     594                 :          0 :         nRowOrCol++;
     595                 :            :     }
     596                 :          0 : }
     597                 :            : 
     598                 :            : //------------------------------------------------------------------------------
     599                 :            : 
     600                 :          8 : const SwSelBoxes *SwAccessibleTable::GetSelBoxes() const
     601                 :            : {
     602                 :          8 :     const SwSelBoxes *pSelBoxes = 0;
     603                 :          8 :     const SwCrsrShell *pCSh = GetCrsrShell();
     604 [ +  + ][ +  + ]:          8 :     if( (pCSh != NULL) && pCSh->IsTableMode() )
                 [ +  - ]
     605                 :            :     {
     606                 :          4 :         pSelBoxes = &pCSh->GetTableCrsr()->GetBoxes();
     607                 :            :     }
     608                 :            : 
     609                 :          8 :     return pSelBoxes;
     610                 :            : }
     611                 :            : 
     612                 :          0 : void SwAccessibleTable::FireTableChangeEvent(
     613                 :            :         const SwAccessibleTableData_Impl& rTableData )
     614                 :            : {
     615                 :          0 :     AccessibleTableModelChange aModelChange;
     616                 :          0 :     aModelChange.Type = AccessibleTableModelChangeType::UPDATE;
     617                 :          0 :     aModelChange.FirstRow = 0;
     618                 :          0 :     aModelChange.LastRow = rTableData.GetRowCount() - 1;
     619                 :          0 :     aModelChange.FirstColumn = 0;
     620                 :          0 :     aModelChange.LastColumn = rTableData.GetColumnCount() - 1;
     621                 :            : 
     622         [ #  # ]:          0 :     AccessibleEventObject aEvent;
     623                 :          0 :     aEvent.EventId = AccessibleEventId::TABLE_MODEL_CHANGED;
     624         [ #  # ]:          0 :     aEvent.NewValue <<= aModelChange;
     625                 :            : 
     626 [ #  # ][ #  # ]:          0 :     FireAccessibleEvent( aEvent );
     627                 :          0 : }
     628                 :            : 
     629                 :            : 
     630                 :         12 : const SwTableBox* SwAccessibleTable::GetTableBox( sal_Int32 nChildIndex ) const
     631                 :            : {
     632                 :            :     OSL_ENSURE( nChildIndex >= 0, "Illegal child index." );
     633                 :            :     OSL_ENSURE( nChildIndex < const_cast<SwAccessibleTable*>(this)->getAccessibleChildCount(), "Illegal child index." ); // #i77106#
     634                 :            : 
     635                 :         12 :     const SwTableBox* pBox = NULL;
     636                 :            : 
     637                 :            :     // get table box for 'our' table cell
     638         [ +  - ]:         12 :     SwAccessibleChild aCell( GetChild( *(const_cast<SwAccessibleMap*>(GetMap())), nChildIndex ) );
     639 [ +  - ][ +  - ]:         12 :     if( aCell.GetSwFrm()  )
     640                 :            :     {
     641         [ +  - ]:         12 :         const SwFrm* pChildFrm = aCell.GetSwFrm();
     642 [ +  - ][ +  - ]:         12 :         if( (pChildFrm != NULL) && pChildFrm->IsCellFrm() )
                 [ +  - ]
     643                 :            :         {
     644                 :            :             const SwCellFrm* pCellFrm =
     645                 :         12 :                 static_cast<const SwCellFrm*>( pChildFrm );
     646                 :         12 :             pBox = pCellFrm->GetTabBox();
     647                 :            :         }
     648                 :            :     }
     649                 :            : 
     650                 :            :     OSL_ENSURE( pBox != NULL, "We need the table box." );
     651                 :         12 :     return pBox;
     652                 :            : }
     653                 :            : 
     654                 :          8 : sal_Bool SwAccessibleTable::IsChildSelected( sal_Int32 nChildIndex ) const
     655                 :            : {
     656                 :          8 :     sal_Bool bRet = sal_False;
     657                 :          8 :     const SwSelBoxes* pSelBoxes = GetSelBoxes();
     658         [ +  + ]:          8 :     if( pSelBoxes )
     659                 :            :     {
     660                 :          4 :         const SwTableBox* pBox = GetTableBox( nChildIndex );
     661                 :            :         OSL_ENSURE( pBox != NULL, "We need the table box." );
     662 [ +  - ][ +  - ]:          4 :         bRet = pSelBoxes->find( const_cast<SwTableBox*>( pBox ) ) != pSelBoxes->end();
     663                 :            :     }
     664                 :            : 
     665                 :          8 :     return bRet;
     666                 :            : }
     667                 :            : 
     668                 :          0 : sal_Int32 SwAccessibleTable::GetIndexOfSelectedChild(
     669                 :            :                 sal_Int32 nSelectedChildIndex ) const
     670                 :            : {
     671                 :            :     // iterate over all children to n-th isAccessibleChildSelected()
     672                 :          0 :     sal_Int32 nChildren = const_cast<SwAccessibleTable*>(this)->getAccessibleChildCount(); // #i77106#
     673         [ #  # ]:          0 :     if( nSelectedChildIndex >= nChildren )
     674                 :          0 :         return -1L;
     675                 :            : 
     676                 :          0 :     sal_Int32 n = 0;
     677         [ #  # ]:          0 :     while( n < nChildren )
     678                 :            :     {
     679         [ #  # ]:          0 :         if( IsChildSelected( n ) )
     680                 :            :         {
     681         [ #  # ]:          0 :             if( 0 == nSelectedChildIndex )
     682                 :          0 :                 break;
     683                 :            :             else
     684                 :          0 :                 --nSelectedChildIndex;
     685                 :            :         }
     686                 :          0 :         ++n;
     687                 :            :     }
     688                 :            : 
     689         [ #  # ]:          0 :     return n < nChildren ? n : -1L;
     690                 :            : }
     691                 :            : 
     692                 :          4 : void SwAccessibleTable::GetStates(
     693                 :            :         ::utl::AccessibleStateSetHelper& rStateSet )
     694                 :            : {
     695                 :          4 :     SwAccessibleContext::GetStates( rStateSet );
     696                 :            : 
     697                 :            :     // MULTISELECTABLE
     698                 :          4 :     SwCrsrShell* pCrsrShell = GetCrsrShell();
     699         [ +  - ]:          4 :     if( pCrsrShell  )
     700                 :          4 :         rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
     701                 :          4 : }
     702                 :            : 
     703                 :          4 : SwAccessibleTable::SwAccessibleTable(
     704                 :            :         SwAccessibleMap* pInitMap,
     705                 :            :         const SwTabFrm* pTabFrm  ) :
     706                 :            :     SwAccessibleContext( pInitMap, AccessibleRole::TABLE, pTabFrm ),
     707                 :          4 :     mpTableData( 0 )
     708                 :            : {
     709         [ +  - ]:          4 :     SolarMutexGuard aGuard;
     710                 :            : 
     711         [ +  - ]:          4 :     const SwFrmFmt *pFrmFmt = pTabFrm->GetFmt();
     712         [ +  - ]:          4 :     const_cast< SwFrmFmt * >( pFrmFmt )->Add( this );
     713                 :          4 :     const String& rName = pFrmFmt->GetName();
     714                 :            : 
     715                 :          4 :     OUStringBuffer aBuffer( rName.Len() + 4 );
     716 [ +  - ][ +  - ]:          4 :     aBuffer.append( OUString(rName) );
     717         [ +  - ]:          4 :     aBuffer.append( static_cast<sal_Unicode>( '-' ) );
     718 [ +  - ][ +  - ]:          4 :     aBuffer.append( static_cast<sal_Int32>( pTabFrm->GetPhyPageNum() ) );
     719                 :            : 
     720         [ +  - ]:          4 :     SetName( aBuffer.makeStringAndClear() );
     721                 :            : 
     722                 :          4 :     OUString sArg1( static_cast< const SwTabFrm * >( GetFrm() )
     723 [ +  - ][ +  - ]:          4 :                                         ->GetFmt()->GetName() );
     724 [ +  - ][ +  - ]:          4 :     OUString sArg2( GetFormattedPageNumber() );
                 [ +  - ]
     725                 :            : 
     726 [ +  - ][ +  - ]:          4 :     sDesc = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );
     727                 :          4 : }
     728                 :            : 
     729         [ +  - ]:          4 : SwAccessibleTable::~SwAccessibleTable()
     730                 :            : {
     731         [ +  - ]:          4 :     SolarMutexGuard aGuard;
     732                 :            : 
     733 [ -  + ][ +  - ]:          4 :     delete mpTableData;
     734         [ -  + ]:          8 : }
     735                 :            : 
     736                 :          0 : void SwAccessibleTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
     737                 :            : {
     738 [ #  # ][ #  # ]:          0 :     sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
     739                 :          0 :     const SwTabFrm *pTabFrm = static_cast< const SwTabFrm * >( GetFrm() );
     740      [ #  #  # ]:          0 :     switch( nWhich )
     741                 :            :     {
     742                 :            :     case RES_NAME_CHANGED:
     743         [ #  # ]:          0 :         if( pTabFrm )
     744                 :            :         {
     745         [ #  # ]:          0 :             const SwFrmFmt *pFrmFmt = pTabFrm->GetFmt();
     746                 :            :             OSL_ENSURE( pFrmFmt == GetRegisteredIn(), "invalid frame" );
     747                 :            : 
     748                 :          0 :             OUString sOldName( GetName() );
     749                 :            : 
     750                 :          0 :             const String& rNewTabName = pFrmFmt->GetName();
     751                 :          0 :             OUStringBuffer aBuffer( rNewTabName.Len() + 4 );
     752 [ #  # ][ #  # ]:          0 :             aBuffer.append( OUString(rNewTabName) );
     753         [ #  # ]:          0 :             aBuffer.append( static_cast<sal_Unicode>( '-' ) );
     754 [ #  # ][ #  # ]:          0 :             aBuffer.append( static_cast<sal_Int32>( pTabFrm->GetPhyPageNum() ) );
     755                 :            : 
     756         [ #  # ]:          0 :             SetName( aBuffer.makeStringAndClear() );
     757         [ #  # ]:          0 :             if( sOldName != GetName() )
     758                 :            :             {
     759         [ #  # ]:          0 :                 AccessibleEventObject aEvent;
     760                 :          0 :                 aEvent.EventId = AccessibleEventId::NAME_CHANGED;
     761         [ #  # ]:          0 :                 aEvent.OldValue <<= sOldName;
     762         [ #  # ]:          0 :                 aEvent.NewValue <<= GetName();
     763 [ #  # ][ #  # ]:          0 :                 FireAccessibleEvent( aEvent );
     764                 :            :             }
     765                 :            : 
     766                 :          0 :             OUString sOldDesc( sDesc );
     767         [ #  # ]:          0 :             OUString sArg1( rNewTabName );
     768 [ #  # ][ #  # ]:          0 :             OUString sArg2( GetFormattedPageNumber() );
                 [ #  # ]
     769                 :            : 
     770         [ #  # ]:          0 :             sDesc = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );
     771         [ #  # ]:          0 :             if( sDesc != sOldDesc )
     772                 :            :             {
     773         [ #  # ]:          0 :                 AccessibleEventObject aEvent;
     774                 :          0 :                 aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
     775         [ #  # ]:          0 :                 aEvent.OldValue <<= sOldDesc;
     776         [ #  # ]:          0 :                 aEvent.NewValue <<= sDesc;
     777 [ #  # ][ #  # ]:          0 :                 FireAccessibleEvent( aEvent );
     778                 :          0 :             }
     779                 :            :         }
     780                 :          0 :         break;
     781                 :            : 
     782                 :            :     case RES_OBJECTDYING:
     783                 :            :         // mba: it seems that this class intentionally does not call code in base class SwClient
     784         [ #  # ]:          0 :         if( GetRegisteredIn() ==
     785                 :            :                 static_cast< SwModify *>( static_cast< const SwPtrMsgPoolItem * >( pOld )->pObject ) )
     786                 :          0 :             GetRegisteredInNonConst()->Remove( this );
     787                 :          0 :         break;
     788                 :            : 
     789                 :            :     default:
     790                 :            :         // mba: former call to base class method removed as it is meant to handle only RES_OBJECTDYING
     791                 :          0 :         break;
     792                 :            :     }
     793                 :          0 : }
     794                 :            : 
     795                 :        112 : uno::Any SwAccessibleTable::queryInterface( const uno::Type& rType )
     796                 :            :     throw (uno::RuntimeException)
     797                 :            : {
     798                 :        112 :     uno::Any aRet;
     799 [ -  + ][ +  - ]:        112 :     if ( rType == ::getCppuType( static_cast< uno::Reference< XAccessibleTable > * >( 0 ) ) )
     800                 :            :     {
     801         [ #  # ]:          0 :         uno::Reference<XAccessibleTable> xThis( this );
     802         [ #  # ]:          0 :            aRet <<= xThis;
     803                 :            :     }
     804 [ +  - ][ +  + ]:        112 :     else if ( rType == ::getCppuType( static_cast< uno::Reference< XAccessibleSelection > * >( 0 ) ) )
     805                 :            :     {
     806         [ +  - ]:          4 :         uno::Reference<XAccessibleSelection> xSelection( this );
     807         [ +  - ]:          4 :         aRet <<= xSelection;
     808                 :            :     }
     809                 :            :     else
     810                 :            :     {
     811         [ +  - ]:        108 :         aRet = SwAccessibleContext::queryInterface(rType);
     812                 :            :     }
     813                 :            : 
     814                 :        112 :     return aRet;
     815                 :            : }
     816                 :            : 
     817                 :            : //====== XTypeProvider ====================================================
     818                 :          0 : uno::Sequence< uno::Type > SAL_CALL SwAccessibleTable::getTypes()
     819                 :            :     throw(uno::RuntimeException)
     820                 :            : {
     821                 :          0 :     uno::Sequence< uno::Type > aTypes( SwAccessibleContext::getTypes() );
     822                 :            : 
     823                 :          0 :     sal_Int32 nIndex = aTypes.getLength();
     824         [ #  # ]:          0 :     aTypes.realloc( nIndex + 2 );
     825                 :            : 
     826         [ #  # ]:          0 :     uno::Type* pTypes = aTypes.getArray();
     827         [ #  # ]:          0 :     pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleSelection > * >( 0 ) );
     828         [ #  # ]:          0 :     pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleTable > * >( 0 ) );
     829                 :            : 
     830                 :          0 :     return aTypes;
     831                 :            : }
     832                 :            : 
     833                 :            : namespace
     834                 :            : {
     835                 :            :     class theSwAccessibleTableImplementationId : public rtl::Static< UnoTunnelIdInit, theSwAccessibleTableImplementationId > {};
     836                 :            : }
     837                 :            : 
     838                 :          0 : uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleTable::getImplementationId()
     839                 :            :         throw(uno::RuntimeException)
     840                 :            : {
     841                 :          0 :     return theSwAccessibleTableImplementationId::get().getSeq();
     842                 :            : }
     843                 :            : 
     844                 :            : // #i77106#
     845                 :          0 : SwAccessibleTableData_Impl* SwAccessibleTable::CreateNewTableData()
     846                 :            : {
     847                 :          0 :     const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() );
     848         [ #  # ]:          0 :     return new SwAccessibleTableData_Impl( *GetMap(), pTabFrm, IsInPagePreview() );
     849                 :            : }
     850                 :            : 
     851                 :          0 : void SwAccessibleTable::UpdateTableData()
     852                 :            : {
     853                 :            :     // #i77106# - usage of new method <CreateNewTableData()>
     854         [ #  # ]:          0 :     delete mpTableData;
     855                 :          0 :     mpTableData = CreateNewTableData();
     856                 :          0 : }
     857                 :            : 
     858                 :          0 : void SwAccessibleTable::ClearTableData()
     859                 :            : {
     860         [ #  # ]:          0 :     delete mpTableData;
     861                 :          0 :     mpTableData = 0;
     862                 :          0 : }
     863                 :            : 
     864                 :         12 : OUString SAL_CALL SwAccessibleTable::getAccessibleDescription (void)
     865                 :            :         throw (uno::RuntimeException)
     866                 :            : {
     867         [ +  - ]:         12 :     SolarMutexGuard aGuard;
     868                 :            : 
     869 [ +  - ][ -  + ]:         12 :     CHECK_FOR_DEFUNC( XAccessibleContext )
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     870                 :            : 
     871         [ +  - ]:         12 :     return sDesc;
     872                 :            : }
     873                 :            : 
     874                 :          0 : sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRowCount()
     875                 :            :     throw (uno::RuntimeException)
     876                 :            : {
     877         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     878                 :            : 
     879 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     880                 :            : 
     881 [ #  # ][ #  # ]:          0 :     return  GetTableData().GetRowCount();
     882                 :            : }
     883                 :            : 
     884                 :          0 : sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumnCount(  )
     885                 :            :     throw (uno::RuntimeException)
     886                 :            : {
     887         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     888                 :            : 
     889 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     890                 :            : 
     891 [ #  # ][ #  # ]:          0 :     return GetTableData().GetColumnCount();
     892                 :            : }
     893                 :            : 
     894                 :          0 : OUString SAL_CALL SwAccessibleTable::getAccessibleRowDescription(
     895                 :            :             sal_Int32 nRow )
     896                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     897                 :            : {
     898                 :            :     // #i87532# - determine table cell in <nRow>th row and
     899                 :            :     // in first column of row header table and return its text content.
     900                 :          0 :     OUString sRowDesc;
     901                 :            : 
     902 [ #  # ][ #  # ]:          0 :     GetTableData().CheckRowAndCol(nRow, 0, this);
     903                 :            : 
     904         [ #  # ]:          0 :     uno::Reference< XAccessibleTable > xTableRowHeader = getAccessibleRowHeaders();
     905         [ #  # ]:          0 :     if ( xTableRowHeader.is() )
     906                 :            :     {
     907                 :            :         uno::Reference< XAccessible > xRowHeaderCell =
     908 [ #  # ][ #  # ]:          0 :                         xTableRowHeader->getAccessibleCellAt( nRow, 0 );
     909                 :            :         OSL_ENSURE( xRowHeaderCell.is(),
     910                 :            :                 "<SwAccessibleTable::getAccessibleRowDescription(..)> - missing row header cell -> serious issue." );
     911                 :            :         uno::Reference< XAccessibleContext > xRowHeaderCellContext =
     912 [ #  # ][ #  # ]:          0 :                                     xRowHeaderCell->getAccessibleContext();
     913 [ #  # ][ #  # ]:          0 :         const sal_Int32 nCellChildCount( xRowHeaderCellContext->getAccessibleChildCount() );
     914         [ #  # ]:          0 :         for ( sal_Int32 nChildIndex = 0; nChildIndex < nCellChildCount; ++nChildIndex )
     915                 :            :         {
     916 [ #  # ][ #  # ]:          0 :             uno::Reference< XAccessible > xChild = xRowHeaderCellContext->getAccessibleChild( nChildIndex );
     917         [ #  # ]:          0 :             uno::Reference< XAccessibleText > xChildText( xChild, uno::UNO_QUERY );
     918         [ #  # ]:          0 :             if ( xChildText.is() )
     919                 :            :             {
     920 [ #  # ][ #  # ]:          0 :                 sRowDesc = sRowDesc + xChildText->getText();
     921                 :            :             }
     922                 :          0 :         }
     923                 :            :     }
     924                 :            : 
     925                 :          0 :     return sRowDesc;
     926                 :            : }
     927                 :            : 
     928                 :          0 : OUString SAL_CALL SwAccessibleTable::getAccessibleColumnDescription(
     929                 :            :             sal_Int32 nColumn )
     930                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     931                 :            : {
     932                 :            :     // #i87532# - determine table cell in first row and
     933                 :            :     // in <nColumn>th column of column header table and return its text content.
     934                 :          0 :     OUString sColumnDesc;
     935                 :            : 
     936 [ #  # ][ #  # ]:          0 :     GetTableData().CheckRowAndCol(0, nColumn, this);
     937                 :            : 
     938         [ #  # ]:          0 :     uno::Reference< XAccessibleTable > xTableColumnHeader = getAccessibleColumnHeaders();
     939         [ #  # ]:          0 :     if ( xTableColumnHeader.is() )
     940                 :            :     {
     941                 :            :         uno::Reference< XAccessible > xColumnHeaderCell =
     942 [ #  # ][ #  # ]:          0 :                         xTableColumnHeader->getAccessibleCellAt( 0, nColumn );
     943                 :            :         OSL_ENSURE( xColumnHeaderCell.is(),
     944                 :            :                 "<SwAccessibleTable::getAccessibleColumnDescription(..)> - missing column header cell -> serious issue." );
     945                 :            :         uno::Reference< XAccessibleContext > xColumnHeaderCellContext =
     946 [ #  # ][ #  # ]:          0 :                                     xColumnHeaderCell->getAccessibleContext();
     947 [ #  # ][ #  # ]:          0 :         const sal_Int32 nCellChildCount( xColumnHeaderCellContext->getAccessibleChildCount() );
     948         [ #  # ]:          0 :         for ( sal_Int32 nChildIndex = 0; nChildIndex < nCellChildCount; ++nChildIndex )
     949                 :            :         {
     950 [ #  # ][ #  # ]:          0 :             uno::Reference< XAccessible > xChild = xColumnHeaderCellContext->getAccessibleChild( nChildIndex );
     951         [ #  # ]:          0 :             uno::Reference< XAccessibleText > xChildText( xChild, uno::UNO_QUERY );
     952         [ #  # ]:          0 :             if ( xChildText.is() )
     953                 :            :             {
     954 [ #  # ][ #  # ]:          0 :                 sColumnDesc = sColumnDesc + xChildText->getText();
     955                 :            :             }
     956                 :          0 :         }
     957                 :            :     }
     958                 :            : 
     959                 :          0 :     return sColumnDesc;
     960                 :            : }
     961                 :            : 
     962                 :          0 : sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRowExtentAt(
     963                 :            :             sal_Int32 nRow, sal_Int32 nColumn )
     964                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     965                 :            : {
     966                 :          0 :     sal_Int32 nExtend = -1;
     967                 :            : 
     968         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     969                 :            : 
     970 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     971                 :            : 
     972 [ #  # ][ #  # ]:          0 :     GetTableData().CheckRowAndCol( nRow, nColumn, this );
     973                 :            : 
     974                 :            :     Int32Set_Impl::const_iterator aSttCol(
     975 [ #  # ][ #  # ]:          0 :                                     GetTableData().GetColumnIter( nColumn ) );
     976                 :            :     Int32Set_Impl::const_iterator aSttRow(
     977 [ #  # ][ #  # ]:          0 :                                     GetTableData().GetRowIter( nRow ) );
     978 [ #  # ][ #  # ]:          0 :     const SwFrm *pCellFrm = GetTableData().GetCellAtPos( *aSttCol, *aSttRow,
                 [ #  # ]
     979         [ #  # ]:          0 :                                                          sal_False );
     980         [ #  # ]:          0 :     if( pCellFrm )
     981                 :            :     {
     982                 :          0 :         sal_Int32 nBottom = pCellFrm->Frm().Bottom();
     983                 :          0 :         nBottom -= GetFrm()->Frm().Top();
     984                 :            :         Int32Set_Impl::const_iterator aEndRow(
     985 [ #  # ][ #  # ]:          0 :                 GetTableData().GetRows().upper_bound( nBottom ) );
     986                 :            :         nExtend =
     987         [ #  # ]:          0 :              static_cast< sal_Int32 >( ::std::distance( aSttRow, aEndRow ) );
     988                 :            :     }
     989                 :            : 
     990         [ #  # ]:          0 :     return nExtend;
     991                 :            : }
     992                 :            : 
     993                 :          0 : sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumnExtentAt(
     994                 :            :                sal_Int32 nRow, sal_Int32 nColumn )
     995                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     996                 :            : {
     997                 :          0 :     sal_Int32 nExtend = -1;
     998                 :            : 
     999         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1000                 :            : 
    1001 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1002                 :            : 
    1003 [ #  # ][ #  # ]:          0 :     GetTableData().CheckRowAndCol( nRow, nColumn, this );
    1004                 :            : 
    1005                 :            :     Int32Set_Impl::const_iterator aSttCol(
    1006 [ #  # ][ #  # ]:          0 :                                     GetTableData().GetColumnIter( nColumn ) );
    1007                 :            :     Int32Set_Impl::const_iterator aSttRow(
    1008 [ #  # ][ #  # ]:          0 :                                     GetTableData().GetRowIter( nRow ) );
    1009 [ #  # ][ #  # ]:          0 :     const SwFrm *pCellFrm = GetTableData().GetCellAtPos( *aSttCol, *aSttRow,
                 [ #  # ]
    1010         [ #  # ]:          0 :                                                          sal_False );
    1011         [ #  # ]:          0 :     if( pCellFrm )
    1012                 :            :     {
    1013                 :          0 :         sal_Int32 nRight = pCellFrm->Frm().Right();
    1014                 :          0 :         nRight -= GetFrm()->Frm().Left();
    1015                 :            :         Int32Set_Impl::const_iterator aEndCol(
    1016 [ #  # ][ #  # ]:          0 :                 GetTableData().GetColumns().upper_bound( nRight ) );
    1017                 :            :         nExtend =
    1018         [ #  # ]:          0 :              static_cast< sal_Int32 >( ::std::distance( aSttCol, aEndCol ) );
    1019                 :            :     }
    1020                 :            : 
    1021         [ #  # ]:          0 :     return nExtend;
    1022                 :            : }
    1023                 :            : 
    1024                 :            : uno::Reference< XAccessibleTable > SAL_CALL
    1025                 :          0 :         SwAccessibleTable::getAccessibleRowHeaders(  )
    1026                 :            :     throw (uno::RuntimeException)
    1027                 :            : {
    1028                 :            :     // Row headers aren't supported
    1029                 :          0 :     return uno::Reference< XAccessibleTable >();
    1030                 :            : }
    1031                 :            : 
    1032                 :            : uno::Reference< XAccessibleTable > SAL_CALL
    1033                 :          0 :         SwAccessibleTable::getAccessibleColumnHeaders(  )
    1034                 :            :     throw (uno::RuntimeException)
    1035                 :            : {
    1036                 :            :     // #i87532# - assure that return accesible object is empty,
    1037                 :            :     // if no column header exists.
    1038                 :            :     SwAccessibleTableColHeaders* pTableColHeaders =
    1039         [ #  # ]:          0 :         new SwAccessibleTableColHeaders( GetMap(), static_cast< const SwTabFrm *>( GetFrm() ) );
    1040 [ #  # ][ #  # ]:          0 :     uno::Reference< XAccessibleTable > xTableColumnHeaders( pTableColHeaders );
    1041 [ #  # ][ #  # ]:          0 :     if ( pTableColHeaders->getAccessibleChildCount() <= 0 )
    1042                 :            :     {
    1043                 :          0 :         return uno::Reference< XAccessibleTable >();
    1044                 :            :     }
    1045                 :            : 
    1046                 :          0 :     return xTableColumnHeaders;
    1047                 :            : }
    1048                 :            : 
    1049                 :          0 : uno::Sequence< sal_Int32 > SAL_CALL SwAccessibleTable::getSelectedAccessibleRows()
    1050                 :            :     throw (uno::RuntimeException)
    1051                 :            : {
    1052         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1053                 :            : 
    1054 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1055                 :            : 
    1056         [ #  # ]:          0 :     const SwSelBoxes *pSelBoxes = GetSelBoxes();
    1057         [ #  # ]:          0 :     if( pSelBoxes )
    1058                 :            :     {
    1059         [ #  # ]:          0 :         sal_Int32 nRows = GetTableData().GetRowCount();
    1060         [ #  # ]:          0 :         SwAccAllTableSelHander_Impl aSelRows( nRows  );
    1061                 :            : 
    1062         [ #  # ]:          0 :         GetTableData().GetSelection( 0, nRows, *pSelBoxes, aSelRows,
    1063         [ #  # ]:          0 :                                       sal_False );
    1064                 :            : 
    1065         [ #  # ]:          0 :         return aSelRows.GetSelSequence();
    1066                 :            :     }
    1067                 :            :     else
    1068                 :            :     {
    1069         [ #  # ]:          0 :         return uno::Sequence< sal_Int32 >( 0 );
    1070         [ #  # ]:          0 :     }
    1071                 :            : }
    1072                 :            : 
    1073                 :          0 : uno::Sequence< sal_Int32 > SAL_CALL SwAccessibleTable::getSelectedAccessibleColumns()
    1074                 :            :     throw (uno::RuntimeException)
    1075                 :            : {
    1076         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1077                 :            : 
    1078 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1079                 :            : 
    1080         [ #  # ]:          0 :     const SwSelBoxes *pSelBoxes = GetSelBoxes();
    1081         [ #  # ]:          0 :     if( pSelBoxes )
    1082                 :            :     {
    1083         [ #  # ]:          0 :         sal_Int32 nCols = GetTableData().GetColumnCount();
    1084         [ #  # ]:          0 :         SwAccAllTableSelHander_Impl aSelCols( nCols );
    1085                 :            : 
    1086 [ #  # ][ #  # ]:          0 :         GetTableData().GetSelection( 0, nCols, *pSelBoxes, aSelCols, sal_True );
    1087                 :            : 
    1088         [ #  # ]:          0 :         return aSelCols.GetSelSequence();
    1089                 :            :     }
    1090                 :            :     else
    1091                 :            :     {
    1092         [ #  # ]:          0 :         return uno::Sequence< sal_Int32 >( 0 );
    1093         [ #  # ]:          0 :     }
    1094                 :            : }
    1095                 :            : 
    1096                 :          0 : sal_Bool SAL_CALL SwAccessibleTable::isAccessibleRowSelected( sal_Int32 nRow )
    1097                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
    1098                 :            : {
    1099         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1100                 :            : 
    1101 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1102                 :            : 
    1103 [ #  # ][ #  # ]:          0 :     GetTableData().CheckRowAndCol( nRow, 0, this );
    1104                 :            : 
    1105                 :            :     sal_Bool bRet;
    1106         [ #  # ]:          0 :     const SwSelBoxes *pSelBoxes = GetSelBoxes();
    1107         [ #  # ]:          0 :     if( pSelBoxes )
    1108                 :            :     {
    1109                 :          0 :         SwAccSingleTableSelHander_Impl aSelRow;
    1110         [ #  # ]:          0 :         GetTableData().GetSelection( nRow, nRow+1, *pSelBoxes, aSelRow,
    1111         [ #  # ]:          0 :                                      sal_False );
    1112                 :          0 :         bRet = aSelRow.IsSelected();
    1113                 :            :     }
    1114                 :            :     else
    1115                 :            :     {
    1116                 :          0 :         bRet = sal_False;
    1117                 :            :     }
    1118                 :            : 
    1119         [ #  # ]:          0 :     return bRet;
    1120                 :            : }
    1121                 :            : 
    1122                 :          0 : sal_Bool SAL_CALL SwAccessibleTable::isAccessibleColumnSelected(
    1123                 :            :         sal_Int32 nColumn )
    1124                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
    1125                 :            : {
    1126         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1127                 :            : 
    1128 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1129                 :            : 
    1130 [ #  # ][ #  # ]:          0 :     GetTableData().CheckRowAndCol( 0, nColumn, this );
    1131                 :            : 
    1132                 :            :     sal_Bool bRet;
    1133         [ #  # ]:          0 :     const SwSelBoxes *pSelBoxes = GetSelBoxes();
    1134         [ #  # ]:          0 :     if( pSelBoxes )
    1135                 :            :     {
    1136                 :          0 :         SwAccSingleTableSelHander_Impl aSelCol;
    1137                 :            : 
    1138         [ #  # ]:          0 :         GetTableData().GetSelection( nColumn, nColumn+1, *pSelBoxes, aSelCol,
    1139         [ #  # ]:          0 :                                      sal_True );
    1140                 :          0 :         bRet = aSelCol.IsSelected();
    1141                 :            :     }
    1142                 :            :     else
    1143                 :            :     {
    1144                 :          0 :         bRet = sal_False;
    1145                 :            :     }
    1146                 :            : 
    1147         [ #  # ]:          0 :     return bRet;
    1148                 :            : }
    1149                 :            : 
    1150                 :          0 : uno::Reference< XAccessible > SAL_CALL SwAccessibleTable::getAccessibleCellAt(
    1151                 :            :         sal_Int32 nRow, sal_Int32 nColumn )
    1152                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
    1153                 :            : {
    1154                 :          0 :     uno::Reference< XAccessible > xRet;
    1155                 :            : 
    1156         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1157                 :            : 
    1158 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1159                 :            : 
    1160                 :            :     const SwFrm *pCellFrm =
    1161 [ #  # ][ #  # ]:          0 :                     GetTableData().GetCell( nRow, nColumn, sal_False, this );
    1162         [ #  # ]:          0 :     if( pCellFrm )
    1163 [ #  # ][ #  # ]:          0 :         xRet = GetMap()->GetContext( pCellFrm, sal_True );
    1164                 :            : 
    1165         [ #  # ]:          0 :     return xRet;
    1166                 :            : }
    1167                 :            : 
    1168                 :          0 : uno::Reference< XAccessible > SAL_CALL SwAccessibleTable::getAccessibleCaption()
    1169                 :            :     throw (uno::RuntimeException)
    1170                 :            : {
    1171                 :            :     // captions aren't supported
    1172                 :          0 :     return uno::Reference< XAccessible >();
    1173                 :            : }
    1174                 :            : 
    1175                 :          0 : uno::Reference< XAccessible > SAL_CALL SwAccessibleTable::getAccessibleSummary()
    1176                 :            :     throw (uno::RuntimeException)
    1177                 :            : {
    1178                 :            :     // summaries aren't supported
    1179                 :          0 :     return uno::Reference< XAccessible >();
    1180                 :            : }
    1181                 :            : 
    1182                 :          0 : sal_Bool SAL_CALL SwAccessibleTable::isAccessibleSelected(
    1183                 :            :             sal_Int32 nRow, sal_Int32 nColumn )
    1184                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
    1185                 :            : {
    1186                 :          0 :     sal_Bool bRet = sal_False;
    1187                 :            : 
    1188         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1189                 :            : 
    1190 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1191                 :            : 
    1192                 :            :     const SwFrm *pFrm =
    1193 [ #  # ][ #  # ]:          0 :                     GetTableData().GetCell( nRow, nColumn, sal_False, this );
    1194 [ #  # ][ #  # ]:          0 :     if( pFrm && pFrm->IsCellFrm() )
                 [ #  # ]
    1195                 :            :     {
    1196         [ #  # ]:          0 :         const SwSelBoxes *pSelBoxes = GetSelBoxes();
    1197         [ #  # ]:          0 :         if( pSelBoxes )
    1198                 :            :         {
    1199                 :          0 :             const SwCellFrm *pCFrm = static_cast < const SwCellFrm * >( pFrm );
    1200                 :            :             SwTableBox *pBox =
    1201                 :          0 :                 const_cast< SwTableBox *>( pCFrm->GetTabBox() );
    1202 [ #  # ][ #  # ]:          0 :             bRet = pSelBoxes->find( pBox ) != pSelBoxes->end();
    1203                 :            :         }
    1204                 :            :     }
    1205                 :            : 
    1206         [ #  # ]:          0 :     return bRet;
    1207                 :            : }
    1208                 :            : 
    1209                 :          0 : sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleIndex(
    1210                 :            :             sal_Int32 nRow, sal_Int32 nColumn )
    1211                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
    1212                 :            : {
    1213                 :          0 :     sal_Int32 nRet = -1;
    1214                 :            : 
    1215         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1216                 :            : 
    1217 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1218                 :            : 
    1219 [ #  # ][ #  # ]:          0 :     SwAccessibleChild aCell( GetTableData().GetCell( nRow, nColumn, sal_False, this ));
                 [ #  # ]
    1220 [ #  # ][ #  # ]:          0 :     if ( aCell.IsValid() )
    1221                 :            :     {
    1222         [ #  # ]:          0 :         nRet = GetChildIndex( *(GetMap()), aCell );
    1223                 :            :     }
    1224                 :            : 
    1225         [ #  # ]:          0 :     return nRet;
    1226                 :            : }
    1227                 :            : 
    1228                 :          0 : sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRow( sal_Int32 nChildIndex )
    1229                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
    1230                 :            : {
    1231                 :          0 :     sal_Int32 nRet = -1;
    1232                 :            : 
    1233         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1234                 :            : 
    1235 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1236                 :            : 
    1237                 :            :     // #i77106#
    1238 [ #  # ][ #  # ]:          0 :     if ( ( nChildIndex < 0 ) ||
                 [ #  # ]
    1239         [ #  # ]:          0 :          ( nChildIndex >= getAccessibleChildCount() ) )
    1240                 :            :     {
    1241         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
    1242                 :            :     }
    1243                 :            : 
    1244         [ #  # ]:          0 :     SwAccessibleChild aCell( GetChild( *(GetMap()), nChildIndex ) );
    1245 [ #  # ][ #  # ]:          0 :     if ( aCell.GetSwFrm()  )
    1246                 :            :     {
    1247         [ #  # ]:          0 :         sal_Int32 nTop = aCell.GetSwFrm()->Frm().Top();
    1248                 :          0 :         nTop -= GetFrm()->Frm().Top();
    1249                 :            :         Int32Set_Impl::const_iterator aRow(
    1250 [ #  # ][ #  # ]:          0 :                 GetTableData().GetRows().lower_bound( nTop ) );
    1251                 :            :         nRet = static_cast< sal_Int32 >( ::std::distance(
    1252 [ #  # ][ #  # ]:          0 :                     GetTableData().GetRows().begin(), aRow ) );
    1253                 :            :     }
    1254                 :            :     else
    1255                 :            :     {
    1256                 :            :         OSL_ENSURE( !aCell.IsValid(), "SwAccessibleTable::getAccessibleColumn:"
    1257                 :            :                 "aCell not expected to be valid.");
    1258                 :            : 
    1259         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
    1260                 :            :     }
    1261                 :            : 
    1262         [ #  # ]:          0 :     return nRet;
    1263                 :            : }
    1264                 :            : 
    1265                 :          0 : sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumn(
    1266                 :            :         sal_Int32 nChildIndex )
    1267                 :            :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
    1268                 :            : {
    1269                 :          0 :     sal_Int32 nRet = -1;
    1270                 :            : 
    1271         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1272                 :            : 
    1273 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1274                 :            : 
    1275                 :            :     // #i77106#
    1276 [ #  # ][ #  # ]:          0 :     if ( ( nChildIndex < 0 ) ||
                 [ #  # ]
    1277         [ #  # ]:          0 :          ( nChildIndex >= getAccessibleChildCount() ) )
    1278                 :            :     {
    1279         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
    1280                 :            :     }
    1281                 :            : 
    1282         [ #  # ]:          0 :     SwAccessibleChild aCell( GetChild( *(GetMap()), nChildIndex ) );
    1283 [ #  # ][ #  # ]:          0 :     if ( aCell.GetSwFrm()  )
    1284                 :            :     {
    1285         [ #  # ]:          0 :         sal_Int32 nLeft = aCell.GetSwFrm()->Frm().Left();
    1286                 :          0 :         nLeft -= GetFrm()->Frm().Left();
    1287                 :            :         Int32Set_Impl::const_iterator aCol(
    1288 [ #  # ][ #  # ]:          0 :                 GetTableData().GetColumns().lower_bound( nLeft ) );
    1289                 :            :         nRet = static_cast< sal_Int32 >( ::std::distance(
    1290 [ #  # ][ #  # ]:          0 :                     GetTableData().GetColumns().begin(), aCol ) );
    1291                 :            :     }
    1292                 :            :     else
    1293                 :            :     {
    1294                 :            :         OSL_ENSURE( !aCell.IsValid(), "SwAccessibleTable::getAccessibleColumn:"
    1295                 :            :                 "aCell not expected to be valid.");
    1296                 :            : 
    1297         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
    1298                 :            :     }
    1299                 :            : 
    1300         [ #  # ]:          0 :     return nRet;
    1301                 :            : }
    1302                 :            : 
    1303                 :            : 
    1304                 :          0 : OUString SAL_CALL SwAccessibleTable::getImplementationName()
    1305                 :            :         throw( uno::RuntimeException )
    1306                 :            : {
    1307                 :          0 :     return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplementationName));
    1308                 :            : }
    1309                 :            : 
    1310                 :          0 : sal_Bool SAL_CALL SwAccessibleTable::supportsService(
    1311                 :            :         const OUString& sTestServiceName)
    1312                 :            :     throw (uno::RuntimeException)
    1313                 :            : {
    1314                 :            :     return sTestServiceName.equalsAsciiL( sServiceName,
    1315                 :          0 :                                           sizeof(sServiceName)-1 ) ||
    1316                 :            :            sTestServiceName.equalsAsciiL( sAccessibleServiceName,
    1317 [ #  # ][ #  # ]:          0 :                                              sizeof(sAccessibleServiceName)-1 );
    1318                 :            : }
    1319                 :            : 
    1320                 :          0 : uno::Sequence< OUString > SAL_CALL SwAccessibleTable::getSupportedServiceNames()
    1321                 :            :         throw( uno::RuntimeException )
    1322                 :            : {
    1323                 :          0 :     uno::Sequence< OUString > aRet(2);
    1324         [ #  # ]:          0 :     OUString* pArray = aRet.getArray();
    1325         [ #  # ]:          0 :     pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sServiceName) );
    1326         [ #  # ]:          0 :     pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleServiceName) );
    1327                 :          0 :     return aRet;
    1328                 :            : }
    1329                 :            : 
    1330                 :          0 : void SwAccessibleTable::InvalidatePosOrSize( const SwRect& rOldBox )
    1331                 :            : {
    1332         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1333                 :            : 
    1334         [ #  # ]:          0 :     if( HasTableData() )
    1335         [ #  # ]:          0 :         GetTableData().SetTablePos( GetFrm()->Frm().Pos() );
    1336                 :            : 
    1337 [ #  # ][ #  # ]:          0 :     SwAccessibleContext::InvalidatePosOrSize( rOldBox );
    1338                 :          0 : }
    1339                 :            : 
    1340                 :          4 : void SwAccessibleTable::Dispose( sal_Bool bRecursive )
    1341                 :            : {
    1342         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    1343                 :            : 
    1344         [ +  - ]:          4 :     if( GetRegisteredIn() )
    1345         [ +  - ]:          4 :         GetRegisteredInNonConst()->Remove( this );
    1346                 :            : 
    1347 [ +  - ][ +  - ]:          4 :     SwAccessibleContext::Dispose( bRecursive );
    1348                 :          4 : }
    1349                 :            : 
    1350                 :          4 : void SwAccessibleTable::DisposeChild( const SwAccessibleChild& rChildFrmOrObj,
    1351                 :            :                                       sal_Bool bRecursive )
    1352                 :            : {
    1353         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    1354                 :            : 
    1355         [ +  - ]:          4 :     const SwFrm *pFrm = rChildFrmOrObj.GetSwFrm();
    1356                 :            :     OSL_ENSURE( pFrm, "frame expected" );
    1357         [ -  + ]:          4 :     if( HasTableData() )
    1358                 :            :     {
    1359 [ #  # ][ #  # ]:          0 :         FireTableChangeEvent( GetTableData() );
    1360                 :          0 :         ClearTableData();
    1361                 :            :     }
    1362                 :            : 
    1363                 :            :     // There are two reason why this method has been called. The first one
    1364                 :            :     // is there is no context for pFrm. The method is them called by
    1365                 :            :     // the map, and we have to call our superclass.
    1366                 :            :     // The other situation is that we have been call by a call to get notified
    1367                 :            :     // about its change. We then must not call the superclass
    1368         [ +  - ]:          4 :     uno::Reference< XAccessible > xAcc( GetMap()->GetContext( pFrm, sal_False ) );
    1369         [ -  + ]:          4 :     if( !xAcc.is() )
    1370 [ #  # ][ +  - ]:          4 :         SwAccessibleContext::DisposeChild( rChildFrmOrObj, bRecursive );
    1371                 :          4 : }
    1372                 :            : 
    1373                 :          0 : void SwAccessibleTable::InvalidateChildPosOrSize( const SwAccessibleChild& rChildFrmOrObj,
    1374                 :            :                                                   const SwRect& rOldBox )
    1375                 :            : {
    1376         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1377                 :            : 
    1378         [ #  # ]:          0 :     if( HasTableData() )
    1379                 :            :     {
    1380                 :            :         OSL_ENSURE( !HasTableData() ||
    1381                 :            :                 GetFrm()->Frm().Pos() == GetTableData().GetTablePos(),
    1382                 :            :                 "table has invalid position" );
    1383         [ #  # ]:          0 :         if( HasTableData() )
    1384                 :            :         {
    1385         [ #  # ]:          0 :             SwAccessibleTableData_Impl *pNewTableData = CreateNewTableData(); // #i77106#
    1386 [ #  # ][ #  # ]:          0 :             if( !pNewTableData->CompareExtents( GetTableData() ) )
                 [ #  # ]
    1387                 :            :             {
    1388 [ #  # ][ #  # ]:          0 :                 FireTableChangeEvent( GetTableData() );
    1389                 :          0 :                 ClearTableData();
    1390                 :          0 :                 mpTableData = pNewTableData;
    1391                 :            :             }
    1392                 :            :             else
    1393                 :            :             {
    1394         [ #  # ]:          0 :                 delete pNewTableData;
    1395                 :            :             }
    1396                 :            :         }
    1397                 :            :     }
    1398                 :            : 
    1399                 :            :     // #i013961# - always call super class method
    1400 [ #  # ][ #  # ]:          0 :     SwAccessibleContext::InvalidateChildPosOrSize( rChildFrmOrObj, rOldBox );
    1401                 :          0 : }
    1402                 :            : 
    1403                 :            : 
    1404                 :            : //
    1405                 :            : //  XAccessibleSelection
    1406                 :            : //
    1407                 :            : 
    1408                 :          8 : void SAL_CALL SwAccessibleTable::selectAccessibleChild(
    1409                 :            :     sal_Int32 nChildIndex )
    1410                 :            :     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
    1411                 :            : {
    1412         [ +  - ]:          8 :     SolarMutexGuard aGuard;
    1413 [ +  - ][ -  + ]:          8 :     CHECK_FOR_DEFUNC( XAccessibleTable );
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1414                 :            : 
    1415 [ +  - ][ +  - ]:          8 :     if( (nChildIndex < 0) || (nChildIndex >= getAccessibleChildCount()) ) // #i77106#
         [ -  + ][ -  + ]
    1416         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
    1417                 :            : 
    1418                 :            :     // preliminaries: get 'our' table box, and get the cursor shell
    1419         [ +  - ]:          8 :     const SwTableBox* pBox = GetTableBox( nChildIndex );
    1420                 :            :     OSL_ENSURE( pBox != NULL, "We need the table box." );
    1421                 :            : 
    1422         [ +  - ]:          8 :     SwCrsrShell* pCrsrShell = GetCrsrShell();
    1423         [ -  + ]:          8 :     if( pCrsrShell == NULL )
    1424                 :            :         return;
    1425                 :            : 
    1426                 :            :     // assure, that child, indentified by the given index, isn't already selected.
    1427 [ +  - ][ -  + ]:          8 :     if ( IsChildSelected( nChildIndex ) )
    1428                 :            :     {
    1429                 :            :         return;
    1430                 :            :     }
    1431                 :            : 
    1432                 :            :     // now we can start to do the work: check whether we already have
    1433                 :            :     // a table selection (in 'our' table). If so, extend the
    1434                 :            :     // selection, else select the current cell.
    1435                 :            : 
    1436                 :            :     // if we have a selection in a table, check if it's in the
    1437                 :            :     // same table that we're trying to select in
    1438         [ +  - ]:          8 :     const SwTableNode* pSelectedTable = pCrsrShell->IsCrsrInTbl();
    1439         [ +  + ]:          8 :     if( pSelectedTable != NULL )
    1440                 :            :     {
    1441                 :            :         // get top-most table line
    1442                 :          6 :         const SwTableLine* pUpper = pBox->GetUpper();
    1443         [ -  + ]:          6 :         while( pUpper->GetUpper() != NULL )
    1444                 :          0 :             pUpper = pUpper->GetUpper()->GetUpper();
    1445                 :            :         sal_uInt16 nPos =
    1446         [ +  - ]:          6 :             pSelectedTable->GetTable().GetTabLines().GetPos( pUpper );
    1447         [ -  + ]:          6 :         if( nPos == USHRT_MAX )
    1448                 :          0 :             pSelectedTable = NULL;
    1449                 :            :     }
    1450                 :            : 
    1451                 :            :     // create the new selection
    1452                 :          8 :     const SwStartNode* pStartNode = pBox->GetSttNd();
    1453 [ +  + ][ +  + ]:          8 :     if( pSelectedTable == NULL || !pCrsrShell->GetTblCrs() )
                 [ +  + ]
    1454                 :            :     {
    1455         [ +  - ]:          4 :         pCrsrShell->StartAction();
    1456                 :            :         // Set cursor into current cell. This deletes any table cursor.
    1457         [ +  - ]:          4 :         SwPaM aPaM( *pStartNode );
    1458         [ +  - ]:          4 :         aPaM.Move( fnMoveForward, fnGoNode );
    1459         [ +  - ]:          4 :         Select( aPaM );
    1460                 :            :         // Move cursor to the end of the table creating a selection and a table
    1461                 :            :         // cursor.
    1462         [ +  - ]:          4 :         pCrsrShell->SetMark();
    1463         [ +  - ]:          4 :         pCrsrShell->MoveTable( fnTableCurr, fnTableEnd );
    1464                 :            :         // now set the cursor into the cell again.
    1465                 :          4 :         SwPaM *pPaM = pCrsrShell->GetTblCrs() ? pCrsrShell->GetTblCrs()
    1466 [ #  # ][ +  - ]:          4 :                                                     : pCrsrShell->GetCrsr();
    1467         [ +  - ]:          4 :         *pPaM->GetPoint() = *pPaM->GetMark();
    1468 [ +  - ][ +  - ]:          4 :         pCrsrShell->EndAction();
    1469                 :            :         // we now have one cell selected!
    1470                 :            :     }
    1471                 :            :     else
    1472                 :            :     {
    1473                 :            :         // if the cursor is already in this table,
    1474                 :            :         // expand the current selection (i.e., set
    1475                 :            :         // point to new position; keep mark)
    1476         [ +  - ]:          4 :         SwPaM aPaM( *pStartNode );
    1477         [ +  - ]:          4 :         aPaM.Move( fnMoveForward, fnGoNode );
    1478         [ +  - ]:          4 :         aPaM.SetMark();
    1479                 :          4 :         const SwPaM *pPaM = pCrsrShell->GetTblCrs() ? pCrsrShell->GetTblCrs()
    1480 [ #  # ][ +  - ]:          4 :                                                     : pCrsrShell->GetCrsr();
    1481         [ +  - ]:          4 :         *(aPaM.GetMark()) = *pPaM->GetMark();
    1482 [ +  - ][ +  - ]:          8 :         Select( aPaM );
    1483                 :            : 
    1484 [ +  - ][ +  - ]:          8 :     }
    1485                 :            : }
    1486                 :            : 
    1487                 :            : 
    1488                 :          0 : sal_Bool SAL_CALL SwAccessibleTable::isAccessibleChildSelected(
    1489                 :            :     sal_Int32 nChildIndex )
    1490                 :            :     throw ( lang::IndexOutOfBoundsException,
    1491                 :            :             uno::RuntimeException )
    1492                 :            : {
    1493         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1494 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1495                 :            : 
    1496 [ #  # ][ #  # ]:          0 :     if( (nChildIndex < 0) || (nChildIndex >= getAccessibleChildCount()) ) // #i77106#
         [ #  # ][ #  # ]
    1497         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
    1498                 :            : 
    1499 [ #  # ][ #  # ]:          0 :     return IsChildSelected( nChildIndex );
    1500                 :            : }
    1501                 :            : 
    1502                 :          4 : void SAL_CALL SwAccessibleTable::clearAccessibleSelection(  )
    1503                 :            :     throw ( uno::RuntimeException )
    1504                 :            : {
    1505         [ +  - ]:          4 :     SolarMutexGuard aGuard;
    1506                 :            : 
    1507 [ +  - ][ -  + ]:          4 :     CHECK_FOR_DEFUNC( XAccessibleTable );
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1508                 :            : 
    1509         [ +  - ]:          4 :     SwCrsrShell* pCrsrShell = GetCrsrShell();
    1510         [ +  - ]:          4 :     if( pCrsrShell != NULL )
    1511                 :            :     {
    1512         [ +  - ]:          4 :         pCrsrShell->StartAction();
    1513         [ +  - ]:          4 :         pCrsrShell->ClearMark();
    1514         [ +  - ]:          4 :         pCrsrShell->EndAction();
    1515         [ +  - ]:          4 :     }
    1516                 :          4 : }
    1517                 :            : 
    1518                 :          4 : void SAL_CALL SwAccessibleTable::selectAllAccessibleChildren(  )
    1519                 :            :     throw ( uno::RuntimeException )
    1520                 :            : {
    1521                 :            :     // first clear selection, then select first and last child
    1522                 :          4 :     clearAccessibleSelection();
    1523                 :          4 :     selectAccessibleChild( 0 );
    1524                 :          4 :     selectAccessibleChild( getAccessibleChildCount()-1 ); // #i77106#
    1525                 :          4 : }
    1526                 :            : 
    1527                 :          0 : sal_Int32 SAL_CALL SwAccessibleTable::getSelectedAccessibleChildCount(  )
    1528                 :            :     throw ( uno::RuntimeException )
    1529                 :            : {
    1530         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1531 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1532                 :            : 
    1533                 :            :     // iterate over all children and count isAccessibleChildSelected()
    1534                 :          0 :     sal_Int32 nCount = 0;
    1535                 :            : 
    1536         [ #  # ]:          0 :     sal_Int32 nChildren = getAccessibleChildCount(); // #i71106#
    1537         [ #  # ]:          0 :     for( sal_Int32 n = 0; n < nChildren; n++ )
    1538 [ #  # ][ #  # ]:          0 :         if( IsChildSelected( n ) )
    1539                 :          0 :             nCount++;
    1540                 :            : 
    1541         [ #  # ]:          0 :     return nCount;
    1542                 :            : }
    1543                 :            : 
    1544                 :          0 : uno::Reference<XAccessible> SAL_CALL SwAccessibleTable::getSelectedAccessibleChild(
    1545                 :            :     sal_Int32 nSelectedChildIndex )
    1546                 :            :     throw ( lang::IndexOutOfBoundsException,
    1547                 :            :             uno::RuntimeException)
    1548                 :            : {
    1549         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1550 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1551                 :            : 
    1552                 :            :     // paremter checking (part 1): index lower 0
    1553         [ #  # ]:          0 :     if( nSelectedChildIndex < 0 )
    1554         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
    1555                 :            : 
    1556         [ #  # ]:          0 :     sal_Int32 nChildIndex = GetIndexOfSelectedChild( nSelectedChildIndex );
    1557                 :            : 
    1558                 :            :     // parameter checking (part 2): index higher than selected children?
    1559         [ #  # ]:          0 :     if( nChildIndex < 0 )
    1560         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
    1561                 :            : 
    1562                 :            :     // #i77106#
    1563 [ #  # ][ #  # ]:          0 :     if ( nChildIndex >= getAccessibleChildCount() )
    1564                 :            :     {
    1565         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
    1566                 :            :     }
    1567                 :            : 
    1568 [ #  # ][ #  # ]:          0 :     return getAccessibleChild( nChildIndex );
    1569                 :            : }
    1570                 :            : 
    1571                 :            : // index has to be treated as global child index.
    1572                 :          0 : void SAL_CALL SwAccessibleTable::deselectAccessibleChild(
    1573                 :            :     sal_Int32 nChildIndex )
    1574                 :            :     throw ( lang::IndexOutOfBoundsException,
    1575                 :            :             uno::RuntimeException )
    1576                 :            : {
    1577         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1578 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleTable );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1579                 :            : 
    1580         [ #  # ]:          0 :     SwCrsrShell* pCrsrShell = GetCrsrShell();
    1581                 :            : 
    1582                 :            :     // index has to be treated as global child index
    1583         [ #  # ]:          0 :     if ( !pCrsrShell )
    1584         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
    1585                 :            : 
    1586                 :            :     // assure, that given child index is in bounds.
    1587 [ #  # ][ #  # ]:          0 :     if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) // #i77106#
         [ #  # ][ #  # ]
    1588         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
    1589                 :            : 
    1590                 :            :     // assure, that child, identified by the given index, is selected.
    1591 [ #  # ][ #  # ]:          0 :     if ( !IsChildSelected( nChildIndex ) )
    1592                 :          0 :         return;
    1593                 :            : 
    1594         [ #  # ]:          0 :     const SwTableBox* pBox = GetTableBox( nChildIndex );
    1595                 :            :     OSL_ENSURE( pBox != NULL, "We need the table box." );
    1596                 :            : 
    1597                 :            :     // If we unselect point, then set cursor to mark. If we clear another
    1598                 :            :     // selected box, then set cursor to point.
    1599                 :            :     // reduce selection to mark.
    1600                 :          0 :     SwPaM *pPaM = pCrsrShell->GetTblCrs() ? pCrsrShell->GetTblCrs()
    1601 [ #  # ][ #  # ]:          0 :                                                 : pCrsrShell->GetCrsr();
    1602                 :            :     sal_Bool bDeselectPoint =
    1603                 :          0 :         pBox->GetSttNd() ==
    1604         [ #  # ]:          0 :             pPaM->GetPoint()->nNode.GetNode().FindTableBoxStartNode();
    1605                 :            : 
    1606 [ #  # ][ #  # ]:          0 :     SwPaM aPaM( bDeselectPoint ? *pPaM->GetMark() : *pPaM->GetPoint() );
    1607                 :            : 
    1608         [ #  # ]:          0 :     pCrsrShell->StartAction();
    1609                 :            : 
    1610                 :            :     // Set cursor into either point or mark
    1611         [ #  # ]:          0 :     Select( aPaM );
    1612                 :            :     // Move cursor to the end of the table creating a selection and a table
    1613                 :            :     // cursor.
    1614         [ #  # ]:          0 :     pCrsrShell->SetMark();
    1615         [ #  # ]:          0 :     pCrsrShell->MoveTable( fnTableCurr, fnTableEnd );
    1616                 :            :     // now set the cursor into the cell again.
    1617                 :          0 :     pPaM = pCrsrShell->GetTblCrs() ? pCrsrShell->GetTblCrs()
    1618 [ #  # ][ #  # ]:          0 :                                         : pCrsrShell->GetCrsr();
    1619         [ #  # ]:          0 :     *pPaM->GetPoint() = *pPaM->GetMark();
    1620 [ #  # ][ #  # ]:          0 :     pCrsrShell->EndAction();
         [ #  # ][ #  # ]
    1621                 :            : }
    1622                 :            : 
    1623                 :            : // #i77106# - implementation of class <SwAccessibleTableColHeaders>
    1624                 :          0 : SwAccessibleTableColHeaders::SwAccessibleTableColHeaders( SwAccessibleMap *pMap2,
    1625                 :            :                                                           const SwTabFrm *pTabFrm )
    1626                 :          0 :     : SwAccessibleTable( pMap2, pTabFrm )
    1627                 :            : {
    1628         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1629                 :            : 
    1630         [ #  # ]:          0 :     const SwFrmFmt *pFrmFmt = pTabFrm->GetFmt();
    1631         [ #  # ]:          0 :     const_cast< SwFrmFmt * >( pFrmFmt )->Add( this );
    1632                 :          0 :     const String& rName = pFrmFmt->GetName();
    1633                 :            : 
    1634                 :          0 :     OUStringBuffer aBuffer( rName.Len() + 15 + 6 );
    1635 [ #  # ][ #  # ]:          0 :     aBuffer.append( OUString(rName) );
    1636         [ #  # ]:          0 :     aBuffer.append( rtl::OUString("-ColumnHeaders-") );
    1637 [ #  # ][ #  # ]:          0 :     aBuffer.append( static_cast<sal_Int32>( pTabFrm->GetPhyPageNum() ) );
    1638                 :            : 
    1639         [ #  # ]:          0 :     SetName( aBuffer.makeStringAndClear() );
    1640                 :            : 
    1641                 :          0 :     OUStringBuffer aBuffer2( rName.Len() + 14 );
    1642 [ #  # ][ #  # ]:          0 :     aBuffer2.append( OUString(rName) );
    1643         [ #  # ]:          0 :     aBuffer2.append( rtl::OUString("-ColumnHeaders") );
    1644         [ #  # ]:          0 :     OUString sArg1( aBuffer2.makeStringAndClear() );
    1645 [ #  # ][ #  # ]:          0 :     OUString sArg2( GetFormattedPageNumber() );
                 [ #  # ]
    1646                 :            : 
    1647         [ #  # ]:          0 :     OUString sDesc2 = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );
    1648                 :          0 :     SetDesc( sDesc2 );
    1649                 :            : 
    1650         [ #  # ]:          0 :     NotRegisteredAtAccessibleMap(); // #i85634#
    1651                 :          0 : }
    1652                 :            : 
    1653                 :          0 : SwAccessibleTableData_Impl* SwAccessibleTableColHeaders::CreateNewTableData()
    1654                 :            : {
    1655                 :          0 :     const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() );
    1656         [ #  # ]:          0 :     return new SwAccessibleTableData_Impl( *(GetMap()), pTabFrm, IsInPagePreview(), true );
    1657                 :            : }
    1658                 :            : 
    1659                 :            : 
    1660                 :          0 : void SwAccessibleTableColHeaders::Modify( const SfxPoolItem * /*pOld*/, const SfxPoolItem * /*pNew*/ )
    1661                 :            : {
    1662                 :          0 : }
    1663                 :            : 
    1664                 :            : //=====  XInterface  ======================================================
    1665                 :          0 : uno::Any SAL_CALL SwAccessibleTableColHeaders::queryInterface( const uno::Type& aType )
    1666                 :            :         throw (uno::RuntimeException)
    1667                 :            : {
    1668                 :          0 :     return SwAccessibleTable::queryInterface( aType );
    1669                 :            : }
    1670                 :            : 
    1671                 :            : //=====  XAccessibleContext  ==============================================
    1672                 :          0 : sal_Int32 SAL_CALL SwAccessibleTableColHeaders::getAccessibleChildCount(void)
    1673                 :            :         throw (uno::RuntimeException)
    1674                 :            : {
    1675         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1676                 :            : 
    1677 [ #  # ][ #  # ]:          0 :     CHECK_FOR_DEFUNC( XAccessibleContext )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1678                 :            : 
    1679                 :          0 :     sal_Int32 nCount = 0;
    1680                 :            : 
    1681                 :          0 :     const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() );
    1682         [ #  # ]:          0 :     const SwAccessibleChildSList aVisList( GetVisArea(), *pTabFrm, *(GetMap()) );
    1683         [ #  # ]:          0 :     SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
    1684 [ #  # ][ #  # ]:          0 :     while( aIter != aVisList.end() )
                 [ #  # ]
    1685                 :            :     {
    1686                 :          0 :         const SwAccessibleChild& rLower = *aIter;
    1687 [ #  # ][ #  # ]:          0 :         if( rLower.IsAccessible( IsInPagePreview() ) )
    1688                 :            :         {
    1689                 :          0 :             nCount++;
    1690                 :            :         }
    1691 [ #  # ][ #  # ]:          0 :         else if( rLower.GetSwFrm() )
    1692                 :            :         {
    1693                 :            :             // There are no unaccessible SdrObjects that count
    1694 [ #  # ][ #  # ]:          0 :             if ( !rLower.GetSwFrm()->IsRowFrm() ||
         [ #  # ][ #  # ]
    1695 [ #  # ][ #  # ]:          0 :                  pTabFrm->IsInHeadline( *(rLower.GetSwFrm()) ) )
    1696                 :            :             {
    1697                 :          0 :                 nCount += SwAccessibleFrame::GetChildCount( *(GetMap()),
    1698                 :          0 :                                                             GetVisArea(),
    1699                 :            :                                                             rLower.GetSwFrm(),
    1700   [ #  #  #  # ]:          0 :                                                             IsInPagePreview() );
    1701                 :            :             }
    1702                 :            :         }
    1703         [ #  # ]:          0 :         ++aIter;
    1704                 :            :     }
    1705                 :            : 
    1706         [ #  # ]:          0 :     return nCount;
    1707                 :            : }
    1708                 :            : 
    1709                 :            : uno::Reference< XAccessible> SAL_CALL
    1710                 :          0 :         SwAccessibleTableColHeaders::getAccessibleChild (sal_Int32 nIndex)
    1711                 :            :         throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
    1712                 :            : {
    1713 [ #  # ][ #  # ]:          0 :     if ( nIndex < 0 || nIndex >= getAccessibleChildCount() )
                 [ #  # ]
    1714                 :            :     {
    1715         [ #  # ]:          0 :         throw lang::IndexOutOfBoundsException();
    1716                 :            :     }
    1717                 :            : 
    1718                 :          0 :     return SwAccessibleTable::getAccessibleChild( nIndex );
    1719                 :            : }
    1720                 :            : 
    1721                 :            : //=====  XAccessibleTable  ================================================
    1722                 :            : uno::Reference< XAccessibleTable >
    1723                 :          0 :         SAL_CALL SwAccessibleTableColHeaders::getAccessibleRowHeaders()
    1724                 :            :         throw (uno::RuntimeException)
    1725                 :            : {
    1726                 :          0 :     return uno::Reference< XAccessibleTable >();
    1727                 :            : }
    1728                 :            : 
    1729                 :            : uno::Reference< XAccessibleTable >
    1730                 :          0 :         SAL_CALL SwAccessibleTableColHeaders::getAccessibleColumnHeaders()
    1731                 :            :         throw (uno::RuntimeException)
    1732                 :            : {
    1733                 :          0 :     return uno::Reference< XAccessibleTable >();
    1734                 :            : }
    1735                 :            : 
    1736                 :            : //=====  XServiceInfo  ====================================================
    1737                 :            : 
    1738                 :          0 : ::rtl::OUString SAL_CALL SwAccessibleTableColHeaders::getImplementationName (void)
    1739                 :            :         throw (uno::RuntimeException)
    1740                 :            : {
    1741                 :            :     static const sal_Char sImplName[] = "com.sun.star.comp.Writer.SwAccessibleTableColumnHeadersView";
    1742                 :          0 :     return OUString(RTL_CONSTASCII_USTRINGPARAM(sImplName));
    1743                 :            : }
    1744                 :            : 
    1745                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10