LCOV - code coverage report
Current view: top level - svtools/source/control - vclxaccessibleheaderbaritem.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 114 0.9 %
Date: 2014-11-03 Functions: 2 34 5.9 %
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             : #include <vclxaccessibleheaderbaritem.hxx>
      20             : 
      21             : #include <svtools/headbar.hxx>
      22             : 
      23             : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      24             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      25             : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      26             : #include <cppuhelper/supportsservice.hxx>
      27             : 
      28             : #include <unotools/accessiblestatesethelper.hxx>
      29             : #include <unotools/accessiblerelationsethelper.hxx>
      30             : #include <vcl/svapp.hxx>
      31             : #include <vcl/settings.hxx>
      32             : #include <toolkit/awt/vclxfont.hxx>
      33             : #include <toolkit/helper/externallock.hxx>
      34             : #include <toolkit/helper/convert.hxx>
      35             : 
      36             : #include <vector>
      37             : 
      38             : using namespace ::com::sun::star;
      39             : using namespace ::com::sun::star::uno;
      40             : using namespace ::com::sun::star::lang;
      41             : using namespace ::com::sun::star::accessibility;
      42             : using namespace ::comphelper;
      43             : 
      44             : 
      45             : 
      46             : //  class AccessibleTabBar
      47             : 
      48             : 
      49           0 : VCLXAccessibleHeaderBarItem::VCLXAccessibleHeaderBarItem( HeaderBar*    pHeadBar, sal_Int32 _nIndexInParent )
      50             :     :AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() )
      51             :     ,m_pHeadBar( pHeadBar )
      52           0 :     ,m_nIndexInParent(_nIndexInParent + 1)
      53             : 
      54             : {
      55           0 :     m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() );
      56           0 : }
      57             : 
      58             : 
      59             : 
      60           0 : VCLXAccessibleHeaderBarItem::~VCLXAccessibleHeaderBarItem()
      61             : {
      62           0 :     delete m_pExternalLock;
      63           0 :     m_pExternalLock = NULL;
      64           0 : }
      65             : 
      66             : 
      67             : 
      68           0 : void VCLXAccessibleHeaderBarItem::ProcessWindowEvent( const VclWindowEvent& )
      69             : {
      70           0 : }
      71             : 
      72             : 
      73             : 
      74           0 : void VCLXAccessibleHeaderBarItem::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
      75             : {
      76           0 :     if ( m_pHeadBar )
      77             :     {
      78           0 :         if ( m_pHeadBar->IsEnabled() )
      79           0 :             rStateSet.AddState( AccessibleStateType::ENABLED );
      80             : 
      81           0 :         if ( m_pHeadBar->IsVisible() )
      82             :         {
      83           0 :             rStateSet.AddState( AccessibleStateType::VISIBLE );
      84             :         }
      85           0 :         rStateSet.AddState( AccessibleStateType::SELECTABLE );
      86           0 :         rStateSet.AddState( AccessibleStateType::RESIZABLE );
      87             :     }
      88           0 : }
      89             : 
      90             : 
      91             : // OCommonAccessibleComponent
      92             : 
      93             : 
      94           0 : awt::Rectangle VCLXAccessibleHeaderBarItem::implGetBounds() throw (RuntimeException)
      95             : {
      96           0 :     awt::Rectangle aBounds;
      97           0 :     OExternalLockGuard aGuard( this );
      98             : 
      99           0 :     ::com::sun::star::awt::Size aSize;
     100             : 
     101           0 :     if ( m_pHeadBar )
     102           0 :         aBounds = AWTRectangle( m_pHeadBar->GetItemRect( sal_uInt16( m_nIndexInParent ) ) );
     103             : 
     104           0 :     return aBounds;
     105             : }
     106             : 
     107             : 
     108             : // XInterface
     109             : 
     110             : 
     111           0 : IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleHeaderBarItem, AccessibleExtendedComponentHelper_BASE, VCLXAccessibleHeaderBarItem_BASE )
     112             : 
     113             : 
     114             : // XTypeProvider
     115             : 
     116             : 
     117           0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleHeaderBarItem, AccessibleExtendedComponentHelper_BASE, VCLXAccessibleHeaderBarItem_BASE )
     118             : 
     119             : 
     120             : // XComponent
     121             : 
     122             : 
     123           0 : void VCLXAccessibleHeaderBarItem::disposing()
     124             : {
     125           0 :     AccessibleExtendedComponentHelper_BASE::disposing();
     126           0 : }
     127             : 
     128             : // XServiceInfo
     129           0 : OUString VCLXAccessibleHeaderBarItem::getImplementationName() throw (RuntimeException, std::exception)
     130             : {
     131           0 :     return OUString("com.sun.star.comp.svtools.AccessibleHeaderBarItem");
     132             : }
     133             : 
     134           0 : sal_Bool VCLXAccessibleHeaderBarItem::supportsService( const OUString& rServiceName ) throw (RuntimeException, std::exception)
     135             : {
     136           0 :     return cppu::supportsService( this, rServiceName );
     137             : }
     138             : 
     139           0 : Sequence< OUString > VCLXAccessibleHeaderBarItem::getSupportedServiceNames() throw (RuntimeException, std::exception)
     140             : {
     141           0 :     Sequence< OUString > aNames(1);
     142           0 :     aNames[0] = OUString( "com.sun.star.awt.AccessibleHeaderBarItem" );
     143           0 :     return aNames;
     144             : }
     145             : 
     146             : // XAccessible
     147           0 : Reference< XAccessibleContext > VCLXAccessibleHeaderBarItem::getAccessibleContext() throw (RuntimeException, std::exception)
     148             : {
     149           0 :     OExternalLockGuard aGuard( this );
     150             : 
     151           0 :     return this;
     152             : }
     153             : 
     154             : 
     155             : // XAccessibleContext
     156             : 
     157             : 
     158           0 : sal_Int32 VCLXAccessibleHeaderBarItem::getAccessibleChildCount() throw (RuntimeException, std::exception)
     159             : {
     160           0 :     OExternalLockGuard aGuard( this );
     161             : 
     162           0 :     return 0;
     163             : }
     164             : 
     165             : 
     166             : 
     167           0 : Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     168             : {
     169           0 :     OExternalLockGuard aGuard( this );
     170             : 
     171           0 :     if ( i < 0 || i >= getAccessibleChildCount() )
     172           0 :         throw IndexOutOfBoundsException();
     173             : 
     174           0 :     return Reference< XAccessible >();
     175             : }
     176             : 
     177             : 
     178             : 
     179           0 : Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleParent() throw (RuntimeException, std::exception)
     180             : {
     181           0 :     OExternalLockGuard aGuard( this );
     182             : 
     183           0 :     Reference< XAccessible > xParent;
     184           0 :     if ( m_pHeadBar )
     185             :     {
     186           0 :         xParent = m_pHeadBar->GetAccessible();
     187             :     }
     188             : 
     189           0 :     return xParent;
     190             : }
     191             : 
     192             : 
     193             : 
     194           0 : sal_Int32 VCLXAccessibleHeaderBarItem::getAccessibleIndexInParent() throw (RuntimeException, std::exception)
     195             : {
     196           0 :     OExternalLockGuard aGuard( this );
     197           0 :     return m_nIndexInParent - 1;
     198             : }
     199             : 
     200             : 
     201             : 
     202           0 : sal_Int16 VCLXAccessibleHeaderBarItem::getAccessibleRole() throw (RuntimeException, std::exception)
     203             : {
     204           0 :     OExternalLockGuard aGuard( this );
     205             : 
     206           0 :     return AccessibleRole::COLUMN_HEADER;
     207             : }
     208             : 
     209             : 
     210             : 
     211           0 : OUString VCLXAccessibleHeaderBarItem::getAccessibleDescription() throw (RuntimeException, std::exception)
     212             : {
     213           0 :     OExternalLockGuard aGuard( this );
     214           0 :     OUString sDescription;
     215           0 :     return sDescription;
     216             : }
     217             : 
     218             : 
     219             : 
     220           0 : OUString VCLXAccessibleHeaderBarItem::getAccessibleName() throw (RuntimeException, std::exception)
     221             : {
     222           0 :     OExternalLockGuard aGuard( this );
     223             : 
     224           0 :     OUString sName;
     225           0 :     if(m_pHeadBar)
     226           0 :         sName = m_pHeadBar->GetItemText( sal_uInt16( m_nIndexInParent ) );
     227           0 :     return sName;
     228             : }
     229             : 
     230             : 
     231             : 
     232           0 : Reference< XAccessibleRelationSet > VCLXAccessibleHeaderBarItem::getAccessibleRelationSet(  ) throw (RuntimeException, std::exception)
     233             : {
     234           0 :     OExternalLockGuard aGuard( this );
     235             : 
     236           0 :     utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
     237           0 :     Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
     238           0 :     return xSet;
     239             : }
     240             : 
     241             : 
     242             : 
     243           0 : Reference< XAccessibleStateSet > VCLXAccessibleHeaderBarItem::getAccessibleStateSet(  ) throw (RuntimeException, std::exception)
     244             : {
     245           0 :     OExternalLockGuard aGuard( this );
     246             : 
     247           0 :     utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
     248           0 :     Reference< XAccessibleStateSet > xSet = pStateSetHelper;
     249             : 
     250           0 :     if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
     251             :     {
     252           0 :         FillAccessibleStateSet( *pStateSetHelper );
     253             :     }
     254             :     else
     255             :     {
     256           0 :         pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
     257             :     }
     258             : 
     259           0 :     return xSet;
     260             : }
     261             : 
     262             : 
     263             : 
     264           0 : com::sun::star::lang::Locale VCLXAccessibleHeaderBarItem::getLocale() throw (IllegalAccessibleComponentStateException, RuntimeException, std::exception)
     265             : {
     266           0 :     OExternalLockGuard aGuard( this );
     267             : 
     268           0 :     return Application::GetSettings().GetLanguageTag().getLocale();
     269             : }
     270             : 
     271             : 
     272             : // XAccessibleComponent
     273             : 
     274             : 
     275           0 : Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException, std::exception)
     276             : {
     277           0 :     OExternalLockGuard aGuard( this );
     278             : 
     279           0 :     return Reference< XAccessible >();
     280             : }
     281             : 
     282             : 
     283             : 
     284           0 : sal_Int32 VCLXAccessibleHeaderBarItem::getForeground() throw (RuntimeException, std::exception)
     285             : {
     286           0 :     OExternalLockGuard aGuard( this );
     287             : 
     288           0 :     sal_Int32 nColor = 0;
     289           0 :     return nColor;
     290             : }
     291             : 
     292             : 
     293             : 
     294           0 : sal_Int32 VCLXAccessibleHeaderBarItem::getBackground() throw (RuntimeException, std::exception)
     295             : {
     296           0 :     OExternalLockGuard aGuard( this );
     297             : 
     298           0 :     sal_Int32 nColor = 0;
     299           0 :     return nColor;
     300             : }
     301             : 
     302             : 
     303             : // XAccessibleExtendedComponent
     304             : 
     305             : 
     306           0 : Reference< awt::XFont > VCLXAccessibleHeaderBarItem::getFont() throw (RuntimeException, std::exception)
     307             : {
     308           0 :     OExternalLockGuard aGuard( this );
     309             : 
     310           0 :     Reference< awt::XFont > xFont;
     311           0 :     return xFont;
     312             : }
     313             : 
     314             : 
     315             : 
     316           0 : OUString VCLXAccessibleHeaderBarItem::getTitledBorderText() throw (RuntimeException, std::exception)
     317             : {
     318           0 :     OExternalLockGuard aGuard( this );
     319             : 
     320           0 :     OUString sText;
     321           0 :     return sText;
     322             : }
     323             : 
     324             : 
     325             : 
     326           0 : OUString VCLXAccessibleHeaderBarItem::getToolTipText() throw (RuntimeException, std::exception)
     327             : {
     328           0 :     OExternalLockGuard aGuard( this );
     329             : 
     330           0 :     OUString sText;
     331           0 :     if ( m_pHeadBar )
     332           0 :         sText = m_pHeadBar->GetQuickHelpText();
     333             : 
     334           0 :     return sText;
     335        1227 : }
     336             : 
     337             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10