diff options
Diffstat (limited to 'sc/source/core/data/column3.cxx')
-rw-r--r-- | sc/source/core/data/column3.cxx | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 60eb8e3e4340..f36dbd0e7c43 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -1448,13 +1448,22 @@ void ScColumn::SetEditText( SCROW nRow, const EditTextObject& rEditText, const S void ScColumn::SetFormula( SCROW nRow, const ScTokenArray& rArray, formula::FormulaGrammar::Grammar eGram ) { ScAddress aPos(nCol, nRow, nTab); - Insert(nRow, new ScFormulaCell(pDocument, aPos, &rArray, eGram)); + ScFormulaCell* pCell = new ScFormulaCell(pDocument, aPos, &rArray, eGram); + sal_uInt32 nCellFormat = GetNumberFormat( nRow ); + if( (nCellFormat % SV_COUNTRY_LANGUAGE_OFFSET) != 0) + pCell->SetNeedNumberFormat(true); + Insert(nRow, pCell); } void ScColumn::SetFormula( SCROW nRow, const OUString& rFormula, formula::FormulaGrammar::Grammar eGram ) { ScAddress aPos(nCol, nRow, nTab); - Insert(nRow, new ScFormulaCell(pDocument, aPos, rFormula, eGram)); + ScFormulaCell* pCell = new ScFormulaCell(pDocument, aPos, rFormula, eGram); + + sal_uInt32 nCellFormat = GetNumberFormat( nRow ); + if( (nCellFormat % SV_COUNTRY_LANGUAGE_OFFSET) != 0) + pCell->SetNeedNumberFormat(true); + Insert(nRow, pCell); } void ScColumn::SetFormulaCell( SCROW nRow, ScFormulaCell* pCell ) @@ -1696,6 +1705,11 @@ void ScColumn::GetString( SCROW nRow, OUString& rString ) const { ScRefCellValue aCell; aCell.assign(*maItems[nIndex].pCell); + + // ugly hack for ordering problem with GetNumberFormat and missing inherited formats + if(aCell.meType == CELLTYPE_FORMULA) + aCell.mpFormula->MaybeInterpret(); + sal_uLong nFormat = GetNumberFormat( nRow ); ScCellFormat::GetString(aCell, nFormat, rString, &pColor, *(pDocument->GetFormatTable())); } |