init repo

This commit is contained in:
nikolay ivanov
2014-07-05 18:22:49 +00:00
commit a8be6b9e72
17348 changed files with 9229832 additions and 0 deletions

View File

@@ -0,0 +1,303 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_BORDERS_FILE_INCLUDE_H_
#define OOX_BORDERS_FILE_INCLUDE_H_
#include "../CommonInclude.h"
#include "rPr.h"
namespace OOX
{
namespace Spreadsheet
{
class CBorderProp : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CBorderProp)
CBorderProp()
{
}
virtual ~CBorderProp()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
}
void toXML2(CStringWriter& writer, CString sName) const
{
writer.WriteStringC(_T("<"));
writer.WriteStringC(sName);
if(m_oStyle.IsInit())
{
CString sVal;sVal.Format(_T(" style=\"%s\""), m_oStyle->ToString());
writer.WriteStringC(sVal);
}
writer.WriteStringC(_T(">"));
if(m_oColor.IsInit())
m_oColor->toXML2(writer, _T("color"));
writer.WriteStringC(_T("</"));
writer.WriteStringC(sName);
writer.WriteStringC(_T(">"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("color") == sName )
m_oColor = oReader;
}
}
virtual EElementType getType () const
{
return et_BorderProp;
}
bool IsEmpty()
{
return !(m_oStyle.IsInit() || m_oColor.IsInit());
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("style"), m_oStyle )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::Spreadsheet::CBorderStyle<>> m_oStyle;
nullable<CColor> m_oColor;
};
class CBorder : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CBorder)
CBorder()
{
}
virtual ~CBorder()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(_T("<border"));
if(m_oDiagonalDown.IsInit() && SimpleTypes::onoffTrue == m_oDiagonalDown->GetValue())
{
CString sVal;sVal.Format(_T(" diagonalDown=\"%s\""), m_oDiagonalDown->ToString2( SimpleTypes::onofftostring1));
writer.WriteStringC(sVal);
}
if(m_oDiagonalUp.IsInit() && SimpleTypes::onoffTrue == m_oDiagonalUp->GetValue())
{
CString sVal;sVal.Format(_T(" diagonalUp=\"%s\""), m_oDiagonalUp->ToString2( SimpleTypes::onofftostring1));
writer.WriteStringC(sVal);
}
writer.WriteStringC(_T(">"));
if(m_oStart.IsInit() && false == m_oStart->IsEmpty())
m_oStart->toXML2(writer, _T("left"));
else
writer.WriteStringC(_T("<left/>"));
if(m_oEnd.IsInit() && false == m_oEnd->IsEmpty())
m_oEnd->toXML2(writer, _T("right"));
else
writer.WriteStringC(_T("<right/>"));
if(m_oTop.IsInit() && false == m_oTop->IsEmpty())
m_oTop->toXML2(writer, _T("top"));
else
writer.WriteStringC(_T("<top/>"));
if(m_oBottom.IsInit() && false == m_oBottom->IsEmpty())
m_oBottom->toXML2(writer, _T("bottom"));
else
writer.WriteStringC(_T("<bottom/>"));
if(m_oDiagonal.IsInit() && false == m_oDiagonal->IsEmpty())
m_oDiagonal->toXML2(writer, _T("diagonal"));
else
writer.WriteStringC(_T("<diagonal/>"));
if(m_oHorizontal.IsInit() && false == m_oHorizontal->IsEmpty())
m_oHorizontal->toXML2(writer, _T("horizontal"));
if(m_oVertical.IsInit() && false == m_oVertical->IsEmpty())
m_oVertical->toXML2(writer, _T("vertical"));
writer.WriteStringC(_T("</border>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("bottom") == sName )
m_oBottom = oReader;
else if ( _T("diagonal") == sName )
m_oDiagonal = oReader;
else if ( _T("end") == sName || _T("right") == sName )
m_oEnd = oReader;
else if ( _T("horizontal") == sName )
m_oHorizontal = oReader;
else if ( _T("start") == sName || _T("left") == sName )
m_oStart = oReader;
else if ( _T("top") == sName )
m_oTop = oReader;
else if ( _T("vertical") == sName )
m_oVertical = oReader;
}
}
virtual EElementType getType () const
{
return et_Border;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("diagonalDown"), m_oDiagonalDown )
WritingElement_ReadAttributes_Read_if ( oReader, _T("diagonalUp"), m_oDiagonalUp )
WritingElement_ReadAttributes_Read_if ( oReader, _T("outline"), m_oOutline )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::COnOff<>> m_oDiagonalDown;
nullable<SimpleTypes::COnOff<>> m_oDiagonalUp;
nullable<SimpleTypes::COnOff<>> m_oOutline;
nullable<CBorderProp> m_oBottom;
nullable<CBorderProp> m_oDiagonal;
nullable<CBorderProp> m_oEnd;
nullable<CBorderProp> m_oHorizontal;
nullable<CBorderProp> m_oStart;
nullable<CBorderProp> m_oTop;
nullable<CBorderProp> m_oVertical;
};
class CBorders : public WritingElementWithChilds<CBorder>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CBorders)
CBorders()
{
}
virtual ~CBorders()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(_T("<borders"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteStringC(sVal);
}
writer.WriteStringC(_T(">"));
for(int i = 0, length = m_arrItems.GetSize(); i < length; ++i)
m_arrItems[i]->toXML(writer);
writer.WriteStringC(_T("</borders>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("border") == sName )
m_arrItems.Add( new CBorder( oReader ));
}
}
virtual EElementType getType () const
{
return et_Borders;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("count"), m_oCount )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
}
}
#endif // OOX_BORDERS_FILE_INCLUDE_H_

View File

@@ -0,0 +1,184 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_CELLSTYLES_FILE_INCLUDE_H_
#define OOX_CELLSTYLES_FILE_INCLUDE_H_
#include "../CommonInclude.h"
namespace OOX
{
namespace Spreadsheet
{
class CCellStyle : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CCellStyle)
CCellStyle()
{
}
virtual ~CCellStyle()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(_T("<cellStyle"));
if(m_oName.IsInit())
{
CString sVal;sVal.Format(_T(" name=\"%s\""), XmlUtils::EncodeXmlString(m_oName.get()));
writer.WriteStringC(sVal);
}
if(m_oXfId.IsInit())
{
CString sVal;sVal.Format(_T(" xfId=\"%d\""), m_oXfId->GetValue());
writer.WriteStringC(sVal);
}
if(m_oBuiltinId.IsInit())
{
CString sVal;sVal.Format(_T(" builtinId=\"%d\""), m_oBuiltinId->GetValue());
writer.WriteStringC(sVal);
}
writer.WriteStringC(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual EElementType getType () const
{
return et_CellStyle;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("builtinId"), m_oBuiltinId )
WritingElement_ReadAttributes_Read_if ( oReader, _T("customBuiltin"), m_oCustomBuiltin )
WritingElement_ReadAttributes_Read_if ( oReader, _T("hidden"), m_oHidden )
WritingElement_ReadAttributes_Read_if ( oReader, _T("iLevel"), m_oILevel )
WritingElement_ReadAttributes_Read_if ( oReader, _T("name"), m_oName )
WritingElement_ReadAttributes_Read_if ( oReader, _T("xfId"), m_oXfId )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oBuiltinId;
nullable<SimpleTypes::COnOff<>> m_oCustomBuiltin;
nullable<SimpleTypes::COnOff<>> m_oHidden;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oILevel;
nullable<CString> m_oName;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oXfId;
};
class CCellStyles : public WritingElementWithChilds<CCellStyle>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CCellStyles)
CCellStyles()
{
}
virtual ~CCellStyles()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(_T("<cellStyles"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteStringC(sVal);
}
writer.WriteStringC(_T(">"));
for(int i = 0, length = m_arrItems.GetSize(); i < length; ++i)
m_arrItems[i]->toXML(writer);
writer.WriteStringC(_T("</cellStyles>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("cellStyle") == sName )
m_arrItems.Add( new CCellStyle( oReader ));
}
}
virtual EElementType getType () const
{
return et_CellStyles;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("count"), m_oCount )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
}
}
#endif // OOX_CELLSTYLES_FILE_INCLUDE_H_

View File

@@ -0,0 +1,106 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_COLORS_FILE_INCLUDE_H_
#define OOX_COLORS_FILE_INCLUDE_H_
#include "../CommonInclude.h"
#include "rPr.h"
namespace OOX
{
namespace Spreadsheet
{
class CColors : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CColors)
CColors()
{
}
virtual ~CColors()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("indexedColors") == sName )
m_oIndexedColors = oReader;
else if ( _T("mruColors") == sName )
m_oMruColors = oReader;
}
}
virtual EElementType getType () const
{
return et_Colors;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("count"), m_oCount )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
nullable<CIndexedColors> m_oIndexedColors;
nullable<CMruColors> m_oMruColors;
};
}
}
#endif // OOX_COLORS_FILE_INCLUDE_H_

View File

