summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-01-26 19:10:35 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-01-26 21:19:19 +0000
commitb1ba84efc38821d5d272448cb34af7519306b8ce (patch)
tree79030585aeba78705769eb5c064387c186f6d8cc /sc
parentfc388c1ff4ba005bbf784a083825f2070e66325e (diff)
handle entries with num type and formula during OOXML import, tdf#94626
Change-Id: I0d48120f2b128fb898c7cc55cc41ce52378851dc Reviewed-on: https://gerrit.libreoffice.org/21820 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/oox/condformatbuffer.cxx26
1 files changed, 18 insertions, 8 deletions
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 4ab87edf6271..4aeeaa9b15b4 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -104,18 +104,30 @@ const sal_uInt16 BIFF12_CFRULE_ABOVEAVERAGE = 0x0004;
const sal_uInt16 BIFF12_CFRULE_BOTTOM = 0x0008;
const sal_uInt16 BIFF12_CFRULE_PERCENT = 0x0010;
+bool isValue(const OUString& rStr, double& rVal)
+{
+ sal_Int32 nEnd = -1;
+ rVal = rtl::math::stringToDouble(rStr.trim(), '.', ',', nullptr, &nEnd);
+
+ if (nEnd < rStr.getLength())
+ return false;
+
+ return true;
+}
+
void SetCfvoData( ColorScaleRuleModelEntry* pEntry, const AttributeList& rAttribs )
{
OUString aType = rAttribs.getString( XML_type, OUString() );
+ OUString aVal = rAttribs.getString(XML_val, OUString());
- if( aType == "formula" )
+ double nVal = 0.0;
+ bool bVal = isValue(aVal, nVal);
+ if( !bVal || aType == "formula" )
{
- OUString aFormula = rAttribs.getString( XML_val, OUString() );
- pEntry->maFormula = aFormula;
+ pEntry->maFormula = aVal;
}
else
{
- double nVal = rAttribs.getDouble( XML_val, 0.0 );
pEntry->mnVal = nVal;
}
@@ -357,11 +369,9 @@ void IconSetRule::importAttribs( const AttributeList& rAttribs )
void IconSetRule::importFormula(const OUString& rFormula)
{
ColorScaleRuleModelEntry& rEntry = maEntries.back();
- if (rEntry.mbNum ||
- rEntry.mbPercent ||
- rEntry.mbPercentile)
+ double nVal = 0.0;
+ if ((rEntry.mbNum || rEntry.mbPercent || rEntry.mbPercentile) && isValue(rFormula, nVal))
{
- double nVal = rFormula.toDouble();
rEntry.mnVal = nVal;
}
else if (!rFormula.isEmpty())