diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-02 17:53:12 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-02 18:01:17 -0400 |
commit | 0712695c970371bce2a2f5074a7028ef97cdb715 (patch) | |
tree | ebe3d173ae6b2bf762c00c473d583e5bed9bdcf7 | |
parent | 13b1964518036d4453b0e713a183250fcf3da346 (diff) |
More methods that can be marked const.
Change-Id: Ia3eb38ae6500463c41e6935a169fa1ac08edc681
-rw-r--r-- | sc/inc/attarray.hxx | 11 | ||||
-rw-r--r-- | sc/inc/column.hxx | 57 | ||||
-rw-r--r-- | sc/source/core/data/attarray.cxx | 10 | ||||
-rw-r--r-- | sc/source/core/data/column.cxx | 22 | ||||
-rw-r--r-- | sc/source/core/data/column2.cxx | 39 |
5 files changed, 72 insertions, 67 deletions
diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx index 3af278f11c9b..7379bbf6fd50 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 2ef0b021f112..402d62f774ed 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 55759d1e8148..3df0c7c42a3c 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 2c96febe0949..c2b2c1d72068 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 d90f79d5936f..036f00fffa62 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 ); |