Commit f8fcdb34 authored by konovalovsergey's avatar konovalovsergey Committed by Alexander Trofimov

add open/save sparkline

parent 59554c12
......@@ -150,7 +150,8 @@ SOURCES += docxformatlib.cpp \
../Source/Utility/DateTime.cpp \
../Source/Utility/TxtFile.cpp \
../Source/Base/unicode_util.cpp \
../../3dParty/pole/pole.cpp
../../3dParty/pole/pole.cpp \
../Source/DocxFormat/Drawing/DrawingExt.cpp
HEADERS += docxformatlib.h \
../Source/Base/Base.h \
......@@ -347,7 +348,8 @@ HEADERS += docxformatlib.h \
../Source/MathEquation/Types.h \
../Source/Base/unicode_util.h \
../Source/XlsxFormat/ExternalLinks/ExternalLinkPath.h \
../Source/XlsxFormat/ExternalLinks/ExternalLinks.h
../Source/XlsxFormat/ExternalLinks/ExternalLinks.h \
../Source/XlsxFormat/Worksheets/Sparkline.h
unix {
target.path = /usr/lib
INSTALLS += target
......
#include "DrawingExt.h"
#include "../../XlsxFormat/Worksheets/Sparkline.h"
namespace OOX
{
namespace Drawing
{
void COfficeArtExtension::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ((m_oUri.IsInit()) && (*m_oUri == _T("{63B3BB69-23CF-44E3-9099-C40C66FF867C}") || *m_oUri == _T("{05C60535-1F16-4fd2-B633-F4F36F0B64E0}")))//2.2.6.2 Legacy Object Wrapper
{
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CString sName = XmlUtils::GetNameNoNS(oReader.GetName());
if (sName == _T("compatExt"))//2.3.1.2 compatExt
{ //attributes spid -https://msdn.microsoft.com/en-us/library/hh657207(v=office.12).aspx
m_oCompatExt = oReader;
}
else if (sName == _T("sparklineGroups"))
{
m_oSparklineGroups = oReader;
}
}
}
else
{
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
}
CString COfficeArtExtension::toXML() const
{
return toXMLWithNS(_T("a:"));
}
CString COfficeArtExtension::toXMLWithNS(const CString& sNamespace) const
{
CString sResult = _T("<");
sResult += sNamespace;
sResult += _T("ext");
sResult += m_sAdditionalNamespace;
if ( m_oUri.IsInit() )
{
sResult += _T(" uri=\"");
sResult += m_oUri->GetString();
sResult += _T("\">");
}
else
sResult += _T(">");
if(m_oCompatExt.IsInit())
{
sResult += m_oCompatExt->toXML();
}
if(m_oSparklineGroups.IsInit())
{
XmlUtils::CStringWriter writer;
m_oSparklineGroups->toXML(writer);
sResult += writer.GetData();
}
sResult += _T("</");
sResult += sNamespace;
sResult += _T("ext>");
return sResult;
}
}
}
......@@ -7,19 +7,20 @@
namespace OOX
{
namespace Spreadsheet
{
class CSparklineGroups;
}
namespace Drawing
{
//--------------------------------------------------------------------------------
// COfficeArtExtension 20.1.2.2.14 (Part 1)
//--------------------------------------------------------------------------------
class COfficeArtExtension : public WritingElement
class CCompatExt : public WritingElement
{
public:
WritingElement_AdditionConstructors(COfficeArtExtension)
COfficeArtExtension()
WritingElement_AdditionConstructors(CCompatExt)
CCompatExt()
{
}
virtual ~COfficeArtExtension()
virtual ~CCompatExt()
{
}
......@@ -27,49 +28,64 @@ namespace OOX
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("uri"), m_oUri );
//todo
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ((m_oUri.IsInit()) && (*m_oUri == _T("{63B3BB69-23CF-44E3-9099-C40C66FF867C}")))//2.2.6.2 Legacy Object Wrapper
{
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CString sName = XmlUtils::GetNameNoNS(oReader.GetName());
if (sName == _T("compatExt"))//2.3.1.2 compatExt
{ //attributes spid -https://msdn.microsoft.com/en-us/library/hh657207(v=office.12).aspx
ReadAttributes( oReader );
}
}
}
else
{
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
CString sResult = _T("<a:ext ");
if ( m_oUri.IsInit() )
{
sResult += _T("uri=\"");
sResult += m_oUri->GetString();
sResult += _T("\">");
}
else
sResult += _T(">");
return _T("");
}
virtual EElementType getType() const
{
return OOX::et_a_compatExt;
}
sResult += _T("</a:ext>");
private:
return sResult;
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if( oReader, _T("spid"), m_sSpId )
WritingElement_ReadAttributes_End( oReader )
}
public:
// Attributes
nullable<CString> m_sSpId;
// Childs
};
//--------------------------------------------------------------------------------
// COfficeArtExtension 20.1.2.2.14 (Part 1)
//--------------------------------------------------------------------------------
class COfficeArtExtension : public WritingElement
{
public:
WritingElement_AdditionConstructors(COfficeArtExtension)
COfficeArtExtension()
{
}
virtual ~COfficeArtExtension()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("uri"), m_oUri );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual CString toXML() const;
CString toXMLWithNS(const CString& sNamespace) const;
virtual EElementType getType() const
{
return OOX::et_a_ext;
......@@ -82,7 +98,6 @@ namespace OOX
// Читаем атрибуты
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if( oReader, _T("uri"), m_oUri )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("spid"), m_sSpId )
WritingElement_ReadAttributes_End( oReader )
}
......@@ -90,9 +105,11 @@ namespace OOX
// Attributes
nullable<CString> m_oUri;
nullable<CString> m_sSpId;
CString m_sAdditionalNamespace;
// Childs
nullable<CCompatExt> m_oCompatExt;
nullable<OOX::Spreadsheet::CSparklineGroups> m_oSparklineGroups;
};
//--------------------------------------------------------------------------------
// COfficeArtExtensionList 20.1.2.2.15 (Part 1)
......@@ -128,8 +145,8 @@ namespace OOX
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CString sName = oReader.GetName();
if ( _T("a:ext") == sName )
CString sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("ext") == sName )
{
OOX::Drawing::COfficeArtExtension *oExt = new OOX::Drawing::COfficeArtExtension(oReader);
if (oExt) m_arrExt.push_back( oExt );
......@@ -137,16 +154,24 @@ namespace OOX
}
}
virtual CString toXML() const
{
return toXMLWithNS(_T("a:"));
}
CString toXMLWithNS(const CString& sNamespace) const
{
CString sResult = _T("<a:extLst>");
CString sResult = _T("<");
sResult += sNamespace;
sResult += _T("extLst>");
for ( unsigned int nIndex = 0; nIndex < m_arrExt.size(); nIndex++ )
{
if (m_arrExt[nIndex])
sResult += m_arrExt[nIndex]->toXML();
sResult += m_arrExt[nIndex]->toXMLWithNS(sNamespace);
}
sResult += _T("</a:extLst>");
sResult += _T("</");
sResult += sNamespace;
sResult += _T("extLst>");
return sResult;
}
......
......@@ -163,6 +163,7 @@ namespace OOX
et_a_effectRef, // <a:effectRef>
et_a_effectStyle, // <a:effectStyle>
et_a_effectStyleLst, // <a:effectStyleLst>
et_a_compatExt,
et_a_ext, // <a:ext>
et_a_extLst, // <a:extLst>
et_a_extraClrScheme, // <a:extraClrScheme>
......
......@@ -420,6 +420,9 @@ namespace OOX{
class AlternateContentChoice;
class AlternateContentFallback;
class CTextProperties;
bool FromXml_ST_DispBlanksAs(CString& val, ST_DispBlanksAs& eOut);
bool ToXml_ST_DispBlanksAs(ST_DispBlanksAs& val, CString& sOut);
///////////////////////////////////////////////////
class CT_extLst
{
......
#pragma once
#pragma once
#ifndef OOX_CELLANCHOR_FILE_INCLUDE_H_
#define OOX_CELLANCHOR_FILE_INCLUDE_H_
......@@ -101,11 +101,11 @@ namespace OOX
if ((m_oGraphicFrame.IsInit()) && (m_oGraphicFrame->m_oChartGraphic.IsInit()) &&
(m_oGraphicFrame->m_oChartGraphic->m_oGraphicData.IsInit()))
{
// ( )
//вытащим выше ссылку на объект (для удобства)
m_sSpId = m_oGraphicFrame->m_oChartGraphic->m_oGraphicData->m_sSpId;
}
}
// ... xml !!!!
//Так читать правильнее ... но для совместимости нужно хранить и все xml !!!!
//else if (_T("pic") == sName )
// m_oPicture = oReader;
//else if (_T("sp") == sName)
......@@ -121,7 +121,7 @@ namespace OOX
m_oXml = oReader.GetOuterXml();
{
XmlUtils::CXmlLiteReader oShapeReader;
// xml-
//сформируем полноценную xml-строку
CString xmlString;// = L"<?xml version=\"1.0\"?>";// encoding=\"UTF-8\"
xmlString += L"<root ";
xmlString += L"xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" ";
......@@ -141,19 +141,20 @@ namespace OOX
if (_T("pic") == sName)
m_oPicture = oShapeReader;
else if (_T("sp") == sName)
{ // , , xml
// pptx:DrawingObjectConverter -
{ //тут может быть не полноценный объект, а ссылка на него, следовательно и xml что выше для
// pptx:DrawingObjectConverter будет не правильная - сотрем ее
m_oShape = oShapeReader;
if ((m_oShape.IsInit()) && (m_oShape->m_oNvSpPr.IsInit()) &&
(m_oShape->m_oNvSpPr->m_oCNvPr.IsInit()) && (m_oShape->m_oNvSpPr->m_oCNvPr->m_oExtLst.IsInit()))
{
for (int i=0; i < m_oShape->m_oNvSpPr->m_oCNvPr->m_oExtLst->m_arrExt.size();i++)
{
if (m_oShape->m_oNvSpPr->m_oCNvPr->m_oExtLst->m_arrExt[i]->m_sSpId.IsInit())
OOX::Drawing::COfficeArtExtension* pExt = m_oShape->m_oNvSpPr->m_oCNvPr->m_oExtLst->m_arrExt[i];
if (pExt->m_oCompatExt.IsInit() && pExt->m_oCompatExt->m_sSpId.IsInit())
{
// -> "" ( )
//собственно это и есть ссылка на обеъект -> переложим ее "повыше" (для удобства)
m_oXml.reset();
m_sSpId = m_oShape->m_oNvSpPr->m_oCNvPr->m_oExtLst->m_arrExt[i]->m_sSpId;
m_sSpId = pExt->m_oCompatExt->m_sSpId;
}
}
}
......@@ -167,8 +168,8 @@ namespace OOX
else if ( _T("AlternateContent") == sName)
{
//Demo-2010WinterOlympics2.xlsx
// - ...
//todooo fallback, (a14, ..)
//вариативность на разные версии офиса части параметров - кстати ... это может встретиться в ЛЮБОМ месте
//todooo сделать чтение не обязательно fallback, по выбору версии нужной нам (a14, ..)
{
nCurDepth++;
while( oReader.ReadNextSiblingNode( nCurDepth ) )
......@@ -242,10 +243,10 @@ namespace OOX
nullable<OOX::Spreadsheet::CShape> m_oShape;
nullable<OOX::Spreadsheet::CConnShape> m_oConnShape;
// pptx:ObjectDrawingConverter
// для pptx:ObjectDrawingConverter
nullable<CString> m_oXml;
//
//для удобства
nullable<CString> m_sSpId;
};
} //Spreadsheet
......
......@@ -2283,5 +2283,77 @@ namespace SimpleTypes
SimpleType_Operator_Equal (ST_CfvoType)
};
enum ESparklineType
{
Line = 0,
Column = 1,
Stacked = 2
};
template<ESparklineType eDefValue = Line>
class ST_SparklineType : public CSimpleType<ESparklineType, eDefValue>
{
public:
ST_SparklineType() {}
virtual ESparklineType FromString(CString &sValue)
{
if(_T("line") == sValue) this->m_eValue = Line;
else if(_T("column") == sValue) this->m_eValue = Column;
else if(_T("stacked") == sValue) this->m_eValue = Stacked;
else this->m_eValue = eDefValue;
return this->m_eValue;
}
virtual CString ToString () const
{
switch(this->m_eValue)
{
case Line: return _T("line"); break;
case Column: return _T("column"); break;
case Stacked: return _T("stacked"); break;
default : return _T("line");
}
}
SimpleType_FromString (ESparklineType)
SimpleType_Operator_Equal (ST_SparklineType)
};
enum ESparklineAxisMinMax
{
Individual = 0,
Group = 1,
Custom = 2
};
template<ESparklineAxisMinMax eDefValue = Individual>
class ST_SparklineAxisMinMax : public CSimpleType<ESparklineAxisMinMax, eDefValue>
{
public:
ST_SparklineAxisMinMax() {}
virtual ESparklineAxisMinMax FromString(CString &sValue)
{
if(_T("individual") == sValue) this->m_eValue = Individual;
else if(_T("group") == sValue) this->m_eValue = Group;
else if(_T("custom") == sValue) this->m_eValue = Custom;
else this->m_eValue = eDefValue;
return this->m_eValue;
}
virtual CString ToString () const
{
switch(this->m_eValue)
{
case Individual: return _T("individual"); break;
case Group: return _T("group"); break;
case Custom: return _T("custom"); break;
default: return _T("individual");
}
}
SimpleType_FromString (ESparklineAxisMinMax)
SimpleType_Operator_Equal (ST_SparklineAxisMinMax)
};
};// Spreadsheet
} // SimpleTypes
#pragma once
#ifndef OOX_SPARKLINE_FILE_INCLUDE_H_
#define OOX_SPARKLINE_FILE_INCLUDE_H_
#include "../CommonInclude.h"
#include "../Chart/ChartSerialize.h"
#include "../Styles/rPr.h"
namespace OOX
{
namespace Spreadsheet
{
class CSparkline : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CSparkline)
CSparkline()
{
}
virtual ~CSparkline()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
{
writer.WriteString(_T("<x14:sparkline>"));
if(m_oRef.IsInit())
{
writer.WriteString(_T("<xm:f>"));
writer.WriteString(m_oRef.get());
writer.WriteString(_T("</xm:f>"));
}
if(m_oSqRef.IsInit())
{
writer.WriteString(_T("<xm:sqref>"));
writer.WriteString(m_oSqRef.get());
writer.WriteString(_T("</xm:sqref>"));
}
writer.WriteString(_T("</x14:sparkline>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CString sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("f") == sName )
m_oRef = oReader.GetText2().GetString();
else if ( _T("sqref") == sName )
m_oSqRef = oReader.GetText2().GetString();
}
}
virtual EElementType getType () const
{
return et_Sparkline;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
}
public:
nullable<CString> m_oRef;
nullable<CString> m_oSqRef;
};
class CSparklines : public WritingElementWithChilds<CSparkline>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CSparklines)
CSparklines()
{
}
virtual ~CSparklines()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
{
writer.WriteString(_T("<x14:sparklines>"));
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
m_arrItems[i]->toXML(writer);
writer.WriteString(_T("</x14:sparklines>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CString sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("sparkline") == sName )
m_arrItems.push_back(new CSparkline( oReader ));
}
}
virtual EElementType getType () const
{
return et_Sparklines;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
}
};
class CSparklineGroup : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CSparklineGroup)
CSparklineGroup()
{
}
virtual ~CSparklineGroup()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
{
writer.WriteString(_T("<x14:sparklineGroup"));
if(m_oManualMax.IsInit())
{
writer.WriteString(_T(" manualMax=\""));
writer.WriteString(m_oManualMax->ToString());
writer.WriteString(_T("\""));
}
if(m_oManualMin.IsInit())
{
writer.WriteString(_T(" manualMin=\""));
writer.WriteString(m_oManualMin->ToString());
writer.WriteString(_T("\""));
}
if(m_oLineWeight.IsInit())
{
writer.WriteString(_T(" lineWeight=\""));
writer.WriteString(m_oLineWeight->ToString());
writer.WriteString(_T("\""));
}
if(m_oType.IsInit())
{
writer.WriteString(_T(" type=\""));
writer.WriteString(m_oType->ToString());
writer.WriteString(_T("\""));
}
if(m_oDateAxis.IsInit())
{
writer.WriteString(_T(" dateAxis=\""));
writer.WriteString(m_oDateAxis->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(_T("\""));
}
if(m_oDisplayEmptyCellsAs.IsInit())
{
writer.WriteString(_T(" displayEmptyCellsAs=\""));
CString sVal;
ToXml_ST_DispBlanksAs(m_oDisplayEmptyCellsAs.get2(), sVal);
writer.WriteString(sVal);
writer.WriteString(_T("\""));
}
if(m_oMarkers.IsInit())
{
writer.WriteString(_T(" markers=\""));
writer.WriteString(m_oMarkers->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(_T("\""));
}
if(m_oHigh.IsInit())
{
writer.WriteString(_T(" high=\""));
writer.WriteString(m_oHigh->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(_T("\""));
}
if(m_oLow.IsInit())
{
writer.WriteString(_T(" low=\""));
writer.WriteString(m_oLow->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(_T("\""));
}
if(m_oFirst.IsInit())
{
writer.WriteString(_T(" first=\""));
writer.WriteString(m_oFirst->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(_T("\""));
}
if(m_oLast.IsInit())
{
writer.WriteString(_T(" last=\""));
writer.WriteString(m_oLast->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(_T("\""));
}
if(m_oNegative.IsInit())
{
writer.WriteString(_T(" negative=\""));
writer.WriteString(m_oNegative->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(_T("\""));
}
if(m_oDisplayXAxis.IsInit())
{
writer.WriteString(_T(" displayXAxis=\""));
writer.WriteString(m_oDisplayXAxis->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(_T("\""));
}
if(m_oDisplayHidden.IsInit())
{
writer.WriteString(_T(" displayHidden=\""));
writer.WriteString(m_oDisplayHidden->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(_T("\""));
}
if(m_oMinAxisType.IsInit())
{
writer.WriteString(_T(" minAxisType=\""));
writer.WriteString(m_oMinAxisType->ToString());
writer.WriteString(_T("\""));
}
if(m_oMaxAxisType.IsInit())
{
writer.WriteString(_T(" maxAxisType=\""));
writer.WriteString(m_oMaxAxisType->ToString());
writer.WriteString(_T("\""));
}
if(m_oRightToLeft.IsInit())
{
writer.WriteString(_T(" rightToLeft=\""));
writer.WriteString(m_oRightToLeft->ToString2(SimpleTypes::onofftostring1));
writer.WriteString(_T("\""));
}
writer.WriteString(_T(">"));
if(m_oColorSeries.IsInit())
{
m_oColorSeries->toXML2(writer, _T("x14:colorSeries"));
}
if(m_oColorNegative.IsInit())
{
m_oColorNegative->toXML2(writer, _T("x14:colorNegative"));
}
if(m_oColorAxis.IsInit())
{
m_oColorAxis->toXML2(writer, _T("x14:colorAxis"));
}
if(m_oColorMarkers.IsInit())
{
m_oColorMarkers->toXML2(writer, _T("x14:colorMarkers"));
}
if(m_oColorFirst.IsInit())
{
m_oColorFirst->toXML2(writer, _T("x14:colorFirst"));
}
if(m_oColorLast.IsInit())
{
m_oColorLast->toXML2(writer, _T("x14:colorLast"));
}
if(m_oColorHigh.IsInit())
{
m_oColorHigh->toXML2(writer, _T("x14:colorHigh"));
}
if(m_oColorLow.IsInit())
{
m_oColorLow->toXML2(writer, _T("x14:colorLow"));
}
if(m_oRef.IsInit())
{
writer.WriteString(_T("<xm:f>"));
writer.WriteString(m_oRef.get());
writer.WriteString(_T("</xm:f>"));
}
if(m_oSparklines.IsInit())
{
m_oSparklines->toXML(writer);
}
writer.WriteString(_T("</x14:sparklineGroup>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CString sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("colorSeries") == sName )
m_oColorSeries = oReader;
else if ( _T("colorNegative") == sName )
m_oColorNegative = oReader;
else if ( _T("colorAxis") == sName )
m_oColorAxis = oReader;
else if ( _T("colorMarkers") == sName )
m_oColorMarkers = oReader;
else if ( _T("colorFirst") == sName )
m_oColorFirst = oReader;
else if ( _T("colorLast") == sName )
m_oColorLast = oReader;
else if ( _T("colorHigh") == sName )
m_oColorHigh = oReader;
else if ( _T("colorLow") == sName )
m_oColorLow = oReader;
else if ( _T("f") == sName )
m_oRef = oReader.GetText2().GetString();
else if ( _T("sparklines") == sName )
m_oSparklines = oReader;
}
}
virtual EElementType getType () const
{
return et_SparklineGroup;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// ������ ��������
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("manualMax"), m_oManualMax )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("manualMin"), m_oManualMin )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("lineWeight"), m_oLineWeight )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("type"), m_oType )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("dateAxis"), m_oDateAxis )
else if(_T("displayEmptyCellsAs") == wsName)
{
ST_DispBlanksAs eVal;
CString sNodeName = oReader.GetText();
if(FromXml_ST_DispBlanksAs(sNodeName, eVal))
{
m_oDisplayEmptyCellsAs.Init();
m_oDisplayEmptyCellsAs.get2() = eVal;
}
}
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("markers"), m_oMarkers )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("high"), m_oHigh )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("low"), m_oLow )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("first"), m_oFirst )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("last"), m_oLast )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("negative"), m_oNegative )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("displayXAxis"), m_oDisplayXAxis )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("displayHidden"), m_oDisplayHidden )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("minAxisType"), m_oMinAxisType )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("maxAxisType"), m_oMaxAxisType )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("rightToLeft"), m_oRightToLeft )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CDouble> m_oManualMax;
nullable<SimpleTypes::CDouble> m_oManualMin;
nullable<SimpleTypes::CDouble> m_oLineWeight;
nullable<SimpleTypes::Spreadsheet::ST_SparklineType<>> m_oType;
nullable<SimpleTypes::COnOff<>> m_oDateAxis;
nullable<OOX::Spreadsheet::ST_DispBlanksAs> m_oDisplayEmptyCellsAs;
nullable<SimpleTypes::COnOff<>> m_oMarkers;
nullable<SimpleTypes::COnOff<>> m_oHigh;
nullable<SimpleTypes::COnOff<>> m_oLow;
nullable<SimpleTypes::COnOff<>> m_oFirst;
nullable<SimpleTypes::COnOff<>> m_oLast;
nullable<SimpleTypes::COnOff<>> m_oNegative;
nullable<SimpleTypes::COnOff<>> m_oDisplayXAxis;
nullable<SimpleTypes::COnOff<>> m_oDisplayHidden;
nullable<SimpleTypes::Spreadsheet::ST_SparklineAxisMinMax<>> m_oMinAxisType;
nullable<SimpleTypes::Spreadsheet::ST_SparklineAxisMinMax<>> m_oMaxAxisType;
nullable<SimpleTypes::COnOff<>> m_oRightToLeft;
nullable<OOX::Spreadsheet::CColor> m_oColorSeries;
nullable<OOX::Spreadsheet::CColor> m_oColorNegative;
nullable<OOX::Spreadsheet::CColor> m_oColorAxis;
nullable<OOX::Spreadsheet::CColor> m_oColorMarkers;
nullable<OOX::Spreadsheet::CColor> m_oColorFirst;
nullable<OOX::Spreadsheet::CColor> m_oColorLast;
nullable<OOX::Spreadsheet::CColor> m_oColorHigh;
nullable<OOX::Spreadsheet::CColor> m_oColorLow;
nullable<CString> m_oRef;
nullable<CSparklines> m_oSparklines;
};
class CSparklineGroups : public WritingElementWithChilds<CSparklineGroup>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CSparklineGroups)
CSparklineGroups()
{
}
virtual ~CSparklineGroups()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(XmlUtils::CStringWriter& writer) const
{
writer.WriteString(_T("<x14:sparklineGroups xmlns:xm=\"http://schemas.microsoft.com/office/excel/2006/main\">"));
for(unsigned int i = 0, length = m_arrItems.size(); i < length; ++i)
m_arrItems[i]->toXML(writer);
writer.WriteString(_T("</x14:sparklineGroups>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CString sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("sparklineGroup") == sName )
m_arrItems.push_back(new CSparklineGroup( oReader ));
}
}
virtual EElementType getType () const
{
return et_SparklineGroups;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
}
};
} //Spreadsheet
} // namespace OOX
#endif // OOX_SPARKLINE_FILE_INCLUDE_H_
......@@ -124,6 +124,8 @@ namespace OOX
m_oLegacyDrawingWorksheet = oReader;
else if (_T("sheetPr") == sName)
m_oSheetPr = oReader;
else if (_T("extLst") == sName)
m_oExtLst = oReader;
}
}
if(m_oLegacyDrawingWorksheet.IsInit() && m_oLegacyDrawingWorksheet->m_oId.IsInit())
......@@ -336,6 +338,8 @@ namespace OOX
m_oLegacyDrawingWorksheet->toXML(sXml);
if(m_oTableParts.IsInit())
m_oTableParts->toXML(sXml);
if(m_oExtLst.IsInit())
sXml.WriteString(m_oExtLst->toXMLWithNS(_T("")));
sXml.WriteString(_T("</worksheet>"));
CDirectory::SaveToFile( oPath.GetPath(), sXml.GetData() );
......@@ -503,6 +507,8 @@ namespace OOX
std::map<CString, CCommentItem*> m_mapComments;
std::vector<OOX::Spreadsheet::CConditionalFormatting*> m_arrConditionalFormatting;
nullable<OOX::Spreadsheet::CSheetPr> m_oSheetPr;
nullable<OOX::Drawing::COfficeArtExtensionList> m_oExtLst;
};
} //Spreadsheet
} // namespace OOX
......
......@@ -322,7 +322,12 @@ namespace Spreadsheet
et_ConnectionNonVisualGraphicFrameProps,
et_GraphicChart,
et_ChartTextProperties,
et_ChartRichText
et_ChartRichText,
et_SparklineGroups,
et_SparklineGroup,
et_Sparklines,
et_Sparkline
};
class WritingElement
......
......@@ -200,7 +200,8 @@ namespace BinXlsxRW
ConditionalFormatting = 21,
SheetViews = 22,
SheetView = 23,
SheetPr = 24
SheetPr = 24,
SparklineGroups = 25
};}
namespace c_oSerWorksheetPropTypes{enum c_oSerWorksheetPropTypes
{
......@@ -726,6 +727,41 @@ namespace BinXlsxRW
TabColor = 9
};}
namespace c_oSer_Sparkline{enum c_oSer_Sparkline
{
SparklineGroup = 0,
ManualMax = 1,
ManualMin = 2,
LineWeight = 3,
Type = 4,
DateAxis = 5,
DisplayEmptyCellsAs = 6,
Markers = 7,
High = 8,
Low = 9,
First = 10,
Last = 11,
Negative = 12,
DisplayXAxis = 13,
DisplayHidden = 14,
MinAxisType = 15,
MaxAxisType = 16,
RightToLeft = 17,
ColorSeries = 18,
ColorNegative = 19,
ColorAxis = 20,
ColorMarkers = 21,
ColorFirst = 22,
ColorLast = 23,
ColorHigh = 24,
ColorLow = 25,
Ref = 26,
Sparklines = 27,
Sparkline = 28,
SparklineRef = 29,
SparklineSqRef = 30
};}
}
#endif //
......@@ -694,7 +694,7 @@ namespace BinXlsxRW {
m_oBcw.m_oStream.WriteBYTE(c_oSerBorderPropTypes::Color);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
nCurPos = m_oBcw.WriteItemWithLengthStart();
m_oBcw.WriteColor(borderProp.m_oColor.get(), pIndexedColors, pTheme);
m_oBcw.WriteColor(borderProp.m_oColor.get(), pIndexedColors);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
//Style
......@@ -934,7 +934,7 @@ namespace BinXlsxRW {
{
nCurPos = m_oBcw.WriteItemStart(c_oSerFillTypes::PatternFill);
int nCurPos2 = m_oBcw.WriteItemStart(c_oSerFillTypes::PatternFillBgColor);
m_oBcw.WriteColor(*pColor, pIndexedColors, pTheme);
m_oBcw.WriteColor(*pColor, pIndexedColors);
m_oBcw.WriteItemEnd(nCurPos2);
m_oBcw.WriteItemEnd(nCurPos);
}
......@@ -966,7 +966,7 @@ namespace BinXlsxRW {
m_oBcw.m_oStream.WriteBYTE(c_oSerFontTypes::Color);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
nCurPos = m_oBcw.WriteItemWithLengthStart();
m_oBcw.WriteColor(font.m_oColor.get(), pIndexedColors, theme);
m_oBcw.WriteColor(font.m_oColor.get(), pIndexedColors);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
//Italic
......@@ -1349,7 +1349,7 @@ namespace BinXlsxRW {
m_oBcw.m_oStream.WriteBYTE(c_oSerFontTypes::Color);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
nCurPos = m_oBcw.WriteItemWithLengthStart();
m_oBcw.WriteColor(rPr.m_oColor.get(), pIndexedColors, pTheme);
m_oBcw.WriteColor(rPr.m_oColor.get(), pIndexedColors);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
//Italic
......@@ -1786,6 +1786,19 @@ namespace BinXlsxRW {
WriteSheetPr(oWorksheet.m_oSheetPr.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (oWorksheet.m_oExtLst.IsInit())
{
for(size_t i = 0; i < oWorksheet.m_oExtLst->m_arrExt.size(); ++i)
{
OOX::Drawing::COfficeArtExtension* pExt = oWorksheet.m_oExtLst->m_arrExt[i];
if(pExt->m_oSparklineGroups.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerWorksheetsTypes::SparklineGroups);
WriteSparklineGroups(pExt->m_oSparklineGroups.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
}
};
void WriteWorksheetProp(OOX::Spreadsheet::CSheet& oSheet)
{
......@@ -2889,7 +2902,7 @@ namespace BinXlsxRW {
if (oSheetPr.m_oTabColor.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_SheetPr::TabColor);
m_oBcw.WriteColor(oSheetPr.m_oTabColor.get(), m_pIndexedColors, m_pTheme);
m_oBcw.WriteColor(oSheetPr.m_oTabColor.get(), m_pIndexedColors);
m_oBcw.WriteItemEnd(nCurPos);
}
}
......@@ -3080,7 +3093,7 @@ namespace BinXlsxRW {
if (NULL != pColor)
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_ConditionalFormattingRuleColorScale::Color);
m_oBcw.WriteColor(*pColor, m_pIndexedColors, m_pTheme);
m_oBcw.WriteColor(*pColor, m_pIndexedColors);
m_oBcw.WriteItemEnd(nCurPos);
continue;
}
......@@ -3111,7 +3124,7 @@ namespace BinXlsxRW {
if (oDataBar.m_oColor.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_ConditionalFormattingDataBar::Color);
m_oBcw.WriteColor(oDataBar.m_oColor.get(), m_pIndexedColors, m_pTheme);
m_oBcw.WriteColor(oDataBar.m_oColor.get(), m_pIndexedColors);
m_oBcw.WriteItemEnd(nCurPos);
}
......@@ -3179,6 +3192,207 @@ namespace BinXlsxRW {
m_oBcw.m_oStream.WriteStringW(oCFVO.m_oVal.get2());
}
}
void WriteSparklineGroups(const OOX::Spreadsheet::CSparklineGroups& oSparklineGroups)
{
int nCurPos = 0;
for(size_t i = 0; i < oSparklineGroups.m_arrItems.size(); ++i)
{
OOX::Spreadsheet::CSparklineGroup* pSparklineGroup = oSparklineGroups.m_arrItems[i];
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::SparklineGroup);
WriteSparklineGroup(*pSparklineGroup);
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteSparklineGroup(const OOX::Spreadsheet::CSparklineGroup& oSparklineGroup)
{
int nCurPos = 0;
if (oSparklineGroup.m_oManualMax.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::ManualMax);
m_oBcw.m_oStream.WriteDoubleReal(oSparklineGroup.m_oManualMax->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oManualMin.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::ManualMin);
m_oBcw.m_oStream.WriteDoubleReal(oSparklineGroup.m_oManualMin->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oLineWeight.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::LineWeight);
m_oBcw.m_oStream.WriteDoubleReal(oSparklineGroup.m_oLineWeight->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oType.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::Type);
m_oBcw.m_oStream.WriteBYTE(oSparklineGroup.m_oType->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oDateAxis.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::DateAxis);
m_oBcw.m_oStream.WriteBOOL(oSparklineGroup.m_oDateAxis->ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oDisplayEmptyCellsAs.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::DisplayEmptyCellsAs);
m_oBcw.m_oStream.WriteBYTE(*oSparklineGroup.m_oDisplayEmptyCellsAs);
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oMarkers.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::Markers);
m_oBcw.m_oStream.WriteBOOL(oSparklineGroup.m_oMarkers->ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oHigh.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::High);
m_oBcw.m_oStream.WriteBOOL(oSparklineGroup.m_oHigh->ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oLow.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::Low);
m_oBcw.m_oStream.WriteBOOL(oSparklineGroup.m_oLow->ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oFirst.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::First);
m_oBcw.m_oStream.WriteBOOL(oSparklineGroup.m_oFirst->ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oLast.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::Last);
m_oBcw.m_oStream.WriteBOOL(oSparklineGroup.m_oLast->ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oNegative.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::Negative);
m_oBcw.m_oStream.WriteBOOL(oSparklineGroup.m_oNegative->ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oDisplayXAxis.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::DisplayXAxis);
m_oBcw.m_oStream.WriteBOOL(oSparklineGroup.m_oDisplayXAxis->ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oDisplayHidden.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::DisplayHidden);
m_oBcw.m_oStream.WriteBOOL(oSparklineGroup.m_oDisplayHidden->ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oMinAxisType.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::MinAxisType);
m_oBcw.m_oStream.WriteBYTE(oSparklineGroup.m_oMinAxisType->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oMaxAxisType.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::MaxAxisType);
m_oBcw.m_oStream.WriteBYTE(oSparklineGroup.m_oMaxAxisType->GetValue());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oRightToLeft.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::RightToLeft);
m_oBcw.m_oStream.WriteBOOL(oSparklineGroup.m_oRightToLeft->ToBool());
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oColorSeries.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::ColorSeries);
m_oBcw.WriteColor(oSparklineGroup.m_oColorSeries.get(), m_pIndexedColors);
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oColorNegative.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::ColorNegative);
m_oBcw.WriteColor(oSparklineGroup.m_oColorNegative.get(), m_pIndexedColors);
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oColorAxis.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::ColorAxis);
m_oBcw.WriteColor(oSparklineGroup.m_oColorAxis.get(), m_pIndexedColors);
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oColorMarkers.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::ColorMarkers);
m_oBcw.WriteColor(oSparklineGroup.m_oColorMarkers.get(), m_pIndexedColors);
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oColorFirst.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::ColorFirst);
m_oBcw.WriteColor(oSparklineGroup.m_oColorFirst.get(), m_pIndexedColors);
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oColorLast.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::ColorLast);
m_oBcw.WriteColor(oSparklineGroup.m_oColorLast.get(), m_pIndexedColors);
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oColorHigh.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::ColorHigh);
m_oBcw.WriteColor(oSparklineGroup.m_oColorHigh.get(), m_pIndexedColors);
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oColorLow.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::ColorLow);
m_oBcw.WriteColor(oSparklineGroup.m_oColorLow.get(), m_pIndexedColors);
m_oBcw.WriteItemEnd(nCurPos);
}
if (oSparklineGroup.m_oRef.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_Sparkline::Ref);
m_oBcw.m_oStream.WriteStringW(oSparklineGroup.m_oRef.get());
}
if (oSparklineGroup.m_oSparklines.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::Sparklines);
WriteSparklines(oSparklineGroup.m_oSparklines.get());
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteSparklines(const OOX::Spreadsheet::CSparklines& oSparklines)
{
int nCurPos = 0;
for(size_t i = 0; i < oSparklines.m_arrItems.size(); ++i)
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_Sparkline::Sparkline);
WriteSparkline(*oSparklines.m_arrItems[i]);
m_oBcw.WriteItemEnd(nCurPos);
}
}
void WriteSparkline(const OOX::Spreadsheet::CSparkline& oSparkline)
{
int nCurPos = 0;
if (oSparkline.m_oRef.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_Sparkline::SparklineRef);
m_oBcw.m_oStream.WriteStringW(oSparkline.m_oRef.get());
}
if (oSparkline.m_oSqRef.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_Sparkline::SparklineSqRef);
m_oBcw.m_oStream.WriteStringW(oSparkline.m_oSqRef.get());
}
}
};
class BinaryCalcChainTableWriter
{
......
//#include "stdafx.h"
//#include "stdafx.h"
#include "CommonWriter.h"
#include "../Common/BinReaderWriterDefines.h"
......@@ -18,7 +18,7 @@ namespace BinXlsxRW {
}
int BinaryCommonWriter::WriteItemWithLengthStart()
{
//
//Запоминаем позицию чтобы в конце записать туда длину
int nStartPos = m_oStream.GetPosition();
m_oStream.Skip(4);
return nStartPos;
......@@ -31,7 +31,7 @@ namespace BinXlsxRW {
m_oStream.WriteLONG(nEnd - nStart - 4);
m_oStream.SetPosition(nEnd);
}
void BinaryCommonWriter::WriteColor(const OOX::Spreadsheet::CColor& color, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* theme)
void BinaryCommonWriter::WriteColor(const OOX::Spreadsheet::CColor& color, OOX::Spreadsheet::CIndexedColors* pIndexedColors)
{
if(color.m_oAuto.IsInit() && color.m_oAuto->ToBool())
{
......
#ifndef COMMON_WRITER
#ifndef COMMON_WRITER
#define COMMON_WRITER
#include "../../ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h"
......@@ -14,7 +14,7 @@ namespace BinXlsxRW {
void WriteItemEnd(int nStart);
int WriteItemWithLengthStart();
void WriteItemWithLengthEnd(int nStart);
void WriteColor(const OOX::Spreadsheet::CColor& color, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* theme);
void WriteColor(const OOX::Spreadsheet::CColor& color, OOX::Spreadsheet::CIndexedColors* pIndexedColors);
void WriteBytesArray(BYTE* pData, long nDataSize);
};
}
......
......@@ -5,6 +5,7 @@
#include "../../Common/ATLDefine.h"
#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Worksheets/Sparkline.h"
#include "../../DesktopEditor/common/Path.h"
#include "../Common/BinReaderWriterDefines.h"
......@@ -1999,6 +2000,19 @@ namespace BinXlsxRW {
m_pCurWorksheet->m_oTableParts->m_oCount.Init();
m_pCurWorksheet->m_oTableParts->m_oCount->SetValue(m_pCurWorksheet->m_oTableParts->m_arrItems.size());
}
else if(c_oSerWorksheetsTypes::SparklineGroups == type)
{
OOX::Drawing::COfficeArtExtension* pOfficeArtExtension = new OOX::Drawing::COfficeArtExtension();
pOfficeArtExtension->m_oSparklineGroups.Init();
res = Read1(length, &BinaryWorksheetsTableReader::ReadSparklineGroups, this, pOfficeArtExtension->m_oSparklineGroups.GetPointer());
pOfficeArtExtension->m_oUri.Init();
pOfficeArtExtension->m_oUri->Append(_T("{05C60535-1F16-4fd2-B633-F4F36F0B64E0}"));
pOfficeArtExtension->m_sAdditionalNamespace = _T(" xmlns:x14=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main\"");
m_pCurWorksheet->m_oExtLst.Init();
m_pCurWorksheet->m_oExtLst->m_arrExt.push_back(pOfficeArtExtension);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
......@@ -2856,6 +2870,195 @@ namespace BinXlsxRW {
res = c_oSerConstants::ReadUnknown;
return res;
};
int ReadSparklineGroups(BYTE type, long length, void* poResult)
{
OOX::Spreadsheet::CSparklineGroups* pSparklineGroups = static_cast<OOX::Spreadsheet::CSparklineGroups*>(poResult);
int res = c_oSerConstants::ReadOk;
if(c_oSer_Sparkline::SparklineGroup == type)
{
OOX::Spreadsheet::CSparklineGroup* pSparklineGroup = new OOX::Spreadsheet::CSparklineGroup();
res = Read1(length, &BinaryWorksheetsTableReader::ReadSparklineGroup, this, pSparklineGroup);
pSparklineGroups->m_arrItems.push_back(pSparklineGroup);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
int ReadSparklineGroup(BYTE type, long length, void* poResult)
{
OOX::Spreadsheet::CSparklineGroup* pSparklineGroup = static_cast<OOX::Spreadsheet::CSparklineGroup*>(poResult);
int res = c_oSerConstants::ReadOk;
if(c_oSer_Sparkline::ManualMax == type)
{
pSparklineGroup->m_oManualMax.Init();
pSparklineGroup->m_oManualMax->SetValue(m_oBufferedStream.GetDoubleReal());
}
else if(c_oSer_Sparkline::ManualMin == type)
{
pSparklineGroup->m_oManualMin.Init();
pSparklineGroup->m_oManualMin->SetValue(m_oBufferedStream.GetDoubleReal());
}
else if(c_oSer_Sparkline::LineWeight == type)
{
pSparklineGroup->m_oLineWeight.Init();
pSparklineGroup->m_oLineWeight->SetValue(m_oBufferedStream.GetDoubleReal());
}
else if(c_oSer_Sparkline::Type == type)
{
pSparklineGroup->m_oType.Init();
pSparklineGroup->m_oType->SetValue((SimpleTypes::Spreadsheet::ESparklineType)m_oBufferedStream.GetChar());
}
else if(c_oSer_Sparkline::DateAxis == type)
{
pSparklineGroup->m_oDateAxis.Init();
pSparklineGroup->m_oDateAxis->FromBool(m_oBufferedStream.GetBool());
}
else if(c_oSer_Sparkline::DisplayEmptyCellsAs == type)
{
pSparklineGroup->m_oDisplayEmptyCellsAs.Init();
pSparklineGroup->m_oDisplayEmptyCellsAs.get2() = (OOX::Spreadsheet::ST_DispBlanksAs)m_oBufferedStream.GetChar();
}
else if(c_oSer_Sparkline::Markers == type)
{
pSparklineGroup->m_oMarkers.Init();
pSparklineGroup->m_oMarkers->FromBool(m_oBufferedStream.GetBool());
}
else if(c_oSer_Sparkline::High == type)
{
pSparklineGroup->m_oHigh.Init();
pSparklineGroup->m_oHigh->FromBool(m_oBufferedStream.GetBool());
}
else if(c_oSer_Sparkline::Low == type)
{
pSparklineGroup->m_oLow.Init();
pSparklineGroup->m_oLow->FromBool(m_oBufferedStream.GetBool());
}
else if(c_oSer_Sparkline::First == type)
{
pSparklineGroup->m_oFirst.Init();
pSparklineGroup->m_oFirst->FromBool(m_oBufferedStream.GetBool());
}
else if(c_oSer_Sparkline::Last == type)
{
pSparklineGroup->m_oLast.Init();
pSparklineGroup->m_oLast->FromBool(m_oBufferedStream.GetBool());
}
else if(c_oSer_Sparkline::Negative == type)
{
pSparklineGroup->m_oNegative.Init();
pSparklineGroup->m_oNegative->FromBool(m_oBufferedStream.GetBool());
}
else if(c_oSer_Sparkline::DisplayXAxis == type)
{
pSparklineGroup->m_oDisplayXAxis.Init();
pSparklineGroup->m_oDisplayXAxis->FromBool(m_oBufferedStream.GetBool());
}
else if(c_oSer_Sparkline::DisplayHidden == type)
{
pSparklineGroup->m_oDisplayHidden.Init();
pSparklineGroup->m_oDisplayHidden->FromBool(m_oBufferedStream.GetBool());
}
else if(c_oSer_Sparkline::MinAxisType == type)
{
pSparklineGroup->m_oMinAxisType.Init();
pSparklineGroup->m_oMinAxisType->SetValue((SimpleTypes::Spreadsheet::ESparklineAxisMinMax)m_oBufferedStream.GetChar());
}
else if(c_oSer_Sparkline::MaxAxisType == type)
{
pSparklineGroup->m_oMaxAxisType.Init();
pSparklineGroup->m_oMaxAxisType->SetValue((SimpleTypes::Spreadsheet::ESparklineAxisMinMax)m_oBufferedStream.GetChar());
}
else if(c_oSer_Sparkline::RightToLeft == type)
{
pSparklineGroup->m_oRightToLeft.Init();
pSparklineGroup->m_oRightToLeft->FromBool(m_oBufferedStream.GetBool());
}
else if(c_oSer_Sparkline::ColorSeries == type)
{
pSparklineGroup->m_oColorSeries.Init();
res = Read2(length, &BinaryWorksheetsTableReader::ReadColor, this, pSparklineGroup->m_oColorSeries.GetPointer());
}
else if(c_oSer_Sparkline::ColorNegative == type)
{
pSparklineGroup->m_oColorNegative.Init();
res = Read2(length, &BinaryWorksheetsTableReader::ReadColor, this, pSparklineGroup->m_oColorNegative.GetPointer());
}
else if(c_oSer_Sparkline::ColorAxis == type)
{
pSparklineGroup->m_oColorAxis.Init();
res = Read2(length, &BinaryWorksheetsTableReader::ReadColor, this, pSparklineGroup->m_oColorAxis.GetPointer());
}
else if(c_oSer_Sparkline::ColorMarkers == type)
{
pSparklineGroup->m_oColorMarkers.Init();
res = Read2(length, &BinaryWorksheetsTableReader::ReadColor, this, pSparklineGroup->m_oColorMarkers.GetPointer());
}
else if(c_oSer_Sparkline::ColorFirst == type)
{
pSparklineGroup->m_oColorFirst.Init();
res = Read2(length, &BinaryWorksheetsTableReader::ReadColor, this, pSparklineGroup->m_oColorFirst.GetPointer());
}
else if(c_oSer_Sparkline::ColorLast == type)
{
pSparklineGroup->m_oColorLast.Init();
res = Read2(length, &BinaryWorksheetsTableReader::ReadColor, this, pSparklineGroup->m_oColorLast.GetPointer());
}
else if(c_oSer_Sparkline::ColorHigh == type)
{
pSparklineGroup->m_oColorHigh.Init();
res = Read2(length, &BinaryWorksheetsTableReader::ReadColor, this, pSparklineGroup->m_oColorHigh.GetPointer());
}
else if(c_oSer_Sparkline::ColorLow == type)
{
pSparklineGroup->m_oColorLow.Init();
res = Read2(length, &BinaryWorksheetsTableReader::ReadColor, this, pSparklineGroup->m_oColorLow.GetPointer());
}
else if(c_oSer_Sparkline::Ref == type)
{
pSparklineGroup->m_oRef.Init();
pSparklineGroup->m_oRef->Append(m_oBufferedStream.GetString3(length));
}
else if(c_oSer_Sparkline::Sparklines == type)
{
pSparklineGroup->m_oSparklines.Init();
res = Read1(length, &BinaryWorksheetsTableReader::ReadSparklines, this, pSparklineGroup->m_oSparklines.GetPointer());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
int ReadSparklines(BYTE type, long length, void* poResult)
{
OOX::Spreadsheet::CSparklines* pSparklines = static_cast<OOX::Spreadsheet::CSparklines*>(poResult);
int res = c_oSerConstants::ReadOk;
if(c_oSer_Sparkline::Sparkline == type)
{
OOX::Spreadsheet::CSparkline* pSparkline = new OOX::Spreadsheet::CSparkline();
res = Read1(length, &BinaryWorksheetsTableReader::ReadSparkline, this, pSparkline);
pSparklines->m_arrItems.push_back(pSparkline);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
int ReadSparkline(BYTE type, long length, void* poResult)
{
OOX::Spreadsheet::CSparkline* pSparkline = static_cast<OOX::Spreadsheet::CSparkline*>(poResult);
int res = c_oSerConstants::ReadOk;
if(c_oSer_Sparkline::SparklineRef == type)
{
pSparkline->m_oRef.Init();
pSparkline->m_oRef->Append(m_oBufferedStream.GetString3(length));
}
else if(c_oSer_Sparkline::SparklineSqRef == type)
{
pSparkline->m_oSqRef.Init();
pSparkline->m_oSqRef->Append(m_oBufferedStream.GetString3(length));
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
void AddLineBreak(OOX::Spreadsheet::CSi& oSi)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment