LCOV - code coverage report
Current view: top level - libreoffice/accessibility/source/extended - accessibleeditbrowseboxcell.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 93 0.0 %
Date: 2012-12-27 Functions: 0 28 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <accessibility/extended/accessibleeditbrowseboxcell.hxx>
      21             : #include <svtools/editbrowsebox.hxx>
      22             : #include <comphelper/processfactory.hxx>
      23             : #include <com/sun/star/accessibility/XAccessibleText.hpp>
      24             : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      25             : 
      26             : 
      27             : // .................................................................................
      28             : namespace accessibility
      29             : {
      30             : // .................................................................................
      31             : 
      32             :     using namespace com::sun::star::accessibility;
      33             :     using namespace ::com::sun::star::uno;
      34             :     using namespace ::com::sun::star::lang;
      35             :     using namespace ::com::sun::star::awt;
      36             :     using namespace ::comphelper;
      37             :     using namespace ::svt;
      38             : 
      39             :     // -----------------------------------------------------------------------------
      40           0 :     EditBrowseBoxTableCell::EditBrowseBoxTableCell(
      41             :                 const com::sun::star::uno::Reference< XAccessible >& _rxParent,
      42             :                 const com::sun::star::uno::Reference< XAccessible >& _rxOwningAccessible,
      43             :                 const com::sun::star::uno::Reference< XAccessibleContext >& _xControlChild,
      44             :                 IAccessibleTableProvider& _rBrowseBox,
      45             :                 const Reference< XWindow >& _xFocusWindow,
      46             :                 sal_Int32 _nRowPos,
      47             :                 sal_uInt16 _nColPos)
      48             :         :AccessibleBrowseBoxCell( _rxParent, _rBrowseBox, _xFocusWindow, _nRowPos, _nColPos )
      49           0 :         ,OAccessibleContextWrapperHelper( ::comphelper::getProcessComponentContext(), rBHelper, _xControlChild, _rxOwningAccessible, _rxParent )
      50             :     {
      51           0 :         aggregateProxy( m_refCount, *this );
      52           0 :     }
      53             : 
      54             :     // -----------------------------------------------------------------------------
      55           0 :     EditBrowseBoxTableCell::~EditBrowseBoxTableCell()
      56             :     {
      57           0 :         if ( !rBHelper.bDisposed )
      58             :         {
      59           0 :             acquire();  // to prevent duplicate dtor calls
      60           0 :             dispose();
      61             :         }
      62           0 :     }
      63             : 
      64             :     // -----------------------------------------------------------------------------
      65           0 :     OUString SAL_CALL EditBrowseBoxTableCell::getImplementationName() throw ( ::com::sun::star::uno::RuntimeException )
      66             :     {
      67           0 :         return OUString( "com.sun.star.comp.svtools.TableCellProxy" );
      68             :     }
      69             : 
      70             :     // -----------------------------------------------------------------------------
      71           0 :     IMPLEMENT_FORWARD_XINTERFACE2( EditBrowseBoxTableCell, AccessibleBrowseBoxCell, OAccessibleContextWrapperHelper )
      72             : 
      73             :     // -----------------------------------------------------------------------------
      74           0 :     IMPLEMENT_FORWARD_XTYPEPROVIDER2( EditBrowseBoxTableCell, AccessibleBrowseBoxCell, OAccessibleContextWrapperHelper )
      75             : 
      76             :     // -----------------------------------------------------------------------------
      77           0 :     void EditBrowseBoxTableCell::notifyTranslatedEvent( const AccessibleEventObject& _rEvent ) throw (RuntimeException)
      78             :     {
      79           0 :         commitEvent( _rEvent.EventId, _rEvent.NewValue, _rEvent.OldValue );
      80           0 :     }
      81             : 
      82             :     // XAccessibleComponent
      83             :     // -----------------------------------------------------------------------------
      84           0 :     sal_Int32 SAL_CALL EditBrowseBoxTableCell::getForeground(  ) throw (RuntimeException)
      85             :     {
      86           0 :         SolarMethodGuard aGuard( *this );
      87           0 :         Reference< XAccessibleComponent > xAccComp( m_xInnerContext, UNO_QUERY );
      88           0 :         if ( xAccComp.is() )
      89           0 :             return xAccComp->getForeground();
      90           0 :         return 0;
      91             :     }
      92             : 
      93             :     // -----------------------------------------------------------------------------
      94           0 :     sal_Int32 SAL_CALL EditBrowseBoxTableCell::getBackground(  ) throw (RuntimeException)
      95             :     {
      96           0 :         SolarMethodGuard aGuard( *this );
      97           0 :         Reference< XAccessibleComponent > xAccComp( m_xInnerContext, UNO_QUERY );
      98           0 :         if ( xAccComp.is() )
      99           0 :             return xAccComp->getBackground();
     100           0 :         return 0;
     101             :     }
     102             : 
     103             :     // -----------------------------------------------------------------------------
     104           0 :     Reference< XAccessible > SAL_CALL EditBrowseBoxTableCell::getAccessibleParent(  ) throw (RuntimeException)
     105             :     {
     106           0 :         return m_xParentAccessible;
     107             :     }
     108             : 
     109             :     // -----------------------------------------------------------------------------
     110           0 :     OUString SAL_CALL EditBrowseBoxTableCell::getAccessibleDescription() throw ( RuntimeException )
     111             :     {
     112           0 :         SolarMethodGuard aGuard( *this );
     113           0 :         return m_xInnerContext->getAccessibleDescription();
     114             :     }
     115             : 
     116             :     // -----------------------------------------------------------------------------
     117           0 :     OUString SAL_CALL EditBrowseBoxTableCell::getAccessibleName() throw ( RuntimeException )
     118             :     {
     119           0 :         SolarMethodGuard aGuard( *this );
     120             : 
     121             :         // TODO: localize this!
     122           0 :         OUStringBuffer sName(mpBrowseBox->GetColumnDescription( ::sal::static_int_cast< sal_uInt16 >( getColumnPos() ) ));
     123           0 :         if ( 0 == sName.getLength() )
     124             :         {
     125           0 :             sName.appendAscii("Column ");
     126           0 :             sName.append(getColumnPos());
     127             :         }
     128             : 
     129           0 :         sName.appendAscii(", Row ");
     130           0 :         sName.append(getRowPos());
     131             : 
     132           0 :         return sName.makeStringAndClear();
     133             :     }
     134             : 
     135             :     // -----------------------------------------------------------------------------
     136           0 :     Reference< XAccessibleRelationSet > SAL_CALL EditBrowseBoxTableCell::getAccessibleRelationSet() throw ( RuntimeException )
     137             :     {
     138           0 :         SolarMethodGuard aGuard( *this );
     139           0 :         return OAccessibleContextWrapperHelper::getAccessibleRelationSet( );
     140             :     }
     141             : 
     142             :     // -----------------------------------------------------------------------------
     143           0 :     Reference<XAccessibleStateSet > SAL_CALL EditBrowseBoxTableCell::getAccessibleStateSet() throw ( RuntimeException )
     144             :     {
     145           0 :         SolarMethodGuard aGuard( *this );
     146           0 :         return m_xInnerContext->getAccessibleStateSet();
     147             :             // TODO: shouldn't we add an ACTIVE here? Isn't the EditBrowseBoxTableCell always ACTIVE?
     148             :     }
     149             : 
     150             :     // -----------------------------------------------------------------------------
     151           0 :     sal_Int32 SAL_CALL EditBrowseBoxTableCell::getAccessibleChildCount(  ) throw (RuntimeException)
     152             :     {
     153           0 :         SolarMethodGuard aGuard( *this );
     154           0 :         return OAccessibleContextWrapperHelper::getAccessibleChildCount();
     155             :     }
     156             : 
     157             :     // -----------------------------------------------------------------------------
     158           0 :     Reference< XAccessible > SAL_CALL EditBrowseBoxTableCell::getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, RuntimeException)
     159             :     {
     160           0 :         SolarMethodGuard aGuard( *this );
     161           0 :         return OAccessibleContextWrapperHelper::getAccessibleChild( i );
     162             :     }
     163             : 
     164             :     // -----------------------------------------------------------------------------
     165           0 :     sal_Int16 SAL_CALL EditBrowseBoxTableCell::getAccessibleRole() throw ( RuntimeException )
     166             :     {
     167           0 :         SolarMethodGuard aGuard( *this );
     168           0 :         return m_xInnerContext->getAccessibleRole( );
     169             :     }
     170             :     // -----------------------------------------------------------------------------
     171           0 :     void SAL_CALL EditBrowseBoxTableCell::dispose() throw( RuntimeException )
     172             :     {
     173             :         // simply disambiguate. Note that the OComponentHelper base in AccessibleBrowseBoxCell
     174             :         // will call our "disposing()", which will call "dispose()" on the OAccessibleContextWrapperHelper
     175             :         // so there is no need to do this here.
     176           0 :         AccessibleBrowseBoxCell::dispose();
     177           0 :     }
     178             :     // -----------------------------------------------------------------------------
     179           0 :     void SAL_CALL EditBrowseBoxTableCell::disposing( const EventObject& _rSource ) throw (RuntimeException)
     180             :     {
     181           0 :         AccessibleBrowseBoxCell::disposing( _rSource );
     182           0 :         OAccessibleContextWrapperHelper::disposing( _rSource );
     183           0 :     }
     184             :     // -----------------------------------------------------------------------------
     185           0 :     void SAL_CALL EditBrowseBoxTableCell::disposing()
     186             :     {
     187           0 :         SolarMethodGuard aGuard( *this, false );
     188           0 :         OAccessibleContextWrapperHelper::dispose();
     189             :             // TODO: do we need to dispose our inner object? The base class does this, but is it a good idea?
     190           0 :         AccessibleBrowseBoxCell::disposing();
     191           0 :     }
     192             :     // =============================================================================
     193             :     // = EditBrowseBoxTableCell
     194             :     // =============================================================================
     195           0 :     EditBrowseBoxTableCellAccess::EditBrowseBoxTableCellAccess(
     196             :             const Reference< XAccessible >& _rxParent, const Reference< XAccessible > _rxControlAccessible,
     197             :             const Reference< XWindow >& _rxFocusWindow,
     198             :             IAccessibleTableProvider& _rBrowseBox, sal_Int32 _nRowPos, sal_uInt16 _nColPos )
     199             :         :EditBrowseBoxTableCellAccess_Base( m_aMutex )
     200             :         ,m_xParent( _rxParent )
     201             :         ,m_xControlAccessible( _rxControlAccessible )
     202             :         ,m_xFocusWindow( _rxFocusWindow )
     203             :         ,m_pBrowseBox( &_rBrowseBox )
     204             :         ,m_nRowPos( _nRowPos )
     205           0 :         ,m_nColPos( _nColPos )
     206             :     {
     207           0 :     }
     208             :     // -----------------------------------------------------------------------------
     209           0 :     EditBrowseBoxTableCellAccess::~EditBrowseBoxTableCellAccess( )
     210             :     {
     211           0 :     }
     212             :     //--------------------------------------------------------------------
     213           0 :     Reference< XAccessibleContext > SAL_CALL EditBrowseBoxTableCellAccess::getAccessibleContext(  ) throw (RuntimeException)
     214             :     {
     215           0 :         if ( !m_pBrowseBox || !m_xControlAccessible.is() )
     216           0 :             throw DisposedException();
     217           0 :             Reference< XAccessibleContext > xMyContext( m_aContext );
     218           0 :             if ( !xMyContext.is() )
     219             :             {
     220           0 :             Reference< XAccessibleContext > xInnerContext = m_xControlAccessible->getAccessibleContext();
     221           0 :             Reference< XAccessible > xMe( this );
     222             : 
     223           0 :                 xMyContext = new EditBrowseBoxTableCell( m_xParent, xMe, xInnerContext, *m_pBrowseBox, m_xFocusWindow, m_nRowPos, m_nColPos );
     224           0 :                 m_aContext = xMyContext;
     225             :             }
     226           0 :         return xMyContext;
     227             :     }
     228             :     //--------------------------------------------------------------------
     229           0 :     void SAL_CALL EditBrowseBoxTableCellAccess::disposing()
     230             :     {
     231             :         // dispose our context, if it still alive
     232           0 :         Reference< XComponent > xMyContext( (Reference< XAccessibleContext >)m_aContext, UNO_QUERY );
     233           0 :         if ( xMyContext.is() )
     234             :         {
     235             :             try
     236             :             {
     237           0 :                 xMyContext->dispose();
     238             :             }
     239           0 :             catch( const Exception& e )
     240             :             {
     241             :                 (void)e;
     242             :                 OSL_FAIL( "EditBrowseBoxTableCellAccess::disposing: caught an exception while disposing the context!" );
     243             :             }
     244             :         }
     245             : 
     246           0 :         m_pBrowseBox = NULL;
     247           0 :         m_xControlAccessible.clear();
     248           0 :         m_aContext = Reference< XAccessibleContext >( );
     249             :         // NO dispose of the inner object there: it is the XAccessible of an window, and disposing
     250             :         // it would delete the respective VCL window
     251           0 :     }
     252             : // .................................................................................
     253             : } // namespace accessibility
     254             : // .................................................................................
     255             : 
     256             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10