summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/column.hxx6
-rw-r--r--sc/source/core/data/column3.cxx14
-rw-r--r--sc/source/core/data/formulacell.cxx2
3 files changed, 14 insertions, 8 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 3f7493ea5fbd..bff5e621160e 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -331,10 +331,12 @@ public:
*/
ScFormulaCell* SetFormulaCell(
SCROW nRow, ScFormulaCell* pCell,
- sc::StartListeningType eListenType = sc::SingleCellListening );
+ sc::StartListeningType eListenType = sc::SingleCellListening,
+ bool bInheritNumFormatIfNeeded = true);
void SetFormulaCell(
sc::ColumnBlockPosition& rBlockPos, SCROW nRow, ScFormulaCell* pCell,
- sc::StartListeningType eListenType = sc::SingleCellListening );
+ sc::StartListeningType eListenType = sc::SingleCellListening,
+ bool bInheritNumFormatIfNeeded = true);
bool SetFormulaCells( SCROW nRow, std::vector<ScFormulaCell*>& rCells );
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index fc9f253e72fd..a3b3ca5efc3e 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1003,7 +1003,9 @@ public:
{
mrDestCol.SetFormulaCell(
maDestBlockPos, nSrcRow + mnRowOffset,
- new ScFormulaCell(rSrcCell, *mrDestCol.GetDoc(), aDestPos));
+ new ScFormulaCell(rSrcCell, *mrDestCol.GetDoc(), aDestPos),
+ sc::SingleCellListening,
+ rSrcCell.NeedsNumberFormat());
}
}
else if (bNumeric || bDateTime || bString)
@@ -1969,11 +1971,12 @@ void ScColumn::SetFormula( SCROW nRow, const OUString& rFormula, formula::Formul
}
ScFormulaCell* ScColumn::SetFormulaCell(
- SCROW nRow, ScFormulaCell* pCell, sc::StartListeningType eListenType )
+ SCROW nRow, ScFormulaCell* pCell, sc::StartListeningType eListenType,
+ bool bInheritNumFormatIfNeeded )
{
sc::CellStoreType::iterator it = GetPositionToInsert(nRow);
sal_uInt32 nCellFormat = GetNumberFormat(GetDoc()->GetNonThreadedContext(), nRow);
- if( (nCellFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
+ if( (nCellFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 && bInheritNumFormatIfNeeded )
pCell->SetNeedNumberFormat(true);
it = maCells.set(it, nRow, pCell);
maCellTextAttrs.set(nRow, sc::CellTextAttr());
@@ -1986,11 +1989,12 @@ ScFormulaCell* ScColumn::SetFormulaCell(
void ScColumn::SetFormulaCell(
sc::ColumnBlockPosition& rBlockPos, SCROW nRow, ScFormulaCell* pCell,
- sc::StartListeningType eListenType )
+ sc::StartListeningType eListenType,
+ bool bInheritNumFormatIfNeeded )
{
rBlockPos.miCellPos = GetPositionToInsert(rBlockPos.miCellPos, nRow);
sal_uInt32 nCellFormat = GetNumberFormat(GetDoc()->GetNonThreadedContext(), nRow);
- if( (nCellFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
+ if( (nCellFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 && bInheritNumFormatIfNeeded )
pCell->SetNeedNumberFormat(true);
rBlockPos.miCellPos = maCells.set(rBlockPos.miCellPos, nRow, pCell);
rBlockPos.miCellTextAttrPos = maCellTextAttrs.set(
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index e1a80effa3b3..40f5cbbd3ba6 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -817,7 +817,7 @@ ScFormulaCell::ScFormulaCell(const ScFormulaCell& rCell, ScDocument& rDoc, const
bInChangeTrack( false ),
bTableOpDirty( false ),
bNeedListening( false ),
- mbNeedsNumberFormat( false ),
+ mbNeedsNumberFormat( rCell.mbNeedsNumberFormat ),
mbAllowNumberFormatChange(false),
mbPostponedDirty(false),
mbIsExtRef(false),