[Libreoffice-commits] .: 2 commits - sc/inc sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 2 15:01:55 PDT 2012


 sc/inc/attarray.hxx              |   15 +++++---
 sc/inc/column.hxx                |   70 ++++++++++++++++++++-------------------
 sc/source/core/data/attarray.cxx |   14 ++++---
 sc/source/core/data/column.cxx   |   29 ++++++++--------
 sc/source/core/data/column2.cxx  |   39 +++++++++------------
 sc/source/core/data/column3.cxx  |    3 +
 6 files changed, 89 insertions(+), 81 deletions(-)

New commits:
commit 0712695c970371bce2a2f5074a7028ef97cdb715
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Nov 2 17:53:12 2012 -0400

    More methods that can be marked const.
    
    Change-Id: Ia3eb38ae6500463c41e6935a169fa1ac08edc681

diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 3af278f..7379bbf 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -148,10 +148,13 @@ public:
     SCsROW  GetNextUnprotected( SCsROW nRow, bool bUp ) const;
 
             /// May return -1 if not found
-    SCsROW  SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle,
-                            bool bUp, ScMarkArray* pMarkArray = NULL );
-    bool    SearchStyleRange( SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle,
-                            bool bUp, ScMarkArray* pMarkArray = NULL );
+    SCsROW SearchStyle(
+        SCsROW nRow, const ScStyleSheet* pSearchStyle, bool bUp,
+        const ScMarkArray* pMarkArray = NULL) const;
+
+    bool SearchStyleRange(
+        SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, bool bUp,
+        const ScMarkArray* pMarkArray = NULL) const;
 
     bool    ApplyFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags );
     bool    RemoveFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags );
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 2ef0b02..402d62f 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -199,20 +199,20 @@ public:
     SCCOL              GetCol() const { return nCol; }
 
                 //     UpdateSelectionFunction: multi-select
-    void               UpdateSelectionFunction( const ScMarkData& rMark,
-                                    ScFunctionData& rData,
-                                    ScFlatBoolRowSegments& rHiddenRows,
-                                    bool bDoExclude, SCROW nExStartRow, SCROW nExEndRow );
-    void        UpdateAreaFunction( ScFunctionData& rData,
-                                    ScFlatBoolRowSegments& rHiddenRows,
-                                    SCROW nStartRow, SCROW nEndRow );
+    void UpdateSelectionFunction(
+        const ScMarkData& rMark, ScFunctionData& rData, ScFlatBoolRowSegments& rHiddenRows,
+        bool bDoExclude, SCROW nExStartRow, SCROW nExEndRow ) const;
+
+    void UpdateAreaFunction(
+        ScFunctionData& rData, ScFlatBoolRowSegments& rHiddenRows, SCROW nStartRow, SCROW nEndRow) const;
 
     void CopyToColumn(
         SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked,
         ScColumn& rColumn, const ScMarkData* pMarkData = NULL, bool bAsLink = false) const;
 
-    void        UndoToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked,
-                                ScColumn& rColumn, const ScMarkData* pMarkData = NULL );
+    void UndoToColumn(
+        SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked,
+        ScColumn& rColumn, const ScMarkData* pMarkData = NULL) const;
 
     void        CopyScenarioFrom( const ScColumn& rSrcCol );
     void        CopyScenarioTo( ScColumn& rDestCol ) const;
@@ -318,10 +318,13 @@ public:
     bool    IsStyleSheetUsed( const ScStyleSheet& rStyle, bool bGatherAllStyles ) const;
 
                 /// May return -1 if not found
-    SCsROW      SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle,
-                                bool bUp, bool bInSelection, const ScMarkData& rMark );
-    bool    SearchStyleRange( SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle,
-                                    bool bUp, bool bInSelection, const ScMarkData& rMark );
+    SCsROW SearchStyle(
+        SCsROW nRow, const ScStyleSheet* pSearchStyle, bool bUp, bool bInSelection,
+        const ScMarkData& rMark) const;
+
+    bool SearchStyleRange(
+        SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, bool bUp,
+        bool bInSelection, const ScMarkData& rMark) const;
 
     bool    ApplyFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags );
     bool    RemoveFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags );
@@ -335,20 +338,20 @@ public:
     void        ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
     void        ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark );
 
