LCOV - code coverage report
Current view: top level - accessibility/source/extended - accessibleeditbrowseboxcell.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 93 0.0 %
Date: 2012-08-25 Functions: 0 28 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 166 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 <accessibility/extended/accessibleeditbrowseboxcell.hxx>
      30                 :            : #include <svtools/editbrowsebox.hxx>
      31                 :            : #include <comphelper/processfactory.hxx>
      32                 :            : #include <com/sun/star/accessibility/XAccessibleText.hpp>
      33                 :            : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      34                 :            : 
      35                 :            : 
      36                 :            : // .................................................................................
      37                 :            : namespace accessibility
      38                 :            : {
      39                 :            : // .................................................................................
      40                 :            : 
      41                 :            :     using namespace com::sun::star::accessibility;
      42                 :            :     using namespace ::com::sun::star::uno;
      43                 :            :     using namespace ::com::sun::star::lang;
      44                 :            :     using namespace ::com::sun::star::awt;
      45                 :            :     using namespace ::comphelper;
      46                 :            :     using namespace ::svt;
      47                 :            : 
      48                 :            :     // -----------------------------------------------------------------------------
      49                 :          0 :     EditBrowseBoxTableCell::EditBrowseBoxTableCell(
      50                 :            :                 const com::sun::star::uno::Reference< XAccessible >& _rxParent,
      51                 :            :                 const com::sun::star::uno::Reference< XAccessible >& _rxOwningAccessible,
      52                 :            :                 const com::sun::star::uno::Reference< XAccessibleContext >& _xControlChild,
      53                 :            :                 IAccessibleTableProvider& _rBrowseBox,
      54                 :            :                 const Reference< XWindow >& _xFocusWindow,
      55                 :            :                 sal_Int32 _nRowPos,
      56                 :            :                 sal_uInt16 _nColPos)
      57                 :            :         :AccessibleBrowseBoxCell( _rxParent, _rBrowseBox, _xFocusWindow, _nRowPos, _nColPos )
      58 [ #  # ][ #  # ]:          0 :         ,OAccessibleContextWrapperHelper( ::comphelper::getProcessServiceFactory(), rBHelper, _xControlChild, _rxOwningAccessible, _rxParent )
      59                 :            :     {
      60         [ #  # ]:          0 :         aggregateProxy( m_refCount, *this );
      61                 :          0 :     }
      62                 :            : 
      63                 :            :     // -----------------------------------------------------------------------------
      64         [ #  # ]:          0 :     EditBrowseBoxTableCell::~EditBrowseBoxTableCell()
      65                 :            :     {
      66         [ #  # ]:          0 :         if ( !rBHelper.bDisposed )
      67                 :            :         {
      68                 :          0 :             acquire();  // to prevent duplicate dtor calls
      69         [ #  # ]:          0 :             dispose();
      70                 :            :         }
      71         [ #  # ]:          0 :     }
      72                 :            : 
      73                 :            :     // -----------------------------------------------------------------------------
      74                 :          0 :     ::rtl::OUString SAL_CALL EditBrowseBoxTableCell::getImplementationName() throw ( ::com::sun::star::uno::RuntimeException )
      75                 :            :     {
      76                 :          0 :         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.TableCellProxy" ) );
      77                 :            :     }
      78                 :            : 
      79                 :            :     // -----------------------------------------------------------------------------
      80 [ #  # ][ #  # ]:          0 :     IMPLEMENT_FORWARD_XINTERFACE2( EditBrowseBoxTableCell, AccessibleBrowseBoxCell, OAccessibleContextWrapperHelper )
      81                 :            : 
      82                 :            :     // -----------------------------------------------------------------------------
      83 [ #  # ][ #  # ]:          0 :     IMPLEMENT_FORWARD_XTYPEPROVIDER2( EditBrowseBoxTableCell, AccessibleBrowseBoxCell, OAccessibleContextWrapperHelper )
                 [ #  # ]
      84                 :            : 
      85                 :            :     // -----------------------------------------------------------------------------
      86                 :          0 :     void EditBrowseBoxTableCell::notifyTranslatedEvent( const AccessibleEventObject& _rEvent ) throw (RuntimeException)
      87                 :            :     {
      88                 :          0 :         commitEvent( _rEvent.EventId, _rEvent.NewValue, _rEvent.OldValue );
      89                 :          0 :     }
      90                 :            : 
      91                 :            :     // XAccessibleComponent
      92                 :            :     // -----------------------------------------------------------------------------
      93                 :          0 :     sal_Int32 SAL_CALL EditBrowseBoxTableCell::getForeground(  ) throw (RuntimeException)
      94                 :            :     {
      95         [ #  # ]:          0 :         SolarMethodGuard aGuard( *this );
      96         [ #  # ]:          0 :         Reference< XAccessibleComponent > xAccComp( m_xInnerContext, UNO_QUERY );
      97         [ #  # ]:          0 :         if ( xAccComp.is() )
      98 [ #  # ][ #  # ]:          0 :             return xAccComp->getForeground();
      99         [ #  # ]:          0 :         return 0;
     100                 :            :     }
     101                 :            : 
     102                 :            :     // -----------------------------------------------------------------------------
     103                 :          0 :     sal_Int32 SAL_CALL EditBrowseBoxTableCell::getBackground(  ) throw (RuntimeException)
     104                 :            :     {
     105         [ #  # ]:          0 :         SolarMethodGuard aGuard( *this );
     106         [ #  # ]:          0 :         Reference< XAccessibleComponent > xAccComp( m_xInnerContext, UNO_QUERY );
     107         [ #  # ]:          0 :         if ( xAccComp.is() )
     108 [ #  # ][ #  # ]:          0 :             return xAccComp->getBackground();
     109         [ #  # ]:          0 :         return 0;
     110                 :            :     }
     111                 :            : 
     112                 :            :     // -----------------------------------------------------------------------------
     113                 :          0 :     Reference< XAccessible > SAL_CALL EditBrowseBoxTableCell::getAccessibleParent(  ) throw (RuntimeException)
     114                 :            :     {
     115                 :          0 :         return m_xParentAccessible;
     116                 :            :     }
     117                 :            : 
     118                 :            :     // -----------------------------------------------------------------------------
     119                 :          0 :     ::rtl::OUString SAL_CALL EditBrowseBoxTableCell::getAccessibleDescription() throw ( RuntimeException )
     120                 :            :     {
     121         [ #  # ]:          0 :         SolarMethodGuard aGuard( *this );
     122 [ #  # ][ #  # ]:          0 :         return m_xInnerContext->getAccessibleDescription();
                 [ #  # ]
     123                 :            :     }
     124                 :            : 
     125                 :            :     // -----------------------------------------------------------------------------
     126                 :          0 :     ::rtl::OUString SAL_CALL EditBrowseBoxTableCell::getAccessibleName() throw ( RuntimeException )
     127                 :            :     {
     128         [ #  # ]:          0 :         SolarMethodGuard aGuard( *this );
     129                 :            : 
     130                 :            :         // TODO: localize this!
     131 [ #  # ][ #  # ]:          0 :         rtl::OUStringBuffer sName(mpBrowseBox->GetColumnDescription( ::sal::static_int_cast< sal_uInt16 >( getColumnPos() ) ));
     132         [ #  # ]:          0 :         if ( 0 == sName.getLength() )
     133                 :            :         {
     134         [ #  # ]:          0 :             sName.appendAscii(RTL_CONSTASCII_STRINGPARAM("Column "));
     135         [ #  # ]:          0 :             sName.append(getColumnPos());
     136                 :            :         }
     137                 :            : 
     138         [ #  # ]:          0 :         sName.appendAscii(RTL_CONSTASCII_STRINGPARAM(", Row "));
     139         [ #  # ]:          0 :         sName.append(getRowPos());
     140                 :            : 
     141 [ #  # ][ #  # ]:          0 :         return sName.makeStringAndClear();
     142                 :            :     }
     143                 :            : 
     144                 :            :     // -----------------------------------------------------------------------------
     145                 :          0 :     Reference< XAccessibleRelationSet > SAL_CALL EditBrowseBoxTableCell::getAccessibleRelationSet() throw ( RuntimeException )
     146                 :            :     {
     147         [ #  # ]:          0 :         SolarMethodGuard aGuard( *this );
     148 [ #  # ][ #  # ]:          0 :         return OAccessibleContextWrapperHelper::getAccessibleRelationSet( );
     149                 :            :     }
     150                 :            : 
     151                 :            :     // -----------------------------------------------------------------------------
     152                 :          0 :     Reference<XAccessibleStateSet > SAL_CALL EditBrowseBoxTableCell::getAccessibleStateSet() throw ( RuntimeException )
     153                 :            :     {
     154         [ #  # ]:          0 :         SolarMethodGuard aGuard( *this );
     155 [ #  # ][ #  # ]:          0 :         return m_xInnerContext->getAccessibleStateSet();
                 [ #  # ]
     156                 :            :             // TODO: shouldn't we add an ACTIVE here? Isn't the EditBrowseBoxTableCell always ACTIVE?
     157                 :            :     }
     158                 :            : 
     159                 :            :     // -----------------------------------------------------------------------------
     160                 :          0 :     sal_Int32 SAL_CALL EditBrowseBoxTableCell::getAccessibleChildCount(  ) throw (RuntimeException)
     161                 :            :     {
     162         [ #  # ]:          0 :         SolarMethodGuard aGuard( *this );
     163 [ #  # ][ #  # ]:          0 :         return OAccessibleContextWrapperHelper::getAccessibleChildCount();
     164                 :            :     }
     165                 :            : 
     166                 :            :     // -----------------------------------------------------------------------------
     167                 :          0 :     Reference< XAccessible > SAL_CALL EditBrowseBoxTableCell::getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, RuntimeException)
     168                 :            :     {
     169         [ #  # ]:          0 :         SolarMethodGuard aGuard( *this );
     170 [ #  # ][ #  # ]:          0 :         return OAccessibleContextWrapperHelper::getAccessibleChild( i );
     171                 :            :     }
     172                 :            : 
     173                 :            :     // -----------------------------------------------------------------------------
     174                 :          0 :     sal_Int16 SAL_CALL EditBrowseBoxTableCell::getAccessibleRole() throw ( RuntimeException )
     175                 :            :     {
     176         [ #  # ]:          0 :         SolarMethodGuard aGuard( *this );
     177 [ #  # ][ #  # ]:          0 :         return m_xInnerContext->getAccessibleRole( );
                 [ #  # ]
     178                 :            :     }
     179                 :            :     // -----------------------------------------------------------------------------
     180                 :          0 :     void SAL_CALL EditBrowseBoxTableCell::dispose() throw( RuntimeException )
     181                 :            :     {
     182                 :            :         // simply disambiguate. Note that the OComponentHelper base in AccessibleBrowseBoxCell
     183                 :            :         // will call our "disposing()", which will call "dispose()" on the OAccessibleContextWrapperHelper
     184                 :            :         // so there is no need to do this here.
     185                 :          0 :         AccessibleBrowseBoxCell::dispose();
     186                 :          0 :     }
     187                 :            :     // -----------------------------------------------------------------------------
     188                 :          0 :     void SAL_CALL EditBrowseBoxTableCell::disposing( const EventObject& _rSource ) throw (RuntimeException)
     189                 :            :     {
     190                 :          0 :         AccessibleBrowseBoxCell::disposing( _rSource );
     191                 :          0 :         OAccessibleContextWrapperHelper::disposing( _rSource );
     192                 :          0 :     }
     193                 :            :     // -----------------------------------------------------------------------------
     194                 :          0 :     void SAL_CALL EditBrowseBoxTableCell::disposing()
     195                 :            :     {
     196         [ #  # ]:          0 :         SolarMethodGuard aGuard( *this, false );
     197         [ #  # ]:          0 :         OAccessibleContextWrapperHelper::dispose();
     198                 :            :             // TODO: do we need to dispose our inner object? The base class does this, but is it a good idea?
     199 [ #  # ][ #  # ]:          0 :         AccessibleBrowseBoxCell::disposing();
     200                 :          0 :     }
     201                 :            :     // =============================================================================
     202                 :            :     // = EditBrowseBoxTableCell
     203                 :            :     // =============================================================================
     204                 :          0 :     EditBrowseBoxTableCellAccess::EditBrowseBoxTableCellAccess(
     205                 :            :             const Reference< XAccessible >& _rxParent, const Reference< XAccessible > _rxControlAccessible,
     206                 :            :             const Reference< XWindow >& _rxFocusWindow,
     207                 :            :             IAccessibleTableProvider& _rBrowseBox, sal_Int32 _nRowPos, sal_uInt16 _nColPos )
     208                 :            :         :EditBrowseBoxTableCellAccess_Base( m_aMutex )
     209                 :            :         ,m_xParent( _rxParent )
     210                 :            :         ,m_xControlAccessible( _rxControlAccessible )
     211                 :            :         ,m_xFocusWindow( _rxFocusWindow )
     212                 :            :         ,m_pBrowseBox( &_rBrowseBox )
     213                 :            :         ,m_nRowPos( _nRowPos )
     214         [ #  # ]:          0 :         ,m_nColPos( _nColPos )
     215                 :            :     {
     216                 :          0 :     }
     217                 :            :     // -----------------------------------------------------------------------------
     218 [ #  # ][ #  # ]:          0 :     EditBrowseBoxTableCellAccess::~EditBrowseBoxTableCellAccess( )
     219                 :            :     {
     220         [ #  # ]:          0 :     }
     221                 :            :     //--------------------------------------------------------------------
     222                 :          0 :     Reference< XAccessibleContext > SAL_CALL EditBrowseBoxTableCellAccess::getAccessibleContext(  ) throw (RuntimeException)
     223                 :            :     {
     224 [ #  # ][ #  # ]:          0 :         if ( !m_pBrowseBox || !m_xControlAccessible.is() )
                 [ #  # ]
     225         [ #  # ]:          0 :             throw DisposedException();
     226                 :          0 :             Reference< XAccessibleContext > xMyContext( m_aContext );
     227         [ #  # ]:          0 :             if ( !xMyContext.is() )
     228                 :            :             {
     229 [ #  # ][ #  # ]:          0 :             Reference< XAccessibleContext > xInnerContext = m_xControlAccessible->getAccessibleContext();
     230         [ #  # ]:          0 :             Reference< XAccessible > xMe( this );
     231                 :            : 
     232 [ #  # ][ #  # ]:          0 :                 xMyContext = new EditBrowseBoxTableCell( m_xParent, xMe, xInnerContext, *m_pBrowseBox, m_xFocusWindow, m_nRowPos, m_nColPos );
                 [ #  # ]
     233         [ #  # ]:          0 :                 m_aContext = xMyContext;
     234                 :            :             }
     235                 :          0 :         return xMyContext;
     236                 :            :     }
     237                 :            :     //--------------------------------------------------------------------
     238                 :          0 :     void SAL_CALL EditBrowseBoxTableCellAccess::disposing()
     239                 :            :     {
     240                 :            :         // dispose our context, if it still alive
     241 [ #  # ][ #  # ]:          0 :         Reference< XComponent > xMyContext( (Reference< XAccessibleContext >)m_aContext, UNO_QUERY );
                 [ #  # ]
     242         [ #  # ]:          0 :         if ( xMyContext.is() )
     243                 :            :         {
     244                 :            :             try
     245                 :            :             {
     246 [ #  # ][ #  # ]:          0 :                 xMyContext->dispose();
     247                 :            :             }
     248         [ #  # ]:          0 :             catch( const Exception& e )
     249                 :            :             {
     250                 :            :                 (void)e;
     251                 :            :                 OSL_FAIL( "EditBrowseBoxTableCellAccess::disposing: caught an exception while disposing the context!" );
     252                 :            :             }
     253                 :            :         }
     254                 :            : 
     255                 :          0 :         m_pBrowseBox = NULL;
     256                 :          0 :         m_xControlAccessible.clear();
     257         [ #  # ]:          0 :         m_aContext = Reference< XAccessibleContext >( );
     258                 :            :         // NO dispose of the inner object there: it is the XAccessible of an window, and disposing
     259                 :            :         // it would delete the respective VCL window
     260                 :          0 :     }
     261                 :            : // .................................................................................
     262                 :            : } // namespace accessibility
     263                 :            : // .................................................................................
     264                 :            : 
     265                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10