[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Thu Mar 6 12:51:38 PST 2014
sc/source/core/data/column3.cxx | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
New commits:
commit 016a231ef0a6bfb3c4b74a0e6d6d7431f42755c1
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Feb 18 22:57:39 2014 -0500
fdo#72491: Always set input as text when that's requested.
Even when the text begins with '='.
(cherry picked from commit ca50752c34de4477c696471b707e1b8136e27661)
Conflicts:
sc/source/core/data/column3.cxx
Change-Id: I6e0a995f3042240b9f78068b5d0b9b758eb253ed
Reviewed-on: https://gerrit.libreoffice.org/8123
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index c19662e..4bd6a5a 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1185,6 +1185,19 @@ void ScColumn::StartListeningInArea( sc::StartListeningContext& rCxt, SCROW nRow
}
}
+namespace {
+
+void applyTextNumFormat( ScColumn& rCol, ScDocument& rDoc, SCROW nRow, SvNumberFormatter* pFormatter )
+{
+ sal_uInt32 nFormat = pFormatter->GetStandardFormat(NUMBERFORMAT_TEXT);
+ ScPatternAttr aNewAttrs(rDoc.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 String& rString,
formula::FormulaGrammar::AddressConvention eConv,
@@ -1217,6 +1230,12 @@ bool ScColumn::ParseString(
{
if ( rString.Len() == 1 ) // = Text
rCell.set(rString);
+ else if (aParam.meSetTextNumFormat == ScSetStringParam::Always)
+ {
+ // Set the cell format type to Text.
+ applyTextNumFormat(*this, *pDocument, nRow, aParam.mpNumFormatter);
+ rCell.set(rString);
+ }
else // = Formula
rCell.set(
new ScFormulaCell(
@@ -1325,11 +1344,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, *pDocument, nRow, aParam.mpNumFormatter);
}
rCell.set(rString);
More information about the Libreoffice-commits
mailing list