summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2015-03-30 01:55:29 +0200
committerJan Holesovsky <kendy@collabora.com>2015-04-09 11:39:35 +0200
commit2b001f9bf1ea0304871411141058d13226f41048 (patch)
tree666447923197035d0ffdd70f65453b584b9355a7
parentadd color scale entries (diff)
downloadcore-2b001f9bf1ea0304871411141058d13226f41048.tar.gz
core-2b001f9bf1ea0304871411141058d13226f41048.zip
implement last part for color scales
Change-Id: Ieaca45d01b5e631e624016b58ab7964dc880725a
-rw-r--r--sc/source/ui/unoobj/condformatuno.cxx53
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");