Commit 7be543c3 authored by ElenaSubbotina's avatar ElenaSubbotina

pptx format .. extended reading xml

parent ccb47b0b
...@@ -52,7 +52,11 @@ namespace PPTX ...@@ -52,7 +52,11 @@ namespace PPTX
{ {
public: public:
WritingElement_AdditionConstructors(BodyPr) WritingElement_AdditionConstructors(BodyPr)
PPTX_LOGIC_BASE2(BodyPr)
BodyPr(std::wstring ns = L"a")
{
m_namespace = ns;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{ {
......
...@@ -42,8 +42,13 @@ namespace PPTX ...@@ -42,8 +42,13 @@ namespace PPTX
class CNvCxnSpPr : public WrapperWritingElement class CNvCxnSpPr : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(CNvCxnSpPr) WritingElement_AdditionConstructors(CNvCxnSpPr)
CNvCxnSpPr(std::wstring ns = L"p")
{
m_namespace = ns;
}
CNvCxnSpPr& operator=(const CNvCxnSpPr& oSrc) CNvCxnSpPr& operator=(const CNvCxnSpPr& oSrc)
{ {
parentFile = oSrc.parentFile; parentFile = oSrc.parentFile;
...@@ -68,9 +73,58 @@ namespace PPTX ...@@ -68,9 +73,58 @@ namespace PPTX
return *this; return *this;
} }
public: virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (strName == L"a:cxnSpLocks")
{
ReadAttributesLocks(oReader);
}
else if (strName == L"a:stCxn")
{
ReadAttributes(oReader, stCxn_id, stCxn_idx);
}
else if (strName == L"a:endCxn")
{
ReadAttributes(oReader, endCxn_id, endCxn_idx);
}
}
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader, nullable_int & id, nullable_int & idx )
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("id"), id)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("idx"), idx)
WritingElement_ReadAttributes_End( oReader )
}
void ReadAttributesLocks(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("noAdjustHandles"), noAdjustHandles)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noChangeArrowheads"), noChangeArrowheads)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noChangeAspect"), noChangeAspect)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noChangeShapeType"), noChangeShapeType)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noEditPoints"), noEditPoints)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noGrp"), noGrp)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noMove"), noMove)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noResize"), noResize)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noRot"), noRot)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noSelect"), noSelect)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
m_namespace = XmlUtils::GetNamespace(node.GetName());
XmlUtils::CXmlNode l_Locks; XmlUtils::CXmlNode l_Locks;
if (node.GetNode(_T("a:cxnSpLocks"), l_Locks)) if (node.GetNode(_T("a:cxnSpLocks"), l_Locks))
{ {
...@@ -132,17 +186,17 @@ namespace PPTX ...@@ -132,17 +186,17 @@ namespace PPTX
if (_T("") != oAttr3.m_strValue) if (_T("") != oAttr3.m_strValue)
oValue.m_strValue += XmlUtils::CreateNode(_T("a:endCxn"), oAttr3); oValue.m_strValue += XmlUtils::CreateNode(_T("a:endCxn"), oAttr3);
return XmlUtils::CreateNode(_T("p:cNvCxnSpPr"), oValue); return XmlUtils::CreateNode(m_namespace + L":cNvCxnSpPr", oValue);
} }
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) std::wstring namespace_ = m_namespace;
pWriter->StartNode(_T("wps:cNvCxnSpPr"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = _T("wps");
pWriter->StartNode(_T("xdr:cNvCxnSpPr")); else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = _T("xdr");
else
pWriter->StartNode(_T("p:cNvCxnSpPr")); pWriter->StartNode(namespace_ + L":cNvCxnSpPr");
pWriter->EndAttributes(); pWriter->EndAttributes();
...@@ -181,12 +235,7 @@ namespace PPTX ...@@ -181,12 +235,7 @@ namespace PPTX
pWriter->EndNode(_T("a:endCxn")); pWriter->EndNode(_T("a:endCxn"));
} }
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) pWriter->EndNode(namespace_ + L":cNvCxnSpPr");
pWriter->EndNode(_T("wps:cNvCxnSpPr"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
pWriter->EndNode(_T("xdr:cNvCxnSpPr"));
else
pWriter->EndNode(_T("p:cNvCxnSpPr"));
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
...@@ -299,7 +348,8 @@ namespace PPTX ...@@ -299,7 +348,8 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
public: std::wstring m_namespace;
nullable_bool noAdjustHandles; nullable_bool noAdjustHandles;
nullable_bool noChangeArrowheads; nullable_bool noChangeArrowheads;
nullable_bool noChangeAspect; nullable_bool noChangeAspect;
......
...@@ -42,7 +42,12 @@ namespace PPTX ...@@ -42,7 +42,12 @@ namespace PPTX
class CNvGraphicFramePr : public WrapperWritingElement class CNvGraphicFramePr : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(CNvGraphicFramePr) WritingElement_AdditionConstructors(CNvGraphicFramePr)
CNvGraphicFramePr(std::wstring ns = L"p")
{
m_namespace = ns;
}
CNvGraphicFramePr& operator=(const CNvGraphicFramePr& oSrc) CNvGraphicFramePr& operator=(const CNvGraphicFramePr& oSrc)
{ {
...@@ -56,12 +61,43 @@ namespace PPTX ...@@ -56,12 +61,43 @@ namespace PPTX
noResize = oSrc.noResize; noResize = oSrc.noResize;
noSelect = oSrc.noSelect; noSelect = oSrc.noSelect;
m_namespace = oSrc.m_namespace;
return *this; return *this;
} }
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = oReader.GetName();
public: if (strName == L"a:graphicFrameLocks")
{
ReadAttributesLocks(oReader);
}
}
}
void ReadAttributesLocks(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("noChangeAspect"), noChangeAspect)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noGrp"), noGrp)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noMove"), noMove)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noResize"), noResize)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noDrilldown"), noDrilldown)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noSelect"), noSelect)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
m_namespace = XmlUtils::GetNamespace(node.GetName());
XmlUtils::CXmlNode oNode; XmlUtils::CXmlNode oNode;
if (node.GetNode(_T("a:graphicFrameLocks"), oNode)) if (node.GetNode(_T("a:graphicFrameLocks"), oNode))
{ {
...@@ -84,18 +120,17 @@ namespace PPTX ...@@ -84,18 +120,17 @@ namespace PPTX
oAttr.Write(_T("noResize"), noResize); oAttr.Write(_T("noResize"), noResize);
oAttr.Write(_T("noSelect"), noSelect); oAttr.Write(_T("noSelect"), noSelect);
if (_T("") == oAttr.m_strValue) return XmlUtils::CreateNode(m_namespace + L":cNvGraphicFramePr>", XmlUtils::CreateNode(_T("a:graphicFrameLocks"), oAttr));
return _T("<p:cNvGraphicFramePr/>");
return _T("<p:cNvGraphicFramePr>") + XmlUtils::CreateNode(_T("a:graphicFrameLocks"), oAttr) + _T("</p:cNvGraphicFramePr>");
} }
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
std::wstring namespace_ = m_namespace;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
pWriter->StartNode(_T("xdr:cNvGraphicFramePr")); namespace_ = L"xdr";
else
pWriter->StartNode(_T("p:cNvGraphicFramePr")); pWriter->StartNode(namespace_ + L":cNvGraphicFramePr");
pWriter->EndAttributes(); pWriter->EndAttributes();
...@@ -114,10 +149,7 @@ namespace PPTX ...@@ -114,10 +149,7 @@ namespace PPTX
pWriter->EndNode(_T("a:graphicFrameLocks")); pWriter->EndNode(_T("a:graphicFrameLocks"));
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) pWriter->EndNode(namespace_ + L":cNvGraphicFramePr");
pWriter->EndNode(_T("xdr:cNvGraphicFramePr"));
else
pWriter->EndNode(_T("p:cNvGraphicFramePr"));
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
...@@ -182,8 +214,8 @@ namespace PPTX ...@@ -182,8 +214,8 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
std::wstring m_namespace;
public:
nullable_bool noChangeAspect; nullable_bool noChangeAspect;
nullable_bool noDrilldown; nullable_bool noDrilldown;
nullable_bool noGrp; nullable_bool noGrp;
......
...@@ -35,7 +35,6 @@ namespace PPTX ...@@ -35,7 +35,6 @@ namespace PPTX
{ {
namespace Logic namespace Logic
{ {
CNvGrpSpPr& CNvGrpSpPr::operator=(const CNvGrpSpPr& oSrc) CNvGrpSpPr& CNvGrpSpPr::operator=(const CNvGrpSpPr& oSrc)
{ {
parentFile = oSrc.parentFile; parentFile = oSrc.parentFile;
...@@ -54,6 +53,8 @@ namespace PPTX ...@@ -54,6 +53,8 @@ namespace PPTX
void CNvGrpSpPr::fromXML(XmlUtils::CXmlNode& node) void CNvGrpSpPr::fromXML(XmlUtils::CXmlNode& node)
{ {
m_namespace = XmlUtils::GetNamespace(node.GetName());
XmlUtils::CXmlNode oNode; XmlUtils::CXmlNode oNode;
if (node.GetNode(_T("a:grpSpLocks"), oNode)) if (node.GetNode(_T("a:grpSpLocks"), oNode))
{ {
...@@ -66,8 +67,36 @@ namespace PPTX ...@@ -66,8 +67,36 @@ namespace PPTX
oNode.ReadAttributeBase(L"noUngrp", noUngrp); oNode.ReadAttributeBase(L"noUngrp", noUngrp);
} }
} }
void CNvGrpSpPr::ReadAttributesLocks(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("noChangeAspect"), noChangeAspect)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noGrp"), noGrp)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noMove"), noMove)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noResize"), noResize)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noRot"), noRot)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noSelect"), noSelect)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noUngrp"), noUngrp)
WritingElement_ReadAttributes_End( oReader )
}
void CNvGrpSpPr::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = oReader.GetName();
if (strName == L"a:grpSpLocks")
{
ReadAttributesLocks(oReader);
}
}
}
std::wstring CNvGrpSpPr::toXML() const std::wstring CNvGrpSpPr::toXML() const
{ {
XmlUtils::CAttribute oAttr; XmlUtils::CAttribute oAttr;
...@@ -79,10 +108,7 @@ namespace PPTX ...@@ -79,10 +108,7 @@ namespace PPTX
oAttr.Write(_T("noSelect"), noSelect); oAttr.Write(_T("noSelect"), noSelect);
oAttr.Write(_T("noUngrp"), noUngrp); oAttr.Write(_T("noUngrp"), noUngrp);
if (_T("") == oAttr.m_strValue) return XmlUtils::CreateNode(m_namespace + L":cNvGrpSpPr", XmlUtils::CreateNode(_T("a:grpSpLocks"), oAttr));
return _T("<p:cNvGrpSpPr/>");
return _T("<p:cNvGrpSpPr>") + XmlUtils::CreateNode(_T("a:grpSpLocks"), oAttr) + _T("</p:cNvGrpSpPr>");
} }
} // namespace Logic } // namespace Logic
......
...@@ -42,18 +42,26 @@ namespace PPTX ...@@ -42,18 +42,26 @@ namespace PPTX
class CNvGrpSpPr : public WrapperWritingElement class CNvGrpSpPr : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(CNvGrpSpPr) WritingElement_AdditionConstructors(CNvGrpSpPr)
CNvGrpSpPr& operator=(const CNvGrpSpPr& oSrc); CNvGrpSpPr(std::wstring ns = L"p")
{
m_namespace = ns;
}
CNvGrpSpPr& operator=(const CNvGrpSpPr& oSrc);
public:
virtual void fromXML(XmlUtils::CXmlNode& node); virtual void fromXML(XmlUtils::CXmlNode& node);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const; virtual std::wstring toXML() const;
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
std::wstring ns = m_namespace;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
ns = L"xdr";
if (!noChangeAspect.is_init() && if (!noChangeAspect.is_init() &&
!noGrp.is_init() && !noGrp.is_init() &&
!noMove.is_init() && !noMove.is_init() &&
...@@ -62,17 +70,11 @@ namespace PPTX ...@@ -62,17 +70,11 @@ namespace PPTX
!noSelect.is_init() && !noSelect.is_init() &&
!noUngrp.is_init()) !noUngrp.is_init())
{ {
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) pWriter->WriteString(L"<" + ns + L":cNvGrpSpPr/>");
pWriter->WriteString(_T("<xdr:cNvGrpSpPr/>"));
else
pWriter->WriteString(_T("<p:cNvGrpSpPr/>"));
return; return;
} }
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) pWriter->WriteString(L"<" + ns + L":cNvGrpSpPr>");
pWriter->WriteString(_T("<xdr:cNvGrpSpPr>"));
else
pWriter->WriteString(_T("<p:cNvGrpSpPr>"));
pWriter->StartNode(_T("a:grpSpLocks")); pWriter->StartNode(_T("a:grpSpLocks"));
...@@ -88,10 +90,7 @@ namespace PPTX ...@@ -88,10 +90,7 @@ namespace PPTX
pWriter->EndNode(_T("a:grpSpLocks")); pWriter->EndNode(_T("a:grpSpLocks"));
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) pWriter->WriteString(L"</" + ns + L":cNvGrpSpPr>");
pWriter->WriteString(_T("</xdr:cNvGrpSpPr>"));
else
pWriter->WriteString(_T("</p:cNvGrpSpPr>"));
} }
void toXmlWriter2(const std::wstring& strNS, NSBinPptxRW::CXmlWriter* pWriter) const void toXmlWriter2(const std::wstring& strNS, NSBinPptxRW::CXmlWriter* pWriter) const
...@@ -192,8 +191,8 @@ namespace PPTX ...@@ -192,8 +191,8 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
std::wstring m_namespace;
public:
nullable_bool noChangeAspect; nullable_bool noChangeAspect;
nullable_bool noGrp; nullable_bool noGrp;
nullable_bool noMove; nullable_bool noMove;
...@@ -202,6 +201,7 @@ namespace PPTX ...@@ -202,6 +201,7 @@ namespace PPTX
nullable_bool noSelect; nullable_bool noSelect;
nullable_bool noUngrp; nullable_bool noUngrp;
protected: protected:
void ReadAttributesLocks(XmlUtils::CXmlLiteReader& oReader);
virtual void FillParentPointersForChilds(){}; virtual void FillParentPointersForChilds(){};
}; };
} // namespace Logic } // namespace Logic
......
...@@ -44,7 +44,12 @@ namespace PPTX ...@@ -44,7 +44,12 @@ namespace PPTX
{ {
public: public:
PPTX_LOGIC_BASE(CNvPicPr) WritingElement_AdditionConstructors(CNvPicPr)
CNvPicPr(std::wstring ns = L"p")
{
m_namespace = ns;
}
CNvPicPr& operator=(const CNvPicPr& oSrc) CNvPicPr& operator=(const CNvPicPr& oSrc)
{ {
...@@ -65,10 +70,52 @@ namespace PPTX ...@@ -65,10 +70,52 @@ namespace PPTX
noRot = oSrc.noRot; noRot = oSrc.noRot;
noSelect = oSrc.noSelect; noSelect = oSrc.noSelect;
m_namespace = oSrc.m_namespace;
return *this; return *this;
} }
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("preferRelativeResize"), preferRelativeResize )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
public: ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (_T("a:picLocks") == strName)
{
ReadAttributesLocks(oReader);
}
}
}
void ReadAttributesLocks(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("noAdjustHandles"), noAdjustHandles)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noChangeArrowheads"), noChangeArrowheads)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noChangeAspect"), noChangeAspect)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noChangeShapeType"), noChangeShapeType)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noCrop"), noCrop)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noEditPoints"), noEditPoints)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noGrp"), noGrp)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noMove"), noMove)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noResize"), noResize)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noRot"), noRot)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noSelect"), noSelect)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
node.ReadAttributeBase(L"preferRelativeResize", preferRelativeResize); node.ReadAttributeBase(L"preferRelativeResize", preferRelativeResize);
...@@ -118,12 +165,12 @@ namespace PPTX ...@@ -118,12 +165,12 @@ namespace PPTX
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) std::wstring namespace_ = m_namespace;
pWriter->StartNode(_T("pic:cNvPicPr"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"pic";
pWriter->StartNode(_T("xdr:cNvPicPr")); else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else
pWriter->StartNode(_T("p:cNvPicPr")); pWriter->StartNode(namespace_ + L":cNvPicPr");
pWriter->StartAttributes(); pWriter->StartAttributes();
pWriter->WriteAttribute(_T("preferRelativeResize"), preferRelativeResize); pWriter->WriteAttribute(_T("preferRelativeResize"), preferRelativeResize);
...@@ -157,13 +204,7 @@ namespace PPTX ...@@ -157,13 +204,7 @@ namespace PPTX
pWriter->EndAttributes(); pWriter->EndAttributes();
pWriter->EndNode(_T("a:picLocks")); pWriter->EndNode(_T("a:picLocks"));
} }
pWriter->EndNode(namespace_ + L":cNvPicPr");
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
pWriter->EndNode(_T("pic:cNvPicPr"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
pWriter->EndNode(_T("xdr:cNvPicPr"));
else
pWriter->EndNode(_T("p:cNvPicPr"));
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
...@@ -262,8 +303,8 @@ namespace PPTX ...@@ -262,8 +303,8 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
std::wstring m_namespace;
public:
nullable_bool preferRelativeResize; nullable_bool preferRelativeResize;
nullable_bool noAdjustHandles; nullable_bool noAdjustHandles;
......
...@@ -44,15 +44,54 @@ namespace PPTX ...@@ -44,15 +44,54 @@ namespace PPTX
class CNvPr : public WrapperWritingElement class CNvPr : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(CNvPr) WritingElement_AdditionConstructors(CNvPr)
CNvPr(std::wstring ns = L"p")
{
m_namespace = ns;
}
virtual OOX::EElementType getType () const virtual OOX::EElementType getType () const
{ {
return OOX::et_p_cNvPr; return OOX::et_p_cNvPr;
} }
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
nullable_int id_;
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("id"), id_)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("name"), name)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("descr"), descr)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("hidden"), hidden)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("title"), title)
WritingElement_ReadAttributes_End( oReader )
id = id_.get_value_or(0);
Normalize();
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring sName = oReader.GetName();
if (sName == L"a:hlinkClick")
hlinkClick = oReader;
else if (sName == L"a:hlinkHover")
hlinkHover = oReader;
}
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
m_namespace = XmlUtils::GetNamespace(node.GetName());
id = node.ReadAttributeInt(L"id"); id = node.ReadAttributeInt(L"id");
name = node.GetAttribute(L"name"); name = node.GetAttribute(L"name");
...@@ -79,18 +118,16 @@ namespace PPTX ...@@ -79,18 +118,16 @@ namespace PPTX
oValue.WriteNullable(hlinkClick); oValue.WriteNullable(hlinkClick);
oValue.WriteNullable(hlinkHover); oValue.WriteNullable(hlinkHover);
return XmlUtils::CreateNode(_T("p:cNvPr"), oAttr, oValue); return XmlUtils::CreateNode(m_namespace + L":cNvPr", oAttr, oValue);
} }
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
std::wstring namespace_; std::wstring namespace_ = m_namespace;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
namespace_= _T("pic"); namespace_= _T("pic");
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
namespace_= _T("xdr"); namespace_= _T("xdr");
else
namespace_= _T("p");
toXmlWriter2(namespace_, pWriter); toXmlWriter2(namespace_, pWriter);
...@@ -196,7 +233,8 @@ namespace PPTX ...@@ -196,7 +233,8 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
public: std::wstring m_namespace;
int id; int id;
std::wstring name; std::wstring name;
nullable_string descr; nullable_string descr;
......
...@@ -42,7 +42,12 @@ namespace PPTX ...@@ -42,7 +42,12 @@ namespace PPTX
class CNvSpPr : public WrapperWritingElement class CNvSpPr : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(CNvSpPr) WritingElement_AdditionConstructors(CNvSpPr)
CNvSpPr(std::wstring ns = L"p")
{
m_namespace = ns;
}
CNvSpPr& operator=(const CNvSpPr& oSrc) CNvSpPr& operator=(const CNvSpPr& oSrc)
{ {
...@@ -65,9 +70,52 @@ namespace PPTX ...@@ -65,9 +70,52 @@ namespace PPTX
return *this; return *this;
} }
public: virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
ReadAttributes(oReader);
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = oReader.GetName();
if (strName == L"a:spLocks")
{
ReadAttributesLocks(oReader);
}
}
}
void ReadAttributesLocks(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("noAdjustHandles"), noAdjustHandles)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noGrp"), noGrp)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noMove"), noMove)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noRot"), noRot)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noResize"), noResize)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noTextEdit"), noTextEdit)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noSelect"), noSelect)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noChangeArrowheads"), noChangeArrowheads)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noChangeShapeType"), noChangeShapeType)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noChangeAspect"), noChangeAspect)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("noEditPoints"), noEditPoints)
WritingElement_ReadAttributes_End( oReader )
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("txBox"), txBox)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
m_namespace = XmlUtils::GetNamespace(node.GetName());
node.ReadAttributeBase(L"txBox", txBox); node.ReadAttributeBase(L"txBox", txBox);
XmlUtils::CXmlNode l_Locks; XmlUtils::CXmlNode l_Locks;
...@@ -105,16 +153,18 @@ namespace PPTX ...@@ -105,16 +153,18 @@ namespace PPTX
oAttr2.Write(_T("noTextEdit"), noTextEdit); oAttr2.Write(_T("noTextEdit"), noTextEdit);
if (_T("") == oAttr2.m_strValue) if (_T("") == oAttr2.m_strValue)
return XmlUtils::CreateNode(_T("p:cNvSpPr"), oAttr1); return XmlUtils::CreateNode(m_namespace + L":cNvSpPr", oAttr1);
return XmlUtils::CreateNode(_T("p:cNvSpPr"), oAttr1, XmlUtils::CreateNode(_T("a:spLocks"), oAttr2)); return XmlUtils::CreateNode(m_namespace + L":cNvSpPr", oAttr1, XmlUtils::CreateNode(_T("a:spLocks"), oAttr2));
} }
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) std::wstring namespace_ = m_namespace;
pWriter->StartNode(_T("xdr:cNvSpPr"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = _T("wps");
pWriter->StartNode(_T("p:cNvSpPr")); else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = _T("xdr");
pWriter->StartNode(namespace_ + L":cNvSpPr");
pWriter->StartAttributes(); pWriter->StartAttributes();
pWriter->WriteAttribute(_T("txBox"), txBox); pWriter->WriteAttribute(_T("txBox"), txBox);
...@@ -151,10 +201,7 @@ namespace PPTX ...@@ -151,10 +201,7 @@ namespace PPTX
pWriter->EndNode(_T("a:spLocks")); pWriter->EndNode(_T("a:spLocks"));
} }
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) pWriter->EndNode(namespace_ + L":cNvSpPr");
pWriter->EndNode(_T("xdr:cNvSpPr"));
else
pWriter->EndNode(_T("p:cNvSpPr"));
} }
void toXmlWriter2(const std::wstring& strNS, NSBinPptxRW::CXmlWriter* pWriter) const void toXmlWriter2(const std::wstring& strNS, NSBinPptxRW::CXmlWriter* pWriter) const
...@@ -296,7 +343,8 @@ namespace PPTX ...@@ -296,7 +343,8 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
public: std::wstring m_namespace;
nullable_bool txBox; nullable_bool txBox;
nullable_bool noAdjustHandles; nullable_bool noAdjustHandles;
nullable_bool noChangeArrowheads; nullable_bool noChangeArrowheads;
......
...@@ -45,9 +45,12 @@ namespace PPTX ...@@ -45,9 +45,12 @@ namespace PPTX
class CSld : public WrapperWritingElement class CSld : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(CSld) WritingElement_AdditionConstructors(CSld)
PPTX_LOGIC_BASE2(CSld)
public: virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
node.ReadAttributeBase(L"name", attrName); node.ReadAttributeBase(L"name", attrName);
......
...@@ -45,15 +45,43 @@ namespace PPTX ...@@ -45,15 +45,43 @@ namespace PPTX
class Cell3D : public WrapperWritingElement class Cell3D : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(Cell3D) WritingElement_AdditionConstructors(Cell3D)
public: Cell3D()
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (_T("bevel") == strName)
bevel = oReader;
else if (_T("lightRig") == strName)
lightRig = oReader;
}
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("prstMaterial"), prstMaterial )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
node.ReadAttributeBase(L"prstMaterial", prstMaterial); node.ReadAttributeBase(L"prstMaterial", prstMaterial);
bevel = node.ReadNodeNoNS(_T("bevel")); bevel = node.ReadNodeNoNS(_T("bevel"));
lightRig = node.ReadNode(_T("a:lightRig")); lightRig = node.ReadNodeNoNS(_T("lightRig"));
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
......
...@@ -41,28 +41,58 @@ namespace PPTX ...@@ -41,28 +41,58 @@ namespace PPTX
{ {
namespace Logic namespace Logic
{ {
CxnSp::CxnSp(std::wstring ns)
CxnSp::CxnSp()
{ {
m_namespace = ns;
} }
CxnSp::~CxnSp() CxnSp::~CxnSp()
{ {
} }
CxnSp::CxnSp(XmlUtils::CXmlNode& node) CxnSp::CxnSp(XmlUtils::CXmlNode& node)
{ {
fromXML(node); fromXML(node);
} }
const CxnSp& CxnSp::operator =(XmlUtils::CXmlNode& node) const CxnSp& CxnSp::operator =(XmlUtils::CXmlNode& node)
{ {
fromXML(node); fromXML(node);
return *this; return *this;
} }
CxnSp::CxnSp(XmlUtils::CXmlLiteReader& oReader)
{
fromXML(oReader);
}
const CxnSp& CxnSp::operator =(XmlUtils::CXmlLiteReader& oReader)
{
fromXML(oReader);
return *this;
}
void CxnSp::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (_T("nvCxnSpPr") == strName)
nvCxnSpPr = oReader;
else if (_T("spPr") == strName)
spPr = oReader;
else if (_T("style") == strName)
style = oReader;
}
FillParentPointersForChilds();
}
void CxnSp::fromXML(XmlUtils::CXmlNode& node) void CxnSp::fromXML(XmlUtils::CXmlNode& node)
{ {
m_namespace = XmlUtils::GetNamespace(node.GetName());
XmlUtils::CXmlNodes oNodes; XmlUtils::CXmlNodes oNodes;
if (node.GetNodes(_T("*"), oNodes)) if (node.GetNodes(_T("*"), oNodes))
{ {
...@@ -93,7 +123,7 @@ namespace PPTX ...@@ -93,7 +123,7 @@ namespace PPTX
oValue.Write(spPr); oValue.Write(spPr);
oValue.WriteNullable(style); oValue.WriteNullable(style);
return XmlUtils::CreateNode(_T("<p:cxnSp>"), oValue); return XmlUtils::CreateNode(m_namespace + L":cxnSp", oValue);
} }
void CxnSp::FillParentPointersForChilds() void CxnSp::FillParentPointersForChilds()
......
...@@ -46,13 +46,23 @@ namespace PPTX ...@@ -46,13 +46,23 @@ namespace PPTX
class CxnSp : public WrapperWritingElement class CxnSp : public WrapperWritingElement
{ {
public: public:
CxnSp(); CxnSp(std::wstring ns = L"p");
virtual ~CxnSp(); virtual ~CxnSp();
explicit CxnSp(XmlUtils::CXmlNode& node); explicit CxnSp(XmlUtils::CXmlNode& node);
const CxnSp& operator =(XmlUtils::CXmlNode& node); const CxnSp& operator =(XmlUtils::CXmlNode& node);
public: explicit CxnSp(XmlUtils::CXmlLiteReader& oReader);
const CxnSp& operator =(XmlUtils::CXmlLiteReader& oReader);
virtual OOX::EElementType getType () const
{
return OOX::et_a_CxnSp;
}
virtual void fromXML(XmlUtils::CXmlNode& node); virtual void fromXML(XmlUtils::CXmlNode& node);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const; virtual std::wstring toXML() const;
virtual void GetRect(Aggplus::RECT& pRect)const; virtual void GetRect(Aggplus::RECT& pRect)const;
...@@ -72,12 +82,12 @@ namespace PPTX ...@@ -72,12 +82,12 @@ namespace PPTX
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) std::wstring namespace_ = m_namespace;
pWriter->StartNode(_T("wps:cxnSp"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"wps";
pWriter->StartNode(_T("xdr:cxnSp")); else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else
pWriter->StartNode(_T("p:cxnSp")); pWriter->StartNode(namespace_ + L":cxnSp");
pWriter->EndAttributes(); pWriter->EndAttributes();
...@@ -87,19 +97,13 @@ namespace PPTX ...@@ -87,19 +97,13 @@ namespace PPTX
if (style.is_init()) if (style.is_init())
{ {
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
style->m_ns = _T("wps"); style->m_namespace = _T("wps");
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
style->m_ns = _T("xdr"); style->m_namespace = _T("xdr");
pWriter->Write(style); pWriter->Write(style);
} }
pWriter->EndNode(namespace_ + L":cxnSp");
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
pWriter->EndNode(_T("wps:cxnSp"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
pWriter->EndNode(_T("xdr:cxnSp"));
else
pWriter->EndNode(_T("p:cxnSp"));
} }
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
...@@ -123,8 +127,7 @@ namespace PPTX ...@@ -123,8 +127,7 @@ namespace PPTX
} }
case 2: case 2:
{ {
style = new ShapeStyle(); style = new ShapeStyle(L"p");
style->m_ns = _T("p");
style->fromPPTY(pReader); style->fromPPTY(pReader);
break; break;
} }
...@@ -138,7 +141,8 @@ namespace PPTX ...@@ -138,7 +141,8 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
public: std::wstring m_namespace;
NvCxnSpPr nvCxnSpPr; NvCxnSpPr nvCxnSpPr;
SpPr spPr; SpPr spPr;
nullable<ShapeStyle> style; nullable<ShapeStyle> style;
......
...@@ -127,8 +127,7 @@ namespace PPTX ...@@ -127,8 +127,7 @@ namespace PPTX
} }
case 1: case 1:
{ {
bodyPr = BodyPr(); bodyPr = BodyPr(L"a");
bodyPr->m_namespace = _T("a");
bodyPr->fromPPTY(pReader); bodyPr->fromPPTY(pReader);
break; break;
} }
...@@ -140,8 +139,7 @@ namespace PPTX ...@@ -140,8 +139,7 @@ namespace PPTX
} }
case 3: case 3:
{ {
style = new ShapeStyle(); style = new ShapeStyle(L"a");
style->m_ns = _T("a");
style->fromPPTY(pReader); style->fromPPTY(pReader);
break; break;
} }
......
...@@ -52,9 +52,48 @@ namespace PPTX ...@@ -52,9 +52,48 @@ namespace PPTX
class Ext : public WrapperWritingElement class Ext : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(Ext) WritingElement_AdditionConstructors(Ext)
public: Ext()
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (strName == L"media")
{
ReadAttributes(oReader);
//std::wstring xmkl = media.GetXml();
int nParentDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth1 ) )
{
std::wstring strName1 = XmlUtils::GetNameNoNS(oReader.GetName());
if (strName1 == L"trim")
{
ReadAttributes(oReader);
}
}
}
}
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("st"), st)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("end"), end)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("r:embed"), link)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
XmlUtils::CXmlNode media; XmlUtils::CXmlNode media;
...@@ -95,11 +134,9 @@ namespace PPTX ...@@ -95,11 +134,9 @@ namespace PPTX
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
} }
public:
OOX::RId link; OOX::RId link;
// trim // trim
nullable_double st; nullable_double st;
nullable_double end; nullable_double end;
......
...@@ -46,8 +46,11 @@ namespace PPTX ...@@ -46,8 +46,11 @@ namespace PPTX
{ {
public: public:
WritingElement_AdditionConstructors(Blip) WritingElement_AdditionConstructors(Blip)
PPTX_LOGIC_BASE2(Blip)
Blip(std::wstring ns = L"a")
{
m_namespace = ns;
}
Blip& operator=(const Blip& oSrc) Blip& operator=(const Blip& oSrc)
{ {
parentFile = oSrc.parentFile; parentFile = oSrc.parentFile;
...@@ -179,10 +182,9 @@ namespace PPTX ...@@ -179,10 +182,9 @@ namespace PPTX
nullable_limit<Limit::BlipCompression> cstate; nullable_limit<Limit::BlipCompression> cstate;
nullable<OOX::RId> embed; nullable<OOX::RId> embed;
nullable<OOX::RId> link; nullable<OOX::RId> link;
//private:
public: public:
std::wstring m_namespace; std::wstring m_namespace;
//internal
std::wstring oleRid; std::wstring oleRid;
std::wstring oleFilepathBin; std::wstring oleFilepathBin;
std::wstring oleFilepathImg; std::wstring oleFilepathImg;
......
...@@ -50,7 +50,11 @@ namespace PPTX ...@@ -50,7 +50,11 @@ namespace PPTX
{ {
public: public:
WritingElement_AdditionConstructors(BlipFill) WritingElement_AdditionConstructors(BlipFill)
PPTX_LOGIC_BASE2(BlipFill)
BlipFill(std::wstring ns = L"p")
{
m_namespace = ns;
}
BlipFill& operator=(const BlipFill& oSrc) BlipFill& operator=(const BlipFill& oSrc)
{ {
......
...@@ -49,8 +49,12 @@ namespace PPTX ...@@ -49,8 +49,12 @@ namespace PPTX
{ {
public: public:
WritingElement_AdditionConstructors(GradFill) WritingElement_AdditionConstructors(GradFill)
PPTX_LOGIC_BASE2(GradFill)
GradFill(std::wstring ns = L"a")
{
m_namespace = ns;
}
GradFill& operator=(const GradFill& oSrc) GradFill& operator=(const GradFill& oSrc)
{ {
parentFile = oSrc.parentFile; parentFile = oSrc.parentFile;
......
...@@ -44,8 +44,11 @@ namespace PPTX ...@@ -44,8 +44,11 @@ namespace PPTX
{ {
public: public:
WritingElement_AdditionConstructors(NoFill) WritingElement_AdditionConstructors(NoFill)
PPTX_LOGIC_BASE2(NoFill)
NoFill(std::wstring ns = L"a")
{
m_namespace = ns;
}
NoFill& operator=(const NoFill& oSrc) NoFill& operator=(const NoFill& oSrc)
{ {
parentFile = oSrc.parentFile; parentFile = oSrc.parentFile;
......
...@@ -45,8 +45,11 @@ namespace PPTX ...@@ -45,8 +45,11 @@ namespace PPTX
{ {
public: public:
WritingElement_AdditionConstructors(PattFill) WritingElement_AdditionConstructors(PattFill)
PPTX_LOGIC_BASE2(PattFill)
PattFill(std::wstring ns = L"a")
{
m_namespace = ns;
}
PattFill& operator=(const PattFill& oSrc) PattFill& operator=(const PattFill& oSrc)
{ {
parentFile = oSrc.parentFile; parentFile = oSrc.parentFile;
......
...@@ -45,8 +45,11 @@ namespace PPTX ...@@ -45,8 +45,11 @@ namespace PPTX
{ {
public: public:
WritingElement_AdditionConstructors(SolidFill) WritingElement_AdditionConstructors(SolidFill)
PPTX_LOGIC_BASE2(SolidFill)
SolidFill(std::wstring ns = L"a")
{
m_namespace = ns;
}
SolidFill& operator=(const SolidFill& oSrc) SolidFill& operator=(const SolidFill& oSrc)
{ {
parentFile = oSrc.parentFile; parentFile = oSrc.parentFile;
......
...@@ -44,9 +44,32 @@ namespace PPTX ...@@ -44,9 +44,32 @@ namespace PPTX
class FontRef : public WrapperWritingElement class FontRef : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(FontRef) WritingElement_AdditionConstructors(FontRef)
public: FontRef()
{
}
virtual OOX::EElementType getType () const
{
return OOX::et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_name = oReader.GetName();
ReadAttributes( oReader );
Color.fromXMLParent(oReader);
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("idx"), idx )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
m_name = node.GetName(); m_name = node.GetName();
......
...@@ -61,6 +61,139 @@ namespace PPTX ...@@ -61,6 +61,139 @@ namespace PPTX
fromXML(node); fromXML(node);
return *this; return *this;
} }
GraphicFrame::GraphicFrame(XmlUtils::CXmlLiteReader& oReader)
{
fromXML(oReader);
}
const GraphicFrame& GraphicFrame::operator =(XmlUtils::CXmlLiteReader& oReader)
{
fromXML(oReader);
return *this;
}
void GraphicFrame::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
fromXML2(oReader);
}
FillParentPointersForChilds();
}
void GraphicFrame::ReadAttributes3(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("spid"), spid )
WritingElement_ReadAttributes_End( oReader )
}
void GraphicFrame::fromXML2(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
std::wstring strNamespace = XmlUtils::GetNamespace(oReader.GetName());
if (L"xfrm" == strName && strNamespace != L"xdr")
xfrm = oReader;
else if (L"nvGraphicFramePr" == strName)
nvGraphicFramePr.fromXML( oReader );
else if (L"graphic" == strName)
{
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName1 = oReader.GetName();
if (strName1 == L"a:graphicData")
{
fromXML3(oReader);
}
}
}
}
bool GraphicFrame::fromXML3(XmlUtils::CXmlLiteReader& oReader)
{
bool result = false;
if ( oReader.IsEmptyNode() )
return result;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (strName == L"tbl")
{
table = oReader;
result = true;
}
else if (strName == L"oleObj")
{
ReadAttributes3(oReader);
int nCurDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth1 ) )
{
std::wstring strName1 = XmlUtils::GetNameNoNS(oReader.GetName());
if (strName1 == L"pic")
{
result = true;
pic = oReader;
//pic->fromXMLOle(oNode2);
if (xfrm.IsInit())
xfrm->Merge(pic->spPr.xfrm);
}
}
}
else if (strName == L"relIds")
{
smartArt = oReader;
result = true;
}
else if (strName == L"chart")
{
chartRec = oReader;
result = true;
}
else if (strName == L"legacyDrawing")
{
ReadAttributes3(oReader);
result = true;
}
else if (strName == L"AlternateContent")
{
int nCurDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth1 ) )
{
std::wstring strName1 = oReader.GetName();
if (strName1 == L"mc:Choice")
{
result = fromXML3(oReader);
if (result)
break;
}
else if (strName1 == L"mc:Fallback")
{
result = fromXML3(oReader);
if (result)
break;
}
}
}
else
{
element = oReader;
if (element.IsInit())
result = true;
}
}
return result;
}
void GraphicFrame::fromXML(XmlUtils::CXmlNode& node) void GraphicFrame::fromXML(XmlUtils::CXmlNode& node)
{ {
...@@ -228,7 +361,7 @@ namespace PPTX ...@@ -228,7 +361,7 @@ namespace PPTX
if (smartArt.is_init() && !table.is_init() && !chartRec.is_init() && !spid.is_init()) if (smartArt.is_init() && !table.is_init() && !chartRec.is_init() && !spid.is_init())
{ {
smartArt->LoadDrawing(pWriter); //smartArt->LoadDrawing(pWriter);
if (smartArt->m_diag.is_init()) if (smartArt->m_diag.is_init())
{ {
smartArt->m_diag->nvGrpSpPr.cNvPr = nvGraphicFramePr.cNvPr; smartArt->m_diag->nvGrpSpPr.cNvPr = nvGraphicFramePr.cNvPr;
......
...@@ -51,27 +51,42 @@ namespace PPTX ...@@ -51,27 +51,42 @@ namespace PPTX
public: public:
GraphicFrame(); GraphicFrame();
virtual ~GraphicFrame(); virtual ~GraphicFrame();
virtual OOX::EElementType getType () const
{
return OOX::et_a_GraphicFrame;
}
explicit GraphicFrame(XmlUtils::CXmlLiteReader& oReader);
const GraphicFrame& operator =(XmlUtils::CXmlLiteReader& oReader);
explicit GraphicFrame(XmlUtils::CXmlNode& node); explicit GraphicFrame(XmlUtils::CXmlNode& node);
const GraphicFrame& operator =(XmlUtils::CXmlNode& node); const GraphicFrame& operator =(XmlUtils::CXmlNode& node);
virtual void fromXML(XmlUtils::CXmlNode& node); virtual void fromXML(XmlUtils::CXmlNode& node);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
void fromXML2(XmlUtils::CXmlLiteReader& oReader);
bool fromXML3(XmlUtils::CXmlLiteReader& oReader);
void ReadAttributes3(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const; virtual std::wstring toXML() const;
virtual void GetRect(Aggplus::RECT& pRect)const; virtual void GetRect(Aggplus::RECT& pRect)const;
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const;
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const;
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader);
NvGraphicFramePr nvGraphicFramePr; NvGraphicFramePr nvGraphicFramePr;
nullable<Xfrm> xfrm; nullable<Xfrm> xfrm;
nullable_string spid; nullable_string spid;
nullable<Table> table; nullable<Table> table;
nullable<SmartArt> smartArt; nullable<SmartArt> smartArt;
nullable<ChartRec> chartRec; nullable<ChartRec> chartRec;
nullable<Pic> pic; nullable<Pic> pic;
nullable<SpTreeElem> element;
std::wstring GetVmlXmlBySpid(std::wstring & rels) const; std::wstring GetVmlXmlBySpid(std::wstring & rels) const;
protected: protected:
......
...@@ -48,8 +48,11 @@ namespace PPTX ...@@ -48,8 +48,11 @@ namespace PPTX
class GrpSpPr : public WrapperWritingElement class GrpSpPr : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(GrpSpPr) WritingElement_AdditionConstructors(GrpSpPr)
GrpSpPr()
{
}
GrpSpPr& operator=(const GrpSpPr& oSrc) GrpSpPr& operator=(const GrpSpPr& oSrc)
{ {
parentFile = oSrc.parentFile; parentFile = oSrc.parentFile;
...@@ -66,7 +69,9 @@ namespace PPTX ...@@ -66,7 +69,9 @@ namespace PPTX
{ {
return OOX::et_p_groupSpPr; return OOX::et_p_groupSpPr;
} }
public: virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
node.ReadAttributeBase(L"bwMode", bwMode); node.ReadAttributeBase(L"bwMode", bwMode);
......
...@@ -42,7 +42,11 @@ namespace PPTX ...@@ -42,7 +42,11 @@ namespace PPTX
class AudioCD : public WrapperWritingElement class AudioCD : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(AudioCD) WritingElement_AdditionConstructors(AudioCD)
AudioCD()
{
}
AudioCD& operator=(const AudioCD& oSrc) AudioCD& operator=(const AudioCD& oSrc)
{ {
...@@ -57,8 +61,10 @@ namespace PPTX ...@@ -57,8 +61,10 @@ namespace PPTX
return *this; return *this;
} }
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
public: {
//todooo
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
XmlUtils::CXmlNode oMem; XmlUtils::CXmlNode oMem;
......
...@@ -42,9 +42,12 @@ namespace PPTX ...@@ -42,9 +42,12 @@ namespace PPTX
{ {
class MediaFile : public WrapperWritingElement class MediaFile : public WrapperWritingElement
{ {
public: public:
WritingElement_AdditionConstructors(MediaFile)
PPTX_LOGIC_BASE(MediaFile)
MediaFile()
{
}
MediaFile& operator=(const MediaFile& oSrc) MediaFile& operator=(const MediaFile& oSrc)
{ {
...@@ -57,15 +60,25 @@ namespace PPTX ...@@ -57,15 +60,25 @@ namespace PPTX
return *this; return *this;
} }
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
public: {
name = XmlUtils::GetNameNoNS(oReader.GetName());
ReadAttributes(oReader);
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
name = XmlUtils::GetNameNoNS(node.GetName()); name = XmlUtils::GetNameNoNS(node.GetName());
link = node.GetAttribute(_T("r:link")); link = node.GetAttribute(_T("r:link"));
node.ReadAttributeBase(L"contentType", contentType); node.ReadAttributeBase(L"contentType", contentType);
} }
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("r:link"), link)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("contentType"), contentType)
WritingElement_ReadAttributes_End( oReader )
}
virtual std::wstring toXML() const virtual std::wstring toXML() const
{ {
XmlUtils::CAttribute oAttr; XmlUtils::CAttribute oAttr;
...@@ -75,7 +88,7 @@ namespace PPTX ...@@ -75,7 +88,7 @@ namespace PPTX
return XmlUtils::CreateNode(_T("a:") + name, oAttr); return XmlUtils::CreateNode(_T("a:") + name, oAttr);
} }
public: public:
std::wstring name; std::wstring name;
OOX::RId link; OOX::RId link;
nullable_string contentType; nullable_string contentType;
protected: protected:
......
...@@ -46,7 +46,12 @@ namespace PPTX ...@@ -46,7 +46,12 @@ namespace PPTX
class NvCxnSpPr : public WrapperWritingElement class NvCxnSpPr : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(NvCxnSpPr) WritingElement_AdditionConstructors(NvCxnSpPr)
NvCxnSpPr(std::wstring ns = L"p")
{
m_namespace = ns;
}
NvCxnSpPr& operator=(const NvCxnSpPr& oSrc) NvCxnSpPr& operator=(const NvCxnSpPr& oSrc)
{ {
...@@ -60,12 +65,33 @@ namespace PPTX ...@@ -60,12 +65,33 @@ namespace PPTX
return *this; return *this;
} }
public: virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlNode& node) {
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (strName == L"cNvPr")
cNvPr = oReader;
else if(strName == L"cNvCxnSpPr")
cNvCxnSpPr = oReader;
else if(strName == L"nvPr")
nvPr = oReader;
}
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
cNvPr = node.ReadNode(_T("p:cNvPr")); m_namespace = XmlUtils::GetNamespace(node.GetName());
cNvCxnSpPr = node.ReadNode(_T("p:cNvCxnSpPr"));
nvPr = node.ReadNode(_T("p:nvPr")); cNvPr = node.ReadNodeNoNS(_T("cNvPr"));
cNvCxnSpPr = node.ReadNodeNoNS(_T("cNvCxnSpPr"));
nvPr = node.ReadNodeNoNS(_T("nvPr"));
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
...@@ -77,26 +103,16 @@ namespace PPTX ...@@ -77,26 +103,16 @@ namespace PPTX
oValue.Write(cNvCxnSpPr); oValue.Write(cNvCxnSpPr);
oValue.Write(nvPr); oValue.Write(nvPr);
return XmlUtils::CreateNode(_T("<p:nvCxnSpPr>"), oValue); return XmlUtils::CreateNode(m_namespace + L":nvCxnSpPr", oValue);
} }
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
std::wstring namespace_; std::wstring namespace_ = m_namespace;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
{ if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = _T("wps");
pWriter->StartNode(_T("wps:nvCxnSpPr")); else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = _T("xdr");
namespace_ = _T("wps");
} pWriter->StartNode(namespace_ + L":nvCxnSpPr");
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
{
pWriter->StartNode(_T("xdr:nvCxnSpPr"));
namespace_ = _T("xdr");
}
else
{
pWriter->StartNode(_T("p:nvCxnSpPr"));
namespace_ = _T("p");
}
pWriter->EndAttributes(); pWriter->EndAttributes();
...@@ -104,12 +120,7 @@ namespace PPTX ...@@ -104,12 +120,7 @@ namespace PPTX
cNvCxnSpPr.toXmlWriter(pWriter); cNvCxnSpPr.toXmlWriter(pWriter);
nvPr.toXmlWriter2(namespace_, pWriter); nvPr.toXmlWriter2(namespace_, pWriter);
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) pWriter->EndNode(namespace_ + L":nvCxnSpPr");
pWriter->EndNode(_T("wps:nvCxnSpPr"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
pWriter->EndNode(_T("xdr:nvCxnSpPr"));
else
pWriter->EndNode(_T("p:nvCxnSpPr"));
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
...@@ -151,10 +162,11 @@ namespace PPTX ...@@ -151,10 +162,11 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
public: std::wstring m_namespace;
CNvPr cNvPr;
CNvCxnSpPr cNvCxnSpPr; CNvPr cNvPr;
NvPr nvPr; CNvCxnSpPr cNvCxnSpPr;
NvPr nvPr;
protected: protected:
virtual void FillParentPointersForChilds() virtual void FillParentPointersForChilds()
{ {
......
...@@ -46,8 +46,12 @@ namespace PPTX ...@@ -46,8 +46,12 @@ namespace PPTX
class NvGraphicFramePr : public WrapperWritingElement class NvGraphicFramePr : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(NvGraphicFramePr) WritingElement_AdditionConstructors(NvGraphicFramePr)
NvGraphicFramePr(std::wstring ns = L"p")
{
m_namespace = ns;
}
NvGraphicFramePr& operator=(const NvGraphicFramePr& oSrc) NvGraphicFramePr& operator=(const NvGraphicFramePr& oSrc)
{ {
parentFile = oSrc.parentFile; parentFile = oSrc.parentFile;
...@@ -57,18 +61,42 @@ namespace PPTX ...@@ -57,18 +61,42 @@ namespace PPTX
cNvGraphicFramePr = oSrc.cNvGraphicFramePr; cNvGraphicFramePr = oSrc.cNvGraphicFramePr;
nvPr = oSrc.nvPr; nvPr = oSrc.nvPr;
m_namespace = oSrc.m_namespace;
return *this; return *this;
} }
public:
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
m_namespace = XmlUtils::GetNamespace(node.GetName());
cNvPr = node.ReadNode(_T("p:cNvPr")); cNvPr = node.ReadNode(_T("p:cNvPr"));
cNvGraphicFramePr = node.ReadNode(_T("p:cNvGraphicFramePr")); cNvGraphicFramePr = node.ReadNode(_T("p:cNvGraphicFramePr"));
nvPr = node.ReadNode(_T("p:nvPr")); nvPr = node.ReadNode(_T("p:nvPr"));
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if (sName == L"cNvPr")
cNvPr.fromXML( oReader);
else if (sName == L"cNvGraphicFramePr")
cNvGraphicFramePr.fromXML( oReader);
else if (sName == L"nvPr")
nvPr.fromXML( oReader);
}
FillParentPointersForChilds();
}
virtual std::wstring toXML() const virtual std::wstring toXML() const
{ {
...@@ -77,7 +105,7 @@ namespace PPTX ...@@ -77,7 +105,7 @@ namespace PPTX
oValue.Write(cNvGraphicFramePr); oValue.Write(cNvGraphicFramePr);
oValue.Write(nvPr); oValue.Write(nvPr);
return XmlUtils::CreateNode(_T("p:nvGraphicFramePr"), oValue); return XmlUtils::CreateNode(m_namespace + L":nvGraphicFramePr", oValue);
} }
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
...@@ -150,7 +178,8 @@ namespace PPTX ...@@ -150,7 +178,8 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
public: std::wstring m_namespace;
CNvPr cNvPr; CNvPr cNvPr;
CNvGraphicFramePr cNvGraphicFramePr; CNvGraphicFramePr cNvGraphicFramePr;
NvPr nvPr; NvPr nvPr;
......
...@@ -38,45 +38,45 @@ namespace PPTX ...@@ -38,45 +38,45 @@ namespace PPTX
void NvGrpSpPr::fromXML(XmlUtils::CXmlNode& node) void NvGrpSpPr::fromXML(XmlUtils::CXmlNode& node)
{ {
m_namespace = XmlUtils::GetNamespace(node.GetName());
cNvPr = node.ReadNode(_T("p:cNvPr")); cNvPr = node.ReadNode(_T("p:cNvPr"));
cNvGrpSpPr = node.ReadNode(_T("p:cNvGrpSpPr")); cNvGrpSpPr = node.ReadNode(_T("p:cNvGrpSpPr"));
nvPr = node.ReadNode(_T("p:nvPr")); nvPr = node.ReadNode(_T("p:nvPr"));
FillParentPointersForChilds(); FillParentPointersForChilds();
/* }
XmlUtils::CXmlNodes oNodes; void NvGrpSpPr::fromXML(XmlUtils::CXmlLiteReader& oReader)
if (node.GetNodes(_T("*"), oNodes)) {
{ m_namespace = XmlUtils::GetNamespace(oReader.GetName());
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode oNode;
oNodes.GetAt(i, oNode);
std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName());
if (_T("cNvPr") == strName)
cNvPr = oNode;
else if (_T("cNvGrpSpPr") == strName)
cNvGrpSpPr = oNode;
else if (_T("nvPr") == strName)
nvPr = oNode;
}
}
FillParentPointersForChilds();
from header (old)*/
}
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if (sName == L"cNvPr")
cNvPr = oReader;
else if (sName == L"cNvGrpSpPr")
cNvGrpSpPr = oReader;
else if (sName == L"nvPr")
nvPr = oReader;
}
FillParentPointersForChilds();
}
std::wstring NvGrpSpPr::toXML() const std::wstring NvGrpSpPr::toXML() const
{ {
XmlUtils::CNodeValue oValue; XmlUtils::CNodeValue oValue;
oValue.Write(cNvPr); oValue.Write(cNvPr);
oValue.Write(cNvGrpSpPr); oValue.Write(cNvGrpSpPr);
oValue.Write(nvPr); oValue.Write(nvPr);
return XmlUtils::CreateNode(_T("p:nvGrpSpPr"), oValue); return XmlUtils::CreateNode(m_namespace + L":nvGrpSpPr", oValue);
} }
void NvGrpSpPr::FillParentPointersForChilds() void NvGrpSpPr::FillParentPointersForChilds()
......
...@@ -46,7 +46,12 @@ namespace PPTX ...@@ -46,7 +46,12 @@ namespace PPTX
class NvGrpSpPr : public WrapperWritingElement class NvGrpSpPr : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(NvGrpSpPr) WritingElement_AdditionConstructors(NvGrpSpPr)
NvGrpSpPr()
{
m_namespace = L"p";
}
NvGrpSpPr& operator=(const NvGrpSpPr& oSrc) NvGrpSpPr& operator=(const NvGrpSpPr& oSrc)
{ {
...@@ -62,49 +67,18 @@ namespace PPTX ...@@ -62,49 +67,18 @@ namespace PPTX
{ {
return OOX::et_p_NvGrpSpPr; return OOX::et_p_NvGrpSpPr;
} }
public:
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual void fromXML(XmlUtils::CXmlNode& node); virtual void fromXML(XmlUtils::CXmlNode& node);
//{
// XmlUtils::CXmlNodes oNodes;
// if (node.GetNodes(_T("*"), oNodes))
// {
// int nCount = oNodes.GetCount();
// for (int i = 0; i < nCount; ++i)
// {
// XmlUtils::CXmlNode oNode;
// oNodes.GetAt(i, oNode);
//virtual void fromXML(XmlUtils::CXmlNode& node);
virtual std::wstring toXML() const; virtual std::wstring toXML() const;
// std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName());
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
// if (_T("cNvPr") == strName)
// cNvPr = oNode;
// else if (_T("cNvGrpSpPr") == strName)
// cNvGrpSpPr = oNode;
// else if (_T("nvPr") == strName)
// nvPr = oNode;
// }
// }
// FillParentPointersForChilds();
//}
//virtual std::wstring toXML() const;
//{
// XmlUtils::CNodeValue oValue;
// oValue.Write(cNvPr);
// oValue.Write(cNvGrpSpPr);
// oValue.Write(nvPr);
// return XmlUtils::CreateNode(_T("p:nvGrpSpPr"), oValue);
//}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) std::wstring namespace_ = m_namespace;
pWriter->StartNode(_T("xdr:nvGrpSpPr")); if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else
pWriter->StartNode(_T("p:nvGrpSpPr")); pWriter->StartNode(namespace_ + L":nvGrpSpPr");
pWriter->EndAttributes(); pWriter->EndAttributes();
...@@ -112,12 +86,11 @@ namespace PPTX ...@@ -112,12 +86,11 @@ namespace PPTX
cNvGrpSpPr.toXmlWriter(pWriter); cNvGrpSpPr.toXmlWriter(pWriter);
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_PPTX) if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_PPTX)
{
nvPr.toXmlWriter(pWriter); nvPr.toXmlWriter(pWriter);
}
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) pWriter->EndNode(namespace_ + L":nvGrpSpPr");
pWriter->EndNode(_T("xdr:nvGrpSpPr"));
else
pWriter->EndNode(_T("p:nvGrpSpPr"));
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
...@@ -159,17 +132,14 @@ namespace PPTX ...@@ -159,17 +132,14 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
public: std::wstring m_namespace;
CNvPr cNvPr; CNvPr cNvPr;
CNvGrpSpPr cNvGrpSpPr; CNvGrpSpPr cNvGrpSpPr;
NvPr nvPr; NvPr nvPr;
protected: protected:
virtual void FillParentPointersForChilds(); virtual void FillParentPointersForChilds();
//{
// cNvPr.SetParentPointer(this);
// cNvGrpSpPr.SetParentPointer(this);
// nvPr.SetParentPointer(this);
//}
}; };
} // namespace Logic } // namespace Logic
} // namespace PPTX } // namespace PPTX
......
...@@ -46,8 +46,12 @@ namespace PPTX ...@@ -46,8 +46,12 @@ namespace PPTX
class NvPicPr : public WrapperWritingElement class NvPicPr : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(NvPicPr) WritingElement_AdditionConstructors(NvPicPr)
NvPicPr(std::wstring ns = L"p")
{
m_namespace = ns;
}
NvPicPr& operator=(const NvPicPr& oSrc) NvPicPr& operator=(const NvPicPr& oSrc)
{ {
parentFile = oSrc.parentFile; parentFile = oSrc.parentFile;
...@@ -57,12 +61,35 @@ namespace PPTX ...@@ -57,12 +61,35 @@ namespace PPTX
cNvPicPr = oSrc.cNvPicPr; cNvPicPr = oSrc.cNvPicPr;
nvPr = oSrc.nvPr; nvPr = oSrc.nvPr;
m_namespace = oSrc.m_namespace;
return *this; return *this;
} }
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (_T("cNvPr") == strName)
cNvPr.fromXML( oReader);
else if (_T("cNvPicPr") == strName)
cNvPicPr.fromXML( oReader);
else if (_T("nvPr") == strName)
nvPr.fromXML( oReader);
}
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
m_namespace = XmlUtils::GetNamespace(node.GetName());
XmlUtils::CXmlNodes oNodes; XmlUtils::CXmlNodes oNodes;
if (node.GetNodes(_T("*"), oNodes)) if (node.GetNodes(_T("*"), oNodes))
{ {
...@@ -93,17 +120,17 @@ namespace PPTX ...@@ -93,17 +120,17 @@ namespace PPTX
oValue.Write(cNvPicPr); oValue.Write(cNvPicPr);
oValue.Write(nvPr); oValue.Write(nvPr);
return XmlUtils::CreateNode(_T("p:nvPicPr"), oValue); return XmlUtils::CreateNode(m_namespace + L":nvPicPr", oValue);
} }
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) std::wstring namespace_ = m_namespace;
pWriter->StartNode(_T("pic:nvPicPr"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"pic";
pWriter->StartNode(_T("xdr:nvPicPr")); else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else
pWriter->StartNode(_T("p:nvPicPr")); pWriter->StartNode(namespace_ + L":nvPicPr");
pWriter->EndAttributes(); pWriter->EndAttributes();
...@@ -113,12 +140,7 @@ namespace PPTX ...@@ -113,12 +140,7 @@ namespace PPTX
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_PPTX) if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_PPTX)
nvPr.toXmlWriter(pWriter); nvPr.toXmlWriter(pWriter);
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) pWriter->EndNode(namespace_ + L":nvPicPr");
pWriter->EndNode(_T("pic:nvPicPr"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
pWriter->EndNode(_T("xdr:nvPicPr"));
else
pWriter->EndNode(_T("p:nvPicPr"));
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
...@@ -159,11 +181,11 @@ namespace PPTX ...@@ -159,11 +181,11 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
std::wstring m_namespace;
public: CNvPr cNvPr;
CNvPr cNvPr; CNvPicPr cNvPicPr;
CNvPicPr cNvPicPr; NvPr nvPr;
NvPr nvPr;
protected: protected:
virtual void FillParentPointersForChilds() virtual void FillParentPointersForChilds()
{ {
......
...@@ -44,8 +44,11 @@ namespace PPTX ...@@ -44,8 +44,11 @@ namespace PPTX
class NvPr : public WrapperWritingElement class NvPr : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(NvPr) WritingElement_AdditionConstructors(NvPr)
NvPr()
{
}
NvPr& operator=(const NvPr& oSrc) NvPr& operator=(const NvPr& oSrc)
{ {
isPhoto = oSrc.isPhoto; isPhoto = oSrc.isPhoto;
...@@ -58,14 +61,53 @@ namespace PPTX ...@@ -58,14 +61,53 @@ namespace PPTX
return *this; return *this;
} }
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
ReadAttributes(oReader);
public: if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (strName == L"ph")
ph = oReader;
else if (strName == L"extLst")
{
int nParentDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth1 ) )
{
Ext element;
element.fromXML(oReader);
extLst.push_back (element);
}
}
else
{
media.fromXML(oReader);
}
}
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("isPhoto"), isPhoto)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("userDrawn"), userDrawn)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
m_namespace = XmlUtils::GetNamespace(node.GetName());
node.ReadAttributeBase(L"isPhoto", isPhoto); node.ReadAttributeBase(L"isPhoto", isPhoto);
node.ReadAttributeBase(L"userDrawn", userDrawn); node.ReadAttributeBase(L"userDrawn", userDrawn);
ph = node.ReadNode(_T("p:ph")); ph = node.ReadNode(_T("p:ph"));
media.GetMediaFrom(node); media.GetMediaFrom(node);
XmlUtils::CXmlNode list; XmlUtils::CXmlNode list;
...@@ -191,17 +233,16 @@ namespace PPTX ...@@ -191,17 +233,16 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
std::wstring m_namespace;
// Attributes
nullable_bool isPhoto;
nullable_bool userDrawn;
public: //Childs
// Attributes nullable<Ph> ph;
nullable_bool isPhoto; UniMedia media;
nullable_bool userDrawn; //custDataLst
std::vector<Ext> extLst;
//Childs
nullable<Ph> ph;
UniMedia media;
//custDataLst
std::vector<Ext> extLst;
protected: protected:
virtual void FillParentPointersForChilds() virtual void FillParentPointersForChilds()
{ {
......
...@@ -46,7 +46,12 @@ namespace PPTX ...@@ -46,7 +46,12 @@ namespace PPTX
class NvSpPr : public WrapperWritingElement class NvSpPr : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(NvSpPr) WritingElement_AdditionConstructors(NvSpPr)
NvSpPr(std::wstring ns = L"p")
{
m_namespace = ns;
}
NvSpPr& operator=(const NvSpPr& oSrc) NvSpPr& operator=(const NvSpPr& oSrc)
{ {
...@@ -58,10 +63,32 @@ namespace PPTX ...@@ -58,10 +63,32 @@ namespace PPTX
nvPr = oSrc.nvPr; nvPr = oSrc.nvPr;
return *this; return *this;
} }
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
public: if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (_T("cNvPr") == strName)
cNvPr = oReader;
else if (_T("cNvSpPr") == strName)
cNvSpPr = oReader;
else if (_T("nvPr") == strName)
nvPr = oReader;
}
FillParentPointersForChilds();
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
m_namespace = XmlUtils::GetNamespace(node.GetName());
XmlUtils::CXmlNodes oNodes; XmlUtils::CXmlNodes oNodes;
if (node.GetNodes(_T("*"), oNodes)) if (node.GetNodes(_T("*"), oNodes))
{ {
...@@ -91,15 +118,17 @@ namespace PPTX ...@@ -91,15 +118,17 @@ namespace PPTX
oValue.Write(cNvSpPr); oValue.Write(cNvSpPr);
oValue.Write(nvPr); oValue.Write(nvPr);
return XmlUtils::CreateNode(_T("p:nvSpPr"), oValue); return XmlUtils::CreateNode(m_namespace + L":nvSpPr", oValue);
} }
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) std::wstring namespace_ = m_namespace;
pWriter->StartNode(_T("xdr:nvSpPr"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = _T("wps");
pWriter->StartNode(_T("p:nvSpPr")); else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = _T("xdr");
pWriter->StartNode( namespace_ + L":nvSpPr");
pWriter->EndAttributes(); pWriter->EndAttributes();
...@@ -109,10 +138,7 @@ namespace PPTX ...@@ -109,10 +138,7 @@ namespace PPTX
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_PPTX) if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_PPTX)
nvPr.toXmlWriter(pWriter); nvPr.toXmlWriter(pWriter);
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) pWriter->EndNode( namespace_ + L":nvSpPr");
pWriter->EndNode(_T("xdr:nvSpPr"));
else
pWriter->EndNode(_T("p:nvSpPr"));
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
...@@ -154,10 +180,11 @@ namespace PPTX ...@@ -154,10 +180,11 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
public: std::wstring m_namespace;
CNvPr cNvPr;
CNvSpPr cNvSpPr; CNvPr cNvPr;
NvPr nvPr; CNvSpPr cNvSpPr;
NvPr nvPr;
protected: protected:
virtual void FillParentPointersForChilds() virtual void FillParentPointersForChilds()
{ {
......
...@@ -44,9 +44,26 @@ namespace PPTX ...@@ -44,9 +44,26 @@ namespace PPTX
class Ph : public WrapperWritingElement class Ph : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(Ph) WritingElement_AdditionConstructors(Ph)
public: Ph()
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("hasCustomPrompt"), hasCustomPrompt)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("idx"), idx)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("orient"), orient)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("sz"), sz)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("type"), type)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
node.ReadAttributeBase(L"hasCustomPrompt", hasCustomPrompt); node.ReadAttributeBase(L"hasCustomPrompt", hasCustomPrompt);
......
...@@ -261,31 +261,59 @@ namespace PPTX ...@@ -261,31 +261,59 @@ namespace PPTX
return sRes; return sRes;
} }
Pic::Pic() Pic::Pic(std::wstring ns)
{ {
m_namespace = ns;
} }
Pic::~Pic() Pic::~Pic()
{ {
} }
Pic::Pic(XmlUtils::CXmlNode& node) Pic::Pic(XmlUtils::CXmlNode& node)
{ {
fromXML(node); fromXML(node);
} }
const Pic& Pic::operator =(XmlUtils::CXmlNode& node) const Pic& Pic::operator =(XmlUtils::CXmlNode& node)
{ {
fromXML(node); fromXML(node);
return *this; return *this;
} }
Pic::Pic(XmlUtils::CXmlLiteReader& oReader)
{
fromXML(oReader);
}
const Pic& Pic::operator =(XmlUtils::CXmlLiteReader& oReader)
{
fromXML(oReader);
return *this;
}
void Pic::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (_T("nvPicPr") == strName)
nvPicPr = oReader;
else if (_T("blipFill") == strName)
blipFill = oReader;
else if (_T("spPr") == strName)
spPr = oReader;
else if (_T("style") == strName)
style = oReader;
}
FillParentPointersForChilds();
}
void Pic::fromXML(XmlUtils::CXmlNode& node) void Pic::fromXML(XmlUtils::CXmlNode& node)
{ {
m_namespace = XmlUtils::GetNamespace(node.GetName());
XmlUtils::CXmlNodes oNodes; XmlUtils::CXmlNodes oNodes;
if (node.GetNodes(_T("*"), oNodes)) if (node.GetNodes(_T("*"), oNodes))
{ {
...@@ -327,7 +355,6 @@ namespace PPTX ...@@ -327,7 +355,6 @@ namespace PPTX
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
std::wstring Pic::toXML() const std::wstring Pic::toXML() const
{ {
XmlUtils::CNodeValue oValue; XmlUtils::CNodeValue oValue;
...@@ -336,7 +363,7 @@ namespace PPTX ...@@ -336,7 +363,7 @@ namespace PPTX
oValue.Write(spPr); oValue.Write(spPr);
oValue.WriteNullable(style); oValue.WriteNullable(style);
return XmlUtils::CreateNode(_T("p:pic"), oValue); return XmlUtils::CreateNode(m_namespace + L":pic", oValue);
} }
void Pic::FillParentPointersForChilds() void Pic::FillParentPointersForChilds()
......
...@@ -215,13 +215,23 @@ namespace PPTX ...@@ -215,13 +215,23 @@ namespace PPTX
class Pic : public WrapperWritingElement class Pic : public WrapperWritingElement
{ {
public: public:
Pic(); Pic(std::wstring ns = L"p");
virtual ~Pic(); virtual ~Pic();
virtual OOX::EElementType getType () const
{
return OOX::et_a_Pic;
}
explicit Pic(XmlUtils::CXmlNode& node); explicit Pic(XmlUtils::CXmlNode& node);
const Pic& operator =(XmlUtils::CXmlNode& node); const Pic& operator =(XmlUtils::CXmlNode& node);
explicit Pic(XmlUtils::CXmlLiteReader& oReader);
const Pic& operator =(XmlUtils::CXmlLiteReader& oReader);
public:
virtual void fromXML(XmlUtils::CXmlNode& node); virtual void fromXML(XmlUtils::CXmlNode& node);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const; virtual std::wstring toXML() const;
virtual void GetRect(Aggplus::RECT& pRect)const; virtual void GetRect(Aggplus::RECT& pRect)const;
virtual std::wstring GetFullPicName()const; virtual std::wstring GetFullPicName()const;
...@@ -255,16 +265,14 @@ namespace PPTX ...@@ -255,16 +265,14 @@ namespace PPTX
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
std::wstring namespace_ = m_namespace;
bool bOle = false; bool bOle = false;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
pWriter->StartNode(_T("xdr:pic")); if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) namespace_ = L"pic";
{
pWriter->StartNode(_T("pic:pic")); if (pWriter->m_lDocType != XMLWRITER_DOC_TYPE_XLSX &&
pWriter->StartAttributes(); pWriter->m_lDocType != XMLWRITER_DOC_TYPE_DOCX)
pWriter->WriteAttribute(_T("xmlns:pic"), (std::wstring)_T("http://schemas.openxmlformats.org/drawingml/2006/picture"));
}
else
{ {
if(oleObject.IsInit() && oleObject->isValid()) if(oleObject.IsInit() && oleObject->isValid())
{ {
...@@ -301,19 +309,19 @@ namespace PPTX ...@@ -301,19 +309,19 @@ namespace PPTX
pWriter->WriteString(L"<p:embed/>"); pWriter->WriteString(L"<p:embed/>");
} }
pWriter->StartNode(_T("p:pic"));
} }
pWriter->StartNode(namespace_ + L":pic");
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
{
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("xmlns:pic"), (std::wstring)_T("http://schemas.openxmlformats.org/drawingml/2006/picture"));
}
pWriter->EndAttributes(); pWriter->EndAttributes();
nvPicPr.toXmlWriter(pWriter); nvPicPr.toXmlWriter(pWriter);
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) blipFill.m_namespace = namespace_;
blipFill.m_namespace = _T("xdr");
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
blipFill.m_namespace = _T("pic");
else
blipFill.m_namespace = _T("p");
if (blipFill.blip.is_init()) if (blipFill.blip.is_init())
blipFill.blip->m_namespace = _T("a"); blipFill.blip->m_namespace = _T("a");
...@@ -325,11 +333,10 @@ namespace PPTX ...@@ -325,11 +333,10 @@ namespace PPTX
pWriter->Write(style); pWriter->Write(style);
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) pWriter->EndNode(namespace_ + L":pic");
pWriter->EndNode(_T("xdr:pic"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) if (pWriter->m_lDocType != XMLWRITER_DOC_TYPE_XLSX &&
pWriter->EndNode(_T("pic:pic")); pWriter->m_lDocType != XMLWRITER_DOC_TYPE_DOCX)
else
{ {
pWriter->EndNode(_T("p:pic")); pWriter->EndNode(_T("p:pic"));
if(bOle) if(bOle)
...@@ -337,7 +344,6 @@ namespace PPTX ...@@ -337,7 +344,6 @@ namespace PPTX
pWriter->WriteString(L"</p:oleObj></a:graphicData></a:graphic></p:graphicFrame>"); pWriter->WriteString(L"</p:oleObj></a:graphicData></a:graphic></p:graphicFrame>");
} }
} }
} }
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
...@@ -367,8 +373,7 @@ namespace PPTX ...@@ -367,8 +373,7 @@ namespace PPTX
} }
case 3: case 3:
{ {
style = new ShapeStyle(); style = new ShapeStyle(L"p");
style->m_ns = _T("p");
style->fromPPTY(pReader); style->fromPPTY(pReader);
break; break;
} }
...@@ -401,13 +406,13 @@ namespace PPTX ...@@ -401,13 +406,13 @@ namespace PPTX
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::WrapperFile>& oTheme, smart_ptr<PPTX::WrapperWritingElement>& oClrMap, bool in_group = false); void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::WrapperFile>& oTheme, smart_ptr<PPTX::WrapperWritingElement>& oClrMap, bool in_group = false);
void fromXMLOle(XmlUtils::CXmlNode& node); void fromXMLOle(XmlUtils::CXmlNode& node);
public:
NvPicPr nvPicPr; NvPicPr nvPicPr;
BlipFill blipFill; BlipFill blipFill;
SpPr spPr; SpPr spPr;
nullable<ShapeStyle> style; nullable<ShapeStyle> style;
//internal //internal
std::wstring m_namespace;
nullable<COLEObject> oleObject; nullable<COLEObject> oleObject;
protected: protected:
virtual void FillParentPointersForChilds(); virtual void FillParentPointersForChilds();
......
...@@ -41,8 +41,9 @@ namespace PPTX ...@@ -41,8 +41,9 @@ namespace PPTX
{ {
namespace Logic namespace Logic
{ {
Shape::Shape() Shape::Shape(std::wstring name_)
{ {
m_name = name_;
} }
Shape::~Shape() Shape::~Shape()
...@@ -53,15 +54,61 @@ namespace PPTX ...@@ -53,15 +54,61 @@ namespace PPTX
{ {
fromXML(node); fromXML(node);
} }
const Shape& Shape::operator =(XmlUtils::CXmlNode& node) const Shape& Shape::operator =(XmlUtils::CXmlNode& node)
{ {
fromXML(node); fromXML(node);
return *this; return *this;
} }
Shape::Shape(XmlUtils::CXmlLiteReader& oReader)
{
fromXML(oReader);
}
const Shape& Shape::operator =(XmlUtils::CXmlLiteReader& oReader)
{
fromXML(oReader);
return *this;
}
void Shape::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_name = oReader.GetName();
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (_T("nvSpPr") == strName)
nvSpPr = oReader;
else if (_T("spPr") == strName)
spPr = oReader;
else if (_T("style") == strName)
style = oReader;
else if (_T("txBody") == strName)
txBody = oReader;
else if (_T("txXfrm") == strName)
txXfrm = oReader;
else if (_T("txbx") == strName || _T("textbox") == strName)
txBody = oReader;
else if (_T("cNvPr") == strName)
nvSpPr.cNvPr = oReader;
else if (_T("cNvSpPr") == strName)
nvSpPr.cNvSpPr = oReader;
else if (_T("txSp") == strName)
txBody = oReader;
else if (_T("bodyPr") == strName)
TextBoxBodyPr = oReader;
}
FillParentPointersForChilds();
}
void Shape::fromXML(XmlUtils::CXmlNode& node) void Shape::fromXML(XmlUtils::CXmlNode& node)
{ {
m_name = node.GetName();
node.ReadAttributeBase(L"useBgFill", attrUseBgFill); node.ReadAttributeBase(L"useBgFill", attrUseBgFill);
XmlUtils::CXmlNodes oNodes; XmlUtils::CXmlNodes oNodes;
...@@ -112,7 +159,6 @@ namespace PPTX ...@@ -112,7 +159,6 @@ namespace PPTX
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
std::wstring Shape::toXML() const std::wstring Shape::toXML() const
{ {
XmlUtils::CAttribute oAttr; XmlUtils::CAttribute oAttr;
...@@ -124,17 +170,17 @@ namespace PPTX ...@@ -124,17 +170,17 @@ namespace PPTX
oValue.WriteNullable(style); oValue.WriteNullable(style);
oValue.WriteNullable(txBody); oValue.WriteNullable(txBody);
return XmlUtils::CreateNode(_T("p:sp"), oAttr, oValue); return XmlUtils::CreateNode(m_name, oAttr, oValue);
} }
void Shape::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const void Shape::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) std::wstring name_ = m_name;
pWriter->StartNode(_T("wps:wsp"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) name_ = L"wps:wsp";
pWriter->StartNode(_T("xdr:sp")); else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) name_ = L"xdr:sp";
else
pWriter->StartNode(_T("p:sp")); pWriter->StartNode(name_);
pWriter->StartAttributes(); pWriter->StartAttributes();
pWriter->WriteAttribute(_T("useBgFill"), attrUseBgFill); pWriter->WriteAttribute(_T("useBgFill"), attrUseBgFill);
...@@ -142,7 +188,6 @@ namespace PPTX ...@@ -142,7 +188,6 @@ namespace PPTX
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
{ {
//nvSpPr.cNvPr.toXmlWriter2(_T("wps"), pWriter);
nvSpPr.cNvSpPr.toXmlWriter2(_T("wps"), pWriter); nvSpPr.cNvSpPr.toXmlWriter2(_T("wps"), pWriter);
} }
else else
...@@ -166,9 +211,9 @@ namespace PPTX ...@@ -166,9 +211,9 @@ namespace PPTX
if (style.is_init()) if (style.is_init())
{ {
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
style->m_ns = _T("wps"); style->m_namespace = _T("wps");
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
style->m_ns = _T("xdr"); style->m_namespace = _T("xdr");
pWriter->Write(style); pWriter->Write(style);
} }
...@@ -208,12 +253,7 @@ namespace PPTX ...@@ -208,12 +253,7 @@ namespace PPTX
} }
} }
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) pWriter->EndNode(name_);
pWriter->EndNode(_T("wps:wsp"));
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX)
pWriter->EndNode(_T("xdr:sp"));
else
pWriter->EndNode(_T("p:sp"));
} }
void Shape::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) void Shape::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
...@@ -257,8 +297,7 @@ namespace PPTX ...@@ -257,8 +297,7 @@ namespace PPTX
} }
case 2: case 2:
{ {
style = new ShapeStyle(); style = new ShapeStyle(L"p");
style->m_ns = _T("p");
style->fromPPTY(pReader); style->fromPPTY(pReader);
break; break;
} }
......
...@@ -275,19 +275,31 @@ namespace PPTX ...@@ -275,19 +275,31 @@ namespace PPTX
class Shape : public WrapperWritingElement class Shape : public WrapperWritingElement
{ {
public: public:
Shape(); Shape(std::wstring name_ = L"p:sp");
virtual ~Shape(); virtual ~Shape();
explicit Shape(XmlUtils::CXmlNode& node); explicit Shape(XmlUtils::CXmlNode& node);
const Shape& operator =(XmlUtils::CXmlNode& node); const Shape& operator =(XmlUtils::CXmlNode& node);
explicit Shape(XmlUtils::CXmlLiteReader& oReader);
const Shape& operator =(XmlUtils::CXmlLiteReader& oReader);
virtual OOX::EElementType getType () const virtual OOX::EElementType getType () const
{ {
return OOX::et_p_Shape; return OOX::et_a_Shape;
} }
virtual void fromXML(XmlUtils::CXmlNode& node); virtual void fromXML(XmlUtils::CXmlNode& node);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const; virtual std::wstring toXML() const;
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("useBgFill"), attrUseBgFill)
WritingElement_ReadAttributes_End( oReader )
}
std::wstring GetText()const{if(txBody.IsInit()) return txBody->GetText(); return _T(""); }; std::wstring GetText()const{if(txBody.IsInit()) return txBody->GetText(); return _T(""); };
void GetShapeFullDescription(Shape& shape, int level = 0)const; void GetShapeFullDescription(Shape& shape, int level = 0)const;
...@@ -312,6 +324,8 @@ namespace PPTX ...@@ -312,6 +324,8 @@ namespace PPTX
virtual void toXmlWriter (NSBinPptxRW::CXmlWriter* pWriter) const; virtual void toXmlWriter (NSBinPptxRW::CXmlWriter* pWriter) const;
virtual void fromPPTY (NSBinPptxRW::CBinaryFileReader* pReader); virtual void fromPPTY (NSBinPptxRW::CBinaryFileReader* pReader);
std::wstring m_name;
NvSpPr nvSpPr; NvSpPr nvSpPr;
SpPr spPr; SpPr spPr;
nullable<ShapeStyle> style; nullable<ShapeStyle> style;
...@@ -324,7 +338,7 @@ namespace PPTX ...@@ -324,7 +338,7 @@ namespace PPTX
bool isFontRefInSlide; bool isFontRefInSlide;
mutable nullable<TextParagraphPr> body[10]; mutable nullable<TextParagraphPr> body[10];
// Attributes // Attributes
nullable_bool attrUseBgFill; nullable_bool attrUseBgFill;
protected: protected:
virtual void FillParentPointersForChilds(); virtual void FillParentPointersForChilds();
......
...@@ -44,8 +44,12 @@ namespace PPTX ...@@ -44,8 +44,12 @@ namespace PPTX
class ShapeStyle : public WrapperWritingElement class ShapeStyle : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(ShapeStyle) WritingElement_AdditionConstructors(ShapeStyle)
ShapeStyle(std::wstring ns = L"a")
{
m_namespace = ns;
}
ShapeStyle& operator=(const ShapeStyle& oSrc) ShapeStyle& operator=(const ShapeStyle& oSrc)
{ {
parentFile = oSrc.parentFile; parentFile = oSrc.parentFile;
...@@ -56,7 +60,7 @@ namespace PPTX ...@@ -56,7 +60,7 @@ namespace PPTX
effectRef = oSrc.effectRef; effectRef = oSrc.effectRef;
fontRef = oSrc.fontRef; fontRef = oSrc.fontRef;
m_ns = oSrc.m_ns; m_namespace = oSrc.m_namespace;
return *this; return *this;
} }
...@@ -64,10 +68,33 @@ namespace PPTX ...@@ -64,10 +68,33 @@ namespace PPTX
{ {
return OOX::et_p_style; return OOX::et_p_style;
} }
public:
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (_T("lnRef") == strName)
lnRef.fromXML(oReader);
else if (_T("fillRef") == strName)
fillRef.fromXML(oReader);
else if (_T("effectRef") == strName)
effectRef.fromXML(oReader);
else if (_T("fontRef") == strName)
fontRef.fromXML(oReader);
}
FillParentPointersForChilds();
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
m_ns = XmlUtils::GetNamespace(node.GetName()); m_namespace = XmlUtils::GetNamespace(node.GetName());
XmlUtils::CXmlNodes oNodes; XmlUtils::CXmlNodes oNodes;
if (node.GetNodes(_T("*"), oNodes)) if (node.GetNodes(_T("*"), oNodes))
...@@ -106,12 +133,12 @@ namespace PPTX ...@@ -106,12 +133,12 @@ namespace PPTX
oValue.Write(effectRef); oValue.Write(effectRef);
oValue.Write(fontRef); oValue.Write(fontRef);
return XmlUtils::CreateNode(m_ns + _T(":style"), oAttr, oValue); return XmlUtils::CreateNode(m_namespace + _T(":style"), oAttr, oValue);
} }
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->StartNode(m_ns + _T(":style")); pWriter->StartNode(m_namespace + _T(":style"));
pWriter->EndAttributes(); pWriter->EndAttributes();
lnRef.toXmlWriter(pWriter); lnRef.toXmlWriter(pWriter);
...@@ -119,7 +146,7 @@ namespace PPTX ...@@ -119,7 +146,7 @@ namespace PPTX
effectRef.toXmlWriter(pWriter); effectRef.toXmlWriter(pWriter);
fontRef.toXmlWriter(pWriter); fontRef.toXmlWriter(pWriter);
pWriter->EndNode(m_ns + _T(":style")); pWriter->EndNode(m_namespace + _T(":style"));
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
...@@ -177,7 +204,7 @@ namespace PPTX ...@@ -177,7 +204,7 @@ namespace PPTX
StyleRef effectRef; StyleRef effectRef;
FontRef fontRef; FontRef fontRef;
mutable std::wstring m_ns; mutable std::wstring m_namespace;
protected: protected:
virtual void FillParentPointersForChilds() virtual void FillParentPointersForChilds()
{ {
......
...@@ -47,8 +47,11 @@ namespace PPTX ...@@ -47,8 +47,11 @@ namespace PPTX
void SmartArt::LoadDrawing(NSBinPptxRW::CBinaryFileWriter* pWriter) void SmartArt::LoadDrawing(NSBinPptxRW::CBinaryFileWriter* pWriter)
{ {
FileContainer* pRels = NULL; FileContainer* pRels = NULL;
if (pWriter->m_pCommonRels->is_init()) if (pWriter)
pRels = pWriter->m_pCommonRels->operator ->(); {
if (pWriter->m_pCommonRels->is_init())
pRels = pWriter->m_pCommonRels->operator ->();
}
smart_ptr<OOX::File> oFileData; smart_ptr<OOX::File> oFileData;
smart_ptr<OOX::File> oFileDrawing; smart_ptr<OOX::File> oFileDrawing;
......
...@@ -42,7 +42,11 @@ namespace PPTX ...@@ -42,7 +42,11 @@ namespace PPTX
class SmartArt : public WrapperWritingElement class SmartArt : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(SmartArt) WritingElement_AdditionConstructors(SmartArt)
SmartArt()
{
}
SmartArt& operator=(const SmartArt& oSrc) SmartArt& operator=(const SmartArt& oSrc)
{ {
...@@ -52,15 +56,22 @@ namespace PPTX ...@@ -52,15 +56,22 @@ namespace PPTX
m_diag = oSrc.m_diag; m_diag = oSrc.m_diag;
return *this; return *this;
} }
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
public: {
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("r:dm"), id_data )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
FillParentPointersForChilds();
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
node.ReadAttributeBase(L"r:dm", id_data); node.ReadAttributeBase(L"r:dm", id_data);
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
virtual std::wstring toXML() const virtual std::wstring toXML() const
{ {
return _T(""); return _T("");
...@@ -86,48 +97,37 @@ namespace PPTX ...@@ -86,48 +97,37 @@ namespace PPTX
pReader->SkipRecord(); pReader->SkipRecord();
} }
public: nullable<OOX::RId> id_data;
nullable<OOX::RId> id_data;
nullable<PPTX::Logic::SpTree> m_diag; nullable<PPTX::Logic::SpTree> m_diag;
smart_ptr<PPTX::CCommonRels> m_oCommonRels; smart_ptr<PPTX::CCommonRels> m_oCommonRels;
protected: protected:
virtual void FillParentPointersForChilds() virtual void FillParentPointersForChilds()
{ {
LoadDrawing();
if(m_diag.IsInit()) if(m_diag.IsInit())
m_diag->SetParentPointer(this); m_diag->SetParentPointer(this);
} }
public: public:
void LoadDrawing(NSBinPptxRW::CBinaryFileWriter* pWriter); void LoadDrawing(NSBinPptxRW::CBinaryFileWriter* pWriter = NULL);
}; };
class ChartRec : public WrapperWritingElement class ChartRec : public WrapperWritingElement
{ {
public: public:
WritingElement_AdditionConstructors(ChartRec)
ChartRec() ChartRec()
{ {
m_bData = false; m_bData = false;
m_lChartNumber = 0; m_lChartNumber = 0;
} }
virtual ~ChartRec()
{
}
explicit ChartRec(XmlUtils::CXmlNode& node)
{
fromXML(node);
}
const ChartRec& operator =(XmlUtils::CXmlNode& node)
{
fromXML(node);
return *this;
}
ChartRec(const ChartRec& oSrc) ChartRec(const ChartRec& oSrc)
{ {
*this = oSrc; *this = oSrc;
} }
ChartRec& operator=(const ChartRec& oSrc) ChartRec& operator=(const ChartRec& oSrc)
{ {
parentFile = oSrc.parentFile; parentFile = oSrc.parentFile;
...@@ -135,8 +135,18 @@ namespace PPTX ...@@ -135,8 +135,18 @@ namespace PPTX
return *this; return *this;
} }
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
public: {
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("r:id"), id_data )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_bData = false;
ReadAttributes( oReader );
FillParentPointersForChilds();
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
m_bData = false; m_bData = false;
...@@ -144,8 +154,6 @@ namespace PPTX ...@@ -144,8 +154,6 @@ namespace PPTX
node.ReadAttributeBase(L"r:id", id_data); node.ReadAttributeBase(L"r:id", id_data);
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
virtual std::wstring toXML() const virtual std::wstring toXML() const
{ {
return _T(""); return _T("");
...@@ -156,12 +164,10 @@ namespace PPTX ...@@ -156,12 +164,10 @@ namespace PPTX
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader);
public: nullable<OOX::RId> id_data;
nullable<OOX::RId> id_data;
LONG m_lChartNumber; LONG m_lChartNumber;
bool m_bData; bool m_bData;
protected: protected:
virtual void FillParentPointersForChilds() virtual void FillParentPointersForChilds()
{ {
......
...@@ -39,9 +39,9 @@ namespace PPTX ...@@ -39,9 +39,9 @@ namespace PPTX
{ {
namespace Logic namespace Logic
{ {
SpPr::SpPr(std::wstring ns)
SpPr::SpPr()
{ {
m_namespace = ns;
Fill.m_type = UniFill::notInit; Fill.m_type = UniFill::notInit;
} }
SpPr::~SpPr() SpPr::~SpPr()
......
...@@ -52,8 +52,9 @@ namespace PPTX ...@@ -52,8 +52,9 @@ namespace PPTX
class SpPr : public WrapperWritingElement class SpPr : public WrapperWritingElement
{ {
public: public:
SpPr(); SpPr(std::wstring ns = L"a");
virtual ~SpPr(); virtual ~SpPr();
explicit SpPr(XmlUtils::CXmlNode& node); explicit SpPr(XmlUtils::CXmlNode& node);
const SpPr& operator =(XmlUtils::CXmlNode& node); const SpPr& operator =(XmlUtils::CXmlNode& node);
......
...@@ -49,7 +49,11 @@ namespace PPTX ...@@ -49,7 +49,11 @@ namespace PPTX
class SpTree : public WrapperWritingElement class SpTree : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(SpTree) WritingElement_AdditionConstructors(SpTree)
SpTree()
{
}
SpTree& operator=(const SpTree& oSrc) SpTree& operator=(const SpTree& oSrc)
{ {
...@@ -70,7 +74,43 @@ namespace PPTX ...@@ -70,7 +74,43 @@ namespace PPTX
{ {
return OOX::et_p_ShapeTree; return OOX::et_p_ShapeTree;
} }
public: virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_name = oReader.GetName();
SpTreeElems.clear();
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (strName == L"nvGrpSpPr")
nvGrpSpPr.fromXML(oReader);
else if (strName == L"grpSpPr")
grpSpPr.fromXML(oReader);
else if (_T("cNvPr") == strName)
{
nvGrpSpPr.cNvPr = oReader;
}
else if (_T("cNvGrpSpPr") == strName)
{
nvGrpSpPr.cNvGrpSpPr = oReader;
}
else
{
SpTreeElem elem(oReader);
if (elem.is_init())
SpTreeElems.push_back(elem);
}
}
FillParentPointersForChilds();
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
m_name = node.GetName(); m_name = node.GetName();
...@@ -256,9 +296,8 @@ namespace PPTX ...@@ -256,9 +296,8 @@ namespace PPTX
Logic::NvGrpSpPr nvGrpSpPr; Logic::NvGrpSpPr nvGrpSpPr;
Logic::GrpSpPr grpSpPr; Logic::GrpSpPr grpSpPr;
std::vector<SpTreeElem> SpTreeElems; std::vector<SpTreeElem> SpTreeElems;
//private:
public: std::wstring m_name;
std::wstring m_name;
protected: protected:
virtual void FillParentPointersForChilds() virtual void FillParentPointersForChilds()
{ {
......
...@@ -180,7 +180,6 @@ namespace PPTX ...@@ -180,7 +180,6 @@ namespace PPTX
} }
*/ */
} }
void CalculateLine(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, NSCommon::smart_ptr<PPTX::WrapperFile>& _oTheme, void CalculateLine(PPTX::Logic::SpPr& oSpPr, nullable<ShapeStyle>& pShapeStyle, NSCommon::smart_ptr<PPTX::WrapperFile>& _oTheme,
NSCommon::smart_ptr<PPTX::WrapperWritingElement>& _oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle) NSCommon::smart_ptr<PPTX::WrapperWritingElement>& _oClrMap, std::wstring& strAttr, std::wstring& strNode, bool bOle)
{ {
...@@ -213,30 +212,65 @@ namespace PPTX ...@@ -213,30 +212,65 @@ namespace PPTX
strAttr += s; strAttr += s;
} }
} }
SpTreeElem::SpTreeElem() SpTreeElem::SpTreeElem()
{ {
} }
SpTreeElem::~SpTreeElem() SpTreeElem::~SpTreeElem()
{ {
} }
SpTreeElem::SpTreeElem(XmlUtils::CXmlNode& node) SpTreeElem::SpTreeElem(XmlUtils::CXmlNode& node)
{ {
fromXML(node); fromXML(node);
} }
const SpTreeElem& SpTreeElem::operator =(XmlUtils::CXmlNode& node) const SpTreeElem& SpTreeElem::operator =(XmlUtils::CXmlNode& node)
{ {
fromXML(node); fromXML(node);
return *this; return *this;
} }
SpTreeElem::SpTreeElem(XmlUtils::CXmlLiteReader& oReader)
{
fromXML(oReader);
}
const SpTreeElem& SpTreeElem::operator =(XmlUtils::CXmlLiteReader& oReader)
{
fromXML(oReader);
return *this;
}
void SpTreeElem::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring name = XmlUtils::GetNameNoNS(oReader.GetName());
if (name == _T("sp") || name == _T("wsp"))
m_elem.reset(new Logic::Shape(oReader));
else if (name == _T("pic"))
m_elem.reset(new Logic::Pic(oReader));
else if (name == _T("cxnSp"))
m_elem.reset(new Logic::CxnSp(oReader));
else if (name == _T("grpSp") || name == _T("wgp") || name == _T("spTree") || name == _T("lockedCanvas"))
m_elem.reset(new Logic::SpTree(oReader));
else if (name == _T("graphicFrame"))
m_elem.reset(new Logic::GraphicFrame(oReader));
else if (name == _T("AlternateContent"))
{
bool isEmpty = true;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
if (strName == L"mc:Choice")
{
//GetAttributeIfExist(L"Requires", sRequires) && L"a14" == sRequires)
fromXML(oReader);
break;
}
else if (strName == L"mc:Fallback")
{
fromXML(oReader);
}
}
}
else m_elem.reset();
}
void SpTreeElem::fromXML(XmlUtils::CXmlNode& node) void SpTreeElem::fromXML(XmlUtils::CXmlNode& node)
{ {
std::wstring name = XmlUtils::GetNameNoNS(node.GetName()); std::wstring name = XmlUtils::GetNameNoNS(node.GetName());
......
...@@ -51,17 +51,28 @@ namespace PPTX ...@@ -51,17 +51,28 @@ namespace PPTX
public: public:
SpTreeElem(); SpTreeElem();
virtual ~SpTreeElem(); virtual ~SpTreeElem();
virtual OOX::EElementType getType () const
{
if (m_elem.IsInit())
return m_elem->getType();
return OOX::et_Unknown;
}
explicit SpTreeElem(XmlUtils::CXmlNode& node); explicit SpTreeElem(XmlUtils::CXmlNode& node);
const SpTreeElem& operator =(XmlUtils::CXmlNode& node); const SpTreeElem& operator =(XmlUtils::CXmlNode& node);
explicit SpTreeElem(XmlUtils::CXmlLiteReader& oReader);
const SpTreeElem& operator =(XmlUtils::CXmlLiteReader& oReader);
SpTreeElem& operator=(const SpTreeElem& oSrc) SpTreeElem& operator=(const SpTreeElem& oSrc)
{ {
m_elem = oSrc.m_elem; m_elem = oSrc.m_elem;
return *this; return *this;
} }
public:
virtual void fromXML(XmlUtils::CXmlNode& node); virtual void fromXML(XmlUtils::CXmlNode& node);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const; virtual std::wstring toXML() const;
virtual bool is_init() const {return (m_elem.IsInit());} virtual bool is_init() const {return (m_elem.IsInit());}
......
...@@ -44,9 +44,33 @@ namespace PPTX ...@@ -44,9 +44,33 @@ namespace PPTX
class StyleRef : public WrapperWritingElement class StyleRef : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(StyleRef) WritingElement_AdditionConstructors(StyleRef)
public: StyleRef()
{
}
virtual OOX::EElementType getType () const
{
return OOX::et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_name = oReader.GetName();
ReadAttributes( oReader );
Color.fromXMLParent(oReader);
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("idx"), idx )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
m_name = node.GetName(); m_name = node.GetName();
......
...@@ -45,7 +45,11 @@ namespace PPTX ...@@ -45,7 +45,11 @@ namespace PPTX
class Table : public WrapperWritingElement class Table : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(Table) WritingElement_AdditionConstructors(Table)
Table()
{
}
Table& operator=(const Table& oSrc) Table& operator=(const Table& oSrc)
{ {
...@@ -58,8 +62,6 @@ namespace PPTX ...@@ -58,8 +62,6 @@ namespace PPTX
tableProperties = oSrc.tableProperties; tableProperties = oSrc.tableProperties;
return *this; return *this;
} }
public:
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
XmlUtils::CXmlNode oNode; XmlUtils::CXmlNode oNode;
...@@ -72,7 +74,41 @@ namespace PPTX ...@@ -72,7 +74,41 @@ namespace PPTX
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (strName == L"tblGrid")
{
int nParentDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth1 ) )
{
std::wstring strName1 = XmlUtils::GetNameNoNS(oReader.GetName());
if (strName1 == L"gridCol")
{
TableCol col;
TableCols.push_back(col);
TableCols.back().fromXML(oReader);
}
}
}
else if (strName == L"tblPr")
tableProperties = oReader;
else if (strName == L"tr")
{
TableRow tr;
TableRows.push_back(tr);
TableRows.back().fromXML(oReader);
}
}
FillParentPointersForChilds();
}
virtual std::wstring toXML() const virtual std::wstring toXML() const
{ {
XmlUtils::CNodeValue oValue; XmlUtils::CNodeValue oValue;
...@@ -158,7 +194,6 @@ namespace PPTX ...@@ -158,7 +194,6 @@ namespace PPTX
pWriter->EndNode(_T("a:tbl")); pWriter->EndNode(_T("a:tbl"));
} }
public:
std::vector<TableCol> TableCols; std::vector<TableCol> TableCols;
std::vector<TableRow> TableRows; std::vector<TableRow> TableRows;
nullable<TableProperties> tableProperties; nullable<TableProperties> tableProperties;
......
...@@ -41,26 +41,62 @@ namespace PPTX ...@@ -41,26 +41,62 @@ namespace PPTX
TableCell::TableCell() TableCell::TableCell()
{ {
} }
TableCell::~TableCell() TableCell::~TableCell()
{ {
} }
TableCell::TableCell(XmlUtils::CXmlNode& node) TableCell::TableCell(XmlUtils::CXmlNode& node)
{ {
fromXML(node); fromXML(node);
} }
const TableCell& TableCell::operator =(XmlUtils::CXmlNode& node) const TableCell& TableCell::operator =(XmlUtils::CXmlNode& node)
{ {
fromXML(node); fromXML(node);
return *this; return *this;
} }
TableCell::TableCell(XmlUtils::CXmlLiteReader& oReader)
{
fromXML(oReader);
}
const TableCell& TableCell::operator =(XmlUtils::CXmlLiteReader& oReader)
{
fromXML(oReader);
return *this;
}
void TableCell::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("rowSpan"), RowSpan)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("gridSpan"), GridSpan)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("hMerge"), HMerge)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("vMerge"), VMerge)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("id"), Id)
WritingElement_ReadAttributes_End( oReader )
}
void TableCell::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (strName == L"txBody")
txBody = oReader;
else if (strName == L"tcPr")
CellProperties = oReader;
}
FillParentPointersForChilds();
}
void TableCell::fromXML(XmlUtils::CXmlNode& node) void TableCell::fromXML(XmlUtils::CXmlNode& node)
{ {
txBody = node.ReadNodeNoNS(_T("txBody")); txBody = node.ReadNodeNoNS(_T("txBody"));
CellProperties = node.ReadNode(_T("a:tcPr")); CellProperties = node.ReadNode(_T("a:tcPr"));
node.ReadAttributeBase(L"rowSpan", RowSpan); node.ReadAttributeBase(L"rowSpan", RowSpan);
node.ReadAttributeBase(L"gridSpan", GridSpan); node.ReadAttributeBase(L"gridSpan", GridSpan);
node.ReadAttributeBase(L"hMerge", HMerge); node.ReadAttributeBase(L"hMerge", HMerge);
......
...@@ -47,11 +47,18 @@ namespace PPTX ...@@ -47,11 +47,18 @@ namespace PPTX
public: public:
TableCell(); TableCell();
virtual ~TableCell(); virtual ~TableCell();
explicit TableCell(XmlUtils::CXmlNode& node); explicit TableCell(XmlUtils::CXmlNode& node);
const TableCell& operator =(XmlUtils::CXmlNode& node); const TableCell& operator =(XmlUtils::CXmlNode& node);
public: explicit TableCell(XmlUtils::CXmlLiteReader& oReader);
const TableCell& operator =(XmlUtils::CXmlLiteReader& oReader);
virtual void fromXML(XmlUtils::CXmlNode& node); virtual void fromXML(XmlUtils::CXmlNode& node);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const; virtual std::wstring toXML() const;
virtual void GetShapeProperties(ShapeProperties& props)const; virtual void GetShapeProperties(ShapeProperties& props)const;
......
...@@ -48,7 +48,11 @@ namespace PPTX ...@@ -48,7 +48,11 @@ namespace PPTX
class TableCellProperties : public WrapperWritingElement class TableCellProperties : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(TableCellProperties) WritingElement_AdditionConstructors(TableCellProperties)
TableCellProperties()
{
}
TableCellProperties& operator=(const TableCellProperties& oSrc) TableCellProperties& operator=(const TableCellProperties& oSrc)
{ {
...@@ -74,8 +78,49 @@ namespace PPTX ...@@ -74,8 +78,49 @@ namespace PPTX
HorzOverflow = oSrc.HorzOverflow; HorzOverflow = oSrc.HorzOverflow;
return *this; return *this;
} }
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
public: if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = oReader.GetName();
if (_T("a:lnL") == strName)
LnL = oReader;
else if (_T("a:lnR") == strName)
LnR = oReader;
else if (_T("a:lnT") == strName)
LnT = oReader;
else if (_T("a:lnB") == strName)
LnB = oReader;
else if (_T("a:cell3D") == strName)
cell3D = oReader;
else if (_T("a:lnBlToTr") == strName)
LnTlToBr = oReader;
else if (_T("a:lnBlToTr") == strName)
LnBlToTr = oReader;
else
Fill.fromXML(oReader);
}
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("marL"), MarL )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("marR"), MarR )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("marT"), MarT )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("marB"), MarB )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("vert"), Vert )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("anchor"), Anchor )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("anchorCtr"), AnchorCtr )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("horzOverflow"), HorzOverflow )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
LnL = node.ReadNode(_T("a:lnL")); LnL = node.ReadNode(_T("a:lnL"));
......
...@@ -42,7 +42,11 @@ namespace PPTX ...@@ -42,7 +42,11 @@ namespace PPTX
class TableCol : public WrapperWritingElement class TableCol : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(TableCol) WritingElement_AdditionConstructors(TableCol)
TableCol()
{
}
TableCol& operator=(const TableCol& oSrc) TableCol& operator=(const TableCol& oSrc)
{ {
...@@ -52,8 +56,16 @@ namespace PPTX ...@@ -52,8 +56,16 @@ namespace PPTX
Width = oSrc.Width; Width = oSrc.Width;
return *this; return *this;
} }
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
public: {
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w"), Width)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
Width = node.ReadAttributeInt(L"w"); Width = node.ReadAttributeInt(L"w");
...@@ -61,7 +73,7 @@ namespace PPTX ...@@ -61,7 +73,7 @@ namespace PPTX
virtual std::wstring toXML() const virtual std::wstring toXML() const
{ {
return L"<a:gridCol w=\"" + std::to_wstring(Width) + L"\"/>"; return L"<a:gridCol w=\"" + std::to_wstring(Width.get_value_or(0)) + L"\"/>";
} }
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
...@@ -78,7 +90,7 @@ namespace PPTX ...@@ -78,7 +90,7 @@ namespace PPTX
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{ {
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteInt1(0, Width); pWriter->WriteInt2(0, Width);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
} }
...@@ -107,8 +119,7 @@ namespace PPTX ...@@ -107,8 +119,7 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
public: nullable_int Width;
int Width;
protected: protected:
virtual void FillParentPointersForChilds(){}; virtual void FillParentPointersForChilds(){};
}; };
......
...@@ -44,7 +44,11 @@ namespace PPTX ...@@ -44,7 +44,11 @@ namespace PPTX
class TableProperties : public WrapperWritingElement class TableProperties : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(TableProperties) WritingElement_AdditionConstructors(TableProperties)
TableProperties()
{
}
TableProperties& operator=(const TableProperties& oSrc) TableProperties& operator=(const TableProperties& oSrc)
{ {
...@@ -65,8 +69,52 @@ namespace PPTX ...@@ -65,8 +69,52 @@ namespace PPTX
return *this; return *this;
} }
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
public: if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = oReader.GetName();
if (strName == L"a:tableStyleId")
{
TableStyleId = oReader.GetText2();
}
else if ( L"a:blipFill" == strName ||
L"a:gradFill" == strName ||
L"a:grpFill" == strName ||
L"a:noFill" == strName ||
L"a:pattFill" == strName ||
L"a:solidFill"== strName )
{
Fill.fromXML(oReader);
}
else if ( L"a:effectDag" == strName ||
L"a:effectLst" == strName ||
L"a:extLst" == strName )
{
Effects.fromXML(oReader);
}
}
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("rtl"), Rtl)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("firstRow"), FirstRow)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("firstCol"), FirstCol)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("lastRow"), LastRow)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("lastCol"), LastCol)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("bandRow"), BandRow)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("bandCol"), BandCol)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
Fill.GetFillFrom(node); Fill.GetFillFrom(node);
......
...@@ -43,7 +43,11 @@ namespace PPTX ...@@ -43,7 +43,11 @@ namespace PPTX
class TableRow : public WrapperWritingElement class TableRow : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(TableRow) WritingElement_AdditionConstructors(TableRow)
TableRow()
{
}
TableRow& operator=(const TableRow& oSrc) TableRow& operator=(const TableRow& oSrc)
{ {
...@@ -56,7 +60,32 @@ namespace PPTX ...@@ -56,7 +60,32 @@ namespace PPTX
return *this; return *this;
} }
public: virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (strName == L"tc")
{
TableCell c;
Cells.push_back(c);
Cells.back().fromXML(oReader);
}
}
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("h"), Height)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
Height = node.ReadAttributeInt(L"h"); Height = node.ReadAttributeInt(L"h");
...@@ -92,7 +121,7 @@ namespace PPTX ...@@ -92,7 +121,7 @@ namespace PPTX
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{ {
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteInt1(0, Height); pWriter->WriteInt2(0, Height);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->WriteRecordArray(0, 1, Cells); pWriter->WriteRecordArray(0, 1, Cells);
...@@ -146,8 +175,7 @@ namespace PPTX ...@@ -146,8 +175,7 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
public: nullable_int Height;
int Height;
std::vector<TableCell> Cells; std::vector<TableCell> Cells;
protected: protected:
virtual void FillParentPointersForChilds() virtual void FillParentPointersForChilds()
......
...@@ -45,9 +45,29 @@ namespace PPTX ...@@ -45,9 +45,29 @@ namespace PPTX
class UniMedia : public WrapperWritingElement class UniMedia : public WrapperWritingElement
{ {
public: public:
PPTX_LOGIC_BASE(UniMedia) WritingElement_AdditionConstructors(UniMedia)
public:
UniMedia()
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring name = XmlUtils::GetNameNoNS(oReader.GetName());
if (name == _T("audioCd"))
Media.reset(new Logic::AudioCD(oReader));
else if (name == _T("wavAudioFile"))
Media.reset(new Logic::WavAudioFile(oReader));
else if (name == _T("audioFile"))
Media.reset(new Logic::MediaFile(oReader));
else if (name == _T("videoFile"))
Media.reset(new Logic::MediaFile(oReader));
else if (name == _T("quickTimeFile"))
Media.reset(new Logic::MediaFile(oReader));
else Media.reset();
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
std::wstring name = XmlUtils::GetNameNoNS(node.GetName()); std::wstring name = XmlUtils::GetNameNoNS(node.GetName());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment