Kaydet (Commit) 0d7193bd authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in ScRTFParser

Change-Id: I3192704e0dc594f7496978414a8c1d93a4e0e5bb
Reviewed-on: https://gerrit.libreoffice.org/57300
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst c6dc541a
...@@ -55,7 +55,7 @@ private: ...@@ -55,7 +55,7 @@ private:
size_t mnCurPos; size_t mnCurPos;
ScRTFColTwips aColTwips; ScRTFColTwips aColTwips;
ScRTFCellDefault* pInsDefault; std::unique_ptr<ScRTFCellDefault> pInsDefault;
ScRTFCellDefault* pActDefault; ScRTFCellDefault* pActDefault;
ScRTFCellDefault* pDefMerge; ScRTFCellDefault* pDefMerge;
sal_uLong nStartAdjust; sal_uLong nStartAdjust;
......
...@@ -47,12 +47,12 @@ ScRTFParser::ScRTFParser( EditEngine* pEditP ) : ...@@ -47,12 +47,12 @@ ScRTFParser::ScRTFParser( EditEngine* pEditP ) :
long nMM = OutputDevice::LogicToLogic( 12, MapUnit::MapPoint, MapUnit::Map100thMM ); long nMM = OutputDevice::LogicToLogic( 12, MapUnit::MapPoint, MapUnit::Map100thMM );
pPool->SetPoolDefaultItem( SvxFontHeightItem( nMM, 100, EE_CHAR_FONTHEIGHT ) ); pPool->SetPoolDefaultItem( SvxFontHeightItem( nMM, 100, EE_CHAR_FONTHEIGHT ) );
// Free-flying pInsDefault // Free-flying pInsDefault
pInsDefault = new ScRTFCellDefault( pPool ); pInsDefault.reset( new ScRTFCellDefault( pPool ) );
} }
ScRTFParser::~ScRTFParser() ScRTFParser::~ScRTFParser()
{ {
delete pInsDefault; pInsDefault.reset();
maDefaultList.clear(); maDefaultList.clear();
} }
...@@ -271,7 +271,7 @@ void ScRTFParser::ProcToken( RtfImportInfo* pInfo ) ...@@ -271,7 +271,7 @@ void ScRTFParser::ProcToken( RtfImportInfo* pInfo )
nLastWidth = maDefaultList.back()->nTwips; nLastWidth = maDefaultList.back()->nTwips;
nColCnt = 0; nColCnt = 0;
if (pActDefault != pInsDefault) if (pActDefault != pInsDefault.get())
pActDefault = nullptr; pActDefault = nullptr;
maDefaultList.clear(); maDefaultList.clear();
pDefMerge = nullptr; pDefMerge = nullptr;
...@@ -281,7 +281,7 @@ void ScRTFParser::ProcToken( RtfImportInfo* pInfo ) ...@@ -281,7 +281,7 @@ void ScRTFParser::ProcToken( RtfImportInfo* pInfo )
break; break;
case RTF_CLMGF: // The first cell of cells to be merged case RTF_CLMGF: // The first cell of cells to be merged
{ {
pDefMerge = pInsDefault; pDefMerge = pInsDefault.get();
nRtfLastToken = pInfo->nToken; nRtfLastToken = pInfo->nToken;
} }
break; break;
...@@ -304,9 +304,9 @@ void ScRTFParser::ProcToken( RtfImportInfo* pInfo ) ...@@ -304,9 +304,9 @@ void ScRTFParser::ProcToken( RtfImportInfo* 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( std::unique_ptr<ScRTFCellDefault>(pInsDefault) ); maDefaultList.push_back( std::move(pInsDefault) );
// New free-flying pInsDefault // New free-flying pInsDefault
pInsDefault = new ScRTFCellDefault( pPool ); pInsDefault.reset( new ScRTFCellDefault( pPool ) );
if ( ++nColCnt > nColMax ) if ( ++nColCnt > nColMax )
nColMax = nColCnt; nColMax = nColCnt;
nRtfLastToken = pInfo->nToken; nRtfLastToken = pInfo->nToken;
...@@ -330,7 +330,7 @@ void ScRTFParser::ProcToken( RtfImportInfo* pInfo ) ...@@ -330,7 +330,7 @@ void ScRTFParser::ProcToken( RtfImportInfo* pInfo )
NewCellRow(); // before was no \intbl, bad behavior NewCellRow(); // before was no \intbl, bad behavior
// Broken RTF? Let's save what we can // Broken RTF? Let's save what we can
if ( !pActDefault ) if ( !pActDefault )
pActDefault = pInsDefault; pActDefault = pInsDefault.get();
if ( pActDefault->nColOverlap > 0 ) if ( pActDefault->nColOverlap > 0 )
{ // Not merged with preceding { // Not merged with preceding
mxActEntry->nCol = pActDefault->nCol; mxActEntry->nCol = pActDefault->nCol;
......
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