@@ -0,0 +1,372 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_FILLS_FILE_INCLUDE_H_
#define OOX_FILLS_FILE_INCLUDE_H_
#include "../CommonInclude.h"
#include "rPr.h"
namespace OOX
{
namespace Spreadsheet
{
class CPatternFill : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CPatternFill)
CPatternFill()
{
}
virtual ~CPatternFill()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(_T("<patternFill"));
if(m_oPatternType.IsInit())
{
CString sVal;sVal.Format(_T(" patternType=\"%s\""), m_oPatternType->ToString());
writer.WriteStringC(sVal);
}
if(m_oBgColor.IsInit() || m_oFgColor.IsInit())
{
writer.WriteStringC(_T(">"));
if(m_oBgColor.IsInit() && m_oFgColor.IsInit())
{
m_oFgColor->toXML2(writer, _T("fgColor"));
m_oBgColor->toXML2(writer, _T("bgColor"));
}
else if(m_oFgColor.IsInit())
{
m_oFgColor->toXML2(writer, _T("fgColor"));
m_oFgColor->toXML2(writer, _T("bgColor"));
}
else if(m_oBgColor.IsInit())
{
m_oBgColor->toXML2(writer, _T("fgColor"));
m_oBgColor->toXML2(writer, _T("bgColor"));
}
writer.WriteStringC(_T("</patternFill>"));
}
else
writer.WriteStringC(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("bgColor") == sName )
m_oBgColor = oReader;
else if ( _T("fgColor") == sName )
m_oFgColor = oReader;
}
}
virtual EElementType getType () const
{
return et_PatternFill;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("patternType"), m_oPatternType )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::Spreadsheet::CPatternType<>> m_oPatternType;
nullable<CColor> m_oBgColor;
nullable<CColor> m_oFgColor;
};
class CGradientStop : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CGradientStop)
CGradientStop()
{
}
virtual ~CGradientStop()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("color") == sName )
m_oColor = oReader;
}
}
virtual EElementType getType () const
{
return et_GradientStop;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("position"), m_oPosition )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CDouble> m_oPosition;
nullable<CColor> m_oColor;
};
class CGradientFill : public WritingElementWithChilds<CGradientStop>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CGradientFill)
CGradientFill()
{
}
virtual ~CGradientFill()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("stop") == sName )
m_arrItems.Add( new CGradientStop( oReader ));
}
}
virtual EElementType getType () const
{
return et_GradientFill;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("bottom"), m_oBottom )
WritingElement_ReadAttributes_Read_if ( oReader, _T("degree"), m_oDegree )
WritingElement_ReadAttributes_Read_if ( oReader, _T("left"), m_oLeft )
WritingElement_ReadAttributes_Read_if ( oReader, _T("right"), m_oRight )
WritingElement_ReadAttributes_Read_if ( oReader, _T("top"), m_oTop )
WritingElement_ReadAttributes_Read_if ( oReader, _T("type"), m_oType )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CDouble> m_oBottom;
nullable<SimpleTypes::CDouble> m_oDegree;
nullable<SimpleTypes::CDouble> m_oLeft;
nullable<SimpleTypes::CDouble> m_oRight;
nullable<SimpleTypes::CDouble> m_oTop;
nullable<SimpleTypes::Spreadsheet::CGradientType<>> m_oType;
};
class CFill : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CFill)
CFill()
{
}
virtual ~CFill()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(_T("<fill>"));
if(m_oPatternFill.IsInit())
m_oPatternFill->toXML(writer);
writer.WriteStringC(_T("</fill>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("gradientFill") == sName )
m_oGradientFill = oReader;
else if ( _T("patternFill") == sName )
m_oPatternFill = oReader;
}
}
virtual EElementType getType () const
{
return et_Fill;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
}
public:
nullable<CGradientFill> m_oGradientFill;
nullable<CPatternFill> m_oPatternFill;
};
class CFills : public WritingElementWithChilds<CFill>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CFills)
CFills()
{
}
virtual ~CFills()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(_T("<fills"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteStringC(sVal);
}
writer.WriteStringC(_T(">"));
for(int i = 0, length = m_arrItems.GetSize(); i < length; ++i)
m_arrItems[i]->toXML(writer);
writer.WriteStringC(_T("</fills>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("fill") == sName )
m_arrItems.Add( new CFill( oReader ));
}
}
virtual EElementType getType () const
{
return et_Fills;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("count"), m_oCount )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
}
}
#endif // OOX_FILLS_FILE_INCLUDE_H_

View File

@@ -0,0 +1,299 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_FONTS_FILE_INCLUDE_H_
#define OOX_FONTS_FILE_INCLUDE_H_
#include "../CommonInclude.h"
#include "rPr.h"
namespace OOX
{
namespace Spreadsheet
{
class CFont : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CFont)
CFont()
{
}
virtual ~CFont()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(_T("<font>"));
if(m_oBold.IsInit())
{
if(SimpleTypes::onoffTrue == m_oBold->m_oVal.GetValue())
writer.WriteStringC(_T("<b/>"));
else
writer.WriteStringC(_T("<b val=\"0\"/>"));
}
if(m_oCharset.IsInit() && m_oCharset->m_oCharset.IsInit())
{
CString sVal;sVal.Format(_T("<charset val=\"%s\"/>"), m_oCharset->m_oCharset->ToString());
writer.WriteStringC(sVal);
}
if(m_oColor.IsInit())
m_oColor->toXML2(writer, _T("color"));
if(m_oCondense.IsInit())
{
if(SimpleTypes::onoffTrue == m_oCondense->m_oVal.GetValue())
writer.WriteStringC(_T("<condense/>"));
else
writer.WriteStringC(_T("<condense val=\"0\"/>"));
}
if(m_oExtend.IsInit())
{
if(SimpleTypes::onoffTrue == m_oExtend->m_oVal.GetValue())
writer.WriteStringC(_T("<extend/>"));
else
writer.WriteStringC(_T("<extend val=\"0\"/>"));
}
if(m_oFamily.IsInit() && m_oFamily->m_oFontFamily.IsInit())
{
CString sVal;sVal.Format(_T("<family val=\"%s\"/>"), m_oFamily->m_oFontFamily->ToString());
writer.WriteStringC(sVal);
}
if(m_oItalic.IsInit())
{
if(SimpleTypes::onoffTrue == m_oItalic->m_oVal.GetValue())
writer.WriteStringC(_T("<i/>"));
else
writer.WriteStringC(_T("<i val=\"0\"/>"));
}
if(m_oOutline.IsInit())
{
if(SimpleTypes::onoffTrue == m_oOutline->m_oVal.GetValue())
writer.WriteStringC(_T("<outline/>"));
else
writer.WriteStringC(_T("<outline val=\"0\"/>"));
}
if(m_oRFont.IsInit() && m_oRFont->m_sVal.IsInit())
{
CString sVal;sVal.Format(_T("<name val=\"%s\"/>"), XmlUtils::EncodeXmlString(m_oRFont->m_sVal.get()));
writer.WriteStringC(sVal);
}
if(m_oScheme.IsInit() && m_oScheme->m_oFontScheme.IsInit())
{
CString sVal;sVal.Format(_T("<scheme val=\"%s\"/>"), m_oScheme->m_oFontScheme->ToString());
writer.WriteStringC(sVal);
}
if(m_oShadow.IsInit())
{
if(SimpleTypes::onoffTrue == m_oShadow->m_oVal.GetValue())
writer.WriteStringC(_T("<shadow/>"));
else
writer.WriteStringC(_T("<shadow val=\"0\"/>"));
}
if(m_oStrike.IsInit())
{
if(SimpleTypes::onoffTrue == m_oStrike->m_oVal.GetValue())
writer.WriteStringC(_T("<strike/>"));
else
writer.WriteStringC(_T("<strike val=\"0\"/>"));
}
if(m_oSz.IsInit() && m_oSz->m_oVal.IsInit())
{
CString sVal;sVal.Format(_T("<sz val=\"%s\"/>"), SpreadsheetCommon::WriteDouble(m_oSz->m_oVal->GetValue()));
writer.WriteStringC(sVal);
}
if(m_oUnderline.IsInit() && m_oUnderline->m_oUnderline.IsInit())
{
CString sVal;
if( SimpleTypes::underlineSingle != m_oUnderline->m_oUnderline->GetValue())
sVal.Format(_T("<u val=\"%s\"/>"), m_oUnderline->m_oUnderline->ToString());
else
sVal.Format(_T("<u/>"), m_oUnderline->m_oUnderline->ToString());
writer.WriteStringC(sVal);
}
if(m_oVertAlign.IsInit() && m_oVertAlign->m_oVerticalAlign.IsInit())
{
CString sVal;sVal.Format(_T("<vertAlign val=\"%s\"/>"), m_oVertAlign->m_oVerticalAlign->ToString());
writer.WriteStringC(sVal);
}
writer.WriteStringC(_T("</font>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("b") == sName )
m_oBold = oReader;
else if ( _T("charset") == sName )
m_oCharset = oReader;
else if ( _T("color") == sName )
m_oColor = oReader;
else if ( _T("condense") == sName )
m_oCondense = oReader;
else if ( _T("extend") == sName )
m_oExtend = oReader;
else if ( _T("family") == sName )
m_oFamily = oReader;
else if ( _T("i") == sName )
m_oItalic = oReader;
else if ( _T("name") == sName )
m_oRFont = oReader;
else if ( _T("outline") == sName )
m_oOutline = oReader;
else if ( _T("scheme") == sName )
m_oScheme = oReader;
else if ( _T("shadow") == sName )
m_oShadow = oReader;
else if ( _T("strike") == sName )
m_oStrike = oReader;
else if ( _T("sz") == sName )
m_oSz = oReader;
else if ( _T("u") == sName )
m_oUnderline = oReader;
else if ( _T("vertAlign") == sName )
m_oVertAlign = oReader;
}
}
virtual EElementType getType () const
{
return et_Font;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
}
public:
nullable<ComplexTypes::Spreadsheet::COnOff2<SimpleTypes::onoffTrue> > m_oBold;
nullable<CCharset> m_oCharset;
nullable<CColor> m_oColor;
nullable<ComplexTypes::Spreadsheet::COnOff2<SimpleTypes::onoffTrue> > m_oCondense;
nullable<ComplexTypes::Spreadsheet::COnOff2<SimpleTypes::onoffTrue> > m_oExtend;
nullable<CFontFamily > m_oFamily;
nullable<ComplexTypes::Spreadsheet::COnOff2<SimpleTypes::onoffTrue> > m_oItalic;
nullable<ComplexTypes::Spreadsheet::COnOff2<SimpleTypes::onoffTrue> > m_oOutline;
nullable<ComplexTypes::Spreadsheet::CString_> m_oRFont;
nullable<CFontScheme> m_oScheme;
nullable<ComplexTypes::Spreadsheet::COnOff2<SimpleTypes::onoffTrue> > m_oShadow;
nullable<ComplexTypes::Spreadsheet::COnOff2<SimpleTypes::onoffTrue> > m_oStrike;
nullable<ComplexTypes::Spreadsheet::CDouble> m_oSz;
nullable<CUnderline> m_oUnderline;
nullable<CVerticalAlign> m_oVertAlign;
};
class CFonts : public WritingElementWithChilds<CFont>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CFonts)
CFonts()
{
}
virtual ~CFonts()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(_T("<fonts"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteStringC(sVal);
}
writer.WriteStringC(_T(">"));
for(int i = 0, length = m_arrItems.GetSize(); i < length; ++i)
m_arrItems[i]->toXML(writer);
writer.WriteStringC(_T("</fonts>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("font") == sName )
m_arrItems.Add( new CFont( oReader ));
}
}
virtual EElementType getType () const
{
return et_Fonts;
}
void AddFont (CFont* pFont)
{
m_arrItems.Add(pFont);
if(false == m_oCount.IsInit())
m_oCount.Init();
m_oCount->SetValue(m_arrItems.GetSize());
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("count"), m_oCount )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
}
}
#endif // OOX_FONTS_FILE_INCLUDE_H_

