LCOV - code coverage report
Current view: top level - accessibility/source/extended - listboxaccessible.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 12 26 46.2 %
Date: 2014-04-11 Functions: 3 7 42.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             : 
      20             : #include <accessibility/extended/listboxaccessible.hxx>
      21             : #include <svtools/treelistbox.hxx>
      22             : 
      23             : namespace accessibility
      24             : {
      25             :     // ListBoxAccessibleBase
      26         122 :     ListBoxAccessibleBase::ListBoxAccessibleBase( SvTreeListBox& _rWindow )
      27         122 :         :m_pWindow( &_rWindow )
      28             :     {
      29         122 :         m_pWindow->AddEventListener( LINK( this, ListBoxAccessibleBase, WindowEventListener ) );
      30         122 :     }
      31             : 
      32         122 :     ListBoxAccessibleBase::~ListBoxAccessibleBase( )
      33             :     {
      34         122 :         if ( m_pWindow )
      35             :         {
      36             :             // cannot call "dispose" here, as it is abstract, so the VTABLE of the derived class
      37             :             // is not intact anymore
      38             :             // so we call our "disposing" only
      39           0 :             disposing();
      40             :         }
      41         122 :     }
      42             : 
      43           0 :     IMPL_LINK( ListBoxAccessibleBase, WindowEventListener, VclSimpleEvent*, pEvent )
      44             :     {
      45             :         OSL_ENSURE( pEvent && pEvent->ISA( VclWindowEvent ), "ListBoxAccessibleBase::WindowEventListener: unexpected WindowEvent!" );
      46           0 :         if ( pEvent && pEvent->ISA( VclWindowEvent ) )
      47             :         {
      48             :             OSL_ENSURE( static_cast< VclWindowEvent* >( pEvent )->GetWindow() , "ListBoxAccessibleBase::WindowEventListener: no event window!" );
      49             :             OSL_ENSURE( static_cast< VclWindowEvent* >( pEvent )->GetWindow() == m_pWindow, "ListBoxAccessibleBase::WindowEventListener: where did this come from?" );
      50             : 
      51           0 :             ProcessWindowEvent( *static_cast< VclWindowEvent* >( pEvent ) );
      52             :         }
      53           0 :         return 0;
      54             :     }
      55             : 
      56         122 :     void ListBoxAccessibleBase::disposing()
      57             :     {
      58         122 :         if ( m_pWindow )
      59         122 :             m_pWindow->RemoveEventListener( LINK( this, ListBoxAccessibleBase, WindowEventListener ) );
      60         122 :         m_pWindow = NULL;
      61         122 :     }
      62             : 
      63           0 :     void ListBoxAccessibleBase::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
      64             :     {
      65           0 :         if ( isAlive() )
      66             :         {
      67           0 :             switch ( _rVclWindowEvent.GetId() )
      68             :             {
      69             :                 case  VCLEVENT_OBJECT_DYING :
      70             :                 {
      71           0 :                     if ( m_pWindow )
      72           0 :                         m_pWindow->RemoveEventListener( LINK( this, ListBoxAccessibleBase, WindowEventListener ) );
      73           0 :                     m_pWindow = NULL;
      74           0 :                     dispose();
      75           0 :                     break;
      76             :                 }
      77             :             }
      78             :         }
      79           0 :     }
      80             : }   // namespace accessibility
      81             : 
      82             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10