Kaydet (Commit) 6c6bc189 authored tarafından Marcel Metz's avatar Marcel Metz Kaydeden (comit) Eike Rathke

Replace XclExpChTrActionStack with std::stack< XclExpChTrAction* >

üst ecfcc545
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
#ifndef SC_XCLEXPCHANGETRACK_HXX #ifndef SC_XCLEXPCHANGETRACK_HXX
#define SC_XCLEXPCHANGETRACK_HXX #define SC_XCLEXPCHANGETRACK_HXX
#include <stack>
#include <tools/datetime.hxx> #include <tools/datetime.hxx>
#include <tools/stack.hxx>
#include <rtl/uuid.h> #include <rtl/uuid.h>
#include "bigrange.hxx" #include "bigrange.hxx"
#include "chgtrack.hxx" #include "chgtrack.hxx"
...@@ -600,30 +600,15 @@ public: ...@@ -600,30 +600,15 @@ public:
virtual void SaveXml( XclExpXmlStream& rStrm ); virtual void SaveXml( XclExpXmlStream& rStrm );
}; };
//___________________________________________________________________
// XclExpChTrActionStack - temporary action stack
class XclExpChTrActionStack : private Stack
{
public:
virtual ~XclExpChTrActionStack();
void Push( XclExpChTrAction* pNewRec );
inline XclExpChTrAction* Pop() { return (XclExpChTrAction*) Stack::Pop(); }
private:
using Stack::Push;
};
//___________________________________________________________________ //___________________________________________________________________
// XclExpChangeTrack - exports the "Revision Log" stream // XclExpChangeTrack - exports the "Revision Log" stream
class XclExpChangeTrack : protected XclExpRoot class XclExpChangeTrack : protected XclExpRoot
{ {
private: private:
std::vector<ExcRecord*> aRecList; // list of "Revision Log" stream records std::vector<ExcRecord*> aRecList; // list of "Revision Log" stream records
XclExpChTrActionStack aActionStack; std::stack<XclExpChTrAction*> aActionStack;
XclExpChTrTabIdBuffer* pTabIdBuffer; XclExpChTrTabIdBuffer* pTabIdBuffer;
std::vector<XclExpChTrTabIdBuffer*> maBuffers; std::vector<XclExpChTrTabIdBuffer*> maBuffers;
ScDocument* pTempDoc; // empty document ScDocument* pTempDoc; // empty document
......
...@@ -1325,21 +1325,6 @@ void XclExpChTr0x014A::SaveXml( XclExpXmlStream& rStrm ) ...@@ -1325,21 +1325,6 @@ void XclExpChTr0x014A::SaveXml( XclExpXmlStream& rStrm )
//___________________________________________________________________ //___________________________________________________________________
XclExpChTrActionStack::~XclExpChTrActionStack()
{
while( XclExpChTrAction* pRec = Pop() )
delete pRec;
}
void XclExpChTrActionStack::Push( XclExpChTrAction* pNewRec )
{
OSL_ENSURE( pNewRec, "XclExpChTrActionStack::Push - NULL pointer" );
if( pNewRec )
Stack::Push( pNewRec );
}
//___________________________________________________________________
class ExcXmlRecord : public ExcRecord class ExcXmlRecord : public ExcRecord
{ {
public: public:
...@@ -1479,8 +1464,11 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) : ...@@ -1479,8 +1464,11 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) :
DateTime aLastDateTime( DateTime::EMPTY ); DateTime aLastDateTime( DateTime::EMPTY );
sal_uInt32 nIndex = 1; sal_uInt32 nIndex = 1;
sal_Int32 nLogNumber = 1; sal_Int32 nLogNumber = 1;
while( XclExpChTrAction* pAction = aActionStack.Pop() ) while( !aActionStack.empty() )
{ {
XclExpChTrAction* pAction = aActionStack.top();
aActionStack.pop();
if( (nIndex == 1) || pAction->ForceInfoRecord() || if( (nIndex == 1) || pAction->ForceInfoRecord() ||
(pAction->GetUsername() != sLastUsername) || (pAction->GetUsername() != sLastUsername) ||
(pAction->GetDateTime() != aLastDateTime) ) (pAction->GetDateTime() != aLastDateTime) )
...@@ -1526,6 +1514,12 @@ XclExpChangeTrack::~XclExpChangeTrack() ...@@ -1526,6 +1514,12 @@ XclExpChangeTrack::~XclExpChangeTrack()
for ( pIter = maBuffers.begin(); pIter != maBuffers.end(); ++pIter ) for ( pIter = maBuffers.begin(); pIter != maBuffers.end(); ++pIter )
delete *pIter; delete *pIter;
while( !aActionStack.empty() )
{
delete aActionStack.top();
aActionStack.pop();
}
if( pTempDoc ) if( pTempDoc )
delete pTempDoc; delete pTempDoc;
} }
...@@ -1592,7 +1586,7 @@ void XclExpChangeTrack::PushActionRecord( const ScChangeAction& rAction ) ...@@ -1592,7 +1586,7 @@ void XclExpChangeTrack::PushActionRecord( const ScChangeAction& rAction )
default:; default:;
} }
if( pXclAction ) if( pXclAction )
aActionStack.Push( pXclAction ); aActionStack.push( pXclAction );
} }
sal_Bool XclExpChangeTrack::WriteUserNamesStream() sal_Bool XclExpChangeTrack::WriteUserNamesStream()
......
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