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

Stephan Bergmann sbergman at redhat.com
Mon Jul 3 10:32:54 UTC 2017


 sc/source/filter/excel/xelink.cxx |   34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

New commits:
commit 18713e10451b017784c7a1f783612074c5f84c42
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jul 1 21:12:18 2017 +0200

    XclExpXct::StoreCell(Range) rToken param is unused
    
    ...ever since the code's introduction with
    ef7f35dbe9a0436970c489f6d4eed2d6f7ba7e45 "#i107439# BIFF export: write
    external link data correctly".
    
    (There's already a StoreCellRange overload that would then have the same
    signature as the one from wich the rToken parameter is removed, so rename
    these functions with a trailing "_".)
    
    I added two "TODO: remove?" comments at places where it's unclear to me whether
    things should be cleaned up further.  This needs reviewing.
    
    Change-Id: I2d69c8a21a219481e64a7f62757618d79ef32b81
    Reviewed-on: https://gerrit.libreoffice.org/39456
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index 4b8928dd3b38..1e51bcf160cc 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -202,8 +202,8 @@ public:
     /** Stores all cells in the given range in the CRN list. */
     void                StoreCellRange( const ScRange& rRange );
 
-    void                StoreCell( const ScAddress& rCell, const ::formula::FormulaToken& rToken );
-    void                StoreCellRange( const ScRange& rRange, const ::formula::FormulaToken& rToken );
+    void                StoreCell_( const ScAddress& rCell );
+    void                StoreCellRange_( const ScRange& rRange );
 
     /** Writes the XCT and all CRN records. */
     virtual void        Save( XclExpStream& rStrm ) override;
@@ -308,8 +308,8 @@ public:
     /** Stores all cells in the given range in the CRN list of the specified SUPBOOK sheet. */
     void                StoreCellRange( const ScRange& rRange, sal_uInt16 nSBTab );
 
-    void                StoreCell( sal_uInt16 nSBTab, const ScAddress& rCell, const ::formula::FormulaToken& rToken );
-    void                StoreCellRange( sal_uInt16 nSBTab, const ScRange& rRange, const ::formula::FormulaToken& rToken );
+    void                StoreCell_( sal_uInt16 nSBTab, const ScAddress& rCell );
+    void                StoreCellRange_( sal_uInt16 nSBTab, const ScRange& rRange );
 
     sal_uInt16          GetTabIndex( const OUString& rTabName ) const;
     sal_uInt16          GetTabCount() const;
@@ -1291,18 +1291,16 @@ void XclExpXct::StoreCellRange( const ScRange& rRange )
     maBoundRange.ExtendTo( rRange );
 }
 
-void XclExpXct::StoreCell( const ScAddress& rCell, const ::formula::FormulaToken& rToken )
+void XclExpXct::StoreCell_( const ScAddress& rCell )
 {
     maUsedCells.SetMultiMarkArea( ScRange( rCell ) );
     maBoundRange.ExtendTo( ScRange( rCell ) );
-    (void)rToken;
 }
 
-void XclExpXct::StoreCellRange( const ScRange& rRange, const ::formula::FormulaToken& rToken )
+void XclExpXct::StoreCellRange_( const ScRange& rRange )
 {
     maUsedCells.SetMultiMarkArea( rRange );
     maBoundRange.ExtendTo( rRange );
-    (void)rToken;
 }
 
 namespace {
@@ -1578,18 +1576,18 @@ void XclExpSupbook::StoreCellRange( const ScRange& rRange, sal_uInt16 nSBTab )
         pXct->StoreCellRange( rRange );
 }
 
-void XclExpSupbook::StoreCell( sal_uInt16 nSBTab, const ScAddress& rCell, const formula::FormulaToken& rToken )
+void XclExpSupbook::StoreCell_( sal_uInt16 nSBTab, const ScAddress& rCell )
 {
     if( XclExpXct* pXct = maXctList.GetRecord( nSBTab ).get() )
-        pXct->StoreCell( rCell, rToken );
+        pXct->StoreCell_( rCell );
 }
 
-void XclExpSupbook::StoreCellRange( sal_uInt16 nSBTab, const ScRange& rRange, const formula::FormulaToken& rToken )
+void XclExpSupbook::StoreCellRange_( sal_uInt16 nSBTab, const ScRange& rRange )
 {
     // multi-table range is not allowed!
     if( rRange.aStart.Tab() == rRange.aEnd.Tab() )
         if( XclExpXct* pXct = maXctList.GetRecord( nSBTab ).get() )
-            pXct->StoreCellRange( rRange, rToken );
+            pXct->StoreCellRange_( rRange );
 }
 
 sal_uInt16 XclExpSupbook::GetTabIndex( const OUString& rTabName ) const
@@ -1868,6 +1866,7 @@ void XclExpSupbookBuffer::StoreCell( sal_uInt16 nFileId, const OUString& rTabNam
         nSupbookId = Append(xSupbook);
     }
 
+    //TODO: remove?
     ScExternalRefCache::TokenRef pToken = pRefMgr->getSingleRefToken(nFileId, rTabName, rCell, nullptr, nullptr);
     if (!pToken.get())
         return;
@@ -1886,7 +1885,7 @@ void XclExpSupbookBuffer::StoreCell( sal_uInt16 nFileId, const OUString& rTabNam
         r.mnSBTab   = nSheetId;
     }
 
-    xSupbook->StoreCell(nSheetId, rCell, *pToken);
+    xSupbook->StoreCell_(nSheetId, rCell);
 }
 
 void XclExpSupbookBuffer::StoreCellRange( sal_uInt16 nFileId, const OUString& rTabName, const ScRange& rRange )
@@ -1908,8 +1907,7 @@ void XclExpSupbookBuffer::StoreCellRange( sal_uInt16 nFileId, const OUString& rT
 
     // If this is a multi-table range, get token for each table.
     using namespace ::formula;
-    vector<FormulaToken*> aMatrixList;
-    aMatrixList.reserve(nTabCount);
+    SCTAB aMatrixListSize = 0; //TODO: remove?
 
     // This is a new'ed instance, so we must manage its life cycle here.
     ScExternalRefCache::TokenArrayRef pArray = pRefMgr->getDoubleRefTokens(nFileId, rTabName, rRange, nullptr);
@@ -1920,7 +1918,7 @@ void XclExpSupbookBuffer::StoreCellRange( sal_uInt16 nFileId, const OUString& rT
     for (FormulaToken* p = aIter.First(); p; p = aIter.Next())
     {
         if (p->GetType() == svMatrix)
-            aMatrixList.push_back(p);
+            ++aMatrixListSize;
         else if (p->GetOpCode() != ocSep)
         {
             // This is supposed to be ocSep!!!
@@ -1928,7 +1926,7 @@ void XclExpSupbookBuffer::StoreCellRange( sal_uInt16 nFileId, const OUString& rT
         }
     }
 
-    if (aMatrixList.size() != static_cast<size_t>(nTabCount))
+    if (aMatrixListSize != nTabCount)
     {
         // matrix size mis-match !
         return;
@@ -1951,7 +1949,7 @@ void XclExpSupbookBuffer::StoreCellRange( sal_uInt16 nFileId, const OUString& rT
             r.mnSBTab   = nSheetId;
         }
 
-        xSupbook->StoreCellRange(nSheetId, aRange, *aMatrixList[nTab]);
+        xSupbook->StoreCellRange_(nSheetId, aRange);
     }
 }
 


More information about the Libreoffice-commits mailing list