summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-10-30 00:57:57 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-10-30 01:03:56 +0100
commitce26903f7037c44a723716dfb38766ab9611c224 (patch)
tree05a033f3f2a6ef49fdcd3c91cbb909d3c52f24f9
parent29c5324696d863f0804405267f6787a4688122b8 (diff)
export icon set data into OOXML
missing are still the Excel2010 extLst entries Change-Id: Ic0c728613b1ee48482cbd9cef2aeccd0e0f25f72
-rw-r--r--sc/inc/colorscale.hxx16
-rw-r--r--sc/source/filter/excel/xecontent.cxx59
-rw-r--r--sc/source/filter/inc/xecontent.hxx14
3 files changed, 81 insertions, 8 deletions
diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 685fde1fc7d1..5907c6ee15e0 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -316,10 +316,6 @@ struct ScIconSetFormatData
class SC_DLLPUBLIC ScIconSetFormat : public ScColorFormat
{
-private:
- typedef boost::ptr_vector<ScColorScaleEntry>::iterator iterator;
- typedef boost::ptr_vector<ScColorScaleEntry>::const_iterator const_iterator;
-
public:
ScIconSetFormat(ScDocument* pDoc);
ScIconSetFormat(ScDocument* pDoc, const ScIconSetFormat& rFormat);
@@ -340,15 +336,19 @@ public:
static ScIconSetMap* getIconSetMap();
-#if DUMP_FORMAT_INFO
- virtual void dumpInfo(rtl::OUStringBuffer& rBuf) const;
-#endif
-private:
+ typedef boost::ptr_vector<ScColorScaleEntry>::iterator iterator;
+ typedef boost::ptr_vector<ScColorScaleEntry>::const_iterator const_iterator;
+
iterator begin();
const_iterator begin() const;
iterator end();
const_iterator end() const;
+#if DUMP_FORMAT_INFO
+ virtual void dumpInfo(rtl::OUStringBuffer& rBuf) const;
+#endif
+private:
+
double GetMinValue() const;
double GetMaxValue() const;
double CalcValue(double nMin, double nMax, ScIconSetFormat::const_iterator& itr) const;
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 219bbb84fcf5..91bd9186f6a5 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -988,6 +988,8 @@ XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat
maCFList.AppendNewRecord( new XclExpColorScale( GetRoot(), static_cast<const ScColorScaleFormat&>(*pFormatEntry), nIndex ) );
else if(pFormatEntry->GetType() == condformat::DATABAR)
maCFList.AppendNewRecord( new XclExpDataBar( GetRoot(), static_cast<const ScDataBarFormat&>(*pFormatEntry), nIndex, xExtLst ) );
+ else if(pFormatEntry->GetType() == condformat::ICONSET)
+ maCFList.AppendNewRecord( new XclExpIconSet( GetRoot(), static_cast<const ScIconSetFormat&>(*pFormatEntry), nIndex ) );
}
aScRanges.Format( msSeqRef, SCA_VALID, NULL, formula::FormulaGrammar::CONV_XL_A1 );
}
@@ -1173,6 +1175,63 @@ void XclExpDataBar::SaveXml( XclExpXmlStream& rStrm )
}
+XclExpIconSet::XclExpIconSet( const XclExpRoot& rRoot, const ScIconSetFormat& rFormat, sal_Int32 nPriority ):
+ XclExpRecord(),
+ XclExpRoot( rRoot ),
+ mrFormat( rFormat ),
+ mnPriority( nPriority )
+{
+ const ScRange* pRange = rFormat.GetRange().front();
+ ScAddress aAddr = pRange->aStart;
+ for(ScIconSetFormat::const_iterator itr = rFormat.begin();
+ itr != rFormat.end(); ++itr)
+ {
+ // exact position is not important, we allow only absolute refs
+
+ XclExpCfvoList::RecordRefType xCfvo( new XclExpCfvo( GetRoot(), *itr, aAddr ) );
+ maCfvoList.AppendRecord( xCfvo );
+ }
+}
+
+namespace {
+
+const char* getIconSetName( ScIconSetType eType )
+{
+ ScIconSetMap* pMap = ScIconSetFormat::getIconSetMap();
+ for(; pMap->pName; ++pMap)
+ {
+ if(pMap->eType == eType)
+ return pMap->pName;
+ }
+
+ return "";
+}
+
+}
+
+void XclExpIconSet::SaveXml( XclExpXmlStream& rStrm )
+{
+ sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
+
+ rWorksheet->startElement( XML_cfRule,
+ XML_type, "iconSet",
+ XML_priority, OString::valueOf( mnPriority + 1 ).getStr(),
+ FSEND );
+
+ const char* pIconSetName = getIconSetName(mrFormat.GetIconSetData()->eIconSetType);
+ rWorksheet->startElement( XML_iconSet,
+ XML_iconSet, pIconSetName,
+ FSEND );
+
+ maCfvoList.SaveXml( rStrm );
+
+ rWorksheet->endElement( XML_iconSet );
+ rWorksheet->endElement( XML_cfRule );
+
+ // OOXTODO: XML_extLst
+
+}
+
// ----------------------------------------------------------------------------
XclExpCondFormatBuffer::XclExpCondFormatBuffer( const XclExpRoot& rRoot, XclExtLstRef xExtLst ) :
diff --git a/sc/source/filter/inc/xecontent.hxx b/sc/source/filter/inc/xecontent.hxx
index 9417ab28b66b..b24533654c6d 100644
--- a/sc/source/filter/inc/xecontent.hxx
+++ b/sc/source/filter/inc/xecontent.hxx
@@ -277,6 +277,20 @@ private:
rtl::OString maGuid;
};
+class XclExpIconSet : public XclExpRecord, protected XclExpRoot
+{
+public:
+ explicit XclExpIconSet( const XclExpRoot& rRoot, const ScIconSetFormat& rFormat, sal_Int32 nPriority );
+
+ virtual void SaveXml( XclExpXmlStream& rStrm );
+private:
+ typedef XclExpRecordList< XclExpCfvo > XclExpCfvoList;
+
+ XclExpCfvoList maCfvoList;
+ const ScIconSetFormat& mrFormat;
+ sal_Int32 mnPriority;
+};
+
// ----------------------------------------------------------------------------
/** Contains all conditional formats of a specific sheet. */