diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-10-31 21:46:06 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-11-02 14:58:09 +0100 |
commit | f73571b5897a53be28ee61d1d1693a5d64065f85 (patch) | |
tree | 80d1d6a8564b16c49afc23d0196d529adcd1c8e1 /sc | |
parent | 2829bc140b0da4d2d2a2e9d4381a774180ffe5c7 (diff) |
extract filling the cache for conditional formats
Change-Id: I90c4f7ac5c462a507cf0d44b7837facdd2bc3643
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/conditio.hxx | 8 | ||||
-rw-r--r-- | sc/source/core/data/conditio.cxx | 21 |
2 files changed, 18 insertions, 11 deletions
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index 641da85c60e8..e1f4e67482ef 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -177,8 +177,8 @@ class SC_DLLPUBLIC ScConditionEntry : public ScFormatEntry bool bTextToReal ); void Interpret( const ScAddress& rPos ); - bool IsValid( double nArg, const ScAddress& rAddr ) const; - bool IsValidStr( const String& rArg, const ScAddress& rAddr ) const; + bool IsValid( double nArg ) const; + bool IsValidStr( const String& rArg ) const; public: ScConditionEntry( ScConditionMode eOper, @@ -248,7 +248,9 @@ protected: private: - bool IsDuplicate(double nArg, const rtl::OUString& rStr, const ScAddress& rAddr, const ScRangeList& rRanges) const; + bool IsDuplicate(double nArg, const rtl::OUString& rStr, const ScRangeList& rRanges) const; + + void FillCache(const ScRangeList& rRanges) const; struct ScConditionEntryCache { diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 324bcf9f54fb..6143647f06ed 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -768,7 +768,7 @@ static bool lcl_GetCellContent( ScBaseCell* pCell, bool bIsStr1, double& rArg, r return bVal; } -bool ScConditionEntry::IsDuplicate( double nArg, const rtl::OUString& rStr, const ScAddress& rAddr, const ScRangeList& rRanges ) const +void ScConditionEntry::FillCache( const ScRangeList& rRanges ) const { if(!mpCache) { @@ -798,7 +798,7 @@ bool ScConditionEntry::IsDuplicate( double nArg, const rtl::OUString& rStr, cons double nVal = 0.0; ScBaseCell *pCell = NULL; - mpDoc->GetCell( c, r, rAddr.Tab(), pCell ); + mpDoc->GetCell( c, r, nTab, pCell ); if( !pCell ) continue; @@ -818,6 +818,11 @@ bool ScConditionEntry::IsDuplicate( double nArg, const rtl::OUString& rStr, cons } } } +} + +bool ScConditionEntry::IsDuplicate( double nArg, const rtl::OUString& rStr, const ScRangeList& rRanges ) const +{ + FillCache( rRanges ); if(rStr.isEmpty()) { @@ -847,7 +852,7 @@ bool ScConditionEntry::IsDuplicate( double nArg, const rtl::OUString& rStr, cons } } -bool ScConditionEntry::IsValid( double nArg, const ScAddress& rAddr ) const +bool ScConditionEntry::IsValid( double nArg ) const { // Interpret muss schon gerufen sein @@ -910,7 +915,7 @@ bool ScConditionEntry::IsValid( double nArg, const ScAddress& rAddr ) const if( pCondFormat ) { const ScRangeList& aRanges = pCondFormat->GetRange(); - bValid = IsDuplicate( nArg, rtl::OUString(), rAddr, aRanges ); + bValid = IsDuplicate( nArg, rtl::OUString(), aRanges ); if( eOp == SC_COND_NOTDUPLICATE ) bValid = !bValid; } @@ -925,7 +930,7 @@ bool ScConditionEntry::IsValid( double nArg, const ScAddress& rAddr ) const return bValid; } -bool ScConditionEntry::IsValidStr( const String& rArg, const ScAddress& rAddr ) const +bool ScConditionEntry::IsValidStr( const String& rArg ) const { bool bValid = false; // Interpret muss schon gerufen sein @@ -938,7 +943,7 @@ bool ScConditionEntry::IsValidStr( const String& rArg, const ScAddress& rAddr ) if( pCondFormat && rArg.Len() ) { const ScRangeList& aRanges = pCondFormat->GetRange(); - bValid = IsDuplicate( 0.0, rArg, rAddr, aRanges ); + bValid = IsDuplicate( 0.0, rArg, aRanges ); if( eOp == SC_COND_NOTDUPLICATE ) bValid = !bValid; return bValid; @@ -1020,9 +1025,9 @@ bool ScConditionEntry::IsCellValid( ScBaseCell* pCell, const ScAddress& rPos ) c rtl::OUString aArgStr; bool bVal = lcl_GetCellContent( pCell, bIsStr1, nArg, aArgStr ); if (bVal) - return IsValid( nArg, rPos ); + return IsValid( nArg ); else - return IsValidStr( aArgStr, rPos ); + return IsValidStr( aArgStr ); } String ScConditionEntry::GetExpression( const ScAddress& rCursor, sal_uInt16 nIndex, |