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,179 @@
/*
* (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 PPTX_LOGIC_TABLE_INCLUDE_H_
#define PPTX_LOGIC_TABLE_INCLUDE_H_
#include "./../../WrapperWritingElement.h"
#include "TableCol.h"
#include "TableRow.h"
#include "TableProperties.h"
namespace PPTX
{
namespace Logic
{
class Table : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Table)
Table& operator=(const Table& oSrc)
{
parentFile = oSrc.parentFile;
parentElement = oSrc.parentElement;
TableCols.Copy(oSrc.TableCols);
TableRows.Copy(oSrc.TableRows);
TableProperties = oSrc.TableProperties;
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
XmlUtils::CXmlNode oNode;
if (node.GetNode(_T("a:tblGrid"), oNode))
oNode.LoadArray(_T("a:gridCol"), TableCols);
node.LoadArray(_T("a:tr"), TableRows);
TableProperties = node.ReadNode(_T("a:tblPr"));
FillParentPointersForChilds();
}
virtual CString toXML() const
{
XmlUtils::CNodeValue oValue;
oValue.WriteNullable(TableProperties);
oValue.WriteArray(TableRows);
oValue.WriteArray(_T("a:tblGrid"), TableCols);
return XmlUtils::CreateNode(_T("a:tbl"), oValue);
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteRecord2(0, TableProperties);
pWriter->WriteRecordArray(1, 0, TableCols);
pWriter->WriteRecordArray(2, 0, TableRows);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
while (pReader->GetPos() < _end_rec)
{
BYTE _at = pReader->GetUChar();
switch (_at)
{
case 0:
{
TableProperties = new Logic::TableProperties();
TableProperties->fromPPTY(pReader);
break;
}
case 1:
{
pReader->Skip(4);
LONG lCount = pReader->GetLong();
for (LONG i = 0; i < lCount; ++i)
{
pReader->Skip(1);
TableCols.Add();
TableCols[i].fromPPTY(pReader);
}
break;
}
case 2:
{
pReader->Skip(4);
LONG lCount = pReader->GetLong();
for (LONG i = 0; i < lCount; ++i)
{
pReader->Skip(1);
TableRows.Add();
TableRows[i].fromPPTY(pReader);
}
}
default:
{
break;
}
}
}
pReader->Seek(_end_rec);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("a:tbl"));
pWriter->EndAttributes();
pWriter->Write(TableProperties);
pWriter->WriteString(_T("<a:tblGrid>"));
size_t n1 = TableCols.GetCount();
for (size_t i = 0; i < n1; ++i)
TableCols[i].toXmlWriter(pWriter);
pWriter->WriteString(_T("</a:tblGrid>"));
size_t n2 = TableRows.GetCount();
for (size_t i = 0; i < n2; ++i)
TableRows[i].toXmlWriter(pWriter);
pWriter->EndNode(_T("a:tbl"));
}
public:
CAtlArray<TableCol> TableCols;
CAtlArray<TableRow> TableRows;
nullable<TableProperties> TableProperties;
protected:
virtual void FillParentPointersForChilds()
{
if (TableProperties.IsInit())
TableProperties->SetParentPointer(this);
size_t count = TableRows.GetCount();
for (size_t i = 0; i < count; ++i)
TableRows[i].SetParentPointer(this);
}
};
}
}
#endif // PPTX_LOGIC_TABLE_INCLUDE_H_

View File

@@ -0,0 +1,109 @@
/*
* (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
*
*/
#include "./stdafx.h"
#include "TableCell.h"
#include "../../Slide.h"
namespace PPTX
{
namespace Logic
{
TableCell::TableCell()
{
}
TableCell::~TableCell()
{
}
TableCell::TableCell(XmlUtils::CXmlNode& node)
{
fromXML(node);
}
const TableCell& TableCell::operator =(XmlUtils::CXmlNode& node)
{
fromXML(node);
return *this;
}
void TableCell::fromXML(XmlUtils::CXmlNode& node)
{
TxBody = node.ReadNodeNoNS(_T("txBody"));
CellProperties = node.ReadNode(_T("a:tcPr"));
node.ReadAttributeBase(L"rowSpan", RowSpan);
node.ReadAttributeBase(L"gridSpan", GridSpan);
node.ReadAttributeBase(L"hMerge", HMerge);
node.ReadAttributeBase(L"vMerge", VMerge);
node.ReadAttributeBase(L"id", Id);
FillParentPointersForChilds();
}
CString TableCell::toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("rowSpan"), RowSpan);
oAttr.Write(_T("gridSpan"), GridSpan);
oAttr.Write(_T("hMerge"), HMerge);
oAttr.Write(_T("vMerge"), VMerge);
oAttr.Write(_T("id"), Id);
XmlUtils::CNodeValue oValue;
oValue.WriteNullable(TxBody);
oValue.WriteNullable(CellProperties);
return XmlUtils::CreateNode(_T("a:tc"), oAttr, oValue);
}
void TableCell::FillParentPointersForChilds()
{
if(TxBody.IsInit())
TxBody->SetParentPointer(this);
if(CellProperties.IsInit())
CellProperties->SetParentPointer(this);
}
void TableCell::GetShapeProperties(ShapeProperties& props)const
{
if(parentFileIs<Slide>())
{
parentFileAs<Slide>().FillShapeProperties(props, _T("table-cell"));
props.FillFromTextBody(TxBody);
}
}
}
} // namespace PPTX

