LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/Accessibility - DrawModelBroadcaster.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 26 0.0 %
Date: 2012-12-27 Functions: 0 6 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             : #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           0 : ScDrawModelBroadcaster::ScDrawModelBroadcaster( SdrModel *pDrawModel ) :
      29             :     maEventListeners( maListenerMutex ),
      30           0 :     mpDrawModel( pDrawModel )
      31             : {
      32           0 :     if (mpDrawModel)
      33           0 :         StartListening( *mpDrawModel );
      34           0 : }
      35             : 
      36           0 : ScDrawModelBroadcaster::~ScDrawModelBroadcaster()
      37             : {
      38           0 :     if (mpDrawModel)
      39           0 :         EndListening( *mpDrawModel );
      40           0 : }
      41             : 
      42           0 : void SAL_CALL ScDrawModelBroadcaster::addEventListener( const uno::Reference< document::XEventListener >& xListener )
      43             :     throw (uno::RuntimeException)
      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)
      50             : {
      51           0 :     maEventListeners.removeInterface( xListener );
      52           0 : }
      53             : 
      54           0 : void ScDrawModelBroadcaster::Notify( SfxBroadcaster&,
      55             :         const SfxHint& rHint )
      56             : {
      57           0 :     const SdrHint *pSdrHint = PTR_CAST( SdrHint, &rHint );
      58           0 :     if( !pSdrHint )
      59             :         return;
      60             : 
      61           0 :     document::EventObject aEvent;
      62           0 :     if( !SvxUnoDrawMSFactory::createEvent( mpDrawModel, pSdrHint, aEvent ) )
      63             :         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             :             rtl::OStringBuffer aError(RTL_CONSTASCII_STRINGPARAM(
      78             :                 "Runtime exception caught while notifying shape.:\n"));
      79             :             aError.append(rtl::OUStringToOString(r.Message, RTL_TEXTENCODING_ASCII_US));
      80             :             OSL_FAIL( aError.getStr() );
      81             : #endif
      82             :         }
      83           0 :     }
      84             : }
      85             : 
      86             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10