diff options
author | npcdoom <venccsralph@gmail.com> | 2011-02-21 11:02:01 -0800 |
---|---|---|
committer | Joseph Powers <jpowers27@cox.net> | 2011-02-21 11:02:01 -0800 |
commit | c670a6d57a09c7641ceb9609bef841f98b8830cb (patch) | |
tree | 6287a3ae2daf6de39fbab5f68cb342b4fd955b61 | |
parent | 0550c05dba06625b62d71e90395b1eeb43b0f3b4 (diff) |
[PATCH 10/10] Remove deprecated List container.
-rw-r--r-- | sc/source/filter/excel/frmbase.cxx | 59 | ||||
-rw-r--r-- | sc/source/filter/excel/impop.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/inc/formel.hxx | 128 |
3 files changed, 41 insertions, 150 deletions
diff --git a/sc/source/filter/excel/frmbase.cxx b/sc/source/filter/excel/frmbase.cxx index 89d7c7423b68..3aa3a3d0ba95 100644 --- a/sc/source/filter/excel/frmbase.cxx +++ b/sc/source/filter/excel/frmbase.cxx @@ -29,29 +29,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" - - - #include "formel.hxx" - - - -_ScRangeList::~_ScRangeList() -{ - ScRange* p = ( ScRange* ) First(); - - while( p ) - { - delete p; - p = ( ScRange* ) Next(); - } -} - - - - -_ScRangeListTabs::_ScRangeListTabs( void ) +_ScRangeListTabs::_ScRangeListTabs() { ppTabLists = new _ScRangeList*[ MAXTAB + 1 ]; @@ -63,7 +43,6 @@ _ScRangeListTabs::_ScRangeListTabs( void ) nAct = 0; } - _ScRangeListTabs::~_ScRangeListTabs() { if( bHasRanges ) @@ -111,11 +90,10 @@ void _ScRangeListTabs::Append( ScSingleRefData a, SCsTAB nTab, const BOOL b ) if( !p ) p = ppTabLists[ nTab ] = new _ScRangeList; - p->Append( a ); + p->push_back(new ScRange(a.nCol,a.nRow,a.nTab)); } } - void _ScRangeListTabs::Append( ScComplexRefData a, SCsTAB nTab, const BOOL b ) { if( b ) @@ -166,6 +144,7 @@ void _ScRangeListTabs::Append( ScComplexRefData a, SCsTAB nTab, const BOOL b ) if( nTab == SCTAB_MAX) return; + if( nTab < -1) nTab = a.Ref1.nTab; @@ -176,11 +155,11 @@ void _ScRangeListTabs::Append( ScComplexRefData a, SCsTAB nTab, const BOOL b ) if( !p ) p = ppTabLists[ nTab ] = new _ScRangeList; - p->Append( a ); + p->push_back(new ScRange(a.Ref1.nCol,a.Ref1.nRow,a.Ref1.nTab, + a.Ref2.nCol,a.Ref2.nRow,a.Ref2.nTab)); } } - const ScRange* _ScRangeListTabs::First( const UINT16 n ) { DBG_ASSERT( ValidTab(n), "-_ScRangeListTabs::First(): Und tschuessssssss!" ); @@ -189,27 +168,25 @@ const ScRange* _ScRangeListTabs::First( const UINT16 n ) { pAct = ppTabLists[ n ]; nAct = n; - return pAct->First(); - } - else - { - pAct = NULL; - nAct = 0; - return NULL; + pAct->iterCur = pAct->begin(); + return &(*(pAct->iterCur)); } -} + pAct = NULL; + nAct = 0; + return NULL; +} -const ScRange* _ScRangeListTabs::Next( void ) +const ScRange* _ScRangeListTabs::Next () { if( pAct ) - return pAct->Next(); - else - return NULL; -} - - + { + ++pAct->iterCur; + return &(*(pAct->iterCur)); + } + return NULL; +} ConverterBase::ConverterBase( UINT16 nNewBuffer ) : aEingPos( 0, 0, 0 ), diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx index d6d330848619..69ecde9702ed 100644 --- a/sc/source/filter/excel/impop.cxx +++ b/sc/source/filter/excel/impop.cxx @@ -1262,7 +1262,7 @@ void ImportExcel::PostDocLoad( void ) p = pExcRoot->pPrintRanges->First( static_cast<UINT16>(n) ); if( p ) { - DBG_ASSERT( pExcRoot->pPrintRanges->GetActList(), + DBG_ASSERT( pExcRoot->pPrintRanges->HasActList(), "-ImportExcel::PostDocLoad(): Imaginaere Tabelle gefunden!" ); pD->ClearPrintRanges( n ); @@ -1288,7 +1288,7 @@ void ImportExcel::PostDocLoad( void ) p = pExcRoot->pPrintTitles->First( static_cast<UINT16>(n) ); if( p ) { - DBG_ASSERT( pExcRoot->pPrintTitles->GetActList(), + DBG_ASSERT( pExcRoot->pPrintTitles->HasActList(), "-ImportExcel::PostDocLoad(): Imaginaere Tabelle gefunden!" ); BOOL bRowVirgin = TRUE; diff --git a/sc/source/filter/inc/formel.hxx b/sc/source/filter/inc/formel.hxx index d36d8aed1e7a..72984e77bf58 100644 --- a/sc/source/filter/inc/formel.hxx +++ b/sc/source/filter/inc/formel.hxx @@ -29,15 +29,16 @@ #ifndef SC_FORMEL_HXX #define SC_FORMEL_HXX +#include <boost/ptr_container/ptr_vector.hpp> + #include <tools/solar.h> #include <tools/string.hxx> -#include "tokstack.hxx" -#include "root.hxx" -#include <global.hxx> -#include <compiler.hxx> +#include <compiler.hxx> +#include <global.hxx> -// ----- forwards -------------------------------------------------------- +#include "root.hxx" +#include "tokstack.hxx" class XclImpStream; class ScTokenArray; @@ -45,11 +46,6 @@ class ScFormulaCell; struct ScSingleRefData; struct ScComplexRefData; - - - -//------------------------------------------------------------------------ - enum ConvErr { ConvOK = 0, @@ -59,7 +55,6 @@ enum ConvErr ConvErrCount // Nicht alle Bytes der Formel 'erwischt' }; - enum FORMULA_TYPE { FT_CellFormula, @@ -67,115 +62,34 @@ enum FORMULA_TYPE FT_SharedFormula }; - - - -//--------------------------------------------------------- class ScRangeList - - -class _ScRangeList : protected List -{ -private: -protected: -public: - virtual ~_ScRangeList(); - inline void Append( const ScRange& rRange ); - inline void Append( ScRange* pRange ); - inline void Append( const ScSingleRefData& rSRD ); - inline void Append( const ScComplexRefData& rCRD ); - - using List::Count; - inline BOOL HasRanges( void ) const; - - inline const ScRange* First( void ); - inline const ScRange* Next( void ); -}; - - -inline void _ScRangeList::Append( const ScRange& r ) -{ - List::Insert( new ScRange( r ), LIST_APPEND ); -} - - -inline void _ScRangeList::Append( ScRange* p ) -{ - List::Insert( p, LIST_APPEND ); -} - - -inline BOOL _ScRangeList::HasRanges( void ) const -{ - return Count() > 0; -} - - -inline const ScRange* _ScRangeList::First( void ) -{ - return ( const ScRange* ) List::First(); -} - - -inline const ScRange* _ScRangeList::Next( void ) -{ - return ( const ScRange* ) List::Next(); -} - - -inline void _ScRangeList::Append( const ScSingleRefData& r ) -{ - List::Insert( new ScRange( r.nCol, r.nRow, r.nTab ), LIST_APPEND ); -} - - -inline void _ScRangeList::Append( const ScComplexRefData& r ) -{ - List::Insert( new ScRange( r.Ref1.nCol, r.Ref1.nRow, r.Ref1.nTab, - r.Ref2.nCol, r.Ref2.nRow, r.Ref2.nTab ), - LIST_APPEND ); -} - - - - -//----------------------------------------------------- class ScRangeListTabs - - class _ScRangeListTabs { -private: -protected: + struct _ScRangeList : public boost::ptr_vector<ScRange> + { + iterator iterCur; + }; + BOOL bHasRanges; _ScRangeList** ppTabLists; _ScRangeList* pAct; UINT16 nAct; -public: - _ScRangeListTabs( void ); - virtual ~_ScRangeListTabs(); - - void Append( ScSingleRefData aSRD, SCsTAB nTab, const BOOL bLimit = TRUE ); - void Append( ScComplexRefData aCRD, SCsTAB nTab, const BOOL bLimit = TRUE ); - - inline BOOL HasRanges( void ) const; - - const ScRange* First( const UINT16 nTab = 0 ); - const ScRange* Next( void ); -// const ScRange* NextContinue( void ); - inline const _ScRangeList* GetActList( void ) const; -}; +public: -inline BOOL _ScRangeListTabs::HasRanges( void ) const -{ - return bHasRanges; -} + _ScRangeListTabs (); + ~_ScRangeListTabs(); -inline const _ScRangeList* _ScRangeListTabs::GetActList( void ) const -{ - return pAct; -} + void Append( ScSingleRefData aSRD, SCsTAB nTab, const BOOL bLimit = TRUE ); + void Append( ScComplexRefData aCRD, SCsTAB nTab, const BOOL bLimit = TRUE ); + const ScRange* First ( const UINT16 nTab = 0 ); + const ScRange* Next (); + inline bool HasRanges () const { return bHasRanges; } + inline bool HasActList () const { return pAct != NULL; } +}; class ConverterBase { |