diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-05-15 05:08:21 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-05-15 05:25:14 +0200 |
commit | 0abbb1172248574ae87bc91aa77eb2420be55152 (patch) | |
tree | bae2be2dde8beed1006811c3238ebd27e56e064b /sc | |
parent | c6c1a4a7a38eb13c45b6c865f310d797fc3f1152 (diff) |
import cusotm icon set collections from OOXML
Change-Id: I92c8a55d313cb1b066bd3ec8822b8a8edeb6b749
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/inc/condformatbuffer.hxx | 1 | ||||
-rw-r--r-- | sc/source/filter/oox/condformatbuffer.cxx | 41 | ||||
-rw-r--r-- | sc/source/filter/oox/condformatcontext.cxx | 1 |
3 files changed, 34 insertions, 9 deletions
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx index 3e6f05a90d28..5b41742e5520 100644 --- a/sc/source/filter/inc/condformatbuffer.hxx +++ b/sc/source/filter/inc/condformatbuffer.hxx @@ -131,6 +131,7 @@ public: void importCfvo( const AttributeList& rAttribs ); void importAttribs( const AttributeList& rAttribs ); void importFormula(const OUString& rFormula); + void importIcon(const AttributeList& rAttribs); void SetData( ScIconSetFormat* pFormat, ScDocument* pDoc, const ScAddress& rAddr ); diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index 7483a06ac605..2917e0871324 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -367,26 +367,49 @@ void IconSetRule::importFormula(const OUString& rFormula) rEntry.maFormula = rFormula; } +namespace { -void IconSetRule::SetData( ScIconSetFormat* pFormat, ScDocument* pDoc, const ScAddress& rPos ) +ScIconSetType getType(const OUString& rName) { - for(size_t i = 0; i < maEntries.size(); ++i) - { - ScColorScaleEntry* pModelEntry = ConvertToModel( maEntries[i], pDoc, rPos ); - mxFormatData->maEntries.push_back(pModelEntry); - } - ScIconSetType eIconSetType = IconSet_3TrafficLights1; ScIconSetMap* pIconSetMap = ScIconSetFormat::getIconSetMap(); for(size_t i = 0; pIconSetMap[i].pName; ++i) { - if(OUString::createFromAscii(pIconSetMap[i].pName) == maIconSetType) + if(OUString::createFromAscii(pIconSetMap[i].pName) == rName) { eIconSetType = pIconSetMap[i].eType; break; } } - mxFormatData->eIconSetType = eIconSetType; + + return eIconSetType; +} + +} + +void IconSetRule::importIcon(const AttributeList& rAttribs) +{ + OUString aIconSet = rAttribs.getString(XML_iconSet, OUString()); + sal_Int32 nIndex = rAttribs.getInteger(XML_iconId, -1); + if (aIconSet == "NoIcons") + { + nIndex = -1; + } + + ScIconSetType eIconSetType = getType(aIconSet); + mxFormatData->maCustomVector.push_back(std::pair<ScIconSetType, sal_Int32>(eIconSetType, nIndex)); +} + +void IconSetRule::SetData( ScIconSetFormat* pFormat, ScDocument* pDoc, const ScAddress& rPos ) +{ + for(size_t i = 0; i < maEntries.size(); ++i) + { + ScColorScaleEntry* pModelEntry = ConvertToModel( maEntries[i], pDoc, rPos ); + mxFormatData->maEntries.push_back(pModelEntry); + } + + mxFormatData->eIconSetType = getType(maIconSetType); + mxFormatData->mbCustom = mbCustom; pFormat->SetIconSetData(mxFormatData.release()); } diff --git a/sc/source/filter/oox/condformatcontext.cxx b/sc/source/filter/oox/condformatcontext.cxx index 08ce68b7ad75..5ba13c8bd833 100644 --- a/sc/source/filter/oox/condformatcontext.cxx +++ b/sc/source/filter/oox/condformatcontext.cxx @@ -143,6 +143,7 @@ void IconSetContext::onStartElement( const AttributeList& rAttribs ) mpIconSet->importCfvo( rAttribs ); break; case XLS14_TOKEN(cfIcon): + mpIconSet->importIcon(rAttribs); break; } } |