Kaydet (Commit) 01bd9471 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

Convert SV_DECL_PTRARR(WW8_WrFkpPtrs) to boost::ptr_vector

I used a ptr_vector here even though the old code was not
declared with PTRARR_DEL because the lifecycle of the
array elements is completely bound to the lifecycle
of the parent object.
üst abaa69f9
...@@ -226,8 +226,6 @@ public: ...@@ -226,8 +226,6 @@ public:
#define sMainStream CREATE_CONST_ASC("WordDocument") #define sMainStream CREATE_CONST_ASC("WordDocument")
#define sCompObj CREATE_CONST_ASC("\1CompObj") #define sCompObj CREATE_CONST_ASC("\1CompObj")
SV_IMPL_PTRARR( WW8_WrFkpPtrs, WW8_FkpPtr )
static void WriteDop( WW8Export& rWrt ) static void WriteDop( WW8Export& rWrt )
{ {
WW8Dop& rDop = *rWrt.pDop; WW8Dop& rDop = *rWrt.pDop;
...@@ -773,24 +771,23 @@ sal_uLong SwWW8Writer::FillUntil( SvStream& rStrm, sal_uLong nEndPos ) ...@@ -773,24 +771,23 @@ sal_uLong SwWW8Writer::FillUntil( SvStream& rStrm, sal_uLong nEndPos )
WW8_WrPlcPn::WW8_WrPlcPn( WW8Export& rWr, ePLCFT ePl, WW8_FC nStartFc ) WW8_WrPlcPn::WW8_WrPlcPn( WW8Export& rWr, ePLCFT ePl, WW8_FC nStartFc )
: rWrt(rWr), nFkpStartPage(0), ePlc(ePl), nMark(0) : rWrt(rWr), nFkpStartPage(0), ePlc(ePl), nMark(0)
{ {
WW8_FkpPtr pF = new WW8_WrFkp( ePlc, nStartFc, rWrt.bWrtWW8 ); WW8_WrFkp* pF = new WW8_WrFkp( ePlc, nStartFc, rWrt.bWrtWW8 );
aFkps.Insert( pF, aFkps.Count() ); aFkps.push_back( pF );
} }
WW8_WrPlcPn::~WW8_WrPlcPn() WW8_WrPlcPn::~WW8_WrPlcPn()
{ {
aFkps.DeleteAndDestroy( 0, aFkps.Count() );
} }
sal_uInt8 *WW8_WrPlcPn::CopyLastSprms(sal_uInt8 &rLen) sal_uInt8 *WW8_WrPlcPn::CopyLastSprms(sal_uInt8 &rLen)
{ {
WW8_FkpPtr pF = aFkps.GetObject(aFkps.Count() - 1); WW8_WrFkp& rF = aFkps.back();
return pF->CopyLastSprms(rLen, rWrt.bWrtWW8); return rF.CopyLastSprms(rLen, rWrt.bWrtWW8);
} }
void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* pSprms) void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* pSprms)
{ {
WW8_FkpPtr pF = aFkps.GetObject( aFkps.Count() - 1 ); WW8_WrFkp* pF = &aFkps.back();
// big sprm? build the sprmPHugePapx // big sprm? build the sprmPHugePapx
sal_uInt8* pNewSprms = (sal_uInt8*)pSprms; sal_uInt8* pNewSprms = (sal_uInt8*)pSprms;
...@@ -829,7 +826,7 @@ void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* pS ...@@ -829,7 +826,7 @@ void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* pS
pF->Combine(); pF->Combine();
pF = new WW8_WrFkp( ePlc, pF->GetEndFc(), rWrt.bWrtWW8 );// Anfang neuer Fkp pF = new WW8_WrFkp( ePlc, pF->GetEndFc(), rWrt.bWrtWW8 );// Anfang neuer Fkp
// == Ende alter Fkp // == Ende alter Fkp
aFkps.Insert( pF, aFkps.Count() ); aFkps.push_back( pF );
if( !pF->Append( nEndFc, nVarLen, pNewSprms ) ) if( !pF->Append( nEndFc, nVarLen, pNewSprms ) )
{ {
OSL_ENSURE( !this, "Sprm liess sich nicht einfuegen" ); OSL_ENSURE( !this, "Sprm liess sich nicht einfuegen" );
...@@ -843,18 +840,18 @@ void WW8_WrPlcPn::WriteFkps() ...@@ -843,18 +840,18 @@ void WW8_WrPlcPn::WriteFkps()
{ {
nFkpStartPage = (sal_uInt16) ( SwWW8Writer::FillUntil( rWrt.Strm() ) >> 9 ); nFkpStartPage = (sal_uInt16) ( SwWW8Writer::FillUntil( rWrt.Strm() ) >> 9 );
for( sal_uInt16 i = 0; i < aFkps.Count(); i++ ) for( sal_uInt16 i = 0; i < aFkps.size(); i++ )
aFkps.GetObject( i )->Write( rWrt.Strm(), *rWrt.pGrf ); aFkps[ i ].Write( rWrt.Strm(), *rWrt.pGrf );
if( CHP == ePlc ) if( CHP == ePlc )
{ {
rWrt.pFib->pnChpFirst = nFkpStartPage; rWrt.pFib->pnChpFirst = nFkpStartPage;
rWrt.pFib->cpnBteChp = aFkps.Count(); rWrt.pFib->cpnBteChp = aFkps.size();
} }
else else
{ {
rWrt.pFib->pnPapFirst = nFkpStartPage; rWrt.pFib->pnPapFirst = nFkpStartPage;
rWrt.pFib->cpnBtePap = aFkps.Count(); rWrt.pFib->cpnBtePap = aFkps.size();
} }
} }
...@@ -863,19 +860,19 @@ void WW8_WrPlcPn::WritePlc() ...@@ -863,19 +860,19 @@ void WW8_WrPlcPn::WritePlc()
sal_uLong nFcStart = rWrt.pTableStrm->Tell(); sal_uLong nFcStart = rWrt.pTableStrm->Tell();
sal_uInt16 i; sal_uInt16 i;
for( i = 0; i < aFkps.Count(); i++ ) for( i = 0; i < aFkps.size(); i++ )
SwWW8Writer::WriteLong( *rWrt.pTableStrm, SwWW8Writer::WriteLong( *rWrt.pTableStrm,
aFkps.GetObject( i )->GetStartFc() ); aFkps[ i ].GetStartFc() );
SwWW8Writer::WriteLong( *rWrt.pTableStrm, SwWW8Writer::WriteLong( *rWrt.pTableStrm,
aFkps.GetObject( i - 1 )->GetEndFc() ); aFkps[ i - 1 ].GetEndFc() );
// fuer jedes FKP die Page ausgeben // fuer jedes FKP die Page ausgeben
if( rWrt.bWrtWW8) // fuer WW97 Long-Ausgabe if( rWrt.bWrtWW8) // fuer WW97 Long-Ausgabe
for ( i = 0; i < aFkps.Count(); i++) for ( i = 0; i < aFkps.size(); i++)
SwWW8Writer::WriteLong( *rWrt.pTableStrm, i + nFkpStartPage ); SwWW8Writer::WriteLong( *rWrt.pTableStrm, i + nFkpStartPage );
else // fuer WW95 Short-Ausgabe else // fuer WW95 Short-Ausgabe
for ( i = 0; i < aFkps.Count(); i++) for ( i = 0; i < aFkps.size(); i++)
SwWW8Writer::WriteShort( *rWrt.pTableStrm, i + nFkpStartPage ); SwWW8Writer::WriteShort( *rWrt.pTableStrm, i + nFkpStartPage );
if( CHP == ePlc ) if( CHP == ePlc )
......
...@@ -1218,8 +1218,8 @@ public: ...@@ -1218,8 +1218,8 @@ public:
sal_uInt16 GetPos( const VoidPtr& p ) const { return aCntnt.GetPos( p ); } sal_uInt16 GetPos( const VoidPtr& p ) const { return aCntnt.GetPos( p ); }
}; };
typedef WW8_WrFkp* WW8_FkpPtr; // Plc fuer Chpx und Papx ( incl PN-Plc ) // Plc fuer Chpx und Papx ( incl PN-Plc )
SV_DECL_PTRARR( WW8_WrFkpPtrs, WW8_FkpPtr, 4 ) typedef boost::ptr_vector<WW8_WrFkp> WW8_WrFkpPtrs;
class WW8_WrPlcPn // Plc fuer Page Numbers class WW8_WrPlcPn // Plc fuer Page Numbers
{ {
......
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