diff options
author | Andrzej Hunt <andrzej@ahunt.org> | 2015-05-31 20:33:09 +0100 |
---|---|---|
committer | Andrzej Hunt <andrzej@ahunt.org> | 2015-10-20 18:18:36 +0200 |
commit | 83d34967bfe6940a5add4dc026bdf8c241c4706f (patch) | |
tree | a796a1e829dd6118bae0c3889fbbe255114914d2 | |
parent | e7ed7ee97ea99fc53cfc0049827672b1b01b4e3e (diff) |
Add Units::isValidUnit
Change-Id: Ibb9c6e0d713ceeaa4fc4c67467d76da2f6183502
-rw-r--r-- | sc/inc/units.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/units/unitsimpl.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/units/unitsimpl.hxx | 2 |
3 files changed, 10 insertions, 0 deletions
diff --git a/sc/inc/units.hxx b/sc/inc/units.hxx index 8e15af4a8a00..b428d40ec9a7 100644 --- a/sc/inc/units.hxx +++ b/sc/inc/units.hxx @@ -117,6 +117,8 @@ public: virtual RangeUnits getUnitsForRange(const ScRangeList& rRangeList, ScDocument* pDoc) = 0; + virtual bool isValidUnit(const OUString& rsUnit) = 0; + virtual ~Units() {} }; diff --git a/sc/source/core/units/unitsimpl.cxx b/sc/source/core/units/unitsimpl.cxx index fc4e899cf19c..e764aad6c2d7 100644 --- a/sc/source/core/units/unitsimpl.cxx +++ b/sc/source/core/units/unitsimpl.cxx @@ -883,4 +883,10 @@ RangeUnits UnitsImpl::getUnitsForRange(const ScRangeList& rRangeList, ScDocument return { aUnitsList, bCompatible }; } +bool UnitsImpl::isValidUnit(const OUString& rsUnit) { + UtUnit aUnit; + + return UtUnit::createUnit(rsUnit, aUnit, mpUnitSystem); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/units/unitsimpl.hxx b/sc/source/core/units/unitsimpl.hxx index 58e0971cfe68..176a34debc43 100644 --- a/sc/source/core/units/unitsimpl.hxx +++ b/sc/source/core/units/unitsimpl.hxx @@ -113,6 +113,8 @@ public: virtual RangeUnits getUnitsForRange(const ScRangeList& rRangeList, ScDocument* pDoc) SAL_OVERRIDE; + virtual bool isValidUnit(const OUString& rsUnit) SAL_OVERRIDE; + private: UnitsResult getOutputUnitsForOpCode(std::stack< RAUSItem >& rStack, const formula::FormulaToken* pToken, ScDocument* pDoc); |