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

Jochen Nitschke j.nitschke+logerrit at ok.de
Thu Jan 26 06:27:05 UTC 2017


 sc/source/filter/excel/excdoc.cxx   |   33 ++++++---------------------------
 sc/source/filter/excel/excform.cxx  |    1 +
 sc/source/filter/excel/exctools.cxx |    1 +
 sc/source/filter/excel/impop.cxx    |    6 +-----
 sc/source/filter/excel/namebuff.cxx |   16 ----------------
 sc/source/filter/inc/excdoc.hxx     |    4 ----
 sc/source/filter/inc/imp_op.hxx     |    2 --
 sc/source/filter/inc/namebuff.hxx   |   34 ----------------------------------
 8 files changed, 9 insertions(+), 88 deletions(-)

New commits:
commit 2640ec898a043c42f62a46f8381cb43cb33d91c2
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Wed Jan 25 20:04:27 2017 +0100

    NameBuffer is dead
    
    all getters are gone since
    commit 96d44c9b077a6cc8068067a795dc63248ab90fea
    Date:   Wed Jul 22 10:20:03 2015 +0200
        loplugin:unusedmethods sc
    
    Change-Id: I26b1ac6b24680d0a6045e9a93d40fbbd2caa6a4b
    Reviewed-on: https://gerrit.libreoffice.org/33542
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index 6f3b2ad..e12f107 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -34,7 +34,6 @@
 #include "formulacell.hxx"
 #include "dociter.hxx"
 #include "document.hxx"
-#include "rangenam.hxx"
 #include "dbdata.hxx"
 #include "global.hxx"
 #include "globstr.hrc"
@@ -137,7 +136,6 @@ ExcTable::ExcTable( const XclExpRoot& rRoot ) :
     XclExpRoot( rRoot ),
     mnScTab( SCTAB_GLOBAL ),
     nExcTab( EXC_NOTAB ),
-    pTabNames( new NameBuffer( nullptr, 16 ) ),
     mxNoteList( new XclExpNoteList )
 {
 }
@@ -146,7 +144,6 @@ ExcTable::ExcTable( const XclExpRoot& rRoot, SCTAB nScTab ) :
     XclExpRoot( rRoot ),
     mnScTab( nScTab ),
     nExcTab( rRoot.GetTabInfo().GetXclTab( nScTab ) ),
-    pTabNames( new NameBuffer( nullptr, 16 ) ),
     mxNoteList( new XclExpNoteList )
 {
 }
@@ -174,9 +171,6 @@ void ExcTable::FillAsHeaderBinary( ExcBoundsheetList& rBoundsheetList )
     else
         Add( new ExcBofW8 );
 
-    SCTAB   nC;
-    OUString aTmpString;
-    SCTAB  nScTabCount     = rTabInfo.GetScTabCount();
     sal_uInt16  nExcTabCount    = rTabInfo.GetXclTabCount();
     sal_uInt16  nCodenames      = static_cast< sal_uInt16 >( GetExtDocOptions().GetCodeNameCount() );
 
@@ -229,15 +223,6 @@ void ExcTable::FillAsHeaderBinary( ExcBoundsheetList& rBoundsheetList )
 
     Add( new XclExpUInt16Record( EXC_ID_FNGROUPCOUNT, 14 ) );
 
-    // first setup table names and contents
-
-    for( nC = 0 ; nC < nScTabCount ; nC++ )
-        if( rTabInfo.IsExportTab( nC ) )
-        {
-            rDoc.GetName( nC, aTmpString );
-            *pTabNames << aTmpString;
-        }
-
     if ( GetBiff() <= EXC_BIFF5 )
     {
         // global link table: EXTERNCOUNT, EXTERNSHEET, NAME
@@ -290,6 +275,8 @@ void ExcTable::FillAsHeaderBinary( ExcBoundsheetList& rBoundsheetList )
     aRecList.AppendRecord( CreateRecord( EXC_ID_XFLIST ) );
     aRecList.AppendRecord( CreateRecord( EXC_ID_PALETTE ) );
 
+    SCTAB   nC;
+    SCTAB  nScTabCount     = rTabInfo.GetScTabCount();
     if( GetBiff() <= EXC_BIFF5 )
     {
         // Bundlesheet
@@ -326,6 +313,7 @@ void ExcTable::FillAsHeaderBinary( ExcBoundsheetList& rBoundsheetList )
                 rBoundsheetList.AppendRecord( xBoundsheet );
             }
 
+        OUString aTmpString;
         for( SCTAB nAdd = 0; nC < static_cast<SCTAB>(nCodenames) ; nC++, nAdd++ )
         {
             aTmpString = lcl_GetVbaTabName( nAdd );
@@ -362,24 +350,12 @@ void ExcTable::FillAsHeaderXml( ExcBoundsheetList& rBoundsheetList )
     ScDocument& rDoc = GetDoc();
     XclExpTabInfo& rTabInfo = GetTabInfo();
 
-    SCTAB   nC;
-    OUString aTmpString;
-    SCTAB  nScTabCount     = rTabInfo.GetScTabCount();
     sal_uInt16  nExcTabCount    = rTabInfo.GetXclTabCount();
     sal_uInt16  nCodenames      = static_cast< sal_uInt16 >( GetExtDocOptions().GetCodeNameCount() );
 
     rR.pTabId = new XclExpChTrTabId( std::max( nExcTabCount, nCodenames ) );
     Add( rR.pTabId );
 
-    // first setup table names and contents
-
-    for( nC = 0 ; nC < nScTabCount ; nC++ )
-        if( rTabInfo.IsExportTab( nC ) )
-        {
-            rDoc.GetName( nC, aTmpString );
-            *pTabNames << aTmpString;
-        }
-
     Add( new XclExpXmlStartSingleElementRecord( XML_workbookPr ) );
     Add( new XclExpBoolRecord(0x0040, false, XML_backupFile ) );    // BACKUP
     Add( new XclExpBoolRecord(0x008D, false, XML_showObjects ) );   // HIDEOBJ
@@ -418,6 +394,8 @@ void ExcTable::FillAsHeaderXml( ExcBoundsheetList& rBoundsheetList )
     lcl_AddBookviews( aRecList, *this );
 
     // Bundlesheet
+    SCTAB nC;
+    SCTAB nScTabCount = rTabInfo.GetScTabCount();
     aRecList.AppendNewRecord( new XclExpXmlStartElementRecord( XML_sheets ) );
     for( nC = 0 ; nC < nScTabCount ; nC++ )
         if( rTabInfo.IsExportTab( nC ) )
@@ -428,6 +406,7 @@ void ExcTable::FillAsHeaderXml( ExcBoundsheetList& rBoundsheetList )
         }
     aRecList.AppendNewRecord( new XclExpXmlEndElementRecord( XML_sheets ) );
 
+    OUString aTmpString;
     for( SCTAB nAdd = 0; nC < static_cast<SCTAB>(nCodenames) ; nC++, nAdd++ )
     {
         aTmpString = lcl_GetVbaTabName( nAdd );
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 67e7657..fe09f4a 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -29,6 +29,7 @@
 #include <svl/sharedstringpool.hxx>
 
 #include "imp_op.hxx"
+#include "namebuff.hxx"
 #include "root.hxx"
 #include "xltracer.hxx"
 #include "xihelper.hxx"
diff --git a/sc/source/filter/excel/exctools.cxx b/sc/source/filter/excel/exctools.cxx
index 2fd9e6d..8f1ad2b 100644
--- a/sc/source/filter/excel/exctools.cxx
+++ b/sc/source/filter/excel/exctools.cxx
@@ -38,6 +38,7 @@
 #include "root.hxx"
 #include "imp_op.hxx"
 #include "excimp8.hxx"
+#include "namebuff.hxx"
 #include "otlnbuff.hxx"
 #include "xcl97rec.hxx"
 #include "formel.hxx"
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 01b5b73..16837e0 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -62,6 +62,7 @@
 #include "postit.hxx"
 
 #include "fapihelper.hxx"
+#include "namebuff.hxx"
 #include "xltools.hxx"
 #include "xltable.hxx"
 #include "xlview.hxx"
@@ -129,9 +130,6 @@ ImportExcel::ImportExcel( XclImpRootData& rImpData, SvStream& rStrm ):
     pExcRoot->pShrfmlaBuff = new SharedFormulaBuffer( pExcRoot );     //&aShrfrmlaBuff;
     pExcRoot->pExtNameBuff = new ExtNameBuff ( *this );
 
-    pExtNameBuff = new NameBuffer( pExcRoot );          //prevent empty rootdata
-    pExtNameBuff->SetBase( 1 );
-
     pOutlineListBuffer = new XclImpOutlineListBuffer( );
 
     // ab Biff8
@@ -157,8 +155,6 @@ ImportExcel::~ImportExcel()
 {
     GetDoc().SetSrcCharSet( GetTextEncoding() );
 
-    delete pExtNameBuff;
-
     delete pOutlineListBuffer;
 
     delete pFormConv;
diff --git a/sc/source/filter/excel/namebuff.cxx b/sc/source/filter/excel/namebuff.cxx
index 211cf25..d2dce76 100644
--- a/sc/source/filter/excel/namebuff.cxx
+++ b/sc/source/filter/excel/namebuff.cxx
@@ -47,22 +47,6 @@ sal_uInt32 StringHashEntry::MakeHashCode( const OUString& r )
     return n;
 }
 
-NameBuffer::~NameBuffer()
-{
-    std::vector<StringHashEntry*>::iterator pIter;
-    for ( pIter = maHashes.begin(); pIter != maHashes.end(); ++pIter )
-        delete *pIter;
-}
-
-//void NameBuffer::operator <<( const SpString &rNewString )
-void NameBuffer::operator <<( const OUString &rNewString )
-{
-    OSL_ENSURE( maHashes.size() + nBase < 0xFFFF,
-        "*NameBuffer::GetLastIndex(): Ich hab' die Nase voll!" );
-
-    maHashes.push_back( new StringHashEntry( rNewString ) );
-}
-
 SharedFormulaBuffer::SharedFormulaBuffer( RootData* pRD ) : ExcRoot(pRD) {}
 
 SharedFormulaBuffer::~SharedFormulaBuffer()
diff --git a/sc/source/filter/inc/excdoc.hxx b/sc/source/filter/inc/excdoc.hxx
index 19c5ad5..f771666 100644
--- a/sc/source/filter/inc/excdoc.hxx
+++ b/sc/source/filter/inc/excdoc.hxx
@@ -30,8 +30,6 @@
 
 class SvStream;
 
-class NameBuffer;
-
 class XclExpChangeTrack;
 
 // class ExcTable -
@@ -52,8 +50,6 @@ private:
     SCTAB                       mnScTab;    // table number SC document
     sal_uInt16                  nExcTab;    // table number Excel document
 
-    std::unique_ptr<NameBuffer> pTabNames;
-
     XclExpNoteListRef           mxNoteList;
 
     // re-create and forget pRec; delete is done by ExcTable itself!
diff --git a/sc/source/filter/inc/imp_op.hxx b/sc/source/filter/inc/imp_op.hxx
index 76cde1f..7740bfa 100644
--- a/sc/source/filter/inc/imp_op.hxx
+++ b/sc/source/filter/inc/imp_op.hxx
@@ -25,7 +25,6 @@
 #include "xistream.hxx"
 #include "xistyle.hxx"
 #include "flttypes.hxx"
-#include "namebuff.hxx"
 #include "root.hxx"
 #include "otlnbuff.hxx"
 #include "colrowst.hxx"
@@ -100,7 +99,6 @@ protected:
     ScfUInt32Vec            maSheetOffsets;
     ScRange                 maScOleSize;        /// Visible range if embedded.
 
-    NameBuffer*             pExtNameBuff;       // ... external names (Ind.-Basis=1)
     ExcelToSc*              pFormConv;          // formula-converter
 
     XclImpOutlineBuffer*    pColOutlineBuff;
diff --git a/sc/source/filter/inc/namebuff.hxx b/sc/source/filter/inc/namebuff.hxx
index a4247b1..18e8a75 100644
--- a/sc/source/filter/inc/namebuff.hxx
+++ b/sc/source/filter/inc/namebuff.hxx
@@ -33,12 +33,10 @@
 #include <unordered_map>
 
 class ScTokenArray;
-class NameBuffer;
 
 class StringHashEntry
 {
 private:
-    friend class NameBuffer;
     OUString          aString;
     sal_uInt32        nHash;
 
@@ -79,38 +77,6 @@ inline bool StringHashEntry::operator ==( const StringHashEntry& r ) const
     return ( nHash == r.nHash && aString ==  r.aString );
 }
 
-class NameBuffer : public ExcRoot
-{
-private:
-    sal_uInt16                  nBase;      // Index-Base
-    std::vector<StringHashEntry*> maHashes;
-
-public:
-
-    inline                  NameBuffer( RootData* );
-    inline                  NameBuffer( RootData*, sal_uInt16 nNewBase );
-
-    virtual                 ~NameBuffer();
-    inline void             SetBase( sal_uInt16 nNewBase );
-    void                    operator <<( const OUString& rNewString );
-};
-
-inline NameBuffer::NameBuffer( RootData* p ) : ExcRoot( p )
-{
-    nBase = 0;
-}
-
-inline NameBuffer::NameBuffer( RootData* p, sal_uInt16 nNewBase ) : ExcRoot( p )
-{
-    nBase = nNewBase;
-}
-
-
-inline void NameBuffer::SetBase( sal_uInt16 nNewBase )
-{
-    nBase = nNewBase;
-}
-
 /**
  * Store and manage shared formula tokens.
  */


More information about the Libreoffice-commits mailing list