Kaydet (Commit) 3c0cbc02 authored tarafından Rafael Dominguez's avatar Rafael Dominguez Kaydeden (comit) Petr Mladek

Replace List for std::vector<ExcEScenario*>.

üst 51d962e3
...@@ -402,16 +402,11 @@ public: ...@@ -402,16 +402,11 @@ public:
class ExcEScenarioManager : public ExcRecord, private List class ExcEScenarioManager : public ExcRecord
{ {
private: private:
sal_uInt16 nActive; sal_uInt16 nActive;
std::vector<ExcEScenario*> aScenes;
inline ExcEScenario* _First() { return (ExcEScenario*) List::First(); }
inline ExcEScenario* _Next() { return (ExcEScenario*) List::Next(); }
inline void Append( ExcEScenario* pScen )
{ List::Insert( pScen, LIST_APPEND ); }
virtual void SaveCont( XclExpStream& rStrm ); virtual void SaveCont( XclExpStream& rStrm );
......
...@@ -1328,7 +1328,7 @@ ExcEScenarioManager::ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab ) ...@@ -1328,7 +1328,7 @@ ExcEScenarioManager::ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab )
while( rDoc.IsScenario( nNewTab ) ) while( rDoc.IsScenario( nNewTab ) )
{ {
Append( new ExcEScenario( rRoot, nNewTab ) ); aScenes.push_back( new ExcEScenario( rRoot, nNewTab ) );
if( rDoc.IsActiveScenario( nNewTab ) ) if( rDoc.IsActiveScenario( nNewTab ) )
nActive = static_cast<sal_uInt16>(nNewTab - nFirstTab); nActive = static_cast<sal_uInt16>(nNewTab - nFirstTab);
...@@ -1338,30 +1338,32 @@ ExcEScenarioManager::ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab ) ...@@ -1338,30 +1338,32 @@ ExcEScenarioManager::ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab )
ExcEScenarioManager::~ExcEScenarioManager() ExcEScenarioManager::~ExcEScenarioManager()
{ {
for( ExcEScenario* pScen = _First(); pScen; pScen = _Next() ) std::vector<ExcEScenario*>::iterator pIter;
delete pScen; for( pIter = aScenes.begin(); pIter != aScenes.end(); ++pIter )
delete *pIter;
} }
void ExcEScenarioManager::SaveCont( XclExpStream& rStrm ) void ExcEScenarioManager::SaveCont( XclExpStream& rStrm )
{ {
rStrm << (sal_uInt16) List::Count() // number of scenarios rStrm << (sal_uInt16) aScenes.size() // number of scenarios
<< nActive // active scen << nActive // active scen
<< nActive // last displayed << nActive // last displayed
<< (sal_uInt16) 0; // reference areas << (sal_uInt16) 0; // reference areas
} }
void ExcEScenarioManager::Save( XclExpStream& rStrm ) void ExcEScenarioManager::Save( XclExpStream& rStrm )
{ {
if( List::Count() ) if( !aScenes.empty() )
ExcRecord::Save( rStrm ); ExcRecord::Save( rStrm );
for( ExcEScenario* pScen = _First(); pScen; pScen = _Next() ) std::vector<ExcEScenario*>::iterator pIter;
pScen->Save( rStrm ); for( pIter = aScenes.begin(); pIter != aScenes.end(); ++pIter )
(*pIter)->Save( rStrm );
} }
void ExcEScenarioManager::SaveXml( XclExpXmlStream& rStrm ) void ExcEScenarioManager::SaveXml( XclExpXmlStream& rStrm )
{ {
if( ! List::Count() ) if( aScenes.empty() )
return; return;
sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream(); sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
...@@ -1371,8 +1373,9 @@ void ExcEScenarioManager::SaveXml( XclExpXmlStream& rStrm ) ...@@ -1371,8 +1373,9 @@ void ExcEScenarioManager::SaveXml( XclExpXmlStream& rStrm )
// OOXTODO: XML_sqref, // OOXTODO: XML_sqref,
FSEND ); FSEND );
for( ExcEScenario* pScen = _First(); pScen; pScen = _Next() ) std::vector<ExcEScenario*>::iterator pIter;
pScen->SaveXml( rStrm ); for( pIter = aScenes.begin(); pIter != aScenes.end(); ++pIter )
(*pIter)->SaveXml( rStrm );
rWorkbook->endElement( XML_scenarios ); rWorkbook->endElement( XML_scenarios );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment