[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-1' - sc/inc sc/qa sc/source

Gabor Kelemen (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 16 09:43:06 UTC 2021


 dev/null                         |binary
 sc/inc/document.hxx              |    5 +---
 sc/inc/table.hxx                 |    7 +----
 sc/qa/unit/bugfix-test.cxx       |   19 ---------------
 sc/source/core/data/documen2.cxx |    4 +--
 sc/source/core/data/document.cxx |    4 +--
 sc/source/core/data/table1.cxx   |   47 ++++++++++-----------------------------
 sc/source/ui/unoobj/cursuno.cxx  |    2 -
 8 files changed, 22 insertions(+), 66 deletions(-)

New commits:
commit 2cce94aa1b1e54afe9e1cbb42b218799903b46c3
Author:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
AuthorDate: Mon Aug 16 11:16:16 2021 +0200
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Mon Aug 16 11:42:21 2021 +0200

    Revert "tdf#104502 sc: skip hidden columns at printing pages"
    
    This reverts commit 30eaa0b7e316129ece585a57460540a6e63e670a.
    
    Reason for revert: Causes data loss (tdf#143986)
    
    Change-Id: Iadfe8dba19be8de5d69973ca96784fafc6ef1818
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120442
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 51130b2fe7cb..3a61417b2c10 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1456,10 +1456,9 @@ public:
     bool                        GetDataAreaSubrange(ScRange& rRange) const;
 
     SC_DLLPUBLIC bool           GetCellArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const;
-    SC_DLLPUBLIC bool           GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow,
-                                              bool bCalcHiddens = false) const;
+    SC_DLLPUBLIC bool           GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const;
     SC_DLLPUBLIC bool           GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow,
-                                              bool bNotes = true, bool bCalcHiddens = false) const;
+                                              bool bNotes = true ) const;
     SC_DLLPUBLIC bool           GetPrintAreaHor( SCTAB nTab, SCROW nStartRow, SCROW nEndRow,
                                                  SCCOL& rEndCol ) const;
     SC_DLLPUBLIC bool           GetPrintAreaVer( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol,
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 519fb6c860ef..a2cf2fe81268 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -198,8 +198,6 @@ private:
 
     mutable SCCOL nTableAreaX;
     mutable SCROW nTableAreaY;
-    mutable SCCOL nTableAreaVisibleX;
-    mutable SCROW nTableAreaVisibleY;
 
     SCTAB           nTab;
     ScDocument&     rDocument;
@@ -234,7 +232,6 @@ private:
     bool            bLoadingRTL:1;
     bool            bPageSizeValid:1;
     mutable bool    bTableAreaValid:1;
-    mutable bool    bTableAreaVisibleValid:1;
     bool            bVisible:1;
     bool            bStreamValid:1;
     bool            bPendingRowHeights:1;
@@ -570,8 +567,8 @@ public:
     void        InvalidatePageBreaks();
 
     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        GetTableArea( SCCOL& rEndCol, SCROW& rEndRow ) const;
+    bool        GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes ) const;
     bool        GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow,
                                 SCCOL& rEndCol ) const;
     bool        GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx
index 88b48326505e..be2a00a94e76 100644
--- a/sc/qa/unit/bugfix-test.cxx
+++ b/sc/qa/unit/bugfix-test.cxx
@@ -58,7 +58,6 @@ public:
     void testTdf128951();
     void testTdf129789();
     void testTdf130725();
-    void testTdf104502_hiddenColsCountedInPageCount();
 
     CPPUNIT_TEST_SUITE(ScFiltersTest);
     CPPUNIT_TEST(testTdf137576_Measureline);
@@ -81,7 +80,6 @@ public:
     CPPUNIT_TEST(testTdf128951);
     CPPUNIT_TEST(testTdf129789);
     CPPUNIT_TEST(testTdf130725);
-    CPPUNIT_TEST(testTdf104502_hiddenColsCountedInPageCount);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -718,23 +716,6 @@ void ScFiltersTest::testTdf130725()
         0.0042, xCell->getValue()); // strict equality
 }
 
-void ScFiltersTest::testTdf104502_hiddenColsCountedInPageCount()
-{
-    ScDocShellRef xShell = loadDoc(u"tdf104502_hiddenColsCountedInPageCount.", FORMAT_ODS);
-    CPPUNIT_ASSERT(xShell.is());
-
-    ScDocument& rDoc = xShell->GetDocument();
-
-    //Check that hidden columns are not calculated into Print Area
-    SCCOL nEndCol = 0;
-    SCROW nEndRow = 0;
-    CPPUNIT_ASSERT(rDoc.GetPrintArea(0, nEndCol, nEndRow, false));
-    CPPUNIT_ASSERT_EQUAL(SCCOL(0), nEndCol);
-    CPPUNIT_ASSERT_EQUAL(SCROW(55), nEndRow);
-
-    xShell->DoClose();
-}
-
 ScFiltersTest::ScFiltersTest()
       : ScBootstrapFixture( "sc/qa/unit/data" )
 {
diff --git a/sc/qa/unit/data/ods/tdf104502_hiddenColsCountedInPageCount.ods b/sc/qa/unit/data/ods/tdf104502_hiddenColsCountedInPageCount.ods
deleted file mode 100644
index 166b86b2e8c1..000000000000
Binary files a/sc/qa/unit/data/ods/tdf104502_hiddenColsCountedInPageCount.ods and /dev/null differ
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 5a624e8fe24a..be95822d89ba 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -571,11 +571,11 @@ const svl::SharedStringPool& ScDocument::GetSharedStringPool() const
 }
 
 bool ScDocument::GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow,
