From a8125114de6fc9dd97ed461fe68e7cfa2d170a04 Mon Sep 17 00:00:00 2001 From: ElenaSubbotina Date: Mon, 18 Aug 2025 21:50:39 +0300 Subject: [PATCH] fix bug #76361 (add custom xml in pptx) --- .../Presentation/BinaryFileReaderWriter.cpp | 61 +- .../Presentation/BinaryFileReaderWriter.h | 12 +- OOXML/Binary/Presentation/Converter.cpp | 2 +- OOXML/Binary/Presentation/PPTXWriter.cpp | 88 ++- OOXML/PPTXFormat/Logic/Colors/SchemeClr.cpp | 7 - OOXML/PPTXFormat/Logic/ExtP.h | 52 +- OOXML/PPTXFormat/PresProps.cpp | 7 +- OOXML/PPTXFormat/PresProps.h | 6 +- OOXML/PPTXFormat/Presentation.cpp | 282 +++++---- OOXML/PPTXFormat/Presentation.h | 38 +- .../PPTXFormat/Presentation/EmbeddedFont.cpp | 73 --- OOXML/PPTXFormat/Presentation/EmbeddedFont.h | 66 -- .../Presentation/EmbeddedFontDataId.cpp | 56 -- .../Presentation/EmbeddedFontDataId.h | 55 -- OOXML/PPTXFormat/Presentation/Kinsoku.cpp | 63 -- OOXML/PPTXFormat/Presentation/Kinsoku.h | 63 -- OOXML/PPTXFormat/Presentation/NotesSz.cpp | 83 --- OOXML/PPTXFormat/Presentation/NotesSz.h | 65 -- OOXML/PPTXFormat/Presentation/PhotoAlbum.cpp | 70 --- OOXML/PPTXFormat/Presentation/PhotoAlbum.h | 65 -- .../PresentationChildElements.cpp | 571 ++++++++++++++++++ .../Presentation/PresentationChildElements.h | 230 +++++++ OOXML/PPTXFormat/Presentation/SectionLst.cpp | 31 - OOXML/PPTXFormat/Presentation/SectionLst.h | 247 -------- OOXML/PPTXFormat/Presentation/SldSz.cpp | 86 --- OOXML/PPTXFormat/Presentation/SldSz.h | 67 -- OOXML/PPTXFormat/ShowPr/Browse.cpp | 4 +- OOXML/PPTXFormat/ShowPr/Browse.h | 4 +- .../ShowPr/{CustShow.cpp => CustomShowId.cpp} | 30 +- .../ShowPr/{CustShow.h => CustomShowId.h} | 8 +- OOXML/PPTXFormat/ShowPr/Kiosk.cpp | 4 +- OOXML/PPTXFormat/ShowPr/Kiosk.h | 4 +- OOXML/PPTXFormat/ShowPr/Present.cpp | 4 +- OOXML/PPTXFormat/ShowPr/Present.h | 4 +- OOXML/PPTXFormat/ShowPr/PresentationPr.cpp | 28 +- OOXML/PPTXFormat/ShowPr/PresentationPr.h | 17 +- OOXML/PPTXFormat/ShowPr/SldAll.cpp | 4 +- OOXML/PPTXFormat/ShowPr/SldAll.h | 4 +- OOXML/PPTXFormat/ShowPr/SldRg.cpp | 4 +- OOXML/PPTXFormat/ShowPr/SldRg.h | 4 +- OOXML/PPTXFormat/ViewProps/OutlineViewPr.cpp | 64 ++ OOXML/PPTXFormat/ViewProps/OutlineViewPr.h | 20 +- OOXML/PPTXFormat/ViewProps/Sld.cpp | 104 ---- OOXML/PPTXFormat/ViewProps/Sld.h | 61 -- .../Linux/PPTXFormatLib/PPTXFormatLib.pro | 21 +- .../Windows/PPTXFormatLib/PPTXFormat.vcxproj | 22 +- .../PPTXFormatLib/PPTXFormat.vcxproj.filters | 50 +- OdfFile/Writer/Converter/PptxConverter.cpp | 3 +- 48 files changed, 1211 insertions(+), 1703 deletions(-) delete mode 100644 OOXML/PPTXFormat/Presentation/EmbeddedFont.cpp delete mode 100644 OOXML/PPTXFormat/Presentation/EmbeddedFont.h delete mode 100644 OOXML/PPTXFormat/Presentation/EmbeddedFontDataId.cpp delete mode 100644 OOXML/PPTXFormat/Presentation/EmbeddedFontDataId.h delete mode 100644 OOXML/PPTXFormat/Presentation/Kinsoku.cpp delete mode 100644 OOXML/PPTXFormat/Presentation/Kinsoku.h delete mode 100644 OOXML/PPTXFormat/Presentation/NotesSz.cpp delete mode 100644 OOXML/PPTXFormat/Presentation/NotesSz.h delete mode 100644 OOXML/PPTXFormat/Presentation/PhotoAlbum.cpp delete mode 100644 OOXML/PPTXFormat/Presentation/PhotoAlbum.h create mode 100644 OOXML/PPTXFormat/Presentation/PresentationChildElements.cpp create mode 100644 OOXML/PPTXFormat/Presentation/PresentationChildElements.h delete mode 100644 OOXML/PPTXFormat/Presentation/SectionLst.cpp delete mode 100644 OOXML/PPTXFormat/Presentation/SectionLst.h delete mode 100644 OOXML/PPTXFormat/Presentation/SldSz.cpp delete mode 100644 OOXML/PPTXFormat/Presentation/SldSz.h rename OOXML/PPTXFormat/ShowPr/{CustShow.cpp => CustomShowId.cpp} (76%) rename OOXML/PPTXFormat/ShowPr/{CustShow.h => CustomShowId.h} (93%) delete mode 100644 OOXML/PPTXFormat/ViewProps/Sld.cpp delete mode 100644 OOXML/PPTXFormat/ViewProps/Sld.h diff --git a/OOXML/Binary/Presentation/BinaryFileReaderWriter.cpp b/OOXML/Binary/Presentation/BinaryFileReaderWriter.cpp index 6f62666178..7b91f83036 100644 --- a/OOXML/Binary/Presentation/BinaryFileReaderWriter.cpp +++ b/OOXML/Binary/Presentation/BinaryFileReaderWriter.cpp @@ -1643,15 +1643,15 @@ namespace NSBinPptxRW m_lNextRelsID = 3; } - void CRelsGenerator::WriteMasters(int nCount) + std::wstring CRelsGenerator::WriteMaster(int nIndex) { - for (int i = 0; i < nCount; ++i) - { - std::wstring strRels = L""; - m_pWriter->WriteString(strRels); - } + std::wstring rid = L"rId" + std::to_wstring(m_lNextRelsID++); + std::wstring strRels = L""; + m_pWriter->WriteString(strRels); + + return rid; } void CRelsGenerator::WriteThemes(int nCount) { @@ -1663,23 +1663,26 @@ namespace NSBinPptxRW m_pWriter->WriteString(strRels); } } - void CRelsGenerator::WriteSlides(int nCount) + std::wstring CRelsGenerator::WriteSlide(int nIndex) { - for (int i = 0; i < nCount; ++i) - { - std::wstring strRels = L""; - m_pWriter->WriteString(strRels); - } + std::wstring rid = L"rId" + std::to_wstring(m_lNextRelsID++); + + std::wstring strRels = L""; + m_pWriter->WriteString(strRels); + + return rid; } - void CRelsGenerator::WriteSlideComments(int nComment) + std::wstring CRelsGenerator::WriteSlideComments(int nIndexComment) { - std::wstring strRels = L""; + std::to_wstring(nIndexComment) + L".xml\"/>"; m_pWriter->WriteString(strRels); + return rid; } void CRelsGenerator::WriteNotesMaster() { @@ -1687,23 +1690,23 @@ namespace NSBinPptxRW L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster\" Target=\"notesMasters/notesMaster1.xml\"/>"; m_pWriter->WriteString(strRels0); } - void CRelsGenerator::WritePresentationComments(int nComment) + std::wstring CRelsGenerator::WritePresentationComments(int nIndexComment) { - std::wstring strRels = L""; + std::to_wstring(nIndexComment) + L".xml\"/>"; m_pWriter->WriteString(strRels); + return rid; } - void CRelsGenerator::WriteCustoms(int nCount) + std::wstring CRelsGenerator::WriteCustom(const std::wstring & file_name) { - for (int i = 0; i < nCount; ++i) - { - std::wstring strRels = L""; + std::wstring rid = L"rId" + std::to_wstring(m_lNextRelsID++); + std::wstring strRels = L""; m_pWriter->WriteString(strRels); - } + return rid; } void CRelsGenerator::EndPresentationRels(bool bIsCommentsAuthors, bool bIsVbaProject, bool bIsJsaProject) { diff --git a/OOXML/Binary/Presentation/BinaryFileReaderWriter.h b/OOXML/Binary/Presentation/BinaryFileReaderWriter.h index f13574ec1a..5a75904398 100644 --- a/OOXML/Binary/Presentation/BinaryFileReaderWriter.h +++ b/OOXML/Binary/Presentation/BinaryFileReaderWriter.h @@ -500,16 +500,16 @@ namespace NSBinPptxRW void StartNotes (int nIndexSlide); void StartThemeNotesMaster(int nIndexTheme); - void WriteMasters (int nCount); void WriteThemes (int nCount); - void WriteSlides (int nCount); void WriteNotesMaster(); - void WriteSlideComments (int nComment); - void WritePresentationComments (int nComment); + std::wstring WriteSlideComments(int nIndexComment); + std::wstring WritePresentationComments(int nIndexComment); + + std::wstring WriteCustom(const std::wstring& file_name); + std::wstring WriteMaster(int nIndex); + std::wstring WriteSlide(int nIndex); - void WriteCustoms(int nCount); - unsigned int WriteRels (const std::wstring& bsType, const std::wstring& bsTarget, const std::wstring& bsTargetMode); unsigned int WriteHyperlink (const std::wstring& strLink, const bool& bIsActionInit); diff --git a/OOXML/Binary/Presentation/Converter.cpp b/OOXML/Binary/Presentation/Converter.cpp index e63dbeecea..2e984b106d 100644 --- a/OOXML/Binary/Presentation/Converter.cpp +++ b/OOXML/Binary/Presentation/Converter.cpp @@ -31,7 +31,7 @@ */ #include "Converter.h" -#include "../../PPTXFormat/Presentation/SldSz.h" +#include "../../PPTXFormat/Presentation/PresentationChildElements.h" #include "../../PPTXFormat/NotesSlide.h" namespace PPTX2EditorAdvanced diff --git a/OOXML/Binary/Presentation/PPTXWriter.cpp b/OOXML/Binary/Presentation/PPTXWriter.cpp index 1bb67561ab..adf155cd7b 100644 --- a/OOXML/Binary/Presentation/PPTXWriter.cpp +++ b/OOXML/Binary/Presentation/PPTXWriter.cpp @@ -703,46 +703,6 @@ namespace NSBinPptxRW SetRequiredDefaultsCore(); } - pPair = m_mainTables.find(NSBinPptxRW::NSMainTables::CustomProperties); - if (m_mainTables.end() != pPair) - { - m_oReader.Seek(pPair->second); - try - { - m_oCustomProperties = new PPTX::CustomProperties(&m_oDocument); - m_oCustomProperties->fromPPTY(&m_oReader); - } - catch (...) - { - } - } - // customs - pPair = m_mainTables.find(NSBinPptxRW::NSMainTables::Customs); - if (m_mainTables.end() != pPair) - { - OOX::CPath pathFolder = m_strDstFolder + FILE_SEPARATOR_STR + _T("customXml"); - OOX::CPath pathFolderRels = pathFolder + FILE_SEPARATOR_STR + _T("_rels"); - - NSDirectory::CreateDirectory(pathFolder.GetPath()); - NSDirectory::CreateDirectory(pathFolderRels.GetPath()); - - m_oReader.Seek(pPair->second); - int nCountCustoms = m_oReader.GetLong(); - - for (int i = 0; i < nCountCustoms; ++i) - { - smart_ptr pCustomXml = new OOX::CCustomXML(NULL, false); - - pCustomXml->fromPPTY(&m_oReader); - - //smart_ptr pCustomXmlFile = pCustomXml.smart_dynamic_cast(); - //m_oPresentation.Add(pCustomXmlFile); - OOX::CPath filename(L"item" + std::to_wstring(i + 1) + L".xml"); - pCustomXml->write(pathFolder / filename, OOX::CPath(m_strDstFolder), *m_oImageManager.m_pContentTypes); - } - m_oReader.m_pRels->WriteCustoms(nCountCustoms); - } - // presProps pPair = m_mainTables.find(NSBinPptxRW::NSMainTables::PresProps); if (m_mainTables.end() != pPair) @@ -836,6 +796,45 @@ namespace NSBinPptxRW m_oReader.m_pRels->Clear(); m_oReader.m_pRels->StartRels(); + pPair = m_mainTables.find(NSBinPptxRW::NSMainTables::CustomProperties); + if (m_mainTables.end() != pPair) + { + m_oReader.Seek(pPair->second); + try + { + m_oCustomProperties = new PPTX::CustomProperties(&m_oDocument); + m_oCustomProperties->fromPPTY(&m_oReader); + } + catch (...) + { + } + } + // customs + pPair = m_mainTables.find(NSBinPptxRW::NSMainTables::Customs); + if (m_mainTables.end() != pPair) + { + OOX::CPath pathFolder = m_strDstFolder + FILE_SEPARATOR_STR + _T("customXml"); + OOX::CPath pathFolderRels = pathFolder + FILE_SEPARATOR_STR + _T("_rels"); + + NSDirectory::CreateDirectory(pathFolder.GetPath()); + NSDirectory::CreateDirectory(pathFolderRels.GetPath()); + + m_oReader.Seek(pPair->second); + int nCountCustoms = m_oReader.GetLong(); + + for (int i = 0; i < nCountCustoms; ++i) + { + smart_ptr pCustomXml = new OOX::CCustomXML(NULL, false); + + pCustomXml->fromPPTY(&m_oReader); + + OOX::CPath filename(L"item" + std::to_wstring(i + 1) + L".xml"); + pCustomXml->write(pathFolder / filename, OOX::CPath(m_strDstFolder), *m_oImageManager.m_pContentTypes); + + std::wstring rid = m_oReader.m_pRels->WriteCustom(filename.GetPath()); + m_oPresentation.custDataLst.push_back(rid); + } + } // tablestyles oXmlWriter.ClearNoAttack(); m_oTableStyles.toXmlWriter(&oXmlWriter); @@ -869,16 +868,14 @@ namespace NSBinPptxRW std::wstring sId = std::to_wstring((_UINT64)(0x80000000 + (_UINT64)nCountLayouts)); + std::wstring rid = m_oReader.m_pRels->WriteMaster(i + 1); m_oPresentation.sldMasterIdLst[i].id = sId; - m_oPresentation.sldMasterIdLst[i].rid = (size_t)(i + 1); + m_oPresentation.sldMasterIdLst[i].rid = rid; nCountLayouts += (LONG)(m_arSlideMasters_Theme[i].m_arLayouts.size() + 1); } - m_oReader.m_pRels->WriteMasters(nCountMasters); m_oReader.m_pRels->WriteThemes(nCountThemes); - unsigned int nCurrentRels = m_oReader.m_pRels->m_lNextRelsID; - m_oPresentation.sldIdLst.clear(); for (LONG i = 0; i < nCountSlides; ++i) { @@ -887,9 +884,8 @@ namespace NSBinPptxRW std::wstring sId = std::to_wstring(256 + i); m_oPresentation.sldIdLst[i].id = sId; - m_oPresentation.sldIdLst[i].rid = nCurrentRels++; + m_oPresentation.sldIdLst[i].rid = m_oReader.m_pRels->WriteSlide(i + 1); } - m_oReader.m_pRels->WriteSlides(nCountSlides); m_oPresentation.notesMasterIdLst.clear(); if (bNotesMasterPresent) diff --git a/OOXML/PPTXFormat/Logic/Colors/SchemeClr.cpp b/OOXML/PPTXFormat/Logic/Colors/SchemeClr.cpp index 58a24156a6..66011b338b 100644 --- a/OOXML/PPTXFormat/Logic/Colors/SchemeClr.cpp +++ b/OOXML/PPTXFormat/Logic/Colors/SchemeClr.cpp @@ -232,13 +232,6 @@ namespace PPTX RGB = parentFileAs().GetABGRFromScheme(str); } } - else if(parentFileIs()) - RGB = parentFileAs().GetARGBFromMap(str); - //{ - // if(val.get() == "phClr") - // RGB = rgb; - // else RGB = parentFileAs().GetARGBFromScheme(str); - //} blue = static_cast(RGB & 0xFF); green = static_cast((RGB & 0xFF00)>>8); diff --git a/OOXML/PPTXFormat/Logic/ExtP.h b/OOXML/PPTXFormat/Logic/ExtP.h index 0ccdbc3ec7..d7d2b302cb 100644 --- a/OOXML/PPTXFormat/Logic/ExtP.h +++ b/OOXML/PPTXFormat/Logic/ExtP.h @@ -32,62 +32,12 @@ #pragma once -#include "../Presentation/SectionLst.h" +#include "../Presentation/PresentationChildElements.h" //-------------------------------------------------------------------------------------------------------------- -// -// -// -// -// -//-------------------------------------------------------------------------------------------------------------- -// -// -// -// -// -// -// -// -// -// -// -// -// -// Лист1!D10:D12 -// H12 -// -// -// -// -// -//-------------------------------------------------------------------------------------------------------------- -// -// -// -//-------------------------------------------------------------------------------------------------------------- - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // // // // - // namespace PPTX { diff --git a/OOXML/PPTXFormat/PresProps.cpp b/OOXML/PPTXFormat/PresProps.cpp index f9f230dea9..42b8f3b14d 100644 --- a/OOXML/PPTXFormat/PresProps.cpp +++ b/OOXML/PPTXFormat/PresProps.cpp @@ -34,7 +34,6 @@ #include "ShowPr/PresentationPr.h" #include "ShowPr/Browse.h" -#include "ShowPr/CustShow.h" #include "ShowPr/Kiosk.h" #include "ShowPr/Present.h" #include "ShowPr/SldAll.h" @@ -55,7 +54,7 @@ namespace PPTX void PresProps::read(const OOX::CPath& filename, FileMap& map) { XmlUtils::CXmlNode oNode; - oNode.FromXmlFile(filename.m_strFilename); + oNode.FromXmlFile(filename.m_strFilename); // ClrMru.clear(); XmlUtils::CXmlNode oNodeClr; @@ -141,12 +140,12 @@ namespace PPTX }break; case 1: { - showPr = new nsPresentationPr::ShowPr(); + showPr = new nsPresentation::ShowPr(); showPr->fromPPTY(pReader); }break; case 2: { - printPr = new nsPresentationPr::PrintPr(); + printPr = new nsPresentation::PrintPr(); printPr->fromPPTY(pReader); }break; default: diff --git a/OOXML/PPTXFormat/PresProps.h b/OOXML/PPTXFormat/PresProps.h index fb92004ba8..6730ad9633 100644 --- a/OOXML/PPTXFormat/PresProps.h +++ b/OOXML/PPTXFormat/PresProps.h @@ -39,7 +39,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { class ShowPr; class PrintPr; @@ -64,7 +64,7 @@ namespace PPTX virtual const OOX::CPath DefaultFileName() const; std::vector ClrMru; - nullable showPr; - nullable printPr; + nullable showPr; + nullable printPr; }; } // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation.cpp b/OOXML/PPTXFormat/Presentation.cpp index 46ba195f6b..26ac0f2546 100644 --- a/OOXML/PPTXFormat/Presentation.cpp +++ b/OOXML/PPTXFormat/Presentation.cpp @@ -33,11 +33,6 @@ #include "FileContainer.h" #include "FileTypes.h" -#include "Presentation/EmbeddedFont.h" -#include "Presentation/Kinsoku.h" -#include "Presentation/NotesSz.h" -#include "Presentation/PhotoAlbum.h" -#include "Presentation/SldSz.h" #include "CommentAuthors.h" #include "Limit/Conformance.h" @@ -68,118 +63,137 @@ namespace PPTX } void Presentation::read(const OOX::CPath& filename, FileMap& map) { - XmlUtils::CXmlNode oNode; - oNode.FromXmlFile(filename.m_strFilename); - - XmlMacroReadAttributeBase(oNode, L"autoCompressPictures", attrAutoCompressPictures); - XmlMacroReadAttributeBase(oNode, L"bookmarkIdSeed", attrBookmarkIdSeed); - XmlMacroReadAttributeBase(oNode, L"compatMode", attrCompatMode); - XmlMacroReadAttributeBase(oNode, L"conformance", attrConformance); - XmlMacroReadAttributeBase(oNode, L"embedTrueTypeFonts", attrEmbedTrueTypeFonts); - XmlMacroReadAttributeBase(oNode, L"firstSlideNum", attrFirstSlideNum); - XmlMacroReadAttributeBase(oNode, L"removePersonalInfoOnSave", attrRemovePersonalInfoOnSave); - XmlMacroReadAttributeBase(oNode, L"rtl", attrRtl); - XmlMacroReadAttributeBase(oNode, L"saveSubsetFonts", attrSaveSubsetFonts); - XmlMacroReadAttributeBase(oNode, L"serverZoom", attrServerZoom); - XmlMacroReadAttributeBase(oNode, L"showSpecialPlsOnTitleSld", attrShowSpecialPlsOnTitleSld); - XmlMacroReadAttributeBase(oNode, L"strictFirstAndLastChars", attrStrictFirstAndLastChars); - - //custDataLst (Customer Data List) - //custShowLst (List of Custom Shows) - defaultTextStyle = oNode.ReadNode(_T("p:defaultTextStyle")); - if (defaultTextStyle.is_init()) - defaultTextStyle->SetParentFilePointer(this); - embeddedFontLst.clear(); - XmlUtils::CXmlNode oNodeEmbeddedFonts; - if (oNode.GetNode(_T("p:embeddedFontLst"), oNodeEmbeddedFonts)) - { - XmlMacroLoadArray(oNodeEmbeddedFonts, _T("p:embeddedFont"), embeddedFontLst, nsPresentation::EmbeddedFont); - - for (size_t i = 0; i < embeddedFontLst.size(); ++i) - embeddedFontLst[i].SetParentFilePointer(this); - } - handoutMasterIdLst.clear(); - XmlUtils::CXmlNode oNodeHMList; - if (oNode.GetNode(_T("p:handoutMasterIdLst"), oNodeHMList)) - { - XmlMacroLoadArray(oNodeHMList, _T("p:handoutMasterId"), handoutMasterIdLst, Logic::XmlId); - - for (size_t i = 0; i < handoutMasterIdLst.size(); ++i) - handoutMasterIdLst[i].SetParentFilePointer(this); - } - - - kinsoku = oNode.ReadNode(_T("p:kinsoku")); - if (kinsoku.is_init()) - kinsoku->SetParentFilePointer(this); - - //modifyVerifier (Modification Verifier) - notesMasterIdLst.clear(); - XmlUtils::CXmlNode oNodeMIDList; - if (oNode.GetNode(_T("p:notesMasterIdLst"), oNodeMIDList)) - { - XmlMacroLoadArray(oNodeMIDList, _T("p:notesMasterId"), notesMasterIdLst, Logic::XmlId); - - for (size_t i = 0; i < notesMasterIdLst.size(); ++i) - notesMasterIdLst[i].SetParentFilePointer(this); - } - - notesSz = oNode.ReadNode(_T("p:notesSz")); - if (notesSz.is_init()) - notesSz->SetParentFilePointer(this); - - photoAlbum = oNode.ReadNode(_T("p:photoAlbum")); - if (photoAlbum.is_init()) - photoAlbum->SetParentFilePointer(this); - sldIdLst.clear(); - XmlUtils::CXmlNode oNode_sldId; - if (oNode.GetNode(_T("p:sldIdLst"), oNode_sldId)) - { - XmlMacroLoadArray(oNode_sldId, _T("p:sldId"), sldIdLst, Logic::XmlId); - - for (size_t i = 0; i < sldIdLst.size(); ++i) - sldIdLst[i].SetParentFilePointer(this); - } - sldMasterIdLst.clear(); - XmlUtils::CXmlNode oNode_sldM_Id; - if (oNode.GetNode(_T("p:sldMasterIdLst"), oNode_sldM_Id)) + + XmlUtils::CXmlNode oNodeRoot; + oNodeRoot.FromXmlFile(filename.m_strFilename); + + XmlMacroReadAttributeBase(oNodeRoot, L"autoCompressPictures", attrAutoCompressPictures); + XmlMacroReadAttributeBase(oNodeRoot, L"bookmarkIdSeed", attrBookmarkIdSeed); + XmlMacroReadAttributeBase(oNodeRoot, L"compatMode", attrCompatMode); + XmlMacroReadAttributeBase(oNodeRoot, L"conformance", attrConformance); + XmlMacroReadAttributeBase(oNodeRoot, L"embedTrueTypeFonts", attrEmbedTrueTypeFonts); + XmlMacroReadAttributeBase(oNodeRoot, L"firstSlideNum", attrFirstSlideNum); + XmlMacroReadAttributeBase(oNodeRoot, L"removePersonalInfoOnSave", attrRemovePersonalInfoOnSave); + XmlMacroReadAttributeBase(oNodeRoot, L"rtl", attrRtl); + XmlMacroReadAttributeBase(oNodeRoot, L"saveSubsetFonts", attrSaveSubsetFonts); + XmlMacroReadAttributeBase(oNodeRoot, L"serverZoom", attrServerZoom); + XmlMacroReadAttributeBase(oNodeRoot, L"showSpecialPlsOnTitleSld", attrShowSpecialPlsOnTitleSld); + XmlMacroReadAttributeBase(oNodeRoot, L"strictFirstAndLastChars", attrStrictFirstAndLastChars); + + //smartTags (Smart Tags) + //modifyVerifier (Modification Verifier) + + std::vector oNodes; + if (oNodeRoot.GetNodes(L"*", oNodes)) { - XmlMacroLoadArray(oNode_sldM_Id, _T("p:sldMasterId"), sldMasterIdLst, Logic::XmlId); - - for (size_t i = 0; i < sldMasterIdLst.size(); ++i) - sldMasterIdLst[i].SetParentFilePointer(this); - } - - sldSz = oNode.ReadNode(_T("p:sldSz")); - if (sldSz.is_init()) - sldSz->SetParentFilePointer(this); - - XmlUtils::CXmlNode list = oNode.ReadNodeNoNS(_T("extLst")); - if (list.IsValid()) - { - std::vector oNodes; - if (list.GetNodes(_T("*"), oNodes)) + for (size_t i = 0; i < oNodes.size(); ++i) { - size_t nCount = oNodes.size(); - for (size_t i = 0; i < nCount; ++i) - { - XmlUtils::CXmlNode& oNode = oNodes[i]; + XmlUtils::CXmlNode& oNode = oNodes[i]; - PPTX::Logic::Ext ext; - ext.fromXML(oNode); - if (ext.sectionLst.IsInit()) + std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName()); + + if (L"custDataLst" == strName) + { + std::vector oCustDataLstNodes; + if (oNode.GetNodes(L"custData", oCustDataLstNodes)) { - sectionLst = ext.sectionLst; + for (auto n : oCustDataLstNodes) + { + custDataLst.emplace_back(); + XmlMacroReadAttributeBase(n, L"r:id", custDataLst.back()); + } + } + } + else if (L"custShowLst" == strName) + { + custShowLst = oNode; + if (custShowLst.is_init()) custShowLst->SetParentFilePointer(this); + } + else if (L"defaultTextStyle" == strName) + { + defaultTextStyle = oNode; + if (defaultTextStyle.is_init()) defaultTextStyle->SetParentFilePointer(this); + } + else if (L"embeddedFontLst" == strName) + { + XmlMacroLoadArray(oNode, L"p:embeddedFont", embeddedFontLst, nsPresentation::EmbeddedFont); + + for (size_t i = 0; i < embeddedFontLst.size(); ++i) + embeddedFontLst[i].SetParentFilePointer(this); + } + else if (L"handoutMasterIdLst" == strName) + { + XmlMacroLoadArray(oNode, L"p:handoutMasterId", handoutMasterIdLst, Logic::XmlId); + + for (size_t i = 0; i < handoutMasterIdLst.size(); ++i) + handoutMasterIdLst[i].SetParentFilePointer(this); + } + else if (L"kinsoku" == strName) + { + kinsoku = oNode; + if (kinsoku.is_init()) kinsoku->SetParentFilePointer(this); + } + else if (L"notesMasterIdLst" == strName) + { + XmlMacroLoadArray(oNode, L"p:notesMasterId", notesMasterIdLst, Logic::XmlId); + + for (size_t i = 0; i < notesMasterIdLst.size(); ++i) + notesMasterIdLst[i].SetParentFilePointer(this); + } + else if (L"notesSz" == strName) + { + notesSz = oNode; + if (notesSz.is_init()) notesSz->SetParentFilePointer(this); + } + else if (L"photoAlbum" == strName) + { + photoAlbum = oNode; + if (photoAlbum.is_init()) photoAlbum->SetParentFilePointer(this); + } + else if (L"sldIdLst" == strName) + { + XmlMacroLoadArray(oNode, L"p:sldId", sldIdLst, Logic::XmlId); + + for (size_t i = 0; i < sldIdLst.size(); ++i) + sldIdLst[i].SetParentFilePointer(this); + } + else if (L"sldMasterIdLst" == strName) + { + XmlMacroLoadArray(oNode, L"p:sldMasterId", sldMasterIdLst, Logic::XmlId); + + for (size_t i = 0; i < sldMasterIdLst.size(); ++i) + sldMasterIdLst[i].SetParentFilePointer(this); + } + else if (L"sldSz" == strName) + { + sldSz = oNode; + if (sldSz.is_init()) sldSz->SetParentFilePointer(this); + } + else if (L"extLst" == strName) + { + if (oNode.IsValid()) + { + std::vector oExtLstNodes; + if (oNode.GetNodes(L"*", oExtLstNodes)) + { + for (auto n : oExtLstNodes) + { + PPTX::Logic::Ext ext; + ext.fromXML(n); + if (ext.sectionLst.IsInit()) + { + sectionLst = ext.sectionLst; + } + } + } } } } } - - //smartTags (Smart Tags) Normalize(); } void Presentation::write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const @@ -277,7 +291,7 @@ namespace PPTX case 0: { defaultTextStyle = PPTX::Logic::TextListStyle(); - defaultTextStyle->m_name = _T("p:defaultTextStyle"); + defaultTextStyle->m_name = L"p:defaultTextStyle"; defaultTextStyle->fromPPTY(pReader); break; } @@ -378,28 +392,28 @@ namespace PPTX void Presentation::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - pWriter->StartNode(_T("p:presentation")); + pWriter->StartNode(L"p:presentation"); pWriter->StartAttributes(); - pWriter->WriteAttribute(_T("xmlns:a"), PPTX::g_Namespaces.a.m_strLink); - pWriter->WriteAttribute(_T("xmlns:r"), PPTX::g_Namespaces.r.m_strLink); - pWriter->WriteAttribute(_T("xmlns:p"), PPTX::g_Namespaces.p.m_strLink); - pWriter->WriteAttribute(_T("xmlns:m"), PPTX::g_Namespaces.m.m_strLink); - pWriter->WriteAttribute(_T("xmlns:w"), PPTX::g_Namespaces.w.m_strLink); + pWriter->WriteAttribute(L"xmlns:a", PPTX::g_Namespaces.a.m_strLink); + pWriter->WriteAttribute(L"xmlns:r", PPTX::g_Namespaces.r.m_strLink); + pWriter->WriteAttribute(L"xmlns:p", PPTX::g_Namespaces.p.m_strLink); + pWriter->WriteAttribute(L"xmlns:m", PPTX::g_Namespaces.m.m_strLink); + pWriter->WriteAttribute(L"xmlns:w", PPTX::g_Namespaces.w.m_strLink); - pWriter->WriteAttribute(_T("autoCompressPictures"), attrAutoCompressPictures); - pWriter->WriteAttribute(_T("bookmarkIdSeed"), attrBookmarkIdSeed); - pWriter->WriteAttribute(_T("compatMode"), attrCompatMode); - pWriter->WriteAttribute(_T("conformance"), attrConformance); - pWriter->WriteAttribute(_T("embedTrueTypeFonts"), attrEmbedTrueTypeFonts); - pWriter->WriteAttribute(_T("firstSlideNum"), attrFirstSlideNum); - pWriter->WriteAttribute(_T("removePersonalInfoOnSave"), attrRemovePersonalInfoOnSave); - pWriter->WriteAttribute(_T("rtl"), attrRtl); - pWriter->WriteAttribute(_T("saveSubsetFonts"), attrSaveSubsetFonts); - pWriter->WriteAttribute(_T("serverZoom"), attrServerZoom); - pWriter->WriteAttribute(_T("showSpecialPlsOnTitleSld"), attrShowSpecialPlsOnTitleSld); - pWriter->WriteAttribute(_T("strictFirstAndLastChars"), attrStrictFirstAndLastChars); + pWriter->WriteAttribute(L"autoCompressPictures", attrAutoCompressPictures); + pWriter->WriteAttribute(L"bookmarkIdSeed", attrBookmarkIdSeed); + pWriter->WriteAttribute(L"compatMode", attrCompatMode); + pWriter->WriteAttribute(L"conformance", attrConformance); + pWriter->WriteAttribute(L"embedTrueTypeFonts", attrEmbedTrueTypeFonts); + pWriter->WriteAttribute(L"firstSlideNum", attrFirstSlideNum); + pWriter->WriteAttribute(L"removePersonalInfoOnSave", attrRemovePersonalInfoOnSave); + pWriter->WriteAttribute(L"rtl", attrRtl); + pWriter->WriteAttribute(L"saveSubsetFonts", attrSaveSubsetFonts); + pWriter->WriteAttribute(L"serverZoom", attrServerZoom); + pWriter->WriteAttribute(L"showSpecialPlsOnTitleSld", attrShowSpecialPlsOnTitleSld); + pWriter->WriteAttribute(L"strictFirstAndLastChars", attrStrictFirstAndLastChars); pWriter->EndAttributes(); @@ -413,6 +427,26 @@ namespace PPTX pWriter->Write(notesSz); pWriter->Write(photoAlbum); pWriter->Write(kinsoku); + + if (false == custDataLst.empty()) + { + pWriter->StartNode(L"p:custDataLst"); + pWriter->EndAttributes(); + + for (auto cust : custDataLst) + { + pWriter->StartNode(L"p:custData"); + pWriter->StartAttributes(); + pWriter->WriteAttribute(L"r:id", cust.ToString()); + + pWriter->EndAttributes(); + pWriter->EndNode(L"p:custData"); + } + + pWriter->EndNode(L"p:custDataLst"); + } + pWriter->Write(custShowLst); + pWriter->Write(defaultTextStyle); std::vector extLst; diff --git a/OOXML/PPTXFormat/Presentation.h b/OOXML/PPTXFormat/Presentation.h index 9aae1337ae..cc6ea6f50f 100644 --- a/OOXML/PPTXFormat/Presentation.h +++ b/OOXML/PPTXFormat/Presentation.h @@ -35,7 +35,7 @@ #include "FileContainer.h" #include "FileTypes.h" -#include "Presentation/EmbeddedFont.h" +#include "Presentation/PresentationChildElements.h" #include "CommentAuthors.h" #include "Limit/Conformance.h" @@ -88,9 +88,6 @@ namespace PPTX return type().DefaultFileName(); } - //Childs - //custDataLst (Customer Data List) - //property > custShowLst (List of Custom Shows) nullable defaultTextStyle; std::vector embeddedFontLst; std::vector handoutMasterIdLst; @@ -101,11 +98,12 @@ namespace PPTX nullable photoAlbum; std::vector sldIdLst; std::vector sldMasterIdLst; + std::vector custDataLst; + nullable custShowLst; nullable sldSz; nullable sectionLst; //smartTags (Smart Tags) - // Attrs nullable_bool attrAutoCompressPictures; nullable_int attrBookmarkIdSeed; nullable_bool attrCompatMode; @@ -119,36 +117,12 @@ namespace PPTX nullable_bool attrShowSpecialPlsOnTitleSld; nullable_bool attrStrictFirstAndLastChars; - smart_ptr commentAuthors; + smart_ptr commentAuthors; + smart_ptr comments; - private: - Logic::ClrMap m_clrMap; - nsTheme::ClrScheme m_clrScheme; - public: bool m_bMacroEnabled; smart_ptr m_pVbaProject; - smart_ptr m_pJsaProject; - smart_ptr comments; - - void SetClrMap(Logic::ClrMap map) {m_clrMap = map;} - void SetClrScheme(nsTheme::ClrScheme scheme) {m_clrScheme = scheme;} - - DWORD GetRGBAFromMap(const std::wstring& str)const - { - return m_clrScheme.GetRGBAFromScheme(m_clrMap.GetColorSchemeIndex(str)); - } - DWORD GetARGBFromMap(const std::wstring& str)const - { - return m_clrScheme.GetARGBFromScheme(m_clrMap.GetColorSchemeIndex(str)); - } - DWORD GetBGRAFromMap(const std::wstring& str)const - { - return m_clrScheme.GetBGRAFromScheme(m_clrMap.GetColorSchemeIndex(str)); - } - DWORD GetABGRFromMap(const std::wstring& str)const - { - return m_clrScheme.GetABGRFromScheme(m_clrMap.GetColorSchemeIndex(str)); - } + smart_ptr m_pJsaProject; private: void Normalize(); diff --git a/OOXML/PPTXFormat/Presentation/EmbeddedFont.cpp b/OOXML/PPTXFormat/Presentation/EmbeddedFont.cpp deleted file mode 100644 index beab4859d8..0000000000 --- a/OOXML/PPTXFormat/Presentation/EmbeddedFont.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "EmbeddedFont.h" - -namespace PPTX -{ - namespace nsPresentation - { - void EmbeddedFont::fromXML(XmlUtils::CXmlNode& node) - { - Bold = node.ReadNode(_T("p:bold")); - BoldItalic = node.ReadNode(_T("p:boldItalic")); - Italic = node.ReadNode(_T("p:italic")); - Regular = node.ReadNode(_T("p:regular")); - Font = node.ReadNode(_T("p:font")); - - FillParentPointersForChilds(); - } - std::wstring EmbeddedFont::toXML() const - { - XmlUtils::CNodeValue oValue; - oValue.WriteNullable(Bold); - oValue.WriteNullable(BoldItalic); - oValue.WriteNullable(Italic); - oValue.WriteNullable(Regular); - oValue.Write(Font); - - return XmlUtils::CreateNode(_T("p:embeddedFont"), oValue); - } - void EmbeddedFont::FillParentPointersForChilds() - { - if(Bold.is_init()) - Bold->SetParentPointer(this); - if(BoldItalic.is_init()) - BoldItalic->SetParentPointer(this); - if(Italic.is_init()) - Italic->SetParentPointer(this); - if(Regular.is_init()) - Regular->SetParentPointer(this); - Font.SetParentPointer(this); - } - } // namespace nsPresentation -} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/EmbeddedFont.h b/OOXML/PPTXFormat/Presentation/EmbeddedFont.h deleted file mode 100644 index 71f421402d..0000000000 --- a/OOXML/PPTXFormat/Presentation/EmbeddedFont.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once -#ifndef PPTX_PRESENTATION_EMBEDDEDFONT_INCLUDE_H_ -#define PPTX_PRESENTATION_EMBEDDEDFONT_INCLUDE_H_ - -#include "./../WrapperWritingElement.h" -#include "EmbeddedFontDataId.h" -#include "./../Logic/TextFont.h" - -namespace PPTX -{ - namespace nsPresentation - { - class EmbeddedFont : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(EmbeddedFont) - - public: - virtual void fromXML(XmlUtils::CXmlNode& node); - virtual std::wstring toXML() const; - - public: - nullable Bold; - nullable BoldItalic; - nullable Italic; - nullable Regular; - Logic::TextFont Font; - - protected: - virtual void FillParentPointersForChilds(); - }; - } // namespace nsPresentation -} // namespace PPTX - -#endif // PPTX_PRESENTATION_EMBEDDEDFONT_INCLUDE_H_ diff --git a/OOXML/PPTXFormat/Presentation/EmbeddedFontDataId.cpp b/OOXML/PPTXFormat/Presentation/EmbeddedFontDataId.cpp deleted file mode 100644 index 53eb0ca4fb..0000000000 --- a/OOXML/PPTXFormat/Presentation/EmbeddedFontDataId.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "EmbeddedFontDataId.h" - -namespace PPTX -{ - namespace nsPresentation - { - void EmbeddedFontDataId::fromXML(XmlUtils::CXmlNode& node) - { - m_name = XmlUtils::GetNameNoNS(node.GetName()); - - rid = node.GetAttribute(L"r:id"); - } - std::wstring EmbeddedFontDataId::toXML() const - { - XmlUtils::CAttribute oAttr; - oAttr.Write(L"r:id", rid); - - return XmlUtils::CreateNode(L"p:" + m_name, oAttr); - } - void EmbeddedFontDataId::FillParentPointersForChilds() - { - } - } // namespace nsPresentation -} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/EmbeddedFontDataId.h b/OOXML/PPTXFormat/Presentation/EmbeddedFontDataId.h deleted file mode 100644 index 03a3caa0e3..0000000000 --- a/OOXML/PPTXFormat/Presentation/EmbeddedFontDataId.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "./../WrapperWritingElement.h" - -namespace PPTX -{ - namespace nsPresentation - { - class EmbeddedFontDataId : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(EmbeddedFontDataId) - - virtual void fromXML(XmlUtils::CXmlNode& node); - virtual std::wstring toXML() const; - - std::wstring rid; - std::wstring m_name; - - protected: - virtual void FillParentPointersForChilds(); - }; - } // namespace nsPresentation -} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/Kinsoku.cpp b/OOXML/PPTXFormat/Presentation/Kinsoku.cpp deleted file mode 100644 index 3b4b5f213c..0000000000 --- a/OOXML/PPTXFormat/Presentation/Kinsoku.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "Kinsoku.h" - -namespace PPTX -{ - namespace nsPresentation - { - void Kinsoku::fromXML(XmlUtils::CXmlNode& node) - { - invalEndChars = node.GetAttribute(_T("invalEndChars")); - invalStChars = node.GetAttribute(_T("invalStChars")); - - XmlMacroReadAttributeBase(node, L"lang", lang); - } - std::wstring Kinsoku::toXML() const - { - XmlUtils::CAttribute oAttr; - oAttr.Write(_T("invalEndChars"), invalEndChars); - oAttr.Write(_T("invalStChars"), invalStChars); - oAttr.Write(_T("lang"), lang); - - return XmlUtils::CreateNode(_T("p:kinsoku"), oAttr); - } - void Kinsoku::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const - { - // TODO: - } - void Kinsoku::FillParentPointersForChilds() - { - } - } // namespace nsPresentation -} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/Kinsoku.h b/OOXML/PPTXFormat/Presentation/Kinsoku.h deleted file mode 100644 index 79ec1775ab..0000000000 --- a/OOXML/PPTXFormat/Presentation/Kinsoku.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once -#ifndef PPTX_PRESENTATION_KINSOKU_INCLUDE_H_ -#define PPTX_PRESENTATION_KINSOKU_INCLUDE_H_ - -#include "./../WrapperWritingElement.h" - -namespace PPTX -{ - namespace nsPresentation - { - class Kinsoku : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(Kinsoku) - - public: - virtual void fromXML(XmlUtils::CXmlNode& node); - virtual std::wstring toXML() const; - virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; - - public: - std::wstring invalEndChars; - std::wstring invalStChars; - nullable_string lang; - - protected: - virtual void FillParentPointersForChilds(); - }; - } // namespace nsPresentation -} // namespace PPTX - -#endif // PPTX_PRESENTATION_KINSOKU_INCLUDE_H_ diff --git a/OOXML/PPTXFormat/Presentation/NotesSz.cpp b/OOXML/PPTXFormat/Presentation/NotesSz.cpp deleted file mode 100644 index 472c869bd4..0000000000 --- a/OOXML/PPTXFormat/Presentation/NotesSz.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "NotesSz.h" - -namespace PPTX -{ - namespace nsPresentation - { - void NotesSz::fromXML(XmlUtils::CXmlNode& node) - { - cx = node.ReadAttributeInt(L"cx"); - cy = node.ReadAttributeInt(L"cy"); - - Normalize(); - } - std::wstring NotesSz::toXML() const - { - XmlUtils::CAttribute oAttr; - oAttr.Write(_T("cx"), cx); - oAttr.Write(_T("cy"), cy); - - return XmlUtils::CreateNode(_T("p:notesSz"), oAttr); - } - void NotesSz::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const - { - pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); - - pWriter->WriteInt1(0, cx); - pWriter->WriteInt1(1, cy); - - pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); - } - void NotesSz::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const - { - pWriter->StartNode(_T("p:notesSz")); - pWriter->StartAttributes(); - pWriter->WriteAttribute(_T("cx"), cx); - pWriter->WriteAttribute(_T("cy"), cy); - pWriter->EndAttributes(); - pWriter->EndNode(_T("p:notesSz")); - } - void NotesSz::FillParentPointersForChilds() - { - } - void NotesSz::Normalize() - { - if (cx < 0) - cx = 0; - if (cy < 0) - cy = 0; - } - } // namespace nsPresentation -} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/NotesSz.h b/OOXML/PPTXFormat/Presentation/NotesSz.h deleted file mode 100644 index b82b33232c..0000000000 --- a/OOXML/PPTXFormat/Presentation/NotesSz.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once -#ifndef PPTX_PRESENTATION_NOTESSZ_INCLUDE_H_ -#define PPTX_PRESENTATION_NOTESSZ_INCLUDE_H_ - -#include "./../WrapperWritingElement.h" - -namespace PPTX -{ - namespace nsPresentation - { - class NotesSz : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(NotesSz) - - public: - virtual void fromXML(XmlUtils::CXmlNode& node); - virtual std::wstring toXML() const; - - virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; - virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; - - public: - int cx; - int cy; - - protected: - virtual void FillParentPointersForChilds(); - void Normalize(); - }; - } // namespace nsPresentation -} // namespace PPTX - -#endif // PPTX_PRESENTATION_NOTESSZ_INCLUDE_H_ diff --git a/OOXML/PPTXFormat/Presentation/PhotoAlbum.cpp b/OOXML/PPTXFormat/Presentation/PhotoAlbum.cpp deleted file mode 100644 index 9d9c198be8..0000000000 --- a/OOXML/PPTXFormat/Presentation/PhotoAlbum.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "PhotoAlbum.h" - -namespace PPTX -{ - namespace nsPresentation - { - void PhotoAlbum::fromXML(XmlUtils::CXmlNode& node) - { - XmlMacroReadAttributeBase(node, L"bw", bw); - XmlMacroReadAttributeBase(node, L"frame", frame); - XmlMacroReadAttributeBase(node, L"layout", layout); - XmlMacroReadAttributeBase(node, L"showCaptions", showCaptions); - } - std::wstring PhotoAlbum::toXML() const - { - XmlUtils::CAttribute oAttr; - oAttr.Write(_T("bw"), bw); - oAttr.WriteLimitNullable(_T("frame"), frame); - oAttr.WriteLimitNullable(_T("layout"), layout); - oAttr.Write(_T("showCaptions"), showCaptions); - - return XmlUtils::CreateNode(_T("p:photoAlbum"), oAttr); - } - void PhotoAlbum::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const - { - } - void PhotoAlbum::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const - { - } - void PhotoAlbum::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) - { - } - void PhotoAlbum::FillParentPointersForChilds() - { - } - } // namespace nsPresentation -} // namespace PPTX - diff --git a/OOXML/PPTXFormat/Presentation/PhotoAlbum.h b/OOXML/PPTXFormat/Presentation/PhotoAlbum.h deleted file mode 100644 index 7e98af8307..0000000000 --- a/OOXML/PPTXFormat/Presentation/PhotoAlbum.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "./../WrapperWritingElement.h" -#include "./../Limit/FrameShape.h" -#include "./../Limit/AlbumLayout.h" - -namespace PPTX -{ - namespace nsPresentation - { - class PhotoAlbum : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(PhotoAlbum) - - public: - virtual void fromXML(XmlUtils::CXmlNode& node); - virtual std::wstring toXML() const; - - virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; - virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; - virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); - - nullable_bool bw; - nullable_limit frame; - nullable_limit layout; - nullable_bool showCaptions; - - protected: - virtual void FillParentPointersForChilds(); - }; - } // namespace nsPresentation -} // namespace PPTX - diff --git a/OOXML/PPTXFormat/Presentation/PresentationChildElements.cpp b/OOXML/PPTXFormat/Presentation/PresentationChildElements.cpp new file mode 100644 index 0000000000..fc0f06d46c --- /dev/null +++ b/OOXML/PPTXFormat/Presentation/PresentationChildElements.cpp @@ -0,0 +1,571 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +#include "PresentationChildElements.h" + +namespace PPTX +{ + namespace nsPresentation + { + void EmbeddedFont::fromXML(XmlUtils::CXmlNode& node) + { + Bold = node.ReadNode(_T("p:bold")); + BoldItalic = node.ReadNode(_T("p:boldItalic")); + Italic = node.ReadNode(_T("p:italic")); + Regular = node.ReadNode(_T("p:regular")); + Font = node.ReadNode(_T("p:font")); + + FillParentPointersForChilds(); + } + std::wstring EmbeddedFont::toXML() const + { + XmlUtils::CNodeValue oValue; + oValue.WriteNullable(Bold); + oValue.WriteNullable(BoldItalic); + oValue.WriteNullable(Italic); + oValue.WriteNullable(Regular); + oValue.Write(Font); + + return XmlUtils::CreateNode(_T("p:embeddedFont"), oValue); + } + void EmbeddedFont::FillParentPointersForChilds() + { + if (Bold.is_init()) + Bold->SetParentPointer(this); + if (BoldItalic.is_init()) + BoldItalic->SetParentPointer(this); + if (Italic.is_init()) + Italic->SetParentPointer(this); + if (Regular.is_init()) + Regular->SetParentPointer(this); + Font.SetParentPointer(this); + } + void EmbeddedFontDataId::fromXML(XmlUtils::CXmlNode& node) + { + m_name = XmlUtils::GetNameNoNS(node.GetName()); + + rid = node.GetAttribute(L"r:id"); + } + std::wstring EmbeddedFontDataId::toXML() const + { + XmlUtils::CAttribute oAttr; + oAttr.Write(L"r:id", rid); + + return XmlUtils::CreateNode(L"p:" + m_name, oAttr); + } + void EmbeddedFontDataId::FillParentPointersForChilds() + { + } + void NotesSz::fromXML(XmlUtils::CXmlNode& node) + { + cx = node.ReadAttributeInt(L"cx"); + cy = node.ReadAttributeInt(L"cy"); + + Normalize(); + } + std::wstring NotesSz::toXML() const + { + XmlUtils::CAttribute oAttr; + oAttr.Write(_T("cx"), cx); + oAttr.Write(_T("cy"), cy); + + return XmlUtils::CreateNode(_T("p:notesSz"), oAttr); + } + void NotesSz::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); + + pWriter->WriteInt1(0, cx); + pWriter->WriteInt1(1, cy); + + pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); + } + void NotesSz::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + { + pWriter->StartNode(_T("p:notesSz")); + pWriter->StartAttributes(); + pWriter->WriteAttribute(_T("cx"), cx); + pWriter->WriteAttribute(_T("cy"), cy); + pWriter->EndAttributes(); + pWriter->EndNode(_T("p:notesSz")); + } + void NotesSz::FillParentPointersForChilds() + { + } + void NotesSz::Normalize() + { + if (cx < 0) + cx = 0; + if (cy < 0) + cy = 0; + } + void Kinsoku::fromXML(XmlUtils::CXmlNode& node) + { + invalEndChars = node.GetAttribute(_T("invalEndChars")); + invalStChars = node.GetAttribute(_T("invalStChars")); + + XmlMacroReadAttributeBase(node, L"lang", lang); + } + std::wstring Kinsoku::toXML() const + { + XmlUtils::CAttribute oAttr; + oAttr.Write(_T("invalEndChars"), invalEndChars); + oAttr.Write(_T("invalStChars"), invalStChars); + oAttr.Write(_T("lang"), lang); + + return XmlUtils::CreateNode(_T("p:kinsoku"), oAttr); + } + void Kinsoku::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + // TODO: + } + void Kinsoku::FillParentPointersForChilds() + { + } + void PhotoAlbum::fromXML(XmlUtils::CXmlNode& node) + { + XmlMacroReadAttributeBase(node, L"bw", bw); + XmlMacroReadAttributeBase(node, L"frame", frame); + XmlMacroReadAttributeBase(node, L"layout", layout); + XmlMacroReadAttributeBase(node, L"showCaptions", showCaptions); + } + std::wstring PhotoAlbum::toXML() const + { + XmlUtils::CAttribute oAttr; + oAttr.Write(_T("bw"), bw); + oAttr.WriteLimitNullable(_T("frame"), frame); + oAttr.WriteLimitNullable(_T("layout"), layout); + oAttr.Write(_T("showCaptions"), showCaptions); + + return XmlUtils::CreateNode(_T("p:photoAlbum"), oAttr); + } + void PhotoAlbum::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + { + } + void PhotoAlbum::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + } + void PhotoAlbum::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) + { + } + void PhotoAlbum::FillParentPointersForChilds() + { + } + void SldSz::fromXML(XmlUtils::CXmlNode& node) + { + cx = node.ReadAttributeInt(L"cx"); + cy = node.ReadAttributeInt(L"cy"); + + XmlMacroReadAttributeBase(node, L"type", type); + + Normalize(); + } + std::wstring SldSz::toXML() const + { + XmlUtils::CAttribute oAttr; + oAttr.Write(_T("cx"), cx); + oAttr.Write(_T("cy"), cy); + oAttr.WriteLimitNullable(_T("type"), type); + + return XmlUtils::CreateNode(_T("p:sldSz"), oAttr); + } + void SldSz::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); + + pWriter->WriteInt1(0, cx); + pWriter->WriteInt1(1, cy); + pWriter->WriteLimit2(2, type); + + pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); + } + void SldSz::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + { + pWriter->StartNode(_T("p:sldSz")); + pWriter->StartAttributes(); + pWriter->WriteAttribute(_T("cx"), cx); + pWriter->WriteAttribute(_T("cy"), cy); + pWriter->WriteAttribute(_T("type"), type); + pWriter->EndAttributes(); + pWriter->EndNode(_T("p:sldSz")); + } + void SldSz::FillParentPointersForChilds() + { + } + void SldSz::Normalize() + { + cx = (std::min)((std::max)(cx, 914400), 51206400); + cy = (std::min)((std::max)(cy, 914400), 51206400); + } +//----------------------------------------------------------------------------------------------------------- + void SectionLst::fromXML(XmlUtils::CXmlNode& node) + { + std::vector oNodes; + if (node.GetNodes(_T("*"), oNodes)) + { + size_t nCount = oNodes.size(); + for (int i = 0; i < nCount; ++i) + { + XmlUtils::CXmlNode& oNode = oNodes[i]; + + Section sect; + arSectionLst.push_back(sect); + + arSectionLst.back().fromXML(oNode); + } + } + } + std::wstring SectionLst::toXML() const + { + return L""; + } + void SectionLst::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) + { + LONG end = pReader->GetPos() + pReader->GetRecordSize() + 4; + + while (pReader->GetPos() < end) + { + BYTE _rec = pReader->GetUChar(); + + switch (_rec) + { + case 0: + { + pReader->Skip(4); // len + ULONG lCount = pReader->GetULong(); + + for (ULONG i = 0; i < lCount; ++i) + { + pReader->Skip(1); + + Section sect; + + arSectionLst.push_back(sect); + arSectionLst.back().fromPPTY(pReader); + } + + break; + } + default: + { + pReader->SkipRecord(); + break; + } + } + } + + pReader->Seek(end); + } + void SectionLst::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + pWriter->WriteRecordArray(0, 0, arSectionLst); + } + void SectionLst::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + { + pWriter->StartNode(L"p14:sectionLst"); + + pWriter->StartAttributes(); + pWriter->WriteAttribute(L"xmlns:p14", PPTX::g_Namespaces.p14.m_strLink); + pWriter->EndAttributes(); + + pWriter->WriteArray2(arSectionLst); + + pWriter->EndNode(L"p14:sectionLst"); + } +//---------------------------------------------------------------------------------------------------------------------- + void Section::fromXML(XmlUtils::CXmlNode& node) + { + XmlMacroReadAttributeBase(node, L"id", id); + XmlMacroReadAttributeBase(node, L"name", name); + + XmlUtils::CXmlNode oNodeSldIdLst; + if (node.GetNode(L"p14:sldIdLst", oNodeSldIdLst)) + { + XmlMacroLoadArray(oNodeSldIdLst, L"p14:sldId", arSldIdLst, Logic::XmlId); + } + } + std::wstring Section::toXML() const + { + return L""; + } + void Section::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + { + pWriter->StartNode(L"p14:section"); + + pWriter->StartAttributes(); + pWriter->WriteAttribute2(L"name", name); + pWriter->WriteAttribute(L"id", id); + + pWriter->EndAttributes(); + + pWriter->StartNode(L"p14:sldIdLst"); + pWriter->EndAttributes(); + pWriter->WriteArray2(arSldIdLst); + pWriter->EndNode(L"p14:sldIdLst"); + + pWriter->EndNode(L"p14:section"); + } + void Section::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); + pWriter->WriteString2(0, id); + pWriter->WriteString2(1, name); + pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); + + pWriter->WriteRecordArray(0, 0, arSldIdLst); + + } + void Section::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) + { + LONG _end_rec = pReader->GetPos() + pReader->GetRecordSize() + 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: + name = pReader->GetString2(); + break; + default: + break; + } + } + + while (pReader->GetPos() < _end_rec) + { + BYTE _rec = pReader->GetUChar(); + + switch (_rec) + { + case 0: + { + pReader->Skip(4); // len + ULONG lCount = pReader->GetULong(); + + for (ULONG i = 0; i < lCount; ++i) + { + pReader->Skip(1); + + Logic::XmlId sldId(L"p14:sldId"); + + arSldIdLst.push_back(sldId); + arSldIdLst.back().fromPPTY(pReader); + } + + break; + } + default: + { + pReader->SkipRecord(); + break; + } + } + } + pReader->Seek(_end_rec); + } +//---------------------------------------------------------------------------------------------------------------------- + void CustShowLst::fromXML(XmlUtils::CXmlNode& node) + { + std::vector oNodes; + if (node.GetNodes(_T("*"), oNodes)) + { + size_t nCount = oNodes.size(); + for (int i = 0; i < nCount; ++i) + { + XmlUtils::CXmlNode& oNode = oNodes[i]; + + arCustShowLst.emplace_back(); + arCustShowLst.back().fromXML(oNode); + } + } + } + std::wstring CustShowLst::toXML() const + { + return L""; + } + void CustShowLst::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) + { + LONG end = pReader->GetPos() + pReader->GetRecordSize() + 4; + + while (pReader->GetPos() < end) + { + BYTE _rec = pReader->GetUChar(); + + switch (_rec) + { + case 0: + { + pReader->Skip(4); // len + ULONG lCount = pReader->GetULong(); + + for (ULONG i = 0; i < lCount; ++i) + { + pReader->Skip(1); + + CustShow custShow; + + arCustShowLst.push_back(custShow); + arCustShowLst.back().fromPPTY(pReader); + } + + break; + } + default: + { + pReader->SkipRecord(); + break; + } + } + } + + pReader->Seek(end); + } + void CustShowLst::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + pWriter->WriteRecordArray(0, 0, arCustShowLst); + } + void CustShowLst::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + { + pWriter->StartNode(L"p:custShowLst"); + + pWriter->StartAttributes(); + pWriter->EndAttributes(); + + pWriter->WriteArray2(arCustShowLst); + + pWriter->EndNode(L"p:custShowLst"); + } +//---------------------------------------------------------------------------------------------------------------------- + void CustShow::fromXML(XmlUtils::CXmlNode& node) + { + XmlUtils::CXmlNode oNodeSldIdLst; + if (node.GetNode(L"p:sldIdLst", oNodeSldIdLst)) + { + if (oNodeSldIdLst.IsValid()) + { + std::vector arrNodeSldId; + if (oNodeSldIdLst.GetNodes(L"sldId", arrNodeSldId)) + + for (auto n : arrNodeSldId) + { + arSldIdLst.emplace_back(); + XmlMacroReadAttributeBase(n, L"r:id", arSldIdLst.back()); + } + } + } + } + std::wstring CustShow::toXML() const + { + return L""; + } + void CustShow::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + { + pWriter->StartNode(L"p:custShow"); + + pWriter->StartAttributes(); + pWriter->EndAttributes(); + + pWriter->StartNode(L"p:sldIdLst"); + pWriter->EndAttributes(); + for (auto sld : arSldIdLst) + { + pWriter->StartNode(L"p:sldId"); + std::wstring sRid = sld.ToString(); + if (sRid.empty() == false) + { + pWriter->WriteAttribute(L"r:id", sRid); + } + pWriter->EndAttributes(); + pWriter->EndNode(L"p:sldId"); + } + pWriter->EndNode(L"p:sldIdLst"); + + pWriter->EndNode(L"p:custShow"); + } + void CustShow::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + pWriter->StartRecord(0); + + _UINT32 len = (_UINT32)arSldIdLst.size(); + pWriter->WriteULONG(len); + + for (_UINT32 i = 0; i < len; ++i) + { + pWriter->WriteString(arSldIdLst[i].ToString()); + } + + pWriter->EndRecord(); + } + void CustShow::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) + { + LONG _end_rec = pReader->GetPos() + pReader->GetRecordSize() + 4; + + while (pReader->GetPos() < _end_rec) + { + BYTE _rec = pReader->GetUChar(); + + switch (_rec) + { + case 0: + { + pReader->Skip(4); // len + ULONG lCount = pReader->GetULong(); + + for (ULONG i = 0; i < lCount; ++i) + { + pReader->Skip(1); + + arSldIdLst.emplace_back(); + arSldIdLst.back() = pReader->GetString2(); + } + + }break; + default: + { + pReader->SkipRecord(); + break; + } + } + } + pReader->Seek(_end_rec); + } + } // namespace +} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/PresentationChildElements.h b/OOXML/PPTXFormat/Presentation/PresentationChildElements.h new file mode 100644 index 0000000000..b1e05942d5 --- /dev/null +++ b/OOXML/PPTXFormat/Presentation/PresentationChildElements.h @@ -0,0 +1,230 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +#pragma once + +#include "../Logic/XmlId.h" +#include "./../Limit/FrameShape.h" +#include "./../Limit/AlbumLayout.h" +#include "./../Limit/SlideSize.h" +#include "./../Logic/TextFont.h" + +namespace PPTX +{ + namespace nsPresentation + { + class Section : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(Section) + + nullable_string id; + nullable_string name; + std::vector arSldIdLst; + + virtual void fromXML(XmlUtils::CXmlNode& node); + + virtual std::wstring toXML() const; + + virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); + + virtual void FillParentPointersForChilds() {} + }; + + class SectionLst : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(SectionLst) + + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + + std::vector
arSectionLst; + + protected: + virtual void FillParentPointersForChilds() {}; + }; + + class SldSz : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(SldSz) + + public: + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + + public: + int cx; + int cy; + nullable_limit type; + + protected: + virtual void FillParentPointersForChilds(); + void Normalize(); + }; + class PhotoAlbum : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(PhotoAlbum) + + public: + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + + virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); + + nullable_bool bw; + nullable_limit frame; + nullable_limit layout; + nullable_bool showCaptions; + + protected: + virtual void FillParentPointersForChilds(); + }; + class NotesSz : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(NotesSz) + + public: + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + + public: + int cx; + int cy; + + protected: + virtual void FillParentPointersForChilds(); + void Normalize(); + }; + class Kinsoku : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(Kinsoku) + + public: + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + + public: + std::wstring invalEndChars; + std::wstring invalStChars; + nullable_string lang; + + protected: + virtual void FillParentPointersForChilds(); + }; + class EmbeddedFontDataId : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(EmbeddedFontDataId) + + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + + std::wstring rid; + std::wstring m_name; + + protected: + virtual void FillParentPointersForChilds(); + }; + class EmbeddedFont : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(EmbeddedFont) + + public: + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + + public: + nullable Bold; + nullable BoldItalic; + nullable Italic; + nullable Regular; + Logic::TextFont Font; + + protected: + virtual void FillParentPointersForChilds(); + }; + class CustShow : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(CustShow) + + std::vector arSldIdLst; + + virtual void fromXML(XmlUtils::CXmlNode& node); + + virtual std::wstring toXML() const; + + virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); + + virtual void FillParentPointersForChilds() {} + }; + class CustShowLst : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(CustShowLst) + + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + + std::vector arCustShowLst; + + protected: + virtual void FillParentPointersForChilds() {}; + }; + } +} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/SectionLst.cpp b/OOXML/PPTXFormat/Presentation/SectionLst.cpp deleted file mode 100644 index 0729268049..0000000000 --- a/OOXML/PPTXFormat/Presentation/SectionLst.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ diff --git a/OOXML/PPTXFormat/Presentation/SectionLst.h b/OOXML/PPTXFormat/Presentation/SectionLst.h deleted file mode 100644 index bba6089d56..0000000000 --- a/OOXML/PPTXFormat/Presentation/SectionLst.h +++ /dev/null @@ -1,247 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "../Logic/XmlId.h" - -namespace PPTX -{ - namespace Logic - { - class Section : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(Section) - - nullable_string id; - nullable_string name; - std::vector arSldIdLst; - - virtual void fromXML(XmlUtils::CXmlNode& node) - { - XmlMacroReadAttributeBase(node, L"id", id); - XmlMacroReadAttributeBase(node, L"name", name); - - XmlUtils::CXmlNode oNodeSldIdLst; - if (node.GetNode(L"p14:sldIdLst", oNodeSldIdLst)) - { - XmlMacroLoadArray(oNodeSldIdLst, L"p14:sldId", arSldIdLst, Logic::XmlId); - } - } - - virtual std::wstring toXML() const - { - return L""; - } - - virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const - { - pWriter->StartNode(L"p14:section"); - - pWriter->StartAttributes(); - pWriter->WriteAttribute2(L"name", name); - pWriter->WriteAttribute(L"id", id); - - pWriter->EndAttributes(); - - pWriter->StartNode(L"p14:sldIdLst"); - pWriter->EndAttributes(); - pWriter->WriteArray2(arSldIdLst); - pWriter->EndNode(L"p14:sldIdLst"); - - pWriter->EndNode(L"p14:section"); - } - - virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const - { - pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); - pWriter->WriteString2(0, id); - pWriter->WriteString2(1, name); - pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); - - pWriter->WriteRecordArray(0, 0, arSldIdLst); - - } - virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) - { - LONG _end_rec = pReader->GetPos() + pReader->GetRecordSize() + 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: - name = pReader->GetString2(); - break; - default: - break; - } - } - - while (pReader->GetPos() < _end_rec) - { - BYTE _rec = pReader->GetUChar(); - - switch (_rec) - { - case 0: - { - pReader->Skip(4); // len - ULONG lCount = pReader->GetULong(); - - for (ULONG i = 0; i < lCount; ++i) - { - pReader->Skip(1); - - Logic::XmlId sldId(L"p14:sldId"); - - arSldIdLst.push_back(sldId); - arSldIdLst.back().fromPPTY(pReader); - } - - break; - } - default: - { - pReader->SkipRecord(); - break; - } - } - } - - pReader->Seek(_end_rec); - } - - virtual void FillParentPointersForChilds() - { - } - }; - } - - namespace nsPresentation - { - class SectionLst : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(SectionLst) - - virtual void fromXML(XmlUtils::CXmlNode& node) - { - std::vector oNodes; - if (node.GetNodes(_T("*"), oNodes)) - { - size_t nCount = oNodes.size(); - for (int i = 0; i < nCount; ++i) - { - XmlUtils::CXmlNode & oNode = oNodes[i]; - - Logic::Section sect; - arSectionLst.push_back(sect); - - arSectionLst.back().fromXML(oNode); - } - } - } - virtual std::wstring toXML() const - { - return L""; - } - virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) - { - LONG end = pReader->GetPos() + pReader->GetRecordSize() + 4; - - while (pReader->GetPos() < end) - { - BYTE _rec = pReader->GetUChar(); - - switch (_rec) - { - case 0: - { - pReader->Skip(4); // len - ULONG lCount = pReader->GetULong(); - - for (ULONG i = 0; i < lCount; ++i) - { - pReader->Skip(1); - - Logic::Section sect; - - arSectionLst.push_back(sect); - arSectionLst.back().fromPPTY(pReader); - } - - break; - } - default: - { - pReader->SkipRecord(); - break; - } - } - } - - pReader->Seek(end); - } - virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const - { - pWriter->WriteRecordArray(0, 0, arSectionLst); - } - virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const - { - pWriter->StartNode(L"p14:sectionLst"); - - pWriter->StartAttributes(); - pWriter->WriteAttribute(L"xmlns:p14", PPTX::g_Namespaces.p14.m_strLink); - pWriter->EndAttributes(); - - pWriter->WriteArray2(arSectionLst); - - pWriter->EndNode(L"p14:sectionLst"); - } - - std::vector arSectionLst; - - protected: - virtual void FillParentPointersForChilds(){}; - }; - } -} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/SldSz.cpp b/OOXML/PPTXFormat/Presentation/SldSz.cpp deleted file mode 100644 index d7be5eb187..0000000000 --- a/OOXML/PPTXFormat/Presentation/SldSz.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "SldSz.h" - -namespace PPTX -{ - namespace nsPresentation - { - void SldSz::fromXML(XmlUtils::CXmlNode& node) - { - cx = node.ReadAttributeInt(L"cx"); - cy = node.ReadAttributeInt(L"cy"); - - XmlMacroReadAttributeBase(node, L"type", type); - - Normalize(); - } - std::wstring SldSz::toXML() const - { - XmlUtils::CAttribute oAttr; - oAttr.Write(_T("cx"), cx); - oAttr.Write(_T("cy"), cy); - oAttr.WriteLimitNullable(_T("type"), type); - - return XmlUtils::CreateNode(_T("p:sldSz"), oAttr); - } - void SldSz::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const - { - pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); - - pWriter->WriteInt1(0, cx); - pWriter->WriteInt1(1, cy); - pWriter->WriteLimit2(2, type); - - pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); - } - void SldSz::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const - { - pWriter->StartNode(_T("p:sldSz")); - pWriter->StartAttributes(); - pWriter->WriteAttribute(_T("cx"), cx); - pWriter->WriteAttribute(_T("cy"), cy); - pWriter->WriteAttribute(_T("type"), type); - pWriter->EndAttributes(); - pWriter->EndNode(_T("p:sldSz")); - } - void SldSz::FillParentPointersForChilds() - { - } - void SldSz::Normalize() - { - cx = (std::min)((std::max)(cx, 914400), 51206400); - cy = (std::min)((std::max)(cy, 914400), 51206400); - } - } // namespace nsPresentation -} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/SldSz.h b/OOXML/PPTXFormat/Presentation/SldSz.h deleted file mode 100644 index c0be8951e0..0000000000 --- a/OOXML/PPTXFormat/Presentation/SldSz.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once -#ifndef PPTX_PRESENTATION_SLDSZ_INCLUDE_H_ -#define PPTX_PRESENTATION_SLDSZ_INCLUDE_H_ - -#include "./../WrapperWritingElement.h" -#include "./../Limit/SlideSize.h" - -namespace PPTX -{ - namespace nsPresentation - { - class SldSz : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(SldSz) - - public: - virtual void fromXML(XmlUtils::CXmlNode& node); - virtual std::wstring toXML() const; - - virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; - virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; - - public: - int cx; - int cy; - nullable_limit type; - - protected: - virtual void FillParentPointersForChilds(); - void Normalize(); - }; - } // namespace nsPresentation -} // namespace PPTX - -#endif // PPTX_PRESENTATION_SLDSZ_INCLUDE_H_ diff --git a/OOXML/PPTXFormat/ShowPr/Browse.cpp b/OOXML/PPTXFormat/ShowPr/Browse.cpp index cf6d0d16df..141337ced6 100644 --- a/OOXML/PPTXFormat/ShowPr/Browse.cpp +++ b/OOXML/PPTXFormat/ShowPr/Browse.cpp @@ -34,7 +34,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { void Browse::fromXML(XmlUtils::CXmlNode& node) { @@ -88,5 +88,5 @@ namespace PPTX void Browse::FillParentPointersForChilds() { } - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/Browse.h b/OOXML/PPTXFormat/ShowPr/Browse.h index 3f3c763331..4efe2ea515 100644 --- a/OOXML/PPTXFormat/ShowPr/Browse.h +++ b/OOXML/PPTXFormat/ShowPr/Browse.h @@ -35,7 +35,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { class Browse : public WrapperWritingElement { @@ -55,6 +55,6 @@ namespace PPTX protected: virtual void FillParentPointersForChilds(); }; - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/CustShow.cpp b/OOXML/PPTXFormat/ShowPr/CustomShowId.cpp similarity index 76% rename from OOXML/PPTXFormat/ShowPr/CustShow.cpp rename to OOXML/PPTXFormat/ShowPr/CustomShowId.cpp index 1d8847541e..638aa7e72c 100644 --- a/OOXML/PPTXFormat/ShowPr/CustShow.cpp +++ b/OOXML/PPTXFormat/ShowPr/CustomShowId.cpp @@ -30,42 +30,42 @@ * */ -#include "CustShow.h" +#include "CustomShowId.h" namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { - void CustShow::fromXML(XmlUtils::CXmlNode& node) + void CustomShowId::fromXML(XmlUtils::CXmlNode& node) { - XmlMacroReadAttributeBase(node, _T("id"), id); + XmlMacroReadAttributeBase(node, L"id", id); } - std::wstring CustShow::toXML() const + std::wstring CustomShowId::toXML() const { XmlUtils::CAttribute oAttr; - oAttr.Write(_T("id"), id); + oAttr.Write(L"id", id); - return XmlUtils::CreateNode(_T("p:custShow"), oAttr); + return XmlUtils::CreateNode(L"p:custShow", oAttr); } - void CustShow::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + void CustomShowId::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const { pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); pWriter->WriteInt2(0, id); pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); } - void CustShow::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + void CustomShowId::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - pWriter->StartNode(_T("p:custShow")); + pWriter->StartNode(L"p:custShow"); pWriter->StartAttributes(); - pWriter->WriteAttribute(_T("id"), id); + pWriter->WriteAttribute(L"id", id); pWriter->EndAttributes(); - pWriter->EndNode(_T("p:custShow")); + pWriter->EndNode(L"p:custShow"); } - void CustShow::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) + void CustomShowId::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) { LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4; @@ -85,8 +85,8 @@ namespace PPTX pReader->Seek(_end_rec); } - void CustShow::FillParentPointersForChilds() + void CustomShowId::FillParentPointersForChilds() { } - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/CustShow.h b/OOXML/PPTXFormat/ShowPr/CustomShowId.h similarity index 93% rename from OOXML/PPTXFormat/ShowPr/CustShow.h rename to OOXML/PPTXFormat/ShowPr/CustomShowId.h index 5464ef3800..1e6237e3c3 100644 --- a/OOXML/PPTXFormat/ShowPr/CustShow.h +++ b/OOXML/PPTXFormat/ShowPr/CustomShowId.h @@ -35,12 +35,12 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { - class CustShow : public WrapperWritingElement + class CustomShowId : public WrapperWritingElement { public: - PPTX_LOGIC_BASE(CustShow) + PPTX_LOGIC_BASE(CustomShowId) virtual void fromXML(XmlUtils::CXmlNode& node); virtual std::wstring toXML() const; @@ -54,5 +54,5 @@ namespace PPTX protected: virtual void FillParentPointersForChilds(); }; - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/Kiosk.cpp b/OOXML/PPTXFormat/ShowPr/Kiosk.cpp index d669071604..19373a48bb 100644 --- a/OOXML/PPTXFormat/ShowPr/Kiosk.cpp +++ b/OOXML/PPTXFormat/ShowPr/Kiosk.cpp @@ -34,7 +34,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { void Kiosk::fromXML(XmlUtils::CXmlNode& node) { @@ -88,5 +88,5 @@ namespace PPTX void Kiosk::FillParentPointersForChilds() { } - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/Kiosk.h b/OOXML/PPTXFormat/ShowPr/Kiosk.h index 5063ab1f7d..eb0b8729df 100644 --- a/OOXML/PPTXFormat/ShowPr/Kiosk.h +++ b/OOXML/PPTXFormat/ShowPr/Kiosk.h @@ -35,7 +35,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { class Kiosk : public WrapperWritingElement { @@ -54,5 +54,5 @@ namespace PPTX protected: virtual void FillParentPointersForChilds(); }; - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/Present.cpp b/OOXML/PPTXFormat/ShowPr/Present.cpp index 4a4a58d6ab..eae17e076a 100644 --- a/OOXML/PPTXFormat/ShowPr/Present.cpp +++ b/OOXML/PPTXFormat/ShowPr/Present.cpp @@ -34,7 +34,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { void Present::fromXML(XmlUtils::CXmlNode& node) { @@ -53,5 +53,5 @@ namespace PPTX void Present::FillParentPointersForChilds() { } - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/Present.h b/OOXML/PPTXFormat/ShowPr/Present.h index 5ffa218cbd..81591e94cf 100644 --- a/OOXML/PPTXFormat/ShowPr/Present.h +++ b/OOXML/PPTXFormat/ShowPr/Present.h @@ -35,7 +35,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { class Present : public WrapperWritingElement { @@ -51,5 +51,5 @@ namespace PPTX protected: virtual void FillParentPointersForChilds(); }; - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/PresentationPr.cpp b/OOXML/PPTXFormat/ShowPr/PresentationPr.cpp index c9185ae035..0ee6e53500 100644 --- a/OOXML/PPTXFormat/ShowPr/PresentationPr.cpp +++ b/OOXML/PPTXFormat/ShowPr/PresentationPr.cpp @@ -33,7 +33,7 @@ #include "PresentationPr.h" #include "./Browse.h" -#include "./CustShow.h" +#include "./CustomShowId.h" #include "./Kiosk.h" #include "./Present.h" #include "./SldAll.h" @@ -41,7 +41,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { void ShowPr::fromXML(XmlUtils::CXmlNode& node) { @@ -51,7 +51,7 @@ namespace PPTX XmlMacroReadAttributeBase(node, L"useTimings", useTimings); Browse = node.ReadNodeNoNS(L"browse"); - CustShow = node.ReadNodeNoNS(L"custShow"); + CustomShowId = node.ReadNodeNoNS(L"custShow"); Kiosk = node.ReadNodeNoNS(L"kiosk"); XmlUtils::CXmlNode node1 = node.ReadNodeNoNS(L"penClr"); PenClr.GetColorFrom(node1); @@ -73,7 +73,7 @@ namespace PPTX oValue.WriteNullable(Kiosk); oValue.WriteNullable(SldAll); oValue.WriteNullable(SldRg); - oValue.WriteNullable(CustShow); + oValue.WriteNullable(CustomShowId); oValue.Write(PenClr); return XmlUtils::CreateNode(L"p:ShowPr", oAttr, oValue); @@ -88,7 +88,7 @@ namespace PPTX pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); pWriter->WriteRecord2(0, Browse); - pWriter->WriteRecord2(1, CustShow); + pWriter->WriteRecord2(1, CustomShowId); pWriter->WriteRecord2(2, Kiosk); pWriter->WriteRecord1(3, PenClr); pWriter->WriteRecord2(4, Present); @@ -113,7 +113,7 @@ namespace PPTX pWriter->Write(Kiosk); pWriter->Write(SldAll); pWriter->Write(SldRg); - pWriter->Write(CustShow); + pWriter->Write(CustomShowId); if(PenClr.is_init()) { pWriter->WriteString(L""); @@ -154,19 +154,19 @@ namespace PPTX { case 0: { - Browse = new nsPresentationPr::Browse(); + Browse = new nsPresentation::Browse(); Browse->fromPPTY(pReader); break; } case 1: { - CustShow = new nsPresentationPr::CustShow(); - CustShow->fromPPTY(pReader); + CustomShowId = new nsPresentation::CustomShowId(); + CustomShowId->fromPPTY(pReader); break; } case 2: { - Kiosk = new nsPresentationPr::Kiosk(); + Kiosk = new nsPresentation::Kiosk(); Kiosk->fromPPTY(pReader); break; } @@ -177,19 +177,19 @@ namespace PPTX } case 4: { - Present = new nsPresentationPr::Present(); + Present = new nsPresentation::Present(); pReader->SkipRecord(); break; } case 5: { - SldAll = new nsPresentationPr::SldAll(); + SldAll = new nsPresentation::SldAll(); pReader->SkipRecord(); break; } case 6: { - SldRg = new nsPresentationPr::SldRg(); + SldRg = new nsPresentation::SldRg(); SldRg->fromPPTY(pReader); break; } @@ -292,5 +292,5 @@ namespace PPTX void PrintPr::FillParentPointersForChilds() { } - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/PresentationPr.h b/OOXML/PPTXFormat/ShowPr/PresentationPr.h index ad05a4b93a..899f85fc45 100644 --- a/OOXML/PPTXFormat/ShowPr/PresentationPr.h +++ b/OOXML/PPTXFormat/ShowPr/PresentationPr.h @@ -35,10 +35,11 @@ #include "../Logic/UniColor.h" #include "../Limit/BWMode.h" #include "../Logic/ExtP.h" +#include "./CustomShowId.h" namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { class Browse; class CustShow; @@ -59,13 +60,13 @@ namespace PPTX virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); - nullable Browse; - nullable CustShow; - nullable Kiosk; + nullable Browse; + nullable CustomShowId; + nullable Kiosk; Logic::UniColor PenClr; - nullable Present; - nullable SldAll; - nullable SldRg; + nullable Present; + nullable SldAll; + nullable SldRg; nullable_bool loop; nullable_bool showAnimation; @@ -99,6 +100,6 @@ namespace PPTX protected: virtual void FillParentPointersForChilds(); }; - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/SldAll.cpp b/OOXML/PPTXFormat/ShowPr/SldAll.cpp index 35d849886c..2cf0e6021a 100644 --- a/OOXML/PPTXFormat/ShowPr/SldAll.cpp +++ b/OOXML/PPTXFormat/ShowPr/SldAll.cpp @@ -34,7 +34,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { void SldAll::fromXML(XmlUtils::CXmlNode& node) { @@ -53,5 +53,5 @@ namespace PPTX void SldAll::FillParentPointersForChilds() { } - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/SldAll.h b/OOXML/PPTXFormat/ShowPr/SldAll.h index d8a8b7e0a9..9ffeb471e6 100644 --- a/OOXML/PPTXFormat/ShowPr/SldAll.h +++ b/OOXML/PPTXFormat/ShowPr/SldAll.h @@ -35,7 +35,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { class SldAll : public WrapperWritingElement { @@ -51,5 +51,5 @@ namespace PPTX protected: virtual void FillParentPointersForChilds(); }; - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/SldRg.cpp b/OOXML/PPTXFormat/ShowPr/SldRg.cpp index a189c07db8..b4d66891f9 100644 --- a/OOXML/PPTXFormat/ShowPr/SldRg.cpp +++ b/OOXML/PPTXFormat/ShowPr/SldRg.cpp @@ -34,7 +34,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { void SldRg::fromXML(XmlUtils::CXmlNode& node) { @@ -94,5 +94,5 @@ namespace PPTX void SldRg::FillParentPointersForChilds() { } - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/SldRg.h b/OOXML/PPTXFormat/ShowPr/SldRg.h index c3316cc6e2..96044c3fde 100644 --- a/OOXML/PPTXFormat/ShowPr/SldRg.h +++ b/OOXML/PPTXFormat/ShowPr/SldRg.h @@ -35,7 +35,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { class SldRg : public WrapperWritingElement { @@ -55,5 +55,5 @@ namespace PPTX protected: virtual void FillParentPointersForChilds(); }; - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ViewProps/OutlineViewPr.cpp b/OOXML/PPTXFormat/ViewProps/OutlineViewPr.cpp index 9ebb481790..4dcfb4ede1 100644 --- a/OOXML/PPTXFormat/ViewProps/OutlineViewPr.cpp +++ b/OOXML/PPTXFormat/ViewProps/OutlineViewPr.cpp @@ -36,6 +36,70 @@ namespace PPTX { namespace nsViewProps { + void Sld::fromXML(XmlUtils::CXmlNode& node) + { + XmlMacroReadAttributeBase(node, L"id", id); + XmlMacroReadAttributeBase(node, L"collapse", collapse); + } + std::wstring Sld::toXML() const + { + XmlUtils::CAttribute oAttr; + oAttr.Write(_T("id"), id); + oAttr.Write(_T("collapse"), collapse); + + return XmlUtils::CreateNode(_T("p:sld"), oAttr); + } + void Sld::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); + + pWriter->WriteString2(0, id); + pWriter->WriteBool2(1, collapse); + + pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); + } + void Sld::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) + { + LONG _end_rec = pReader->GetPos() + pReader->GetRecordSize() + 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: + { + collapse = pReader->GetBool(); + }break; + default: + break; + } + } + pReader->Seek(_end_rec); + } + void Sld::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + { + pWriter->StartNode(_T("p:sld")); + + pWriter->StartAttributes(); + pWriter->WriteAttribute(_T("id"), id); + pWriter->WriteAttribute(_T("collapse"), collapse); + pWriter->EndAttributes(); + + pWriter->EndNode(_T("p:sld")); + } + void Sld::FillParentPointersForChilds() + { + } +//----------------------------------------------------------------------------------------------------------------------------- OutlineViewPr& OutlineViewPr::operator=(const OutlineViewPr& oSrc) { parentFile = oSrc.parentFile; diff --git a/OOXML/PPTXFormat/ViewProps/OutlineViewPr.h b/OOXML/PPTXFormat/ViewProps/OutlineViewPr.h index e1f64dd487..12471e522a 100644 --- a/OOXML/PPTXFormat/ViewProps/OutlineViewPr.h +++ b/OOXML/PPTXFormat/ViewProps/OutlineViewPr.h @@ -33,12 +33,30 @@ #include "./../WrapperWritingElement.h" #include "CViewPr.h" -#include "Sld.h" namespace PPTX { namespace nsViewProps { + class Sld : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(Sld) + + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); + virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + + nullable_string id; + nullable_bool collapse; + + protected: + virtual void FillParentPointersForChilds(); + }; + class OutlineViewPr : public WrapperWritingElement { public: diff --git a/OOXML/PPTXFormat/ViewProps/Sld.cpp b/OOXML/PPTXFormat/ViewProps/Sld.cpp deleted file mode 100644 index d0bdc18832..0000000000 --- a/OOXML/PPTXFormat/ViewProps/Sld.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "Sld.h" - -namespace PPTX -{ - namespace nsViewProps - { - void Sld::fromXML(XmlUtils::CXmlNode& node) - { - XmlMacroReadAttributeBase(node, L"id", id); - XmlMacroReadAttributeBase(node, L"collapse", collapse); - } - std::wstring Sld::toXML() const - { - XmlUtils::CAttribute oAttr; - oAttr.Write(_T("id"), id); - oAttr.Write(_T("collapse"), collapse); - - return XmlUtils::CreateNode(_T("p:sld"), oAttr); - } - void Sld::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const - { - pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); - - pWriter->WriteString2(0, id); - pWriter->WriteBool2(1, collapse); - - pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); - } - void Sld::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) - { - LONG _end_rec = pReader->GetPos() + pReader->GetRecordSize() + 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: - { - collapse = pReader->GetBool(); - }break; - default: - break; - } - } - pReader->Seek(_end_rec); - } - void Sld::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const - { - pWriter->StartNode(_T("p:sld")); - - pWriter->StartAttributes(); - pWriter->WriteAttribute(_T("id"), id); - pWriter->WriteAttribute(_T("collapse"), collapse); - pWriter->EndAttributes(); - - pWriter->EndNode(_T("p:sld")); - } - void Sld::FillParentPointersForChilds() - { - } - } // namespace nsViewProps -} // namespace PPTX - diff --git a/OOXML/PPTXFormat/ViewProps/Sld.h b/OOXML/PPTXFormat/ViewProps/Sld.h deleted file mode 100644 index 0b0bc242fb..0000000000 --- a/OOXML/PPTXFormat/ViewProps/Sld.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "./../WrapperWritingElement.h" -#include "./../Limit/Orient.h" - -namespace PPTX -{ - namespace nsViewProps - { - class Sld : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(Sld) - - virtual void fromXML(XmlUtils::CXmlNode& node); - virtual std::wstring toXML() const; - - virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; - virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); - virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; - - nullable_string id; - nullable_bool collapse; - - protected: - virtual void FillParentPointersForChilds(); - }; - } // namespace nsViewProps -} // namespace PPTX - diff --git a/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro b/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro index 182a0505f2..f339dd4034 100644 --- a/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro +++ b/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro @@ -96,7 +96,6 @@ SOURCES += \ ../../../PPTXFormat/ViewProps/Ratio.cpp \ ../../../PPTXFormat/ViewProps/Restored.cpp \ ../../../PPTXFormat/ViewProps/Scale.cpp \ - ../../../PPTXFormat/ViewProps/Sld.cpp \ ../../../PPTXFormat/ViewProps/SlideViewPr.cpp \ ../../../PPTXFormat/ViewProps/SorterViewPr.cpp \ \ @@ -110,18 +109,12 @@ SOURCES += \ ../../../PPTXFormat/ShowPr/PresentationPr.cpp \ ../../../PPTXFormat/ShowPr/Present.cpp \ ../../../PPTXFormat/ShowPr/Kiosk.cpp \ - ../../../PPTXFormat/ShowPr/CustShow.cpp \ + ../../../PPTXFormat/ShowPr/CustomShowId.cpp \ ../../../PPTXFormat/ShowPr/Browse.cpp \ ../../../PPTXFormat/ShowPr/SldRg.cpp \ ../../../PPTXFormat/ShowPr/SldAll.cpp \ \ - ../../../PPTXFormat/Presentation/NotesSz.cpp \ - ../../../PPTXFormat/Presentation/PhotoAlbum.cpp \ - ../../../PPTXFormat/Presentation/EmbeddedFont.cpp \ - ../../../PPTXFormat/Presentation/EmbeddedFontDataId.cpp \ - ../../../PPTXFormat/Presentation/Kinsoku.cpp \ - ../../../PPTXFormat/Presentation/SectionLst.cpp \ - ../../../PPTXFormat/Presentation/SldSz.cpp + ../../../PPTXFormat/Presentation/PresentationChildElements.cpp HEADERS += \ pptx_format.h \ @@ -155,12 +148,7 @@ HEADERS += \ ../../../PPTXFormat/DrawingConverter/ASCOfficeDrawingConverter.h \ ../../../PPTXFormat/DrawingConverter/ASCOfficePPTXFile.h \ \ - ../../../PPTXFormat/Presentation/EmbeddedFont.h \ - ../../../PPTXFormat/Presentation/EmbeddedFontDataId.h \ - ../../../PPTXFormat/Presentation/Kinsoku.h \ - ../../../PPTXFormat/Presentation/NotesSz.h \ - ../../../PPTXFormat/Presentation/PhotoAlbum.h \ - ../../../PPTXFormat/Presentation/SldSz.h \ + ../../../PPTXFormat/Presentation/PresentationChildElements.h \ \ ../../../PPTXFormat/Theme/ClrScheme.h \ ../../../PPTXFormat/Theme/ExtraClrScheme.h \ @@ -181,7 +169,6 @@ HEADERS += \ ../../../PPTXFormat/ViewProps/Ratio.h \ ../../../PPTXFormat/ViewProps/Restored.h \ ../../../PPTXFormat/ViewProps/Scale.h \ - ../../../PPTXFormat/ViewProps/Sld.h \ ../../../PPTXFormat/ViewProps/SlideViewPr.h \ ../../../PPTXFormat/ViewProps/SorterViewPr.h \ \ @@ -199,7 +186,7 @@ HEADERS += \ ../../../Binary/Presentation/DefaultNotesTheme.h \ \ ../../../PPTXFormat/ShowPr/Browse.h \ - ../../../PPTXFormat/ShowPr/CustShow.h \ + ../../../PPTXFormat/ShowPr/CustomShowId.h \ ../../../PPTXFormat/ShowPr/Kiosk.h \ ../../../PPTXFormat/ShowPr/Present.h \ ../../../PPTXFormat/ShowPr/PresentationPr.h \ diff --git a/OOXML/Projects/Windows/PPTXFormatLib/PPTXFormat.vcxproj b/OOXML/Projects/Windows/PPTXFormatLib/PPTXFormat.vcxproj index bfed147632..6b50a09fd3 100644 --- a/OOXML/Projects/Windows/PPTXFormatLib/PPTXFormat.vcxproj +++ b/OOXML/Projects/Windows/PPTXFormatLib/PPTXFormat.vcxproj @@ -623,16 +623,10 @@ - - - - - - - + - + @@ -662,7 +656,6 @@ - @@ -1254,16 +1247,10 @@ - - - - - - - + - + @@ -1293,7 +1280,6 @@ - diff --git a/OOXML/Projects/Windows/PPTXFormatLib/PPTXFormat.vcxproj.filters b/OOXML/Projects/Windows/PPTXFormatLib/PPTXFormat.vcxproj.filters index 2e2a4ba88d..b82060a2bb 100644 --- a/OOXML/Projects/Windows/PPTXFormatLib/PPTXFormat.vcxproj.filters +++ b/OOXML/Projects/Windows/PPTXFormatLib/PPTXFormat.vcxproj.filters @@ -685,31 +685,13 @@ Logic\Transition - - Presentation - - - Presentation - - - Presentation - - - Presentation - - - Presentation - - - Presentation - - + Presentation PresentationPr - + PresentationPr @@ -778,9 +760,6 @@ ViewProps - - ViewProps - ViewProps @@ -2451,31 +2430,13 @@ Logic - - Presentation - - - Presentation - - - Presentation - - - Presentation - - - Presentation - - - Presentation - - + Presentation PresentationPr - + PresentationPr @@ -2514,9 +2475,6 @@ ViewProps - - ViewProps - ViewProps diff --git a/OdfFile/Writer/Converter/PptxConverter.cpp b/OdfFile/Writer/Converter/PptxConverter.cpp index 4bc2d877ef..778cee8345 100644 --- a/OdfFile/Writer/Converter/PptxConverter.cpp +++ b/OdfFile/Writer/Converter/PptxConverter.cpp @@ -74,8 +74,7 @@ #include "../../../OOXML/PPTXFormat/Logic/Transitions/SplitTransition.h" #include "../../../OOXML/PPTXFormat/Logic/Transitions/ZoomTransition.h" -#include "../../../OOXML/PPTXFormat/Presentation/SldSz.h" -#include "../../../OOXML/PPTXFormat/Presentation/NotesSz.h" +#include "../../../OOXML/PPTXFormat/Presentation/PresentationChildElements.h" #include "../../../OOXML/DocxFormat/Core.h" #include "../../../OOXML/DocxFormat/App.h"