[Libreoffice-commits] core.git: sc/inc sc/source

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 9 11:26:37 UTC 2019


 sc/inc/document.hxx                   |    4 ++++
 sc/source/core/data/attarray.cxx      |    8 ++++----
 sc/source/core/data/autonamecache.cxx |    2 +-
 sc/source/core/data/bigrange.cxx      |    4 ++--
 sc/source/core/data/colorscale.cxx    |    4 ++--
 sc/source/core/data/documen2.cxx      |    2 ++
 6 files changed, 15 insertions(+), 9 deletions(-)

New commits:
commit 63dedfbfedff5c8e2b0b242b8b6af7ba30b665e4
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Tue Oct 8 09:49:19 2019 +0100
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Wed Oct 9 13:25:15 2019 +0200

    sc: rowcol: store sheet maximum sizes in ScDocument.
    
    For now, hard coded to MAXCOL, MAXROW while we re-factor.
    
    Change-Id: I5e1aafc91ba1434a9a248d33bf0da4f4a2dc3a1b
    Reviewed-on: https://gerrit.libreoffice.org/80434
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 2b2ae8d99c0c..9e19ad228a36 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -370,6 +370,8 @@ private:
     std::unique_ptr<ScValidationDataList> pValidationList;              // validity
     SvNumberFormatterIndexTable* pFormatExchangeList;    // for application of number formats
     TableContainer maTabs;
+    SCCOL mnMaxCol; /// Maximum addressable column
+    SCROW mnMaxRow; /// Maximum addressable row
     std::vector<OUString> maTabNames;               // for undo document, we need the information tab name <-> index
     mutable std::unique_ptr<ScRangeName>    pRangeName;
     std::unique_ptr<ScDBCollection>         pDBCollection;
@@ -853,6 +855,8 @@ public:
     SC_DLLPUBLIC bool GetCodeName( SCTAB nTab, OUString& rName ) const;
     SC_DLLPUBLIC bool SetCodeName( SCTAB nTab, const OUString& rName );
     SC_DLLPUBLIC bool GetTable( const OUString& rName, SCTAB& rTab ) const;
+    SC_DLLPUBLIC SCCOL MaxCol() const { return mnMaxCol; }
+    SC_DLLPUBLIC SCROW MaxRow() const { return mnMaxRow; }
 
     SC_DLLPUBLIC std::vector<OUString> GetAllTableNames() const;
 
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 060436585d08..db708eb4e522 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1446,8 +1446,8 @@ bool ScAttrArray::IsMerged( SCROW nRow ) const
  * Area around any given summaries expand and adapt any MergeFlag (bRefresh)
  */
 bool ScAttrArray::ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
-                                SCCOL& rPaintCol, SCROW& rPaintRow,
-                                bool bRefresh )
+                               SCCOL& rPaintCol, SCROW& rPaintRow,
+                               bool bRefresh )
 {
     assert( nCol != -1 );
     SetDefaultIfNotInit();
@@ -1470,9 +1470,9 @@ bool ScAttrArray::ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
             SCROW nThisRow = (i>0) ? mvData[i-1].nEndRow+1 : 0;
             SCCOL nMergeEndCol = nThisCol + nCountX - 1;
             SCROW nMergeEndRow = nThisRow + nCountY - 1;
-            if (nMergeEndCol > rPaintCol && nMergeEndCol <= MAXCOL)
+            if (nMergeEndCol > rPaintCol && nMergeEndCol <= pDocument->MaxCol())
                 rPaintCol = nMergeEndCol;
-            if (nMergeEndRow > rPaintRow && nMergeEndRow <= MAXROW)
+            if (nMergeEndRow > rPaintRow && nMergeEndRow <= pDocument->MaxRow())
                 rPaintRow = nMergeEndRow;
             bFound = true;
 
diff --git a/sc/source/core/data/autonamecache.cxx b/sc/source/core/data/autonamecache.cxx
index 15e924d9fd3d..bd30352f1d1f 100644
--- a/sc/source/core/data/autonamecache.cxx
+++ b/sc/source/core/data/autonamecache.cxx
@@ -49,7 +49,7 @@ const ScAutoNameAddresses& ScAutoNameCache::GetNameOccurrences( const OUString&
 
     ScAutoNameAddresses& rAddresses = aNames[rName];
 
-    ScCellIterator aIter( pDoc, ScRange( 0, 0, nCurrentTab, MAXCOL, MAXROW, nCurrentTab ) );
+    ScCellIterator aIter( pDoc, ScRange( 0, 0, nCurrentTab, pDoc->MaxCol(), pDoc->MaxRow(), nCurrentTab ) );
     for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
     {
         // don't check code length here, always use the stored result
diff --git a/sc/source/core/data/bigrange.cxx b/sc/source/core/data/bigrange.cxx
index c0cd753f5f4a..14cc64556309 100644
--- a/sc/source/core/data/bigrange.cxx
+++ b/sc/source/core/data/bigrange.cxx
@@ -13,9 +13,9 @@
 bool ScBigAddress::IsValid( const ScDocument* pDoc ) const
 {   // min/max interval bounds define whole col/row/tab
     return
-        ((0 <= nCol && nCol <= MAXCOL)
+        ((0 <= nCol && nCol <= pDoc->MaxCol())
             || nCol == nInt32Min || nCol == nInt32Max) &&
-        ((0 <= nRow && nRow <= MAXROW)
+        ((0 <= nRow && nRow <= pDoc->MaxRow())
             || nRow == nInt32Min || nRow == nInt32Max) &&
         ((0 <= nTab && nTab < pDoc->GetTableCount())
             || nTab == nInt32Min || nTab == nInt32Max)
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 3fa03b5b6988..64c0d990c147 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -78,11 +78,11 @@ void ScFormulaListener::startListening(const ScTokenArray* pArr, const ScRange&
                     {   // automagically
                         if ( rRef1.IsColRel() )
                         {   // ColName
-                            aRange1.aEnd.SetRow(MAXROW);
+                            aRange1.aEnd.SetRow(mpDoc->MaxRow());
                         }
                         else
                         {   // RowName
-                            aRange1.aEnd.SetCol(MAXCOL);
+                            aRange1.aEnd.SetCol(mpDoc->MaxCol());
                         }
                     }
                     mpDoc->StartListeningArea(aRange1, false, this);
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index b87d73a8da56..d831e2b58d9f 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -98,6 +98,8 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
         mpPrinter( nullptr ),
         mpVirtualDevice_100th_mm( nullptr ),
         pFormatExchangeList( nullptr ),
+        mnMaxCol(MAXCOL),
+        mnMaxRow(MAXROW),
         pFormulaTree( nullptr ),
         pEOFormulaTree( nullptr ),
         pFormulaTrack( nullptr ),


More information about the Libreoffice-commits mailing list