diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2015-03-30 01:55:29 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2015-03-30 04:34:33 +0200 |
commit | fc3e8355774a5e7ee524626bc50f2a39d4785c00 (patch) | |
tree | 64b859e95bcfe90433b4cdd6615dd6582fea5561 /sc/source/ui/unoobj/condformatuno.cxx | |
parent | 21e9287987e99b1c9a5b9af7ace1c3f8b3b888dd (diff) |
implement last part for color scales
Change-Id: Ieaca45d01b5e631e624016b58ab7964dc880725a
Diffstat (limited to 'sc/source/ui/unoobj/condformatuno.cxx')
-rw-r--r-- | sc/source/ui/unoobj/condformatuno.cxx | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx index e7295f950bfb..b3ff5c94e754 100644 --- a/sc/source/ui/unoobj/condformatuno.cxx +++ b/sc/source/ui/unoobj/condformatuno.cxx @@ -802,8 +802,46 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScColorScaleFormatObj::getPrope return aRef; } +namespace { + +void setColorScaleEntry(ScColorScaleEntry* pEntry, uno::Reference<sheet::XColorScaleEntry> xEntry) +{ + ScColorScaleEntryType eType; + sal_Int32 nApiType = xEntry->getType(); + bool bFound = false; + for (size_t i = 0; i < SAL_N_ELEMENTS(aColorScaleEntryTypeMap); ++i) + { + if (aColorScaleEntryTypeMap[i].nApiType == nApiType) + { + eType = aColorScaleEntryTypeMap[i].eType; + bFound = true; + break; + } + } + + if (!bFound) + throw lang::IllegalArgumentException(); + + pEntry->SetType(eType); + pEntry->SetColor(xEntry->getColor()); + switch (eType) + { + case COLORSCALE_FORMULA: + // TODO: Implement + break; + default: + { + double nVal = xEntry->getFormula().toDouble(); + pEntry->SetValue(nVal); + } + break; + } +} + +} + void SAL_CALL ScColorScaleFormatObj::setPropertyValue( - const OUString& aPropertyName, const uno::Any& /*aValue*/ ) + const OUString& aPropertyName, const uno::Any& aValue ) throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception) @@ -818,6 +856,19 @@ void SAL_CALL ScColorScaleFormatObj::setPropertyValue( switch(pEntry->nWID) { case ColorScaleEntries: + { + uno::Sequence<uno::Reference<sheet::XColorScaleEntry> > aEntries; + if (aValue >>= aEntries) + { + size_t n = size_t(aEntries.getLength()); + for (size_t i = 0; i < n; ++i) + { + setColorScaleEntry(getCoreObject()->GetEntry(i), aEntries[i]); + } + } + else + throw lang::IllegalArgumentException(); + } break; default: SAL_WARN("sc", "unknown property"); |