summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-11-02 12:04:56 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-11-02 14:58:11 +0100
commit2a38429ce0b3ef389bd58590eb42e6edf6bdddef (patch)
treeb6fe446557a0e4389d518c4e799f2971aab9fca7
parent6e78db23c1194a371961e2136a62fb149a8a764d (diff)
we don't need to pass this parameter
Change-Id: Ia330894b43c94d1dee09e7013999d22114ca52ac
-rw-r--r--sc/inc/conditio.hxx18
-rw-r--r--sc/source/core/data/conditio.cxx49
2 files changed, 33 insertions, 34 deletions
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index cebb8f421fe8..f765639315c8 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -254,15 +254,15 @@ protected:
private:
- bool IsDuplicate(double nArg, const rtl::OUString& rStr, const ScRangeList& rRanges) const;
- bool IsTopNElement( double nArg, const ScRangeList& rRanges ) const;
- bool IsTopNPercent( double nArg, const ScRangeList& rRanges ) const;
- bool IsBottomNElement( double nArg, const ScRangeList& rRanges ) const;
- bool IsBottomNPercent( double nArg, const ScRangeList& rRanges ) const;
- bool IsAboveAverage( double nArg, const ScRangeList& rRanges ) const;
- bool IsBelowAverage( double nArg, const ScRangeList& rRanges ) const;
-
- void FillCache(const ScRangeList& rRanges) const;
+ bool IsDuplicate(double nArg, const rtl::OUString& rStr) const;
+ bool IsTopNElement( double nArg ) const;
+ bool IsTopNPercent( double nArg ) const;
+ bool IsBottomNElement( double nArg ) const;
+ bool IsBottomNPercent( double nArg ) const;
+ bool IsAboveAverage( double nArg ) const;
+ bool IsBelowAverage( double nArg ) const;
+
+ void FillCache() const;
struct ScConditionEntryCache
{
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index c0403f1d50f8..3557e06f3dea 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -768,10 +768,11 @@ static bool lcl_GetCellContent( ScBaseCell* pCell, bool bIsStr1, double& rArg, r
return bVal;
}
-void ScConditionEntry::FillCache( const ScRangeList& rRanges ) const
+void ScConditionEntry::FillCache() const
{
if(!mpCache)
{
+ const ScRangeList& rRanges = pCondFormat->GetRange();
mpCache.reset(new ScConditionEntryCache);
size_t nListCount = rRanges.size();
for( size_t i = 0; i < nListCount; i++ )
@@ -822,9 +823,9 @@ void ScConditionEntry::FillCache( const ScRangeList& rRanges ) const
}
}
-bool ScConditionEntry::IsDuplicate( double nArg, const rtl::OUString& rStr, const ScRangeList& rRanges ) const
+bool ScConditionEntry::IsDuplicate( double nArg, const rtl::OUString& rStr ) const
{
- FillCache( rRanges );
+ FillCache();
if(rStr.isEmpty())
{
@@ -854,9 +855,9 @@ bool ScConditionEntry::IsDuplicate( double nArg, const rtl::OUString& rStr, cons
}
}
-bool ScConditionEntry::IsTopNElement( double nArg, const ScRangeList& rRanges ) const
+bool ScConditionEntry::IsTopNElement( double nArg ) const
{
- FillCache( rRanges );
+ FillCache();
if(mpCache->nValueItems <= nVal1)
return true;
@@ -875,9 +876,9 @@ bool ScConditionEntry::IsTopNElement( double nArg, const ScRangeList& rRanges )
return true;
}
-bool ScConditionEntry::IsBottomNElement( double nArg, const ScRangeList& rRanges ) const
+bool ScConditionEntry::IsBottomNElement( double nArg ) const
{
- FillCache( rRanges );
+ FillCache();
if(mpCache->nValueItems <= nVal1)
return true;
@@ -896,9 +897,9 @@ bool ScConditionEntry::IsBottomNElement( double nArg, const ScRangeList& rRanges
return true;
}
-bool ScConditionEntry::IsTopNPercent( double nArg, const ScRangeList& rRanges ) const
+bool ScConditionEntry::IsTopNPercent( double nArg ) const
{
- FillCache( rRanges );
+ FillCache();
size_t nCells = 0;
size_t nLimitCells = static_cast<size_t>(mpCache->nValueItems*nVal1/100);
@@ -915,9 +916,9 @@ bool ScConditionEntry::IsTopNPercent( double nArg, const ScRangeList& rRanges )
return true;
}
-bool ScConditionEntry::IsBottomNPercent( double nArg, const ScRangeList& rRanges ) const
+bool ScConditionEntry::IsBottomNPercent( double nArg ) const
{
- FillCache( rRanges );
+ FillCache();
size_t nCells = 0;
size_t nLimitCells = static_cast<size_t>(mpCache->nValueItems*nVal1/100);
@@ -934,9 +935,9 @@ bool ScConditionEntry::IsBottomNPercent( double nArg, const ScRangeList& rRanges
return true;
}
-bool ScConditionEntry::IsBelowAverage( double nArg, const ScRangeList& rRanges ) const
+bool ScConditionEntry::IsBelowAverage( double nArg ) const
{
- FillCache( rRanges );
+ FillCache();
double nSum = 0;
for(ScConditionEntryCache::ValueCacheType::const_iterator itr = mpCache->maValues.begin(),
@@ -951,9 +952,9 @@ bool ScConditionEntry::IsBelowAverage( double nArg, const ScRangeList& rRanges )
return (nArg < nSum/mpCache->nValueItems);
}
-bool ScConditionEntry::IsAboveAverage( double nArg, const ScRangeList& rRanges ) const
+bool ScConditionEntry::IsAboveAverage( double nArg ) const
{
- FillCache( rRanges );
+ FillCache();
double nSum = 0;
for(ScConditionEntryCache::ValueCacheType::const_iterator itr = mpCache->maValues.begin(),
@@ -1030,8 +1031,7 @@ bool ScConditionEntry::IsValid( double nArg ) const
case SC_COND_NOTDUPLICATE:
if( pCondFormat )
{
- const ScRangeList& aRanges = pCondFormat->GetRange();
- bValid = IsDuplicate( nArg, rtl::OUString(), aRanges );
+ bValid = IsDuplicate( nArg, rtl::OUString() );
if( eOp == SC_COND_NOTDUPLICATE )
bValid = !bValid;
}
@@ -1040,22 +1040,22 @@ bool ScConditionEntry::IsValid( double nArg ) const
bValid = !::rtl::math::approxEqual( nComp1, 0.0 );
break;
case SC_COND_TOP10:
- bValid = IsTopNElement( nArg, pCondFormat->GetRange() );
+ bValid = IsTopNElement( nArg );
break;
case SC_COND_BOTTOM10:
- bValid = IsBottomNElement( nArg, pCondFormat->GetRange() );
+ bValid = IsBottomNElement( nArg );
break;
case SC_COND_TOP_PERCENT:
- bValid = IsTopNPercent( nArg, pCondFormat->GetRange() );
+ bValid = IsTopNPercent( nArg );
break;
case SC_COND_BOTTOM_PERCENT:
- bValid = IsBottomNPercent( nArg, pCondFormat->GetRange() );
+ bValid = IsBottomNPercent( nArg );
break;
case SC_COND_ABOVE_AVERAGE:
- bValid = IsAboveAverage( nArg, pCondFormat->GetRange() );
+ bValid = IsAboveAverage( nArg );
break;
case SC_COND_BELOW_AVERAGE:
- bValid = IsBelowAverage( nArg, pCondFormat->GetRange() );
+ bValid = IsBelowAverage( nArg );
break;
default:
OSL_FAIL("unbekannte Operation bei ScConditionEntry");
@@ -1076,8 +1076,7 @@ bool ScConditionEntry::IsValidStr( const String& rArg ) const
{
if( pCondFormat && rArg.Len() )
{
- const ScRangeList& aRanges = pCondFormat->GetRange();
- bValid = IsDuplicate( 0.0, rArg, aRanges );
+ bValid = IsDuplicate( 0.0, rArg );
if( eOp == SC_COND_NOTDUPLICATE )
bValid = !bValid;
return bValid;