View File

@@ -0,0 +1,185 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_NUMFMTS_FILE_INCLUDE_H_
#define OOX_NUMFMTS_FILE_INCLUDE_H_
#include "../CommonInclude.h"
#include "rPr.h"
namespace OOX
{
namespace Spreadsheet
{
class CNumFmt : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CNumFmt)
CNumFmt()
{
}
virtual ~CNumFmt()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
toXML2(writer, CString(_T("numFmt")));
}
void toXML2(CStringWriter& writer, CString& sHeader) const
{
writer.WriteStringC(_T("<") + sHeader);
if(m_oNumFmtId.IsInit())
{
CString sVal;sVal.Format(_T(" numFmtId=\"%d\""), m_oNumFmtId->GetValue());
writer.WriteStringC(sVal);
}
if(m_oFormatCode.IsInit())
{
CString sVal;sVal.Format(_T(" formatCode=\"%s\""), XmlUtils::EncodeXmlString(m_oFormatCode.get()));
writer.WriteStringC(sVal);
}
if(m_oSourceLinked.IsInit())
{
CString sVal;
sVal.Format(_T(" sourceLinked=\"%s\""), m_oSourceLinked->ToString2(SimpleTypes::onofftostring1));
writer.WriteStringC(sVal);
}
writer.WriteStringC(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual EElementType getType () const
{
return et_NumFmt;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("formatCode"), m_oFormatCode )
WritingElement_ReadAttributes_Read_if ( oReader, _T("numFmtId"), m_oNumFmtId )
WritingElement_ReadAttributes_Read_if ( oReader, _T("sourceLinked"), m_oSourceLinked )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<CString > m_oFormatCode;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oNumFmtId;
nullable<SimpleTypes::COnOff<>> m_oSourceLinked;
};
class CNumFmts : public WritingElementWithChilds<CNumFmt>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CNumFmts)
CNumFmts()
{
}
virtual ~CNumFmts()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
if(m_arrItems.GetSize() > 0 )
{
writer.WriteStringC(_T("<numFmts"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteStringC(sVal);
}
writer.WriteStringC(_T(">"));
for(int i = 0, length = m_arrItems.GetSize(); i < length; ++i)
m_arrItems[i]->toXML(writer);
writer.WriteStringC(_T("</numFmts>"));
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("numFmt") == sName )
m_arrItems.Add( new CNumFmt( oReader ));
}
}
virtual EElementType getType () const
{
return et_NumFmts;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("count"), m_oCount )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
}
}
#endif // OOX_NUMFMTS_FILE_INCLUDE_H_

View File

@@ -0,0 +1,264 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_STYLES_FILE_INCLUDE_H_
#define OOX_STYLES_FILE_INCLUDE_H_
#include "../CommonInclude.h"
#include "Borders.h"
#include "CellStyles.h"
#include "Xfs.h"
#include "Colors.h"
#include "Dxf.h"
#include "Fills.h"
#include "Fonts.h"
#include "NumFmts.h"
#include "TableStyles.h"
namespace OOX
{
namespace Spreadsheet
{
class CStyles : public OOX::File, public OOX::Spreadsheet::IFileContainer
{
public:
CStyles()
{
}
CStyles(const CPath& oPath)
{
read( oPath );
}
virtual ~CStyles()
{
}
public:
virtual void read(const CPath& oPath)
{
m_oReadPath = oPath;
IFileContainer::Read( oPath );
XmlUtils::CXmlLiteReader oReader;
if ( !oReader.FromFile( oPath.GetPath() ) )
return;
if ( !oReader.ReadNextNode() )
return;
CWCharWrapper sName = oReader.GetName();
if ( _T("styleSheet") == sName )
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
{
int nStylesDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nStylesDepth ) )
{
sName = oReader.GetName();
if ( _T("borders") == sName )
m_oBorders = oReader;
else if ( _T("cellStyles") == sName )
m_oCellStyles = oReader;
else if ( _T("cellStyleXfs") == sName )
m_oCellStyleXfs = oReader;
else if ( _T("cellXfs") == sName )
m_oCellXfs = oReader;
else if ( _T("colors") == sName )
m_oColors = oReader;
else if ( _T("dxfs") == sName )
m_oDxfs = oReader;
else if ( _T("fills") == sName )
m_oFills = oReader;
else if ( _T("fonts") == sName )
m_oFonts = oReader;
else if ( _T("numFmts") == sName )
m_oNumFmts = oReader;
else if ( _T("tableStyles") == sName )
m_oTableStyles = oReader;
}
}
}
}
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
CStringWriter sXml;
sXml.WriteStringC(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" mc:Ignorable=\"x14ac\" xmlns:x14ac=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac\">"));
if(m_oNumFmts.IsInit())
m_oNumFmts->toXML(sXml);
if(m_oFonts.IsInit())
m_oFonts->toXML(sXml);
if(m_oFills.IsInit())
m_oFills->toXML(sXml);
if(m_oBorders.IsInit())
m_oBorders->toXML(sXml);
if(m_oCellStyleXfs.IsInit())
m_oCellStyleXfs->toXML(sXml);
if(m_oCellXfs.IsInit())
m_oCellXfs->toXML(sXml);
if(m_oCellStyles.IsInit())
m_oCellStyles->toXML(sXml);
if(m_oColors.IsInit())
m_oColors->toXML(sXml);
if(m_oDxfs.IsInit())
m_oDxfs->toXML(sXml);
if(m_oTableStyles.IsInit())
m_oTableStyles->toXML(sXml);
sXml.WriteStringC(_T("</styleSheet>"));
CDirectory::SaveToFile( oPath.GetPath(), sXml.GetCString() );
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
}
void PrepareToWrite()
{
if(false == m_oFills.IsInit())
m_oFills.Init();
if(m_oCellXfs.IsInit())
{
for(int i = 0, length = m_oCellXfs->m_arrItems.GetSize(); i < length; ++i)
{
OOX::Spreadsheet::CXfs* xfs = m_oCellXfs->m_arrItems[i];
if (false == xfs->m_oXfId.IsInit())
{
xfs->m_oXfId.Init();
xfs->m_oXfId->SetValue(0);
}
}
}
if(false == m_oCellStyles.IsInit())
m_oCellStyles.Init();
if(false == m_oCellStyles->m_oCount.IsInit())
{
m_oCellStyles->m_oCount.Init();
m_oCellStyles->m_oCount->SetValue(1);
}
if(0 == m_oCellStyles->m_arrItems.GetSize())
{
CCellStyle* pCellStyle = new CCellStyle();
pCellStyle->m_oName = _T("Normal");
pCellStyle->m_oXfId.Init();
pCellStyle->m_oXfId->SetValue(0);
pCellStyle->m_oBuiltinId.Init();
pCellStyle->m_oBuiltinId->SetValue(0);
m_oCellStyles->m_arrItems.Add(pCellStyle);
}
if(false == m_oCellStyleXfs.IsInit())
m_oCellStyleXfs.Init();
if(false == m_oCellStyleXfs->m_oCount.IsInit())
{
m_oCellStyleXfs->m_oCount.Init();
m_oCellStyleXfs->m_oCount->SetValue(1);
}
if(0 == m_oCellStyleXfs->m_arrItems.GetSize())
{
CXfs* pXfs = new CXfs();
pXfs->m_oNumFmtId.Init();
pXfs->m_oNumFmtId->SetValue(0);
pXfs->m_oFontId.Init();
pXfs->m_oFontId->SetValue(0);
pXfs->m_oFillId.Init();
pXfs->m_oFillId->SetValue(0);
pXfs->m_oBorderId.Init();
pXfs->m_oBorderId->SetValue(0);
m_oCellStyleXfs->m_arrItems.Add(pXfs);
}
if(false == m_oDxfs.IsInit())
m_oDxfs.Init();
if(false == m_oDxfs->m_oCount.IsInit())
{
m_oDxfs->m_oCount.Init();
m_oDxfs->m_oCount->SetValue(0);
}
if(false == m_oTableStyles.IsInit())
{
m_oTableStyles.Init();
m_oTableStyles->m_oCount.Init();
m_oTableStyles->m_oCount->SetValue(0);
}
if(false == m_oTableStyles->m_oDefaultPivotStyle.IsInit())
m_oTableStyles->m_oDefaultTableStyle = _T("TableStyleMedium2");
if(false == m_oTableStyles->m_oDefaultPivotStyle.IsInit())
m_oTableStyles->m_oDefaultPivotStyle = _T("PivotStyleLight16");
}
virtual const OOX::FileType type() const
{
return OOX::Spreadsheet::FileTypes::Styles;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
const CPath& GetReadPath()
{
return m_oReadPath;
}
private:
CPath m_oReadPath;
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
}
public:
nullable<OOX::Spreadsheet::CBorders> m_oBorders;
nullable<OOX::Spreadsheet::CCellStyles> m_oCellStyles;
nullable<OOX::Spreadsheet::CCellStyleXfs> m_oCellStyleXfs;
nullable<OOX::Spreadsheet::CCellXfs> m_oCellXfs;
nullable<OOX::Spreadsheet::CColors> m_oColors;
nullable<OOX::Spreadsheet::CDxfs> m_oDxfs;
nullable<OOX::Spreadsheet::CFills> m_oFills;
nullable<OOX::Spreadsheet::CFonts> m_oFonts;
nullable<OOX::Spreadsheet::CNumFmts> m_oNumFmts;
nullable<OOX::Spreadsheet::CTableStyles> m_oTableStyles;
};
}
}
#endif // OOX_STYLES_FILE_INCLUDE_H_

