diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-05-15 05:07:52 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-05-15 05:25:12 +0200 |
commit | c6c1a4a7a38eb13c45b6c865f310d797fc3f1152 (patch) | |
tree | a40d7dfd42aa189e42ad7ca5726bad931e207618 /sc | |
parent | 52077be6a1053f6c9c0118d6c116780fc27d43b5 (diff) |
support custom iconSet collections
Change-Id: If54afe3535dd20f77cab9d15ba2d575ddeb89986
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/colorscale.hxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/colorscale.cxx | 21 |
2 files changed, 23 insertions, 2 deletions
diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx index 593a662387d0..dd28d47f51e8 100644 --- a/sc/inc/colorscale.hxx +++ b/sc/inc/colorscale.hxx @@ -338,6 +338,10 @@ struct ScIconSetFormatData */ bool mbReverse; boost::ptr_vector<ScColorScaleEntry> maEntries; + bool mbCustom; + // the std::pair points to exactly one image + // std..pair::second == -1 means no image + std::vector<std::pair<ScIconSetType, sal_Int32> > maCustomVector; ScIconSetFormatData(): eIconSetType(IconSet_3Arrows), diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 9ef4aea7900d..cefb5cc962c3 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -1067,11 +1067,28 @@ ScIconSetInfo* ScIconSetFormat::GetIconSetInfo(const ScAddress& rAddr) const if(mpFormatData->mbReverse) { sal_Int32 nMaxIndex = mpFormatData->maEntries.size() - 1; - pInfo->nIconIndex = nMaxIndex - nIndex; + nIndex = nMaxIndex - nIndex; + } + + if (mpFormatData->mbCustom && sal_Int32(mpFormatData->maCustomVector.size()) > nIndex) + { + ScIconSetType eCustomType = mpFormatData->maCustomVector[nIndex].first; + sal_Int32 nCustomIndex = mpFormatData->maCustomVector[nIndex].second; + if (nCustomIndex == -1) + { + delete pInfo; + return NULL; + } + + pInfo->eIconSetType = eCustomType; + pInfo->nIconIndex = nCustomIndex; } else + { pInfo->nIconIndex = nIndex; - pInfo->eIconSetType = mpFormatData->eIconSetType; + pInfo->eIconSetType = mpFormatData->eIconSetType; + } + pInfo->mbShowValue = mpFormatData->mbShowValue; return pInfo; } |