LCOV - code coverage report
Current view: top level - svtools/source/toolpanel - toolpaneldrawerpeer.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 34 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 9 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 "toolpaneldrawerpeer.hxx"
      22             : #include "toolpaneldrawer.hxx"
      23             : 
      24             : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      25             : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      26             : 
      27             : #include <tools/diagnose_ex.h>
      28             : #include <toolkit/awt/vclxaccessiblecomponent.hxx>
      29             : #include <unotools/accessiblestatesethelper.hxx>
      30             : #include <vcl/vclevent.hxx>
      31             : #include <vcl/svapp.hxx>
      32             : 
      33             : 
      34             : namespace svt
      35             : {
      36             : 
      37             : 
      38             :     using ::com::sun::star::uno::Reference;
      39             :     using ::com::sun::star::uno::XInterface;
      40             :     using ::com::sun::star::uno::UNO_QUERY;
      41             :     using ::com::sun::star::uno::UNO_QUERY_THROW;
      42             :     using ::com::sun::star::uno::UNO_SET_THROW;
      43             :     using ::com::sun::star::uno::Exception;
      44             :     using ::com::sun::star::uno::RuntimeException;
      45             :     using ::com::sun::star::uno::Any;
      46             :     using ::com::sun::star::uno::makeAny;
      47             :     using ::com::sun::star::uno::Sequence;
      48             :     using ::com::sun::star::uno::Type;
      49             :     using ::com::sun::star::accessibility::XAccessibleContext;
      50             : 
      51             :     namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType;
      52             :     namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId;
      53             : 
      54             : 
      55             :     //= ToolPanelDrawerContext
      56             : 
      57             :     class ToolPanelDrawerContext : public VCLXAccessibleComponent
      58             :     {
      59             :     public:
      60           0 :         explicit ToolPanelDrawerContext( VCLXWindow& i_rWindow )
      61           0 :             :VCLXAccessibleComponent( &i_rWindow )
      62             :         {
      63           0 :         }
      64             : 
      65             :         virtual void    ProcessWindowEvent( const VclWindowEvent& i_rVclWindowEvent ) SAL_OVERRIDE;
      66             :         virtual void    FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ) SAL_OVERRIDE;
      67             : 
      68             :     protected:
      69           0 :         virtual ~ToolPanelDrawerContext()
      70           0 :         {
      71           0 :         }
      72             :     };
      73             : 
      74             : 
      75           0 :     void ToolPanelDrawerContext::ProcessWindowEvent( const VclWindowEvent& i_rVclWindowEvent )
      76             :     {
      77           0 :         VCLXAccessibleComponent::ProcessWindowEvent( i_rVclWindowEvent );
      78             : 
      79           0 :         switch ( i_rVclWindowEvent.GetId() )
      80             :         {
      81             :         case VCLEVENT_ITEM_EXPANDED:
      82           0 :             NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), makeAny( AccessibleStateType::EXPANDED ) );
      83           0 :             break;
      84             :         case VCLEVENT_ITEM_COLLAPSED:
      85           0 :             NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, makeAny( AccessibleStateType::EXPANDED ), Any() );
      86           0 :             break;
      87             :         }
      88           0 :     }
      89             : 
      90             : 
      91           0 :     void ToolPanelDrawerContext::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet )
      92             :     {
      93           0 :         VCLXAccessibleComponent::FillAccessibleStateSet( i_rStateSet );
      94           0 :         if ( !GetWindow() )
      95           0 :             return;
      96             : 
      97           0 :         i_rStateSet.AddState( AccessibleStateType::EXPANDABLE );
      98           0 :         i_rStateSet.AddState( AccessibleStateType::FOCUSABLE );
      99             : 
     100           0 :         VclPtr< ToolPanelDrawer > pDrawer = GetAsDynamic< ToolPanelDrawer > ();
     101           0 :         ENSURE_OR_RETURN_VOID( pDrawer, "ToolPanelDrawerContext::FillAccessibleStateSet: illegal window!" );
     102           0 :         if ( pDrawer->IsExpanded() )
     103           0 :             i_rStateSet.AddState( AccessibleStateType::EXPANDED );
     104             : 
     105           0 :         if ( pDrawer->HasChildPathFocus() )
     106           0 :             i_rStateSet.AddState( AccessibleStateType::FOCUSED );
     107             :     }
     108             : 
     109             : 
     110             :     //= ToolPanelDrawerPeer
     111             : 
     112             : 
     113           0 :     ToolPanelDrawerPeer::ToolPanelDrawerPeer()
     114           0 :         :VCLXWindow()
     115             :     {
     116           0 :     }
     117             : 
     118             : 
     119           0 :     ToolPanelDrawerPeer::~ToolPanelDrawerPeer()
     120             :     {
     121           0 :     }
     122             : 
     123             : 
     124           0 :     Reference< XAccessibleContext > ToolPanelDrawerPeer::CreateAccessibleContext()
     125             :     {
     126           0 :         SolarMutexGuard aSolarGuard;
     127           0 :         return new ToolPanelDrawerContext( *this );
     128             :     }
     129             : 
     130             : 
     131             : } // namespace svt
     132             : 
     133             : 
     134             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11