LCOV - code coverage report
Current view: top level - unotools/source/config - options.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 43 0.0 %
Date: 2014-04-14 Functions: 0 13 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 "sal/config.h"
      21             : #include <unotools/options.hxx>
      22             : 
      23             : using utl::detail::Options;
      24             : using utl::ConfigurationBroadcaster;
      25             : 
      26           0 : utl::ConfigurationListener::~ConfigurationListener() {}
      27             : 
      28           0 : ConfigurationBroadcaster::ConfigurationBroadcaster()
      29             : : mpList(0)
      30             : , m_nBroadcastBlocked( 0 )
      31           0 : , m_nBlockedHint( 0 )
      32             : {
      33           0 : }
      34             : 
      35           0 : ConfigurationBroadcaster::~ConfigurationBroadcaster()
      36             : {
      37           0 :     delete mpList;
      38           0 : }
      39             : 
      40           0 : void ConfigurationBroadcaster::AddListener( utl::ConfigurationListener* pListener )
      41             : {
      42           0 :     if ( !mpList )
      43           0 :         mpList = new IMPL_ConfigurationListenerList;
      44           0 :     mpList->push_back( pListener );
      45           0 : }
      46             : 
      47           0 : void ConfigurationBroadcaster::RemoveListener( utl::ConfigurationListener* pListener )
      48             : {
      49           0 :     if ( mpList ) {
      50           0 :         for ( IMPL_ConfigurationListenerList::iterator it = mpList->begin();
      51           0 :               it != mpList->end();
      52             :               ++it
      53             :         ) {
      54           0 :             if ( *it == pListener ) {
      55           0 :                 mpList->erase( it );
      56           0 :                 break;
      57             :             }
      58             :         }
      59             :     }
      60           0 : }
      61             : 
      62           0 : void ConfigurationBroadcaster::NotifyListeners( sal_uInt32 nHint )
      63             : {
      64           0 :     if ( m_nBroadcastBlocked )
      65           0 :         m_nBlockedHint |= nHint;
      66             :     else
      67             :     {
      68           0 :         nHint |= m_nBlockedHint;
      69           0 :         m_nBlockedHint = 0;
      70           0 :         if ( mpList ) {
      71           0 :             for ( size_t n = 0; n < mpList->size(); n++ ) {
      72           0 :                 (*mpList)[ n ]->ConfigurationChanged( this, nHint );
      73             :             }
      74             :         }
      75             :     }
      76           0 : }
      77             : 
      78           0 : void ConfigurationBroadcaster::BlockBroadcasts( bool bBlock )
      79             : {
      80           0 :     if ( bBlock )
      81           0 :         ++m_nBroadcastBlocked;
      82           0 :     else if ( m_nBroadcastBlocked )
      83             :     {
      84           0 :         if ( --m_nBroadcastBlocked == 0 )
      85           0 :             NotifyListeners( 0 );
      86             :     }
      87           0 : }
      88             : 
      89           0 : Options::Options()
      90             : {
      91           0 : }
      92             : 
      93           0 : Options::~Options()
      94             : {
      95           0 : }
      96             : 
      97           0 : void Options::ConfigurationChanged( ConfigurationBroadcaster*, sal_uInt32 nHint )
      98             : {
      99           0 :     NotifyListeners( nHint );
     100           0 : }
     101             : 
     102             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10