LCOV - code coverage report
Current view: top level - sc/source/ui/Accessibility - DrawModelBroadcaster.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 14 29 48.3 %
Date: 2015-06-13 12:38:46 Functions: 6 8 75.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             : #include "DrawModelBroadcaster.hxx"
      21             : #include <osl/diagnose.h>
      22             : #include <rtl/strbuf.hxx>
      23             : #include <svx/svdmodel.hxx>
      24             : #include <svx/unomod.hxx>
      25             : 
      26             : using namespace ::com::sun::star;
      27             : 
      28           2 : ScDrawModelBroadcaster::ScDrawModelBroadcaster( SdrModel *pDrawModel ) :
      29             :     maEventListeners( maListenerMutex ),
      30           2 :     mpDrawModel( pDrawModel )
      31             : {
      32           2 :     if (mpDrawModel)
      33           2 :         StartListening( *mpDrawModel );
      34           2 : }
      35             : 
      36           6 : ScDrawModelBroadcaster::~ScDrawModelBroadcaster()
      37             : {
      38           2 :     if (mpDrawModel)
      39           2 :         EndListening( *mpDrawModel );
      40           4 : }
      41             : 
      42           0 : void SAL_CALL ScDrawModelBroadcaster::addEventListener( const uno::Reference< document::XEventListener >& xListener )
      43             :     throw (uno::RuntimeException, std::exception)
      44             : {
      45           0 :     maEventListeners.addInterface( xListener );
      46           0 : }
      47             : 
      48           0 : void SAL_CALL ScDrawModelBroadcaster::removeEventListener( const uno::Reference< document::XEventListener >& xListener )
      49             :     throw (uno::RuntimeException, std::exception)
      50             : {
      51           0 :     maEventListeners.removeInterface( xListener );
      52           0 : }
      53             : 
      54           2 : void ScDrawModelBroadcaster::Notify( SfxBroadcaster&,
      55             :         const SfxHint& rHint )
      56             : {
      57           2 :     const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
      58           2 :     if( !pSdrHint )
      59           4 :         return;
      60             : 
      61           0 :     document::EventObject aEvent;
      62           0 :     if( !SvxUnoDrawMSFactory::createEvent( mpDrawModel, pSdrHint, aEvent ) )
      63           0 :         return;
      64             : 
      65           0 :     ::cppu::OInterfaceIteratorHelper aIter( maEventListeners );
      66           0 :     while( aIter.hasMoreElements() )
      67             :     {
      68           0 :         uno::Reference < document::XEventListener > xListener( aIter.next(), uno::UNO_QUERY );
      69             :         try
      70             :         {
      71           0 :             xListener->notifyEvent( aEvent );
      72             :         }
      73           0 :         catch( const uno::RuntimeException& r )
      74             :         {
      75             :             (void) r;
      76             : #if OSL_DEBUG_LEVEL > 1
      77             :             OStringBuffer aError("Runtime exception caught while notifying shape.:\n");
      78             :             aError.append(OUStringToOString(r.Message, RTL_TEXTENCODING_ASCII_US));
      79             :             OSL_FAIL( aError.getStr() );
      80             : #endif
      81             :         }
      82           0 :     }
      83         156 : }
      84             : 
      85             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11