-    long        GetNeededSize( SCROW nRow, OutputDevice* pDev,
-                                    double nPPTX, double nPPTY,
-                                    const Fraction& rZoomX, const Fraction& rZoomY,
-                                    bool bWidth, const ScNeededSizeOptions& rOptions );
-    sal_uInt16  GetOptimalColWidth( OutputDevice* pDev, double nPPTX, double nPPTY,
-                                    const Fraction& rZoomX, const Fraction& rZoomY,
-                                    bool bFormula, sal_uInt16 nOldWidth,
-                                    const ScMarkData* pMarkData,
-                                    const ScColWidthParam* pParam );
-    void        GetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16* pHeight,
-                                    OutputDevice* pDev,
-                                    double nPPTX, double nPPTY,
-                                    const Fraction& rZoomX, const Fraction& rZoomY,
-                                    bool bShrink, sal_uInt16 nMinHeight, SCROW nMinStart );
+    long GetNeededSize(
+        SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY,
+        const Fraction& rZoomX, const Fraction& rZoomY,
+        bool bWidth, const ScNeededSizeOptions& rOptions) const;
+
+    sal_uInt16 GetOptimalColWidth(
+        OutputDevice* pDev, double nPPTX, double nPPTY,
+        const Fraction& rZoomX, const Fraction& rZoomY,
+        bool bFormula, sal_uInt16 nOldWidth, const ScMarkData* pMarkData, const ScColWidthParam* pParam) const;
+
+    void GetOptimalHeight(
+        SCROW nStartRow, SCROW nEndRow, sal_uInt16* pHeight, OutputDevice* pDev,
+        double nPPTX, double nPPTY, const Fraction& rZoomX, const Fraction& rZoomY,
+        bool bShrink, sal_uInt16 nMinHeight, SCROW nMinStart) const;
 public:
 
                 /// Including current, may return -1
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 55759d1..3df0c7c 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -2340,8 +2340,9 @@ void ScAttrArray::CopyAreaSafe( SCROW nStartRow, SCROW nEndRow, long nDy, ScAttr
 }
 
 
-SCsROW ScAttrArray::SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle,
-                                    bool bUp, ScMarkArray* pMarkArray )
+SCsROW ScAttrArray::SearchStyle(
+    SCsROW nRow, const ScStyleSheet* pSearchStyle, bool bUp,
+    const ScMarkArray* pMarkArray) const
 {
     bool bFound = false;
 
@@ -2403,8 +2404,9 @@ SCsROW ScAttrArray::SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle,
 }
 
 
-bool ScAttrArray::SearchStyleRange( SCsROW& rRow, SCsROW& rEndRow,
-                        const ScStyleSheet* pSearchStyle, bool bUp, ScMarkArray* pMarkArray )
+bool ScAttrArray::SearchStyleRange(
+    SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, bool bUp,
+    const ScMarkArray* pMarkArray) const
 {
     SCsROW nStartRow = SearchStyle( rRow, pSearchStyle, bUp, pMarkArray );
     if (VALIDROW(nStartRow))
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 2c96feb..c2b2c1d 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1310,8 +1310,9 @@ void ScColumn::CopyToColumn(
 }
 
 
-void ScColumn::UndoToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked,
-                                ScColumn& rColumn, const ScMarkData* pMarkData )
+void ScColumn::UndoToColumn(
+    SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked, ScColumn& rColumn,
+    const ScMarkData* pMarkData) const
 {
     if (nRow1 > 0)
         CopyToColumn( 0, nRow1-1, IDF_FORMULA, false, rColumn );
@@ -2098,14 +2099,14 @@ bool ScColumn::HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst) const
 }
 
 
-SCsROW ScColumn::SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle,
-                                bool bUp, bool bInSelection, const ScMarkData& rMark )
+SCsROW ScColumn::SearchStyle(
+    SCsROW nRow, const ScStyleSheet* pSearchStyle, bool bUp, bool bInSelection,
+    const ScMarkData& rMark) const
 {
     if (bInSelection)
     {
         if (rMark.IsMultiMarked())
-            return pAttrArray->SearchStyle( nRow, pSearchStyle, bUp,
-                                    (ScMarkArray*) rMark.GetArray()+nCol );     //! const
+            return pAttrArray->SearchStyle(nRow, pSearchStyle, bUp, rMark.GetArray()+nCol);
         else
             return -1;
     }
@@ -2114,14 +2115,15 @@ SCsROW ScColumn::SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle,
 }
 
 