View File

@@ -0,0 +1,275 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_TABLESTYLES_FILE_INCLUDE_H_
#define OOX_TABLESTYLES_FILE_INCLUDE_H_
#include "../CommonInclude.h"
#include "rPr.h"
namespace OOX
{
namespace Spreadsheet
{
class CTableStyleElement : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CTableStyleElement)
CTableStyleElement()
{
}
virtual ~CTableStyleElement()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
if(m_oType.IsInit() && m_oDxfId.IsInit())
{
CString sXml;
if(m_oSize.IsInit())
sXml.Format(_T("<tableStyleElement type=\"%s\" size=\"%d\" dxfId=\"%d\"/>"), m_oType->ToString(), m_oSize->GetValue(), m_oDxfId->GetValue());
else
sXml.Format(_T("<tableStyleElement type=\"%s\" dxfId=\"%d\"/>"), m_oType->ToString(), m_oDxfId->GetValue());
writer.WriteStringC(sXml);
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual EElementType getType () const
{
return et_TableStyleElement;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("dxfId"), m_oDxfId )
WritingElement_ReadAttributes_Read_if ( oReader, _T("size"), m_oSize )
WritingElement_ReadAttributes_Read_if ( oReader, _T("type"), m_oType )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oDxfId;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oSize;
nullable<SimpleTypes::Spreadsheet::CTableStyleType<>> m_oType;
};
class CTableStyle : public WritingElementWithChilds<CTableStyleElement>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CTableStyle)
CTableStyle()
{
}
virtual ~CTableStyle()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
if(m_oName.IsInit() && m_arrItems.GetSize() > 0)
{
writer.WriteStringC(_T("<tableStyle"));
if(m_oName.IsInit())
{
CString sName;
sName.Format(_T(" name=\"%s\""), XmlUtils::EncodeXmlString(m_oName.get2()));
writer.WriteStringC(sName);
}
if(m_oPivot.IsInit() && true == m_oPivot->ToBool())
writer.WriteStringC(_T(" table=\"0\""));
else
writer.WriteStringC(_T(" pivot=\"0\""));
if(m_oCount.IsInit())
{
CString sCount;
sCount.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteStringC(sCount);
}
writer.WriteStringC(_T(">"));
for(int i = 0, length = m_arrItems.GetSize(); i < length; ++i)
m_arrItems[i]->toXML(writer);
writer.WriteStringC(_T("</tableStyle>"));
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("tableStyleElement") == sName )
m_arrItems.Add( new CTableStyleElement( oReader ));
}
}
virtual EElementType getType () const
{
return et_TableStyle;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("count"), m_oCount )
WritingElement_ReadAttributes_Read_if ( oReader, _T("name"), m_oName )
WritingElement_ReadAttributes_Read_if ( oReader, _T("pivot"), m_oPivot )
WritingElement_ReadAttributes_Read_if ( oReader, _T("table"), m_oTable )
WritingElement_ReadAttributes_Read_if ( oReader, _T("displayName"),m_oDisplayName )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
nullable<CString> m_oName;
nullable<SimpleTypes::COnOff<>> m_oPivot;
nullable<SimpleTypes::COnOff<>> m_oTable;
nullable<CString> m_oDisplayName;
};
class CTableStyles : public WritingElementWithChilds<CTableStyle>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CTableStyles)
CTableStyles()
{
}
virtual ~CTableStyles()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(_T("<tableStyles"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteStringC(sVal);
}
if(m_oDefaultTableStyle.IsInit())
{
CString sVal;sVal.Format(_T(" defaultTableStyle=\"%s\""), XmlUtils::EncodeXmlString(m_oDefaultTableStyle.get()));
writer.WriteStringC(sVal);
}
if(m_oDefaultPivotStyle.IsInit())
{
CString sVal;sVal.Format(_T(" defaultPivotStyle=\"%s\""), XmlUtils::EncodeXmlString(m_oDefaultPivotStyle.get()));
writer.WriteStringC(sVal);
}
if(m_arrItems.GetSize() > 0)
{
writer.WriteStringC(_T(">"));
for(int i = 0, length = m_arrItems.GetSize(); i < length; ++i)
m_arrItems[i]->toXML(writer);
writer.WriteStringC(_T("</tableStyles>"));
}
else
writer.WriteStringC(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("tableStyle") == sName )
m_arrItems.Add( new CTableStyle( oReader ));
}
}
virtual EElementType getType () const
{
return et_TableStyles;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("count"), m_oCount )
WritingElement_ReadAttributes_Read_if ( oReader, _T("defaultPivotStyle"), m_oDefaultPivotStyle )
WritingElement_ReadAttributes_Read_if ( oReader, _T("defaultTableStyle"), m_oDefaultTableStyle )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
nullable<CString> m_oDefaultPivotStyle;
nullable<CString> m_oDefaultTableStyle;
};
}
}
#endif // OOX_TABLESTYLES_FILE_INCLUDE_H_

View File

