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

Bartosz Kosiorek gang65 at poczta.onet.pl
Tue Mar 7 21:59:52 UTC 2017


 sc/inc/attarray.hxx              |    2 +-
 sc/inc/table.hxx                 |    3 ++-
 sc/source/core/data/attarray.cxx |   12 ++++++------
 sc/source/core/data/column.cxx   |    6 +++---
 sc/source/core/data/table1.cxx   |    2 +-
 sc/source/core/data/table2.cxx   |    6 +++---
 6 files changed, 16 insertions(+), 15 deletions(-)

New commits:
commit e1e2defb2cd9b572747b964e5ec97d289029af8c
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date:   Tue Feb 28 02:48:32 2017 +0100

    tdf#50916 Simplify and refactor source code
    
    Change-Id: Ibcb3068318180f2adfdc41aac5d75299c1ffaffc
    Reviewed-on: https://gerrit.libreoffice.org/34711
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>

diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 49626ea..a78d774 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -106,7 +106,7 @@ friend class ScHorizontalAttrIterator;
     ScAttrArray& operator=(const ScAttrArray&) = delete;
 
 public:
-            ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, ScAttrArray* pNextColAttrArray = nullptr, bool bCreateEmpty = false );
+            ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, ScAttrArray* pNextColAttrArray = nullptr );
             ~ScAttrArray();
 
     void    SetTab(SCTAB nNewTab)   { nTab = nNewTab; }
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 0358a76..12517c6 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -207,7 +207,8 @@ private:
     bool            mbPageBreaksValid:1;
     bool            mbForceBreaks:1;
 
-    ScAttrArray     aNextColAttrArray;
+    // Default attributes for the unallocated columns.
+    ScAttrArray     aDefaultColAttrArray;
 
 friend class ScDocument;                    // for FillInfo
 friend class ScColumn;
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index eb530ed..cfbb1c0 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -49,7 +49,7 @@
 
 using ::editeng::SvxBorderLine;
 
-ScAttrArray::ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, ScAttrArray* pNextColAttrArray, bool bCreateEmpty ) :
+ScAttrArray::ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, ScAttrArray* pDefaultColAttrArray ) :
     nCol( nNewCol ),
     nTab( nNewTab ),
     pDocument( pDoc ),
@@ -57,10 +57,10 @@ ScAttrArray::ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, ScAttr
     nLimit(0),
     pData(nullptr)
 {
-    if ( nCol != -1 && !bCreateEmpty && pNextColAttrArray )
+    if ( nCol != -1 && pDefaultColAttrArray )
     {
-        nCount = pNextColAttrArray->nCount;
-        nLimit = pNextColAttrArray->nCount;
+        nCount = pDefaultColAttrArray->nCount;
+        nLimit = pDefaultColAttrArray->nCount;
         if ( nCount )
         {
             bool bNumFormatChanged;
@@ -69,8 +69,8 @@ ScAttrArray::ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, ScAttr
             pData = new ScAttrEntry[nCount];
             for ( size_t nIdx = 0; nIdx < nCount; ++nIdx )
             {
-                pData[nIdx].nRow = pNextColAttrArray->pData[nIdx].nRow;
-                ScPatternAttr aNewPattern( *(pNextColAttrArray->pData[nIdx].pPattern) );
+                pData[nIdx].nRow = pDefaultColAttrArray->pData[nIdx].nRow;
+                ScPatternAttr aNewPattern( *(pDefaultColAttrArray->pData[nIdx].pPattern) );
                 pData[nIdx].pPattern = static_cast<const ScPatternAttr*>( &pDocument->GetPool()->Put( aNewPattern ) );
                 bNumFormatChanged = false;
                 if ( ScGlobal::CheckWidthInvalidate( bNumFormatChanged,
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index af35e8c..bb8d378 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -108,10 +108,10 @@ void ScColumn::Init(SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, bool bEmptyA
     nCol = nNewCol;
     nTab = nNewTab;
     pDocument = pDoc;
-    if ( !bEmptyAttrArray )
-        pAttrArray = new ScAttrArray( nCol, nTab, pDocument, &pDocument->maTabs[nTab]->aNextColAttrArray, bEmptyAttrArray );
+    if ( bEmptyAttrArray )
+        pAttrArray = new ScAttrArray( nCol, nTab, pDocument, nullptr );
     else
-        pAttrArray = new ScAttrArray( nCol, nTab, pDocument, nullptr, true );
+        pAttrArray = new ScAttrArray( nCol, nTab, pDocument, &pDocument->maTabs[nTab]->aDefaultColAttrArray );
 }
 
 SCsROW ScColumn::GetNextUnprotected( SCROW nRow, bool bUp ) const
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index b2ff54d..8eb4648 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -288,7 +288,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName,
     bActiveScenario(false),
     mbPageBreaksValid(false),
     mbForceBreaks(false),
-    aNextColAttrArray(static_cast<SCCOL>(-1), nNewTab, pDoc, nullptr, true)
+    aDefaultColAttrArray(static_cast<SCCOL>(-1), nNewTab, pDoc, nullptr)
 {
 
     if (bColInfo)
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index ae86b15..7d7ed84 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2527,12 +2527,12 @@ void ScTable::ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, S
                 nEndCol = aCol.size() - 1;
                 for (SCCOL i = nStartCol; i <= nEndCol; i++)
                     aCol[i].ApplyStyleArea(nStartRow, nEndRow, rStyle);
-                aNextColAttrArray.ApplyStyleArea(nStartRow, nEndRow, const_cast<ScStyleSheet*>( &rStyle ) );
+                aDefaultColAttrArray.ApplyStyleArea(nStartRow, nEndRow, const_cast<ScStyleSheet*>( &rStyle ) );
             }
             else
             {
                 CreateColumnIfNotExists( nStartCol - 1 );
-                aNextColAttrArray.ApplyStyleArea(nStartRow, nEndRow, const_cast<ScStyleSheet*>( &rStyle ) );
+                aDefaultColAttrArray.ApplyStyleArea(nStartRow, nEndRow, const_cast<ScStyleSheet*>( &rStyle ) );
             }
         }
         else
@@ -2567,7 +2567,7 @@ const ScStyleSheet* ScTable::GetStyle( SCCOL nCol, SCROW nRow ) const
     if ( nCol < aCol.size() )
         return aCol[nCol].GetStyle( nRow );
     else
-        return aNextColAttrArray.GetPattern( nRow )->GetStyleSheet();
+        return aDefaultColAttrArray.GetPattern( nRow )->GetStyleSheet();
 }
 
 const ScStyleSheet* ScTable::GetSelectionStyle( const ScMarkData& rMark, bool& rFound ) const


More information about the Libreoffice-commits mailing list