sc/inc/table.hxx               |    9 +--------
 sc/qa/unit/ucalc.cxx           |    2 --
 sc/source/core/data/table1.cxx |   19 +++----------------
 sc/source/ui/unoobj/docuno.cxx |    9 ++-------
 4 files changed, 6 insertions(+), 33 deletions(-)

New commits:
commit 08009002625ec20788d0c6d55aaa32aeac416753
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Dec 5 14:06:06 2023 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Dec 19 18:54:17 2023 +0100

    tdf#154339: do not cache GetCellArea results for now
    
    Partially revert 0a55aa8ba38aea56a2bce1504fd687e510f66b9d
    "calc: cache GetCellArea results"
    
    Change-Id: I371a56f64afe541d9a194e6435fda3fb27bc43ce
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160349
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit 01473b85a218b303a5674c4c3c24177c938d4e69)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160946

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 3bf61e701c16..78fdbc6fabdf 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -180,12 +180,6 @@ private:
     SCROW           nRepeatStartY;
     SCROW           nRepeatEndY;
 
-    // last used col and row
-    bool            mbCellAreaDirty;
-    bool            mbCellAreaEmpty;
-    SCCOL           mnEndCol;
-    SCROW           mnEndRow;
-
     // Standard row height for this sheet - benefits XLSX because default 
height defined per sheet
     sal_uInt16 mnOptimalMinRowHeight; // in Twips
 
@@ -625,8 +619,7 @@ public:
     void        InvalidateTableArea();
     void        InvalidatePageBreaks();
 
-    void        InvalidateCellArea() { mbCellAreaDirty = true; }
-    bool        GetCellArea( SCCOL& rEndCol, SCROW& rEndRow );            // 
FALSE = empty
+    bool        GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const;           
 // FALSE = empty
     bool        GetTableArea( SCCOL& rEndCol, SCROW& rEndRow, bool 
bCalcHiddens = false) const;
     bool        GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes, 
bool bCalcHiddens = false) const;
     bool        GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow,
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index a3e2d2ddd567..c75742eabdfc 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -43,7 +43,6 @@
 #include <columnspanset.hxx>
 
 #include <editable.hxx>
-#include <table.hxx>
 #include <tabprotection.hxx>
 #include <undomanager.hxx>
 
@@ -5298,7 +5297,6 @@ CPPUNIT_TEST_FIXTURE(Test, testAreasWithNotes)
 
     m_pDoc->SetString(0, 3, 0, "Some Text");
     m_pDoc->SetString(3, 3, 0, "Some Text");
-    m_pDoc->FetchTable(0)->InvalidateCellArea();
 
     dataFound = m_pDoc->GetDataStart(0,col,row);
 
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index c9002d096854..93d023f96246 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -247,10 +247,6 @@ ScTable::ScTable( ScDocument& rDoc, SCTAB nNewTab, const 
OUString& rNewName,
     nRepeatEndX( SCCOL_REPEAT_NONE ),
     nRepeatStartY( SCROW_REPEAT_NONE ),
     nRepeatEndY( SCROW_REPEAT_NONE ),
-    mbCellAreaDirty( true ),
-    mbCellAreaEmpty( true ),
-    mnEndCol( -1 ),
-    mnEndRow( -1 ),
     mnOptimalMinRowHeight(0),
     mpRowHeights( static_cast<ScFlatUInt16RowSegments*>(nullptr) ),
     mpHiddenCols(new ScFlatBoolColSegments(rDoc.MaxCol())),
@@ -519,15 +515,8 @@ void ScTable::SetOptimalHeightOnly(
         delete pProgress;
 }
 
-bool ScTable::GetCellArea( SCCOL& rEndCol, SCROW& rEndRow )
+bool ScTable::GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const
 {
-    if (!mbCellAreaDirty)
-    {
-        rEndCol = mnEndCol;
-        rEndRow = mnEndRow;
-        return !mbCellAreaEmpty;
-    }
-
     bool bFound = false;
     SCCOL nMaxX = 0;
     SCROW nMaxY = 0;
@@ -571,10 +560,8 @@ bool ScTable::GetCellArea( SCCOL& rEndCol, SCROW& rEndRow )
             }
     }
 
-    mnEndCol = rEndCol = nMaxX;
-    mnEndRow = rEndRow = nMaxY;
-    mbCellAreaEmpty = !bFound;
-    mbCellAreaDirty = false;
+    rEndCol = nMaxX;
+    rEndRow = nMaxY;
     return bFound;
 }
 
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 85c179373788..c906f39336f5 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -3266,7 +3266,7 @@ bool ScModelObj::HasChangesListeners() const
 namespace
 {
 
-void lcl_dataAreaInvalidation(ScDocument& rDocument, ScModelObj* pModel,
+void lcl_dataAreaInvalidation(ScModelObj* pModel,
                               const ScRangeList& rRanges,
                               bool bInvalidateDataArea, bool bExtendDataArea)
 {
@@ -3293,10 +3293,6 @@ void lcl_dataAreaInvalidation(ScDocument& rDocument, 
ScModelObj* pModel,
         bool bInvalidate = bAreaExtended || bInvalidateDataArea;
         if ( bInvalidate )
         {
-            ScTable* pTab = rDocument.FetchTable( nTab );
-            if ( pTab )
-                pTab->InvalidateCellArea();
-
             if ( comphelper::LibreOfficeKit::isActive() )
                 SfxLokHelper::notifyPartSizeChangedAllViews( pModel, nTab );
         }
@@ -3318,8 +3314,7 @@ void ScModelObj::NotifyChanges( const OUString& 
rOperation, const ScRangeList& r
 
     if ( pDocShell )
     {
-        ScDocument& rDocument = pDocShell->GetDocument();
-        lcl_dataAreaInvalidation(rDocument, this, rRanges, 
bInvalidateDataArea, bExtendDataArea);
+        lcl_dataAreaInvalidation(this, rRanges, bInvalidateDataArea, 
bExtendDataArea);
 
         // check if we were called only to update data area
         if (bIsDataAreaInvalidateType || bIsDataAreaExtendType)

Reply via email to