View File

@@ -0,0 +1,176 @@
/*
* (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 PPTX_LOGIC_TABLE_CELL_INCLUDE_H_
#define PPTX_LOGIC_TABLE_CELL_INCLUDE_H_
#include "./../../WrapperWritingElement.h"
#include "./../TxBody.h"
#include "TableCellProperties.h"
#include "../ShapeProperties.h"
namespace PPTX
{
namespace Logic
{
class TableCell : public WrapperWritingElement
{
public:
TableCell();
virtual ~TableCell();
explicit TableCell(XmlUtils::CXmlNode& node);
const TableCell& operator =(XmlUtils::CXmlNode& node);
public:
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual CString toXML() const;
virtual void GetShapeProperties(ShapeProperties& props)const;
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("a:tc"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("rowSpan"), RowSpan);
pWriter->WriteAttribute(_T("gridSpan"), GridSpan);
pWriter->WriteAttribute(_T("hMerge"), HMerge);
pWriter->WriteAttribute(_T("vMerge"), VMerge);
pWriter->WriteAttribute(_T("id"), Id);
pWriter->EndAttributes();
pWriter->Write(TxBody);
pWriter->Write(CellProperties);
pWriter->EndNode(_T("a:tc"));
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteString2(0, Id);
pWriter->WriteInt2(1, RowSpan);
pWriter->WriteInt2(2, GridSpan);
pWriter->WriteBool2(3, HMerge);
pWriter->WriteBool2(4, VMerge);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->WriteRecord2(0, CellProperties);
pWriter->WriteRecord2(1, TxBody);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1);
while (true)
{
BYTE _at = pReader->GetUChar();
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
{
Id = pReader->GetString2();
break;
}
case 1:
{
RowSpan = pReader->GetLong();
break;
}
case 2:
{
GridSpan = pReader->GetLong();
break;
}
case 3:
{
HMerge = pReader->GetBool();
break;
}
case 4:
{
VMerge = pReader->GetBool();
break;
}
default:
break;
}
}
while (pReader->GetPos() < _end_rec)
{
BYTE _at = pReader->GetUChar();
switch (_at)
{
case 0:
{
CellProperties = new TableCellProperties();
CellProperties->fromPPTY(pReader);
break;
}
case 1:
{
TxBody = new Logic::TxBody();
TxBody->fromPPTY(pReader);
TxBody->m_ns = _T("a");
break;
}
default:
break;
}
}
pReader->Seek(_end_rec);
}
public:
nullable<TxBody> TxBody;
nullable<TableCellProperties> CellProperties;
nullable_int RowSpan;
nullable_int GridSpan;
nullable_bool HMerge;
nullable_bool VMerge;
nullable_string Id;
protected:
virtual void FillParentPointersForChilds();
};
}
}
#endif // PPTX_LOGIC_TABLE_CELL_INCLUDE_H_

View File

@@ -0,0 +1,351 @@
/*
* (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 PPTX_LOGIC_TABLE_CELLPROPERTIES_INCLUDE_H_
#define PPTX_LOGIC_TABLE_CELLPROPERTIES_INCLUDE_H_
#include "./../../WrapperWritingElement.h"
#include "./../../Limit/TextVerticalType.h"
#include "./../../Limit/TextAnchor.h"
#include "./../../Limit/HorzOverflow.h"
#include "./../Ln.h"
#include "./../Cell3D.h"
#include "./../UniFill.h"
namespace PPTX
{
namespace Logic
{
class TableCellProperties : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(TableCellProperties)
TableCellProperties& operator=(const TableCellProperties& oSrc)
{
parentFile = oSrc.parentFile;
parentElement = oSrc.parentElement;
LnL = oSrc.LnL;
LnR = oSrc.LnR;
LnT = oSrc.LnT;
LnB = oSrc.LnB;
LnTlToBr = oSrc.LnTlToBr;
LnBlToTr = oSrc.LnBlToTr;
Cell3D = oSrc.Cell3D;
Fill = oSrc.Fill;
MarL = oSrc.MarL;
MarR = oSrc.MarR;
MarT = oSrc.MarT;
MarB = oSrc.MarB;
Vert = oSrc.Vert;
Anchor = oSrc.Anchor;
AnchorCtr = oSrc.AnchorCtr;
HorzOverflow = oSrc.HorzOverflow;
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
LnL = node.ReadNode(_T("a:lnL"));
LnR = node.ReadNode(_T("a:lnR"));
LnT = node.ReadNode(_T("a:lnT"));
LnB = node.ReadNode(_T("a:lnB"));
LnTlToBr = node.ReadNode(_T("a:lnTlToBr"));
LnBlToTr = node.ReadNode(_T("a:lnBlToTr"));
Cell3D = node.ReadNode(_T("a:cell3D"));
Fill.GetFillFrom(node);
node.ReadAttributeBase(L"marL", MarL);
node.ReadAttributeBase(L"marR", MarR);
node.ReadAttributeBase(L"marT", MarT);
node.ReadAttributeBase(L"marB", MarB);
node.ReadAttributeBase(L"vert", Vert);
node.ReadAttributeBase(L"anchor", Anchor);
node.ReadAttributeBase(L"anchorCtr", AnchorCtr);
node.ReadAttributeBase(L"horzOverflow", HorzOverflow);
FillParentPointersForChilds();
}
virtual CString toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("marL"), MarL);
oAttr.Write(_T("marR"), MarR);
oAttr.Write(_T("marT"), MarT);
oAttr.Write(_T("marB"), MarB);
oAttr.WriteLimitNullable(_T("vert"), Vert);
oAttr.WriteLimitNullable(_T("anchor"), Anchor);
oAttr.Write(_T("anchorCtr"), AnchorCtr);
oAttr.WriteLimitNullable(_T("horzOverflow"), HorzOverflow);
XmlUtils::CNodeValue oValue;
oValue.WriteNullable(LnL);
oValue.WriteNullable(LnR);
oValue.WriteNullable(LnT);
oValue.WriteNullable(LnB);
oValue.WriteNullable(LnTlToBr);
oValue.WriteNullable(LnBlToTr);
oValue.WriteNullable(Cell3D);
oValue.Write(Fill);
return XmlUtils::CreateNode(_T("a:tcPr"), oAttr, oValue);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("a:tcPr"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("marL"), MarL);
pWriter->WriteAttribute(_T("marR"), MarR);
pWriter->WriteAttribute(_T("marT"), MarT);
pWriter->WriteAttribute(_T("marB"), MarB);
pWriter->WriteAttribute(_T("vert"), Vert);
pWriter->WriteAttribute(_T("anchor"), Anchor);
pWriter->WriteAttribute(_T("anchorCtr"), AnchorCtr);
pWriter->WriteAttribute(_T("horzOverflow"), HorzOverflow);
pWriter->EndAttributes();
pWriter->Write(LnL);
pWriter->Write(LnR);
pWriter->Write(LnT);
pWriter->Write(LnB);
pWriter->Write(LnTlToBr);
pWriter->Write(LnBlToTr);
Fill.toXmlWriter(pWriter);
pWriter->Write(Cell3D);
pWriter->EndNode(_T("a:tcPr"));
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteInt2(0, MarL);
pWriter->WriteInt2(1, MarT);
pWriter->WriteInt2(2, MarR);
pWriter->WriteInt2(3, MarB);
pWriter->WriteBool2(4, AnchorCtr);
pWriter->WriteLimit2(5, Vert);
pWriter->WriteLimit2(6, Anchor);
pWriter->WriteLimit2(7, HorzOverflow);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->WriteRecord2(0, LnL);
pWriter->WriteRecord2(1, LnT);
pWriter->WriteRecord2(2, LnR);
pWriter->WriteRecord2(3, LnB);
pWriter->WriteRecord2(4, LnTlToBr);
pWriter->WriteRecord2(5, LnBlToTr);
pWriter->WriteRecord1(6, Fill);
pWriter->WriteRecord2(7, Cell3D);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1);
while (true)
{
BYTE _at = pReader->GetUChar();
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
{
MarL = pReader->GetLong();
break;
}
case 1:
{
MarT = pReader->GetLong();
break;
}
case 2:
{
MarR = pReader->GetLong();
break;
}
case 3:
{
MarB = pReader->GetLong();
break;
}
case 4:
{
AnchorCtr = pReader->GetBool();
break;
}
case 5:
{
Vert = new Limit::TextVerticalType();
Vert->SetBYTECode(pReader->GetUChar());
break;
}
case 6:
{
Anchor = new Limit::TextAnchor();
Anchor->SetBYTECode(pReader->GetUChar());
break;
}
case 7:
{
HorzOverflow = new Limit::HorzOverflow();
HorzOverflow->SetBYTECode(pReader->GetUChar());
break;
}
default:
break;
}
}
while (pReader->GetPos() < _end_rec)
{
BYTE _at = pReader->GetUChar();
switch (_at)
{
case 0:
{
LnL = new Ln();
LnL->fromPPTY(pReader);
LnL->m_name = _T("a:lnL");
break;
}
case 1:
{
LnT = new Ln();
LnT->fromPPTY(pReader);
LnT->m_name = _T("a:lnT");
break;
}
case 2:
{
LnR = new Ln();
LnR->fromPPTY(pReader);
LnR->m_name = _T("a:lnR");
break;
}
case 3:
{
LnB = new Ln();
LnB->fromPPTY(pReader);
LnB->m_name = _T("a:lnB");
break;
}
case 4:
{
LnTlToBr = new Ln();
LnTlToBr->fromPPTY(pReader);
LnTlToBr->m_name = _T("a:lnTlToBr");
break;
}
case 5:
{
LnBlToTr = new Ln();
LnBlToTr->fromPPTY(pReader);
LnBlToTr->m_name = _T("a:lnBlToTr");
break;
}
case 6:
{
Fill.fromPPTY(pReader);
break;
}
case 7:
{
Cell3D = new Logic::Cell3D();
Cell3D->fromPPTY(pReader);
break;
}
default:
break;
}
}
pReader->Seek(_end_rec);
}
public:
nullable<Ln> LnL;
nullable<Ln> LnR;
nullable<Ln> LnT;
nullable<Ln> LnB;
nullable<Ln> LnTlToBr;
nullable<Ln> LnBlToTr;
nullable<Cell3D> Cell3D;
UniFill Fill;
nullable_int MarL;
nullable_int MarR;
nullable_int MarT;
nullable_int MarB;
nullable_limit<Limit::TextVerticalType> Vert;
nullable_limit<Limit::TextAnchor> Anchor;
nullable_bool AnchorCtr;
nullable_limit<Limit::HorzOverflow> HorzOverflow;
protected:
virtual void FillParentPointersForChilds()
{
if(LnL.IsInit())
LnL->SetParentPointer(this);
if(LnR.IsInit())
LnR->SetParentPointer(this);
if(LnT.IsInit())
LnT->SetParentPointer(this);
if(LnB.IsInit())
LnB->SetParentPointer(this);
if(LnTlToBr.IsInit())
LnTlToBr->SetParentPointer(this);
if(LnBlToTr.IsInit())
LnBlToTr->SetParentPointer(this);
if(Cell3D.IsInit())
Cell3D->SetParentPointer(this);
if(Fill.is_init())
Fill.SetParentPointer(this);
}
};
}
}
#endif // PPTX_LOGIC_TABLE_CELLPROPERTIES_INCLUDE_H_

View File

@@ -0,0 +1,120 @@
/*
* (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 PPTX_LOGIC_TABLECOL_INCLUDE_H_
#define PPTX_LOGIC_TABLECOL_INCLUDE_H_
#include "./../../WrapperWritingElement.h"
namespace PPTX
{
namespace Logic
{
class TableCol : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(TableCol)
TableCol& operator=(const TableCol& oSrc)
{
parentFile = oSrc.parentFile;
parentElement = oSrc.parentElement;
Width = oSrc.Width;
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
Width = node.ReadAttributeInt(L"w");
}
virtual CString toXML() const
{
CString str = _T("");
str.Format(_T("<a:gridCol w=\"%d\" />"), Width);
return str;
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("a:gridCol"));
pWriter->StartAttributes();
pWriter->WriteAttribute(L"w", Width);
pWriter->EndAttributes();
pWriter->EndNode(_T("a:gridCol"));
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteInt1(0, Width);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1);
while (true)
{
BYTE _at = pReader->GetUChar();
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
{
Width = pReader->GetLong();
break;
}
default:
break;
}
}
pReader->Seek(_end_rec);
}
public:
int Width;
protected:
virtual void FillParentPointersForChilds(){};
};
}
}
#endif // PPTX_LOGIC_TABLECOL_INCLUDE_H_

View File

@@ -0,0 +1,260 @@
/*
* (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 PPTX_LOGIC_TABLE_PROPERTIES_INCLUDE_H_
#define PPTX_LOGIC_TABLE_PROPERTIES_INCLUDE_H_
#include "./../../WrapperWritingElement.h"
#include "./../UniFill.h"
#include "./../EffectProperties.h"
namespace PPTX
{
namespace Logic
{
class TableProperties : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(TableProperties)
TableProperties& operator=(const TableProperties& oSrc)
{
parentFile = oSrc.parentFile;
parentElement = oSrc.parentElement;
Fill = oSrc.Fill;
Effects = oSrc.Effects;
TableStyleId = oSrc.TableStyleId;
Rtl = oSrc.Rtl;
FirstRow = oSrc.FirstRow;
FirstCol = oSrc.FirstCol;
LastRow = oSrc.LastRow;
LastCol = oSrc.LastCol;
BandRow = oSrc.BandRow;
BandCol = oSrc.BandCol;
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
Fill.GetFillFrom(node);
Effects.GetEffectListFrom(node);
XmlUtils::CXmlNode oNode;
if (node.GetNode(_T("a:tableStyleId"), oNode))
TableStyleId = oNode.GetTextExt();
node.ReadAttributeBase(L"rtl", Rtl);
node.ReadAttributeBase(L"firstRow", FirstRow);
node.ReadAttributeBase(L"firstCol", FirstCol);
node.ReadAttributeBase(L"lastRow", LastRow);
node.ReadAttributeBase(L"lastCol", LastCol);
node.ReadAttributeBase(L"bandRow", BandRow);
node.ReadAttributeBase(L"bandCol", BandCol);
FillParentPointersForChilds();
}
virtual CString toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("rtl"), Rtl);
oAttr.Write(_T("firstRow"), FirstRow);
oAttr.Write(_T("firstCol"), FirstCol);
oAttr.Write(_T("lastRow"), LastRow);
oAttr.Write(_T("lastCol"), LastCol);
oAttr.Write(_T("bandRow"), BandRow);
oAttr.Write(_T("bandCol"), BandCol);
XmlUtils::CNodeValue oValue;
oValue.Write(Fill);
oValue.Write(Effects);
if (TableStyleId.IsInit())
oValue.m_strValue += (_T("<a:tableStyleId>") + *TableStyleId + _T("</a:tableStyleId>"));
return XmlUtils::CreateNode(_T("a:tblPr"), oAttr, oValue);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("a:tblPr"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("rtl"), Rtl);
pWriter->WriteAttribute(_T("firstRow"), FirstRow);
pWriter->WriteAttribute(_T("firstCol"), FirstCol);
pWriter->WriteAttribute(_T("lastRow"), LastRow);
pWriter->WriteAttribute(_T("lastCol"), LastCol);
pWriter->WriteAttribute(_T("bandRow"), BandRow);
pWriter->WriteAttribute(_T("bandCol"), BandCol);
pWriter->EndAttributes();
if (TableStyleId.is_init())
pWriter->WriteString(_T("<a:tableStyleId>") + *TableStyleId + _T("</a:tableStyleId>"));
Fill.toXmlWriter(pWriter);
Effects.toXmlWriter(pWriter);
pWriter->EndNode(_T("a:tblPr"));
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteString2(0, TableStyleId);
pWriter->WriteBool2(1, Rtl);
pWriter->WriteBool2(2, FirstRow);
pWriter->WriteBool2(3, FirstCol);
pWriter->WriteBool2(4, LastRow);
pWriter->WriteBool2(5, LastCol);
pWriter->WriteBool2(6, BandRow);
pWriter->WriteBool2(7, BandCol);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->WriteRecord1(0, Fill);
pWriter->WriteRecord1(1, Effects);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1);
while (true)
{
BYTE _at = pReader->GetUChar();
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
{
TableStyleId = pReader->GetString2();
break;
}
case 1:
{
Rtl = pReader->GetBool();
break;
}
case 2:
{
FirstRow = pReader->GetBool();
break;
}
case 3:
{
FirstCol = pReader->GetBool();
break;
}
case 4:
{
LastRow = pReader->GetBool();
break;
}
case 5:
{
LastCol = pReader->GetBool();
break;
}
case 6:
{
BandRow = pReader->GetBool();
break;
}
case 7:
{
BandCol = pReader->GetBool();
break;
}
default:
break;
}
}
while (pReader->GetPos() < _end_rec)
{
BYTE _at = pReader->GetUChar();
switch (_at)
{
case 0:
{
Fill.fromPPTY(pReader);
break;
}
case 1:
{
Effects.fromPPTY(pReader);
break;
}
default:
break;
}
}
pReader->Seek(_end_rec);
}
public:
UniFill Fill;
EffectProperties Effects;
nullable_string TableStyleId;
nullable_bool Rtl;
nullable_bool FirstRow;
nullable_bool FirstCol;
nullable_bool LastRow;
nullable_bool LastCol;
nullable_bool BandRow;
nullable_bool BandCol;
protected:
virtual void FillParentPointersForChilds()
{
if(Fill.is_init())
Fill.SetParentPointer(this);
if(Effects.is_init())
Effects.SetParentPointer(this);
}
};
}
}
#endif // PPTX_LOGIC_TABLE_PROPERTIES_INCLUDE_H_

View File

@@ -0,0 +1,163 @@
/*
* (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 PPTX_LOGIC_TABLEROW_INCLUDE_H_
#define PPTX_LOGIC_TABLEROW_INCLUDE_H_
#include "./../../WrapperWritingElement.h"
#include "TableCell.h"
namespace PPTX
{
namespace Logic
{
class TableRow : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(TableRow)
TableRow& operator=(const TableRow& oSrc)
{
parentFile = oSrc.parentFile;
parentElement = oSrc.parentElement;
Height = oSrc.Height;
Cells.Copy(oSrc.Cells);
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
Height = node.ReadAttributeInt(L"h");
node.LoadArray(_T("a:tc"), Cells);
}
virtual CString toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("h"), Height);
XmlUtils::CNodeValue oValue;
oValue.WriteArray(Cells);
return XmlUtils::CreateNode(_T("a:tr"), oAttr, oValue);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("a:tr"));
pWriter->StartAttributes();
pWriter->WriteAttribute(L"h", Height);
pWriter->EndAttributes();
size_t len = Cells.GetCount();
for (size_t i = 0; i < len; ++i)
Cells[i].toXmlWriter(pWriter);
pWriter->EndNode(_T("a:tr"));
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteInt1(0, Height);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->WriteRecordArray(0, 1, Cells);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1);
while (true)
{
BYTE _at = pReader->GetUChar();
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
{
Height = pReader->GetLong();
break;
}
default:
break;
}
}
while (pReader->GetPos() < _end_rec)
{
BYTE _at = pReader->GetUChar();
switch (_at)
{
case 0:
{
pReader->Skip(4);
LONG len = pReader->GetLong();
for (LONG i = 0; i < len; ++i)
{
pReader->Skip(1);
Cells.Add();
Cells[i].fromPPTY(pReader);
}
break;
}
default:
break;
}
}
pReader->Seek(_end_rec);
}
public:
int Height;
CAtlArray<TableCell> Cells;
protected:
virtual void FillParentPointersForChilds()
{
size_t count = Cells.GetCount();
for (size_t i = 0; i < count; ++i)
Cells[i].SetParentPointer(this);
}
};
}
}
#endif // PPTX_LOGIC_TABLEROW_INCLUDE_H_