@@ -0,0 +1,483 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_XFS_FILE_INCLUDE_H_
#define OOX_XFS_FILE_INCLUDE_H_
#include "../CommonInclude.h"
namespace OOX
{
namespace Spreadsheet
{
class CAligment : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CAligment)
CAligment()
{
}
virtual ~CAligment()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(_T("<alignment"));
if(m_oHorizontal.IsInit())
{
CString sVal;sVal.Format(_T(" horizontal=\"%s\""), m_oHorizontal->ToString());
writer.WriteStringC(sVal);
}
if(m_oIndent.IsInit())
{
CString sVal;sVal.Format(_T(" indent=\"%d\""), m_oIndent->GetValue());
writer.WriteStringC(sVal);
}
if(m_oJustifyLastLine.IsInit())
{
CString sVal;sVal.Format(_T(" justifyLastLine=\"%s\""), m_oJustifyLastLine->ToString2(SimpleTypes::onofftostring1));
writer.WriteStringC(sVal);
}
if(m_oReadingOrder.IsInit())
{
CString sVal;sVal.Format(_T(" readingOrder=\"%d\""), m_oReadingOrder->GetValue());
writer.WriteStringC(sVal);
}
if(m_oRelativeIndent.IsInit())
{
CString sVal;sVal.Format(_T(" relativeIndent=\"%d\""), m_oRelativeIndent->GetValue());
writer.WriteStringC(sVal);
}
if(m_oShrinkToFit.IsInit())
{
CString sVal;sVal.Format(_T(" shrinkToFit=\"%s\""), m_oShrinkToFit->ToString2(SimpleTypes::onofftostring1));
writer.WriteStringC(sVal);
}
if(m_oTextRotation.IsInit())
{
CString sVal;sVal.Format(_T(" textRotation=\"%d\""), m_oTextRotation->GetValue());
writer.WriteStringC(sVal);
}
if(m_oVertical.IsInit())
{
CString sVal;sVal.Format(_T(" vertical=\"%s\""), m_oVertical->ToString());
writer.WriteStringC(sVal);
}
if(m_oWrapText.IsInit())
{
CString sVal;sVal.Format(_T(" wrapText=\"%s\""), m_oWrapText->ToString2(SimpleTypes::onofftostring1));
writer.WriteStringC(sVal);
}
writer.WriteStringC(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual EElementType getType () const
{
return et_Aligment;
}
bool IsEmpty()
{
return !(m_oHorizontal.IsInit() || m_oIndent.IsInit() || m_oJustifyLastLine.IsInit() || m_oReadingOrder.IsInit() || m_oRelativeIndent.IsInit() ||
m_oShrinkToFit.IsInit() || m_oTextRotation.IsInit() || (m_oVertical.IsInit() && SimpleTypes::Spreadsheet::verticalalignmentBottom != m_oVertical->GetValue()) || m_oWrapText.IsInit());
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("horizontal"), m_oHorizontal )
WritingElement_ReadAttributes_Read_if ( oReader, _T("indent"), m_oIndent )
WritingElement_ReadAttributes_Read_if ( oReader, _T("justifyLastLine"), m_oJustifyLastLine )
WritingElement_ReadAttributes_Read_if ( oReader, _T("readingOrder"), m_oReadingOrder )
WritingElement_ReadAttributes_Read_if ( oReader, _T("relativeIndent"), m_oRelativeIndent )
WritingElement_ReadAttributes_Read_if ( oReader, _T("shrinkToFit"), m_oShrinkToFit )
WritingElement_ReadAttributes_Read_if ( oReader, _T("textRotation"), m_oTextRotation )
WritingElement_ReadAttributes_Read_if ( oReader, _T("vertical"), m_oVertical )
WritingElement_ReadAttributes_Read_if ( oReader, _T("wrapText"), m_oWrapText )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::Spreadsheet::CHorizontalAlignment<>> m_oHorizontal;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oIndent;
nullable<SimpleTypes::COnOff<>> m_oJustifyLastLine;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oReadingOrder;
nullable<SimpleTypes::CDecimalNumber<>> m_oRelativeIndent;
nullable<SimpleTypes::COnOff<>> m_oShrinkToFit;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oTextRotation;
nullable<SimpleTypes::Spreadsheet::CVerticalAlignment<>> m_oVertical;
nullable<SimpleTypes::COnOff<>> m_oWrapText;
};
class CProtection : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CProtection)
CProtection()
{
}
virtual ~CProtection()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual EElementType getType () const
{
return et_Protection;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("hidden"), m_oHidden )
WritingElement_ReadAttributes_Read_if ( oReader, _T("locked"), m_oLocked )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::COnOff<>> m_oHidden;
nullable<SimpleTypes::COnOff<>> m_oLocked;
};
class CXfs : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CXfs)
CXfs()
{
}
virtual ~CXfs()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(_T("<xf"));
if(m_oFontId.IsInit())
{
CString sVal;sVal.Format(_T(" fontId=\"%d\""), m_oFontId->GetValue());
writer.WriteStringC(sVal);
}
if(m_oFillId.IsInit())
{
CString sVal;sVal.Format(_T(" fillId=\"%d\""), m_oFillId->GetValue());
writer.WriteStringC(sVal);
}
if(m_oBorderId.IsInit())
{
CString sVal;sVal.Format(_T(" borderId=\"%d\""), m_oBorderId->GetValue());
writer.WriteStringC(sVal);
}
if(m_oNumFmtId.IsInit())
{
CString sVal;sVal.Format(_T(" numFmtId=\"%d\""), m_oNumFmtId->GetValue());
writer.WriteStringC(sVal);
}
if(m_oXfId.IsInit())
{
CString sVal;sVal.Format(_T(" xfId=\"%d\""), m_oXfId->GetValue());
writer.WriteStringC(sVal);
}
if(m_oApplyNumberFormat.IsInit())
{
CString sVal;sVal.Format(_T(" applyNumberFormat=\"%s\""), m_oApplyNumberFormat->ToString2(SimpleTypes::onofftostring1));
writer.WriteStringC(sVal);
}
if(m_oApplyFont.IsInit())
{
CString sVal;sVal.Format(_T(" applyFont=\"%s\""), m_oApplyFont->ToString2(SimpleTypes::onofftostring1));
writer.WriteStringC(sVal);
}
if(m_oApplyFill.IsInit())
{
CString sVal;sVal.Format(_T(" applyFill=\"%s\""), m_oApplyFill->ToString2(SimpleTypes::onofftostring1));
writer.WriteStringC(sVal);
}
if(m_oApplyBorder.IsInit())
{
CString sVal;sVal.Format(_T(" applyBorder=\"%s\""), m_oApplyBorder->ToString2(SimpleTypes::onofftostring1));
writer.WriteStringC(sVal);
}
if(m_oApplyAlignment.IsInit())
{
CString sVal;sVal.Format(_T(" applyAlignment=\"%s\""), m_oApplyAlignment->ToString2(SimpleTypes::onofftostring1));
writer.WriteStringC(sVal);
}
if(m_oQuotePrefix.IsInit())
{
CString sVal;sVal.Format(_T(" quotePrefix=\"%s\""), m_oQuotePrefix->ToString2(SimpleTypes::onofftostring1));
writer.WriteStringC(sVal);
}
if(m_oAligment.IsInit())
{
writer.WriteStringC(_T(">"));
m_oAligment->toXML(writer);
writer.WriteStringC(_T("</xf>"));
}
else
writer.WriteStringC(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("alignment") == sName )
m_oAligment = oReader;
else if( _T("protection") == sName )
m_oProtection = oReader;
}
}
virtual EElementType getType () const
{
return et_Xfs;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("applyAlignment"), m_oApplyAlignment )
WritingElement_ReadAttributes_Read_if ( oReader, _T("applyBorder"), m_oApplyBorder )
WritingElement_ReadAttributes_Read_if ( oReader, _T("applyFill"), m_oApplyFill )
WritingElement_ReadAttributes_Read_if ( oReader, _T("applyFont"), m_oApplyFont )
WritingElement_ReadAttributes_Read_if ( oReader, _T("applyNumberFormat"), m_oApplyNumberFormat )
WritingElement_ReadAttributes_Read_if ( oReader, _T("applyProtection"), m_oApplyProtection )
WritingElement_ReadAttributes_Read_if ( oReader, _T("borderId"), m_oBorderId )
WritingElement_ReadAttributes_Read_if ( oReader, _T("fillId"), m_oFillId )
WritingElement_ReadAttributes_Read_if ( oReader, _T("fontId"), m_oFontId )
WritingElement_ReadAttributes_Read_if ( oReader, _T("numFmtId"), m_oNumFmtId )
WritingElement_ReadAttributes_Read_if ( oReader, _T("pivotButton"), m_oPivotButton )
WritingElement_ReadAttributes_Read_if ( oReader, _T("quotePrefix"), m_oQuotePrefix )
WritingElement_ReadAttributes_Read_if ( oReader, _T("xfId"), m_oXfId )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::COnOff<>> m_oApplyAlignment;
nullable<SimpleTypes::COnOff<>> m_oApplyBorder;
nullable<SimpleTypes::COnOff<>> m_oApplyFill;
nullable<SimpleTypes::COnOff<>> m_oApplyFont;
nullable<SimpleTypes::COnOff<>> m_oApplyNumberFormat;
nullable<SimpleTypes::COnOff<>> m_oApplyProtection;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oBorderId;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oFillId;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oFontId;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oNumFmtId;
nullable<SimpleTypes::COnOff<>> m_oPivotButton;
nullable<SimpleTypes::COnOff<>> m_oQuotePrefix;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oXfId;
nullable<CAligment> m_oAligment;
nullable<CProtection> m_oProtection;
};
class CCellXfs : public WritingElementWithChilds<CXfs>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CCellXfs)
CCellXfs()
{
}
virtual ~CCellXfs()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(_T("<cellXfs"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteStringC(sVal);
}
writer.WriteStringC(_T(">"));
for(int i = 0, length = m_arrItems.GetSize(); i < length; ++i)
m_arrItems[i]->toXML(writer);
writer.WriteStringC(_T("</cellXfs>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("xf") == sName )
m_arrItems.Add( new CXfs( oReader ));
}
}
virtual EElementType getType () const
{
return et_CellXfs;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("count"), m_oCount )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
class CCellStyleXfs : public WritingElementWithChilds<CXfs>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CCellStyleXfs)
CCellStyleXfs()
{
}
virtual ~CCellStyleXfs()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(_T("<cellStyleXfs"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteStringC(sVal);
}
writer.WriteStringC(_T(">"));
for(int i = 0, length = m_arrItems.GetSize(); i < length; ++i)
m_arrItems[i]->toXML(writer);
writer.WriteStringC(_T("</cellStyleXfs>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("xf") == sName )
m_arrItems.Add( new CXfs( oReader ));
}
}
virtual EElementType getType () const
{
return et_CellStyleXfs;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("count"), m_oCount )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
}
}
#endif // OOX_XFS_FILE_INCLUDE_H_

View File

@@ -0,0 +1,191 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_DXFS_FILE_INCLUDE_H_
#define OOX_DXFS_FILE_INCLUDE_H_
#include "../CommonInclude.h"
#include "Borders.h"
#include "Fills.h"
#include "Fonts.h"
#include "NumFmts.h"
namespace OOX
{
namespace Spreadsheet
{
class CDxf : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CDxf)
CDxf()
{
}
virtual ~CDxf()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(CString(_T("<dxf>")));
if(m_oFont.IsInit())
m_oFont->toXML(writer);
if(m_oNumFmt.IsInit())
m_oNumFmt->toXML(writer);
if(m_oFill.IsInit())
m_oFill->toXML(writer);
if(m_oAlignment.IsInit())
m_oAlignment->toXML(writer);
if(m_oBorder.IsInit())
m_oBorder->toXML(writer);
if(m_oProtection.IsInit())
m_oProtection->toXML(writer);
writer.WriteStringC(CString(_T("</dxf>")));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("alignment") == sName )
m_oAlignment = oReader;
else if ( _T("border") == sName )
m_oBorder = oReader;
else if ( _T("fill") == sName )
m_oFill = oReader;
else if ( _T("font") == sName )
m_oFont = oReader;
else if ( _T("numFmt") == sName )
m_oNumFmt = oReader;
else if ( _T("protection") == sName )
m_oProtection = oReader;
}
}
virtual EElementType getType () const
{
return et_Dxf;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
}
public:
nullable<CAligment> m_oAlignment;
nullable<CBorder> m_oBorder;
nullable<CFill> m_oFill;
nullable<CFont> m_oFont;
nullable<CNumFmt> m_oNumFmt;
nullable<CProtection> m_oProtection;
};
class CDxfs : public WritingElementWithChilds<CDxf>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CDxfs)
CDxfs()
{
}
virtual ~CDxfs()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(_T("<dxfs"));
if(m_oCount.IsInit())
{
CString sVal;sVal.Format(_T(" count=\"%d\""), m_oCount->GetValue());
writer.WriteStringC(sVal);
}
writer.WriteStringC(_T(">"));
for(int i = 0, length = m_arrItems.GetSize(); i < length; ++i)
m_arrItems[i]->toXML(writer);
writer.WriteStringC(_T("</dxfs>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("dxf") == sName )
m_arrItems.Add( new CDxf(oReader));
}
}
virtual EElementType getType () const
{
return et_Dxfs;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("count"), m_oCount )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
}
}
#endif // OOX_DXFS_FILE_INCLUDE_H_

View File

