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

Noel Grandin noel at peralex.com
Wed Jul 13 12:28:09 UTC 2016


 sc/source/filter/inc/stylesbuffer.hxx       |    4 
 sc/source/filter/inc/workbookhelper.hxx     |    2 
 sc/source/filter/oox/addressconverter.cxx   |   61 --
 sc/source/filter/oox/commentsbuffer.cxx     |   48 -
 sc/source/filter/oox/defnamesbuffer.cxx     |    5 
 sc/source/filter/oox/externallinkbuffer.cxx |   86 ---
 sc/source/filter/oox/formulabase.cxx        |    2 
 sc/source/filter/oox/formulaparser.cxx      |  729 ----------------------------
 sc/source/filter/oox/pagesettings.cxx       |   25 
 sc/source/filter/oox/pivotcachebuffer.cxx   |   82 ---
 sc/source/filter/oox/stylesbuffer.cxx       |  127 ----
 sc/source/filter/oox/themebuffer.cxx        |   17 
 sc/source/filter/oox/workbookhelper.cxx     |   25 
 sc/source/filter/oox/workbooksettings.cxx   |   14 
 sc/source/filter/oox/worksheethelper.cxx    |   38 -
 15 files changed, 96 insertions(+), 1169 deletions(-)

New commits:
commit c4cb83504faa1d241a116001fd27f7148de300ba
Author: Noel Grandin <noel at peralex.com>
Date:   Sun Jun 26 21:48:06 2016 +0200

    loplugin:singlevalfields in sc(part2)
    
    the meFilterType field in WorkbookGlobals lead to a chain reaction
    of code removal.
    
    Change-Id: Iaa8b467c1c76cab78f8ce1796709590b666028db
    Reviewed-on: https://gerrit.libreoffice.org/26682
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx
index 3f25bca..83f6d12 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -864,9 +864,9 @@ public:
     const FontModel&    getDefaultFontModel() const;
 
     /** Returns true, if the specified borders are equal. */
-    bool                equalBorders( sal_Int32 nBorderId1, sal_Int32 nBorderId2 ) const;
+    static bool         equalBorders( sal_Int32 nBorderId1, sal_Int32 nBorderId2 );
     /** Returns true, if the specified fills are equal. */
-    bool                equalFills( sal_Int32 nFillId1, sal_Int32 nFillId2 ) const;
+    static bool         equalFills( sal_Int32 nFillId1, sal_Int32 nFillId2 );
 
     /** Returns the default style sheet for unused cells. */
     OUString     getDefaultStyleName() const;
diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx
index 46d45fd..11b17fb 100644
--- a/sc/source/filter/inc/workbookhelper.hxx
+++ b/sc/source/filter/inc/workbookhelper.hxx
@@ -127,8 +127,6 @@ public:
 
     /** Returns the base filter object (base class of all filters). */
     ::oox::core::FilterBase& getBaseFilter() const;
-    /** Returns the file type of the current filter. */
-    FilterType          getFilterType() const;
     /** Returns the filter progress bar. */
     SegmentProgressBar& getProgressBar() const;
     /** Returns true, if the file is a multi-sheet document, or false if single-sheet. */
diff --git a/sc/source/filter/oox/addressconverter.cxx b/sc/source/filter/oox/addressconverter.cxx
index 8036d58..0d4185c1 100644
--- a/sc/source/filter/oox/addressconverter.cxx
+++ b/sc/source/filter/oox/addressconverter.cxx
@@ -46,26 +46,6 @@ const sal_Int32 OOX_MAXCOL          = static_cast< sal_Int32 >( (1 << 14) - 1 );
 const sal_Int32 OOX_MAXROW          = static_cast< sal_Int32 >( (1 << 20) - 1 );
 const sal_Int16 OOX_MAXTAB          = static_cast< sal_Int16 >( (1 << 15) - 1 );
 
-const sal_Int32 BIFF2_MAXCOL        = 255;
-const sal_Int32 BIFF2_MAXROW        = 16383;
-const sal_Int16 BIFF2_MAXTAB        = 0;
-
-const sal_Int32 BIFF3_MAXCOL        = BIFF2_MAXCOL;
-const sal_Int32 BIFF3_MAXROW        = BIFF2_MAXROW;
-const sal_Int16 BIFF3_MAXTAB        = BIFF2_MAXTAB;
-
-const sal_Int32 BIFF4_MAXCOL        = BIFF3_MAXCOL;
-const sal_Int32 BIFF4_MAXROW        = BIFF3_MAXROW;
-const sal_Int16 BIFF4_MAXTAB        = 32767;
-
-const sal_Int32 BIFF5_MAXCOL        = BIFF4_MAXCOL;
-const sal_Int32 BIFF5_MAXROW        = BIFF4_MAXROW;
-const sal_Int16 BIFF5_MAXTAB        = BIFF4_MAXTAB;
-
-const sal_Int32 BIFF8_MAXCOL        = BIFF5_MAXCOL;
-const sal_Int32 BIFF8_MAXROW        = 65535;
-const sal_Int16 BIFF8_MAXTAB        = BIFF5_MAXTAB;
-
 } // namespace
 
 
