LCOV - code coverage report
Current view: top level - sc/source/ui/Accessibility - AccessibleDataPilotControl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 292 0.0 %
Date: 2012-08-25 Functions: 0 49 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 458 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "AccessibleDataPilotControl.hxx"
      30                 :            : #include "fieldwnd.hxx"
      31                 :            : 
      32                 :            : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      33                 :            : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      34                 :            : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      35                 :            : 
      36                 :            : #include <unotools/accessiblestatesethelper.hxx>
      37                 :            : #include <comphelper/servicehelper.hxx>
      38                 :            : #include <tools/gen.hxx>
      39                 :            : #include <toolkit/helper/convert.hxx>
      40                 :            : #include <vcl/svapp.hxx>
      41                 :            : 
      42                 :            : using namespace ::com::sun::star;
      43                 :            : using namespace ::com::sun::star::accessibility;
      44                 :            : 
      45                 :            : class ScAccessibleDataPilotButton
      46                 :            :     :   public ScAccessibleContextBase
      47                 :            : {
      48                 :            : public:
      49                 :            :     //=====  internal  ========================================================
      50                 :            :     ScAccessibleDataPilotButton(
      51                 :            :         const ::com::sun::star::uno::Reference<
      52                 :            :         ::com::sun::star::accessibility::XAccessible>& rxParent,
      53                 :            :         ScDPFieldControlBase* pDPFieldWindow,
      54                 :            :         sal_Int32 nIndex);
      55                 :            : 
      56                 :            :     virtual void Init();
      57                 :            : 
      58                 :            :     using ScAccessibleContextBase::disposing;
      59                 :            :     virtual void SAL_CALL disposing();
      60                 :            : 
      61                 :          0 :     void SetIndex(sal_Int32 nIndex) { mnIndex = nIndex; }
      62                 :            :     void NameChanged();
      63                 :            :     void SetFocused();
      64                 :            :     void ResetFocused();
      65                 :            : protected:
      66                 :            :     virtual ~ScAccessibleDataPilotButton(void);
      67                 :            : public:
      68                 :            :     ///=====  XAccessibleComponent  ============================================
      69                 :            : 
      70                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
      71                 :            :         SAL_CALL getAccessibleAtPoint(
      72                 :            :         const ::com::sun::star::awt::Point& rPoint )
      73                 :            :         throw (::com::sun::star::uno::RuntimeException);
      74                 :            : 
      75                 :            :     virtual sal_Bool SAL_CALL isVisible(  )
      76                 :            :         throw (::com::sun::star::uno::RuntimeException);
      77                 :            : 
      78                 :            :     virtual void SAL_CALL grabFocus(  )
      79                 :            :         throw (::com::sun::star::uno::RuntimeException);
      80                 :            : 
      81                 :            :     virtual sal_Int32 SAL_CALL getForeground(  )
      82                 :            :         throw (::com::sun::star::uno::RuntimeException);
      83                 :            : 
      84                 :            :     virtual sal_Int32 SAL_CALL getBackground(  )
      85                 :            :         throw (::com::sun::star::uno::RuntimeException);
      86                 :            : 
      87                 :            :     ///=====  XAccessibleContext  ==============================================
      88                 :            : 
      89                 :            :     /// Return the number of currently visible children.
      90                 :            :     virtual sal_Int32 SAL_CALL
      91                 :            :         getAccessibleChildCount(void) throw (::com::sun::star::uno::RuntimeException);
      92                 :            : 
      93                 :            :     /// Return the specified child or NULL if index is invalid.
      94                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
      95                 :            :         getAccessibleChild(sal_Int32 nIndex)
      96                 :            :         throw (::com::sun::star::uno::RuntimeException,
      97                 :            :                 ::com::sun::star::lang::IndexOutOfBoundsException);
      98                 :            : 
      99                 :            :     /// Return this objects index among the parents children.
     100                 :            :     virtual sal_Int32 SAL_CALL
     101                 :            :         getAccessibleIndexInParent(void)
     102                 :            :         throw (::com::sun::star::uno::RuntimeException);
     103                 :            : 
     104                 :            :     /// Return the set of current states.
     105                 :            :     virtual ::com::sun::star::uno::Reference<
     106                 :            :             ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
     107                 :            :         getAccessibleStateSet(void)
     108                 :            :         throw (::com::sun::star::uno::RuntimeException);
     109                 :            : 
     110                 :            :     ///=====  XServiceInfo  ====================================================
     111                 :            : 
     112                 :            :     /** Returns an identifier for the implementation of this object.
     113                 :            :     */
     114                 :            :     virtual ::rtl::OUString SAL_CALL
     115                 :            :         getImplementationName(void)
     116                 :            :         throw (::com::sun::star::uno::RuntimeException);
     117                 :            : 
     118                 :            :     ///=====  XTypeProvider  ===================================================
     119                 :            : 
     120                 :            :     /** Returns a implementation id.
     121                 :            :     */
     122                 :            :     virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
     123                 :            :         getImplementationId(void)
     124                 :            :         throw (::com::sun::star::uno::RuntimeException);
     125                 :            : 
     126                 :            : protected:
     127                 :            :     /// Return this object's description.
     128                 :            :     virtual ::rtl::OUString SAL_CALL
     129                 :            :         createAccessibleDescription(void)
     130                 :            :         throw (::com::sun::star::uno::RuntimeException);
     131                 :            : 
     132                 :            :     /// Return the object's current name.
     133                 :            :     virtual ::rtl::OUString SAL_CALL
     134                 :            :         createAccessibleName(void)
     135                 :            :         throw (::com::sun::star::uno::RuntimeException);
     136                 :            : 
     137                 :            :     /// Return the object's current bounding box relative to the desktop.
     138                 :            :     virtual Rectangle GetBoundingBoxOnScreen(void) const
     139                 :            :         throw (::com::sun::star::uno::RuntimeException);
     140                 :            : 
     141                 :            :     /// Return the object's current bounding box relative to the parent object.
     142                 :            :     virtual Rectangle GetBoundingBox(void) const
     143                 :            :         throw (::com::sun::star::uno::RuntimeException);
     144                 :            : 
     145                 :            : private:
     146                 :            :     ScDPFieldControlBase* mpDPFieldWindow;
     147                 :            :     sal_Int32        mnIndex;
     148                 :            : };
     149                 :            : 
     150                 :            :     //=====  internal  ========================================================
     151                 :          0 : ScAccessibleDataPilotControl::ScAccessibleDataPilotControl(
     152                 :            :         const uno::Reference<XAccessible>& rxParent,
     153                 :            :         ScDPFieldControlBase* pDPFieldWindow)
     154                 :            :         :
     155                 :            :     ScAccessibleContextBase(rxParent, AccessibleRole::GROUP_BOX),
     156         [ #  # ]:          0 :     mpDPFieldWindow(pDPFieldWindow)
     157                 :            : {
     158         [ #  # ]:          0 :     if (mpDPFieldWindow)
     159 [ #  # ][ #  # ]:          0 :         maChildren.resize(mpDPFieldWindow->GetFieldCount());
     160                 :          0 : }
     161                 :            : 
     162                 :          0 : ScAccessibleDataPilotControl::~ScAccessibleDataPilotControl(void)
     163                 :            : {
     164 [ #  # ][ #  # ]:          0 :     if (!IsDefunc() && !rBHelper.bInDispose)
                 [ #  # ]
     165                 :            :     {
     166                 :            :         // increment refcount to prevent double call off dtor
     167         [ #  # ]:          0 :         osl_incrementInterlockedCount( &m_refCount );
     168                 :            :         // call dispose to inform object wich have a weak reference to this object
     169         [ #  # ]:          0 :         dispose();
     170                 :            :     }
     171         [ #  # ]:          0 : }
     172                 :            : 
     173                 :          0 : void ScAccessibleDataPilotControl::Init()
     174                 :            : {
     175                 :          0 : }
     176                 :            : 
     177                 :          0 : void SAL_CALL ScAccessibleDataPilotControl::disposing()
     178                 :            : {
     179         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     180                 :          0 :     mpDPFieldWindow = NULL;
     181                 :            : 
     182 [ #  # ][ #  # ]:          0 :     ScAccessibleContextBase::disposing();
     183                 :          0 : }
     184                 :            : 
     185                 :          0 : void ScAccessibleDataPilotControl::AddField(sal_Int32 nNewIndex)
     186                 :            : {
     187                 :          0 :     sal_Bool bAdded(sal_False);
     188         [ #  # ]:          0 :     if (static_cast<sal_uInt32>(nNewIndex) == maChildren.size())
     189                 :            :     {
     190         [ #  # ]:          0 :         maChildren.push_back(AccessibleWeak());
     191                 :          0 :         bAdded = sal_True;
     192                 :            :     }
     193         [ #  # ]:          0 :     else if (static_cast<sal_uInt32>(nNewIndex) < maChildren.size())
     194                 :            :     {
     195         [ #  # ]:          0 :         ::std::vector < AccessibleWeak >::iterator aItr = maChildren.begin() + nNewIndex;
     196 [ #  # ][ #  # ]:          0 :         maChildren.insert(aItr, AccessibleWeak());
                 [ #  # ]
     197                 :            : 
     198                 :          0 :         ::std::vector < AccessibleWeak >::iterator aEndItr = maChildren.end();
     199 [ #  # ][ #  # ]:          0 :         aItr = maChildren.begin() + nNewIndex + 1;
     200                 :          0 :         uno::Reference< XAccessible > xTempAcc;
     201                 :          0 :         sal_Int32 nIndex = nNewIndex + 1;
     202 [ #  # ][ #  # ]:          0 :         while (aItr != aEndItr)
     203                 :            :         {
     204 [ #  # ][ #  # ]:          0 :             xTempAcc = aItr->xWeakAcc;
     205 [ #  # ][ #  # ]:          0 :             if (xTempAcc.is() && aItr->pAcc)
                 [ #  # ]
     206                 :          0 :                 aItr->pAcc->SetIndex(nIndex);
     207                 :          0 :             ++nIndex;
     208                 :          0 :             ++aItr;
     209                 :            :         }
     210                 :          0 :         bAdded = sal_True;
     211                 :            :     }
     212                 :            :     else
     213                 :            :     {
     214                 :            :         OSL_FAIL("did not recognize a child count change");
     215                 :            :     }
     216                 :            : 
     217         [ #  # ]:          0 :     if (bAdded)
     218                 :            :     {
     219         [ #  # ]:          0 :         AccessibleEventObject aEvent;
     220                 :          0 :         aEvent.EventId = AccessibleEventId::CHILD;
     221 [ #  # ][ #  # ]:          0 :         aEvent.Source = uno::Reference< XAccessibleContext >(this);
     222 [ #  # ][ #  # ]:          0 :         aEvent.NewValue <<= getAccessibleChild(nNewIndex);
     223                 :            : 
     224 [ #  # ][ #  # ]:          0 :         CommitChange(aEvent); // new child - event
     225                 :            :     }
     226                 :          0 : }
     227                 :            : 
     228                 :          0 : void ScAccessibleDataPilotControl::MoveField(sal_Int32 nOldIndex, sal_Int32 nNewIndex)
     229                 :            : {
     230                 :          0 :     RemoveField(nOldIndex);
     231         [ #  # ]:          0 :     if (nNewIndex > nOldIndex)
     232                 :          0 :         --nNewIndex;
     233                 :          0 :     AddField(nNewIndex);
     234                 :          0 : }
     235                 :            : 
     236                 :          0 : void ScAccessibleDataPilotControl::RemoveField(sal_Int32 nOldIndex)
     237                 :            : {
     238                 :          0 :     sal_Bool bRemoved(sal_False);
     239                 :          0 :     uno::Reference< XAccessible > xTempAcc;
     240                 :          0 :     ScAccessibleDataPilotButton* pField = NULL;
     241         [ #  # ]:          0 :     if (static_cast<sal_uInt32>(nOldIndex) < maChildren.size())
     242                 :            :     {
     243 [ #  # ][ #  # ]:          0 :         xTempAcc = getAccessibleChild(nOldIndex);
     244                 :          0 :         pField = maChildren[nOldIndex].pAcc;
     245                 :            : 
     246         [ #  # ]:          0 :         ::std::vector < AccessibleWeak >::iterator aItr = maChildren.begin() + nOldIndex;
     247         [ #  # ]:          0 :         aItr = maChildren.erase(aItr);
     248                 :            : 
     249                 :          0 :         ::std::vector < AccessibleWeak >::iterator aEndItr = maChildren.end();
     250                 :          0 :         uno::Reference< XAccessible > xItrAcc;
     251 [ #  # ][ #  # ]:          0 :         while (aItr != aEndItr)
     252                 :            :         {
     253 [ #  # ][ #  # ]:          0 :             xItrAcc = aItr->xWeakAcc;
     254 [ #  # ][ #  # ]:          0 :             if (xItrAcc.is() && aItr->pAcc)
                 [ #  # ]
     255                 :          0 :                 aItr->pAcc->SetIndex(nOldIndex);
     256                 :          0 :             ++nOldIndex;
     257                 :          0 :             ++aItr;
     258                 :            :         }
     259                 :          0 :         bRemoved = sal_True;
     260                 :            :     }
     261                 :            :     else
     262                 :            :     {
     263                 :            :         OSL_FAIL("did not recognize a child count change");
     264                 :            :     }
     265                 :            : 
     266         [ #  # ]:          0 :     if (bRemoved)
     267                 :            :     {
     268         [ #  # ]:          0 :         AccessibleEventObject aEvent;
     269                 :          0 :         aEvent.EventId = AccessibleEventId::CHILD;
     270 [ #  # ][ #  # ]:          0 :         aEvent.Source = uno::Reference< XAccessibleContext >(this);
     271         [ #  # ]:          0 :         aEvent.NewValue <<= xTempAcc;
     272                 :            : 
     273         [ #  # ]:          0 :         CommitChange(aEvent); // gone child - event
     274                 :            : 
     275         [ #  # ]:          0 :         if (pField)
     276 [ #  # ][ #  # ]:          0 :             pField->dispose();
     277                 :          0 :     }
     278                 :          0 : }
     279                 :            : 
     280                 :          0 : void ScAccessibleDataPilotControl::FieldFocusChange(sal_Int32 nOldIndex, sal_Int32 nNewIndex)
     281                 :            : {
     282                 :            :     OSL_ENSURE(static_cast<sal_uInt32>(nOldIndex) < maChildren.size() &&
     283                 :            :                 static_cast<sal_uInt32>(nNewIndex) < maChildren.size(), "did not recognize a child count change");
     284                 :            : 
     285         [ #  # ]:          0 :     uno::Reference < XAccessible > xTempAcc = maChildren[nOldIndex].xWeakAcc;
     286 [ #  # ][ #  # ]:          0 :     if (xTempAcc.is() && maChildren[nOldIndex].pAcc)
                 [ #  # ]
     287         [ #  # ]:          0 :         maChildren[nOldIndex].pAcc->ResetFocused();
     288                 :            : 
     289 [ #  # ][ #  # ]:          0 :     xTempAcc = maChildren[nNewIndex].xWeakAcc;
     290 [ #  # ][ #  # ]:          0 :     if (xTempAcc.is() && maChildren[nNewIndex].pAcc)
                 [ #  # ]
     291         [ #  # ]:          0 :         maChildren[nNewIndex].pAcc->SetFocused();
     292                 :          0 : }
     293                 :            : 
     294                 :          0 : void ScAccessibleDataPilotControl::FieldNameChange(sal_Int32 nIndex)
     295                 :            : {
     296                 :            :     OSL_ENSURE(static_cast<sal_uInt32>(nIndex) < maChildren.size(), "did not recognize a child count change");
     297                 :            : 
     298         [ #  # ]:          0 :     uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc;
     299 [ #  # ][ #  # ]:          0 :     if (xTempAcc.is() && maChildren[nIndex].pAcc)
                 [ #  # ]
     300         [ #  # ]:          0 :         maChildren[nIndex].pAcc->ChangeName();
     301                 :          0 : }
     302                 :            : 
     303                 :          0 : void ScAccessibleDataPilotControl::GotFocus()
     304                 :            : {
     305         [ #  # ]:          0 :     if (mpDPFieldWindow)
     306                 :            :     {
     307                 :            :         OSL_ENSURE(static_cast<sal_uInt32>(mpDPFieldWindow->GetFieldCount()) == maChildren.size(), "did not recognize a child count change");
     308                 :            : 
     309         [ #  # ]:          0 :         sal_Int32 nIndex(mpDPFieldWindow->GetSelectedField());
     310         [ #  # ]:          0 :         uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc;
     311 [ #  # ][ #  # ]:          0 :         if (xTempAcc.is() && maChildren[nIndex].pAcc)
                 [ #  # ]
     312         [ #  # ]:          0 :             maChildren[nIndex].pAcc->SetFocused();
     313                 :            :     }
     314                 :          0 : }
     315                 :            : 
     316                 :          0 : void ScAccessibleDataPilotControl::LostFocus()
     317                 :            : {
     318         [ #  # ]:          0 :     if (mpDPFieldWindow)
     319                 :            :     {
     320                 :            :         OSL_ENSURE(static_cast<sal_uInt32>(mpDPFieldWindow->GetFieldCount()) == maChildren.size(), "did not recognize a child count change");
     321                 :            : 
     322         [ #  # ]:          0 :         sal_Int32 nIndex(mpDPFieldWindow->GetSelectedField());
     323         [ #  # ]:          0 :         uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc;
     324 [ #  # ][ #  # ]:          0 :         if (xTempAcc.is() && maChildren[nIndex].pAcc)
                 [ #  # ]
     325         [ #  # ]:          0 :             maChildren[nIndex].pAcc->ResetFocused();
     326                 :            :     }
     327                 :          0 : }
     328                 :            : 
     329                 :            :     ///=====  XAccessibleComponent  ============================================
     330                 :            : 
     331                 :          0 : uno::Reference< XAccessible > SAL_CALL ScAccessibleDataPilotControl::getAccessibleAtPoint(
     332                 :            :         const awt::Point& rPoint )
     333                 :            :         throw (uno::RuntimeException)
     334                 :            : {
     335                 :          0 :     uno::Reference<XAccessible> xAcc;
     336 [ #  # ][ #  # ]:          0 :     if (containsPoint(rPoint))
     337                 :            :     {
     338         [ #  # ]:          0 :         SolarMutexGuard aGuard;
     339         [ #  # ]:          0 :         IsObjectValid();
     340         [ #  # ]:          0 :         if (mpDPFieldWindow)
     341                 :            :         {
     342                 :          0 :             Point aAbsPoint(VCLPoint(rPoint));
     343         [ #  # ]:          0 :             Point aControlEdge(GetBoundingBoxOnScreen().TopLeft());
     344                 :          0 :             Point aRelPoint(aAbsPoint - aControlEdge);
     345                 :          0 :             size_t nChildIndex(0);
     346 [ #  # ][ #  # ]:          0 :             if (mpDPFieldWindow->GetFieldIndex(aRelPoint, nChildIndex))
     347 [ #  # ][ #  # ]:          0 :                 xAcc = getAccessibleChild(static_cast< long >( nChildIndex ));
     348         [ #  # ]:          0 :         }
     349                 :            :     }
     350                 :          0 :     return xAcc;
     351                 :            : }
     352                 :            : 
     353                 :          0 : sal_Bool SAL_CALL ScAccessibleDataPilotControl::isVisible(  )
     354                 :            :         throw (uno::RuntimeException)
     355                 :            : {
     356                 :          0 :     return sal_True;
     357                 :            : }
     358                 :            : 
     359                 :          0 : void SAL_CALL ScAccessibleDataPilotControl::grabFocus(  )
     360                 :            :         throw (uno::RuntimeException)
     361                 :            : {
     362         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     363         [ #  # ]:          0 :     IsObjectValid();
     364         [ #  # ]:          0 :     if (mpDPFieldWindow)
     365 [ #  # ][ #  # ]:          0 :         mpDPFieldWindow->GrabFocus();
     366                 :          0 : }
     367                 :            : 
     368                 :          0 : sal_Int32 SAL_CALL ScAccessibleDataPilotControl::getForeground(  )
     369                 :            :     throw (uno::RuntimeException)
     370                 :            : {
     371         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     372         [ #  # ]:          0 :     IsObjectValid();
     373                 :          0 :     sal_Int32 nColor(0);
     374         [ #  # ]:          0 :     if (mpDPFieldWindow)
     375                 :            :     {
     376                 :          0 :         nColor = mpDPFieldWindow->GetSettings().GetStyleSettings().GetWindowTextColor().GetColor();
     377                 :            :     }
     378         [ #  # ]:          0 :     return nColor;
     379                 :            : }
     380                 :            : 
     381                 :          0 : sal_Int32 SAL_CALL ScAccessibleDataPilotControl::getBackground(  )
     382                 :            :     throw (uno::RuntimeException)
     383                 :            : {
     384         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     385         [ #  # ]:          0 :     IsObjectValid();
     386                 :          0 :     sal_Int32 nColor(0);
     387         [ #  # ]:          0 :     if (mpDPFieldWindow)
     388                 :            :     {
     389 [ #  # ][ #  # ]:          0 :         if (mpDPFieldWindow->GetFieldType() == TYPE_SELECT)
     390                 :            :         {
     391                 :          0 :             nColor = mpDPFieldWindow->GetSettings().GetStyleSettings().GetFaceColor().GetColor();
     392                 :            :         }
     393                 :            :         else
     394                 :            :         {
     395                 :          0 :             nColor = mpDPFieldWindow->GetSettings().GetStyleSettings().GetWindowColor().GetColor();
     396                 :            :         }
     397                 :            :     }
     398         [ #  # ]:          0 :     return nColor;
     399                 :            : }
     400                 :            : 
     401                 :            :     ///=====  XAccessibleContext  ==============================================
     402                 :            : 
     403                 :          0 : sal_Int32 SAL_CALL ScAccessibleDataPilotControl::getAccessibleChildCount(void)
     404                 :            :         throw (uno::RuntimeException)
     405                 :            : {
     406         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     407         [ #  # ]:          0 :     IsObjectValid();
     408         [ #  # ]:          0 :     if (mpDPFieldWindow)
     409         [ #  # ]:          0 :         return mpDPFieldWindow->GetFieldCount();
     410                 :            :     else
     411         [ #  # ]:          0 :         return 0;
     412                 :            : }
     413                 :            : 
     414                 :          0 : uno::Reference< XAccessible> SAL_CALL ScAccessibleDataPilotControl::getAccessibleChild(sal_Int32 nIndex)
     415                 :            :         throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
     416                 :            : {
     417         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     418         [ #  # ]:          0 :     IsObjectValid();
     419                 :          0 :     uno::Reference<XAccessible> xAcc;
     420         [ #  # ]:          0 :     if (mpDPFieldWindow)
     421                 :            :     {
     422 [ #  # ][ #  # ]:          0 :         if (nIndex < 0 || static_cast< size_t >( nIndex ) >= mpDPFieldWindow->GetFieldCount())
         [ #  # ][ #  # ]
     423         [ #  # ]:          0 :             throw lang::IndexOutOfBoundsException();
     424                 :            : 
     425                 :            :         OSL_ENSURE(static_cast<sal_uInt32>(mpDPFieldWindow->GetFieldCount()) == maChildren.size(), "did not recognize a child count change");
     426                 :            : 
     427         [ #  # ]:          0 :         uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc;
     428         [ #  # ]:          0 :         if (!xTempAcc.is())
     429                 :            :         {
     430 [ #  # ][ #  # ]:          0 :             maChildren[nIndex].pAcc = new ScAccessibleDataPilotButton(this, mpDPFieldWindow, nIndex);
     431 [ #  # ][ #  # ]:          0 :             xTempAcc = maChildren[nIndex].pAcc;
     432         [ #  # ]:          0 :             maChildren[nIndex].xWeakAcc = xTempAcc;
     433                 :            :         }
     434                 :            : 
     435         [ #  # ]:          0 :         xAcc = xTempAcc;
     436                 :            :     }
     437         [ #  # ]:          0 :     return xAcc;
     438                 :            : }
     439                 :            : 
     440                 :          0 : uno::Reference<XAccessibleStateSet> SAL_CALL ScAccessibleDataPilotControl::getAccessibleStateSet(void)
     441                 :            :         throw (uno::RuntimeException)
     442                 :            : {
     443         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     444         [ #  # ]:          0 :     IsObjectValid();
     445                 :            : 
     446         [ #  # ]:          0 :     utl::AccessibleStateSetHelper* pStateSet = new utl::AccessibleStateSetHelper();
     447                 :            : 
     448         [ #  # ]:          0 :     if (IsDefunc())
     449         [ #  # ]:          0 :         pStateSet->AddState(AccessibleStateType::DEFUNC);
     450                 :            :     else
     451                 :            :     {
     452         [ #  # ]:          0 :         pStateSet->AddState(AccessibleStateType::ENABLED);
     453         [ #  # ]:          0 :         pStateSet->AddState(AccessibleStateType::OPAQUE);
     454 [ #  # ][ #  # ]:          0 :         if (isShowing())
     455         [ #  # ]:          0 :             pStateSet->AddState(AccessibleStateType::SHOWING);
     456 [ #  # ][ #  # ]:          0 :         if (isVisible())
     457         [ #  # ]:          0 :             pStateSet->AddState(AccessibleStateType::VISIBLE);
     458                 :            :     }
     459                 :            : 
     460 [ #  # ][ #  # ]:          0 :     return pStateSet;
                 [ #  # ]
     461                 :            : }
     462                 :            : 
     463                 :            :     ///=====  XServiceInfo  ====================================================
     464                 :            : 
     465                 :          0 : ::rtl::OUString SAL_CALL ScAccessibleDataPilotControl::getImplementationName(void)
     466                 :            :         throw (uno::RuntimeException)
     467                 :            : {
     468                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("ScAccessibleDataPilotControl"));
     469                 :            : }
     470                 :            : 
     471                 :            :     ///=====  XTypeProvider  ===================================================
     472                 :            : 
     473                 :            : namespace
     474                 :            : {
     475                 :            :     class theScAccessibleDataPilotControlImplementationId : public rtl::Static< UnoTunnelIdInit, theScAccessibleDataPilotControlImplementationId > {};
     476                 :            : }
     477                 :            : 
     478                 :          0 : uno::Sequence<sal_Int8> SAL_CALL ScAccessibleDataPilotControl::getImplementationId(void)
     479                 :            :         throw (uno::RuntimeException)
     480                 :            : {
     481                 :          0 :     return theScAccessibleDataPilotControlImplementationId::get().getSeq();
     482                 :            : }
     483                 :            : 
     484                 :            :     //=====  internal  ========================================================
     485                 :            : 
     486                 :          0 : ::rtl::OUString SAL_CALL ScAccessibleDataPilotControl::createAccessibleDescription(void)
     487                 :            :         throw (uno::RuntimeException)
     488                 :            : {
     489         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     490         [ #  # ]:          0 :     IsObjectValid();
     491         [ #  # ]:          0 :     if (mpDPFieldWindow)
     492 [ #  # ][ #  # ]:          0 :         return mpDPFieldWindow->GetDescription();
                 [ #  # ]
     493                 :            : 
     494         [ #  # ]:          0 :     return rtl::OUString();
     495                 :            : }
     496                 :            : 
     497                 :          0 : ::rtl::OUString SAL_CALL ScAccessibleDataPilotControl::createAccessibleName(void)
     498                 :            :         throw (uno::RuntimeException)
     499                 :            : {
     500         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     501         [ #  # ]:          0 :     IsObjectValid();
     502         [ #  # ]:          0 :     if (mpDPFieldWindow)
     503         [ #  # ]:          0 :         return mpDPFieldWindow->GetName();
     504                 :            : 
     505         [ #  # ]:          0 :     return rtl::OUString();
     506                 :            : }
     507                 :            : 
     508                 :          0 : Rectangle ScAccessibleDataPilotControl::GetBoundingBoxOnScreen(void) const
     509                 :            :         throw (uno::RuntimeException)
     510                 :            : {
     511         [ #  # ]:          0 :     if (mpDPFieldWindow)
     512                 :          0 :         return mpDPFieldWindow->GetWindowExtentsRelative(NULL);
     513                 :            :     else
     514                 :          0 :         return Rectangle();
     515                 :            : }
     516                 :            : 
     517                 :          0 : Rectangle ScAccessibleDataPilotControl::GetBoundingBox(void) const
     518                 :            :         throw (uno::RuntimeException)
     519                 :            : {
     520         [ #  # ]:          0 :     if (mpDPFieldWindow)
     521                 :          0 :         return mpDPFieldWindow->GetWindowExtentsRelative(mpDPFieldWindow->GetAccessibleParentWindow());
     522                 :            :     else
     523                 :          0 :         return Rectangle();
     524                 :            : }
     525                 :            : 
     526                 :            : 
     527                 :            : //===============================================================================
     528                 :            : 
     529                 :          0 : ScAccessibleDataPilotButton::ScAccessibleDataPilotButton(
     530                 :            :         const ::com::sun::star::uno::Reference<
     531                 :            :         ::com::sun::star::accessibility::XAccessible>& rxParent,
     532                 :            :         ScDPFieldControlBase* pDPFieldWindow,
     533                 :            :         sal_Int32 nIndex)
     534                 :            :     : ScAccessibleContextBase(rxParent, AccessibleRole::PUSH_BUTTON),
     535                 :            :     mpDPFieldWindow(pDPFieldWindow),
     536                 :          0 :     mnIndex(nIndex)
     537                 :            : {
     538                 :          0 : }
     539                 :            : 
     540                 :          0 : ScAccessibleDataPilotButton::~ScAccessibleDataPilotButton(void)
     541                 :            : {
     542 [ #  # ][ #  # ]:          0 :     if (!IsDefunc() && !rBHelper.bInDispose)
                 [ #  # ]
     543                 :            :     {
     544                 :            :         // increment refcount to prevent double call off dtor
     545         [ #  # ]:          0 :         osl_incrementInterlockedCount( &m_refCount );
     546                 :            :         // call dispose to inform object wich have a weak reference to this object
     547         [ #  # ]:          0 :         dispose();
     548                 :            :     }
     549         [ #  # ]:          0 : }
     550                 :            : 
     551                 :          0 : void ScAccessibleDataPilotButton::Init()
     552                 :            : {
     553                 :          0 : }
     554                 :            : 
     555                 :          0 : void SAL_CALL ScAccessibleDataPilotButton::disposing()
     556                 :            : {
     557         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     558                 :          0 :     mpDPFieldWindow = NULL;
     559                 :            : 
     560 [ #  # ][ #  # ]:          0 :     ScAccessibleContextBase::disposing();
     561                 :          0 : }
     562                 :            : 
     563                 :          0 : void ScAccessibleDataPilotButton::SetFocused()
     564                 :            : {
     565                 :          0 :     CommitFocusGained();
     566                 :          0 : }
     567                 :            : 
     568                 :          0 : void ScAccessibleDataPilotButton::ResetFocused()
     569                 :            : {
     570                 :          0 :     CommitFocusLost();
     571                 :          0 : }
     572                 :            : 
     573                 :            :     ///=====  XAccessibleComponent  ============================================
     574                 :            : 
     575                 :          0 : uno::Reference< XAccessible > SAL_CALL ScAccessibleDataPilotButton::getAccessibleAtPoint(
     576                 :            :         const ::com::sun::star::awt::Point& /* rPoint */ )
     577                 :            :         throw (::com::sun::star::uno::RuntimeException)
     578                 :            : {
     579                 :          0 :     return NULL;
     580                 :            : }
     581                 :            : 
     582                 :          0 : sal_Bool SAL_CALL ScAccessibleDataPilotButton::isVisible(  )
     583                 :            :         throw (::com::sun::star::uno::RuntimeException)
     584                 :            : {
     585                 :          0 :     return sal_True;
     586                 :            : }
     587                 :            : 
     588                 :          0 : void SAL_CALL ScAccessibleDataPilotButton::grabFocus(  )
     589                 :            :         throw (::com::sun::star::uno::RuntimeException)
     590                 :            : {
     591         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     592         [ #  # ]:          0 :     IsObjectValid();
     593         [ #  # ]:          0 :     if (mpDPFieldWindow)
     594                 :            :     {
     595 [ #  # ][ #  # ]:          0 :         mpDPFieldWindow->GrabFocusWithSel(getAccessibleIndexInParent());
     596         [ #  # ]:          0 :     }
     597                 :          0 : }
     598                 :            : 
     599                 :          0 : sal_Int32 SAL_CALL ScAccessibleDataPilotButton::getForeground(  )
     600                 :            : throw (uno::RuntimeException)
     601                 :            : {
     602         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     603         [ #  # ]:          0 :     IsObjectValid();
     604                 :          0 :     sal_Int32 nColor(0);
     605         [ #  # ]:          0 :     if (mpDPFieldWindow)
     606                 :            :     {
     607                 :          0 :         nColor = mpDPFieldWindow->GetSettings().GetStyleSettings().GetButtonTextColor().GetColor();
     608                 :            :     }
     609         [ #  # ]:          0 :     return nColor;
     610                 :            : }
     611                 :            : 
     612                 :          0 : sal_Int32 SAL_CALL ScAccessibleDataPilotButton::getBackground(  )
     613                 :            : throw (uno::RuntimeException)
     614                 :            : {
     615         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     616         [ #  # ]:          0 :     IsObjectValid();
     617                 :          0 :     sal_Int32 nColor(0);
     618         [ #  # ]:          0 :     if (mpDPFieldWindow)
     619                 :            :     {
     620                 :          0 :         nColor = mpDPFieldWindow->GetSettings().GetStyleSettings().GetFaceColor().GetColor();
     621                 :            :     }
     622         [ #  # ]:          0 :     return nColor;
     623                 :            : }
     624                 :            : 
     625                 :            :     ///=====  XAccessibleContext  ==============================================
     626                 :            : 
     627                 :          0 : sal_Int32 SAL_CALL ScAccessibleDataPilotButton::getAccessibleChildCount(void)
     628                 :            :     throw (::com::sun::star::uno::RuntimeException)
     629                 :            : {
     630                 :          0 :     return 0;
     631                 :            : }
     632                 :            : 
     633                 :          0 : uno::Reference< XAccessible> SAL_CALL ScAccessibleDataPilotButton::getAccessibleChild(sal_Int32 /* nIndex */)
     634                 :            :         throw (::com::sun::star::uno::RuntimeException,
     635                 :            :                 ::com::sun::star::lang::IndexOutOfBoundsException)
     636                 :            : {
     637         [ #  # ]:          0 :     throw lang::IndexOutOfBoundsException();
     638                 :            : }
     639                 :            : 
     640                 :          0 : sal_Int32 SAL_CALL ScAccessibleDataPilotButton::getAccessibleIndexInParent(void)
     641                 :            :         throw (::com::sun::star::uno::RuntimeException)
     642                 :            : {
     643         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     644         [ #  # ]:          0 :     IsObjectValid();
     645         [ #  # ]:          0 :     return mnIndex;
     646                 :            : }
     647                 :            : 
     648                 :          0 : uno::Reference<XAccessibleStateSet> SAL_CALL ScAccessibleDataPilotButton::getAccessibleStateSet(void)
     649                 :            :         throw (::com::sun::star::uno::RuntimeException)
     650                 :            : {
     651         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     652         [ #  # ]:          0 :     IsObjectValid();
     653                 :            : 
     654         [ #  # ]:          0 :     utl::AccessibleStateSetHelper* pStateSet = new utl::AccessibleStateSetHelper();
     655                 :            : 
     656         [ #  # ]:          0 :     if (IsDefunc())
     657         [ #  # ]:          0 :         pStateSet->AddState(AccessibleStateType::DEFUNC);
     658                 :            :     else
     659                 :            :     {
     660         [ #  # ]:          0 :         pStateSet->AddState(AccessibleStateType::ENABLED);
     661         [ #  # ]:          0 :         pStateSet->AddState(AccessibleStateType::OPAQUE);
     662         [ #  # ]:          0 :         pStateSet->AddState(AccessibleStateType::FOCUSABLE);
     663 [ #  # ][ #  # ]:          0 :         if (mpDPFieldWindow && (sal::static_int_cast<sal_Int32>(mpDPFieldWindow->GetSelectedField()) == mnIndex))
         [ #  # ][ #  # ]
     664         [ #  # ]:          0 :             pStateSet->AddState(AccessibleStateType::FOCUSED);
     665 [ #  # ][ #  # ]:          0 :         if (isShowing())
     666         [ #  # ]:          0 :             pStateSet->AddState(AccessibleStateType::SHOWING);
     667 [ #  # ][ #  # ]:          0 :         if (isVisible())
     668         [ #  # ]:          0 :             pStateSet->AddState(AccessibleStateType::VISIBLE);
     669                 :            :     }
     670                 :            : 
     671 [ #  # ][ #  # ]:          0 :     return pStateSet;
                 [ #  # ]
     672                 :            : }
     673                 :            : 
     674                 :            :     ///=====  XServiceInfo  ====================================================
     675                 :            : 
     676                 :          0 : ::rtl::OUString SAL_CALL ScAccessibleDataPilotButton::getImplementationName(void)
     677                 :            :         throw (::com::sun::star::uno::RuntimeException)
     678                 :            : {
     679                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("ScAccessibleDataPilotButton"));
     680                 :            : }
     681                 :            : 
     682                 :            :     ///=====  XTypeProvider  ===================================================
     683                 :            : 
     684                 :            : namespace
     685                 :            : {
     686                 :            :     class theScAccessibleDataPilotButtonImplementationId : public rtl::Static< UnoTunnelIdInit, theScAccessibleDataPilotButtonImplementationId > {};
     687                 :            : }
     688                 :            : 
     689                 :          0 : uno::Sequence<sal_Int8> SAL_CALL ScAccessibleDataPilotButton::getImplementationId(void)
     690                 :            :         throw (::com::sun::star::uno::RuntimeException)
     691                 :            : {
     692                 :          0 :     return theScAccessibleDataPilotButtonImplementationId::get().getSeq();
     693                 :            : }
     694                 :            : 
     695                 :          0 : ::rtl::OUString SAL_CALL ScAccessibleDataPilotButton::createAccessibleDescription(void)
     696                 :            :         throw (::com::sun::star::uno::RuntimeException)
     697                 :            : {
     698                 :          0 :     return rtl::OUString();
     699                 :            : }
     700                 :            : 
     701                 :          0 : ::rtl::OUString SAL_CALL ScAccessibleDataPilotButton::createAccessibleName(void)
     702                 :            :         throw (::com::sun::star::uno::RuntimeException)
     703                 :            : {
     704         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     705         [ #  # ]:          0 :     IsObjectValid();
     706         [ #  # ]:          0 :     if (mpDPFieldWindow)
     707 [ #  # ][ #  # ]:          0 :         return mpDPFieldWindow->GetFieldText(getAccessibleIndexInParent());
     708                 :            : 
     709         [ #  # ]:          0 :     return rtl::OUString();
     710                 :            : }
     711                 :            : 
     712                 :          0 : Rectangle ScAccessibleDataPilotButton::GetBoundingBoxOnScreen(void) const
     713                 :            :         throw (::com::sun::star::uno::RuntimeException)
     714                 :            : {
     715                 :          0 :     Rectangle aRect(GetBoundingBox());
     716                 :            : 
     717         [ #  # ]:          0 :     if (mpDPFieldWindow)
     718                 :            :     {
     719         [ #  # ]:          0 :         Point aParentPos(mpDPFieldWindow->GetWindowExtentsRelative(NULL).TopLeft());
     720         [ #  # ]:          0 :         aRect.Move(aParentPos.getX(), aParentPos.getY());
     721                 :            :     }
     722                 :            : 
     723                 :          0 :     return aRect;
     724                 :            : }
     725                 :            : 
     726                 :          0 : Rectangle ScAccessibleDataPilotButton::GetBoundingBox(void) const
     727                 :            :         throw (::com::sun::star::uno::RuntimeException)
     728                 :            : {
     729         [ #  # ]:          0 :     if (mpDPFieldWindow)
     730 [ #  # ][ #  # ]:          0 :         return Rectangle (mpDPFieldWindow->GetFieldPosition(const_cast<ScAccessibleDataPilotButton*> (this)->getAccessibleIndexInParent()), mpDPFieldWindow->GetFieldSize());
                 [ #  # ]
     731                 :            :     else
     732                 :          0 :         return Rectangle();
     733                 :            : }
     734                 :            : 
     735                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10