[Libreoffice-commits] core.git: Branch 'feature/perfwork5' - 3 commits - sc/inc sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Tue Nov 18 08:50:39 PST 2014


 sc/inc/column.hxx                     |    4 ++--
 sc/inc/columnspanset.hxx              |    3 +++
 sc/source/core/data/column3.cxx       |   16 ++++++++--------
 sc/source/core/data/column4.cxx       |    6 +-----
 sc/source/core/data/columnspanset.cxx |    9 +++++++++
 sc/source/core/data/table4.cxx        |    2 +-
 6 files changed, 24 insertions(+), 16 deletions(-)

New commits:
commit 283483ae5b78c06a6b8b6a9521500be500d43354
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Nov 18 11:34:21 2014 -0500

    Let's not re-use the same iterator esp when it's still iterating.
    
    Change-Id: I1752857bc036f8d389b4b71d570cf83a76ef29ea

diff --git a/sc/inc/columnspanset.hxx b/sc/inc/columnspanset.hxx
index 48ae7c1..63e8c90 100644
--- a/sc/inc/columnspanset.hxx
+++ b/sc/inc/columnspanset.hxx
@@ -25,6 +25,7 @@ class ScRangeList;
 namespace sc {
 
 struct ColumnBlockConstPosition;
+class SingleColumnSpanSet;
 
 struct RowSpan
 {
@@ -92,6 +93,8 @@ public:
     void set(SCTAB nTab, SCCOL nCol, SCROW nRow1, SCROW nRow2, bool bVal);
     void set(const ScRange& rRange, bool bVal);
 
+    void set( SCTAB nTab, SCCOL nCol, const SingleColumnSpanSet& rSingleSet, bool bVal );
+
     /**
      * Scan specified range in a specified sheet and mark all non-empty cells
      * with specified boolean value.
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 2316a26..b0d1d50 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -110,11 +110,7 @@ void ScColumn::DeleteBeforeCopyFromClip(
         {
             sc::SingleColumnSpanSet aDeletedRows;
             DeleteCells(aBlockPos, nRow1, nRow2, nDelFlag, aDeletedRows);
-            aDeletedRows.getSpans(aSpans);
-            it = aSpans.begin();
-            itEnd = aSpans.end();
-            for (; it != itEnd; ++it)
-                rBroadcastSpans.set(nTab, nCol, it->mnRow1, it->mnRow2, true);
+            rBroadcastSpans.set(nTab, nCol, aDeletedRows, true);
         }
 
         if (nDelFlag & IDF_NOTE)
diff --git a/sc/source/core/data/columnspanset.cxx b/sc/source/core/data/columnspanset.cxx
index fe10528..6132906 100644
--- a/sc/source/core/data/columnspanset.cxx
+++ b/sc/source/core/data/columnspanset.cxx
@@ -120,6 +120,15 @@ void ColumnSpanSet::set(const ScRange& rRange, bool bVal)
     }
 }
 
+void ColumnSpanSet::set( SCTAB nTab, SCCOL nCol, const SingleColumnSpanSet& rSingleSet, bool bVal )
+{
+    SingleColumnSpanSet::SpansType aSpans;
+    rSingleSet.getSpans(aSpans);
+    SingleColumnSpanSet::SpansType::const_iterator it = aSpans.begin(), itEnd = aSpans.end();
+    for (; it != itEnd; ++it)
+        set(nTab, nCol, it->mnRow1, it->mnRow2, bVal);
+}
+
 void ColumnSpanSet::scan(
     const ScDocument& rDoc, SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bVal)
 {
commit 756d4765104dfab1a49dde07d5425774feda54ed
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Nov 18 10:26:27 2014 -0500

    Rename Activate... -> Attach...
    
    Attach is the new one we are going with & offers nice contrast with
    'Detach...'.
    
    Change-Id: I4578f4c7b9d989e41d433d7c8aa96a9317aa6919

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index f268c5c..440a95b 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -628,8 +628,8 @@ private:
 
     sc::CellStoreType::iterator GetPositionToInsert( SCROW nRow );
     sc::CellStoreType::iterator GetPositionToInsert( const sc::CellStoreType::iterator& it, SCROW nRow );
-    void ActivateNewFormulaCell( const sc::CellStoreType::iterator& itPos, SCROW nRow, ScFormulaCell& rCell, bool bJoin = true );
-    void ActivateNewFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell, bool bJoin = true );
+    void AttachNewFormulaCell( const sc::CellStoreType::iterator& itPos, SCROW nRow, ScFormulaCell& rCell, bool bJoin = true );
+    void AttachNewFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell, bool bJoin = true );
     void AttachNewFormulaCells( const sc::CellStoreType::position_type& aPos, size_t nLength );
     void BroadcastNewCell( SCROW nRow );
     bool UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, const sc::CellStoreType::iterator& itr );
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 97af751..ec0dd45 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -374,13 +374,13 @@ sc::CellStoreType::iterator ScColumn::GetPositionToInsert( const sc::CellStoreTy
     return itRet;
 }
 
-void ScColumn::ActivateNewFormulaCell(
+void ScColumn::AttachNewFormulaCell(
     const sc::CellStoreType::iterator& itPos, SCROW nRow, ScFormulaCell& rCell, bool bJoin )
 {
-    ActivateNewFormulaCell(maCells.position(itPos, nRow), rCell, bJoin);
+    AttachNewFormulaCell(maCells.position(itPos, nRow), rCell, bJoin);
 }
 
-void ScColumn::ActivateNewFormulaCell(
+void ScColumn::AttachNewFormulaCell(
     const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell, bool bJoin )
 {
     if (bJoin)
@@ -1817,7 +1817,7 @@ void ScColumn::SetFormula( SCROW nRow, const ScTokenArray& rArray, formula::Form
 
     CellStorageModified();
 
-    ActivateNewFormulaCell(it, nRow, *pCell);
+    AttachNewFormulaCell(it, nRow, *pCell);
 }
 
 void ScColumn::SetFormula( SCROW nRow, const OUString& rFormula, formula::FormulaGrammar::Grammar eGram )
@@ -1834,7 +1834,7 @@ void ScColumn::SetFormula( SCROW nRow, const OUString& rFormula, formula::Formul
 
     CellStorageModified();
 
-    ActivateNewFormulaCell(it, nRow, *pCell);
+    AttachNewFormulaCell(it, nRow, *pCell);
 }
 
 ScFormulaCell* ScColumn::SetFormulaCell( SCROW nRow, ScFormulaCell* pCell )
@@ -1848,7 +1848,7 @@ ScFormulaCell* ScColumn::SetFormulaCell( SCROW nRow, ScFormulaCell* pCell )
 
     CellStorageModified();
 
-    ActivateNewFormulaCell(it, nRow, *pCell);
+    AttachNewFormulaCell(it, nRow, *pCell);
     return pCell;
 }
 
@@ -1864,7 +1864,7 @@ ScFormulaCell* ScColumn::SetFormulaCell( sc::ColumnBlockPosition& rBlockPos, SCR
 
     CellStorageModified();
 
-    ActivateNewFormulaCell(rBlockPos.miCellPos, nRow, *pCell);
+    AttachNewFormulaCell(rBlockPos.miCellPos, nRow, *pCell);
     return pCell;
 }
 
@@ -2324,7 +2324,7 @@ void ScColumn::SetError( SCROW nRow, const sal_uInt16 nError)
 
     CellStorageModified();
 
-    ActivateNewFormulaCell(it, nRow, *pCell);
+    AttachNewFormulaCell(it, nRow, *pCell);
 }
 
 void ScColumn::SetRawString( SCROW nRow, const OUString& rStr, bool bBroadcast )
commit d1ed0f696d0f8f6c1360086577c12161abb9d569
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Nov 18 10:17:20 2014 -0500

    Unnecessary casting.
    
    Change-Id: Id7d9b28921e96842df1e7c0d735dba4d3dbb6156

diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index bfc29bd..3561a04 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -448,7 +448,7 @@ void ScTable::FillFormula(
                 ScFormulaCell* pOrgCell = pDocument->GetFormulaCell(aOrg);
                 if (pOrgCell && pOrgCell->GetMatrixFlag() == MM_FORMULA)
                 {
-                    ((ScFormulaCell*)pOrgCell)->SetMatColsRows(
+                    pOrgCell->SetMatColsRows(
                         nDestCol - aOrg.Col() + 1,
                         nDestRow - aOrg.Row() + 1 );
                 }


More information about the Libreoffice-commits mailing list