[Libreoffice-commits] .: 3 commits - sc/source
Petr Mladek
pmladek at kemper.freedesktop.org
Tue Jun 7 10:29:20 PDT 2011
sc/source/filter/inc/xcl97rec.hxx | 24 ++++---------
sc/source/filter/xcl97/xcl97rec.cxx | 66 +++++++++++++++++++-----------------
2 files changed, 44 insertions(+), 46 deletions(-)
New commits:
commit 72758dd5cf06b1b40cf297a98231160f1c5301aa
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Thu Jun 2 16:30:44 2011 -0430
Replace List for std::vector<ExcEScenario*>.
diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx
index 6f768c0..7248bd9 100644
--- a/sc/source/filter/inc/xcl97rec.hxx
+++ b/sc/source/filter/inc/xcl97rec.hxx
@@ -402,16 +402,11 @@ public:
-class ExcEScenarioManager : public ExcRecord, private List
+class ExcEScenarioManager : public ExcRecord
{
private:
sal_uInt16 nActive;
-
- inline ExcEScenario* _First() { return (ExcEScenario*) List::First(); }
- inline ExcEScenario* _Next() { return (ExcEScenario*) List::Next(); }
-
- inline void Append( ExcEScenario* pScen )
- { List::Insert( pScen, LIST_APPEND ); }
+ std::vector<ExcEScenario*> aScenes;
virtual void SaveCont( XclExpStream& rStrm );
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 7c1c19d..7c8c921 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1328,7 +1328,7 @@ ExcEScenarioManager::ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab )
while( rDoc.IsScenario( nNewTab ) )
{
- Append( new ExcEScenario( rRoot, nNewTab ) );
+ aScenes.push_back( new ExcEScenario( rRoot, nNewTab ) );
if( rDoc.IsActiveScenario( nNewTab ) )
nActive = static_cast<sal_uInt16>(nNewTab - nFirstTab);
@@ -1338,30 +1338,32 @@ ExcEScenarioManager::ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab )
ExcEScenarioManager::~ExcEScenarioManager()
{
- for( ExcEScenario* pScen = _First(); pScen; pScen = _Next() )
- delete pScen;
+ std::vector<ExcEScenario*>::iterator pIter;
+ for( pIter = aScenes.begin(); pIter != aScenes.end(); ++pIter )
+ delete *pIter;
}
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 // last displayed
- << (sal_uInt16) 0; // reference areas
+ << (sal_uInt16) 0; // reference areas
}
void ExcEScenarioManager::Save( XclExpStream& rStrm )
{
- if( List::Count() )
+ if( !aScenes.empty() )
ExcRecord::Save( rStrm );
- for( ExcEScenario* pScen = _First(); pScen; pScen = _Next() )
- pScen->Save( rStrm );
+ std::vector<ExcEScenario*>::iterator pIter;
+ for( pIter = aScenes.begin(); pIter != aScenes.end(); ++pIter )
+ (*pIter)->Save( rStrm );
}
void ExcEScenarioManager::SaveXml( XclExpXmlStream& rStrm )
{
- if( ! List::Count() )
+ if( aScenes.empty() )
return;
sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
@@ -1371,8 +1373,9 @@ void ExcEScenarioManager::SaveXml( XclExpXmlStream& rStrm )
// OOXTODO: XML_sqref,
FSEND );
- for( ExcEScenario* pScen = _First(); pScen; pScen = _Next() )
- pScen->SaveXml( rStrm );
+ std::vector<ExcEScenario*>::iterator pIter;
+ for( pIter = aScenes.begin(); pIter != aScenes.end(); ++pIter )
+ (*pIter)->SaveXml( rStrm );
rWorkbook->endElement( XML_scenarios );
}
commit febdf0679added11c5025fc5abb365894f7d19c4
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Thu Jun 2 16:14:15 2011 -0430
Make read only functions in ExcEScenarioCell const.
diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx
index b679abe..6f768c0 100644
--- a/sc/source/filter/inc/xcl97rec.hxx
+++ b/sc/source/filter/inc/xcl97rec.hxx
@@ -363,13 +363,13 @@ protected:
public:
ExcEScenarioCell( sal_uInt16 nC, sal_uInt16 nR, const String& rTxt );
- inline sal_Size GetStringBytes()
+ inline sal_Size GetStringBytes() const
{ return sText.GetSize(); }
- void WriteAddress( XclExpStream& rStrm );
- void WriteText( XclExpStream& rStrm );
+ void WriteAddress( XclExpStream& rStrm ) const ;
+ void WriteText( XclExpStream& rStrm ) const;
- void SaveXml( XclExpXmlStream& rStrm );
+ void SaveXml( XclExpXmlStream& rStrm ) const;
};
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 6e02c1a..7c1c19d 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1164,17 +1164,17 @@ ExcEScenarioCell::ExcEScenarioCell( sal_uInt16 nC, sal_uInt16 nR, const String&
{
}
-void ExcEScenarioCell::WriteAddress( XclExpStream& rStrm )
+void ExcEScenarioCell::WriteAddress( XclExpStream& rStrm ) const
{
rStrm << nRow << nCol;
}
-void ExcEScenarioCell::WriteText( XclExpStream& rStrm )
+void ExcEScenarioCell::WriteText( XclExpStream& rStrm ) const
{
rStrm << sText;
}
-void ExcEScenarioCell::SaveXml( XclExpXmlStream& rStrm )
+void ExcEScenarioCell::SaveXml( XclExpXmlStream& rStrm ) const
{
rStrm.GetCurrentStream()->singleElement( XML_inputCells,
// OOXTODO: XML_deleted,
commit 8855ea8c2101ce0c15c67b88b1a805fcf47a2642
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Thu Jun 2 16:10:54 2011 -0430
Replace List for std::vector<ExcEScenarioCell>.
diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx
index c92557b..b679abe 100644
--- a/sc/source/filter/inc/xcl97rec.hxx
+++ b/sc/source/filter/inc/xcl97rec.hxx
@@ -374,17 +374,16 @@ public:
-class ExcEScenario : public ExcRecord, private List
+class ExcEScenario : public ExcRecord
{
private:
sal_Size nRecLen;
XclExpString sName;
XclExpString sComment;
XclExpString sUserName;
- sal_uInt8 nProtected;
+ sal_uInt8 nProtected;
- inline ExcEScenarioCell* _First() { return (ExcEScenarioCell*) List::First(); }
- inline ExcEScenarioCell* _Next() { return (ExcEScenarioCell*) List::Next(); }
+ std::vector<ExcEScenarioCell> aCells;
sal_Bool Append( sal_uInt16 nCol, sal_uInt16 nRow, const String& rTxt );
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 085c378..6e02c1a 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1244,25 +1244,25 @@ ExcEScenario::ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab )
ExcEScenario::~ExcEScenario()
{
- for( ExcEScenarioCell* pCell = _First(); pCell; pCell = _Next() )
- delete pCell;
}
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;
- ExcEScenarioCell* pCell = new ExcEScenarioCell( nCol, nRow, rTxt );
- List::Insert( pCell, LIST_APPEND );
- nRecLen += 6 + pCell->GetStringBytes(); // 4 bytes address, 2 bytes ifmt
+ ExcEScenarioCell aCell(nCol, nRow, rTxt);
+ aCells.push_back(aCell);
+ nRecLen += 6 + aCell.GetStringBytes(); // 4 bytes address, 2 bytes ifmt
return sal_True;
}
void ExcEScenario::SaveCont( XclExpStream& rStrm )
{
- rStrm << (sal_uInt16) List::Count() // number of cells
- << nProtected // fProtection
+ sal_uInt16 count = aCells.size();
+
+ rStrm << (sal_uInt16) count // number of cells
+ << nProtected // fProtection
<< (sal_uInt8) 0 // fHidden
<< (sal_uInt8) sName.Len() // length of scen name
<< (sal_uInt8) sComment.Len() // length of comment
@@ -1275,13 +1275,13 @@ void ExcEScenario::SaveCont( XclExpStream& rStrm )
if( sComment.Len() )
rStrm << sComment;
- ExcEScenarioCell* pCell;
- for( pCell = _First(); pCell; pCell = _Next() )
- pCell->WriteAddress( rStrm ); // pos of cell
- for( pCell = _First(); pCell; pCell = _Next() )
- pCell->WriteText( rStrm ); // string content
+ std::vector<ExcEScenarioCell>::iterator pIter;
+ for( pIter = aCells.begin(); pIter != aCells.end(); ++pIter )
+ pIter->WriteAddress( rStrm ); // pos of cell
+ for( pIter = aCells.begin(); pIter != aCells.end(); ++pIter )
+ pIter->WriteText( rStrm ); // string content
rStrm.SetSliceSize( 2 );
- rStrm.WriteZeroBytes( 2 * List::Count() ); // date format
+ rStrm.WriteZeroBytes( 2 * count ); // date format
}
sal_uInt16 ExcEScenario::GetNum() const
@@ -1301,13 +1301,14 @@ void ExcEScenario::SaveXml( XclExpXmlStream& rStrm )
XML_name, XclXmlUtils::ToOString( sName ).getStr(),
XML_locked, XclXmlUtils::ToPsz( nProtected ),
// 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_comment, XESTRING_TO_PSZ( sComment ),
FSEND );
- for( ExcEScenarioCell* pCell = _First(); pCell; pCell = _Next() )
- pCell->SaveXml( rStrm );
+ std::vector<ExcEScenarioCell>::iterator pIter;
+ for( pIter = aCells.begin(); pIter != aCells.end(); ++pIter )
+ pIter->SaveXml( rStrm );
rWorkbook->endElement( XML_scenario );
}
More information about the Libreoffice-commits
mailing list