sc/inc/address.hxx                  |    4 ++--
 sc/source/core/data/column.cxx      |    3 ++-
 sc/source/core/data/conditio.cxx    |    2 +-
 sc/source/core/data/drwlayer.cxx    |    7 ++++---
 sc/source/core/data/formulacell.cxx |    2 +-
 sc/source/core/tool/address.cxx     |   22 +++++++++++-----------
 sc/source/core/tool/token.cxx       |   18 +++++++++---------
 sc/source/filter/html/htmlimp.cxx   |    2 +-
 sc/source/filter/html/htmlpars.cxx  |   25 ++++++++++++++-----------
 sc/source/filter/inc/htmlpars.hxx   |   10 +++++++---
 sc/source/ui/docshell/docfunc.cxx   |    4 ++--
 sc/source/ui/view/gridwin.cxx       |    8 ++++----
 12 files changed, 58 insertions(+), 49 deletions(-)

New commits:
commit 725e1066cbe3bbd6759b3e7396bc5d0ecb55a504
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Sat Feb 19 10:29:32 2022 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Sat Feb 19 12:42:54 2022 +0100

    remove MAXCOL/MAXROW from ScAddress/ScRange (tdf#147509)
    
    Change-Id: I4e80bba8b866f9915a6600ce67774380e619c2e7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130188
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index dab74ac0fcc0..4532fffec32d 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -352,7 +352,7 @@ public:
                 The document for the maximum defined sheet number.
      */
     [[nodiscard]] SC_DLLPUBLIC bool Move( SCCOL nDeltaX, SCROW nDeltaY, SCTAB 
nDeltaZ,
-            ScAddress& rErrorPos, const ScDocument* pDocument = nullptr );
+            ScAddress& rErrorPos, const ScDocument& rDoc );
 
     inline bool operator==( const ScAddress& rAddress ) const;
     inline bool operator!=( const ScAddress& rAddress ) const;