@@ -124,45 +104,8 @@ AddressConverter::AddressConverter( const WorkbookHelper& rHelper ) :
     mbTabOverflow( false )
 {
     maDConChars.set( 0xFFFF, '\x01', 0xFFFF, '\x02', 0xFFFF );
-    switch( getFilterType() )
-    {
-        case FILTER_OOXML:
-            initializeMaxPos( OOX_MAXTAB, OOX_MAXCOL, OOX_MAXROW );
-            maLinkChars.set( 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF );
-        break;
-        case FILTER_BIFF: switch( getBiff() )
-        {
-            case BIFF2:
-                initializeMaxPos( BIFF2_MAXTAB, BIFF2_MAXCOL, BIFF2_MAXROW );
-                maLinkChars.set( 0xFFFF, '\x01', '\x02', 0xFFFF, 0xFFFF );
-            break;
-            case BIFF3:
-                initializeMaxPos( BIFF3_MAXTAB, BIFF3_MAXCOL, BIFF3_MAXROW );
-                maLinkChars.set( 0xFFFF, '\x01', '\x02', 0xFFFF, 0xFFFF );
-            break;
-            case BIFF4:
-                initializeMaxPos( BIFF4_MAXTAB, BIFF4_MAXCOL, BIFF4_MAXROW );
-                maLinkChars.set( 0xFFFF, '\x01', '\x02', 0xFFFF, '\x00' );
-            break;
-            case BIFF5:
-                initializeMaxPos( BIFF5_MAXTAB, BIFF5_MAXCOL, BIFF5_MAXROW );
-                maLinkChars.set( '\x04', '\x01', '\x02', '\x03', '\x00' );
-            break;
-            case BIFF8:
-                initializeMaxPos( BIFF8_MAXTAB, BIFF8_MAXCOL, BIFF8_MAXROW );
-                maLinkChars.set( '\x04', '\x01', 0xFFFF, '\x02', '\x00' );
-            break;
-            case BIFF_UNKNOWN:
-                initializeMaxPos( 0, 0, 0 );
-                maLinkChars.set( 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF );
-            break;
-        }
-        break;
-        case FILTER_UNKNOWN:
-            initializeMaxPos( 0, 0, 0 );
-            maLinkChars.set( 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF );
-        break;
-    }
+    initializeMaxPos( OOX_MAXTAB, OOX_MAXCOL, OOX_MAXROW );
+    maLinkChars.set( 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF );
 }
 
 bool AddressConverter::parseOoxAddress2d(
diff --git a/sc/source/filter/oox/commentsbuffer.cxx b/sc/source/filter/oox/commentsbuffer.cxx
index 8fa3277..a44b2a7 100644
--- a/sc/source/filter/oox/commentsbuffer.cxx
+++ b/sc/source/filter/oox/commentsbuffer.cxx
@@ -153,37 +153,25 @@ void Comment::finalizeImport()
 
         // convert shape formatting and visibility
         bool bVisible = true;
-        switch( getFilterType() )
+        // Add shape formatting properties (autoFill, colHidden and rowHidden are dropped)
+        PropertySet aCommentPr( xAnnoShape );
+        aCommentPr.setProperty( PROP_TextFitToSize, maModel.mbAutoScale );
+        aCommentPr.setProperty( PROP_MoveProtect, maModel.mbLocked );
+        aCommentPr.setProperty( PROP_TextHorizontalAdjust, lcl_ToHorizAlign( maModel.mnTHA ) );
+        aCommentPr.setProperty( PROP_TextVerticalAdjust, lcl_ToVertAlign( maModel.mnTVA ) );
+        if( maModel.maAnchor.Width > 0 && maModel.maAnchor.Height > 0 )
         {
-            case FILTER_OOXML:
-                {
-                    // Add shape formatting properties (autoFill, colHidden and rowHidden are dropped)
-                    PropertySet aCommentPr( xAnnoShape );
-                    aCommentPr.setProperty( PROP_TextFitToSize, maModel.mbAutoScale );
-                    aCommentPr.setProperty( PROP_MoveProtect, maModel.mbLocked );
-                    aCommentPr.setProperty( PROP_TextHorizontalAdjust, lcl_ToHorizAlign( maModel.mnTHA ) );
-                    aCommentPr.setProperty( PROP_TextVerticalAdjust, lcl_ToVertAlign( maModel.mnTVA ) );
-                    if( maModel.maAnchor.Width > 0 && maModel.maAnchor.Height > 0 )
-                    {
-                        xAnnoShape->setPosition( css::awt::Point( maModel.maAnchor.X, maModel.maAnchor.Y ) );
-                        xAnnoShape->setSize( css::awt::Size( maModel.maAnchor.Width, maModel.maAnchor.Height ) );
-                    }
-
-                    // convert shape formatting and visibility
-                    if( const ::oox::vml::ShapeBase* pNoteShape = getVmlDrawing().getNoteShape( aNotePos ) )
-                    {
-                        // position and formatting
-                        pNoteShape->convertFormatting( xAnnoShape );
-                        // visibility
-                        bVisible = pNoteShape->getTypeModel().mbVisible;
-                    }
-                }
-            break;
-            case FILTER_BIFF:
-                bVisible = maModel.mbVisible;
-            break;
-            case FILTER_UNKNOWN:
-            break;
+            xAnnoShape->setPosition( css::awt::Point( maModel.maAnchor.X, maModel.maAnchor.Y ) );
+            xAnnoShape->setSize( css::awt::Size( maModel.maAnchor.Width, maModel.maAnchor.Height ) );
+        }
+
+        // convert shape formatting and visibility
+        if( const ::oox::vml::ShapeBase* pNoteShape = getVmlDrawing().getNoteShape( aNotePos ) )
+        {
+            // position and formatting
+            pNoteShape->convertFormatting( xAnnoShape );
+            // visibility
+            bVisible = pNoteShape->getTypeModel().mbVisible;
         }
         xAnno->setIsVisible( bVisible );
 
diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx
index acc58ba..fe41ed7 100644
--- a/sc/source/filter/oox/defnamesbuffer.cxx
+++ b/sc/source/filter/oox/defnamesbuffer.cxx
@@ -299,10 +299,6 @@ void DefinedName::createNameObject( sal_Int32 nIndex )
     if( /*maModel.mbHidden ||*/ maModel.mbFunction || maModel.mbVBName )
         return;
 
-    // skip BIFF names without stream position (e.g. BIFF3-BIFF4 internal 3D references)
-    if( getFilterType() == FILTER_BIFF )
-        return;
-
     // convert original name to final Calc name (TODO: filter invalid characters from model name)
     maCalcName = isBuiltinName() ? lclGetPrefixedName( mcBuiltinId ) : maModel.maName;
 
@@ -350,7 +346,6 @@ void DefinedName::convertFormula()
         return;
 
     // convert and set formula of the defined name
-    if ( getFilterType() == FILTER_OOXML )
     {
         std::unique_ptr<ScTokenArray> pTokenArray = getScTokens();
         mpScRangeData->SetCode( *pTokenArray );
diff --git a/sc/source/filter/oox/externallinkbuffer.cxx b/sc/source/filter/oox/externallinkbuffer.cxx
index 00defc2..2235906 100644
--- a/sc/source/filter/oox/externallinkbuffer.cxx
+++ b/sc/source/filter/oox/externallinkbuffer.cxx
@@ -475,7 +475,7 @@ sal_Int32 ExternalLink::getDocumentLinkIndex() const
 sal_Int32 ExternalLink::getSheetCacheIndex( sal_Int32 nTabId ) const
 {
     OSL_ENSURE( meLinkType == LINKTYPE_EXTERNAL, "ExternalLink::getSheetCacheIndex - invalid link type" );
-    OSL_ENSURE( (nTabId == 0) || (getFilterType() == FILTER_OOXML) || (getBiff() == BIFF8),
+    OSL_ENSURE( (nTabId == 0) || (getBiff() == BIFF8),
         "ExternalLink::getSheetCacheIndex - invalid sheet index" );
     return ContainerHelper::getVectorElement( maSheetCaches, nTabId, -1 );
 }
@@ -511,35 +511,8 @@ void ExternalLink::getSheetRange( LinkSheetRange& orSheetRange, sal_Int32 nTabId
         case LINKTYPE_EXTERNAL:
         {
             sal_Int32 nDocLinkIdx = getDocumentLinkIndex();
-            switch( getFilterType() )
-            {
-                case FILTER_OOXML:
-                    // BIFF12: passed indexes point into sheet list of EXTSHEETLIST
-                    orSheetRange.setExternalRange( nDocLinkIdx, getSheetCacheIndex( nTabId1 ), getSheetCacheIndex( nTabId2 ) );
-                break;
-                case FILTER_BIFF:
-                    switch( getBiff() )
-                    {
-                        case BIFF2:
-                        case BIFF3:
-                        case BIFF4:
-                            orSheetRange.setExternalRange( nDocLinkIdx, getSheetCacheIndex( nTabId1 ), getSheetCacheIndex( nTabId2 ) );
-                        break;
-                        case BIFF5:
-                            // BIFF5: first sheet from this external link, last sheet is passed in nTabId2
-                            if( const ExternalLink* pExtLink2 = getExternalLinks().getExternalLink( nTabId2 ).get() )
-                                if( (pExtLink2->getLinkType() == LINKTYPE_EXTERNAL) && (maTargetUrl == pExtLink2->getTargetUrl()) )
-                                    orSheetRange.setExternalRange( nDocLinkIdx, getSheetCacheIndex(), pExtLink2->getSheetCacheIndex() );
-                        break;
-                        case BIFF8:
-                            // BIFF8: passed indexes point into sheet list of EXTERNALBOOK
-                            orSheetRange.setExternalRange( nDocLinkIdx, getSheetCacheIndex( nTabId1 ), getSheetCacheIndex( nTabId2 ) );
-                        break;
-                        case BIFF_UNKNOWN: break;
-                    }
-                break;
-                case FILTER_UNKNOWN: break;
-            }
+            // BIFF12: passed indexes point into sheet list of EXTSHEETLIST
+            orSheetRange.setExternalRange( nDocLinkIdx, getSheetCacheIndex( nTabId1 ), getSheetCacheIndex( nTabId2 ) );
         }
         break;
 
@@ -695,8 +668,6 @@ void ExternalLinkBuffer::importExternalSheets( SequenceInputStream& rStrm )
 Sequence< ExternalLinkInfo > ExternalLinkBuffer::getLinkInfos() const
 {
     ::std::vector< ExternalLinkInfo > aLinkInfos;
-    // XML formula parser also used in BIFF12 documents, e.g. replacement formulas in unsupported conditional formattings
-    OSL_ENSURE( getFilterType() == FILTER_OOXML, "ExternalLinkBuffer::getLinkInfos - unexpected file format" );
     // add entry for implicit index 0 (self reference to this document)
     aLinkInfos.push_back( mxSelfRef->getLinkInfo() );
     for( ExternalLinkVec::const_iterator aIt = maExtLinks.begin(), aEnd = maExtLinks.end(); aIt != aEnd; ++aIt )
@@ -707,49 +678,12 @@ Sequence< ExternalLinkInfo > ExternalLinkBuffer::getLinkInfos() const
 ExternalLinkRef ExternalLinkBuffer::getExternalLink( sal_Int32 nRefId, bool bUseRefSheets ) const
 {
     ExternalLinkRef xExtLink;
-    switch( getFilterType() )
-    {
-        case FILTER_OOXML:
-            // OOXML: 0 = this document, otherwise one-based index into link list
-            if( !bUseRefSheets || !mbUseRefSheets )
-                xExtLink = (nRefId == 0) ? mxSelfRef : maLinks.get( nRefId - 1 );
-            // BIFF12: zero-based index into ref-sheets list
-            else if( const RefSheetsModel* pRefSheets = getRefSheets( nRefId ) )
-                xExtLink = maLinks.get( pRefSheets->mnExtRefId );
-        break;
-        case FILTER_BIFF:
-            switch( getBiff() )
-            {
-                case BIFF2:
-                case BIFF3:
-                case BIFF4:
-                    // one-based index to EXTERNSHEET records
-                    xExtLink = maLinks.get( nRefId - 1 );
-                break;
-                case BIFF5:
-                    if( nRefId < 0 )
-                    {
-                        // internal links in formula tokens have negative index
-                        xExtLink = maLinks.get( -nRefId - 1 );
-                        if( xExtLink.get() && !xExtLink->isInternalLink() )
-                            xExtLink.reset();
-                    }
-                    else
-                    {
-                        // one-based index to EXTERNSHEET records
-                        xExtLink = maLinks.get( nRefId - 1 );
-                    }
-                break;
-                case BIFF8:
-                    // zero-based index into REF list in EXTERNSHEET record
-                    if( const RefSheetsModel* pRefSheets = getRefSheets( nRefId ) )
-                        xExtLink = maLinks.get( pRefSheets->mnExtRefId );
-                break;
-                case BIFF_UNKNOWN: break;
-            }
-        break;
-        case FILTER_UNKNOWN: break;
-    }
+    // OOXML: 0 = this document, otherwise one-based index into link list
+    if( !bUseRefSheets || !mbUseRefSheets )
+        xExtLink = (nRefId == 0) ? mxSelfRef : maLinks.get( nRefId - 1 );
+    // BIFF12: zero-based index into ref-sheets list
+    else if( const RefSheetsModel* pRefSheets = getRefSheets( nRefId ) )
+        xExtLink = maLinks.get( pRefSheets->mnExtRefId );
     return xExtLink;
 }
 
@@ -764,7 +698,7 @@ LinkSheetRange ExternalLinkBuffer::getSheetRange( sal_Int32 nRefId, sal_Int16 nT
 
 LinkSheetRange ExternalLinkBuffer::getSheetRange( sal_Int32 nRefId ) const
 {
-    OSL_ENSURE( ((getFilterType() == FILTER_OOXML) && mbUseRefSheets) || (getBiff() == BIFF8), "ExternalLinkBuffer::getSheetRange - wrong BIFF version" );
+    OSL_ENSURE( mbUseRefSheets || (getBiff() == BIFF8), "ExternalLinkBuffer::getSheetRange - wrong BIFF version" );
     LinkSheetRange aSheetRange;
     if( const ExternalLink* pExtLink = getExternalLink( nRefId ).get() )
         if( const RefSheetsModel* pRefSheets = getRefSheets( nRefId ) )
diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index db721d5..e9242f6 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -1616,7 +1616,7 @@ TokenToRangeListState lclProcessClose( sal_Int32& ornParenLevel )
 } // namespace
 
 FormulaProcessorBase::FormulaProcessorBase( const WorkbookHelper& rHelper ) :
-    OpCodeProvider( rHelper.getBaseFilter().getModelFactory(), rHelper.getFilterType(), rHelper.getBiff(), rHelper.getBaseFilter().isImportFilter() ),
+    OpCodeProvider( rHelper.getBaseFilter().getModelFactory(), FILTER_OOXML, rHelper.getBiff(), rHelper.getBaseFilter().isImportFilter() ),
     ApiOpCodes( getOpCodes() ),
     WorkbookHelper( rHelper )
 {
diff --git a/sc/source/filter/oox/formulaparser.cxx b/sc/source/filter/oox/formulaparser.cxx
index a78b84b..0503ade 100644
--- a/sc/source/filter/oox/formulaparser.cxx
+++ b/sc/source/filter/oox/formulaparser.cxx
@@ -505,7 +505,6 @@ protected:
     bool                pushReferenceOperand( const LinkSheetRange& rSheetRange, const Type& rApiRef );
     bool                pushReferenceOperand( const LinkSheetRange& rSheetRange, const BinSingleRef2d& rRef, bool bDeleted, bool bRelativeAsOffset );
     bool                pushReferenceOperand( const LinkSheetRange& rSheetRange, const BinComplexRef2d& rRef, bool bDeleted, bool bRelativeAsOffset );
-    bool                pushNlrOperand( const BinSingleRef2d& rRef );
     bool                pushEmbeddedRefOperand( const DefinedNameBase& rName, bool bPushBadToken );
     bool                pushDefinedNameOperand( const DefinedNameRef& rxDefName );
     bool                pushExternalFuncOperand( const FunctionInfo& rFuncInfo );
@@ -636,12 +635,12 @@ void FormulaParserImpl::initializeImport( const CellAddress& rBaseAddr, FormulaT
         case FORMULATYPE_VALIDATION:
             mbRelativeAsOffset = true;
             // enable NUL characters in BIFF import, string list is single tStr token with NUL separators
-            mbAllowNulChars = getFilterType() == FILTER_BIFF;
+            mbAllowNulChars = false;
         break;
         case FORMULATYPE_DEFINEDNAME:
             mbRelativeAsOffset = true;
             // BIFF2-BIFF4: convert 2D references to absolute 3D references
-            mb2dRefsAs3dRefs = (getFilterType() == FILTER_BIFF) && (getBiff() <= BIFF4);
+            mb2dRefsAs3dRefs = false;
         break;
     }
 
@@ -975,13 +974,6 @@ bool FormulaParserImpl::pushReferenceOperand( const LinkSheetRange& rSheetRange,
     return pushReferenceOperand( rSheetRange, aApiRef );
 }
 
-bool FormulaParserImpl::pushNlrOperand( const BinSingleRef2d& rRef )
-{
-    SingleReference aApiRef;
-    convertReference2d( aApiRef, rRef, false, false );
-    return pushValueOperand( aApiRef, OPCODE_NLR );
-}
-
 bool FormulaParserImpl::pushEmbeddedRefOperand( const DefinedNameBase& rName, bool bPushBadToken )
 {
     Any aRefAny = rName.getReference( maBaseAddr );
@@ -1811,716 +1803,6 @@ bool OoxFormulaParserImpl::pushBiff12Function( sal_uInt16 nFuncId, sal_uInt8 nPa
     return pushFunctionOperator( OPCODE_NONAME, nParamCount );
 }
 
-// BIFF parser implementation =================================================
-
-namespace {
-
-/** A natural language reference struct with relative flag. */
-struct BiffNlr
-{
-    sal_Int32           mnCol;              /// Column index.
-    sal_Int32           mnRow;              /// Row index.
-    bool                mbRel;              /// True = relative column/row reference.
-
-    explicit            BiffNlr();
-
-    void                readBiff8Data( BiffInputStream& rStrm );
-};
-
-BiffNlr::BiffNlr() :
-    mnCol( 0 ),
-    mnRow( 0 ),
-    mbRel( false )
-{
-}
-
-void BiffNlr::readBiff8Data( BiffInputStream& rStrm )
-{
-    sal_uInt16 nRow, nCol;
-    rStrm >> nRow >> nCol;
-    mnCol = nCol & BIFF_TOK_NLR_MASK;
-    mnRow = nRow;
-    mbRel = getFlag( nCol, BIFF_TOK_NLR_REL );
-}
-
-bool lclIsValidNlrStack( const BinAddress& rAddr1, const BinAddress& rAddr2, bool bRow )
-{
-    return bRow ?
-        ((rAddr1.mnRow == rAddr2.mnRow) && (rAddr1.mnCol + 1 == rAddr2.mnCol)) :
-        ((rAddr1.mnCol == rAddr2.mnCol) && (rAddr1.mnRow + 1 == rAddr2.mnRow));
-}
-
-bool lclIsValidNlrRange( const BiffNlr& rNlr, const BinRange& rRange, bool bRow )
-{
-    return bRow ?
-        ((rNlr.mnRow == rRange.maFirst.mnRow) && (rNlr.mnCol + 1 == rRange.maFirst.mnCol) && (rRange.maFirst.mnRow == rRange.maLast.mnRow)) :
-        ((rNlr.mnCol == rRange.maFirst.mnCol) && (rNlr.mnRow + 1 == rRange.maFirst.mnRow) && (rRange.maFirst.mnCol == rRange.maLast.mnCol));
-}
-
-} // namespace
-
-class BiffFormulaParserImpl : public FormulaParserImpl
-{
-public:
-    explicit            BiffFormulaParserImpl( const FormulaParser& rParent );
-
-private:
-    // import token contents and create API formula token ---------------------
-
-    bool                importTokenNotAvailable( BiffInputStream& rStrm );
-    bool                importRefTokenNotAvailable( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
-    bool                importStrToken2( BiffInputStream& rStrm );
-    bool                importStrToken8( BiffInputStream& rStrm );
-    bool                importSpaceToken3( BiffInputStream& rStrm );
-    bool                importSpaceToken4( BiffInputStream& rStrm );
-    bool                importSheetToken2( BiffInputStream& rStrm );
-    bool                importSheetToken3( BiffInputStream& rStrm );
-    bool                importEndSheetToken2( BiffInputStream& rStrm );
-    bool                importEndSheetToken3( BiffInputStream& rStrm );
-    bool                importNlrToken( BiffInputStream& rStrm );
-    bool                importRefToken2( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
-    bool                importRefToken8( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
-    bool                importAreaToken2( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
-    bool                importAreaToken8( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
-    bool                importRef3dToken5( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
-    bool                importRef3dToken8( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
-    bool                importArea3dToken5( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
-    bool                importArea3dToken8( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset );
-    bool                importNameXToken( BiffInputStream& rStrm );
-    bool                importFuncToken2( BiffInputStream& rStrm );
-    bool                importFuncToken4( BiffInputStream& rStrm );
-    bool                importFuncVarToken2( BiffInputStream& rStrm );
-    bool                importFuncVarToken4( BiffInputStream& rStrm );
-    bool                importFuncCEToken( BiffInputStream& rStrm );
-
-    bool                importNlrAddrToken( BiffInputStream& rStrm, bool bRow );
-    bool                importNlrRangeToken( BiffInputStream& rStrm );
-    bool                importNlrSAddrToken( BiffInputStream& rStrm, bool bRow );
-    bool                importNlrSRangeToken( BiffInputStream& rStrm );
-    bool                importNlrErrToken( BiffInputStream& rStrm, sal_uInt16 nSkip );
-
-    sal_Int32           readRefId( BiffInputStream& rStrm );
-    sal_uInt16          readNameId( BiffInputStream& rStrm );
-    LinkSheetRange      readSheetRange5( BiffInputStream& rStrm );
-    LinkSheetRange      readSheetRange8( BiffInputStream& rStrm );
-
-    void                swapStreamPosition( BiffInputStream& rStrm );
-    bool                readNlrSAddrAddData( BiffNlr& orNlr, BiffInputStream& rStrm, bool bRow );
-    bool                readNlrSRangeAddData( BiffNlr& orNlr, bool& orbIsRow, BiffInputStream& rStrm );
-
-    // convert BIFF token and push API operand or operator --------------------
-
-    bool                pushBiffReference( const BinSingleRef2d& rRef, bool bDeleted, bool bRelativeAsOffset );
-    bool                pushBiffReference( const BinComplexRef2d& rRef, bool bDeleted, bool bRelativeAsOffset );
-    bool                pushBiffNlrAddr( const BiffNlr& rNlr, bool bRow );
-    bool                pushBiffNlrRange( const BiffNlr& rNlr, const BinRange& rRange );
-    bool                pushBiffNlrSAddr( const BiffNlr& rNlr, bool bRow );
-    bool                pushBiffNlrSRange( const BiffNlr& rNlr, const BinRange& rRange, bool bRow );
-    bool                pushBiffName( sal_uInt16 nNameId );
-    bool                pushBiffExtName( sal_Int32 nRefId, sal_uInt16 nNameId );
-    bool                pushBiffFunction( sal_uInt16 nFuncId );
-    bool                pushBiffFunction( sal_uInt16 nFuncId, sal_uInt8 nParamCount );
-
-private:
-    typedef bool (BiffFormulaParserImpl::*ImportTokenFunc)( BiffInputStream& );
-    typedef bool (BiffFormulaParserImpl::*ImportRefTokenFunc)( BiffInputStream&, bool, bool );
-
-    ImportTokenFunc     mpImportStrToken;           /// Pointer to tStr import function (string constant).
-    ImportTokenFunc     mpImportSpaceToken;         /// Pointer to tAttrSpace import function (spaces/line breaks).
-    ImportTokenFunc     mpImportSheetToken;         /// Pointer to tSheet import function (external reference).
-    ImportTokenFunc     mpImportEndSheetToken;      /// Pointer to tEndSheet import function (end of external reference).
-    ImportTokenFunc     mpImportNlrToken;           /// Pointer to tNlr import function (natural language reference).
-    ImportRefTokenFunc  mpImportRefToken;           /// Pointer to tRef import function (2d cell reference).
-    ImportRefTokenFunc  mpImportAreaToken;          /// Pointer to tArea import function (2d area reference).
-    ImportRefTokenFunc  mpImportRef3dToken;         /// Pointer to tRef3d import function (3d cell reference).
-    ImportRefTokenFunc  mpImportArea3dToken;        /// Pointer to tArea3d import function (3d area reference).
-    ImportTokenFunc     mpImportNameXToken;         /// Pointer to tNameX import function (external name).
-    ImportTokenFunc     mpImportFuncToken;          /// Pointer to tFunc import function (function with fixed parameter count).
-    ImportTokenFunc     mpImportFuncVarToken;       /// Pointer to tFuncVar import function (function with variable parameter count).
-    ImportTokenFunc     mpImportFuncCEToken;        /// Pointer to tFuncCE import function (command macro call).
-    sal_Int64           mnAddDataPos;               /// Current stream position for additional data (tArray, tMemArea, tNlr).
-    sal_Int32           mnCurrRefId;                /// Current ref-id from tSheet token (BIFF2-BIFF4 only).
-    sal_uInt16          mnAttrDataSize;             /// Size of one tAttr data element.
-    sal_uInt16          mnArraySize;                /// Size of tArray data.
-    sal_uInt16          mnNameSize;                 /// Size of tName data.
-    sal_uInt16          mnMemAreaSize;              /// Size of tMemArea data.
-    sal_uInt16          mnMemFuncSize;              /// Size of tMemFunc data.
-    sal_uInt16          mnRefIdSize;                /// Size of unused data following a reference identifier.
-};
-
-BiffFormulaParserImpl::BiffFormulaParserImpl( const FormulaParser& rParent ) :
-    FormulaParserImpl( rParent ),
-    mnAddDataPos( 0 ),
-    mnCurrRefId( 0 )
-{
-    switch( getBiff() )
-    {
-        case BIFF2:
-            mpImportStrToken = &BiffFormulaParserImpl::importStrToken2;
-            mpImportSpaceToken = &BiffFormulaParserImpl::importTokenNotAvailable;
-            mpImportSheetToken = &BiffFormulaParserImpl::importSheetToken2;
-            mpImportEndSheetToken = &BiffFormulaParserImpl::importEndSheetToken2;
-            mpImportNlrToken = &BiffFormulaParserImpl::importTokenNotAvailable;
-            mpImportRefToken = &BiffFormulaParserImpl::importRefToken2;
-            mpImportAreaToken = &BiffFormulaParserImpl::importAreaToken2;
-            mpImportRef3dToken = &BiffFormulaParserImpl::importRefTokenNotAvailable;
-            mpImportArea3dToken = &BiffFormulaParserImpl::importRefTokenNotAvailable;
-            mpImportNameXToken = &BiffFormulaParserImpl::importTokenNotAvailable;
-            mpImportFuncToken = &BiffFormulaParserImpl::importFuncToken2;
-            mpImportFuncVarToken = &BiffFormulaParserImpl::importFuncVarToken2;
-            mpImportFuncCEToken = &BiffFormulaParserImpl::importFuncCEToken;
-            mnAttrDataSize = 1;
-            mnArraySize = 6;
-            mnNameSize = 5;
-            mnMemAreaSize = 4;
-            mnMemFuncSize = 1;
-            mnRefIdSize = 1;
-        break;
-        case BIFF3:
-            mpImportStrToken = &BiffFormulaParserImpl::importStrToken2;
-            mpImportSpaceToken = &BiffFormulaParserImpl::importSpaceToken3;
-            mpImportSheetToken = &BiffFormulaParserImpl::importSheetToken3;
-            mpImportEndSheetToken = &BiffFormulaParserImpl::importEndSheetToken3;
-            mpImportNlrToken = &BiffFormulaParserImpl::importTokenNotAvailable;
-            mpImportRefToken = &BiffFormulaParserImpl::importRefToken2;
-            mpImportAreaToken = &BiffFormulaParserImpl::importAreaToken2;
-            mpImportRef3dToken = &BiffFormulaParserImpl::importRefTokenNotAvailable;
-            mpImportArea3dToken = &BiffFormulaParserImpl::importRefTokenNotAvailable;
-            mpImportNameXToken = &BiffFormulaParserImpl::importTokenNotAvailable;
-            mpImportFuncToken = &BiffFormulaParserImpl::importFuncToken2;
-            mpImportFuncVarToken = &BiffFormulaParserImpl::importFuncVarToken2;
-            mpImportFuncCEToken = &BiffFormulaParserImpl::importFuncCEToken;
-            mnAttrDataSize = 2;
-            mnArraySize = 7;
-            mnNameSize = 8;
-            mnMemAreaSize = 6;
-            mnMemFuncSize = 2;
-            mnRefIdSize = 2;
-        break;
-        case BIFF4:
-            mpImportStrToken = &BiffFormulaParserImpl::importStrToken2;
-            mpImportSpaceToken = &BiffFormulaParserImpl::importSpaceToken4;
-            mpImportSheetToken = &BiffFormulaParserImpl::importSheetToken3;
-            mpImportEndSheetToken = &BiffFormulaParserImpl::importEndSheetToken3;
-            mpImportNlrToken = &BiffFormulaParserImpl::importTokenNotAvailable;
-            mpImportRefToken = &BiffFormulaParserImpl::importRefToken2;
-            mpImportAreaToken = &BiffFormulaParserImpl::importAreaToken2;
-            mpImportRef3dToken = &BiffFormulaParserImpl::importRefTokenNotAvailable;
-            mpImportArea3dToken = &BiffFormulaParserImpl::importRefTokenNotAvailable;
-            mpImportNameXToken = &BiffFormulaParserImpl::importTokenNotAvailable;
-            mpImportFuncToken = &BiffFormulaParserImpl::importFuncToken4;
-            mpImportFuncVarToken = &BiffFormulaParserImpl::importFuncVarToken4;
-            mpImportFuncCEToken = &BiffFormulaParserImpl::importTokenNotAvailable;
-            mnAttrDataSize = 2;
-            mnArraySize = 7;
-            mnNameSize = 8;
-            mnMemAreaSize = 6;
-            mnMemFuncSize = 2;
-            mnRefIdSize = 2;
-        break;
-        case BIFF5:
-            mpImportStrToken = &BiffFormulaParserImpl::importStrToken2;
-            mpImportSpaceToken = &BiffFormulaParserImpl::importSpaceToken4;
-            mpImportSheetToken = &BiffFormulaParserImpl::importTokenNotAvailable;
-            mpImportEndSheetToken = &BiffFormulaParserImpl::importTokenNotAvailable;
-            mpImportNlrToken = &BiffFormulaParserImpl::importTokenNotAvailable;
-            mpImportRefToken = &BiffFormulaParserImpl::importRefToken2;
-            mpImportAreaToken = &BiffFormulaParserImpl::importAreaToken2;
-            mpImportRef3dToken = &BiffFormulaParserImpl::importRef3dToken5;
-            mpImportArea3dToken = &BiffFormulaParserImpl::importArea3dToken5;
-            mpImportNameXToken = &BiffFormulaParserImpl::importNameXToken;
-            mpImportFuncToken = &BiffFormulaParserImpl::importFuncToken4;
-            mpImportFuncVarToken = &BiffFormulaParserImpl::importFuncVarToken4;
-            mpImportFuncCEToken = &BiffFormulaParserImpl::importTokenNotAvailable;
-            mnAttrDataSize = 2;
-            mnArraySize = 7;
-            mnNameSize = 12;
-            mnMemAreaSize = 6;
-            mnMemFuncSize = 2;
-            mnRefIdSize = 8;
-        break;
-        case BIFF8:
-            mpImportStrToken = &BiffFormulaParserImpl::importStrToken8;
-            mpImportSpaceToken = &BiffFormulaParserImpl::importSpaceToken4;
-            mpImportSheetToken = &BiffFormulaParserImpl::importTokenNotAvailable;
-            mpImportEndSheetToken = &BiffFormulaParserImpl::importTokenNotAvailable;
-            mpImportNlrToken = &BiffFormulaParserImpl::importNlrToken;
-            mpImportRefToken = &BiffFormulaParserImpl::importRefToken8;
-            mpImportAreaToken = &BiffFormulaParserImpl::importAreaToken8;
-            mpImportRef3dToken = &BiffFormulaParserImpl::importRef3dToken8;
-            mpImportArea3dToken = &BiffFormulaParserImpl::importArea3dToken8;
-            mpImportNameXToken = &BiffFormulaParserImpl::importNameXToken;
-            mpImportFuncToken = &BiffFormulaParserImpl::importFuncToken4;
-            mpImportFuncVarToken = &BiffFormulaParserImpl::importFuncVarToken4;
-            mpImportFuncCEToken = &BiffFormulaParserImpl::importTokenNotAvailable;
-            mnAttrDataSize = 2;
-            mnArraySize = 7;
-            mnNameSize = 2;
-            mnMemAreaSize = 6;
-            mnMemFuncSize = 2;
-            mnRefIdSize = 0;
-        break;
-        case BIFF_UNKNOWN:
-            mpImportStrToken = nullptr;
-            mpImportSpaceToken = nullptr;
-            mpImportSheetToken = nullptr;
-            mpImportEndSheetToken = nullptr;
-            mpImportNlrToken = nullptr;
-            mpImportRefToken = nullptr;
-            mpImportAreaToken = nullptr;
-            mpImportRef3dToken = nullptr;
-            mpImportArea3dToken = nullptr;
-            mpImportNameXToken = nullptr;
-            mpImportFuncToken = nullptr;
-            mpImportFuncVarToken = nullptr;
-            mpImportFuncCEToken = nullptr;
-            mnAttrDataSize = 0;
-            mnArraySize = 0;
-            mnNameSize = 0;
-            mnMemAreaSize = 0;
-            mnMemFuncSize = 0;
-            mnRefIdSize = 0;
-        break;
-    }
-}
-
-// import token contents and create API formula token -------------------------
-
-bool BiffFormulaParserImpl::importTokenNotAvailable( BiffInputStream& )
-{
-    // dummy function for pointer-to-member-function
-    return false;
-}
-
-bool BiffFormulaParserImpl::importRefTokenNotAvailable( BiffInputStream&, bool, bool )
-{
-    // dummy function for pointer-to-member-function
-    return false;
-}
-
-bool BiffFormulaParserImpl::importStrToken2( BiffInputStream& rStrm )
-{
-    return pushValueOperand( rStrm.readByteStringUC( false, getTextEncoding(), mbAllowNulChars ) );
-}
-
-bool BiffFormulaParserImpl::importStrToken8( BiffInputStream& rStrm )
-{
-    // read flags field for empty strings also
-    return pushValueOperand( rStrm.readUniStringBody( rStrm.readuInt8(), mbAllowNulChars ) );
-}
-
-bool BiffFormulaParserImpl::importSpaceToken3( BiffInputStream& rStrm )
-{
-    rStrm.skip( 2 );
-    return true;
-}
-
-bool BiffFormulaParserImpl::importSpaceToken4( BiffInputStream& rStrm )
-{
-    sal_uInt8 nType, nCount;
-    rStrm >> nType >> nCount;
-    switch( nType )
-    {
-        case BIFF_TOK_ATTR_SPACE_SP:
-            appendLeadingSpaces( nCount, false );
-        break;
-        case BIFF_TOK_ATTR_SPACE_BR:
-            appendLeadingSpaces( nCount, true );
-        break;
-        case BIFF_TOK_ATTR_SPACE_SP_OPEN:
-            appendOpeningSpaces( nCount, false );
-        break;
-        case BIFF_TOK_ATTR_SPACE_BR_OPEN:
-            appendOpeningSpaces( nCount, true );
-        break;
-        case BIFF_TOK_ATTR_SPACE_SP_CLOSE:
-            appendClosingSpaces( nCount, false );
-        break;
-        case BIFF_TOK_ATTR_SPACE_BR_CLOSE:
-            appendClosingSpaces( nCount, true );
-        break;
-    }
-    return true;
-}
-
-bool BiffFormulaParserImpl::importSheetToken2( BiffInputStream& rStrm )
-{
-    rStrm.skip( 4 );
-    mnCurrRefId = readRefId( rStrm );
-    return true;
-}
-
-bool BiffFormulaParserImpl::importSheetToken3( BiffInputStream& rStrm )
-{
-    rStrm.skip( 6 );
-    mnCurrRefId = readRefId( rStrm );
-    return true;
-}
-
-bool BiffFormulaParserImpl::importEndSheetToken2( BiffInputStream& rStrm )
-{
-    rStrm.skip( 3 );
-    mnCurrRefId = 0;
-    return true;
-}
-
-bool BiffFormulaParserImpl::importEndSheetToken3( BiffInputStream& rStrm )
-{
-    rStrm.skip( 4 );
-    mnCurrRefId = 0;
-    return true;
-}
-
-bool BiffFormulaParserImpl::importNlrToken( BiffInputStream& rStrm )
-{
-    bool bOk = true;
-    sal_uInt8 nNlrType;
-    rStrm >> nNlrType;
-    switch( nNlrType )
-    {
-        case BIFF_TOK_NLR_ERR:      bOk = importNlrErrToken( rStrm, 4 );        break;
-        case BIFF_TOK_NLR_ROWR:     bOk = importNlrAddrToken( rStrm, true );    break;
-        case BIFF_TOK_NLR_COLR:     bOk = importNlrAddrToken( rStrm, false );   break;
-        case BIFF_TOK_NLR_ROWV:     bOk = importNlrAddrToken( rStrm, true );    break;
-        case BIFF_TOK_NLR_COLV:     bOk = importNlrAddrToken( rStrm, false );   break;
-        case BIFF_TOK_NLR_RANGE:    bOk = importNlrRangeToken( rStrm );         break;
-        case BIFF_TOK_NLR_SRANGE:   bOk = importNlrSRangeToken( rStrm );        break;
-        case BIFF_TOK_NLR_SROWR:    bOk = importNlrSAddrToken( rStrm, true );   break;
-        case BIFF_TOK_NLR_SCOLR:    bOk = importNlrSAddrToken( rStrm, false );  break;
-        case BIFF_TOK_NLR_SROWV:    bOk = importNlrSAddrToken( rStrm, true );   break;
-        case BIFF_TOK_NLR_SCOLV:    bOk = importNlrSAddrToken( rStrm, false );  break;
-        case BIFF_TOK_NLR_RANGEERR: bOk = importNlrErrToken( rStrm, 13 );       break;
-        case BIFF_TOK_NLR_SXNAME:   bOk = importNlrErrToken( rStrm, 4 );        break;
-        default:                    bOk = false;
-    }
-    return bOk;
-}
-
-bool BiffFormulaParserImpl::importRefToken2( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset )
-{
-    BinSingleRef2d aRef;
-    aRef.readBiff2Data( rStrm, bRelativeAsOffset );
-    return pushBiffReference( aRef, bDeleted, bRelativeAsOffset );
-}
-
-bool BiffFormulaParserImpl::importRefToken8( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset )
-{
-    BinSingleRef2d aRef;
-    aRef.readBiff8Data( rStrm, bRelativeAsOffset );
-    return pushBiffReference( aRef, bDeleted, bRelativeAsOffset );
-}
-
-bool BiffFormulaParserImpl::importAreaToken2( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset )
-{
-    BinComplexRef2d aRef;
-    aRef.readBiff2Data( rStrm, bRelativeAsOffset );
-    return pushBiffReference( aRef, bDeleted, bRelativeAsOffset );
-}
-
-bool BiffFormulaParserImpl::importAreaToken8( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset )
-{
-    BinComplexRef2d aRef;
-    aRef.readBiff8Data( rStrm, bRelativeAsOffset );
-    return pushBiffReference( aRef, bDeleted, bRelativeAsOffset );
-}
-
-bool BiffFormulaParserImpl::importRef3dToken5( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset )
-{
-    LinkSheetRange aSheetRange = readSheetRange5( rStrm );
-    BinSingleRef2d aRef;
-    aRef.readBiff2Data( rStrm, bRelativeAsOffset );
-    return pushReferenceOperand( aSheetRange, aRef, bDeleted, bRelativeAsOffset );
-}
-
-bool BiffFormulaParserImpl::importRef3dToken8( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset )
-{
-    LinkSheetRange aSheetRange = readSheetRange8( rStrm );
-    BinSingleRef2d aRef;
-    aRef.readBiff8Data( rStrm, bRelativeAsOffset );
-    return pushReferenceOperand( aSheetRange, aRef, bDeleted, bRelativeAsOffset );
-}
-
-bool BiffFormulaParserImpl::importArea3dToken5( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset )
-{
-    LinkSheetRange aSheetRange = readSheetRange5( rStrm );
-    BinComplexRef2d aRef;
-    aRef.readBiff2Data( rStrm, bRelativeAsOffset );
-    return pushReferenceOperand( aSheetRange, aRef, bDeleted, bRelativeAsOffset );
-}
-
-bool BiffFormulaParserImpl::importArea3dToken8( BiffInputStream& rStrm, bool bDeleted, bool bRelativeAsOffset )
-{
-    LinkSheetRange aSheetRange = readSheetRange8( rStrm );
-    BinComplexRef2d aRef;
-    aRef.readBiff8Data( rStrm, bRelativeAsOffset );
-    return pushReferenceOperand( aSheetRange, aRef, bDeleted, bRelativeAsOffset );
-}
-
-bool BiffFormulaParserImpl::importNameXToken( BiffInputStream& rStrm )
-{
-    sal_Int32 nRefId = readRefId( rStrm );
-    sal_uInt16 nNameId = readNameId( rStrm );
-    return pushBiffExtName( nRefId, nNameId );
-}
-
-bool BiffFormulaParserImpl::importFuncToken2( BiffInputStream& rStrm )
-{
-    sal_uInt8 nFuncId;
-    rStrm >> nFuncId;
-    return pushBiffFunction( nFuncId );
-}
-
-bool BiffFormulaParserImpl::importFuncToken4( BiffInputStream& rStrm )
-{
-    sal_uInt16 nFuncId;
-    rStrm >> nFuncId;
-    return pushBiffFunction( nFuncId );
-}
-
-bool BiffFormulaParserImpl::importFuncVarToken2( BiffInputStream& rStrm )
-{
-    sal_uInt8 nParamCount, nFuncId;
-    rStrm >> nParamCount >> nFuncId;
-    return pushBiffFunction( nFuncId, nParamCount );
-}
-
-bool BiffFormulaParserImpl::importFuncVarToken4( BiffInputStream& rStrm )
-{
-    sal_uInt8 nParamCount;
-    sal_uInt16 nFuncId;
-    rStrm >> nParamCount >> nFuncId;
-    return pushBiffFunction( nFuncId, nParamCount & BIFF_TOK_FUNCVAR_COUNTMASK );
-}
-
-bool BiffFormulaParserImpl::importFuncCEToken( BiffInputStream& rStrm )
-{
-    sal_uInt8 nParamCount, nFuncId;
-    rStrm >> nParamCount >> nFuncId;
-    sal_uInt16 nCmdId = nFuncId;
-    setFlag( nCmdId, BIFF_TOK_FUNCVAR_CMD );
-    return pushBiffFunction( nCmdId, nParamCount );
-}
-
-bool BiffFormulaParserImpl::importNlrAddrToken( BiffInputStream& rStrm, bool bRow )
-{
-    BiffNlr aNlr;
-    aNlr.readBiff8Data( rStrm );
-    return pushBiffNlrAddr( aNlr, bRow );
-}
-
-bool BiffFormulaParserImpl::importNlrRangeToken( BiffInputStream& rStrm )
-{
-    BiffNlr aNlr;
-    aNlr.readBiff8Data( rStrm );
-    rStrm.skip( 1 );
-    BinRange aRange;
-    rStrm >> aRange;
-    return pushBiffNlrRange( aNlr, aRange );
-}
-
-bool BiffFormulaParserImpl::importNlrSAddrToken( BiffInputStream& rStrm, bool bRow )
-{
-    rStrm.skip( 4 );
-    BiffNlr aNlr;
-    return readNlrSAddrAddData( aNlr, rStrm, bRow ) ? pushBiffNlrSAddr( aNlr, bRow ) : pushBiffErrorOperand( BIFF_ERR_REF );
-}
-
-bool BiffFormulaParserImpl::importNlrSRangeToken( BiffInputStream& rStrm )
-{
-    rStrm.skip( 5 );
-    BinRange aRange;
-    rStrm >> aRange;
-    BiffNlr aNlr;
-    bool bRow;
-    return readNlrSRangeAddData( aNlr, bRow, rStrm ) ? pushBiffNlrSRange( aNlr, aRange, bRow ) : pushBiffErrorOperand( BIFF_ERR_REF );
-}
-
-bool BiffFormulaParserImpl::importNlrErrToken( BiffInputStream& rStrm, sal_uInt16 nIgnore )
-{
-    rStrm.skip( nIgnore );
-    return pushBiffErrorOperand( BIFF_ERR_NAME );
-}
-
-sal_Int32 BiffFormulaParserImpl::readRefId( BiffInputStream& rStrm )
-{
-    sal_Int16 nRefId;
-    rStrm >> nRefId;
-    rStrm.skip( mnRefIdSize );
-    return nRefId;
-}
-
-sal_uInt16 BiffFormulaParserImpl::readNameId( BiffInputStream& rStrm )
-{
-    sal_uInt16 nNameId;
-    rStrm >> nNameId;
-    rStrm.skip( mnNameSize );
-    return nNameId;
-}
-
-LinkSheetRange BiffFormulaParserImpl::readSheetRange5( BiffInputStream& rStrm )
-{
-    sal_Int32 nRefId = readRefId( rStrm );
-    sal_Int16 nTab1, nTab2;
-    rStrm >> nTab1 >> nTab2;
-    return getExternalLinks().getSheetRange( nRefId, nTab1, nTab2 );
-}
-
-LinkSheetRange BiffFormulaParserImpl::readSheetRange8( BiffInputStream& rStrm )
-{
-    return getExternalLinks().getSheetRange( readRefId( rStrm ) );
-}
-
-void BiffFormulaParserImpl::swapStreamPosition( BiffInputStream& rStrm )
-{
-    sal_Int64 nRecPos = rStrm.tell();
-    rStrm.seek( mnAddDataPos );
-    mnAddDataPos = nRecPos;
-}
-
-bool BiffFormulaParserImpl::readNlrSAddrAddData( BiffNlr& orNlr, BiffInputStream& rStrm, bool bRow )
-{
-    bool bIsRow = false;
-    return readNlrSRangeAddData( orNlr, bIsRow, rStrm ) && (bIsRow == bRow);
-}
-
-bool BiffFormulaParserImpl::readNlrSRangeAddData( BiffNlr& orNlr, bool& orbIsRow, BiffInputStream& rStrm )
-{
-    orbIsRow = false;
-    swapStreamPosition( rStrm );
-    // read number of cell addresses and relative flag
-    sal_uInt32 nCount;
-    rStrm >> nCount;
-    bool bRel = getFlag( nCount, BIFF_TOK_NLR_ADDREL );
-    nCount &= BIFF_TOK_NLR_ADDMASK;
-    sal_Int64 nEndPos = rStrm.tell() + 4 * nCount;
-    // read list of cell addresses
-    bool bValid = false;
-    if( nCount >= 2 )
-    {
-        // detect column/row orientation
-        BinAddress aAddr1, aAddr2;
-        rStrm >> aAddr1 >> aAddr2;
-        orbIsRow = aAddr1.mnRow == aAddr2.mnRow;
-        bValid = lclIsValidNlrStack( aAddr1, aAddr2, orbIsRow );
-        // read and verify additional cell positions
-        for( sal_uInt32 nIndex = 2; bValid && (nIndex < nCount); ++nIndex )
-        {
-            aAddr1 = aAddr2;
-            rStrm >> aAddr2;
-            bValid = !rStrm.isEof() && lclIsValidNlrStack( aAddr1, aAddr2, orbIsRow );
-        }
-        // check that last imported position (aAddr2) is not at the end of the sheet
-        bValid = bValid && (orbIsRow ? (aAddr2.mnCol < mnMaxApiCol) : (aAddr2.mnRow < mnMaxApiRow));
-        // fill the NLR struct with the last imported position
-        if( bValid )
-        {
-            orNlr.mnCol = aAddr2.mnCol;
-            orNlr.mnRow = aAddr2.mnRow;
-            orNlr.mbRel = bRel;
-        }
-    }
-    // seek to end of additional data for this token
-    rStrm.seek( nEndPos );
-    swapStreamPosition( rStrm );
-
-    return bValid;
-}
-
-// convert BIFF token and push API operand or operator ------------------------
-
-bool BiffFormulaParserImpl::pushBiffReference( const BinSingleRef2d& rRef, bool bDeleted, bool bRelativeAsOffset )
-{
-    return (mnCurrRefId > 0) ?
-        pushReferenceOperand( getExternalLinks().getSheetRange( mnCurrRefId, 0, 0 ), rRef, bDeleted, bRelativeAsOffset ) :
-        pushReferenceOperand( rRef, bDeleted, bRelativeAsOffset );
-}
-
-bool BiffFormulaParserImpl::pushBiffReference( const BinComplexRef2d& rRef, bool bDeleted, bool bRelativeAsOffset )
-{
-    return (mnCurrRefId > 0) ?
-        pushReferenceOperand( getExternalLinks().getSheetRange( mnCurrRefId, 0, 0 ), rRef, bDeleted, bRelativeAsOffset ) :
-        pushReferenceOperand( rRef, bDeleted, bRelativeAsOffset );
-}
-
-bool BiffFormulaParserImpl::pushBiffNlrAddr( const BiffNlr& rNlr, bool bRow )
-{
-    BinSingleRef2d aRef;
-    aRef.mnCol = rNlr.mnCol;
-    aRef.mnRow = rNlr.mnRow;
-    aRef.mbColRel = !bRow;
-    aRef.mbRowRel = bRow;
-    return pushNlrOperand( aRef );
-}
-
-bool BiffFormulaParserImpl::pushBiffNlrRange( const BiffNlr& rNlr, const BinRange& rRange )
-{
-    bool bRow = rNlr.mnRow == rRange.maFirst.mnRow;
-    return lclIsValidNlrRange( rNlr, rRange, bRow ) ?
-        pushBiffNlrAddr( rNlr, bRow ) : pushBiffErrorOperand( BIFF_ERR_REF );
-}
-
-bool BiffFormulaParserImpl::pushBiffNlrSAddr( const BiffNlr& rNlr, bool bRow )
-{
-    BinRange aRange;
-    aRange.maFirst.mnCol = rNlr.mnCol + (bRow ? 1 : 0);
-    aRange.maFirst.mnRow = rNlr.mnRow + (bRow ? 0 : 1);
-    aRange.maLast.mnCol = bRow ? mnMaxApiCol : rNlr.mnCol;
-    aRange.maLast.mnRow = bRow ? rNlr.mnRow : mnMaxApiRow;
-    return pushBiffNlrSRange( rNlr, aRange, bRow );
-}
-
-bool BiffFormulaParserImpl::pushBiffNlrSRange( const BiffNlr& rNlr, const BinRange& rRange, bool bRow )
-{
-    if( lclIsValidNlrRange( rNlr, rRange, bRow ) )
-    {
-        BinComplexRef2d aRef;
-        aRef.maRef1.mnCol = rRange.maFirst.mnCol;
-        aRef.maRef1.mnRow = rRange.maFirst.mnRow;
-        aRef.maRef2.mnCol = rRange.maLast.mnCol;
-        aRef.maRef2.mnRow = rRange.maLast.mnRow;
-        aRef.maRef1.mbColRel = aRef.maRef2.mbColRel = !bRow && rNlr.mbRel;
-        aRef.maRef1.mbRowRel = aRef.maRef2.mbRowRel = bRow && rNlr.mbRel;
-        return pushReferenceOperand( aRef, false, false );
-    }
-    return pushBiffErrorOperand( BIFF_ERR_REF );
-}
-
-bool BiffFormulaParserImpl::pushBiffName( sal_uInt16 nNameId )
-{
-    // one-based in BIFF formulas
-    return pushDefinedNameOperand( getDefinedNames().getByIndex( static_cast< sal_Int32 >( nNameId ) - 1 ) );
-}
-
-bool BiffFormulaParserImpl::pushBiffExtName( sal_Int32 nRefId, sal_uInt16 nNameId )
-{
-    if( const ExternalLink* pExtLink = getExternalLinks().getExternalLink( nRefId ).get() )
-    {
-        if( pExtLink->getLinkType() == LINKTYPE_SELF )
-            return pushBiffName( nNameId );
-        // external name indexes are one-based in BIFF
-        ExternalNameRef xExtName = pExtLink->getNameByIndex( static_cast< sal_Int32 >( nNameId ) - 1 );
-        return pushExternalNameOperand( xExtName, *pExtLink );
-    }
-    return pushBiffErrorOperand( BIFF_ERR_NAME );
-}
-
-bool BiffFormulaParserImpl::pushBiffFunction( sal_uInt16 nFuncId )
-{
-    if( const FunctionInfo* pFuncInfo = getFuncInfoFromBiffFuncId( nFuncId ) )
-        if( pFuncInfo->mnMinParamCount == pFuncInfo->mnMaxParamCount )
-            return pushFunctionOperator( *pFuncInfo, pFuncInfo->mnMinParamCount );
-    return pushFunctionOperator( OPCODE_NONAME, 0 );
-}
-
-bool BiffFormulaParserImpl::pushBiffFunction( sal_uInt16 nFuncId, sal_uInt8 nParamCount )
-{
-    if( getFlag( nFuncId, BIFF_TOK_FUNCVAR_CMD ) )
-        nParamCount &= BIFF_TOK_FUNCVAR_COUNTMASK;
-    if( const FunctionInfo* pFuncInfo = getFuncInfoFromBiffFuncId( nFuncId ) )
-        return pushFunctionOperator( *pFuncInfo, nParamCount );
-    return pushFunctionOperator( OPCODE_NONAME, nParamCount );
-}
-
 namespace {
 
 /** Extracts the reference identifier and the remaining data from a formula in
@@ -2545,12 +1827,7 @@ bool lclExtractRefId( sal_Int32& rnRefId, OUString& rRemainder, const OUString&
 FormulaParser::FormulaParser( const WorkbookHelper& rHelper ) :
     FormulaProcessorBase( rHelper )
 {
-    switch( getFilterType() )
-    {
-        case FILTER_OOXML:  mxImpl.reset( new OoxFormulaParserImpl( *this ) );  break;
-        case FILTER_BIFF:   mxImpl.reset( new BiffFormulaParserImpl( *this ) ); break;
-        case FILTER_UNKNOWN: break;
-    }
+    mxImpl.reset( new OoxFormulaParserImpl( *this ) );
 }
 
 FormulaParser::~FormulaParser()
diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx
index 3a48457..de3dca6 100644
--- a/sc/source/filter/oox/pagesettings.cxx
+++ b/sc/source/filter/oox/pagesettings.cxx
@@ -567,18 +567,17 @@ double HeaderFooterParser::parse( const Reference<sheet::XHeaderFooterContent>&
                     }
                     break;
                     case 'Z':   // file path (without file name), OOXML, BIFF12, and BIFF8 only
-                        if( (getFilterType() == FILTER_OOXML) || ((getFilterType() == FILTER_BIFF) && (getBiff() == BIFF8)) )
-                        {
-                            Reference<text::XTextContent> xContent = createField( maFileNameService );
-                            PropertySet aPropSet( xContent );
-                            // FilenameDisplayFormat::PATH not supported by Calc
-                            aPropSet.setProperty( PROP_FileFormat, css::text::FilenameDisplayFormat::FULL );
-                            appendField( xContent );
-                            /*  path only is not supported -- if we find a '&Z&F'
-                                combination for path/name, skip the '&F' part */
-                            if( (pcChar + 2 < pcEnd) && (pcChar[ 1 ] == '&') && ((pcChar[ 2 ] == 'f') || (pcChar[ 2 ] == 'F')) )
-                                pcChar += 2;
-                        }
+                    {
+                        Reference<text::XTextContent> xContent = createField( maFileNameService );
+                        PropertySet aPropSet( xContent );
+                        // FilenameDisplayFormat::PATH not supported by Calc
+                        aPropSet.setProperty( PROP_FileFormat, css::text::FilenameDisplayFormat::FULL );
+                        appendField( xContent );
+                        /*  path only is not supported -- if we find a '&Z&F'
+                            combination for path/name, skip the '&F' part */
+                        if( (pcChar + 2 < pcEnd) && (pcChar[ 1 ] == '&') && ((pcChar[ 2 ] == 'f') || (pcChar[ 2 ] == 'F')) )
+                            pcChar += 2;
+                    }
                     break;
                     case 'D':   // date
                     {
@@ -635,7 +634,7 @@ double HeaderFooterParser::parse( const Reference<sheet::XHeaderFooterContent>&
                     break;
 
                     case 'K':   // text color (not in BIFF)
-                        if( (getFilterType() == FILTER_OOXML) && (pcChar + 6 < pcEnd) )
+                        if( pcChar + 6 < pcEnd )
                         {
                             setAttributes();
                             // eat the following 6 characters
diff --git a/sc/source/filter/oox/pivotcachebuffer.cxx b/sc/source/filter/oox/pivotcachebuffer.cxx
index c7b75e3..019b029 100644
--- a/sc/source/filter/oox/pivotcachebuffer.cxx
+++ b/sc/source/filter/oox/pivotcachebuffer.cxx
@@ -1356,7 +1356,7 @@ void PivotCache::finalizeExternalSheetSource()
     /*  If pivot cache is based on external sheet data, try to restore sheet
         data from cache records. No support for external defined names or tables,
         sheet name and path to cache records fragment (OOXML only) are required. */
-    bool bHasRelation = (getFilterType() == FILTER_BIFF) || !maDefModel.maRelId.isEmpty();
+    bool bHasRelation = !maDefModel.maRelId.isEmpty();
     if( bHasRelation && maSheetSrcModel.maDefName.isEmpty() && !maSheetSrcModel.maSheet.isEmpty() )
         prepareSourceDataSheet();
 }
@@ -1403,67 +1403,25 @@ void PivotCacheBuffer::registerPivotCacheFragment( sal_Int32 nCacheId, const OUS
 
 PivotCache* PivotCacheBuffer::importPivotCacheFragment( sal_Int32 nCacheId )
 {
-    switch( getFilterType() )
-    {
-        /*  OOXML/BIFF12 filter: On first call for the cache ID, the pivot
-            cache object is created and inserted into maCaches. Then, the cache
-            definition fragment is read and the cache is returned. On
-            subsequent calls, the created cache will be found in maCaches and
-            returned immediately. */
-        case FILTER_OOXML:
-        {
-            // try to find an imported pivot cache
-            if( PivotCache* pCache = maCaches.get( nCacheId ).get() )
-                return pCache;
-
-            // check if a fragment path exists for the passed cache identifier
-            FragmentPathMap::iterator aIt = maFragmentPaths.find( nCacheId );
-            if( aIt == maFragmentPaths.end() )
-                return nullptr;
-
-            /*  Import the cache fragment. This may create a dummy data sheet
-                for external sheet sources. */
-            PivotCache& rCache = createPivotCache( nCacheId );
-            importOoxFragment( new PivotCacheDefinitionFragment( *this, aIt->second, rCache ) );
-            return &rCache;
-        }
-
-        /*  BIFF filter: Pivot table provides 0-based index into list of pivot
-            cache source links (PIVOTCACHE/PCDSOURCE/... record blocks in
-            workbook stream). First, this index has to be resolved to the cache
-            identifier that is used to manage the cache stream names (the
-            maFragmentPaths member). The cache object itself exists already
-            before the first call for the cache source index, because source data
-            link is part of workbook data, not of the cache stream. To detect
-            subsequent calls with an already initialized cache, the entry in
-            maFragmentPaths will be removed after reading the cache stream. */
-        case FILTER_BIFF:
-        {
-            /*  Resolve cache index to cache identifier and try to find pivot
-                cache. Cache must exist already for a valid cache index. */
-            nCacheId = ContainerHelper::getVectorElement( maCacheIds, nCacheId, -1 );
-            PivotCache* pCache = maCaches.get( nCacheId ).get();
-            if( !pCache )
-                return nullptr;
-
-            /*  Try to find fragment path entry (stream name). If missing, the
-                stream has been read already, and the cache can be returned. */
-            FragmentPathMap::iterator aIt = maFragmentPaths.find( nCacheId );
-            if( aIt != maFragmentPaths.end() )
-            {
-                /*  Import the cache stream. This may create a dummy data sheet
-                    for external sheet sources. */
-                BiffPivotCacheFragment( *this, aIt->second, *pCache ).importFragment();
-                // remove the fragment entry to mark that the cache is initialized
-                maFragmentPaths.erase( aIt );
-            }
-            return pCache;
-        }
-
-        case FILTER_UNKNOWN:
-            OSL_FAIL( "PivotCacheBuffer::importPivotCacheFragment - unknown filter type" );
-    }
-    return nullptr;
+    /*  OOXML/BIFF12 filter: On first call for the cache ID, the pivot
+        cache object is created and inserted into maCaches. Then, the cache
+        definition fragment is read and the cache is returned. On
+        subsequent calls, the created cache will be found in maCaches and
+        returned immediately. */
+    // try to find an imported pivot cache
+    if( PivotCache* pCache = maCaches.get( nCacheId ).get() )
+        return pCache;
+
+    // check if a fragment path exists for the passed cache identifier
+    FragmentPathMap::iterator aIt = maFragmentPaths.find( nCacheId );
+    if( aIt == maFragmentPaths.end() )
+        return nullptr;
+
+    /*  Import the cache fragment. This may create a dummy data sheet
+        for external sheet sources. */
+    PivotCache& rCache = createPivotCache( nCacheId );
+    importOoxFragment( new PivotCacheDefinitionFragment( *this, aIt->second, rCache ) );
+    return &rCache;
 }
 
 PivotCache& PivotCacheBuffer::createPivotCache( sal_Int32 nCacheId )
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index d6f0ada..e11df21 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -102,7 +102,6 @@ namespace {
 
 // OOXML predefined color indexes (also used in BIFF3-BIFF8)
 const sal_Int32 OOX_COLOR_USEROFFSET        = 0;        /// First user defined color in palette (OOXML/BIFF12).
-const sal_Int32 BIFF_COLOR_USEROFFSET       = 8;        /// First user defined color in palette (BIFF3-BIFF8).
 
 // OOXML font family (also used in BIFF)
 const sal_Int32 OOX_FONTFAMILY_NONE         = 0;
@@ -233,9 +232,7 @@ ExcelGraphicHelper::ExcelGraphicHelper( const WorkbookHelper& rHelper ) :
 
 sal_Int32 ExcelGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
 {
-    if( getFilterType() == FILTER_OOXML )
-        return getTheme().getColorByToken( nToken );
-    return GraphicHelper::getSchemeColor( nToken );
+    return getTheme().getColorByToken( nToken );
 }
 
 sal_Int32 ExcelGraphicHelper::getPaletteColor( sal_Int32 nPaletteIdx ) const
@@ -349,33 +346,6 @@ namespace {
 #define PALETTE_EGA_COLORS_DARK \
             0x800000, 0x008000, 0x000080, 0x808000, 0x800080, 0x008080, 0xC0C0C0, 0x808080
 
-/** Default color table for BIFF2. */
-static const sal_Int32 spnDefColors2[] =
-{
-/*  0 */    PALETTE_EGA_COLORS_LIGHT
-};
-
-/** Default color table for BIFF3/BIFF4. */
-static const sal_Int32 spnDefColors3[] =
-{
-/*  0 */    PALETTE_EGA_COLORS_LIGHT,
-/*  8 */    PALETTE_EGA_COLORS_LIGHT,
-/* 16 */    PALETTE_EGA_COLORS_DARK
-};
-
-/** Default color table for BIFF5. */
-static const sal_Int32 spnDefColors5[] =
-{
-/*  0 */    PALETTE_EGA_COLORS_LIGHT,
-/*  8 */    PALETTE_EGA_COLORS_LIGHT,
-/* 16 */    PALETTE_EGA_COLORS_DARK,
-/* 24 */    0x8080FF, 0x802060, 0xFFFFC0, 0xA0E0E0, 0x600080, 0xFF8080, 0x0080C0, 0xC0C0FF,
-/* 32 */    0x000080, 0xFF00FF, 0xFFFF00, 0x00FFFF, 0x800080, 0x800000, 0x008080, 0x0000FF,
-/* 40 */    0x00CFFF, 0x69FFFF, 0xE0FFE0, 0xFFFF80, 0xA6CAF0, 0xDD9CB3, 0xB38FEE, 0xE3E3E3,
-/* 48 */    0x2A6FF9, 0x3FB8CD, 0x488436, 0x958C41, 0x8E5E42, 0xA0627A, 0x624FAC, 0x969696,
-/* 56 */    0x1D2FBE, 0x286676, 0x004500, 0x453E01, 0x6A2813, 0x85396A, 0x4A3285, 0x424242
-};
-
 /** Default color table for BIFF8/BIFF12/OOXML. */
 static const sal_Int32 spnDefColors8[] =
 {
@@ -399,26 +369,8 @@ ColorPalette::ColorPalette( const WorkbookHelper& rHelper )
     , mnAppendIndex(0)
 {
     // default colors
-    switch( getFilterType() )
-    {
-        case FILTER_OOXML:
-            maColors.insert( maColors.begin(), spnDefColors8, ::std::end(spnDefColors8) );
-            mnAppendIndex = OOX_COLOR_USEROFFSET;
-        break;
-        case FILTER_BIFF:
-            switch( getBiff() )
-            {
-                case BIFF2: maColors.insert( maColors.begin(), spnDefColors2, ::std::end(spnDefColors2) );  break;
-                case BIFF3:
-                case BIFF4: maColors.insert( maColors.begin(), spnDefColors3, ::std::end(spnDefColors3) );  break;
-                case BIFF5: maColors.insert( maColors.begin(), spnDefColors5, ::std::end(spnDefColors5) );  break;
-                case BIFF8: maColors.insert( maColors.begin(), spnDefColors8, ::std::end(spnDefColors8) );  break;
-                case BIFF_UNKNOWN: break;
-            }
-            mnAppendIndex = BIFF_COLOR_USEROFFSET;
-        break;
-        case FILTER_UNKNOWN: break;
-    }
+    maColors.insert( maColors.begin(), spnDefColors8, ::std::end(spnDefColors8) );
+    mnAppendIndex = OOX_COLOR_USEROFFSET;
 }
 
 void ColorPalette::importPaletteColor( const AttributeList& rAttribs )
@@ -1216,14 +1168,8 @@ void Alignment::finalizeImport()
         maApiData.mnVerJustifyMethod = css::table::CellJustifyMethod::DISTRIBUTE;
 
     /*  indentation: expressed as number of blocks of 3 space characters in
-        OOXML/BIFF12, and as multiple of 10 points in BIFF8. */
-    sal_Int32 nIndent = 0;
-    switch( getFilterType() )
-    {
-        case FILTER_OOXML:  nIndent = getUnitConverter().scaleToMm100( 3.0 * maModel.mnIndent, UNIT_SPACE );  break;
-        case FILTER_BIFF:   nIndent = getUnitConverter().scaleToMm100( 10.0 * maModel.mnIndent, UNIT_POINT ); break;
-        case FILTER_UNKNOWN: break;
-    }
+        OOXML. */
+    sal_Int32 nIndent = getUnitConverter().scaleToMm100( 3.0 * maModel.mnIndent, UNIT_SPACE );
     if( (0 <= nIndent) && (nIndent <= SAL_MAX_INT16) )
         maApiData.mnIndent = static_cast< sal_Int16 >( nIndent );
 
@@ -2226,9 +2172,9 @@ Xf::createPattern( bool bSkipPoolDefs )
         if( !maModel.mbProtUsed )
             maModel.mbProtUsed = !rStyleData.mbProtUsed || !(maProtection.getApiData() == pStyleXf->maProtection.getApiData());
         if( !maModel.mbBorderUsed )
-            maModel.mbBorderUsed = !rStyleData.mbBorderUsed || !rStyles.equalBorders( maModel.mnBorderId, rStyleData.mnBorderId );
+            maModel.mbBorderUsed = !rStyleData.mbBorderUsed || !StylesBuffer::equalBorders( maModel.mnBorderId, rStyleData.mnBorderId );
         if( !maModel.mbAreaUsed )
-            maModel.mbAreaUsed = !rStyleData.mbAreaUsed || !rStyles.equalFills( maModel.mnFillId, rStyleData.mnFillId );
+            maModel.mbAreaUsed = !rStyleData.mbAreaUsed || !StylesBuffer::equalFills( maModel.mnFillId, rStyleData.mnFillId );
     }
     // cell protection
     if( maModel.mbProtUsed )
@@ -2625,13 +2571,7 @@ void CellStyleBuffer::finalizeImport()
 
     /*  First, reserve style names that are built-in in Calc. This causes that
         imported cell styles get different unused names and thus do not try to
-        overwrite these built-in styles. For BIFF4 workbooks (which contain a
-        separate list of cell styles per sheet), reserve all existing styles if
-        current sheet is not the first sheet (this styles buffer will be
-        constructed again for every new sheet). This will create unique names
-        for styles in different sheets with the same name. Assuming that the
-        BIFF4W import filter is never used to import from clipboard... */
-    bool bReserveAll = (getFilterType() == FILTER_BIFF) && (getBiff() == BIFF4) && isWorkbookFile() && (getCurrentSheetIndex() > 0);
+        overwrite these built-in styles. */
     try
     {
         // unfortunately, com.sun.star.style.StyleFamily does not implement XEnumerationAccess...
@@ -2639,7 +2579,7 @@ void CellStyleBuffer::finalizeImport()
         for( sal_Int32 nIndex = 0, nCount = xStyleFamilyIA->getCount(); nIndex < nCount; ++nIndex )
         {
             Reference< XStyle > xStyle( xStyleFamilyIA->getByIndex( nIndex ), UNO_QUERY_THROW );
-            if( bReserveAll || !xStyle->isUserDefined() )
+            if( !xStyle->isUserDefined() )
             {
                 // create an empty entry by using ::std::map<>::operator[]
                 aCellStyles[ xStyle->getName() ];
@@ -2659,13 +2599,10 @@ void CellStyleBuffer::finalizeImport()
             continue;
 
         OUString aStyleName = lclCreateStyleName( rModel );
-        /*  If a builtin style entry already exists, and we do not reserve all
-            existing styles, we just stick with the last definition and ignore
+        /*  If a builtin style entry already exists,
+            we just stick with the last definition and ignore
             the preceding ones. */
-        if( bReserveAll && (aCellStyles.find( aStyleName ) != aCellStyles.end()) )
-            aConflictNameStyles.push_back( *aIt );
-        else
-            aCellStyles[ aStyleName ] = *aIt;
+        aCellStyles[ aStyleName ] = *aIt;
     }
 
     /*  Calculate names of user defined styles. Store styles with reserved
@@ -2939,53 +2876,21 @@ const FontModel& StylesBuffer::getDefaultFontModel() const
     return xDefFont.get() ? xDefFont->getModel() : getTheme().getDefaultFontModel();
 }
 
-bool StylesBuffer::equalBorders( sal_Int32 nBorderId1, sal_Int32 nBorderId2 ) const
+bool StylesBuffer::equalBorders( sal_Int32 nBorderId1, sal_Int32 nBorderId2 )
 {
     if( nBorderId1 == nBorderId2 )
         return true;
 
-    switch( getFilterType() )
-    {
-        case FILTER_OOXML:
-            // in OOXML, borders are assumed to be unique
-            return false;
-
-        case FILTER_BIFF:
-        {
-            // in BIFF, a new border entry has been created for every XF
-            const Border* pBorder1 = maBorders.get( nBorderId1 ).get();
-            const Border* pBorder2 = maBorders.get( nBorderId2 ).get();
-            return pBorder1 && pBorder2 && (pBorder1->getApiData() == pBorder2->getApiData());
-        }
-
-        case FILTER_UNKNOWN:
-        break;
-    }
+    // in OOXML, borders are assumed to be unique
     return false;
 }
 
-bool StylesBuffer::equalFills( sal_Int32 nFillId1, sal_Int32 nFillId2 ) const
+bool StylesBuffer::equalFills( sal_Int32 nFillId1, sal_Int32 nFillId2 )
 {
     if( nFillId1 == nFillId2 )
         return true;
 
-    switch( getFilterType() )
-    {
-        case FILTER_OOXML:
-            // in OOXML, fills are assumed to be unique
-            return false;
-
-        case FILTER_BIFF:
-        {
-            // in BIFF, a new fill entry has been created for every XF
-            const Fill* pFill1 = maFills.get( nFillId1 ).get();
-            const Fill* pFill2 = maFills.get( nFillId2 ).get();
-            return pFill1 && pFill2 && (pFill1->getApiData() == pFill2->getApiData());
-        }
-
-        case FILTER_UNKNOWN:
-        break;
-    }
+    // in OOXML, fills are assumed to be unique
     return false;
 }
 
diff --git a/sc/source/filter/oox/themebuffer.cxx b/sc/source/filter/oox/themebuffer.cxx
index 210094b..77849df 100644
--- a/sc/source/filter/oox/themebuffer.cxx
+++ b/sc/source/filter/oox/themebuffer.cxx
@@ -29,20 +29,9 @@ ThemeBuffer::ThemeBuffer( const WorkbookHelper& rHelper ) :
     WorkbookHelper( rHelper ),
     mxDefFontModel( new FontModel )
 {
-    switch( getFilterType() )
-    {
-        case FILTER_OOXML:
-            //! TODO: locale dependent font name
-            mxDefFontModel->maName = "Cambria";
-            mxDefFontModel->mfHeight = 11.0;
-        break;
-        case FILTER_BIFF:
-            //! TODO: BIFF dependent font name
-            mxDefFontModel->maName = "Arial";
-            mxDefFontModel->mfHeight = 10.0;
-        break;
-        case FILTER_UNKNOWN: break;
-    }
+    //! TODO: locale dependent font name
+    mxDefFontModel->maName = "Cambria";
+    mxDefFontModel->mfHeight = 11.0;
 }
 
 ThemeBuffer::~ThemeBuffer()
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 346b452..2af4dcb 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -128,8 +128,6 @@ public:
     inline FilterBase&  getBaseFilter() const { return mrBaseFilter; }
     /** Returns the filter progress bar. */
     inline SegmentProgressBar& getProgressBar() const { return *mxProgressBar; }
-    /** Returns the file type of the current filter. */
-    inline FilterType   getFilterType() const { return meFilterType; }
     /** Returns true, if the file is a multi-sheet document, or false if single-sheet. */
     inline bool         isWorkbookFile() const { return mbWorkbook; }
     /** Returns the VBA project storage. */
@@ -270,7 +268,6 @@ private:
     Reference< XSpreadsheetDocument > mxDoc;    /// Document model.
     FilterBase&         mrBaseFilter;           /// Base filter object.
     ExcelFilter&        mrExcelFilter;          /// Base object for registration of this structure.
-    FilterType          meFilterType;           /// File type of the filter.
     ProgressBarPtr      mxProgressBar;          /// The progress bar.
     StorageRef          mxVbaPrjStrg;           /// Storage containing the VBA project.
     sal_Int16           mnCurrSheet;            /// Current sheet index in Calc document.
@@ -308,7 +305,6 @@ private:
     BiffCodecHelperPtr  mxCodecHelper;          /// Encoder/decoder helper.
     BiffType            meBiff;                 /// BIFF version for BIFF import/export.
     rtl_TextEncoding    meTextEnc;              /// BIFF byte string text encoding.
-    bool                mbHasCodePage;          /// True = CODEPAGE record exists in imported stream.
     ScDocument* mpDoc;
     ScDocShell* mpDocShell;
     std::unique_ptr<ScDocumentImport> mxDocImport;
@@ -317,7 +313,6 @@ private:
 WorkbookGlobals::WorkbookGlobals( ExcelFilter& rFilter ) :
     mrBaseFilter( rFilter ),
     mrExcelFilter( rFilter ),
-    meFilterType( FILTER_OOXML ),
     mpOoxFilter( &rFilter ),
     meBiff( BIFF_UNKNOWN ),
     mpDoc(nullptr),
@@ -540,7 +535,6 @@ void WorkbookGlobals::initialize()
     mnCurrSheet = -1;
     mbWorkbook = true;
     meTextEnc = osl_getThreadTextEncoding();
-    mbHasCodePage = false;
 
     // the spreadsheet document
     mxDoc.set( mrBaseFilter.getModel(), UNO_QUERY );
@@ -622,19 +616,6 @@ void WorkbookGlobals::initialize()
     {
         mxProgressBar.reset( new SegmentProgressBar( mrBaseFilter.getStatusIndicator(), ScGlobal::GetRscString(STR_SAVE_DOC) ) );
     }
-    // filter specific
-    switch( getFilterType() )
-    {
-        case FILTER_BIFF:
-            mxCodecHelper.reset( new BiffCodecHelper( *this ) );
-        break;
-
-        case FILTER_OOXML:
-        break;
-
-        case FILTER_UNKNOWN:
-        break;
-    }
 }
 
 void WorkbookGlobals::finalize()
@@ -682,11 +663,6 @@ FilterBase& WorkbookHelper::getBaseFilter() const
     return mrBookGlob.getBaseFilter();
 }
 
-FilterType WorkbookHelper::getFilterType() const
-{
-    return mrBookGlob.getFilterType();
-}
-
 SegmentProgressBar& WorkbookHelper::getProgressBar() const
 {
     return mrBookGlob.getProgressBar();
@@ -983,7 +959,6 @@ PageSettingsConverter& WorkbookHelper::getPageSettingsConverter() const
 
 XmlFilterBase& WorkbookHelper::getOoxFilter() const
 {
-    OSL_ENSURE( mrBookGlob.getFilterType() == FILTER_OOXML, "WorkbookHelper::getOoxFilter - invalid call" );
     return mrBookGlob.getOoxFilter();
 }
 
diff --git a/sc/source/filter/oox/workbooksettings.cxx b/sc/source/filter/oox/workbooksettings.cxx
index df3d1b2..dbe5473 100644
--- a/sc/source/filter/oox/workbooksettings.cxx
+++ b/sc/source/filter/oox/workbooksettings.cxx
@@ -181,17 +181,9 @@ void WorkbookSettings::finalizeImport()
 {
     // default settings
     PropertySet aPropSet( getDocument() );
-    switch( getFilterType() )
-    {
-        case FILTER_OOXML:
-        case FILTER_BIFF:
-            aPropSet.setProperty( PROP_IgnoreCase,          true );     // always in Excel
-            aPropSet.setProperty( PROP_RegularExpressions,  false );    // not supported in Excel
-            aPropSet.setProperty( PROP_Wildcards,           true );     // always in Excel
-        break;
-        case FILTER_UNKNOWN:
-        break;
-    }
+    aPropSet.setProperty( PROP_IgnoreCase,          true );     // always in Excel
+    aPropSet.setProperty( PROP_RegularExpressions,  false );    // not supported in Excel
+    aPropSet.setProperty( PROP_Wildcards,           true );     // always in Excel
 
     // write protection
     if( maFileSharing.mbRecommendReadOnly || (maFileSharing.mnPasswordHash != 0) ) try
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 81c92e0..53c1cf3 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -274,9 +274,6 @@ public:
     /** returns the ExtLst entries that need to be filled */
     inline ExtLst&      getExtLst() { return maExtLst; }
 
-    /** Returns the BIFF drawing page for this sheet (BIFF2-BIFF8 only). */
-    inline BiffSheetDrawing& getBiffDrawing() const { return *mxBiffDrawing; }
-
     /** Sets a column or row page break described in the passed struct. */
     void                setPageBreak( const PageBreakModel& rModel, bool bRowBreak );
     /** Inserts the hyperlink URL into the spreadsheet. */
@@ -452,17 +449,7 @@ WorksheetGlobals::WorksheetGlobals( const WorkbookHelper& rHelper, const ISegmen
     maDefRowModel.mbCollapsed = false;
 
     // buffers
-    switch( getFilterType() )
-    {
-        case FILTER_OOXML:
-            mxVmlDrawing.reset( new VmlDrawing( *this ) );
-        break;
-        case FILTER_BIFF:
-            mxBiffDrawing.reset( new BiffSheetDrawing( *this ) );
-        break;
-        case FILTER_UNKNOWN:
-        break;
-    }
+    mxVmlDrawing.reset( new VmlDrawing( *this ) );
 
     // prepare progress bars
     if( mxProgressBar.get() )
@@ -1364,24 +1351,11 @@ void WorksheetGlobals::finalizeDrawings()
     PropertySet aRangeProp( getCellRange( CellRangeAddress( getSheetIndex(), 0, 0, mrMaxApiPos.Col(), mrMaxApiPos.Row() ) ) );
     aRangeProp.getProperty( maDrawPageSize, PROP_Size );
 
-    switch( getFilterType() )
-    {
-        case FILTER_OOXML:
-            // import DML and VML
-            if( !maDrawingPath.isEmpty() )
-                importOoxFragment( new DrawingFragment( *this, maDrawingPath ) );
-            if( !maVmlDrawingPath.isEmpty() )
-                importOoxFragment( new VmlDrawingFragment( *this, maVmlDrawingPath ) );
-        break;
-
-        case FILTER_BIFF:
-            // convert BIFF3-BIFF5 drawing objects, or import and convert DFF stream
-            getBiffDrawing().finalizeImport();
-        break;
-
-        case FILTER_UNKNOWN:
-        break;
-    }
+    // import DML and VML
+    if( !maDrawingPath.isEmpty() )
+        importOoxFragment( new DrawingFragment( *this, maDrawingPath ) );
+    if( !maVmlDrawingPath.isEmpty() )
+        importOoxFragment( new VmlDrawingFragment( *this, maVmlDrawingPath ) );
 
     // comments (after callout shapes have been imported from VML/DFF)
     maComments.finalizeImport();


More information about the Libreoffice-commits mailing list