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 dfd115ac6a7ad5e1ef12909933ca658205680c49
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Dec 5 14:06:06 2023 +0100
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Dec 29 09:04:55 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
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160998
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 7604787a4f77..727828eb404e 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;
-
     std::unique_ptr<ScTableProtection> pTabProtection;
 
     std::unique_ptr<ScCompressedArray<SCCOL, sal_uInt16>> mpColWidth;
@@ -617,8 +611,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 5642654a0d2e..9dececb5be89 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>
 
@@ -5281,7 +5280,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 e3eeda745447..bb574ce3f3a4 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -244,10 +244,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 ),
     mpRowHeights( static_cast<ScFlatUInt16RowSegments*>(nullptr) ),
     mpHiddenCols(new ScFlatBoolColSegments(rDoc.MaxCol())),
     mpHiddenRows(new ScFlatBoolRowSegments(rDoc.MaxRow())),
@@ -514,15 +510,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;
@@ -566,10 +555,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 6ca01319a0b0..a4fc5f6d60de 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -3218,7 +3218,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)
 {
@@ -3245,10 +3245,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 );
         }
@@ -3270,8 +3266,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