LCOV - code coverage report
Current view: top level - sc/source/ui/Accessibility - AccessibleCell.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 140 200 70.0 %
Date: 2012-08-25 Functions: 23 30 76.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 136 390 34.9 %

           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 "AccessibleCell.hxx"
      30                 :            : #include "scitems.hxx"
      31                 :            : #include <editeng/eeitem.hxx>
      32                 :            : 
      33                 :            : 
      34                 :            : #include "AccessibleText.hxx"
      35                 :            : #include "AccessibleDocument.hxx"
      36                 :            : #include "tabvwsh.hxx"
      37                 :            : #include "document.hxx"
      38                 :            : #include "attrib.hxx"
      39                 :            : #include "miscuno.hxx"
      40                 :            : #include "editsrc.hxx"
      41                 :            : #include "dociter.hxx"
      42                 :            : #include "cell.hxx"
      43                 :            : #include "markdata.hxx"
      44                 :            : 
      45                 :            : #include <unotools/accessiblestatesethelper.hxx>
      46                 :            : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      47                 :            : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      48                 :            : #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
      49                 :            : #include <com/sun/star/accessibility/XAccessibleTable.hpp>
      50                 :            : #include <editeng/brshitem.hxx>
      51                 :            : #include <comphelper/sequence.hxx>
      52                 :            : #include <float.h>
      53                 :            : #include <vcl/svapp.hxx>
      54                 :            : 
      55                 :            : using namespace ::com::sun::star;
      56                 :            : using namespace ::com::sun::star::accessibility;
      57                 :            : 
      58                 :            : //=====  internal  ============================================================
      59                 :            : 
      60                 :         11 : ScAccessibleCell::ScAccessibleCell(
      61                 :            :         const uno::Reference<XAccessible>& rxParent,
      62                 :            :         ScTabViewShell* pViewShell,
      63                 :            :         ScAddress& rCellAddress,
      64                 :            :         sal_Int32 nIndex,
      65                 :            :         ScSplitPos eSplitPos,
      66                 :            :         ScAccessibleDocument* pAccDoc)
      67                 :            :     :
      68                 :            :     ScAccessibleCellBase(rxParent, GetDocument(pViewShell), rCellAddress, nIndex),
      69                 :            :         ::accessibility::AccessibleStaticTextBase(CreateEditSource(pViewShell, rCellAddress, eSplitPos)),
      70                 :            :     mpViewShell(pViewShell),
      71                 :            :     mpAccDoc(pAccDoc),
      72 [ +  - ][ +  - ]:         11 :     meSplitPos(eSplitPos)
         [ +  - ][ +  - ]
      73                 :            : {
      74         [ +  - ]:         11 :     if (pViewShell)
      75         [ +  - ]:         11 :         pViewShell->AddAccessibilityObject(*this);
      76                 :         11 : }
      77                 :            : 
      78         [ +  - ]:         11 : ScAccessibleCell::~ScAccessibleCell()
      79                 :            : {
      80 [ -  + ][ #  # ]:         11 :     if (!ScAccessibleContextBase::IsDefunc() && !rBHelper.bInDispose)
                 [ -  + ]
      81                 :            :     {
      82                 :            :         // increment refcount to prevent double call off dtor
      83         [ #  # ]:          0 :         osl_incrementInterlockedCount( &m_refCount );
      84                 :            :         // call dispose to inform object wich have a weak reference to this object
      85         [ #  # ]:          0 :         dispose();
      86                 :            :     }
      87         [ -  + ]:         22 : }
      88                 :            : 
      89                 :         25 : void ScAccessibleCell::Init()
      90                 :            : {
      91                 :         25 :     ScAccessibleCellBase::Init();
      92                 :            : 
      93         [ +  - ]:         25 :     SetEventSource(this);
      94                 :         25 : }
      95                 :            : 
      96                 :         11 : void SAL_CALL ScAccessibleCell::disposing()
      97                 :            : {
      98         [ +  - ]:         11 :     SolarMutexGuard aGuard;
      99                 :            :     // dispose in AccessibleStaticTextBase
     100         [ +  - ]:         11 :     Dispose();
     101                 :            : 
     102         [ +  - ]:         11 :     if (mpViewShell)
     103                 :            :     {
     104         [ +  - ]:         11 :         mpViewShell->RemoveAccessibilityObject(*this);
     105                 :         11 :         mpViewShell = NULL;
     106                 :            :     }
     107                 :         11 :     mpAccDoc = NULL;
     108                 :            : 
     109 [ +  - ][ +  - ]:         11 :     ScAccessibleCellBase::disposing();
     110                 :         11 : }
     111                 :            : 
     112                 :            :     //=====  XInterface  =====================================================
     113                 :            : 
     114 [ -  + ][ #  # ]:        879 : IMPLEMENT_FORWARD_XINTERFACE2( ScAccessibleCell, ScAccessibleCellBase, AccessibleStaticTextBase )
     115                 :            : 
     116                 :            :     //=====  XTypeProvider  ===================================================
     117                 :            : 
     118 [ #  # ][ #  # ]:          0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( ScAccessibleCell, ScAccessibleCellBase, AccessibleStaticTextBase )
                 [ #  # ]
     119                 :            : 
     120                 :            :     //=====  XAccessibleComponent  ============================================
     121                 :            : 
     122                 :          0 : uno::Reference< XAccessible > SAL_CALL ScAccessibleCell::getAccessibleAtPoint(
     123                 :            :         const awt::Point& rPoint )
     124                 :            :         throw (uno::RuntimeException)
     125                 :            : {
     126                 :          0 :     return AccessibleStaticTextBase::getAccessibleAtPoint(rPoint);
     127                 :            : }
     128                 :            : 
     129                 :          2 : void SAL_CALL ScAccessibleCell::grabFocus(  )
     130                 :            :         throw (uno::RuntimeException)
     131                 :            : {
     132         [ +  - ]:          2 :      SolarMutexGuard aGuard;
     133         [ +  - ]:          2 :     IsObjectValid();
     134 [ +  - ][ +  - ]:          2 :     if (getAccessibleParent().is() && mpViewShell)
         [ +  - ][ +  - ]
           [ +  -  #  # ]
     135                 :            :     {
     136 [ +  - ][ +  - ]:          2 :         uno::Reference<XAccessibleComponent> xAccessibleComponent(getAccessibleParent()->getAccessibleContext(), uno::UNO_QUERY);
         [ +  - ][ +  - ]
     137         [ +  - ]:          2 :         if (xAccessibleComponent.is())
     138                 :            :         {
     139 [ +  - ][ +  - ]:          2 :             xAccessibleComponent->grabFocus();
     140         [ +  - ]:          2 :             mpViewShell->SetCursor(maCellAddress.Col(), maCellAddress.Row());
     141                 :          2 :         }
     142         [ +  - ]:          2 :     }
     143                 :          2 : }
     144                 :            : 
     145                 :          2 : Rectangle ScAccessibleCell::GetBoundingBoxOnScreen(void) const
     146                 :            :         throw (uno::RuntimeException)
     147                 :            : {
     148                 :          2 :     Rectangle aCellRect(GetBoundingBox());
     149         [ +  - ]:          2 :     if (mpViewShell)
     150                 :            :     {
     151                 :          2 :         Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
     152         [ +  - ]:          2 :         if (pWindow)
     153                 :            :         {
     154         [ +  - ]:          2 :             Rectangle aRect = pWindow->GetWindowExtentsRelative(NULL);
     155                 :          2 :             aCellRect.setX(aCellRect.getX() + aRect.getX());
     156                 :          2 :             aCellRect.setY(aCellRect.getY() + aRect.getY());
     157                 :            :         }
     158                 :            :     }
     159                 :          2 :     return aCellRect;
     160                 :            : }
     161                 :            : 
     162                 :        535 : Rectangle ScAccessibleCell::GetBoundingBox(void) const
     163                 :            :         throw (uno::RuntimeException)
     164                 :            : {
     165                 :        535 :     Rectangle aCellRect;
     166         [ +  - ]:        535 :     if (mpViewShell)
     167                 :            :     {
     168                 :            :         long nSizeX, nSizeY;
     169                 :            :         mpViewShell->GetViewData()->GetMergeSizePixel(
     170         [ +  - ]:        535 :             maCellAddress.Col(), maCellAddress.Row(), nSizeX, nSizeY);
     171         [ +  - ]:        535 :         aCellRect.SetSize(Size(nSizeX, nSizeY));
     172         [ +  - ]:        535 :         aCellRect.SetPos(mpViewShell->GetViewData()->GetScrPos(maCellAddress.Col(), maCellAddress.Row(), meSplitPos, sal_True));
     173                 :            : 
     174         [ +  - ]:        535 :         Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
     175         [ +  - ]:        535 :         if (pWindow)
     176                 :            :         {
     177 [ +  - ][ +  - ]:        535 :             Rectangle aRect(pWindow->GetWindowExtentsRelative(pWindow->GetAccessibleParentWindow()));
     178         [ +  - ]:        535 :             aRect.Move(-aRect.Left(), -aRect.Top());
     179         [ +  - ]:        535 :             aCellRect = aRect.Intersection(aCellRect);
     180                 :            :         }
     181                 :            : 
     182                 :            :         /*  #i19430# Gnopernicus reads text partly if it sticks out of the cell
     183                 :            :             boundaries. This leads to wrong results in cases where the cell
     184                 :            :             text is rotated, because rotation is not taken into account when
     185                 :            :             calculating the visible part of the text. In these cases we will
     186                 :            :             simply expand the cell size to the width of the unrotated text. */
     187         [ +  - ]:        535 :         if (mpDoc)
     188                 :            :         {
     189                 :            :             const SfxInt32Item* pItem = static_cast< const SfxInt32Item* >(
     190         [ +  - ]:        535 :                 mpDoc->GetAttr( maCellAddress.Col(), maCellAddress.Row(), maCellAddress.Tab(), ATTR_ROTATE_VALUE ) );
     191 [ +  - ][ -  + ]:        535 :             if( pItem && (pItem->GetValue() != 0) )
                 [ -  + ]
     192                 :            :             {
     193         [ #  # ]:          0 :                 Rectangle aParaRect = GetParagraphBoundingBox();
     194 [ #  # ][ #  # ]:          0 :                 if( !aParaRect.IsEmpty() && (aCellRect.GetWidth() < aParaRect.GetWidth()) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     195 [ #  # ][ #  # ]:        535 :                     aCellRect.SetSize( Size( aParaRect.GetWidth(), aCellRect.GetHeight() ) );
                 [ #  # ]
     196                 :            :             }
     197                 :            :         }
     198                 :            :     }
     199         [ -  + ]:        535 :     if (aCellRect.IsEmpty())
     200                 :          0 :         aCellRect.SetPos(Point(-1, -1));
     201                 :        535 :     return aCellRect;
     202                 :            : }
     203                 :            : 
     204                 :            :     //=====  XAccessibleContext  ==============================================
     205                 :            : 
     206                 :            : sal_Int32 SAL_CALL
     207                 :         18 :     ScAccessibleCell::getAccessibleChildCount(void)
     208                 :            :                     throw (uno::RuntimeException)
     209                 :            : {
     210                 :         18 :     return AccessibleStaticTextBase::getAccessibleChildCount();
     211                 :            : }
     212                 :            : 
     213                 :            : uno::Reference< XAccessible > SAL_CALL
     214                 :          0 :     ScAccessibleCell::getAccessibleChild(sal_Int32 nIndex)
     215                 :            :         throw (uno::RuntimeException,
     216                 :            :         lang::IndexOutOfBoundsException)
     217                 :            : {
     218                 :          0 :     return AccessibleStaticTextBase::getAccessibleChild(nIndex);
     219                 :            : }
     220                 :            : 
     221                 :            : uno::Reference<XAccessibleStateSet> SAL_CALL
     222                 :         11 :     ScAccessibleCell::getAccessibleStateSet(void)
     223                 :            :     throw (uno::RuntimeException)
     224                 :            : {
     225         [ +  - ]:         11 :     SolarMutexGuard aGuard;
     226                 :         11 :     uno::Reference<XAccessibleStateSet> xParentStates;
     227 [ +  - ][ +  - ]:         11 :     if (getAccessibleParent().is())
     228                 :            :     {
     229 [ +  - ][ +  - ]:         11 :         uno::Reference<XAccessibleContext> xParentContext = getAccessibleParent()->getAccessibleContext();
                 [ +  - ]
     230 [ +  - ][ +  - ]:         11 :         xParentStates = xParentContext->getAccessibleStateSet();
                 [ +  - ]
     231                 :            :     }
     232         [ +  - ]:         11 :     utl::AccessibleStateSetHelper* pStateSet = new utl::AccessibleStateSetHelper();
     233 [ +  - ][ -  + ]:         11 :     if (IsDefunc(xParentStates))
     234         [ #  # ]:          0 :         pStateSet->AddState(AccessibleStateType::DEFUNC);
     235                 :            :     else
     236                 :            :     {
     237 [ +  - ][ +  - ]:         11 :         if (IsEditable(xParentStates))
     238                 :            :         {
     239         [ +  - ]:         11 :             pStateSet->AddState(AccessibleStateType::EDITABLE);
     240         [ +  - ]:         11 :             pStateSet->AddState(AccessibleStateType::RESIZABLE);
     241                 :            :         }
     242         [ +  - ]:         11 :         pStateSet->AddState(AccessibleStateType::ENABLED);
     243         [ +  - ]:         11 :         pStateSet->AddState(AccessibleStateType::MULTI_LINE);
     244         [ +  - ]:         11 :         pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE);
     245 [ +  - ][ -  + ]:         11 :         if (IsOpaque(xParentStates))
     246         [ #  # ]:          0 :             pStateSet->AddState(AccessibleStateType::OPAQUE);
     247         [ +  - ]:         11 :         pStateSet->AddState(AccessibleStateType::SELECTABLE);
     248 [ +  - ][ -  + ]:         11 :         if (IsSelected())
     249         [ #  # ]:          0 :             pStateSet->AddState(AccessibleStateType::SELECTED);
     250 [ +  - ][ +  - ]:         11 :         if (isShowing())
     251         [ +  - ]:         11 :             pStateSet->AddState(AccessibleStateType::SHOWING);
     252         [ +  - ]:         11 :         pStateSet->AddState(AccessibleStateType::TRANSIENT);
     253 [ +  - ][ +  - ]:         11 :         if (isVisible())
     254         [ +  - ]:         11 :             pStateSet->AddState(AccessibleStateType::VISIBLE);
     255                 :            :     }
     256 [ +  - ][ +  - ]:         11 :     return pStateSet;
                 [ +  - ]
     257                 :            : }
     258                 :            : 
     259                 :            : uno::Reference<XAccessibleRelationSet> SAL_CALL
     260                 :          2 :        ScAccessibleCell::getAccessibleRelationSet(void)
     261                 :            :     throw (uno::RuntimeException)
     262                 :            : {
     263         [ +  - ]:          2 :     SolarMutexGuard aGuard;
     264         [ +  - ]:          2 :     IsObjectValid();
     265                 :          2 :     utl::AccessibleRelationSetHelper* pRelationSet = NULL;
     266         [ +  - ]:          2 :     if (mpAccDoc)
     267         [ +  - ]:          2 :         pRelationSet = mpAccDoc->GetRelationSet(&maCellAddress);
     268         [ +  - ]:          2 :     if (!pRelationSet)
     269         [ +  - ]:          2 :         pRelationSet = new utl::AccessibleRelationSetHelper();
     270         [ +  - ]:          2 :     FillDependends(pRelationSet);
     271         [ +  - ]:          2 :     FillPrecedents(pRelationSet);
     272 [ +  - ][ +  - ]:          2 :     return pRelationSet;
                 [ +  - ]
     273                 :            : }
     274                 :            : 
     275                 :            :     //=====  XServiceInfo  ====================================================
     276                 :            : 
     277                 :         10 : ::rtl::OUString SAL_CALL ScAccessibleCell::getImplementationName(void)
     278                 :            :         throw (uno::RuntimeException)
     279                 :            : {
     280                 :         10 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("ScAccessibleCell"));
     281                 :            : }
     282                 :            : 
     283                 :            : uno::Sequence< ::rtl::OUString> SAL_CALL
     284                 :          0 :     ScAccessibleCell::getSupportedServiceNames(void)
     285                 :            :         throw (uno::RuntimeException)
     286                 :            : {
     287                 :          0 :     uno::Sequence< ::rtl::OUString > aSequence = ScAccessibleContextBase::getSupportedServiceNames();
     288                 :          0 :     sal_Int32 nOldSize(aSequence.getLength());
     289         [ #  # ]:          0 :     aSequence.realloc(nOldSize + 1);
     290         [ #  # ]:          0 :     ::rtl::OUString* pNames = aSequence.getArray();
     291                 :            : 
     292         [ #  # ]:          0 :     pNames[nOldSize] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.AccessibleCell"));
     293                 :            : 
     294                 :          0 :     return aSequence;
     295                 :            : }
     296                 :            : 
     297                 :            :     //====  internal  =========================================================
     298                 :            : 
     299                 :         11 : sal_Bool ScAccessibleCell::IsDefunc(
     300                 :            :     const uno::Reference<XAccessibleStateSet>& rxParentStates)
     301                 :            : {
     302 [ +  - ][ +  - ]:         33 :     return ScAccessibleContextBase::IsDefunc() || (mpDoc == NULL) || (mpViewShell == NULL) || !getAccessibleParent().is() ||
                 [ #  # ]
     303         [ +  - ]:         33 :          (rxParentStates.is() && rxParentStates->contains(AccessibleStateType::DEFUNC));
           [ +  -  +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
                 [ +  - ]
     304                 :            : }
     305                 :            : 
     306                 :         21 : sal_Bool ScAccessibleCell::IsEditable(
     307                 :            :     const uno::Reference<XAccessibleStateSet>& rxParentStates)
     308                 :            : {
     309                 :         21 :     sal_Bool bEditable(sal_True);
     310 [ +  - ][ -  + ]:         21 :     if (rxParentStates.is() && !rxParentStates->contains(AccessibleStateType::EDITABLE) &&
         [ #  # ][ -  + ]
     311                 :            :         mpDoc)
     312                 :            :     {
     313                 :            :         // here I have to test whether the protection of the table should influence this cell.
     314                 :            :         const ScProtectionAttr* pItem = (const ScProtectionAttr*)mpDoc->GetAttr(
     315                 :          0 :             maCellAddress.Col(), maCellAddress.Row(),
     316                 :          0 :             maCellAddress.Tab(), ATTR_PROTECTION);
     317         [ #  # ]:          0 :         if (pItem)
     318                 :          0 :             bEditable = !pItem->GetProtection();
     319                 :            :     }
     320                 :         21 :     return bEditable;
     321                 :            : }
     322                 :            : 
     323                 :         11 : sal_Bool ScAccessibleCell::IsOpaque(
     324                 :            :     const uno::Reference<XAccessibleStateSet>& /* rxParentStates */)
     325                 :            : {
     326                 :            :     // test whether there is a background color
     327                 :         11 :     sal_Bool bOpaque(sal_True);
     328         [ +  - ]:         11 :     if (mpDoc)
     329                 :            :     {
     330                 :            :         const SvxBrushItem* pItem = (const SvxBrushItem*)mpDoc->GetAttr(
     331                 :         11 :             maCellAddress.Col(), maCellAddress.Row(),
     332                 :         22 :             maCellAddress.Tab(), ATTR_BACKGROUND);
     333         [ +  - ]:         11 :         if (pItem)
     334                 :         11 :             bOpaque = pItem->GetColor() != COL_TRANSPARENT;
     335                 :            :     }
     336                 :         11 :     return bOpaque;
     337                 :            : }
     338                 :            : 
     339                 :         11 : sal_Bool ScAccessibleCell::IsSelected()
     340                 :            : {
     341                 :         11 :     sal_Bool bResult(false);
     342 [ +  - ][ +  - ]:         11 :     if (mpViewShell && mpViewShell->GetViewData())
                 [ +  - ]
     343                 :            :     {
     344                 :         11 :         const ScMarkData& rMarkdata = mpViewShell->GetViewData()->GetMarkData();
     345                 :         11 :         bResult = rMarkdata.IsCellMarked(maCellAddress.Col(), maCellAddress.Row());
     346                 :            :     }
     347                 :         11 :     return bResult;
     348                 :            : }
     349                 :            : 
     350                 :         11 : ScDocument* ScAccessibleCell::GetDocument(ScTabViewShell* pViewShell)
     351                 :            : {
     352                 :         11 :     ScDocument* pDoc = NULL;
     353 [ +  - ][ +  - ]:         11 :     if (pViewShell && pViewShell->GetViewData())
                 [ +  - ]
     354                 :         11 :         pDoc = pViewShell->GetViewData()->GetDocument();
     355                 :         11 :     return pDoc;
     356                 :            : }
     357                 :            : 
     358                 :            : SAL_WNODEPRECATED_DECLARATIONS_PUSH
     359                 :         11 : ::std::auto_ptr< SvxEditSource > ScAccessibleCell::CreateEditSource(ScTabViewShell* pViewShell, ScAddress aCell, ScSplitPos eSplitPos)
     360                 :            : {
     361                 :            :     ::std::auto_ptr < ScAccessibleTextData > pAccessibleCellTextData
     362 [ +  - ][ +  - ]:         11 :         ( new ScAccessibleCellTextData( pViewShell, aCell, eSplitPos, this ) );
     363 [ +  - ][ +  - ]:         11 :     ::std::auto_ptr< SvxEditSource > pEditSource (new ScAccessibilityEditSource(pAccessibleCellTextData));
                 [ +  - ]
     364                 :            : 
     365         [ +  - ]:         11 :     return pEditSource;
     366                 :            : }
     367                 :            : SAL_WNODEPRECATED_DECLARATIONS_POP
     368                 :            : 
     369                 :          2 : void ScAccessibleCell::FillDependends(utl::AccessibleRelationSetHelper* pRelationSet)
     370                 :            : {
     371         [ +  - ]:          2 :     if (mpDoc)
     372                 :            :     {
     373         [ +  - ]:          2 :         ScCellIterator aCellIter( mpDoc, 0,0, maCellAddress.Tab(), MAXCOL,MAXROW, maCellAddress.Tab() );
     374         [ +  - ]:          2 :         ScBaseCell* pCell = aCellIter.GetFirst();
     375         [ +  + ]:          4 :         while (pCell)
     376                 :            :         {
     377         [ -  + ]:          2 :             if (pCell->GetCellType() == CELLTYPE_FORMULA)
     378                 :            :             {
     379                 :          0 :                 sal_Bool bFound(false);
     380 [ #  # ][ #  # ]:          0 :                 ScDetectiveRefIter aIter( (ScFormulaCell*) pCell );
     381                 :          0 :                 ScRange aRef;
     382 [ #  # ][ #  # ]:          0 :                 while ( !bFound && aIter.GetNextRef( aRef ) )
         [ #  # ][ #  # ]
     383                 :            :                 {
     384         [ #  # ]:          0 :                     if (aRef.In(maCellAddress))
     385                 :          0 :                         bFound = sal_True;
     386                 :            :                 }
     387         [ #  # ]:          0 :                 if (bFound)
     388         [ #  # ]:          0 :                     AddRelation(ScAddress(aCellIter.GetCol(), aCellIter.GetRow(), aCellIter.GetTab()), AccessibleRelationType::CONTROLLER_FOR, pRelationSet);
     389                 :            :             }
     390         [ +  - ]:          2 :             pCell = aCellIter.GetNext();
     391                 :            :         }
     392                 :            :     }
     393                 :          2 : }
     394                 :            : 
     395                 :          2 : void ScAccessibleCell::FillPrecedents(utl::AccessibleRelationSetHelper* pRelationSet)
     396                 :            : {
     397         [ +  - ]:          2 :     if (mpDoc)
     398                 :            :     {
     399                 :          2 :         ScBaseCell* pBaseCell = mpDoc->GetCell(maCellAddress);
     400 [ -  + ][ -  + ]:          2 :         if (pBaseCell && (pBaseCell->GetCellType() == CELLTYPE_FORMULA))
                 [ +  - ]
     401                 :            :         {
     402         [ #  # ]:          0 :             ScFormulaCell* pFCell = (ScFormulaCell*) pBaseCell;
     403                 :            : 
     404         [ #  # ]:          0 :             ScDetectiveRefIter aIter( pFCell );
     405                 :          0 :             ScRange aRef;
     406 [ #  # ][ #  # ]:          0 :             while ( aIter.GetNextRef( aRef ) )
     407                 :            :             {
     408         [ #  # ]:          0 :                 AddRelation( aRef, AccessibleRelationType::CONTROLLED_BY, pRelationSet);
     409                 :            :             }
     410                 :            :         }
     411                 :            :     }
     412                 :          2 : }
     413                 :            : 
     414                 :          0 : void ScAccessibleCell::AddRelation(const ScAddress& rCell,
     415                 :            :     const sal_uInt16 aRelationType,
     416                 :            :     utl::AccessibleRelationSetHelper* pRelationSet)
     417                 :            : {
     418         [ #  # ]:          0 :     AddRelation(ScRange(rCell, rCell), aRelationType, pRelationSet);
     419                 :          0 : }
     420                 :            : 
     421                 :          0 : void ScAccessibleCell::AddRelation(const ScRange& rRange,
     422                 :            :     const sal_uInt16 aRelationType,
     423                 :            :     utl::AccessibleRelationSetHelper* pRelationSet)
     424                 :            : {
     425 [ #  # ][ #  # ]:          0 :     uno::Reference < XAccessibleTable > xTable ( getAccessibleParent()->getAccessibleContext(), uno::UNO_QUERY );
         [ #  # ][ #  # ]
     426         [ #  # ]:          0 :     if (xTable.is())
     427                 :            :     {
     428                 :          0 :         sal_uInt32 nCount(static_cast<sal_uInt32>(rRange.aEnd.Col() -
     429                 :          0 :                     rRange.aStart.Col() + 1) * (rRange.aEnd.Row() -
     430                 :          0 :                     rRange.aStart.Row() + 1));
     431         [ #  # ]:          0 :         uno::Sequence < uno::Reference < uno::XInterface > > aTargetSet( nCount );
     432         [ #  # ]:          0 :         uno::Reference < uno::XInterface >* pTargetSet = aTargetSet.getArray();
     433         [ #  # ]:          0 :         if (pTargetSet)
     434                 :            :         {
     435                 :          0 :             sal_uInt32 nPos(0);
     436         [ #  # ]:          0 :             for (sal_uInt32 nRow = rRange.aStart.Row(); nRow <= sal::static_int_cast<sal_uInt32>(rRange.aEnd.Row()); ++nRow)
     437                 :            :             {
     438         [ #  # ]:          0 :                 for (sal_uInt32 nCol = rRange.aStart.Col(); nCol <= sal::static_int_cast<sal_uInt32>(rRange.aEnd.Col()); ++nCol)
     439                 :            :                 {
     440 [ #  # ][ #  # ]:          0 :                     pTargetSet[nPos] = xTable->getAccessibleCellAt(nRow, nCol);
                 [ #  # ]
     441                 :          0 :                     ++nPos;
     442                 :            :                 }
     443                 :            :             }
     444                 :            :             OSL_ENSURE(nCount == nPos, "something wents wrong");
     445                 :            :         }
     446         [ #  # ]:          0 :         AccessibleRelation aRelation;
     447                 :          0 :         aRelation.RelationType = aRelationType;
     448         [ #  # ]:          0 :         aRelation.TargetSet = aTargetSet;
     449 [ #  # ][ #  # ]:          0 :         pRelationSet->AddRelation(aRelation);
                 [ #  # ]
     450                 :          0 :     }
     451                 :          0 : }
     452                 :            : 
     453                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10