diff options
author | Noel Grandin <noel@peralex.com> | 2014-05-29 07:54:23 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-06-06 15:39:42 +0000 |
commit | a10a621b48a30904b970ce01cc0bf2aa15cea9cb (patch) | |
tree | e8f2bc3890a3ae9e0cc6bc06ff8dd6346217fc66 /svl | |
parent | 016e1f888946b829563efd1e771d88b23c1730bf (diff) |
simplify SfxListener::EndListening and StartListening
No-one is using the return values, so we can simplify the methods
Change-Id: Icc2dbfb797bcd82afcbf42ed3bdc20b0426ccba1
Reviewed-on: https://gerrit.libreoffice.org/9542
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/notify/lstner.cxx | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/svl/source/notify/lstner.cxx b/svl/source/notify/lstner.cxx index 606b9a609c10..331f60017b9b 100644 --- a/svl/source/notify/lstner.cxx +++ b/svl/source/notify/lstner.cxx @@ -65,7 +65,7 @@ void SfxListener::RemoveBroadcaster_Impl( SfxBroadcaster& rBroadcaster ) // registers a specific SfxBroadcaster -bool SfxListener::StartListening( SfxBroadcaster& rBroadcaster, bool bPreventDups ) +void SfxListener::StartListening( SfxBroadcaster& rBroadcaster, bool bPreventDups ) { if ( !bPreventDups || !IsListening( rBroadcaster ) ) { @@ -73,27 +73,25 @@ bool SfxListener::StartListening( SfxBroadcaster& rBroadcaster, bool bPreventDup aBCs.push_back( &rBroadcaster ); DBG_ASSERT( IsListening(rBroadcaster), "StartListening failed" ); - return true; } - - return false; } // unregisters a specific SfxBroadcaster -bool SfxListener::EndListening( SfxBroadcaster& rBroadcaster, bool bAllDups ) +void SfxListener::EndListening( SfxBroadcaster& rBroadcaster, bool bAllDups ) { - if ( !IsListening( rBroadcaster ) ) - return false; - do { + SfxBroadcasterArr_Impl::iterator it = std::find( aBCs.begin(), aBCs.end(), &rBroadcaster ); + if ( it == aBCs.end() ) + { + break; + } rBroadcaster.RemoveListener(*this); - aBCs.erase( std::find( aBCs.begin(), aBCs.end(), &rBroadcaster ) ); + aBCs.erase( it ); } - while ( bAllDups && IsListening( rBroadcaster ) ); - return true; + while ( bAllDups ); } |