sc/inc/interpretercontext.hxx           |    2 -
 sc/qa/unit/mark_test.cxx                |    2 -
 sc/source/core/data/table3.cxx          |    2 -
 sc/source/core/tool/token.cxx           |    2 -
 sc/source/filter/excel/xlroot.cxx       |    1 
 sc/source/filter/inc/lotattr.hxx        |   12 +++++-----
 sc/source/filter/inc/namebuff.hxx       |    2 +
 sc/source/filter/inc/root.hxx           |   21 ------------------
 sc/source/filter/lotus/filter.cxx       |    2 -
 sc/source/filter/lotus/lotattr.cxx      |   23 ++++++++++---------
 sc/source/filter/lotus/lotfilter.hxx    |   36 ++++++++++++++-----------------
 sc/source/filter/lotus/lotform.cxx      |    4 +--
 sc/source/filter/lotus/lotimpop.cxx     |   37 ++++++--------------------------
 sc/source/filter/lotus/lotread.cxx      |    8 +++---
 sc/source/filter/lotus/lotus.cxx        |   24 +++++++++++++++++++-
 sc/source/filter/lotus/op.cxx           |   24 ++++++++++----------
 sc/source/filter/lotus/tool.cxx         |    2 -
 sc/source/ui/docshell/dbdocfun.cxx      |    2 -
 sc/source/ui/miscdlgs/datatableview.cxx |    2 -
 sc/source/ui/view/viewfun2.cxx          |    4 +--
 20 files changed, 96 insertions(+), 116 deletions(-)

New commits:
commit c71d886120998884fdd16a862826f59883d9a114
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Nov 28 14:11:10 2019 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Nov 28 19:02:06 2019 +0100

    fix a few places using SCROW/SCCOL datatypes incorrectly
    
    Found while looking for problems in another patch.
    
    This will become more important with "jumbo sheets" when using the wrong
    datatype can mean overflow
    
    Change-Id: I7370ffd8a6edc33a5e613242735e4c7b9eaf830d
    Reviewed-on: https://gerrit.libreoffice.org/83991
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/inc/interpretercontext.hxx b/sc/inc/interpretercontext.hxx
index 35b91947405c..7eb1f1415642 100644
--- a/sc/inc/interpretercontext.hxx
+++ b/sc/inc/interpretercontext.hxx
@@ -30,7 +30,7 @@ enum class SvNumFormatType : sal_Int16;
 // SetNumberFormat() is not thread-safe, so calls to it need to be delayed to 
the main thread.
 struct DelayedSetNumberFormat
 {
-    SCROW mCol;
+    SCCOL mCol;
     SCROW mRow;
     sal_uInt32 mnNumberFormat;
 };
diff --git a/sc/qa/unit/mark_test.cxx b/sc/qa/unit/mark_test.cxx
index 6c2d3e870370..6cd63a02de6b 100644
--- a/sc/qa/unit/mark_test.cxx
+++ b/sc/qa/unit/mark_test.cxx
@@ -307,7 +307,7 @@ void Test::testMultiMark( const MultiMarkTestData& 
rMarksData )
             CPPUNIT_ASSERT( aMark.IsAllMarked( rRange ) );
             SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row();
             SCCOL nCol1 = rRange.aStart.Col(), nCol2 = rRange.aEnd.Col();
-            for ( SCROW nColIter = nCol1; nColIter <= nCol2; ++nColIter )
+            for ( SCCOL nColIter = nCol1; nColIter <= nCol2; ++nColIter )
                 CPPUNIT_ASSERT( aMultiSel.IsAllMarked( nColIter, nRow1, nRow2 
) );
         }
 
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 9f4eeb59e6a7..c3d627d09eff 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -3443,7 +3443,7 @@ bool ScTable::HasRowHeader( SCCOL nStartCol, SCROW 
nStartRow, SCCOL nEndCol, SCR
     }
 
     // First column all text cells, any non-text cell in second column => 
