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

Generated by: LCOV version 1.10