summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2015-03-30 01:17:44 +0200
committerJan Holesovsky <kendy@collabora.com>2015-04-09 11:39:34 +0200
commit69266499c95748be37c61fc5c0f63e2876480f6c (patch)
treecbea47c744834d07271588c5795587537505b6fe
parent9b7cf0af937af449caf02dac6561b81fb8cd1802 (diff)
implement last missing IconSet piece
Change-Id: I97fb3a2e8bc5abb68a07e4daab6492a4ffa5c52a
-rw-r--r--sc/source/ui/unoobj/condformatuno.cxx44
1 files changed, 43 insertions, 1 deletions
diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx
index 10a2e7869f42..0b81b5a81c94 100644
--- a/sc/source/ui/unoobj/condformatuno.cxx
+++ b/sc/source/ui/unoobj/condformatuno.cxx
@@ -1228,6 +1228,44 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScIconSetFormatObj::getProperty
return aRef;
}
+namespace {
+
+void setIconSetEntry(ScIconSetFormat* pFormat, uno::Reference<sheet::XIconSetEntry> xEntry, size_t nPos)
+{
+ ScIconSetFormatData* pData = pFormat->GetIconSetData();
+ ScColorScaleEntryType eType;
+ sal_Int32 nApiType = xEntry->getType();
+ bool bFound = false;
+ for (size_t i = 0; i < SAL_N_ELEMENTS(aIconSetEntryTypeMap); ++i)
+ {
+ if (aIconSetEntryTypeMap[i].nApiType == nApiType)
+ {
+ eType = aIconSetEntryTypeMap[i].eType;
+ bFound = true;
+ break;
+ }
+ }
+
+ if (!bFound)
+ throw lang::IllegalArgumentException();
+
+ pData->maEntries[nPos].SetType(eType);
+ switch (eType)
+ {
+ case COLORSCALE_FORMULA:
+ // TODO: Implement
+ break;
+ default:
+ {
+ double nVal = xEntry->getFormula().toDouble();
+ pData->maEntries[nPos].SetValue(nVal);
+ }
+ break;
+ }
+}
+
+}
+
void SAL_CALL ScIconSetFormatObj::setPropertyValue(
const OUString& aPropertyName, const uno::Any& aValue )
throw(beans::UnknownPropertyException, beans::PropertyVetoException,
@@ -1286,7 +1324,11 @@ void SAL_CALL ScIconSetFormatObj::setPropertyValue(
uno::Sequence<uno::Reference<sheet::XIconSetEntry> > aEntries;
if (aValue >>= aEntries)
{
-
+ sal_Int32 nLength = aEntries.getLength();
+ for (size_t i = 0; i < size_t(nLength); ++i)
+ {
+ setIconSetEntry(getCoreObject(), aEntries[i], i);
+ }
}
else
throw lang::IllegalArgumentException();