@@ -622,7 +622,7 @@ public:
                 The document for the maximum defined sheet number.
      */
     [[nodiscard]] bool Move( SCCOL aDeltaX, SCROW aDeltaY, SCTAB aDeltaZ,
-            ScRange& rErrorRange, const ScDocument* pDocument = nullptr );
+            ScRange& rErrorRange, const ScDocument& rDoc );
 
     /** Same as Move() but with sticky end col/row anchors. */
     [[nodiscard]] bool MoveSticky( const ScDocument& rDoc, SCCOL aDeltaX, 
SCROW aDeltaY, SCTAB aDeltaZ,
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 80a667801aac..167a3541f511 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2186,7 +2186,8 @@ class UpdateRefOnNonCopy
             for (++pp; pp != ppEnd; ++pp) // skip the top cell.
             {
                 ScFormulaCell* pFC = *pp;
-                if (!pFC->aPos.Move(mpCxt->mnColDelta, mpCxt->mnRowDelta, 
mpCxt->mnTabDelta, aErrorPos))
+                if (!pFC->aPos.Move(mpCxt->mnColDelta, mpCxt->mnRowDelta, 
mpCxt->mnTabDelta,
+                                    aErrorPos, mpCxt->mrDoc))
                 {
                     assert(!"can't move formula cell");
                 }
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 841238883dcb..ab5bfce9814a 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -500,7 +500,7 @@ void ScConditionEntry::UpdateReference( 
sc::RefUpdateContext& rCxt )
     if (rCxt.meMode == URM_INSDEL && rCxt.maRange.Contains(aSrcPos))
     {
         ScAddress aErrorPos( ScAddress::UNINITIALIZED );
-        if (!aSrcPos.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta, 
aErrorPos))
+        if (!aSrcPos.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta, 
aErrorPos, *mpDoc))
         {
             assert(!"can't move ScConditionEntry");
         }
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index e625868b5466..47985ebeda51 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1769,7 +1769,8 @@ static bool lcl_IsAllInRange( const ::std::vector< 
ScRangeList >& rRangesVector,
     return true;            // everything is fine
 }
 
-static bool lcl_MoveRanges( ::std::vector< ScRangeList >& rRangesVector, const 
ScRange& rSourceRange, const ScAddress& rDestPos )
+static bool lcl_MoveRanges( ::std::vector< ScRangeList >& rRangesVector, const 
ScRange& rSourceRange,
+                            const ScAddress& rDestPos, const ScDocument& rDoc )
 {
     bool bChanged = false;
 
@@ -1784,7 +1785,7 @@ static bool lcl_MoveRanges( ::std::vector< ScRangeList >& 
rRangesVector, const S
                 SCCOL nDiffX = rDestPos.Col() - rSourceRange.aStart.Col();
                 SCROW nDiffY = rDestPos.Row() - rSourceRange.aStart.Row();
                 SCTAB nDiffZ = rDestPos.Tab() - rSourceRange.aStart.Tab();
-                if (!rRange.Move( nDiffX, nDiffY, nDiffZ, aErrorRange))
+                if (!rRange.Move( nDiffX, nDiffY, nDiffZ, aErrorRange, rDoc ))
                 {
                     assert(!"can't move range");
                 }
@@ -1957,7 +1958,7 @@ void ScDrawLayer::CopyFromClip( ScDrawLayer* pClipModel, 
SCTAB nSourceTab, const
                                     if ( rDestPos != aClipRange.aStart )
                                     {
                                         //  update the data ranges to the new 
(copied) position
-                                        if ( lcl_MoveRanges( aRangesVector, 
aClipRange, rDestPos ) )
+                                        if ( lcl_MoveRanges( aRangesVector, 
aClipRange, rDestPos, *pDoc ) )
                                             pDoc->SetChartRanges( aChartName, 
aRangesVector );
                                     }
                                 }
diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index f3c0c1ed305b..e8ee8682df60 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3127,7 +3127,7 @@ bool ScFormulaCell::UpdatePosOnShift( const 
sc::RefUpdateContext& rCxt )
     // This formula cell itself is being shifted during cell range
     // insertion or deletion. Update its position.
     ScAddress aErrorPos( ScAddress::UNINITIALIZED );
-    if (!aPos.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta, 
aErrorPos))
+    if (!aPos.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta, 
aErrorPos, rCxt.mrDoc))
     {
         assert(!"can't move ScFormulaCell");
     }
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 28f1b0b7f6ad..a9c52ea0b2a0 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -2290,11 +2290,11 @@ OUString ScRange::Format( const ScDocument& rDoc, 
ScRefFlags nFlags,
     return r.makeStringAndClear();
 }
 
-bool ScAddress::Move( SCCOL dx, SCROW dy, SCTAB dz, ScAddress& rErrorPos, 
const ScDocument* pDoc )
+bool ScAddress::Move( SCCOL dx, SCROW dy, SCTAB dz, ScAddress& rErrorPos, 
const ScDocument& rDoc )
 {
-    SCTAB nMaxTab = pDoc ? pDoc->GetTableCount() : MAXTAB;
-    SCCOL nMaxCol = pDoc ? pDoc->MaxCol() : MAXCOL;
-    SCROW nMaxRow = pDoc ? pDoc->MaxRow() : MAXROW;
+    SCTAB nMaxTab = rDoc.GetTableCount();
+    SCCOL nMaxCol = rDoc.MaxCol();
+    SCROW nMaxRow = rDoc.MaxRow();
     dx = Col() + dx;
     dy = Row() + dy;
     dz = Tab() + dz;
@@ -2338,16 +2338,16 @@ bool ScAddress::Move( SCCOL dx, SCROW dy, SCTAB dz, 
ScAddress& rErrorPos, const
     return bValid;
 }
 
-bool ScRange::Move( SCCOL dx, SCROW dy, SCTAB dz, ScRange& rErrorRange, const 
ScDocument* pDoc )
+bool ScRange::Move( SCCOL dx, SCROW dy, SCTAB dz, ScRange& rErrorRange, const 
ScDocument& rDoc )
 {
-    SCCOL nMaxCol = pDoc ? pDoc->MaxCol() : MAXCOL;
-    SCROW nMaxRow = pDoc ? pDoc->MaxRow() : MAXROW;
+    SCCOL nMaxCol = rDoc.MaxCol();
+    SCROW nMaxRow = rDoc.MaxRow();
     if (dy && aStart.Row() == 0 && aEnd.Row() == nMaxRow)
         dy = 0;     // Entire column not to be moved.
     if (dx && aStart.Col() == 0 && aEnd.Col() == nMaxCol)
         dx = 0;     // Entire row not to be moved.
-    bool b = aStart.Move( dx, dy, dz, rErrorRange.aStart, pDoc );
-    b &= aEnd.Move( dx, dy, dz, rErrorRange.aEnd, pDoc );
+    bool b = aStart.Move( dx, dy, dz, rErrorRange.aStart, rDoc );
+    b &= aEnd.Move( dx, dy, dz, rErrorRange.aEnd, rDoc );
     return b;
 }
 
@@ -2361,13 +2361,13 @@ bool ScRange::MoveSticky( const ScDocument& rDoc, SCCOL 
dx, SCROW dy, SCTAB dz,
         dy = 0;     // Entire column not to be moved.
     if (dx && aStart.Col() == 0 && aEnd.Col() == nMaxCol)
         dx = 0;     // Entire row not to be moved.
-    bool b1 = aStart.Move( dx, dy, dz, rErrorRange.aStart );
+    bool b1 = aStart.Move( dx, dy, dz, rErrorRange.aStart, rDoc );
     if (dx && bColRange && aEnd.Col() == nMaxCol)
         dx = 0;     // End column sticky.
     if (dy && bRowRange && aEnd.Row() == nMaxRow)
         dy = 0;     // End row sticky.
     SCTAB nOldTab = aEnd.Tab();
-    bool b2 = aEnd.Move( dx, dy, dz, rErrorRange.aEnd );
+    bool b2 = aEnd.Move( dx, dy, dz, rErrorRange.aEnd, rDoc );
     if (!b2)
     {
         // End column or row of a range may have become sticky.
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 33e99dc65eb4..59f9e04ac8d3 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3136,7 +3136,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnShift( 
const sc::RefUpdateCon
     if (bCellShifted)
     {
         ScAddress aErrorPos( ScAddress::UNINITIALIZED );
-        if (!aNewPos.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta, 
aErrorPos))
+        if (!aNewPos.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta, 
aErrorPos, rCxt.mrDoc))
         {
             assert(!"can't move");
         }
@@ -3183,7 +3183,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnShift( 
const sc::RefUpdateCon
                         if (rCxt.maRange.Contains(aAbs))
                         {
                             ScAddress aErrorPos( ScAddress::UNINITIALIZED );
-                            if (!aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, 
rCxt.mnTabDelta, aErrorPos))
+                            if (!aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, 
rCxt.mnTabDelta, aErrorPos, rCxt.mrDoc))
                                 aAbs = aErrorPos;
                             aRes.mbReferenceModified = true;
                         }
@@ -3370,7 +3370,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove(
     // to use the old range prior to the move for hit analysis.
     ScRange aOldRange = rCxt.maRange;
     ScRange aErrorMoveRange( ScAddress::UNINITIALIZED );
-    if (!aOldRange.Move(-rCxt.mnColDelta, -rCxt.mnRowDelta, -rCxt.mnTabDelta, 
aErrorMoveRange))
+    if (!aOldRange.Move(-rCxt.mnColDelta, -rCxt.mnRowDelta, -rCxt.mnTabDelta, 
aErrorMoveRange, rCxt.mrDoc))
     {
         assert(!"can't move");
     }
@@ -3404,7 +3404,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove(
                         if (aOldRange.Contains(aAbs))
                         {
                             ScAddress aErrorPos( ScAddress::UNINITIALIZED );
-                            if (!aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, 
rCxt.mnTabDelta, aErrorPos))
+                            if (!aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, 
rCxt.mnTabDelta, aErrorPos, rCxt.mrDoc))
                                 aAbs = aErrorPos;
                             aRes.mbReferenceModified = true;
                         }
@@ -3434,7 +3434,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove(
                         if (aOldRange.Contains(aAbs))
                         {
                             ScRange aErrorRange( ScAddress::UNINITIALIZED );
-                            if (!aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, 
rCxt.mnTabDelta, aErrorRange))
+                            if (!aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, 
rCxt.mnTabDelta, aErrorRange, rCxt.mrDoc))
                                 aAbs = aErrorRange;
                             aRes.mbReferenceModified = true;
                         }
@@ -4063,7 +4063,7 @@ sc::RefUpdateResult 
ScTokenArray::AdjustReferenceInMovedName( const sc::RefUpdat
     // When moving, the range is the destination range.
     ScRange aOldRange = rCxt.maRange;
     ScRange aErrorMoveRange( ScAddress::UNINITIALIZED );
-    if (!aOldRange.Move(-rCxt.mnColDelta, -rCxt.mnRowDelta, -rCxt.mnTabDelta, 
aErrorMoveRange))
+    if (!aOldRange.Move(-rCxt.mnColDelta, -rCxt.mnRowDelta, -rCxt.mnTabDelta, 
aErrorMoveRange, rCxt.mrDoc))
     {
         assert(!"can't move");
     }
@@ -4102,7 +4102,7 @@ sc::RefUpdateResult 
ScTokenArray::AdjustReferenceInMovedName( const sc::RefUpdat
                         if (aOldRange.Contains(aAbs))
                         {
                             ScAddress aErrorPos( ScAddress::UNINITIALIZED );
-                            if (!aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, 
rCxt.mnTabDelta, aErrorPos))
+                            if (!aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, 
rCxt.mnTabDelta, aErrorPos, rCxt.mrDoc))
                                 aAbs = aErrorPos;
                             aRes.mbReferenceModified = true;
                         }
@@ -4127,7 +4127,7 @@ sc::RefUpdateResult 
ScTokenArray::AdjustReferenceInMovedName( const sc::RefUpdat
                         if (aOldRange.Contains(aAbs))
                         {
                             ScRange aErrorRange( ScAddress::UNINITIALIZED );
-                            if (!aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, 
rCxt.mnTabDelta, aErrorRange))
+                            if (!aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, 
rCxt.mnTabDelta, aErrorRange, rCxt.mrDoc))
                                 aAbs = aErrorRange;
                             aRes.mbReferenceModified = true;
                         }
@@ -4716,7 +4716,7 @@ void checkBounds(
     {
         // Check bounds against the old range prior to the move.
         ScRange aErrorRange( ScAddress::UNINITIALIZED );
-        if (!aCheckRange.Move(-rCxt.mnColDelta, -rCxt.mnRowDelta, 
-rCxt.mnTabDelta, aErrorRange))
+        if (!aCheckRange.Move(-rCxt.mnColDelta, -rCxt.mnRowDelta, 
-rCxt.mnTabDelta, aErrorRange, rCxt.mrDoc))
         {
             assert(!"can't move");
         }
diff --git a/sc/source/filter/html/htmlimp.cxx 
b/sc/source/filter/html/htmlimp.cxx
index 57b92e0d5ef9..cb88c0c658ca 100644
--- a/sc/source/filter/html/htmlimp.cxx
+++ b/sc/source/filter/html/htmlimp.cxx
@@ -176,7 +176,7 @@ void ScHTMLImport::WriteToDocument(
     while( (pTable = pGlobTable->FindNestedTable( ++nTableId )) != nullptr )
     {
         pTable->GetDocRange( aNewRange );
-        if (!aNewRange.Move( nColDiff, nRowDiff, nTabDiff, aErrorRange ))
+        if (!aNewRange.Move( nColDiff, nRowDiff, nTabDiff, aErrorRange, *mpDoc 
))
         {
             assert(!"can't move");
         }
diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index dc1c8eed1388..af48b0b3e7e5 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1720,7 +1720,7 @@ public:
 
     /** Inserts a new table into the container. This container owns the 
created table.
         @param bPreFormText  true = New table is based on preformatted text 
(<pre> tag). */
-    ScHTMLTable*        CreateTable( const HtmlImportInfo& rInfo, bool 
bPreFormText );
+    ScHTMLTable*        CreateTable( const HtmlImportInfo& rInfo, bool 
bPreFormText, const ScDocument& rDoc );
 
 private:
     /** Sets a working table with its index for search optimization. */
@@ -1755,9 +1755,9 @@ ScHTMLTable* ScHTMLTableMap::FindTable( ScHTMLTableId 
nTableId, bool bDeep ) con
     return pResult;
 }
 
-ScHTMLTable* ScHTMLTableMap::CreateTable( const HtmlImportInfo& rInfo, bool 
bPreFormText )
+ScHTMLTable* ScHTMLTableMap::CreateTable( const HtmlImportInfo& rInfo, bool 
bPreFormText, const ScDocument& rDoc )
 {
-    ScHTMLTable* pTable = new ScHTMLTable( mrParentTable, rInfo, bPreFormText 
);
+    ScHTMLTable* pTable = new ScHTMLTable( mrParentTable, rInfo, bPreFormText, 
rDoc );
     maTables[ pTable->GetTableId() ].reset( pTable );
     SetCurrTable( pTable );
     return pTable;
@@ -1807,7 +1807,7 @@ ScHTMLTableAutoId::ScHTMLTableAutoId( ScHTMLTableId& 
rnUnusedId ) :
     ++mrnUnusedId;
 }
 
-ScHTMLTable::ScHTMLTable( ScHTMLTable& rParentTable, const HtmlImportInfo& 
rInfo, bool bPreFormText ) :
+ScHTMLTable::ScHTMLTable( ScHTMLTable& rParentTable, const HtmlImportInfo& 
rInfo, bool bPreFormText, const ScDocument& rDoc ) :
     mpParentTable( &rParentTable ),
     maTableId( rParentTable.maTableId.mrnUnusedId ),
     maTableItemSet( rParentTable.GetCurrItemSet() ),
@@ -1816,6 +1816,7 @@ ScHTMLTable::ScHTMLTable( ScHTMLTable& rParentTable, 
const HtmlImportInfo& rInfo
     mpCurrEntryVector( nullptr ),
     maSize( 1, 1 ),
     mpParser(rParentTable.mpParser),
+    mrDoc(rDoc),
     mbBorderOn( false ),
     mbPreFormText( bPreFormText ),
     mbRowOn( false ),
@@ -1854,7 +1855,7 @@ ScHTMLTable::ScHTMLTable(
     SfxItemPool& rPool,
     EditEngine& rEditEngine,
     std::vector<std::shared_ptr<ScEEParseEntry>>& rEEParseList,
-    ScHTMLTableId& rnUnusedId, ScHTMLParser* pParser
+    ScHTMLTableId& rnUnusedId, ScHTMLParser* pParser, const ScDocument& rDoc
 ) :
     mpParentTable( nullptr ),
     maTableId( rnUnusedId ),
@@ -1864,6 +1865,7 @@ ScHTMLTable::ScHTMLTable(
     mpCurrEntryVector( nullptr ),
     maSize( 1, 1 ),
     mpParser(pParser),
+    mrDoc(rDoc),
     mbBorderOn( false ),
     mbPreFormText( false ),
     mbRowOn( false ),
@@ -2229,7 +2231,7 @@ void ScHTMLTable::GetDocRange( ScRange& rRange ) const
     rRange.aStart = rRange.aEnd = maDocBasePos.MakeAddr();
     ScAddress aErrorPos( ScAddress::UNINITIALIZED );
     if (!rRange.aEnd.Move( static_cast< SCCOL >( GetDocSize( tdCol ) ) - 1,
-                static_cast< SCROW >( GetDocSize( tdRow ) ) - 1, 0, aErrorPos))
+                static_cast< SCROW >( GetDocSize( tdRow ) ) - 1, 0, aErrorPos, 
mrDoc ))
     {
         assert(!"can't move");
     }
@@ -2390,7 +2392,7 @@ ScHTMLTable* ScHTMLTable::InsertNestedTable( const 
HtmlImportInfo& rInfo, bool b
         mxNestedTables.reset( new ScHTMLTableMap( *this ) );
     if( bPreFormText )      // enclose new preformatted table with empty lines
         InsertLeadingEmptyLine();
-    return mxNestedTables->CreateTable( rInfo, bPreFormText );
+    return mxNestedTables->CreateTable( rInfo, bPreFormText, mrDoc );
 }
 
 void ScHTMLTable::InsertNewCell( const ScHTMLSize& rSpanSize )
@@ -2421,7 +2423,7 @@ void ScHTMLTable::InsertNewCell( const ScHTMLSize& 
rSpanSize )
     // insert the new range into the cell lists
     ScRange aNewRange( maCurrCell.MakeAddr() );
     ScAddress aErrorPos( ScAddress::UNINITIALIZED );
-    if (!aNewRange.aEnd.Move( rSpanSize.mnCols - 1, rSpanSize.mnRows - 1, 0, 
aErrorPos))
+    if (!aNewRange.aEnd.Move( rSpanSize.mnCols - 1, rSpanSize.mnRows - 1, 0, 
aErrorPos, mrDoc ))
     {
         assert(!"can't move");
     }
@@ -2746,9 +2748,10 @@ ScHTMLGlobalTable::ScHTMLGlobalTable(
     EditEngine& rEditEngine,
     std::vector<std::shared_ptr<ScEEParseEntry>>& rEEParseVector,
     ScHTMLTableId& rnUnusedId,
-    ScHTMLParser* pParser
+    ScHTMLParser* pParser,
+    const ScDocument& rDoc
 ) :
-    ScHTMLTable( rPool, rEditEngine, rEEParseVector, rnUnusedId, pParser )
+    ScHTMLTable( rPool, rEditEngine, rEEParseVector, rnUnusedId, pParser, rDoc 
)
 {
 }
 
@@ -2772,7 +2775,7 @@ ScHTMLQueryParser::ScHTMLQueryParser( EditEngine* 
pEditEngine, ScDocument* pDoc
     mbTitleOn( false )
 {
     mxGlobTable.reset(
-        new ScHTMLGlobalTable(*pPool, *pEdit, maList, mnUnusedId, this));
+        new ScHTMLGlobalTable(*pPool, *pEdit, maList, mnUnusedId, this, 
*pDoc));
     mpCurrTable = mxGlobTable.get();
 }
 
diff --git a/sc/source/filter/inc/htmlpars.hxx 
b/sc/source/filter/inc/htmlpars.hxx
index 11065dec9e88..47ecc57b416d 100644
--- a/sc/source/filter/inc/htmlpars.hxx
+++ b/sc/source/filter/inc/htmlpars.hxx
@@ -333,7 +333,8 @@ public:
     explicit            ScHTMLTable(
                             ScHTMLTable& rParentTable,
                             const HtmlImportInfo& rInfo,
-                            bool bPreFormText );
+                            bool bPreFormText,
+                            const ScDocument& rDoc );
 
     virtual             ~ScHTMLTable();
 
@@ -435,7 +436,8 @@ protected:
                             SfxItemPool& rPool,
                             EditEngine& rEditEngine,
                             std::vector<std::shared_ptr<ScEEParseEntry>>& 
rEEParseList,
-                            ScHTMLTableId& rnUnusedId, ScHTMLParser* pParser );
+                            ScHTMLTableId& rnUnusedId, ScHTMLParser* pParser,
+                            const ScDocument& rDoc );
 
     /** Fills all empty cells in this and nested tables with dummy parse 
entries. */
     void                FillEmptyCells();
@@ -542,6 +544,7 @@ private:
     ScHTMLPos           maCurrCell;         /// Address of current cell to 
fill.
     ScHTMLPos           maDocBasePos;       /// Resulting base address in a 
Calc document.
     ScHTMLParser*       mpParser;
+    const ScDocument&   mrDoc;
     bool                mbBorderOn:1;       /// true = Table borders on.
     bool                mbPreFormText:1;    /// true = Table from preformatted 
text (<pre> tag).
     bool                mbRowOn:1;          /// true = Inside of <tr> </tr>.
@@ -558,7 +561,8 @@ public:
                             SfxItemPool& rPool,
                             EditEngine& rEditEngine,
                             std::vector<std::shared_ptr<ScEEParseEntry>>& 
rEEParseList,
-                            ScHTMLTableId& rnUnusedId, ScHTMLParser* pParser );
+                            ScHTMLTableId& rnUnusedId, ScHTMLParser* pParser,
+                            const ScDocument& rDoc );
 
     virtual             ~ScHTMLGlobalTable() override;
 
diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index 8ce57f1f832f..dac09e465ae3 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1749,7 +1749,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const 
ScMarkData* pTabMark,
     if ( eCmd == INS_INSROWS_AFTER )
     {
         ScRange aErrorRange( ScAddress::UNINITIALIZED );
-        if (!aTargetRange.Move(0, rRange.aEnd.Row() - rRange.aStart.Row() + 1, 
0, aErrorRange))
+        if (!aTargetRange.Move(0, rRange.aEnd.Row() - rRange.aStart.Row() + 1, 
0, aErrorRange, rDoc))
         {
             return false;
         }
@@ -1757,7 +1757,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const 
ScMarkData* pTabMark,
     if ( eCmd == INS_INSCOLS_AFTER )
     {
         ScRange aErrorRange( ScAddress::UNINITIALIZED );
-        if (!aTargetRange.Move(rRange.aEnd.Col() - rRange.aStart.Col() + 1, 0, 
0, aErrorRange))
+        if (!aTargetRange.Move(rRange.aEnd.Col() - rRange.aStart.Col() + 1, 0, 
0, aErrorRange, rDoc))
         {
             return false;
         }
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 97e37f852542..1357a543659c 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4477,14 +4477,14 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* 
pTransObj, SCCOL nDestPos
                                  nDestPosX == aSource.aStart.Col() && 
nDestPosY < aSource.aStart.Row() )
                             {
                                 ScRange aErrorRange( ScAddress::UNINITIALIZED 
);
-                                bDone = aSource.Move( 0, nSizeY, 0, 
aErrorRange, pSourceDoc );
+                                bDone = aSource.Move( 0, nSizeY, 0, 
aErrorRange, *pSourceDoc );
                                 nCorrectCursorPosRow = nSizeY;
                             }
                             else if ( meDragInsertMode == INS_CELLSRIGHT &&
                                       nDestPosY == aSource.aStart.Row() && 
nDestPosX < aSource.aStart.Col() )
                             {
                                 ScRange aErrorRange( ScAddress::UNINITIALIZED 
);
-                                bDone = aSource.Move( nSizeX, 0, 0, 
aErrorRange, pSourceDoc );
+                                bDone = aSource.Move( nSizeX, 0, 0, 
aErrorRange, *pSourceDoc );
                                 nCorrectCursorPosCol = nSizeX;
                             }
                         }
@@ -4527,12 +4527,12 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* 
pTransObj, SCCOL nDestPos
                             if ( eCmd == DelCellCmd::CellsUp && nDestPosY > 
aSource.aEnd.Row() )
                             {
                                 ScRange aErrorRange( ScAddress::UNINITIALIZED 
);
-                                bDone = aDest.Move( 0, -nSizeY, 0, 
aErrorRange, &rThisDoc );
+                                bDone = aDest.Move( 0, -nSizeY, 0, 
aErrorRange, rThisDoc );
                             }
                             else if ( eCmd == DelCellCmd::CellsLeft && 
nDestPosX > aSource.aEnd.Col() )
                             {
                                 ScRange aErrorRange( ScAddress::UNINITIALIZED 
);
-                                bDone = aDest.Move( -nSizeX, 0, 0, 
aErrorRange, &rThisDoc );
+                                bDone = aDest.Move( -nSizeX, 0, 0, 
aErrorRange, rThisDoc );
                             }
                             pDocSh->UpdateOle(mrViewData);
                             pView->CellContentChanged();

Reply via email to