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

Replace List for std::vector<ExcEScenarioCell>.

üst e4c03fb6
...@@ -374,17 +374,16 @@ public: ...@@ -374,17 +374,16 @@ public:
class ExcEScenario : public ExcRecord, private List class ExcEScenario : public ExcRecord
{ {
private: private:
sal_Size nRecLen; sal_Size nRecLen;
XclExpString sName; XclExpString sName;
XclExpString sComment; XclExpString sComment;
XclExpString sUserName; XclExpString sUserName;
sal_uInt8 nProtected; sal_uInt8 nProtected;
inline ExcEScenarioCell* _First() { return (ExcEScenarioCell*) List::First(); } std::vector<ExcEScenarioCell> aCells;
inline ExcEScenarioCell* _Next() { return (ExcEScenarioCell*) List::Next(); }
sal_Bool Append( sal_uInt16 nCol, sal_uInt16 nRow, const String& rTxt ); sal_Bool Append( sal_uInt16 nCol, sal_uInt16 nRow, const String& rTxt );
......
...@@ -1244,25 +1244,25 @@ ExcEScenario::ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab ) ...@@ -1244,25 +1244,25 @@ ExcEScenario::ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab )
ExcEScenario::~ExcEScenario() ExcEScenario::~ExcEScenario()
{ {
for( ExcEScenarioCell* pCell = _First(); pCell; pCell = _Next() )
delete pCell;
} }
sal_Bool ExcEScenario::Append( sal_uInt16 nCol, sal_uInt16 nRow, const String& rTxt ) sal_Bool ExcEScenario::Append( sal_uInt16 nCol, sal_uInt16 nRow, const String& rTxt )
{ {
if( List::Count() == EXC_SCEN_MAXCELL ) if( aCells.size() == EXC_SCEN_MAXCELL )
return false; return false;
ExcEScenarioCell* pCell = new ExcEScenarioCell( nCol, nRow, rTxt ); ExcEScenarioCell aCell(nCol, nRow, rTxt);
List::Insert( pCell, LIST_APPEND ); aCells.push_back(aCell);
nRecLen += 6 + pCell->GetStringBytes(); // 4 bytes address, 2 bytes ifmt nRecLen += 6 + aCell.GetStringBytes(); // 4 bytes address, 2 bytes ifmt
return sal_True; return sal_True;
} }
void ExcEScenario::SaveCont( XclExpStream& rStrm ) void ExcEScenario::SaveCont( XclExpStream& rStrm )
{ {
rStrm << (sal_uInt16) List::Count() // number of cells sal_uInt16 count = aCells.size();
<< nProtected // fProtection
rStrm << (sal_uInt16) count // number of cells
<< nProtected // fProtection
<< (sal_uInt8) 0 // fHidden << (sal_uInt8) 0 // fHidden
<< (sal_uInt8) sName.Len() // length of scen name << (sal_uInt8) sName.Len() // length of scen name
<< (sal_uInt8) sComment.Len() // length of comment << (sal_uInt8) sComment.Len() // length of comment
...@@ -1275,13 +1275,13 @@ void ExcEScenario::SaveCont( XclExpStream& rStrm ) ...@@ -1275,13 +1275,13 @@ void ExcEScenario::SaveCont( XclExpStream& rStrm )
if( sComment.Len() ) if( sComment.Len() )
rStrm << sComment; rStrm << sComment;
ExcEScenarioCell* pCell; std::vector<ExcEScenarioCell>::iterator pIter;
for( pCell = _First(); pCell; pCell = _Next() ) for( pIter = aCells.begin(); pIter != aCells.end(); ++pIter )
pCell->WriteAddress( rStrm ); // pos of cell pIter->WriteAddress( rStrm ); // pos of cell
for( pCell = _First(); pCell; pCell = _Next() ) for( pIter = aCells.begin(); pIter != aCells.end(); ++pIter )
pCell->WriteText( rStrm ); // string content pIter->WriteText( rStrm ); // string content
rStrm.SetSliceSize( 2 ); rStrm.SetSliceSize( 2 );
rStrm.WriteZeroBytes( 2 * List::Count() ); // date format rStrm.WriteZeroBytes( 2 * count ); // date format
} }
sal_uInt16 ExcEScenario::GetNum() const sal_uInt16 ExcEScenario::GetNum() const
...@@ -1301,13 +1301,14 @@ void ExcEScenario::SaveXml( XclExpXmlStream& rStrm ) ...@@ -1301,13 +1301,14 @@ void ExcEScenario::SaveXml( XclExpXmlStream& rStrm )
XML_name, XclXmlUtils::ToOString( sName ).getStr(), XML_name, XclXmlUtils::ToOString( sName ).getStr(),
XML_locked, XclXmlUtils::ToPsz( nProtected ), XML_locked, XclXmlUtils::ToPsz( nProtected ),
// OOXTODO: XML_hidden, // OOXTODO: XML_hidden,
XML_count, OString::valueOf( (sal_Int32) List::Count() ).getStr(), XML_count, OString::valueOf( (sal_Int32) aCells.size() ).getStr(),
XML_user, XESTRING_TO_PSZ( sUserName ), XML_user, XESTRING_TO_PSZ( sUserName ),
XML_comment, XESTRING_TO_PSZ( sComment ), XML_comment, XESTRING_TO_PSZ( sComment ),
FSEND ); FSEND );
for( ExcEScenarioCell* pCell = _First(); pCell; pCell = _Next() ) std::vector<ExcEScenarioCell>::iterator pIter;
pCell->SaveXml( rStrm ); for( pIter = aCells.begin(); pIter != aCells.end(); ++pIter )
pIter->SaveXml( rStrm );
rWorkbook->endElement( XML_scenario ); rWorkbook->endElement( XML_scenario );
} }
......
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