Commit 46b5971c authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander Trofimov

PresProps

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@66762 954022d7-b5bf-4e40-9824-e11837661b57
parent 97be4580
......@@ -31,6 +31,7 @@ namespace NSBinPptxRW
ViewProps = 4,
VmlDrawing = 5,
TableStyles = 6,
PresProps = 7,
Themes = 20,
ThemeOverride = 21,
......
#pragma once
#pragma once
#include "../PPTXFormat/PPTX.h"
#include "BinWriters.h"
......@@ -9,7 +9,7 @@ namespace PPTX2EditorAdvanced
DWORD Convert(NSBinPptxRW::CBinaryFileWriter& oBinaryWriter, PPTX::Folder& oFolder, const CString& strSourceDirectory, const CString& strDstFile)
{
// main-
// сначала соберем все объекты для конвертации и сформируем main-таблицы
NSBinPptxRW::CCommonWriter* pCommon = oBinaryWriter.m_pCommon;
std::vector<smart_ptr<PPTX::Theme>> _themes;
......@@ -23,7 +23,7 @@ namespace PPTX2EditorAdvanced
int cx = presentation->sldSz->cx;
int cy = presentation->sldSz->cy;
//
// записываем все темы
size_t nCountMasters = presentation->sldMasterIdLst.size();
for (size_t nMaster = 0; nMaster < nCountMasters; ++nMaster)
{
......@@ -31,7 +31,7 @@ namespace PPTX2EditorAdvanced
if (slideMaster.IsInit() == false)
{
//.pptx - rId
//Вебкасты.pptx - неверно назначены rId
continue;
}
size_t pPointerSM = (size_t)(slideMaster.operator ->());
......@@ -39,19 +39,19 @@ namespace PPTX2EditorAdvanced
std::map<size_t, LONG>::const_iterator pSearchSM = pCommon->slideMasters.find(pPointerSM);
if (pSearchSM != pCommon->slideMasters.end())
{
//
// такого быть не должно
continue;
}
oBinaryWriter.m_pCommon->m_oRels.push_back (CMasterSlideInfo());
CMasterSlideInfo& oMasterInfo = oBinaryWriter.m_pCommon->m_oRels[oBinaryWriter.m_pCommon->m_oRels.size() - 1];
// mainMaster
// записываем mainMaster
LONG lCountSM = (LONG)_slideMasters.size();
pCommon->slideMasters [pPointerSM] = lCountSM;
_slideMasters.push_back(slideMaster);
// theme
// проверяем theme
size_t pPointerTh = (size_t)(slideMaster->theme.operator ->());
std::map<size_t, LONG>::const_iterator pSearchTh = pCommon->themes.find (pPointerTh);
if (pSearchTh == pCommon->themes.end())
......@@ -72,7 +72,7 @@ namespace PPTX2EditorAdvanced
CString rId = slideMaster->sldLayoutIdLst[iLayout].rid.get();
smart_ptr<PPTX::SlideLayout> slideLayout = ((*slideMaster)[rId]).smart_dynamic_cast<PPTX::SlideLayout>();
// layout
// проверяем layout
size_t pPointerL = (size_t)(slideLayout.operator ->());
if (pPointerL == 0 )
......@@ -95,7 +95,7 @@ namespace PPTX2EditorAdvanced
}
}
// notesMasters
// записываем все notesMasters
size_t nCountNoteMasters = presentation->notesMasterIdLst.size();
for (size_t nNote = 0; nNote < nCountNoteMasters; ++nNote)
{
......@@ -105,16 +105,16 @@ namespace PPTX2EditorAdvanced
std::map<size_t, LONG>::const_iterator pSearchNM = pCommon->notesMasters.find(pPointerNM);
if (pSearchNM != pCommon->notesMasters.end())
{
//
// такого быть не должно
continue;
}
// mainMaster
// записываем mainMaster
LONG lCountNM = (LONG)_notesMasters.size();
pCommon->notesMasters[pPointerNM] = lCountNM;
_notesMasters.push_back(noteMaster);
// theme
// проверяем theme
size_t pPointerTh = (size_t)(noteMaster->theme_.operator ->());
std::map<size_t, LONG>::const_iterator pSearchTh = pCommon->themes.find(pPointerTh);
if (pSearchTh == pCommon->themes.end())
......@@ -125,7 +125,7 @@ namespace PPTX2EditorAdvanced
}
}
//
// записываем все слайды
size_t nCount = presentation->sldIdLst.size();
for (size_t i = 0; i < nCount; ++i)
{
......@@ -134,14 +134,14 @@ namespace PPTX2EditorAdvanced
if (slide.IsInit() == false)
{
continue;// ... 38 FY10_September_Partner_Call.pptx
continue;// странное ... слайд 38 в FY10_September_Partner_Call.pptx
}
size_t pPointerS = (size_t)(slide.operator ->());
std::map<size_t, LONG>::const_iterator pSearchS = pCommon->slides.find(pPointerS);
if (pSearchS != pCommon->slides.end())
{
//
// такого быть не должно
continue;
}
......@@ -149,7 +149,7 @@ namespace PPTX2EditorAdvanced
std::map<size_t, LONG>::const_iterator pSearchL = pCommon->layouts.find(pPointerL);
if (pSearchL == pCommon->layouts.end())
{
//
// такого быть не должно
oBinaryWriter.m_pCommon->m_oSlide_Layout_Rels.push_back(0);
}
else
......@@ -161,7 +161,7 @@ namespace PPTX2EditorAdvanced
pCommon->slides [pPointerS] = lCountS;
_slides.push_back(slide);
// note
// проверяем note
size_t pPointerN = (size_t)(slide->Note.operator ->());
if (NULL != pPointerN)
......@@ -176,9 +176,9 @@ namespace PPTX2EditorAdvanced
}
}
// maintables. .
// - 5 ( )
// - ( 30. - )
// нужно записать все в maintables. А кроме главных таблиц ничего и нету. Все остальное лежит в них
// на каждую таблицу - 5 байт (тип и сдвиг)
// число таблиц - заранее известно (сделаем 30. если потом не будет хватать - новая версия формата)
oBinaryWriter.WriteReserved(5 * 30);
// Main
......@@ -202,6 +202,14 @@ namespace PPTX2EditorAdvanced
core->toPPTY(&oBinaryWriter);
}
// PresProps
smart_ptr<PPTX::PresProps> presProps = presentation->get(PPTX::FileTypes::PresProps).smart_dynamic_cast<PPTX::PresProps>();
if (presProps.is_init())
{
oBinaryWriter.StartMainRecord(NSMainTables::PresProps);
presProps->toPPTY(&oBinaryWriter);
}
// ViewProps
smart_ptr<PPTX::ViewProps> viewProps = presentation->get(PPTX::FileTypes::ViewProps).smart_dynamic_cast<PPTX::ViewProps>();
if (viewProps.is_init())
......@@ -255,7 +263,7 @@ namespace PPTX2EditorAdvanced
if (_layouts[i].IsInit() == false)
{
continue;
// 42 FY10_September_Partner_Call.pptx
//непонятки с 42 шаблоном в FY10_September_Partner_Call.pptx
}
_layouts[i]->toPPTY(&oBinaryWriter);
}
......@@ -271,7 +279,7 @@ namespace PPTX2EditorAdvanced
if (false)
{
// NOTES
// ПОКА нету NOTES
// notes
oBinaryWriter.StartMainRecord(NSMainTables::NotesSlides);
......@@ -395,7 +403,7 @@ namespace PPTX2EditorAdvanced
oBinaryWriter.WriteEmbeddedFonts();
oBinaryWriter.WriteMainPart();
// .
// все записалось нормально. осталось скинуть на диск
BYTE* pbBinBuffer = oBinaryWriter.GetBuffer();
int nBinBufferLen = (int)oBinaryWriter.GetPosition();
int nBase64BufferLen = Base64::Base64EncodeGetRequiredLength(nBinBufferLen, Base64::B64_BASE64_FLAG_NOCRLF);
......
#pragma once
#pragma once
#include "Converter.h"
#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
......@@ -146,7 +146,7 @@ namespace NSBinPptxRW
// writer
CXmlWriter oXmlWriter;
// . - ,
// первым делом определим количество необходимого. если хоть одно из этих чисел - ноль, то ппту не корректный
LONG nCountThemes = 0;
LONG nCountMasters = 0;
LONG nCountLayouts = 0;
......@@ -177,12 +177,12 @@ namespace NSBinPptxRW
nCountSlides = m_oReader.GetLong();
}
if (0 == nCountThemes || 0 == nCountMasters || 0 == nCountLayouts/* || 0 == nCountSlides*/) //rev 60054 -
if (0 == nCountThemes || 0 == nCountMasters || 0 == nCountLayouts/* || 0 == nCountSlides*/) //rev 60054 - презентация без слайдов
{
return;
}
//
// теперь создадим массивы для рельсов
for (LONG i = 0; i < nCountMasters; ++i)
{
CSlideMasterInfo elm;
......@@ -210,7 +210,7 @@ namespace NSBinPptxRW
}
}
// .
// нужно проставить всем шаблонам мастер.
for (LONG i = 0; i < nCountMasters; ++i)
{
size_t _countL = m_arSlideMasters_Theme[i].m_arLayouts.size();
......@@ -220,7 +220,7 @@ namespace NSBinPptxRW
}
}
// ,
// готово, теперь нужно слайдам проставить шаблоны
pPair = m_mainTables.find(NSMainTables::SlideRels);
if (m_mainTables.end() != pPair)
{
......@@ -234,13 +234,13 @@ namespace NSBinPptxRW
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
//m_arSlides_Layout[_at] = m_oReader.GetULong(); , - - oBinaryWriter.WriteInt1(0, oBinaryWriter.m_pCommon->m_oSlide_Layout_Rels[i]);
//m_arSlides_Layout[_at] = m_oReader.GetULong(); тут прописан не индекс, а тип - смотри - oBinaryWriter.WriteInt1(0, oBinaryWriter.m_pCommon->m_oSlide_Layout_Rels[i]);
if (index < m_arSlides_Layout.size())
m_arSlides_Layout[index++] = m_oReader.GetULong();
}
}
// themes,
// теперь нужно удалить все themes, которые не ведут на мастерслайд
std::vector<LONG> arThemes;
std::vector<LONG> arThemesDst;
std::vector<bool> arThemesSave;
......@@ -262,7 +262,7 @@ namespace NSBinPptxRW
arThemesDst[i] = lCurrectTheme;
++lCurrectTheme;
}
//
// теперь нужно перебить ссылки
for (LONG i = 0; i < nCountMasters; ++i)
{
m_arSlideMasters_Theme[i].m_lThemeIndex = arThemesDst[i];
......@@ -285,7 +285,7 @@ namespace NSBinPptxRW
{
if (!arThemesSave[i])
{
//
// это ненужная тема
continue;
}
......@@ -554,6 +554,14 @@ namespace NSBinPptxRW
m_oTableStyles.fromPPTY(&m_oReader);
}
// presProps
pPair = m_mainTables.find(NSMainTables::PresProps);
if (m_mainTables.end() != pPair)
{
m_oReader.Seek(pPair->second);
m_oPresProps.fromPPTY(&m_oReader);
}
// viewProps
pPair = m_mainTables.find(NSMainTables::ViewProps);
if (m_mainTables.end() != pPair)
......@@ -562,17 +570,29 @@ namespace NSBinPptxRW
m_oViewProps.fromPPTY(&m_oReader);
}
CreateDefaultPresProps();
//CreateDefaultPresProps();
}
else
{
// create default
CreateDefaultApp();
CreateDefaultCore();
CreateDefaultPresProps();
//CreateDefaultPresProps();
//CreateDefaultTableStyles();
CreateDefaultViewProps();
// presProps
pPair = m_mainTables.find(NSMainTables::PresProps);
if (m_mainTables.end() != pPair)
{
m_oReader.Seek(pPair->second);
m_oPresProps.fromPPTY(&m_oReader);
}
else
{
CreateDefaultPresProps();
}
pPair = m_mainTables.find(NSMainTables::TableStyles);
if (m_mainTables.end() != pPair)
{
......
......@@ -3,12 +3,16 @@
#define PPTX_PRESPROPS_FILE_INCLUDE_H_
#include "WrapperFile.h"
#include "FileContainer.h"
#include "Logic/UniColor.h"
#include "ShowPr/ShowPr.h"
#include "DocxFormat/FileTypes.h"
namespace PPTX
{
class PresProps : public WrapperFile
class PresProps : public WrapperFile, public PPTX::FileContainer
{
public:
PresProps()
......@@ -32,6 +36,10 @@ namespace PPTX
XmlUtils::CXmlNode oNodeClr;
if (oNode.GetNode(_T("p:clrMru"), oNodeClr))
oNodeClr.LoadArray(_T("*"), ClrMru);
showPr = oNode.ReadNode(_T("p:showPr"));
if(showPr.is_init())
showPr->SetParentFilePointer(this);
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, PPTX::ContentTypes::File& content)const
{
......@@ -42,10 +50,23 @@ namespace PPTX
XmlUtils::CNodeValue oValue;
oValue.WriteArray(_T("p:clrMru"), ClrMru);
oValue.WriteNullable(showPr);
XmlUtils::SaveToFile(filename.m_strFilename, XmlUtils::CreateNode(_T("p:presentationPr"), oAttr, oValue));
content.registration(type().OverrideType(), directory, filename);
m_written = true;
m_WrittenFileName = filename.GetFilename();
FileContainer::write(filename, directory, content);
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->StartRecord(NSMainTables::PresProps);
pWriter->WriteRecordArray(0, 0, ClrMru);
pWriter->WriteRecord2(1, showPr);
pWriter->EndRecord();
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
......@@ -59,9 +80,61 @@ namespace PPTX
pWriter->EndAttributes();
pWriter->WriteArray(_T("p:clrMru"), ClrMru);
pWriter->Write(showPr);
pWriter->EndNode(_T("p:presentationPr"));
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
pReader->Skip(1); // type
LONG end = pReader->GetPos() + pReader->GetLong() + 4;
while (pReader->GetPos() < end)
{
BYTE _rec = pReader->GetUChar();
switch (_rec)
{
case 0:
{
pReader->Skip(4); // len
ULONG _c = pReader->GetULong();
for (ULONG i = 0; i < _c; ++i)
{
pReader->Skip(1); // type (0)
LONG nElemLength = pReader->GetLong(); // len
if(nElemLength > 0)
{
Logic::UniColor elm;
ClrMru.push_back(elm);
ClrMru.back().fromPPTY(pReader);
if (!ClrMru.back().is_init())
{
ClrMru.pop_back();
}
}
}
break;
}
case 1:
{
showPr = new nsShowPr::ShowPr();
showPr->fromPPTY(pReader);
break;
}
default:
{
pReader->SkipRecord();
break;
}
}
}
pReader->Seek(end);
}
public:
virtual const PPTX::FileType type() const
{
......@@ -78,8 +151,8 @@ namespace PPTX
public:
std::vector<Logic::UniColor> ClrMru;
nullable<nsShowPr::ShowPr> showPr;
//prnPr (Printing Properties)
//showPr (Presentation-wide Show Properties)
};
} // namespace PPTX
......
#pragma once
#ifndef PPTX_SHOWPR_BROWSE_INCLUDE_H_
#define PPTX_SHOWPR_BROWSE_INCLUDE_H_
#include "./../WrapperWritingElement.h"
namespace PPTX
{
namespace nsShowPr
{
class Browse : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Browse)
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(_T("showScrollbar"), showScrollbar);
}
virtual CString toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("showScrollbar"), showScrollbar);
return XmlUtils::CreateNode(_T("p:browse"), oAttr);
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteBool2(0, showScrollbar);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("p:browse"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("showScrollbar"), showScrollbar);
pWriter->EndAttributes();
pWriter->EndNode(_T("p:browse"));
}
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;
if (0 == _at)
showScrollbar = pReader->GetBool();
else
break;
}
pReader->Seek(_end_rec);
}
public:
nullable_bool showScrollbar;
protected:
virtual void FillParentPointersForChilds(){};
};
} // namespace nsShowPr
} // namespace PPTX
#endif // PPTX_SHOWPR_BROWSE_INCLUDE_H_
#pragma once
#ifndef PPTX_SHOWPR_CUSTSHOW_INCLUDE_H_
#define PPTX_SHOWPR_CUSTSHOW_INCLUDE_H_
#include "./../WrapperWritingElement.h"
namespace PPTX
{
namespace nsShowPr
{
class CustShow : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(CustShow)
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(_T("id"), id);
}
virtual CString toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("id"), id);
return XmlUtils::CreateNode(_T("p:custShow"), oAttr);
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteInt2(0, id);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("p:custShow"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("id"), id);
pWriter->EndAttributes();
pWriter->EndNode(_T("p:custShow"));
}
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;
if (0 == _at)
id = pReader->GetLong();
else
break;
}
pReader->Seek(_end_rec);
}
public:
nullable_int id;
protected:
virtual void FillParentPointersForChilds(){};
};
} // namespace nsShowPr
} // namespace PPTX
#endif // PPTX_SHOWPR_CUSTSHOW_INCLUDE_H_
#pragma once
#ifndef PPTX_SHOWPR_KIOSK_INCLUDE_H_
#define PPTX_SHOWPR_KIOSK_INCLUDE_H_
#include "./../WrapperWritingElement.h"
namespace PPTX
{
namespace nsShowPr
{
class Kiosk : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Kiosk)
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(_T("restart"), restart);
}
virtual CString toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("restart"), restart);
return XmlUtils::CreateNode(_T("p:kiosk"), oAttr);
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteInt2(0, restart);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("p:kiosk"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("restart"), restart);
pWriter->EndAttributes();
pWriter->EndNode(_T("p:kiosk"));
}
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;
if (0 == _at)
restart = pReader->GetLong();
else
break;
}
pReader->Seek(_end_rec);
}
public:
nullable_int restart;
protected:
virtual void FillParentPointersForChilds(){};
};
} // namespace nsShowPr
} // namespace PPTX
#endif // PPTX_SHOWPR_KIOSK_INCLUDE_H_
#pragma once
#ifndef PPTX_SHOWPR_PRESENT_INCLUDE_H_
#define PPTX_SHOWPR_PRESENT_INCLUDE_H_
#include "./../WrapperWritingElement.h"
namespace PPTX
{
namespace nsShowPr
{
class Present : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Present)
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual CString toXML() const
{
return _T("<p:present/>");
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->WriteString(_T("<p:present/>"));
}
protected:
virtual void FillParentPointersForChilds(){};
};
} // namespace nsShowPr
} // namespace PPTX
#endif // PPTX_SHOWPR_PRESENT_INCLUDE_H_
#pragma once
#ifndef PPTX_SHOWPR_FILE_INCLUDE_H_
#define PPTX_SHOWPR_FILE_INCLUDE_H_
#include "./../WrapperWritingElement.h"
#include "../Logic/UniColor.h"
#include "./Browse.h"
#include "./CustShow.h"
#include "./Kiosk.h"
#include "./Present.h"
#include "./SldAll.h"
#include "./SldRg.h"
namespace PPTX
{
namespace nsShowPr
{
class ShowPr : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(ShowPr)
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(_T("loop"), loop);
node.ReadAttributeBase(_T("showAnimation"), showAnimation);
node.ReadAttributeBase(_T("showNarration"), showNarration);
node.ReadAttributeBase(_T("useTimings"), useTimings);
Browse = node.ReadNodeNoNS(_T("browse"));
CustShow = node.ReadNodeNoNS(_T("custShow"));
Kiosk = node.ReadNodeNoNS(_T("kiosk"));
XmlUtils::CXmlNode node1 = node.ReadNodeNoNS(_T("penClr"));
PenClr.GetColorFrom(node1);
Present = node.ReadNodeNoNS(_T("present"));
SldAll = node.ReadNodeNoNS(_T("sldAll"));
SldRg = node.ReadNodeNoNS(_T("sldRg"));
}
virtual CString toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("loop"), loop);
oAttr.Write(_T("showAnimation"), showAnimation);
oAttr.Write(_T("showNarration"), showNarration);
oAttr.Write(_T("useTimings"), useTimings);
XmlUtils::CNodeValue oValue;
oValue.WriteNullable(Present);
oValue.WriteNullable(Browse);
oValue.WriteNullable(Kiosk);
oValue.WriteNullable(SldAll);
oValue.WriteNullable(SldRg);
oValue.WriteNullable(CustShow);
oValue.Write(PenClr);
return XmlUtils::CreateNode(_T("p:ShowPr"), oAttr, oValue);
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteBool2(0, loop);
pWriter->WriteBool2(1, showAnimation);
pWriter->WriteBool2(2, showNarration);
pWriter->WriteBool2(3, useTimings);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->WriteRecord2(0, Browse);
pWriter->WriteRecord2(1, CustShow);
pWriter->WriteRecord2(2, Kiosk);
pWriter->WriteRecord1(3, PenClr);
pWriter->WriteRecord2(4, Present);
pWriter->WriteRecord2(5, SldAll);
pWriter->WriteRecord2(6, SldRg);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("p:showPr"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("loop"), loop);
pWriter->WriteAttribute(_T("showAnimation"), showAnimation);
pWriter->WriteAttribute(_T("showNarration"), showNarration);
pWriter->WriteAttribute(_T("useTimings"), useTimings);
pWriter->EndAttributes();
pWriter->Write(Present);
pWriter->Write(Browse);
pWriter->Write(Kiosk);
pWriter->Write(SldAll);
pWriter->Write(SldRg);
pWriter->Write(CustShow);
if(PenClr.is_init())
{
pWriter->WriteString(_T("<p:penClr>"));
PenClr.toXmlWriter(pWriter);
pWriter->WriteString(_T("</p:penClr>"));
}
pWriter->EndNode(_T("p:showPr"));
}
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;
if (0 == _at)
loop = pReader->GetBool();
else if (1 == _at)
showAnimation = pReader->GetBool();
else if (2 == _at)
showNarration = pReader->GetBool();
else if (3 == _at)
useTimings = pReader->GetBool();
else
break;
}
while (pReader->GetPos() < _end_rec)
{
BYTE _at = pReader->GetUChar();
switch (_at)
{
case 0:
{
Browse = new nsShowPr::Browse();
Browse->fromPPTY(pReader);
break;
}
case 1:
{
CustShow = new nsShowPr::CustShow();
CustShow->fromPPTY(pReader);
break;
}
case 2:
{
Kiosk = new nsShowPr::Kiosk();
Kiosk->fromPPTY(pReader);
break;
}
case 3:
{
PenClr.fromPPTY(pReader);
break;
}
case 4:
{
Present = new nsShowPr::Present();
pReader->SkipRecord();
break;
}
case 5:
{
SldAll = new nsShowPr::SldAll();
pReader->SkipRecord();
break;
}
case 6:
{
SldRg = new nsShowPr::SldRg();
SldRg->fromPPTY(pReader);
break;
}
default:
break;
}
}
pReader->Seek(_end_rec);
}
public:
nullable<nsShowPr::Browse> Browse;
nullable<nsShowPr::CustShow> CustShow;
nullable<nsShowPr::Kiosk> Kiosk;
Logic::UniColor PenClr;
nullable<nsShowPr::Present> Present;
nullable<nsShowPr::SldAll> SldAll;
nullable<nsShowPr::SldRg> SldRg;
nullable_bool loop;
nullable_bool showAnimation;
nullable_bool showNarration;
nullable_bool useTimings;
protected:
virtual void FillParentPointersForChilds(){};
};
} // namespace nsShowPr
} // namespace PPTX
#endif // PPTX_SHOWPR_FILE_INCLUDE_H_
#pragma once
#ifndef PPTX_SHOWPR_SLDALL_INCLUDE_H_
#define PPTX_SHOWPR_SLDALL_INCLUDE_H_
#include "./../WrapperWritingElement.h"
namespace PPTX
{
namespace nsShowPr
{
class SldAll : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(SldAll)
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual CString toXML() const
{
return _T("<p:sldAll/>");
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->WriteString(_T("<p:sldAll/>"));
}
protected:
virtual void FillParentPointersForChilds(){};
};
} // namespace nsShowPr
} // namespace PPTX
#endif // PPTX_SHOWPR_SLDALL_INCLUDE_H_
#pragma once
#ifndef PPTX_SHOWPR_SLDRG_INCLUDE_H_
#define PPTX_SHOWPR_SLDRG_INCLUDE_H_
#include "./../WrapperWritingElement.h"
namespace PPTX
{
namespace nsShowPr
{
class SldRg : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(SldRg)
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(_T("st"), st);
node.ReadAttributeBase(_T("end"), end);
}
virtual CString toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("st"), st);
oAttr.Write(_T("end"), end);
return XmlUtils::CreateNode(_T("p:sldRg"), oAttr);
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteInt2(0, st);
pWriter->WriteInt2(1, end);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("p:sldRg"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("st"), st);
pWriter->WriteAttribute(_T("end"), end);
pWriter->EndAttributes();
pWriter->EndNode(_T("p:sldRg"));
}
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;
if (0 == _at)
st = pReader->GetLong();
else if (1 == _at)
end = pReader->GetLong();
else
break;
}
pReader->Seek(_end_rec);
}
public:
nullable_int st;
nullable_int end;
protected:
virtual void FillParentPointersForChilds(){};
};
} // namespace nsShowPr
} // namespace PPTX
#endif // PPTX_SHOWPR_SLDRG_INCLUDE_H_
......@@ -577,7 +577,14 @@ HEADERS += pptxformatlib.h \
../../../../Common/DocxFormat/Source/Base/Nullable.h \
../../../../Common/DocxFormat/Source/XML/xmlutils.h \
../../../../HtmlRenderer/include/ASCSVGWriter.h \
../../../../Common/FileDownloader/FileDownloader.h
../../../../Common/FileDownloader/FileDownloader.h \
../../../PPTXFormat/ShowPr/Browse.h \
../../../PPTXFormat/ShowPr/CustShow.h \
../../../PPTXFormat/ShowPr/Kiosk.h \
../../../PPTXFormat/ShowPr/Present.h \
../../../PPTXFormat/ShowPr/ShowPr.h \
../../../PPTXFormat/ShowPr/SldAll.h \
../../../PPTXFormat/ShowPr/SldRg.h
win32 {
SOURCES += \
......
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