-                                bool bNotes, bool bCalcHiddens) const
+                                bool bNotes ) const
 {
     if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
     {
-        bool bAny = maTabs[nTab]->GetPrintArea( rEndCol, rEndRow, bNotes, bCalcHiddens);
+        bool bAny = maTabs[nTab]->GetPrintArea( rEndCol, rEndRow, bNotes );
         if (mpDrawLayer)
         {
             ScRange aDrawRange(0,0,nTab, MaxCol(),MaxRow(),nTab);
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index a2eead753ae3..b3cac25303af 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -1018,11 +1018,11 @@ bool ScDocument::GetCellArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const
     return false;
 }
 
-bool ScDocument::GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow, bool bCalcHiddens) const
+bool ScDocument::GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const
 {
     if (ValidTab(nTab) && nTab < static_cast<SCTAB> (maTabs.size()))
         if (maTabs[nTab])
-            return maTabs[nTab]->GetTableArea( rEndCol, rEndRow, bCalcHiddens);
+            return maTabs[nTab]->GetTableArea( rEndCol, rEndRow );
 
     rEndCol = 0;
     rEndRow = 0;
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 8b4a6e1344da..11ac1f1d3e83 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -248,8 +248,6 @@ ScTable::ScTable( ScDocument& rDoc, SCTAB nNewTab, const OUString& rNewName,
     mpFilteredRows(new ScFlatBoolRowSegments(rDoc.MaxRow())),
     nTableAreaX( 0 ),
     nTableAreaY( 0 ),
-    nTableAreaVisibleX( 0 ),
-    nTableAreaVisibleY( 0 ),
     nTab( nNewTab ),
     rDocument( rDoc ),
     pSortCollator( nullptr ),
@@ -542,35 +540,22 @@ bool ScTable::GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const
     return bFound;
 }
 
-bool ScTable::GetTableArea( SCCOL& rEndCol, SCROW& rEndRow, bool bCalcHiddens) const
+bool ScTable::GetTableArea( SCCOL& rEndCol, SCROW& rEndRow ) const
 {
     bool bRet = true;               //TODO: remember?
-    if (bCalcHiddens)
+    if (!bTableAreaValid)
     {
-        if (!bTableAreaValid)
-        {
-            bRet = GetPrintArea(nTableAreaX, nTableAreaY, true, bCalcHiddens);
-            bTableAreaValid = true;
-        }
-        rEndCol = nTableAreaX;
-        rEndRow = nTableAreaY;
-    }
-    else
-    {
-        if (!bTableAreaVisibleValid)
-        {
-            bRet = GetPrintArea(nTableAreaVisibleX, nTableAreaVisibleY, true, bCalcHiddens);
-            bTableAreaVisibleValid = true;
-        }
-        rEndCol = nTableAreaVisibleX;
-        rEndRow = nTableAreaVisibleY;
+        bRet = GetPrintArea(nTableAreaX, nTableAreaY, true);
+        bTableAreaValid = true;
     }
+    rEndCol = nTableAreaX;
+    rEndRow = nTableAreaY;
     return bRet;
 }
 
 const SCCOL SC_COLUMNS_STOP = 30;
 
-bool ScTable::GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes, bool bCalcHiddens ) const
+bool ScTable::GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes ) const
 {
     bool bFound = false;
     SCCOL nMaxX = 0;
@@ -578,8 +563,6 @@ bool ScTable::GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes, bool bC
     SCCOL i;
 
     for (i=0; i<aCol.size(); i++)               // Test data
-    {
-        if (bCalcHiddens || !rDocument.ColHidden(i, nTab))
         {
             if (!aCol[i].IsEmptyData())
             {
@@ -605,22 +588,18 @@ bool ScTable::GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes, bool bC
                 }
             }
         }
-    }
 
     SCCOL nMaxDataX = nMaxX;
 
     for (i=0; i<aCol.size(); i++)               // Test attribute
     {
-        if (bCalcHiddens || !rDocument.ColHidden(i, nTab))
+        SCROW nLastRow;
+        if (aCol[i].GetLastVisibleAttr( nLastRow ))
         {
-            SCROW nLastRow;
-            if (aCol[i].GetLastVisibleAttr( nLastRow ))
-            {
-                bFound = true;
-                nMaxX = i;
-                if (nLastRow > nMaxY)
-                    nMaxY = nLastRow;
-            }
+            bFound = true;
+            nMaxX = i;
+            if (nLastRow > nMaxY)
+                nMaxY = nLastRow;
         }
     }
 
diff --git a/sc/source/ui/unoobj/cursuno.cxx b/sc/source/ui/unoobj/cursuno.cxx
index 7928fceb0dbb..a301be0ae24f 100644
--- a/sc/source/ui/unoobj/cursuno.cxx
+++ b/sc/source/ui/unoobj/cursuno.cxx
@@ -257,7 +257,7 @@ void SAL_CALL ScCellCursorObj::gotoEndOfUsedArea( sal_Bool bExpand )
 
     SCCOL nUsedX = 0;       // fetch the end
     SCROW nUsedY = 0;
-    if (!pDocSh->GetDocument().GetTableArea( nTab, nUsedX, nUsedY, true ))
+    if (!pDocSh->GetDocument().GetTableArea( nTab, nUsedX, nUsedY ))
     {
         nUsedX = 0;
         nUsedY = 0;


More information about the Libreoffice-commits mailing list