summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-02-18 22:57:39 -0500
committerCaolán McNamara <caolanm@redhat.com>2014-02-21 12:49:18 +0000
commit50b46373b06545b81c68efc9f183cc5670c8517a (patch)
tree0581017efc51b0278d3a226bd1b9abd63549af9a
parentde7ea676a51832d502b449b39809ce26299aa09a (diff)
fdo#72491: Always set input as text when that's requested.
Even when the text begins with '='. Change-Id: I6e0a995f3042240b9f78068b5d0b9b758eb253ed (cherry picked from commit ca50752c34de4477c696471b707e1b8136e27661) Reviewed-on: https://gerrit.libreoffice.org/8122 Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> (cherry picked from commit 563516fc10f1590a5987606de5444643b1b83747) Reviewed-on: https://gerrit.libreoffice.org/8130 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/source/core/data/column3.cxx25
1 files changed, 20 insertions, 5 deletions
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 13ee606901ea..50c52cee5ed8 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1492,6 +1492,19 @@ void ScColumn::StartListeningInArea( sc::StartListeningContext& rCxt, SCROW nRow
sc::ProcessFormula(maCells.begin(), maCells, nRow1, nRow2, aFunc);
}
+namespace {
+
+void applyTextNumFormat( ScColumn& rCol, SCROW nRow, SvNumberFormatter* pFormatter )
+{
+ sal_uInt32 nFormat = pFormatter->GetStandardFormat(NUMBERFORMAT_TEXT);
+ ScPatternAttr aNewAttrs(rCol.GetDoc().GetPool());
+ SfxItemSet& rSet = aNewAttrs.GetItemSet();
+ rSet.Put(SfxUInt32Item(ATTR_VALUE_FORMAT, nFormat));
+ rCol.ApplyPattern(nRow, aNewAttrs);
+}
+
+}
+
bool ScColumn::ParseString(
ScCellValue& rCell, SCROW nRow, SCTAB nTabP, const OUString& rString,
formula::FormulaGrammar::AddressConvention eConv,
@@ -1528,6 +1541,12 @@ bool ScColumn::ParseString(
{
rCell.set(rPool.intern(rString));
}
+ else if (aParam.meSetTextNumFormat == ScSetStringParam::Always)
+ {
+ // Set the cell format type to Text.
+ applyTextNumFormat(*this, nRow, aParam.mpNumFormatter);
+ rCell.set(rPool.intern(rString));
+ }
else // = Formula
rCell.set(
new ScFormulaCell(
@@ -1632,11 +1651,7 @@ bool ScColumn::ParseString(
if (aParam.meSetTextNumFormat != ScSetStringParam::Never && aParam.mpNumFormatter->IsNumberFormat(rString, nIndex, nVal))
{
// Set the cell format type to Text.
- sal_uInt32 nFormat = aParam.mpNumFormatter->GetStandardFormat(NUMBERFORMAT_TEXT);
- ScPatternAttr aNewAttrs(pDocument->GetPool());
- SfxItemSet& rSet = aNewAttrs.GetItemSet();
- rSet.Put( SfxUInt32Item(ATTR_VALUE_FORMAT, nFormat) );
- ApplyPattern(nRow, aNewAttrs);
+ applyTextNumFormat(*this, nRow, aParam.mpNumFormatter);
}
rCell.set(rPool.intern(rString));