LCOV - code coverage report
Current view: top level - accessibility/source/standard - vclxaccessiblestatusbaritem.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 126 250 50.4 %
Date: 2012-08-25 Functions: 23 48 47.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 113 410 27.6 %

           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 <accessibility/standard/vclxaccessiblestatusbaritem.hxx>
      30                 :            : #include <toolkit/helper/externallock.hxx>
      31                 :            : #include <toolkit/helper/convert.hxx>
      32                 :            : #include <accessibility/helper/characterattributeshelper.hxx>
      33                 :            : 
      34                 :            : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      35                 :            : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      36                 :            : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      37                 :            : #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
      38                 :            : #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
      39                 :            : 
      40                 :            : #include <unotools/accessiblestatesethelper.hxx>
      41                 :            : #include <unotools/accessiblerelationsethelper.hxx>
      42                 :            : #include <vcl/svapp.hxx>
      43                 :            : #include <vcl/unohelp2.hxx>
      44                 :            : #include <vcl/status.hxx>
      45                 :            : #include <vcl/controllayout.hxx>
      46                 :            : 
      47                 :            : #include <memory>
      48                 :            : 
      49                 :            : 
      50                 :            : using namespace ::com::sun::star::accessibility;
      51                 :            : using namespace ::com::sun::star::uno;
      52                 :            : using namespace ::com::sun::star::lang;
      53                 :            : using namespace ::com::sun::star::beans;
      54                 :            : using namespace ::com::sun::star;
      55                 :            : using namespace ::comphelper;
      56                 :            : 
      57                 :            : 
      58                 :            : // -----------------------------------------------------------------------------
      59                 :            : // class VCLXAccessibleStatusBarItem
      60                 :            : // -----------------------------------------------------------------------------
      61                 :            : 
      62                 :          4 : VCLXAccessibleStatusBarItem::VCLXAccessibleStatusBarItem( StatusBar* pStatusBar, sal_uInt16 nItemId )
      63                 :          0 :     :AccessibleTextHelper_BASE( new VCLExternalSolarLock() )
      64                 :            :     ,m_pStatusBar( pStatusBar )
      65         [ +  - ]:          4 :     ,m_nItemId( nItemId )
      66                 :            : {
      67         [ +  - ]:          4 :     m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() );
      68                 :            : 
      69         [ +  - ]:          4 :     m_sItemName = GetItemName();
      70         [ +  - ]:          4 :     m_sItemText = GetItemText();
      71         [ +  - ]:          4 :     m_bShowing  = IsShowing();
      72                 :          4 : }
      73                 :            : 
      74                 :            : // -----------------------------------------------------------------------------
      75                 :            : 
      76                 :          4 : VCLXAccessibleStatusBarItem::~VCLXAccessibleStatusBarItem()
      77                 :            : {
      78 [ +  - ][ +  - ]:          4 :     delete m_pExternalLock;
      79                 :          4 :     m_pExternalLock = NULL;
      80         [ -  + ]:          8 : }
      81                 :            : 
      82                 :            : // -----------------------------------------------------------------------------
      83                 :            : 
      84                 :          4 : sal_Bool VCLXAccessibleStatusBarItem::IsShowing()
      85                 :            : {
      86                 :          4 :     sal_Bool bShowing = sal_False;
      87                 :            : 
      88         [ +  - ]:          4 :     if ( m_pStatusBar )
      89                 :          4 :         bShowing = m_pStatusBar->IsItemVisible( m_nItemId );
      90                 :            : 
      91                 :          4 :     return bShowing;
      92                 :            : }
      93                 :            : 
      94                 :            : // -----------------------------------------------------------------------------
      95                 :            : 
      96                 :          0 : void VCLXAccessibleStatusBarItem::SetShowing( sal_Bool bShowing )
      97                 :            : {
      98         [ #  # ]:          0 :     if ( m_bShowing != bShowing )
      99                 :            :     {
     100                 :          0 :         Any aOldValue, aNewValue;
     101         [ #  # ]:          0 :         if ( m_bShowing )
     102         [ #  # ]:          0 :             aOldValue <<= AccessibleStateType::SHOWING;
     103                 :            :         else
     104         [ #  # ]:          0 :             aNewValue <<= AccessibleStateType::SHOWING;
     105                 :          0 :         m_bShowing = bShowing;
     106         [ #  # ]:          0 :         NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
     107                 :            :     }
     108                 :          0 : }
     109                 :            : 
     110                 :            : // -----------------------------------------------------------------------------
     111                 :            : 
     112                 :          0 : void VCLXAccessibleStatusBarItem::SetItemName( const ::rtl::OUString& sItemName )
     113                 :            : {
     114         [ #  # ]:          0 :     if ( !m_sItemName.equals( sItemName ) )
     115                 :            :     {
     116                 :          0 :         Any aOldValue, aNewValue;
     117         [ #  # ]:          0 :         aOldValue <<= m_sItemName;
     118         [ #  # ]:          0 :         aNewValue <<= sItemName;
     119                 :          0 :         m_sItemName = sItemName;
     120         [ #  # ]:          0 :         NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue );
     121                 :            :     }
     122                 :          0 : }
     123                 :            : 
     124                 :            : // -----------------------------------------------------------------------------
     125                 :            : 
     126                 :          4 : ::rtl::OUString VCLXAccessibleStatusBarItem::GetItemName()
     127                 :            : {
     128                 :          4 :     ::rtl::OUString sName;
     129         [ +  - ]:          4 :     if ( m_pStatusBar )
     130 [ +  - ][ +  - ]:          4 :         sName = m_pStatusBar->GetAccessibleName( m_nItemId );
     131                 :            : 
     132                 :          4 :     return sName;
     133                 :            : }
     134                 :            : 
     135                 :            : // -----------------------------------------------------------------------------
     136                 :            : 
     137                 :          0 : void VCLXAccessibleStatusBarItem::SetItemText( const ::rtl::OUString& sItemText )
     138                 :            : {
     139                 :          0 :     Any aOldValue, aNewValue;
     140 [ #  # ][ #  # ]:          0 :     if ( implInitTextChangedEvent( m_sItemText, sItemText, aOldValue, aNewValue ) )
     141                 :            :     {
     142                 :          0 :         m_sItemText = sItemText;
     143         [ #  # ]:          0 :         NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue );
     144                 :          0 :     }
     145                 :          0 : }
     146                 :            : 
     147                 :            : // -----------------------------------------------------------------------------
     148                 :            : 
     149                 :        144 : ::rtl::OUString VCLXAccessibleStatusBarItem::GetItemText()
     150                 :            : {
     151                 :        144 :     ::rtl::OUString sText;
     152         [ +  - ]:        144 :     ::vcl::ControlLayoutData aLayoutData;
     153         [ +  - ]:        144 :     if ( m_pStatusBar )
     154                 :            :     {
     155         [ +  - ]:        144 :         Rectangle aItemRect = m_pStatusBar->GetItemRect( m_nItemId );
     156         [ +  - ]:        144 :         m_pStatusBar->RecordLayoutData( &aLayoutData, aItemRect );
     157         [ +  - ]:        144 :         sText = aLayoutData.m_aDisplayText;
     158                 :            :     }
     159                 :            : 
     160         [ +  - ]:        144 :     return sText;
     161                 :            : }
     162                 :            : 
     163                 :            : // -----------------------------------------------------------------------------
     164                 :            : 
     165                 :          0 : void VCLXAccessibleStatusBarItem::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
     166                 :            : {
     167                 :          0 :     rStateSet.AddState( AccessibleStateType::ENABLED );
     168                 :          0 :     rStateSet.AddState( AccessibleStateType::SENSITIVE );
     169                 :            : 
     170                 :          0 :     rStateSet.AddState( AccessibleStateType::VISIBLE );
     171                 :            : 
     172         [ #  # ]:          0 :     if ( IsShowing() )
     173                 :          0 :         rStateSet.AddState( AccessibleStateType::SHOWING );
     174                 :          0 : }
     175                 :            : 
     176                 :            : // -----------------------------------------------------------------------------
     177                 :            : // OCommonAccessibleComponent
     178                 :            : // -----------------------------------------------------------------------------
     179                 :            : 
     180                 :          2 : awt::Rectangle VCLXAccessibleStatusBarItem::implGetBounds() throw (RuntimeException)
     181                 :            : {
     182                 :          2 :     awt::Rectangle aBounds( 0, 0, 0, 0 );
     183                 :            : 
     184         [ +  - ]:          2 :     if ( m_pStatusBar )
     185         [ +  - ]:          2 :         aBounds = AWTRectangle( m_pStatusBar->GetItemRect( m_nItemId ) );
     186                 :            : 
     187                 :          2 :     return aBounds;
     188                 :            : }
     189                 :            : 
     190                 :            : // -----------------------------------------------------------------------------
     191                 :            : // OCommonAccessibleText
     192                 :            : // -----------------------------------------------------------------------------
     193                 :            : 
     194                 :        138 : ::rtl::OUString VCLXAccessibleStatusBarItem::implGetText()
     195                 :            : {
     196                 :        138 :     return GetItemText();
     197                 :            : }
     198                 :            : 
     199                 :            : // -----------------------------------------------------------------------------
     200                 :            : 
     201                 :          0 : lang::Locale VCLXAccessibleStatusBarItem::implGetLocale()
     202                 :            : {
     203                 :          0 :     return Application::GetSettings().GetLocale();
     204                 :            : }
     205                 :            : 
     206                 :            : // -----------------------------------------------------------------------------
     207                 :            : 
     208                 :          0 : void VCLXAccessibleStatusBarItem::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
     209                 :            : {
     210                 :          0 :     nStartIndex = 0;
     211                 :          0 :     nEndIndex = 0;
     212                 :          0 : }
     213                 :            : 
     214                 :            : // -----------------------------------------------------------------------------
     215                 :            : // XInterface
     216                 :            : // -----------------------------------------------------------------------------
     217                 :            : 
     218 [ +  + ][ +  - ]:        192 : IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleStatusBarItem, AccessibleTextHelper_BASE, VCLXAccessibleStatusBarItem_BASE )
     219                 :            : 
     220                 :            : // -----------------------------------------------------------------------------
     221                 :            : // XTypeProvider
     222                 :            : // -----------------------------------------------------------------------------
     223                 :            : 
     224 [ #  # ][ #  # ]:          0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleStatusBarItem, AccessibleTextHelper_BASE, VCLXAccessibleStatusBarItem_BASE )
                 [ #  # ]
     225                 :            : 
     226                 :            : // -----------------------------------------------------------------------------
     227                 :            : // XComponent
     228                 :            : // -----------------------------------------------------------------------------
     229                 :            : 
     230                 :          4 : void VCLXAccessibleStatusBarItem::disposing()
     231                 :            : {
     232                 :          4 :     AccessibleTextHelper_BASE::disposing();
     233                 :            : 
     234                 :          4 :     m_pStatusBar = NULL;
     235                 :          4 :     m_sItemName = ::rtl::OUString();
     236                 :          4 :     m_sItemText = ::rtl::OUString();
     237                 :          4 : }
     238                 :            : 
     239                 :            : // -----------------------------------------------------------------------------
     240                 :            : // XServiceInfo
     241                 :            : // -----------------------------------------------------------------------------
     242                 :            : 
     243                 :          2 : ::rtl::OUString VCLXAccessibleStatusBarItem::getImplementationName() throw (RuntimeException)
     244                 :            : {
     245                 :          2 :     return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.AccessibleStatusBarItem" ));
     246                 :            : }
     247                 :            : 
     248                 :            : // -----------------------------------------------------------------------------
     249                 :            : 
     250                 :          0 : sal_Bool VCLXAccessibleStatusBarItem::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
     251                 :            : {
     252         [ #  # ]:          0 :     Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
     253                 :          0 :     const ::rtl::OUString* pNames = aNames.getConstArray();
     254                 :          0 :     const ::rtl::OUString* pEnd = pNames + aNames.getLength();
     255 [ #  # ][ #  # ]:          0 :     for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
                 [ #  # ]
     256                 :            :         ;
     257                 :            : 
     258         [ #  # ]:          0 :     return pNames != pEnd;
     259                 :            : }
     260                 :            : 
     261                 :            : // -----------------------------------------------------------------------------
     262                 :            : 
     263                 :          0 : Sequence< ::rtl::OUString > VCLXAccessibleStatusBarItem::getSupportedServiceNames() throw (RuntimeException)
     264                 :            : {
     265                 :          0 :     Sequence< ::rtl::OUString > aNames(1);
     266 [ #  # ][ #  # ]:          0 :     aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.AccessibleStatusBarItem" ));
     267                 :          0 :     return aNames;
     268                 :            : }
     269                 :            : 
     270                 :            : // -----------------------------------------------------------------------------
     271                 :            : // XAccessible
     272                 :            : // -----------------------------------------------------------------------------
     273                 :            : 
     274                 :          0 : Reference< XAccessibleContext > VCLXAccessibleStatusBarItem::getAccessibleContext(  ) throw (RuntimeException)
     275                 :            : {
     276         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     277                 :            : 
     278 [ #  # ][ #  # ]:          0 :     return this;
     279                 :            : }
     280                 :            : 
     281                 :            : // -----------------------------------------------------------------------------
     282                 :            : // XAccessibleContext
     283                 :            : // -----------------------------------------------------------------------------
     284                 :            : 
     285                 :          0 : sal_Int32 VCLXAccessibleStatusBarItem::getAccessibleChildCount() throw (RuntimeException)
     286                 :            : {
     287         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     288                 :            : 
     289         [ #  # ]:          0 :     return 0;
     290                 :            : }
     291                 :            : 
     292                 :            : // -----------------------------------------------------------------------------
     293                 :            : 
     294                 :          0 : Reference< XAccessible > VCLXAccessibleStatusBarItem::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
     295                 :            : {
     296         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     297                 :            : 
     298 [ #  # ][ #  # ]:          0 :     if ( i < 0 || i >= getAccessibleChildCount() )
         [ #  # ][ #  # ]
     299         [ #  # ]:          0 :         throw IndexOutOfBoundsException();
     300                 :            : 
     301         [ #  # ]:          0 :     return Reference< XAccessible >();
     302                 :            : }
     303                 :            : 
     304                 :            : // -----------------------------------------------------------------------------
     305                 :            : 
     306                 :          6 : Reference< XAccessible > VCLXAccessibleStatusBarItem::getAccessibleParent(  ) throw (RuntimeException)
     307                 :            : {
     308         [ +  - ]:          6 :     OExternalLockGuard aGuard( this );
     309                 :            : 
     310                 :          6 :     Reference< XAccessible > xParent;
     311         [ +  - ]:          6 :     if ( m_pStatusBar )
     312 [ +  - ][ +  - ]:          6 :         xParent = m_pStatusBar->GetAccessible();
     313                 :            : 
     314         [ +  - ]:          6 :     return xParent;
     315                 :            : }
     316                 :            : 
     317                 :            : // -----------------------------------------------------------------------------
     318                 :            : 
     319                 :          0 : sal_Int32 VCLXAccessibleStatusBarItem::getAccessibleIndexInParent(  ) throw (RuntimeException)
     320                 :            : {
     321         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     322                 :            : 
     323                 :          0 :     sal_Int32 nIndexInParent = -1;
     324         [ #  # ]:          0 :     if ( m_pStatusBar )
     325         [ #  # ]:          0 :         nIndexInParent = m_pStatusBar->GetItemPos( m_nItemId );
     326                 :            : 
     327         [ #  # ]:          0 :     return nIndexInParent;
     328                 :            : }
     329                 :            : 
     330                 :            : // -----------------------------------------------------------------------------
     331                 :            : 
     332                 :          0 : sal_Int16 VCLXAccessibleStatusBarItem::getAccessibleRole(  ) throw (RuntimeException)
     333                 :            : {
     334         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     335                 :            : 
     336         [ #  # ]:          0 :     return AccessibleRole::LABEL;
     337                 :            : }
     338                 :            : 
     339                 :            : // -----------------------------------------------------------------------------
     340                 :            : 
     341                 :          0 : ::rtl::OUString VCLXAccessibleStatusBarItem::getAccessibleDescription(  ) throw (RuntimeException)
     342                 :            : {
     343         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     344                 :            : 
     345                 :          0 :     ::rtl::OUString sDescription;
     346         [ #  # ]:          0 :     if ( m_pStatusBar )
     347 [ #  # ][ #  # ]:          0 :         sDescription = m_pStatusBar->GetHelpText( m_nItemId );
     348                 :            : 
     349         [ #  # ]:          0 :     return sDescription;
     350                 :            : }
     351                 :            : 
     352                 :            : // -----------------------------------------------------------------------------
     353                 :            : 
     354                 :          0 : ::rtl::OUString VCLXAccessibleStatusBarItem::getAccessibleName(  ) throw (RuntimeException)
     355                 :            : {
     356         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     357                 :            : 
     358 [ #  # ][ #  # ]:          0 :     return GetItemName();
     359                 :            : }
     360                 :            : 
     361                 :            : // -----------------------------------------------------------------------------
     362                 :            : 
     363                 :          0 : Reference< XAccessibleRelationSet > VCLXAccessibleStatusBarItem::getAccessibleRelationSet(  ) throw (RuntimeException)
     364                 :            : {
     365         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     366                 :            : 
     367         [ #  # ]:          0 :     utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
     368 [ #  # ][ #  # ]:          0 :     Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
     369         [ #  # ]:          0 :     return xSet;
     370                 :            : }
     371                 :            : 
     372                 :            : // -----------------------------------------------------------------------------
     373                 :            : 
     374                 :          0 : Reference< XAccessibleStateSet > VCLXAccessibleStatusBarItem::getAccessibleStateSet(  ) throw (RuntimeException)
     375                 :            : {
     376         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     377                 :            : 
     378         [ #  # ]:          0 :     utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
     379 [ #  # ][ #  # ]:          0 :     Reference< XAccessibleStateSet > xSet = pStateSetHelper;
     380                 :            : 
     381 [ #  # ][ #  # ]:          0 :     if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
     382                 :            :     {
     383         [ #  # ]:          0 :         FillAccessibleStateSet( *pStateSetHelper );
     384                 :            :     }
     385                 :            :     else
     386                 :            :     {
     387         [ #  # ]:          0 :         pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
     388                 :            :     }
     389                 :            : 
     390         [ #  # ]:          0 :     return xSet;
     391                 :            : }
     392                 :            : 
     393                 :            : // -----------------------------------------------------------------------------
     394                 :            : 
     395                 :          0 : Locale VCLXAccessibleStatusBarItem::getLocale(  ) throw (IllegalAccessibleComponentStateException, RuntimeException)
     396                 :            : {
     397         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     398                 :            : 
     399 [ #  # ][ #  # ]:          0 :     return Application::GetSettings().GetLocale();
                 [ #  # ]
     400                 :            : }
     401                 :            : 
     402                 :            : // -----------------------------------------------------------------------------
     403                 :            : // XAccessibleComponent
     404                 :            : // -----------------------------------------------------------------------------
     405                 :            : 
     406                 :          0 : Reference< XAccessible > VCLXAccessibleStatusBarItem::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException)
     407                 :            : {
     408         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     409                 :            : 
     410         [ #  # ]:          0 :     return Reference< XAccessible >();
     411                 :            : }
     412                 :            : 
     413                 :            : // -----------------------------------------------------------------------------
     414                 :            : 
     415                 :          0 : void VCLXAccessibleStatusBarItem::grabFocus(  ) throw (RuntimeException)
     416                 :            : {
     417                 :            :     // no focus for status bar items
     418                 :          0 : }
     419                 :            : 
     420                 :            : // -----------------------------------------------------------------------------
     421                 :            : 
     422                 :          2 : sal_Int32 VCLXAccessibleStatusBarItem::getForeground(   ) throw (RuntimeException)
     423                 :            : {
     424         [ +  - ]:          2 :     OExternalLockGuard aGuard( this );
     425                 :            : 
     426                 :          2 :     sal_Int32 nColor = 0;
     427         [ +  - ]:          2 :     Reference< XAccessible > xParent = getAccessibleParent();
     428         [ +  - ]:          2 :     if ( xParent.is() )
     429                 :            :     {
     430 [ +  - ][ +  - ]:          2 :         Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
                 [ +  - ]
     431         [ +  - ]:          2 :         if ( xParentComp.is() )
     432 [ +  - ][ +  - ]:          2 :             nColor = xParentComp->getForeground();
     433                 :            :     }
     434                 :            : 
     435         [ +  - ]:          2 :     return nColor;
     436                 :            : }
     437                 :            : 
     438                 :            : // -----------------------------------------------------------------------------
     439                 :            : 
     440                 :          2 : sal_Int32 VCLXAccessibleStatusBarItem::getBackground(  ) throw (RuntimeException)
     441                 :            : {
     442         [ +  - ]:          2 :     OExternalLockGuard aGuard( this );
     443                 :            : 
     444                 :          2 :     sal_Int32 nColor = 0;
     445         [ +  - ]:          2 :     Reference< XAccessible > xParent = getAccessibleParent();
     446         [ +  - ]:          2 :     if ( xParent.is() )
     447                 :            :     {
     448 [ +  - ][ +  - ]:          2 :         Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
                 [ +  - ]
     449         [ +  - ]:          2 :         if ( xParentComp.is() )
     450 [ +  - ][ +  - ]:          2 :             nColor = xParentComp->getBackground();
     451                 :            :     }
     452                 :            : 
     453         [ +  - ]:          2 :     return nColor;
     454                 :            : }
     455                 :            : 
     456                 :            : // -----------------------------------------------------------------------------
     457                 :            : // XAccessibleExtendedComponent
     458                 :            : // -----------------------------------------------------------------------------
     459                 :            : 
     460                 :          2 : Reference< awt::XFont > VCLXAccessibleStatusBarItem::getFont(  ) throw (RuntimeException)
     461                 :            : {
     462         [ +  - ]:          2 :     OExternalLockGuard aGuard( this );
     463                 :            : 
     464                 :          2 :     Reference< awt::XFont > xFont;
     465         [ +  - ]:          2 :     Reference< XAccessible > xParent = getAccessibleParent();
     466         [ +  - ]:          2 :     if ( xParent.is() )
     467                 :            :     {
     468 [ +  - ][ +  - ]:          2 :         Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
                 [ +  - ]
     469         [ +  - ]:          2 :         if ( xParentComp.is() )
     470 [ +  - ][ +  - ]:          2 :             xFont = xParentComp->getFont();
                 [ +  - ]
     471                 :            :     }
     472                 :            : 
     473         [ +  - ]:          2 :     return xFont;
     474                 :            : }
     475                 :            : 
     476                 :            : // -----------------------------------------------------------------------------
     477                 :            : 
     478                 :          2 : ::rtl::OUString VCLXAccessibleStatusBarItem::getTitledBorderText(  ) throw (RuntimeException)
     479                 :            : {
     480         [ +  - ]:          2 :     OExternalLockGuard aGuard( this );
     481                 :            : 
     482 [ +  - ][ +  - ]:          2 :     return GetItemText();
     483                 :            : }
     484                 :            : 
     485                 :            : // -----------------------------------------------------------------------------
     486                 :            : 
     487                 :          2 : ::rtl::OUString VCLXAccessibleStatusBarItem::getToolTipText(  ) throw (RuntimeException)
     488                 :            : {
     489         [ +  - ]:          2 :     OExternalLockGuard aGuard( this );
     490                 :            : 
     491         [ +  - ]:          2 :     return ::rtl::OUString();
     492                 :            : }
     493                 :            : 
     494                 :            : // -----------------------------------------------------------------------------
     495                 :            : // XAccessibleText
     496                 :            : // -----------------------------------------------------------------------------
     497                 :            : 
     498                 :          0 : sal_Int32 VCLXAccessibleStatusBarItem::getCaretPosition() throw (RuntimeException)
     499                 :            : {
     500         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     501                 :            : 
     502         [ #  # ]:          0 :     return -1;
     503                 :            : }
     504                 :            : 
     505                 :            : // -----------------------------------------------------------------------------
     506                 :            : 
     507                 :          6 : sal_Bool VCLXAccessibleStatusBarItem::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     508                 :            : {
     509         [ +  - ]:          6 :     OExternalLockGuard aGuard( this );
     510                 :            : 
     511 [ +  - ][ +  - ]:          6 :     if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
                 [ +  + ]
     512         [ +  - ]:          4 :         throw IndexOutOfBoundsException();
     513                 :            : 
     514         [ +  - ]:          6 :     return sal_False;
     515                 :            : }
     516                 :            : 
     517                 :            : // -----------------------------------------------------------------------------
     518                 :            : 
     519                 :          6 : Sequence< PropertyValue > VCLXAccessibleStatusBarItem::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException)
     520                 :            : {
     521         [ +  - ]:          6 :     OExternalLockGuard aGuard( this );
     522                 :            : 
     523         [ +  - ]:          6 :     Sequence< PropertyValue > aValues;
     524         [ +  - ]:          6 :     ::rtl::OUString sText( implGetText() );
     525                 :            : 
     526 [ +  - ][ +  + ]:          6 :     if ( !implIsValidIndex( nIndex, sText.getLength() ) )
     527         [ +  - ]:          4 :         throw IndexOutOfBoundsException();
     528                 :            : 
     529         [ +  - ]:          2 :     if ( m_pStatusBar )
     530                 :            :     {
     531         [ +  - ]:          2 :         Font aFont = m_pStatusBar->GetFont();
     532         [ +  - ]:          2 :         sal_Int32 nBackColor = getBackground();
     533         [ +  - ]:          2 :         sal_Int32 nColor = getForeground();
     534 [ +  - ][ +  - ]:          2 :         ::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) );
     535 [ +  - ][ +  - ]:          2 :         aValues = pHelper->GetCharacterAttributes( aRequestedAttributes );
         [ +  - ][ +  - ]
                 [ +  - ]
     536                 :            :     }
     537                 :            : 
     538         [ +  - ]:          6 :     return aValues;
     539                 :            : }
     540                 :            : 
     541                 :            : // -----------------------------------------------------------------------------
     542                 :            : 
     543                 :         32 : awt::Rectangle VCLXAccessibleStatusBarItem::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     544                 :            : {
     545         [ +  - ]:         32 :     OExternalLockGuard aGuard( this );
     546                 :            : 
     547 [ +  - ][ +  - ]:         32 :     if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
                 [ +  + ]
     548         [ +  - ]:          4 :         throw IndexOutOfBoundsException();
     549                 :            : 
     550                 :         28 :     awt::Rectangle aBounds( 0, 0, 0, 0 );
     551         [ +  - ]:         28 :     if ( m_pStatusBar )
     552                 :            :     {
     553         [ +  - ]:         28 :         ::vcl::ControlLayoutData aLayoutData;
     554         [ +  - ]:         28 :         Rectangle aItemRect = m_pStatusBar->GetItemRect( m_nItemId );
     555         [ +  - ]:         28 :         m_pStatusBar->RecordLayoutData( &aLayoutData, aItemRect );
     556         [ +  - ]:         28 :         Rectangle aCharRect = aLayoutData.GetCharacterBounds( nIndex );
     557         [ +  - ]:         28 :         aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() );
     558 [ +  - ][ +  - ]:         28 :         aBounds = AWTRectangle( aCharRect );
     559                 :            :     }
     560                 :            : 
     561         [ +  - ]:         32 :     return aBounds;
     562                 :            : }
     563                 :            : 
     564                 :            : // -----------------------------------------------------------------------------
     565                 :            : 
     566                 :         30 : sal_Int32 VCLXAccessibleStatusBarItem::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
     567                 :            : {
     568         [ +  - ]:         30 :     OExternalLockGuard aGuard( this );
     569                 :            : 
     570                 :         30 :     sal_Int32 nIndex = -1;
     571         [ +  - ]:         30 :     if ( m_pStatusBar )
     572                 :            :     {
     573         [ +  - ]:         30 :         ::vcl::ControlLayoutData aLayoutData;
     574         [ +  - ]:         30 :         Rectangle aItemRect = m_pStatusBar->GetItemRect( m_nItemId );
     575         [ +  - ]:         30 :         m_pStatusBar->RecordLayoutData( &aLayoutData, aItemRect );
     576                 :         30 :         Point aPnt( VCLPoint( aPoint ) );
     577                 :         30 :         aPnt += aItemRect.TopLeft();
     578 [ +  - ][ +  - ]:         30 :         nIndex = aLayoutData.GetIndexForPoint( aPnt );
     579                 :            :     }
     580                 :            : 
     581         [ +  - ]:         30 :     return nIndex;
     582                 :            : }
     583                 :            : 
     584                 :            : // -----------------------------------------------------------------------------
     585                 :            : 
     586                 :          0 : sal_Bool VCLXAccessibleStatusBarItem::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     587                 :            : {
     588         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     589                 :            : 
     590 [ #  # ][ #  # ]:          0 :     if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
                 [ #  # ]
     591         [ #  # ]:          0 :         throw IndexOutOfBoundsException();
     592                 :            : 
     593         [ #  # ]:          0 :     return sal_False;
     594                 :            : }
     595                 :            : 
     596                 :            : // -----------------------------------------------------------------------------
     597                 :            : 
     598                 :          0 : sal_Bool VCLXAccessibleStatusBarItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     599                 :            : {
     600         [ #  # ]:          0 :     OExternalLockGuard aGuard( this );
     601                 :            : 
     602                 :          0 :     sal_Bool bReturn = sal_False;
     603                 :            : 
     604         [ #  # ]:          0 :     if ( m_pStatusBar )
     605                 :            :     {
     606         [ #  # ]:          0 :         Reference< datatransfer::clipboard::XClipboard > xClipboard = m_pStatusBar->GetClipboard();
     607         [ #  # ]:          0 :         if ( xClipboard.is() )
     608                 :            :         {
     609         [ #  # ]:          0 :             ::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) );
     610                 :            : 
     611 [ #  # ][ #  # ]:          0 :             ::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
                 [ #  # ]
     612         [ #  # ]:          0 :             const sal_uInt32 nRef = Application::ReleaseSolarMutex();
     613 [ #  # ][ #  # ]:          0 :             xClipboard->setContents( pDataObj, NULL );
         [ #  # ][ #  # ]
     614                 :            : 
     615         [ #  # ]:          0 :             Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
     616         [ #  # ]:          0 :             if( xFlushableClipboard.is() )
     617 [ #  # ][ #  # ]:          0 :                 xFlushableClipboard->flushClipboard();
     618                 :            : 
     619         [ #  # ]:          0 :             Application::AcquireSolarMutex( nRef );
     620                 :            : 
     621                 :          0 :             bReturn = sal_True;
     622                 :          0 :         }
     623                 :            :     }
     624                 :            : 
     625         [ #  # ]:          0 :     return bReturn;
     626                 :            : }
     627                 :            : 
     628                 :            : // -----------------------------------------------------------------------------
     629                 :            : 
     630                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10