[Libreoffice-commits] core.git: sc/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Apr 11 09:03:36 UTC 2017


 sc/source/filter/html/htmlpars.cxx |   26 ++++++++++++--------------
 sc/source/filter/inc/htmlpars.hxx  |    2 +-
 2 files changed, 13 insertions(+), 15 deletions(-)

New commits:
commit 8966f6e3b4207d15c74208846c2dec827cab254e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Apr 11 09:52:56 2017 +0200

    loplugin:inlinefields in ScHTMLLayoutParser
    
    Change-Id: I45be789db16eeee6a666eb14df6989967a5e1d09
    Reviewed-on: https://gerrit.libreoffice.org/36404
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 777137cb6471..4c77e7f7e493 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -203,7 +203,6 @@ ScHTMLLayoutParser::ScHTMLLayoutParser(
         aBaseURL( rBaseURL ),
         xLockedList( new ScRangeList ),
         pTables( nullptr ),
-        pColOffset( new ScHTMLColOffset ),
         pLocalColOffset( new ScHTMLColOffset ),
         nFirstTableCell(0),
         nTableLevel(0),
@@ -221,7 +220,7 @@ ScHTMLLayoutParser::ScHTMLLayoutParser(
         bInTitle( false )
 {
     MakeColNoRef( pLocalColOffset, 0, 0, 0, 0 );
-    MakeColNoRef( pColOffset, 0, 0, 0, 0 );
+    MakeColNoRef( &maColOffset, 0, 0, 0, 0 );
 }
 
 ScHTMLLayoutParser::~ScHTMLLayoutParser()
@@ -247,7 +246,6 @@ ScHTMLLayoutParser::~ScHTMLLayoutParser()
         delete pS;
     }
     delete pLocalColOffset;
-    delete pColOffset;
     if ( pTables )
     {
         for( OuterMap::const_iterator it = pTables->begin(); it != pTables->end(); ++it)
@@ -290,15 +288,15 @@ sal_uLong ScHTMLLayoutParser::Read( SvStream& rStream, const OUString& rBaseURL
     // Create column width
     Adjust();
     OutputDevice* pDefaultDev = Application::GetDefaultDevice();
-    sal_uInt16 nCount = pColOffset->size();
-    sal_uLong nOff = (*pColOffset)[0];
+    sal_uInt16 nCount = maColOffset.size();
+    sal_uLong nOff = maColOffset[0];
     Size aSize;
     for ( sal_uInt16 j = 1; j < nCount; j++ )
     {
-        aSize.Width() = (*pColOffset)[j] - nOff;
+        aSize.Width() = maColOffset[j] - nOff;
         aSize = pDefaultDev->PixelToLogic( aSize, MapMode( MapUnit::MapTwip ) );
         maColWidths[ j-1 ] = aSize.Width();
-        nOff = (*pColOffset)[j];
+        nOff = maColOffset[j];
     }
     return nErr;
 }
@@ -590,24 +588,24 @@ void ScHTMLLayoutParser::Adjust()
             }
         }
         // Real column
-        (void)SeekOffset( pColOffset, pE->nOffset, &pE->nCol, nOffsetTolerance );
+        (void)SeekOffset( &maColOffset, pE->nOffset, &pE->nCol, nOffsetTolerance );
         SCCOL nColBeforeSkip = pE->nCol;
         SkipLocked( pE, false );
         if ( pE->nCol != nColBeforeSkip )
         {
-            SCCOL nCount = (SCCOL)pColOffset->size();
+            SCCOL nCount = (SCCOL)maColOffset.size();
             if ( nCount <= pE->nCol )
             {
-                pE->nOffset = (sal_uInt16) (*pColOffset)[nCount-1];
-                MakeCol( pColOffset, pE->nOffset, pE->nWidth, nOffsetTolerance, nOffsetTolerance );
+                pE->nOffset = (sal_uInt16) maColOffset[nCount-1];
+                MakeCol( &maColOffset, pE->nOffset, pE->nWidth, nOffsetTolerance, nOffsetTolerance );
             }
             else
             {
-                pE->nOffset = (sal_uInt16) (*pColOffset)[pE->nCol];
+                pE->nOffset = (sal_uInt16) maColOffset[pE->nCol];
             }
         }
         SCCOL nPos;
-        if ( pE->nWidth && SeekOffset( pColOffset, pE->nOffset + pE->nWidth, &nPos, nOffsetTolerance ) )
+        if ( pE->nWidth && SeekOffset( &maColOffset, pE->nOffset + pE->nWidth, &nPos, nOffsetTolerance ) )
             pE->nColOverlap = (nPos > pE->nCol ? nPos - pE->nCol : 1);
         else
         {
@@ -790,7 +788,7 @@ void ScHTMLLayoutParser::SetWidths()
                 pE->nWidth = GetWidth( pE );
                 OSL_ENSURE( pE->nWidth, "SetWidths: pE->nWidth == 0" );
             }
-            MakeCol( pColOffset, pE->nOffset, pE->nWidth, nOffsetTolerance, nOffsetTolerance );
+            MakeCol( &maColOffset, pE->nOffset, pE->nWidth, nOffsetTolerance, nOffsetTolerance );
         }
     }
 }
diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx
index 4c7ee1fca80c..f807c06ee604 100644
--- a/sc/source/filter/inc/htmlpars.hxx
+++ b/sc/source/filter/inc/htmlpars.hxx
@@ -158,7 +158,7 @@ private:
     OUString            aString;
     ScRangeListRef      xLockedList;        // je Table
     OuterMap*           pTables;
-    ScHTMLColOffset*    pColOffset;
+    ScHTMLColOffset     maColOffset;
     ScHTMLColOffset*    pLocalColOffset;    // je Table
     sal_uLong           nFirstTableCell;    // je Table
     short               nTableLevel;


More information about the Libreoffice-commits mailing list