Kaydet (Commit) 83a58be1 authored tarafından Noel Grandin's avatar Noel Grandin

sc: boost::ptr_vector->std::vector

Change-Id: If3fff7cec768be9ce4cad6064415c1739433e030
üst 16877ccb
...@@ -807,7 +807,7 @@ bool DifParser::ScanFloatVal( const sal_Unicode* pStart ) ...@@ -807,7 +807,7 @@ bool DifParser::ScanFloatVal( const sal_Unicode* pStart )
} }
DifColumn::DifColumn () DifColumn::DifColumn ()
: pAkt(nullptr) : mpAkt(nullptr)
{ {
} }
...@@ -815,23 +815,22 @@ void DifColumn::SetLogical( SCROW nRow ) ...@@ -815,23 +815,22 @@ void DifColumn::SetLogical( SCROW nRow )
{ {
OSL_ENSURE( ValidRow(nRow), "*DifColumn::SetLogical(): Row too big!" ); OSL_ENSURE( ValidRow(nRow), "*DifColumn::SetLogical(): Row too big!" );
if( pAkt ) if( mpAkt )
{ {
OSL_ENSURE( nRow > 0, "*DifColumn::SetLogical(): more cannot be zero!" ); OSL_ENSURE( nRow > 0, "*DifColumn::SetLogical(): more cannot be zero!" );
nRow--; nRow--;
if( pAkt->nEnd == nRow ) if( mpAkt->nEnd == nRow )
pAkt->nEnd++; mpAkt->nEnd++;
else else
pAkt = nullptr; mpAkt = nullptr;
} }
else else
{ {
pAkt = new ENTRY; maEntries.push_back(ENTRY());
pAkt->nStart = pAkt->nEnd = nRow; mpAkt = &maEntries.back();
mpAkt->nStart = mpAkt->nEnd = nRow;
aEntries.push_back(pAkt);
} }
} }
...@@ -841,15 +840,15 @@ void DifColumn::SetNumFormat( SCROW nRow, const sal_uInt32 nNumFormat ) ...@@ -841,15 +840,15 @@ void DifColumn::SetNumFormat( SCROW nRow, const sal_uInt32 nNumFormat )
if( nNumFormat > 0 ) if( nNumFormat > 0 )
{ {
if(pAkt) if(mpAkt)
{ {
OSL_ENSURE( nRow > 0, OSL_ENSURE( nRow > 0,
"*DifColumn::SetNumFormat(): more cannot be zero!" ); "*DifColumn::SetNumFormat(): more cannot be zero!" );
OSL_ENSURE( nRow > pAkt->nEnd, OSL_ENSURE( nRow > mpAkt->nEnd,
"*DifColumn::SetNumFormat(): start from scratch?" ); "*DifColumn::SetNumFormat(): start from scratch?" );
if( pAkt->nNumFormat == nNumFormat && pAkt->nEnd == nRow - 1 ) if( mpAkt->nNumFormat == nNumFormat && mpAkt->nEnd == nRow - 1 )
pAkt->nEnd = nRow; mpAkt->nEnd = nRow;
else else
NewEntry( nRow, nNumFormat ); NewEntry( nRow, nNumFormat );
} }
...@@ -857,21 +856,21 @@ void DifColumn::SetNumFormat( SCROW nRow, const sal_uInt32 nNumFormat ) ...@@ -857,21 +856,21 @@ void DifColumn::SetNumFormat( SCROW nRow, const sal_uInt32 nNumFormat )
NewEntry(nRow,nNumFormat ); NewEntry(nRow,nNumFormat );
} }
else else
pAkt = nullptr; mpAkt = nullptr;
} }
void DifColumn::NewEntry( const SCROW nPos, const sal_uInt32 nNumFormat ) void DifColumn::NewEntry( const SCROW nPos, const sal_uInt32 nNumFormat )
{ {
pAkt = new ENTRY; maEntries.push_back(ENTRY());
pAkt->nStart = pAkt->nEnd = nPos; mpAkt = &maEntries.back();
pAkt->nNumFormat = nNumFormat; mpAkt->nStart = mpAkt->nEnd = nPos;
mpAkt->nNumFormat = nNumFormat;
aEntries.push_back(pAkt);
} }
void DifColumn::Apply( ScDocument& rDoc, const SCCOL nCol, const SCTAB nTab, const ScPatternAttr& rPattAttr ) void DifColumn::Apply( ScDocument& rDoc, const SCCOL nCol, const SCTAB nTab, const ScPatternAttr& rPattAttr )
{ {
for (boost::ptr_vector<ENTRY>::const_iterator it = aEntries.begin(); it != aEntries.end(); ++it) for (std::vector<ENTRY>::const_iterator it = maEntries.begin(); it != maEntries.end(); ++it)
rDoc.ApplyPatternAreaTab( nCol, it->nStart, nCol, it->nEnd, nTab, rPattAttr ); rDoc.ApplyPatternAreaTab( nCol, it->nStart, nCol, it->nEnd, nTab, rPattAttr );
} }
...@@ -880,7 +879,7 @@ void DifColumn::Apply( ScDocument& rDoc, const SCCOL nCol, const SCTAB nTab ) ...@@ -880,7 +879,7 @@ void DifColumn::Apply( ScDocument& rDoc, const SCCOL nCol, const SCTAB nTab )
ScPatternAttr aAttr( rDoc.GetPool() ); ScPatternAttr aAttr( rDoc.GetPool() );
SfxItemSet &rItemSet = aAttr.GetItemSet(); SfxItemSet &rItemSet = aAttr.GetItemSet();
for (boost::ptr_vector<ENTRY>::const_iterator it = aEntries.begin(); it != aEntries.end(); ++it) for (std::vector<ENTRY>::const_iterator it = maEntries.begin(); it != maEntries.end(); ++it)
{ {
OSL_ENSURE( it->nNumFormat > 0, OSL_ENSURE( it->nNumFormat > 0,
"+DifColumn::Apply(): Number format must not be 0!" ); "+DifColumn::Apply(): Number format must not be 0!" );
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#ifndef INCLUDED_SC_SOURCE_FILTER_INC_DIF_HXX #ifndef INCLUDED_SC_SOURCE_FILTER_INC_DIF_HXX
#define INCLUDED_SC_SOURCE_FILTER_INC_DIF_HXX #define INCLUDED_SC_SOURCE_FILTER_INC_DIF_HXX
#include <boost/ptr_container/ptr_vector.hpp> #include <vector>
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
...@@ -153,8 +153,8 @@ class DifColumn ...@@ -153,8 +153,8 @@ class DifColumn
SCROW nEnd; SCROW nEnd;
}; };
ENTRY *pAkt; ENTRY *mpAkt;
boost::ptr_vector<ENTRY> aEntries; std::vector<ENTRY> maEntries;
DifColumn(); DifColumn();
......
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