LCOV - code coverage report
Current view: top level - chart2/source/controller/accessibility - AccessibleTextHelper.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 56 1.8 %
Date: 2015-06-13 12:38:46 Functions: 2 16 12.5 %
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 <sal/config.h>
      21             : 
      22             : #include <memory>
      23             : #include <utility>
      24             : 
      25             : #include "AccessibleTextHelper.hxx"
      26             : #include "DrawViewWrapper.hxx"
      27             : 
      28             : #include <vcl/svapp.hxx>
      29             : #include <osl/mutex.hxx>
      30             : 
      31             : #include <svx/AccessibleTextHelper.hxx>
      32             : #include <svx/unoshtxt.hxx>
      33             : #include <toolkit/helper/vclunohelper.hxx>
      34             : #include <vcl/window.hxx>
      35             : 
      36             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      37             : 
      38             : using namespace ::com::sun::star;
      39             : using namespace ::com::sun::star::accessibility;
      40             : 
      41             : using ::com::sun::star::uno::Reference;
      42             : using ::com::sun::star::uno::Sequence;
      43             : 
      44             : namespace chart
      45             : {
      46             : 
      47           0 : AccessibleTextHelper::AccessibleTextHelper(
      48             :     DrawViewWrapper * pDrawViewWrapper ) :
      49             :         impl::AccessibleTextHelper_Base( m_aMutex ),
      50             :         m_pTextHelper( 0 ),
      51           0 :         m_pDrawViewWrapper( pDrawViewWrapper )
      52           0 : {}
      53             : 
      54           0 : AccessibleTextHelper::~AccessibleTextHelper()
      55             : {
      56           0 :     if( m_pTextHelper )
      57           0 :         delete m_pTextHelper;
      58           0 : }
      59             : 
      60             : // ____ XInitialization ____
      61           0 : void SAL_CALL AccessibleTextHelper::initialize( const Sequence< uno::Any >& aArguments )
      62             :     throw (uno::Exception,
      63             :            uno::RuntimeException, std::exception)
      64             : {
      65           0 :     OUString aCID;
      66           0 :     Reference< XAccessible > xEventSource;
      67           0 :     Reference< awt::XWindow > xWindow;
      68             : 
      69           0 :     if( aArguments.getLength() >= 3 )
      70             :     {
      71           0 :         aArguments[0] >>= aCID;
      72           0 :         aArguments[1] >>= xEventSource;
      73           0 :         aArguments[2] >>= xWindow;
      74             :     }
      75             :     OSL_ENSURE( !aCID.isEmpty(), "Empty CID" );
      76             :     OSL_ENSURE( xEventSource.is(), "Empty Event Source" );
      77             :     OSL_ENSURE( xWindow.is(), "Empty Window" );
      78           0 :     if( !xEventSource.is() || aCID.isEmpty() )
      79           0 :         return;
      80             : 
      81           0 :     SolarMutexGuard aSolarGuard;
      82             : 
      83           0 :     delete m_pTextHelper;
      84             : 
      85           0 :     vcl::Window* pWindow( VCLUnoHelper::GetWindow( xWindow ));
      86           0 :     if( pWindow )
      87             :     {
      88           0 :         SdrView * pView = m_pDrawViewWrapper;
      89           0 :         if( pView )
      90             :         {
      91           0 :             SdrObject * pTextObj = m_pDrawViewWrapper->getNamedSdrObject( aCID );
      92           0 :             if( pTextObj )
      93             :             {
      94           0 :                 std::unique_ptr<SvxEditSource> pEditSource(new SvxTextEditSource( *pTextObj, 0, *pView, *pWindow ));
      95           0 :                 m_pTextHelper = new ::accessibility::AccessibleTextHelper(std::move(pEditSource));
      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, std::exception)
     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, std::exception)
     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, std::exception)
     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, std::exception)
     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, std::exception)
     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, std::exception)
     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, std::exception)
     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, std::exception)
     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, std::exception)
     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, std::exception)
     180             : {
     181             :     OSL_FAIL( "Not implemented in this helper" );
     182           0 :     return lang::Locale();
     183             : }
     184             : 
     185          57 : } //  namespace chart
     186             : 
     187             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11