LCOV - code coverage report
Current view: top level - libreoffice/chart2/source/controller/accessibility - AccessibleTextHelper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 57 0.0 %
Date: 2012-12-27 Functions: 0 14 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             : 
      21             : #include "AccessibleTextHelper.hxx"
      22             : #include "DrawViewWrapper.hxx"
      23             : 
      24             : #include <vcl/svapp.hxx>
      25             : #include <osl/mutex.hxx>
      26             : 
      27             : #include <svx/AccessibleTextHelper.hxx>
      28             : #include <svx/unoshtxt.hxx>
      29             : #include <toolkit/helper/vclunohelper.hxx>
      30             : #include <vcl/window.hxx>
      31             : 
      32             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      33             : 
      34             : using namespace ::com::sun::star;
      35             : using namespace ::com::sun::star::accessibility;
      36             : 
      37             : using ::com::sun::star::uno::Reference;
      38             : using ::com::sun::star::uno::Sequence;
      39             : using ::rtl::OUString;
      40             : 
      41             : namespace chart
      42             : {
      43             : 
      44           0 : AccessibleTextHelper::AccessibleTextHelper(
      45             :     DrawViewWrapper * pDrawViewWrapper ) :
      46             :         impl::AccessibleTextHelper_Base( m_aMutex ),
      47             :         m_pTextHelper( 0 ),
      48           0 :         m_pDrawViewWrapper( pDrawViewWrapper )
      49           0 : {}
      50             : 
      51           0 : AccessibleTextHelper::~AccessibleTextHelper()
      52             : {
      53           0 :     if( m_pTextHelper )
      54           0 :         delete m_pTextHelper;
      55           0 : }
      56             : 
      57             : // ____ XInitialization ____
      58           0 : void SAL_CALL AccessibleTextHelper::initialize( const Sequence< uno::Any >& aArguments )
      59             :     throw (uno::Exception,
      60             :            uno::RuntimeException)
      61             : {
      62           0 :     OUString aCID;
      63           0 :     Reference< XAccessible > xEventSource;
      64           0 :     Reference< awt::XWindow > xWindow;
      65             : 
      66           0 :     if( aArguments.getLength() >= 3 )
      67             :     {
      68           0 :         aArguments[0] >>= aCID;
      69           0 :         aArguments[1] >>= xEventSource;
      70           0 :         aArguments[2] >>= xWindow;
      71             :     }
      72             :     OSL_ENSURE( !aCID.isEmpty(), "Empty CID" );
      73             :     OSL_ENSURE( xEventSource.is(), "Empty Event Source" );
      74             :     OSL_ENSURE( xWindow.is(), "Empty Window" );
      75           0 :     if( !xEventSource.is() || aCID.isEmpty() )
      76           0 :         return;
      77             : 
      78           0 :     SolarMutexGuard aSolarGuard;
      79             : 
      80           0 :     if( m_pTextHelper )
      81           0 :         delete m_pTextHelper;
      82             : 
      83           0 :     Window* pWindow( VCLUnoHelper::GetWindow( xWindow ));
      84           0 :     if( pWindow )
      85             :     {
      86           0 :         SdrView * pView = m_pDrawViewWrapper;
      87           0 :         if( pView )
      88             :         {
      89           0 :             SdrObject * pTextObj = m_pDrawViewWrapper->getNamedSdrObject( aCID );
      90           0 :             if( pTextObj )
      91             :             {
      92           0 :                 SvxEditSource * pEditSource = new SvxTextEditSource( *pTextObj, 0, *pView, *pWindow );
      93             :                 m_pTextHelper = new ::accessibility::AccessibleTextHelper(
      94           0 :                     ::std::auto_ptr< SvxEditSource >( pEditSource ));
      95           0 :                 if( m_pTextHelper )
      96           0 :                     m_pTextHelper->SetEventSource( xEventSource );
      97             :             }
      98             :         }
      99             :     }
     100             : 
     101           0 :     OSL_ENSURE( m_pTextHelper, "Couldn't create text helper" );
     102             : }
     103             : 
     104             : // ____ XAccessibleContext ____
     105           0 : ::sal_Int32 SAL_CALL AccessibleTextHelper::getAccessibleChildCount()
     106             :     throw (uno::RuntimeException)
     107             : {
     108           0 :     if( m_pTextHelper )
     109             :     {
     110           0 :         SolarMutexGuard aSolarGuard;
     111           0 :         return m_pTextHelper->GetChildCount();
     112             :     }
     113           0 :     return 0;
     114             : }
     115             : 
     116           0 : Reference< XAccessible > SAL_CALL AccessibleTextHelper::getAccessibleChild( ::sal_Int32 i )
     117             :     throw (lang::IndexOutOfBoundsException,
     118             :            uno::RuntimeException)
     119             : {
     120           0 :     if( m_pTextHelper )
     121             :     {
     122           0 :         SolarMutexGuard aSolarGuard;
     123           0 :         return m_pTextHelper->GetChild( i );
     124             :     }
     125           0 :     return Reference< XAccessible >();
     126             : }
     127             : 
     128           0 : Reference< XAccessible > SAL_CALL AccessibleTextHelper::getAccessibleParent()
     129             :     throw (uno::RuntimeException)
     130             : {
     131             :     OSL_FAIL( "Not implemented in this helper" );
     132           0 :     return Reference< XAccessible >();
     133             : }
     134             : 
     135           0 : ::sal_Int32 SAL_CALL AccessibleTextHelper::getAccessibleIndexInParent()
     136             :     throw (uno::RuntimeException)
     137             : {
     138             :     OSL_FAIL( "Not implemented in this helper" );
     139           0 :     return -1;
     140             : }
     141             : 
     142           0 : ::sal_Int16 SAL_CALL AccessibleTextHelper::getAccessibleRole()
     143             :     throw (uno::RuntimeException)
     144             : {
     145             :     OSL_FAIL( "Not implemented in this helper" );
     146           0 :     return AccessibleRole::UNKNOWN;
     147             : }
     148             : 
     149           0 : OUString SAL_CALL AccessibleTextHelper::getAccessibleDescription()
     150             :     throw (uno::RuntimeException)
     151             : {
     152             :     OSL_FAIL( "Not implemented in this helper" );
     153           0 :     return OUString();
     154             : }
     155             : 
     156           0 : OUString SAL_CALL AccessibleTextHelper::getAccessibleName()
     157             :     throw (uno::RuntimeException)
     158             : {
     159             :     OSL_FAIL( "Not implemented in this helper" );
     160           0 :     return OUString();
     161             : }
     162             : 
     163           0 : Reference< XAccessibleRelationSet > SAL_CALL AccessibleTextHelper::getAccessibleRelationSet()
     164             :     throw (uno::RuntimeException)
     165             : {
     166             :     OSL_FAIL( "Not implemented in this helper" );
     167           0 :     return Reference< XAccessibleRelationSet >();
     168             : }
     169             : 
     170           0 : Reference< XAccessibleStateSet > SAL_CALL AccessibleTextHelper::getAccessibleStateSet()
     171             :     throw (uno::RuntimeException)
     172             : {
     173             :     OSL_FAIL( "Not implemented in this helper" );
     174           0 :     return Reference< XAccessibleStateSet >();
     175             : }
     176             : 
     177           0 : lang::Locale SAL_CALL AccessibleTextHelper::getLocale()
     178             :     throw (IllegalAccessibleComponentStateException,
     179             :            uno::RuntimeException)
     180             : {
     181             :     OSL_FAIL( "Not implemented in this helper" );
     182           0 :     return lang::Locale();
     183             : }
     184             : 
     185             : 
     186             : 
     187             : } //  namespace chart
     188             : 
     189             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10