-bool ScColumn::SearchStyleRange( SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle,
-                                    bool bUp, bool bInSelection, const ScMarkData& rMark )
+bool ScColumn::SearchStyleRange(
+    SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, bool bUp,
+    bool bInSelection, const ScMarkData& rMark) const
 {
     if (bInSelection)
     {
         if (rMark.IsMultiMarked())
-            return pAttrArray->SearchStyleRange( rRow, rEndRow, pSearchStyle, bUp,
-                                    (ScMarkArray*) rMark.GetArray()+nCol );     //! const
+            return pAttrArray->SearchStyleRange(
+                rRow, rEndRow, pSearchStyle, bUp, rMark.GetArray() + nCol);
         else
             return false;
     }
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index d90f79d..036f00f 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -89,10 +89,10 @@ inline bool IsAmbiguousScript( sal_uInt8 nScript )
 // -----------------------------------------------------------------------------------------
 
 
-long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev,
-                              double nPPTX, double nPPTY,
-                              const Fraction& rZoomX, const Fraction& rZoomY,
-                              bool bWidth, const ScNeededSizeOptions& rOptions )
+long ScColumn::GetNeededSize(
+    SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY,
+    const Fraction& rZoomX, const Fraction& rZoomY,
+    bool bWidth, const ScNeededSizeOptions& rOptions ) const
 {
     long nValue=0;
     SCSIZE nIndex;
@@ -530,11 +530,9 @@ long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev,
 }
 
 
-sal_uInt16 ScColumn::GetOptimalColWidth( OutputDevice* pDev, double nPPTX, double nPPTY,
-                                     const Fraction& rZoomX, const Fraction& rZoomY,
-                                     bool bFormula, sal_uInt16 nOldWidth,
-                                     const ScMarkData* pMarkData,
-                                     const ScColWidthParam* pParam )
+sal_uInt16 ScColumn::GetOptimalColWidth(
+    OutputDevice* pDev, double nPPTX, double nPPTY, const Fraction& rZoomX, const Fraction& rZoomY,
+    bool bFormula, sal_uInt16 nOldWidth, const ScMarkData* pMarkData, const ScColWidthParam* pParam) const
 {
     if ( maItems.empty() )
         return nOldWidth;
@@ -671,11 +669,10 @@ static sal_uInt16 lcl_GetAttribHeight( const ScPatternAttr& rPattern, sal_uInt16
 //  nMinHeight, nMinStart zur Optimierung: ab nRow >= nMinStart ist mindestens nMinHeight
 //  (wird nur bei bStdAllowed ausgewertet)
 
-void ScColumn::GetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16* pHeight,
-                                OutputDevice* pDev,
-                                double nPPTX, double nPPTY,
-                                const Fraction& rZoomX, const Fraction& rZoomY,
-                                bool bShrink, sal_uInt16 nMinHeight, SCROW nMinStart )
+void ScColumn::GetOptimalHeight(
+    SCROW nStartRow, SCROW nEndRow, sal_uInt16* pHeight, OutputDevice* pDev,
+    double nPPTX, double nPPTY, const Fraction& rZoomX, const Fraction& rZoomY,
+    bool bShrink, sal_uInt16 nMinHeight, SCROW nMinStart) const
 {
     ScAttrIterator aIter( pAttrArray, nStartRow, nEndRow );
 
@@ -1640,7 +1637,7 @@ void ScColumn::CompileColRowNameFormula()
         }
 }
 
-static void lcl_UpdateSubTotal( ScFunctionData& rData, ScBaseCell* pCell )
+static void lcl_UpdateSubTotal( ScFunctionData& rData, const ScBaseCell* pCell )
 {
     double nValue = 0.0;
     bool bVal = false;
@@ -1720,10 +1717,9 @@ static void lcl_UpdateSubTotal( ScFunctionData& rData, ScBaseCell* pCell )
 }
 
 //  Mehrfachselektion:
-void ScColumn::UpdateSelectionFunction( const ScMarkData& rMark,
-                                        ScFunctionData& rData,
-                                        ScFlatBoolRowSegments& rHiddenRows,
-                                        bool bDoExclude, SCROW nExStartRow, SCROW nExEndRow )
+void ScColumn::UpdateSelectionFunction(
+    const ScMarkData& rMark, ScFunctionData& rData, ScFlatBoolRowSegments& rHiddenRows,
+    bool bDoExclude, SCROW nExStartRow, SCROW nExEndRow) const
 {
     SCSIZE nIndex;
     ScMarkedDataIter aDataIter(this, &rMark, false);
@@ -1738,9 +1734,8 @@ void ScColumn::UpdateSelectionFunction( const ScMarkData& rMark,
 }
 
 //  bei bNoMarked die Mehrfachselektion weglassen
-void ScColumn::UpdateAreaFunction( ScFunctionData& rData,
-                                   ScFlatBoolRowSegments& rHiddenRows,
-                                    SCROW nStartRow, SCROW nEndRow )
+void ScColumn::UpdateAreaFunction(
+    ScFunctionData& rData, ScFlatBoolRowSegments& rHiddenRows, SCROW nStartRow, SCROW nEndRow) const
 {
     SCSIZE nIndex;
     Search( nStartRow, nIndex );
commit 13b1964518036d4453b0e713a183250fcf3da346
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Nov 2 16:59:34 2012 -0400

    Mark these methods const.
    
    Change-Id: I9b9a8c156e1da89045ba3210960732ccbf2c9dd0

diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 6598341..3af278f 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -188,8 +188,8 @@ public:
     void    DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex );
     void    DeleteArea( SCROW nStartRow, SCROW nEndRow );
     void    MoveTo( SCROW nStartRow, SCROW nEndRow, ScAttrArray& rAttrArray );
-    void    CopyArea( SCROW nStartRow, SCROW nEndRow, long nDy, ScAttrArray& rAttrArray,
-                        sal_Int16 nStripFlags = 0 );
+    void    CopyArea(
+        SCROW nStartRow, SCROW nEndRow, long nDy, ScAttrArray& rAttrArray, sal_Int16 nStripFlags = 0) const;
 
     void    DeleteHardAttr( SCROW nStartRow, SCROW nEndRow );
 };
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index a2aad72..2ef0b02 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -176,7 +176,7 @@ public:
     void        DeleteRow( SCROW nStartRow, SCSIZE nSize );
     void        DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDelFlag );
     void        DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag );
-    void        CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags);
+    void CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags) const;
     void        CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy,
                                 sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScColumn& rColumn);
     void        StartListeningInArea( SCROW nRow1, SCROW nRow2 );
@@ -207,9 +207,10 @@ public:
                                     ScFlatBoolRowSegments& rHiddenRows,
                                     SCROW nStartRow, SCROW nEndRow );
 
-    void        CopyToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked,
-                                ScColumn& rColumn, const ScMarkData* pMarkData = NULL,
-                                bool bAsLink = false );
+    void CopyToColumn(
+        SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked,
+        ScColumn& rColumn, const ScMarkData* pMarkData = NULL, bool bAsLink = false) const;
+
     void        UndoToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked,
                                 ScColumn& rColumn, const ScMarkData* pMarkData = NULL );
 
@@ -379,7 +380,7 @@ public:
                                        SCROW nRowStart, SCROW nRowEnd ) const;
 
 private:
-    ScBaseCell* CloneCell(SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos);
+    ScBaseCell* CloneCell(SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos) const;
 
     SCROW FindNextVisibleRowWithContent(SCROW nRow, bool bForward) const;
     SCROW FindNextVisibleRow(SCROW nRow, bool bForward) const;
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index f47bb05..55759d1 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -2231,8 +2231,8 @@ void ScAttrArray::MoveTo(SCROW nStartRow, SCROW nEndRow, ScAttrArray& rAttrArray
 
 // copy between documents (Clipboard)
 
-void ScAttrArray::CopyArea( SCROW nStartRow, SCROW nEndRow, long nDy, ScAttrArray& rAttrArray,
-                                sal_Int16 nStripFlags )
+void ScAttrArray::CopyArea(
+    SCROW nStartRow, SCROW nEndRow, long nDy, ScAttrArray& rAttrArray, sal_Int16 nStripFlags) const
 {
     nStartRow -= nDy;   // Source
     nEndRow -= nDy;
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 5debdd1..2c96feb 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1172,7 +1172,7 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize )
 }
 
 
-void ScColumn::CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags)
+void ScColumn::CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags) const
 {
     pAttrArray->CopyArea( nRow1, nRow2, 0, *rColumn.pAttrArray,
                             bKeepScenarioFlags ? (SC_MF_ALL & ~SC_MF_SCENARIO) : SC_MF_ALL );
@@ -1215,8 +1215,9 @@ void ScColumn::CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKee
 }
 
 
-void ScColumn::CopyToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked,
-                                ScColumn& rColumn, const ScMarkData* pMarkData, bool bAsLink )
+void ScColumn::CopyToColumn(
+    SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked, ScColumn& rColumn,
+    const ScMarkData* pMarkData, bool bAsLink) const
 {
     if (bMarked)
     {
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index f2c4eca..c44de8e 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -767,7 +767,8 @@ bool lclCanCloneValue( ScDocument& rDoc, const ScColumn& rCol, SCROW nRow, bool
 } // namespace
 
 
-ScBaseCell* ScColumn::CloneCell(SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos)
+ScBaseCell* ScColumn::CloneCell(
+    SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos) const
 {
     bool bCloneValue    = (nFlags & IDF_VALUE) != 0;
     bool bCloneDateTime = (nFlags & IDF_DATETIME) != 0;


More information about the Libreoffice-commits mailing list