diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-05-25 14:26:21 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-06-02 03:25:50 +0200 |
commit | 7e700674c88153ddfecbcb10e7078618a4d0f206 (patch) | |
tree | 36777545f51d952b150e63882cb97d459031fa76 | |
parent | c7e046e6420b410eb9a9382108df62b29bf128c6 (diff) |
accept this result as bug fixed
We still have the number format type in ScFormulaCell. Removing that one
from ScFormulaCell is more work and needs much more inspection than
removing the formula index. Additionally we should inspect all callers
of ScFormulaCell::GetStandardFormat as most of them are useless when we
know that a cell has a fixed number format.
Change-Id: I3ad55a0c072da0fc4046d6c7245ed734a1dcaabc
-rw-r--r-- | sc/inc/formulacell.hxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/column2.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 21 | ||||
-rw-r--r-- | sc/source/core/tool/cellform.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/chart2uno.cxx | 12 |
6 files changed, 8 insertions, 41 deletions
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 1954b749ee47..c407ae7016e5 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -77,10 +77,9 @@ private: ScFormulaCell* pPreviousTrack; ScFormulaCell* pNextTrack; ScFormulaCellGroupRef xGroup; // re-factoring hack - group of formulae we're part of. - sal_uLong nFormatIndex; // Number format set by calculation - short nFormatType; // Number format type set by calculation sal_uInt16 nSeenInIteration; // Iteration cycle in which the cell was last encountered sal_uInt8 cMatrixFlag; // One of ScMatrixMode + short nFormatType; bool bDirty : 1; // Must be (re)calculated bool bChanged : 1; // Whether something changed regarding display/representation bool bRunning : 1; // Already interpreting right now @@ -154,6 +153,7 @@ public: bool NeedsListening() const { return bNeedListening; } void SetNeedsListening( bool bVar ) { bNeedListening = bVar; } void SetNeedNumberFormat( bool bVal ) { mbNeedsNumberFormat = bVal; } + short GetFormatType() const { return nFormatType; } void Compile(const OUString& rFormula, bool bNoListening = false, const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT ); @@ -215,7 +215,6 @@ public: sal_uInt16 GetMatrixEdge( ScAddress& rOrgPos ); sal_uInt16 GetErrCode(); // interpret first if necessary sal_uInt16 GetRawError(); // don't interpret, just return code or result error - short GetFormatType() const { return nFormatType; } sal_uInt8 GetMatrixFlag() const { return cMatrixFlag; } ScTokenArray* GetCode() const { return pCode; } diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index cc814fd06e9c..4df926e9f273 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -160,10 +160,7 @@ long ScColumn::GetNeededSize( // #i111387# disable automatic line breaks only for "General" number format if (bBreak && aCell.hasNumeric() && ( nFormat % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 ) { - // also take formula result type into account for number format - if (aCell.meType != CELLTYPE_FORMULA || - (aCell.mpFormula->GetStandardFormat(*pFormatter, nFormat) % SV_COUNTRY_LANGUAGE_OFFSET) == 0) - bBreak = false; + bBreak = false; } // get other attributes from pattern and conditional formatting diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index d4a484625d13..d3d1b38ba7d5 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -401,10 +401,9 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos, pNext(0), pPreviousTrack(0), pNextTrack(0), - nFormatIndex(0), - nFormatType( NUMBERFORMAT_NUMBER ), nSeenInIteration(0), cMatrixFlag ( cMatInd ), + nFormatType ( NUMBERFORMAT_NUMBER ), bDirty( true ), // -> Because of the use of the Auto Pilot Function was: cMatInd != 0 bChanged( false ), bRunning( false ), @@ -436,10 +435,9 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos, pNext(0), pPreviousTrack(0), pNextTrack(0), - nFormatIndex(0), - nFormatType( NUMBERFORMAT_NUMBER ), nSeenInIteration(0), cMatrixFlag ( cInd ), + nFormatType ( NUMBERFORMAT_NUMBER ), bDirty( NULL != pArr ), // -> Because of the use of the Auto Pilot Function was: cInd != 0 bChanged( false ), bRunning( false ), @@ -483,10 +481,9 @@ ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, cons pNext(0), pPreviousTrack(0), pNextTrack(0), - nFormatIndex( &rDoc == rCell.pDocument ? rCell.nFormatIndex : 0 ), - nFormatType( rCell.nFormatType ), nSeenInIteration(0), cMatrixFlag ( rCell.cMatrixFlag ), + nFormatType( rCell.nFormatType ), bDirty( rCell.bDirty ), bChanged( rCell.bChanged ), bRunning( false ), @@ -770,7 +767,6 @@ void ScFormulaCell::CompileTokenArray( bool bNoListening ) if( !pCode->GetCodeError() ) { nFormatType = aComp.GetNumFormatType(); - nFormatIndex = 0; bChanged = true; aResult.SetToken( NULL); bCompile = false; @@ -820,7 +816,6 @@ void ScFormulaCell::CompileXML( ScProgress& rProgress ) if( !pCode->GetCodeError() ) { nFormatType = aComp.GetNumFormatType(); - nFormatIndex = 0; bChanged = true; bCompile = false; StartListeningTo( pDocument ); @@ -871,7 +866,6 @@ void ScFormulaCell::CalcAfterLoad() aComp.SetGrammar(pDocument->GetGrammar()); bSubTotal = aComp.CompileTokenArray(); nFormatType = aComp.GetNumFormatType(); - nFormatIndex = 0; bDirty = true; bCompile = false; bNewCompiled = true; @@ -1298,7 +1292,7 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam ) if( mbNeedsNumberFormat ) { - sal_uInt16 nFormatType = p->GetRetFormatType(); + nFormatType = p->GetRetFormatType(); sal_Int32 nFormatIndex = p->GetRetFormatIndex(); // don't set text format as hard format @@ -1378,11 +1372,6 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam ) && nFormatType != NUMBERFORMAT_DATETIME ) { sal_uLong nFormat = pDocument->GetNumberFormat( aPos ); - if ( nFormatIndex && (nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 ) - nFormat = nFormatIndex; - if ( (nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 ) - nFormat = ScGlobal::GetStandardFormat( - *pDocument->GetFormatTable(), nFormat, nFormatType ); aResult.SetDouble( pDocument->RoundValueAsShown( aResult.GetDouble(), nFormat)); } @@ -1508,8 +1497,6 @@ void ScFormulaCell::GetMatColsRows( SCCOL & nCols, SCROW & nRows ) const sal_uLong ScFormulaCell::GetStandardFormat( SvNumberFormatter& rFormatter, sal_uLong nFormat ) const { - if ( nFormatIndex && (nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 ) - return nFormatIndex; //! not ScFormulaCell::IsValue(), that could reinterpret the formula again. if ( aResult.IsValue() ) return ScGlobal::GetStandardFormat( aResult.GetDouble(), rFormatter, nFormat, nFormatType ); diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx index cb7ce81996e6..68468747ab55 100644 --- a/sc/source/core/tool/cellform.cxx +++ b/sc/source/core/tool/cellform.cxx @@ -203,10 +203,6 @@ OUString ScCellFormat::GetString( { sal_uInt16 nErrCode = pFCell->GetErrCode(); - // get the number format only after interpretation (GetErrCode): - if ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0) nFormat = pFCell->GetStandardFormat(rFormatter, - nFormat); - if (nErrCode != 0) aString = ScGlobal::GetErrorString(nErrCode); else if (pFCell->IsEmptyDisplayedAsString()) aString = OUString(); else if (pFCell->IsValue()) diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 7fd4ef7d0c3f..1f789b96b333 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -170,8 +170,6 @@ sal_uLong ScInterpreter::GetCellNumberFormat( const ScAddress& rPos, ScRefCellVa else nErr = 0; nFormat = pDok->GetNumberFormat( rPos ); - if (rCell.meType == CELLTYPE_FORMULA && ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0)) - nFormat = rCell.mpFormula->GetStandardFormat(*pFormatter, nFormat); } SetError(nErr); diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index c6363a4a7fe7..832f59c4e878 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -3257,17 +3257,7 @@ namespace { sal_uLong getDisplayNumberFormat(ScDocument* pDoc, const ScAddress& rPos) { sal_uLong nFormat = pDoc->GetNumberFormat(rPos); // original format from cell. - SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); - if (!pFormatter) - return nFormat; - - ScRefCellValue aCell; - aCell.assign(*pDoc, rPos); - if (aCell.isEmpty() || aCell.meType != CELLTYPE_FORMULA || nFormat) - return nFormat; - - // With formula cell, the format may be inferred from the formula result. - return aCell.mpFormula->GetStandardFormat(*pFormatter, nFormat); + return nFormat; } } |