@@ -0,0 +1,840 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_RPR_FILE_INCLUDE_H_
#define OOX_RPR_FILE_INCLUDE_H_
#include "../CommonInclude.h"
namespace OOX
{
namespace Spreadsheet
{
class CRgbColor : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CRgbColor)
CRgbColor()
{
}
virtual ~CRgbColor()
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual EElementType getType () const
{
return et_RgbColor;
}
private:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("rgb"), m_oRgb )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::Spreadsheet::CHexColor> m_oRgb;
};
class CIndexedColors : public WritingElementWithChilds<CRgbColor>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CIndexedColors)
CIndexedColors()
{
}
virtual ~CIndexedColors()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("rgbColor") == sName )
m_arrItems.Add( new CRgbColor( oReader ));
}
}
virtual EElementType getType () const
{
return et_IndexedColors;
}
static bool GetDefaultRGBAByIndex(int index, unsigned char& unR, unsigned char& unG, unsigned char& unB, unsigned char& unA)
{
unA = 255;
switch(index)
{
case 0 : unR = 0x00; unG = 0x00; unB = 0x00; break;
case 1 : unR = 0xFF; unG = 0xFF; unB = 0xFF; break;
case 2 : unR = 0xFF; unG = 0x00; unB = 0x00; break;
case 3 : unR = 0x00; unG = 0xFF; unB = 0x00; break;
case 4 : unR = 0x00; unG = 0x00; unB = 0xFF; break;
case 5 : unR = 0xFF; unG = 0xFF; unB = 0x00; break;
case 6 : unR = 0xFF; unG = 0x00; unB = 0xFF; break;
case 7 : unR = 0x00; unG = 0xFF; unB = 0xFF; break;
case 8 : unR = 0x00; unG = 0x00; unB = 0x00; break;
case 9 : unR = 0xFF; unG = 0xFF; unB = 0xFF; break;
case 10: unR = 0xFF; unG = 0x00; unB = 0x00; break;
case 11: unR = 0x00; unG = 0xFF; unB = 0x00; break;
case 12: unR = 0x00; unG = 0x00; unB = 0xFF; break;
case 13: unR = 0xFF; unG = 0xFF; unB = 0x00; break;
case 14: unR = 0xFF; unG = 0x00; unB = 0xFF; break;
case 15: unR = 0x00; unG = 0xFF; unB = 0xFF; break;
case 16: unR = 0x80; unG = 0x00; unB = 0x00; break;
case 17: unR = 0x00; unG = 0x80; unB = 0x00; break;
case 18: unR = 0x00; unG = 0x00; unB = 0x80; break;
case 19: unR = 0x80; unG = 0x80; unB = 0x00; break;
case 20: unR = 0x80; unG = 0x00; unB = 0x80; break;
case 21: unR = 0x00; unG = 0x80; unB = 0x80; break;
case 22: unR = 0xC0; unG = 0xC0; unB = 0xC0; break;
case 23: unR = 0x80; unG = 0x80; unB = 0x80; break;
case 24: unR = 0x99; unG = 0x99; unB = 0xFF; break;
case 25: unR = 0x99; unG = 0x33; unB = 0x66; break;
case 26: unR = 0xFF; unG = 0xFF; unB = 0xCC; break;
case 27: unR = 0xCC; unG = 0xFF; unB = 0xFF; break;
case 28: unR = 0x66; unG = 0x00; unB = 0x66; break;
case 29: unR = 0xFF; unG = 0x80; unB = 0x80; break;
case 30: unR = 0x00; unG = 0x66; unB = 0xCC; break;
case 31: unR = 0xCC; unG = 0xCC; unB = 0xFF; break;
case 32: unR = 0x00; unG = 0x00; unB = 0x80; break;
case 33: unR = 0xFF; unG = 0x00; unB = 0xFF; break;
case 34: unR = 0xFF; unG = 0xFF; unB = 0x00; break;
case 35: unR = 0x00; unG = 0xFF; unB = 0xFF; break;
case 36: unR = 0x80; unG = 0x00; unB = 0x80; break;
case 37: unR = 0x80; unG = 0x00; unB = 0x00; break;
case 38: unR = 0x00; unG = 0x80; unB = 0x80; break;
case 39: unR = 0x00; unG = 0x00; unB = 0xFF; break;
case 40: unR = 0x00; unG = 0xCC; unB = 0xFF; break;
case 41: unR = 0xCC; unG = 0xFF; unB = 0xFF; break;
case 42: unR = 0xCC; unG = 0xFF; unB = 0xCC; break;
case 43: unR = 0xFF; unG = 0xFF; unB = 0x99; break;
case 44: unR = 0x99; unG = 0xCC; unB = 0xFF; break;
case 45: unR = 0xFF; unG = 0x99; unB = 0xCC; break;
case 46: unR = 0xCC; unG = 0x99; unB = 0xFF; break;
case 47: unR = 0xFF; unG = 0xCC; unB = 0x99; break;
case 48: unR = 0x33; unG = 0x66; unB = 0xFF; break;
case 49: unR = 0x33; unG = 0xCC; unB = 0xCC; break;
case 50: unR = 0x99; unG = 0xCC; unB = 0x00; break;
case 51: unR = 0xFF; unG = 0xCC; unB = 0x00; break;
case 52: unR = 0xFF; unG = 0x99; unB = 0x00; break;
case 53: unR = 0xFF; unG = 0x66; unB = 0x00; break;
case 54: unR = 0x66; unG = 0x66; unB = 0x99; break;
case 55: unR = 0x96; unG = 0x96; unB = 0x96; break;
case 56: unR = 0x00; unG = 0x33; unB = 0x66; break;
case 57: unR = 0x33; unG = 0x99; unB = 0x66; break;
case 58: unR = 0x00; unG = 0x33; unB = 0x00; break;
case 59: unR = 0x33; unG = 0x33; unB = 0x00; break;
case 60: unR = 0x99; unG = 0x33; unB = 0x00; break;
case 61: unR = 0x99; unG = 0x33; unB = 0x66; break;
case 62: unR = 0x33; unG = 0x33; unB = 0x99; break;
case 63: unR = 0x33; unG = 0x33; unB = 0x33; break;
case 64: unR = 0x00; unG = 0x00; unB = 0x00; break;
case 65: unR = 0xFF; unG = 0xFF; unB = 0xFF; break;
default: return false;
}
return true;
}
static int GetDefaultIndexByRGBA( unsigned char unR, unsigned char unG, unsigned char unB, unsigned char unA)
{
if(255 != unA)
return -1;
int nIndex = -1;
if(unR == 0x00 && unG == 0x00 && unB == 0x00)
nIndex = 64;
else if(unR == 0xFF && unG == 0xFF && unB == 0xFF)
nIndex = 65;
else if(unR == 0x00 && unG == 0x00 && unB == 0x00)
nIndex = 0;
else if(unR == 0xFF && unG == 0xFF && unB == 0xFF)
nIndex = 1;
else if(unR == 0xFF && unG == 0x00 && unB == 0x00)
nIndex = 2;
else if(unR == 0x00 && unG == 0xFF && unB == 0x00)
nIndex = 3;
else if(unR == 0x00 && unG == 0x00 && unB == 0xFF)
nIndex = 4;
else if(unR == 0xFF && unG == 0xFF && unB == 0x00)
nIndex = 5;
else if(unR == 0xFF && unG == 0x00 && unB == 0xFF)
nIndex = 6;
else if(unR == 0x00 && unG == 0xFF && unB == 0xFF)
nIndex = 7;
else if(unR == 0x00 && unG == 0x00 && unB == 0x00)
nIndex = 8;
else if(unR == 0xFF && unG == 0xFF && unB == 0xFF)
nIndex = 9;
else if(unR == 0xFF && unG == 0x00 && unB == 0x00)
nIndex = 10;
else if(unR == 0x00 && unG == 0xFF && unB == 0x00)
nIndex = 11;
else if(unR == 0x00 && unG == 0x00 && unB == 0xFF)
nIndex = 12;
else if(unR == 0xFF && unG == 0xFF && unB == 0x00)
nIndex = 13;
else if(unR == 0xFF && unG == 0x00 && unB == 0xFF)
nIndex = 14;
else if(unR == 0x00 && unG == 0xFF && unB == 0xFF)
nIndex = 15;
else if(unR == 0x80 && unG == 0x00 && unB == 0x00)
nIndex = 16;
else if(unR == 0x00 && unG == 0x80 && unB == 0x00)
nIndex = 17;
else if(unR == 0x00 && unG == 0x00 && unB == 0x80)
nIndex = 18;
else if(unR == 0x80 && unG == 0x80 && unB == 0x00)
nIndex = 19;
else if(unR == 0x80 && unG == 0x00 && unB == 0x80)
nIndex = 20;
else if(unR == 0x00 && unG == 0x80 && unB == 0x80)
nIndex = 21;
else if(unR == 0xC0 && unG == 0xC0 && unB == 0xC0)
nIndex = 22;
else if(unR == 0x80 && unG == 0x80 && unB == 0x80)
nIndex = 23;
else if(unR == 0x99 && unG == 0x99 && unB == 0xFF)
nIndex = 24;
else if(unR == 0x99 && unG == 0x33 && unB == 0x66)
nIndex = 25;
else if(unR == 0xFF && unG == 0xFF && unB == 0xCC)
nIndex = 26;
else if(unR == 0xCC && unG == 0xFF && unB == 0xFF)
nIndex = 27;
else if(unR == 0x66 && unG == 0x00 && unB == 0x66)
nIndex = 28;
else if(unR == 0xFF && unG == 0x80 && unB == 0x80)
nIndex = 29;
else if(unR == 0x00 && unG == 0x66 && unB == 0xCC)
nIndex = 30;
else if(unR == 0xCC && unG == 0xCC && unB == 0xFF)
nIndex = 31;
else if(unR == 0x00 && unG == 0x00 && unB == 0x80)
nIndex = 32;
else if(unR == 0xFF && unG == 0x00 && unB == 0xFF)
nIndex = 33;
else if(unR == 0xFF && unG == 0xFF && unB == 0x00)
nIndex = 34;
else if(unR == 0x00 && unG == 0xFF && unB == 0xFF)
nIndex = 35;
else if(unR == 0x80 && unG == 0x00 && unB == 0x80)
nIndex = 36;
else if(unR == 0x80 && unG == 0x00 && unB == 0x00)
nIndex = 37;
else if(unR == 0x00 && unG == 0x80 && unB == 0x80)
nIndex = 38;
else if(unR == 0x00 && unG == 0x00 && unB == 0xFF)
nIndex = 39;
else if(unR == 0x00 && unG == 0xCC && unB == 0xFF)
nIndex = 40;
else if(unR == 0xCC && unG == 0xFF && unB == 0xFF)
nIndex = 41;
else if(unR == 0xCC && unG == 0xFF && unB == 0xCC)
nIndex = 42;
else if(unR == 0xFF && unG == 0xFF && unB == 0x99)
nIndex = 43;
else if(unR == 0x99 && unG == 0xCC && unB == 0xFF)
nIndex = 44;
else if(unR == 0xFF && unG == 0x99 && unB == 0xCC)
nIndex = 45;
else if(unR == 0xCC && unG == 0x99 && unB == 0xFF)
nIndex = 46;
else if(unR == 0xFF && unG == 0xCC && unB == 0x99)
nIndex = 47;
else if(unR == 0x33 && unG == 0x66 && unB == 0xFF)
nIndex = 48;
else if(unR == 0x33 && unG == 0xCC && unB == 0xCC)
nIndex = 49;
else if(unR == 0x99 && unG == 0xCC && unB == 0x00)
nIndex = 50;
else if(unR == 0xFF && unG == 0xCC && unB == 0x00)
nIndex = 51;
else if(unR == 0xFF && unG == 0x99 && unB == 0x00)
nIndex = 52;
else if(unR == 0xFF && unG == 0x66 && unB == 0x00)
nIndex = 53;
else if(unR == 0x66 && unG == 0x66 && unB == 0x99)
nIndex = 54;
else if(unR == 0x96 && unG == 0x96 && unB == 0x96)
nIndex = 55;
else if(unR == 0x00 && unG == 0x33 && unB == 0x66)
nIndex = 56;
else if(unR == 0x33 && unG == 0x99 && unB == 0x66)
nIndex = 57;
else if(unR == 0x00 && unG == 0x33 && unB == 0x00)
nIndex = 58;
else if(unR == 0x33 && unG == 0x33 && unB == 0x00)
nIndex = 59;
else if(unR == 0x99 && unG == 0x33 && unB == 0x00)
nIndex = 60;
else if(unR == 0x99 && unG == 0x33 && unB == 0x66)
nIndex = 61;
else if(unR == 0x33 && unG == 0x33 && unB == 0x99)
nIndex = 62;
else if(unR == 0x33 && unG == 0x33 && unB == 0x33)
nIndex = 63;
return nIndex;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
}
};
class CColor : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CColor)
CColor()
{
}
virtual ~CColor()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
toXML2(writer, _T("color"));
}
void toXML2(CStringWriter& writer, CString sName) const
{
writer.WriteStringC(_T("<"));
writer.WriteStringC(sName);
if(m_oAuto.IsInit())
{
CString sVal;sVal.Format(_T(" auto=\"%s\""), m_oAuto->ToString2(SimpleTypes::onofftostring1));
writer.WriteStringC(sVal);
}
if(m_oIndexed.IsInit())
{
CString sVal;sVal.Format(_T(" indexed=\"%d\""), m_oIndexed->GetValue());
writer.WriteStringC(sVal);
}
if(m_oRgb.IsInit())
{
int nIndex = OOX::Spreadsheet::CIndexedColors::GetDefaultIndexByRGBA(m_oRgb->Get_R(), m_oRgb->Get_G(), m_oRgb->Get_B(), m_oRgb->Get_A());
if(-1 == nIndex)
{
CString sVal;sVal.Format(_T(" rgb=\"%s\""), m_oRgb->ToString());
writer.WriteStringC(sVal);
}
else
{
CString sVal;sVal.Format(_T(" indexed=\"%d\""), nIndex);
writer.WriteStringC(sVal);
}
}
if(m_oThemeColor.IsInit())
{
CString sVal;sVal.Format(_T(" theme=\"%d\""), m_oThemeColor->GetValue());
writer.WriteStringC(sVal);
}
if(m_oTint.IsInit())
{
CString sVal;sVal.Format(_T(" tint=\"%s\""), SpreadsheetCommon::WriteDouble(m_oTint->GetValue()));
writer.WriteStringC(sVal);
}
writer.WriteStringC(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual EElementType getType () const
{
return et_Color;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("auto"), m_oAuto )
WritingElement_ReadAttributes_Read_if ( oReader, _T("indexed"), m_oIndexed )
WritingElement_ReadAttributes_Read_if ( oReader, _T("rgb"), m_oRgb )
WritingElement_ReadAttributes_Read_if ( oReader, _T("theme"), m_oThemeColor )
WritingElement_ReadAttributes_Read_if ( oReader, _T("tint"), m_oTint )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::COnOff<>> m_oAuto;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oIndexed;
nullable<SimpleTypes::Spreadsheet::CHexColor> m_oRgb;
nullable<SimpleTypes::Spreadsheet::CThemeColor<>> m_oThemeColor;
nullable<SimpleTypes::CDouble> m_oTint;
};
class CMruColors : public WritingElementWithChilds<CColor>
{
public:
WritingElementSpreadsheet_AdditionConstructors(CMruColors)
CMruColors()
{
}
virtual ~CMruColors()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("color") == sName )
m_arrItems.Add( new CColor( oReader ));
}
}
virtual EElementType getType () const
{
return et_MruColors;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
}
};
class CCharset
{
public:
WritingElementSpreadsheet_AdditionConstructors(CCharset)
CCharset()
{
}
virtual ~CCharset()
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), m_oCharset )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::Spreadsheet::CFontCharset<>> m_oCharset;
};
class CVerticalAlign
{
public:
WritingElementSpreadsheet_AdditionConstructors(CVerticalAlign)
CVerticalAlign()
{
}
virtual ~CVerticalAlign()
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), m_oVerticalAlign )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CVerticalAlignRun<>> m_oVerticalAlign;
};
class CFontFamily
{
public:
WritingElementSpreadsheet_AdditionConstructors(CFontFamily)
CFontFamily()
{
}
virtual ~CFontFamily()
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), m_oFontFamily )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CFontFamily<>> m_oFontFamily;
};
class CFontScheme
{
public:
WritingElementSpreadsheet_AdditionConstructors(CFontScheme)
CFontScheme()
{
}
virtual ~CFontScheme()
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), m_oFontScheme )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::Spreadsheet::CFontScheme<>> m_oFontScheme;
};
class CUnderline
{
public:
WritingElementSpreadsheet_AdditionConstructors(CUnderline)
CUnderline()
{
}
virtual ~CUnderline()
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), m_oUnderline )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::Spreadsheet::CUnderline<>> m_oUnderline;
};
class CRPr : public WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors(CRPr)
CRPr()
{
}
virtual ~CRPr()
{
}
public:
virtual CString toXML() const
{
return _T("");
}
virtual void toXML(CStringWriter& writer) const
{
writer.WriteStringC(_T("<rPr>"));
if(m_oBold.IsInit())
{
if(SimpleTypes::onoffTrue == m_oBold->m_oVal.GetValue())
writer.WriteStringC(_T("<b/>"));
else
writer.WriteStringC(_T("<b val=\"false\"/>"));
}
if(m_oCharset.IsInit() && m_oCharset->m_oCharset.IsInit())
{
CString sVal;sVal.Format(_T("<charset val=\"%s\"/>"), m_oCharset->m_oCharset->ToString());
writer.WriteStringC(sVal);
}
if(m_oColor.IsInit())
m_oColor->toXML2(writer, _T("color"));
if(m_oCondense.IsInit())
{
if(SimpleTypes::onoffTrue == m_oCondense->m_oVal.GetValue())
writer.WriteStringC(_T("<condense/>"));
else
writer.WriteStringC(_T("<condense val=\"false\"/>"));
}
if(m_oExtend.IsInit())
{
if(SimpleTypes::onoffTrue == m_oExtend->m_oVal.GetValue())
writer.WriteStringC(_T("<extend/>"));
else
writer.WriteStringC(_T("<extend val=\"false\"/>"));
}
if(m_oFamily.IsInit() && m_oFamily->m_oFontFamily.IsInit())
{
CString sVal;sVal.Format(_T("<family val=\"%s\"/>"), m_oFamily->m_oFontFamily->ToString());
writer.WriteStringC(sVal);
}
if(m_oItalic.IsInit())
{
if(SimpleTypes::onoffTrue == m_oItalic->m_oVal.GetValue())
writer.WriteStringC(_T("<i/>"));
else
writer.WriteStringC(_T("<i val=\"false\"/>"));
}
if(m_oOutline.IsInit())
{
if(SimpleTypes::onoffTrue == m_oOutline->m_oVal.GetValue())
writer.WriteStringC(_T("<outline/>"));
else
writer.WriteStringC(_T("<outline val=\"false\"/>"));
}
if(m_oRFont.IsInit() && m_oRFont->m_sVal.IsInit())
{
CString sVal;sVal.Format(_T("<rFont val=\"%s\"/>"), XmlUtils::EncodeXmlString(m_oRFont->m_sVal.get()));
writer.WriteStringC(sVal);
}
if(m_oScheme.IsInit() && m_oScheme->m_oFontScheme.IsInit())
{
CString sVal;sVal.Format(_T("<scheme val=\"%s\"/>"), m_oScheme->m_oFontScheme->ToString());
writer.WriteStringC(sVal);
}
if(m_oShadow.IsInit())
{
if(SimpleTypes::onoffTrue == m_oShadow->m_oVal.GetValue())
writer.WriteStringC(_T("<shadow/>"));
else
writer.WriteStringC(_T("<shadow val=\"false\"/>"));
}
if(m_oStrike.IsInit())
{
if(SimpleTypes::onoffTrue == m_oStrike->m_oVal.GetValue())
writer.WriteStringC(_T("<strike/>"));
else
writer.WriteStringC(_T("<strike val=\"false\"/>"));
}
if(m_oSz.IsInit() && m_oSz->m_oVal.IsInit())
{
CString sVal;sVal.Format(_T("<sz val=\"%s\"/>"), SpreadsheetCommon::WriteDouble(m_oSz->m_oVal->GetValue()));
writer.WriteStringC(sVal);
}
if(m_oUnderline.IsInit() && m_oUnderline->m_oUnderline.IsInit())
{
CString sVal;
if( SimpleTypes::underlineSingle != m_oUnderline->m_oUnderline->GetValue())
sVal.Format(_T("<u val=\"%s\"/>"), m_oUnderline->m_oUnderline->ToString());
else
sVal.Format(_T("<u/>"), m_oUnderline->m_oUnderline->ToString());
writer.WriteStringC(sVal);
}
if(m_oVertAlign.IsInit() && m_oVertAlign->m_oVerticalAlign.IsInit())
{
CString sVal;sVal.Format(_T("<vertAlign val=\"%s\"/>"), m_oVertAlign->m_oVerticalAlign->ToString());
writer.WriteStringC(sVal);
}
writer.WriteStringC(_T("</rPr>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("b") == sName )
m_oBold = oReader;
else if ( _T("charset") == sName )
m_oCharset = oReader;
else if ( _T("color") == sName )
m_oColor = oReader;
else if ( _T("condense") == sName )
m_oCondense = oReader;
else if ( _T("extend") == sName )
m_oExtend = oReader;
else if ( _T("family") == sName )
m_oFamily = oReader;
else if ( _T("i") == sName )
m_oItalic = oReader;
else if ( _T("outline") == sName )
m_oOutline = oReader;
else if ( _T("rFont") == sName || _T("name") == sName)
m_oRFont = oReader;
else if ( _T("scheme") == sName )
m_oScheme = oReader;
else if ( _T("shadow") == sName )
m_oShadow = oReader;
else if ( _T("strike") == sName )
m_oStrike = oReader;
else if ( _T("sz") == sName )
m_oSz = oReader;
else if ( _T("u") == sName )
m_oUnderline = oReader;
else if ( _T("vertAlign") == sName )
m_oVertAlign = oReader;
}
}
virtual EElementType getType () const
{
return et_rPr;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
}
public:
nullable<ComplexTypes::Spreadsheet::COnOff2<SimpleTypes::onoffTrue> > m_oBold;
nullable<CCharset> m_oCharset;
nullable<CColor> m_oColor;
nullable<ComplexTypes::Spreadsheet::COnOff2<SimpleTypes::onoffTrue> > m_oCondense;
nullable<ComplexTypes::Spreadsheet::COnOff2<SimpleTypes::onoffTrue> > m_oExtend;
nullable<CFontFamily > m_oFamily;
nullable<ComplexTypes::Spreadsheet::COnOff2<SimpleTypes::onoffTrue> > m_oItalic;
nullable<ComplexTypes::Spreadsheet::COnOff2<SimpleTypes::onoffTrue> > m_oOutline;
nullable<ComplexTypes::Spreadsheet::CString_> m_oRFont;
nullable<CFontScheme> m_oScheme;
nullable<ComplexTypes::Spreadsheet::COnOff2<SimpleTypes::onoffTrue> > m_oShadow;
nullable<ComplexTypes::Spreadsheet::COnOff2<SimpleTypes::onoffTrue> > m_oStrike;
nullable<ComplexTypes::Spreadsheet::CDouble> m_oSz;
nullable<CUnderline> m_oUnderline;
nullable<CVerticalAlign> m_oVertAlign;
};
}
}
#endif // OOX_RPR_FILE_INCLUDE_H_