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

Tor Lillqvist tml at collabora.com
Thu Nov 23 14:29:30 UTC 2017


 sc/inc/attarray.hxx              |    2 +-
 sc/source/core/data/attarray.cxx |    4 ++--
 sc/source/core/data/column.cxx   |    4 ++--
 sc/source/core/data/table2.cxx   |    4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 2923cb0b5b757a764e285d7295f4e78b8494c5c8
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Nov 23 14:24:16 2017 +0200

    Move the need for several ugly const_casts deeper down to just one place
    
    Change-Id: I2cdd66b9819f070548c2a0af7388d9bfbd3689c1
    Reviewed-on: https://gerrit.libreoffice.org/45144
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 726c5a831114..ccfb1bb8120a 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -139,7 +139,7 @@ public:
     void    SetPattern( SCROW nRow, const ScPatternAttr* pPattern, bool bPutToPool = false );
     void    SetPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr* pPattern,
                             bool bPutToPool = false, ScEditDataArray* pDataArray = nullptr );
-    void    ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, ScStyleSheet* pStyle );
+    void    ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle );
     void    ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache,
                             ScEditDataArray* pDataArray = nullptr, bool* const pIsChanged = nullptr );
     void    SetAttrEntries(std::vector<ScAttrEntry> && vNewData);
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index ef4b11cdf09c..c8a7d50da93c 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -605,7 +605,7 @@ void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPattern
 #endif
 }
 
-void ScAttrArray::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, ScStyleSheet* pStyle )
+void ScAttrArray::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle )
 {
     if (ValidRow(nStartRow) && ValidRow(nEndRow))
     {
@@ -625,7 +625,7 @@ void ScAttrArray::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, ScStyleSheet*
         {
             const ScPatternAttr* pOldPattern = mvData[nPos].pPattern;
             std::unique_ptr<ScPatternAttr> pNewPattern(new ScPatternAttr(*pOldPattern));
-            pNewPattern->SetStyleSheet(pStyle);
+            pNewPattern->SetStyleSheet(const_cast<ScStyleSheet*>(&rStyle));
             SCROW nY1 = nStart;
             SCROW nY2 = mvData[nPos].nEndRow;
             nStart = mvData[nPos].nEndRow + 1;
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index ff507715af12..73afe1a810f8 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -567,7 +567,7 @@ void ScColumn::ApplyStyle( SCROW nRow, const ScStyleSheet* rStyle )
 
 void ScColumn::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle )
 {
-    pAttrArray->ApplyStyleArea(nStartRow, nEndRow, const_cast<ScStyleSheet*>(&rStyle));
+    pAttrArray->ApplyStyleArea(nStartRow, nEndRow, rStyle);
 }
 
 void ScColumn::ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark)
@@ -579,7 +579,7 @@ void ScColumn::ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData&
     {
         ScMultiSelIter aMultiIter( rMark.GetMultiSelData(), nCol );
         while (aMultiIter.Next( nTop, nBottom ))
-            pAttrArray->ApplyStyleArea(nTop, nBottom, const_cast<ScStyleSheet*>(&rStyle));
+            pAttrArray->ApplyStyleArea(nTop, nBottom, rStyle);
     }
 }
 
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 0053e5f67f3c..a45d7af408c2 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2569,12 +2569,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);
-                aDefaultColAttrArray.ApplyStyleArea(nStartRow, nEndRow, const_cast<ScStyleSheet*>( &rStyle ) );
+                aDefaultColAttrArray.ApplyStyleArea(nStartRow, nEndRow, rStyle );
             }
             else
             {
                 CreateColumnIfNotExists( nStartCol - 1 );
-                aDefaultColAttrArray.ApplyStyleArea(nStartRow, nEndRow, const_cast<ScStyleSheet*>( &rStyle ) );
+                aDefaultColAttrArray.ApplyStyleArea(nStartRow, nEndRow, rStyle );
             }
         }
         else


More information about the Libreoffice-commits mailing list