headers.
-    SCROW nTestCol = nStartCol + 1;
+    SCCOL nTestCol = nStartCol + 1;
     for (SCROW nRow=nStartRow; nRow<=nEndRow; nRow++)
     {
         CellType eType = GetCellType( nRow, nTestCol );
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 8bed30a6a57f..d305044afe3f 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3515,7 +3515,7 @@ void ScTokenArray::MoveReferenceRowReorder( const 
ScAddress& rPos, SCTAB nTab, S
                     if (it != rRowMap.end())
                     {
                         // This row is reordered.
-                        SCCOL nNewRow = it->second;
+                        SCROW nNewRow = it->second;
                         aAbs.aStart.SetRow(nNewRow);
                         aAbs.aEnd.SetRow(nNewRow);
                         rRef.SetRange(aAbs, rPos);
diff --git a/sc/source/ui/docshell/dbdocfun.cxx 
b/sc/source/ui/docshell/dbdocfun.cxx
index b4dff2ee24b8..71507af7bce2 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -505,7 +505,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& 
rSortParam,
     // tdf#119804: If there is a header row/column, it won't be affected by
     // sorting; so we can exclude it from the test.
     SCROW nStartingRowToEdit = aLocalParam.nRow1;
-    SCROW nStartingColToEdit = aLocalParam.nCol1;
+    SCCOL nStartingColToEdit = aLocalParam.nCol1;
     if ( aLocalParam.bHasHeader )
     {
         if ( aLocalParam.bByRow )
diff --git a/sc/source/ui/miscdlgs/datatableview.cxx 
b/sc/source/ui/miscdlgs/datatableview.cxx
index 16463598e1fe..2541688a6677 100644
--- a/sc/source/ui/miscdlgs/datatableview.cxx
+++ b/sc/source/ui/miscdlgs/datatableview.cxx
@@ -277,7 +277,7 @@ void ScDataTableView::Paint(vcl::RenderContext& 
rRenderContext, const tools::Rec
 {
     Size aSize = GetSizePixel();
     SCCOL nMaxVisibleCol = findColFromPos(aSize.Width() - nScrollBarSize, 
mpDoc.get(), mnFirstVisibleCol);
-    SCCOL nMaxVisibleRow = findRowFromPos(aSize.Height(), mpDoc.get(), 
mnFirstVisibleRow);
+    SCROW nMaxVisibleRow = findRowFromPos(aSize.Height(), mpDoc.get(), 
mnFirstVisibleRow);
 
     ScTableInfo aTableInfo;
     mpDoc->FillInfo(aTableInfo, mnFirstVisibleCol, mnFirstVisibleRow, 
nMaxVisibleCol, nMaxVisibleRow, 0, 0.06666, 0.06666, false, false);
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 5c5302a99517..0b3166bedef4 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -328,7 +328,7 @@ static bool lcl_FindNextSumEntryInColumn( ScDocument* pDoc, 
SCCOL nCol, SCROW& n
 }
 
 static bool lcl_FindNextSumEntryInRow( ScDocument* pDoc, SCCOL& nCol, SCROW 
nRow,
-                                SCTAB nTab, SCCOLROW& nExtend, SCROW nMinCol )
+                                SCTAB nTab, SCCOLROW& nExtend, SCCOL nMinCol )
 {
     const SCCOL nTmp = nCol;
     ScAutoSum eSkip = ScAutoSumNone;
@@ -1512,7 +1512,7 @@ void ScViewFunc::CopyAutoSpellData( FillDir eDir, SCCOL 
nStartCol, SCROW nStartR
         std::vector<std::vector<MisspellRangesType>> 
aSourceSpellRanges(nRowRepeatSize, 
std::vector<MisspellRangesType>(nColRepeatSize));
 
         for ( SCROW nRowIdx = 0; nRowIdx < nRowRepeatSize; ++nRowIdx )
-            for ( SCROW nColIdx = 0; nColIdx < nColRepeatSize; ++nColIdx )
+            for ( SCCOL nColIdx = 0; nColIdx < nColRepeatSize; ++nColIdx )
                 aSourceSpellRanges[nRowIdx][nColIdx] = pWin->GetAutoSpellData( 
nStartCol + nColIdx, nStartRow + nRowIdx );
 
         switch( eDir )
commit 523189a32e8d867b71d23f8aa88708ae2757f727
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Nov 28 13:30:10 2019 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Nov 28 19:01:54 2019 +0100

    merge LOTUS_ROOT into LotusContext
    
    since they are serving the same purpose.
    In the process getting rid of a duplicate ScDocument*
    that was sometimes set and sometimes not, causing trouble
    for me in another patch
    
    Change-Id: I2ceeb6d6e34b62616065bf4840a87bd87d2c3844
    Reviewed-on: https://gerrit.libreoffice.org/83990
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/source/filter/excel/xlroot.cxx 
b/sc/source/filter/excel/xlroot.cxx
index f52a4ab3fa3f..e4c0d924841f 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -40,6 +40,7 @@
 #include <editeng/editstat.hxx>
 #include <scitems.hxx>
 #include <editeng/eeitem.hxx>
+#include <editeng/fhgtitem.hxx>
 #include <document.hxx>
 #include <docpool.hxx>
 #include <docuno.hxx>
diff --git a/sc/source/filter/inc/lotattr.hxx b/sc/source/filter/inc/lotattr.hxx
index 82ead05d242e..cdeebbd79c9b 100644
--- a/sc/source/filter/inc/lotattr.hxx
+++ b/sc/source/filter/inc/lotattr.hxx
@@ -29,7 +29,7 @@ class ScDocumentPool;
 class ScPatternAttr;
 class SvxColorItem;
 class Color;
-struct LOTUS_ROOT;
+struct LotusContext;
 
 namespace editeng { class SvxBorderLine; }
 
@@ -56,7 +56,7 @@ class LotAttrCache
 {
 public:
 
-    LotAttrCache(LOTUS_ROOT* pLotRoot);
+    LotAttrCache(LotusContext& rContext);
 
     ~LotAttrCache();
 
@@ -96,7 +96,7 @@ private:
     std::unique_ptr<Color[]>      pColTab;
     std::vector< std::unique_ptr<ENTRY> > aEntries;
 
-    LOTUS_ROOT* mpLotusRoot;
+    LotusContext& mrContext;
 };
 
 class LotAttrCol
@@ -104,7 +104,7 @@ class LotAttrCol
 public:
     void SetAttr (const SCROW nRow, const ScPatternAttr&);
 
-    void Apply(LOTUS_ROOT* pLotRoot, const SCCOL nCol, const SCTAB nTab);
+    void Apply(LotusContext& rContext, const SCCOL nCol, const SCTAB nTab);
 private:
 
     struct ENTRY
@@ -120,11 +120,11 @@ private:
 class LotAttrTable
 {
 public:
-    LotAttrTable(LOTUS_ROOT* pLotRoot);
+    LotAttrTable(LotusContext& rContext);
 
     void SetAttr( const SCCOL nColFirst, const SCCOL nColLast, const SCROW 
nRow, const LotAttrWK3& );
 
-    void Apply(LOTUS_ROOT* pLotRoot, const SCTAB nTabNum);
+    void Apply(LotusContext& rContext, const SCTAB nTabNum);
 
 private:
 
diff --git a/sc/source/filter/inc/namebuff.hxx 
b/sc/source/filter/inc/namebuff.hxx
index 1f174b46e65c..fea49820580f 100644
--- a/sc/source/filter/inc/namebuff.hxx
+++ b/sc/source/filter/inc/namebuff.hxx
@@ -22,9 +22,11 @@
 
 #include <memory>
 #include <map>
+#include <vector>
 #include <rtl/ustring.hxx>
 #include "root.hxx"
 #include "xiroot.hxx"
+#include <refdata.hxx>
 
 #include <unordered_map>
 
diff --git a/sc/source/filter/inc/root.hxx b/sc/source/filter/inc/root.hxx
index 29c1f9bc3bfe..a41b22b2128b 100644
--- a/sc/source/filter/inc/root.hxx
+++ b/sc/source/filter/inc/root.hxx
@@ -22,9 +22,6 @@
 
 #include <address.hxx>
 #include "flttypes.hxx"
-#include "lotattr.hxx"
-#include "lotfntbf.hxx"
-#include "lotrange.hxx"
 #include <memory>
 
 class ScRangeName;
@@ -80,24 +77,6 @@ protected:
     ExcRoot( const ExcRoot& rCopy ) : pExcRoot( rCopy.pExcRoot ) {}
 };
 
-// Lotus Imp~/Exp~ -
-
-struct LOTUS_ROOT
-{
-    ScDocument*         pDoc;
-    LotusRangeList      maRangeNames;
-    rtl_TextEncoding const    eCharsetQ;
-    Lotus123Typ         eFirstType;
-    Lotus123Typ         eActType;
-    ScRange             aActRange;
-    std::unique_ptr<RangeNameBufferWK3> pRngNmBffWK3;
-    LotusFontBuffer     maFontBuff;
-    LotAttrTable        maAttrTable;
-
-                        LOTUS_ROOT( ScDocument* pDocP, rtl_TextEncoding eQ );
-                        ~LOTUS_ROOT();
-};
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/lotus/filter.cxx 
b/sc/source/filter/lotus/filter.cxx
index 9746a6807a93..6723f7d402c6 100644
--- a/sc/source/filter/lotus/filter.cxx
+++ b/sc/source/filter/lotus/filter.cxx
@@ -189,7 +189,7 @@ ErrCode ScImportLotus123old(LotusContext& rContext, 
SvStream& aStream, ScDocumen
     // make document pointer global
     rContext.pDoc = pDocument;
     rContext.bEOF = false;
-    rContext.eCharVon = eSrc;
+    rContext.eCharset = eSrc;
 
     // allocate memory
     if( !MemNew(rContext) )
diff --git a/sc/source/filter/lotus/lotattr.cxx 
b/sc/source/filter/lotus/lotattr.cxx
index dd7725b40ec2..725ac276d7d7 100644
--- a/sc/source/filter/lotus/lotattr.cxx
+++ b/sc/source/filter/lotus/lotattr.cxx
@@ -30,6 +30,7 @@
 #include <docpool.hxx>
 #include <document.hxx>
 #include <lotfntbf.hxx>
+#include "lotfilter.hxx"
 #include <patattr.hxx>
 #include <root.hxx>
 #include <scitems.hxx>
@@ -46,10 +47,10 @@ LotAttrCache::ENTRY::~ENTRY ()
 {
 }
 
-LotAttrCache::LotAttrCache (LOTUS_ROOT* pLotRoot)
-    : mpLotusRoot(pLotRoot)
+LotAttrCache::LotAttrCache (LotusContext& rContext)
+    : mrContext(rContext)
 {
-    pDocPool = mpLotusRoot->pDoc->GetPool();
+    pDocPool = rContext.pDoc->GetPool();
 
     pColTab.reset( new Color [ 8 ] );
     pColTab[ 0 ] = COL_WHITE;
@@ -95,7 +96,7 @@ const ScPatternAttr& LotAttrCache::GetPattAttr( const 
LotAttrWK3& rAttr )
 
     pCurrent->nHash0 = nRefHash;
 
-    mpLotusRoot->maFontBuff.Fill( rAttr.nFont, rItemSet );
+    mrContext.maFontBuff.Fill( rAttr.nFont, rItemSet );
 
     sal_uInt8 nLine = rAttr.nLineStyle;
     if( nLine )
@@ -211,9 +212,9 @@ void LotAttrCol::SetAttr( const SCROW nRow, const 
ScPatternAttr& rAttr )
     }
 }
 
-void LotAttrCol::Apply(LOTUS_ROOT* pLotusRoot, const SCCOL nColNum, const 
SCTAB nTabNum)
+void LotAttrCol::Apply(LotusContext& rContext, const SCCOL nColNum, const 
SCTAB nTabNum)
 {
-    ScDocument*     pDoc = pLotusRoot->pDoc;
+    ScDocument*     pDoc = rContext.pDoc;
 
     for (const auto& rxEntry : aEntries)
     {
@@ -222,8 +223,8 @@ void LotAttrCol::Apply(LOTUS_ROOT* pLotusRoot, const SCCOL 
nColNum, const SCTAB
     }
 }
 
-LotAttrTable::LotAttrTable(LOTUS_ROOT* pLotRoot):
-    aAttrCache(pLotRoot)
+LotAttrTable::LotAttrTable(LotusContext& rContext):
+    aAttrCache(rContext)
 {
 }
 
@@ -240,11 +241,11 @@ void LotAttrTable::SetAttr( const SCCOL nColFirst, const 
SCCOL nColLast, const S
         pCols[ nColCnt ].SetAttr( nRow, rPattAttr );
 }
 
-void LotAttrTable::Apply(LOTUS_ROOT* pLotusRoot, const SCTAB nTabNum)
+void LotAttrTable::Apply(LotusContext& rContext, const SCTAB nTabNum)
 {
     SCCOL nColCnt;
-    for( nColCnt = 0 ; nColCnt <= aAttrCache.mpLotusRoot->pDoc->MaxCol() ; 
nColCnt++ )
-        pCols[ nColCnt ].Apply(pLotusRoot, nColCnt, nTabNum);     // does a 
Clear() at end
+    for( nColCnt = 0 ; nColCnt <= aAttrCache.mrContext.pDoc->MaxCol() ; 
nColCnt++ )
+        pCols[ nColCnt ].Apply(rContext, nColCnt, nTabNum);     // does a 
Clear() at end
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/lotus/lotfilter.hxx 
b/sc/source/filter/lotus/lotfilter.hxx
index 66700377584d..95cb49b3b13d 100644
--- a/sc/source/filter/lotus/lotfilter.hxx
+++ b/sc/source/filter/lotus/lotfilter.hxx
@@ -24,42 +24,40 @@
 #include <decl.h>
 #include <optab.h>
 #include <patattr.hxx>
+#include <lotattr.hxx>
+#include <lotrange.hxx>
+#include <lotfntbf.hxx>
+#include <flttypes.hxx>
+#include <namebuff.hxx>
 
 class SvxHorJustifyItem;
 class FormCache;
-struct LOTUS_ROOT;
 
 struct LotusContext
 {
     static const sal_uInt16 nBOF = 0x0000;
+    static OPCODE_FKT pOpFkt[ FKT_LIMIT ];
+    static OPCODE_FKT pOpFkt123[ FKT_LIMIT123 ]; // -> optab.cxx; table of 
possible Opcodes
+
     WKTYP            eTyp;          // type of file being processed
     bool             bEOF;          // shows end of file
-    rtl_TextEncoding eCharVon;
+    rtl_TextEncoding eCharset;
     ScDocument*      pDoc;          // pointer to access document
-    static OPCODE_FKT pOpFkt[ FKT_LIMIT ];
-    static OPCODE_FKT pOpFkt123[ FKT_LIMIT123 ]; // -> optab.cxx; table of 
possible Opcodes
-    LOTUS_ROOT*      pLotusRoot;
     std::map<sal_uInt16, ScPatternAttr> aLotusPatternPool;
 
     SvxHorJustifyItem *pAttrRight, *pAttrLeft, *pAttrCenter, *pAttrRepeat, 
*pAttrStandard;
 
     FormCache*       pValueFormCache; // -> initialized in memory.cxx
 
-    LotusContext()
-        : eTyp(eWK_UNKNOWN)
-        , bEOF(false)
-        , eCharVon(RTL_TEXTENCODING_DONTKNOW)
-        , pDoc(nullptr)
-        , pLotusRoot(nullptr)
+    LotusRangeList      maRangeNames;
+    Lotus123Typ         eFirstType;
+    Lotus123Typ         eActType;
+    ScRange             aActRange;
+    std::unique_ptr<RangeNameBufferWK3> pRngNmBffWK3;
+    LotusFontBuffer     maFontBuff;
+    LotAttrTable        maAttrTable;
 
-        , pAttrRight(nullptr)
-        , pAttrLeft(nullptr)
-        , pAttrCenter(nullptr)
-        , pAttrRepeat(nullptr)
-        , pAttrStandard(nullptr)
-        , pValueFormCache(nullptr)
-    {
-    }
+    LotusContext(ScDocument* pDocP, rtl_TextEncoding eQ);
 };
 
 #endif
diff --git a/sc/source/filter/lotus/lotform.cxx 
b/sc/source/filter/lotus/lotform.cxx
index 9692a95f08ff..a9e38c18b507 100644
--- a/sc/source/filter/lotus/lotform.cxx
+++ b/sc/source/filter/lotus/lotform.cxx
@@ -392,7 +392,7 @@ void LotusToSc::Convert( std::unique_ptr<ScTokenArray>& 
rpErg, sal_Int32& rRest
     TokenId             nBuf0;
     DefTokenId          eOc;
     const sal_Char*     pExtName = nullptr;
-    RangeNameBufferWK3& rRangeNameBufferWK3 = 
*m_rContext.pLotusRoot->pRngNmBffWK3;
+    RangeNameBufferWK3& rRangeNameBufferWK3 = *m_rContext.pRngNmBffWK3;
 
     ScComplexRefData        aCRD;
     aCRD.InitFlags();
@@ -401,7 +401,7 @@ void LotusToSc::Convert( std::unique_ptr<ScTokenArray>& 
rpErg, sal_Int32& rRest
     LR_ID               nId;
     TokenId             nNewId;
 
-    LotusRangeList&     rRangeList = m_rContext.pLotusRoot->maRangeNames;
+    LotusRangeList&     rRangeList = m_rContext.maRangeNames;
 
     FuncType1*          pIndexToType;
     FuncType2*          pIndexToToken;
diff --git a/sc/source/filter/lotus/lotimpop.cxx 
b/sc/source/filter/lotus/lotimpop.cxx
index 3b1a66603561..2b6c5afa6f7c 100644
--- a/sc/source/filter/lotus/lotimpop.cxx
+++ b/sc/source/filter/lotus/lotimpop.cxx
@@ -37,21 +37,6 @@
 
 #include <unotools/configmgr.hxx>
 
-LOTUS_ROOT::LOTUS_ROOT( ScDocument* pDocP, rtl_TextEncoding eQ )
-    :
-        pDoc( pDocP),
-        maRangeNames(),
-        eCharsetQ( eQ),
-        eFirstType( Lotus123Typ::X),
-        eActType( Lotus123Typ::X),
-        pRngNmBffWK3( new RangeNameBufferWK3() ),
-        maAttrTable( this )
-{
-}
-
-LOTUS_ROOT::~LOTUS_ROOT()
-{
-}
 
 static osl::Mutex aLotImpSemaphore;
 
@@ -64,16 +49,10 @@ ImportLotus::ImportLotus(LotusContext &rContext, SvStream& 
aStream, ScDocument*
 {
     // good point to start locking of import lotus
     aLotImpSemaphore.acquire();
-
-    rContext.pLotusRoot = new LOTUS_ROOT(pDoc, eQ);
 }
 
 ImportLotus::~ImportLotus()
 {
-    LotusContext &rContext = aConv.getContext();
-    delete rContext.pLotusRoot;
-    rContext.pLotusRoot = nullptr;
-
     // no need 4 pLotusRoot anymore
     aLotImpSemaphore.release();
 }
@@ -86,7 +65,7 @@ void ImportLotus::Bof()
     Read( nFileCode );
     Read( nFileSub );
     LotusContext &rContext = aConv.getContext();
-    Read( rContext.pLotusRoot->aActRange );
+    Read( rContext.aActRange );
     Read( nSaveCnt );
     Read( nMajorId );
     Read( nMinorId );
@@ -97,11 +76,11 @@ void ImportLotus::Bof()
     {
         if( nFileCode == 0x1000 )
         {// <= WK3
-            rContext.pLotusRoot->eFirstType = rContext.pLotusRoot->eActType = 
Lotus123Typ::WK3;
+            rContext.eFirstType = rContext.eActType = Lotus123Typ::WK3;
         }
         else if( nFileCode == 0x1002 )
         {// WK4
-            rContext.pLotusRoot->eFirstType = rContext.pLotusRoot->eActType = 
Lotus123Typ::WK4;
+            rContext.eFirstType = rContext.eActType = Lotus123Typ::WK4;
         }
     }
 }
@@ -188,7 +167,7 @@ void ImportLotus::Userrange()
     Read( aScRange );
 
     LotusContext &rContext = aConv.getContext();
-    rContext.pLotusRoot->pRngNmBffWK3->Add( aName, aScRange );
+    rContext.pRngNmBffWK3->Add( aName, aScRange );
 }
 
 void ImportLotus::Errcell()
@@ -353,7 +332,7 @@ void ImportLotus::Font_Face()
     Read( aName );
 
     LotusContext &rContext = aConv.getContext();
-    rContext.pLotusRoot->maFontBuff.SetName( nNum, aName );
+    rContext.maFontBuff.SetName( nNum, aName );
 }
 
 void ImportLotus::Font_Type()
@@ -363,7 +342,7 @@ void ImportLotus::Font_Type()
     {
         sal_uInt16 nType;
         Read( nType );
-        rContext.pLotusRoot->maFontBuff.SetType( nCnt, nType );
+        rContext.maFontBuff.SetType( nCnt, nType );
     }
 }
 
@@ -374,7 +353,7 @@ void ImportLotus::Font_Ysize()
     {
         sal_uInt16 nSize;
         Read( nSize );
-        rContext.pLotusRoot->maFontBuff.SetHeight( nCnt, nSize );
+        rContext.maFontBuff.SetHeight( nCnt, nSize );
     }
 }
 
@@ -411,7 +390,7 @@ void ImportLotus::Row_( const sal_uInt16 nRecLen )
         Read( nRepeats );
 
         if( aAttr.HasStyles() )
-            rContext.pLotusRoot->maAttrTable.SetAttr(
+            rContext.maAttrTable.SetAttr(
                 nColCnt, static_cast<SCCOL> ( nColCnt + nRepeats ), nRow, 
aAttr );
 
         // Do this here and NOT in class LotAttrTable, as we only add 
attributes if the other
diff --git a/sc/source/filter/lotus/lotread.cxx 
b/sc/source/filter/lotus/lotread.cxx
index dab87db2866b..5212b0355441 100644
--- a/sc/source/filter/lotus/lotread.cxx
+++ b/sc/source/filter/lotus/lotread.cxx
@@ -86,7 +86,7 @@ ErrCode ImportLotus::parse()
                 if( nRecLen > 2 )
                 {
                     Bof();
-                    switch (rContext.pLotusRoot->eFirstType)
+                    switch (rContext.eFirstType)
                     {
                         case Lotus123Typ::WK3: eCurrent = S_WK3; break;
                         case Lotus123Typ::WK4: eCurrent = S_WK4; break;
@@ -290,7 +290,7 @@ ErrCode ImportLotus::Read(SvStream& rIn)
 
                 case 195:
                     if( nExtTab >= 0 )
-                        
rContext.pLotusRoot->maAttrTable.Apply(rContext.pLotusRoot, 
static_cast<SCTAB>(nExtTab));
+                        rContext.maAttrTable.Apply(rContext, 
static_cast<SCTAB>(nExtTab));
                     nExtTab++;
                     break;
                 case 197:
@@ -305,7 +305,7 @@ ErrCode ImportLotus::Read(SvStream& rIn)
         }
     }
 
-    rContext.pLotusRoot->maAttrTable.Apply(rContext.pLotusRoot, 
static_cast<SCTAB>(nExtTab));
+    rContext.maAttrTable.Apply(rContext, static_cast<SCTAB>(nExtTab));
 
     return eRet;
 }
@@ -321,7 +321,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool 
TestImportWKS(SvStream& rStream)
     aDocument.EnableExecuteLink(false);
     aDocument.SetInsertingFromOtherDoc(true);
 
-    LotusContext aContext;
+    LotusContext aContext(&aDocument, RTL_TEXTENCODING_ASCII_US);
     ImportLotus aLotusImport(aContext, rStream, &aDocument, 
RTL_TEXTENCODING_ASCII_US);
 
     ErrCode eRet = aLotusImport.parse();
diff --git a/sc/source/filter/lotus/lotus.cxx b/sc/source/filter/lotus/lotus.cxx
index 5b7260434343..a2f0482a31b1 100644
--- a/sc/source/filter/lotus/lotus.cxx
+++ b/sc/source/filter/lotus/lotus.cxx
@@ -38,7 +38,7 @@ ErrCode ScFormatFilterPluginImpl::ScImportLotus123( 
SfxMedium& rMedium, ScDocume
 
     pStream->SetBufferSize( 32768 );
 
-    LotusContext aContext;
+    LotusContext aContext(pDocument, eSrc);
 
     ImportLotus aLotusImport(aContext, *pStream, pDocument, eSrc);
 
@@ -61,7 +61,7 @@ ErrCode ScFormatFilterPluginImpl::ScImportLotus123( 
SfxMedium& rMedium, ScDocume
     if( eRet != ERRCODE_NONE )
         return eRet;
 
-    if (aContext.pLotusRoot->eFirstType == Lotus123Typ::WK3)
+    if (aContext.eFirstType == Lotus123Typ::WK3)
     {
         // try to load *.FM3 file
         INetURLObject aURL( rMedium.GetURLObject() );
@@ -80,4 +80,24 @@ ErrCode ScFormatFilterPluginImpl::ScImportLotus123( 
SfxMedium& rMedium, ScDocume
     return eRet;
 }
 
+LotusContext::LotusContext(ScDocument* pDocP, rtl_TextEncoding eQ)
+    : eTyp(eWK_UNKNOWN)
+    , bEOF(false)
+    , eCharset(eQ)
+    , pDoc(pDocP)
+    , pAttrRight(nullptr)
+    , pAttrLeft(nullptr)
+    , pAttrCenter(nullptr)
+    , pAttrRepeat(nullptr)
+    , pAttrStandard(nullptr)
+    , pValueFormCache(nullptr)
+    , maRangeNames()
+    , eFirstType( Lotus123Typ::X)
+    , eActType( Lotus123Typ::X)
+    , pRngNmBffWK3( new RangeNameBufferWK3() )
+    , maAttrTable( *this )
+{
+}
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index 02cd9b0e014d..01f1a3616d34 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -144,8 +144,8 @@ void OP_Formula(LotusContext &rContext, SvStream& r, 
sal_uInt16 /*n*/)
     sal_Int32 nBytesLeft = nFormulaSize;
     ScAddress aAddress(nCol, nRow, 0);
 
-    svl::SharedStringPool& rSPool = 
rContext.pLotusRoot->pDoc->GetSharedStringPool();
-    LotusToSc aConv(rContext, r, rSPool, rContext.pLotusRoot->eCharsetQ, 
false);
+    svl::SharedStringPool& rSPool = rContext.pDoc->GetSharedStringPool();
+    LotusToSc aConv(rContext, r, rSPool, rContext.eCharset, false);
     aConv.Reset( aAddress );
     aConv.Convert( pResult, nBytesLeft );
     if (!aConv.good())
@@ -153,7 +153,7 @@ void OP_Formula(LotusContext &rContext, SvStream& r, 
sal_uInt16 /*n*/)
 
     if (ValidColRow(nCol, nRow))
     {
-        ScFormulaCell* pCell = new ScFormulaCell(rContext.pLotusRoot->pDoc, 
aAddress, std::move(pResult));
+        ScFormulaCell* pCell = new ScFormulaCell(rContext.pDoc, aAddress, 
std::move(pResult));
         pCell->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE );
         rContext.pDoc->EnsureTable(0);
         rContext.pDoc->SetFormulaCell(ScAddress(nCol, nRow, 0), pCell);
@@ -218,11 +218,11 @@ void OP_NamedRange(LotusContext& rContext, SvStream& r, 
sal_uInt16 /*n*/)
         else
             strcpy( cBuf, cBuffer );           // #100211# - checked
 
-        OUString      aTmp( cBuf, strlen(cBuf), rContext.pLotusRoot->eCharsetQ 
);
+        OUString      aTmp( cBuf, strlen(cBuf), rContext.eCharset );
 
         aTmp = ScfTools::ConvertToScDefinedName( aTmp );
 
-        rContext.pLotusRoot->maRangeNames.Append( std::move(pRange) );
+        rContext.maRangeNames.Append( std::move(pRange) );
     }
 }
 
@@ -257,10 +257,10 @@ void OP_SymphNamedRange(LotusContext& rContext, SvStream& 
r, sal_uInt16 /*n*/)
         else
             strcpy( cBuf, cBuffer );           // #100211# - checked
 
-        OUString  aTmp( cBuf, strlen(cBuf), rContext.pLotusRoot->eCharsetQ );
+        OUString  aTmp( cBuf, strlen(cBuf), rContext.eCharset );
         aTmp = ScfTools::ConvertToScDefinedName( aTmp );
 
-        rContext.pLotusRoot->maRangeNames.Append( std::move(pRange) );
+        rContext.maRangeNames.Append( std::move(pRange) );
     }
 }
 
@@ -402,8 +402,8 @@ void OP_Formula123(LotusContext& rContext, SvStream& r, 
sal_uInt16 n)
     sal_Int32 nBytesLeft = (n > 12) ? n - 12 : 0;
     ScAddress aAddress( nCol, nRow, nTab );
 
-    svl::SharedStringPool& rSPool = 
rContext.pLotusRoot->pDoc->GetSharedStringPool();
-    LotusToSc aConv(rContext, r, rSPool, rContext.pLotusRoot->eCharsetQ, true);
+    svl::SharedStringPool& rSPool = rContext.pDoc->GetSharedStringPool();
+    LotusToSc aConv(rContext, r, rSPool, rContext.eCharset, true);
     aConv.Reset( aAddress );
     aConv.Convert( pResult, nBytesLeft );
     if (!aConv.good())
@@ -411,7 +411,7 @@ void OP_Formula123(LotusContext& rContext, SvStream& r, 
sal_uInt16 n)
 
     if (ValidColRow(nCol, nRow) && nTab <= rContext.pDoc->GetMaxTableNumber())
     {
-        ScFormulaCell* pCell = new ScFormulaCell(rContext.pLotusRoot->pDoc, 
aAddress, std::move(pResult));
+        ScFormulaCell* pCell = new ScFormulaCell(rContext.pDoc, aAddress, 
std::move(pResult));
         pCell->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE );
         rContext.pDoc->EnsureTable(nTab);
         rContext.pDoc->SetFormulaCell(ScAddress(nCol,nRow,nTab), pCell);
@@ -450,7 +450,7 @@ void OP_Note123(LotusContext& rContext, SvStream& r, 
sal_uInt16 n)
     r.ReadBytes(pText.get(), n);
     pText[ n ] = 0;
 
-    OUString aNoteText(pText.get(), strlen(pText.get()), 
rContext.pLotusRoot->eCharsetQ);
+    OUString aNoteText(pText.get(), strlen(pText.get()), rContext.eCharset);
     pText.reset();
 
     ScAddress aPos(nCol, nRow, nTab);
@@ -595,7 +595,7 @@ void OP_SheetName123(LotusContext& rContext, SvStream& 
rStream, sal_uInt16 nLeng
     rContext.pDoc->MakeTable(nSheetNum);
     if (!sSheetName.empty())
     {
-        OUString aName(sSheetName.data(), strlen(sSheetName.data()), 
rContext.eCharVon);
+        OUString aName(sSheetName.data(), strlen(sSheetName.data()), 
rContext.eCharset);
         rContext.pDoc->RenameTab(nSheetNum, aName);
     }
 }
diff --git a/sc/source/filter/lotus/tool.cxx b/sc/source/filter/lotus/tool.cxx
index 5c5d307198a3..5eeb6af4642f 100644
--- a/sc/source/filter/lotus/tool.cxx
+++ b/sc/source/filter/lotus/tool.cxx
@@ -82,7 +82,7 @@ void PutFormString(LotusContext& rContext, SCCOL nCol, SCROW 
nRow, SCTAB nTab, s
     rContext.pDoc->ApplyAttr( nCol, nRow, nTab, *pJustify );
     ScSetStringParam aParam;
     aParam.setTextInput();
-    rContext.pDoc->SetString(ScAddress(nCol,nRow,nTab), OUString(pString, 
strlen(pString), rContext.pLotusRoot->eCharsetQ), &aParam);
+    rContext.pDoc->SetString(ScAddress(nCol,nRow,nTab), OUString(pString, 
strlen(pString), rContext.eCharset), &aParam);
 }
 
 void SetFormat(LotusContext& rContext, SCCOL nCol, SCROW nRow, SCTAB nTab, 
sal_uInt8 nFormat, sal_uInt8 nSt)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to