LCOV - code coverage report
Current view: top level - svtools/source/control - vclxaccessibleheaderbar.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 62 1.6 %
Date: 2014-11-03 Functions: 2 18 11.1 %
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 <vclxaccessibleheaderbar.hxx>
      20             : #include <vclxaccessibleheaderbaritem.hxx>
      21             : 
      22             : #include <toolkit/awt/vclxwindows.hxx>
      23             : #include <svtools/headbar.hxx>
      24             : #include <unotools/accessiblestatesethelper.hxx>
      25             : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      26             : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      27             : #include <cppuhelper/typeprovider.hxx>
      28             : #include <comphelper/sequence.hxx>
      29             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      30             : #include <vcl/svapp.hxx>
      31             : 
      32             : using namespace ::com::sun::star;
      33             : using namespace ::com::sun::star::uno;
      34             : using namespace ::com::sun::star::awt;
      35             : using namespace ::com::sun::star::lang;
      36             : using namespace ::com::sun::star::beans;
      37             : using namespace ::com::sun::star::accessibility;
      38             : using namespace ::comphelper;
      39             : 
      40           0 : VCLXHeaderBar::VCLXHeaderBar(vcl::Window* pHeaderBar)
      41             : {
      42           0 :     SetWindow(pHeaderBar);
      43           0 : }
      44             : 
      45           0 : VCLXHeaderBar::~VCLXHeaderBar()
      46             : {
      47           0 : }
      48             : 
      49           0 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXHeaderBar::CreateAccessibleContext()
      50             : {
      51           0 :     return new VCLXAccessibleHeaderBar(this);
      52             : }
      53             : 
      54             : 
      55           0 : VCLXAccessibleHeaderBar::VCLXAccessibleHeaderBar( VCLXWindow* pVCLWindow )
      56             :     :VCLXAccessibleComponent( pVCLWindow )
      57           0 :     ,m_pHeadBar(NULL)
      58             : {
      59           0 :     m_pHeadBar = static_cast< HeaderBar* >( GetWindow() );
      60           0 : }
      61             : 
      62             : 
      63             : 
      64           0 : VCLXAccessibleHeaderBar::~VCLXAccessibleHeaderBar()
      65             : {
      66           0 : }
      67             : 
      68             : 
      69             : 
      70           0 : void VCLXAccessibleHeaderBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
      71             : {
      72           0 :     VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
      73           0 : }
      74             : 
      75             : 
      76             : 
      77           0 : void VCLXAccessibleHeaderBar::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
      78             : {
      79           0 :     VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
      80           0 : }
      81             : 
      82             : 
      83             : // XServiceInfo
      84             : 
      85             : 
      86           0 : ::rtl::OUString VCLXAccessibleHeaderBar::getImplementationName() throw (RuntimeException, std::exception)
      87             : {
      88           0 :     return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleHeaderBar" );
      89             : }
      90             : 
      91             : 
      92             : 
      93           0 : Sequence< ::rtl::OUString > VCLXAccessibleHeaderBar::getSupportedServiceNames() throw (RuntimeException, std::exception)
      94             : {
      95           0 :     Sequence< ::rtl::OUString > aNames(1);
      96           0 :     aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleHeaderBar" );
      97           0 :     return aNames;
      98             : }
      99             : 
     100             : // =======XAccessibleContext=======
     101             : 
     102           0 : sal_Int32 SAL_CALL VCLXAccessibleHeaderBar::getAccessibleChildCount(  )
     103             :         throw (::com::sun::star::uno::RuntimeException, std::exception)
     104             : {
     105           0 :     SolarMutexGuard g;
     106             : 
     107           0 :     sal_Int32 nCount = 0;
     108           0 :     if ( m_pHeadBar )
     109           0 :         nCount = m_pHeadBar->GetItemCount();
     110             : 
     111           0 :     return nCount;
     112             : }
     113             : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
     114           0 :         VCLXAccessibleHeaderBar::getAccessibleChild( sal_Int32 i )  throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception)
     115             : {
     116           0 :     SolarMutexGuard g;
     117             : 
     118           0 :     if ( i < 0 || i >= getAccessibleChildCount() )
     119           0 :         throw IndexOutOfBoundsException();
     120             : 
     121           0 :     Reference< XAccessible > xChild;
     122             :     // search for the child
     123           0 :     if ( static_cast<sal_uInt16>(i) >= m_aAccessibleChildren.size() )
     124           0 :         xChild = CreateChild (i);
     125             :     else
     126             :     {
     127           0 :         xChild = m_aAccessibleChildren[i];
     128           0 :         if ( !xChild.is() )
     129           0 :             xChild = CreateChild (i);
     130             :     }
     131           0 :     return xChild;
     132             : }
     133             : 
     134           0 : sal_Int16 SAL_CALL VCLXAccessibleHeaderBar::getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
     135             : {
     136           0 :     return com::sun::star::accessibility::AccessibleRole::LIST;
     137             : }
     138             : 
     139           0 : void SAL_CALL VCLXAccessibleHeaderBar::disposing()
     140             : {
     141           0 :     SolarMutexGuard g;
     142             : 
     143           0 :     ListItems().swap(m_aAccessibleChildren);
     144           0 :     VCLXAccessibleComponent::disposing();
     145           0 : }
     146             : 
     147           0 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > VCLXAccessibleHeaderBar::CreateChild (sal_Int32 i)
     148             : {
     149           0 :     Reference<XAccessible> xChild;
     150             : 
     151           0 :     sal_uInt16 nPos = static_cast<sal_uInt16>(i);
     152           0 :     if ( nPos >= m_aAccessibleChildren.size() )
     153             :     {
     154           0 :         m_aAccessibleChildren.resize(nPos + 1);
     155             : 
     156             :         // insert into the container
     157           0 :         xChild = new VCLXAccessibleHeaderBarItem(m_pHeadBar, i);
     158           0 :         m_aAccessibleChildren[nPos] = xChild;
     159             :     }
     160             :     else
     161             :     {
     162           0 :         xChild = m_aAccessibleChildren[nPos];
     163             :         // check if position is empty and can be used else we have to adjust all entries behind this
     164           0 :         if ( !xChild.is() )
     165             :         {
     166           0 :             xChild = new VCLXAccessibleHeaderBarItem(m_pHeadBar, i);
     167           0 :             m_aAccessibleChildren[nPos] = xChild;
     168             :         }
     169             :     }
     170           0 :     return xChild;
     171        1227 : }
     172             : 
     173             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10