[Libreoffice-commits] .: binfilter/bf_sc
Joseph Powers
jpowers at kemper.freedesktop.org
Sat Jan 8 13:18:50 PST 2011
binfilter/bf_sc/source/core/data/sc_bcaslot.cxx | 62 ++++++++++++------------
binfilter/bf_sc/source/core/inc/bcaslot.hxx | 4 -
2 files changed, 34 insertions(+), 32 deletions(-)
New commits:
commit 62ef6fde33d7e4fdb5de0d591a5b4ac7bcdaef45
Author: Joseph Powers <jpowers27 at cox.net>
Date: Sat Jan 8 13:18:45 2011 -0800
Remove DECLARE_LIST( ScBroadcastAreaList, ScBroadcastArea* )
diff --git a/binfilter/bf_sc/source/core/data/sc_bcaslot.cxx b/binfilter/bf_sc/source/core/data/sc_bcaslot.cxx
index e0ea23b..1a3e9ed 100644
--- a/binfilter/bf_sc/source/core/data/sc_bcaslot.cxx
+++ b/binfilter/bf_sc/source/core/data/sc_bcaslot.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -38,6 +38,7 @@
#include "document.hxx"
#include "bcaslot.hxx"
#include "scerrors.hxx"
+#include <vector>
namespace binfilter {
// Anzahl der Slots je Dimension
@@ -59,7 +60,7 @@ namespace binfilter {
#error BCA_SLOTS DOOMed!
#endif
-DECLARE_LIST( ScBroadcastAreaList, ScBroadcastArea* )//STRIP008 ;
+typedef ::std::vector< ScBroadcastArea* > ScBroadcastAreaList;
// STATIC DATA -----------------------------------------------------------
@@ -118,13 +119,13 @@ TYPEINIT1( ScAreaChangedHint, SfxHint );
/*?*/ if ( !pDoc->GetHardRecalcState() )
/*?*/ {
/*?*/ pDoc->SetHardRecalcState( 1 );
-/*?*/
+/*?*/
/*?*/ SfxObjectShell* pShell = pDoc->GetDocumentShell();
/*?*/ DBG_ASSERT( pShell, "Missing DocShell :-/" );
-/*?*/
+/*?*/
/*?*/ if ( pShell )
/*?*/ pShell->SetError( SCWARN_CORE_HARD_RECALC );
-/*?*/
+/*?*/
/*?*/ pDoc->SetAutoCalc( FALSE );
/*?*/ pDoc->SetHardRecalcState( 2 );
/*?*/ }
@@ -192,8 +193,8 @@ TYPEINIT1( ScAreaChangedHint, SfxHint );
/*N*/ }
/*N*/ }
/*N*/ }
-/*N*/
-/*N*/
+/*N*/
+/*N*/
/*N*/ USHORT ScBroadcastAreaSlot::FindBroadcastArea( const ScRange& rRange ) const
/*N*/ {
/*N*/ USHORT nPos;
@@ -329,7 +330,7 @@ TYPEINIT1( ScAreaChangedHint, SfxHint );
/*N*/ ScBroadcastAreaSlotMachine::~ScBroadcastAreaSlotMachine()
/*N*/ {
-/*N*/
+/*N*/
/*N*/ ScBroadcastAreaSlot** pp = ppSlots;
/*N*/ for ( USHORT j=0; j < BCA_SLOTS; ++j, ++pp )
/*N*/ {
@@ -337,11 +338,9 @@ TYPEINIT1( ScAreaChangedHint, SfxHint );
/*N*/ delete *pp;
/*N*/ }
/*N*/ delete[] ppSlots;
-/*N*/
-/*N*/ for ( ScBroadcastArea* pBCA = pBCAlwaysList->First(); pBCA; pBCA = pBCAlwaysList->Next() )
-/*N*/ {
-/*N*/ delete pBCA;
-/*N*/ }
+/*N*/
+ for ( size_t i = 0, n = pBCAlwaysList->size(); i < n; ++i )
+ delete (*pBCAlwaysList)[ i ];
/*N*/ delete pBCAlwaysList;
/*N*/ }
@@ -382,26 +381,26 @@ TYPEINIT1( ScAreaChangedHint, SfxHint );
/*N*/ if ( rRange == BCA_LISTEN_ALWAYS )
/*N*/ {
/*N*/ ScBroadcastArea* pBCA;
-/*N*/ if ( !pBCAlwaysList->Count() )
+/*N*/ if ( pBCAlwaysList->empty() )
/*N*/ {
/*N*/ pBCA = new ScBroadcastArea( rRange );
/*N*/ pListener->StartListening( *pBCA, FALSE ); // kein PreventDupes
-/*N*/ pBCAlwaysList->Insert( pBCA, LIST_APPEND );
+/*N*/ pBCAlwaysList->push_back( pBCA );
/*N*/ return ;
/*N*/ }
/*N*/ ScBroadcastArea* pLast(NULL);
-/*N*/ for ( pBCA = pBCAlwaysList->First(); pBCA; pBCA = pBCAlwaysList->Next() )
-/*N*/ {
-/*N*/ if ( pListener->IsListening( *pBCA ) )
+ for ( size_t i = 0, n = pBCAlwaysList->size(); i < n; ++i )
+ {
+ pLast = (*pBCAlwaysList)[ i ];
+/*N*/ if ( pListener->IsListening( *pLast ) )
/*N*/ return ; // keine Dupes
-/*N*/ pLast = pBCA;
/*N*/ }
/*?*/ pBCA = pLast;
/*?*/ //! ListenerArrays don't shrink!
/*?*/ if ( pBCA->GetListenerCount() > ((USHRT_MAX / 2) / sizeof(SfxBroadcaster*)) )
/*?*/ { // Arrays nicht zu gross werden lassen
/*?*/ pBCA = new ScBroadcastArea( rRange );
-/*?*/ pBCAlwaysList->Insert( pBCA, LIST_APPEND );
+/*?*/ pBCAlwaysList->push_back( pBCA );
/*?*/ }
/*?*/ pListener->StartListening( *pBCA, FALSE ); // kein PreventDupes
/*N*/ }
@@ -442,16 +441,18 @@ TYPEINIT1( ScAreaChangedHint, SfxHint );
/*N*/ {
/*N*/ if ( rRange == BCA_LISTEN_ALWAYS )
/*N*/ {
-/*?*/ if ( pBCAlwaysList->Count() )
+/*?*/ if ( pBCAlwaysList->size() )
/*?*/ {
-/*?*/ for ( ScBroadcastArea* pBCA = pBCAlwaysList->First(); pBCA; pBCA = pBCAlwaysList->Next() )
-/*?*/ {
-/*?*/ // EndListening liefert FALSE wenn !IsListening, keine Dupes
+ for ( size_t i = 0; i < pBCAlwaysList->size(); ++i )
+ {
+ ScBroadcastArea* pBCA = (*pBCAlwaysList)[ i ];
/*?*/ if ( pListener->EndListening( *pBCA, FALSE ) )
/*?*/ {
/*?*/ if ( !pBCA->HasListeners() )
/*?*/ {
-/*?*/ pBCAlwaysList->Remove();
+ ScBroadcastAreaList::iterator it = pBCAlwaysList->begin();
+ ::std::advance( it, i );
+/*?*/ pBCAlwaysList->erase( it );
/*?*/ delete pBCA;
/*?*/ }
/*?*/ return ;
@@ -486,17 +487,18 @@ TYPEINIT1( ScAreaChangedHint, SfxHint );
/*N*/ }
/*N*/ }
/*N*/ }
-/*N*/
-/*N*/
+/*N*/
+/*N*/
/*N*/ BOOL ScBroadcastAreaSlotMachine::AreaBroadcast( const ScHint& rHint ) const
/*N*/ {
/*N*/ const ScAddress& rAddress = rHint.GetAddress();
/*N*/ if ( rAddress == BCA_BRDCST_ALWAYS )
/*N*/ {
-/*N*/ if ( pBCAlwaysList->Count() )
+/*N*/ if ( pBCAlwaysList->size() )
/*N*/ {
-/*N*/ for ( ScBroadcastArea* pBCA = pBCAlwaysList->First(); pBCA; pBCA = pBCAlwaysList->Next() )
-/*N*/ {
+ for ( size_t i = 0, n = pBCAlwaysList->size(); i < n; ++i )
+ {
+ ScBroadcastArea* pBCA = (*pBCAlwaysList)[ i ];
/*N*/ pBCA->Broadcast( rHint );
/*N*/ }
/*N*/ return TRUE;
diff --git a/binfilter/bf_sc/source/core/inc/bcaslot.hxx b/binfilter/bf_sc/source/core/inc/bcaslot.hxx
index 7fb8710..7013e3b 100644
--- a/binfilter/bf_sc/source/core/inc/bcaslot.hxx
+++ b/binfilter/bf_sc/source/core/inc/bcaslot.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -37,7 +37,7 @@
namespace binfilter {
class ScBroadcastArea;
-class ScBroadcastAreaList;
+typedef ::std::vector< ScBroadcastArea* > ScBroadcastAreaList;
#define BCA_INITGROWSIZE 16
typedef ScBroadcastArea* ScBroadcastAreaPtr;
More information about the Libreoffice-commits
mailing list