Commit bed88400 authored by ElenaSubbotina's avatar ElenaSubbotina

PptxFormat - slide sections

parent 1aa0b039
...@@ -415,11 +415,10 @@ namespace NSBinPptxRW ...@@ -415,11 +415,10 @@ namespace NSBinPptxRW
LONG lLayouts = (LONG)m_arSlideMasters_Theme[i].m_arLayouts.size(); LONG lLayouts = (LONG)m_arSlideMasters_Theme[i].m_arLayouts.size();
for (LONG j = 0; j < lLayouts; ++j) for (LONG j = 0; j < lLayouts; ++j)
{ {
arrLays.push_back(PPTX::Logic::XmlId()); arrLays.push_back(PPTX::Logic::XmlId(L"p:sldLayoutId"));
std::wstring sId = std::to_wstring((_UINT64)(0x80000000 + __nCountLayouts + j + 1)); std::wstring sId = std::to_wstring((_UINT64)(0x80000000 + __nCountLayouts + j + 1));
arrLays[j].m_name = _T("sldLayoutId");
arrLays[j].id = sId; arrLays[j].id = sId;
arrLays[j].rid = (size_t)(j + 1); arrLays[j].rid = (size_t)(j + 1);
} }
...@@ -755,11 +754,10 @@ namespace NSBinPptxRW ...@@ -755,11 +754,10 @@ namespace NSBinPptxRW
LONG nCountLayouts = 0; LONG nCountLayouts = 0;
for (LONG i = 0; i < nCountMasters; ++i) for (LONG i = 0; i < nCountMasters; ++i)
{ {
m_oPresentation.sldMasterIdLst.push_back(PPTX::Logic::XmlId()); m_oPresentation.sldMasterIdLst.push_back(PPTX::Logic::XmlId(L"p:sldMasterId"));
std::wstring sId = std::to_wstring((_UINT64)(0x80000000 + nCountLayouts)); std::wstring sId = std::to_wstring((_UINT64)(0x80000000 + nCountLayouts));
m_oPresentation.sldMasterIdLst[i].m_name = _T("sldMasterId");
m_oPresentation.sldMasterIdLst[i].id = sId; m_oPresentation.sldMasterIdLst[i].id = sId;
m_oPresentation.sldMasterIdLst[i].rid = (size_t)(i + 1); m_oPresentation.sldMasterIdLst[i].rid = (size_t)(i + 1);
nCountLayouts += (LONG)(m_arSlideMasters_Theme[i].m_arLayouts.size() + 1); nCountLayouts += (LONG)(m_arSlideMasters_Theme[i].m_arLayouts.size() + 1);
...@@ -773,11 +771,10 @@ namespace NSBinPptxRW ...@@ -773,11 +771,10 @@ namespace NSBinPptxRW
m_oPresentation.sldIdLst.clear(); m_oPresentation.sldIdLst.clear();
for (LONG i = 0; i < nCountSlides; ++i) for (LONG i = 0; i < nCountSlides; ++i)
{ {
m_oPresentation.sldIdLst.push_back(PPTX::Logic::XmlId()); m_oPresentation.sldIdLst.push_back(PPTX::Logic::XmlId(L"p:sldId"));
std::wstring sId = std::to_wstring(256 + i); std::wstring sId = std::to_wstring(256 + i);
m_oPresentation.sldIdLst[i].m_name = _T("sldId");
m_oPresentation.sldIdLst[i].id = sId; m_oPresentation.sldIdLst[i].id = sId;
m_oPresentation.sldIdLst[i].rid = (size_t)nCurrentRels; m_oPresentation.sldIdLst[i].rid = (size_t)nCurrentRels;
++nCurrentRels; ++nCurrentRels;
...@@ -788,8 +785,8 @@ namespace NSBinPptxRW ...@@ -788,8 +785,8 @@ namespace NSBinPptxRW
m_oPresentation.notesMasterIdLst.clear(); m_oPresentation.notesMasterIdLst.clear();
if (bNotesMasterPresent) if (bNotesMasterPresent)
{ {
m_oPresentation.notesMasterIdLst.push_back(PPTX::Logic::XmlId()); m_oPresentation.notesMasterIdLst.push_back(PPTX::Logic::XmlId(L"p:notesMasterId"));
m_oPresentation.notesMasterIdLst[0].m_name = _T("notesMasterId");
m_oPresentation.notesMasterIdLst[0].rid = (size_t)nCurrentRels; m_oPresentation.notesMasterIdLst[0].rid = (size_t)nCurrentRels;
++nCurrentRels; ++nCurrentRels;
} }
......
...@@ -32,15 +32,15 @@ ...@@ -32,15 +32,15 @@
#ifndef PPTX_LOGIC_EXTP_PROPERTIES_INCLUDE_H_ #ifndef PPTX_LOGIC_EXTP_PROPERTIES_INCLUDE_H_
#define PPTX_LOGIC_EXTP_PROPERTIES_INCLUDE_H_ #define PPTX_LOGIC_EXTP_PROPERTIES_INCLUDE_H_
#include "./../WrapperWritingElement.h" #include "../Presentation/SectionLst.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/RId.h"
//--------------------------------------------------------------------------------------------------------------
//<p:ext uri="{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}"> //<p:ext uri="{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}">
//<p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId2"> //<p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId2">
//<p14:trim st="93333.0816" end="96583.4816"/> //<p14:trim st="93333.0816" end="96583.4816"/>
//</p14:media> //</p14:media>
//</p:ext> //</p:ext>
//--------------------------------------------------------------------------------------------------------------
//<ext uri="{05C60535-1F16-4fd2-B633-F4F36F0B64E0}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"> //<ext uri="{05C60535-1F16-4fd2-B633-F4F36F0B64E0}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main">
// <x14:sparklineGroups xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main"> // <x14:sparklineGroups xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">
// <x14:sparklineGroup displayEmptyCellsAs="gap"> // <x14:sparklineGroup displayEmptyCellsAs="gap">
...@@ -61,10 +61,33 @@ ...@@ -61,10 +61,33 @@
// </x14:sparklineGroup> // </x14:sparklineGroup>
// </x14:sparklineGroups> // </x14:sparklineGroups>
//</ext> //</ext>
//--------------------------------------------------------------------------------------------------------------
//<a:ext uri="{63B3BB69-23CF-44E3-9099-C40C66FF867C}"> //<a:ext uri="{63B3BB69-23CF-44E3-9099-C40C66FF867C}">
// <a14:compatExt spid="_x0000_s1025"/> // <a14:compatExt spid="_x0000_s1025"/>
//</a:ext> //</a:ext>
//--------------------------------------------------------------------------------------------------------------
// <p:ext uri="{521415D9-36F7-43E2-AB2F-B90AF26B5E84}">
// <p14:sectionLst xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main">
// <p14:section name="123" id="{775558AA-D529-4C59-9762-B6F3CDAC8092}">
// <p14:sldIdLst>
// <p14:sldId id="256"/>
// <p14:sldId id="257"/>
// </p14:sldIdLst>
// </p14:section>
// <p14:section name="qwerty" id="{296A3C58-7D47-4848-A546-3C86980BE927}">
// <p14:sldIdLst>
// <p14:sldId id="258"/>
// </p14:sldIdLst>
// </p14:section>
// <p14:section name="Раздел без заголовка" id="{DA908BF8-2A15-4E46-B49B-C1BB4B4AAF31}">
// <p14:sldIdLst/>
// </p14:section>
// </p14:sectionLst>
// </p:ext>
// <p:ext uri="{EFAFB233-063F-42B5-8137-9DF3F51BA10A}">
// <p15:sldGuideLst xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main"/>
// </p:ext>
//</p:extLst>
namespace PPTX namespace PPTX
{ {
...@@ -115,48 +138,61 @@ namespace PPTX ...@@ -115,48 +138,61 @@ namespace PPTX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{ {
WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("uri"), uri) WritingElement_ReadAttributes_ReadSingle ( oReader, L"uri", uri)
WritingElement_ReadAttributes_End( oReader ) WritingElement_ReadAttributes_End( oReader )
} }
void ReadAttributes1(XmlUtils::CXmlLiteReader& oReader) void ReadAttributes1(XmlUtils::CXmlLiteReader& oReader)
{ {
WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("r:embed"), link) WritingElement_ReadAttributes_ReadSingle( oReader, L"r:embed", link)
WritingElement_ReadAttributes_End( oReader ) WritingElement_ReadAttributes_End( oReader )
} }
void ReadAttributes2(XmlUtils::CXmlLiteReader& oReader) void ReadAttributes2(XmlUtils::CXmlLiteReader& oReader)
{ {
WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("st"), st) WritingElement_ReadAttributes_Read_if ( oReader, L"st", st)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("end"), end) WritingElement_ReadAttributes_Read_else_if ( oReader, L"end", end)
WritingElement_ReadAttributes_End( oReader ) WritingElement_ReadAttributes_End( oReader )
} }
void ReadAttributes3(XmlUtils::CXmlLiteReader& oReader) void ReadAttributes3(XmlUtils::CXmlLiteReader& oReader)
{ {
WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_Start( oReader );
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("spid"), spid) WritingElement_ReadAttributes_ReadSingle ( oReader, L"spid", spid)
WritingElement_ReadAttributes_End( oReader ) WritingElement_ReadAttributes_End( oReader )
} }
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{//todooo списком .. {
XmlUtils::CXmlNode media = node.ReadNodeNoNS(_T("media")); XmlUtils::CXmlNodes oNodes;
if (media.IsValid()) if (node.GetNodes(L"*", oNodes))
{ {
link = media.GetAttribute(_T("r:embed")); int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
XmlUtils::CXmlNode trim = media.ReadNodeNoNS(_T("trim"));
if (trim.IsValid())
{ {
trim.ReadAttributeBase(_T("st"), st); XmlUtils::CXmlNode oNode;
trim.ReadAttributeBase(_T("end"), end); oNodes.GetAt(i, oNode);
std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName());
if (L"media" == strName)
{
link = oNode.GetAttribute(L"r:embed");
XmlUtils::CXmlNode trim = oNode.ReadNodeNoNS(L"trim");
if (trim.IsValid())
{
trim.ReadAttributeBase(L"st", st);
trim.ReadAttributeBase(L"end", end);
}
}
else if (L"compatExt" == strName)
{
spid = oNode.GetAttribute(L"spid");
}
else if (L"sectionLst" == strName)
{
sectionLst = oNode;
}
} }
return;
}
XmlUtils::CXmlNode compatExt = node.ReadNodeNoNS(_T("compatExt"));
if (compatExt.IsValid())
{
spid = media.GetAttribute(_T("spid"));
return;
} }
} }
...@@ -170,11 +206,11 @@ namespace PPTX ...@@ -170,11 +206,11 @@ namespace PPTX
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
if (link.IsInit() && uri.IsInit()) if (link.IsInit())
{ {
pWriter->StartNode(L"p:ext"); pWriter->StartNode(L"p:ext");
pWriter->StartAttributes(); pWriter->StartAttributes();
pWriter->WriteAttribute(L"uri", *uri); pWriter->WriteAttribute(L"uri", std::wstring(L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}"));
pWriter->EndAttributes(); pWriter->EndAttributes();
pWriter->StartNode(L"p14:media"); pWriter->StartNode(L"p14:media");
...@@ -185,6 +221,16 @@ namespace PPTX ...@@ -185,6 +221,16 @@ namespace PPTX
pWriter->EndNode(L"p14:media"); pWriter->EndNode(L"p14:media");
pWriter->EndNode(L"p:ext"); pWriter->EndNode(L"p:ext");
} }
if (sectionLst.IsInit())
{
pWriter->StartNode(L"p:ext");
pWriter->StartAttributes();
pWriter->WriteAttribute(L"uri", std::wstring(L"{521415D9-36F7-43E2-AB2F-B90AF26B5E84}"));
pWriter->EndAttributes();
sectionLst->toXmlWriter(pWriter);
pWriter->EndNode(L"p:ext");
}
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
...@@ -201,10 +247,11 @@ namespace PPTX ...@@ -201,10 +247,11 @@ namespace PPTX
//media //media
nullable<OOX::RId> link; nullable<OOX::RId> link;
nullable_double st; nullable_double st;
nullable_double end; nullable_double end;
//compatExt //compatExt
nullable_string spid; nullable_string spid;
nullable<nsPresentation::SectionLst> sectionLst;
//dataModelExt //dataModelExt
//table //table
//sparklineGroups //sparklineGroups
......
...@@ -896,7 +896,6 @@ namespace PPTX ...@@ -896,7 +896,6 @@ namespace PPTX
{ {
PPTX::Logic::Ext ext; PPTX::Logic::Ext ext;
ext.link = OOX::RId(blipFill.blip->mediaRid); ext.link = OOX::RId(blipFill.blip->mediaRid);
ext.uri = L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}";
nvPicPr.nvPr.extLst.push_back(ext); nvPicPr.nvPr.extLst.push_back(ext);
int nRId = -1; int nRId = -1;
......
...@@ -45,9 +45,14 @@ namespace PPTX ...@@ -45,9 +45,14 @@ namespace PPTX
public: public:
PPTX_LOGIC_BASE(XmlId) PPTX_LOGIC_BASE(XmlId)
XmlId(std::wstring name)
{
m_name = name;
}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
m_name = XmlUtils::GetNameNoNS(node.GetName()); m_name = node.GetName();
node.ReadAttributeBase(L"r:id", rid); node.ReadAttributeBase(L"r:id", rid);
node.ReadAttributeBase(L"id", id); node.ReadAttributeBase(L"id", id);
} }
...@@ -57,7 +62,7 @@ namespace PPTX ...@@ -57,7 +62,7 @@ namespace PPTX
oAttr.Write(_T("r:id"), rid.ToString()); oAttr.Write(_T("r:id"), rid.ToString());
oAttr.Write(_T("id"), id); oAttr.Write(_T("id"), id);
return XmlUtils::CreateNode(_T("p:") + m_name, oAttr); return XmlUtils::CreateNode(m_name, oAttr);
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
...@@ -69,17 +74,48 @@ namespace PPTX ...@@ -69,17 +74,48 @@ namespace PPTX
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
} }
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1); // start attributes
while (true)
{
BYTE _at = pReader->GetUChar_TypeNode();
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
id = pReader->GetString2();
break;
case 1:
rid = pReader->GetString2();
break;
default:
break;
}
}
pReader->Seek(_end_rec);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->StartNode(_T("p:") + m_name); pWriter->StartNode( m_name );
pWriter->StartAttributes(); pWriter->StartAttributes();
pWriter->WriteAttribute(_T("id"), id); pWriter->WriteAttribute(_T("id"), id);
pWriter->WriteAttribute(_T("r:id"), rid.ToString());
std::wstring sRid = rid.ToString();
if (sRid.empty() == false)
{
pWriter->WriteAttribute(_T("r:id"), sRid);
}
pWriter->EndAttributes(); pWriter->EndAttributes();
pWriter->EndNode(_T("p:") + m_name); pWriter->EndNode( m_name );
} }
nullable_string id; nullable_string id;
......
...@@ -52,40 +52,42 @@ namespace PPTX ...@@ -52,40 +52,42 @@ namespace PPTX
class Namespaces class Namespaces
{ {
public: public:
Namespaces() : a(L"a", L"http://schemas.openxmlformats.org/drawingml/2006/main"), Namespaces() :
b(L"b", L"http://schemas.openxmlformats.org/officeDocument/2006/bibliography"), a (L"a", L"http://schemas.openxmlformats.org/drawingml/2006/main"),
cdr(L"cdr", L"http://schemas.openxmlformats.org/drawingml/2006/chartDrawing"), b (L"b", L"http://schemas.openxmlformats.org/officeDocument/2006/bibliography"),
cp(L"cp", L"http://schemas.openxmlformats.org/package/2006/metadata/core-properties"), cdr (L"cdr", L"http://schemas.openxmlformats.org/drawingml/2006/chartDrawing"),
dc(L"dc", L"http://purl.org/dc/elements/1.1/"), cp (L"cp", L"http://schemas.openxmlformats.org/package/2006/metadata/core-properties"),
dc (L"dc", L"http://purl.org/dc/elements/1.1/"),
dchrt(L"dchrt", L"http://schemas.openxmlformats.org/drawingml/2006/chart"), dchrt(L"dchrt", L"http://schemas.openxmlformats.org/drawingml/2006/chart"),
dcmitype(L"dcmitype", L"http://purl.org/dc/dcmitype/"), dcmitype(L"dcmitype", L"http://purl.org/dc/dcmitype/"),
dcterms(L"dcterms", L"http://purl.org/dc/terms/"), dcterms(L"dcterms", L"http://purl.org/dc/terms/"),
ddgrm(L"ddgrm", L"http://schemas.openxmlformats.org/drawingml/2006/diagram"), ddgrm(L"ddgrm", L"http://schemas.openxmlformats.org/drawingml/2006/diagram"),
dgm(L"dgm", L"http://schemas.openxmlformats.org/drawingml/2006/diagram"), dgm (L"dgm", L"http://schemas.openxmlformats.org/drawingml/2006/diagram"),
dlckcnv(L"dlckcnv", L"http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas"), dlckcnv(L"dlckcnv", L"http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas"),
dpct(L"dpct", L"http://schemas.openxmlformats.org/drawingml/2006/picture"), dpct(L"dpct", L"http://schemas.openxmlformats.org/drawingml/2006/picture"),
ds(L"ds", L"http://schemas.openxmlformats.org/officeDocument/2006/customXml"), ds (L"ds", L"http://schemas.openxmlformats.org/officeDocument/2006/customXml"),
m(L"m", L"http://schemas.openxmlformats.org/officeDocument/2006/math"), m (L"m", L"http://schemas.openxmlformats.org/officeDocument/2006/math"),
o(L"o", L"urn:schemas-microsoft-com:office:office"), o (L"o", L"urn:schemas-microsoft-com:office:office"),
p(L"p", L"http://schemas.openxmlformats.org/presentationml/2006/main"), p (L"p", L"http://schemas.openxmlformats.org/presentationml/2006/main"),
pic(L"pic", L"http://schemas.openxmlformats.org/drawingml/2006/picture"), pic (L"pic", L"http://schemas.openxmlformats.org/drawingml/2006/picture"),
pvml(L"pvml", L"urn:schemas-microsoft-com:office:powerpoint"), pvml(L"pvml", L"urn:schemas-microsoft-com:office:powerpoint"),
r(L"r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"), r (L"r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
s(L"s", L"http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes"), s (L"s", L"http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes"),
sl(L"sl", L"http://schemas.openxmlformats.org/schemaLibrary/2006/main"), sl (L"sl", L"http://schemas.openxmlformats.org/schemaLibrary/2006/main"),
v(L"v", L"urn:schemas-microsoft-com:vml"), v (L"v", L"urn:schemas-microsoft-com:vml"),
ve(L"ve", L"http://schemas.openxmlformats.org/markup-compatibility/2006"), ve (L"ve", L"http://schemas.openxmlformats.org/markup-compatibility/2006"),
vp(L"vp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"), vp (L"vp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
vt(L"vt", L"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"), vt (L"vt", L"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"),
w(L"w", L"http://schemas.openxmlformats.org/wordprocessingml/2006/main"), w (L"w", L"http://schemas.openxmlformats.org/wordprocessingml/2006/main"),
w10(L"w10", L"urn:schemas-microsoft-com:office:word"), w10 (L"w10", L"urn:schemas-microsoft-com:office:word"),
wne(L"wne", L"http://schemas.microsoft.com/office/word/2006/wordml"), wne (L"wne", L"http://schemas.microsoft.com/office/word/2006/wordml"),
wp(L"wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"), wp (L"wp", L"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
x(L"x", L"urn:schemas-microsoft-com:office:excel"), x (L"x", L"urn:schemas-microsoft-com:office:excel"),
xdr(L"xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"), xdr (L"xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"),
xmlns(L"xmlns", L"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"), xmlns(L"xmlns", L"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"),
xsd(L"xsd", L"http://www.w3.org/2001/XMLSchema"), xsd (L"xsd", L"http://www.w3.org/2001/XMLSchema"),
xsi(L"xsi", L"http://www.w3.org/2001/XMLSchema-instance") xsi (L"xsi", L"http://www.w3.org/2001/XMLSchema-instance"),
p14 (L"p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main")
{ {
} }
...@@ -124,6 +126,7 @@ namespace PPTX ...@@ -124,6 +126,7 @@ namespace PPTX
const Namespace xmlns; const Namespace xmlns;
const Namespace xsd; const Namespace xsd;
const Namespace xsi; const Namespace xsi;
const Namespace p14;
}; };
static Namespaces g_Namespaces; static Namespaces g_Namespaces;
......
...@@ -37,19 +37,19 @@ ...@@ -37,19 +37,19 @@
#include "FileContainer.h" #include "FileContainer.h"
#include "FileTypes.h" #include "FileTypes.h"
#include "Limit/Conformance.h"
#include "Logic/TextListStyle.h"
#include "Logic/ClrMap.h"
#include "Theme/ClrScheme.h"
#include "Presentation/EmbeddedFont.h" #include "Presentation/EmbeddedFont.h"
#include "Presentation/Kinsoku.h" #include "Presentation/Kinsoku.h"
#include "Presentation/NotesSz.h" #include "Presentation/NotesSz.h"
#include "Presentation/PhotoAlbum.h" #include "Presentation/PhotoAlbum.h"
#include "Logic/XmlId.h"
#include "Presentation/SldSz.h" #include "Presentation/SldSz.h"
#include "CommentAuthors.h" #include "CommentAuthors.h"
#include "Limit/Conformance.h"
#include "Logic/TextListStyle.h"
#include "Logic/ClrMap.h"
#include "Logic/ExtP.h"
#include "Theme/ClrScheme.h"
namespace PPTX namespace PPTX
{ {
class Presentation : public WrapperFile, public PPTX::FileContainer class Presentation : public WrapperFile, public PPTX::FileContainer
...@@ -87,7 +87,6 @@ namespace PPTX ...@@ -87,7 +87,6 @@ namespace PPTX
oNode.ReadAttributeBase(L"showSpecialPlsOnTitleSld", attrShowSpecialPlsOnTitleSld); oNode.ReadAttributeBase(L"showSpecialPlsOnTitleSld", attrShowSpecialPlsOnTitleSld);
oNode.ReadAttributeBase(L"strictFirstAndLastChars", attrStrictFirstAndLastChars); oNode.ReadAttributeBase(L"strictFirstAndLastChars", attrStrictFirstAndLastChars);
//custDataLst (Customer Data List) //custDataLst (Customer Data List)
//custShowLst (List of Custom Shows) //custShowLst (List of Custom Shows)
defaultTextStyle = oNode.ReadNode(_T("p:defaultTextStyle")); defaultTextStyle = oNode.ReadNode(_T("p:defaultTextStyle"));
...@@ -100,8 +99,7 @@ namespace PPTX ...@@ -100,8 +99,7 @@ namespace PPTX
{ {
oNodeEmbeddedFonts.LoadArray(_T("p:embeddedFont"), embeddedFontLst); oNodeEmbeddedFonts.LoadArray(_T("p:embeddedFont"), embeddedFontLst);
size_t count = embeddedFontLst.size(); for (size_t i = 0; i < embeddedFontLst.size(); ++i)
for (size_t i = 0; i < count; ++i)
embeddedFontLst[i].SetParentFilePointer(this); embeddedFontLst[i].SetParentFilePointer(this);
} }
...@@ -111,8 +109,7 @@ namespace PPTX ...@@ -111,8 +109,7 @@ namespace PPTX
{ {
oNodeHMList.LoadArray(_T("p:handoutMasterId"), handoutMasterIdLst); oNodeHMList.LoadArray(_T("p:handoutMasterId"), handoutMasterIdLst);
size_t count = handoutMasterIdLst.size(); for (size_t i = 0; i < handoutMasterIdLst.size(); ++i)
for (size_t i = 0; i < count; ++i)
handoutMasterIdLst[i].SetParentFilePointer(this); handoutMasterIdLst[i].SetParentFilePointer(this);
} }
...@@ -128,8 +125,7 @@ namespace PPTX ...@@ -128,8 +125,7 @@ namespace PPTX
{ {
oNodeMIDList.LoadArray(_T("p:notesMasterId"), notesMasterIdLst); oNodeMIDList.LoadArray(_T("p:notesMasterId"), notesMasterIdLst);
size_t count = notesMasterIdLst.size(); for (size_t i = 0; i < notesMasterIdLst.size(); ++i)
for (size_t i = 0; i < count; ++i)
notesMasterIdLst[i].SetParentFilePointer(this); notesMasterIdLst[i].SetParentFilePointer(this);
} }
...@@ -147,8 +143,7 @@ namespace PPTX ...@@ -147,8 +143,7 @@ namespace PPTX
{ {
oNode_sldId.LoadArray(_T("p:sldId"), sldIdLst); oNode_sldId.LoadArray(_T("p:sldId"), sldIdLst);
size_t count = sldIdLst.size(); for (size_t i = 0; i < sldIdLst.size(); ++i)
for (size_t i = 0; i < count; ++i)
sldIdLst[i].SetParentFilePointer(this); sldIdLst[i].SetParentFilePointer(this);
} }
...@@ -158,16 +153,36 @@ namespace PPTX ...@@ -158,16 +153,36 @@ namespace PPTX
{ {
oNode_sldM_Id.LoadArray(_T("p:sldMasterId"), sldMasterIdLst); oNode_sldM_Id.LoadArray(_T("p:sldMasterId"), sldMasterIdLst);
size_t count = sldMasterIdLst.size(); for (size_t i = 0; i < sldMasterIdLst.size(); ++i)
for (size_t i = 0; i < count; ++i)
sldMasterIdLst[i].SetParentFilePointer(this); sldMasterIdLst[i].SetParentFilePointer(this);
} }
sldSz = oNode.ReadNode(_T("p:sldSz")); sldSz = oNode.ReadNode(_T("p:sldSz"));
if (sldSz.is_init()) if (sldSz.is_init())
sldSz->SetParentFilePointer(this); sldSz->SetParentFilePointer(this);
//smartTags (Smart Tags)
XmlUtils::CXmlNode list = oNode.ReadNodeNoNS(_T("extLst"));
if (list.IsValid())
{
XmlUtils::CXmlNodes oNodes;
if (list.GetNodes(_T("*"), oNodes))
{
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode oNode;
oNodes.GetAt(i, oNode);
PPTX::Logic::Ext ext;
ext.fromXML(oNode);
if (ext.sectionLst.IsInit())
{
sectionLst = ext.sectionLst;
}
}
}
}
//smartTags (Smart Tags)
Normalize(); Normalize();
} }
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
...@@ -205,6 +220,7 @@ namespace PPTX ...@@ -205,6 +220,7 @@ namespace PPTX
pWriter->WriteRecord2(5, sldSz); pWriter->WriteRecord2(5, sldSz);
pWriter->WriteRecord2(6, commentAuthors); pWriter->WriteRecord2(6, commentAuthors);
pWriter->WriteRecord2(7, sectionLst);
pWriter->EndRecord(); pWriter->EndRecord();
} }
...@@ -312,6 +328,12 @@ namespace PPTX ...@@ -312,6 +328,12 @@ namespace PPTX
commentAuthors->fromPPTY(pReader); commentAuthors->fromPPTY(pReader);
break; break;
} }
case 7:
{
sectionLst = new nsPresentation::SectionLst();
sectionLst->fromPPTY(pReader);
break;
}
default: default:
{ {
pReader->Seek(_end_pos); pReader->Seek(_end_pos);
...@@ -350,11 +372,11 @@ namespace PPTX ...@@ -350,11 +372,11 @@ namespace PPTX
pWriter->EndAttributes(); pWriter->EndAttributes();
pWriter->WriteArray(_T("p:sldMasterIdLst"), sldMasterIdLst); pWriter->WriteArray(L"p:sldMasterIdLst", sldMasterIdLst);
pWriter->WriteArray(_T("p:notesMasterIdLst"), notesMasterIdLst); pWriter->WriteArray(L"p:notesMasterIdLst", notesMasterIdLst);
pWriter->WriteArray(_T("p:handoutMasterIdLst"), handoutMasterIdLst); pWriter->WriteArray(L"p:handoutMasterIdLst", handoutMasterIdLst);
pWriter->WriteArray(_T("p:embeddedFontLst"), embeddedFontLst); pWriter->WriteArray(L"p:embeddedFontLst", embeddedFontLst);
pWriter->WriteArray(_T("p:sldIdLst"), sldIdLst); pWriter->WriteArray(L"p:sldIdLst", sldIdLst);
pWriter->Write(sldSz); pWriter->Write(sldSz);
pWriter->Write(notesSz); pWriter->Write(notesSz);
...@@ -362,7 +384,17 @@ namespace PPTX ...@@ -362,7 +384,17 @@ namespace PPTX
pWriter->Write(kinsoku); pWriter->Write(kinsoku);
pWriter->Write(defaultTextStyle); pWriter->Write(defaultTextStyle);
pWriter->EndNode(_T("p:presentation")); std::vector<Logic::Ext> extLst;
if (sectionLst.IsInit())
{
Logic::Ext exp;
exp.sectionLst = sectionLst;
extLst.push_back(exp);
}
pWriter->WriteArray(L"p:extLst", extLst);
pWriter->EndNode(L"p:presentation");
} }
public: public:
...@@ -380,7 +412,7 @@ namespace PPTX ...@@ -380,7 +412,7 @@ namespace PPTX
} }
public: public:
//Childs //Childs
//custDataLst (Customer Data List) //custDataLst (Customer Data List)
//property<std::list<Presentation::CustShow> > custShowLst (List of Custom Shows) //property<std::list<Presentation::CustShow> > custShowLst (List of Custom Shows)
nullable<Logic::TextListStyle> defaultTextStyle; nullable<Logic::TextListStyle> defaultTextStyle;
...@@ -394,6 +426,7 @@ namespace PPTX ...@@ -394,6 +426,7 @@ namespace PPTX
std::vector<Logic::XmlId> sldIdLst; std::vector<Logic::XmlId> sldIdLst;
std::vector<Logic::XmlId> sldMasterIdLst; std::vector<Logic::XmlId> sldMasterIdLst;
nullable<nsPresentation::SldSz> sldSz; nullable<nsPresentation::SldSz> sldSz;
nullable<nsPresentation::SectionLst> sectionLst;
//smartTags (Smart Tags) //smartTags (Smart Tags)
// Attrs // Attrs
......
...@@ -2987,6 +2987,10 @@ ...@@ -2987,6 +2987,10 @@
RelativePath="..\.\PPTXFormat\Presentation.h" RelativePath="..\.\PPTXFormat\Presentation.h"
> >
</File> </File>
<File
RelativePath="..\PPTXFormat\Presentation\SectionLst.h"
>
</File>
<File <File
RelativePath="..\.\PPTXFormat\Presentation\SldSz.h" RelativePath="..\.\PPTXFormat\Presentation\SldSz.h"
> >
......
...@@ -44,9 +44,11 @@ namespace OOX ...@@ -44,9 +44,11 @@ namespace OOX
public: public:
RId() : m_id(0) RId() : m_id(0)
{ {
bNumber = false;
} }
RId(const size_t id) : m_id(id) RId(const size_t id) : m_id(id)
{ {
bNumber = true;
} }
RId(const std::wstring& rid) RId(const std::wstring& rid)
{ {
...@@ -68,11 +70,13 @@ namespace OOX ...@@ -68,11 +70,13 @@ namespace OOX
{ {
std::wstring strParam = rid.substr(nFindStringLength); std::wstring strParam = rid.substr(nFindStringLength);
m_id = XmlUtils::GetUInteger(strParam); m_id = XmlUtils::GetUInteger(strParam);
bNumber = true;
} }
else else
{ {
m_id = 0; m_id = 0;
m_sId = rid; m_sId = rid;
bNumber = false;
} }
return *this; return *this;
...@@ -80,8 +84,9 @@ namespace OOX ...@@ -80,8 +84,9 @@ namespace OOX
const RId& operator= (const RId& oSrc) const RId& operator= (const RId& oSrc)
{ {
m_id = oSrc.m_id; m_id = oSrc.m_id;
m_sId = oSrc.m_sId; m_sId = oSrc.m_sId;
bNumber = oSrc.bNumber;
return *this; return *this;
} }
...@@ -118,6 +123,7 @@ namespace OOX ...@@ -118,6 +123,7 @@ namespace OOX
const RId next() const const RId next() const
{ {
bNumber = true;
return RId(m_id + 1); return RId(m_id + 1);
} }
...@@ -125,8 +131,10 @@ namespace OOX ...@@ -125,8 +131,10 @@ namespace OOX
{ {
if(!m_sId.empty()) if(!m_sId.empty())
return m_sId; return m_sId;
else else if (bNumber)
return _T("rId") + std::to_wstring((unsigned int)m_id); return _T("rId") + std::to_wstring((unsigned int)m_id);
else
return L"";
} }
template<typename T> template<typename T>
void toPPTY(BYTE type, T pWriter) const void toPPTY(BYTE type, T pWriter) const
...@@ -137,6 +145,7 @@ namespace OOX ...@@ -137,6 +145,7 @@ namespace OOX
private: private:
size_t m_id; size_t m_id;
std::wstring m_sId; std::wstring m_sId;
mutable bool bNumber;
}; };
} // namespace OOX } // namespace OOX
......
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