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

Tamas Bunth tamas.bunth at collabora.co.uk
Sat Jul 22 07:20:46 UTC 2017


 sc/inc/column.hxx                 |    3 ++-
 sc/inc/document.hxx               |    3 ++-
 sc/inc/table.hxx                  |    3 ++-
 sc/source/core/data/attarray.cxx  |    7 ++-----
 sc/source/core/data/column.cxx    |    4 ++--
 sc/source/core/data/document.cxx  |    7 ++++---
 sc/source/core/data/table2.cxx    |    5 +++--
 sc/source/ui/docshell/docfunc.cxx |    2 +-
 8 files changed, 18 insertions(+), 16 deletions(-)

New commits:
commit 8becd40f030b94fe3fb6ad82b048ee97daaea2b1
Author: Tamas Bunth <tamas.bunth at collabora.co.uk>
Date:   Fri Jul 21 12:53:43 2017 +0000

    avoid unnecessary calls of AdjustRowHeight
    
    Change-Id: I2d164f69a7313d69f3fe5cabe1e3cc39aeba4d32
    Reviewed-on: https://gerrit.libreoffice.org/40272
    Reviewed-by: Tamás Bunth <btomi96 at gmail.com>
    Tested-by: Tamás Bunth <btomi96 at gmail.com>

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index e280e3c7f692..35693f87aa8b 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -460,7 +460,8 @@ public:
     void        ApplyAttr( SCROW nRow, const SfxPoolItem& rAttr );
     void        ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr );
     void        ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr,
-                                  ScEditDataArray* pDataArray = nullptr );
+                                  ScEditDataArray* pDataArray = nullptr,
+                                  bool* const pIsChanged = nullptr);
     void        SetPattern( SCROW nRow, const ScPatternAttr& rPatAttr );
     void        SetPatternArea( SCROW nStartRow, SCROW nEndRow,
                                 const ScPatternAttr& rPatAttr );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 76a4251e887d..bf5934381e92 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1622,7 +1622,8 @@ public:
     SC_DLLPUBLIC void           ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow,
                                                   SCCOL nEndCol, SCROW nEndRow,
                                                   const ScMarkData& rMark, const ScPatternAttr& rAttr,
-                                                  ScEditDataArray* pDataArray = nullptr );
+                                                  ScEditDataArray* pDataArray = nullptr,
+                                                  bool* const pIsChanged = nullptr );
     SC_DLLPUBLIC void           ApplyPatternAreaTab( SCCOL nStartCol, SCROW nStartRow,
                                                      SCCOL nEndCol, SCROW nEndRow, SCTAB nTab,
                                                      const ScPatternAttr& rAttr );
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 440e0cc414a3..80f4b7dfc7de 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -662,7 +662,8 @@ public:
     void        ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
     void        ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
     void        ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
-                                  const ScPatternAttr& rAttr, ScEditDataArray* pDataArray = nullptr );
+                                  const ScPatternAttr& rAttr, ScEditDataArray* pDataArray = nullptr,
+                                  bool* const pIsChanged = nullptr );
 
     void        SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr )
                     {
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 2ecead9c24d2..5b1dab939ffc 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -856,7 +856,6 @@ void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCac
     TestData();
 #endif
 
-    bool bChanged = false;
     if (ValidRow(nStartRow) && ValidRow(nEndRow))
     {
         SCSIZE nPos;
@@ -881,7 +880,8 @@ void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCac
                 SCROW nY2 = pData[nPos].nRow;
                 nStart = pData[nPos].nRow + 1;
 
-                bChanged = true;
+                if(pIsChanged)
+                    *pIsChanged = true;
 
                 if ( nY1 < nStartRow || nY2 > nEndRow )
                 {
@@ -929,9 +929,6 @@ void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCac
             pDocument->SetStreamValid(nTab, false);
     }
 
-    if( pIsChanged)
-        *pIsChanged = bChanged;
-
 #if DEBUG_SC_TESTATTRARRAY
     TestData();
 #endif
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 716007e9a21e..ae2a2e795b7f 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -514,11 +514,11 @@ void ScColumn::ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr )
 }
 
 void ScColumn::ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr,
-                                 ScEditDataArray* pDataArray )
+                                 ScEditDataArray* pDataArray, bool* const pIsChanged )
 {
     const SfxItemSet* pSet = &rPatAttr.GetItemSet();
     SfxItemPoolCache aCache( pDocument->GetPool(), pSet );
-    pAttrArray->ApplyCacheArea( nStartRow, nEndRow, &aCache, pDataArray );
+    pAttrArray->ApplyCacheArea( nStartRow, nEndRow, &aCache, pDataArray, pIsChanged );
 }
 
 void ScColumn::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 967a182a70da..55978a93efb2 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4723,13 +4723,14 @@ void ScDocument::ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow,
                         SCCOL nEndCol, SCROW nEndRow,
                         const ScMarkData& rMark,
                         const ScPatternAttr& rAttr,
-                        ScEditDataArray* pDataArray )
+                        ScEditDataArray* pDataArray,
+                        bool* const pIsChanged )
 {
     SCTAB nMax = static_cast<SCTAB>(maTabs.size());
     ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
     for (; itr != itrEnd && *itr < nMax; ++itr)
         if (maTabs[*itr])
-            maTabs[*itr]->ApplyPatternArea( nStartCol, nStartRow, nEndCol, nEndRow, rAttr, pDataArray );
+            maTabs[*itr]->ApplyPatternArea( nStartCol, nStartRow, nEndCol, nEndRow, rAttr, pDataArray, pIsChanged );
 }
 
 void ScDocument::ApplyPatternAreaTab( SCCOL nStartCol, SCROW nStartRow,
@@ -5795,7 +5796,7 @@ void ScDocument::ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMark
             ScRange aRange;
             rMark.GetMarkArea( aRange );
             ApplyPatternArea( aRange.aStart.Col(), aRange.aStart.Row(),
-                              aRange.aEnd.Col(), aRange.aEnd.Row(), rMark, rAttr, pDataArray );
+                              aRange.aEnd.Col(), aRange.aEnd.Row(), rMark, rAttr, pDataArray, pIsChanged );
         }
         else
         {
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index ba78a9e73422..f26084a36b03 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2501,14 +2501,15 @@ void ScTable::ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr )
 }
 
 void ScTable::ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
-                                     const ScPatternAttr& rAttr, ScEditDataArray* pDataArray )
+                                     const ScPatternAttr& rAttr, ScEditDataArray* pDataArray,
+                                     bool* const pIsChanged )
 {
     if (ValidColRow(nStartCol, nStartRow) && ValidColRow(nEndCol, nEndRow))
     {
         PutInOrder(nStartCol, nEndCol);
         PutInOrder(nStartRow, nEndRow);
         for (SCCOL i = nStartCol; i <= nEndCol; i++)
-            aCol[i].ApplyPatternArea(nStartRow, nEndRow, rAttr, pDataArray);
+            aCol[i].ApplyPatternArea(nStartRow, nEndRow, rAttr, pDataArray, pIsChanged);
     }
 }
 
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 0a170c4b96e5..17d8d2dcd049 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1369,7 +1369,7 @@ bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& r
     if ( !bImportingXML )
         rDocShell.UpdatePaintExt( nExtFlags, aMultiRange );     // content before the change
 
-    bool bChanged = true;
+    bool bChanged = false;
     rDoc.ApplySelectionPattern( rPattern, rMark, nullptr, &bChanged );
 
     if(bChanged)


More information about the Libreoffice-commits mailing list