LCOV - code coverage report
Current view: top level - svtools/source/control - vclxaccessibleheaderbar.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 61 0.0 %
Date: 2014-04-14 Functions: 0 16 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * This file is part of the LibreOffice project.
       3             :  *
       4             :  * This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       6             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       7             :  *
       8             :  * This file incorporates work covered by the following license notice:
       9             :  *
      10             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      11             :  *   contributor license agreements. See the NOTICE file distributed
      12             :  *   with this work for additional information regarding copyright
      13             :  *   ownership. The ASF licenses this file to you under the Apache
      14             :  *   License, Version 2.0 (the "License"); you may not use this file
      15             :  *   except in compliance with the License. You may obtain a copy of
      16             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      17             :  */
      18             : #include <svtools/vclxaccessibleheaderbar.hxx>
      19             : #include <svtools/vclxaccessibleheaderbaritem.hxx>
      20             : 
      21             : #include <toolkit/awt/vclxwindows.hxx>
      22             : #include <svtools/headbar.hxx>
      23             : #include <unotools/accessiblestatesethelper.hxx>
      24             : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      25             : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      26             : #include <cppuhelper/typeprovider.hxx>
      27             : #include <comphelper/sequence.hxx>
      28             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      29             : #include <vcl/svapp.hxx>
      30             : 
      31             : using namespace ::com::sun::star;
      32             : using namespace ::com::sun::star::uno;
      33             : using namespace ::com::sun::star::awt;
      34             : using namespace ::com::sun::star::lang;
      35             : using namespace ::com::sun::star::beans;
      36             : using namespace ::com::sun::star::accessibility;
      37             : using namespace ::comphelper;
      38             : 
      39           0 : VCLXHeaderBar::VCLXHeaderBar(Window* pHeaderBar)
      40             : {
      41           0 :     SetWindow(pHeaderBar);
      42           0 : }
      43             : 
      44           0 : VCLXHeaderBar::~VCLXHeaderBar()
      45             : {
      46           0 : }
      47             : 
      48           0 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXHeaderBar::CreateAccessibleContext()
      49             : {
      50           0 :     return new VCLXAccessibleHeaderBar(this);
      51             : }
      52             : 
      53             : 
      54           0 : VCLXAccessibleHeaderBar::VCLXAccessibleHeaderBar( VCLXWindow* pVCLWindow )
      55             :     :VCLXAccessibleComponent( pVCLWindow )
      56           0 :     ,m_pHeadBar(NULL)
      57             : {
      58           0 :     m_pHeadBar = static_cast< HeaderBar* >( GetWindow() );
      59           0 : }
      60             : 
      61             : 
      62             : 
      63           0 : VCLXAccessibleHeaderBar::~VCLXAccessibleHeaderBar()
      64             : {
      65           0 : }
      66             : 
      67             : 
      68             : 
      69           0 : void VCLXAccessibleHeaderBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
      70             : {
      71           0 :     VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
      72           0 : }
      73             : 
      74             : 
      75             : 
      76           0 : void VCLXAccessibleHeaderBar::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
      77             : {
      78           0 :     VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
      79           0 : }
      80             : 
      81             : 
      82             : // XServiceInfo
      83             : 
      84             : 
      85           0 : ::rtl::OUString VCLXAccessibleHeaderBar::getImplementationName() throw (RuntimeException, std::exception)
      86             : {
      87           0 :     return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleHeaderBar" );
      88             : }
      89             : 
      90             : 
      91             : 
      92           0 : Sequence< ::rtl::OUString > VCLXAccessibleHeaderBar::getSupportedServiceNames() throw (RuntimeException, std::exception)
      93             : {
      94           0 :     Sequence< ::rtl::OUString > aNames(1);
      95           0 :     aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleHeaderBar" );
      96           0 :     return aNames;
      97             : }
      98             : 
      99             : // =======XAccessibleContext=======
     100             : 
     101           0 : sal_Int32 SAL_CALL VCLXAccessibleHeaderBar::getAccessibleChildCount(  )
     102             :         throw (::com::sun::star::uno::RuntimeException, std::exception)
     103             : {
     104           0 :     SolarMutexGuard g;
     105             : 
     106           0 :     sal_Int32 nCount = 0;
     107           0 :     if ( m_pHeadBar )
     108           0 :         nCount = m_pHeadBar->GetItemCount();
     109             : 
     110           0 :     return nCount;
     111             : }
     112             : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
     113           0 :         VCLXAccessibleHeaderBar::getAccessibleChild( sal_Int32 i )  throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception)
     114             : {
     115           0 :     SolarMutexGuard g;
     116             : 
     117           0 :     if ( i < 0 || i >= getAccessibleChildCount() )
     118           0 :         throw IndexOutOfBoundsException();
     119             : 
     120           0 :     Reference< XAccessible > xChild;
     121             :     // search for the child
     122           0 :     if ( static_cast<sal_uInt16>(i) >= m_aAccessibleChildren.size() )
     123           0 :         xChild = CreateChild (i);
     124             :     else
     125             :     {
     126           0 :         xChild = m_aAccessibleChildren[i];
     127           0 :         if ( !xChild.is() )
     128           0 :             xChild = CreateChild (i);
     129             :     }
     130           0 :     return xChild;
     131             : }
     132             : 
     133           0 : sal_Int16 SAL_CALL VCLXAccessibleHeaderBar::getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
     134             : {
     135           0 :     return com::sun::star::accessibility::AccessibleRole::LIST;
     136             : }
     137             : 
     138           0 : void SAL_CALL VCLXAccessibleHeaderBar::disposing()
     139             : {
     140           0 :     SolarMutexGuard g;
     141             : 
     142           0 :     ListItems().swap(m_aAccessibleChildren);
     143           0 :     VCLXAccessibleComponent::disposing();
     144           0 : }
     145             : 
     146           0 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > VCLXAccessibleHeaderBar::CreateChild (sal_Int32 i)
     147             : {
     148           0 :     Reference<XAccessible> xChild;
     149             : 
     150           0 :     sal_uInt16 nPos = static_cast<sal_uInt16>(i);
     151           0 :     if ( nPos >= m_aAccessibleChildren.size() )
     152             :     {
     153           0 :         m_aAccessibleChildren.resize(nPos + 1);
     154             : 
     155             :         // insert into the container
     156           0 :         xChild = new VCLXAccessibleHeaderBarItem(m_pHeadBar, i);
     157           0 :         m_aAccessibleChildren[nPos] = xChild;
     158             :     }
     159             :     else
     160             :     {
     161           0 :         xChild = m_aAccessibleChildren[nPos];
     162             :         // check if position is empty and can be used else we have to adjust all entries behind this
     163           0 :         if ( !xChild.is() )
     164             :         {
     165           0 :             xChild = new VCLXAccessibleHeaderBarItem(m_pHeadBar, i);
     166           0 :             m_aAccessibleChildren[nPos] = xChild;
     167             :         }
     168             :     }
     169           0 :     return xChild;
     170             : }

Generated by: LCOV version 1.10