diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2017-02-08 22:47:56 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-09 05:57:24 +0000 |
commit | 67cf45f54c71b62226475dd54cf32fb20136a221 (patch) | |
tree | 49023417a888ddfb9e83c1e4f850e7317bb2dc83 /sc | |
parent | 14c8ed764c5a4dc64f10389a83d396f055af145b (diff) |
move member to stack
ScRTFColTwips is a vector with some extra logic
Change-Id: I1ef08152d57f73404d08a566e311fdbe8934f68c
Reviewed-on: https://gerrit.libreoffice.org/34047
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/inc/rtfparse.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/rtf/rtfparse.cxx | 18 |
2 files changed, 9 insertions, 11 deletions
diff --git a/sc/source/filter/inc/rtfparse.hxx b/sc/source/filter/inc/rtfparse.hxx index 3fe1db4c62d6..ccb79086fd39 100644 --- a/sc/source/filter/inc/rtfparse.hxx +++ b/sc/source/filter/inc/rtfparse.hxx @@ -54,7 +54,7 @@ private: DefaultList maDefaultList; size_t mnCurPos; - ScRTFColTwips* pColTwips; + ScRTFColTwips aColTwips; ScRTFCellDefault* pInsDefault; ScRTFCellDefault* pActDefault; ScRTFCellDefault* pDefMerge; diff --git a/sc/source/filter/rtf/rtfparse.cxx b/sc/source/filter/rtf/rtfparse.cxx index b6b7a70fad9a..5f9dbdfbe86c 100644 --- a/sc/source/filter/rtf/rtfparse.cxx +++ b/sc/source/filter/rtf/rtfparse.cxx @@ -35,7 +35,6 @@ ScRTFParser::ScRTFParser( EditEngine* pEditP ) : ScEEParser( pEditP ), mnCurPos(0), - pColTwips( new ScRTFColTwips ), pActDefault( nullptr ), pDefMerge( nullptr ), nStartAdjust( (sal_uLong)~0 ), @@ -52,7 +51,6 @@ ScRTFParser::ScRTFParser( EditEngine* pEditP ) : ScRTFParser::~ScRTFParser() { delete pInsDefault; - delete pColTwips; maDefaultList.clear(); } @@ -103,21 +101,21 @@ inline void ScRTFParser::NextRow() bool ScRTFParser::SeekTwips( sal_uInt16 nTwips, SCCOL* pCol ) { - ScRTFColTwips::const_iterator it = pColTwips->find( nTwips ); - bool bFound = it != pColTwips->end(); - sal_uInt16 nPos = it - pColTwips->begin(); + ScRTFColTwips::const_iterator it = aColTwips.find( nTwips ); + bool bFound = it != aColTwips.end(); + sal_uInt16 nPos = it - aColTwips.begin(); *pCol = static_cast<SCCOL>(nPos); if ( bFound ) return true; - sal_uInt16 nCount = pColTwips->size(); + sal_uInt16 nCount = aColTwips.size(); if ( !nCount ) return false; SCCOL nCol = *pCol; // nCol is insertion position; the next one higher up is there (or not) - if ( nCol < static_cast<SCCOL>(nCount) && (((*pColTwips)[nCol] - SC_RTFTWIPTOL) <= nTwips) ) + if ( nCol < static_cast<SCCOL>(nCount) && ((aColTwips[nCol] - SC_RTFTWIPTOL) <= nTwips) ) return true; // Not smaller than everything else? Then compare with the next lower one - else if ( nCol != 0 && (((*pColTwips)[nCol-1] + SC_RTFTWIPTOL) >= nTwips) ) + else if ( nCol != 0 && ((aColTwips[nCol-1] + SC_RTFTWIPTOL) >= nTwips) ) { (*pCol)--; return true; @@ -150,7 +148,7 @@ void ScRTFParser::ColAdjust() nColMax = nCol; } nStartAdjust = (sal_uLong)~0; - pColTwips->clear(); + aColTwips.clear(); } } @@ -227,7 +225,7 @@ void ScRTFParser::NewCellRow( ImportInfo* /*pInfo*/ ) const ScRTFCellDefault& rD = *pCellDefault.get(); SCCOL nCol; if ( !SeekTwips(rD.nTwips, &nCol) ) - pColTwips->insert( rD.nTwips ); + aColTwips.insert( rD.nTwips ); } } pDefMerge = nullptr; |