Kaydet (Commit) 51e4d1dc authored tarafından Noel Grandin's avatar Noel Grandin

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

Change-Id: I32ae2419ce6f7cce6e3da182c582b49be8dd362f
üst 5f87aafe
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
#include "eeparser.hxx" #include "eeparser.hxx"
#include <boost/ptr_container/ptr_vector.hpp> #include <vector>
#include <memory>
#include <o3tl/sorted_vector.hxx> #include <o3tl/sorted_vector.hxx>
struct ScRTFCellDefault struct ScRTFCellDefault
...@@ -48,7 +49,7 @@ class EditEngine; ...@@ -48,7 +49,7 @@ class EditEngine;
class ScRTFParser : public ScEEParser class ScRTFParser : public ScEEParser
{ {
private: private:
typedef boost::ptr_vector<ScRTFCellDefault> DefaultList; typedef std::vector< std::unique_ptr<ScRTFCellDefault> > DefaultList;
DefaultList maDefaultList; DefaultList maDefaultList;
size_t mnCurPos; size_t mnCurPos;
......
...@@ -207,7 +207,7 @@ void ScRTFParser::NewCellRow( ImportInfo* /*pInfo*/ ) ...@@ -207,7 +207,7 @@ void ScRTFParser::NewCellRow( ImportInfo* /*pInfo*/ )
// Not flush on the right? => new table // Not flush on the right? => new table
if ( nLastWidth && !maDefaultList.empty() ) if ( nLastWidth && !maDefaultList.empty() )
{ {
const ScRTFCellDefault& rD = maDefaultList.back(); const ScRTFCellDefault& rD = *maDefaultList.back().get();
if (rD.nTwips != nLastWidth) if (rD.nTwips != nLastWidth)
{ {
SCCOL n1, n2; SCCOL n1, n2;
...@@ -224,14 +224,14 @@ void ScRTFParser::NewCellRow( ImportInfo* /*pInfo*/ ) ...@@ -224,14 +224,14 @@ void ScRTFParser::NewCellRow( ImportInfo* /*pInfo*/ )
// Build up TwipCols only after nLastWidth comparison! // Build up TwipCols only after nLastWidth comparison!
for ( size_t i = 0, n = maDefaultList.size(); i < n; ++i ) for ( size_t i = 0, n = maDefaultList.size(); i < n; ++i )
{ {
const ScRTFCellDefault& rD = maDefaultList[i]; const ScRTFCellDefault& rD = *maDefaultList[i].get();
SCCOL nCol; SCCOL nCol;
if ( !SeekTwips(rD.nTwips, &nCol) ) if ( !SeekTwips(rD.nTwips, &nCol) )
pColTwips->insert( rD.nTwips ); pColTwips->insert( rD.nTwips );
} }
} }
pDefMerge = nullptr; pDefMerge = nullptr;
pActDefault = maDefaultList.empty() ? nullptr : &maDefaultList[0]; pActDefault = maDefaultList.empty() ? nullptr : maDefaultList[0].get();
mnCurPos = 0; mnCurPos = 0;
OSL_ENSURE( pActDefault, "NewCellRow: pActDefault==0" ); OSL_ENSURE( pActDefault, "NewCellRow: pActDefault==0" );
} }
...@@ -270,7 +270,7 @@ void ScRTFParser::ProcToken( ImportInfo* pInfo ) ...@@ -270,7 +270,7 @@ void ScRTFParser::ProcToken( ImportInfo* pInfo )
case RTF_TROWD: // denotes table row defauls, before RTF_CELLX case RTF_TROWD: // denotes table row defauls, before RTF_CELLX
{ {
if (!maDefaultList.empty()) if (!maDefaultList.empty())
nLastWidth = maDefaultList.back().nTwips; nLastWidth = maDefaultList.back()->nTwips;
nColCnt = 0; nColCnt = 0;
maDefaultList.clear(); maDefaultList.clear();
...@@ -289,7 +289,7 @@ void ScRTFParser::ProcToken( ImportInfo* pInfo ) ...@@ -289,7 +289,7 @@ void ScRTFParser::ProcToken( ImportInfo* pInfo )
{ {
if (!pDefMerge && !maDefaultList.empty()) if (!pDefMerge && !maDefaultList.empty())
{ {
pDefMerge = &maDefaultList.back(); pDefMerge = maDefaultList.back().get();
mnCurPos = maDefaultList.size() - 1; mnCurPos = maDefaultList.size() - 1;
} }
OSL_ENSURE( pDefMerge, "RTF_CLMRG: pDefMerge==0" ); OSL_ENSURE( pDefMerge, "RTF_CLMRG: pDefMerge==0" );
...@@ -304,7 +304,7 @@ void ScRTFParser::ProcToken( ImportInfo* pInfo ) ...@@ -304,7 +304,7 @@ void ScRTFParser::ProcToken( ImportInfo* pInfo )
bNewDef = true; bNewDef = true;
pInsDefault->nCol = nColCnt; pInsDefault->nCol = nColCnt;
pInsDefault->nTwips = pInfo->nTokenValue; // Right cell border pInsDefault->nTwips = pInfo->nTokenValue; // Right cell border
maDefaultList.push_back( pInsDefault ); maDefaultList.push_back( std::unique_ptr<ScRTFCellDefault>(pInsDefault) );
// New free-flying pInsDefault // New free-flying pInsDefault
pInsDefault = new ScRTFCellDefault( pPool ); pInsDefault = new ScRTFCellDefault( pPool );
if ( ++nColCnt > nColMax ) if ( ++nColCnt > nColMax )
...@@ -359,7 +359,7 @@ void ScRTFParser::ProcToken( ImportInfo* pInfo ) ...@@ -359,7 +359,7 @@ void ScRTFParser::ProcToken( ImportInfo* pInfo )
pActDefault = nullptr; pActDefault = nullptr;
if (!maDefaultList.empty() && (mnCurPos+1) < maDefaultList.size()) if (!maDefaultList.empty() && (mnCurPos+1) < maDefaultList.size())
pActDefault = &maDefaultList[++mnCurPos]; pActDefault = maDefaultList[++mnCurPos].get();
nLastToken = pInfo->nToken; nLastToken = pInfo->nToken;
} }
......
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