diff --git a/MsBinaryFile/Common/Vml/PPTShape/CustomGeomShape.h b/MsBinaryFile/Common/Vml/PPTShape/CustomGeomShape.h index 30fdac5486..87980aec8a 100644 --- a/MsBinaryFile/Common/Vml/PPTShape/CustomGeomShape.h +++ b/MsBinaryFile/Common/Vml/PPTShape/CustomGeomShape.h @@ -35,20 +35,18 @@ #include "../BaseShape.h" #include "../../../PptFile/Drawing/Attributes.h" #include "PptFormula.h" +#include "../GraphicsPath.h" namespace NSCustomVML { - using namespace PPT_FORMAT; - using namespace NSGuidesVML; - class CSegment { public: - RulesType m_eRuler; - WORD m_nCount; + ODRAW::RulesType m_eRuler; + WORD m_nCount; public: - CSegment(RulesType eType = rtMoveTo, WORD nCount = 2) + CSegment(ODRAW::RulesType eType = ODRAW::rtMoveTo, WORD nCount = 2) { m_eRuler = eType; m_nCount = nCount; @@ -84,37 +82,37 @@ namespace NSCustomVML switch (value) { case 0x0001: // lineto - m_eRuler = rtLineTo; + m_eRuler = ODRAW::rtLineTo; m_nCount = 1; break; case 0x4000: // moveto - m_eRuler = rtMoveTo; + m_eRuler = ODRAW::rtMoveTo; m_nCount = 1; break; case 0x2000: // curveto - m_eRuler = rtCurveTo; + m_eRuler = ODRAW::rtCurveTo; m_nCount = 3; break; case 0xb300: // arcto - m_eRuler = rtArc; + m_eRuler = ODRAW::rtArc; m_nCount = 2; break; case 0xac00: case 0xaa00: // nofill case 0xad00: - m_eRuler = rtNoFill; + m_eRuler = ODRAW::rtNoFill; break; case 0xab00: // nostroke - m_eRuler = rtNoStroke; + m_eRuler = ODRAW::rtNoStroke; break; case 0x6001: // close - m_eRuler = rtClose; + m_eRuler = ODRAW::rtClose; break; case 0x8000: // end - m_eRuler = rtEnd; + m_eRuler = ODRAW::rtEnd; break; default: // given number of lineto elements - m_eRuler = rtLineTo; + m_eRuler = ODRAW::rtLineTo; m_nCount = value; break; } @@ -127,7 +125,7 @@ namespace NSCustomVML if (type <= 4) { - m_eRuler = (RulesType)type; + m_eRuler = (ODRAW::RulesType)type; m_nCount = (mem >> 3) & 0x1FFF; return; } @@ -139,77 +137,77 @@ namespace NSCustomVML { case 0x00: { - m_eRuler = rtLineTo; + m_eRuler = ODRAW::rtLineTo; break; } case 0x01: { - m_eRuler = rtAngleEllipseTo; + m_eRuler = ODRAW::rtAngleEllipseTo; break; } case 0x02: { - m_eRuler = rtAngleEllipse; + m_eRuler = ODRAW::rtAngleEllipse; break; } case 0x03: { - m_eRuler = rtArcTo; + m_eRuler = ODRAW::rtArcTo; break; } case 0x04: { - m_eRuler = rtArc; + m_eRuler = ODRAW::rtArc; break; } case 0x05: { - m_eRuler = rtClockwiseArcTo; + m_eRuler = ODRAW::rtClockwiseArcTo; break; } case 0x06: { - m_eRuler = rtClockwiseArc; + m_eRuler = ODRAW::rtClockwiseArc; break; } case 0x07: { - m_eRuler = rtEllipticalQuadrX; + m_eRuler = ODRAW::rtEllipticalQuadrX; break; } case 0x08: { - m_eRuler = rtEllipticalQuadrY; + m_eRuler = ODRAW::rtEllipticalQuadrY; break; } case 0x09: { - m_eRuler = rtQuadrBesier; + m_eRuler = ODRAW::rtQuadrBesier; break; } case 0x0A: { - m_eRuler = rtNoFill; + m_eRuler = ODRAW::rtNoFill; break; } case 0x0B: { - m_eRuler = rtNoStroke; + m_eRuler = ODRAW::rtNoStroke; break; } case 0x15: { - m_eRuler = rtFillColor; + m_eRuler = ODRAW::rtFillColor; break; } case 0x16: { - m_eRuler = rtLineColor; + m_eRuler = ODRAW::rtLineColor; break; } default: { - m_eRuler = rtCurveTo; + m_eRuler = ODRAW::rtCurveTo; } }; @@ -222,7 +220,7 @@ namespace NSCustomVML BYTE type = (mem >> 13 & 0x07); if (type <= 4) { - m_eRuler = (RulesType)type; + m_eRuler = (ODRAW::RulesType)type; m_nCount = (mem & 0x1FFF); m_nCount = (WORD)GetCountPoints2(m_eRuler, m_nCount); return; @@ -235,68 +233,68 @@ namespace NSCustomVML { case 0x00: { - m_eRuler = rtLineTo; + m_eRuler = ODRAW::rtLineTo; break; } case 0x01: { - m_eRuler = rtAngleEllipseTo; + m_eRuler = ODRAW::rtAngleEllipseTo; break; } case 0x02: { - m_eRuler = rtAngleEllipse; + m_eRuler = ODRAW::rtAngleEllipse; break; } case 0x03: { - m_eRuler = rtArcTo; + m_eRuler = ODRAW::rtArcTo; break; } case 0x04: { - m_eRuler = rtArc; + m_eRuler = ODRAW::rtArc; break; } case 0x05: { - m_eRuler = rtClockwiseArcTo; + m_eRuler = ODRAW::rtClockwiseArcTo; break; } case 0x06: { - m_eRuler = rtClockwiseArc; + m_eRuler = ODRAW::rtClockwiseArc; break; } case 0x07: { - m_eRuler = rtEllipticalQuadrX; + m_eRuler = ODRAW::rtEllipticalQuadrX; break; } case 0x08: { - m_eRuler = rtEllipticalQuadrY; + m_eRuler = ODRAW::rtEllipticalQuadrY; break; } case 0x09: { - m_eRuler = rtQuadrBesier; + m_eRuler = ODRAW::rtQuadrBesier; break; } case 0x0A: { - m_eRuler = rtNoFill; + m_eRuler = ODRAW::rtNoFill; break; } case 0x0B: { - m_eRuler = rtNoStroke; + m_eRuler = ODRAW::rtNoStroke; break; } case 0x0C: case 0x10: { - m_eRuler = rtLineTo; + m_eRuler = ODRAW::rtLineTo; break; } case 0x0D: @@ -307,22 +305,22 @@ namespace NSCustomVML case 0x13: case 0x14: { - m_eRuler = rtCurveTo; + m_eRuler = ODRAW::rtCurveTo; break; } case 0x15: { - m_eRuler = rtFillColor; + m_eRuler = ODRAW::rtFillColor; break; } case 0x16: { - m_eRuler = rtLineColor; + m_eRuler = ODRAW::rtLineColor; break; } default: { - m_eRuler = rtCurveTo; + m_eRuler = ODRAW::rtCurveTo; } }; @@ -335,7 +333,7 @@ namespace NSCustomVML class CGuide { public: - FormulaType m_eType; + NSGuidesVML::FormulaType m_eType; BYTE m_param_type1; BYTE m_param_type2; @@ -351,7 +349,7 @@ namespace NSCustomVML CGuide() { - m_eType = ftVal; + m_eType = NSGuidesVML::ftVal; m_param_type1 = 0; m_param_type2 = 0; @@ -401,7 +399,7 @@ namespace NSCustomVML { WORD ftType = StreamUtils::ReadWORD(pStream); - m_eType = FormulaType(ftType & 0x1FFF); + m_eType = NSGuidesVML::FormulaType(ftType & 0x1FFF); m_param_type1 = (BYTE)(ftType & 0x04); m_param_type2 = (BYTE)(ftType & 0x02); @@ -415,7 +413,7 @@ namespace NSCustomVML { WORD ftType = oReader.ReadWORD(); - m_eType = FormulaType(ftType & 0x1FFF); + m_eType = NSGuidesVML::FormulaType(ftType & 0x1FFF); m_param_type1 = (BYTE)(ftType & 0x04); m_param_type2 = (BYTE)(ftType & 0x02); @@ -482,7 +480,7 @@ namespace NSCustomVML class CCustomVML { private: - RulesType m_ePath; + ODRAW::RulesType m_ePath; std::vector m_arVertices; std::vector m_arSegments; @@ -495,13 +493,13 @@ namespace NSCustomVML bool m_bIsVerticesPresent; bool m_bIsPathPresent; - CBrush m_oBrush; - CPen m_oPen; + ODRAW::CBrush m_oBrush; + ODRAW::CPen m_oPen; public: CCustomVML() : m_pAdjustValues(NULL) { - m_ePath = rtCurveTo/*rtLineTo*/; + m_ePath = ODRAW::rtCurveTo/*rtLineTo*/; m_bIsVerticesPresent = false; m_bIsPathPresent = false; @@ -545,7 +543,7 @@ namespace NSCustomVML return (m_bIsVerticesPresent && m_bIsPathPresent); } - void SetPath(RulesType ePath) + void SetPath(ODRAW::RulesType ePath) { m_ePath = ePath; m_bIsPathPresent = true; @@ -706,10 +704,10 @@ namespace NSCustomVML if (0 == oInfo.m_nCount) { - if ((rtEnd != oInfo.m_eRuler) && - (rtNoFill != oInfo.m_eRuler) && - (rtNoStroke != oInfo.m_eRuler) && - (rtClose != oInfo.m_eRuler)) + if ((ODRAW::rtEnd != oInfo.m_eRuler) && + (ODRAW::rtNoFill != oInfo.m_eRuler) && + (ODRAW::rtNoStroke != oInfo.m_eRuler) && + (ODRAW::rtClose != oInfo.m_eRuler)) { continue; } @@ -734,10 +732,10 @@ namespace NSCustomVML if (0 == oInfo.m_nCount) { - if ((rtEnd != oInfo.m_eRuler) && - (rtNoFill != oInfo.m_eRuler) && - (rtNoStroke != oInfo.m_eRuler) && - (rtClose != oInfo.m_eRuler)) + if ((ODRAW::rtEnd != oInfo.m_eRuler) && + (ODRAW::rtNoFill != oInfo.m_eRuler) && + (ODRAW::rtNoStroke != oInfo.m_eRuler) && + (ODRAW::rtClose != oInfo.m_eRuler)) { continue; } @@ -817,7 +815,7 @@ namespace NSCustomVML m_pAdjustValues = pList; } - void ToCustomShape(CBaseShape* pShape, NSGuidesVML::CFormulasManager& oManager) + void ToCustomShape(ODRAW::CBaseShape* pShape, NSGuidesVML::CFormulasManager& oManager) { if ((NULL == pShape) || (!IsCustom())) return; @@ -881,21 +879,21 @@ namespace NSCustomVML { if (bBreak) { - if ((rtEnd != m_arSegments[nS].m_eRuler) && - (rtNoFill != m_arSegments[nS].m_eRuler) && - (rtNoStroke != m_arSegments[nS].m_eRuler) && - (rtClose != m_arSegments[nS].m_eRuler)) + if ((ODRAW::rtEnd != m_arSegments[nS].m_eRuler) && + (ODRAW::rtNoFill != m_arSegments[nS].m_eRuler) && + (ODRAW::rtNoStroke != m_arSegments[nS].m_eRuler) && + (ODRAW::rtClose != m_arSegments[nS].m_eRuler)) { strPath += _T("e"); break; } } - if ((rtFillColor == m_arSegments[nS].m_eRuler) || (rtLineColor == m_arSegments[nS].m_eRuler)) + if ((ODRAW::rtFillColor == m_arSegments[nS].m_eRuler) || (ODRAW::rtLineColor == m_arSegments[nS].m_eRuler)) { if (nStart < m_arVertices.size()) { - if (rtFillColor == m_arSegments[nS].m_eRuler) + if (ODRAW::rtFillColor == m_arSegments[nS].m_eRuler) { m_oBrush.Color1 = (_UINT32)m_arVertices[nStart].x; m_oBrush.Color2 = (_UINT32)m_arVertices[nStart].y; diff --git a/MsBinaryFile/Common/Vml/PPTShape/ElementSettings.cpp b/MsBinaryFile/Common/Vml/PPTShape/ElementSettings.cpp new file mode 100644 index 0000000000..dd374c11eb --- /dev/null +++ b/MsBinaryFile/Common/Vml/PPTShape/ElementSettings.cpp @@ -0,0 +1,174 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2019 + * + * 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-12 Ernesta Birznieka-Upisha + * 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 "ElementSettings.h" +#include "../../../../OOXML/SystemUtility/File.h" + +#include "../../../PptFile/Reader/Records.h" +#include "../../../PptFile/Reader/PPTFileDefines.h" + +// это класс, использующийся для передачи свойств объектов, +// например - указатель на картинку... (по PID'у) + +void CProperty::FromStream(POLE::Stream* pStream) +{ + // читаем из стрима... + // только пока без учета bComplex + // т.к. Complex - учитывается в контейнере, хранящем все проперти + USHORT lMem = StreamUtils::ReadWORD(pStream); + m_ePID = (ODRAW::ePropertyId)(lMem & 0x3FFF); + + m_bIsBlip = ((lMem & 0x4000) == 0x4000); + m_bComplex = ((lMem & 0x8000) == 0x8000); + + m_lValue = StreamUtils::ReadDWORD(pStream); +} + +void CProperty::ComplexFromStream(POLE::Stream* pStream) +{ + if (m_bComplex && m_lValue > 0) + { + if (ODRAW::dgmConstrainBounds == m_ePID || + ODRAW::fillShadeColors == m_ePID || + ODRAW::lineDashStyle == m_ePID || + ODRAW::pAdjustHandles == m_ePID || + ODRAW::pConnectionSites == m_ePID || + ODRAW::pConnectionSitesDir == m_ePID || + ODRAW::pInscribe == m_ePID || + ODRAW::pSegmentInfo == m_ePID || + ODRAW::pVertices == m_ePID || + ODRAW::pGuides == m_ePID || + ODRAW::pWrapPolygonVertices == m_ePID || + ODRAW::pRelationTbl == m_ePID || + ODRAW::tableRowProperties == m_ePID || + ODRAW::lineLeftDashStyle == m_ePID || + ODRAW::lineTopDashStyle == m_ePID || + ODRAW::lineRightDashStyle == m_ePID || + ODRAW::lineBottomDashStyle == m_ePID) + { + WORD nElems = StreamUtils::ReadWORD(pStream); + WORD nElemsAlloc = StreamUtils::ReadWORD(pStream); + WORD nElemSize = StreamUtils::ReadWORD(pStream); + + if (0xFFF0 == nElemSize) + { + nElemSize = 4; + m_bIsTruncated = TRUE; + } + + LONG dwSize = nElems * nElemSize; + + if (m_lValue != (dwSize + 6)) + { + bool b = false; + } + + m_lValue = dwSize; + } + + switch (m_ePID) + { + case ODRAW::fillBlip: + { + SRecordHeader oHeader; + if (oHeader.ReadFromStream(pStream) == false) + { + return; + } + switch (oHeader.RecType) + { + case RECORD_TYPE_ESCHER_BLIP_EMF: + case RECORD_TYPE_ESCHER_BLIP_WMF: + case RECORD_TYPE_ESCHER_BLIP_PICT: + case RECORD_TYPE_ESCHER_BLIP_JPEG: + case RECORD_TYPE_ESCHER_BLIP_PNG: + case RECORD_TYPE_ESCHER_BLIP_DIB: + case RECORD_TYPE_ESCHER_BLIP_TIFF: + { + CRecordOfficeArtBlip art_blip; + art_blip.ReadFromStream(oHeader, pStream); + } + } + + }break; + default: + { + if (0 == m_lValue) + { + return; + } + + RELEASEARRAYOBJECTS(m_pOptions); + m_pOptions = new BYTE[m_lValue]; + + ULONG lReadBytes = (ULONG)pStream->read(m_pOptions, m_lValue); + if (lReadBytes != m_lValue) + { + return; + } + } + } + } +} + + +void CProperties::FromStream(POLE::Stream* pStream, long lCount) +{ + m_lCount = lCount; + for (size_t lIndex = 0; lIndex < m_lCount; ++lIndex) + { + CProperty elem; + m_arProperties.push_back(elem); + m_arProperties[lIndex].FromStream(pStream); + } + // теперь читаем дополнительную информацию + // сортировано по pid'ам (но у нас пока просто по-порядку) + for (size_t lIndex = 0; lIndex < m_lCount; ++lIndex) + { + m_arProperties[lIndex].ComplexFromStream(pStream); + } +} + + +size_t CProperties::GetLen() +{ + size_t dwLen = 6 * m_lCount; + for (size_t nIndex = 0; nIndex < m_lCount; ++nIndex) + { + if (m_arProperties[nIndex].m_bComplex) + { + dwLen += m_arProperties[nIndex].m_lValue; + } + } + return dwLen; +} diff --git a/MsBinaryFile/Common/Vml/PPTShape/ElementSettings.h b/MsBinaryFile/Common/Vml/PPTShape/ElementSettings.h index 202c91f838..9d0b175977 100644 --- a/MsBinaryFile/Common/Vml/PPTShape/ElementSettings.h +++ b/MsBinaryFile/Common/Vml/PPTShape/ElementSettings.h @@ -32,9 +32,12 @@ #pragma once #include "../../../PptFile/Records/Drawing/ArtBlip.h" - +#include "../../../../OOXML/Base/Types_32.h" +#include "../../../../Common/3dParty/pole/pole.h" #include "Enums.h" +#include + // это класс, использующийся для передачи свойств объектов, // например - указатель на картинку... (по PID'у) @@ -45,7 +48,7 @@ public: bool m_bIsBlip; bool m_bComplex; _UINT32 m_lValue; - BYTE* m_pOptions; + unsigned char* m_pOptions; // чтобы не плодить классы - это value, когда m_bComplex == true bool m_bIsTruncated; @@ -61,108 +64,11 @@ public: } ~CProperty() { - RELEASEARRAYOBJECTS(m_pOptions); - } - void FromStream(POLE::Stream* pStream) - { - // читаем из стрима... - // только пока без учета bComplex - // т.к. Complex - учитывается в контейнере, хранящем все проперти - USHORT lMem = StreamUtils::ReadWORD(pStream); - m_ePID = (ODRAW::ePropertyId)(lMem & 0x3FFF); - - m_bIsBlip = ((lMem & 0x4000) == 0x4000); - m_bComplex = ((lMem & 0x8000) == 0x8000); - - m_lValue = StreamUtils::ReadDWORD(pStream); - } - - void ComplexFromStream(POLE::Stream* pStream) - { - if (m_bComplex && m_lValue > 0) - { - if (ODRAW::dgmConstrainBounds == m_ePID || - ODRAW::fillShadeColors == m_ePID || - ODRAW::lineDashStyle == m_ePID || - ODRAW::pAdjustHandles == m_ePID || - ODRAW::pConnectionSites == m_ePID || - ODRAW::pConnectionSitesDir == m_ePID || - ODRAW::pInscribe == m_ePID || - ODRAW::pSegmentInfo == m_ePID || - ODRAW::pVertices == m_ePID || - ODRAW::pGuides == m_ePID || - ODRAW::pWrapPolygonVertices == m_ePID || - ODRAW::pRelationTbl == m_ePID || - ODRAW::tableRowProperties == m_ePID || - ODRAW::lineLeftDashStyle == m_ePID || - ODRAW::lineTopDashStyle == m_ePID || - ODRAW::lineRightDashStyle == m_ePID || - ODRAW::lineBottomDashStyle == m_ePID) - { - WORD nElems = StreamUtils::ReadWORD(pStream); - WORD nElemsAlloc = StreamUtils::ReadWORD(pStream); - WORD nElemSize = StreamUtils::ReadWORD(pStream); - - if (0xFFF0 == nElemSize) - { - nElemSize = 4; - m_bIsTruncated = TRUE; - } - - LONG dwSize = nElems * nElemSize; - - if (m_lValue != (dwSize + 6)) - { - bool b = false; - } - - m_lValue = dwSize; - } - - switch( m_ePID ) - { - case ODRAW::fillBlip: - { - SRecordHeader oHeader; - if (oHeader.ReadFromStream(pStream) == false ) - { - return; - } - switch (oHeader.RecType) - { - case RECORD_TYPE_ESCHER_BLIP_EMF: - case RECORD_TYPE_ESCHER_BLIP_WMF: - case RECORD_TYPE_ESCHER_BLIP_PICT: - case RECORD_TYPE_ESCHER_BLIP_JPEG: - case RECORD_TYPE_ESCHER_BLIP_PNG: - case RECORD_TYPE_ESCHER_BLIP_DIB: - case RECORD_TYPE_ESCHER_BLIP_TIFF: - { - CRecordOfficeArtBlip art_blip; - art_blip.ReadFromStream(oHeader, pStream); - } - } - - }break; - default: - { - if (0 == m_lValue) - { - return; - } - - RELEASEARRAYOBJECTS(m_pOptions); - m_pOptions = new BYTE[m_lValue]; - - ULONG lReadBytes = (ULONG)pStream->read(m_pOptions, m_lValue); - if (lReadBytes != m_lValue) - { - return; - } - } - } - } + if (m_pOptions) delete []m_pOptions; + m_pOptions = NULL; } + void FromStream(POLE::Stream* pStream); + void ComplexFromStream(POLE::Stream* pStream); }; // А вот контейнер пропертей @@ -183,34 +89,6 @@ public: m_arProperties.clear(); } - void FromStream(POLE::Stream* pStream, long lCount) - { - m_lCount = lCount; - for (size_t lIndex = 0; lIndex < m_lCount; ++lIndex) - { - CProperty elem; - m_arProperties.push_back(elem); - m_arProperties[lIndex].FromStream(pStream); - } - // теперь читаем дополнительную информацию - // сортировано по pid'ам (но у нас пока просто по-порядку) - for (size_t lIndex = 0; lIndex < m_lCount; ++lIndex) - { - m_arProperties[lIndex].ComplexFromStream(pStream); - } - } - - - size_t GetLen() - { - size_t dwLen = 6 * m_lCount; - for (size_t nIndex = 0; nIndex < m_lCount; ++nIndex) - { - if (m_arProperties[nIndex].m_bComplex) - { - dwLen += m_arProperties[nIndex].m_lValue; - } - } - return dwLen; - } + void FromStream(POLE::Stream* pStream, long lCount); + size_t GetLen(); }; diff --git a/MsBinaryFile/PptFile/Converter/Animation/TimingUtils.cpp b/MsBinaryFile/PptFile/Converter/Animation/TimingUtils.cpp index 817d2d4771..7d70219c32 100644 --- a/MsBinaryFile/PptFile/Converter/Animation/TimingUtils.cpp +++ b/MsBinaryFile/PptFile/Converter/Animation/TimingUtils.cpp @@ -1,5 +1,5 @@ #include "TimingUtils.h" -#include "../../Reader/ExtXmlUtils.h" +#include "../../Reader/ExtXmlUtils.hpp" #include "../../Enums/enums.h" diff --git a/MsBinaryFile/PptFile/Drawing/Element.h b/MsBinaryFile/PptFile/Drawing/Element.h index 32109a0430..a2a13a32fb 100644 --- a/MsBinaryFile/PptFile/Drawing/Element.h +++ b/MsBinaryFile/PptFile/Drawing/Element.h @@ -118,11 +118,108 @@ public: std::vector* m_pParentElements; std::vector m_pChildElements; - CElement(); - virtual ~CElement(); + CElement() + { + m_bIsBackground = false; + m_bHaveAnchor = true; + m_bHidden = false; + + m_bChildAnchorEnabled = false; + m_bAnchorEnabled = false; + m_bGroupAnchorEnabled = false; + + m_lID = -1; + m_lLayoutID = -1; + + m_lPlaceholderID = -1; + m_lPlaceholderType = -1; + m_bPlaceholderSet = false; + m_lPlaceholderSizePreset = -1; + m_lPlaceholderUserStr = -1; + m_nFormatDate = 1; + + m_etType = etShape; + + m_dStartTime = 0.0; + m_dEndTime = 30.0; + + m_dRotate = 0.0; + m_bFlipH = false; + m_bFlipV = false; + m_bLine = true; + m_bIsFilled = true; + + m_pTheme = NULL; + m_pLayout = NULL; + m_pParentElements = NULL; + } + virtual ~CElement() + { + } virtual CElementPtr CreateDublicate() = 0; - virtual void SetProperiesToDublicate(CElementPtr pDublicate); - void NormalizeCoordsByMetric(); + + virtual void SetProperiesToDublicate(CElementPtr pDublicate) + { + if (!pDublicate) + return; + + pDublicate->m_bIsBackground = m_bIsBackground; + pDublicate->m_bHaveAnchor = m_bHaveAnchor; + pDublicate->m_bHidden = m_bHidden; + + pDublicate->m_etType = m_etType; + + pDublicate->m_rcChildAnchor = m_rcChildAnchor; + pDublicate->m_rcAnchor = m_rcAnchor; + pDublicate->m_rcGroupAnchor = m_rcGroupAnchor; + + pDublicate->m_bChildAnchorEnabled = m_bChildAnchorEnabled; + pDublicate->m_bAnchorEnabled = m_bAnchorEnabled; + pDublicate->m_bGroupAnchorEnabled = m_bGroupAnchorEnabled; + + pDublicate->m_dStartTime = m_dStartTime; + pDublicate->m_dEndTime = m_dEndTime; + + pDublicate->m_lID = m_lID; + pDublicate->m_lLayoutID = m_lLayoutID; + + pDublicate->m_arrActions = m_arrActions; + pDublicate->m_oTextActions = m_oTextActions; + pDublicate->m_oAnimations = m_oAnimations; + pDublicate->m_oEffects = m_oEffects; + + pDublicate->m_lPlaceholderID = m_lPlaceholderID; + pDublicate->m_lPlaceholderType = m_lPlaceholderType; + pDublicate->m_bPlaceholderSet = m_bPlaceholderSet; + + pDublicate->m_lPlaceholderSizePreset = m_lPlaceholderSizePreset; + pDublicate->m_lPlaceholderUserStr = m_lPlaceholderUserStr; + pDublicate->m_nFormatDate = m_nFormatDate; + + pDublicate->m_dRotate = m_dRotate; + pDublicate->m_bFlipH = m_bFlipH; + pDublicate->m_bFlipV = m_bFlipV; + pDublicate->m_bLine = m_bLine; + pDublicate->m_bIsFilled = m_bIsFilled; + + pDublicate->m_pTheme = m_pTheme; + pDublicate->m_pLayout = m_pLayout; + + pDublicate->m_oPen = m_oPen; + pDublicate->m_oBrush = m_oBrush; + pDublicate->m_oShadow = m_oShadow; + } + + void NormalizeCoordsByMetric() + { + if (!m_bAnchorEnabled) return; + double dScale = 1587.5; //master to emu + + m_rcAnchor.left = dScale * m_rcAnchor.left; + m_rcAnchor.right = dScale * m_rcAnchor.right; + m_rcAnchor.top = dScale * m_rcAnchor.top; + m_rcAnchor.bottom = dScale * m_rcAnchor.bottom; + } }; } diff --git a/MsBinaryFile/PptFile/Drawing/Elements.cpp b/MsBinaryFile/PptFile/Drawing/Elements.cpp index 6a87ba30be..d6edcf4a05 100644 --- a/MsBinaryFile/PptFile/Drawing/Elements.cpp +++ b/MsBinaryFile/PptFile/Drawing/Elements.cpp @@ -37,105 +37,28 @@ #include "../../../DesktopEditor/raster/ImageFileFormatChecker.h" #endif -CImageElement::CImageElement() : CElement() -{ - m_etType = etPicture; - - m_nAlpha = 0xFF; - - m_bCropEnabled = false; - - m_lcropFromRight = 0; - m_lcropFromLeft = 0; - m_lcropFromTop = 0; - m_lcropFromBottom = 0; - - m_lpictureContrast = 0x10000; - m_lpictureBrightness = 0; - - m_bStretch = true; - m_bTile = false; - m_bOLE = false; - m_bImagePresent = false; - -} - -CImageElement::~CImageElement() -{ -} - -CElementPtr CImageElement::CreateDublicate() -{ - CImageElement* pImageElement = new CImageElement(); - - CElementPtr pElement = CElementPtr( pImageElement ); - - SetProperiesToDublicate(pElement); - - pImageElement->m_strImageFileName = m_strImageFileName; - pImageElement->m_nAlpha = m_nAlpha; - - pImageElement->m_bCropEnabled = m_bCropEnabled; - - pImageElement->m_lcropFromRight = m_lcropFromRight; - pImageElement->m_lcropFromLeft = m_lcropFromLeft; - pImageElement->m_lcropFromTop = m_lcropFromTop; - pImageElement->m_lcropFromBottom = m_lcropFromBottom; - - pImageElement->m_bStretch = m_bStretch; - pImageElement->m_bTile = m_bTile; - pImageElement->m_bImagePresent = m_bImagePresent; - pImageElement->m_bOLE = m_bOLE; - - return pElement; -} - -std::wstring CImageElement::ConvertPPTShapeToPPTX(bool bIsNamespace) -{ - NSGuidesVML::CFormParam pParamCoef; - pParamCoef.m_eType = ptValue; - pParamCoef.m_lParam = 65536; - pParamCoef.m_lCoef = 65536; - - return ConvertPPTtoPPTX(/*pPPTShape,*/ pParamCoef, bIsNamespace); -} - -std::wstring CImageElement::ConvertPPTtoPPTX(const CFormParam &pCoef, bool bIsNamespace) -{ - if (bIsNamespace) - { - return _T(""); - } - return _T(""); - - std::wstring strXmlPPTX = bIsNamespace ? _T("") : _T(""); - - strXmlPPTX += _T(""); - return strXmlPPTX; -} - std::wstring PPT_FORMAT::CImageElement::DownloadImage(const std::wstring& strFile) { #ifndef DISABLE_FILE_DOWNLOADER NSNetwork::NSFileTransport::CFileDownloader oDownloader(strFile, true); - if ( oDownloader.DownloadSync() ) - { - m_strImageFileName = oDownloader.GetFilePath(); - - CImageFileFormatChecker checker; - if (false == checker.isImageFile(m_strImageFileName)) - { - m_strImageFileName.clear(); - } - } + if ( oDownloader.DownloadSync() ) + { + m_strImageFileName = oDownloader.GetFilePath(); + + CImageFileFormatChecker checker; + if (false == checker.isImageFile(m_strImageFileName)) + { + m_strImageFileName.clear(); + } + } #endif return m_strImageFileName; } void PPT_FORMAT::CShapeElement::CalculateColor(CColor& oColor, CSlide* pSlide, CTheme* pTheme, CLayout* pLayout) { - LONG lOldIndex = oColor.m_lSchemeIndex; - if (-1 == oColor.m_lSchemeIndex) - return; + LONG lOldIndex = oColor.m_lSchemeIndex; + if (-1 == oColor.m_lSchemeIndex) + return; std::vector* pArray = NULL; @@ -160,347 +83,79 @@ void PPT_FORMAT::CShapeElement::CalculateColor(CColor& oColor, CSlide* pSlide, C oColor.m_lSchemeIndex = lOldIndex; } -std::wstring CShapeElement::ConvertPPTShapeToPPTX(bool bIsNamespace) -{ - CPPTShape* pPPTShape = dynamic_cast(m_pShape->getBaseShape().get()); - if (NULL == pPPTShape) - { - // такого быть не может - return _T(""); - } - - NSGuidesVML::CFormParam pParamCoef; - pParamCoef.m_eType = ptValue; - pParamCoef.m_lParam = 65536; - pParamCoef.m_lCoef = 65536; - - return ConvertPPTtoPPTX(pPPTShape, pParamCoef, bIsNamespace); -} - -#ifndef OPTIMIZE_COMPILE_CONVERT_PPT_TO_PPTX -std::wstring CShapeElement::ConvertPPTtoPPTX(CPPTShape* pPPTShape, const NSGuidesVML::CFormParam& pCoef, bool bIsNamespace = false) -{ - if (pPPTShape->m_eType == PPTShapes::sptCRect) - { - if (bIsNamespace) - { - return _T(""); - } - return _T(""); - } - - std::wstring strXmlPPTX = bIsNamespace ? _T("") : _T(""); - - CFormulaConverter pFormulaConverter; - - //coeff - pFormulaConverter.ConvertCoef ( pCoef ); - - //guids---------------------------------------- - int nGuidCount = pPPTShape->m_oManager.m_arFormulas.size(); - if (0 != nGuidCount) - { - pFormulaConverter.ConvertFormula ( pPPTShape->m_oManager.m_arFormulas); - } - - //path------------------------------------------ - int nPathCount = pPPTShape->m_strPath.GetLength(); - if (0 != nPathCount && pPPTShape->m_eType != 1) - { - pFormulaConverter.ConvertPath (pPPTShape->m_strPath, pPPTShape->m_oPath); - - //string rect - int nRectCount = (int)pPPTShape->m_arStringTextRects.GetCount(); - if (0 != nRectCount) - { - pFormulaConverter.ConvertTextRect ( pPPTShape->m_arStringTextRects[0] ); - } - - int nHandlesCount = pPPTShape->m_arHandles.size(); - int nAdjCount = pPPTShape->m_arAdjustments.size(); - - //handles - if (0 != nHandlesCount || 0 != nAdjCount) - { - pFormulaConverter.ConvertHandle (pPPTShape->m_arHandles, pPPTShape->m_arAdjustments, pPPTShape->m_eType); - } - pFormulaConverter.strGuidsRes = pFormulaConverter.strCoef + pFormulaConverter.strGuidsRes; - - //adj---------------------------- - if (pFormulaConverter.strAdjRes.GetLength() == 0) - strXmlPPTX += _T(""); - else - strXmlPPTX += _T("") + pFormulaConverter.strAdjRes + _T(""); - - //guids-------------------------- - if (pFormulaConverter.strGuidsRes.GetLength() == 0) - strXmlPPTX += _T(""); - else - strXmlPPTX += _T("") + pFormulaConverter.strGuidsRes + _T(""); - - //handles--------------------------- - if (pFormulaConverter.strHandleRes.GetLength() == 0) - strXmlPPTX += _T(""); - else - strXmlPPTX += _T("") + pFormulaConverter.strHandleRes + _T(""); - - //connectors------------------------- - strXmlPPTX += _T(""); - - //textRect--------------------------- - if (pFormulaConverter.strTextRect.GetLength() != 0) - strXmlPPTX += pFormulaConverter.strTextRect; - - //path------------------------------ - strXmlPPTX += _T(""); - strXmlPPTX += pFormulaConverter.strPathRes; - strXmlPPTX += _T(""); - } - - strXmlPPTX += _T(""); - return strXmlPPTX; -} -#else -std::wstring CShapeElement::ConvertPPTtoPPTX(CPPTShape *pPPTShape, const CFormParam &pCoef, bool bIsNamespace) -{ - if (pPPTShape->m_eType == PPTShapes::sptCRect || pPPTShape->m_eType == PPTShapes::sptCFrame || pPPTShape->m_eType == PPTShapes::sptCTextBox) - { - if (bIsNamespace) - { - return _T(""); - } - return _T(""); - } - else if (pPPTShape->m_eType == PPTShapes::sptCLine) - { - if (bIsNamespace) - { - return _T(""); - } - return _T(""); - } - else if (pPPTShape->m_eType == PPTShapes::sptCEllipse) - { - if (bIsNamespace) - { - return _T(""); - } - return _T(""); - } - std::wstring strXmlPPTX = bIsNamespace ? _T("") : _T(""); - - CFormulaConverter pFormulaConverter; - - //coeff - pFormulaConverter.ConvertCoef(pCoef); - - //guids---------------------------------------- - int nGuidCount = (int)pPPTShape->m_oManager.m_arFormulas.size(); - if (0 != nGuidCount) - { - pFormulaConverter.ConvertFormula(pPPTShape->m_oManager.m_arFormulas); - } - - //path------------------------------------------ - int nPathCount = (int)pPPTShape->m_strPath.length(); - if (0 != nPathCount && pPPTShape->m_eType != 1) - { - pFormulaConverter.ConvertPath(pPPTShape->m_strPath, pPPTShape->m_oPath); - - //string rect - int nRectCount = (int)pPPTShape->m_arStringTextRects.size(); - if (0 != nRectCount && !pPPTShape->m_arStringTextRects[0].empty()) - { - if (pPPTShape->m_eType == PPTShapes::sptCNotchedCircularArrow) - { - pFormulaConverter.SetTextRectDefault(); - } - else - { - pFormulaConverter.ConvertTextRect(pPPTShape->m_arStringTextRects[0]); - } - } - - int nHandlesCount = (int)pPPTShape->m_arHandles.size(); - int nAdjCount = (int)pPPTShape->m_arAdjustments.size(); - - //handles - if (0 != nHandlesCount || 0 != nAdjCount) - { - pFormulaConverter.ConvertHandle(pPPTShape->m_arHandles, pPPTShape->m_arAdjustments, pPPTShape->m_eType); - } - - //adj---------------------------- - if (pFormulaConverter.m_oAdjRes.GetSize() == 0) - strXmlPPTX += _T(""); - else - strXmlPPTX += _T("") + pFormulaConverter.m_oAdjRes.GetXmlString() + _T(""); - - //guids-------------------------- - if (pFormulaConverter.m_oGuidsRes.GetSize() == 0) - strXmlPPTX += _T("") + pFormulaConverter.m_oCoef.GetXmlString() + _T(""); - else - strXmlPPTX += _T("") + pFormulaConverter.m_oCoef.GetXmlString() + pFormulaConverter.m_oGuidsRes.GetXmlString() + _T(""); - - //handles--------------------------- - if (pFormulaConverter.m_oHandleRes.GetSize() == 0) - strXmlPPTX += _T(""); - else - strXmlPPTX += _T("") + pFormulaConverter.m_oHandleRes.GetXmlString() + _T(""); - - //connectors------------------------- - strXmlPPTX += _T(""); - - //textRect--------------------------- - if (pFormulaConverter.m_oTextRect.GetSize() != 0) - strXmlPPTX += pFormulaConverter.m_oTextRect.GetXmlString(); - - //path------------------------------ - strXmlPPTX += _T(""); - strXmlPPTX += pFormulaConverter.m_oPathRes.GetXmlString(); - strXmlPPTX += _T(""); - } - else - { - return _T(""); - } - - strXmlPPTX += _T(""); - return strXmlPPTX; -} -#endif - - void PPT_FORMAT::CShapeElement::SetupTextProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout) { - PPT_FORMAT::CTextAttributesEx* pAttributes = &m_pShape->m_oText; - int nCountColors = 0; - if (NULL != pTheme) - nCountColors = (int)pTheme->m_arColorScheme.size(); + PPT_FORMAT::CTextAttributesEx* pAttributes = &m_pShape->m_oText; + int nCountColors = 0; + if (NULL != pTheme) + nCountColors = (int)pTheme->m_arColorScheme.size(); - size_t nCount = pAttributes->m_arParagraphs.size(); - for (size_t nIndex = 0; nIndex < nCount; ++nIndex) - { - if (pAttributes->m_arParagraphs[nIndex].m_oPFRun.bulletColor.is_init()) - { - int nColorIndex = (int)pAttributes->m_arParagraphs[nIndex].m_oPFRun.bulletColor->m_lSchemeIndex; - if (0 <= nColorIndex && nColorIndex < nCountColors) - { - CalculateColor(pAttributes->m_arParagraphs[nIndex].m_oPFRun.bulletColor.get(), pSlide, pTheme, pLayout); - pAttributes->m_arParagraphs[nIndex].m_oPFRun.bulletColor->m_lSchemeIndex = nColorIndex; - } - } + size_t nCount = pAttributes->m_arParagraphs.size(); + for (size_t nIndex = 0; nIndex < nCount; ++nIndex) + { + if (pAttributes->m_arParagraphs[nIndex].m_oPFRun.bulletColor.is_init()) + { + int nColorIndex = (int)pAttributes->m_arParagraphs[nIndex].m_oPFRun.bulletColor->m_lSchemeIndex; + if (0 <= nColorIndex && nColorIndex < nCountColors) + { + CalculateColor(pAttributes->m_arParagraphs[nIndex].m_oPFRun.bulletColor.get(), pSlide, pTheme, pLayout); + pAttributes->m_arParagraphs[nIndex].m_oPFRun.bulletColor->m_lSchemeIndex = nColorIndex; + } + } - size_t nCountCFs = pAttributes->m_arParagraphs[nIndex].m_arSpans.size(); - for (size_t i = 0; i < nCountCFs; ++i) - { - CTextCFRun* pRun = &pAttributes->m_arParagraphs[nIndex].m_arSpans[i].m_oRun; + size_t nCountCFs = pAttributes->m_arParagraphs[nIndex].m_arSpans.size(); + for (size_t i = 0; i < nCountCFs; ++i) + { + CTextCFRun* pRun = &pAttributes->m_arParagraphs[nIndex].m_arSpans[i].m_oRun; + + if (pRun->Color.is_init()) + { + int nColorIndex = (int)pRun->Color->m_lSchemeIndex; + if (0 <= nColorIndex && nColorIndex < nCountColors) + { + CalculateColor(pRun->Color.get(), pSlide, pTheme, pLayout); + pRun->Color->m_lSchemeIndex = nColorIndex; + } + } + if (NULL != pTheme) + { + if ((pRun->fontRef.is_init()) && (pRun->fontRef.get() < pTheme->m_arFonts.size())) + { + pRun->font.font = new CFontProperty(pTheme->m_arFonts[pRun->fontRef.get()]); - if (pRun->Color.is_init()) - { - int nColorIndex = (int)pRun->Color->m_lSchemeIndex; - if (0 <= nColorIndex && nColorIndex < nCountColors) - { - CalculateColor(pRun->Color.get(), pSlide, pTheme, pLayout); - pRun->Color->m_lSchemeIndex = nColorIndex; - } - } - if (NULL != pTheme) - { - if ((pRun->fontRef.is_init()) && (pRun->fontRef.get() < pTheme->m_arFonts.size())) - { - pRun->font.font = new CFontProperty(pTheme->m_arFonts[pRun->fontRef.get()]); - - //if (1 < pRun->fontRef.get()) - // pRun->fontRef.reset(); - } - if ((pRun->ansiFontRef.is_init()) && (pRun->ansiFontRef.get() < pTheme->m_arFonts.size())) - { - pRun->font.ansi = new CFontProperty(pTheme->m_arFonts[pRun->ansiFontRef.get()]); - } - if ((pRun->eaFontRef.is_init()) && (pRun->eaFontRef.get() < pTheme->m_arFonts.size())) - { - pRun->font.ea = new CFontProperty(pTheme->m_arFonts[pRun->eaFontRef.get()]); - } - if ((pRun->symbolFontRef.is_init()) && (pRun->symbolFontRef.get() < pTheme->m_arFonts.size())) - { - pRun->font.sym = new CFontProperty(pTheme->m_arFonts[pRun->symbolFontRef.get()]); - } - } - } - } -} - -CShapeElement::CShapeElement(ClassType ClassType, int eType) : CElement() -{ - m_lShapeType = eType; - m_ClassType = ClassType; - m_etType = etShape; - - m_pShape = CShapePtr( new CShape(ClassType, eType)); - - m_pShape->m_rcBounds = m_bChildAnchorEnabled ? m_rcChildAnchor : m_rcAnchor; - - m_pShape->m_dStartTime = m_dStartTime; - m_pShape->m_dEndTime = m_dEndTime; - - m_bShapePreset = false; - -} - -CShapeElement::CShapeElement() : CElement() -{ - m_lShapeType = 0x1000; - m_etType = etShape; - m_bShapePreset = false; - - m_pShape = CShapePtr( new CShape(NSBaseShape::unknown, 0x1000)); -} - -CShapeElement::CShapeElement(const std::wstring &str) : CElement() -{ - m_lShapeType = 0x1000; - m_bShapePreset = false; - - m_pShape = CShapePtr( new CShape(NSBaseShape::unknown, 0x1000)); - m_pShape->LoadFromXML(str); - - m_ClassType = m_pShape->getBaseShape()->GetClassType(); -} - -CShapeElement::~CShapeElement() -{ -} - -CElementPtr CShapeElement::CreateDublicate() -{ - CShapeElement* pShapeElement = new CShapeElement(m_ClassType, m_lShapeType); - - CElementPtr pElement = CElementPtr( pShapeElement ); - - SetProperiesToDublicate(pElement); - - pShapeElement->m_lShapeType = m_lShapeType; - pShapeElement->m_bShapePreset = m_bShapePreset; - - m_pShape->SetToDublicate(pShapeElement->m_pShape.get()); - - return pElement; + //if (1 < pRun->fontRef.get()) + // pRun->fontRef.reset(); + } + if ((pRun->ansiFontRef.is_init()) && (pRun->ansiFontRef.get() < pTheme->m_arFonts.size())) + { + pRun->font.ansi = new CFontProperty(pTheme->m_arFonts[pRun->ansiFontRef.get()]); + } + if ((pRun->eaFontRef.is_init()) && (pRun->eaFontRef.get() < pTheme->m_arFonts.size())) + { + pRun->font.ea = new CFontProperty(pTheme->m_arFonts[pRun->eaFontRef.get()]); + } + if ((pRun->symbolFontRef.is_init()) && (pRun->symbolFontRef.get() < pTheme->m_arFonts.size())) + { + pRun->font.sym = new CFontProperty(pTheme->m_arFonts[pRun->symbolFontRef.get()]); + } + } + } + } } bool PPT_FORMAT::CShapeElement::SetUpTextPlaceholder(std::wstring newText) { - bool result = false; - PPT_FORMAT::CTextAttributesEx* pText = &m_pShape->m_oText; + bool result = false; + PPT_FORMAT::CTextAttributesEx* pText = &m_pShape->m_oText; - for (size_t p = 0 ; p < pText->m_arParagraphs.size(); p++) //тут по всем -> 1-(33).ppt - { - if (pText->m_arParagraphs[p].m_arSpans.size() >0)//??? по всем? - { - int pos = (int)pText->m_arParagraphs[p].m_arSpans[0].m_strText.find(L"*"); - - if (pos >= 0) - { + for (size_t p = 0 ; p < pText->m_arParagraphs.size(); p++) //тут по всем -> 1-(33).ppt + { + if (pText->m_arParagraphs[p].m_arSpans.size() >0)//??? по всем? + { + int pos = (int)pText->m_arParagraphs[p].m_arSpans[0].m_strText.find(L"*"); + + if (pos >= 0) + { CSpan first = pText->m_arParagraphs[p].m_arSpans[0]; CSpan last = pText->m_arParagraphs[p].m_arSpans[0]; @@ -521,394 +176,3 @@ bool PPT_FORMAT::CShapeElement::SetUpTextPlaceholder(std::wstring newText) } return result; } - -void CShapeElement::SetupProperties(CSlide *pSlide, CTheme *pTheme, CLayout *pLayout) -{ - m_pShape->m_oText.m_lPlaceholderType = m_lPlaceholderType; - m_pShape->m_oText.m_lPlaceholderID = m_lPlaceholderID; - - m_pShape->getBaseShape()->ReCalculate(); - - SetupTextProperties(pSlide, pTheme, pLayout); - - CalculateColor(m_oPen.Color , pSlide, pTheme, pLayout); - CalculateColor(m_oBrush.Color1 , pSlide, pTheme, pLayout); - CalculateColor(m_oBrush.Color2 , pSlide, pTheme, pLayout); -} - -OOXMLShapes::ShapeType PPTX2EditorAdvanced::GetShapeTypeFromStr(const std::wstring &str)//const -{ - if(str == _T("")) - return OOXMLShapes::sptNil; - switch((CHAR)str[0]) - { - case 'a': - if (str == _T("accentBorderCallout1")) return OOXMLShapes::sptCAccentBorderCallout1; - if (str == _T("accentBorderCallout2")) return OOXMLShapes::sptCAccentBorderCallout2; - if (str == _T("accentBorderCallout3")) return OOXMLShapes::sptCAccentBorderCallout3; - if (str == _T("accentCallout1")) return OOXMLShapes::sptCAccentCallout1; - if (str == _T("accentCallout2")) return OOXMLShapes::sptCAccentCallout2; - if (str == _T("accentCallout3")) return OOXMLShapes::sptCAccentCallout3; - if (str == _T("actionButtonBackPrevious")) return OOXMLShapes::sptCActionButtonBackPrevious; - if (str == _T("actionButtonBeginning")) return OOXMLShapes::sptCActionButtonBeginning; - if (str == _T("actionButtonBlank")) return OOXMLShapes::sptCActionButtonBlank; - if (str == _T("actionButtonDocument")) return OOXMLShapes::sptCActionButtonDocument; - if (str == _T("actionButtonEnd")) return OOXMLShapes::sptCActionButtonEnd; - if (str == _T("actionButtonForwardNext")) return OOXMLShapes::sptCActionButtonForwardNext; - if (str == _T("actionButtonHelp")) return OOXMLShapes::sptCActionButtonHelp; - if (str == _T("actionButtonHome")) return OOXMLShapes::sptCActionButtonHome; - if (str == _T("actionButtonInformation")) return OOXMLShapes::sptCActionButtonInformation; - if (str == _T("actionButtonMovie")) return OOXMLShapes::sptCActionButtonMovie; - if (str == _T("actionButtonReturn")) return OOXMLShapes::sptCActionButtonReturn; - if (str == _T("actionButtonSound")) return OOXMLShapes::sptCActionButtonSound; - if (str == _T("arc")) return OOXMLShapes::sptCArc; - break; - case 'b': - if (str == _T("bentArrow")) return OOXMLShapes::sptCBentArrow; - if (str == _T("bentConnector2")) return OOXMLShapes::sptCBentConnector2; - if (str == _T("bentConnector3")) return OOXMLShapes::sptCBentConnector3; - if (str == _T("bentConnector4")) return OOXMLShapes::sptCBentConnector4; - if (str == _T("bentConnector5")) return OOXMLShapes::sptCBentConnector5; - if (str == _T("bentUpArrow")) return OOXMLShapes::sptCBentUpArrow; - if (str == _T("bevel")) return OOXMLShapes::sptCBevel; - if (str == _T("blockArc")) return OOXMLShapes::sptCBlockArc; - if (str == _T("borderCallout1")) return OOXMLShapes::sptCBorderCallout1; - if (str == _T("borderCallout2")) return OOXMLShapes::sptCBorderCallout2; - if (str == _T("borderCallout3")) return OOXMLShapes::sptCBorderCallout3; - if (str == _T("bracePair")) return OOXMLShapes::sptCBracePair; - if (str == _T("bracketPair")) return OOXMLShapes::sptCBracketPair; - break; - case 'c': - if (str == _T("callout1")) return OOXMLShapes::sptCCallout1; - if (str == _T("callout2")) return OOXMLShapes::sptCCallout2; - if (str == _T("callout3")) return OOXMLShapes::sptCCallout3; - if (str == _T("can")) return OOXMLShapes::sptCCan; - if (str == _T("chartPlus")) return OOXMLShapes::sptCChartPlus; - if (str == _T("chartStar")) return OOXMLShapes::sptCChartStar; - if (str == _T("chartX")) return OOXMLShapes::sptCChartX; - if (str == _T("chevron")) return OOXMLShapes::sptCChevron; - if (str == _T("chord")) return OOXMLShapes::sptCChord; - if (str == _T("circularArrow")) return OOXMLShapes::sptCCircularArrow; - if (str == _T("cloud")) return OOXMLShapes::sptCCloud; - if (str == _T("cloudCallout")) return OOXMLShapes::sptCCloudCallout; - if (str == _T("corner")) return OOXMLShapes::sptCCorner; - if (str == _T("cornerTabs")) return OOXMLShapes::sptCCornerTabs; - if (str == _T("cube")) return OOXMLShapes::sptCCube; - if (str == _T("curvedConnector2")) return OOXMLShapes::sptCCurvedConnector2; - if (str == _T("curvedConnector3")) return OOXMLShapes::sptCCurvedConnector3; - if (str == _T("curvedConnector4")) return OOXMLShapes::sptCCurvedConnector4; - if (str == _T("curvedConnector5")) return OOXMLShapes::sptCCurvedConnector5; - if (str == _T("curvedDownArrow")) return OOXMLShapes::sptCCurvedDownArrow; - if (str == _T("curvedLeftArrow")) return OOXMLShapes::sptCCurvedLeftArrow; - if (str == _T("curvedRightArrow")) return OOXMLShapes::sptCCurvedRightArrow; - if (str == _T("curvedUpArrow")) return OOXMLShapes::sptCCurvedUpArrow; - break; - case 'd': - if (str == _T("decagon")) return OOXMLShapes::sptCDecagon; - if (str == _T("diagStripe")) return OOXMLShapes::sptCDiagStripe; - if (str == _T("diamond")) return OOXMLShapes::sptCDiamond; - if (str == _T("dodecagon")) return OOXMLShapes::sptCDodecagon; - if (str == _T("donut")) return OOXMLShapes::sptCDonut; - if (str == _T("doubleWave")) return OOXMLShapes::sptCDoubleWave; - if (str == _T("downArrow")) return OOXMLShapes::sptCDownArrow; - if (str == _T("downArrowCallout")) return OOXMLShapes::sptCDownArrowCallout; - break; - case 'e': - if (str == _T("ellipse")) return OOXMLShapes::sptCEllipse; - if (str == _T("ellipseRibbon")) return OOXMLShapes::sptCEllipseRibbon; - if (str == _T("ellipseRibbon2")) return OOXMLShapes::sptCEllipseRibbon2; - break; - case 'f': - if (str == _T("flowChartAlternateProcess")) return OOXMLShapes::sptCFlowChartAlternateProcess; - if (str == _T("flowChartCollate")) return OOXMLShapes::sptCFlowChartCollate; - if (str == _T("flowChartConnector")) return OOXMLShapes::sptCFlowChartConnector; - if (str == _T("flowChartDecision")) return OOXMLShapes::sptCFlowChartDecision; - if (str == _T("flowChartDelay")) return OOXMLShapes::sptCFlowChartDelay; - if (str == _T("flowChartDisplay")) return OOXMLShapes::sptCFlowChartDisplay; - if (str == _T("flowChartDocument")) return OOXMLShapes::sptCFlowChartDocument; - if (str == _T("flowChartExtract")) return OOXMLShapes::sptCFlowChartExtract; - if (str == _T("flowChartInputOutput")) return OOXMLShapes::sptCFlowChartInputOutput; - if (str == _T("flowChartInternalStorage")) return OOXMLShapes::sptCFlowChartInternalStorage; - if (str == _T("flowChartMagneticDisk")) return OOXMLShapes::sptCFlowChartMagneticDisk; - if (str == _T("flowChartMagneticDrum")) return OOXMLShapes::sptCFlowChartMagneticDrum; - if (str == _T("flowChartMagneticTape")) return OOXMLShapes::sptCFlowChartMagneticTape; - if (str == _T("flowChartManualInput")) return OOXMLShapes::sptCFlowChartManualInput; - if (str == _T("flowChartManualOperation")) return OOXMLShapes::sptCFlowChartManualOperation; - if (str == _T("flowChartMerge")) return OOXMLShapes::sptCFlowChartMerge; - if (str == _T("flowChartMultidocument")) return OOXMLShapes::sptCFlowChartMultidocument; - if (str == _T("flowChartOfflineStorage")) return OOXMLShapes::sptCFlowChartOfflineStorage; - if (str == _T("flowChartOffpageConnector")) return OOXMLShapes::sptCFlowChartOffpageConnector; - if (str == _T("flowChartOnlineStorage")) return OOXMLShapes::sptCFlowChartOnlineStorage; - if (str == _T("flowChartOr")) return OOXMLShapes::sptCFlowChartOr; - if (str == _T("flowChartPredefinedProcess")) return OOXMLShapes::sptCFlowChartPredefinedProcess; - if (str == _T("flowChartPreparation")) return OOXMLShapes::sptCFlowChartPreparation; - if (str == _T("flowChartProcess")) return OOXMLShapes::sptCFlowChartProcess; - if (str == _T("flowChartPunchedCard")) return OOXMLShapes::sptCFlowChartPunchedCard; - if (str == _T("flowChartPunchedTape")) return OOXMLShapes::sptCFlowChartPunchedTape; - if (str == _T("flowChartSort")) return OOXMLShapes::sptCFlowChartSort; - if (str == _T("flowChartSummingJunction")) return OOXMLShapes::sptCFlowChartSummingJunction; - if (str == _T("flowChartTerminator")) return OOXMLShapes::sptCFlowChartTerminator; - if (str == _T("foldedCorner")) return OOXMLShapes::sptCFoldedCorner; - if (str == _T("frame")) return OOXMLShapes::sptCFrame; - if (str == _T("funnel")) return OOXMLShapes::sptCFunnel; - break; - case 'g': - if (str == _T("gear6")) return OOXMLShapes::sptCGear6; - if (str == _T("gear9")) return OOXMLShapes::sptCGear9; - break; - case 'h': - if (str == _T("halfFrame")) return OOXMLShapes::sptCHalfFrame; - if (str == _T("heart")) return OOXMLShapes::sptCHeart; - if (str == _T("heptagon")) return OOXMLShapes::sptCHeptagon; - if (str == _T("hexagon")) return OOXMLShapes::sptCHexagon; - if (str == _T("homePlate")) return OOXMLShapes::sptCHomePlate; - if (str == _T("horizontalScroll")) return OOXMLShapes::sptCHorizontalScroll; - break; - case 'i': - if (str == _T("irregularSeal1")) return OOXMLShapes::sptCIrregularSeal1; - if (str == _T("irregularSeal2")) return OOXMLShapes::sptCIrregularSeal2; - break; - case 'l': - if (str == _T("leftArrow")) return OOXMLShapes::sptCLeftArrow; - if (str == _T("leftArrowCallout")) return OOXMLShapes::sptCLeftArrowCallout; - if (str == _T("leftBrace")) return OOXMLShapes::sptCLeftBrace; - if (str == _T("leftBracket")) return OOXMLShapes::sptCLeftBracket; - if (str == _T("leftCircularArrow")) return OOXMLShapes::sptCLeftCircularArrow; - if (str == _T("leftRightArrow")) return OOXMLShapes::sptCLeftRightArrow; - if (str == _T("leftRightArrowCallout")) return OOXMLShapes::sptCLeftRightArrowCallout; - if (str == _T("leftRightCircularArrow")) return OOXMLShapes::sptCLeftRightCircularArrow; - if (str == _T("leftRightRibbon")) return OOXMLShapes::sptCLeftRightRibbon; - if (str == _T("leftRightUpArrow")) return OOXMLShapes::sptCLeftRightUpArrow; - if (str == _T("leftUpArrow")) return OOXMLShapes::sptCLeftUpArrow; - if (str == _T("lightningBolt")) return OOXMLShapes::sptCLightningBolt; - if (str == _T("line")) return OOXMLShapes::sptCLine; - if (str == _T("lineInv")) return OOXMLShapes::sptCLineInv; - break; - case 'm': - if (str == _T("mathDivide")) return OOXMLShapes::sptCMathDivide; - if (str == _T("mathEqual")) return OOXMLShapes::sptCMathEqual; - if (str == _T("mathMinus")) return OOXMLShapes::sptCMathMinus; - if (str == _T("mathMultiply")) return OOXMLShapes::sptCMathMultiply; - if (str == _T("mathNotEqual")) return OOXMLShapes::sptCMathNotEqual; - if (str == _T("mathPlus")) return OOXMLShapes::sptCMathPlus; - if (str == _T("moon")) return OOXMLShapes::sptCMoon; - break; - case 'n': - if (str == _T("nonIsoscelesTrapezoid")) return OOXMLShapes::sptCNonIsoscelesTrapezoid; - if (str == _T("noSmoking")) return OOXMLShapes::sptCNoSmoking; - if (str == _T("notchedRightArrow")) return OOXMLShapes::sptCNotchedRightArrow; - break; - case 'o': - if (str == _T("octagon")) return OOXMLShapes::sptCOctagon; - break; - case 'p': - if (str == _T("parallelogram")) return OOXMLShapes::sptCParallelogram; - if (str == _T("pentagon")) return OOXMLShapes::sptCPentagon; - if (str == _T("pie")) return OOXMLShapes::sptCPie; - if (str == _T("pieWedge")) return OOXMLShapes::sptCPieWedge; - if (str == _T("plaque")) return OOXMLShapes::sptCPlaque; - if (str == _T("plaqueTabs")) return OOXMLShapes::sptCPlaqueTabs; - if (str == _T("plus")) return OOXMLShapes::sptCPlus; - break; - case 'q': - if (str == _T("quadArrow")) return OOXMLShapes::sptCQuadArrow; - if (str == _T("quadArrowCallout")) return OOXMLShapes::sptCQuadArrowCallout; - break; - case 'r': - if (str == _T("rect")) return OOXMLShapes::sptCRect; - if (str == _T("ribbon")) return OOXMLShapes::sptCRibbon; - if (str == _T("ribbon2")) return OOXMLShapes::sptCRibbon2; - if (str == _T("rightArrow")) return OOXMLShapes::sptCRightArrow; - if (str == _T("rightArrowCallout")) return OOXMLShapes::sptCRightArrowCallout; - if (str == _T("rightBrace")) return OOXMLShapes::sptCRightBrace; - if (str == _T("rightBracket")) return OOXMLShapes::sptCRightBracket; - if (str == _T("round1Rect")) return OOXMLShapes::sptCRound1Rect; - if (str == _T("round2DiagRect")) return OOXMLShapes::sptCRound2DiagRect; - if (str == _T("round2SameRect")) return OOXMLShapes::sptCRound2SameRect; - if (str == _T("roundRect")) return OOXMLShapes::sptCRoundRect; - if (str == _T("rtTriangle")) return OOXMLShapes::sptCRtTriangle; - break; - case 's': - if (str == _T("smileyFace")) return OOXMLShapes::sptCSmileyFace; - if (str == _T("snip1Rect")) return OOXMLShapes::sptCSnip1Rect; - if (str == _T("snip2DiagRect")) return OOXMLShapes::sptCSnip2DiagRect; - if (str == _T("snip2SameRect")) return OOXMLShapes::sptCSnip2SameRect; - if (str == _T("snipRoundRect")) return OOXMLShapes::sptCSnipRoundRect; - if (str == _T("squareTabs")) return OOXMLShapes::sptCSquareTabs; - if (str == _T("star10")) return OOXMLShapes::sptCStar10; - if (str == _T("star12")) return OOXMLShapes::sptCStar12; - if (str == _T("star16")) return OOXMLShapes::sptCStar16; - if (str == _T("star24")) return OOXMLShapes::sptCStar24; - if (str == _T("star32")) return OOXMLShapes::sptCStar32; - if (str == _T("star4")) return OOXMLShapes::sptCStar4; - if (str == _T("star5")) return OOXMLShapes::sptCStar5; - if (str == _T("star6")) return OOXMLShapes::sptCStar6; - if (str == _T("star7")) return OOXMLShapes::sptCStar7; - if (str == _T("star8")) return OOXMLShapes::sptCStar8; - if (str == _T("straightConnector1")) return OOXMLShapes::sptCStraightConnector1; - if (str == _T("stripedRightArrow")) return OOXMLShapes::sptCStripedRightArrow; - if (str == _T("sun")) return OOXMLShapes::sptCSun; - if (str == _T("swooshArrow")) return OOXMLShapes::sptCSwooshArrow; - break; - case 't': - if (str == _T("teardrop")) return OOXMLShapes::sptCTeardrop; - if (str == _T("trapezoid")) return OOXMLShapes::sptCTrapezoid; - if (str == _T("triangle")) return OOXMLShapes::sptCTriangle; - break; - case 'u': - if (str == _T("upArrow")) return OOXMLShapes::sptCUpArrow; - if (str == _T("upArrowCallout")) return OOXMLShapes::sptCUpArrowCallout; - if (str == _T("upDownArrow")) return OOXMLShapes::sptCUpDownArrow; - if (str == _T("upDownArrowCallout")) return OOXMLShapes::sptCUpDownArrowCallout; - if (str == _T("uturnArrow")) return OOXMLShapes::sptCUturnArrow; - break; - case 'v': - if (str == _T("verticalScroll")) return OOXMLShapes::sptCVerticalScroll; - break; - case 'w': - if (str == _T("wave")) return OOXMLShapes::sptCWave; - if (str == _T("wedgeEllipseCallout")) return OOXMLShapes::sptCWedgeEllipseCallout; - if (str == _T("wedgeRectCallout")) return OOXMLShapes::sptCWedgeRectCallout; - if (str == _T("wedgeRoundRectCallout")) return OOXMLShapes::sptCWedgeRoundRectCallout; - break; - } - return OOXMLShapes::sptNil; -} - -CAudioElement::CAudioElement() : CImageElement() -{ - m_etType = etAudio; - - m_nAmplify = 100; - m_bWithVideo = false; - - m_dAudioDuration = 0.0; - m_bLoop = false; - - m_dClipStartTime = 0.0; - m_dClipEndTime = -1.0; -} - -CAudioElement::~CAudioElement() -{ -} - -CElementPtr CAudioElement::CreateDublicate() -{ - CAudioElement* pAudioElement = new CAudioElement(); - CElementPtr pElement = CElementPtr( pAudioElement ); - - SetProperiesToDublicate(pElement); - - pAudioElement->m_strAudioFileName = m_strAudioFileName; - pAudioElement->m_nAmplify = m_nAmplify; - pAudioElement->m_bWithVideo = m_bWithVideo; - - pAudioElement->m_dAudioDuration = m_dAudioDuration; - pAudioElement->m_bLoop = m_bLoop; - - pAudioElement->m_dClipStartTime = m_dClipStartTime; - pAudioElement->m_dClipEndTime = m_dClipEndTime; - - return pElement; -} - -CVideoElement::CVideoElement() : CImageElement() -{ - m_etType = etVideo; - - m_dVideoDuration = 0.0; - m_nAlpha = 0xFF; - - m_dClipStartTime = -1.0; - m_dClipEndTime = -1.0; - m_bLoop = false; -} - -CVideoElement::~CVideoElement() -{ -} - -CElementPtr CVideoElement::CreateDublicate() -{ - CVideoElement* pVideoElement = new CVideoElement(); - - CElementPtr pElement = CElementPtr( pVideoElement ); - - SetProperiesToDublicate(pElement); - - pVideoElement->m_strVideoFileName = m_strVideoFileName; - pVideoElement->m_nAlpha = m_nAlpha; - - pVideoElement->m_dVideoDuration = m_dVideoDuration; - - pVideoElement->m_dClipStartTime = m_dClipStartTime; - pVideoElement->m_dClipEndTime = m_dClipEndTime; - pVideoElement->m_bLoop = m_bLoop; - - return pElement; -} - -CGroupElement::CGroupElement() : CElement() -{ - m_etType = etGroup; -} - -CGroupElement::~CGroupElement() -{ -} - -CElementPtr CGroupElement::CreateDublicate() -{ - CGroupElement* pGroupElement = new CGroupElement(); - - CElementPtr pElement = CElementPtr( pGroupElement ); - - SetProperiesToDublicate(pElement); - - return pElement; -} - -std::wstring CGroupElement::ConvertPPTShapeToPPTX(bool bIsNamespace) -{ - - return L""; -} - -CTableElement::CTableElement() : CElement() -{ - m_etType = etTable; -} - -CTableElement::~CTableElement() -{ -} - -CElementPtr CTableElement::CreateDublicate() -{ - CTableElement* pTableElement = new CTableElement(); - - CElementPtr pElement = CElementPtr( pTableElement ); - - SetProperiesToDublicate(pElement); - - return pElement; -} - -int CTableElement::GetWidth() const -{ - double multip = m_bAnchorEnabled ? 1587.5 : 1; - return round(m_rcAnchor.GetWidth() * multip); -} - -int CTableElement::GetHeight() const -{ - double multip = m_bAnchorEnabled ? 1587.5 : 1; - return round(m_rcAnchor.GetHeight() * multip); -} - -std::wstring CTableElement::ConvertPPTShapeToPPTX(bool bIsNamespace) -{ - - return L""; -} diff --git a/MsBinaryFile/PptFile/Drawing/Elements.h b/MsBinaryFile/PptFile/Drawing/Elements.h index 7712f7c986..8f7e6dc921 100644 --- a/MsBinaryFile/PptFile/Drawing/Elements.h +++ b/MsBinaryFile/PptFile/Drawing/Elements.h @@ -34,162 +34,832 @@ #include "Theme.h" #include "Shapes/Shape.h" #include "../../Common/Vml/PPTShape/Ppt2PptxShapeConverter.h" -#define OPTIMIZE_COMPILE_CONVERT_PPT_TO_PPTX namespace PPTX2EditorAdvanced { -OOXMLShapes::ShapeType GetShapeTypeFromStr(const std::wstring& str); + AVSINLINE OOXMLShapes::ShapeType GetShapeTypeFromStr(const std::wstring& str)//const + { + if(str == _T("")) + return OOXMLShapes::sptNil; + switch((CHAR)str[0]) + { + case 'a': + if (str == _T("accentBorderCallout1")) return OOXMLShapes::sptCAccentBorderCallout1; + if (str == _T("accentBorderCallout2")) return OOXMLShapes::sptCAccentBorderCallout2; + if (str == _T("accentBorderCallout3")) return OOXMLShapes::sptCAccentBorderCallout3; + if (str == _T("accentCallout1")) return OOXMLShapes::sptCAccentCallout1; + if (str == _T("accentCallout2")) return OOXMLShapes::sptCAccentCallout2; + if (str == _T("accentCallout3")) return OOXMLShapes::sptCAccentCallout3; + if (str == _T("actionButtonBackPrevious")) return OOXMLShapes::sptCActionButtonBackPrevious; + if (str == _T("actionButtonBeginning")) return OOXMLShapes::sptCActionButtonBeginning; + if (str == _T("actionButtonBlank")) return OOXMLShapes::sptCActionButtonBlank; + if (str == _T("actionButtonDocument")) return OOXMLShapes::sptCActionButtonDocument; + if (str == _T("actionButtonEnd")) return OOXMLShapes::sptCActionButtonEnd; + if (str == _T("actionButtonForwardNext")) return OOXMLShapes::sptCActionButtonForwardNext; + if (str == _T("actionButtonHelp")) return OOXMLShapes::sptCActionButtonHelp; + if (str == _T("actionButtonHome")) return OOXMLShapes::sptCActionButtonHome; + if (str == _T("actionButtonInformation")) return OOXMLShapes::sptCActionButtonInformation; + if (str == _T("actionButtonMovie")) return OOXMLShapes::sptCActionButtonMovie; + if (str == _T("actionButtonReturn")) return OOXMLShapes::sptCActionButtonReturn; + if (str == _T("actionButtonSound")) return OOXMLShapes::sptCActionButtonSound; + if (str == _T("arc")) return OOXMLShapes::sptCArc; + break; + case 'b': + if (str == _T("bentArrow")) return OOXMLShapes::sptCBentArrow; + if (str == _T("bentConnector2")) return OOXMLShapes::sptCBentConnector2; + if (str == _T("bentConnector3")) return OOXMLShapes::sptCBentConnector3; + if (str == _T("bentConnector4")) return OOXMLShapes::sptCBentConnector4; + if (str == _T("bentConnector5")) return OOXMLShapes::sptCBentConnector5; + if (str == _T("bentUpArrow")) return OOXMLShapes::sptCBentUpArrow; + if (str == _T("bevel")) return OOXMLShapes::sptCBevel; + if (str == _T("blockArc")) return OOXMLShapes::sptCBlockArc; + if (str == _T("borderCallout1")) return OOXMLShapes::sptCBorderCallout1; + if (str == _T("borderCallout2")) return OOXMLShapes::sptCBorderCallout2; + if (str == _T("borderCallout3")) return OOXMLShapes::sptCBorderCallout3; + if (str == _T("bracePair")) return OOXMLShapes::sptCBracePair; + if (str == _T("bracketPair")) return OOXMLShapes::sptCBracketPair; + break; + case 'c': + if (str == _T("callout1")) return OOXMLShapes::sptCCallout1; + if (str == _T("callout2")) return OOXMLShapes::sptCCallout2; + if (str == _T("callout3")) return OOXMLShapes::sptCCallout3; + if (str == _T("can")) return OOXMLShapes::sptCCan; + if (str == _T("chartPlus")) return OOXMLShapes::sptCChartPlus; + if (str == _T("chartStar")) return OOXMLShapes::sptCChartStar; + if (str == _T("chartX")) return OOXMLShapes::sptCChartX; + if (str == _T("chevron")) return OOXMLShapes::sptCChevron; + if (str == _T("chord")) return OOXMLShapes::sptCChord; + if (str == _T("circularArrow")) return OOXMLShapes::sptCCircularArrow; + if (str == _T("cloud")) return OOXMLShapes::sptCCloud; + if (str == _T("cloudCallout")) return OOXMLShapes::sptCCloudCallout; + if (str == _T("corner")) return OOXMLShapes::sptCCorner; + if (str == _T("cornerTabs")) return OOXMLShapes::sptCCornerTabs; + if (str == _T("cube")) return OOXMLShapes::sptCCube; + if (str == _T("curvedConnector2")) return OOXMLShapes::sptCCurvedConnector2; + if (str == _T("curvedConnector3")) return OOXMLShapes::sptCCurvedConnector3; + if (str == _T("curvedConnector4")) return OOXMLShapes::sptCCurvedConnector4; + if (str == _T("curvedConnector5")) return OOXMLShapes::sptCCurvedConnector5; + if (str == _T("curvedDownArrow")) return OOXMLShapes::sptCCurvedDownArrow; + if (str == _T("curvedLeftArrow")) return OOXMLShapes::sptCCurvedLeftArrow; + if (str == _T("curvedRightArrow")) return OOXMLShapes::sptCCurvedRightArrow; + if (str == _T("curvedUpArrow")) return OOXMLShapes::sptCCurvedUpArrow; + break; + case 'd': + if (str == _T("decagon")) return OOXMLShapes::sptCDecagon; + if (str == _T("diagStripe")) return OOXMLShapes::sptCDiagStripe; + if (str == _T("diamond")) return OOXMLShapes::sptCDiamond; + if (str == _T("dodecagon")) return OOXMLShapes::sptCDodecagon; + if (str == _T("donut")) return OOXMLShapes::sptCDonut; + if (str == _T("doubleWave")) return OOXMLShapes::sptCDoubleWave; + if (str == _T("downArrow")) return OOXMLShapes::sptCDownArrow; + if (str == _T("downArrowCallout")) return OOXMLShapes::sptCDownArrowCallout; + break; + case 'e': + if (str == _T("ellipse")) return OOXMLShapes::sptCEllipse; + if (str == _T("ellipseRibbon")) return OOXMLShapes::sptCEllipseRibbon; + if (str == _T("ellipseRibbon2")) return OOXMLShapes::sptCEllipseRibbon2; + break; + case 'f': + if (str == _T("flowChartAlternateProcess")) return OOXMLShapes::sptCFlowChartAlternateProcess; + if (str == _T("flowChartCollate")) return OOXMLShapes::sptCFlowChartCollate; + if (str == _T("flowChartConnector")) return OOXMLShapes::sptCFlowChartConnector; + if (str == _T("flowChartDecision")) return OOXMLShapes::sptCFlowChartDecision; + if (str == _T("flowChartDelay")) return OOXMLShapes::sptCFlowChartDelay; + if (str == _T("flowChartDisplay")) return OOXMLShapes::sptCFlowChartDisplay; + if (str == _T("flowChartDocument")) return OOXMLShapes::sptCFlowChartDocument; + if (str == _T("flowChartExtract")) return OOXMLShapes::sptCFlowChartExtract; + if (str == _T("flowChartInputOutput")) return OOXMLShapes::sptCFlowChartInputOutput; + if (str == _T("flowChartInternalStorage")) return OOXMLShapes::sptCFlowChartInternalStorage; + if (str == _T("flowChartMagneticDisk")) return OOXMLShapes::sptCFlowChartMagneticDisk; + if (str == _T("flowChartMagneticDrum")) return OOXMLShapes::sptCFlowChartMagneticDrum; + if (str == _T("flowChartMagneticTape")) return OOXMLShapes::sptCFlowChartMagneticTape; + if (str == _T("flowChartManualInput")) return OOXMLShapes::sptCFlowChartManualInput; + if (str == _T("flowChartManualOperation")) return OOXMLShapes::sptCFlowChartManualOperation; + if (str == _T("flowChartMerge")) return OOXMLShapes::sptCFlowChartMerge; + if (str == _T("flowChartMultidocument")) return OOXMLShapes::sptCFlowChartMultidocument; + if (str == _T("flowChartOfflineStorage")) return OOXMLShapes::sptCFlowChartOfflineStorage; + if (str == _T("flowChartOffpageConnector")) return OOXMLShapes::sptCFlowChartOffpageConnector; + if (str == _T("flowChartOnlineStorage")) return OOXMLShapes::sptCFlowChartOnlineStorage; + if (str == _T("flowChartOr")) return OOXMLShapes::sptCFlowChartOr; + if (str == _T("flowChartPredefinedProcess")) return OOXMLShapes::sptCFlowChartPredefinedProcess; + if (str == _T("flowChartPreparation")) return OOXMLShapes::sptCFlowChartPreparation; + if (str == _T("flowChartProcess")) return OOXMLShapes::sptCFlowChartProcess; + if (str == _T("flowChartPunchedCard")) return OOXMLShapes::sptCFlowChartPunchedCard; + if (str == _T("flowChartPunchedTape")) return OOXMLShapes::sptCFlowChartPunchedTape; + if (str == _T("flowChartSort")) return OOXMLShapes::sptCFlowChartSort; + if (str == _T("flowChartSummingJunction")) return OOXMLShapes::sptCFlowChartSummingJunction; + if (str == _T("flowChartTerminator")) return OOXMLShapes::sptCFlowChartTerminator; + if (str == _T("foldedCorner")) return OOXMLShapes::sptCFoldedCorner; + if (str == _T("frame")) return OOXMLShapes::sptCFrame; + if (str == _T("funnel")) return OOXMLShapes::sptCFunnel; + break; + case 'g': + if (str == _T("gear6")) return OOXMLShapes::sptCGear6; + if (str == _T("gear9")) return OOXMLShapes::sptCGear9; + break; + case 'h': + if (str == _T("halfFrame")) return OOXMLShapes::sptCHalfFrame; + if (str == _T("heart")) return OOXMLShapes::sptCHeart; + if (str == _T("heptagon")) return OOXMLShapes::sptCHeptagon; + if (str == _T("hexagon")) return OOXMLShapes::sptCHexagon; + if (str == _T("homePlate")) return OOXMLShapes::sptCHomePlate; + if (str == _T("horizontalScroll")) return OOXMLShapes::sptCHorizontalScroll; + break; + case 'i': + if (str == _T("irregularSeal1")) return OOXMLShapes::sptCIrregularSeal1; + if (str == _T("irregularSeal2")) return OOXMLShapes::sptCIrregularSeal2; + break; + case 'l': + if (str == _T("leftArrow")) return OOXMLShapes::sptCLeftArrow; + if (str == _T("leftArrowCallout")) return OOXMLShapes::sptCLeftArrowCallout; + if (str == _T("leftBrace")) return OOXMLShapes::sptCLeftBrace; + if (str == _T("leftBracket")) return OOXMLShapes::sptCLeftBracket; + if (str == _T("leftCircularArrow")) return OOXMLShapes::sptCLeftCircularArrow; + if (str == _T("leftRightArrow")) return OOXMLShapes::sptCLeftRightArrow; + if (str == _T("leftRightArrowCallout")) return OOXMLShapes::sptCLeftRightArrowCallout; + if (str == _T("leftRightCircularArrow")) return OOXMLShapes::sptCLeftRightCircularArrow; + if (str == _T("leftRightRibbon")) return OOXMLShapes::sptCLeftRightRibbon; + if (str == _T("leftRightUpArrow")) return OOXMLShapes::sptCLeftRightUpArrow; + if (str == _T("leftUpArrow")) return OOXMLShapes::sptCLeftUpArrow; + if (str == _T("lightningBolt")) return OOXMLShapes::sptCLightningBolt; + if (str == _T("line")) return OOXMLShapes::sptCLine; + if (str == _T("lineInv")) return OOXMLShapes::sptCLineInv; + break; + case 'm': + if (str == _T("mathDivide")) return OOXMLShapes::sptCMathDivide; + if (str == _T("mathEqual")) return OOXMLShapes::sptCMathEqual; + if (str == _T("mathMinus")) return OOXMLShapes::sptCMathMinus; + if (str == _T("mathMultiply")) return OOXMLShapes::sptCMathMultiply; + if (str == _T("mathNotEqual")) return OOXMLShapes::sptCMathNotEqual; + if (str == _T("mathPlus")) return OOXMLShapes::sptCMathPlus; + if (str == _T("moon")) return OOXMLShapes::sptCMoon; + break; + case 'n': + if (str == _T("nonIsoscelesTrapezoid")) return OOXMLShapes::sptCNonIsoscelesTrapezoid; + if (str == _T("noSmoking")) return OOXMLShapes::sptCNoSmoking; + if (str == _T("notchedRightArrow")) return OOXMLShapes::sptCNotchedRightArrow; + break; + case 'o': + if (str == _T("octagon")) return OOXMLShapes::sptCOctagon; + break; + case 'p': + if (str == _T("parallelogram")) return OOXMLShapes::sptCParallelogram; + if (str == _T("pentagon")) return OOXMLShapes::sptCPentagon; + if (str == _T("pie")) return OOXMLShapes::sptCPie; + if (str == _T("pieWedge")) return OOXMLShapes::sptCPieWedge; + if (str == _T("plaque")) return OOXMLShapes::sptCPlaque; + if (str == _T("plaqueTabs")) return OOXMLShapes::sptCPlaqueTabs; + if (str == _T("plus")) return OOXMLShapes::sptCPlus; + break; + case 'q': + if (str == _T("quadArrow")) return OOXMLShapes::sptCQuadArrow; + if (str == _T("quadArrowCallout")) return OOXMLShapes::sptCQuadArrowCallout; + break; + case 'r': + if (str == _T("rect")) return OOXMLShapes::sptCRect; + if (str == _T("ribbon")) return OOXMLShapes::sptCRibbon; + if (str == _T("ribbon2")) return OOXMLShapes::sptCRibbon2; + if (str == _T("rightArrow")) return OOXMLShapes::sptCRightArrow; + if (str == _T("rightArrowCallout")) return OOXMLShapes::sptCRightArrowCallout; + if (str == _T("rightBrace")) return OOXMLShapes::sptCRightBrace; + if (str == _T("rightBracket")) return OOXMLShapes::sptCRightBracket; + if (str == _T("round1Rect")) return OOXMLShapes::sptCRound1Rect; + if (str == _T("round2DiagRect")) return OOXMLShapes::sptCRound2DiagRect; + if (str == _T("round2SameRect")) return OOXMLShapes::sptCRound2SameRect; + if (str == _T("roundRect")) return OOXMLShapes::sptCRoundRect; + if (str == _T("rtTriangle")) return OOXMLShapes::sptCRtTriangle; + break; + case 's': + if (str == _T("smileyFace")) return OOXMLShapes::sptCSmileyFace; + if (str == _T("snip1Rect")) return OOXMLShapes::sptCSnip1Rect; + if (str == _T("snip2DiagRect")) return OOXMLShapes::sptCSnip2DiagRect; + if (str == _T("snip2SameRect")) return OOXMLShapes::sptCSnip2SameRect; + if (str == _T("snipRoundRect")) return OOXMLShapes::sptCSnipRoundRect; + if (str == _T("squareTabs")) return OOXMLShapes::sptCSquareTabs; + if (str == _T("star10")) return OOXMLShapes::sptCStar10; + if (str == _T("star12")) return OOXMLShapes::sptCStar12; + if (str == _T("star16")) return OOXMLShapes::sptCStar16; + if (str == _T("star24")) return OOXMLShapes::sptCStar24; + if (str == _T("star32")) return OOXMLShapes::sptCStar32; + if (str == _T("star4")) return OOXMLShapes::sptCStar4; + if (str == _T("star5")) return OOXMLShapes::sptCStar5; + if (str == _T("star6")) return OOXMLShapes::sptCStar6; + if (str == _T("star7")) return OOXMLShapes::sptCStar7; + if (str == _T("star8")) return OOXMLShapes::sptCStar8; + if (str == _T("straightConnector1")) return OOXMLShapes::sptCStraightConnector1; + if (str == _T("stripedRightArrow")) return OOXMLShapes::sptCStripedRightArrow; + if (str == _T("sun")) return OOXMLShapes::sptCSun; + if (str == _T("swooshArrow")) return OOXMLShapes::sptCSwooshArrow; + break; + case 't': + if (str == _T("teardrop")) return OOXMLShapes::sptCTeardrop; + if (str == _T("trapezoid")) return OOXMLShapes::sptCTrapezoid; + if (str == _T("triangle")) return OOXMLShapes::sptCTriangle; + break; + case 'u': + if (str == _T("upArrow")) return OOXMLShapes::sptCUpArrow; + if (str == _T("upArrowCallout")) return OOXMLShapes::sptCUpArrowCallout; + if (str == _T("upDownArrow")) return OOXMLShapes::sptCUpDownArrow; + if (str == _T("upDownArrowCallout")) return OOXMLShapes::sptCUpDownArrowCallout; + if (str == _T("uturnArrow")) return OOXMLShapes::sptCUturnArrow; + break; + case 'v': + if (str == _T("verticalScroll")) return OOXMLShapes::sptCVerticalScroll; + break; + case 'w': + if (str == _T("wave")) return OOXMLShapes::sptCWave; + if (str == _T("wedgeEllipseCallout")) return OOXMLShapes::sptCWedgeEllipseCallout; + if (str == _T("wedgeRectCallout")) return OOXMLShapes::sptCWedgeRectCallout; + if (str == _T("wedgeRoundRectCallout")) return OOXMLShapes::sptCWedgeRoundRectCallout; + break; + } + return OOXMLShapes::sptNil; + } } namespace PPT_FORMAT { -class CImageElement : public CElement -{ -public: - std::wstring m_strImageFileName; + class CImageElement : public CElement + { + public: + std::wstring m_strImageFileName; - BYTE m_nAlpha; + BYTE m_nAlpha; - bool m_bCropEnabled; + bool m_bCropEnabled; - _INT32 m_lcropFromRight; - _INT32 m_lcropFromLeft; - _INT32 m_lcropFromTop; - _INT32 m_lcropFromBottom; + _INT32 m_lcropFromRight; + _INT32 m_lcropFromLeft; + _INT32 m_lcropFromTop; + _INT32 m_lcropFromBottom; - _INT32 m_lpictureContrast; - _INT32 m_lpictureBrightness; + _INT32 m_lpictureContrast; + _INT32 m_lpictureBrightness; - bool m_bStretch; - bool m_bTile; + bool m_bStretch; + bool m_bTile; - bool m_bOLE; - bool m_bImagePresent; + bool m_bOLE; + bool m_bImagePresent; - std::wstring m_sImageName; + std::wstring m_sImageName; - CImageElement(); - virtual ~CImageElement(); - virtual CElementPtr CreateDublicate(); - std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false); + CImageElement() : CElement() + { + m_etType = etPicture; + + m_nAlpha = 0xFF; + + m_bCropEnabled = false; + + m_lcropFromRight = 0; + m_lcropFromLeft = 0; + m_lcropFromTop = 0; + m_lcropFromBottom = 0; + + m_lpictureContrast = 0x10000; + m_lpictureBrightness = 0; + + m_bStretch = true; + m_bTile = false; + m_bOLE = false; + m_bImagePresent = false; + + } + virtual ~CImageElement() + { + } + virtual CElementPtr CreateDublicate() + { + CImageElement* pImageElement = new CImageElement(); + + CElementPtr pElement = CElementPtr( pImageElement ); + + SetProperiesToDublicate(pElement); + + pImageElement->m_strImageFileName = m_strImageFileName; + pImageElement->m_nAlpha = m_nAlpha; + + pImageElement->m_bCropEnabled = m_bCropEnabled; + + pImageElement->m_lcropFromRight = m_lcropFromRight; + pImageElement->m_lcropFromLeft = m_lcropFromLeft; + pImageElement->m_lcropFromTop = m_lcropFromTop; + pImageElement->m_lcropFromBottom = m_lcropFromBottom; + + pImageElement->m_bStretch = m_bStretch; + pImageElement->m_bTile = m_bTile; + pImageElement->m_bImagePresent = m_bImagePresent; + pImageElement->m_bOLE = m_bOLE; + + return pElement; + } + AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false) + { + NSGuidesVML::CFormParam pParamCoef; + pParamCoef.m_eType = ptValue; + pParamCoef.m_lParam = 65536; + pParamCoef.m_lCoef = 65536; + + return ConvertPPTtoPPTX(/*pPPTShape,*/ pParamCoef, bIsNamespace); + } - std::wstring ConvertPPTtoPPTX(const NSGuidesVML::CFormParam& pCoef, bool bIsNamespace = false); + std::wstring ConvertPPTtoPPTX(/*CPPTShape* pPPTShape, */const NSGuidesVML::CFormParam& pCoef, bool bIsNamespace = false) + { + if (bIsNamespace) + { + return _T(""); + } + return _T(""); + + std::wstring strXmlPPTX = bIsNamespace ? _T("") : _T(""); - std::wstring DownloadImage(const std::wstring& strFile); -}; + strXmlPPTX += _T(""); + return strXmlPPTX; + } -class CShapeElement : public CElement -{ -public: - NSBaseShape::ClassType m_ClassType; + AVSINLINE std::wstring DownloadImage(const std::wstring& strFile); + }; - int m_lShapeType; - CShapePtr m_pShape; - bool m_bShapePreset; // or rect ( + class CShapeElement : public CElement + { + public: + NSBaseShape::ClassType m_ClassType; - CShapeElement(NSBaseShape::ClassType ClassType, int eType); + int m_lShapeType; + CShapePtr m_pShape; + bool m_bShapePreset; // or rect ( + + CShapeElement(NSBaseShape::ClassType ClassType, int eType) : CElement() + { + m_lShapeType = eType; + m_ClassType = ClassType; + m_etType = etShape; - CShapeElement(); + m_pShape = CShapePtr( new CShape(ClassType, eType)); - CShapeElement(const std::wstring& str); - //virtual void NormalizeCoordsByMetric() - //{ - // CElement::NormalizeCoordsByMetric(); + m_pShape->m_rcBounds = m_bChildAnchorEnabled ? m_rcChildAnchor : m_rcAnchor; - // double dScaleX = (double)m_oMetric.m_lUnitsHor / m_oMetric.m_lMillimetresHor; - // double dScaleY = (double)m_oMetric.m_lUnitsVer / m_oMetric.m_lMillimetresVer; + m_pShape->m_dStartTime = m_dStartTime; + m_pShape->m_dEndTime = m_dEndTime; - // m_pShape->m_oText.m_oBounds.left = (int)(dScaleX * m_pShape->m_oText.m_oBounds.left); - // m_pShape->m_oText.m_oBounds.right = (int)(dScaleX * m_pShape->m_oText.m_oBounds.right); - // m_pShape->m_oText.m_oBounds.top = (int)(dScaleY * m_pShape->m_oText.m_oBounds.top); - // m_pShape->m_oText.m_oBounds.bottom = (int)(dScaleY * m_pShape->m_oText.m_oBounds.bottom); - //} - virtual ~CShapeElement(); + m_bShapePreset = false; - virtual CElementPtr CreateDublicate(); - bool SetUpTextPlaceholder(std::wstring newText); + } - virtual void SetupProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout); + CShapeElement() : CElement() + { + m_lShapeType = 0x1000; + m_etType = etShape; + m_bShapePreset = false; + + m_pShape = CShapePtr( new CShape(NSBaseShape::unknown, 0x1000)); + } - virtual void SetupTextProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout); + CShapeElement(const std::wstring& str) : CElement() + { + m_lShapeType = 0x1000; + m_bShapePreset = false; - void CalculateColor(CColor& oColor, CSlide* pSlide, CTheme* pTheme, CLayout* pLayout); + m_pShape = CShapePtr( new CShape(NSBaseShape::unknown, 0x1000)); + m_pShape->LoadFromXML(str); + + m_ClassType = m_pShape->getBaseShape()->GetClassType(); + } + //virtual void NormalizeCoordsByMetric() + //{ + // CElement::NormalizeCoordsByMetric(); - std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false); + // double dScaleX = (double)m_oMetric.m_lUnitsHor / m_oMetric.m_lMillimetresHor; + // double dScaleY = (double)m_oMetric.m_lUnitsVer / m_oMetric.m_lMillimetresVer; + + // m_pShape->m_oText.m_oBounds.left = (int)(dScaleX * m_pShape->m_oText.m_oBounds.left); + // m_pShape->m_oText.m_oBounds.right = (int)(dScaleX * m_pShape->m_oText.m_oBounds.right); + // m_pShape->m_oText.m_oBounds.top = (int)(dScaleY * m_pShape->m_oText.m_oBounds.top); + // m_pShape->m_oText.m_oBounds.bottom = (int)(dScaleY * m_pShape->m_oText.m_oBounds.bottom); + //} + virtual ~CShapeElement() + { + } + + virtual CElementPtr CreateDublicate() + { + CShapeElement* pShapeElement = new CShapeElement(m_ClassType, m_lShapeType); + + CElementPtr pElement = CElementPtr( pShapeElement ); + + SetProperiesToDublicate(pElement); + + pShapeElement->m_lShapeType = m_lShapeType; + pShapeElement->m_bShapePreset = m_bShapePreset; + + m_pShape->SetToDublicate(pShapeElement->m_pShape.get()); + + return pElement; + } + bool SetUpTextPlaceholder(std::wstring newText); + + virtual void SetupProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout) + { + m_pShape->m_oText.m_lPlaceholderType = m_lPlaceholderType; + m_pShape->m_oText.m_lPlaceholderID = m_lPlaceholderID; + + m_pShape->getBaseShape()->ReCalculate(); + + SetupTextProperties(pSlide, pTheme, pLayout); + + CalculateColor(m_oPen.Color , pSlide, pTheme, pLayout); + CalculateColor(m_oBrush.Color1 , pSlide, pTheme, pLayout); + CalculateColor(m_oBrush.Color2 , pSlide, pTheme, pLayout); + } + + virtual void SetupTextProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout); + + void CalculateColor(CColor& oColor, CSlide* pSlide, CTheme* pTheme, CLayout* pLayout); + + AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false) + { + CPPTShape* pPPTShape = dynamic_cast(m_pShape->getBaseShape().get()); + if (NULL == pPPTShape) + { + // такого быть не может + return _T(""); + } + + NSGuidesVML::CFormParam pParamCoef; + pParamCoef.m_eType = ptValue; + pParamCoef.m_lParam = 65536; + pParamCoef.m_lCoef = 65536; + + return ConvertPPTtoPPTX(pPPTShape, pParamCoef, bIsNamespace); + } #ifndef OPTIMIZE_COMPILE_CONVERT_PPT_TO_PPTX - std::wstring ConvertPPTtoPPTX(CPPTShape* pPPTShape, const NSGuidesVML::CFormParam& pCoef, bool bIsNamespace = false); + std::wstring ConvertPPTtoPPTX(CPPTShape* pPPTShape, const NSGuidesVML::CFormParam& pCoef, bool bIsNamespace = false) + { + if (pPPTShape->m_eType == PPTShapes::sptCRect) + { + if (bIsNamespace) + { + return _T(""); + } + return _T(""); + } + + std::wstring strXmlPPTX = bIsNamespace ? _T("") : _T(""); + + CFormulaConverter pFormulaConverter; + + //coeff + pFormulaConverter.ConvertCoef ( pCoef ); + + //guids---------------------------------------- + int nGuidCount = pPPTShape->m_oManager.m_arFormulas.size(); + if (0 != nGuidCount) + { + pFormulaConverter.ConvertFormula ( pPPTShape->m_oManager.m_arFormulas); + } + + //path------------------------------------------ + int nPathCount = pPPTShape->m_strPath.GetLength(); + if (0 != nPathCount && pPPTShape->m_eType != 1) + { + pFormulaConverter.ConvertPath (pPPTShape->m_strPath, pPPTShape->m_oPath); + + //string rect + int nRectCount = (int)pPPTShape->m_arStringTextRects.GetCount(); + if (0 != nRectCount) + { + pFormulaConverter.ConvertTextRect ( pPPTShape->m_arStringTextRects[0] ); + } + + int nHandlesCount = pPPTShape->m_arHandles.size(); + int nAdjCount = pPPTShape->m_arAdjustments.size(); + + //handles + if (0 != nHandlesCount || 0 != nAdjCount) + { + pFormulaConverter.ConvertHandle (pPPTShape->m_arHandles, pPPTShape->m_arAdjustments, pPPTShape->m_eType); + } + pFormulaConverter.strGuidsRes = pFormulaConverter.strCoef + pFormulaConverter.strGuidsRes; + + //adj---------------------------- + if (pFormulaConverter.strAdjRes.GetLength() == 0) + strXmlPPTX += _T(""); + else + strXmlPPTX += _T("") + pFormulaConverter.strAdjRes + _T(""); + + //guids-------------------------- + if (pFormulaConverter.strGuidsRes.GetLength() == 0) + strXmlPPTX += _T(""); + else + strXmlPPTX += _T("") + pFormulaConverter.strGuidsRes + _T(""); + + //handles--------------------------- + if (pFormulaConverter.strHandleRes.GetLength() == 0) + strXmlPPTX += _T(""); + else + strXmlPPTX += _T("") + pFormulaConverter.strHandleRes + _T(""); + + //connectors------------------------- + strXmlPPTX += _T(""); + + //textRect--------------------------- + if (pFormulaConverter.strTextRect.GetLength() != 0) + strXmlPPTX += pFormulaConverter.strTextRect; + + //path------------------------------ + strXmlPPTX += _T(""); + strXmlPPTX += pFormulaConverter.strPathRes; + strXmlPPTX += _T(""); + } + + strXmlPPTX += _T(""); + return strXmlPPTX; + } #else - std::wstring ConvertPPTtoPPTX(CPPTShape* pPPTShape, const NSGuidesVML::CFormParam& pCoef, bool bIsNamespace = false); + std::wstring ConvertPPTtoPPTX(CPPTShape* pPPTShape, const NSGuidesVML::CFormParam& pCoef, bool bIsNamespace = false) + { + if (pPPTShape->m_eType == PPTShapes::sptCRect || pPPTShape->m_eType == PPTShapes::sptCFrame || pPPTShape->m_eType == PPTShapes::sptCTextBox) + { + if (bIsNamespace) + { + return _T(""); + } + return _T(""); + } + else if (pPPTShape->m_eType == PPTShapes::sptCLine) + { + if (bIsNamespace) + { + return _T(""); + } + return _T(""); + } + else if (pPPTShape->m_eType == PPTShapes::sptCEllipse) + { + if (bIsNamespace) + { + return _T(""); + } + return _T(""); + } + std::wstring strXmlPPTX = bIsNamespace ? _T("") : _T(""); + + CFormulaConverter pFormulaConverter; + + //coeff + pFormulaConverter.ConvertCoef(pCoef); + + //guids---------------------------------------- + int nGuidCount = (int)pPPTShape->m_oManager.m_arFormulas.size(); + if (0 != nGuidCount) + { + pFormulaConverter.ConvertFormula(pPPTShape->m_oManager.m_arFormulas); + } + + //path------------------------------------------ + int nPathCount = (int)pPPTShape->m_strPath.length(); + if (0 != nPathCount && pPPTShape->m_eType != 1) + { + pFormulaConverter.ConvertPath(pPPTShape->m_strPath, pPPTShape->m_oPath); + + //string rect + int nRectCount = (int)pPPTShape->m_arStringTextRects.size(); + if (0 != nRectCount && !pPPTShape->m_arStringTextRects[0].empty()) + { + if (pPPTShape->m_eType == PPTShapes::sptCNotchedCircularArrow) + { + pFormulaConverter.SetTextRectDefault(); + } + else + { + pFormulaConverter.ConvertTextRect(pPPTShape->m_arStringTextRects[0]); + } + } + + int nHandlesCount = (int)pPPTShape->m_arHandles.size(); + int nAdjCount = (int)pPPTShape->m_arAdjustments.size(); + + //handles + if (0 != nHandlesCount || 0 != nAdjCount) + { + pFormulaConverter.ConvertHandle(pPPTShape->m_arHandles, pPPTShape->m_arAdjustments, pPPTShape->m_eType); + } + + //adj---------------------------- + if (pFormulaConverter.m_oAdjRes.GetSize() == 0) + strXmlPPTX += _T(""); + else + strXmlPPTX += _T("") + pFormulaConverter.m_oAdjRes.GetXmlString() + _T(""); + + //guids-------------------------- + if (pFormulaConverter.m_oGuidsRes.GetSize() == 0) + strXmlPPTX += _T("") + pFormulaConverter.m_oCoef.GetXmlString() + _T(""); + else + strXmlPPTX += _T("") + pFormulaConverter.m_oCoef.GetXmlString() + pFormulaConverter.m_oGuidsRes.GetXmlString() + _T(""); + + //handles--------------------------- + if (pFormulaConverter.m_oHandleRes.GetSize() == 0) + strXmlPPTX += _T(""); + else + strXmlPPTX += _T("") + pFormulaConverter.m_oHandleRes.GetXmlString() + _T(""); + + //connectors------------------------- + strXmlPPTX += _T(""); + + //textRect--------------------------- + if (pFormulaConverter.m_oTextRect.GetSize() != 0) + strXmlPPTX += pFormulaConverter.m_oTextRect.GetXmlString(); + + //path------------------------------ + strXmlPPTX += _T(""); + strXmlPPTX += pFormulaConverter.m_oPathRes.GetXmlString(); + strXmlPPTX += _T(""); + } + else + { + return _T(""); + } + + strXmlPPTX += _T(""); + return strXmlPPTX; + } #endif + + }; -}; + class CAudioElement : public CImageElement + { + public: + std::wstring m_strAudioFileName; + + BYTE m_nAmplify; + bool m_bWithVideo; + double m_dAudioDuration; -class CAudioElement : public CImageElement -{ -public: - std::wstring m_strAudioFileName; + double m_dClipStartTime; + double m_dClipEndTime; + bool m_bLoop; - BYTE m_nAmplify; - bool m_bWithVideo; - double m_dAudioDuration; + CAudioElement() : CImageElement() + { + m_etType = etAudio; + + m_nAmplify = 100; + m_bWithVideo = false; - double m_dClipStartTime; - double m_dClipEndTime; - bool m_bLoop; + m_dAudioDuration = 0.0; + m_bLoop = false; - CAudioElement(); + m_dClipStartTime = 0.0; + m_dClipEndTime = -1.0; + } - virtual ~CAudioElement(); + virtual ~CAudioElement() + { + } - virtual CElementPtr CreateDublicate(); -}; + virtual CElementPtr CreateDublicate() + { + CAudioElement* pAudioElement = new CAudioElement(); + CElementPtr pElement = CElementPtr( pAudioElement ); + + SetProperiesToDublicate(pElement); -class CVideoElement : public CImageElement -{ -public: - std::wstring m_strVideoFileName; - double m_dVideoDuration; - BYTE m_nAlpha; + pAudioElement->m_strAudioFileName = m_strAudioFileName; + pAudioElement->m_nAmplify = m_nAmplify; + pAudioElement->m_bWithVideo = m_bWithVideo; - double m_dClipStartTime; - double m_dClipEndTime; + pAudioElement->m_dAudioDuration = m_dAudioDuration; + pAudioElement->m_bLoop = m_bLoop; - bool m_bLoop; + pAudioElement->m_dClipStartTime = m_dClipStartTime; + pAudioElement->m_dClipEndTime = m_dClipEndTime; - CVideoElement(); + return pElement; + } + }; - virtual ~CVideoElement(); + class CVideoElement : public CImageElement + { + public: + std::wstring m_strVideoFileName; + double m_dVideoDuration; + BYTE m_nAlpha; - virtual CElementPtr CreateDublicate(); -}; + double m_dClipStartTime; + double m_dClipEndTime; -class CGroupElement : public CElement -{ -public: + bool m_bLoop; -public: - CGroupElement(); - virtual ~CGroupElement(); - virtual CElementPtr CreateDublicate(); - std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false); -}; + CVideoElement() : CImageElement() + { + m_etType = etVideo; + + m_dVideoDuration = 0.0; + m_nAlpha = 0xFF; + + m_dClipStartTime = -1.0; + m_dClipEndTime = -1.0; + m_bLoop = false; + } -class CTableElement : public CElement -{ -public: - std::wstring m_xmlRawData; -public: - CTableElement(); - virtual ~CTableElement(); - virtual CElementPtr CreateDublicate(); - int GetWidth()const; - int GetHeight()const; - std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false); -}; + virtual ~CVideoElement() + { + } + + virtual CElementPtr CreateDublicate() + { + CVideoElement* pVideoElement = new CVideoElement(); + + CElementPtr pElement = CElementPtr( pVideoElement ); + + SetProperiesToDublicate(pElement); + + pVideoElement->m_strVideoFileName = m_strVideoFileName; + pVideoElement->m_nAlpha = m_nAlpha; + + pVideoElement->m_dVideoDuration = m_dVideoDuration; + + pVideoElement->m_dClipStartTime = m_dClipStartTime; + pVideoElement->m_dClipEndTime = m_dClipEndTime; + pVideoElement->m_bLoop = m_bLoop; + + return pElement; + } + }; + + class CGroupElement : public CElement + { + public: + + public: + CGroupElement() : CElement() + { + m_etType = etGroup; + } + virtual ~CGroupElement() + { + } + virtual CElementPtr CreateDublicate() + { + CGroupElement* pGroupElement = new CGroupElement(); + + CElementPtr pElement = CElementPtr( pGroupElement ); + + SetProperiesToDublicate(pElement); + + return pElement; + } + AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false) + { + + return L""; + } + }; + + class CTableElement : public CElement + { + public: + std::wstring m_xmlRawData; + public: + CTableElement() : CElement() + { + m_etType = etTable; + } + virtual ~CTableElement() + { + } + virtual CElementPtr CreateDublicate() + { + CTableElement* pTableElement = new CTableElement(); + + CElementPtr pElement = CElementPtr( pTableElement ); + + SetProperiesToDublicate(pElement); + + return pElement; + } + int GetWidth()const + { + double multip = m_bAnchorEnabled ? 1587.5 : 1; + return round(m_rcAnchor.GetWidth() * multip); + } + int GetHeight()const + { + double multip = m_bAnchorEnabled ? 1587.5 : 1; + return round(m_rcAnchor.GetHeight() * multip); + } + AVSINLINE std::wstring ConvertPPTShapeToPPTX(bool bIsNamespace = false) + { + + return L""; + } + }; } diff --git a/MsBinaryFile/PptFile/Drawing/Layout.h b/MsBinaryFile/PptFile/Drawing/Layout.h index b7e523c4bd..f46d070e8a 100644 --- a/MsBinaryFile/PptFile/Drawing/Layout.h +++ b/MsBinaryFile/PptFile/Drawing/Layout.h @@ -36,10 +36,124 @@ namespace PPT_FORMAT { +// enum eSlideSize +// { +// SS_Screen = 0, +// SS_LetterPaper = 1, +// SS_A4Paper = 2, +// SS_35mm = 3, +// SS_Overhead = 4, +// SS_Banner = 5, +// SS_Custom = 6 +// }; -void CorrectPlaceholderType(int & type); -bool isTitlePlaceholder(int type); -bool isBodyPlaceholder(int type); +// enum ePlaceholderType +// { +// PT_None = 0, +// PT_MasterTitle = 1, +// PT_MasterBody = 2, +// PT_MasterCenterTitle = 3, +// PT_MasterSubTitle = 4, +// PT_MasterNotesSlideImage = 5, +// PT_MasterNotesBody = 6, +// PT_MasterDate = 7, +// PT_MasterSlideNumber = 8, +// PT_MasterFooter = 9, +// PT_MasterHeader = 10, +// PT_NotesSlideImage = 11, +// PT_NotesBody = 12, +// PT_Title = 13, +// PT_Body = 14, +// PT_CenterTitle = 15, +// PT_SubTitle = 16, +// PT_VerticalTitle = 17, +// PT_VerticalBody = 18, +// PT_Object = 19, +// PT_Graph = 20, +// PT_Table = 21, +// PT_ClipArt = 22, +// PT_OrgChart = 23, +// PT_Media = 24, +// PT_Body_Empty = 25 +// }; + +// enum Instances +// { +// CollectionOfSlides = 0, +// CollectionOfMasterSlides = 1, +// CollectionOfNotesSlides = 2 +// }; + +// enum eSlideLayoutType +// { +// SL_TitleSlide = 0, +// SL_TitleBody = 1, +// SL_MasterTitle = 2, +// SL_TitleOnly = 7, +// SL_TwoColumns = 8, +// SL_TwoRows = 9, +// SL_ColumnTwoRows = 10, +// SL_TwoRowsColumn = 11, +// SL_TwoColumnsRow = 13, +// SL_FourObjects = 14, +// SL_BigObject = 15, +// SL_Blank = 16, +// SL_VerticalTitleBody = 17, +// SL_VerticalTwoRows = 18 +// }; + +// enum eTextType +// { +// Tx_TYPE_TITLE = 0, +// Tx_TYPE_BODY = 1, +// Tx_TYPE_NOTES = 2, +// Tx_TYPE_OTHER = 4, +// Tx_TYPE_CENTERBODY = 5, +// Tx_TYPE_CENTERTITLE = 6, +// Tx_TYPE_HALFBODY = 7, +// Tx_TYPE_QUARTERBODY = 8, + +// NoPresent = 0xFF +// }; + static void CorrectPlaceholderType(int & type) + { + switch (type) + { + case PT_MasterTitle: type = PT_Title; break; + case PT_MasterBody: type = PT_Body; break; + case PT_MasterCenterTitle: type = PT_CenterTitle; break; + case PT_MasterSubTitle: type = PT_SubTitle; break; + case PT_MasterNotesSlideImage: type = PT_NotesSlideImage; break; + case PT_MasterNotesBody: type = PT_NotesBody; break; + } + } + + static bool isTitlePlaceholder(int type) + { + switch (type) + { + case PT_MasterTitle: + case PT_MasterCenterTitle: + case PT_Title: + case PT_CenterTitle: + case PT_VerticalTitle: + return true; + default: + return false; + } + } + static bool isBodyPlaceholder(int type) + { + switch (type) + { + case PT_MasterBody: + case PT_Body: + case PT_VerticalBody: + return true; + default: + return false; + } + } class CLayout { @@ -66,17 +180,118 @@ bool isBodyPlaceholder(int type); std::wstring m_sName; - CLayout(); - void Clear(); + CLayout() + { + Clear(); + } + void Clear() + { + m_arElements.clear(); + m_mapPlaceholders.clear(); - void CreateDublicateElements(); + m_bIsTitleMaster = false; - CElementPtr GetPlaceholder(LONG lID); + m_bHasDate = false; + m_bHasSlideNumber = false; + m_bHasFooter = false; + m_nFormatDate = 1; - LONG GetCountPlaceholderWithType(LONG lType); - ODRAW::CColor GetColor(const LONG& lIndexScheme); + for (int i = 0 ; i < 3 ; i++) + m_PlaceholdersReplaceString[i].clear(); - static void CheckPlaceholderStyle(std::wstring strStyleName, LONG& lType, LONG& lLevel, LONG& lTypeStyle); + m_bUseThemeColorScheme = true; + m_bShowMasterShapes = true; + m_strLayoutType = _T("obj"); + m_bIsBackground = false; + } + + void CreateDublicateElements() + { + // просто из всех своих элементов делаем дубликата + + for (size_t nIndex = 0; nIndex < m_arElements.size(); ++nIndex) + { + CElementPtr pElem = m_arElements[nIndex]; + if (NULL != pElem) + { + m_arElements[nIndex] = pElem->CreateDublicate(); + } + } + } + + CElementPtr GetPlaceholder(LONG lID) + { + size_t nCount = m_arElements.size(); + + for (size_t i = 0; i < nCount; ++i) + { + CElementPtr pElem = m_arElements[i]; + + if (pElem->m_lPlaceholderType == lID) + { + return pElem; + } + } + + return CElementPtr(); + } + + LONG GetCountPlaceholderWithType(LONG lType) + { + LONG lFound = 0; + + for (size_t i = 0; i < m_arElements.size(); ++i) + { + if (m_arElements[i]->m_lPlaceholderType == lType) + { + ++lFound; + } + } + + return lFound; + } + ODRAW::CColor GetColor(const LONG& lIndexScheme) + { + if (lIndexScheme < (LONG)m_arColorScheme.size()) + { + return m_arColorScheme[lIndexScheme]; + } + return ODRAW::CColor(); + } + + static void CheckPlaceholderStyle(std::wstring strStyleName, LONG& lType, LONG& lLevel, LONG& lTypeStyle) + { + size_t nLen = strStyleName.length(); + wchar_t* pData = (wchar_t*)strStyleName.c_str(); + + lType = 0; + lLevel = 0; + lTypeStyle = -1; + + wchar_t* pDataEnd = pData + nLen; + wchar_t* pDataMem = pData + 1; + for (; ((pDataMem < pDataEnd) && XmlUtils::IsDigit(*pDataMem)); ++pDataMem) + { + lType *= 10; + lType += (*pDataMem - ((wchar_t)'0')); + } + + pDataMem += 4; + for (; ((pDataMem < pDataEnd) && XmlUtils::IsDigit(*pDataMem)); ++pDataMem) + { + lLevel *= 10; + lLevel += (*pDataMem - ((wchar_t)'0')); + } + + ++pDataMem; + if (pDataMem + 1 < pDataEnd) + { + if ((wchar_t('c') == pDataMem[0]) && (wchar_t('f') == pDataMem[1])) + lTypeStyle = 1; + if ((wchar_t('p') == pDataMem[0]) && (wchar_t('f') == pDataMem[1])) + lTypeStyle = 0; + } + } }; typedef boost::shared_ptr CLayoutPtr; } diff --git a/MsBinaryFile/PptFile/Drawing/Slide.h b/MsBinaryFile/PptFile/Drawing/Slide.h index 54ed56eeb5..db85646c69 100644 --- a/MsBinaryFile/PptFile/Drawing/Slide.h +++ b/MsBinaryFile/PptFile/Drawing/Slide.h @@ -66,13 +66,125 @@ namespace PPT_FORMAT std::wstring m_strComment; std::wstring m_sName; - CSlide(); - ~CSlide(); - CSlide(const CSlide& oSrc); + CSlide() : m_oSlideShow() + { + Clear(); + } + ~CSlide() + { + Clear(); + } - void Clear(); + void Clear() + { + m_arColorScheme.clear(); + m_arElements.clear(); + + m_lThemeID = -1; + m_lLayoutID = -1; + m_lSlideID = -1; + m_lNotesID = -1; - void SetUpPlaceholderStyles(PPT_FORMAT::CLayout* pLayout); - ODRAW::CColor GetColor(const LONG& lIndexScheme); + m_dStartTime = 0.0; + m_dEndTime = 0.0; + m_dDuration = 30000.0; + + m_bShowMasterShapes = true; + m_strComment.clear(); + m_sName.clear(); + + for (int i = 0 ; i < 3 ; i++) + m_PlaceholdersReplaceString[i].clear(); + } + + CSlide(const CSlide& oSrc) + { + Clear(); + + size_t nCount = oSrc.m_arElements.size(); + for (size_t nIndex = 0; nIndex < nCount; ++nIndex) + { + m_arElements.push_back(oSrc.m_arElements[nIndex]->CreateDublicate()); + } + + m_arColorScheme = oSrc.m_arColorScheme; + + m_oSlideShow = oSrc.m_oSlideShow; + + m_lThemeID = oSrc.m_lThemeID; + m_lLayoutID = oSrc.m_lLayoutID; + m_lNotesID = oSrc.m_lNotesID; + m_lSlideID = oSrc.m_lSlideID; + + m_dStartTime = oSrc.m_dStartTime; + m_dEndTime = oSrc.m_dEndTime; + m_dDuration = oSrc.m_dDuration; + + m_bIsBackground = oSrc.m_bIsBackground; + m_oBackground = oSrc.m_oBackground; + + m_bShowMasterShapes = oSrc.m_bShowMasterShapes; + + for (int i = 0 ; i < 3 ; i++) m_PlaceholdersReplaceString[i] = oSrc.m_PlaceholdersReplaceString[i]; + + m_strComment = oSrc.m_strComment; + m_sName = oSrc.m_sName; + } + + void SetUpPlaceholderStyles(PPT_FORMAT::CLayout* pLayout) + { + size_t nCountElements = m_arElements.size(); + for (size_t nEl = 0; nEl < nCountElements; ++nEl) + { + if (-1 != m_arElements[nEl]->m_lPlaceholderType && etShape == m_arElements[nEl]->m_etType) + { + CShapeElement* pSlideElement = dynamic_cast(m_arElements[nEl].get()); + + if (NULL != pSlideElement) + { + LONG lCountThisType = pLayout->GetCountPlaceholderWithType(pSlideElement->m_lPlaceholderType); + + size_t nCountLayout = pLayout->m_arElements.size(); + for (size_t i = 0; i < nCountLayout; ++i) + { + if (1 == lCountThisType) + { + if ((pLayout->m_arElements[i]->m_lPlaceholderType == pSlideElement->m_lPlaceholderType) && + (pLayout->m_arElements[i]->m_etType == etShape)) + { + CShapeElement* pLayoutElement = dynamic_cast(pLayout->m_arElements[i].get()); + if (NULL != pLayoutElement) + { + pSlideElement->m_pShape->m_oText.m_oLayoutStyles = pLayoutElement->m_pShape->m_oText.m_oStyles; + } + } + } + else + { + if ((pLayout->m_arElements[i]->m_lPlaceholderType == pSlideElement->m_lPlaceholderType) && + (pLayout->m_arElements[i]->m_lPlaceholderID == pSlideElement->m_lPlaceholderID) && + (pLayout->m_arElements[i]->m_etType == etShape)) + { + CShapeElement* pLayoutElement = dynamic_cast(pLayout->m_arElements[i].get()); + if (NULL != pLayoutElement) + { + pSlideElement->m_pShape->m_oText.m_oLayoutStyles = pLayoutElement->m_pShape->m_oText.m_oStyles; + } + } + } + } + } + } + } + } + + ODRAW::CColor GetColor(const LONG& lIndexScheme) + { + if (lIndexScheme < (LONG)m_arColorScheme.size()) + { + return m_arColorScheme[lIndexScheme]; + } + return ODRAW::CColor(); + } }; } diff --git a/MsBinaryFile/PptFile/Drawing/TextAttributesEx.cpp b/MsBinaryFile/PptFile/Drawing/TextAttributesEx.cpp index d3dcfda3f3..ea764bd6c2 100644 --- a/MsBinaryFile/PptFile/Drawing/TextAttributesEx.cpp +++ b/MsBinaryFile/PptFile/Drawing/TextAttributesEx.cpp @@ -35,96 +35,24 @@ namespace PPT_FORMAT { -CTextAttributesEx::CTextAttributesEx() : - m_oAttributes(), - m_arParagraphs(), - m_oRuler(), - m_oLayoutStyles(), - m_oStyles() -{ - m_lTextType = -1; - m_lPlaceholderType = -1; - m_lPlaceholderID = -1; - - m_lStyleThemeIndex = -1; - - m_lFontRef = -1; - m_bIsSlideFontRef = false; - - m_oBounds.left = 0; - m_oBounds.top = 0; - m_oBounds.right = 50; - m_oBounds.bottom = 50; - - m_bVertical = false; - m_bAutoFit = false; - m_lWrapMode = 0; - m_nTextFlow = -1; - - m_lTextMasterType = -1; -} - -CTextAttributesEx &CTextAttributesEx::operator =(const CTextAttributesEx &oSrc) -{ - m_oBounds = oSrc.m_oBounds; - - m_lTextType = oSrc.m_lTextType; - m_lPlaceholderType = oSrc.m_lPlaceholderType; - m_lPlaceholderID = oSrc.m_lPlaceholderID; - - m_lFontRef = oSrc.m_lFontRef; - m_bIsSlideFontRef = oSrc.m_bIsSlideFontRef; - - m_oAttributes = oSrc.m_oAttributes; - m_bVertical = oSrc.m_bVertical; - m_lWrapMode = oSrc.m_lWrapMode; - m_bAutoFit = oSrc.m_bAutoFit; - m_nTextFlow = oSrc.m_nTextFlow; - - m_arParagraphs.insert(m_arParagraphs.end(), oSrc.m_arParagraphs.begin(), oSrc.m_arParagraphs.end()); - m_oRuler = oSrc.m_oRuler; - - m_oLayoutStyles = oSrc.m_oLayoutStyles; - m_oStyles = oSrc.m_oStyles; - - m_lTextMasterType = oSrc.m_lTextMasterType; - - return *this; -} - -CTextAttributesEx::CTextAttributesEx(const CTextAttributesEx &oSrc) -{ - *this = oSrc; -} - -CTextAttributesEx::~CTextAttributesEx() -{ - m_arParagraphs.clear(); -} - -void CTextAttributesEx::NormalizeString(std::wstring &strText) -{ - strText = XmlUtils::EncodeXmlString(strText); -} - -void CTextAttributesEx::RecalcParagraphsPPT() -{ - for (size_t i = 0; i < m_arParagraphs.size(); ++i) + void CTextAttributesEx::RecalcParagraphsPPT() { - bool split_paragraph = false; - for (size_t j = 0; j < m_arParagraphs[i].m_arSpans.size(); ++j) + for (size_t i = 0; i < m_arParagraphs.size(); ++i) { - size_t lCountCFs = m_arParagraphs[i].m_arSpans.size(); - size_t s_size = m_arParagraphs[i].m_arSpans[j].m_strText.length(); - - size_t lFoundEnter = m_arParagraphs[i].m_arSpans[j].m_strText.find((wchar_t)13); - - if( !split_paragraph && lFoundEnter != std::wstring::npos && - (s_size > 1 || (s_size == 1 && m_arParagraphs[i].m_arSpans.size() > 1))) + bool split_paragraph = false; + for (size_t j = 0; j < m_arParagraphs[i].m_arSpans.size(); ++j) { - split_paragraph = true; - // разбиваем параграф - CParagraph oNewPar = m_arParagraphs[i]; + size_t lCountCFs = m_arParagraphs[i].m_arSpans.size(); + size_t s_size = m_arParagraphs[i].m_arSpans[j].m_strText.length(); + + size_t lFoundEnter = m_arParagraphs[i].m_arSpans[j].m_strText.find((wchar_t)13); + + if( !split_paragraph && lFoundEnter != std::wstring::npos && + (s_size > 1 || (s_size == 1 && m_arParagraphs[i].m_arSpans.size() > 1))) + { + split_paragraph = true; + // разбиваем параграф + CParagraph oNewPar = m_arParagraphs[i]; if (lCountCFs - (j + 1) > 0) { @@ -524,9 +452,4 @@ void CTextAttributesEx::RecalcParagraphsPPT() }; } - bool CTextAttributesEx::IsEmptyText() - { - return (0 == m_arParagraphs.size()) ? true : false; - } - } diff --git a/MsBinaryFile/PptFile/Drawing/TextAttributesEx.h b/MsBinaryFile/PptFile/Drawing/TextAttributesEx.h index e3019c5d6e..2fee3dbd56 100644 --- a/MsBinaryFile/PptFile/Drawing/TextAttributesEx.h +++ b/MsBinaryFile/PptFile/Drawing/TextAttributesEx.h @@ -84,21 +84,85 @@ namespace PPT_FORMAT bool m_bIsSlideFontRef; int m_lFontRef; + CTextAttributesEx() : + m_oAttributes(), + m_arParagraphs(), + m_oRuler(), + m_oLayoutStyles(), + m_oStyles() + { + m_lTextType = -1; + m_lPlaceholderType = -1; + m_lPlaceholderID = -1; - CTextAttributesEx(); - CTextAttributesEx& operator =(const CTextAttributesEx& oSrc); + m_lStyleThemeIndex = -1; - CTextAttributesEx(const CTextAttributesEx& oSrc); + m_lFontRef = -1; + m_bIsSlideFontRef = false; + + m_oBounds.left = 0; + m_oBounds.top = 0; + m_oBounds.right = 50; + m_oBounds.bottom = 50; - ~CTextAttributesEx(); + m_bVertical = false; + m_bAutoFit = false; + m_lWrapMode = 0; + m_nTextFlow = -1; - void NormalizeString(std::wstring& strText); + m_lTextMasterType = -1; + } + CTextAttributesEx& operator =(const CTextAttributesEx& oSrc) + { + m_oBounds = oSrc.m_oBounds; + + m_lTextType = oSrc.m_lTextType; + m_lPlaceholderType = oSrc.m_lPlaceholderType; + m_lPlaceholderID = oSrc.m_lPlaceholderID; + + m_lFontRef = oSrc.m_lFontRef; + m_bIsSlideFontRef = oSrc.m_bIsSlideFontRef; + + m_oAttributes = oSrc.m_oAttributes; + m_bVertical = oSrc.m_bVertical; + m_lWrapMode = oSrc.m_lWrapMode; + m_bAutoFit = oSrc.m_bAutoFit; + m_nTextFlow = oSrc.m_nTextFlow; + + m_arParagraphs.insert(m_arParagraphs.end(), oSrc.m_arParagraphs.begin(), oSrc.m_arParagraphs.end()); + m_oRuler = oSrc.m_oRuler; + + m_oLayoutStyles = oSrc.m_oLayoutStyles; + m_oStyles = oSrc.m_oStyles; + + m_lTextMasterType = oSrc.m_lTextMasterType; + + return *this; + } + + CTextAttributesEx(const CTextAttributesEx& oSrc) + { + *this = oSrc; + } + + ~CTextAttributesEx() + { + m_arParagraphs.clear(); + } + + inline void NormalizeString(std::wstring& strText) + { + strText = XmlUtils::EncodeXmlString(strText); + } void RecalcParagraphsPPT(); void ApplyThemeStyle (CTheme* pTheme = NULL); void ApplyRuler (CTheme* pTheme); void ApplyRuler (CTextPFRun* pPar, WORD lIndentLevel); - bool IsEmptyText(); + bool IsEmptyText() + { + return (0 == m_arParagraphs.size()) ? true : false; + } }; } diff --git a/MsBinaryFile/PptFile/Drawing/TextStructures.h b/MsBinaryFile/PptFile/Drawing/TextStructures.h index 5fa0ce7752..7506c83c44 100644 --- a/MsBinaryFile/PptFile/Drawing/TextStructures.h +++ b/MsBinaryFile/PptFile/Drawing/TextStructures.h @@ -40,261 +40,786 @@ using namespace ODRAW; namespace PPT_FORMAT { -static std::wstring ToNode(const NSCommon::nullable_base& prop, const std::wstring& strName); -static std::wstring ToNode(const NSCommon::nullable_base& prop, const std::wstring& strName); -static std::wstring ToNode(const NSCommon::nullable_base<_UINT32>& prop, const std::wstring& strName); -static std::wstring ToNode(const NSCommon::nullable_base& prop, const std::wstring& strName); -static std::wstring ToNode(const NSCommon::nullable_base& prop, const std::wstring& strName); + + + #define DEFAULT_BEFORE(EXIST_PARAM, PARAM) \ + if (!EXIST_PARAM && oSrc.##EXIST_PARAM) \ + { \ + EXIST_PARAM = true; \ + PARAM = oSrc.##PARAM; \ + } + + #define APPLY_AFTER(EXIST_PARAM, PARAM) \ + if (oSrc.##EXIST_PARAM) \ + { \ + EXIST_PARAM = true; \ + PARAM = oSrc.##PARAM; \ + } + + static std::wstring ToNode(const NSCommon::nullable_base& prop, const std::wstring& strName) + { + if (!prop.is_init()) return L""; + + return _T("<") + strName + _T(">") + std::to_wstring( (int)prop.get() ) + _T(""); + } + static std::wstring ToNode(const NSCommon::nullable_base& prop, const std::wstring& strName) + { + if (!prop.is_init()) return L""; + + return _T("<") + strName + _T(">") + std::to_wstring( (int)prop.get() ) + _T(""); + } + static std::wstring ToNode(const NSCommon::nullable_base<_UINT32>& prop, const std::wstring& strName) + { + if (!prop.is_init()) return L""; + + return _T("<") + strName + _T(">") + std::to_wstring((int)prop.get()) + _T(""); + } + static std::wstring ToNode(const NSCommon::nullable_base& prop, const std::wstring& strName) + { + if (!prop.is_init()) return L""; + + return _T("<") + strName + _T(">") + XmlUtils::ToString(prop.get()) + _T(""); + } + static std::wstring ToNode(const NSCommon::nullable_base& prop, const std::wstring& strName) + { + if (!prop.is_init()) return L""; + + return _T("<") + strName + _T(">") + std::to_wstring((unsigned int)prop->GetLONG()) + _T(""); + } // std::wstring TextAutoNumberSchemeEnumTOTextAutonumberScheme(const PPT_FORMAT::TextAutoNumberSchemeEnum oldEnum); -class CFontProperty -{ -public: - std::wstring Name; - int PitchFamily; - int Charset; - - CFontProperty(); - CFontProperty(const CFontProperty& oSrc); - CFontProperty& operator=(const CFontProperty& oSrc); - - std::wstring getXmlArgsStr()const; - - static bool IsValidCharset(int value); - - static bool IsValidPitchFamily(int value); - -}; - -class CBulletAutoNum -{ -public: - NSCommon::nullable startAt; - NSCommon::nullable_string type; - - bool isDefault()const; - -}; - -class CBulletBlip -{ -public: - std::wstring tmpImagePath; - SHORT bulletBlipRef; - - bool hasRef()const - {return bulletBlipRef != -1;} -}; - -class CFontProperties -{ -public: - CFontProperties () {} - CFontProperties(const CFontProperties& oSrc); - CFontProperties& operator=(const CFontProperties& oSrc); - NSCommon::nullable_base font; - NSCommon::nullable_base ea; - NSCommon::nullable_base sym; - NSCommon::nullable_base ansi; -}; - -class CTextCFRun -{ -public: - - NSCommon::nullable_base FontBold; - NSCommon::nullable_base FontItalic; - NSCommon::nullable_base FontUnderline; - NSCommon::nullable_base FontStrikeout; - NSCommon::nullable_bool FontShadow; - - NSCommon::nullable_base fontRef; // fontRef - NSCommon::nullable_base eaFontRef; // eaFontRef - NSCommon::nullable_base ansiFontRef; // ansiFontRef - NSCommon::nullable_base symbolFontRef; // symFontRef - NSCommon::nullable_base pp9rt; - - NSCommon::nullable_base BaseLineOffset; // baseline offset - - NSCommon::nullable_base Color; // text color - NSCommon::nullable_base Size; // font size - - NSCommon::nullable_base Cap; // 0 - none, 1 - TEXT, 2 - text - NSCommon::nullable_base Language; - - CFontProperties font; - - CTextCFRun(); - CTextCFRun(const CTextCFRun& oSrc); - CTextCFRun& operator=(const CTextCFRun& oSrc); - ~CTextCFRun(); - - void ApplyBefore(const CTextCFRun& oSrc); - void ApplyAfter(const CTextCFRun& oSrc); -}; - -class CTextPFRun -{ -public: - - NSCommon::nullable_bool hasBullet; - - NSCommon::nullable_base bulletFontRef; - NSCommon::nullable_base bulletSize; - NSCommon::nullable_base bulletChar; - NSCommon::nullable_base bulletColor; - NSCommon::nullable_base bulletFontProperties; - NSCommon::nullable_base bulletAutoNum; - NSCommon::nullable_base bulletBlip; - - NSCommon::nullable_base textAlignment; - NSCommon::nullable_base lineSpacing; - NSCommon::nullable_base spaceBefore; - NSCommon::nullable_base spaceAfter; - NSCommon::nullable_base leftMargin; - NSCommon::nullable_base indent; - NSCommon::nullable_base defaultTabSize; - - std::vector> tabStops; - - bool bIsOneLine; - - NSCommon::nullable_base fontAlign; - NSCommon::nullable_base textDirection; - - NSCommon::nullable_base wrapFlags; - - CTextPFRun(); - - CTextPFRun(const CTextPFRun& oSrc); - - CTextPFRun& operator =(const CTextPFRun& oSrc); - - void ApplyBefore(const CTextPFRun& oSrc); - - void ApplyAfter(const CTextPFRun& oSrc); - - std::wstring ToString(LONG lCount); - -}; - -class CTextRuler -{ -public: - NSCommon::nullable_base DefaultTabSize; - NSCommon::nullable_base CLevels; - - NSCommon::nullable_base TabStops; - std::vector> tabsStops; - - NSCommon::nullable_base LeftMargin1; - NSCommon::nullable_base LeftMargin2; - NSCommon::nullable_base LeftMargin3; - NSCommon::nullable_base LeftMargin4; - NSCommon::nullable_base LeftMargin5; - - NSCommon::nullable_base Indent1; - NSCommon::nullable_base Indent2; - NSCommon::nullable_base Indent3; - NSCommon::nullable_base Indent4; - NSCommon::nullable_base Indent5; - - CTextRuler(); - - CTextRuler(const CTextRuler& oSrc); - - CTextRuler& operator =(const CTextRuler& oSrc); - ~CTextRuler(); - - void ApplyBefore(const CTextRuler& oSrc); - - std::wstring ToString(); -}; - -class CTextSIRun -{ -public: - bool bIsExt; - _UINT32 lCount; - - bool bSpell; - bool bLang; - bool bAltLang; - - bool bPp10ext; - bool bBidi; - bool bSmartTag; - - WORD Spell; - WORD Lang; - WORD AltLang; - - WORD Bidi; - BYTE pp10runid; - - bool bGramma; - - std::vector<_UINT32> arSmartTags; - -public: - - CTextSIRun(); - - CTextSIRun(const CTextSIRun& oSrc); - - CTextSIRun& operator =(const CTextSIRun& oSrc); - - void ApplyBefore(const CTextSIRun& oSrc); - - std::wstring ToString(); -}; - - -class CSpan -{ -public: - CTextCFRun m_oRun; - std::wstring m_strText; - bool m_bField; - bool m_bBreak; - - std::vector m_arrInteractive; - - CSpan(); - CSpan(const CSpan& oSrc); - CSpan& operator=(const CSpan& oSrc); - ~CSpan(); -}; - -class CTextStyleLevel -{ -public: - CTextPFRun m_oPFRun; - CTextCFRun m_oCFRun; - -public: - CTextStyleLevel(); - CTextStyleLevel(const CTextStyleLevel& oSrc); - CTextStyleLevel& operator=(const CTextStyleLevel& oSrc); - - void ApplyAfter(const CTextStyleLevel& oSrc); - void ApplyBefore(const CTextStyleLevel& oSrc); -}; - -class CTextStyles -{ -public: - NSCommon::nullable_base m_pLevels[10]; - - CTextStyles(); - CTextStyles(const CTextStyles& oSrc); - CTextStyles& operator=(const CTextStyles& oSrc); - void SetStyles(CTextStyles* pStyles); - void SetLanguage(nullable & language); - void ApplyAfter(const CTextStyles& oSrc); - void ApplyBefore(const CTextStyles& oSrc); -}; -/////////////////////////////////////////////////////// TODO ///////////////////////////////////// + class CFontProperty + { + public: + std::wstring Name; + int PitchFamily; + int Charset; + + CFontProperty() : PitchFamily(0), Charset(0) {} + + CFontProperty(const CFontProperty& oSrc) + { + *this = oSrc; + } + CFontProperty& operator=(const CFontProperty& oSrc) + { + Name = oSrc.Name; + PitchFamily = oSrc.PitchFamily; + Charset = oSrc.Charset; + + return *this; + } + + std::wstring getXmlArgsStr()const + { + std::wstring str = L" typeface=\"" + Name + L"\""; + if (IsValidPitchFamily(PitchFamily)) + str += L" pitchFamily=\"" + std::to_wstring(PitchFamily) + L"\""; + if (IsValidCharset(Charset)) + str += L" charset=\"" + std::to_wstring((char)Charset) + L"\""; + + return str; + } + + static bool IsValidCharset(int value) + { + if (value <= 0 || value > 255) + return false; + + std::set BLCharset = {128, 136, 129}; + return BLCharset.find(value) == BLCharset.end(); + } + + static bool IsValidPitchFamily(int value) + { + if (value <= 0 || value > 255) + return false; + + std::set BLPitchFamily = {148, 164}; + return BLPitchFamily.find(value) == BLPitchFamily.end(); + } + + }; + + class CBulletAutoNum + { + public: + NSCommon::nullable startAt; + NSCommon::nullable_string type; + + inline bool isDefault()const + {return type.get_value_or(L"arabicPeriod") == L"arabicPeriod" && + (startAt.is_init() ? *startAt == 1 : true);} + + }; + + class CBulletBlip + { + public: + std::wstring tmpImagePath; + SHORT bulletBlipRef; + + bool hasRef()const + {return bulletBlipRef != -1;} + }; + + class CFontProperties + { + public: + CFontProperties () {} + CFontProperties(const CFontProperties& oSrc) + { + *this = oSrc; + } + CFontProperties& operator=(const CFontProperties& oSrc) + { + font = oSrc.font; + ansi = oSrc.ansi; + ea = oSrc.ea; + sym = oSrc.sym; + + return *this; + } + NSCommon::nullable_base font; + NSCommon::nullable_base ea; + NSCommon::nullable_base sym; + NSCommon::nullable_base ansi; + }; + + class CTextCFRun + { + public: + + NSCommon::nullable_base FontBold; + NSCommon::nullable_base FontItalic; + NSCommon::nullable_base FontUnderline; + NSCommon::nullable_base FontStrikeout; + NSCommon::nullable_bool FontShadow; + + NSCommon::nullable_base fontRef; // fontRef + NSCommon::nullable_base eaFontRef; // eaFontRef + NSCommon::nullable_base ansiFontRef; // ansiFontRef + NSCommon::nullable_base symbolFontRef; // symFontRef + NSCommon::nullable_base pp9rt; + + NSCommon::nullable_base BaseLineOffset; // baseline offset + + NSCommon::nullable_base Color; // text color + NSCommon::nullable_base Size; // font size + + NSCommon::nullable_base Cap; // 0 - none, 1 - TEXT, 2 - text + NSCommon::nullable_base Language; + + CFontProperties font; + + CTextCFRun() + { + } + CTextCFRun(const CTextCFRun& oSrc) + { + *this = oSrc; + } + CTextCFRun& operator=(const CTextCFRun& oSrc) + { + FontBold = oSrc.FontBold; + FontItalic = oSrc.FontItalic; + FontUnderline = oSrc.FontUnderline; + FontStrikeout = oSrc.FontStrikeout; + FontShadow = oSrc.FontShadow; + + fontRef = oSrc.fontRef; + eaFontRef = oSrc.eaFontRef; + ansiFontRef = oSrc.ansiFontRef; + symbolFontRef = oSrc.symbolFontRef; + pp9rt = oSrc.pp9rt; + BaseLineOffset = oSrc.BaseLineOffset; + + Color = oSrc.Color; + Size = oSrc.Size; + + font = oSrc.font; + font.ea = oSrc.font.ea; + font.ansi = oSrc.font.ansi; + font.sym = oSrc.font.sym; + + Cap = oSrc.Cap; + + Language = oSrc.Language; + return *this; + } + ~CTextCFRun() + { + } + + AVSINLINE void ApplyBefore(const CTextCFRun& oSrc) + { + if (!FontBold.is_init()) FontBold = oSrc.FontBold; + if (!FontItalic.is_init()) FontItalic = oSrc.FontItalic; + if (!FontUnderline.is_init()) FontUnderline = oSrc.FontUnderline; + if (!FontStrikeout.is_init()) FontStrikeout = oSrc.FontStrikeout; + if (!FontShadow.is_init()) FontShadow = oSrc.FontShadow; + + if (!fontRef.is_init()) fontRef = oSrc.fontRef; + if (!eaFontRef.is_init()) eaFontRef = oSrc.eaFontRef; + if (!ansiFontRef.is_init()) ansiFontRef = oSrc.ansiFontRef; + if (!symbolFontRef.is_init()) symbolFontRef = oSrc.symbolFontRef; + if (!pp9rt.is_init()) pp9rt = oSrc.pp9rt; + if (!BaseLineOffset.is_init()) BaseLineOffset = oSrc.BaseLineOffset; + if (!Color.is_init()) Color = oSrc.Color; + if (!Size.is_init()) Size = oSrc.Size; + if (!Cap.is_init()) Cap = oSrc.Cap; + + if (!font.font.is_init()) font.font = oSrc.font.font; + if (!font.ansi.is_init()) font.ansi = oSrc.font.ansi; + if (!font.ea.is_init()) font.ea = oSrc.font.ea; + if (!font.sym.is_init()) font.sym = oSrc.font.sym; + + if (!Language.is_init()) Language = oSrc.Language; + } + AVSINLINE void ApplyAfter(const CTextCFRun& oSrc) + { + if (oSrc.FontBold.is_init()) FontBold = oSrc.FontBold; + if (oSrc.FontItalic.is_init()) FontItalic = oSrc.FontItalic; + if (oSrc.FontUnderline.is_init()) FontUnderline = oSrc.FontUnderline; + if (oSrc.FontStrikeout.is_init()) FontStrikeout = oSrc.FontStrikeout; + if (oSrc.FontShadow.is_init()) FontShadow = oSrc.FontShadow; + if (oSrc.pp9rt.is_init()) pp9rt = oSrc.pp9rt; + + bool bFontRefSetUp = false; + if (oSrc.fontRef.is_init()) + { + fontRef = oSrc.fontRef; + bFontRefSetUp = true; + } + if (oSrc.eaFontRef.is_init()) eaFontRef = oSrc.eaFontRef; + if (oSrc.ansiFontRef.is_init()) ansiFontRef = oSrc.ansiFontRef; + if (oSrc.symbolFontRef.is_init()) symbolFontRef = oSrc.symbolFontRef; + if (oSrc.BaseLineOffset.is_init()) BaseLineOffset = oSrc.BaseLineOffset; + if (oSrc.pp9rt.is_init()) pp9rt = oSrc.pp9rt; + + if (oSrc.Color.is_init()) Color = oSrc.Color; + if (oSrc.Size.is_init()) Size = oSrc.Size; + if (oSrc.Cap.is_init()) Cap = oSrc.Cap; + if (oSrc.Language.is_init()) Language = oSrc.Language; + + if (oSrc.font.ansi.is_init()) font.ansi = oSrc.font.ansi; + if (oSrc.font.ea.is_init()) font.ea = oSrc.font.ea; + if (oSrc.font.sym.is_init()) font.sym = oSrc.font.sym; + if (oSrc.font.font.is_init()) font.font = oSrc.font.font; + //{ + // FontProperties = oSrc.FontProperties; + // if (!bFontRefSetUp) + // fontRef.reset(); + //} + + } + + }; + + class CTextPFRun + { + public: + + NSCommon::nullable_bool hasBullet; + + NSCommon::nullable_base bulletFontRef; + NSCommon::nullable_base bulletSize; + NSCommon::nullable_base bulletChar; + NSCommon::nullable_base bulletColor; + NSCommon::nullable_base bulletFontProperties; + NSCommon::nullable_base bulletAutoNum; + NSCommon::nullable_base bulletBlip; + + NSCommon::nullable_base textAlignment; + NSCommon::nullable_base lineSpacing; + NSCommon::nullable_base spaceBefore; + NSCommon::nullable_base spaceAfter; + NSCommon::nullable_base leftMargin; + NSCommon::nullable_base indent; + NSCommon::nullable_base defaultTabSize; + + std::vector> tabStops; + + bool bIsOneLine; + + NSCommon::nullable_base fontAlign; + NSCommon::nullable_base textDirection; + + NSCommon::nullable_base wrapFlags; + + CTextPFRun() : bIsOneLine(false) + { + } + + CTextPFRun(const CTextPFRun& oSrc) + { + *this = oSrc; + } + + CTextPFRun& operator =(const CTextPFRun& oSrc) + { + hasBullet = oSrc.hasBullet; + + bulletFontRef = oSrc.bulletFontRef; + bulletSize = oSrc.bulletSize; + bulletChar = oSrc.bulletChar; + bulletColor = oSrc.bulletColor; + bulletFontProperties = oSrc.bulletFontProperties; + bulletAutoNum = oSrc.bulletAutoNum; + + textAlignment = oSrc.textAlignment; + lineSpacing = oSrc.lineSpacing; + spaceBefore = oSrc.spaceBefore; + spaceAfter = oSrc.spaceAfter; + leftMargin = oSrc.leftMargin; + indent = oSrc.indent; + defaultTabSize = oSrc.defaultTabSize; + + tabStops = oSrc.tabStops; + + fontAlign = oSrc.fontAlign; + textDirection = oSrc.textDirection; + wrapFlags = oSrc.wrapFlags; + + bIsOneLine = oSrc.bIsOneLine; + + return *this; + } + + void ApplyBefore(const CTextPFRun& oSrc) + { + if (!hasBullet.is_init()) + { + hasBullet = oSrc.hasBullet; + } + if (!bulletSize.is_init()) + { + bulletSize = oSrc.bulletSize; + } + if (!bulletChar.is_init())//master style (78).ppt + { + bulletChar = oSrc.bulletChar; + bulletFontRef = oSrc.bulletFontRef; + } + if (!bulletColor.is_init()) + { + bulletColor = oSrc.bulletColor; + } + bulletFontProperties.reset(); + bulletAutoNum.reset(); + + if (!textAlignment.is_init()) textAlignment = oSrc.textAlignment; + if (!lineSpacing.is_init()) lineSpacing = oSrc.lineSpacing; + if (!spaceBefore.is_init()) spaceBefore = oSrc.spaceBefore; + if (!spaceAfter.is_init()) spaceAfter = oSrc.spaceAfter; + if (!leftMargin.is_init()) leftMargin = oSrc.leftMargin; + if (!indent.is_init()) indent = oSrc.indent; + if (!defaultTabSize.is_init()) defaultTabSize = oSrc.defaultTabSize; + + if (!fontAlign.is_init()) fontAlign = oSrc.fontAlign; + if (!textDirection.is_init()) textDirection = oSrc.textDirection; + if (!wrapFlags.is_init()) wrapFlags = oSrc.wrapFlags; + + if ((0 == tabStops.size()) && (0 != oSrc.tabStops.size())) + { + tabStops.insert(tabStops.end(), oSrc.tabStops.begin(), oSrc.tabStops.end()); + } + } + + void ApplyAfter(const CTextPFRun& oSrc) + { + if (oSrc.hasBullet.is_init()) + { + hasBullet = oSrc.hasBullet; + + bulletSize = oSrc.bulletSize; + bulletChar = oSrc.bulletChar; + bulletFontRef = oSrc.bulletFontRef; + bulletColor = oSrc.bulletColor; + + bulletFontProperties.reset(); + bulletAutoNum.reset(); + } + + if (oSrc.textAlignment.is_init()) textAlignment = oSrc.textAlignment; + if (oSrc.lineSpacing.is_init()) lineSpacing = oSrc.lineSpacing; + if (oSrc.spaceBefore.is_init()) spaceBefore = oSrc.spaceBefore; + if (oSrc.spaceAfter.is_init()) spaceAfter = oSrc.spaceAfter; + if (oSrc.leftMargin.is_init()) leftMargin = oSrc.leftMargin; + if (oSrc.indent.is_init()) indent = oSrc.indent; + if (oSrc.defaultTabSize.is_init()) defaultTabSize = oSrc.defaultTabSize; + + if (oSrc.fontAlign.is_init()) fontAlign = oSrc.fontAlign; + if (oSrc.textDirection.is_init()) textDirection = oSrc.textDirection; + if (oSrc.wrapFlags.is_init()) wrapFlags = oSrc.wrapFlags; + + if (!oSrc.tabStops.empty()) tabStops = oSrc.tabStops; + } + + std::wstring ToString(LONG lCount) + { + return L""; + } + + }; + + class CTextRuler + { + public: + NSCommon::nullable_base DefaultTabSize; + NSCommon::nullable_base CLevels; + + NSCommon::nullable_base TabStops; + std::vector> tabsStops; + + NSCommon::nullable_base LeftMargin1; + NSCommon::nullable_base LeftMargin2; + NSCommon::nullable_base LeftMargin3; + NSCommon::nullable_base LeftMargin4; + NSCommon::nullable_base LeftMargin5; + + NSCommon::nullable_base Indent1; + NSCommon::nullable_base Indent2; + NSCommon::nullable_base Indent3; + NSCommon::nullable_base Indent4; + NSCommon::nullable_base Indent5; + + CTextRuler() + { + } + + CTextRuler(const CTextRuler& oSrc) + { + *this = oSrc; + } + + CTextRuler& operator =(const CTextRuler& oSrc) + { + DefaultTabSize = oSrc.DefaultTabSize; + CLevels = oSrc.CLevels; + TabStops = oSrc.TabStops; + + LeftMargin1 = oSrc.LeftMargin1; + LeftMargin2 = oSrc.LeftMargin2; + LeftMargin3 = oSrc.LeftMargin3; + LeftMargin4 = oSrc.LeftMargin4; + LeftMargin5 = oSrc.LeftMargin5; + + Indent1 = oSrc.Indent1; + Indent2 = oSrc.Indent2; + Indent3 = oSrc.Indent3; + Indent4 = oSrc.Indent4; + Indent5 = oSrc.Indent5; + + tabsStops = oSrc.tabsStops; + + return *this; + } + ~CTextRuler() + { + tabsStops.clear(); + } + + void ApplyBefore(const CTextRuler& oSrc) + { + if (!DefaultTabSize.is_init()) DefaultTabSize = oSrc.DefaultTabSize; + if (!CLevels.is_init()) CLevels = oSrc.CLevels; + + if (!LeftMargin1.is_init()) LeftMargin1 = oSrc.LeftMargin1; + if (!LeftMargin2.is_init()) LeftMargin2 = oSrc.LeftMargin2; + if (!LeftMargin3.is_init()) LeftMargin3 = oSrc.LeftMargin3; + if (!LeftMargin4.is_init()) LeftMargin4 = oSrc.LeftMargin4; + if (!LeftMargin5.is_init()) LeftMargin5 = oSrc.LeftMargin5; + + if (!Indent1.is_init()) Indent1 = oSrc.Indent1; + if (!Indent2.is_init()) Indent2 = oSrc.Indent2; + if (!Indent3.is_init()) Indent3 = oSrc.Indent3; + if (!Indent4.is_init()) Indent4 = oSrc.Indent4; + if (!Indent5.is_init()) Indent5 = oSrc.Indent5; + + if (!tabsStops.empty()) tabsStops = oSrc.tabsStops; + } + + std::wstring ToString() + { + return L""; + } + }; + + class CTextSIRun + { + public: + bool bIsExt; + _UINT32 lCount; + + bool bSpell; + bool bLang; + bool bAltLang; + + bool bPp10ext; + bool bBidi; + bool bSmartTag; + + WORD Spell; + WORD Lang; + WORD AltLang; + + WORD Bidi; + BYTE pp10runid; + + bool bGramma; + + std::vector<_UINT32> arSmartTags; + + public: + + CTextSIRun() + { + bIsExt = true; + lCount = 0; + + bSpell = false; + bLang = false; + bAltLang = false; + + bPp10ext = false; + bBidi = false; + bSmartTag = false; + + Spell = 0; + Lang = 0; + AltLang = 0; + + Bidi = 0; + pp10runid = 0; + + bGramma = false; + } + + CTextSIRun(const CTextSIRun& oSrc) + { + *this = oSrc; + } + + CTextSIRun& operator =(const CTextSIRun& oSrc) + { + bIsExt = oSrc.bIsExt; + lCount = oSrc.lCount; + + bSpell = oSrc.bSpell; + bLang = oSrc.bLang; + bAltLang = oSrc.bAltLang; + + bPp10ext = oSrc.bPp10ext; + bBidi = oSrc.bBidi; + bSmartTag = oSrc.bSmartTag; + + Spell = oSrc.Spell; + Lang = oSrc.Lang; + AltLang = oSrc.AltLang; + + Bidi = oSrc.Bidi; + pp10runid = oSrc.pp10runid; + + bGramma = oSrc.bGramma; + + arSmartTags = oSrc.arSmartTags; + + return *this; + } + + void ApplyBefore(const CTextSIRun& oSrc) + { + /* + * gcc 4.8 doesn't understand this construction: + * + DEFAULT_BEFORE(bSpell, Spell); + DEFAULT_BEFORE(bLang, Lang); + DEFAULT_BEFORE(bAltLang, AltLang); + DEFAULT_BEFORE(bBidi, Bidi); + DEFAULT_BEFORE(bPp10ext, pp10runid); + */ + if (!bSpell && oSrc.bSpell) + { + bSpell = true; + Spell = oSrc.Spell; + } + if (!bLang && oSrc.bLang) + { + bLang = true; + Lang = oSrc.Lang; + } + if (!bAltLang && oSrc.bAltLang) + { + bAltLang = true; + AltLang = oSrc.AltLang; + } + if (!bBidi && oSrc.bBidi) + { + bBidi = true; + Bidi = oSrc.Bidi; + } + if (!bPp10ext && oSrc.bPp10ext) + { + bPp10ext = true; + pp10runid = oSrc.pp10runid; + } + + + if (!bGramma) + { + bGramma = oSrc.bGramma; + } + } + + std::wstring ToString() + { + return L""; + } + }; + + + class CSpan + { + public: + CTextCFRun m_oRun; + std::wstring m_strText; + bool m_bField; + bool m_bBreak; + + std::vector m_arrInteractive; + + CSpan() : m_bField(false), m_bBreak(false) + { + } + CSpan(const CSpan& oSrc) + { + *this = oSrc; + } + CSpan& operator=(const CSpan& oSrc) + { + m_oRun = oSrc.m_oRun; + m_strText = oSrc.m_strText; + m_bField = oSrc.m_bField; + m_bBreak = oSrc.m_bBreak; + m_arrInteractive = oSrc.m_arrInteractive; + + return *this; + } + ~CSpan() + { + } + }; + + class CTextStyleLevel + { + public: + CTextPFRun m_oPFRun; + CTextCFRun m_oCFRun; + + public: + CTextStyleLevel() + { + } + CTextStyleLevel(const CTextStyleLevel& oSrc) + { + *this = oSrc; + } + CTextStyleLevel& operator=(const CTextStyleLevel& oSrc) + { + m_oPFRun = oSrc.m_oPFRun; + m_oCFRun = oSrc.m_oCFRun; + + return *this; + } + + void ApplyAfter(const CTextStyleLevel& oSrc) + { + m_oPFRun.ApplyAfter(oSrc.m_oPFRun); + m_oCFRun.ApplyAfter(oSrc.m_oCFRun); + } + void ApplyBefore(const CTextStyleLevel& oSrc) + { + m_oPFRun.ApplyBefore(oSrc.m_oPFRun); + m_oCFRun.ApplyBefore(oSrc.m_oCFRun); + } + }; + + class CTextStyles + { + public: + NSCommon::nullable_base m_pLevels[10]; + + CTextStyles() + { + for (int i = 0; i < 10; ++i) + { + m_pLevels[i] = NULL; + } + } + CTextStyles(const CTextStyles& oSrc) + { + *this = oSrc; + } + CTextStyles& operator=(const CTextStyles& oSrc) + { + for (int i = 0; i < 10; ++i) + { + m_pLevels[i] = oSrc.m_pLevels[i]; + } + return *this; + } + void SetStyles(CTextStyles* pStyles) + { + for (int i = 0; i < 10; ++i) + { + m_pLevels[i] = pStyles->m_pLevels[i]; + } + } + void SetLanguage(nullable & language) + { + if (!language.is_init()) return; + + for (int i = 0; i < 10; ++i) + { + if (m_pLevels[i].is_init()) + { + m_pLevels[i]->m_oCFRun.Language = language; + } + } + } + void ApplyAfter(const CTextStyles& oSrc) + { + for (int i = 0; i < 10; ++i) + { + if (!m_pLevels[i].is_init()) + { + m_pLevels[i] = oSrc.m_pLevels[i]; + } + else if (oSrc.m_pLevels[i].is_init()) + { + m_pLevels[i]->ApplyAfter(oSrc.m_pLevels[i].get()); + } + + } + } + void ApplyBefore(const CTextStyles& oSrc) + { + for (int i = 0; i < 10; ++i) + { + if (!m_pLevels[i].is_init()) + { + m_pLevels[i] = oSrc.m_pLevels[i]; + } + else if (oSrc.m_pLevels[i].is_init()) + { + m_pLevels[i]->ApplyBefore(oSrc.m_pLevels[i].get()); + } + + } + } + }; + /////////////////////////////////////////////////////// TODO ///////////////////////////////////// // class CTextStyle9Level // { @@ -405,25 +930,72 @@ public: // } // }; -/////////////////////////////////////////////////////// TODO ///////////////////////////////////// -class CParagraph -{ -public: - int m_lTextType; - int m_lTextLevel; - int m_lStyleThemeIndex; + /////////////////////////////////////////////////////// TODO ///////////////////////////////////// + class CParagraph + { + public: + int m_lTextType; + int m_lTextLevel; + int m_lStyleThemeIndex; - CTextPFRun m_oPFRun; - std::vector m_arSpans; + CTextPFRun m_oPFRun; + std::vector m_arSpans; -public: - CParagraph(); - CParagraph(const CParagraph& oSrc); - CParagraph& operator=(const CParagraph& oSrc); - ~CParagraph(); - void CheckErrors(); - bool IsEmpty(); -}; + public: + CParagraph() + { + m_lTextType = -1; + m_lTextLevel = 0; + m_lStyleThemeIndex = -1; + } + CParagraph(const CParagraph& oSrc) + { + *this = oSrc; + } + CParagraph& operator=(const CParagraph& oSrc) + { + m_lTextLevel = oSrc.m_lTextLevel; + m_lTextType = oSrc.m_lTextType; + m_lStyleThemeIndex = oSrc.m_lStyleThemeIndex; + + m_oPFRun = oSrc.m_oPFRun; + + m_arSpans = oSrc.m_arSpans; + + return *this; + } + ~CParagraph() + { + m_arSpans.clear(); + } + AVSINLINE void CheckErrors() + { + //if (IsEmpty()) + //{ + // m_oPFRun.hasBullet = false; + //} + size_t nCountS = m_arSpans.size(); + for (size_t i = 0; i < nCountS; ++i) + { + std::replace( m_arSpans[i].m_strText.begin(), m_arSpans[i].m_strText.end(), (wchar_t)(11), (wchar_t)(13)); + } + } + AVSINLINE bool IsEmpty() + { + size_t nCountSpans = m_arSpans.size(); + for (size_t i = 0; i < nCountSpans; ++i) + { + size_t nLen = m_arSpans[i].m_strText.length(); + + if (nLen > 1) + return false; + + if ((nLen == 1) && ((wchar_t)(13) != m_arSpans[i].m_strText[0])) + return false; + } + return true; + } + }; } diff --git a/MsBinaryFile/PptFile/Drawing/Theme.h b/MsBinaryFile/PptFile/Drawing/Theme.h index ab38d79c4b..fcf6ee1d3c 100644 --- a/MsBinaryFile/PptFile/Drawing/Theme.h +++ b/MsBinaryFile/PptFile/Drawing/Theme.h @@ -88,15 +88,203 @@ namespace PPT_FORMAT bool m_wasBulletStart; unsigned m_bulletPos; //------------------------------------------------------------------------------------ - CTheme(_typeMaster type = typeMaster); - void Clear(); + CTheme(_typeMaster type = typeMaster) : m_arColorScheme(), m_arFonts(), m_arBrushes(), + m_arPens(), m_arEffects(), m_arLayouts(), m_eType(type), m_wasBulletStart(false), + m_bulletPos(0) + { + Clear(); + } + void Clear() + { + m_arElements.clear(); + m_arLayouts.clear(); + m_mapTitleLayout.clear(); + m_mapGeomToLayout.clear(); + m_mapPlaceholders.clear(); - virtual ~CTheme(); - ODRAW::CColor GetColor(const LONG& lIndexScheme); + m_sThemeName = L"Default"; + + m_bHasDate = false; + m_bHasSlideNumber = false; + m_bHasFooter = false; + m_nFormatDate = 1; + + for (int i = 0 ; i < 3 ; i++) + m_PlaceholdersReplaceString[i].clear(); + } - void CalculateStyles(); + virtual ~CTheme() + { + } + ODRAW::CColor GetColor(const LONG& lIndexScheme) + { + if (lIndexScheme < (LONG)m_arColorScheme.size()) + { + return m_arColorScheme[lIndexScheme]; + } + return ODRAW::CColor(); + } - static void CalculateStyle(CTheme* pTheme, CTextStyles& oStyle); + void CalculateStyles() + { + LONG lCountColors = (LONG)m_arColorScheme.size(); + + for (int pos = 0; pos < g_ThemeTextStylesCount; ++pos) + { + PPT_FORMAT::CTextStyles& oStyle = m_pStyles[pos]; + + size_t nLevels = 10; + for (size_t i = 0; i < nLevels; ++i) + { + if (!oStyle.m_pLevels[i].is_init()) + continue; + + CTextStyleLevel* pLevel = oStyle.m_pLevels[i].operator ->(); + + if (pLevel->m_oPFRun.bulletColor.is_init()) + { + CColor& oColor = pLevel->m_oPFRun.bulletColor.get(); + if ((0 <= oColor.m_lSchemeIndex) && (oColor.m_lSchemeIndex < lCountColors)) + { + oColor.R = m_arColorScheme[oColor.m_lSchemeIndex].R; + oColor.G = m_arColorScheme[oColor.m_lSchemeIndex].G; + oColor.B = m_arColorScheme[oColor.m_lSchemeIndex].B; + oColor.A = m_arColorScheme[oColor.m_lSchemeIndex].A; + } + } + if (pLevel->m_oCFRun.Color.is_init()) + { + CColor& oColor = pLevel->m_oCFRun.Color.get(); + if ((0 <= oColor.m_lSchemeIndex) && (oColor.m_lSchemeIndex < lCountColors)) + { + oColor.R = m_arColorScheme[oColor.m_lSchemeIndex].R; + oColor.G = m_arColorScheme[oColor.m_lSchemeIndex].G; + oColor.B = m_arColorScheme[oColor.m_lSchemeIndex].B; + oColor.A = m_arColorScheme[oColor.m_lSchemeIndex].A; + } + } + if (pLevel->m_oPFRun.bulletFontRef.IsInit()) + { + WORD lFontIndex = pLevel->m_oPFRun.bulletFontRef.get(); + if (lFontIndex < (WORD)m_arFonts.size()) + { + if (!pLevel->m_oPFRun.bulletFontProperties.is_init()) + pLevel->m_oPFRun.bulletFontProperties = new CFontProperty(m_arFonts[lFontIndex]); + } + } + if (pLevel->m_oCFRun.fontRef.IsInit()) + { + WORD lFontIndex = pLevel->m_oCFRun.fontRef.get(); + if (lFontIndex < (WORD)m_arFonts.size()) + { + if (!pLevel->m_oCFRun.font.font.is_init()) + pLevel->m_oCFRun.font.font = new CFontProperty(m_arFonts[lFontIndex]); + } + } + if (pLevel->m_oCFRun.eaFontRef.IsInit()) + { + WORD lFontIndex = pLevel->m_oCFRun.eaFontRef.get(); + if (lFontIndex < (WORD)m_arFonts.size()) + { + if (!pLevel->m_oCFRun.font.ea.is_init()) + pLevel->m_oCFRun.font.ea = new CFontProperty(m_arFonts[lFontIndex]); + } + } + if (pLevel->m_oCFRun.ansiFontRef.IsInit()) + { + WORD lFontIndex = pLevel->m_oCFRun.ansiFontRef.get(); + if (lFontIndex < (WORD)m_arFonts.size()) + { + if (!pLevel->m_oCFRun.font.ansi.is_init()) + pLevel->m_oCFRun.font.ansi = new CFontProperty(m_arFonts[lFontIndex]); + } + } + if (pLevel->m_oCFRun.symbolFontRef.IsInit()) + { + WORD lFontIndex = pLevel->m_oCFRun.symbolFontRef.get(); + if (lFontIndex < (WORD)m_arFonts.size()) + { + if (!pLevel->m_oCFRun.font.sym.is_init()) + pLevel->m_oCFRun.font.sym = new CFontProperty(m_arFonts[lFontIndex]); + } + } + } + } + } + + static void CalculateStyle(CTheme* pTheme, CTextStyles& oStyle) + { + LONG lCountColors = (LONG)pTheme->m_arColorScheme.size(); + + // пока здесь расчитываются только цвета + size_t nLevels = 10; + for (size_t i = 0; i < nLevels; ++i) + { + if (!oStyle.m_pLevels[i].is_init()) + continue; + + CTextStyleLevel* pLevel = oStyle.m_pLevels[i].operator ->(); + + if (pLevel->m_oPFRun.bulletColor.is_init()) + { + CColor& oColor = pLevel->m_oPFRun.bulletColor.get(); + if ((0 <= oColor.m_lSchemeIndex) && (oColor.m_lSchemeIndex < lCountColors)) + { + oColor.R = pTheme->m_arColorScheme[oColor.m_lSchemeIndex].R; + oColor.G = pTheme->m_arColorScheme[oColor.m_lSchemeIndex].G; + oColor.B = pTheme->m_arColorScheme[oColor.m_lSchemeIndex].B; + oColor.A = pTheme->m_arColorScheme[oColor.m_lSchemeIndex].A; + } + } + if (pLevel->m_oCFRun.Color.is_init()) + { + CColor& oColor = pLevel->m_oCFRun.Color.get(); + if ((0 <= oColor.m_lSchemeIndex) && (oColor.m_lSchemeIndex < lCountColors)) + { + oColor.R = pTheme->m_arColorScheme[oColor.m_lSchemeIndex].R; + oColor.G = pTheme->m_arColorScheme[oColor.m_lSchemeIndex].G; + oColor.B = pTheme->m_arColorScheme[oColor.m_lSchemeIndex].B; + oColor.A = pTheme->m_arColorScheme[oColor.m_lSchemeIndex].A; + } + } + if (pLevel->m_oCFRun.fontRef.IsInit()) + { + WORD lFontIndex = pLevel->m_oCFRun.fontRef.get(); + if (lFontIndex < (WORD)pTheme->m_arFonts.size()) + { + if (!pLevel->m_oCFRun.font.font.is_init()) + pLevel->m_oCFRun.font.font = new CFontProperty(pTheme->m_arFonts[lFontIndex]); + } + } + if (pLevel->m_oCFRun.eaFontRef.IsInit()) + { + WORD lFontIndex = pLevel->m_oCFRun.eaFontRef.get(); + if (lFontIndex < (WORD)pTheme->m_arFonts.size()) + { + if (!pLevel->m_oCFRun.font.ea.is_init()) + pLevel->m_oCFRun.font.ea = new CFontProperty(pTheme->m_arFonts[lFontIndex]); + } + } + if (pLevel->m_oCFRun.ansiFontRef.IsInit()) + { + WORD lFontIndex = pLevel->m_oCFRun.ansiFontRef.get(); + if (lFontIndex < (WORD)pTheme->m_arFonts.size()) + { + if (!pLevel->m_oCFRun.font.ansi.is_init()) + pLevel->m_oCFRun.font.ansi = new CFontProperty(pTheme->m_arFonts[lFontIndex]); + } + } + if (pLevel->m_oCFRun.symbolFontRef.IsInit()) + { + WORD lFontIndex = pLevel->m_oCFRun.symbolFontRef.get(); + if (lFontIndex < (WORD)pTheme->m_arFonts.size()) + { + if (!pLevel->m_oCFRun.font.sym.is_init()) + pLevel->m_oCFRun.font.sym = new CFontProperty(pTheme->m_arFonts[lFontIndex]); + } + } + } + } }; typedef boost::shared_ptr CThemePtr; diff --git a/MsBinaryFile/PptFile/Enums/enums.h b/MsBinaryFile/PptFile/Enums/enums.h index 62fcfdb367..f2a99bc8f4 100644 --- a/MsBinaryFile/PptFile/Enums/enums.h +++ b/MsBinaryFile/PptFile/Enums/enums.h @@ -61,6 +61,14 @@ enum AnimBuildTypeEnum : BYTE }; +enum BuildTypeEnum +{ + TL_BuildParagraph, + TL_BuildChart, + TL_BuildDiagram +}; + + enum ChartBuildEnum { TLCB_AsOneObject, diff --git a/MsBinaryFile/PptFile/PPTXWriter/BulletsConverter.cpp b/MsBinaryFile/PptFile/PPTXWriter/BulletsConverter.cpp index 37136e1ecf..55bafd19b1 100644 --- a/MsBinaryFile/PptFile/PPTXWriter/BulletsConverter.cpp +++ b/MsBinaryFile/PptFile/PPTXWriter/BulletsConverter.cpp @@ -1,34 +1,3 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * 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-12 Ernesta Birznieka-Upisha - * 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 "BulletsConverter.h" #include "StylesWriter.h" diff --git a/MsBinaryFile/PptFile/PPTXWriter/Converter.cpp b/MsBinaryFile/PptFile/PPTXWriter/Converter.cpp index 74b2190ecb..867a580c12 100644 --- a/MsBinaryFile/PptFile/PPTXWriter/Converter.cpp +++ b/MsBinaryFile/PptFile/PPTXWriter/Converter.cpp @@ -211,10 +211,6 @@ void PPT_FORMAT::CPPTXWriter::CloseFile() m_oManager.Clear(); } -void CPPTXWriter::Write() -{ -} - void PPT_FORMAT::CPPTXWriter::WriteContentTypes() { diff --git a/MsBinaryFile/PptFile/PPTXWriter/Converter.h b/MsBinaryFile/PptFile/PPTXWriter/Converter.h index 6079b5c69d..508779c945 100644 --- a/MsBinaryFile/PptFile/PPTXWriter/Converter.h +++ b/MsBinaryFile/PptFile/PPTXWriter/Converter.h @@ -67,7 +67,9 @@ namespace PPT_FORMAT void CloseFile(); - void Write(); + void Write() + { + } std::wstring m_xmlApp; std::wstring m_xmlCore; diff --git a/MsBinaryFile/PptFile/PPTXWriter/ImageManager.h b/MsBinaryFile/PptFile/PPTXWriter/ImageManager.h index 690d83a711..c98741949c 100644 --- a/MsBinaryFile/PptFile/PPTXWriter/ImageManager.h +++ b/MsBinaryFile/PptFile/PPTXWriter/ImageManager.h @@ -34,6 +34,7 @@ #ifndef DISABLE_FILE_DOWNLOADER #include "../../../Common/Network/FileTransporter/include/FileTransporter.h" #endif +#include #include "../Drawing/Attributes.h" #include "../../../DesktopEditor/common/File.h" namespace PPT_FORMAT @@ -50,22 +51,140 @@ namespace PPT_FORMAT std::wstring m_strDstMedia; public: - CMediaManager(); - ~CMediaManager(); - void Clear(); - std::wstring FindMedia(const std::wstring& strInput); - void SetDstMedia(const std::wstring& strDst); - std::wstring GenerateVideo(const std::wstring& strInput); - std::wstring GenerateAudio(const std::wstring& strInput); - std::wstring GenerateImage(const std::wstring& strInput); - std::wstring GenerateImageJPEG(const std::wstring& strInput); - std::wstring GenerateMedia(const std::wstring& strInput, const std::wstring& Template, long & Indexer, const std::wstring& strDefaultExt); - void WriteAudioCollection(const std::vector& audioCont); - bool IsNeedDownload(const std::wstring& strFile); + CMediaManager() : m_lIndexNextImage(0), m_lIndexNextAudio(0), m_lIndexNextVideo(0) + { + } + ~CMediaManager() + { + } + inline void Clear() + { + m_mapMedia.clear(); + + m_lIndexNextImage = 0; + m_lIndexNextAudio = 0; + m_lIndexNextVideo = 0; + } + inline std::wstring FindMedia(const std::wstring& strInput) + { + std::map::iterator pPair = m_mapMedia.find(strInput); + if (m_mapMedia.end() != pPair) + { + return pPair->second; + } + return L""; + } + inline void SetDstMedia(const std::wstring& strDst) + { + m_strDstMedia = strDst; + } + inline std::wstring GenerateVideo(const std::wstring& strInput) + { + return GenerateMedia(strInput, L"video", m_lIndexNextVideo, L".avi"); + } + inline std::wstring GenerateAudio(const std::wstring& strInput) + { + return GenerateMedia(strInput, L"audio", m_lIndexNextAudio, L".wav"); + } + inline std::wstring GenerateImage(const std::wstring& strInput) + { + return GenerateMedia(strInput, L"image", m_lIndexNextImage, L".png"); + } + inline std::wstring GenerateImageJPEG(const std::wstring& strInput) + { + return GenerateMedia(strInput, L"image", m_lIndexNextImage, L".jpeg"); + } + inline std::wstring GenerateMedia(const std::wstring& strInput, const std::wstring& Template, long & Indexer, const std::wstring& strDefaultExt) + { + std::map::iterator pPair = m_mapMedia.find(strInput); + if (m_mapMedia.end() != pPair) + { + return pPair->second; + } + + if (IsNeedDownload(strInput)) + { +#ifndef DISABLE_FILE_DOWNLOADER + NSNetwork::NSFileTransport::CFileDownloader oDownloader(strInput, TRUE); + if ( oDownloader.DownloadSync() ) + { + std::wstring file_name = oDownloader.GetFilePath(); + + //todooo - check media file + return GenerateMedia(file_name , Template, Indexer, strDefaultExt); + } +#endif + } + + std::wstring strExts = strDefaultExt; + int nIndexExt = strInput.rfind(wchar_t('.')); + if (-1 != nIndexExt) + strExts = strInput.substr(nIndexExt); + + if (strExts == _T(".video") || strExts == _T(".audio")) + { + std::wstring strInput1 = strInput.substr(0, nIndexExt); + nIndexExt = strInput1.rfind(wchar_t('.')); + strExts = nIndexExt < 0 ? L"" : strInput1.substr(nIndexExt); + } + if (strExts == _T(".tmp") || strExts.empty()) strExts = strDefaultExt; + + std::wstring strMediaName = Template + std::to_wstring(++Indexer); + + std::wstring strOutput = m_strDstMedia + strMediaName + strExts; + strMediaName = _T("../media/") + strMediaName + strExts; + + // теперь нужно скопировать + if (strOutput != strInput) + { + if (NSFile::CFileBinary::Copy(strInput, strOutput) == false) + { + return L""; + } + } + m_mapMedia[strInput] = strMediaName; + return strMediaName; + } + inline void WriteAudioCollection(const std::vector& audioCont) + { + if (audioCont.empty()) return; + + for (auto& audio : audioCont) + { + auto pathAudio = GenerateAudio(audio.m_strFilePath); + } + + } + inline bool IsNeedDownload(const std::wstring& strFile) + { + int n1 = strFile.find(L"www"); + int n2 = strFile.find(L"http"); + int n3 = strFile.find(L"ftp"); + + if (((n1 >= 0) && (n1 < 10)) || ((n2 >= 0) && (n2 < 10)) || ((n3 >= 0) && (n3 < 10))) + return true; + return false; + } }; - std::wstring CorrectXmlString3(const std::wstring & str); - + static std::wstring CorrectXmlString3(const std::wstring & str) + { + std::wstring buffer; + buffer.reserve(str.size()); + for(size_t pos = 0; pos != str.size(); ++pos) + { + switch(str[pos]) + { + case '&': buffer.append(_T("&")); break; + case '\"': buffer.append(_T(""")); break; + case '\'': buffer.append(_T("'")); break; + case '<': buffer.append(_T("<")); break; + case '>': buffer.append(_T(">")); break; + default: buffer.append(&str[pos], 1); break; + } + } + return buffer; + } class CRelsGenerator { private: @@ -76,31 +195,237 @@ namespace PPT_FORMAT std::map m_mapHyperlinks; public: - CRelsGenerator(CMediaManager* pManager); - ~CRelsGenerator(); - void Clear(); + CRelsGenerator(CMediaManager* pManager) : m_oWriter(), m_lNextRelsID(1) + { + m_pManager = pManager; + } + ~CRelsGenerator() + { + } + inline void Clear() + { + m_oWriter.ClearNoAttack(); + m_lNextRelsID = 1; + m_mapMediaRelsID.clear(); + m_mapHyperlinks.clear(); + } - void StartMaster(int nIndexTheme, int nStartLayoutIndex, int nCountLayouts); - void StartLayout(int nIndexTheme); - void StartNotes(int nIndexSlide, bool bMaster); - void StartSlide(int nIndexLayout, int nIndexNotes); - void CloseRels(); - void SaveRels(const std::wstring& strFile); - std::wstring WriteHyperlink(const std::wstring& strHyperlink, bool isExternal = false); + inline void StartMaster(int nIndexTheme, int nStartLayoutIndex, int nCountLayouts) + { + std::wstring str1 = _T("\ +"); - std::wstring WriteFile(const std::wstring& strPath); + m_oWriter.WriteString(str1); + + for (int i = 0; i < nCountLayouts; ++i) + { + std::wstring str = L""; + nStartLayoutIndex++; + m_oWriter.WriteString(str); + } + + std::wstring s = L""; + m_oWriter.WriteString(s); + } + inline void StartLayout(int nIndexTheme) + { + std::wstring str1 = _T("\ +"); + + m_oWriter.WriteString(str1); + + std::wstring str = L""; + + m_oWriter.WriteString(str); + } + inline void StartNotes(int nIndexSlide, bool bMaster) + { + m_oWriter.WriteString(L"\ + "); + if (bMaster) + { + m_oWriter.WriteString(L""); + } + if (nIndexSlide >= 0) + { + m_oWriter.WriteString(L""); + } + } + inline void StartSlide(int nIndexLayout, int nIndexNotes) + { + m_oWriter.WriteString(L"\ + "); + + m_oWriter.WriteString(L""); + + if (nIndexNotes >= 0) + { + m_oWriter.WriteString(L""); + } + } + inline void CloseRels() + { + std::wstring str = _T(""); + m_oWriter.WriteString(str); + } + inline void SaveRels(const std::wstring& strFile) + { + NSFile::CFileBinary oFile; + oFile.CreateFileW(strFile); + std::wstring strMem = m_oWriter.GetData(); + oFile.WriteStringUTF8(strMem); + oFile.CloseFile(); + } + inline std::wstring WriteHyperlink(const std::wstring& strHyperlink, bool isExternal = false) + { + std::map::iterator pPair = m_mapHyperlinks.find(strHyperlink); + + if (m_mapHyperlinks.end() != pPair) + { + std::wstring strRid = L"rId" + pPair->second; + return strRid; + } + m_mapHyperlinks[strHyperlink] = std::to_wstring(m_lNextRelsID); + + std::wstring strRid = L"rId" + std::to_wstring( m_lNextRelsID++); + + std::wstring strRels = L"" : L"\"/>"); + + m_oWriter.WriteString(strRels); + + return strRid; + } + + inline std::wstring WriteFile(const std::wstring& strPath) + { + std::map::iterator pPair = m_mapHyperlinks.find(strPath); + + if (m_mapHyperlinks.end() != pPair) + { + std::wstring strRid = L"rId" + pPair->second; + return strRid; + } + m_mapHyperlinks[strPath] = std::to_wstring( m_lNextRelsID ); + + std::wstring strRid = L"rId" + std::to_wstring( m_lNextRelsID++); + + std::wstring strRels = L""; + + m_oWriter.WriteString(strRels); + + return strRid; + } - std::wstring WriteHyperlinkMedia(const std::wstring& strMedia, bool bExternal = true, bool newRIdAlways = false, std::wstring strRelsType = L"http://schemas.microsoft.com/office/2007/relationships/media"); - std::wstring WriteHyperlinkImage(const std::wstring& strImage, bool bExternal = true); - std::wstring WriteHyperlinkAudio(const std::wstring& strImage, bool bExternal = true); - std::wstring WriteHyperlinkVideo(const std::wstring& strImage, bool bExternal = true); - std::wstring WriteMedia(const std::wstring& strMediaPath); - std::wstring WriteImage(const std::wstring& strImagePath); - std::wstring WriteSlideRef(const std::wstring& strLocation); - std::wstring WriteAudio(const std::wstring& strAudioPath, bool & bExternal); - std::wstring WriteVideo(const std::wstring& strVideoPath, bool & bExternal); + inline std::wstring WriteHyperlinkMedia(const std::wstring& strMedia, bool bExternal = true, bool newRIdAlways = false, std::wstring strRelsType = L"http://schemas.microsoft.com/office/2007/relationships/media") + { + if (!newRIdAlways) + { + std::map::iterator pPair = m_mapMediaRelsID.find(strMedia); - int getRId()const{return m_lNextRelsID;} + if (m_mapMediaRelsID.end() != pPair) + { + std::wstring strRid = L"rId" + std::to_wstring(pPair->second); + return strRid; + } + + m_mapMediaRelsID[strMedia] = m_lNextRelsID; + } + + std::wstring strRid = L"rId" + std::to_wstring(m_lNextRelsID++); + + std::wstring strRels = L""; + + m_oWriter.WriteString(strRels); + + return strRid; + } + inline std::wstring WriteHyperlinkImage(const std::wstring& strImage, bool bExternal = true) + { + return WriteHyperlinkMedia(strImage, bExternal, false, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"); + } + inline std::wstring WriteHyperlinkAudio(const std::wstring& strImage, bool bExternal = true) + { + return WriteHyperlinkMedia(strImage, bExternal, false, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio"); + } + inline std::wstring WriteHyperlinkVideo(const std::wstring& strImage, bool bExternal = true) + { + return WriteHyperlinkMedia(strImage, bExternal, false, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video"); + } + inline std::wstring WriteMedia(const std::wstring& strMediaPath) + { + std::wstring strMedia = m_pManager->FindMedia(strMediaPath); + + if (strMedia.empty()) return WriteHyperlinkMedia(CorrectXmlString3(strMediaPath), true, true); + return WriteHyperlinkMedia(strMedia, false, false); // changed + } + inline std::wstring WriteImage(const std::wstring& strImagePath) + { + std::wstring strImage = m_pManager->GenerateImage(strImagePath); + + if (strImage.empty()) return WriteHyperlinkImage(CorrectXmlString3(strImagePath), true); + return WriteHyperlinkImage(strImage, false); + } + std::wstring WriteSlideRef(const std::wstring& strLocation) + { + int sldNum = CExFilesInfo::GetSlideNumber(strLocation); + + std::wstring strSlide(L"slide"); + strSlide += std::to_wstring(sldNum); + strSlide += L".xml"; + return WriteHyperlinkMedia(strSlide, false, false, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"); + } + inline std::wstring WriteAudio(const std::wstring& strAudioPath, bool & bExternal) + { + std::wstring strAudio = m_pManager->GenerateAudio(strAudioPath); + + if (strAudio.empty()) + { + bExternal = true; + return WriteHyperlinkAudio(CorrectXmlString3(strAudioPath), true); + } + else + { + return WriteHyperlinkAudio(strAudio, false); + } + } + inline std::wstring WriteVideo(const std::wstring& strVideoPath, bool & bExternal) + { + std::wstring strVideo = m_pManager->GenerateVideo(strVideoPath); + + if (strVideo.empty()) + { + bExternal = true; + return WriteHyperlinkVideo(CorrectXmlString3(strVideoPath), true); + } + else + { + return WriteHyperlinkVideo(strVideo, false); + } + } + + inline int getRId()const{return m_lNextRelsID;} }; } diff --git a/MsBinaryFile/PptFile/PPTXWriter/ShapeWriter.cpp b/MsBinaryFile/PptFile/PPTXWriter/ShapeWriter.cpp index b7552a835c..f612c7da1c 100644 --- a/MsBinaryFile/PptFile/PPTXWriter/ShapeWriter.cpp +++ b/MsBinaryFile/PptFile/PPTXWriter/ShapeWriter.cpp @@ -189,11 +189,6 @@ PPT_FORMAT::CShapeWriter::CShapeWriter() m_pFontManager = NULL; } - -void CShapeWriter::InitNextId() -{ - m_lNextShapeID = 1000; -} bool PPT_FORMAT::CShapeWriter::SetElement(CElementPtr pElem) { m_pElement = pElem; @@ -2326,94 +2321,6 @@ HRESULT PPT_FORMAT::CShapeWriter::SetBrush(std::wstring bsXML) return S_OK; } -void CShapeWriter::SetRelsGenerator(CRelsGenerator *pGenerator) -{ - m_pRels = pGenerator; -} - -void CShapeWriter::CalculateFullTransform() -{ - m_oFullTransform = m_oBaseTransform; - m_oFullTransform.Multiply(&m_oTransform, Aggplus::MatrixOrderPrepend); - - m_dTransformAngle = m_oTransform.z_Rotation(); -} - -void CShapeWriter::_SetFont() -{ - if (NULL == m_pFontManager) - { - m_pFontManager = NSFonts::NSFontManager::Create(); - m_pFontManager->Initialize(); - } - - m_pFontManager->SetStringGID(m_oFont.StringGID); - - if (_T("") == m_oFont.Path) - { - m_pFontManager->LoadFontByName(m_oFont.Name, m_oFont.Size, m_oFont.GetStyle(), m_dDpiX, m_dDpiY); - } - else - { - m_pFontManager->LoadFontFromFile(m_oFont.Path, 0, m_oFont.Size, m_dDpiX, m_dDpiY); - } - - m_oInstalledFont = m_oFont; -} - -void CShapeWriter::MoveTo(const double &dX, const double &dY) -{ - double x = dX; - double y = dY; - m_oFullTransform.TransformPoint(x, y); - - m_oWriterPath.WriteString(L""); -} - -void CShapeWriter::LineTo(const double &dX, const double &dY) -{ - double x = dX; - double y = dY; - m_oFullTransform.TransformPoint(x, y); - - m_oWriterPath.WriteString(L""); -} - -void CShapeWriter::CurveTo(const double &x1, const double &y1, const double &x2, const double &y2, const double &x3, const double &y3) -{ - double _x1 = x1; - double _y1 = y1; - m_oFullTransform.TransformPoint(_x1, _y1); - - double _x2 = x2; - double _y2 = y2; - m_oFullTransform.TransformPoint(_x2, _y2); - - double _x3 = x3; - double _y3 = y3; - m_oFullTransform.TransformPoint(_x3, _y3); - - m_oWriterPath.WriteString(L""); -} - -void CShapeWriter::Start() -{ - m_oWriterPath.ClearNoAttack(); -} - -void CShapeWriter::End() -{ - m_oWriterPath.ClearNoAttack(); -} - -void CShapeWriter::Close() -{ - std::wstring str = _T(""); - m_oWriterPath.WriteString(str); -} - HRESULT PPT_FORMAT::CShapeWriter::get_BrushType(LONG* lType) { *lType = m_oBrush.Type; @@ -3026,97 +2933,3 @@ HRESULT PPT_FORMAT::CShapeWriter::put_ClipMode(const LONG& lMode) m_lClipMode = lMode; return S_OK; } - -static inline LONG GetPPTXPlaceHolderType(const int & lType) -{ - switch (lType) - { - case PT_None: break; - - case PT_MasterTitle: - case PT_Title: - case PT_VerticalTitle: - return 15; // title - - case PT_MasterBody: - case PT_Body: - case PT_MasterNotesBody: - case PT_VerticalBody: - case PT_NotesBody: - return 0; // body - - case PT_MasterCenterTitle: - case PT_CenterTitle: - return 3; // ctrTitle - - case PT_MasterSubTitle: - case PT_SubTitle: - return 13; // subtitle - - case PT_Object: - return 9; // object - - case PT_MasterNotesSlideImage: - case PT_NotesSlideImage: - return 11; // slideImg - - case PT_Graph: - return 1; //chart - - case PT_Table: - return 14; // table - - case PT_ClipArt: - return 2; // clipArt - - case PT_OrgChart: - return 1; // chart - - case PT_Media: - return 8; // media - - case PT_MasterDate: - return 5; // date - - case PT_MasterSlideNumber: - return 12; // sldNum - - case PT_MasterFooter: - return 6; // footer - - case PT_MasterHeader: - return 7; // header - default: - break; - } - - return lType; -} - -std::wstring GetPhType(const int &lType) -{ - int TypePPTX = GetPPTXPlaceHolderType(lType); - - switch (TypePPTX) - { - case 0: return _T("body"); - case 100: return _T("body"); // для master pages - case 1: return _T("chart"); - case 2: return _T("clipArt"); - case 3: return _T("ctrTitle"); - case 4: return _T("dgm"); - case 5: return _T("dt"); - case 6: return _T("ftr"); - case 7: return _T("hdr"); - case 8: return _T("media"); - case 9: return _T("obj"); - case 10: return _T("pic"); - case 11: return _T("sldImg"); - case 12: return _T("sldNum"); - case 13: return _T("subTitle"); - case 14: return _T("tbl"); - case 15: return _T("title"); - default: break; - } - return _T("body"); -} diff --git a/MsBinaryFile/PptFile/PPTXWriter/ShapeWriter.h b/MsBinaryFile/PptFile/PPTXWriter/ShapeWriter.h index 6aecb07f5f..71f0d37342 100644 --- a/MsBinaryFile/PptFile/PPTXWriter/ShapeWriter.h +++ b/MsBinaryFile/PptFile/PPTXWriter/ShapeWriter.h @@ -37,7 +37,99 @@ namespace PPT_FORMAT { - std::wstring GetPhType(const int & lType); + static inline LONG GetPPTXPlaceHolderType(const int & lType) + { + switch (lType) + { + case PT_None: break; + + case PT_MasterTitle: + case PT_Title: + case PT_VerticalTitle: + return 15; // title + + case PT_MasterBody: + case PT_Body: + case PT_MasterNotesBody: + case PT_VerticalBody: + case PT_NotesBody: + return 0; // body + + case PT_MasterCenterTitle: + case PT_CenterTitle: + return 3; // ctrTitle + + case PT_MasterSubTitle: + case PT_SubTitle: + return 13; // subtitle + + case PT_Object: + return 9; // object + + case PT_MasterNotesSlideImage: + case PT_NotesSlideImage: + return 11; // slideImg + + case PT_Graph: + return 1; //chart + + case PT_Table: + return 14; // table + + case PT_ClipArt: + return 2; // clipArt + + case PT_OrgChart: + return 1; // chart + + case PT_Media: + return 8; // media + + case PT_MasterDate: + return 5; // date + + case PT_MasterSlideNumber: + return 12; // sldNum + + case PT_MasterFooter: + return 6; // footer + + case PT_MasterHeader: + return 7; // header + default: + break; + } + + return lType; + } + + AVSINLINE std::wstring GetPhType(const int & lType) + { + int TypePPTX = GetPPTXPlaceHolderType(lType); + + switch (TypePPTX) + { + case 0: return _T("body"); + case 100: return _T("body"); // для master pages + case 1: return _T("chart"); + case 2: return _T("clipArt"); + case 3: return _T("ctrTitle"); + case 4: return _T("dgm"); + case 5: return _T("dt"); + case 6: return _T("ftr"); + case 7: return _T("hdr"); + case 8: return _T("media"); + case 9: return _T("obj"); + case 10: return _T("pic"); + case 11: return _T("sldImg"); + case 12: return _T("sldNum"); + case 13: return _T("subTitle"); + case 14: return _T("tbl"); + case 15: return _T("title"); + default: break; + } + return _T("body"); + } class CShapeWriter { @@ -70,7 +162,10 @@ namespace PPT_FORMAT friend class CPPTXWriter; - void InitNextId(); + AVSINLINE void InitNextId() + { + m_lNextShapeID = 1000; + } bool SetElement(CElementPtr pElem); //-------------------------------------------------------------------- @@ -239,11 +334,40 @@ namespace PPT_FORMAT HRESULT SetPen(std::wstring bsXML); HRESULT SetBrush(std::wstring bsXML); public: - void SetRelsGenerator(CRelsGenerator* pGenerator); + void SetRelsGenerator(CRelsGenerator* pGenerator) + { + m_pRels = pGenerator; + } protected: - void CalculateFullTransform(); - void _SetFont(); + void CalculateFullTransform() + { + m_oFullTransform = m_oBaseTransform; + m_oFullTransform.Multiply(&m_oTransform, Aggplus::MatrixOrderPrepend); + + m_dTransformAngle = m_oTransform.z_Rotation(); + } + void _SetFont() + { + if (NULL == m_pFontManager) + { + m_pFontManager = NSFonts::NSFontManager::Create(); + m_pFontManager->Initialize(); + } + + m_pFontManager->SetStringGID(m_oFont.StringGID); + + if (_T("") == m_oFont.Path) + { + m_pFontManager->LoadFontByName(m_oFont.Name, m_oFont.Size, m_oFont.GetStyle(), m_dDpiX, m_dDpiY); + } + else + { + m_pFontManager->LoadFontFromFile(m_oFont.Path, 0, m_oFont.Size, m_dDpiX, m_dDpiY); + } + + m_oInstalledFont = m_oFont; + } public: @@ -273,12 +397,53 @@ namespace PPT_FORMAT CFont m_oInstalledFont; public: - void MoveTo(const double& dX, const double& dY); - void LineTo(const double& dX, const double& dY); - void CurveTo(const double& x1, const double& y1, const double& x2, const double& y2, const double& x3, const double& y3); - void Start(); - void End(); - void Close(); + inline void MoveTo(const double& dX, const double& dY) + { + double x = dX; + double y = dY; + m_oFullTransform.TransformPoint(x, y); + + m_oWriterPath.WriteString(L""); + } + inline void LineTo(const double& dX, const double& dY) + { + double x = dX; + double y = dY; + m_oFullTransform.TransformPoint(x, y); + + m_oWriterPath.WriteString(L""); + } + inline void CurveTo(const double& x1, const double& y1, const double& x2, const double& y2, const double& x3, const double& y3) + { + double _x1 = x1; + double _y1 = y1; + m_oFullTransform.TransformPoint(_x1, _y1); + + double _x2 = x2; + double _y2 = y2; + m_oFullTransform.TransformPoint(_x2, _y2); + + double _x3 = x3; + double _y3 = y3; + m_oFullTransform.TransformPoint(_x3, _y3); + + m_oWriterPath.WriteString(L""); + } + void Start() + { + m_oWriterPath.ClearNoAttack(); + } + void End() + { + m_oWriterPath.ClearNoAttack(); + } + void Close() + { + std::wstring str = _T(""); + m_oWriterPath.WriteString(str); + } void WriteGroupInfo(); void WriteTableInfo(); diff --git a/MsBinaryFile/PptFile/PPTXWriter/StylesWriter.h b/MsBinaryFile/PptFile/PPTXWriter/StylesWriter.h index c42a7575f7..3f096137df 100644 --- a/MsBinaryFile/PptFile/PPTXWriter/StylesWriter.h +++ b/MsBinaryFile/PptFile/PPTXWriter/StylesWriter.h @@ -31,8 +31,6 @@ */ #pragma once -#include "../Drawing/TextStructures.h" - namespace PPT_FORMAT { class CTheme; @@ -45,17 +43,83 @@ public: PPT_FORMAT::CTheme* m_pTheme; - void ConvertStyles(PPT_FORMAT::CTextStyles& oStyles, PPT_FORMAT::CStringWriter& oWriter, int nCount = 10); - std::wstring ConvertStyleLevel(PPT_FORMAT::CTextStyleLevel& oLevel, const int& nLevel); + void ConvertStyles(PPT_FORMAT::CTextStyles& oStyles, PPT_FORMAT::CStringWriter& oWriter, int nCount = 10) + { + for (int i = 0; i < nCount; ++i) + { + if (oStyles.m_pLevels[i].is_init()) + ConvertStyleLevel(oStyles.m_pLevels[i].get(), oWriter, i); + } + } + std::wstring ConvertStyleLevel(PPT_FORMAT::CTextStyleLevel& oLevel, const int& nLevel) + { + PPT_FORMAT::CStringWriter oWriter; + ConvertStyleLevel(oLevel, oWriter, nLevel); + return oWriter.GetData(); + } void ConvertStyleLevel(PPT_FORMAT::CTextStyleLevel& oLevel, PPT_FORMAT::CStringWriter& oWriter, const int& nLevel); - std::wstring ConvertStyles(PPT_FORMAT::CTextStyles& oStyles, int nCount = 10); - static std::wstring GetTextAnchor(const WORD& value); + std::wstring ConvertStyles(PPT_FORMAT::CTextStyles& oStyles, int nCount = 10) + { + PPT_FORMAT::CStringWriter oWriter; + ConvertStyles(oStyles, oWriter, nCount); + return oWriter.GetData(); + } + AVSINLINE static std::wstring GetTextAnchor(const WORD& value) + { + if (0 == value) return L"t"; + if (1 == value) return L"ctr"; + if (2 == value) return L"b"; + return L"t"; + } + + AVSINLINE static std::wstring GetTextAlign(const WORD& value) + { + if (0 == value) return L"l"; + if (1 == value) return L"ctr"; + if (2 == value) return L"r"; + if (3 == value) return L"just"; + if (4 == value) return L"dist"; + if (5 == value) return L"thaiDist"; + if (6 == value) return L"justLow"; + return L"l"; + } + AVSINLINE static std::wstring GetColorInScheme(const LONG& lIndex) + { + switch (lIndex) + { + case 0: return L"phClr"; + case 1: return L"bg1"; + case 2: return L"tx1"; + case 3: return L"bg2"; + case 4: return L"tx2"; + case 5: return L"accent1"; + case 6: return L"accent2"; + case 7: return L"accent3"; + case 8: return L"accent4"; + case 9: return L"accent5"; + case 10: return L"accent6"; + case 11: return L"hlink"; + case 12: return L"folHlink"; + case 13: return L"lt1"; + case 14: return L"dk1"; + case 15: return L"lt2"; + case 16: return L"dk2"; + break; + }; + return L"none"; + } + + AVSINLINE static std::wstring GetFontAlign(const WORD& value) + { + if (0 == value) return L"base"; + if (1 == value) return L"t"; + if (2 == value) return L"ctr"; + if (3 == value) return L"b"; + return L"auto"; + } - static std::wstring GetTextAlign(const WORD& value); - static std::wstring GetColorInScheme(const LONG& lIndex); - static std::wstring GetFontAlign(const WORD& value); }; diff --git a/MsBinaryFile/PptFile/Reader/ClassesAtom.h b/MsBinaryFile/PptFile/Reader/ClassesAtom.h index 5324b0ebb9..52ebc52449 100644 --- a/MsBinaryFile/PptFile/Reader/ClassesAtom.h +++ b/MsBinaryFile/PptFile/Reader/ClassesAtom.h @@ -45,16 +45,38 @@ public: _UINT32 m_nEncryptRef; _UINT32 m_nMaxPersistWritten; - CUserEdit(); - ~CUserEdit(); + CUserEdit() + { + m_nOffsetLastEdit = 0; + m_nOffsetPersistDirectory = 0; + m_nDocumentRef = 0; + m_nMaxPersistWritten = 0; + m_nEncryptRef = 0; + } + ~CUserEdit() + { + } - CUserEdit& operator =(const CUserEdit& oSrc); + CUserEdit& operator =(const CUserEdit& oSrc) + { + m_nOffsetLastEdit = oSrc.m_nOffsetLastEdit; + m_nOffsetPersistDirectory = oSrc.m_nOffsetPersistDirectory; + m_nDocumentRef = oSrc.m_nDocumentRef; + m_nMaxPersistWritten = oSrc.m_nMaxPersistWritten; + m_nEncryptRef = oSrc.m_nEncryptRef; + return (*this); + } - void FromAtom(CRecordUserEditAtom* pAtom); + void FromAtom(CRecordUserEditAtom* pAtom) + { + m_nOffsetLastEdit = pAtom->m_nOffsetLastEdit; + m_nOffsetPersistDirectory = pAtom->m_nOffsetPersistDirectory; + m_nDocumentRef = pAtom->m_nOffsetDocPersistIdRef; + m_nMaxPersistWritten = pAtom->m_nPersistIdSeed; + m_nEncryptRef = pAtom->m_nEncryptSessionPersistIdRef; + } }; -class CRecordCurrentUserAtom; - class CCurrentUser { public: @@ -62,12 +84,30 @@ public: _UINT32 m_nOffsetToCurrentEdit; std::wstring m_sName; - CCurrentUser(); - ~CCurrentUser(); + CCurrentUser() + { + m_bIsEncrypt = false; + m_nOffsetToCurrentEdit = 0; + } + ~CCurrentUser() + { + } - CCurrentUser& operator =(const CCurrentUser& oSrc); + CCurrentUser& operator =(const CCurrentUser& oSrc) + { + m_bIsEncrypt = oSrc.m_bIsEncrypt; + m_nOffsetToCurrentEdit = oSrc.m_nOffsetToCurrentEdit; + m_sName = oSrc.m_sName; + return (*this); + } - void FromAtom(CRecordCurrentUserAtom* pAtom); + void FromAtom(CRecordCurrentUserAtom* pAtom) + { + m_bIsEncrypt = (ENCRYPT == pAtom->m_nToken); + + m_nOffsetToCurrentEdit = pAtom->m_nOffsetToCurEdit; + m_sName = pAtom->m_strUNICODEUserName; + } }; diff --git a/MsBinaryFile/PptFile/Reader/PPTDocumentInfo.h b/MsBinaryFile/PptFile/Reader/PPTDocumentInfo.h index ffd18f66bf..4d534fc812 100644 --- a/MsBinaryFile/PptFile/Reader/PPTDocumentInfo.h +++ b/MsBinaryFile/PptFile/Reader/PPTDocumentInfo.h @@ -46,12 +46,95 @@ public: std::wstring m_app_xml; std::wstring m_core_xml; - CPPTDocumentInfo(); + CPPTDocumentInfo() : m_oCurrentUser(), m_bMacros(true) + { + } - ~CPPTDocumentInfo(); + ~CPPTDocumentInfo() + { + Clear(); + } - void Clear(); + void Clear() + { + size_t nCount = m_arUsers.size(); + while(0 != nCount) + { + if (NULL != m_arUsers[nCount-1]) + RELEASEOBJECT(m_arUsers[nCount-1]) + + m_arUsers.pop_back(); + --nCount; + } + } - bool ReadFromStream(CRecordCurrentUserAtom* pCurrentUser, POLE::Stream* pStream); - bool LoadDocument(std::wstring strFolderMem); + bool ReadFromStream(CRecordCurrentUserAtom* pCurrentUser, POLE::Stream* pStream) + { + m_oCurrentUser.FromAtom(pCurrentUser); + + _UINT32 offsetToEdit = m_oCurrentUser.m_nOffsetToCurrentEdit; + SRecordHeader oHeader; + CRecordUserEditAtom oUserAtom; + + Clear(); + + size_t nCountUsers = 0; + + while (0 < offsetToEdit) + { + StreamUtils::StreamSeek(offsetToEdit, pStream); + + oHeader.ReadFromStream(pStream); + oUserAtom.ReadFromStream(oHeader, pStream); + + CPPTUserInfo* pInfo = new CPPTUserInfo(); + + pInfo->m_strTmpDirectory = m_strTmpDirectory; + pInfo->m_bEncrypt = m_oCurrentUser.m_bIsEncrypt; + pInfo->m_strPassword = m_strPassword; + pInfo->m_bMacros = m_bMacros; + + bool bResult = pInfo->ReadFromStream(&oUserAtom, pStream); + + m_bMacros = pInfo->m_bMacros; + offsetToEdit = pInfo->m_oUser.m_nOffsetLastEdit; + m_oCurrentUser.m_bIsEncrypt = pInfo->m_bEncrypt; + + if (bResult == false) + { + delete pInfo; + pInfo = NULL; // may not work + + if (m_oCurrentUser.m_bIsEncrypt) + return false; + else + continue; + } + + m_arUsers.push_back(pInfo); + // теперь нужно выставить у него параметры для других юзеров + pInfo->m_pDocumentInfo = this; + pInfo->m_lIndexThisUser = m_arUsers.size() - 1; + + pInfo = NULL; + } + + return true; + } + bool LoadDocument(std::wstring strFolderMem) + { + if (m_arUsers.empty()) return false; + + try + { + m_arUsers[0]->ReadExtenalObjects(strFolderMem); + m_arUsers[0]->FromDocument(); + } + catch(int) //error code + { + return false; + } + + return true; + } }; diff --git a/MsBinaryFile/PptFile/Reader/PPTDocumentInfoOneUser.cpp b/MsBinaryFile/PptFile/Reader/PPTDocumentInfoOneUser.cpp index f238d51581..fb6b229212 100644 --- a/MsBinaryFile/PptFile/Reader/PPTDocumentInfoOneUser.cpp +++ b/MsBinaryFile/PptFile/Reader/PPTDocumentInfoOneUser.cpp @@ -2581,195 +2581,6 @@ void CPPTUserInfo::CreateDefaultStyle(PPT_FORMAT::CTextStyles& pStyle, PPT_FORMA } } -void CPPTUserInfo::CorrectColorScheme(std::vector &oScheme) -{ - if (oScheme.size() < 1) return; - - std::vector oArrayMem; - oArrayMem.push_back(oScheme[0]);//0 - oArrayMem.push_back(oScheme[1]);//1 - oArrayMem.push_back(oScheme[2]);//2 - oArrayMem.push_back(oScheme[3]);//3 - oArrayMem.push_back(oScheme[0]);//4 - oArrayMem.push_back(oScheme[4]);//5 //accent1 - oArrayMem.push_back(oScheme[5]);//6 //accent2 - oArrayMem.push_back(CColor(0xAAAAAA));//(oScheme[0]);//7 //accent3 - oArrayMem.push_back(CColor(0xDCDCDC));//(oScheme[5]);//8 //accent4 - oArrayMem.push_back(CColor(0xDBF1FA));//(oScheme[4]);//9 //accent5 - oArrayMem.push_back(CColor(0x4B9DCA));//(oScheme[7]);//10 //accent6 - oArrayMem.push_back(oScheme[6]);//11 //hlink - oArrayMem.push_back(oScheme[7]);//12 //folHlink - oArrayMem.push_back(oScheme[0]);//13 //lt1 - oArrayMem.push_back(oScheme[1]);//14 //dk1 - oArrayMem.push_back(oScheme[2]);//15 //lt2 - oArrayMem.push_back(oScheme[3]);//16 //dk2 - - //0x00 //Background color - //0x01 //Text color - //0x02 //Shadow color - //0x03 //Title text color - //0x04 //Fill color - //0x05 //Accent 1 color - //0x06 //Accent 2 color - //0x07 //Accent 3 color - - oScheme = oArrayMem; -} - -void CPPTUserInfo::ConvertLayoutType(SSlideLayoutAtom &layoutRecord, std::wstring &type, std::wstring &name) -{ - name = L"Blank Slide"; - type = L"blank"; - - switch (layoutRecord.m_nGeom) - { - case SL_TitleSlide: - case SL_MasterTitle: - { - name = L"Title Slide"; - type = L"title"; - }break; - case SL_TitleBody: - { - name = L"Title and Object Slide"; - type = L"obj"; - - int ind = 0; - if (layoutRecord.m_pPlaceHolderID[0] == 13 && layoutRecord.m_pPlaceHolderID[1] != 0) ind++; - PlaceholderEnum phbody = (PlaceholderEnum)layoutRecord.m_pPlaceHolderID[ind]; - switch (phbody) - { - case PT_MasterTitle: type = L"title"; name = L"Title and Object Slide"; break; - case PT_Table: type = L"tbl"; name = L"Title and Table Slide"; break; - case PT_OrgChart: type = L"dgm"; name = L"Title and Diagramma Slide"; break; - case PT_Graph: type = L"chart"; name = L"Title and Chart Slide"; break; - default: - break; - } - }break; - case SL_TitleOnly: - { - name = L"Title Only Slide"; - type = L"titleOnly"; - }break; - case SL_TwoColumns: - { - PlaceholderEnum leftType = (PlaceholderEnum)layoutRecord.m_pPlaceHolderID[1]; - PlaceholderEnum rightType = (PlaceholderEnum)layoutRecord.m_pPlaceHolderID[2]; - - name = L"Two Objects Slide"; - type = L"twoObj"; - - if (leftType == PT_Body && rightType == PT_Object) - { - name = L"Text And Object Slide"; - type = L"txAndObj"; - } - else if (leftType == PT_Object && rightType == PT_Body) - { - name = L"Object And Text Slide"; - type = L"objAndTx"; - } - else if (leftType == PT_Body && rightType == PT_ClipArt) - { - name = L"Text And ClipArt Slide"; - type = L"txAndClipArt"; - } - else if (leftType == PT_ClipArt && rightType == PT_Body) - { - name = L"ClipArt And Text Slide"; - type = L"clipArtAndTx"; - } - else if (leftType == PT_Body && rightType == PT_Graph) - { - name = L"Text And Chart Slide"; - type = L"txAndChart"; - } - else if (leftType == PT_Graph && rightType == PT_Body) - { - name = L"Chart And Text Slide"; - type = L"chartAndTx"; - } - else if (leftType == PT_Body && rightType == PT_Media) - { - name = L"Text And Media Slide"; - type = L"txAndMedia"; - } - else if (leftType == PT_Media && rightType == PT_Body) - { - name = L"Media And Text Slide"; - type = L"mediaAndTx"; - } - }break; - case SL_TwoRows: - { - PlaceholderEnum topType = (PlaceholderEnum)layoutRecord.m_pPlaceHolderID[1]; - PlaceholderEnum bottomType = (PlaceholderEnum)layoutRecord.m_pPlaceHolderID[2]; - - if (topType == PT_Body && bottomType == PT_Object) - { - name = L"Text Over Object Slide"; - type = L"txOverObj"; - } - else - { - name = L"Object Over Text Slide"; - type = L"objOverTx"; - } - }break; - case SL_ColumnTwoRows: - { - PlaceholderEnum leftType = (PlaceholderEnum)layoutRecord.m_pPlaceHolderID[1]; - - if (leftType == PT_Object) - { - type = L"objAndTwoObj"; - } - else - { - type = L"txAndTwoObj"; - } - }break; - case SL_TwoRowsColumn: - { - PlaceholderEnum rightType = (PlaceholderEnum)layoutRecord.m_pPlaceHolderID[2]; - - if (rightType == PT_Object) - { - type = L"twoObjAndObj"; - } - else - { - type = L"twoObjAndTx"; - } - }break; - case SL_TwoColumnsRow: - { - type = L"twoObjOverTx"; - }break; - case SL_FourObjects: - { - type = L"fourObj"; - }break; - case SL_BigObject: - { - name = L"Object Only Slide"; - type = L"objOnly"; - }break; - case SL_VerticalTitleBody: - { - type = L"vertTitleAndTx"; - }break; - case SL_VerticalTwoRows: - { - type = L"vertTx"; - }break; - case SL_Blank: - default: - break; - } -} - void CPPTUserInfo::LoadAutoNumbering(CRecordGroupShapeContainer *pGroupContainer, CTheme *pTheme) { @@ -2811,28 +2622,28 @@ void CPPTUserInfo::LoadBulletBlip(CShapeElement *pShape) auto& arrPars = pShape->m_pShape->m_oText.m_arParagraphs; // TODO need to find BlipEntity; - IRecord* pRecPPT9 = arrDocInfoCont[0]->getDocBinaryTagExtension(___PPT9); - auto* pProgBinaryTag = dynamic_cast(pRecPPT9); - if (pProgBinaryTag == nullptr || !pProgBinaryTag->m_blipCollectionContainer.is_init()) - return; + IRecord* pRecPPT9 = arrDocInfoCont[0]->getDocBinaryTagExtension(___PPT9); + auto* pProgBinaryTag = dynamic_cast(pRecPPT9); + if (pProgBinaryTag == nullptr || !pProgBinaryTag->m_blipCollectionContainer.is_init()) + return; - const auto& arrBlipEntity = pProgBinaryTag->m_blipCollectionContainer.get().m_rgBlipEntityAtom; - // const auto& arrAutoNum = pProgBinaryTag->m_outlineTextPropsContainer.get() - if(arrBlipEntity.empty()) - return; + const auto& arrBlipEntity = pProgBinaryTag->m_blipCollectionContainer.get().m_rgBlipEntityAtom; + // const auto& arrAutoNum = pProgBinaryTag->m_outlineTextPropsContainer.get() + if(arrBlipEntity.empty()) + return; - for (auto& par : arrPars) - { - if (par.m_oPFRun.bulletBlip.IsInit()) - { - auto& buBlip = par.m_oPFRun.bulletBlip.get(); - if (buBlip.bulletBlipRef >= 0 && (UINT)buBlip.bulletBlipRef < arrBlipEntity.size()) - { - buBlip.tmpImagePath = arrBlipEntity[buBlip.bulletBlipRef]->getTmpImgPath(); - } - } + for (auto& par : arrPars) + { + if (par.m_oPFRun.bulletBlip.IsInit()) + { + auto& buBlip = par.m_oPFRun.bulletBlip.get(); + if (buBlip.bulletBlipRef >= 0 && (UINT)buBlip.bulletBlipRef < arrBlipEntity.size()) + { + buBlip.tmpImagePath = arrBlipEntity[buBlip.bulletBlipRef]->getTmpImgPath(); + } + } - } + } } void CPPTUserInfo::LoadAutoNumBullet(CShapeElement *pShape, int slideID) diff --git a/MsBinaryFile/PptFile/Reader/PPTDocumentInfoOneUser.h b/MsBinaryFile/PptFile/Reader/PPTDocumentInfoOneUser.h index 89b64e3702..f331da9efb 100644 --- a/MsBinaryFile/PptFile/Reader/PPTDocumentInfoOneUser.h +++ b/MsBinaryFile/PptFile/Reader/PPTDocumentInfoOneUser.h @@ -161,9 +161,194 @@ public: void LoadBulletBlip(CShapeElement* pShape); void LoadAutoNumBullet(CShapeElement* pShape, int slideID); void CreateDefaultStyle(PPT_FORMAT::CTextStyles& pStyle, PPT_FORMAT::CTheme* pTheme); - void CorrectColorScheme(std::vector& oScheme); + void CorrectColorScheme(std::vector& oScheme) + { + if (oScheme.size() < 1) return; + + std::vector oArrayMem; + oArrayMem.push_back(oScheme[0]);//0 + oArrayMem.push_back(oScheme[1]);//1 + oArrayMem.push_back(oScheme[2]);//2 + oArrayMem.push_back(oScheme[3]);//3 + oArrayMem.push_back(oScheme[0]);//4 + oArrayMem.push_back(oScheme[4]);//5 //accent1 + oArrayMem.push_back(oScheme[5]);//6 //accent2 + oArrayMem.push_back(CColor(0xAAAAAA));//(oScheme[0]);//7 //accent3 + oArrayMem.push_back(CColor(0xDCDCDC));//(oScheme[5]);//8 //accent4 + oArrayMem.push_back(CColor(0xDBF1FA));//(oScheme[4]);//9 //accent5 + oArrayMem.push_back(CColor(0x4B9DCA));//(oScheme[7]);//10 //accent6 + oArrayMem.push_back(oScheme[6]);//11 //hlink + oArrayMem.push_back(oScheme[7]);//12 //folHlink + oArrayMem.push_back(oScheme[0]);//13 //lt1 + oArrayMem.push_back(oScheme[1]);//14 //dk1 + oArrayMem.push_back(oScheme[2]);//15 //lt2 + oArrayMem.push_back(oScheme[3]);//16 //dk2 + +//0x00 //Background color +//0x01 //Text color +//0x02 //Shadow color +//0x03 //Title text color +//0x04 //Fill color +//0x05 //Accent 1 color +//0x06 //Accent 2 color +//0x07 //Accent 3 color + + oScheme = oArrayMem; + } - void ConvertLayoutType(SSlideLayoutAtom & layoutRecord, std::wstring & type, std::wstring & name); + void ConvertLayoutType(SSlideLayoutAtom & layoutRecord, std::wstring & type, std::wstring & name) + { + name = L"Blank Slide"; + type = L"blank"; + + switch (layoutRecord.m_nGeom) + { + case SL_TitleSlide: + case SL_MasterTitle: + { + name = L"Title Slide"; + type = L"title"; + }break; + case SL_TitleBody: + { + name = L"Title and Object Slide"; + type = L"obj"; + + int ind = 0; + if (layoutRecord.m_pPlaceHolderID[0] == 13 && layoutRecord.m_pPlaceHolderID[1] != 0) ind++; + PlaceholderEnum phbody = (PlaceholderEnum)layoutRecord.m_pPlaceHolderID[ind]; + switch (phbody) + { + case PT_MasterTitle: type = L"title"; name = L"Title and Object Slide"; break; + case PT_Table: type = L"tbl"; name = L"Title and Table Slide"; break; + case PT_OrgChart: type = L"dgm"; name = L"Title and Diagramma Slide"; break; + case PT_Graph: type = L"chart"; name = L"Title and Chart Slide"; break; + default: + break; + } + }break; + case SL_TitleOnly: + { + name = L"Title Only Slide"; + type = L"titleOnly"; + }break; + case SL_TwoColumns: + { + PlaceholderEnum leftType = (PlaceholderEnum)layoutRecord.m_pPlaceHolderID[1]; + PlaceholderEnum rightType = (PlaceholderEnum)layoutRecord.m_pPlaceHolderID[2]; + + name = L"Two Objects Slide"; + type = L"twoObj"; + + if (leftType == PT_Body && rightType == PT_Object) + { + name = L"Text And Object Slide"; + type = L"txAndObj"; + } + else if (leftType == PT_Object && rightType == PT_Body) + { + name = L"Object And Text Slide"; + type = L"objAndTx"; + } + else if (leftType == PT_Body && rightType == PT_ClipArt) + { + name = L"Text And ClipArt Slide"; + type = L"txAndClipArt"; + } + else if (leftType == PT_ClipArt && rightType == PT_Body) + { + name = L"ClipArt And Text Slide"; + type = L"clipArtAndTx"; + } + else if (leftType == PT_Body && rightType == PT_Graph) + { + name = L"Text And Chart Slide"; + type = L"txAndChart"; + } + else if (leftType == PT_Graph && rightType == PT_Body) + { + name = L"Chart And Text Slide"; + type = L"chartAndTx"; + } + else if (leftType == PT_Body && rightType == PT_Media) + { + name = L"Text And Media Slide"; + type = L"txAndMedia"; + } + else if (leftType == PT_Media && rightType == PT_Body) + { + name = L"Media And Text Slide"; + type = L"mediaAndTx"; + } + }break; + case SL_TwoRows: + { + PlaceholderEnum topType = (PlaceholderEnum)layoutRecord.m_pPlaceHolderID[1]; + PlaceholderEnum bottomType = (PlaceholderEnum)layoutRecord.m_pPlaceHolderID[2]; + + if (topType == PT_Body && bottomType == PT_Object) + { + name = L"Text Over Object Slide"; + type = L"txOverObj"; + } + else + { + name = L"Object Over Text Slide"; + type = L"objOverTx"; + } + }break; + case SL_ColumnTwoRows: + { + PlaceholderEnum leftType = (PlaceholderEnum)layoutRecord.m_pPlaceHolderID[1]; + + if (leftType == PT_Object) + { + type = L"objAndTwoObj"; + } + else + { + type = L"txAndTwoObj"; + } + }break; + case SL_TwoRowsColumn: + { + PlaceholderEnum rightType = (PlaceholderEnum)layoutRecord.m_pPlaceHolderID[2]; + + if (rightType == PT_Object) + { + type = L"twoObjAndObj"; + } + else + { + type = L"twoObjAndTx"; + } + }break; + case SL_TwoColumnsRow: + { + type = L"twoObjOverTx"; + }break; + case SL_FourObjects: + { + type = L"fourObj"; + }break; + case SL_BigObject: + { + name = L"Object Only Slide"; + type = L"objOnly"; + }break; + case SL_VerticalTitleBody: + { + type = L"vertTitleAndTx"; + }break; + case SL_VerticalTwoRows: + { + type = L"vertTx"; + }break; + case SL_Blank: + default: + break; + } + } void AddAnimation (_UINT32 dwSlideID, double Width, double Height, CElementPtr pElement); void AddAudioTransition (_UINT32 dwSlideID, CTransition* pTransition, const std::wstring& strFilePath); diff --git a/MsBinaryFile/PptFile/Reader/ReadStructures.cpp b/MsBinaryFile/PptFile/Reader/ReadStructures.cpp index 86181d9a01..07e64248ef 100644 --- a/MsBinaryFile/PptFile/Reader/ReadStructures.cpp +++ b/MsBinaryFile/PptFile/Reader/ReadStructures.cpp @@ -232,50 +232,8 @@ void Read(POLE::Stream* pStream, PPT_FORMAT::CTextRuler& oRun) if (bLeftMargin5_) oRun.LeftMargin5 = StreamUtils::ReadSHORT(pStream) * dScaleX; if (bIndent5_) oRun.Indent5 = StreamUtils::ReadSHORT(pStream) * dScaleX; } - -void Read(POLE::Stream *pStream, SPointAtom &oAtom) -{ - oAtom.X = StreamUtils::ReadLONG(pStream); - oAtom.Y = StreamUtils::ReadLONG(pStream); } -void Read(POLE::Stream *pStream, SColorAtom &oAtom) -{ - oAtom.R = StreamUtils::ReadBYTE(pStream); - oAtom.G = StreamUtils::ReadBYTE(pStream); - oAtom.B = StreamUtils::ReadBYTE(pStream); - oAtom.Index = StreamUtils::ReadBYTE(pStream); - - oAtom.bPaletteIndex = oAtom.bPaletteRGB = oAtom.bSystemRGB = oAtom.bSysIndex = oAtom.bSchemeIndex = false; - - if (oAtom.Index != 0xFF) - { - oAtom.bPaletteRGB = (oAtom.Index == 0xFE); - oAtom.bSchemeIndex = (oAtom.Index != 0xFE); - } -} - -} - - -CTextPFRunRecord::CTextPFRunRecord() : m_oRun() -{ - m_lLevel = -1; - m_lCount = 0; -} - -CTextPFRunRecord::CTextPFRunRecord(const CTextPFRunRecord &oSrc) -{ - *this = oSrc; -} - -CTextPFRunRecord &CTextPFRunRecord::operator=(const CTextPFRunRecord &oSrc) -{ - m_oRun = oSrc.m_oRun; - m_lLevel = oSrc.m_lLevel; - m_lCount = oSrc.m_lCount; - return *this; -} void CTextPFRunRecord::LoadFromStream(POLE::Stream* pStream, bool bIsIndentation) { @@ -453,23 +411,6 @@ void CTextPFRunRecord::LoadFromStream(POLE::Stream* pStream, bool bIsIndentation } -CTextCFRunRecord::CTextCFRunRecord() : m_oRun() -{ - m_lCount = 0; -} - -CTextCFRunRecord::CTextCFRunRecord(const CTextCFRunRecord &oSrc) -{ - *this = oSrc; -} - -CTextCFRunRecord &CTextCFRunRecord::operator=(const CTextCFRunRecord &oSrc) -{ - m_oRun = oSrc.m_oRun; - m_lCount = oSrc.m_lCount; - return *this; -} - void CTextCFRunRecord::LoadFromStream(POLE::Stream* pStream, bool bIsIndentation) { if (bIsIndentation) @@ -851,72 +792,3 @@ void CMetaHeader::ToPICTHeader(BYTE *& pHeader, int & size) int sz = ((BYTE*)picPtr - pHeader); size = sz; } - -CMetaFileBuffer::CMetaFileBuffer() -{ - m_bIsCompressed = false; - m_bIsValid = false; - - m_pMetaHeader = NULL; - m_pMetaFile = NULL; - - m_lMetaHeaderSize = 0; - m_lMetaFileSize = 0; -} - -CMetaFileBuffer::~CMetaFileBuffer() -{ - RELEASEARRAYOBJECTS(m_pMetaHeader); - RELEASEARRAYOBJECTS(m_pMetaFile); - - if (m_bIsCompressed) - RELEASEARRAYOBJECTS(m_pMetaFile); - m_bIsCompressed = false; -} - -void CMetaFileBuffer::SetHeader(BYTE *pHeader, LONG lSize) -{ - m_pMetaHeader = pHeader; - m_lMetaHeaderSize = lSize; -} - -void CMetaFileBuffer::SetData(BYTE *pCompress, LONG lCompressSize, LONG lUncompressSize, bool bIsCompressed) -{ - m_bIsCompressed = bIsCompressed; - if (!m_bIsCompressed) - { - m_pMetaFile = pCompress; - m_lMetaFileSize = lUncompressSize; - } - else - { - ULONG lSize = lUncompressSize; - m_pMetaFile = new BYTE[lUncompressSize]; - bool bRes = NSZip::Decompress(pCompress, (ULONG)lCompressSize, m_pMetaFile, lSize); - if (bRes) - { - m_lMetaFileSize = (LONG)lSize; - m_bIsCompressed = true; - } - else - { - RELEASEARRAYOBJECTS(m_pMetaFile); - - m_pMetaFile = pCompress; - m_lMetaFileSize = lUncompressSize; - m_bIsCompressed = false; - } - } -} - -void CMetaFileBuffer::ToFile(NSFile::CFileBinary *pFile) -{ - if (NULL != m_pMetaHeader) - { - pFile->WriteFile(m_pMetaHeader, m_lMetaHeaderSize); - } - if (NULL != m_pMetaFile) - { - pFile->WriteFile(m_pMetaFile, m_lMetaFileSize); - } -} diff --git a/MsBinaryFile/PptFile/Reader/ReadStructures.h b/MsBinaryFile/PptFile/Reader/ReadStructures.h index 42d9935e4e..dca78a7a95 100644 --- a/MsBinaryFile/PptFile/Reader/ReadStructures.h +++ b/MsBinaryFile/PptFile/Reader/ReadStructures.h @@ -191,20 +191,98 @@ private: LONG m_lMetaFileSize; public: - CMetaFileBuffer(); - ~CMetaFileBuffer(); + CMetaFileBuffer() + { + m_bIsCompressed = false; + m_bIsValid = false; - void SetHeader(BYTE* pHeader, LONG lSize); + m_pMetaHeader = NULL; + m_pMetaFile = NULL; - void SetData(BYTE* pCompress, LONG lCompressSize, LONG lUncompressSize, bool bIsCompressed); + m_lMetaHeaderSize = 0; + m_lMetaFileSize = 0; + } + ~CMetaFileBuffer() + { + RELEASEARRAYOBJECTS(m_pMetaHeader); + RELEASEARRAYOBJECTS(m_pMetaFile); - void ToFile(NSFile::CFileBinary* pFile); + if (m_bIsCompressed) + RELEASEARRAYOBJECTS(m_pMetaFile); + m_bIsCompressed = false; + } + + void SetHeader(BYTE* pHeader, LONG lSize) + { + m_pMetaHeader = pHeader; + m_lMetaHeaderSize = lSize; + } + + void SetData(BYTE* pCompress, LONG lCompressSize, LONG lUncompressSize, bool bIsCompressed) + { + m_bIsCompressed = bIsCompressed; + if (!m_bIsCompressed) + { + m_pMetaFile = pCompress; + m_lMetaFileSize = lUncompressSize; + } + else + { + ULONG lSize = lUncompressSize; + m_pMetaFile = new BYTE[lUncompressSize]; + bool bRes = NSZip::Decompress(pCompress, (ULONG)lCompressSize, m_pMetaFile, lSize); + if (bRes) + { + m_lMetaFileSize = (LONG)lSize; + m_bIsCompressed = true; + } + else + { + RELEASEARRAYOBJECTS(m_pMetaFile); + + m_pMetaFile = pCompress; + m_lMetaFileSize = lUncompressSize; + m_bIsCompressed = false; + } + } + } + + void ToFile(NSFile::CFileBinary* pFile) + { + if (NULL != m_pMetaHeader) + { + pFile->WriteFile(m_pMetaHeader, m_lMetaHeaderSize); + } + if (NULL != m_pMetaFile) + { + pFile->WriteFile(m_pMetaFile, m_lMetaFileSize); + } + } }; namespace NSStreamReader { - void Read(POLE::Stream* pStream, SPointAtom& oAtom); - void Read(POLE::Stream* pStream, SColorAtom& oAtom); + static inline void Read(POLE::Stream* pStream, SPointAtom& oAtom) + { + oAtom.X = StreamUtils::ReadLONG(pStream); + oAtom.Y = StreamUtils::ReadLONG(pStream); + } + + static inline void Read(POLE::Stream* pStream, SColorAtom& oAtom) + { + oAtom.R = StreamUtils::ReadBYTE(pStream); + oAtom.G = StreamUtils::ReadBYTE(pStream); + oAtom.B = StreamUtils::ReadBYTE(pStream); + oAtom.Index = StreamUtils::ReadBYTE(pStream); + + oAtom.bPaletteIndex = oAtom.bPaletteRGB = oAtom.bSystemRGB = oAtom.bSysIndex = oAtom.bSchemeIndex = false; + + if (oAtom.Index != 0xFF) + { + oAtom.bPaletteRGB = (oAtom.Index == 0xFE); + oAtom.bSchemeIndex = (oAtom.Index != 0xFE); + } + } void Read(POLE::Stream* pStream, PPT_FORMAT::CTextSIRun& oRun, bool bIsIndentation = true); void Read(POLE::Stream* pStream, PPT_FORMAT::CTextRuler& oRun); @@ -217,9 +295,22 @@ public: LONG m_lLevel; LONG m_lCount; - CTextPFRunRecord(); - CTextPFRunRecord(const CTextPFRunRecord& oSrc); - CTextPFRunRecord& operator=(const CTextPFRunRecord& oSrc); + CTextPFRunRecord() : m_oRun() + { + m_lLevel = -1; + m_lCount = 0; + } + CTextPFRunRecord(const CTextPFRunRecord& oSrc) + { + *this = oSrc; + } + CTextPFRunRecord& operator=(const CTextPFRunRecord& oSrc) + { + m_oRun = oSrc.m_oRun; + m_lLevel = oSrc.m_lLevel; + m_lCount = oSrc.m_lCount; + return *this; + } void LoadFromStream(POLE::Stream* pStream, bool bIsIndentation = true); }; @@ -230,9 +321,20 @@ public: PPT_FORMAT::CTextCFRun m_oRun; LONG m_lCount; - CTextCFRunRecord(); - CTextCFRunRecord(const CTextCFRunRecord& oSrc); - CTextCFRunRecord& operator=(const CTextCFRunRecord& oSrc); + CTextCFRunRecord() : m_oRun() + { + m_lCount = 0; + } + CTextCFRunRecord(const CTextCFRunRecord& oSrc) + { + *this = oSrc; + } + CTextCFRunRecord& operator=(const CTextCFRunRecord& oSrc) + { + m_oRun = oSrc.m_oRun; + m_lCount = oSrc.m_lCount; + return *this; + } void LoadFromStream(POLE::Stream* pStream, bool bIsIndentation = true); }; diff --git a/MsBinaryFile/PptFile/Reader/Records.cpp b/MsBinaryFile/PptFile/Reader/Records.cpp index 9828ce3ede..cd19c9714c 100644 --- a/MsBinaryFile/PptFile/Reader/Records.cpp +++ b/MsBinaryFile/PptFile/Reader/Records.cpp @@ -39,35 +39,6 @@ using namespace PPT_FORMAT; - -//------------------------------------------------------------------------------- -#define CREATE_BY_TYPE(RECORD_TYPE, CLASS_RECORD_NAME) \ - case RECORD_TYPE: { pRecord = new CLASS_RECORD_NAME(); break; } \ -//------------------------------------------------------------------------------- - - -CUnknownRecord::CUnknownRecord() -{ -} - -CUnknownRecord::~CUnknownRecord() -{ -} - -void CUnknownRecord::ReadFromStream(SRecordHeader &oHeader, const CFStreamPtr &pStream) -{ - m_oHeader = oHeader; - - pStream->seekFromCurForward(m_oHeader.RecLen); -} - -void CUnknownRecord::ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) -{ - m_oHeader = oHeader; - - StreamUtils::StreamSkip((long)m_oHeader.RecLen, pStream); -} - std::wstring CUnknownRecord::ReadStringW(const CFStreamPtr &pStream, int lLen) { if (!pStream) return (L""); @@ -125,47 +96,23 @@ std::string CUnknownRecord::ReadStringA(const CFStreamPtr &pStream, int lLen) return str; } -CRecordsContainer::CRecordsContainer() : m_arRecords() -{ -} - -CRecordsContainer::~CRecordsContainer() -{ - Clear(); -} - -void CRecordsContainer::Clear() -{ - size_t nCount = m_arRecords.size(); - while(0 != nCount) - { - if (NULL != m_arRecords[nCount-1]) - { - delete m_arRecords[nCount-1]; - m_arRecords[nCount-1] = NULL; - } - m_arRecords.pop_back(); - --nCount; - } -} - void CRecordsContainer::ReadFromStream(SRecordHeader & oHeader, const CFStreamPtr &pStream) { - m_oHeader = oHeader; - m_arRecords.clear(); + m_oHeader = oHeader; + m_arRecords.clear(); - LONG lPosition = pStream->getStreamPointer(); + LONG lPosition = pStream->getStreamPointer(); + + m_oHeader = oHeader; - m_oHeader = oHeader; - - UINT lCurLen = 0; - ULONG lReadLen = 0; - SRecordHeader oRec; - - while (lCurLen < m_oHeader.RecLen) - { - if (oRec.ReadFromStream(pStream) == FALSE ) - { + UINT lCurLen = 0; + ULONG lReadLen = 0; + SRecordHeader oRec; + + while (lCurLen < m_oHeader.RecLen) + { + if (oRec.ReadFromStream(pStream) == FALSE ) + { break; } @@ -725,113 +672,3 @@ IRecord* CreateByType(SRecordHeader oHeader) } return pRecord; } - -void SRecordHeader::Clear() -{ - RecVersion = 0; - RecInstance = 0; - RecType = RT_NONE; - RecLen = 0; - - bBadHeader = false; -} - -SRecordHeader::SRecordHeader() -{ - Clear(); -} - -bool SRecordHeader::ReadFromStream(const CFStreamPtr &pStream) -{ - Clear(); - - if (pStream->isEOF()) return FALSE; - POLE::uint64 nRd = 0; - - unsigned short rec =0; - pStream->read((unsigned char*)&(rec), 2); - - RecInstance = rec >> 4; - RecVersion = rec - (RecInstance << 4); - - *pStream >> RecType >> RecLen; - - unsigned long sz = pStream->getStreamSize() - pStream->getStreamPointer(); - - if (RecLen > sz) - { - RecLen = (UINT)sz; - bBadHeader = true; // GZoabli_PhD.ppt ... RecLen & 0xffff ???? - } - - return true; -} - -bool SRecordHeader::ReadFromStream(POLE::Stream *pStream) -{ - Clear(); - if (!pStream) return false; - - POLE::uint64 nRd = 0; - - unsigned short rec =0; - nRd = pStream->read((unsigned char*)&(rec), 2); - - if (nRd != 2) return false; - - RecInstance = rec >> 4; - RecVersion = rec - (RecInstance<<4); - - nRd = pStream->read((unsigned char*)&(RecType), 2); - - nRd = pStream->read((unsigned char*)&(RecLen), 4); - - POLE::uint64 sz = pStream->size() - pStream->tell(); - - if (RecLen > sz) - { - RecLen = (UINT)sz; - bBadHeader = true; // GZoabli_PhD.ppt ... RecLen & 0xffff ???? - } - - // void** backTraceData = (void**)(new char*[40]); - // int backTraceSize = backtrace(backTraceData, 40); - - // std::ofstream file("/home/ivaz28/pp/dia/ppt/pptRecords.txt", std::ios::out | std::ios::app); - - // file << std::string(backTraceSize - 11, ' ') - // << "0x" << std::setw(4) << std::setfill('0') << std::hex << (int)RecType - // << " " << std::setw(40) << std::setfill(' ') << std::left << GetRecordName(RecType) - // << " " << std::setw(5) << std::dec << RecLen - // << " " << backTraceSize << std::endl; - - // delete [] backTraceData; - // file.close(); - - return true; -} - -bool SRecordHeader::IsContainer() -{ - /*if ((RecVersion == PSFLAG_CONTAINER) || ((RecVersion & 0x0F) == 0x0F)) - { - return TRUE; - }*/ - if (1064 == RecType) - return false; - - if (RecVersion == 0x0F) - { - return true; - } - return false; -} - -SRecordHeader &SRecordHeader::operator =(const SRecordHeader &oSrc) -{ - RecVersion = oSrc.RecVersion; - RecInstance = oSrc.RecInstance; - RecType = oSrc.RecType; - RecLen = oSrc.RecLen; - return (*this); -} diff --git a/MsBinaryFile/PptFile/Reader/Records.h b/MsBinaryFile/PptFile/Reader/Records.h index 46e5ce302e..cee310370a 100644 --- a/MsBinaryFile/PptFile/Reader/Records.h +++ b/MsBinaryFile/PptFile/Reader/Records.h @@ -43,6 +43,11 @@ #include +#include +#include +#include + + //#include //using namespace PPT_FORMAT; @@ -62,15 +67,114 @@ public: bool bBadHeader; - void Clear(); - SRecordHeader(); - bool ReadFromStream(const CFStreamPtr &pStream); + void Clear() + { + RecVersion = 0; + RecInstance = 0; + RecType = RT_NONE; + RecLen = 0; - bool ReadFromStream(POLE::Stream * pStream); + bBadHeader = false; + } + SRecordHeader() + { + Clear(); + } + bool ReadFromStream(const CFStreamPtr &pStream) + { + Clear(); - bool IsContainer(); + if (pStream->isEOF()) return FALSE; + POLE::uint64 nRd = 0; + + unsigned short rec =0; + pStream->read((unsigned char*)&(rec), 2); + + RecInstance = rec >> 4; + RecVersion = rec - (RecInstance << 4); + + *pStream >> RecType >> RecLen; + + unsigned long sz = pStream->getStreamSize() - pStream->getStreamPointer(); + + if (RecLen > sz) + { + RecLen = (UINT)sz; + bBadHeader = true; // GZoabli_PhD.ppt ... RecLen & 0xffff ???? + } + + return true; + } + + bool ReadFromStream(POLE::Stream * pStream) + { + Clear(); + if (!pStream) return false; + + POLE::uint64 nRd = 0; + + unsigned short rec =0; + nRd = pStream->read((unsigned char*)&(rec), 2); + + if (nRd != 2) return false; + + RecInstance = rec >> 4; + RecVersion = rec - (RecInstance<<4); + + nRd = pStream->read((unsigned char*)&(RecType), 2); + + nRd = pStream->read((unsigned char*)&(RecLen), 4); + + POLE::uint64 sz = pStream->size() - pStream->tell(); + + if (RecLen > sz) + { + RecLen = (UINT)sz; + bBadHeader = true; // GZoabli_PhD.ppt ... RecLen & 0xffff ???? + } + +// void** backTraceData = (void**)(new char*[40]); +// int backTraceSize = backtrace(backTraceData, 40); + +// std::ofstream file("/home/ivaz28/pp/dia/ppt/pptRecords.txt", std::ios::out | std::ios::app); + +// file << std::string(backTraceSize - 11, ' ') +// << "0x" << std::setw(4) << std::setfill('0') << std::hex << (int)RecType +// << " " << std::setw(40) << std::setfill(' ') << std::left << GetRecordName(RecType) +// << " " << std::setw(5) << std::dec << RecLen +// << " " << backTraceSize << std::endl; + +// delete [] backTraceData; +// file.close(); + + return true; + } + + bool IsContainer() + { + /*if ((RecVersion == PSFLAG_CONTAINER) || ((RecVersion & 0x0F) == 0x0F)) + { + return TRUE; + }*/ + if (1064 == RecType) + return false; + + if (RecVersion == 0x0F) + { + return true; + } + return false; + } + + SRecordHeader& operator =(const SRecordHeader& oSrc) + { + RecVersion = oSrc.RecVersion; + RecInstance = oSrc.RecInstance; + RecType = oSrc.RecType; + RecLen = oSrc.RecLen; + return (*this); + } - SRecordHeader& operator =(const SRecordHeader& oSrc); }; class IRecord @@ -89,11 +193,25 @@ class CUnknownRecord : public IRecord // реализована ли у нас такая запись public: - CUnknownRecord(); + CUnknownRecord() + { + } - ~CUnknownRecord(); - virtual void ReadFromStream(SRecordHeader & oHeader, const CFStreamPtr &pStream); - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); + ~CUnknownRecord() + { + } + virtual void ReadFromStream(SRecordHeader & oHeader, const CFStreamPtr &pStream) + { + m_oHeader = oHeader; + + pStream->seekFromCurForward(m_oHeader.RecLen); + } + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + StreamUtils::StreamSkip((long)m_oHeader.RecLen, pStream); + } std::wstring ReadStringW(const CFStreamPtr &pStream, int size); std::string ReadStringA(const CFStreamPtr &pStream, int size); @@ -106,11 +224,29 @@ class CRecordsContainer : public CUnknownRecord public: std::vector m_arRecords; - CRecordsContainer(); + CRecordsContainer() : m_arRecords() + { + } - virtual ~CRecordsContainer(); + virtual ~CRecordsContainer() + { + Clear(); + } - void Clear(); + void Clear() + { + size_t nCount = m_arRecords.size(); + while(0 != nCount) + { + if (NULL != m_arRecords[nCount-1]) + { + delete m_arRecords[nCount-1]; + m_arRecords[nCount-1] = NULL; + } + m_arRecords.pop_back(); + --nCount; + } + } virtual void ReadFromStream(SRecordHeader & oHeader, const CFStreamPtr &pStream); virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); @@ -149,56 +285,61 @@ public: контейнеры... (по идее они не нужны, потом можно убрать) **************************************************************/ - -//class CRecordDocument : public CRecordsContainer {}; -//class CRecordExAviMovie : public CRecordsContainer {}; -//class CRecordExCDAudio : public CRecordsContainer {}; -//class CRecordExControl : public CRecordsContainer {}; -//class CRecordExEmbed : public CRecordsContainer {}; -//class CRecordExHyperlink : public CRecordsContainer {}; -//class CRecordExHyperlink9 : public CRecordsContainer {}; -//class CRecordExLink : public CRecordsContainer {}; -//class CRecordExMCIMovie : public CRecordsContainer {}; -//class CRecordExMIDIAudio : public CRecordsContainer {}; -//class CRecordExObjList : public CRecordsContainer {}; -//class CRecordExOleObjStg : public CRecordsContainer {}; -//class CRecordExQuickTimeMovie : public CRecordsContainer {}; -//class CRecordExVideo : public CRecordsContainer {}; -//class CRecordExWAVAudioEmbedded : public CRecordsContainer {}; -//class CRecordExWAVAudioLink : public CRecordsContainer {}; -//class CRecordFontCollection10 : public CRecordsContainer {}; -//class CRecordHandout : public CRecordsContainer {}; -//class CRecordHeadersFooters : public CRecordsContainer {}; -//class CRecordHTMLPublishInfo : public CRecordsContainer {}; -//class CRecordInteractiveInfo : public CRecordsContainer {}; -//class CRecordList : public CRecordsContainer {}; -//class CRecordMainMaster : public CRecordsContainer {}; -//class CRecordMsofbtClientData : public CRecordsContainer {}; -//class CRecordNamedShow : public CRecordsContainer {}; -//class CRecordNamedShows : public CRecordsContainer {}; -//class CRecordNotes : public CRecordsContainer {}; -//class CRecordNotesTextViewInfo : public CRecordsContainer {}; -//class CRecordOutlineTextProps9 : public CRecordsContainer {}; -//class CRecordOutlineTextProps10 : public CRecordsContainer {}; -//class CRecordOutlineTextProps11 : public CRecordsContainer {}; -//class CRecordOutlineViewInfo : public CRecordsContainer {}; -//class CRecordParaBuild : public CRecordsContainer {}; -//class CRecordProgBinaryTag : public CRecordsContainer {}; -//class CRecordProgStringTag : public CRecordsContainer {}; -//class CRecordProgTags : public CRecordsContainer {}; -//class CRecordSlide : public CRecordsContainer {}; -//class CRecordSlideListTable10 : public CRecordsContainer {}; -//class CRecordSlideListWithText : public CRecordsContainer {}; -//class CRecordSlideSyncInfo12 : public CRecordsContainer {}; -//class CRecordSlideViewInfo : public CRecordsContainer {}; -//class CRecordSorterViewInfo : public CRecordsContainer {}; -//class CRecordSound : public CRecordsContainer {}; -//class CRecordSoundCollection : public CRecordsContainer {}; -//class CRecordSrKinsoku : public CRecordsContainer {}; -//class CRecordSummary : public CRecordsContainer {}; -//class CRecordVBAInfo : public CRecordsContainer {}; - +/* +class CRecordDocument : public CRecordsContainer {}; +class CRecordExAviMovie : public CRecordsContainer {}; +class CRecordExCDAudio : public CRecordsContainer {}; +class CRecordExControl : public CRecordsContainer {}; +class CRecordExEmbed : public CRecordsContainer {}; +class CRecordExHyperlink : public CRecordsContainer {}; +class CRecordExHyperlink9 : public CRecordsContainer {}; +class CRecordExLink : public CRecordsContainer {}; +class CRecordExMCIMovie : public CRecordsContainer {}; +class CRecordExMIDIAudio : public CRecordsContainer {}; +class CRecordExObjList : public CRecordsContainer {}; +class CRecordExOleObjStg : public CRecordsContainer {}; +class CRecordExQuickTimeMovie : public CRecordsContainer {}; +class CRecordExVideo : public CRecordsContainer {}; +class CRecordExWAVAudioEmbedded : public CRecordsContainer {}; +class CRecordExWAVAudioLink : public CRecordsContainer {}; +class CRecordFontCollection10 : public CRecordsContainer {}; +class CRecordHandout : public CRecordsContainer {}; +class CRecordHeadersFooters : public CRecordsContainer {}; +class CRecordHTMLPublishInfo : public CRecordsContainer {}; +class CRecordInteractiveInfo : public CRecordsContainer {}; +class CRecordList : public CRecordsContainer {}; +class CRecordMainMaster : public CRecordsContainer {}; +class CRecordMsofbtClientData : public CRecordsContainer {}; +class CRecordNamedShow : public CRecordsContainer {}; +class CRecordNamedShows : public CRecordsContainer {}; +class CRecordNotes : public CRecordsContainer {}; +class CRecordNotesTextViewInfo : public CRecordsContainer {}; +class CRecordOutlineTextProps9 : public CRecordsContainer {}; +class CRecordOutlineTextProps10 : public CRecordsContainer {}; +class CRecordOutlineTextProps11 : public CRecordsContainer {}; +class CRecordOutlineViewInfo : public CRecordsContainer {}; +class CRecordParaBuild : public CRecordsContainer {}; +class CRecordProgBinaryTag : public CRecordsContainer {}; +class CRecordProgStringTag : public CRecordsContainer {}; +class CRecordProgTags : public CRecordsContainer {}; +class CRecordSlide : public CRecordsContainer {}; +class CRecordSlideListTable10 : public CRecordsContainer {}; +class CRecordSlideListWithText : public CRecordsContainer {}; +class CRecordSlideSyncInfo12 : public CRecordsContainer {}; +class CRecordSlideViewInfo : public CRecordsContainer {}; +class CRecordSorterViewInfo : public CRecordsContainer {}; +class CRecordSound : public CRecordsContainer {}; +class CRecordSoundCollection : public CRecordsContainer {}; +class CRecordSrKinsoku : public CRecordsContainer {}; +class CRecordSummary : public CRecordsContainer {}; +class CRecordVBAInfo : public CRecordsContainer {}; +*/ /******************************************************************************** создаем по типу (остальные будем добавлять по мере необходимости) ********************************************************************************/ + +//------------------------------------------------------------------------------- +#define CREATE_BY_TYPE(RECORD_TYPE, CLASS_RECORD_NAME) \ + case RECORD_TYPE: { pRecord = new CLASS_RECORD_NAME(); break; } \ + //------------------------------------------------------------------------------- diff --git a/MsBinaryFile/PptFile/Reader/Slide.h b/MsBinaryFile/PptFile/Reader/Slide.h index fb66af1307..62ae3f2a62 100644 --- a/MsBinaryFile/PptFile/Reader/Slide.h +++ b/MsBinaryFile/PptFile/Reader/Slide.h @@ -36,40 +36,527 @@ class CSlide : public CElementsContainer { public: - enum SlideType - { - stSlide = 0x00, - stMaster = 0x01, - stNote = 0x02, - stNone = 0xFF - }; + enum SlideType + { + stSlide = 0x00, + stMaster = 0x01, + stNote = 0x02, + stNone = 0xFF + }; public: - // SlideListWithText properties - CAtlArray m_arTextPlaceHolders; + // SlideListWithText properties + CAtlArray m_arTextPlaceHolders; - // indentLevels - CSimpleMap m_mapTextStyles; - - SlideType m_eSlideType; - - double m_dReadDuration; + // indentLevels + CSimpleMap m_mapTextStyles; + + SlideType m_eSlideType; + + double m_dReadDuration; public: - CSlide(); + CSlide() : CElementsContainer(), + m_arTextPlaceHolders(), m_mapTextStyles() + { + m_eSlideType = stNone; + m_dReadDuration = -1.0; + + m_parEmptyPictures = NULL; + } public: - void SetUpTextStyle(IElement* pElem); + void SetUpTextStyle(IElement* pElem) + { + // сначала проверяем на shape + // затем применяем все настройки по-очереди + // 1) master + TextMasterStyles + // 2) persist + TextMasterStyles + // 3) свои настройки + TextMasterStyles + // причем "свои настройки" - это чисто "продвинутые настройки" + // потому что все общие ( через проперти ) - уже установлены + // тут важно выставить правильный порядок. + // словом - важная очень функция для текста, + // и, чтобы убрать всякие лишние .cpp файлы - здесь же будем учитывать + // настройки слайда (т.е. структуры не будут работать со слайдами) + + if (NULL == pElem) + return; + + if (etShape != pElem->m_etType) + return; + + CShapeElement* pShape = dynamic_cast(pElem); + if (NULL == pShape) + return; + + // а вот надо читать, потому что текст может быть еще не выставлен + //if (_T("") == pShape->m_oShape.m_oText.m_sText) // текста нету - так чего тогда тут читать?? + // return; + + CTextAttributesEx* pTextSettings = &(pShape->m_oShape.m_oText); + + // сначала применим ссылки на masterstyle (для шаблонного элемента) + // как узнать - просто есть ли массивы (т.к. они могли появиться пока только оттуда) + // - теперь этого делать не нужно - т.к. в мастере тоже вызывается эта функция - + // и там все это должно уже примениться + BOOL bIsPersistPresentSettings = FALSE; + BOOL bIsOwnPresentSettings = FALSE; + + NSOfficePPT::TextType eTypeMaster = (NSOfficePPT::TextType)pTextSettings->m_lMasterTextType; + NSOfficePPT::TextType eTypePersist = NSOfficePPT::NoPresent; + NSOfficePPT::TextType eTypeOwn = (NSOfficePPT::TextType)pTextSettings->m_lTextType; + + // persist ---------------------------------------------------------------------- + LONG lCountPersistObjects = (LONG)m_arTextPlaceHolders.GetCount(); + LONG lPersistIndex = pShape->m_lPersistIndex; + + if ((lPersistIndex >= 0) && (lPersistIndex < lCountPersistObjects)) + { + eTypePersist = (NSOfficePPT::TextType)m_arTextPlaceHolders[lPersistIndex].m_nTextType; + m_arTextPlaceHolders[lPersistIndex].ApplyProperties(pTextSettings); + + bIsPersistPresentSettings = ((NULL != m_arTextPlaceHolders[lPersistIndex].m_pTextStyleProp) && + (0 < m_arTextPlaceHolders[lPersistIndex].m_pTextStyleProp->m_lCount)); + + } + // ------------------------------------------------------------------------------ + + // own properties --------------------------------------------------------------- + if (NULL != pShape->m_pStream) + { + // теперь нужно загрузить продвинутые настройки текста из стрима. + LONG lPosition = 0; StreamUtils::StreamPosition(lPosition, pShape->m_pStream); + + if (-1 != pShape->m_lOffsetTextStyle) + { + StreamUtils::StreamSeek(pShape->m_lOffsetTextStyle - 8, pShape->m_pStream); + + SRecordHeader oHeader; + pShape->m_pStream->Read(&oHeader, sizeof(oHeader), NULL); + + if (RECORD_TYPE_STYLE_TEXTPROP_ATOM == oHeader.RecType) + { + CRecordStyleTextPropAtom* pStyle = new CRecordStyleTextPropAtom(); + pStyle->m_lCount = pShape->m_oShape.m_oText.m_sText.GetLength(); + + pStyle->ReadFromStream(oHeader, pShape->m_pStream); + pStyle->ApplyProperties(&(pShape->m_oShape.m_oText)); + + bIsOwnPresentSettings = (0 < pStyle->m_lCount); + + RELEASEOBJECT(pStyle); + } + } + + if (-1 != pShape->m_lOffsetTextProp) + { + StreamUtils::StreamSeek(pShape->m_lOffsetTextProp - 8, pShape->m_pStream); + + SRecordHeader oHeader; + pShape->m_pStream->Read(&oHeader, sizeof(oHeader), NULL); + + if (RECORD_TYPE_TEXTSPECINFO_ATOM == oHeader.RecType) + { + CRecordTextSpecInfoAtom* pSpecInfo = new CRecordTextSpecInfoAtom(); + pSpecInfo->m_lCount = pShape->m_oShape.m_oText.m_sText.GetLength(); + pSpecInfo->ReadFromStream(oHeader, pShape->m_pStream); + pSpecInfo->ApplyProperties(&(pShape->m_oShape.m_oText)); + + RELEASEOBJECT(pSpecInfo); + } + } + + StreamUtils::StreamSeek(lPosition, pShape->m_pStream); + } + // ------------------------------------------------------------------------------ + + SetUpAllTextType(pTextSettings, eTypeMaster, eTypePersist, bIsPersistPresentSettings, eTypeOwn, bIsOwnPresentSettings); + + // теперь проверим - если нету вообще разбиения на параграфы и символы - + // вставим по умолчанию для такого типа текста + // по идее нужно еще дефолт применить + + if (0 == pShape->m_oShape.m_oText.m_arPFs.GetCount()) + { + CTextMasterStyle* pStyle = this->m_mapTextStyles.Lookup(pShape->m_oShape.m_oText.m_lTextType); + if (NULL != pStyle) + { + if (0 < pStyle->m_lLevels) + { + pShape->m_oShape.m_oText.m_arPFs.Add(pStyle->m_arrLevels[0].oPFRun); + pShape->m_oShape.m_oText.m_arPFs[0].lCount = pShape->m_oShape.m_oText.m_sText.GetLength(); + } + } + } + if (0 == pShape->m_oShape.m_oText.m_arCFs.GetCount()) + { + CTextMasterStyle* pStyle = this->m_mapTextStyles.Lookup(pShape->m_oShape.m_oText.m_lTextType); + if (NULL != pStyle) + { + if (0 < pStyle->m_lLevels) + { + pShape->m_oShape.m_oText.m_arCFs.Add(pStyle->m_arrLevels[0].oCFRun); + pShape->m_oShape.m_oText.m_arCFs[0].lCount = pShape->m_oShape.m_oText.m_sText.GetLength(); + } + } + } + + // теперь нужно посмотреть, является ли шейп placeholder'ом + // если да, то применить его настройки ДО всех остальных + LONG lPlaceholderIndex = pShape->m_lPlaceholderPosition; + if (-1 != lPlaceholderIndex) + { + CTextMasterStyle* pStyle = this->m_mapTextStyles.Lookup(lPlaceholderIndex); + + if (NULL != pStyle) + { + LONG lCountPF = (LONG)pShape->m_oShape.m_oText.m_arPFs.GetCount(); + LONG lCountCF = (LONG)pShape->m_oShape.m_oText.m_arCFs.GetCount(); + + LONG lLevels = (LONG)pStyle->m_arrLevels.GetCount(); + + if (0 != lLevels) + { + for (LONG lIndexPF = 0; lIndexPF < lCountPF; ++lIndexPF) + { + LONG lIndentLevel = pTextSettings->m_arPFs[lIndexPF].lIndentLevel; + + if (lIndentLevel >= 0 && lIndentLevel < lLevels) + { + pTextSettings->m_arPFs[lIndexPF].ApplyBefore(pStyle->m_arrLevels[lIndentLevel].oPFRun); + } + } + for (LONG lIndexCF = 0; lIndexCF < lCountCF; ++lIndexCF) + { + pTextSettings->m_arCFs[lIndexCF].ApplyBefore(pStyle->m_arrLevels[0].oCFRun); + } + } + } + } + + // теперь нужно пересчитать все настройки в зависимости от схем слайда (только для слайда!!!) + if (stSlide == m_eSlideType) + { + pShape->m_oShape.m_oText.ApplyProperties(this); + } + + if ((pShape->m_arrActions[0].m_bPresent) && (7 < m_arColorScheme.GetSize())) + { + ApplyHyperlink(pShape, m_arColorScheme[6]); + } + + CPPTShape* pPPTShape = dynamic_cast(pShape->m_oShape.m_pShape); + + if (NULL != pPPTShape) + { + // теперь смотрим - что за фигура создана + switch (pPPTShape->m_eType) + { + case sptTextPlainText: + case sptTextStop: + case sptTextTriangle: + case sptTextTriangleInverted: + case sptTextChevron: + case sptTextChevronInverted: + case sptTextRingInside: + case sptTextRingOutside: + case sptTextArchUpCurve: + case sptTextArchDownCurve: + case sptTextCircleCurve: + case sptTextButtonCurve: + case sptTextArchUpPour: + case sptTextArchDownPour: + case sptTextCirclePour: + case sptTextButtonPour: + case sptTextCurveUp: + case sptTextCurveDown: + case sptTextCascadeUp: + case sptTextCascadeDown: + case sptTextWave1: + case sptTextWave2: + case sptTextWave3: + case sptTextWave4: + case sptTextInflate: + case sptTextDeflate: + case sptTextInflateBottom: + case sptTextDeflateBottom: + case sptTextInflateTop: + case sptTextDeflateTop: + case sptTextDeflateInflate: + case sptTextDeflateInflateDeflate: + case sptTextFadeRight: + case sptTextFadeLeft: + case sptTextFadeUp: + case sptTextFadeDown: + case sptTextSlantUp: + case sptTextSlantDown: + case sptTextCanUp: + case sptTextCanDown: + { + pShape->m_oShape.m_oText.m_arCFs.RemoveAll(); + pShape->m_oShape.m_oText.m_arPFs.RemoveAll(); + + pShape->m_oShape.m_oText.m_oAttributes.m_oTextBrush = pShape->m_oShape.m_oBrush; + + pShape->m_oShape.m_oText.m_oAttributes.m_nTextAlignHorizontal = 1; + pShape->m_oShape.m_oText.m_oAttributes.m_nTextAlignVertical = 1; + + pShape->m_oShape.m_lDrawType = c_ShapeDrawType_Text; + break; + } + default: + break; + }; + } + } private: - void SetUpTextTypeStyle(CTextAttributesEx* pTextAttributes, NSOfficePPT::TextType eApplyType, LONG lApplyMode); + void SetUpTextTypeStyle(CTextAttributesEx* pTextAttributes, NSOfficePPT::TextType eApplyType, LONG lApplyMode) + { + if ((NULL == pTextAttributes) || (NSOfficePPT::NoPresent == eApplyType) || (2 <= lApplyMode)) + return; - void SetUpAllTextType(CTextAttributesEx* pTextAttributes, NSOfficePPT::TextType eTypeMaster, - NSOfficePPT::TextType eTypePersist, BOOL bPersistPresent, - NSOfficePPT::TextType eTypeOwn, BOOL bOwnPresent); + CTextMasterStyle* pStyle = this->m_mapTextStyles.Lookup(eApplyType); + if (NULL == pStyle) + return; + + for (size_t nIndex = 0; nIndex < pTextAttributes->m_arPFs.GetCount(); ++nIndex) + { + LONG lIndentLevel = pTextAttributes->m_arPFs[nIndex].lIndentLevel; + if (NULL != pStyle) + { + if (lIndentLevel < pStyle->m_lLevels) + { + switch (lApplyMode) + { + case 0: + { + pTextAttributes->m_arPFs[nIndex].ApplyBefore(pStyle->m_arrLevels[lIndentLevel].oPFRun); + break; + } + case 1: + { + pTextAttributes->m_arPFs[nIndex].ApplyAfter(pStyle->m_arrLevels[lIndentLevel].oPFRun); + break; + } + default: + break; + }; + } + } + } + for (size_t nIndex = 0; nIndex < pTextAttributes->m_arCFs.GetCount(); ++nIndex) + { + if (NULL != pStyle) + { + LONG lIndentIndex = pTextAttributes->GetIndentLevelCF(nIndex); + if (lIndentIndex < pStyle->m_lLevels) + { + // вот непонятно какой левел нужно брать. будем нулевой пока + switch (lApplyMode) + { + case 0: + { + pTextAttributes->m_arCFs[nIndex].ApplyBefore(pStyle->m_arrLevels[lIndentIndex].oCFRun); + break; + } + case 1: + { + pTextAttributes->m_arCFs[nIndex].ApplyAfter(pStyle->m_arrLevels[lIndentIndex].oCFRun); + break; + } + default: + break; + }; + } + } + } + } - void ApplyHyperlink(CShapeElement* pShape, SColorAtom& oColor); + void SetUpAllTextType(CTextAttributesEx* pTextAttributes, NSOfficePPT::TextType eTypeMaster, + NSOfficePPT::TextType eTypePersist, BOOL bPersistPresent, + NSOfficePPT::TextType eTypeOwn, BOOL bOwnPresent) + { + if (bOwnPresent) + { + if (eTypeOwn != eTypePersist) + { + SetUpTextTypeStyle(pTextAttributes, eTypeOwn, 0); + } + if (eTypePersist != eTypeOwn) + { + SetUpTextTypeStyle(pTextAttributes, eTypePersist, 0); + } + if ((eTypeMaster != eTypePersist) && (eTypeMaster != eTypeOwn)) + { + SetUpTextTypeStyle(pTextAttributes, eTypeMaster, 0); + } + } + else if (bPersistPresent) + { + SetUpTextTypeStyle(pTextAttributes, eTypePersist, 0); - void InsertCF(LONG lStartH, LONG lEndH, CAtlArray& oArrayCF, CAtlArray& arStart, CAtlArray&arEnd, LONG lIndexFound, SColorAtom& oColor); + if (eTypePersist != eTypeMaster) + { + SetUpTextTypeStyle(pTextAttributes, eTypeMaster, 0); + } + if (NSOfficePPT::NoPresent != eTypeOwn) + { + SetUpTextTypeStyle(pTextAttributes, eTypeOwn, 1); + } + } + else + { + SetUpTextTypeStyle(pTextAttributes, eTypeMaster, 0); + + if (eTypePersist != eTypeMaster) + { + SetUpTextTypeStyle(pTextAttributes, eTypePersist, 1); + } + if (eTypeOwn != eTypePersist && ((NSOfficePPT::NoPresent != eTypePersist) || (eTypeMaster != eTypeOwn))) + { + SetUpTextTypeStyle(pTextAttributes, eTypeOwn, 1); + } + } + } + + void ApplyHyperlink(CShapeElement* pShape, SColorAtom& oColor) + { + CAtlArray* pRanges = &pShape->m_arrActions[0].m_arRanges; + CTextAttributesEx* pTextAttributes = &pShape->m_oShape.m_oText; + + LONG lCountHyper = (LONG)pRanges->GetCount(); + LONG lCountCFs = (LONG)pTextAttributes->m_arCFs.GetCount(); + + if (0 == lCountHyper) + return; + + CAtlArray arStart; + CAtlArray arEnd; + + LONG lStartCur = 0; + LONG lEndCur = 0; + + for (LONG iCF = 0; iCF < lCountCFs; ++iCF) + { + lEndCur = lStartCur + pTextAttributes->m_arCFs[iCF].lCount - 1; + + arStart.Add(lStartCur); + arEnd.Add(lEndCur); + + lStartCur = lEndCur + 1; + } + + // сначала нормализуем Ranges + for (LONG iR = 0; iR < lCountHyper; ++iR) + { + LONG lStart = ((*pRanges)[iR]).m_lStart; + LONG lEnd = ((*pRanges)[iR]).m_lEnd; + + if (lStart > lEnd) + continue; + + LONG lStartFound = -1; + LONG lEndFound = -1; + + lCountCFs = (LONG)pTextAttributes->m_arCFs.GetCount(); + + for (LONG iCF = 0; iCF < lCountCFs; ++iCF) + { + BOOL bStart = ((lStart >= arStart[iCF]) && (lStart <= arEnd[iCF])); + BOOL bEnd = ((lEnd >= arStart[iCF]) && (lEnd <= arEnd[iCF])); + + if (-1 == lStartFound && bStart) + lStartFound = iCF; + + if (-1 == lEndFound && bEnd) + lEndFound = iCF; + } + + // найдены индексы ранов, в которых надо резать + if (-1 == lStartFound || -1 == lEndFound) + continue; + + if (lStartFound == lEndFound) + { + InsertCF(lStart, lEnd, pTextAttributes->m_arCFs, arStart, arEnd, lStartFound, oColor); + } + else if (lEndFound > lStartFound) + { + // по идее другого быть не могло + + // здесь последовательный вызов инсерта + InsertCF(lStart, arEnd[lStartFound], pTextAttributes->m_arCFs, arStart, arEnd, lStartFound, oColor); + + LONG lPlus = (LONG)pTextAttributes->m_arCFs.GetCount() - lCountCFs; + lCountCFs += lPlus; + + InsertCF(arStart[lEndFound + lPlus], lEnd, pTextAttributes->m_arCFs, arStart, arEnd, lEndFound + lPlus, oColor); + } + } + + // старая версия... + /*for (size_t i = 0; i < pTextAttributes->m_arCFs.GetCount(); ++i) + { + pTextAttributes->m_arCFs[i].hasColor = true; + pTextAttributes->m_arCFs[i].oColor = oColor; + }*/ + } + + void InsertCF(LONG lStartH, LONG lEndH, CAtlArray& oArrayCF, CAtlArray& arStart, CAtlArray&arEnd, LONG lIndexFound, SColorAtom& oColor) + { + STextCFRun oRunOld = oArrayCF[lIndexFound]; + STextCFRun oRunNew = oRunOld; + + oRunNew.oColor = oColor; + oRunNew.fontStyle |= 0x04; + oRunNew.hasUnderline = true; + + LONG lSize1 = lStartH - arStart[lIndexFound]; + LONG lSize2 = lEndH - lStartH + 1; + LONG lSize3 = arEnd[lIndexFound] - lEndH; + + if (lSize1 > 0 && lSize3 > 0) + { + oArrayCF[lIndexFound].lCount = lSize1; + arEnd[lIndexFound] = arStart[lIndexFound] + lSize1 - 1; + + oRunNew.lCount = lSize2; + oArrayCF.InsertAt(lIndexFound + 1, oRunNew); + arStart.InsertAt(lIndexFound + 1, arEnd[lIndexFound] + 1); + arEnd.InsertAt(lIndexFound + 1, arStart[lIndexFound + 1] + lSize2 - 1); + + oRunOld.lCount = lSize3; + oArrayCF.InsertAt(lIndexFound + 2, oRunOld); + arStart.InsertAt(lIndexFound + 2, arEnd[lIndexFound + 1] + 1); + arEnd.InsertAt(lIndexFound + 2, arStart[lIndexFound + 2] + lSize3 - 1); + } + else if (lSize1 > 0) + { + oArrayCF[lIndexFound].lCount = lSize1; + arEnd[lIndexFound] = arStart[lIndexFound] + lSize1 - 1; + + oRunNew.lCount = lSize2; + oArrayCF.InsertAt(lIndexFound + 1, oRunNew); + arStart.InsertAt(lIndexFound + 1, arEnd[lIndexFound] + 1); + arEnd.InsertAt(lIndexFound + 1, arStart[lIndexFound + 1] + lSize2 - 1); + } + else if (lSize3 > 0) + { + oArrayCF[lIndexFound] = oRunNew; + oArrayCF[lIndexFound].lCount = lSize2; + arEnd[lIndexFound] = arStart[lIndexFound] + lSize2 - 1; + + oRunOld.lCount = lSize3; + oArrayCF.InsertAt(lIndexFound + 1, oRunOld); + arStart.InsertAt(lIndexFound + 1, arEnd[lIndexFound] + 1); + arEnd.InsertAt(lIndexFound + 1, arStart[lIndexFound + 1] + lSize3 - 1); + } + else + { + oArrayCF[lIndexFound] = oRunNew; + } + } }; diff --git a/MsBinaryFile/PptFile/Reader/SlideInfo.h b/MsBinaryFile/PptFile/Reader/SlideInfo.h index 8f1ed8d9dc..b4d1376e74 100644 --- a/MsBinaryFile/PptFile/Reader/SlideInfo.h +++ b/MsBinaryFile/PptFile/Reader/SlideInfo.h @@ -45,10 +45,35 @@ public: int m_lMasterPlaceholderType; public: - CElementInfo(); - CElementInfo(const CElementInfo& oSrc); - CElementInfo& operator=(const CElementInfo& oSrc); - ~CElementInfo(); + CElementInfo() + { + m_lOffsetTextStyle = -1; + m_lOffsetTextProp = -1; + m_lPersistIndex = -1; + m_pStream = NULL; + + m_lMasterTextType = -1; + m_lMasterPlaceholderType = -1; + } + CElementInfo(const CElementInfo& oSrc) + { + *this = oSrc; + } + CElementInfo& operator=(const CElementInfo& oSrc) + { + m_lOffsetTextStyle = oSrc.m_lOffsetTextStyle; + m_lOffsetTextProp = oSrc.m_lOffsetTextProp; + m_lPersistIndex = oSrc.m_lPersistIndex; + m_pStream = oSrc.m_pStream; + + m_lMasterTextType = oSrc.m_lMasterTextType; + m_lMasterPlaceholderType = oSrc.m_lMasterPlaceholderType; + + return *this; + } + ~CElementInfo() + { + } }; class CSlideInfo @@ -60,13 +85,63 @@ public: std::map* m_mapFilePictures; nullable_base m_pStyles[9]; - CSlideInfo(); - ~CSlideInfo(); + CSlideInfo() + { + } + ~CSlideInfo() + { + } - CSlideInfo(const CSlideInfo& oSrc); - CSlideInfo& operator=(const CSlideInfo& oSrc); + CSlideInfo(const CSlideInfo& oSrc) + { + *this = oSrc; + } + CSlideInfo& operator=(const CSlideInfo& oSrc) + { + m_arTextPlaceHolders = oSrc.m_arTextPlaceHolders; - std::wstring GetFileNamePicture(_UINT32 lIndex); + m_parEmptyPictures = oSrc.m_parEmptyPictures; + m_mapFilePictures = oSrc.m_mapFilePictures; + + for (int i = 0; i < 9; ++i) + { + m_pStyles[i] = oSrc.m_pStyles[i]; + } - int GetIndexPicture(int lIndex); + m_mapElements = oSrc.m_mapElements; + + return *this; + } + + std::wstring GetFileNamePicture(_UINT32 lIndex) + { + std::map::iterator pic = m_mapFilePictures->find(lIndex); + + if (pic != m_mapFilePictures->end()) + { + return pic->second; + } + return _T(""); + } + + int GetIndexPicture(int lIndex) + { + if (NULL == m_parEmptyPictures) + return -1; + if ( m_parEmptyPictures->size() < 1 ) + return -1; + + lIndex -= 1; + + if (lIndex < 0) lIndex = 0; + + if(lIndex >= 0 && lIndex < (int)m_parEmptyPictures->size()) + { + return m_parEmptyPictures->at(lIndex); + } + else + { + return m_parEmptyPictures->at(0);//??? + } + } }; diff --git a/MsBinaryFile/PptFile/Records/Animations/AnimationInfoAtom.h b/MsBinaryFile/PptFile/Records/Animations/AnimationInfoAtom.h index a00906b55d..ea3a4ec5c9 100644 --- a/MsBinaryFile/PptFile/Records/Animations/AnimationInfoAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/AnimationInfoAtom.h @@ -38,6 +38,27 @@ namespace PPT_FORMAT { +struct SFlagsAH { + + USHORT m_fA_H; + + USHORT getH()const {return (m_fA_H & 0xC000) >> 14;} + USHORT getG()const {return (m_fA_H & 0x3000) >> 12;} + USHORT getF()const {return (m_fA_H & 0xC00) >> 10;} + USHORT getE()const {return (m_fA_H & 0x300) >> 8;} + USHORT getD()const {return (m_fA_H & 0xC0) >> 6;} + USHORT getC()const {return (m_fA_H & 0x30) >> 4;} + USHORT getB()const {return (m_fA_H & 0xC) >> 2;} + USHORT getA()const {return (m_fA_H & 0x3) >> 0;} + + + + void ReadFromStream(POLE::Stream* pStream) { + m_fA_H = StreamUtils::ReadWORD(pStream); + } +}; + + class CRecordAnimationInfoAtom : public CUnknownRecord { public: @@ -69,11 +90,56 @@ public: BYTE m_OleVerb; std::array asByteArr{}; - public: - CRecordAnimationInfoAtom(); - ~CRecordAnimationInfoAtom(); - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); + CRecordAnimationInfoAtom() + { + } + + ~CRecordAnimationInfoAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_sDimColor.ReadFromStream(pStream); + + SFlagsAH fAH; + fAH.ReadFromStream(pStream); + + m_fReverse = fAH.getA(); + m_fAutomatic = fAH.getB(); + m_fSound = fAH.getC(); + m_fStopSound = fAH.getD(); + m_fPlay = fAH.getE(); + m_fSynchronous = fAH.getF(); + m_fHide = fAH.getG(); + m_fAnimateBg = fAH.getH(); + + m_Reserved = StreamUtils::ReadWORD(pStream); + + m_SoundIdRef = StreamUtils::ReadDWORD(pStream); + m_DelayTime = StreamUtils::ReadDWORD(pStream); + + m_OrderID = StreamUtils::ReadWORD(pStream); + m_SlideCount = StreamUtils::ReadWORD(pStream); + + m_AnimBuildType = StreamUtils::ReadBYTE(pStream); + m_AnimEffect = StreamUtils::ReadBYTE(pStream); + m_AnimEffectDirection = StreamUtils::ReadBYTE(pStream); + m_AnimAfterEffect = StreamUtils::ReadBYTE(pStream); + m_TextBuildSubEffect = StreamUtils::ReadBYTE(pStream); + m_OleVerb = StreamUtils::ReadBYTE(pStream); + + + StreamUtils::StreamSkip(2, pStream); + m_OldSoundIdRef = m_SoundIdRef; + + StreamUtils::StreamSkipBack(36, pStream); + auto tempStr = StreamUtils::ReadStringA(pStream, 36); + std::copy(tempStr.begin(), tempStr.end(), asByteArr.begin()); + } }; } diff --git a/MsBinaryFile/PptFile/Records/Animations/AnimationInfoContainer.h b/MsBinaryFile/PptFile/Records/Animations/AnimationInfoContainer.h index c6cb2f58dc..d946803303 100644 --- a/MsBinaryFile/PptFile/Records/Animations/AnimationInfoContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/AnimationInfoContainer.h @@ -45,9 +45,20 @@ public: CRecordAnimationInfoAtom m_AnimationAtom; CRecordSoundContainer m_AnimationSound; - CRecordAnimationInfoContainer(); - ~CRecordAnimationInfoContainer(); + CRecordAnimationInfoContainer(){} + ~CRecordAnimationInfoContainer(){} - virtual void ReadFromStream(SRecordHeader & thisHeader, POLE::Stream* pStream); + virtual void ReadFromStream(SRecordHeader & thisHeader, POLE::Stream* pStream) + { + m_oHeader = thisHeader; + + SRecordHeader oHeader; + + if (oHeader.ReadFromStream(pStream)) + m_AnimationAtom.ReadFromStream ( oHeader, pStream ); + + if (m_oHeader.RecLen != 36 && oHeader.ReadFromStream(pStream)) + m_AnimationSound.ReadFromStream ( oHeader, pStream ); + } }; } diff --git a/MsBinaryFile/PptFile/Records/Animations/BuildAtom.h b/MsBinaryFile/PptFile/Records/Animations/BuildAtom.h index 0a561505dd..b1349899fc 100644 --- a/MsBinaryFile/PptFile/Records/Animations/BuildAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/BuildAtom.h @@ -40,9 +40,22 @@ namespace PPT_FORMAT class CRecordBuildAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ); + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + m_nBuildType = StreamUtils::ReadDWORD ( pStream ); + m_nBuildId = StreamUtils::ReadDWORD ( pStream ); + m_nShapeIdRef = StreamUtils::ReadDWORD ( pStream ); + + _UINT32 Value = StreamUtils::ReadDWORD ( pStream ); + + m_fExpanded = ( 0x01 == ( 0x01 & ((BYTE)Value) ) ); + m_fUIExpanded = ( 0x02 == ( 0x02 & ((BYTE)Value) ) ); + } public: + _UINT32 m_nBuildType; // 1 - Paragraph build type, 2 - Chart build type, 3 - Diagram build type _UINT32 m_nBuildId; _UINT32 m_nShapeIdRef; diff --git a/MsBinaryFile/PptFile/Records/Animations/BuildListSubContainer.h b/MsBinaryFile/PptFile/Records/Animations/BuildListSubContainer.h index b7ebea382f..e36846aa6d 100644 --- a/MsBinaryFile/PptFile/Records/Animations/BuildListSubContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/BuildListSubContainer.h @@ -41,10 +41,25 @@ namespace PPT_FORMAT class CRecordBuildListSubContainer : public CUnknownRecord { public: - CRecordBuildListSubContainer(); - ~CRecordBuildListSubContainer(); + CRecordBuildListSubContainer() + { - virtual void ReadFromStream(SRecordHeader &header, POLE::Stream *pStream) override; + } + + ~CRecordBuildListSubContainer() + { + + } + + virtual void ReadFromStream(SRecordHeader &header, POLE::Stream *pStream) override + { + m_oHeader = header; + + SRecordHeader buildAtomHeader; + if (buildAtomHeader.ReadFromStream(pStream)) + buildAtom.ReadFromStream ( buildAtomHeader, pStream ); + + } public: CRecordBuildAtom buildAtom; diff --git a/MsBinaryFile/PptFile/Records/Animations/ChartBuildAtom.h b/MsBinaryFile/PptFile/Records/Animations/ChartBuildAtom.h index 2a06b7509a..bcd7ef1437 100644 --- a/MsBinaryFile/PptFile/Records/Animations/ChartBuildAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/ChartBuildAtom.h @@ -44,9 +44,17 @@ public: ChartBuildEnum m_ChartBuild; BYTE m_fAnimBackground; - CRecordChartBuildAtom(); - ~CRecordChartBuildAtom(); + CRecordChartBuildAtom(){} + ~CRecordChartBuildAtom(){} - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_ChartBuild = (ChartBuildEnum)StreamUtils::ReadDWORD(pStream); + m_fAnimBackground = StreamUtils::ReadBYTE(pStream); + + StreamUtils::StreamSkip(3, pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Records/Animations/ChartBuildContainer.h b/MsBinaryFile/PptFile/Records/Animations/ChartBuildContainer.h index 4de4df1bcc..c75d27df9a 100644 --- a/MsBinaryFile/PptFile/Records/Animations/ChartBuildContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/ChartBuildContainer.h @@ -39,10 +39,24 @@ namespace PPT_FORMAT class CRecordChartBuildContainer : public CRecordBuildListSubContainer { public: - CRecordChartBuildContainer(); - ~CRecordChartBuildContainer(); + CRecordChartBuildContainer() + { - void ReadFromStream(SRecordHeader &header, POLE::Stream *pStream) override; + } + + ~CRecordChartBuildContainer() + { + + } + + void ReadFromStream(SRecordHeader &header, POLE::Stream *pStream) override + { + CRecordBuildListSubContainer::ReadFromStream(header, pStream); + + SRecordHeader childHeader; + if (childHeader.ReadFromStream(pStream)) + m_oChartBuildAtom.ReadFromStream ( childHeader, pStream ); + } public: CRecordChartBuildAtom m_oChartBuildAtom; diff --git a/MsBinaryFile/PptFile/Records/Animations/ClientVisualElementContainer.h b/MsBinaryFile/PptFile/Records/Animations/ClientVisualElementContainer.h index 8d46ce4ca4..3fb55edda4 100644 --- a/MsBinaryFile/PptFile/Records/Animations/ClientVisualElementContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/ClientVisualElementContainer.h @@ -31,6 +31,7 @@ */ #pragma once + #include "../../Reader/Records.h" #include "VisualPageAtom.h" #include "VisualShapeAtom.h" @@ -41,12 +42,39 @@ namespace PPT_FORMAT class CRecordClientVisualElementContainer : public CUnknownRecord { public: - CRecordClientVisualElementContainer (); - ~CRecordClientVisualElementContainer(); + CRecordClientVisualElementContainer () + { + m_bVisualPageAtom = false; + m_bVisualShapeAtom = false; + } - void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override + { + m_oHeader = oHeader; + + LONG lPos = 0; StreamUtils::StreamPosition ( lPos, pStream ); + + SRecordHeader ReadHeader; + if (ReadHeader.ReadFromStream(pStream) ) + { + if ( RT_VisualPageAtom == ReadHeader.RecType ) + { + m_bVisualPageAtom = true; + m_oVisualPageAtom.ReadFromStream ( ReadHeader, pStream ); + } + + if ( RT_VisualShapeAtom == ReadHeader.RecType ) + { + m_bVisualShapeAtom = true; + m_oVisualShapeAtom.ReadFromStream ( ReadHeader, pStream ); + } + } + + StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } public: + CRecordVisualPageAtom m_oVisualPageAtom; CRecordVisualShapeAtom m_oVisualShapeAtom; diff --git a/MsBinaryFile/PptFile/Records/Animations/DiagramBuildAtom.h b/MsBinaryFile/PptFile/Records/Animations/DiagramBuildAtom.h index e2a4c075d9..5973528142 100644 --- a/MsBinaryFile/PptFile/Records/Animations/DiagramBuildAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/DiagramBuildAtom.h @@ -43,9 +43,14 @@ class CRecordDiagramBuildAtom : public CUnknownRecord public: DiagramBuildEnum m_oDiagramBuild; - CRecordDiagramBuildAtom(); - ~CRecordDiagramBuildAtom(); + CRecordDiagramBuildAtom(){} + ~CRecordDiagramBuildAtom(){} - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_oDiagramBuild = (DiagramBuildEnum)StreamUtils::ReadDWORD(pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Records/Animations/DiagramBuildContainer.h b/MsBinaryFile/PptFile/Records/Animations/DiagramBuildContainer.h index 118a0e2c62..7333b02535 100644 --- a/MsBinaryFile/PptFile/Records/Animations/DiagramBuildContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/DiagramBuildContainer.h @@ -41,10 +41,25 @@ namespace PPT_FORMAT class CRecordDiagramBuildContainer : public CRecordBuildListSubContainer { public: - CRecordDiagramBuildContainer(); - ~CRecordDiagramBuildContainer(); + CRecordDiagramBuildContainer() + { - void ReadFromStream(SRecordHeader &header, POLE::Stream *pStream) override; + } + + ~CRecordDiagramBuildContainer() + { + + } + + void ReadFromStream(SRecordHeader &header, POLE::Stream *pStream) override + { + CRecordBuildListSubContainer::ReadFromStream(header, pStream); + + SRecordHeader diagramBuildAtomHeader; + + if (diagramBuildAtomHeader.ReadFromStream(pStream)) + m_oDiagramBuildAtom.ReadFromStream (diagramBuildAtomHeader, pStream); + } public: CRecordDiagramBuildAtom m_oDiagramBuildAtom; diff --git a/MsBinaryFile/PptFile/Records/Animations/ExtTimeNodeContainer.h b/MsBinaryFile/PptFile/Records/Animations/ExtTimeNodeContainer.h index a7e8987486..9c274504f9 100644 --- a/MsBinaryFile/PptFile/Records/Animations/ExtTimeNodeContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/ExtTimeNodeContainer.h @@ -106,13 +106,323 @@ public: public: - CRecordExtTimeNodeContainer(); - virtual ~CRecordExtTimeNodeContainer(); + CRecordExtTimeNodeContainer() : + m_pTimePropertyList(nullptr), + m_pTimeAnimateBehavior(nullptr), + m_pTimeColorBehavior(nullptr), + m_pTimeEffectBehavior(nullptr), + m_pTimeMotionBehavior(nullptr), + m_pTimeRotationBehavior(nullptr), + m_pTimeScaleBehavior(nullptr), + m_pTimeSetBehavior(nullptr), + m_pTimeCommandBehavior(nullptr), + m_pClientVisualElement(nullptr), + + m_pTimeIterateDataAtom(nullptr), + m_pTimeSequenceDataAtom(nullptr), + + m_pTimeEndSyncTimeCondition(nullptr), + + + m_haveTimePropertyList(false), + m_haveAnimateBehavior(false), + m_haveColorBehavior(false), + m_haveEffectBehavior(false), + m_haveMotionBehavior(false), + m_haveRotationBehavior(false), + m_haveScaleBehavior(false), + m_haveSetBehavior(false), + m_haveCommandBehavior(false), + m_haveClientVisualElement(false), + + m_haveIterateDataAtom(false), + m_haveSequenceAtom(false), + + m_haveTimeEndSyncTime(false) + { + } + + virtual ~CRecordExtTimeNodeContainer() + { + RELEASEOBJECT(m_pTimePropertyList); + RELEASEOBJECT(m_pTimeAnimateBehavior); + RELEASEOBJECT(m_pTimeColorBehavior); + RELEASEOBJECT(m_pTimeEffectBehavior); + RELEASEOBJECT(m_pTimeMotionBehavior); + RELEASEOBJECT(m_pTimeRotationBehavior); + RELEASEOBJECT(m_pTimeScaleBehavior); + RELEASEOBJECT(m_pTimeSetBehavior); + RELEASEOBJECT(m_pTimeCommandBehavior); + RELEASEOBJECT(m_pClientVisualElement); + + RELEASEOBJECT(m_pTimeIterateDataAtom); + RELEASEOBJECT(m_pTimeSequenceDataAtom); + + RELEASEOBJECT(m_pTimeEndSyncTimeCondition); + + for ( size_t i = 0; i < m_arrRgBeginTimeCondition.size(); ++i ) + RELEASEOBJECT ( m_arrRgBeginTimeCondition[i] ); + + for ( size_t i = 0; i < m_arrRgNextTimeCondition.size(); ++i ) + RELEASEOBJECT ( m_arrRgNextTimeCondition[i] ); + + for ( size_t i = 0; i < m_arrRgEndTimeCondition.size(); ++i ) + RELEASEOBJECT ( m_arrRgEndTimeCondition[i] ); + + for ( size_t i = 0; i < m_arrRgTimeModifierAtom.size(); ++i ) + RELEASEOBJECT ( m_arrRgTimeModifierAtom[i] ); + + for ( size_t i = 0; i < m_arrRgSubEffect.size(); ++i ) + RELEASEOBJECT ( m_arrRgSubEffect[i] ); + + for ( size_t i = 0; i < m_arrRgExtTimeNodeChildren.size(); ++i ) + RELEASEOBJECT ( m_arrRgExtTimeNodeChildren[i] ); + } + + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); + + SRecordHeader rHeader; + + if ( rHeader.ReadFromStream(pStream) ) + m_oTimeNodeAtom.ReadFromStream ( rHeader, pStream ); + + UINT lCurLen = m_oTimeNodeAtom.m_oHeader.RecLen + 8; + + SRecordHeader ReadHeader; + + while ( lCurLen < m_oHeader.RecLen ) + { + LONG lPosExpected = 0; + StreamUtils::StreamPosition ( lPosExpected, pStream ); + + if ( ReadHeader.ReadFromStream(pStream) == false) + break; + + lCurLen += 8 + ReadHeader.RecLen; + lPosExpected += 8 + ReadHeader.RecLen; + + switch (ReadHeader.RecType) + { + case RT_TimePropertyList: + { + + m_pTimePropertyList = new CRecordTimePropertyList4TimeNodeContainer; + m_pTimePropertyList->ReadFromStream(ReadHeader, pStream); + m_haveTimePropertyList = true; + + break; + } + + case RT_TimeAnimateBehaviorContainer: + { + + m_pTimeAnimateBehavior = new CRecordTimeAnimateBehaviorContainer; + m_pTimeAnimateBehavior->ReadFromStream(ReadHeader, pStream); + m_haveAnimateBehavior = true; + + break; + } + + case RT_TimeColorBehaviorContainer: + { + + m_pTimeColorBehavior = new CRecordTimeColorBehaviorContainer; + m_pTimeColorBehavior->ReadFromStream(ReadHeader, pStream); + m_haveColorBehavior = true; + + break; + } + + case RT_TimeEffectBehaviorContainer: + { + + m_pTimeEffectBehavior = new CRecordTimeEffectBehaviorContainer(); + m_pTimeEffectBehavior->ReadFromStream(ReadHeader, pStream); + m_haveEffectBehavior = true; + + break; + } + + case RT_TimeMotionBehaviorContainer: + { + + m_pTimeMotionBehavior = new CRecordTimeMotionBehaviorContainer(); + m_pTimeMotionBehavior->ReadFromStream(ReadHeader, pStream); + m_haveMotionBehavior = true; + + break; + } + + case RT_TimeRotationBehaviorContainer: + { + + m_pTimeRotationBehavior = new CRecordTimeRotationBehaviorContainer(); + m_pTimeRotationBehavior->ReadFromStream(ReadHeader, pStream); + m_haveRotationBehavior = true; + + break; + } + + case RT_TimeScaleBehaviorContainer: + { + + m_pTimeScaleBehavior = new CRecordTimeScaleBehaviorContainer(); + m_pTimeScaleBehavior->ReadFromStream(ReadHeader, pStream); + m_haveScaleBehavior = true; + + break; + } + + case RT_TimeSetBehaviorContainer: + { + + m_pTimeSetBehavior = new CRecordTimeSetBehaviorContainer(); + m_pTimeSetBehavior->ReadFromStream(ReadHeader, pStream); + m_haveSetBehavior = true; + + break; + } + + case RT_TimeCommandBehaviorContainer: + { + + m_pTimeCommandBehavior = new CRecordTimeCommandBehaviorContainer(); + m_pTimeCommandBehavior->ReadFromStream(ReadHeader, pStream); + m_haveCommandBehavior = true; + + break; + } + + case RT_TimeClientVisualElement: + { + + m_pClientVisualElement = new CRecordClientVisualElementContainer(); + m_pClientVisualElement->ReadFromStream(ReadHeader, pStream); + m_haveClientVisualElement = true; + + break; + } + + case RT_TimeIterateData: + { + + m_pTimeIterateDataAtom = new CRecordTimeIterateDataAtom(); + m_pTimeIterateDataAtom->ReadFromStream(ReadHeader, pStream); + m_haveIterateDataAtom = true; + + break; + } + + case RT_TimeSequenceData: + { + + m_pTimeSequenceDataAtom = new CRecordTimeSequenceDataAtom(); + m_pTimeSequenceDataAtom->ReadFromStream(ReadHeader, pStream); + m_haveSequenceAtom = true; + + break; + } + + case RT_TimeConditionContainer: + { + + CRecordTimeConditionContainer* pTimeCondition = + new CRecordTimeConditionContainer(); + pTimeCondition->ReadFromStream(ReadHeader, pStream); + unsigned short recInst = ReadHeader.RecInstance; + + if (recInst == TL_CT_Begin) + { + m_arrRgBeginTimeCondition.push_back(pTimeCondition); + } + else if (recInst == TL_CT_Next) + { + m_arrRgNextTimeCondition.push_back(pTimeCondition); + } + + else if (recInst == TL_CT_End || recInst == TL_CT_Previous) + { + m_arrRgEndTimeCondition.push_back(pTimeCondition); + } + else + { + m_haveTimeEndSyncTime = true; + m_pTimeEndSyncTimeCondition = pTimeCondition; + } + + + break; // A lot of records. Look at instance + } + + + case RT_TimeModifier: + { + + CRecordTimeModifierAtom* pModAtom = new CRecordTimeModifierAtom(); + pModAtom->ReadFromStream(ReadHeader, pStream); + m_arrRgTimeModifierAtom.push_back(pModAtom); + + break; + } + + case RT_TimeSubEffectContainer: + { + + CRecordSubEffectContainer* pSub = new CRecordSubEffectContainer(); + pSub->ReadFromStream(ReadHeader, pStream); + m_arrRgSubEffect.push_back(pSub); + + break; + } + + case RT_TimeExtTimeNodeContainer: + { + + CRecordExtTimeNodeContainer* pExt = new CRecordExtTimeNodeContainer(); + pExt->ReadFromStream(ReadHeader, pStream); + m_arrRgExtTimeNodeChildren.push_back(pExt); + + break; + } + + + default: + break; +// throw ; + } + LONG lPosCurrent = 0; + StreamUtils::StreamPosition ( lPosCurrent, pStream ); + if (lPosExpected != lPosCurrent) + { + StreamUtils::StreamSeek ( lPosExpected, pStream ); + } + + } + StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } + + + // + inline CRecordTimeModifierAtom* GetModifier (_UINT32 Type) + { + for ( size_t i = 0; i < m_arrRgTimeModifierAtom.size(); ++i ) + if (m_arrRgTimeModifierAtom[i]->m_nType == Type) + return m_arrRgTimeModifierAtom[i]; + + return nullptr; + } + + inline int GetNodeType () const + { + return m_oTimeNodeAtom.m_dwType; + } - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; - CRecordTimeModifierAtom* GetModifier (_UINT32 Type); - int GetNodeType () const; }; } diff --git a/MsBinaryFile/PptFile/Records/Animations/HashCode10Atom.h b/MsBinaryFile/PptFile/Records/Animations/HashCode10Atom.h index a12bb33c91..401d5e146b 100644 --- a/MsBinaryFile/PptFile/Records/Animations/HashCode10Atom.h +++ b/MsBinaryFile/PptFile/Records/Animations/HashCode10Atom.h @@ -41,6 +41,12 @@ class CRecordHashCode10Atom : public CUnknownRecord public: _UINT32 m_nHash; - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + m_nHash = StreamUtils::ReadDWORD(pStream); + } + }; } diff --git a/MsBinaryFile/PptFile/Records/Animations/LevelInfoAtom.h b/MsBinaryFile/PptFile/Records/Animations/LevelInfoAtom.h index f9f3182447..0cc08cf676 100644 --- a/MsBinaryFile/PptFile/Records/Animations/LevelInfoAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/LevelInfoAtom.h @@ -39,12 +39,24 @@ namespace PPT_FORMAT class CRecordLevelInfoAtom : public CUnknownRecord { public: + CRecordLevelInfoAtom() + { + + } + + ~CRecordLevelInfoAtom() + { + + } + + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + m_nLevel = StreamUtils::ReadDWORD ( pStream ); + } + + _UINT32 m_nLevel; - - CRecordLevelInfoAtom(); - ~CRecordLevelInfoAtom(); - - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ); - }; } diff --git a/MsBinaryFile/PptFile/Records/Animations/ParaBuildAtom.h b/MsBinaryFile/PptFile/Records/Animations/ParaBuildAtom.h index 9f3b909fb8..a485fde7e7 100644 --- a/MsBinaryFile/PptFile/Records/Animations/ParaBuildAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/ParaBuildAtom.h @@ -39,7 +39,22 @@ namespace PPT_FORMAT class CRecordParaBuildAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + m_nParaBuild = StreamUtils::ReadDWORD ( pStream ); + m_nBuildLevel = StreamUtils::ReadDWORD ( pStream ); + + _UINT32 Value = StreamUtils::ReadDWORD ( pStream ); + + m_fAnimBackground = ( 0x01 == ( 0x01 & ((BYTE)Value) ) ); + m_fReverse = ( 0x02 == ( 0x02 & ((BYTE)Value) ) ); + m_fUserSetAnimBackground = ( 0x04 == ( 0x04 & ((BYTE)Value) ) ); + m_fAutomatic = ( 0x08 == ( 0x08 & ((BYTE)Value) ) ); + + m_nDelayTime = StreamUtils::ReadDWORD ( pStream ); + } public: diff --git a/MsBinaryFile/PptFile/Records/Animations/ParaBuildContainer.h b/MsBinaryFile/PptFile/Records/Animations/ParaBuildContainer.h index 471c73f951..9148900dd6 100644 --- a/MsBinaryFile/PptFile/Records/Animations/ParaBuildContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/ParaBuildContainer.h @@ -42,10 +42,42 @@ class CRecordParaBuildContainer : public CRecordBuildListSubContainer { public: - CRecordParaBuildContainer(); - virtual ~CRecordParaBuildContainer(); + CRecordParaBuildContainer() + { - virtual void ReadFromStream ( SRecordHeader & header, POLE::Stream* pStream ) override; + } + + virtual ~CRecordParaBuildContainer() + { + } + + virtual void ReadFromStream ( SRecordHeader & header, POLE::Stream* pStream ) override + { + LONG lPos(0); StreamUtils::StreamPosition(lPos, pStream); + CRecordBuildListSubContainer::ReadFromStream(header, pStream); + + UINT lCurLen = buildAtom.m_oHeader.RecLen + 8 + 24; // BuildAtom - 24 + + + SRecordHeader paraBuildAtomHeader; + if (paraBuildAtomHeader.ReadFromStream(pStream)) + { + m_oParaBuildAtom.ReadFromStream ( paraBuildAtomHeader, pStream ); + lCurLen += paraBuildAtomHeader.RecLen + 8; + } + + while (lCurLen < m_oHeader.RecLen ) + { + CRecordParaBuildLevel buildLevel; + buildLevel.ReadFromStream(pStream); + + rgParaBuildLevel.push_back(buildLevel); + + lCurLen += buildLevel.getRecordLen(); + } + + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + } public: CRecordParaBuildAtom m_oParaBuildAtom; diff --git a/MsBinaryFile/PptFile/Records/Animations/ParaBuildLevel.h b/MsBinaryFile/PptFile/Records/Animations/ParaBuildLevel.h index 575a791827..5e0c787f4f 100644 --- a/MsBinaryFile/PptFile/Records/Animations/ParaBuildLevel.h +++ b/MsBinaryFile/PptFile/Records/Animations/ParaBuildLevel.h @@ -40,10 +40,30 @@ class CRecordParaBuildLevel { public: - CRecordParaBuildLevel (); - ~CRecordParaBuildLevel(); + CRecordParaBuildLevel () : m_nRecordLen(0) + { + } - virtual void ReadFromStream ( POLE::Stream* pStream ); + ~CRecordParaBuildLevel() + { + } + + virtual void ReadFromStream ( POLE::Stream* pStream ) + { + SRecordHeader oHeader; + + if (oHeader.ReadFromStream(pStream)) + { + m_oLevelInfoAtom.ReadFromStream ( oHeader, pStream ); + m_nRecordLen += oHeader.RecLen + 8; + } + + if (oHeader.ReadFromStream(pStream)) + { + m_oTimeNode.ReadFromStream ( oHeader, pStream ); + m_nRecordLen += oHeader.RecLen + 8; + } + } _UINT32 getRecordLen()const {return m_nRecordLen;} @@ -51,5 +71,5 @@ public: CRecordExtTimeNodeContainer m_oTimeNode; // ExtTimeNodeContainer private: - _UINT32 m_nRecordLen = 0; + _UINT32 m_nRecordLen; }; diff --git a/MsBinaryFile/PptFile/Records/Animations/SubEffectContainer.h b/MsBinaryFile/PptFile/Records/Animations/SubEffectContainer.h index ecb8efe58c..84747e29ed 100644 --- a/MsBinaryFile/PptFile/Records/Animations/SubEffectContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/SubEffectContainer.h @@ -31,6 +31,7 @@ */ #pragma once + #include "../../Reader/Records.h" #include "TimeNodeAtom.h" #include "TimePropertyList4TimeNodeContainer.h" @@ -42,16 +43,117 @@ #include "TimeModifierAtom.h" +//-------------------------------------------------------------------------------- +#define SUBEFFECT_CASE(RECORD_TYPE, P_VAR, CLASS_RECORD_NAME, FLAG) \ + case RECORD_TYPE: { P_VAR = new CLASS_RECORD_NAME(); \ + P_VAR->ReadFromStream(ReadHeader, pStream); \ + FLAG = true; \ + break; } \ +//------------------------------------------------------------------------------- + + namespace PPT_FORMAT { struct CRecordSubEffectContainer : public CUnknownRecord { public: - CRecordSubEffectContainer (); - virtual ~CRecordSubEffectContainer (); + CRecordSubEffectContainer () : + m_pTimePropertyList(nullptr), + m_pTimeColorBehavior(nullptr), + m_pTimeSetBehavior(nullptr), + m_pTimeCommandBehavior(nullptr), + m_pClientVisualElement(nullptr), - virtual void ReadFromStream (SRecordHeader & oHeader, POLE::Stream* pStream) override; + m_haveTimePropertyList(false), + m_haveColorBehavior(false), + m_haveSetBehavior(false), + m_haveCommandBehavior(false), + m_haveClientVisualElement(false) + { + } + + virtual ~CRecordSubEffectContainer () + { + RELEASEOBJECT(m_pTimePropertyList); + RELEASEOBJECT(m_pTimeColorBehavior); + RELEASEOBJECT(m_pTimeSetBehavior); + RELEASEOBJECT(m_pTimeCommandBehavior); + RELEASEOBJECT(m_pClientVisualElement); + + for (auto pRecord : m_arrRgBeginTimeCondition) + RELEASEOBJECT(pRecord); + for (auto pRecord : m_arrRgEndTimeCondition) + RELEASEOBJECT(pRecord); + for (auto pRecord : m_arrRgTimeModifierAtom) + RELEASEOBJECT(pRecord); + } + + virtual void ReadFromStream (SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + LONG lPos(0); StreamUtils::StreamPosition(lPos, pStream); + + SRecordHeader ReadHeader; + + if ( ReadHeader.ReadFromStream(pStream) ) + m_oTimeNodeAtom.ReadFromStream ( ReadHeader, pStream ); + + UINT lCurLen = m_oTimeNodeAtom.m_oHeader.RecLen + 8; + while ( lCurLen < m_oHeader.RecLen ) + { + if ( ReadHeader.ReadFromStream(pStream) == false) + break; + + lCurLen += 8 + ReadHeader.RecLen; + + switch (ReadHeader.RecType) + { + SUBEFFECT_CASE(RT_TimePropertyList, m_pTimePropertyList, + CRecordTimePropertyList4TimeNodeContainer, m_haveTimePropertyList) + SUBEFFECT_CASE(RT_TimeColorBehaviorContainer, m_pTimeColorBehavior, + CRecordTimeColorBehaviorContainer, m_haveColorBehavior) + SUBEFFECT_CASE(RT_TimeSetBehaviorContainer, m_pTimeSetBehavior, + CRecordTimeSetBehaviorContainer, m_haveSetBehavior) + SUBEFFECT_CASE(RT_TimeCommandBehaviorContainer, m_pTimeCommandBehavior, + CRecordTimeCommandBehaviorContainer, m_haveCommandBehavior) + SUBEFFECT_CASE(RT_TimeClientVisualElement, m_pClientVisualElement, + CRecordClientVisualElementContainer, m_haveClientVisualElement) + + case RT_TimeConditionContainer: + { + CRecordTimeConditionContainer* pTimeCondition = + new CRecordTimeConditionContainer(); + pTimeCondition->ReadFromStream(ReadHeader, pStream); + unsigned short recInst = ReadHeader.RecInstance; + + if (recInst == TL_CT_Begin) + m_arrRgBeginTimeCondition.push_back(pTimeCondition); + + else if (recInst == TL_CT_End) + m_arrRgEndTimeCondition.push_back(pTimeCondition); + else + throw ; + + break; // A lot of records. Look at instance + } + + case RT_TimeModifier: + { + CRecordTimeModifierAtom* pModAtom = new CRecordTimeModifierAtom(); + pModAtom->ReadFromStream(ReadHeader, pStream); + m_arrRgTimeModifierAtom.push_back(pModAtom); + break; + } + + default: + throw ; + } + } + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + + } public: diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeAnimateBehaviorAtom.h b/MsBinaryFile/PptFile/Records/Animations/TimeAnimateBehaviorAtom.h index 3d6cb72681..6a20e886d9 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeAnimateBehaviorAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeAnimateBehaviorAtom.h @@ -31,6 +31,7 @@ */ #pragma once + #include "../../Reader/Records.h" #include "../../Enums/_includer.h" @@ -40,7 +41,23 @@ namespace PPT_FORMAT class CRecordTimeAnimateBehaviorAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + m_nCalcMode = StreamUtils::ReadDWORD ( pStream ); + + _UINT32 Value = StreamUtils::ReadDWORD ( pStream ); + + m_bByPropertyUsed = ( 0x01 == ( 0x01 & ((BYTE)Value) ) ); + m_bFromPropertyUsed = ( 0x02 == ( 0x02 & ((BYTE)Value) ) ); + m_bToPropertyUsed = ( 0x04 == ( 0x04 & ((BYTE)Value) ) ); + m_bCalcModePropertyUsed = ( 0x08 == ( 0x08 & ((BYTE)Value) ) ); + m_bAnimationValuesPropertyUsed = ( 0x10 == ( 0x10 & ((BYTE)Value) ) ); + m_bValueTypePropertyUsed = ( 0x20 == ( 0x20 & ((BYTE)Value) ) ); + + m_ValueType = (TimeAnimateBehaviorValueTypeEnum)StreamUtils::ReadDWORD ( pStream ); + } public: diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeAnimateBehaviorContainer.h b/MsBinaryFile/PptFile/Records/Animations/TimeAnimateBehaviorContainer.h index bca3423d7a..bf4712f9b1 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeAnimateBehaviorContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeAnimateBehaviorContainer.h @@ -45,7 +45,43 @@ namespace PPT_FORMAT class CRecordTimeAnimateBehaviorContainer : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ); + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + SRecordHeader ReadHeader; + + if ( ReadHeader.ReadFromStream(pStream) ) + m_oAnimateBehaviorAtom.ReadFromStream ( ReadHeader, pStream ); + + ReadHeader.ReadFromStream(pStream) ; + if (ReadHeader.RecType == RT_TimeAnimationValueList) + m_oAnimateValueList.ReadFromStream ( ReadHeader, pStream ); + else + StreamUtils::StreamSkipBack(8, pStream); + + + if ( m_oAnimateBehaviorAtom.m_bByPropertyUsed ) + { + if ( ReadHeader.ReadFromStream(pStream) ) + m_oVarBy.ReadFromStream ( ReadHeader, pStream ); + } + + if ( m_oAnimateBehaviorAtom.m_bFromPropertyUsed ) + { + if ( ReadHeader.ReadFromStream(pStream) ) + m_oVarFrom.ReadFromStream ( ReadHeader, pStream ); + } + + if ( m_oAnimateBehaviorAtom.m_bToPropertyUsed ) + { + if ( ReadHeader.ReadFromStream(pStream) ) + m_oVarTo.ReadFromStream ( ReadHeader, pStream ); + } + + if ( ReadHeader.ReadFromStream(pStream) ) + m_oBehavior.ReadFromStream ( ReadHeader, pStream ); + } public: diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeAnimateColor.h b/MsBinaryFile/PptFile/Records/Animations/TimeAnimateColor.h index 9f6d3c31e8..89b4165058 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeAnimateColor.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeAnimateColor.h @@ -44,6 +44,9 @@ struct TimeAnimateColor _UINT32 component1; _UINT32 component2; - unsigned long FRGB (BYTE alpha = 0xFF); + inline unsigned long FRGB (BYTE alpha = 0xFF) + { + return ((component2 << 16) | (component1 << 8) | (component0 << 0) | (alpha << 24)); + } }; } diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeAnimateColorBy.h b/MsBinaryFile/PptFile/Records/Animations/TimeAnimateColorBy.h index b2b445dd3d..9cac62106d 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeAnimateColorBy.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeAnimateColorBy.h @@ -44,6 +44,9 @@ struct TimeAnimateColorBy _UINT32 component1; _UINT32 component2; - unsigned long FRGB (BYTE alpha = 0xFF); + inline unsigned long FRGB (BYTE alpha = 0xFF) // + { + return ((component2 << 16) | (component1 << 8) | (component0 << 0) | (alpha << 24)); + } }; } diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeAnimationValueAtom.h b/MsBinaryFile/PptFile/Records/Animations/TimeAnimationValueAtom.h index 0e1a30ecfb..c9787eba46 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeAnimationValueAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeAnimationValueAtom.h @@ -39,9 +39,15 @@ namespace PPT_FORMAT class CRecordTimeAnimationValueAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + m_nTime = StreamUtils::ReadDWORD ( pStream ); + } public: + long m_nTime; }; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeAnimationValueListContainer.h b/MsBinaryFile/PptFile/Records/Animations/TimeAnimationValueListContainer.h index fe4c3d0a8f..35ca133d33 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeAnimationValueListContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeAnimationValueListContainer.h @@ -43,13 +43,45 @@ class CRecordTimeAnimationValueListContainer : public CUnknownRecord { public: - CRecordTimeAnimationValueListContainer(); - ~CRecordTimeAnimationValueListContainer(); - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + ~CRecordTimeAnimationValueListContainer() + { + for (auto pEntry : m_arrEntry) + { + RELEASEOBJECT(pEntry); + } + } + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); + + UINT lCurLen = 0; + + SRecordHeader ReadHeader; + while ( lCurLen < m_oHeader.RecLen ) + { + if ( ReadHeader.ReadFromStream(pStream) == false ) + { + break; + } + + lCurLen += 8 + ReadHeader.RecLen; + + auto Entry = new CRecordTimeAnimationEntry; + Entry->ReadFromStream ( lCurLen, ReadHeader, pStream ); + + m_arrEntry.push_back ( Entry ); + + } + + StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } public: - std::vector m_arrEntry; + std::vector m_arrEntry; }; } diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeAnimationValueListEntry.h b/MsBinaryFile/PptFile/Records/Animations/TimeAnimationValueListEntry.h index 8477eea7ba..d144a486f0 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeAnimationValueListEntry.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeAnimationValueListEntry.h @@ -40,14 +40,50 @@ namespace PPT_FORMAT { -class CRecordTimeAnimationValueListEntry +class CRecordTimeAnimationEntry { public: - CRecordTimeAnimationValueListEntry(); - virtual ~CRecordTimeAnimationValueListEntry(); + CRecordTimeAnimationEntry() + { - virtual void ReadFromStream ( UINT& CurLen, SRecordHeader & oHeader, POLE::Stream* pStream ); + } + + virtual ~CRecordTimeAnimationEntry() + { + } + + virtual void ReadFromStream ( UINT& CurLen, SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oTimeAnimationValueAtom.ReadFromStream ( oHeader, pStream ); + CurLen += 4; + +// UINT res = 0; + SRecordHeader ReadHeader; + + ReadHeader.ReadFromStream(pStream); + if ( ReadHeader.RecInstance == 0 && + ReadHeader.RecType == RT_TimeVariant ) + { + m_pVarValue = TimeVariantFactoryMethod( ReadHeader, pStream ); + CurLen += 8 + ReadHeader.RecLen; + }else + { + StreamUtils::StreamSkipBack(8, pStream); + } + + ReadHeader.ReadFromStream(pStream); + if ( ReadHeader.RecInstance == 1 && + ReadHeader.RecType == RT_TimeVariant) + { + m_VarFormula.ReadFromStream ( ReadHeader, pStream ); + CurLen += 8 + ReadHeader.RecLen; + } else + { + StreamUtils::StreamSkipBack(8, pStream); + } + + } CRecordTimeAnimationValueAtom m_oTimeAnimationValueAtom; nullable m_pVarValue; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeBehaviorAtom.h b/MsBinaryFile/PptFile/Records/Animations/TimeBehaviorAtom.h index 0e1e82e392..10fcb5f9a0 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeBehaviorAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeBehaviorAtom.h @@ -31,6 +31,7 @@ */ #pragma once + #include "../../Reader/Records.h" @@ -40,8 +41,25 @@ namespace PPT_FORMAT class CRecordTimeBehaviorAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ); + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + // LONG lPos = 0; StreamUtils::StreamPosition ( lPos, pStream ); + + _UINT32 dwFlags = StreamUtils::ReadDWORD ( pStream ); + + m_bAdditivePropertyUsed = ( 0x01 == ( 0x01 & ((BYTE)dwFlags) ) ); + m_bAttributeNamesPropertyUsed = ( 0x04 == ( 0x04 & ((BYTE)dwFlags) ) ); + + m_nBehaviorAdditive = StreamUtils::ReadDWORD ( pStream ); + m_nBehaviorAccumulate = StreamUtils::ReadDWORD ( pStream ); + m_nBehaviorTransform = StreamUtils::ReadDWORD ( pStream ); + + // StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } + +public: bool m_bAdditivePropertyUsed; bool m_bAttributeNamesPropertyUsed; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeBehaviorContainer.h b/MsBinaryFile/PptFile/Records/Animations/TimeBehaviorContainer.h index 83440cd770..d1bec44236 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeBehaviorContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeBehaviorContainer.h @@ -45,11 +45,78 @@ namespace PPT_FORMAT class CRecordTimeBehaviorContainer : public CUnknownRecord { public: - CRecordTimeBehaviorContainer (); - virtual ~CRecordTimeBehaviorContainer (); - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ); + CRecordTimeBehaviorContainer () : + m_pStringList(nullptr), + m_pPropertyList(nullptr), - _UINT32 GetObjectID (); + m_haveStringList(false), + m_havePropertyList(false) + { + } + + virtual ~CRecordTimeBehaviorContainer () + { + RELEASEOBJECT (m_pStringList); + RELEASEOBJECT (m_pPropertyList); + } + + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + LONG lPos(0); StreamUtils::StreamPosition(lPos, pStream); + + SRecordHeader ReadHeader; + + if ( ReadHeader.ReadFromStream(pStream) ) + m_oBehaviorAtom.ReadFromStream ( ReadHeader, pStream ); + + UINT lCurLen = 8 + ReadHeader.RecLen; + + while ( lCurLen < m_oHeader.RecLen ) + { + if (ReadHeader.ReadFromStream(pStream) == false) + break; + + lCurLen += 8 + ReadHeader.RecLen; + + RecordType nRecord = ReadHeader.RecType; + + switch (nRecord) + { + case RT_TimeVariantList: + { + m_pStringList = new CRecordTimeStringListContainer(); + m_pStringList->ReadFromStream(ReadHeader, pStream); + m_haveStringList = true; + break; + } + + case RT_TimePropertyList: + { + m_pPropertyList = new CRecordTimePropertyList4TimeBehavior(); + m_pPropertyList->ReadFromStream(ReadHeader, pStream); + m_havePropertyList = true; + break; + } + + case RT_TimeClientVisualElement: + { + m_oClientVisualElement.ReadFromStream( ReadHeader, pStream ); + } + + default: + break ; + } + } + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + } + + + inline _UINT32 GetObjectID () + { + return m_oClientVisualElement.m_oVisualShapeAtom.m_nObjectIdRef; + } public: CRecordTimeBehaviorAtom m_oBehaviorAtom; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeColorBehaviorAtom.h b/MsBinaryFile/PptFile/Records/Animations/TimeColorBehaviorAtom.h index 3d6a33067d..fc6fe97213 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeColorBehaviorAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeColorBehaviorAtom.h @@ -43,7 +43,22 @@ namespace PPT_FORMAT class CRecordTimeColorBehaviorAtom: public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + _UINT32 flag = StreamUtils::ReadDWORD ( pStream ); + + m_fByPropertyUsed = ( 0x01 == ( 0x01 & ((BYTE)flag) ) ); + m_fFromPropertyUsed = ( 0x02 == ( 0x02 & ((BYTE)flag) ) ); + m_fToPropertyUsed = ( 0x04 == ( 0x04 & ((BYTE)flag) ) ); + m_fColorSpacePropertyUsed = ( 0x08 == ( 0x08 & ((BYTE)flag) ) ); + m_fDirectionPropertyUsed = ( 0x10 == ( 0x10 & ((BYTE)flag) ) ); + + pStream->read ((unsigned char*) &m_sColorBy , sizeof ( TimeAnimateColorBy ) ); + pStream->read ((unsigned char*) &m_sColorFrom , sizeof ( TimeAnimateColor ) ); + pStream->read ((unsigned char*) &m_sColorTo , sizeof ( TimeAnimateColor ) ); + } public: diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeColorBehaviorContainer.h b/MsBinaryFile/PptFile/Records/Animations/TimeColorBehaviorContainer.h index 5c89586535..08fde48cd7 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeColorBehaviorContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeColorBehaviorContainer.h @@ -43,7 +43,17 @@ namespace PPT_FORMAT class CRecordTimeColorBehaviorContainer : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + SRecordHeader ReadHeader; + if (ReadHeader.ReadFromStream(pStream) ) + m_oColorBehaviorAtom.ReadFromStream ( ReadHeader, pStream ); + + if (ReadHeader.ReadFromStream(pStream) ) + m_oBehavior.ReadFromStream (ReadHeader, pStream ); + } public: diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeCommandBehaviorAtom.h b/MsBinaryFile/PptFile/Records/Animations/TimeCommandBehaviorAtom.h index 69f8f19f62..cf0ba1dc55 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeCommandBehaviorAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeCommandBehaviorAtom.h @@ -41,8 +41,30 @@ namespace PPT_FORMAT class CRecordTimeCommandBehaviorAtom : public CUnknownRecord { public: - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + CRecordTimeCommandBehaviorAtom () + { + } + + ~CRecordTimeCommandBehaviorAtom() + { + + } + + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override + { + m_oHeader = oHeader; + + _UINT32 flags = StreamUtils::ReadLONG(pStream); + + m_fTypePropertyUsed = ( 0x01 == ( 0x01 & (flags) ) ); + m_fCommandPropertyUsed = ( 0x02 == ( 0x02 & (flags) ) ); + + + m_eCommandBehaviorType = (TimeCommandBehaviorTypeEnum) + StreamUtils::ReadLONG(pStream); + + } public: bool m_fTypePropertyUsed; bool m_fCommandPropertyUsed; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeCommandBehaviorContainer.h b/MsBinaryFile/PptFile/Records/Animations/TimeCommandBehaviorContainer.h index 5dc21d520d..5c305a91aa 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeCommandBehaviorContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeCommandBehaviorContainer.h @@ -42,9 +42,32 @@ namespace PPT_FORMAT class CRecordTimeCommandBehaviorContainer : public CUnknownRecord { public: - void ReadFromStream(SRecordHeader &thisHeader, POLE::Stream *pStream) override; + CRecordTimeCommandBehaviorContainer () + { + } + ~CRecordTimeCommandBehaviorContainer () + { + + } + + void ReadFromStream(SRecordHeader &thisHeader, POLE::Stream *pStream) override + { + m_oHeader = thisHeader; + + SRecordHeader oHeader; + if (oHeader.ReadFromStream(pStream)) + m_oCommandBehaviorAtom.ReadFromStream ( oHeader, pStream ); + + if (oHeader.ReadFromStream(pStream)) + m_oVarCommand.ReadFromStream ( oHeader, pStream ); + + if (oHeader.ReadFromStream(pStream)) + m_oBevavior.ReadFromStream ( oHeader, pStream ); + } + +public: CRecordTimeCommandBehaviorAtom m_oCommandBehaviorAtom; CRecordTimeVariantString m_oVarCommand; CRecordTimeBehaviorContainer m_oBevavior; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeConditionAtom.h b/MsBinaryFile/PptFile/Records/Animations/TimeConditionAtom.h index 2e985af4c2..eb01a386e9 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeConditionAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeConditionAtom.h @@ -41,8 +41,18 @@ namespace PPT_FORMAT class CRecordTimeConditionAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ); + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + m_TriggerObject = ( TriggerObjectEnum )StreamUtils::ReadDWORD ( pStream ); + + m_nTriggerEvent = StreamUtils::ReadDWORD ( pStream ); + m_nID = StreamUtils::ReadDWORD ( pStream ); + m_nTimeDelay = StreamUtils::ReadLONG ( pStream ); + } + +public: TriggerObjectEnum m_TriggerObject; _UINT32 m_nTriggerEvent; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeConditionContainer.h b/MsBinaryFile/PptFile/Records/Animations/TimeConditionContainer.h index 6e90d8c1d0..802614d116 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeConditionContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeConditionContainer.h @@ -31,6 +31,7 @@ */ #pragma once + #include "../../Reader/Records.h" #include "TimeConditionAtom.h" #include "ClientVisualElementContainer.h" @@ -41,8 +42,31 @@ namespace PPT_FORMAT class CRecordTimeConditionContainer : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + LONG lPos = 0; StreamUtils::StreamPosition ( lPos, pStream ); + + SRecordHeader header; + + if ( header.ReadFromStream(pStream) ) + { + m_oTimeConditionAtom.ReadFromStream ( header, pStream ); + + if ( TL_TOT_VisualElement == m_oTimeConditionAtom.m_TriggerObject ) + { + if ( header.ReadFromStream(pStream) ) + { + m_oVisualElement.ReadFromStream ( header, pStream ); + } + } + } + + StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } + +public: CRecordTimeConditionAtom m_oTimeConditionAtom; CRecordClientVisualElementContainer m_oVisualElement; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeEffectBehaviorAtom.h b/MsBinaryFile/PptFile/Records/Animations/TimeEffectBehaviorAtom.h index 01d6aed07c..6f0a9c5e69 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeEffectBehaviorAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeEffectBehaviorAtom.h @@ -31,15 +31,33 @@ */ #pragma once + #include "../../Reader/Records.h" namespace PPT_FORMAT { + class CRecordTimeEffectBehaviorAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ); + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + // LONG lPos = 0; StreamUtils::StreamPosition ( lPos, pStream ); + + _UINT32 dwFlags = StreamUtils::ReadDWORD ( pStream ); + + m_bTransitionPropertyUsed = ( 0x01 == ( 0x01 & ((BYTE)dwFlags) ) ); + m_bTypePropertyUsed = ( 0x02 == ( 0x02 & ((BYTE)dwFlags) ) ); + m_bProgressPropertyUsed = ( 0x04 == ( 0x04 & ((BYTE)dwFlags) ) ); + m_bRuntimeContextObsolete = ( 0x08 == ( 0x08 & ((BYTE)dwFlags) ) ); + + m_nEffectTransition = StreamUtils::ReadDWORD ( pStream ); + + // StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } public: bool m_bTransitionPropertyUsed; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeEffectBehaviorContainer.h b/MsBinaryFile/PptFile/Records/Animations/TimeEffectBehaviorContainer.h index 03d5716e3d..933ab0f695 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeEffectBehaviorContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeEffectBehaviorContainer.h @@ -42,8 +42,54 @@ namespace PPT_FORMAT class CRecordTimeEffectBehaviorContainer : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + LONG lPos = 0; StreamUtils::StreamPosition ( lPos, pStream ); + + SRecordHeader header; + if ( header.ReadFromStream(pStream) ) + m_effectBehaviorAtom.ReadFromStream ( header, pStream ); + + if ( m_effectBehaviorAtom.m_bTypePropertyUsed ) + { + if ( header.ReadFromStream(pStream) ) + m_oVarType.ReadFromStream ( header, pStream ); + } + + if ( m_effectBehaviorAtom.m_bProgressPropertyUsed ) + { + if ( header.ReadFromStream(pStream) ) + m_oVarProgress.ReadFromStream ( header, pStream ); + } + + if ( m_effectBehaviorAtom.m_bRuntimeContextObsolete ) + { + if ( header.ReadFromStream(pStream) ) + m_oVarRuntimeContext.ReadFromStream ( header, pStream ); + } + + if ( header.ReadFromStream(pStream) ) + { + if (header.RecType == 0xF12A) + { + m_oBehavior.ReadFromStream (header, pStream); + } + else + { + StreamUtils::StreamSkip (header.RecLen, pStream); + if ( header.ReadFromStream(pStream) ) + { + m_oBehavior.ReadFromStream ( header, pStream ); + } + } + } + + StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } + +public: CRecordTimeEffectBehaviorAtom m_effectBehaviorAtom; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeIterateDataAtom.h b/MsBinaryFile/PptFile/Records/Animations/TimeIterateDataAtom.h index 7b5e28d452..33240b0eca 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeIterateDataAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeIterateDataAtom.h @@ -31,16 +31,32 @@ */ #pragma once -#include "../../Reader/Records.h" +#include "../../Reader/Records.h" namespace PPT_FORMAT { class CRecordTimeIterateDataAtom: public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + m_nIterateInterval = StreamUtils::ReadDWORD ( pStream ); + m_nIterateType = StreamUtils::ReadDWORD ( pStream ); + m_nIterateDirection = StreamUtils::ReadDWORD ( pStream ); + m_nIterateIntervalType = StreamUtils::ReadDWORD ( pStream ); + + _UINT32 Value = StreamUtils::ReadDWORD ( pStream ); + + m_fIterateDirectionPropertyUsed = ( 0x01 == ( 0x01 & ((BYTE)Value) ) ); + m_fIterateTypePropertyUsed = ( 0x02 == ( 0x02 & ((BYTE)Value) ) ); + m_fIterateIntervalPropertyUsed = ( 0x04 == ( 0x04 & ((BYTE)Value) ) ); + m_fIterateIntervalTypePropertyUsed = ( 0x08 == ( 0x08 & ((BYTE)Value) ) ); + } + +public: _UINT32 m_nIterateInterval; _UINT32 m_nIterateType; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeModifierAtom.h b/MsBinaryFile/PptFile/Records/Animations/TimeModifierAtom.h index fd123a3ca4..a94faed0ea 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeModifierAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeModifierAtom.h @@ -40,8 +40,15 @@ namespace PPT_FORMAT class CRecordTimeModifierAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + m_nType = StreamUtils::ReadDWORD(pStream); + m_Value = StreamUtils::ReadFLOAT(pStream); + } + +public: unsigned long m_nType; // 0x00000000 Repeat count. // 0x00000001 Repeat duration. diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeMotionBehaviorAtom.h b/MsBinaryFile/PptFile/Records/Animations/TimeMotionBehaviorAtom.h index 24693fd468..215f629790 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeMotionBehaviorAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeMotionBehaviorAtom.h @@ -40,8 +40,31 @@ namespace PPT_FORMAT class CRecordTimeMotionBehaviorAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + _UINT32 Value = StreamUtils::ReadDWORD ( pStream ); + + m_bByPropertyUsed = ( 0x01 == ( 0x01 & ((BYTE)Value) ) ); + m_bFromPropertyUsed = ( 0x02 == ( 0x02 & ((BYTE)Value) ) ); + m_bToPropertyUsed = ( 0x04 == ( 0x04 & ((BYTE)Value) ) ); + m_bOriginPropertyUsed = ( 0x08 == ( 0x08 & ((BYTE)Value) ) ); + m_bPathPropertyUsed = ( 0x10 == ( 0x10 & ((BYTE)Value) ) ); + + m_bEditRotationPropertyUsed = ( 0x40 == ( 0x40 & ((BYTE)Value) ) ); + m_bPointsTypesPropertyUsed = ( 0x80 == ( 0x80 & ((BYTE)Value) ) ); + + m_nXBY = StreamUtils::ReadFLOAT ( pStream ); + m_nYBY = StreamUtils::ReadFLOAT ( pStream ); + m_nXFROM = StreamUtils::ReadFLOAT ( pStream ); + m_nYFROM = StreamUtils::ReadFLOAT ( pStream ); + m_nXTO = StreamUtils::ReadFLOAT ( pStream ); + m_nYTO = StreamUtils::ReadFLOAT ( pStream ); + m_nBehaviorOrigin = StreamUtils::ReadDWORD ( pStream ); + } + +public: bool m_bByPropertyUsed; bool m_bFromPropertyUsed; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeMotionBehaviorContainer.h b/MsBinaryFile/PptFile/Records/Animations/TimeMotionBehaviorContainer.h index 7f8b1d84ac..f73c48d87a 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeMotionBehaviorContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeMotionBehaviorContainer.h @@ -43,10 +43,59 @@ namespace PPT_FORMAT class CRecordTimeMotionBehaviorContainer : public CUnknownRecord { public: - ~CRecordTimeMotionBehaviorContainer(); + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + LONG lPos = 0; StreamUtils::StreamPosition ( lPos, pStream ); + //UINT res = 0; + + SRecordHeader header; + if ( header.ReadFromStream(pStream) ) + { + m_oMotionBehaviorAtom.ReadFromStream ( header, pStream ); + } + + UINT lCurLen = m_oMotionBehaviorAtom.m_oHeader.RecLen + 8; + while ( lCurLen < m_oHeader.RecLen ) + { + header.ReadFromStream(pStream); + + lCurLen += header.RecLen + 8; + + switch (header.RecType) { + case RT_TimeVariant: + { + if (header.RecLen > 5 ) { + m_pVarPath = new CRecordTimeVariantString(); + m_pVarPath->ReadFromStream(header, pStream); + }else if (header.RecLen == 5){ + StreamUtils::StreamSkip(5, pStream); + } else + StreamUtils::StreamSkip(header.RecLen, pStream); + break; + } + + case RT_TimeBehaviorContainer: + { + m_oTimeBehavior.ReadFromStream(header, pStream); + break; + } + default: + break; + } + } + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + } + + + ~CRecordTimeMotionBehaviorContainer() + { + RELEASEOBJECT(m_pVarPath) + } + +public: CRecordTimeMotionBehaviorAtom m_oMotionBehaviorAtom; CRecordTimeVariantString* m_pVarPath; // OPTIONAL diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeNodeAtom.h b/MsBinaryFile/PptFile/Records/Animations/TimeNodeAtom.h index e60f974bf1..c5ead4aae6 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeNodeAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeNodeAtom.h @@ -41,8 +41,49 @@ namespace PPT_FORMAT class CRecordTimeNodeAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + // LONG lPos = 0; StreamUtils::StreamPosition(lPos, pStream); + + StreamUtils::StreamSkip ( sizeof ( _UINT32 ), pStream ); + + // 0x00000000 Does not restart. + // 0x00000001 Can restart at any time. + // 0x00000002 Can restart when the corresponding time node is not active. + // 0x00000003 Same as 0x00000000. + m_dwRestart = StreamUtils::ReadDWORD ( pStream ); + // 0x00000000 specifies that this time node is a parallel time node, + // which allows all of its child nodes to start at the same time. + m_dwType = (TimeNodeTypeEnum)StreamUtils::ReadDWORD ( pStream ); + + // 0x00000000 The properties remain at their ending values while the parent time node is still running or holding. After which, the properties reset to their original values. + // 0x00000001 The properties reset to their original values after the time node becomes inactive. + // 0x00000002 The properties remain at their ending values while the parent time node is still running or holding, or until another sibling time node is started under a sequential time node as specified in the type field. After which, the properties reset to their original values. + // 0x00000003 Same as 0x00000000. + // 0x00000004 Same as 0x00000001. + m_dwFill = StreamUtils::ReadDWORD ( pStream ); + + StreamUtils::StreamSkip ( sizeof ( _UINT32 ), pStream ); + StreamUtils::StreamSkip ( sizeof ( _UINT32 ), pStream ); + + // duration: 0xFFFFFFFF specifies that the duration of the time node is infinite, + // and that its actual duration is determined by the durations of its child nodes. + m_nDuration = StreamUtils::ReadLONG ( pStream ); + + _UINT32 Value = StreamUtils::ReadDWORD ( pStream ); + + m_fFillProperty = ( 0x01 == ( 0x01 & ((BYTE)Value) ) ); + m_fRestartProperty = ( 0x02 == ( 0x02 & ((BYTE)Value) ) ); + + m_fGroupingTypeProperty = ( 0x08 == ( 0x08 & ((BYTE)Value) ) ); + m_fDurationProperty = ( 0x10 == ( 0x10 & ((BYTE)Value) ) ); + + // StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } + +public: _UINT32 m_dwRestart; TimeNodeTypeEnum m_dwType; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimePropertyList4TimeBehavior.h b/MsBinaryFile/PptFile/Records/Animations/TimePropertyList4TimeBehavior.h index 1f3c4bafc8..412f0b5418 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimePropertyList4TimeBehavior.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimePropertyList4TimeBehavior.h @@ -42,8 +42,46 @@ namespace PPT_FORMAT class CRecordTimePropertyList4TimeBehavior : public CRecordsContainer { public: - virtual ~CRecordTimePropertyList4TimeBehavior (); + //static const _UINT32 RT_TimePropertyList = 0xF13D; // Specifies a TimePropertyList4TimeNodeContainer or TimePropertyList4TimeBehavior. - virtual void ReadFromStream ( SRecordHeader & thisHeader, POLE::Stream* pStream ) override; + CRecordTimePropertyList4TimeBehavior () + { + } + + virtual ~CRecordTimePropertyList4TimeBehavior () + { + CRecordsContainer::Clear(); + } + + virtual void ReadFromStream ( SRecordHeader & thisHeader, POLE::Stream* pStream ) + { + m_oHeader = thisHeader; + + UINT lCurLen = 0; + SRecordHeader oHeader; + + while (lCurLen < m_oHeader.RecLen) + { +// if (oHeader.ReadFromStream(pStream) == FALSE) +// { +// break; +// } + + if (oHeader.ReadFromStream(pStream)) { + lCurLen += 8 + oHeader.RecLen; + IRecord* pRecord = FactoryTimeVariant4Behavior::createByInstanse(oHeader.RecInstance); + if (pRecord) + { + pRecord->ReadFromStream(oHeader, pStream); + m_arRecords.push_back(pRecord); + } + else + break; + } + } + } + +public: + // Empty }; } diff --git a/MsBinaryFile/PptFile/Records/Animations/TimePropertyList4TimeNodeContainer.h b/MsBinaryFile/PptFile/Records/Animations/TimePropertyList4TimeNodeContainer.h index 9d71b37ff0..9f0f31ab3a 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimePropertyList4TimeNodeContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimePropertyList4TimeNodeContainer.h @@ -44,15 +44,87 @@ class CRecordTimePropertyList4TimeNodeContainer : public CUnknownRecord public: //static const _UINT32 RT_TimePropertyList = 0xF13D; // Specifies a CRecordTimePropertyList4TimeNodeContainer or TimePropertyList4TimeBehavior. - CRecordTimePropertyList4TimeNodeContainer (); - virtual ~CRecordTimePropertyList4TimeNodeContainer (); + CRecordTimePropertyList4TimeNodeContainer () + { + m_bEmtyNode = false; + } - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual ~CRecordTimePropertyList4TimeNodeContainer () + { + ClearNodes (); + } - bool IsEmpty (); - void ClearNodes (); + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); + + UINT lCurLen = 0; + + SRecordHeader ReadHeader; + + if ( 0 == m_oHeader.RecLen ) + m_bEmtyNode = true; + + while ( lCurLen < m_oHeader.RecLen ) + { + if (ReadHeader.ReadFromStream(pStream) == false) + break; + + CRecordTimeVariant* pRecord = NULL; + + TimePropertyID4TimeNode VariableType = ( TimePropertyID4TimeNode ) ReadHeader.RecInstance; + + switch ( VariableType ) + { + case TL_TPID_Display: pRecord = new CRecordTimeDisplayType (); break; + case TL_TPID_MasterPos: pRecord = new CRecordTimeMasterRelType (); break; + case TL_TPID_SubType: pRecord = new CRecordTimeSubType (); break; + case TL_TPID_EffectID: pRecord = new CRecordTimeEffectID (); break; + case TL_TPID_EffectDir: pRecord = new CRecordTimeEffectDir (); break; + case TL_TPID_EffectType: pRecord = new CRecordTimeEffectType (); break; + case TL_TPID_AfterEffect: pRecord = new CRecordTimeAfterEffect (); break; + case TL_TPID_SlideCount: pRecord = new CRecordTimeSlideCount (); break; + case TL_TPID_TimeFilter: pRecord = new CRecordTimeNodeTimeFilter (); break; + case TL_TPID_EventFilter: pRecord = new CRecordTimeEventFilter (); break; + case TL_TPID_HideWhenStopped: pRecord = new CRecordTimeHideWhenStopped (); break; + case TL_TPID_GroupID: pRecord = new CRecordTimeGroupID (); break; + case TL_TPID_EffectNodeType: pRecord = new CRecordTimeEffectNodeType (); break; + case TL_TPID_PlaceholderNode: pRecord = new CRecordTimePlaceholderNode (); break; + case TL_TPID_MediaVolume: pRecord = new CRecordTimeMediaVolume (); break; + case TL_TPID_MediaMute: pRecord = new CRecordTimeMediaMute (); break; + case TL_TPID_ZoomToFullScreen: pRecord = new CRecordTimeZoomToFullScreen (); break; + default : + break; + } + + pRecord->ReadFromStream ( ReadHeader, pStream ); + lCurLen += 8 + ReadHeader.RecLen; + + m_arrElements.push_back ( pRecord ); + } + + StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } + + inline bool IsEmpty () + { + return m_bEmtyNode; + } + + void ClearNodes () + { + for ( size_t i = 0; i < m_arrElements.size(); ++i ) + { + RELEASEOBJECT ( m_arrElements[i] ); + } + m_arrElements.clear (); + } public: + bool m_bEmtyNode; std::vector m_arrElements; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeRotationBehaviorAtom.h b/MsBinaryFile/PptFile/Records/Animations/TimeRotationBehaviorAtom.h index 28f7806a9b..72996eee08 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeRotationBehaviorAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeRotationBehaviorAtom.h @@ -39,7 +39,23 @@ namespace PPT_FORMAT class CRecordTimeRotationBehaviorAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ); + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + _UINT32 src = StreamUtils::ReadDWORD ( pStream ); + + m_fByPropertyUsed = ( 0x01 == ( 0x01 & ((BYTE)src) ) ); + m_fFromPropertyUsed = ( 0x02 == ( 0x02 & ((BYTE)src) ) ); + m_fToPropertyUsed = ( 0x04 == ( 0x04 & ((BYTE)src) ) ); + m_fDirectionPropertyUsed = ( 0x08 == ( 0x08 & ((BYTE)src) ) ); + + m_By = StreamUtils::ReadFLOAT ( pStream ); + m_From = StreamUtils::ReadFLOAT ( pStream ); + m_To = StreamUtils::ReadFLOAT ( pStream ); + + m_nRotationDirection = StreamUtils::ReadDWORD ( pStream ); + } public: diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeRotationBehaviorContainer.h b/MsBinaryFile/PptFile/Records/Animations/TimeRotationBehaviorContainer.h index e5ca52acc7..679f13dae0 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeRotationBehaviorContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeRotationBehaviorContainer.h @@ -42,8 +42,22 @@ namespace PPT_FORMAT class CRecordTimeRotationBehaviorContainer : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ); + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + SRecordHeader ReadHeader; + + if ( ReadHeader.ReadFromStream(pStream) ) + m_oRotationBehaviorAtom.ReadFromStream ( ReadHeader, pStream ); + + if ( ReadHeader.ReadFromStream(pStream) ) + m_oBehavior.ReadFromStream ( ReadHeader, pStream ); + } + + + +public: CRecordTimeRotationBehaviorAtom m_oRotationBehaviorAtom; CRecordTimeBehaviorContainer m_oBehavior; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeScaleBehaviorAtom.h b/MsBinaryFile/PptFile/Records/Animations/TimeScaleBehaviorAtom.h index 9eeac07e0c..76512eeb64 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeScaleBehaviorAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeScaleBehaviorAtom.h @@ -40,7 +40,27 @@ namespace PPT_FORMAT class CRecordTimeScaleBehaviorAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + _UINT32 src = StreamUtils::ReadDWORD ( pStream ); + + m_fByPropertyUsed = ( 0x01 == ( 0x01 & ((BYTE)src) ) ); + m_fFromPropertyUsed = ( 0x02 == ( 0x02 & ((BYTE)src) ) ); + m_fToPropertyUsed = ( 0x04 == ( 0x04 & ((BYTE)src) ) ); + m_fZoomContentsUsed = ( 0x08 == ( 0x08 & ((BYTE)src) ) ); + + m_XBy = StreamUtils::ReadFLOAT ( pStream ); + m_YBy = StreamUtils::ReadFLOAT ( pStream ); + m_XFrom = StreamUtils::ReadFLOAT ( pStream ); + m_YFrom = StreamUtils::ReadFLOAT ( pStream ); + m_XTo = StreamUtils::ReadFLOAT ( pStream ); + m_YTo = StreamUtils::ReadFLOAT ( pStream ); + + src = StreamUtils::ReadDWORD ( pStream ); + m_fZoomContents = ( 0x01 == ( 0x01 & ((BYTE)src) ) ); + } public: diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeScaleBehaviorContainer.h b/MsBinaryFile/PptFile/Records/Animations/TimeScaleBehaviorContainer.h index 00c2be3908..f0259c4e0e 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeScaleBehaviorContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeScaleBehaviorContainer.h @@ -42,7 +42,18 @@ namespace PPT_FORMAT class CRecordTimeScaleBehaviorContainer : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + SRecordHeader ReadHeader; + + if ( ReadHeader.ReadFromStream(pStream) ) + m_oScaleBehaviorAtom.ReadFromStream ( ReadHeader, pStream ); + + if ( ReadHeader.ReadFromStream(pStream) ) + m_oBehavior.ReadFromStream ( ReadHeader, pStream ); + } public: CRecordTimeScaleBehaviorAtom m_oScaleBehaviorAtom; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeSequenceDataAtom.h b/MsBinaryFile/PptFile/Records/Animations/TimeSequenceDataAtom.h index bf617f754e..f4f93c903c 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeSequenceDataAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeSequenceDataAtom.h @@ -39,7 +39,26 @@ namespace PPT_FORMAT class CRecordTimeSequenceDataAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + // LONG lPos = 0; StreamUtils::StreamPosition ( lPos, pStream ); + + m_nConcurrency = StreamUtils::ReadDWORD ( pStream ); + m_nNextAction = StreamUtils::ReadDWORD ( pStream ); + m_nPreviousAction = StreamUtils::ReadDWORD ( pStream ); + + StreamUtils::StreamSkip ( sizeof ( _UINT32 ), pStream ); + + _UINT32 Value = StreamUtils::ReadDWORD ( pStream ); + + m_fConcurrencyPropertyUsed = ( 0x01 == ( 0x01 & ((BYTE)Value) ) ); + m_fNextActionPropertyUsed = ( 0x02 == ( 0x02 & ((BYTE)Value) ) ); + m_fPreviousActionPropertyUsed = ( 0x04 == ( 0x04 & ((BYTE)Value) ) ); + + // StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } public: diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeSetBehaviorAtom.h b/MsBinaryFile/PptFile/Records/Animations/TimeSetBehaviorAtom.h index c900f0e578..649ca44227 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeSetBehaviorAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeSetBehaviorAtom.h @@ -41,8 +41,19 @@ namespace PPT_FORMAT class CRecordTimeSetBehaviorAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + _UINT32 Value = StreamUtils::ReadDWORD ( pStream ); + + m_bToPropertyUsed = ( 0x01 == ( 0x01 & ((BYTE)Value) ) ); + m_bValueTypePropertyUsed = ( 0x02 == ( 0x02 & ((BYTE)Value) ) ); + + m_eValueType = (TimeAnimateBehaviorValueTypeEnum)StreamUtils::ReadDWORD ( pStream ); + } + +public: bool m_bToPropertyUsed; bool m_bValueTypePropertyUsed; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeSetBehaviorContainer.h b/MsBinaryFile/PptFile/Records/Animations/TimeSetBehaviorContainer.h index ade6300947..dcfa34853e 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeSetBehaviorContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeSetBehaviorContainer.h @@ -43,7 +43,28 @@ namespace PPT_FORMAT class CRecordTimeSetBehaviorContainer : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + LONG lPos = 0; StreamUtils::StreamPosition ( lPos, pStream ); + + //UINT res = 0; + SRecordHeader ReadHeader; + if ( ReadHeader.ReadFromStream(pStream) ) + m_oSetBehaviorAtom.ReadFromStream ( ReadHeader, pStream ); + + //if ( m_oSetBehaviorAtom.m_bToPropertyUsed ) + //{ + if ( ReadHeader.ReadFromStream(pStream) ) + m_oVarTo.ReadFromStream ( ReadHeader, pStream ); + //} + + if ( ReadHeader.ReadFromStream(pStream) ) + m_oBehavior.ReadFromStream ( ReadHeader, pStream ); + + StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } public: diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeStringListContainer.h b/MsBinaryFile/PptFile/Records/Animations/TimeStringListContainer.h index 230411e87d..d777f44232 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeStringListContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeStringListContainer.h @@ -31,6 +31,7 @@ */ #pragma once + #include "../../Reader/Records.h" #include "TimeVariant.h" @@ -40,8 +41,31 @@ namespace PPT_FORMAT class CRecordTimeStringListContainer : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + LONG lPos(0); StreamUtils::StreamPosition(lPos, pStream); + + UINT lCurLen = 0; + SRecordHeader ReadHeader; + + while ( lCurLen < m_oHeader.RecLen ) + { + if (ReadHeader.ReadFromStream(pStream) == false) + break; + + CRecordTimeVariantString Element; + Element.ReadFromStream ( ReadHeader, pStream ); + lCurLen += 8 + ReadHeader.RecLen; + + + m_arrRgChildRec.push_back ( Element ); + } + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + } + +public: std::vector m_arrRgChildRec; }; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeVariant.cpp b/MsBinaryFile/PptFile/Records/Animations/TimeVariant.cpp index 7b31e895ad..e97a885a64 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeVariant.cpp +++ b/MsBinaryFile/PptFile/Records/Animations/TimeVariant.cpp @@ -73,90 +73,3 @@ CRecordTimeVariant* PPT_FORMAT::TimeVariantFactoryMethod(SRecordHeader & oHeader return pTimeVariant; } - -void CRecordTimeVariant::ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) -{ - m_oHeader = oHeader; - - m_Type = ( TimeVariantTypeEnum )StreamUtils::ReadBYTE ( pStream ); -} - -CRecordTimeVariant::~CRecordTimeVariant() -{ - -} - -CRecordTimeVariant &CRecordTimeVariant::operator=(const CRecordTimeVariant &src) -{ - CUnknownRecord::operator=(src); - m_Type = src.m_Type; - - return *this; -} - -void CRecordTimeVariantBool::ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) -{ - CRecordTimeVariant::ReadFromStream(oHeader, pStream); - m_Value = ( 0x1 == StreamUtils::ReadBYTE ( pStream ) ); -} - -CRecordTimeVariant &CRecordTimeVariantBool::operator=(const CRecordTimeVariant &src) -{ - CRecordTimeVariant::operator=(src); - m_Value = dynamic_cast(src).m_Value; - - return *this; -} - -void CRecordTimeVariantInt::ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) -{ - CRecordTimeVariant::ReadFromStream(oHeader, pStream); - m_Value = StreamUtils::ReadDWORD ( pStream ); -} - -CRecordTimeVariant &CRecordTimeVariantInt::operator=(const CRecordTimeVariant &src) -{ - CRecordTimeVariant::operator=(src); - m_Value = dynamic_cast(src).m_Value; - - return *this; -} - -void CRecordTimeVariantFloat::ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) -{ - CRecordTimeVariant::ReadFromStream(oHeader, pStream); - m_Value = StreamUtils::ReadFLOAT ( pStream ); -} - -CRecordTimeVariant &CRecordTimeVariantFloat::operator=(const CRecordTimeVariant &src) -{ - CRecordTimeVariant::operator=(src); - m_Value = dynamic_cast(src).m_Value; - - return *this; -} - -void CRecordTimeVariantString::ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) -{ - if (oHeader.RecLen == 0) - return; - - LONG lPos; StreamUtils::StreamPosition(lPos, pStream); - lPos += oHeader.RecLen; - - CRecordTimeVariant::ReadFromStream(oHeader, pStream); - int strLen = m_oHeader.RecLen / 2 - 1; - if (strLen > 0) - { - m_Value = StreamUtils::ReadStringW(pStream, strLen); - } - StreamUtils::StreamSeek(lPos, pStream); -} - -CRecordTimeVariant &CRecordTimeVariantString::operator=(const CRecordTimeVariant &src) -{ - CRecordTimeVariant::operator=(src); - m_Value = dynamic_cast(src).m_Value; - - return *this; -} diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeVariant.h b/MsBinaryFile/PptFile/Records/Animations/TimeVariant.h index 119b2a00e1..ecd702a2f6 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeVariant.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeVariant.h @@ -43,11 +43,22 @@ class CRecordTimeVariant : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; - virtual ~CRecordTimeVariant(); + m_Type = ( TimeVariantTypeEnum )StreamUtils::ReadBYTE ( pStream ); + } - virtual CRecordTimeVariant &operator=(const CRecordTimeVariant& src) ; + virtual ~CRecordTimeVariant(){} + + virtual CRecordTimeVariant& operator=(const CRecordTimeVariant& src) + { + CUnknownRecord::operator=(src); + m_Type = src.m_Type; + + return *this; + } public: TimeVariantTypeEnum m_Type; @@ -57,9 +68,19 @@ public: class CRecordTimeVariantBool : public CRecordTimeVariant { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + CRecordTimeVariant::ReadFromStream(oHeader, pStream); + m_Value = ( 0x1 == StreamUtils::ReadBYTE ( pStream ) ); + } - virtual CRecordTimeVariant& operator=(const CRecordTimeVariant& src) override; + virtual CRecordTimeVariant& operator=(const CRecordTimeVariant& src) + { + CRecordTimeVariant::operator=(src); + m_Value = dynamic_cast(src).m_Value; + + return *this; + } virtual ~CRecordTimeVariantBool(){} @@ -70,9 +91,19 @@ public: class CRecordTimeVariantInt : public CRecordTimeVariant { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + CRecordTimeVariant::ReadFromStream(oHeader, pStream); + m_Value = StreamUtils::ReadDWORD ( pStream ); + } - virtual CRecordTimeVariant& operator=(const CRecordTimeVariant& src) override; + virtual CRecordTimeVariant& operator=(const CRecordTimeVariant& src) + { + CRecordTimeVariant::operator=(src); + m_Value = dynamic_cast(src).m_Value; + + return *this; + } virtual ~CRecordTimeVariantInt(){} @@ -83,9 +114,21 @@ public: class CRecordTimeVariantFloat : public CRecordTimeVariant { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + CRecordTimeVariant::ReadFromStream(oHeader, pStream); + m_Value = StreamUtils::ReadFLOAT ( pStream ); + } - virtual CRecordTimeVariant& operator=(const CRecordTimeVariant& src) override; + virtual CRecordTimeVariant& operator=(const CRecordTimeVariant& src) + { + CRecordTimeVariant::operator=(src); + m_Value = dynamic_cast(src).m_Value; + + return *this; + } + + virtual ~CRecordTimeVariantFloat(){} public: FLOAT m_Value; @@ -94,9 +137,33 @@ public: class CRecordTimeVariantString : public CRecordTimeVariant { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + if (oHeader.RecLen == 0) + return; + + LONG lPos; StreamUtils::StreamPosition(lPos, pStream); + lPos += oHeader.RecLen; + + CRecordTimeVariant::ReadFromStream(oHeader, pStream); + int strLen = m_oHeader.RecLen / 2 - 1; + if (strLen > 0) + { + m_Value = StreamUtils::ReadStringW(pStream, strLen); + } + StreamUtils::StreamSeek(lPos, pStream); + } + + virtual CRecordTimeVariant& operator=(const CRecordTimeVariant& src) + { + CRecordTimeVariant::operator=(src); + m_Value = dynamic_cast(src).m_Value; + + return *this; + } + + virtual ~CRecordTimeVariantString(){} - virtual CRecordTimeVariant& operator=(const CRecordTimeVariant& src) override; public: std::wstring m_Value; diff --git a/MsBinaryFile/PptFile/Records/Animations/TimeVariant4Behavior.h b/MsBinaryFile/PptFile/Records/Animations/TimeVariant4Behavior.h index 07bae9d168..2d632a5754 100644 --- a/MsBinaryFile/PptFile/Records/Animations/TimeVariant4Behavior.h +++ b/MsBinaryFile/PptFile/Records/Animations/TimeVariant4Behavior.h @@ -31,16 +31,43 @@ */ #pragma once + #include "../../Reader/Records.h" #include "../../Enums/_includer.h" #include "TimeVariant.h" +//------------------------------------------------------------------------------- +#define CREATE_BY_Instanse(RECORD_Instanse, CLASS_RECORD_NAME) \ + case RECORD_Instanse: { pRecord = new CLASS_RECORD_NAME(); break; } \ +//------------------------------------------------------------------------------- + + namespace PPT_FORMAT { +//TODO class FactoryTimeVariant4Behavior { public: - static IRecord* createByInstanse(unsigned short recInstance); + static IRecord* createByInstanse(unsigned short recInstance) + { + IRecord* pRecord = nullptr; + + switch (recInstance) + { + CREATE_BY_Instanse(TL_TBPID_UnknownPropertyList, CRecordTimeVariantString) + CREATE_BY_Instanse(TL_TBPID_RuntimeContext, CRecordTimeRuntimeContext) + CREATE_BY_Instanse(TL_TBPID_MotionPathEditRelative, CRecordTimeVariantBool) + CREATE_BY_Instanse(TL_TBPID_ColorColorModel, CRecordTimeColorModel) + CREATE_BY_Instanse(TL_TBPID_ColorDirection, CRecordTimeColorDirection) + CREATE_BY_Instanse(TL_TBPID_Override, CRecordTimeOverride) + CREATE_BY_Instanse(TL_TBPID_PathEditRotationAngle, CRecordTimeVariantFloat) + CREATE_BY_Instanse(TL_TBPID_PathEditRotationX, CRecordTimeVariantFloat) + CREATE_BY_Instanse(TL_TBPID_PathEditRotationY, CRecordTimeVariantFloat) + CREATE_BY_Instanse(TL_TBPID_PointsTypes, CRecordTimePointsTypes) + } + + return pRecord; + } }; } diff --git a/MsBinaryFile/PptFile/Records/Animations/VisualPageAtom.h b/MsBinaryFile/PptFile/Records/Animations/VisualPageAtom.h index bf6d717059..1703a27bcc 100644 --- a/MsBinaryFile/PptFile/Records/Animations/VisualPageAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/VisualPageAtom.h @@ -31,17 +31,24 @@ */ #pragma once + #include "../../Reader/Records.h" #include "../../Enums/_includer.h" - namespace PPT_FORMAT { class CRecordVisualPageAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + m_eType = (TimeVisualElementEnum) StreamUtils::ReadDWORD ( pStream ); + } + + +public: TimeVisualElementEnum m_eType; }; diff --git a/MsBinaryFile/PptFile/Records/Animations/VisualShapeAtom.h b/MsBinaryFile/PptFile/Records/Animations/VisualShapeAtom.h index 8ced72392a..651e9f186c 100644 --- a/MsBinaryFile/PptFile/Records/Animations/VisualShapeAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/VisualShapeAtom.h @@ -42,8 +42,19 @@ class CRecordVisualShapeAtom : public CUnknownRecord { public: // Привязка анимации через этот объект к ID объекту - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + m_Type = (TimeVisualElementEnum) StreamUtils::ReadDWORD ( pStream ); + m_RefType = (ElementTypeEnum) StreamUtils::ReadDWORD ( pStream ); + m_nObjectIdRef = StreamUtils::ReadDWORD ( pStream ); + m_nData1 = StreamUtils::ReadDWORD ( pStream ); + m_nData2 = StreamUtils::ReadDWORD ( pStream ); + } + +public: TimeVisualElementEnum m_Type; ElementTypeEnum m_RefType; diff --git a/MsBinaryFile/PptFile/Records/Animations/VisualShapeChartElementAtom.h b/MsBinaryFile/PptFile/Records/Animations/VisualShapeChartElementAtom.h index 7cb425646a..af56b35ea8 100644 --- a/MsBinaryFile/PptFile/Records/Animations/VisualShapeChartElementAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/VisualShapeChartElementAtom.h @@ -40,7 +40,17 @@ namespace PPT_FORMAT class CRecordVisualShapeChartElementAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + m_eType = (TimeVisualElementEnum)StreamUtils::ReadDWORD(pStream); + m_eRefType = (ElementTypeEnum)StreamUtils::ReadDWORD(pStream); + + m_nShapeIdRef = StreamUtils::ReadDWORD(pStream); + m_nData1 = StreamUtils::ReadDWORD(pStream); + m_nData2 = StreamUtils::ReadDWORD(pStream); + } public: TimeVisualElementEnum m_eType; diff --git a/MsBinaryFile/PptFile/Records/Animations/VisualShapeGeneralAtom.h b/MsBinaryFile/PptFile/Records/Animations/VisualShapeGeneralAtom.h index 93cc1228f1..db01eecb88 100644 --- a/MsBinaryFile/PptFile/Records/Animations/VisualShapeGeneralAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/VisualShapeGeneralAtom.h @@ -31,6 +31,7 @@ */ #pragma once + #include "../../Reader/Records.h" #include "../../Enums/_includer.h" @@ -40,14 +41,24 @@ namespace PPT_FORMAT class CRecordVisualShapeGeneralAtom : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + m_eType = (TimeVisualElementEnum)StreamUtils::ReadDWORD(pStream); + m_eRefType = (ElementTypeEnum)StreamUtils::ReadDWORD(pStream); + m_nShapeIdRef = StreamUtils::ReadDWORD(pStream); + m_nData1 = StreamUtils::ReadDWORD(pStream); + m_nData2 = StreamUtils::ReadDWORD(pStream); + } +public: TimeVisualElementEnum m_eType; ElementTypeEnum m_eRefType; _UINT32 m_nShapeIdRef; _INT32 m_nData1; _INT32 m_nData2; + }; } diff --git a/MsBinaryFile/PptFile/Records/Animations/VisualSoundAtom.h b/MsBinaryFile/PptFile/Records/Animations/VisualSoundAtom.h index dacb4726bc..b34844d482 100644 --- a/MsBinaryFile/PptFile/Records/Animations/VisualSoundAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/VisualSoundAtom.h @@ -42,8 +42,19 @@ class CRecordVisualSoundAtom : public CUnknownRecord { public: // Привязка звука через этот объект к ID объекту - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + m_eType = (TimeVisualElementEnum) StreamUtils::ReadDWORD ( pStream ); + m_eRefType = (ElementTypeEnum) StreamUtils::ReadDWORD ( pStream ); + m_nSoundIdRef = StreamUtils::ReadDWORD ( pStream ); + m_nData1 = StreamUtils::ReadDWORD ( pStream ); + m_nData2 = StreamUtils::ReadDWORD ( pStream ); + } + +public: TimeVisualElementEnum m_eType; ElementTypeEnum m_eRefType; diff --git a/MsBinaryFile/PptFile/Records/BlipCollection9Container.h b/MsBinaryFile/PptFile/Records/BlipCollection9Container.h index e0f3ee3b76..28f18444e4 100644 --- a/MsBinaryFile/PptFile/Records/BlipCollection9Container.h +++ b/MsBinaryFile/PptFile/Records/BlipCollection9Container.h @@ -41,7 +41,37 @@ class CRecordBlipCollection9Container : public CUnknownRecord public: std::vector > m_rgBlipEntityAtom; + CRecordBlipCollection9Container() + { + } + + ~CRecordBlipCollection9Container() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); + + _UINT32 lCurLen = 0; + + SRecordHeader ReadHeader; + + while ( lCurLen < m_oHeader.RecLen ) + { + if ( ReadHeader.ReadFromStream(pStream) == false) + break; + + lCurLen += 8 + ReadHeader.RecLen; + + std::shared_ptr pRec(new CRecordBlipEntityAtom); + pRec->ReadFromStream(ReadHeader, pStream); + m_rgBlipEntityAtom.push_back(pRec); + } + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); }; } diff --git a/MsBinaryFile/PptFile/Records/BookmarkEntityAtom.h b/MsBinaryFile/PptFile/Records/BookmarkEntityAtom.h index 47cbc6187f..2c0756a628 100644 --- a/MsBinaryFile/PptFile/Records/BookmarkEntityAtom.h +++ b/MsBinaryFile/PptFile/Records/BookmarkEntityAtom.h @@ -35,8 +35,20 @@ class CRecordBookmarkEntityAtom : public CUnknownRecord { public: - UINT m_nID = 0; + UINT m_nID; std::wstring m_strName; + + CRecordBookmarkEntityAtom() + { + } + + ~CRecordBookmarkEntityAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); }; diff --git a/MsBinaryFile/PptFile/Records/BookmarkSeedAtom.h b/MsBinaryFile/PptFile/Records/BookmarkSeedAtom.h index 6aff1a43f8..9b04809cca 100644 --- a/MsBinaryFile/PptFile/Records/BookmarkSeedAtom.h +++ b/MsBinaryFile/PptFile/Records/BookmarkSeedAtom.h @@ -35,8 +35,19 @@ class CRecordBookmarkSeedAtom : public CUnknownRecord { public: - INT m_nBookmarkID = -1; + INT m_nBookmarkID; + + CRecordBookmarkSeedAtom() + { + } + ~CRecordBookmarkSeedAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/BuildAtom.h b/MsBinaryFile/PptFile/Records/BuildAtom.h index 31871440a3..e6efb23b2e 100644 --- a/MsBinaryFile/PptFile/Records/BuildAtom.h +++ b/MsBinaryFile/PptFile/Records/BuildAtom.h @@ -31,7 +31,6 @@ */ #pragma once #include "../Reader/Records.h" -#include "../Enums/enums.h" enum BuildTypeEnum : _UINT32 { @@ -43,12 +42,32 @@ enum BuildTypeEnum : _UINT32 class CRecordBuildAtom : public CUnknownRecord { public: - BuildTypeEnum m_BuildType = TL_BuildParagraph; - _UINT32 m_BuildId = 0; - _UINT32 m_ShapeIdRef = 0; - bool m_fExpanded = false; - bool m_fUIExpanded = false; + BuildTypeEnum m_BuildType; + _UINT32 m_BuildId; + _UINT32 m_ShapeIdRef; + bool m_fExpanded; + bool m_fUIExpanded; +public: + CRecordBuildAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)override; + ~CRecordBuildAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_BuildType = (BuildTypeEnum)StreamUtils::ReadDWORD(pStream); + m_BuildId = StreamUtils::ReadDWORD(pStream); + m_ShapeIdRef = StreamUtils::ReadDWORD(pStream); + + m_fExpanded = StreamUtils::ReadBYTE(pStream); + m_fUIExpanded = StreamUtils::ReadBYTE(pStream); + + StreamUtils::StreamSkip(2, pStream); + } }; diff --git a/MsBinaryFile/PptFile/Records/CFMasks.h b/MsBinaryFile/PptFile/Records/CFMasks.h index ef59b559c0..f27e86d278 100644 --- a/MsBinaryFile/PptFile/Records/CFMasks.h +++ b/MsBinaryFile/PptFile/Records/CFMasks.h @@ -63,6 +63,40 @@ struct SCFMasks // reserved 5 bits - void ReadFromStream(POLE::Stream* pStream); + void ReadFromStream(POLE::Stream* pStream) + { + BYTE data1 = StreamUtils::ReadBYTE(pStream); + BYTE data2 = StreamUtils::ReadBYTE(pStream); + BYTE data3 = StreamUtils::ReadBYTE(pStream); + BYTE data4 = StreamUtils::ReadBYTE(pStream); + + m_bold = 0x01 == (0x01 & data1); + m_italic = 0x02 == (0x02 & data1); + m_underline = 0x04 == (0x04 & data1); + // unused + m_shadow = 0x10 == (0x10 & data1); + m_fehint = 0x20 == (0x20 & data1); + // unused2 + m_kumi = 0x80 == (0x80 & data1); + // unused3 + + m_emboss = 0x02 == (0x02 & data2); + m_fHasStyle = 0x3C & data2; // 4 bits + // unused 2 bits + + m_typeface = 0x01 == (0x01 & data3); + m_size = 0x02 == (0x02 & data3); + m_color = 0x04 == (0x04 & data3); + m_position = 0x08 == (0x08 & data3); + m_pp10ext = 0x10 == (0x10 & data3); + m_oldEATypeface = 0x20 == (0x20 & data3); + m_ansiTypeface = 0x40 == (0x40 & data3); + m_symbolTypeface = 0x80 == (0x80 & data3); + + m_newEATypeface = 0x01 == (0x01 & data4); + m_csTypeface = 0x02 == (0x02 & data4); + m_pp11ext = 0x04 == (0x04 & data4); + // reserved 5 bits + } }; } diff --git a/MsBinaryFile/PptFile/Records/CString.h b/MsBinaryFile/PptFile/Records/CString.h index c8dde5d4da..003eeb5240 100644 --- a/MsBinaryFile/PptFile/Records/CString.h +++ b/MsBinaryFile/PptFile/Records/CString.h @@ -37,7 +37,19 @@ class CRecordCString : public CUnknownRecord { public: std::wstring m_strText; + + CRecordCString() + { + } + ~CRecordCString() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + m_strText = StreamUtils::ReadStringW(pStream, m_oHeader.RecLen / 2); + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; }; diff --git a/MsBinaryFile/PptFile/Records/ColorSchemeAtom.h b/MsBinaryFile/PptFile/Records/ColorSchemeAtom.h index f3d0faf40c..6074fd520b 100644 --- a/MsBinaryFile/PptFile/Records/ColorSchemeAtom.h +++ b/MsBinaryFile/PptFile/Records/ColorSchemeAtom.h @@ -34,7 +34,6 @@ class CRecordColorSchemeAtom : public CUnknownRecord { -public: SColorAtom m_oBackgroundColor; SColorAtom m_oTextAndLinesColor; SColorAtom m_oShadowsColor; @@ -44,9 +43,72 @@ public: SColorAtom m_oAccentAndHyperlinkColor; SColorAtom m_oAccentAndFollowingHyperlinkColor; +public: + + CRecordColorSchemeAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); + ~CRecordColorSchemeAtom() + { + } - void ToArray(std::vector* pArray); - void ToArray(std::vector* pArray); -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + NSStreamReader::Read(pStream, m_oBackgroundColor); + NSStreamReader::Read(pStream, m_oTextAndLinesColor); + NSStreamReader::Read(pStream, m_oShadowsColor); + NSStreamReader::Read(pStream, m_oTitleTextColor); + NSStreamReader::Read(pStream, m_oFillsColor); + NSStreamReader::Read(pStream, m_oAccentColor); + NSStreamReader::Read(pStream, m_oAccentAndHyperlinkColor); + NSStreamReader::Read(pStream, m_oAccentAndFollowingHyperlinkColor); + } + + void ToArray(std::vector* pArray) + { + if (NULL != pArray) + { + pArray->push_back(m_oBackgroundColor); + pArray->push_back(m_oTextAndLinesColor); + pArray->push_back(m_oShadowsColor); + pArray->push_back(m_oTitleTextColor); + pArray->push_back(m_oFillsColor); + pArray->push_back(m_oAccentColor); + pArray->push_back(m_oAccentAndHyperlinkColor); + pArray->push_back(m_oAccentAndFollowingHyperlinkColor); + } + } + void ToArray(std::vector* pArray) + { + CColor oColor; + if (NULL != pArray) + { + m_oBackgroundColor.ToColor(&oColor); + pArray->push_back(oColor); + + m_oTextAndLinesColor.ToColor(&oColor); + pArray->push_back(oColor); + + m_oShadowsColor.ToColor(&oColor); + pArray->push_back(oColor); + + m_oTitleTextColor.ToColor(&oColor); + pArray->push_back(oColor); + + m_oFillsColor.ToColor(&oColor); + pArray->push_back(oColor); + + m_oAccentColor.ToColor(&oColor); + pArray->push_back(oColor); + + m_oAccentAndHyperlinkColor.ToColor(&oColor); + pArray->push_back(oColor); + + m_oAccentAndFollowingHyperlinkColor.ToColor(&oColor); + pArray->push_back(oColor); + } + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/Comment10Container.h b/MsBinaryFile/PptFile/Records/Comment10Container.h index cf71c0e999..e5364a494e 100644 --- a/MsBinaryFile/PptFile/Records/Comment10Container.h +++ b/MsBinaryFile/PptFile/Records/Comment10Container.h @@ -41,7 +41,12 @@ namespace PPT_FORMAT class CRecordComment10AuthorAtom : public CUnknownRecord { public: - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override + { + m_oHeader = oHeader; + + m_sCommentAuthor = StreamUtils::ReadStringW(pStream, m_oHeader.RecLen); + } public: std::wstring m_sCommentAuthor; @@ -50,7 +55,12 @@ public: class CRecordComment10TextAtom : public CUnknownRecord { public: - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override + { + m_oHeader = oHeader; + + m_sCommentText = StreamUtils::ReadStringW(pStream, m_oHeader.RecLen); + } public: std::wstring m_sCommentText; @@ -59,7 +69,12 @@ public: class CRecordComment10AuthorInitialAtom : public CUnknownRecord { public: - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override + { + m_oHeader = oHeader; + + m_sCommentAuthorInitials = StreamUtils::ReadStringW(pStream, m_oHeader.RecLen); + } public: std::wstring m_sCommentAuthorInitials; @@ -68,10 +83,17 @@ public: class CRecordComment10Atom : public CUnknownRecord { public: - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override + { + m_oHeader = oHeader; + + m_nIndex = StreamUtils::ReadLONG(pStream); + m_oDatetime.ReadFromStream(pStream); + m_oAnchor.ReadFromStream(pStream); + } public: - _INT32 m_nIndex = -1; + _INT32 m_nIndex; DateTimeStruct m_oDatetime; PointStruct m_oAnchor; }; @@ -81,11 +103,70 @@ class CRecordComment10Container : public CUnknownRecord { public: - CRecordComment10Container(); + CRecordComment10Container() : + m_pCommentAuthorAtom(nullptr), + m_pCommentTextAtom(nullptr), + m_pCommentAuthorInitialsAtom(nullptr), - ~CRecordComment10Container(); + m_haveAuthorAtom(false), + m_haveTextAtom(false), + m_haveAuthorInitialAtom(false) + {} - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + ~CRecordComment10Container() + { + RELEASEOBJECT(m_pCommentAuthorAtom) + RELEASEOBJECT(m_pCommentTextAtom) + RELEASEOBJECT(m_pCommentAuthorInitialsAtom) + } + + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override + { + m_oHeader = oHeader; + + LONG lPos(0); StreamUtils::StreamPosition(lPos, pStream); + + _UINT32 lCurLen(0); + SRecordHeader ReadHeader; + + while (lCurLen < m_oHeader.RecLen) { + if ( ReadHeader.ReadFromStream(pStream) == false ) + { + break; + } + + lCurLen += 8 + ReadHeader.RecLen; + + if (ReadHeader.RecType == RT_CString) { + switch (ReadHeader.RecInstance) { + case 0: + m_pCommentAuthorAtom = new CRecordComment10AuthorAtom(); + m_pCommentAuthorAtom->ReadFromStream(ReadHeader, pStream); + m_haveAuthorAtom = true; + break; + case 1: + m_pCommentTextAtom = new CRecordComment10TextAtom(); + m_pCommentTextAtom->ReadFromStream(ReadHeader, pStream); + m_haveTextAtom = true; + break; + + case 2: + m_pCommentAuthorInitialsAtom = new CRecordComment10AuthorInitialAtom(); + m_pCommentAuthorInitialsAtom->ReadFromStream(ReadHeader, pStream); + m_haveAuthorInitialAtom = true; + break; + default: + break; + } + + } else + { + m_oCommentAtom.ReadFromStream(ReadHeader, pStream); + } + } + + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + } public: CRecordComment10AuthorAtom* m_pCommentAuthorAtom; // OPTIONAL diff --git a/MsBinaryFile/PptFile/Records/CurrentUserAtom.h b/MsBinaryFile/PptFile/Records/CurrentUserAtom.h index b25fcc0d81..4f5158b304 100644 --- a/MsBinaryFile/PptFile/Records/CurrentUserAtom.h +++ b/MsBinaryFile/PptFile/Records/CurrentUserAtom.h @@ -55,11 +55,56 @@ public: _UINT32 m_nRelVersion; // 0x00000008 or 0x00000009 - CRecordCurrentUserAtom(); + CRecordCurrentUserAtom() : m_nToken(0) + { + m_nSize = m_nRelVersion = m_nToken = m_nOffsetToCurEdit = 0; + m_nLenUserName = m_nDocFileVersion = 0; + m_nMinorVersion = m_nMajorVersion = 0; - ~CRecordCurrentUserAtom(); + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream * pStream) override; + ~CRecordCurrentUserAtom() + { + } - bool IsSupported() const; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream * pStream) + { + m_oHeader = oHeader; + + m_nSize = StreamUtils::ReadDWORD(pStream); + + long sz = (long)(pStream->size() - pStream->tell()); + + if ((long)m_nSize > sz ) + { + m_nSize = sz ; + } + + if (m_nSize < 16) return; + + m_nToken = StreamUtils::ReadDWORD(pStream); + + m_nOffsetToCurEdit = StreamUtils::ReadDWORD(pStream); + + m_nLenUserName = StreamUtils::ReadWORD(pStream); + + m_nDocFileVersion = StreamUtils::ReadWORD(pStream); + + m_nMajorVersion = StreamUtils::ReadBYTE(pStream); + m_nMinorVersion = StreamUtils::ReadBYTE(pStream); + + StreamUtils::StreamSkip(2, pStream); + + m_strANSIUserName = StreamUtils::ReadStringA(pStream, m_nLenUserName); + + m_nRelVersion = StreamUtils::ReadDWORD(pStream); + + m_strUNICODEUserName = StreamUtils::ReadStringW(pStream, m_nLenUserName ); + + } + + bool IsSupported() + { + return (NO_ENCRYPT == m_nToken); + } }; diff --git a/MsBinaryFile/PptFile/Records/DocInfoListContainer.h b/MsBinaryFile/PptFile/Records/DocInfoListContainer.h index 1d30785d44..d4047d1d77 100644 --- a/MsBinaryFile/PptFile/Records/DocInfoListContainer.h +++ b/MsBinaryFile/PptFile/Records/DocInfoListContainer.h @@ -41,7 +41,31 @@ class DocInfoListSubContainerOrAtom public: nullable m_record; - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream); + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) + { + switch (oHeader.RecType) + { + case RT_ProgTags: + { + m_record.reset(new CRecordDocProgTagsContainer); + m_record->ReadFromStream(oHeader, pStream); + break; + } + case RT_VbaInfo: + { + m_record.reset(new CRecordVBAInfoContainer); + m_record->ReadFromStream(oHeader, pStream); + break; + } +// case RT_OutlineViewInfo: +// { + +// } + default: + StreamUtils::StreamSkip(oHeader.RecLen, pStream); + break; + } + } }; class CRecordDocInfoListContainer : public CUnknownRecord @@ -50,13 +74,74 @@ public: std::vector m_rgChildRec; public: - CRecordDocInfoListContainer(); - virtual ~CRecordDocInfoListContainer() override; + CRecordDocInfoListContainer() + { - virtual void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + } - IRecord* getDocBinaryTagExtension(const std::wstring& extVersion); + virtual ~CRecordDocInfoListContainer() + { + for (auto child : m_rgChildRec) + { + RELEASEOBJECT(child) + } + } - CRecordVBAInfoAtom* getVBAInfoAtom()const; + virtual void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) + { + m_oHeader = oHeader; + + LONG lPos; StreamUtils::StreamPosition(lPos, pStream); + LONG lCurLen = 0; + SRecordHeader ReadHeader; + + while (lCurLen < (LONG)m_oHeader.RecLen) + { + + if (!ReadHeader.ReadFromStream(pStream)) + { + break; + } + + + lCurLen += 8 + ReadHeader.RecLen; + + auto pRec = new DocInfoListSubContainerOrAtom; + pRec->ReadFromStream(ReadHeader, pStream); + m_rgChildRec.push_back(pRec); + } + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + } + + IRecord* getDocBinaryTagExtension(const std::wstring& extVersion) + { + for (auto* pChild : m_rgChildRec) + { + if(pChild == nullptr || pChild->m_record.IsInit() == false) + continue; + + auto* pDocProgTagsCont = dynamic_cast(pChild->m_record.GetPointer()); + if (pDocProgTagsCont == nullptr) + continue; + + return pDocProgTagsCont->getDocBinaryTagExtension(extVersion); + } + return nullptr; + } + + CRecordVBAInfoAtom* getVBAInfoAtom()const + { + for (const auto* pChild : m_rgChildRec) + { + if (!pChild || !pChild->m_record.IsInit()) + continue; + IRecord* pRecord = pChild->m_record.GetPointer(); + auto* pVBA = dynamic_cast(pRecord); + if (pVBA) + return static_cast(pVBA->m_arRecords[0]); + } + + return nullptr; + } }; } diff --git a/MsBinaryFile/PptFile/Records/DocProgTagsContainer.h b/MsBinaryFile/PptFile/Records/DocProgTagsContainer.h index 4688741005..f663f74753 100644 --- a/MsBinaryFile/PptFile/Records/DocProgTagsContainer.h +++ b/MsBinaryFile/PptFile/Records/DocProgTagsContainer.h @@ -55,40 +55,211 @@ public: nullable m_textDefaultsAtom; nullable m_outlineTextPropsContainer; nullable m_blipCollectionContainer; + // TODO + CRecordPP9DocBinaryTagExtension() + { + } - ~CRecordPP9DocBinaryTagExtension(); - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + ~CRecordPP9DocBinaryTagExtension() + { + for (auto pEl : m_rgTextMasterStyleAtom) + { + RELEASEOBJECT(pEl) + } + } + + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); + + UINT lCurLen = 0; + + SRecordHeader ReadHeader; + + while ( lCurLen < m_oHeader.RecLen ) + { + if ( ReadHeader.ReadFromStream(pStream) == false) + break; + + lCurLen += 8 + ReadHeader.RecLen; + switch (ReadHeader.RecType) + { + case RT_TextMasterStyle9Atom: + { + auto pStyle = new CRecordTextMasterStyle9Atom; + pStyle->ReadFromStream(ReadHeader, pStream); + m_rgTextMasterStyleAtom.push_back(pStyle); + break; + } + case RT_TextDefaults9Atom: + { + m_textDefaultsAtom = new CRecordTextDefaults9Atom; + m_textDefaultsAtom->ReadFromStream(ReadHeader, pStream); + break; + } + case RT_OutlineTextProps9: + { + m_outlineTextPropsContainer = new CRecordOutlineTextProps9Container; + m_outlineTextPropsContainer->ReadFromStream(ReadHeader, pStream); + break; + } + case RT_BlipCollection9: + { + m_blipCollectionContainer = new CRecordBlipCollection9Container; + m_blipCollectionContainer->ReadFromStream(ReadHeader, pStream); + break; + } + default: + IRecord* pRecord = CreateByType(ReadHeader); + pRecord->ReadFromStream(ReadHeader, pStream); + + m_arRecords.push_back(pRecord); + break; + } + + } + + StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } }; class CRecordPP10DocBinaryTagExtension : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream )override; + + CRecordPP10DocBinaryTagExtension () + { + } + + virtual ~CRecordPP10DocBinaryTagExtension () + { + + } + + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); + + StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } + +public: + }; class CRecordPP11DocBinaryTagExtension : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ); + CRecordPP11DocBinaryTagExtension() + { + + } + + ~CRecordPP11DocBinaryTagExtension() + { + + } + + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); + + StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } + +public: + }; class CRecordPP12DocBinaryTagExtension : public CUnknownRecord { public: - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + + CRecordPP12DocBinaryTagExtension() + { + + } + + ~CRecordPP12DocBinaryTagExtension() + { + } + + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); + + StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } }; class CRecordDocProgBinaryTagSubContainerOrAtom : public CUnknownRecord { public: - CRecordDocProgBinaryTagSubContainerOrAtom(); - ~CRecordDocProgBinaryTagSubContainerOrAtom(); + CRecordDocProgBinaryTagSubContainerOrAtom() : + m_pTagName(nullptr), m_pTagContainer(nullptr) + {} + ~CRecordDocProgBinaryTagSubContainerOrAtom() + { + RELEASEOBJECT(m_pTagName); + RELEASEOBJECT(m_pTagContainer); + } + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override + { + m_oHeader = oHeader; + LONG lPos = 0; StreamUtils::StreamPosition(lPos, pStream); - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + SRecordHeader ReadHeader; + ReadHeader.ReadFromStream(pStream); + + if (m_oHeader.RecType == RT_ProgBinaryTag) + { + m_pTagName = new CRecordCString(); + m_pTagName->ReadFromStream(ReadHeader, pStream); + + SRecordHeader childHeader; + if (!childHeader.ReadFromStream(pStream)) + return; + + if (m_pTagName->m_strText == ___PPT9) { + m_pTagContainer = new CRecordPP9DocBinaryTagExtension(); + dynamic_cast + (m_pTagContainer)->ReadFromStream(childHeader, pStream); + } else if (m_pTagName->m_strText == ___PPT10) { + m_pTagContainer = new CRecordPP10DocBinaryTagExtension(); + dynamic_cast + (m_pTagContainer)->ReadFromStream(childHeader, pStream); + } else if (m_pTagName->m_strText == ___PPT11) { + m_pTagContainer = new CRecordPP11DocBinaryTagExtension(); + dynamic_cast + (m_pTagContainer)->ReadFromStream(childHeader, pStream); + } else if (m_pTagName->m_strText == ___PPT12) { + m_pTagContainer = new CRecordPP12DocBinaryTagExtension(); + dynamic_cast + (m_pTagContainer)->ReadFromStream(childHeader, pStream); + } + + } else if (m_oHeader.RecType == RT_ProgStringTag) + { + m_pTagContainer = new CRecordProgStringTagContainer(); + dynamic_cast + (m_pTagContainer)->ReadFromStream(ReadHeader, pStream); + } + LONG lSeek = lPos + m_oHeader.RecLen; + StreamUtils::StreamSeek(lSeek, pStream); + } public: CRecordCString* m_pTagName; // OPTIONAL @@ -99,14 +270,59 @@ class CRecordDocProgTagsContainer : public CUnknownRecord { public: - CRecordDocProgTagsContainer (); - ~CRecordDocProgTagsContainer(); + CRecordDocProgTagsContainer () + { + + } + + ~CRecordDocProgTagsContainer() + { + for (auto pEl : m_arrRgChildRec) + RELEASEOBJECT(pEl) + } - virtual void ReadFromStream (SRecordHeader & oHeader, POLE::Stream* pStream)override; + virtual void ReadFromStream (SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; - CRecordPP9DocBinaryTagExtension* getPP9DocBinaryTagExtension(); - IRecord* getDocBinaryTagExtension(const std::wstring& extVersion); + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); + + LONG lCurLen(0); + SRecordHeader ReadHeader; + + while (lCurLen < (LONG)m_oHeader.RecLen) + { + if ( ReadHeader.ReadFromStream(pStream) == false) + break; + lCurLen += 8 + ReadHeader.RecLen; + CRecordDocProgBinaryTagSubContainerOrAtom* pRecord = + new CRecordDocProgBinaryTagSubContainerOrAtom(); + pRecord->ReadFromStream(ReadHeader, pStream); + m_arrRgChildRec.push_back(pRecord); + } + + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + } + + CRecordPP9DocBinaryTagExtension* getPP9DocBinaryTagExtension() + { + for (auto* rec : m_arrRgChildRec) + if (rec->m_pTagName->m_strText == ___PPT9) + return (CRecordPP9DocBinaryTagExtension*)rec->m_pTagContainer; + + return nullptr; + } + + IRecord* getDocBinaryTagExtension(const std::wstring& extVersion) + { + for (auto* rec : m_arrRgChildRec) + if (rec->m_pTagName != nullptr && rec->m_pTagName->m_strText == extVersion) + return rec->m_pTagContainer; + + return nullptr; + } public: std::vector m_arrRgChildRec; diff --git a/MsBinaryFile/PptFile/Records/DocRoutingSlipAtom.h b/MsBinaryFile/PptFile/Records/DocRoutingSlipAtom.h index 8bf234c032..d007407170 100644 --- a/MsBinaryFile/PptFile/Records/DocRoutingSlipAtom.h +++ b/MsBinaryFile/PptFile/Records/DocRoutingSlipAtom.h @@ -51,8 +51,18 @@ public: SDocRoutingSlipAtom m_oRgRecipientRoutingSlipStrings; SDocRoutingSlipAtom m_oSubjectString; SDocRoutingSlipAtom m_oMessageString; + + CRecordDocRoutingSlipAtom() + { + } + ~CRecordDocRoutingSlipAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } }; diff --git a/MsBinaryFile/PptFile/Records/DocumentAtom.h b/MsBinaryFile/PptFile/Records/DocumentAtom.h index a62e8838af..8d3fd87462 100644 --- a/MsBinaryFile/PptFile/Records/DocumentAtom.h +++ b/MsBinaryFile/PptFile/Records/DocumentAtom.h @@ -53,6 +53,37 @@ public: BOOL1 m_bShowComments; + CRecordDocumentAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + ~CRecordDocumentAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_oSlideSize.X = StreamUtils::ReadLONG(pStream); + m_oSlideSize.Y = StreamUtils::ReadLONG(pStream); + + m_oNotesSize.X = StreamUtils::ReadLONG(pStream); + m_oNotesSize.Y = StreamUtils::ReadLONG(pStream); + + m_oServerZoom.Number = StreamUtils::ReadLONG(pStream); + m_oServerZoom.Denom = StreamUtils::ReadLONG(pStream); + + m_nNotesMasterPersistIDRef = (UINT)StreamUtils::ReadDWORD(pStream); + m_nHandoutMasterPersistIDRef = (UINT)StreamUtils::ReadDWORD(pStream); + + m_nFirstSlideNum = StreamUtils::ReadWORD(pStream); + m_nSlideSizeType = StreamUtils::ReadWORD(pStream); + + m_bSaveWithFonts = StreamUtils::ReadBYTE(pStream); + m_bOmitTitlePlace = StreamUtils::ReadBYTE(pStream); + m_bRightToLeft = StreamUtils::ReadBYTE(pStream); + m_bShowComments = StreamUtils::ReadBYTE(pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/DocumentRecords.h b/MsBinaryFile/PptFile/Records/DocumentRecords.h index ab28ab0f83..18c5e6501d 100644 --- a/MsBinaryFile/PptFile/Records/DocumentRecords.h +++ b/MsBinaryFile/PptFile/Records/DocumentRecords.h @@ -39,9 +39,69 @@ public: std::vector m_arNotePersists; std::vector m_arSlidePersists; + CRecordDocument() + { + } - CRecordDocument(); - ~CRecordDocument(); + ~CRecordDocument() + { + m_arMasterPersists.clear(); + m_arNotePersists.clear(); + m_arSlidePersists.clear(); + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_arMasterPersists.clear(); + m_arNotePersists.clear(); + m_arSlidePersists.clear(); + + m_arRecords.clear(); + + CRecordsContainer::ReadFromStream(oHeader, pStream); + + std::vector oArraySlideWithText; + this->GetRecordsByType(&oArraySlideWithText, true, false); + + for (size_t nIndexList = 0; nIndexList < oArraySlideWithText.size(); ++nIndexList) + { + CRecordSlideListWithText* pAtom = oArraySlideWithText[nIndexList]; + std::vector* pArray = NULL; + + switch (pAtom->m_Type) + { + case CRecordSlideListWithText::CollectionOfMasterSlides: + { + pArray = &m_arMasterPersists; + }break; + case CRecordSlideListWithText::CollectionOfNotesSlides: + { + pArray = &m_arNotePersists; + }break; + case CRecordSlideListWithText::CollectionOfSlides: + { + pArray = &m_arSlidePersists; + }break; + default: + { + // этого не может быть... + continue; + } + }; + + size_t nCountItems = pAtom->m_arSlides.size(); + for (size_t index = 0; index < nCountItems; ++index) + { + SSlidePersist oPersist; + oPersist.m_nPsrRef = pAtom->m_arSlides[index]->m_nPsrRef; + oPersist.m_nSlideID = pAtom->m_arSlides[index]->m_nSlideID; + + oPersist.m_arTextAttrs.insert(oPersist.m_arTextAttrs.end(), pAtom->m_arTextPlaceHolders[index].begin(),pAtom->m_arTextPlaceHolders[index].end()); + + pArray->push_back(oPersist); + } + } + } }; diff --git a/MsBinaryFile/PptFile/Records/DocumentTextInfo.h b/MsBinaryFile/PptFile/Records/DocumentTextInfo.h index dec3c42165..d739cf40f2 100644 --- a/MsBinaryFile/PptFile/Records/DocumentTextInfo.h +++ b/MsBinaryFile/PptFile/Records/DocumentTextInfo.h @@ -35,11 +35,37 @@ class CRecordDocumentTextInfo : public CRecordsContainer { public: - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + + CRecordDocumentTextInfo() + { + } + + ~CRecordDocumentTextInfo() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + CRecordsContainer::ReadFromStream(oHeader, pStream); + } + }; class CRecordFontCollection : public CRecordsContainer { public: - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + + CRecordFontCollection() + { + } + + ~CRecordFontCollection() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + CRecordsContainer::ReadFromStream(oHeader, pStream); + } + }; diff --git a/MsBinaryFile/PptFile/Records/Drawing/ArtBlip.cpp b/MsBinaryFile/PptFile/Records/Drawing/ArtBlip.cpp index afaa7bd89e..aaf1c92a72 100644 --- a/MsBinaryFile/PptFile/Records/Drawing/ArtBlip.cpp +++ b/MsBinaryFile/PptFile/Records/Drawing/ArtBlip.cpp @@ -237,18 +237,3 @@ void CRecordOfficeArtBlip::ReadFromStream(SRecordHeader & oHeader, POLE::Stream* m_sFileName = strFile; } } - -CRecordBitmapBlip::CRecordBitmapBlip() -{ - -} - -CRecordBitmapBlip::~CRecordBitmapBlip() -{ - -} - -void CRecordBitmapBlip::ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) -{ - return CUnknownRecord::ReadFromStream(oHeader, pStream); -} diff --git a/MsBinaryFile/PptFile/Records/Drawing/ArtBlip.h b/MsBinaryFile/PptFile/Records/Drawing/ArtBlip.h index 3720172b83..3c1a9bdbcb 100644 --- a/MsBinaryFile/PptFile/Records/Drawing/ArtBlip.h +++ b/MsBinaryFile/PptFile/Records/Drawing/ArtBlip.h @@ -65,7 +65,17 @@ public: //BYTE* m_pScan0; - CRecordBitmapBlip(); - ~CRecordBitmapBlip(); - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); -}; + CRecordBitmapBlip() + { + } + + ~CRecordBitmapBlip() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/Drawing/BlipStoreContainer.h b/MsBinaryFile/PptFile/Records/Drawing/BlipStoreContainer.h index 2cb68e1c35..82b12cdb77 100644 --- a/MsBinaryFile/PptFile/Records/Drawing/BlipStoreContainer.h +++ b/MsBinaryFile/PptFile/Records/Drawing/BlipStoreContainer.h @@ -31,11 +31,45 @@ */ #pragma once #include "../../Reader/Records.h" +#include "BlipStoreEntry.h" class CRecordBlipStoreContainer : public CRecordsContainer { public: - CRecordBlipStoreContainer(); - ~CRecordBlipStoreContainer(); - void SetUpPicturesInfos(std::vector* pArray); + + CRecordBlipStoreContainer() + { + } + + ~CRecordBlipStoreContainer() + { + } + + void SetUpPicturesInfos(std::vector* pArray) + { + if (NULL == pArray) + return; + + pArray->clear(); + + std::map<_UINT32, int> image_map; + for (size_t nIndex = 0; nIndex < m_arRecords.size(); ++nIndex) + { + CRecordBlipStoreEntry* pEntry = dynamic_cast(m_arRecords[nIndex]); + if (NULL != pEntry) + { + image_map.insert(std::pair<_UINT32, int>(pEntry->m_nFoDelay, pArray->size())); + + int offset = pEntry->m_nFoDelay; + if (0 == pEntry->m_oHeader.RecInstance) offset = -1; + + if (pEntry->m_oHeader.RecType == 0xf007) + { + //inside here? + } + + pArray->push_back(offset); + } + } + } }; diff --git a/MsBinaryFile/PptFile/Records/Drawing/BlipStoreEntry.h b/MsBinaryFile/PptFile/Records/Drawing/BlipStoreEntry.h index ced9aa1fab..e1d976eb31 100644 --- a/MsBinaryFile/PptFile/Records/Drawing/BlipStoreEntry.h +++ b/MsBinaryFile/PptFile/Records/Drawing/BlipStoreEntry.h @@ -50,8 +50,34 @@ public: BYTE m_nUnused2; BYTE m_nUnused3; - CRecordBlipStoreEntry(); - ~CRecordBlipStoreEntry(); + CRecordBlipStoreEntry() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); -}; + ~CRecordBlipStoreEntry() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_btWin32 = (ODRAW::eBlipType)StreamUtils::ReadBYTE(pStream); + m_btMacOS = (ODRAW::eBlipType)StreamUtils::ReadBYTE(pStream); + + pStream->read(m_pRgbUid, 16); + + m_nTag = StreamUtils::ReadWORD(pStream); + + m_nSize = StreamUtils::ReadDWORD(pStream); + m_nCountRef = StreamUtils::ReadDWORD(pStream); + m_nFoDelay = StreamUtils::ReadDWORD(pStream); + + m_eUsage = (ODRAW::eBlipUsage)StreamUtils::ReadBYTE(pStream); + + m_nLenName = StreamUtils::ReadBYTE(pStream); + + m_nUnused2 = StreamUtils::ReadBYTE(pStream); + m_nUnused3 = StreamUtils::ReadBYTE(pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/Drawing/ChildAnchor.h b/MsBinaryFile/PptFile/Records/Drawing/ChildAnchor.h index b2656a1de0..8b9744a3a6 100644 --- a/MsBinaryFile/PptFile/Records/Drawing/ChildAnchor.h +++ b/MsBinaryFile/PptFile/Records/Drawing/ChildAnchor.h @@ -32,7 +32,6 @@ #pragma once #include "../../Reader/Records.h" - class CRecordChildAnchor : public CUnknownRecord { public: @@ -40,8 +39,20 @@ public: public: - CRecordChildAnchor(); - ~CRecordChildAnchor(); + CRecordChildAnchor() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); -}; + ~CRecordChildAnchor() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + m_oBounds.left = StreamUtils::ReadLONG(pStream); + m_oBounds.top = StreamUtils::ReadLONG(pStream); + m_oBounds.right = StreamUtils::ReadLONG(pStream); + m_oBounds.bottom = StreamUtils::ReadLONG(pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/Drawing/ClientAnchor.h b/MsBinaryFile/PptFile/Records/Drawing/ClientAnchor.h index 6739c562b2..d1fd5f4076 100644 --- a/MsBinaryFile/PptFile/Records/Drawing/ClientAnchor.h +++ b/MsBinaryFile/PptFile/Records/Drawing/ClientAnchor.h @@ -37,7 +37,34 @@ class CRecordClientAnchor : public CUnknownRecord public: SRectAtom m_oBounds; - CRecordClientAnchor(); - ~CRecordClientAnchor(); - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); -}; +public: + + CRecordClientAnchor() + { + } + + ~CRecordClientAnchor() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + if (m_oHeader.RecLen == 0x00000008) //SSmallRectAtom + { + m_oBounds.Top = StreamUtils::ReadSHORT(pStream); + m_oBounds.Left = StreamUtils::ReadSHORT(pStream); + m_oBounds.Right = StreamUtils::ReadSHORT(pStream); + m_oBounds.Bottom = StreamUtils::ReadSHORT(pStream); + } + if (m_oHeader.RecLen == 0x00000010) //SRectAtom + { + m_oBounds.Top = StreamUtils::ReadLONG(pStream); + m_oBounds.Left = StreamUtils::ReadLONG(pStream); + m_oBounds.Right = StreamUtils::ReadLONG(pStream); + m_oBounds.Bottom = StreamUtils::ReadLONG(pStream); + } + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/Drawing/DrawingContainer.h b/MsBinaryFile/PptFile/Records/Drawing/DrawingContainer.h index 5c8ccfa78a..9d357692fa 100644 --- a/MsBinaryFile/PptFile/Records/Drawing/DrawingContainer.h +++ b/MsBinaryFile/PptFile/Records/Drawing/DrawingContainer.h @@ -32,14 +32,21 @@ #pragma once #include "GroupShapeContainer.h" - class CRecordDrawingContainer : public CRecordsContainer { public: - CRecordDrawingContainer(); - ~CRecordDrawingContainer(); + CRecordDrawingContainer() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); + ~CRecordDrawingContainer() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + CRecordsContainer::ReadFromStream(oHeader, pStream); + } }; diff --git a/MsBinaryFile/PptFile/Records/Drawing/DrawingGroup.h b/MsBinaryFile/PptFile/Records/Drawing/DrawingGroup.h index fde2f9a5f3..9f0db15cd1 100644 --- a/MsBinaryFile/PptFile/Records/Drawing/DrawingGroup.h +++ b/MsBinaryFile/PptFile/Records/Drawing/DrawingGroup.h @@ -32,7 +32,6 @@ #pragma once #include "../../Reader/Records.h" - class CRecordDrawingGroup : public CUnknownRecord { UINT m_nMaxShapeId; // Maximum shape ID @@ -43,8 +42,31 @@ class CRecordDrawingGroup : public CUnknownRecord std::vector m_arrIDs; public: - CRecordDrawingGroup(); - ~CRecordDrawingGroup(); + + CRecordDrawingGroup() : m_arrIDs() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); -}; + ~CRecordDrawingGroup() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_nMaxShapeId = (UINT)StreamUtils::ReadDWORD(pStream); + m_nIdClustersCount = (UINT)StreamUtils::ReadDWORD(pStream) - 1; // Office saves the actual value + 1 + m_nShapesSavedCount = (UINT)StreamUtils::ReadDWORD(pStream); + m_nDrawingsSavedCount = (UINT)StreamUtils::ReadDWORD(pStream); + + m_arrIDs.clear(); + for (UINT nIndex = 0; nIndex < m_nIdClustersCount; ++nIndex) + { + SFileIdCluster elm; + m_arrIDs.push_back(elm); + m_arrIDs[nIndex].ReadFromStream(pStream); + } + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/Drawing/DrawingRecord.h b/MsBinaryFile/PptFile/Records/Drawing/DrawingRecord.h index 0b1c2af1d8..9e9f1dece8 100644 --- a/MsBinaryFile/PptFile/Records/Drawing/DrawingRecord.h +++ b/MsBinaryFile/PptFile/Records/Drawing/DrawingRecord.h @@ -32,7 +32,6 @@ #pragma once #include "../../Reader/Records.h" - class CRecordDrawingRecord : public CUnknownRecord { public: @@ -41,8 +40,18 @@ public: UINT m_nPidCur; - CRecordDrawingRecord(); - ~CRecordDrawingRecord(); + CRecordDrawingRecord() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); + ~CRecordDrawingRecord() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + m_nCountShapes = (UINT)StreamUtils::ReadDWORD(pStream); + m_nPidCur = (UINT)StreamUtils::ReadDWORD(pStream); + } }; diff --git a/MsBinaryFile/PptFile/Records/Drawing/GroupShape.h b/MsBinaryFile/PptFile/Records/Drawing/GroupShape.h index 89108c4a64..b77d1477c4 100644 --- a/MsBinaryFile/PptFile/Records/Drawing/GroupShape.h +++ b/MsBinaryFile/PptFile/Records/Drawing/GroupShape.h @@ -32,15 +32,27 @@ #pragma once #include "../../Reader/Records.h" - class CRecordGroupShape : public CUnknownRecord { public: RECT m_oBounds; - CRecordGroupShape(); - ~CRecordGroupShape(); + CRecordGroupShape() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); + ~CRecordGroupShape() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_oBounds.left = StreamUtils::ReadLONG(pStream); + m_oBounds.top = StreamUtils::ReadLONG(pStream); + m_oBounds.right = StreamUtils::ReadLONG(pStream); + m_oBounds.bottom = StreamUtils::ReadLONG(pStream); + } }; diff --git a/MsBinaryFile/PptFile/Records/Drawing/Shape.h b/MsBinaryFile/PptFile/Records/Drawing/Shape.h index 10d471f965..e70145615b 100644 --- a/MsBinaryFile/PptFile/Records/Drawing/Shape.h +++ b/MsBinaryFile/PptFile/Records/Drawing/Shape.h @@ -53,8 +53,40 @@ public: public: - CRecordShape(); - ~CRecordShape(); + CRecordShape() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); -}; + ~CRecordShape() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + m_nID = (UINT)StreamUtils::ReadDWORD(pStream); + + UINT nFlag = (UINT)StreamUtils::ReadDWORD(pStream); + + m_bGroup = ((nFlag & 0x01) == 0x01); + m_bChild = ((nFlag & 0x02) == 0x02); + m_bPatriarch = ((nFlag & 0x04) == 0x04); + m_bDeleted = ((nFlag & 0x08) == 0x08); + m_bOleShape = ((nFlag & 0x10) == 0x10); + m_bHaveMaster = ((nFlag & 0x20) == 0x20); + m_bFlipH = ((nFlag & 0x40) == 0x40); + m_bFlipV = ((nFlag & 0x80) == 0x80); + m_bConnector = ((nFlag & 0x0100) == 0x0100); + m_bHaveAnchor = ((nFlag & 0x0200) == 0x0200); + m_bBackground = ((nFlag & 0x0400) == 0x0400); + m_bHaveSpt = ((nFlag & 0x0800) == 0x0800); + + LONG lSize = m_oHeader.RecLen - 8; + if (lSize > 0) + { + StreamUtils::StreamSkip(lSize, pStream); + } + + m_nShapeID = m_oHeader.RecInstance; + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/Drawing/ShapeContainer.cpp b/MsBinaryFile/PptFile/Records/Drawing/ShapeContainer.cpp index e7ac0e5d08..31d7d328f7 100644 --- a/MsBinaryFile/PptFile/Records/Drawing/ShapeContainer.cpp +++ b/MsBinaryFile/PptFile/Records/Drawing/ShapeContainer.cpp @@ -1506,25 +1506,6 @@ void CPPTElement::SetUpPropertyShape(CElementPtr pElement, CTheme* pTheme, CSlid } -CRecordShapeContainer::CRecordShapeContainer() -{ - bGroupShape = false; - - m_pStream = NULL; - -} - -CRecordShapeContainer::~CRecordShapeContainer() -{ - m_pStream = NULL; -} - -void CRecordShapeContainer::ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) -{ - m_pStream = pStream; - CRecordsContainer::ReadFromStream(oHeader, pStream); -} - CElementPtr CRecordShapeContainer::GetElement (bool inGroup, CExMedia* pMapIDs, CTheme* pTheme, CLayout* pLayout, CSlideInfo* pThemeWrapper, CSlideInfo* pSlideWrapper, CSlide* pSlide) @@ -2076,36 +2057,6 @@ CElementPtr CRecordShapeContainer::GetElement (bool inGroup, CExMedia* pMapIDs, return pElement; } -PPT_FORMAT::ElementType CRecordShapeContainer::GetTypeElem(eSPT eType) -{ - switch (eType) - { - //case sptMin: - case sptMax: - case sptNil: - { - return etShape; - } - case sptPictureFrame: - { - return etPicture; - } - default: - { - return etShape; - } - }; - return etShape; -} - -std::wstring CRecordShapeContainer::GetFileName(std::wstring strFilePath) -{ - int nIndex = strFilePath.rfind(wchar_t('\\')); - if (-1 != nIndex) - return strFilePath.substr(nIndex + 1); - else - return strFilePath; -} bool CRecordShapeContainer::isTable() const { std::vector oArrayOptions; diff --git a/MsBinaryFile/PptFile/Records/Drawing/ShapeContainer.h b/MsBinaryFile/PptFile/Records/Drawing/ShapeContainer.h index 3bf107f3d3..a427ace96d 100644 --- a/MsBinaryFile/PptFile/Records/Drawing/ShapeContainer.h +++ b/MsBinaryFile/PptFile/Records/Drawing/ShapeContainer.h @@ -84,18 +84,60 @@ public: bool bGroupShape; - CRecordShapeContainer(); + CRecordShapeContainer() + { + bGroupShape = false; - ~CRecordShapeContainer(); + m_pStream = NULL; + + } + + ~CRecordShapeContainer() + { + m_pStream = NULL; + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_pStream = pStream; + CRecordsContainer::ReadFromStream(oHeader, pStream); + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); CElementPtr GetElement (bool inGroup, CExMedia* pMapIDs, CTheme* pTheme, CLayout* pLayout, CSlideInfo* pThemeWrapper, CSlideInfo* pSlideWrapper, CSlide* pSlide = NULL); - PPT_FORMAT::ElementType GetTypeElem(eSPT eType); - std::wstring GetFileName(std::wstring strFilePath); + PPT_FORMAT::ElementType GetTypeElem(eSPT eType) + { + switch (eType) + { + //case sptMin: + case sptMax: + case sptNil: + { + return etShape; + } + case sptPictureFrame: + { + return etPicture; + } + default: + { + return etShape; + } + }; + return etShape; + } + AVSINLINE std::wstring GetFileName(std::wstring strFilePath) + { + int nIndex = strFilePath.rfind(wchar_t('\\')); + if (-1 != nIndex) + { + return strFilePath.substr(nIndex + 1); + } + return strFilePath; + } protected: diff --git a/MsBinaryFile/PptFile/Records/Drawing/ShapeProperties.h b/MsBinaryFile/PptFile/Records/Drawing/ShapeProperties.h index 16939ebc6f..94198ae716 100644 --- a/MsBinaryFile/PptFile/Records/Drawing/ShapeProperties.h +++ b/MsBinaryFile/PptFile/Records/Drawing/ShapeProperties.h @@ -34,14 +34,31 @@ #include "../../Reader/Records.h" #include "../../../Common/Vml/PPTShape/ElementSettings.h" - class CRecordShapeProperties : public CUnknownRecord { public: CProperties m_oProperties; - CRecordShapeProperties(); - ~CRecordShapeProperties(); + CRecordShapeProperties() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); + ~CRecordShapeProperties() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + LONG lPosition = 0; + StreamUtils::StreamPosition(lPosition, pStream); + + m_oProperties.FromStream(pStream, m_oHeader.RecInstance); + _UINT32 dwLen = m_oProperties.GetLen(); + + // это на всякий случай, может там напридумывают проперти с complex - + // которые мы не поддерживаем... + StreamUtils::StreamSeek(lPosition + m_oHeader.RecLen, pStream); + } }; diff --git a/MsBinaryFile/PptFile/Records/Drawing/TextBox.h b/MsBinaryFile/PptFile/Records/Drawing/TextBox.h index e2976a2843..047aeb2b83 100644 --- a/MsBinaryFile/PptFile/Records/Drawing/TextBox.h +++ b/MsBinaryFile/PptFile/Records/Drawing/TextBox.h @@ -35,8 +35,18 @@ class CRecordTextBox : public CUnknownRecord { public: - CRecordTextBox(); - ~CRecordTextBox(); + + CRecordTextBox() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); -}; + ~CRecordTextBox() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/EndDocument.h b/MsBinaryFile/PptFile/Records/EndDocument.h index ca26ee96f1..5c944882b1 100644 --- a/MsBinaryFile/PptFile/Records/EndDocument.h +++ b/MsBinaryFile/PptFile/Records/EndDocument.h @@ -35,5 +35,17 @@ class CRecordEndDocument : public CUnknownRecord { public: - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + + CRecordEndDocument() + { + } + + ~CRecordEndDocument() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/ExCDAudioContainer.h b/MsBinaryFile/PptFile/Records/ExCDAudioContainer.h index ed1721c0d1..6079ad4781 100644 --- a/MsBinaryFile/PptFile/Records/ExCDAudioContainer.h +++ b/MsBinaryFile/PptFile/Records/ExCDAudioContainer.h @@ -37,9 +37,41 @@ class CRecordExCDAudioContainer : public CRecordsContainer public: CRecordExMediaAtom m_oMedia; - double m_dStartTime = .0; - double m_dEndTime = .0; + double m_dStartTime; + double m_dEndTime; + CRecordExCDAudioContainer() + { + m_dStartTime = 0; + m_dEndTime = 0; + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + ~CRecordExCDAudioContainer() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + SRecordHeader oExHeader; + oExHeader.ReadFromStream(pStream); + + m_oMedia.ReadFromStream(oExHeader, pStream); + + StreamUtils::StreamSkip(8, pStream); + + BYTE nTrack1 = StreamUtils::ReadBYTE(pStream); + BYTE nMinute1 = StreamUtils::ReadBYTE(pStream); + BYTE nSecond1 = StreamUtils::ReadBYTE(pStream); + BYTE nFrame1 = StreamUtils::ReadBYTE(pStream); + + BYTE nTrack2 = StreamUtils::ReadBYTE(pStream); + BYTE nMinute2 = StreamUtils::ReadBYTE(pStream); + BYTE nSecond2 = StreamUtils::ReadBYTE(pStream); + BYTE nFrame2 = StreamUtils::ReadBYTE(pStream); + + m_dStartTime = 60000 * nMinute1 + 1000 * nSecond1; + m_dEndTime = 60000 * nMinute2 + 1000 * nSecond2; + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/ExControlAtom.h b/MsBinaryFile/PptFile/Records/ExControlAtom.h index 2edc1917b4..4d0d075c2b 100644 --- a/MsBinaryFile/PptFile/Records/ExControlAtom.h +++ b/MsBinaryFile/PptFile/Records/ExControlAtom.h @@ -34,9 +34,22 @@ class CRecordExControlAtom : public CUnknownRecord { + UINT m_nSlideIdRef; + public: - UINT m_nSlideIdRef = 0; + + CRecordExControlAtom() + { + } + ~CRecordExControlAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_nSlideIdRef = StreamUtils::ReadDWORD(pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/ExHyperlinkAtom.h b/MsBinaryFile/PptFile/Records/ExHyperlinkAtom.h index 6b7333756f..79b62c0e84 100644 --- a/MsBinaryFile/PptFile/Records/ExHyperlinkAtom.h +++ b/MsBinaryFile/PptFile/Records/ExHyperlinkAtom.h @@ -39,10 +39,22 @@ class CRecordExHyperlinkAtom : public CUnknownRecord { public: - UINT m_nHyperlinkID = 0; + UINT m_nHyperlinkID; + CRecordExHyperlinkAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordExHyperlinkAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_nHyperlinkID = StreamUtils::ReadDWORD(pStream); + } }; class CRecordExHyperlinkContainer : public CRecordsContainer @@ -53,8 +65,48 @@ public: nullable m_targetAtom; nullable m_locationAtom; + CRecordExHyperlinkContainer() + { + } - bool hasCString()const; + ~CRecordExHyperlinkContainer() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + bool hasCString()const + { + return m_friendlyNameAtom.IsInit() || m_targetAtom.IsInit() || m_locationAtom.IsInit(); + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + SRecordHeader header; + + header.ReadFromStream(pStream); + m_exHyperlinkAtom.ReadFromStream(header, pStream); + + unsigned currentLen = 12; // 12(atom) + while (currentLen < m_oHeader.RecLen) + { + header.ReadFromStream(pStream); + auto* pCString = new CRecordCString; + pCString->ReadFromStream(header, pStream); + switch (header.RecInstance) + { + case 0: m_friendlyNameAtom = pCString; break; + case 1: m_targetAtom = pCString; break; + case 3: m_locationAtom = pCString; break; + default: delete pCString; + } + currentLen += 8 + header.RecLen; // headerLen + CStringLen + } +// if (m_friendlyNameAtom.IsInit() && (int)m_friendlyNameAtom->m_strText.find(L"NEXT") == -1) +// std::wcout << m_exHyperlinkAtom.m_nHyperlinkID << L" " +// << (m_friendlyNameAtom.IsInit() ? m_friendlyNameAtom->m_strText : L"-") << L" " +// << (m_targetAtom.IsInit() ? m_targetAtom->m_strText : L"-") << L" " +// << (m_locationAtom.IsInit() ? m_locationAtom->m_strText : L"-") +// << std::endl; + } }; diff --git a/MsBinaryFile/PptFile/Records/ExMIDIAudioContainer.h b/MsBinaryFile/PptFile/Records/ExMIDIAudioContainer.h index d45caf3a16..3c0b97b0f7 100644 --- a/MsBinaryFile/PptFile/Records/ExMIDIAudioContainer.h +++ b/MsBinaryFile/PptFile/Records/ExMIDIAudioContainer.h @@ -35,5 +35,17 @@ class CRecordExMIDIAudioContainer : public CRecordsContainer { public: - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + + CRecordExMIDIAudioContainer() + { + } + + ~CRecordExMIDIAudioContainer() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + CRecordsContainer::ReadFromStream(oHeader, pStream); + } }; diff --git a/MsBinaryFile/PptFile/Records/ExMediaAtom.h b/MsBinaryFile/PptFile/Records/ExMediaAtom.h index 0707a26d0d..4f622ccc2a 100644 --- a/MsBinaryFile/PptFile/Records/ExMediaAtom.h +++ b/MsBinaryFile/PptFile/Records/ExMediaAtom.h @@ -35,12 +35,34 @@ class CRecordExMediaAtom : public CUnknownRecord { public: - _UINT32 m_nExObjID = 0; + _UINT32 m_nExObjID; - bool m_bLoop = false; - bool m_bRewind = false; - bool m_bNarration = false; + bool m_bLoop; + bool m_bRewind; + bool m_bNarration; +public: + + CRecordExMediaAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); -}; + ~CRecordExMediaAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_nExObjID = StreamUtils::ReadDWORD(pStream); + + USHORT nFlag = StreamUtils::ReadWORD(pStream); + + m_bLoop = ((nFlag & 0x01) == 0x01); + m_bRewind = ((nFlag & 0x02) == 0x02); + m_bNarration = ((nFlag & 0x04) == 0x04); + + StreamUtils::StreamSkip(2, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/ExObjListAtom.h b/MsBinaryFile/PptFile/Records/ExObjListAtom.h index 6bb97d7059..3705c484a9 100644 --- a/MsBinaryFile/PptFile/Records/ExObjListAtom.h +++ b/MsBinaryFile/PptFile/Records/ExObjListAtom.h @@ -35,8 +35,21 @@ class CRecordExObjListAtom : public CUnknownRecord { public: - _INT32 m_nObjectIdSeed = -1; + INT m_nObjectIdSeed; + CRecordExObjListAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + ~CRecordExObjListAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_nObjectIdSeed = StreamUtils::ReadDWORD(pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/ExObjListContainer.h b/MsBinaryFile/PptFile/Records/ExObjListContainer.h index 023ca847fd..7631d4ac28 100644 --- a/MsBinaryFile/PptFile/Records/ExObjListContainer.h +++ b/MsBinaryFile/PptFile/Records/ExObjListContainer.h @@ -35,5 +35,17 @@ class CRecordExObjListContainer : public CRecordsContainer { public: - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + + CRecordExObjListContainer() + { + } + + ~CRecordExObjListContainer() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + CRecordsContainer::ReadFromStream(oHeader, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/ExObjRefAtom.h b/MsBinaryFile/PptFile/Records/ExObjRefAtom.h index 20d84687bb..c3695f9a27 100644 --- a/MsBinaryFile/PptFile/Records/ExObjRefAtom.h +++ b/MsBinaryFile/PptFile/Records/ExObjRefAtom.h @@ -35,8 +35,19 @@ class CRecordExObjRefAtom : public CUnknownRecord { public: - _UINT32 m_nExObjID = 0; + _UINT32 m_nExObjID; + CRecordExObjRefAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + ~CRecordExObjRefAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + m_nExObjID = StreamUtils::ReadDWORD(pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/ExOleEmbedAtom.h b/MsBinaryFile/PptFile/Records/ExOleEmbedAtom.h index 47aaa71986..89393c3bcf 100644 --- a/MsBinaryFile/PptFile/Records/ExOleEmbedAtom.h +++ b/MsBinaryFile/PptFile/Records/ExOleEmbedAtom.h @@ -39,7 +39,23 @@ public: BOOL1 m_nCantLockServer; BOOL1 m_nNoSizeToServer; BOOL1 m_nIsTable; + + CRecordExOleEmbedAtom() + { + } + ~CRecordExOleEmbedAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_nColorFollow = StreamUtils::ReadLONG(pStream); + m_nCantLockServer = StreamUtils::ReadBYTE(pStream); + m_nNoSizeToServer = StreamUtils::ReadBYTE(pStream); + m_nIsTable = StreamUtils::ReadBYTE(pStream); + StreamUtils::StreamSkip(1, pStream); + } }; diff --git a/MsBinaryFile/PptFile/Records/ExOleLinkAtom.h b/MsBinaryFile/PptFile/Records/ExOleLinkAtom.h index 9405816737..734f2118c5 100644 --- a/MsBinaryFile/PptFile/Records/ExOleLinkAtom.h +++ b/MsBinaryFile/PptFile/Records/ExOleLinkAtom.h @@ -37,7 +37,17 @@ class CRecordExOleLinkAtom : public CUnknownRecord public: UINT m_nSlideID; UINT m_nOleUpdateMode; + + CRecordExOleLinkAtom() + { + } + ~CRecordExOleLinkAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/ExOleObjAtom.h b/MsBinaryFile/PptFile/Records/ExOleObjAtom.h index aa4d6da3e7..028ec545c7 100644 --- a/MsBinaryFile/PptFile/Records/ExOleObjAtom.h +++ b/MsBinaryFile/PptFile/Records/ExOleObjAtom.h @@ -34,25 +34,99 @@ class CRecordExOleObjAtom : public CUnknownRecord { -public: UINT m_nDrawAspect; UINT m_nType; UINT m_nExObjID; UINT m_nSubType; UINT m_nPersistID; +public: + + CRecordExOleObjAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordExOleObjAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_nDrawAspect = StreamUtils::ReadDWORD(pStream); + m_nType = StreamUtils::ReadDWORD(pStream); + m_nExObjID = StreamUtils::ReadDWORD(pStream); + m_nSubType = StreamUtils::ReadDWORD(pStream); + m_nPersistID = StreamUtils::ReadDWORD(pStream); + + StreamUtils::StreamSkip ( 4, pStream ); //unused + } }; - class CRecordExOleObjStg : public CUnknownRecord { public: std::wstring m_sFileName; std::wstring m_strTmpDirectory; - CRecordExOleObjStg(std::wstring strTemp); - ~CRecordExOleObjStg(); + CRecordExOleObjStg(std::wstring strTemp) : m_strTmpDirectory(strTemp) + { + } + + ~CRecordExOleObjStg() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + ULONG decompressedSize = m_oHeader.RecLen, compressedSize = m_oHeader.RecLen; + + if (m_oHeader.RecInstance == 0x01) + { + compressedSize = m_oHeader.RecLen - 4; + decompressedSize = StreamUtils::ReadDWORD(pStream); + } + + BYTE* pData = (compressedSize > 0 && compressedSize < 0xffffff ) ? new BYTE[compressedSize] : NULL; + + if (!pData) return; + + compressedSize = pStream->read(pData, compressedSize); + + if (m_oHeader.RecInstance == 0x01) + { + BYTE* pDataUncompress = (compressedSize > 0 && compressedSize < 0xffffff) ? new BYTE[decompressedSize + 64] : NULL; + if ((pDataUncompress) && (NSZip::Decompress(pData, compressedSize, pDataUncompress, decompressedSize))) + { + delete []pData; + pData = pDataUncompress; + } + else + { + delete []pData; + pData = NULL; + } + } + //if (pDecryptor) + //{ + // pDecryptor->Decrypt((char*)pData, oHeader.RecLen - lOffset, 0); + //} + if (pData) + { + m_sFileName = m_strTmpDirectory + FILE_SEPARATOR_STR + L"oleObject_xxx.bin"; + + NSFile::CFileBinary file; + if (file.CreateFileW(m_sFileName)) + { + file.WriteFile(pData, decompressedSize); + file.CloseFile(); + } + delete[] pData; + pData = NULL; + } + + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; }; diff --git a/MsBinaryFile/PptFile/Records/ExVideoContainer.h b/MsBinaryFile/PptFile/Records/ExVideoContainer.h index 33d44386c2..eba08538c4 100644 --- a/MsBinaryFile/PptFile/Records/ExVideoContainer.h +++ b/MsBinaryFile/PptFile/Records/ExVideoContainer.h @@ -35,5 +35,17 @@ class CRecordExVideoContainer : public CRecordsContainer { public: - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + + CRecordExVideoContainer() + { + } + + ~CRecordExVideoContainer() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + CRecordsContainer::ReadFromStream(oHeader, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/ExWAVAudioEmbeddedContainer.h b/MsBinaryFile/PptFile/Records/ExWAVAudioEmbeddedContainer.h index c7c5733871..053d6db953 100644 --- a/MsBinaryFile/PptFile/Records/ExWAVAudioEmbeddedContainer.h +++ b/MsBinaryFile/PptFile/Records/ExWAVAudioEmbeddedContainer.h @@ -37,9 +37,33 @@ class CRecordWAVAudioEmbeddedContainer : public CRecordsContainer public: CRecordExMediaAtom m_oMedia; - _UINT32 m_nSoundID = 0; - LONG m_nDuration = 0; + _UINT32 m_nSoundID; + LONG m_nDuration; +public: + + CRecordWAVAudioEmbeddedContainer() + { + m_nSoundID = 0; + m_nDuration = 0; + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + ~CRecordWAVAudioEmbeddedContainer() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + SRecordHeader oExHeader; + oExHeader.ReadFromStream(pStream); + + m_oMedia.ReadFromStream(oExHeader, pStream); + + StreamUtils::StreamSkip(8, pStream); + + m_nSoundID = StreamUtils::ReadDWORD(pStream); + m_nDuration = StreamUtils::ReadLONG(pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/ExWAVAudioLinkContainer.h b/MsBinaryFile/PptFile/Records/ExWAVAudioLinkContainer.h index 5b763ebfba..ab072f5dc5 100644 --- a/MsBinaryFile/PptFile/Records/ExWAVAudioLinkContainer.h +++ b/MsBinaryFile/PptFile/Records/ExWAVAudioLinkContainer.h @@ -35,5 +35,17 @@ class CRecordWAVAudioLinkContainer : public CRecordsContainer { public: - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + + CRecordWAVAudioLinkContainer() + { + } + + ~CRecordWAVAudioLinkContainer() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + CRecordsContainer::ReadFromStream(oHeader, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/FontCollection10Container.h b/MsBinaryFile/PptFile/Records/FontCollection10Container.h index 481bd8992e..adf65c5320 100644 --- a/MsBinaryFile/PptFile/Records/FontCollection10Container.h +++ b/MsBinaryFile/PptFile/Records/FontCollection10Container.h @@ -31,7 +31,7 @@ */ #pragma once -//#include "FontCollectionEntry.h" +#include "../Structures/FontCollectionEntry.h" #include "../Reader/Records.h" namespace PPT_FORMAT @@ -39,11 +39,39 @@ namespace PPT_FORMAT class CRecordFontCollection10Container : public CUnknownRecord { public: - //std::vector m_rgFontCollectionEntry; + std::vector m_rgFontCollectionEntry; public: - virtual ~CRecordFontCollection10Container(); + virtual ~CRecordFontCollection10Container() + { + for (auto pEl : m_rgFontCollectionEntry) + { + RELEASEOBJECT(pEl) + } + } - virtual void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + virtual void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) + { + m_oHeader = oHeader; + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); + + _UINT32 lCurLen = 0; + + SRecordHeader ReadHeader; + + while ( lCurLen < m_oHeader.RecLen ) + { + if ( ReadHeader.ReadFromStream(pStream) == false) + break; + + lCurLen += 8 + ReadHeader.RecLen; + + auto pRec = new FontCollectionEntry; + pRec->ReadFromStream(pStream); + m_rgFontCollectionEntry.push_back(pRec); + } + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Records/FontEmbedFlags10Atom.h b/MsBinaryFile/PptFile/Records/FontEmbedFlags10Atom.h index 4824682490..500a5b75d7 100644 --- a/MsBinaryFile/PptFile/Records/FontEmbedFlags10Atom.h +++ b/MsBinaryFile/PptFile/Records/FontEmbedFlags10Atom.h @@ -39,10 +39,17 @@ namespace PPT_FORMAT class CRecordFontEmbedFlags10Atom : public CUnknownRecord { public: - bool m_fSubset = false; - bool m_fSubsetOptionConfirmed = false; + bool m_fSubset; + bool m_fSubsetOptionConfirmed; - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + _UINT32 flags = StreamUtils::ReadDWORD(pStream); + m_fSubset = 0x1 & flags; + m_fSubsetOptionConfirmed = 0x2 & flags; + } }; } diff --git a/MsBinaryFile/PptFile/Records/FontEntityAtom.h b/MsBinaryFile/PptFile/Records/FontEntityAtom.h index b88da064ec..bc001dfafc 100644 --- a/MsBinaryFile/PptFile/Records/FontEntityAtom.h +++ b/MsBinaryFile/PptFile/Records/FontEntityAtom.h @@ -47,8 +47,61 @@ public: BYTE m_lfPitchAndFamily; + CRecordFontEntityAtom(){} - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordFontEntityAtom(){} + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + //face name - utf16 string with 0, 64 bytes always allocated + unsigned char utf16FaceName[64+2] = {}; + + POLE::uint64 lReadByte = pStream->read(utf16FaceName, 64); + + if (sizeof(wchar_t) == 4) + { + ULONG lLen = 0; + for (lLen = 0; lLen < lReadByte; lLen +=2) + if (utf16FaceName[lLen] == 0)break; + + lLen/=2; + + UTF32 *pStrUtf32 = new UTF32 [lLen + 1]; + pStrUtf32[lLen] = 0 ; + + const UTF16 *pStrUtf16_Conv = (const UTF16 *) utf16FaceName; + UTF32 *pStrUtf32_Conv = pStrUtf32; + + if (conversionOK == ConvertUTF16toUTF32 ( &pStrUtf16_Conv, &pStrUtf16_Conv[lLen] + , &pStrUtf32_Conv, &pStrUtf32 [lLen] + , strictConversion)) + { + m_strFaceName = std::wstring((wchar_t*)pStrUtf32/*, lLen*/); + } + delete [] pStrUtf32; + } + else + { + m_strFaceName = std::wstring((wchar_t*)utf16FaceName/*, lReadByte/2*/); // по факту .. нули нам не нужны + } + m_lfCharSet = StreamUtils::ReadBYTE(pStream); + + BYTE Mem = 0; + Mem = StreamUtils::ReadBYTE(pStream); + m_bEmbedSubsetted = ((Mem & 0x01) == 0x01); + + Mem = 0; + Mem = StreamUtils::ReadBYTE(pStream); + + m_bIsRaster = ((Mem & 0x01) == 0x01); + m_bIsDevice = ((Mem & 0x02) == 0x02); + m_bIsTrueType = ((Mem & 0x04) == 0x04); + m_bIsNoFontSubstitution = ((Mem & 0x08) == 0x08); + + m_lfPitchAndFamily = StreamUtils::ReadBYTE(pStream); + } }; @@ -57,6 +110,15 @@ class CRecordFontEmbedDataBlob : public CUnknownRecord public: std::pair, _INT32> data; //font data of an embedded font + + CRecordFontEmbedDataBlob(){} + ~CRecordFontEmbedDataBlob(){} - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + data = std::make_pair(boost::shared_array(new unsigned char[m_oHeader.RecLen]), m_oHeader.RecLen); + pStream->read(data.first.get(), data.second); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/GridSpacing10Atom.h b/MsBinaryFile/PptFile/Records/GridSpacing10Atom.h index b16f414b80..348c50bc7e 100644 --- a/MsBinaryFile/PptFile/Records/GridSpacing10Atom.h +++ b/MsBinaryFile/PptFile/Records/GridSpacing10Atom.h @@ -35,9 +35,19 @@ class CRecordGridSpacing10Atom : public CUnknownRecord { public: - INT m_nX = 0; - INT m_nY = 0; + INT m_nX; + INT m_nY; + + CRecordGridSpacing10Atom() + { + } + ~CRecordGridSpacing10Atom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/GuideAtom.h b/MsBinaryFile/PptFile/Records/GuideAtom.h index b6b672bbd1..07dcb4bbac 100644 --- a/MsBinaryFile/PptFile/Records/GuideAtom.h +++ b/MsBinaryFile/PptFile/Records/GuideAtom.h @@ -34,10 +34,23 @@ class CRecordGuideAtom : public CUnknownRecord { -public: _UINT32 m_nType; _UINT32 m_nPos; +public: + + CRecordGuideAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + ~CRecordGuideAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + m_nType = StreamUtils::ReadDWORD(pStream); + m_nPos = StreamUtils::ReadDWORD(pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/HeadersFootersAtom.h b/MsBinaryFile/PptFile/Records/HeadersFootersAtom.h index 61f0ca8934..2a5119204f 100644 --- a/MsBinaryFile/PptFile/Records/HeadersFootersAtom.h +++ b/MsBinaryFile/PptFile/Records/HeadersFootersAtom.h @@ -38,15 +38,37 @@ class CRecordHeadersFootersAtom : public CUnknownRecord public: WORD m_nFormatID; - bool m_bHasDate; + bool m_bHasDate; bool m_bHasTodayDate; bool m_bHasUserDate; bool m_bHasSlideNumber; bool m_bHasHeader; - bool m_bHasFooter; + bool m_bHasFooter; + CRecordHeadersFootersAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordHeadersFootersAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_nFormatID = StreamUtils::ReadWORD(pStream); + + BYTE nFlag = StreamUtils::ReadBYTE(pStream); + m_bHasDate = ((nFlag & 0x01) == 0x01); + m_bHasTodayDate = ((nFlag & 0x02) == 0x02); + m_bHasUserDate = ((nFlag & 0x04) == 0x04); + m_bHasSlideNumber = ((nFlag & 0x08) == 0x08); + m_bHasHeader = ((nFlag & 0x10) == 0x10); + m_bHasFooter = ((nFlag & 0x20) == 0x20); + + StreamUtils::ReadBYTE(pStream);//reserved + } }; @@ -60,17 +82,51 @@ public: bool m_bIncludeHeader; bool m_bIncludeSlideNumber; + CRecordRoundTripHeaderFooterDefaults12Atom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordRoundTripHeaderFooterDefaults12Atom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + BYTE nFlag = StreamUtils::ReadBYTE(pStream); + + m_bIncludeDate = ((nFlag & 0x04) == 0x04); + m_bIncludeFooter = ((nFlag & 0x08) == 0x08); + m_bIncludeHeader = ((nFlag & 0x10) == 0x10); + m_bIncludeSlideNumber = ((nFlag & 0x20) == 0x20); + } }; class CRecordMetaCharacterAtom : public CUnknownRecord { public: - _UINT32 m_nPosition = -1; + _UINT32 m_nPosition; - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + CRecordMetaCharacterAtom() + { + m_nPosition = -1; + } + + ~CRecordMetaCharacterAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + if (oHeader.RecLen >=4) + { + m_nPosition = StreamUtils::ReadDWORD(pStream); + } + } }; class CRecordGenericDateMetaAtom : public CRecordMetaCharacterAtom @@ -82,17 +138,35 @@ class CRecordRTFDateTimeMetaAtom : public CRecordGenericDateMetaAtom public: std::string m_strFormat; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + CRecordGenericDateMetaAtom::ReadFromStream(oHeader, pStream); - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); + m_strFormat = StreamUtils::ReadStringA(pStream, 128); + } }; class CRecordDateTimeMetaAtom : public CRecordGenericDateMetaAtom { public: _UINT32 m_FormatID; - - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + POLE::uint64 lPosition = pStream->tell(); + + CRecordGenericDateMetaAtom::ReadFromStream(oHeader, pStream); + + if (oHeader.RecLen == 8) + { + m_FormatID = StreamUtils::ReadDWORD(pStream); + } + else if (oHeader.RecLen >4) + { + m_FormatID = StreamUtils::ReadBYTE(pStream); + StreamUtils::StreamSeek((long)(lPosition + m_oHeader.RecLen), pStream); + } + } }; @@ -113,8 +187,36 @@ class CRecordHeadersFootersContainer : public CRecordsContainer public: vector_string m_HeadersFootersString[3]; //0-dates, 1 - headers, 2 - footers - CRecordHeadersFootersAtom *m_oHeadersFootersAtom = nullptr; + CRecordHeadersFootersAtom *m_oHeadersFootersAtom; + CRecordHeadersFootersContainer() + { + m_oHeadersFootersAtom = NULL; + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + CRecordsContainer::ReadFromStream(oHeader, pStream); + + for (size_t i = 0 ; i < m_arRecords.size(); i++) + { + switch(m_arRecords[i]->m_oHeader.RecType) + { + case 0x0FDA: + m_oHeadersFootersAtom = dynamic_cast(m_arRecords[i]); + break; + case 0xFBA: + { + CRecordCString *str = dynamic_cast(m_arRecords[i]); + switch(m_arRecords[i]->m_oHeader.RecInstance) + { + case 0x000: m_HeadersFootersString[0].push_back(str->m_strText); break; + case 0x001: m_HeadersFootersString[1].push_back(str->m_strText); break; + case 0x002: m_HeadersFootersString[2].push_back(str->m_strText); break; + } + }break; + } + } + + } }; diff --git a/MsBinaryFile/PptFile/Records/InteractiveInfoAtom.h b/MsBinaryFile/PptFile/Records/InteractiveInfoAtom.h index 27f8010804..9c1c6396cc 100644 --- a/MsBinaryFile/PptFile/Records/InteractiveInfoAtom.h +++ b/MsBinaryFile/PptFile/Records/InteractiveInfoAtom.h @@ -48,6 +48,35 @@ public: bool m_bCustomShowReturn; bool m_bVisited; + CRecordInteractiveInfoAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordInteractiveInfoAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_nSoundIdRef = StreamUtils::ReadDWORD(pStream); + m_nExHyperlinkIdRef = StreamUtils::ReadDWORD(pStream); + m_nAction = StreamUtils::ReadBYTE(pStream); + m_nOleVerb = StreamUtils::ReadBYTE(pStream); + m_nJump = StreamUtils::ReadBYTE(pStream); + + BYTE nFlag = StreamUtils::ReadBYTE(pStream); + + m_bAnimated = ((nFlag & 0x01) == 0x01); + m_bStopSound = ((nFlag & 0x02) == 0x02); + m_bCustomShowReturn = ((nFlag & 0x04) == 0x04); + m_bVisited = ((nFlag & 0x08) == 0x08); + + m_nHyperlinkType = StreamUtils::ReadBYTE(pStream); + StreamUtils::StreamSkip(3, pStream); +// if (m_nExHyperlinkIdRef) +// std::wcout << L"HyperlinkIDRef: " << m_nExHyperlinkIdRef << std::endl;; + + } }; diff --git a/MsBinaryFile/PptFile/Records/KinsokuAtom.h b/MsBinaryFile/PptFile/Records/KinsokuAtom.h index 314c3c0639..aef9aef84a 100644 --- a/MsBinaryFile/PptFile/Records/KinsokuAtom.h +++ b/MsBinaryFile/PptFile/Records/KinsokuAtom.h @@ -35,8 +35,21 @@ class CRecordKinsokuAtom : public CUnknownRecord { public: - _UINT32 m_nLevel = 0; + _UINT32 m_nLevel; + + CRecordKinsokuAtom() + { + } + ~CRecordKinsokuAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_nLevel = StreamUtils::ReadDWORD(pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/KinsokuContainer.h b/MsBinaryFile/PptFile/Records/KinsokuContainer.h index ebb3584a3f..301ef8ae2c 100644 --- a/MsBinaryFile/PptFile/Records/KinsokuContainer.h +++ b/MsBinaryFile/PptFile/Records/KinsokuContainer.h @@ -38,10 +38,21 @@ class CRecordKinsokuContainer : public CUnknownRecord { public: - _UINT32 m_nLevel = 0; + _UINT32 m_nLevel; + CRecordKinsokuContainer() + { + } - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + ~CRecordKinsokuContainer() + { + } + + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + CUnknownRecord::ReadFromStream(m_oHeader, pStream); + } public: diff --git a/MsBinaryFile/PptFile/Records/KinsokuFollowingAtom.h b/MsBinaryFile/PptFile/Records/KinsokuFollowingAtom.h index a7275f7266..75ae3f5466 100644 --- a/MsBinaryFile/PptFile/Records/KinsokuFollowingAtom.h +++ b/MsBinaryFile/PptFile/Records/KinsokuFollowingAtom.h @@ -37,6 +37,18 @@ class CRecordKinsokuFollowingAtom : public CUnknownRecord public: std::wstring m_arKinsokuFollowing; + CRecordKinsokuFollowingAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordKinsokuFollowingAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_arKinsokuFollowing = StreamUtils::ReadStringW(pStream, m_oHeader.RecLen - sizeof (oHeader)); + } }; diff --git a/MsBinaryFile/PptFile/Records/KinsokuLeadingAtom.h b/MsBinaryFile/PptFile/Records/KinsokuLeadingAtom.h index 631af89a26..58e1982fb2 100644 --- a/MsBinaryFile/PptFile/Records/KinsokuLeadingAtom.h +++ b/MsBinaryFile/PptFile/Records/KinsokuLeadingAtom.h @@ -37,6 +37,18 @@ class CRecordKinsokuLeadingAtom : public CUnknownRecord public: std::wstring m_arKinsokuLeading; + CRecordKinsokuLeadingAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordKinsokuLeadingAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_arKinsokuLeading = StreamUtils::ReadStringW(pStream, m_oHeader.RecLen - sizeof (oHeader)); + } }; diff --git a/MsBinaryFile/PptFile/Records/LinkedShape10Atom.h b/MsBinaryFile/PptFile/Records/LinkedShape10Atom.h index 4265f47373..6a0593710a 100644 --- a/MsBinaryFile/PptFile/Records/LinkedShape10Atom.h +++ b/MsBinaryFile/PptFile/Records/LinkedShape10Atom.h @@ -38,11 +38,17 @@ namespace PPT_FORMAT { class CRecordLinkedShape10Atom : public CUnknownRecord { +public: +void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override +{ + m_oHeader = oHeader; + + m_nShapeIdRef = StreamUtils::ReadLONG(pStream); + m_nLinkedShapeIdRef = StreamUtils::ReadLONG(pStream); +} + public: _UINT32 m_nShapeIdRef; _UINT32 m_nLinkedShapeIdRef; - - - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; }; } diff --git a/MsBinaryFile/PptFile/Records/LinkedSlide10Atom.h b/MsBinaryFile/PptFile/Records/LinkedSlide10Atom.h index a2cf5eaccb..63d60a2df8 100644 --- a/MsBinaryFile/PptFile/Records/LinkedSlide10Atom.h +++ b/MsBinaryFile/PptFile/Records/LinkedSlide10Atom.h @@ -39,11 +39,17 @@ typedef _UINT32 SlideIdRef; class CRecordLinkedSlide10Atom : public CUnknownRecord { +public: +void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override +{ + m_oHeader = oHeader; + + m_nLinkedSlideIdRef = StreamUtils::ReadLONG(pStream); + m_cLinkedShapes = StreamUtils::ReadLONG(pStream); +} + public: SlideIdRef m_nLinkedSlideIdRef; _INT32 m_cLinkedShapes; - - - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; }; } diff --git a/MsBinaryFile/PptFile/Records/MasterPersistAtom.h b/MsBinaryFile/PptFile/Records/MasterPersistAtom.h index db2d4fa38f..4ba6786c70 100644 --- a/MsBinaryFile/PptFile/Records/MasterPersistAtom.h +++ b/MsBinaryFile/PptFile/Records/MasterPersistAtom.h @@ -37,7 +37,18 @@ class CRecordMasterPersistAtom : public CUnknownRecord public: UINT m_nPsrRef; INT m_nMasterID; + + CRecordMasterPersistAtom() + { + } + ~CRecordMasterPersistAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/MasterTextPropAtom.h b/MsBinaryFile/PptFile/Records/MasterTextPropAtom.h index 9230ad98a5..1be6e84e90 100644 --- a/MsBinaryFile/PptFile/Records/MasterTextPropAtom.h +++ b/MsBinaryFile/PptFile/Records/MasterTextPropAtom.h @@ -37,16 +37,56 @@ class CRecordMasterTextPropAtom : public CUnknownRecord public: struct SMasterTextPropRun { - _UINT32 lCount = 0; - unsigned short lIndentLevel = 0; + _UINT32 lCount; + unsigned short lIndentLevel; - SMasterTextPropRun(); - SMasterTextPropRun(const SMasterTextPropRun& oSrc); - SMasterTextPropRun& operator=(const SMasterTextPropRun& oSrc); + SMasterTextPropRun() + { + lCount = 0; + lIndentLevel = 0; + } + + SMasterTextPropRun(const SMasterTextPropRun& oSrc) + { + lCount = oSrc.lCount; + lIndentLevel = oSrc.lIndentLevel; + } + + SMasterTextPropRun& operator=(const SMasterTextPropRun& oSrc) + { + lCount = oSrc.lCount; + lIndentLevel = oSrc.lIndentLevel; + + return *this; + } }; std::vector m_arrProps; + CRecordMasterTextPropAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + ~CRecordMasterTextPropAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + m_arrProps.clear(); + + size_t nCount = m_oHeader.RecLen / 6; + while (nCount != 0) + { + --nCount; + + SMasterTextPropRun oRun; + oRun.lCount = StreamUtils::ReadDWORD(pStream); + oRun.lIndentLevel = StreamUtils::ReadWORD(pStream); + + m_arrProps.push_back(oRun); + } + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/MetafileBlob.h b/MsBinaryFile/PptFile/Records/MetafileBlob.h index 2c32a7ba50..b49671c7ad 100644 --- a/MsBinaryFile/PptFile/Records/MetafileBlob.h +++ b/MsBinaryFile/PptFile/Records/MetafileBlob.h @@ -42,9 +42,31 @@ public: SHORT m_nExtY; BYTE* m_pData; - CRecordMetafileBlob(); - ~CRecordMetafileBlob(); + CRecordMetafileBlob() : + m_nMM(-1), m_nExtX(-1), m_nExtY(-1), m_pData(nullptr) + { - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + } + + ~CRecordMetafileBlob() + { + RELEASEOBJECT (m_pData) + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_nMM = StreamUtils::ReadSHORT(pStream); + m_nExtX = StreamUtils::ReadSHORT(pStream); + m_nExtY = StreamUtils::ReadSHORT(pStream); + + const int dataLen = m_oHeader.RecLen - 6; + if (dataLen > 6) + { + m_pData = new BYTE[dataLen]; + pStream->read(m_pData, dataLen); + } + } }; diff --git a/MsBinaryFile/PptFile/Records/MouseInteractiveInfoContainer.h b/MsBinaryFile/PptFile/Records/MouseInteractiveInfoContainer.h index 5d2ba2d17c..c20fd2d88b 100644 --- a/MsBinaryFile/PptFile/Records/MouseInteractiveInfoContainer.h +++ b/MsBinaryFile/PptFile/Records/MouseInteractiveInfoContainer.h @@ -38,8 +38,31 @@ class CRecordMouseInteractiveInfoContainer : public CUnknownRecord public: CRecordInteractiveInfoAtom interactiveInfoAtom; nullable macroNameAtom; - bool isOver = false; // click = 0, over = 1 + bool isOver; // click = 0, over = 1 + CRecordMouseInteractiveInfoContainer() : + isOver(false) + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordMouseInteractiveInfoContainer() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + isOver = oHeader.RecInstance; + + SRecordHeader header; + header.ReadFromStream(pStream); + interactiveInfoAtom.ReadFromStream(header, pStream); + + if (m_oHeader.RecLen > 24) + { + header.ReadFromStream(pStream); + macroNameAtom.reset(new CRecordCString); + macroNameAtom->ReadFromStream(header, pStream); + } + } }; diff --git a/MsBinaryFile/PptFile/Records/MouseTextInteractiveInfoAtom.h b/MsBinaryFile/PptFile/Records/MouseTextInteractiveInfoAtom.h index fe949a7b01..a6e294f69f 100644 --- a/MsBinaryFile/PptFile/Records/MouseTextInteractiveInfoAtom.h +++ b/MsBinaryFile/PptFile/Records/MouseTextInteractiveInfoAtom.h @@ -36,7 +36,17 @@ class CRecordMouseTextInteractiveInfoAtom : public CUnknownRecord { public: STextRange m_oRange; + + CRecordMouseTextInteractiveInfoAtom() + { + } + ~CRecordMouseTextInteractiveInfoAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/NamedShowSlidesAtom.h b/MsBinaryFile/PptFile/Records/NamedShowSlidesAtom.h index 42fcb80114..2e6a4b6d73 100644 --- a/MsBinaryFile/PptFile/Records/NamedShowSlidesAtom.h +++ b/MsBinaryFile/PptFile/Records/NamedShowSlidesAtom.h @@ -36,7 +36,17 @@ class CRecordNamedShowSlidesAtom : public CUnknownRecord { public: std::vector m_arRgSlideIdRef; + + CRecordNamedShowSlidesAtom() + { + } + ~CRecordNamedShowSlidesAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/NoZoomViewInfoAtom.cpp b/MsBinaryFile/PptFile/Records/NoZoomViewInfoAtom.cpp index 433fa7e446..d8c84e3a5a 100644 --- a/MsBinaryFile/PptFile/Records/NoZoomViewInfoAtom.cpp +++ b/MsBinaryFile/PptFile/Records/NoZoomViewInfoAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "NoZoomViewInfoAtom.h" diff --git a/MsBinaryFile/PptFile/Records/NoZoomViewInfoAtom.h b/MsBinaryFile/PptFile/Records/NoZoomViewInfoAtom.h index 5e530ef8eb..9ba0d035b3 100644 --- a/MsBinaryFile/PptFile/Records/NoZoomViewInfoAtom.h +++ b/MsBinaryFile/PptFile/Records/NoZoomViewInfoAtom.h @@ -38,8 +38,18 @@ public: SScalingAtom m_oCurScale; SPointAtom m_nOrigin; - BOOL1 m_bDraftMode; + BOOL1 m_bDraftMode; + + CRecordNoZoomViewInfoAtom() + { + } + ~CRecordNoZoomViewInfoAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/NormalViewSetInfoAtom.cpp b/MsBinaryFile/PptFile/Records/NormalViewSetInfoAtom.cpp index e4965b6f35..a8752d1a83 100644 --- a/MsBinaryFile/PptFile/Records/NormalViewSetInfoAtom.cpp +++ b/MsBinaryFile/PptFile/Records/NormalViewSetInfoAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "NormalViewSetInfoAtom.h" void CRecordNormalViewSetInfoAtom::ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) diff --git a/MsBinaryFile/PptFile/Records/NormalViewSetInfoAtom.h b/MsBinaryFile/PptFile/Records/NormalViewSetInfoAtom.h index a95433adf2..eadcc73d20 100644 --- a/MsBinaryFile/PptFile/Records/NormalViewSetInfoAtom.h +++ b/MsBinaryFile/PptFile/Records/NormalViewSetInfoAtom.h @@ -44,6 +44,17 @@ public: BOOL1 m_fPreferSingleSet; BYTE m_nFlags; + + CRecordNormalViewSetInfoAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + ~CRecordNormalViewSetInfoAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/NotesAtom.cpp b/MsBinaryFile/PptFile/Records/NotesAtom.cpp index 73aae36e91..0ee14fa41c 100644 --- a/MsBinaryFile/PptFile/Records/NotesAtom.cpp +++ b/MsBinaryFile/PptFile/Records/NotesAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "NotesAtom.h" diff --git a/MsBinaryFile/PptFile/Records/NotesAtom.h b/MsBinaryFile/PptFile/Records/NotesAtom.h index d39068d455..089a8de6a2 100644 --- a/MsBinaryFile/PptFile/Records/NotesAtom.h +++ b/MsBinaryFile/PptFile/Records/NotesAtom.h @@ -39,8 +39,27 @@ public: bool m_bMasterObjects; bool m_bMasterScheme; - bool m_bMasterBackground; + bool m_bMasterBackground; + + CRecordNotesAtom() + { + } + ~CRecordNotesAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_nSlideIDRef = (UINT)StreamUtils::ReadDWORD(pStream); + + USHORT nFlag = StreamUtils::ReadWORD(pStream); + m_bMasterObjects = ((nFlag & 0x01) == 0x01); + m_bMasterScheme = ((nFlag & 0x02) == 0x02); + m_bMasterBackground = ((nFlag & 0x04) == 0x04); + + StreamUtils::StreamSkip(2, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/NotesPersistAtom.cpp b/MsBinaryFile/PptFile/Records/NotesPersistAtom.cpp index 6c5507a922..74f8ab4152 100644 --- a/MsBinaryFile/PptFile/Records/NotesPersistAtom.cpp +++ b/MsBinaryFile/PptFile/Records/NotesPersistAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "NotesPersistAtom.h" diff --git a/MsBinaryFile/PptFile/Records/NotesPersistAtom.h b/MsBinaryFile/PptFile/Records/NotesPersistAtom.h index c3114be914..ff082d7bc7 100644 --- a/MsBinaryFile/PptFile/Records/NotesPersistAtom.h +++ b/MsBinaryFile/PptFile/Records/NotesPersistAtom.h @@ -36,8 +36,18 @@ class CRecordNotesPersistAtom : public CUnknownRecord { public: UINT m_nPsrRef; - INT m_nNotesID; + INT m_nNotesID; + + CRecordNotesPersistAtom() + { + } + ~CRecordNotesPersistAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/OfficeArtClientData.cpp b/MsBinaryFile/PptFile/Records/OfficeArtClientData.cpp index 5334e894d6..60460c6704 100644 --- a/MsBinaryFile/PptFile/Records/OfficeArtClientData.cpp +++ b/MsBinaryFile/PptFile/Records/OfficeArtClientData.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "OfficeArtClientData.h" diff --git a/MsBinaryFile/PptFile/Records/OfficeArtClientData.h b/MsBinaryFile/PptFile/Records/OfficeArtClientData.h index 5060596fcc..972ddc51c4 100644 --- a/MsBinaryFile/PptFile/Records/OfficeArtClientData.h +++ b/MsBinaryFile/PptFile/Records/OfficeArtClientData.h @@ -43,8 +43,18 @@ class CRecordShapeProgBinaryTagContainer : public CUnknownRecord public: CRecordShapeProgBinaryTagSubContainerOrAtom m_rec; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); + + SRecordHeader ReadHeader; + m_rec.ReadFromStream(ReadHeader, pStream); + + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + } }; class CRecordOfficeArtClientData : public CRecordsContainer @@ -53,10 +63,70 @@ public: std::vector m_rgShapeClientRoundtripData; - virtual ~CRecordOfficeArtClientData(); + virtual ~CRecordOfficeArtClientData() + { + CRecordsContainer::Clear(); + for ( size_t i = 0; i < m_rgShapeClientRoundtripData.size(); ++i ) + RELEASEOBJECT ( m_rgShapeClientRoundtripData[i] ); + } - CRecordShapeProgBinaryTagSubContainerOrAtom *getProgTag(const std::wstring& tagname); + CRecordShapeProgBinaryTagSubContainerOrAtom* getProgTag(const std::wstring& tagname) + { + for (auto* progtag : m_rgShapeClientRoundtripData) + { + if (progtag->m_pTagName->m_strText == tagname) + return progtag; + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + return nullptr; + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); + + UINT lCurLen = 0; + + SRecordHeader ReadHeader; + + while ( lCurLen < m_oHeader.RecLen ) + { + if ( ReadHeader.ReadFromStream(pStream) == false) + break; + + lCurLen += 8 + ReadHeader.RecLen; + + switch (ReadHeader.RecType) + { + case RT_ProgTags: + { + // ShapeProgBinaryTagContainer + ReadHeader.ReadFromStream(pStream); + + auto pRec = new CRecordShapeProgBinaryTagSubContainerOrAtom; + pRec->ReadFromStream(ReadHeader, pStream); + m_rgShapeClientRoundtripData.push_back(pRec); + break; + } + case RT_VbaInfo: + { + auto pRec = new CRecordsContainer; + pRec->ReadFromStream(ReadHeader, pStream); + break; + } + default: + IRecord* pRecord = CreateByType(ReadHeader); + pRecord->ReadFromStream(ReadHeader, pStream); + + m_arRecords.push_back(pRecord); + break; + } + + } + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Records/OfficeArtClientTextbox.h b/MsBinaryFile/PptFile/Records/OfficeArtClientTextbox.h index 8785a9c921..7d5cf239ba 100644 --- a/MsBinaryFile/PptFile/Records/OfficeArtClientTextbox.h +++ b/MsBinaryFile/PptFile/Records/OfficeArtClientTextbox.h @@ -35,4 +35,9 @@ class CRecordOfficeArtClientTextbox : public CRecordsContainer { +public: + CRecordOfficeArtClientTextbox() + { + + } }; diff --git a/MsBinaryFile/PptFile/Records/OutlineTextProps9Container.cpp b/MsBinaryFile/PptFile/Records/OutlineTextProps9Container.cpp index 4e400e6e7c..4626341fa4 100644 --- a/MsBinaryFile/PptFile/Records/OutlineTextProps9Container.cpp +++ b/MsBinaryFile/PptFile/Records/OutlineTextProps9Container.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "OutlineTextProps9Container.h" diff --git a/MsBinaryFile/PptFile/Records/OutlineTextProps9Container.h b/MsBinaryFile/PptFile/Records/OutlineTextProps9Container.h index 37fa73beab..130c1fd9e7 100644 --- a/MsBinaryFile/PptFile/Records/OutlineTextProps9Container.h +++ b/MsBinaryFile/PptFile/Records/OutlineTextProps9Container.h @@ -42,7 +42,21 @@ public: CRecordStyleTextProp9Atom m_styleTextProp9Atom; public: - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override + { + CRecordOutlineTextPropsHeaderExAtom::ReadFromStream(oHeader, pStream); + + SRecordHeader ReadHeader; + ReadHeader.ReadFromStream(pStream); + + if (ReadHeader.bBadHeader) + { + oHeader.bBadHeader = true; // GZoabli_PhD.ppt + return; + } + + m_styleTextProp9Atom.ReadFromStream(ReadHeader, pStream); + } }; @@ -52,8 +66,40 @@ public: std::vector m_rgOutlineTextProps9Entry; public: - virtual ~CRecordOutlineTextProps9Container(); + virtual ~CRecordOutlineTextProps9Container() + { + for (auto pEl : m_rgOutlineTextProps9Entry) + { + RELEASEOBJECT(pEl) + } + } - virtual void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + virtual void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) + { + m_oHeader = oHeader; + LONG lPos = 0; + StreamUtils::StreamPosition(lPos, pStream); + + UINT lCurLen = 0; + + SRecordHeader ReadHeader; + + while (lCurLen < m_oHeader.RecLen) + { + if (ReadHeader.ReadFromStream(pStream) == false || ReadHeader.bBadHeader) + break; + + lCurLen += 8 + ReadHeader.RecLen; + + auto pRec = new CRecordOutlineTextProps9Entry; + pRec->ReadFromStream(ReadHeader, pStream); + + if (ReadHeader.bBadHeader) + break; + + m_rgOutlineTextProps9Entry.push_back(pRec); + } + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Records/OutlineTextPropsHeaderExAtom.cpp b/MsBinaryFile/PptFile/Records/OutlineTextPropsHeaderExAtom.cpp index 0e7c8385f3..4a92a450e7 100644 --- a/MsBinaryFile/PptFile/Records/OutlineTextPropsHeaderExAtom.cpp +++ b/MsBinaryFile/PptFile/Records/OutlineTextPropsHeaderExAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "OutlineTextPropsHeaderExAtom.h" diff --git a/MsBinaryFile/PptFile/Records/OutlineTextPropsHeaderExAtom.h b/MsBinaryFile/PptFile/Records/OutlineTextPropsHeaderExAtom.h index d4c027707e..2d4fa728a6 100644 --- a/MsBinaryFile/PptFile/Records/OutlineTextPropsHeaderExAtom.h +++ b/MsBinaryFile/PptFile/Records/OutlineTextPropsHeaderExAtom.h @@ -43,6 +43,11 @@ public: TextTypeEnum m_eTxType; protected: - virtual void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + virtual void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) + { + m_oHeader = oHeader; + m_slideIdRef = StreamUtils::ReadDWORD(pStream); + m_eTxType = (TextTypeEnum)StreamUtils::ReadDWORD(pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Records/OutlineTextRefAtom.cpp b/MsBinaryFile/PptFile/Records/OutlineTextRefAtom.cpp index 333d99251d..17addc9021 100644 --- a/MsBinaryFile/PptFile/Records/OutlineTextRefAtom.cpp +++ b/MsBinaryFile/PptFile/Records/OutlineTextRefAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "OutlineTextRefAtom.h" diff --git a/MsBinaryFile/PptFile/Records/OutlineTextRefAtom.h b/MsBinaryFile/PptFile/Records/OutlineTextRefAtom.h index 733ecc9642..675d0caa2a 100644 --- a/MsBinaryFile/PptFile/Records/OutlineTextRefAtom.h +++ b/MsBinaryFile/PptFile/Records/OutlineTextRefAtom.h @@ -37,6 +37,18 @@ class CRecordOutlineTextRefAtom : public CUnknownRecord public: _UINT32 m_nIndex; + + CRecordOutlineTextRefAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + ~CRecordOutlineTextRefAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + m_nIndex = StreamUtils::ReadDWORD(pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/PFMasks.cpp b/MsBinaryFile/PptFile/Records/PFMasks.cpp index 28a0d8f481..6aa136dd3e 100644 --- a/MsBinaryFile/PptFile/Records/PFMasks.cpp +++ b/MsBinaryFile/PptFile/Records/PFMasks.cpp @@ -1,3 +1,64 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 +* +*//* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "PFMasks.h" static inline bool getBit(_UINT32 data, _UINT32 mask) diff --git a/MsBinaryFile/PptFile/Records/PFMasks.h b/MsBinaryFile/PptFile/Records/PFMasks.h index edae6f44d8..7ece4d6e33 100644 --- a/MsBinaryFile/PptFile/Records/PFMasks.h +++ b/MsBinaryFile/PptFile/Records/PFMasks.h @@ -34,6 +34,13 @@ namespace PPT_FORMAT { + +inline bool getBit(_UINT32 data, _UINT32 mask) +{ + return mask == (mask & data); +} + + struct PFMasks { bool m_hasBullet; @@ -64,6 +71,36 @@ struct PFMasks bool m_bulletHasScheme; - void ReadFromStream(POLE::Stream* pStream); + void ReadFromStream(POLE::Stream* pStream) + { + _UINT32 data = StreamUtils::ReadDWORD(pStream); + + m_hasBullet = getBit(data, 0x0001); + m_bulletHasFont = getBit(data, 0x0002); + m_bulletHasColor = getBit(data, 0x0004); + m_bulletHasSize = getBit(data, 0x0008); + m_bulletFont = getBit(data, 0x0010); + m_bulletColor = getBit(data, 0x0020); + m_bulletSize = getBit(data, 0x0040); + m_bulletChar = getBit(data, 0x0080); + m_leftMargin = getBit(data, 0x0100); + // unused + m_indent = getBit(data, 0x000400); + m_align = getBit(data, 0x000800); + m_lineSpacing = getBit(data, 0x001000); + m_spaceBefore = getBit(data, 0x002000); + m_spaceAfter = getBit(data, 0x004000); + m_defaultTabSize = getBit(data, 0x008000); + m_fontAlign = getBit(data, 0x010000); + m_charWrap = getBit(data, 0x020000); + m_wordWrap = getBit(data, 0x040000); + m_overflow = getBit(data, 0x080000); + m_tabStops = getBit(data, 0x100000); + m_textDirection = getBit(data, 0x200000); + // reserved1 + m_bulletBlip = getBit(data, 0x0800000); + m_bulletScheme = getBit(data, 0x1000000); + m_bulletHasScheme = getBit(data, 0x2000000); + } }; } diff --git a/MsBinaryFile/PptFile/Records/PersistDirectoryAtom.cpp b/MsBinaryFile/PptFile/Records/PersistDirectoryAtom.cpp index 2a96d20505..5b6a112e19 100644 --- a/MsBinaryFile/PptFile/Records/PersistDirectoryAtom.cpp +++ b/MsBinaryFile/PptFile/Records/PersistDirectoryAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "PersistDirectoryAtom.h" diff --git a/MsBinaryFile/PptFile/Records/PersistDirectoryAtom.h b/MsBinaryFile/PptFile/Records/PersistDirectoryAtom.h index 998e3550a6..0ac42afb39 100644 --- a/MsBinaryFile/PptFile/Records/PersistDirectoryAtom.h +++ b/MsBinaryFile/PptFile/Records/PersistDirectoryAtom.h @@ -51,7 +51,22 @@ public: m_nPersistCount = 0; } - _UINT32 FromStream(POLE::Stream* pStream); + _UINT32 FromStream(POLE::Stream* pStream) + { + _UINT32 nFlag = StreamUtils::ReadDWORD(pStream); + m_nPersistID = (nFlag & 0x000FFFFF); // 20 bit + m_nPersistCount = (nFlag & 0xFFF00000) >> 20; // 12 bit + + m_arPersistOffsets.clear(); + + for (_UINT32 index = 0; index < m_nPersistCount; ++index) + { + _UINT32 Mem = StreamUtils::ReadDWORD(pStream); + m_arPersistOffsets.push_back(Mem); + } + + return 4 * (m_nPersistCount + 1); + } }; class CRecordPersistDirectoryAtom : public CUnknownRecord @@ -59,8 +74,46 @@ class CRecordPersistDirectoryAtom : public CUnknownRecord std::vector m_arEntries; public: + + CRecordPersistDirectoryAtom() : m_arEntries() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordPersistDirectoryAtom() + { + m_arEntries.clear(); + } - void ToMap(std::map<_UINT32, _UINT32>* pMap); -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + _UINT32 nCountRead = 0; + _UINT32 nCountEnries = 0; + while (nCountRead < m_oHeader.RecLen) + { + CPersistDirectoryEntry elm; + m_arEntries.push_back(elm); + + nCountRead += m_arEntries[nCountEnries].FromStream(pStream); + ++nCountEnries; + } + } + + void ToMap(std::map<_UINT32, _UINT32>* pMap) + { + pMap->clear(); + + for (size_t nEntry = 0; nEntry < m_arEntries.size(); ++nEntry) + { + _UINT32 nPID = m_arEntries[nEntry].m_nPersistID; + + for (size_t nIndex = 0; nIndex < m_arEntries[nEntry].m_nPersistCount; ++nIndex) + { + _UINT32 nOffset = m_arEntries[nEntry].m_arPersistOffsets[nIndex]; + pMap->insert(std::pair<_UINT32, _UINT32>(nPID, nOffset)); + ++nPID; + } + } + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/PlaceHolderAtom.cpp b/MsBinaryFile/PptFile/Records/PlaceHolderAtom.cpp index 13000ea16c..94a06e9eaf 100644 --- a/MsBinaryFile/PptFile/Records/PlaceHolderAtom.cpp +++ b/MsBinaryFile/PptFile/Records/PlaceHolderAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "PlaceHolderAtom.h" diff --git a/MsBinaryFile/PptFile/Records/PlaceHolderAtom.h b/MsBinaryFile/PptFile/Records/PlaceHolderAtom.h index c50e539f56..d117274d1d 100644 --- a/MsBinaryFile/PptFile/Records/PlaceHolderAtom.h +++ b/MsBinaryFile/PptFile/Records/PlaceHolderAtom.h @@ -39,6 +39,24 @@ public: BYTE m_nPlacementID; BYTE m_nSize; +public: + + CRecordPlaceHolderAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordPlaceHolderAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_nPosition = StreamUtils::ReadLONG(pStream); + m_nPlacementID = StreamUtils::ReadBYTE(pStream); + m_nSize = StreamUtils::ReadBYTE(pStream); + + StreamUtils::StreamSkip(2, pStream); + } }; diff --git a/MsBinaryFile/PptFile/Records/ProgStringTagContainer.cpp b/MsBinaryFile/PptFile/Records/ProgStringTagContainer.cpp index b2bb072b7a..4dac45c490 100644 --- a/MsBinaryFile/PptFile/Records/ProgStringTagContainer.cpp +++ b/MsBinaryFile/PptFile/Records/ProgStringTagContainer.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "ProgStringTagContainer.h" diff --git a/MsBinaryFile/PptFile/Records/ProgStringTagContainer.h b/MsBinaryFile/PptFile/Records/ProgStringTagContainer.h index 7d95da787c..078844e319 100644 --- a/MsBinaryFile/PptFile/Records/ProgStringTagContainer.h +++ b/MsBinaryFile/PptFile/Records/ProgStringTagContainer.h @@ -38,13 +38,30 @@ namespace PPT_FORMAT { class CRecordProgStringTagContainer : public CUnknownRecord { public: - CRecordProgStringTagContainer(); - ~CRecordProgStringTagContainer(); + CRecordProgStringTagContainer() : m_pTagValueAtom(nullptr) {} - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + ~CRecordProgStringTagContainer() + { + RELEASEOBJECT(m_pTagValueAtom) + } + + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override + { + m_oHeader = oHeader; + SRecordHeader ReadHeader; + ReadHeader.ReadFromStream(pStream); + + m_oTagNameAtom.ReadFromStream(ReadHeader, pStream); + if (m_oHeader.RecLen > 8 + ReadHeader.RecLen) + { + m_pTagValueAtom = new CRecordTagValueAtom(); + ReadHeader.ReadFromStream(pStream); + m_pTagValueAtom->ReadFromStream(ReadHeader, pStream); + } + } public: CRecordTagNameAtom m_oTagNameAtom; - CRecordTagValueAtom* m_pTagValueAtom = nullptr; // OPTIONAL + CRecordTagValueAtom* m_pTagValueAtom; // OPTIONAL }; } diff --git a/MsBinaryFile/PptFile/Records/RoundTrip.cpp b/MsBinaryFile/PptFile/Records/RoundTrip.cpp index 97d2712cd5..3bd664b5a6 100644 --- a/MsBinaryFile/PptFile/Records/RoundTrip.cpp +++ b/MsBinaryFile/PptFile/Records/RoundTrip.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "RoundTrip.h" //static int nRTCounter = 1; diff --git a/MsBinaryFile/PptFile/Records/RoundTrip.h b/MsBinaryFile/PptFile/Records/RoundTrip.h index 2a577d52ec..12d17da8b5 100644 --- a/MsBinaryFile/PptFile/Records/RoundTrip.h +++ b/MsBinaryFile/PptFile/Records/RoundTrip.h @@ -32,6 +32,8 @@ #pragma once #include "../Reader/Records.h" +#include +//static UINT nRTCounter = 1; namespace PPT_FORMAT { @@ -40,19 +42,56 @@ class CUnknownRoundTrip : public CUnknownRecord public: std::pair, _INT32> data; + CUnknownRoundTrip() + { + } - void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; - void ReadFromStream(SRecordHeader & oHeader, const CFStreamPtr &pStream) override; + ~CUnknownRoundTrip() + { + } + + void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + data = std::make_pair(boost::shared_array(new unsigned char[m_oHeader.RecLen]), m_oHeader.RecLen); + pStream->read(data.first.get(), data.second); + +// std::string filename = std::to_string(nRTCounter++) + "_" + GetRecordName(m_oHeader.RecType) + ".zip"; +// std::ofstream file("RoundTrips/" + filename, std::ios::out); +// file.write((char*)data.first.get(), data.second); +// file.close(); + } + + void ReadFromStream(SRecordHeader & oHeader, const CFStreamPtr &pStream) + { + m_oHeader = oHeader; + + data = std::make_pair(boost::shared_array(new unsigned char[m_oHeader.RecLen]), m_oHeader.RecLen); + pStream->read(data.first.get(), data.second); + } }; class CUnknownRoundTripID : public CUnknownRecord { public: - UINT m_dwID = -1; + UINT m_dwID; + CUnknownRoundTripID(): m_dwID(-1){} + ~CUnknownRoundTripID(){} - virtual std::wstring getStrID()const; - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual inline std::wstring getStrID()const + { return std::to_wstring(m_dwID);} + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + m_dwID = StreamUtils::ReadDWORD(pStream); + +// std::string filename = std::to_string(nRTCounter++) + "_" + GetRecordName(m_oHeader.RecType) + "_ID_" + std::to_string(m_dwID) + ".txt"; +// std::ofstream file("RoundTrips/" + filename, std::ios::out); +// file << m_dwID; +// file.close(); + } }; // .zip @@ -73,8 +112,27 @@ public: RoundTripColorMapping12Atom(){} ~RoundTripColorMapping12Atom(){} - void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; - std::wstring getPClrMap()const; + void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + m_colorMapping = StreamUtils::ReadStringA(pStream, m_oHeader.RecLen); + +// std::string filename = std::to_string(nRTCounter++) + "_" + GetRecordName(m_oHeader.RecType) + ".xml"; +// std::ofstream file("RoundTrips/" + filename, std::ios::out); +// file << m_colorMapping; +// file.close(); + } + std::wstring getPClrMap()const + { + auto iter = m_colorMapping.find("read(nm, 64); + m_pName = NSFile::CUtf8Converter::GetWStringFromUTF16((unsigned short*)nm, 32); + + flags = StreamUtils::ReadWORD(pStream); + + fAutoAdvance = GETBIT(flags, 15); + fWillSkipBuilds = GETBIT(flags, 14); + fUseSlideRange = GETBIT(flags, 13); + fDocUseNamedShow = GETBIT(flags, 12); + fBrowseMode = GETBIT(flags, 11); + fKioskMode = GETBIT(flags, 10); + fWillSkipNarration = GETBIT(flags, 9); + fLoopContinuously = GETBIT(flags, 8); + fHideScrollBar = GETBIT(flags, 7); + + unsigned short unused = StreamUtils::ReadWORD(pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/SSSlideInfoAtom.cpp b/MsBinaryFile/PptFile/Records/SSSlideInfoAtom.cpp index 2a3a886180..aa3f54e26f 100644 --- a/MsBinaryFile/PptFile/Records/SSSlideInfoAtom.cpp +++ b/MsBinaryFile/PptFile/Records/SSSlideInfoAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "SSSlideInfoAtom.h" diff --git a/MsBinaryFile/PptFile/Records/SSSlideInfoAtom.h b/MsBinaryFile/PptFile/Records/SSSlideInfoAtom.h index 8a569ea666..f950933d7f 100644 --- a/MsBinaryFile/PptFile/Records/SSSlideInfoAtom.h +++ b/MsBinaryFile/PptFile/Records/SSSlideInfoAtom.h @@ -62,11 +62,76 @@ public: public: - CSlideShowSlideInfoAtom(); - ~CSlideShowSlideInfoAtom(); - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) override; + CSlideShowSlideInfoAtom() + { + m_nSlideTime = -1; + m_nSoundRef = 0xFFFFFFFE; - double GetTimeTransition(); - double GetTimeSlide(); + m_nEffectDirection = 0; + m_nEffectType = 0; + + m_bManualAdvance = false; + m_bHidden = false; + m_bSound = false; + m_bLoopSound = false; + m_bStopSound = false; + m_bAutoAdvance = false; + m_bCursorVisible = false; + + m_nSpeed = 1; + } + + ~CSlideShowSlideInfoAtom() + { + } + + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + m_nSlideTime = (INT)StreamUtils::ReadDWORD ( pStream ); + m_nSoundRef = StreamUtils::ReadDWORD ( pStream ); + + m_nEffectDirection = StreamUtils::ReadBYTE ( pStream ); + m_nEffectType = StreamUtils::ReadBYTE ( pStream ); + + BYTE bValue = StreamUtils::ReadBYTE ( pStream ); + + m_bManualAdvance = (0x01 == (0x01 & bValue)); + m_bHidden = (0x04 == (0x04 & bValue)); + m_bSound = (0x10 == (0x10 & bValue)); + m_bLoopSound = (0x40 == (0x40 & bValue)); + + bValue = StreamUtils::ReadBYTE ( pStream ); + + m_bStopSound = (0x01 == (0x01 & bValue)); + m_bAutoAdvance = (0x04 == (0x04 & bValue)); + m_bCursorVisible = (0x10 == (0x10 & bValue)); + + //_UINT32 dwValue = StreamUtils::ReadDWORD ( pStream ); + //m_nSpeed = ( 0x01 == ( 0x01 & ((BYTE)dwValue) ) ); + m_nSpeed = StreamUtils::ReadBYTE( pStream ); + StreamUtils::StreamSkip(3, pStream); + } + + double GetTimeTransition() + { + double dTime = 500.0; + if (0 == m_nSpeed) + { + dTime = 750.0; + } + else if (2 == m_nSpeed) + { + dTime = 250.0; + } + + return dTime; + } + + double GetTimeSlide() + { + return (double)m_nSlideTime; + } }; diff --git a/MsBinaryFile/PptFile/Records/SSlideLayoutAtom.cpp b/MsBinaryFile/PptFile/Records/SSlideLayoutAtom.cpp index edf4eb8a60..e32de9b15d 100644 --- a/MsBinaryFile/PptFile/Records/SSlideLayoutAtom.cpp +++ b/MsBinaryFile/PptFile/Records/SSlideLayoutAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "SSlideLayoutAtom.h" diff --git a/MsBinaryFile/PptFile/Records/SSlideLayoutAtom.h b/MsBinaryFile/PptFile/Records/SSlideLayoutAtom.h index 088715c0a1..50428ebee1 100644 --- a/MsBinaryFile/PptFile/Records/SSlideLayoutAtom.h +++ b/MsBinaryFile/PptFile/Records/SSlideLayoutAtom.h @@ -38,10 +38,17 @@ public: INT m_nGeom; BYTE m_pPlaceHolderID[8]; + CRecordSSlideLayoutAtom() + { + } - CRecordSSlideLayoutAtom(); - ~CRecordSSlideLayoutAtom(); + ~CRecordSSlideLayoutAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } -}; +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/ShapeFlags10Atom.cpp b/MsBinaryFile/PptFile/Records/ShapeFlags10Atom.cpp index 57e516d1d0..80d449b1be 100644 --- a/MsBinaryFile/PptFile/Records/ShapeFlags10Atom.cpp +++ b/MsBinaryFile/PptFile/Records/ShapeFlags10Atom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "ShapeFlags10Atom.h" diff --git a/MsBinaryFile/PptFile/Records/ShapeFlags10Atom.h b/MsBinaryFile/PptFile/Records/ShapeFlags10Atom.h index 5644e5ec5a..5166948116 100644 --- a/MsBinaryFile/PptFile/Records/ShapeFlags10Atom.h +++ b/MsBinaryFile/PptFile/Records/ShapeFlags10Atom.h @@ -35,8 +35,18 @@ class CRecordShapeFlags10Atom : public CUnknownRecord { public: - BYTE m_nFlags; + BYTE m_nFlags; + + CRecordShapeFlags10Atom() + { + } + ~CRecordShapeFlags10Atom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/ShapeFlagsAtom.cpp b/MsBinaryFile/PptFile/Records/ShapeFlagsAtom.cpp index a6e18f72b5..943f144877 100644 --- a/MsBinaryFile/PptFile/Records/ShapeFlagsAtom.cpp +++ b/MsBinaryFile/PptFile/Records/ShapeFlagsAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "ShapeFlagsAtom.h" diff --git a/MsBinaryFile/PptFile/Records/ShapeFlagsAtom.h b/MsBinaryFile/PptFile/Records/ShapeFlagsAtom.h index f761101892..4eee18b6b1 100644 --- a/MsBinaryFile/PptFile/Records/ShapeFlagsAtom.h +++ b/MsBinaryFile/PptFile/Records/ShapeFlagsAtom.h @@ -36,7 +36,17 @@ class CRecordShapeFlagsAtom : public CUnknownRecord { public: BYTE m_nFlags; + + CRecordShapeFlagsAtom() + { + } + ~CRecordShapeFlagsAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/ShapeProgBinaryTagSubContainerOrAtom.cpp b/MsBinaryFile/PptFile/Records/ShapeProgBinaryTagSubContainerOrAtom.cpp index 171557a3cf..32c2586da7 100644 --- a/MsBinaryFile/PptFile/Records/ShapeProgBinaryTagSubContainerOrAtom.cpp +++ b/MsBinaryFile/PptFile/Records/ShapeProgBinaryTagSubContainerOrAtom.cpp @@ -1,3 +1,64 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 +* +*//* + * (c) Copyright Ascensio System SIA 2010-2019 + * + * 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-12 Ernesta Birznieka-Upisha + * 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 "ShapeProgBinaryTagSubContainerOrAtom.h" diff --git a/MsBinaryFile/PptFile/Records/ShapeProgBinaryTagSubContainerOrAtom.h b/MsBinaryFile/PptFile/Records/ShapeProgBinaryTagSubContainerOrAtom.h index 4c95411a43..05bf250a21 100644 --- a/MsBinaryFile/PptFile/Records/ShapeProgBinaryTagSubContainerOrAtom.h +++ b/MsBinaryFile/PptFile/Records/ShapeProgBinaryTagSubContainerOrAtom.h @@ -46,26 +46,53 @@ class CRecordPP9ShapeBinaryTagExtension : public CUnknownRecord { public: CRecordStyleTextProp9Atom m_styleTextPropAtom; + virtual ~CRecordPP9ShapeBinaryTagExtension(){} - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override + { + m_oHeader = oHeader; + + SRecordHeader ReadHeader; + ReadHeader.ReadFromStream(pStream); + + m_styleTextPropAtom.ReadFromStream(ReadHeader, pStream); + } }; class CRecordPP10ShapeBinaryTagExtension : public CUnknownRecord { public: CRecordStyleTextProp10Atom m_styleTextPropAtom; + virtual ~CRecordPP10ShapeBinaryTagExtension(){} - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override + { + m_oHeader = oHeader; + + SRecordHeader ReadHeader; + ReadHeader.ReadFromStream(pStream); + + m_styleTextPropAtom.ReadFromStream(ReadHeader, pStream); + } }; class CRecordPP11ShapeBinaryTagExtension : public CUnknownRecord { public: CRecordStyleTextProp11Atom m_styleTextPropAtom; + virtual ~CRecordPP11ShapeBinaryTagExtension(){} - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override + { + m_oHeader = oHeader; + + SRecordHeader ReadHeader; + ReadHeader.ReadFromStream(pStream); + + m_styleTextPropAtom.ReadFromStream(ReadHeader, pStream); + } }; class CRecordShapeProgBinaryTagSubContainerOrAtom : public CUnknownRecord @@ -74,8 +101,42 @@ public: IRecord* m_pTagContainer; CRecordCString* m_pTagName; - CRecordShapeProgBinaryTagSubContainerOrAtom(); + CRecordShapeProgBinaryTagSubContainerOrAtom() : m_pTagContainer(NULL), m_pTagName(NULL){} + virtual ~CRecordShapeProgBinaryTagSubContainerOrAtom(){} - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override + { + m_oHeader = oHeader; + LONG lPos = 0; StreamUtils::StreamPosition(lPos, pStream); + + SRecordHeader ReadHeader; + ReadHeader.ReadFromStream(pStream); + + if (ReadHeader.RecType == RT_CString) + { + RELEASEOBJECT(m_pTagName); + RELEASEOBJECT(m_pTagContainer); + m_pTagName = new CRecordCString(); + m_pTagName->ReadFromStream(ReadHeader, pStream); + + SRecordHeader childHeader; + if (!childHeader.ReadFromStream(pStream)) + return; + + if (m_pTagName->m_strText == TN_PPT9) { + m_pTagContainer = new CRecordPP9ShapeBinaryTagExtension(); + dynamic_cast + (m_pTagContainer)->ReadFromStream(childHeader, pStream); + } else if (m_pTagName->m_strText == TN_PPT10) { + m_pTagContainer = new CRecordPP10ShapeBinaryTagExtension(); + dynamic_cast + (m_pTagContainer)->ReadFromStream(childHeader, pStream); + } else if (m_pTagName->m_strText == TN_PPT11) { + m_pTagContainer = new CRecordPP11ShapeBinaryTagExtension(); + dynamic_cast + (m_pTagContainer)->ReadFromStream(childHeader, pStream); + } + } + } }; } diff --git a/MsBinaryFile/PptFile/Records/SlideAtom.cpp b/MsBinaryFile/PptFile/Records/SlideAtom.cpp index b31f45d900..4506f426e5 100644 --- a/MsBinaryFile/PptFile/Records/SlideAtom.cpp +++ b/MsBinaryFile/PptFile/Records/SlideAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "SlideAtom.h" CRecordSlideAtom::CRecordSlideAtom() diff --git a/MsBinaryFile/PptFile/Records/SlideAtom.h b/MsBinaryFile/PptFile/Records/SlideAtom.h index 221d200b92..77b86be81c 100644 --- a/MsBinaryFile/PptFile/Records/SlideAtom.h +++ b/MsBinaryFile/PptFile/Records/SlideAtom.h @@ -45,8 +45,37 @@ public: public: - CRecordSlideAtom(); - ~CRecordSlideAtom(); + CRecordSlideAtom() + { + m_oLayout.m_hash = 0; + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + ~CRecordSlideAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_oLayout.m_nGeom = (INT)StreamUtils::ReadLONG(pStream); + for (int nIndex = 0; nIndex < 8; nIndex++) + { + m_oLayout.m_pPlaceHolderID[nIndex] = StreamUtils::ReadBYTE(pStream); + m_oLayout.m_hash = (m_oLayout.m_hash << 4) + m_oLayout.m_pPlaceHolderID[nIndex]; + } + + m_oLayout.m_hash += (((_UINT64)m_oLayout.m_nGeom) << 32) ; + + m_nMasterIDRef = (UINT)StreamUtils::ReadDWORD(pStream); + m_nNotesIDRef = (UINT)StreamUtils::ReadDWORD(pStream); + + USHORT nFlag = StreamUtils::ReadWORD(pStream); + + m_bMasterObjects = ((nFlag & 0x01) == 0x01); + m_bMasterScheme = ((nFlag & 0x02) == 0x02); + m_bMasterBackground = ((nFlag & 0x04) == 0x04); + + StreamUtils::StreamSkip(2, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/SlideColorSchemeAtom.cpp b/MsBinaryFile/PptFile/Records/SlideColorSchemeAtom.cpp index 588b2bb5cc..fa6e20db63 100644 --- a/MsBinaryFile/PptFile/Records/SlideColorSchemeAtom.cpp +++ b/MsBinaryFile/PptFile/Records/SlideColorSchemeAtom.cpp @@ -1,3 +1,64 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 +* +*//* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "SlideColorSchemeAtom.h" diff --git a/MsBinaryFile/PptFile/Records/SlideColorSchemeAtom.h b/MsBinaryFile/PptFile/Records/SlideColorSchemeAtom.h index eafa4b9431..be3dad62e1 100644 --- a/MsBinaryFile/PptFile/Records/SlideColorSchemeAtom.h +++ b/MsBinaryFile/PptFile/Records/SlideColorSchemeAtom.h @@ -40,10 +40,23 @@ public: SColorAtom m_oShadowColor; SColorAtom m_o3DColor; - CRecordSplitMenuColorRecord(); - ~CRecordSplitMenuColorRecord(); + CRecordSplitMenuColorRecord() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordSplitMenuColorRecord() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + NSStreamReader::Read(pStream, m_oFillColor); + NSStreamReader::Read(pStream, m_oLineColor); + NSStreamReader::Read(pStream, m_oShadowColor); + NSStreamReader::Read(pStream, m_o3DColor); + } }; class CRecordMostRecentlyUserColors : public CUnknownRecord @@ -51,9 +64,24 @@ class CRecordMostRecentlyUserColors : public CUnknownRecord public: std::vector m_oColors; + CRecordMostRecentlyUserColors() + { + } - CRecordMostRecentlyUserColors(); - ~CRecordMostRecentlyUserColors(); + ~CRecordMostRecentlyUserColors() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + for (unsigned int i = 0; i < m_oHeader.RecLen / 4; i++) + { + SColorAtom color; + NSStreamReader::Read(pStream, color); + + m_oColors.push_back(color); + } + } }; diff --git a/MsBinaryFile/PptFile/Records/SlideContainer.cpp b/MsBinaryFile/PptFile/Records/SlideContainer.cpp index 53b9e41b7c..30713a5fb1 100644 --- a/MsBinaryFile/PptFile/Records/SlideContainer.cpp +++ b/MsBinaryFile/PptFile/Records/SlideContainer.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "SlideContainer.h" diff --git a/MsBinaryFile/PptFile/Records/SlideContainer.h b/MsBinaryFile/PptFile/Records/SlideContainer.h index a3dd3ca99c..60b23482f0 100644 --- a/MsBinaryFile/PptFile/Records/SlideContainer.h +++ b/MsBinaryFile/PptFile/Records/SlideContainer.h @@ -54,15 +54,119 @@ private: public: - CRecordSlide(); + CRecordSlide() + { + m_bExistsTransition = false; + m_pSlideProgTagsContainer = NULL; + m_lCountReferences = 0; - virtual ~CRecordSlide(); + m_Index = -1; + m_IndexUser = 0; - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); + AddRef(); + } - bool IsSlide(); + virtual ~CRecordSlide() + { + Clear(); + RELEASEOBJECT ( m_pSlideProgTagsContainer ); + } - void AddRef(); - void Release(); - CRecordSlide* QueryInterface(); + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + m_arRecords.clear(); + + LONG lPosition = 0; + StreamUtils::StreamPosition(lPosition, pStream); + + m_oHeader = oHeader; + + UINT lCurLen = 0; + SRecordHeader oRec; + + while (lCurLen < m_oHeader.RecLen) + { + if (oRec.ReadFromStream(pStream) == FALSE) + { + break; + } + + if ( RT_SlideShowSlideInfoAtom == oRec.RecType ) + { + m_bExistsTransition = true; + m_oSlideShowSlideInfoAtom.ReadFromStream ( oRec, pStream ); + + lCurLen += (8 + oRec.RecLen); + continue; + } + + if ( RT_ProgTags == oRec.RecType ) + { + m_pSlideProgTagsContainer = + new CRecordSlideProgTagsContainer(); + m_pSlideProgTagsContainer->ReadFromStream(oRec, pStream); + + lCurLen += (8 + oRec.RecLen); + continue; + } + + if (RT_VbaInfo == oRec.RecType) + { + auto pVbaInfo = new CRecordsContainer; + pVbaInfo->ReadFromStream(oRec, pStream); + m_arRecords.push_back(pVbaInfo); + + lCurLen += (8 + oRec.RecLen); + continue; + } + + + IRecord* pRecord = CreateByType ( oRec ); + + + + pRecord->ReadFromStream(oRec, pStream); + m_arRecords.push_back(pRecord); + + + lCurLen += (8 + oRec.RecLen); + } + if (lCurLen != m_oHeader.RecLen) + { + // нужно разобраться, что тут такое!!! + LONG lPosition = 0; + StreamUtils::StreamSeek(lPosition + m_oHeader.RecLen, pStream); + } + } + + bool IsSlide() + { + for (size_t nIndex = 0; nIndex < m_arRecords.size(); ++nIndex) + { + if ((RT_Slide == m_arRecords[nIndex]->m_oHeader.RecType) || + (RT_MainMaster == m_arRecords[nIndex]->m_oHeader.RecType) || + (RT_Notes == m_arRecords[nIndex]->m_oHeader.RecType)) + { + return true; + } + } + return false; + } + + void AddRef() + { + ++m_lCountReferences; + } + void Release() + { + --m_lCountReferences; + if (0 == m_lCountReferences) + delete this; + } + CRecordSlide* QueryInterface() + { + AddRef(); + return this; + } }; diff --git a/MsBinaryFile/PptFile/Records/SlideFlags10Atom.cpp b/MsBinaryFile/PptFile/Records/SlideFlags10Atom.cpp index cc775b1c28..783267d909 100644 --- a/MsBinaryFile/PptFile/Records/SlideFlags10Atom.cpp +++ b/MsBinaryFile/PptFile/Records/SlideFlags10Atom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "SlideFlags10Atom.h" diff --git a/MsBinaryFile/PptFile/Records/SlideFlags10Atom.h b/MsBinaryFile/PptFile/Records/SlideFlags10Atom.h index a6c99e4cdd..9c7d0bfe49 100644 --- a/MsBinaryFile/PptFile/Records/SlideFlags10Atom.h +++ b/MsBinaryFile/PptFile/Records/SlideFlags10Atom.h @@ -39,7 +39,15 @@ namespace PPT_FORMAT class CRecordSlideFlags10Atom : public CUnknownRecord { public: - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override + { + m_oHeader = oHeader; + + _UINT32 data(StreamUtils::ReadLONG(pStream)); + + m_fPreserveMaster = ( 0x01 == ( 0x01 & ((BYTE)data) ) ); + m_fOverrideMasterAnimation = ( 0x02 == ( 0x02 & ((BYTE)data) ) ); + } public: bool m_fPreserveMaster; bool m_fOverrideMasterAnimation; diff --git a/MsBinaryFile/PptFile/Records/SlideListWithText.cpp b/MsBinaryFile/PptFile/Records/SlideListWithText.cpp index 9130829f4a..c51f3fd70e 100644 --- a/MsBinaryFile/PptFile/Records/SlideListWithText.cpp +++ b/MsBinaryFile/PptFile/Records/SlideListWithText.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "SlideListWithText.h" diff --git a/MsBinaryFile/PptFile/Records/SlideListWithText.h b/MsBinaryFile/PptFile/Records/SlideListWithText.h index 16d46bde59..f891e11d7e 100644 --- a/MsBinaryFile/PptFile/Records/SlideListWithText.h +++ b/MsBinaryFile/PptFile/Records/SlideListWithText.h @@ -53,9 +53,118 @@ public: public: - CRecordSlideListWithText(); + CRecordSlideListWithText() : m_arSlides() + { + m_Type = CollectionOfSlides; + } - ~CRecordSlideListWithText(); + ~CRecordSlideListWithText() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + m_Type = (Instances)m_oHeader.RecInstance; + + if (m_oHeader.IsContainer()) + { + // а по-другому и быть не могло... + _UINT32 lSymbolCount = 0; + + UINT lCurLen = 0; + SRecordHeader oRec; + + while (lCurLen < m_oHeader.RecLen) + { + if (oRec.ReadFromStream(pStream) == FALSE) + { + break; + } + + IRecord* pRecord = CreateByType(oRec); + + if (RT_StyleTextPropAtom == oRec.RecType) + { + ((CRecordStyleTextPropAtom*)(pRecord))->m_lCount = lSymbolCount; + } + else if (RT_TextSpecialInfoAtom == oRec.RecType) + { + ((CRecordTextSpecInfoAtom*)(pRecord))->m_lCount = lSymbolCount; + } + + pRecord->ReadFromStream(oRec, pStream); + lCurLen += (8 + oRec.RecLen); + + if (RT_SlidePersistAtom == oRec.RecType) + { + m_arSlides.push_back((CRecordSlidePersistAtom*)pRecord); + + std::vector elm; + m_arTextPlaceHolders.push_back(elm); + } + else + { + long nCurrentSlide = (long)m_arSlides.size() - 1; + if (0 > nCurrentSlide) + continue; + + CRecordTextHeaderAtom* pHeader = dynamic_cast(pRecord); + if (NULL != pHeader) + { + CTextFullSettings oAttr; + m_arTextPlaceHolders[nCurrentSlide].push_back(oAttr); + m_arTextPlaceHolders[nCurrentSlide][m_arTextPlaceHolders[nCurrentSlide].size() - 1].m_nTextType = pHeader->m_nTextType; + + m_arRecords.push_back(pRecord); + continue; + } + CRecordTextCharsAtom* pChars = dynamic_cast(pRecord); + CRecordTextBytesAtom* pBytes = dynamic_cast(pRecord); + + long nCurrentTextHeader = (long)m_arTextPlaceHolders[nCurrentSlide].size() - 1; + if (0 > nCurrentTextHeader) + continue; + + // здесь еще настойки кроме текста + if (NULL != pChars) + { + m_arTextPlaceHolders[nCurrentSlide][nCurrentTextHeader].m_strText = pChars->m_strText; + lSymbolCount = (_UINT32)pChars->m_strText.length(); + } + else if (NULL != pBytes) + { + m_arTextPlaceHolders[nCurrentSlide][nCurrentTextHeader].m_strText = pBytes->m_strText; + lSymbolCount = (_UINT32)pBytes->m_strText.length(); + } + + if (RT_StyleTextPropAtom == oRec.RecType) + { + m_arTextPlaceHolders[nCurrentSlide][nCurrentTextHeader].m_pTextStyleProp = + dynamic_cast(pRecord); + } + if (RT_TextSpecialInfoAtom == oRec.RecType) + { + m_arTextPlaceHolders[nCurrentSlide][nCurrentTextHeader].m_pTextSpecInfo = + dynamic_cast(pRecord); + } + if (RT_TextRulerAtom == oRec.RecType) + { + m_arTextPlaceHolders[nCurrentSlide][nCurrentTextHeader].m_pTextRuler = + dynamic_cast(pRecord); + } + if (RT_TextInteractiveInfoAtom == oRec.RecType) + { + CRecordTextInteractiveInfoAtom* pTxRanges = dynamic_cast(pRecord); + PPT_FORMAT::CTextRange oRange; + oRange.m_lStart = pTxRanges->m_lStart; + oRange.m_lEnd = pTxRanges->m_lEnd; + m_arTextPlaceHolders[nCurrentSlide][nCurrentTextHeader].m_arRanges.push_back(oRange); + } + } + + m_arRecords.push_back(pRecord); + } + } + } }; diff --git a/MsBinaryFile/PptFile/Records/SlidePersistAtom.cpp b/MsBinaryFile/PptFile/Records/SlidePersistAtom.cpp index 893d6fe098..bca37930a3 100644 --- a/MsBinaryFile/PptFile/Records/SlidePersistAtom.cpp +++ b/MsBinaryFile/PptFile/Records/SlidePersistAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "SlidePersistAtom.h" diff --git a/MsBinaryFile/PptFile/Records/SlidePersistAtom.h b/MsBinaryFile/PptFile/Records/SlidePersistAtom.h index 1e60f184b4..fdc7aa7458 100644 --- a/MsBinaryFile/PptFile/Records/SlidePersistAtom.h +++ b/MsBinaryFile/PptFile/Records/SlidePersistAtom.h @@ -43,10 +43,31 @@ public: INT m_nNumberText; _UINT32 m_nSlideID; - CRecordSlidePersistAtom(); + CRecordSlidePersistAtom() + { + } - ~CRecordSlidePersistAtom(); + ~CRecordSlidePersistAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; -}; + m_nPsrRef = StreamUtils::ReadDWORD(pStream); + + BYTE Mem = 0; + Mem = StreamUtils::ReadBYTE(pStream); + m_bShouldCollapse = ((Mem & 0x02) == 0x02); + m_bNonOutlineData = ((Mem & 0x04) == 0x04); + + StreamUtils::StreamSkip(3, pStream); + + m_nNumberText = (INT)StreamUtils::ReadLONG(pStream); + m_nSlideID = StreamUtils::ReadDWORD(pStream); + + StreamUtils::StreamSkip(4, pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/SlideProgTagsContainer.cpp b/MsBinaryFile/PptFile/Records/SlideProgTagsContainer.cpp index 607aa4162f..0c425cf2ea 100644 --- a/MsBinaryFile/PptFile/Records/SlideProgTagsContainer.cpp +++ b/MsBinaryFile/PptFile/Records/SlideProgTagsContainer.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "SlideProgTagsContainer.h" diff --git a/MsBinaryFile/PptFile/Records/SlideProgTagsContainer.h b/MsBinaryFile/PptFile/Records/SlideProgTagsContainer.h index 7c997f7c67..b61b01eda0 100644 --- a/MsBinaryFile/PptFile/Records/SlideProgTagsContainer.h +++ b/MsBinaryFile/PptFile/Records/SlideProgTagsContainer.h @@ -60,11 +60,42 @@ class CRecordPP9SlideBinaryTagExtension : public CUnknownRecord public: std::vector m_rgTextMasterStyleAtom; - CRecordPP9SlideBinaryTagExtension(); + CRecordPP9SlideBinaryTagExtension() + { - ~CRecordPP9SlideBinaryTagExtension(); + } - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ); + ~CRecordPP9SlideBinaryTagExtension() + { + for (auto pEl : m_rgTextMasterStyleAtom) + { + RELEASEOBJECT(pEl) + } + } + + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); + + UINT lCurLen = 0; + + SRecordHeader ReadHeader; + + while ( lCurLen < m_oHeader.RecLen ) + { + if ( ReadHeader.ReadFromStream(pStream) == false) + break; + + lCurLen += 8 + ReadHeader.RecLen; + auto pStyle = new CRecordTextMasterStyle9Atom; + pStyle->ReadFromStream(ReadHeader, pStream); + m_rgTextMasterStyleAtom.push_back(pStyle); + } + + StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } }; @@ -72,11 +103,141 @@ class CRecordPP10SlideBinaryTagExtension : public CUnknownRecord { public: - CRecordPP10SlideBinaryTagExtension (); + CRecordPP10SlideBinaryTagExtension () : + m_pLinkedSlideAtom(nullptr), + m_pSlideFlagsAtom(nullptr), + m_pSlideTimeAtom(nullptr), + m_pHashCode10Atom(nullptr), + m_pExtTimeNodeContainer(nullptr), + m_pBuildListContainer(nullptr), - virtual ~CRecordPP10SlideBinaryTagExtension (); + m_haveLinkedSlide(false), + m_haveSlideFlags(false), + m_haveSlideTime(false), + m_haveHashCode(false), + m_haveExtTime(false), + m_haveBuildList(false) + { + } - virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ); + virtual ~CRecordPP10SlideBinaryTagExtension () + { + RELEASEOBJECT (m_pLinkedSlideAtom) + RELEASEOBJECT (m_pSlideFlagsAtom) + RELEASEOBJECT (m_pSlideTimeAtom) + RELEASEOBJECT (m_pHashCode10Atom) + RELEASEOBJECT (m_pExtTimeNodeContainer) + RELEASEOBJECT (m_pBuildListContainer) + + for (auto pEl : m_arrRgTextMasterStyleAtom) + RELEASEOBJECT(pEl) + for (auto pEl : m_arrRgComment10Container) + RELEASEOBJECT(pEl) + for (auto pEl : m_arrRgLinkedShape10Atom) + RELEASEOBJECT(pEl) + } + + virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) + { + m_oHeader = oHeader; + + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); + + UINT lCurLen = 0; + + SRecordHeader ReadHeader; + + while ( lCurLen < m_oHeader.RecLen ) + { + if ( ReadHeader.ReadFromStream(pStream) == false) + break; + + lCurLen += 8 + ReadHeader.RecLen; + + switch (ReadHeader.RecType) { + case RT_TextMasterStyle10Atom: + { + CRecordTextMasterStyleAtom* pRecord = + new CRecordTextMasterStyleAtom(); + pRecord->ReadFromStream(ReadHeader, pStream); + m_arrRgTextMasterStyleAtom.push_back(pRecord); + break; + } + + case RT_Comment10: + { + CRecordComment10Container* pRecord = + new CRecordComment10Container(); + pRecord->ReadFromStream(ReadHeader, pStream); + m_arrRgComment10Container.push_back(pRecord); + break; + } + + case RT_LinkedSlide10Atom : + { + m_pLinkedSlideAtom = new CRecordLinkedSlide10Atom(); + m_pLinkedSlideAtom->ReadFromStream(ReadHeader, pStream); + m_haveLinkedSlide = true; + break; + } + + case RT_LinkedShape10Atom : + { + CRecordLinkedShape10Atom* pRecord = + new CRecordLinkedShape10Atom(); + pRecord->ReadFromStream(ReadHeader, pStream); + m_arrRgLinkedShape10Atom.push_back(pRecord); + break; + } + + case RT_SlideFlags10Atom: + { + m_pSlideFlagsAtom = new CRecordSlideFlags10Atom(); + m_pSlideFlagsAtom->ReadFromStream(ReadHeader, pStream); + m_haveSlideFlags = true; + break; + } + + case RT_SlideTime10Atom: + { + m_pSlideTimeAtom = new CRecordSlideTime10Atom(); + m_pSlideTimeAtom->ReadFromStream(ReadHeader, pStream); + m_haveSlideTime = true; + break; + } + + case RT_HashCodeAtom: + { + m_pHashCode10Atom = new CRecordHashCode10Atom(); + m_pHashCode10Atom->ReadFromStream(ReadHeader, pStream); + m_haveHashCode = true; + break; + } + + case RT_TimeExtTimeNodeContainer: + { + m_pExtTimeNodeContainer = new CRecordExtTimeNodeContainer(); + m_pExtTimeNodeContainer->ReadFromStream(ReadHeader, pStream); + m_haveExtTime = true; + break; + } + + case RT_BuildList: + { + m_pBuildListContainer = new CRecordBuildListContainer(); + m_pBuildListContainer->ReadFromStream(ReadHeader, pStream); + m_haveBuildList = true; + break; + } + + default: + break; + } + } + + StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream ); + } public: std::vector m_arrRgTextMasterStyleAtom; @@ -101,9 +262,15 @@ public: class CRecordPP12SlideBinaryTagExtension : public CUnknownRecord { public: - CRecordPP12SlideBinaryTagExtension(); + CRecordPP12SlideBinaryTagExtension() + { - ~CRecordPP12SlideBinaryTagExtension(); + } + + ~CRecordPP12SlideBinaryTagExtension() + { + + } virtual void ReadFromStream ( SRecordHeader & oHeader, POLE::Stream* pStream ) { @@ -124,9 +291,54 @@ public: class CRecordSlideProgBinaryTagSubContainerOrAtom : public CUnknownRecord { public: - CRecordSlideProgBinaryTagSubContainerOrAtom(); - ~CRecordSlideProgBinaryTagSubContainerOrAtom(); - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + CRecordSlideProgBinaryTagSubContainerOrAtom() : + m_pTagName(nullptr), m_pTagContainer(nullptr) + {} + ~CRecordSlideProgBinaryTagSubContainerOrAtom() + { + RELEASEOBJECT(m_pTagName); + RELEASEOBJECT(m_pTagContainer); + } + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override + { + m_oHeader = oHeader; + LONG lPos = 0; StreamUtils::StreamPosition(lPos, pStream); + + SRecordHeader ReadHeader; + ReadHeader.ReadFromStream(pStream); + + if (m_oHeader.RecType == RT_ProgBinaryTag) + { + m_pTagName = new CRecordCString(); + m_pTagName->ReadFromStream(ReadHeader, pStream); + + SRecordHeader childHeader; + if (!childHeader.ReadFromStream(pStream)) + return; + + if (m_pTagName->m_strText == TN_PPT9) { + m_pTagContainer = new CRecordPP9SlideBinaryTagExtension(); + dynamic_cast + (m_pTagContainer)->ReadFromStream(childHeader, pStream); + } else if (m_pTagName->m_strText == TN_PPT10) { + m_pTagContainer = new CRecordPP10SlideBinaryTagExtension(); + dynamic_cast + (m_pTagContainer)->ReadFromStream(childHeader, pStream); + } else if (m_pTagName->m_strText == TN_PPT12) { + m_pTagContainer = new CRecordPP12SlideBinaryTagExtension(); + dynamic_cast + (m_pTagContainer)->ReadFromStream(childHeader, pStream); + } + + } else if (m_oHeader.RecType == RT_ProgStringTag) + { + m_pTagContainer = new CRecordProgStringTagContainer(); + dynamic_cast + (m_pTagContainer)->ReadFromStream(ReadHeader, pStream); + } + LONG lSeek = lPos + m_oHeader.RecLen; + StreamUtils::StreamSeek(lSeek, pStream); + } public: CRecordCString* m_pTagName; // OPTIONAL @@ -137,14 +349,50 @@ class CRecordSlideProgTagsContainer : public CUnknownRecord { public: - CRecordSlideProgTagsContainer (); + CRecordSlideProgTagsContainer () + { - ~CRecordSlideProgTagsContainer(); + } + + ~CRecordSlideProgTagsContainer() + { + for (auto pEl : m_arrRgChildRec) + RELEASEOBJECT(pEl) + } - virtual void ReadFromStream (SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual void ReadFromStream (SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; - CRecordPP10SlideBinaryTagExtension* getPP10SlideBinaryTagExtension(); + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); + + LONG lCurLen(0); + SRecordHeader ReadHeader; + + while (lCurLen < (LONG)m_oHeader.RecLen) + { + if ( ReadHeader.ReadFromStream(pStream) == false) + break; + lCurLen += 8 + ReadHeader.RecLen; + CRecordSlideProgBinaryTagSubContainerOrAtom* pRecord = + new CRecordSlideProgBinaryTagSubContainerOrAtom(); + pRecord->ReadFromStream(ReadHeader, pStream); + m_arrRgChildRec.push_back(pRecord); + } + + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + } + + CRecordPP10SlideBinaryTagExtension* getPP10SlideBinaryTagExtension() + { + for (auto* rec : m_arrRgChildRec) + if (rec->m_pTagName && rec->m_pTagName->m_strText == TN_PPT10) + return (CRecordPP10SlideBinaryTagExtension*)rec->m_pTagContainer; + + return nullptr; + } public: std::vector m_arrRgChildRec; diff --git a/MsBinaryFile/PptFile/Records/SlideTime10Atom.cpp b/MsBinaryFile/PptFile/Records/SlideTime10Atom.cpp index b6f319e218..005a0bc685 100644 --- a/MsBinaryFile/PptFile/Records/SlideTime10Atom.cpp +++ b/MsBinaryFile/PptFile/Records/SlideTime10Atom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "SlideTime10Atom.h" diff --git a/MsBinaryFile/PptFile/Records/SlideTime10Atom.h b/MsBinaryFile/PptFile/Records/SlideTime10Atom.h index 65b43905ef..78dd949531 100644 --- a/MsBinaryFile/PptFile/Records/SlideTime10Atom.h +++ b/MsBinaryFile/PptFile/Records/SlideTime10Atom.h @@ -47,7 +47,13 @@ typedef struct _FILETIME { class CRecordSlideTime10Atom : public CUnknownRecord { public: -void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; +void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override +{ + m_oHeader = oHeader; + + m_oFileTime.dwLowDateTime = StreamUtils::ReadDWORD(pStream); + m_oFileTime.dwHighDateTime = StreamUtils::ReadDWORD(pStream); +} public: FILETIME m_oFileTime; diff --git a/MsBinaryFile/PptFile/Records/SlideViewInfoAtom.cpp b/MsBinaryFile/PptFile/Records/SlideViewInfoAtom.cpp index 207a22669f..49da447b20 100644 --- a/MsBinaryFile/PptFile/Records/SlideViewInfoAtom.cpp +++ b/MsBinaryFile/PptFile/Records/SlideViewInfoAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "SlideViewInfoAtom.h" diff --git a/MsBinaryFile/PptFile/Records/SlideViewInfoAtom.h b/MsBinaryFile/PptFile/Records/SlideViewInfoAtom.h index 6485127b5a..937ea3dff8 100644 --- a/MsBinaryFile/PptFile/Records/SlideViewInfoAtom.h +++ b/MsBinaryFile/PptFile/Records/SlideViewInfoAtom.h @@ -39,9 +39,22 @@ class CRecordSlideViewInfoAtom : public CUnknownRecord BOOL1 m_bSnapToShape; public: - CRecordSlideViewInfoAtom(); - ~CRecordSlideViewInfoAtom(); + + CRecordSlideViewInfoAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordSlideViewInfoAtom() + { + } -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_bShowGuides = StreamUtils::ReadBYTE(pStream); + m_bSnapToGrid = StreamUtils::ReadBYTE(pStream); + m_bSnapToShape = StreamUtils::ReadBYTE(pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/SoundCollAtom.cpp b/MsBinaryFile/PptFile/Records/SoundCollAtom.cpp index d0e149d96a..c6b74cf705 100644 --- a/MsBinaryFile/PptFile/Records/SoundCollAtom.cpp +++ b/MsBinaryFile/PptFile/Records/SoundCollAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "SoundCollAtom.h" diff --git a/MsBinaryFile/PptFile/Records/SoundCollAtom.h b/MsBinaryFile/PptFile/Records/SoundCollAtom.h index d726a00da3..27ca63baa2 100644 --- a/MsBinaryFile/PptFile/Records/SoundCollAtom.h +++ b/MsBinaryFile/PptFile/Records/SoundCollAtom.h @@ -37,8 +37,18 @@ class CRecordSoundCollAtom : public CUnknownRecord public: INT m_nObjectIdSeed; - CRecordSoundCollAtom(); - ~CRecordSoundCollAtom(); + CRecordSoundCollAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + ~CRecordSoundCollAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_nObjectIdSeed = StreamUtils::ReadDWORD(pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/SoundCollectionContainer.cpp b/MsBinaryFile/PptFile/Records/SoundCollectionContainer.cpp index d52b52363c..21033ab903 100644 --- a/MsBinaryFile/PptFile/Records/SoundCollectionContainer.cpp +++ b/MsBinaryFile/PptFile/Records/SoundCollectionContainer.cpp @@ -1,3 +1,64 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 +* +*//* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "SoundCollectionContainer.h" diff --git a/MsBinaryFile/PptFile/Records/SoundCollectionContainer.h b/MsBinaryFile/PptFile/Records/SoundCollectionContainer.h index e5c11b0d13..378658691c 100644 --- a/MsBinaryFile/PptFile/Records/SoundCollectionContainer.h +++ b/MsBinaryFile/PptFile/Records/SoundCollectionContainer.h @@ -36,9 +36,16 @@ class CRecordSoundCollectionContainer : public CRecordsContainer { public: - CRecordSoundCollectionContainer(); + CRecordSoundCollectionContainer() + { + } - ~CRecordSoundCollectionContainer(); + ~CRecordSoundCollectionContainer() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + CRecordsContainer::ReadFromStream(oHeader, pStream); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/SoundContainer.cpp b/MsBinaryFile/PptFile/Records/SoundContainer.cpp index a567e5ad44..e358af6188 100644 --- a/MsBinaryFile/PptFile/Records/SoundContainer.cpp +++ b/MsBinaryFile/PptFile/Records/SoundContainer.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "SoundContainer.h" diff --git a/MsBinaryFile/PptFile/Records/SoundContainer.h b/MsBinaryFile/PptFile/Records/SoundContainer.h index dc7bcd68a8..cc83928557 100644 --- a/MsBinaryFile/PptFile/Records/SoundContainer.h +++ b/MsBinaryFile/PptFile/Records/SoundContainer.h @@ -35,9 +35,18 @@ class CRecordSoundContainer : public CRecordsContainer { public: - CRecordSoundContainer(); - ~CRecordSoundContainer(); + + CRecordSoundContainer() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordSoundContainer() + { + } -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + CRecordsContainer::ReadFromStream(oHeader, pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/SoundDataBlob.cpp b/MsBinaryFile/PptFile/Records/SoundDataBlob.cpp index 3efe609f83..199e641cb7 100644 --- a/MsBinaryFile/PptFile/Records/SoundDataBlob.cpp +++ b/MsBinaryFile/PptFile/Records/SoundDataBlob.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "SoundDataBlob.h" diff --git a/MsBinaryFile/PptFile/Records/SoundDataBlob.h b/MsBinaryFile/PptFile/Records/SoundDataBlob.h index a7168eebdc..275529ccaa 100644 --- a/MsBinaryFile/PptFile/Records/SoundDataBlob.h +++ b/MsBinaryFile/PptFile/Records/SoundDataBlob.h @@ -39,13 +39,45 @@ class CRecordSoundDataBlob : public CUnknownRecord public: - CRecordSoundDataBlob(); + CRecordSoundDataBlob() + { + m_pData = NULL; + m_lSize = 0; + } - ~CRecordSoundDataBlob(); + ~CRecordSoundDataBlob() + { + ReleaseData(); + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + m_lSize = m_oHeader.RecLen; - void ReleaseData(); + if (0 < m_lSize) + { + m_pData = new BYTE[m_lSize]; + pStream->read(m_pData, m_lSize); + } + } - void SaveToFile(std::wstring strFile); -}; + void ReleaseData() + { + RELEASEARRAYOBJECTS(m_pData); + } + + void SaveToFile(std::wstring strFile) + { + if ((NULL == m_pData) || (0 >= m_lSize)) + return; + + NSFile::CFileBinary oFile; + oFile.CreateFileW(strFile); + + oFile.WriteFile((BYTE*)m_pData, (DWORD)m_lSize); + oFile.CloseFile(); + + ReleaseData(); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/StyleTextProp10Atom.cpp b/MsBinaryFile/PptFile/Records/StyleTextProp10Atom.cpp index 7bb5f1055d..a9ca27f366 100644 --- a/MsBinaryFile/PptFile/Records/StyleTextProp10Atom.cpp +++ b/MsBinaryFile/PptFile/Records/StyleTextProp10Atom.cpp @@ -1,5 +1,66 @@ -#include "StyleTextProp10Atom.h" +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "StyleTextProp10Atom.h"/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 +* +*/ void CRecordStyleTextProp10Atom::ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) { diff --git a/MsBinaryFile/PptFile/Records/StyleTextProp10Atom.h b/MsBinaryFile/PptFile/Records/StyleTextProp10Atom.h index 148054a8b2..50902fb5b3 100644 --- a/MsBinaryFile/PptFile/Records/StyleTextProp10Atom.h +++ b/MsBinaryFile/PptFile/Records/StyleTextProp10Atom.h @@ -42,7 +42,24 @@ class CRecordStyleTextProp10Atom : public CUnknownRecord public: std::vector rgStyleTextProp10; + virtual void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) + { + m_oHeader = oHeader; + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); - virtual void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + LONG lCurPos = 0; + StreamUtils::StreamPosition ( lCurPos, pStream ); + + while ( lPos + (LONG)m_oHeader.RecLen > lCurPos) + { + STextCFException10 style; + style.ReadFromStream(pStream); + rgStyleTextProp10.push_back(style); + + StreamUtils::StreamPosition ( lCurPos, pStream ); + } + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Records/StyleTextProp11Atom.cpp b/MsBinaryFile/PptFile/Records/StyleTextProp11Atom.cpp index e40061620f..4385238644 100644 --- a/MsBinaryFile/PptFile/Records/StyleTextProp11Atom.cpp +++ b/MsBinaryFile/PptFile/Records/StyleTextProp11Atom.cpp @@ -1,6 +1,36 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "StyleTextProp11Atom.h" - void CRecordStyleTextProp11Atom::ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) { m_oHeader = oHeader; diff --git a/MsBinaryFile/PptFile/Records/StyleTextProp11Atom.h b/MsBinaryFile/PptFile/Records/StyleTextProp11Atom.h index e0d1918a89..52e0a6246b 100644 --- a/MsBinaryFile/PptFile/Records/StyleTextProp11Atom.h +++ b/MsBinaryFile/PptFile/Records/StyleTextProp11Atom.h @@ -47,6 +47,24 @@ class CRecordStyleTextProp11Atom : public CUnknownRecord public: std::vector m_rgStyleTextProp11; - virtual void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + virtual void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) + { + m_oHeader = oHeader; + LONG lPos = 0; + StreamUtils::StreamPosition ( lPos, pStream ); + + LONG lCurPos = 0; + StreamUtils::StreamPosition ( lCurPos, pStream ); + + while ( lPos + (LONG)m_oHeader.RecLen > lCurPos) + { + SStyleTextProp11 style; + style.ReadFromStream(pStream); + m_rgStyleTextProp11.push_back(style); + + StreamUtils::StreamPosition ( lCurPos, pStream ); + } + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Records/StyleTextProp9Atom.cpp b/MsBinaryFile/PptFile/Records/StyleTextProp9Atom.cpp index 800fd636e9..18dba99a75 100644 --- a/MsBinaryFile/PptFile/Records/StyleTextProp9Atom.cpp +++ b/MsBinaryFile/PptFile/Records/StyleTextProp9Atom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "StyleTextProp9Atom.h" diff --git a/MsBinaryFile/PptFile/Records/StyleTextProp9Atom.h b/MsBinaryFile/PptFile/Records/StyleTextProp9Atom.h index e1b3e67da5..31d9092705 100644 --- a/MsBinaryFile/PptFile/Records/StyleTextProp9Atom.h +++ b/MsBinaryFile/PptFile/Records/StyleTextProp9Atom.h @@ -44,16 +44,38 @@ struct SStyleTextProp9 STextSIException m_si; - void ReadFromStream(POLE::Stream* pStream); + void ReadFromStream(POLE::Stream* pStream) + { + m_pf9.ReadFromStream(pStream); + m_cf9.ReadFromStream(pStream); + m_si.ReadFromStream(pStream); + } }; class CRecordStyleTextProp9Atom : public CUnknownRecord { public: - virtual ~CRecordStyleTextProp9Atom(); + virtual ~CRecordStyleTextProp9Atom() + { + } - virtual void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + virtual void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) + { + m_oHeader = oHeader; + + LONG lCurPos; StreamUtils::StreamPosition(lCurPos, pStream); + LONG lEndPos = lCurPos + m_oHeader.RecLen; + + while(lCurPos < lEndPos) + { + SStyleTextProp9 rec; + rec.ReadFromStream(pStream); + m_rgStyleTextProp9.push_back(rec); + + StreamUtils::StreamPosition(lCurPos, pStream); + } + } public: std::vector m_rgStyleTextProp9; diff --git a/MsBinaryFile/PptFile/Records/StyleTextPropAtom.cpp b/MsBinaryFile/PptFile/Records/StyleTextPropAtom.cpp index f1925a642d..633a1d2652 100644 --- a/MsBinaryFile/PptFile/Records/StyleTextPropAtom.cpp +++ b/MsBinaryFile/PptFile/Records/StyleTextPropAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "StyleTextPropAtom.h" diff --git a/MsBinaryFile/PptFile/Records/StyleTextPropAtom.h b/MsBinaryFile/PptFile/Records/StyleTextPropAtom.h index f120008a4e..0e903c4bae 100644 --- a/MsBinaryFile/PptFile/Records/StyleTextPropAtom.h +++ b/MsBinaryFile/PptFile/Records/StyleTextPropAtom.h @@ -46,10 +46,58 @@ public: std::vector m_arrPFs; std::vector m_arrCFs; + CRecordStyleTextPropAtom() + { + m_lCount = 0; + m_lOffsetInStream = 0; + } - CRecordStyleTextPropAtom(); - ~CRecordStyleTextPropAtom(); + ~CRecordStyleTextPropAtom() + { + m_lCount = 0; + } - void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + StreamUtils::StreamPosition(m_lOffsetInStream, pStream); + + _UINT32 lMemCount = 0; + _UINT32 lCountItems = 0; + + if (0 == m_lCount) + { + StreamUtils::StreamSeek(m_lOffsetInStream + m_oHeader.RecLen, pStream); + return; + } + + while (lMemCount < m_lCount + 1) + { + CTextPFRunRecord elm; + m_arrPFs.push_back(elm); + m_arrPFs[lCountItems].LoadFromStream(pStream); + lMemCount += m_arrPFs[lCountItems].m_lCount; + + ++lCountItems; + } + + lMemCount = 0; + lCountItems = 0; + while (lMemCount < m_lCount + 1) + { + CTextCFRunRecord elm; + m_arrCFs.push_back(elm); + + m_arrCFs[lCountItems].LoadFromStream(pStream); + lMemCount += m_arrCFs[lCountItems].m_lCount; + + ++lCountItems; + } + + // на всякий случай... + // здесь когда текст сначала другой (т.е. например - placeholder в мастере) - + // то у нас неправильно выставился m_lCount... + StreamUtils::StreamSeek(m_lOffsetInStream + m_oHeader.RecLen, pStream); + } }; diff --git a/MsBinaryFile/PptFile/Records/TextBookmarkAtom.cpp b/MsBinaryFile/PptFile/Records/TextBookmarkAtom.cpp index 1e97af08f7..264ed41c0e 100644 --- a/MsBinaryFile/PptFile/Records/TextBookmarkAtom.cpp +++ b/MsBinaryFile/PptFile/Records/TextBookmarkAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextBookmarkAtom.h" diff --git a/MsBinaryFile/PptFile/Records/TextBookmarkAtom.h b/MsBinaryFile/PptFile/Records/TextBookmarkAtom.h index e125144c59..9f288e1cad 100644 --- a/MsBinaryFile/PptFile/Records/TextBookmarkAtom.h +++ b/MsBinaryFile/PptFile/Records/TextBookmarkAtom.h @@ -39,8 +39,18 @@ class CRecordTextBookmarkAtom : public CUnknownRecord UINT m_nBookmarkID; public: - CRecordTextBookmarkAtom(); - ~CRecordTextBookmarkAtom(); + + CRecordTextBookmarkAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + ~CRecordTextBookmarkAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + return CUnknownRecord::ReadFromStream(oHeader, pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/TextBytesAtom.cpp b/MsBinaryFile/PptFile/Records/TextBytesAtom.cpp index e0e018467c..d05653e236 100644 --- a/MsBinaryFile/PptFile/Records/TextBytesAtom.cpp +++ b/MsBinaryFile/PptFile/Records/TextBytesAtom.cpp @@ -1,6 +1,36 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextBytesAtom.h" - CRecordTextBytesAtom::CRecordTextBytesAtom() { } diff --git a/MsBinaryFile/PptFile/Records/TextBytesAtom.h b/MsBinaryFile/PptFile/Records/TextBytesAtom.h index b90a126989..7a8ce87e15 100644 --- a/MsBinaryFile/PptFile/Records/TextBytesAtom.h +++ b/MsBinaryFile/PptFile/Records/TextBytesAtom.h @@ -38,8 +38,44 @@ public: std::wstring m_strText; public: - CRecordTextBytesAtom(); - ~CRecordTextBytesAtom(); + + CRecordTextBytesAtom() + { + } + + ~CRecordTextBytesAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + //UTF-16 Unicode character whose high byte is 0x00. + unsigned short *pUTF16 = new unsigned short[m_oHeader.RecLen]; + unsigned char *pUTF16_low = new unsigned char [m_oHeader.RecLen]; + + if (pUTF16 && pUTF16_low) + { + pStream->read(pUTF16_low, m_oHeader.RecLen); + + for (UINT i = 0 ; i < m_oHeader.RecLen; i++) + { + pUTF16[i] = pUTF16_low[i]; + } + + m_strText = NSFile::CUtf8Converter::GetWStringFromUTF16(pUTF16, m_oHeader.RecLen); + + } + + RELEASEARRAYOBJECTS(pUTF16_low); + RELEASEARRAYOBJECTS(pUTF16); + + //std::string tmpStrTextA = StreamUtils::ReadCStringA(pStream, m_oHeader.RecLen); + + //std::wstring tmpStrTextW (tmpStrTextA.begin(), tmpStrTextA.end()); + + //m_strText = std_string2string(tmpStrTextW); + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; }; diff --git a/MsBinaryFile/PptFile/Records/TextCFException10.cpp b/MsBinaryFile/PptFile/Records/TextCFException10.cpp index f3c694f06c..51d88e9588 100644 --- a/MsBinaryFile/PptFile/Records/TextCFException10.cpp +++ b/MsBinaryFile/PptFile/Records/TextCFException10.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextCFException10.h" diff --git a/MsBinaryFile/PptFile/Records/TextCFException10.h b/MsBinaryFile/PptFile/Records/TextCFException10.h index c24a112aa7..5cf4e8e6fe 100644 --- a/MsBinaryFile/PptFile/Records/TextCFException10.h +++ b/MsBinaryFile/PptFile/Records/TextCFException10.h @@ -41,7 +41,16 @@ struct STextCFException10 nullable m_csFontRef; nullable<_UINT32> m_pp11ext; + virtual void ReadFromStream(POLE::Stream* pStream) + { + m_masks.ReadFromStream(pStream); - virtual void ReadFromStream(POLE::Stream* pStream); + if (m_masks.m_newEATypeface) + m_newEAFontRef = new USHORT(StreamUtils::ReadSHORT(pStream)); + if (m_masks.m_csTypeface) + m_newEAFontRef = new USHORT(StreamUtils::ReadSHORT(pStream)); + if (m_masks.m_pp11ext) + m_pp11ext = new _UINT32(StreamUtils::ReadDWORD(pStream)); + } }; } diff --git a/MsBinaryFile/PptFile/Records/TextCFException9.cpp b/MsBinaryFile/PptFile/Records/TextCFException9.cpp index 135a158b67..4fa512a3d0 100644 --- a/MsBinaryFile/PptFile/Records/TextCFException9.cpp +++ b/MsBinaryFile/PptFile/Records/TextCFException9.cpp @@ -1,3 +1,35 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextCFException9.h" diff --git a/MsBinaryFile/PptFile/Records/TextCFException9.h b/MsBinaryFile/PptFile/Records/TextCFException9.h index 38de35764c..569192559b 100644 --- a/MsBinaryFile/PptFile/Records/TextCFException9.h +++ b/MsBinaryFile/PptFile/Records/TextCFException9.h @@ -43,6 +43,12 @@ struct STextCFException9 nullable_uint m_pp10runid; // 4 bits - void ReadFromStream(POLE::Stream* pStream); + void ReadFromStream(POLE::Stream* pStream) + { + m_masks.ReadFromStream(pStream); + + if (m_masks.m_pp10ext) + m_pp10runid = 0xF & StreamUtils::ReadDWORD(pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Records/TextCFExceptionAtom.cpp b/MsBinaryFile/PptFile/Records/TextCFExceptionAtom.cpp index e7cdd72a66..8456b562a1 100644 --- a/MsBinaryFile/PptFile/Records/TextCFExceptionAtom.cpp +++ b/MsBinaryFile/PptFile/Records/TextCFExceptionAtom.cpp @@ -1,3 +1,35 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextCFExceptionAtom.h" diff --git a/MsBinaryFile/PptFile/Records/TextCFExceptionAtom.h b/MsBinaryFile/PptFile/Records/TextCFExceptionAtom.h index 13d4c10f57..9b366db473 100644 --- a/MsBinaryFile/PptFile/Records/TextCFExceptionAtom.h +++ b/MsBinaryFile/PptFile/Records/TextCFExceptionAtom.h @@ -37,10 +37,25 @@ class CRecordTextCFExceptionAtom : public CUnknownRecord public: CTextCFRunRecord m_oCFRun; + CRecordTextCFExceptionAtom() + { + } - CRecordTextCFExceptionAtom(); - ~CRecordTextCFExceptionAtom(); + ~CRecordTextCFExceptionAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; -}; + LONG lPosition = 0; + StreamUtils::StreamPosition(lPosition, pStream); + + m_oCFRun.LoadFromStream(pStream, false); + + // это на всякий случай... + StreamUtils::StreamSeek(lPosition + m_oHeader.RecLen, pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/TextCharsAtom.cpp b/MsBinaryFile/PptFile/Records/TextCharsAtom.cpp index 8401ad3c92..873cee56f9 100644 --- a/MsBinaryFile/PptFile/Records/TextCharsAtom.cpp +++ b/MsBinaryFile/PptFile/Records/TextCharsAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextCharsAtom.h" diff --git a/MsBinaryFile/PptFile/Records/TextCharsAtom.h b/MsBinaryFile/PptFile/Records/TextCharsAtom.h index 80b879e364..babc34e048 100644 --- a/MsBinaryFile/PptFile/Records/TextCharsAtom.h +++ b/MsBinaryFile/PptFile/Records/TextCharsAtom.h @@ -38,8 +38,19 @@ public: std::wstring m_strText; public: - CRecordTextCharsAtom(); - ~CRecordTextCharsAtom(); + + CRecordTextCharsAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + ~CRecordTextCharsAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + m_strText = StreamUtils::ReadStringW(pStream, m_oHeader.RecLen / 2); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/TextDefaults9Atom.cpp b/MsBinaryFile/PptFile/Records/TextDefaults9Atom.cpp index ed6f1b5d3c..e8d5775987 100644 --- a/MsBinaryFile/PptFile/Records/TextDefaults9Atom.cpp +++ b/MsBinaryFile/PptFile/Records/TextDefaults9Atom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextDefaults9Atom.h" diff --git a/MsBinaryFile/PptFile/Records/TextDefaults9Atom.h b/MsBinaryFile/PptFile/Records/TextDefaults9Atom.h index 784cd69c42..59083afb2c 100644 --- a/MsBinaryFile/PptFile/Records/TextDefaults9Atom.h +++ b/MsBinaryFile/PptFile/Records/TextDefaults9Atom.h @@ -44,6 +44,12 @@ public: STextPFException9 m_pf9; - virtual void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + + virtual void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) + { + m_oHeader = oHeader; + m_cf9.ReadFromStream(pStream); + m_pf9.ReadFromStream(pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Records/TextFullSettings.cpp b/MsBinaryFile/PptFile/Records/TextFullSettings.cpp index 87a7fe01c7..f6d85f5b1f 100644 --- a/MsBinaryFile/PptFile/Records/TextFullSettings.cpp +++ b/MsBinaryFile/PptFile/Records/TextFullSettings.cpp @@ -1,3 +1,65 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 +* +*/ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextFullSettings.h" @@ -38,7 +100,7 @@ CTextFullSettings::~CTextFullSettings() m_pTextRuler = NULL; } -std::wstring CTextFullSettings::ApplyProperties(CTextAttributesEx *pTextAttributes) +std::wstring CTextFullSettings::ApplyProperties(PPT_FORMAT::CTextAttributesEx *pTextAttributes) { if (NULL == pTextAttributes) return m_strText; diff --git a/MsBinaryFile/PptFile/Records/TextFullSettings.h b/MsBinaryFile/PptFile/Records/TextFullSettings.h index f74ded4851..dd135d576e 100644 --- a/MsBinaryFile/PptFile/Records/TextFullSettings.h +++ b/MsBinaryFile/PptFile/Records/TextFullSettings.h @@ -54,10 +54,54 @@ public: _UINT32 m_lStyleThemeIndex; public: - CTextFullSettings(); - CTextFullSettings(const CTextFullSettings& oSrc); - CTextFullSettings& operator =(const CTextFullSettings& oSrc); - ~CTextFullSettings(); + CTextFullSettings() : m_arRanges() + { + m_pTextStyleProp = NULL; + m_pTextSpecInfo = NULL; + m_pTextRuler = NULL; + + m_nTextType = 0xFFFFFFFF; + m_lStyleThemeIndex = 0; //default + m_strText.clear(); + } + CTextFullSettings(const CTextFullSettings& oSrc) + { + *this = oSrc; + } + CTextFullSettings& operator =(const CTextFullSettings& oSrc) + { + m_pTextStyleProp = oSrc.m_pTextStyleProp; + m_pTextSpecInfo = oSrc.m_pTextSpecInfo; + m_pTextRuler = oSrc.m_pTextRuler; + m_lStyleThemeIndex = oSrc.m_lStyleThemeIndex; + + m_nTextType = oSrc.m_nTextType; + m_strText = oSrc.m_strText; + + m_arRanges = oSrc.m_arRanges; + return (*this); + } + ~CTextFullSettings() + { + m_pTextStyleProp = NULL; + m_pTextSpecInfo = NULL; + m_pTextRuler = NULL; + } - std::wstring ApplyProperties(CTextAttributesEx* pTextAttributes); + std::wstring ApplyProperties(CTextAttributesEx* pTextAttributes) + { + if (NULL == pTextAttributes) + return m_strText; + + pTextAttributes->m_lTextType = m_nTextType; + pTextAttributes->m_lStyleThemeIndex = m_lStyleThemeIndex; + + if (NULL != m_pTextStyleProp) + PPT_FORMAT::ConvertPPTTextToEditorStructure(m_pTextStyleProp->m_arrPFs, m_pTextStyleProp->m_arrCFs, m_strText, *pTextAttributes); + + if (NULL != m_pTextRuler) + pTextAttributes->m_oRuler = m_pTextRuler->m_oTextRuler; + + return m_strText; + } }; diff --git a/MsBinaryFile/PptFile/Records/TextHeaderAtom.cpp b/MsBinaryFile/PptFile/Records/TextHeaderAtom.cpp index d3ba10434f..f441d5c2c2 100644 --- a/MsBinaryFile/PptFile/Records/TextHeaderAtom.cpp +++ b/MsBinaryFile/PptFile/Records/TextHeaderAtom.cpp @@ -1,3 +1,65 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 +* +*/ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextHeaderAtom.h" diff --git a/MsBinaryFile/PptFile/Records/TextHeaderAtom.h b/MsBinaryFile/PptFile/Records/TextHeaderAtom.h index d366d3b10a..88bd500089 100644 --- a/MsBinaryFile/PptFile/Records/TextHeaderAtom.h +++ b/MsBinaryFile/PptFile/Records/TextHeaderAtom.h @@ -38,9 +38,19 @@ public: UINT m_nTextType; public: - CRecordTextHeaderAtom(); - ~CRecordTextHeaderAtom(); + + CRecordTextHeaderAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordTextHeaderAtom() + { + } -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + m_nTextType = (UINT)StreamUtils::ReadDWORD(pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/TextInteractiveInfoAtom.cpp b/MsBinaryFile/PptFile/Records/TextInteractiveInfoAtom.cpp index dfbc3e105b..0dca00f982 100644 --- a/MsBinaryFile/PptFile/Records/TextInteractiveInfoAtom.cpp +++ b/MsBinaryFile/PptFile/Records/TextInteractiveInfoAtom.cpp @@ -1,6 +1,36 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextInteractiveInfoAtom.h" - CRecordTextInteractiveInfoAtom::CRecordTextInteractiveInfoAtom() { m_lStart = 0; diff --git a/MsBinaryFile/PptFile/Records/TextInteractiveInfoAtom.h b/MsBinaryFile/PptFile/Records/TextInteractiveInfoAtom.h index a2449da629..1d96a64d40 100644 --- a/MsBinaryFile/PptFile/Records/TextInteractiveInfoAtom.h +++ b/MsBinaryFile/PptFile/Records/TextInteractiveInfoAtom.h @@ -38,8 +38,22 @@ public: LONG m_lStart; LONG m_lEnd; - CRecordTextInteractiveInfoAtom(); - ~CRecordTextInteractiveInfoAtom(); + CRecordTextInteractiveInfoAtom() + { + m_lStart = 0; + m_lEnd = 0; + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + ~CRecordTextInteractiveInfoAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_lStart = StreamUtils::ReadLONG(pStream); + m_lEnd = StreamUtils::ReadLONG(pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/TextMasterStyle9Atom.cpp b/MsBinaryFile/PptFile/Records/TextMasterStyle9Atom.cpp index 5afaaea92b..181f0797fa 100644 --- a/MsBinaryFile/PptFile/Records/TextMasterStyle9Atom.cpp +++ b/MsBinaryFile/PptFile/Records/TextMasterStyle9Atom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextMasterStyle9Atom.h" diff --git a/MsBinaryFile/PptFile/Records/TextMasterStyle9Atom.h b/MsBinaryFile/PptFile/Records/TextMasterStyle9Atom.h index 466c052a8e..dd6c3ca2c4 100644 --- a/MsBinaryFile/PptFile/Records/TextMasterStyle9Atom.h +++ b/MsBinaryFile/PptFile/Records/TextMasterStyle9Atom.h @@ -47,7 +47,40 @@ public: nullable m_lstLvl4; nullable m_lstLvl5; + void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override + { + m_oHeader = oHeader; + LONG lPos; StreamUtils::StreamPosition(lPos, pStream); - void ReadFromStream(SRecordHeader &oHeader, POLE::Stream *pStream) override; + + m_cLevels = StreamUtils::ReadWORD(pStream); + if (m_cLevels > 0) + { + m_lstLvl1 = new STextMasterStyle9Level; + m_lstLvl1->ReadFromStream(pStream); + if (m_cLevels > 1) + { + m_lstLvl2 = new STextMasterStyle9Level; + m_lstLvl2->ReadFromStream(pStream); + if (m_cLevels > 2) + { + m_lstLvl3 = new STextMasterStyle9Level; + m_lstLvl3->ReadFromStream(pStream); + if (m_cLevels > 3) + { + m_lstLvl4 = new STextMasterStyle9Level; + m_lstLvl4->ReadFromStream(pStream); + if (m_cLevels > 4) + { + m_lstLvl5 = new STextMasterStyle9Level; + m_lstLvl5->ReadFromStream(pStream); + } + } + } + } + } + + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Records/TextMasterStyle9Level.cpp b/MsBinaryFile/PptFile/Records/TextMasterStyle9Level.cpp index 04ec54ff63..a027169562 100644 --- a/MsBinaryFile/PptFile/Records/TextMasterStyle9Level.cpp +++ b/MsBinaryFile/PptFile/Records/TextMasterStyle9Level.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextMasterStyle9Level.h" diff --git a/MsBinaryFile/PptFile/Records/TextMasterStyle9Level.h b/MsBinaryFile/PptFile/Records/TextMasterStyle9Level.h index 02ef9a00f8..84120b85bc 100644 --- a/MsBinaryFile/PptFile/Records/TextMasterStyle9Level.h +++ b/MsBinaryFile/PptFile/Records/TextMasterStyle9Level.h @@ -43,6 +43,10 @@ struct STextMasterStyle9Level STextCFException9 m_cf9; - void ReadFromStream(POLE::Stream* pStream); + void ReadFromStream(POLE::Stream* pStream) + { + m_pf9.ReadFromStream(pStream); + m_cf9.ReadFromStream(pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Records/TextMasterStyleAtom.cpp b/MsBinaryFile/PptFile/Records/TextMasterStyleAtom.cpp index 6380c3d1d4..63061b0ffb 100644 --- a/MsBinaryFile/PptFile/Records/TextMasterStyleAtom.cpp +++ b/MsBinaryFile/PptFile/Records/TextMasterStyleAtom.cpp @@ -1,6 +1,36 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextMasterStyleAtom.h" - CRecordTextMasterStyleAtom::CRecordTextMasterStyleAtom() : PPT_FORMAT::CTextStyles() { m_nTextType = -1; diff --git a/MsBinaryFile/PptFile/Records/TextMasterStyleAtom.h b/MsBinaryFile/PptFile/Records/TextMasterStyleAtom.h index 02bab90329..a73c42ad23 100644 --- a/MsBinaryFile/PptFile/Records/TextMasterStyleAtom.h +++ b/MsBinaryFile/PptFile/Records/TextMasterStyleAtom.h @@ -37,12 +37,87 @@ class CRecordTextMasterStyleAtom : public CUnknownRecord, public PPT_FORMAT::CTe public: LONG m_nTextType; + CRecordTextMasterStyleAtom() : PPT_FORMAT::CTextStyles() + { + m_nTextType = -1; + } - CRecordTextMasterStyleAtom(); - ~CRecordTextMasterStyleAtom(); + ~CRecordTextMasterStyleAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + LONG lPosition = 0; + StreamUtils::StreamPosition(lPosition, pStream); + + m_nTextType = m_oHeader.RecInstance; + + bool bIsLevelsPresent = (0x05 <= m_oHeader.RecInstance); + + int lLevels = StreamUtils::ReadWORD(pStream); + if (0 < lLevels) + LoadLevel(0, pStream, bIsLevelsPresent); + if (1 < lLevels) + LoadLevel(1, pStream, bIsLevelsPresent); + if (2 < lLevels) + LoadLevel(2, pStream, bIsLevelsPresent); + if (3 < lLevels) + LoadLevel(3, pStream, bIsLevelsPresent); + if (4 < lLevels) + LoadLevel(4, pStream, bIsLevelsPresent); + + // походу нужно делать так: ---------------------------------------------- + if (m_pLevels[0].is_init()) + { + if (!m_pLevels[1].is_init()) + m_pLevels[1] = m_pLevels[0].get(); + else + m_pLevels[1]->ApplyBefore(m_pLevels[0].get()); + } + if (m_pLevels[1].is_init()) + { + if (!m_pLevels[2].is_init()) + m_pLevels[2] = m_pLevels[1].get(); + else + m_pLevels[2]->ApplyBefore(m_pLevels[1].get()); + } + if (m_pLevels[2].is_init()) + { + if (!m_pLevels[3].is_init()) + m_pLevels[3] = m_pLevels[2].get(); + else + m_pLevels[3]->ApplyBefore(m_pLevels[2].get()); + } + if (m_pLevels[3].is_init()) + { + if (!m_pLevels[4].is_init()) + m_pLevels[4] = m_pLevels[3].get(); + else + m_pLevels[4]->ApplyBefore(m_pLevels[3].get()); + } + // ----------------------------------------------------------------------- + + // это на всякий случай... + StreamUtils::StreamSeek(lPosition + m_oHeader.RecLen, pStream); + } protected: - void LoadLevel(LONG lLevel, POLE::Stream* pStream, bool bIsLevelPresent); -}; + void LoadLevel(LONG lLevel, POLE::Stream* pStream, bool bIsLevelPresent) + { + LONG lLevelOld = lLevel; + + if (bIsLevelPresent) + lLevel = StreamUtils::ReadSHORT(pStream); + + CTextPFRunRecord oPF; + CTextCFRunRecord oCF; + oPF.LoadFromStream(pStream, false); + oCF.LoadFromStream(pStream, false); + + m_pLevels[lLevelOld] = new PPT_FORMAT::CTextStyleLevel(); + m_pLevels[lLevelOld]->m_oPFRun = oPF.m_oRun; + m_pLevels[lLevelOld]->m_oCFRun = oCF.m_oRun; + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/TextPFException9.cpp b/MsBinaryFile/PptFile/Records/TextPFException9.cpp index 3b7803df8a..0e57f3fda1 100644 --- a/MsBinaryFile/PptFile/Records/TextPFException9.cpp +++ b/MsBinaryFile/PptFile/Records/TextPFException9.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextPFException9.h" diff --git a/MsBinaryFile/PptFile/Records/TextPFException9.h b/MsBinaryFile/PptFile/Records/TextPFException9.h index 076f9661cb..3e309b3bf8 100644 --- a/MsBinaryFile/PptFile/Records/TextPFException9.h +++ b/MsBinaryFile/PptFile/Records/TextPFException9.h @@ -42,9 +42,61 @@ struct STextAutoNumberScheme SHORT m_nStartNum; - void ReadFromStream(POLE::Stream* pStream); + void ReadFromStream(POLE::Stream* pStream){ + m_eScheme = (TextAutoNumberSchemeEnum)StreamUtils::ReadSHORT(pStream); + m_nStartNum = StreamUtils::ReadSHORT(pStream); + } + + + std::wstring SchemeToStr()const + { + switch (m_eScheme) + { + case ANM_AlphaLcPeriod:{ return L"alphaLcPeriod"; break;} + case ANM_AlphaUcPeriod:{ return L"alphaUcPeriod"; break;} + case ANM_ArabicParenRight:{ return L"arabicParenR"; break;} + case ANM_ArabicPeriod:{ return L"arabicPeriod"; break;} + case ANM_RomanLcParenBoth:{ return L"romanLcParenBoth"; break;} + case ANM_RomanLcParenRight:{ return L"romanLcParenR"; break;} + case ANM_RomanLcPeriod:{ return L"romanLcPeriod"; break;} + case ANM_RomanUcPeriod:{ return L"romanUcPeriod"; break;} + case ANM_AlphaLcParenBoth:{ return L"alphaLcParenBoth"; break;} + case ANM_AlphaLcParenRight:{ return L"alphaLcParenR"; break;} + case ANM_AlphaUcParenBoth:{ return L"alphaUcParenBoth"; break;} + case ANM_AlphaUcParenRight:{ return L"alphaUcParenR"; break;} + case ANM_ArabicParenBoth:{ return L"arabicParenBoth"; break;} + case ANM_ArabicPlain:{ return L"arabicPlain"; break;} + case ANM_RomanUcParenBoth:{ return L"romanUcParenBoth"; break;} + case ANM_RomanUcParenRight:{ return L"romanUcParenR"; break;} + case ANM_ChsPlain:{ return L"ea1ChsPlain"; break;} + case ANM_ChsPeriod:{ return L"ea1ChsPeriod"; break;} + case ANM_CircleNumDBPlain:{ return L"circleNumDbPlain"; break;} + case ANM_CircleNumWDBWhitePlain:{ return L"circleNumWdWhitePlain"; break;} + case ANM_CircleNumWDBBlackPlain:{ return L"circleNumWdBlackPlain"; break;} + case ANM_ChtPlain:{ return L"ea1ChtPlain"; break;} + case ANM_ChtPeriod:{ return L"ea1ChtPeriod"; break;} + case ANM_Arabic1Minus:{ return L"arabic1Minus"; break;} + case ANM_Arabic2Minus:{ return L"arabic2Minus"; break;} + case ANM_Hebrew2Minus:{ return L"hebrew2Minus"; break;} + case ANM_JpnKorPlain:{ return L"ea1JpnKorPlain"; break;} + case ANM_JpnKorPeriod:{ return L"ea1JpnKorPeriod"; break;} + case ANM_ArabicDbPlain:{ return L"arabicDbPlain"; break;} + case ANM_ArabicDbPeriod:{ return L"arabicDbPeriod"; break;} + case ANM_ThaiAlphaPeriod:{ return L"thaiAlphaPeriod"; break;} + case ANM_ThaiAlphaParenRight:{ return L"thaiAlphaParenR"; break;} + case ANM_ThaiAlphaParenBoth:{ return L"thaiAlphaParenBoth"; break;} + case ANM_ThaiNumPeriod:{ return L"thaiNumPeriod"; break;} + case ANM_ThaiNumParenRight:{ return L"thaiNumParenR"; break;} + case ANM_ThaiNumParenBoth:{ return L"thaiNumParenBoth"; break;} + case ANM_HindiAlphaPeriod:{ return L"hindiAlphaPeriod"; break;} + case ANM_HindiNumPeriod:{ return L"hindiNumPeriod"; break;} + case ANM_JpnChsDBPeriod:{ return L"ea1JpnChsDbPeriod"; break;} + case ANM_HindiNumParenRight:{ return L"hindiNumParenR"; break;} + case ANM_HindiAlpha1Period:{ return L"hindiAlpha1Period"; break;} + } + return L"alphaUcPeriod"; + } - std::wstring SchemeToStr()const; }; @@ -58,6 +110,30 @@ struct STextPFException9 nullable m_optBulletAutoNumberScheme; - void ReadFromStream(POLE::Stream* pStream); + void ReadFromStream(POLE::Stream* pStream) + { + m_masks.ReadFromStream(pStream); + + if (m_masks.m_bulletBlip) // 0x0800000 2^23 + m_optBulletBlipRef = StreamUtils::ReadSHORT(pStream); + + if (m_masks.m_bulletHasScheme) // 0x2000000 2^25 + m_optfBulletHasAutoNumber = (bool)StreamUtils::ReadSHORT(pStream); + + if(m_masks.m_bulletScheme) // 0x1000000 2^24 + { + auto pBulletAutoNumberScheme = new STextAutoNumberScheme; + pBulletAutoNumberScheme->ReadFromStream(pStream); + m_optBulletAutoNumberScheme = pBulletAutoNumberScheme; + } + else if (m_optfBulletHasAutoNumber.get_value_or(false)) + { + auto pBulletAutoNumberScheme = new STextAutoNumberScheme; + pBulletAutoNumberScheme->m_nStartNum = 1; + pBulletAutoNumberScheme->m_eScheme = ANM_ArabicPeriod; + m_optBulletAutoNumberScheme = pBulletAutoNumberScheme; + } + + } }; } diff --git a/MsBinaryFile/PptFile/Records/TextPFExceptionAtom.cpp b/MsBinaryFile/PptFile/Records/TextPFExceptionAtom.cpp index 4bd56b81bf..8812b9592d 100644 --- a/MsBinaryFile/PptFile/Records/TextPFExceptionAtom.cpp +++ b/MsBinaryFile/PptFile/Records/TextPFExceptionAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextPFExceptionAtom.h" diff --git a/MsBinaryFile/PptFile/Records/TextPFExceptionAtom.h b/MsBinaryFile/PptFile/Records/TextPFExceptionAtom.h index b1aed43a8c..6aa7cec33b 100644 --- a/MsBinaryFile/PptFile/Records/TextPFExceptionAtom.h +++ b/MsBinaryFile/PptFile/Records/TextPFExceptionAtom.h @@ -37,9 +37,26 @@ class CRecordTextPFExceptionAtom : public CUnknownRecord public: CTextPFRunRecord m_oPFRun; + CRecordTextPFExceptionAtom() + { + } - CRecordTextPFExceptionAtom(); - ~CRecordTextPFExceptionAtom(); + ~CRecordTextPFExceptionAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + LONG lPosition = 0; + StreamUtils::StreamPosition(lPosition, pStream); + + m_oPFRun.LoadFromStream(pStream, m_oHeader.RecLen == 12); + + // это на всякий случай... + POLE::uint64 current_pos = pStream->tell(); + StreamUtils::StreamSeek(lPosition + m_oHeader.RecLen, pStream); + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; }; diff --git a/MsBinaryFile/PptFile/Records/TextRulerAtom.cpp b/MsBinaryFile/PptFile/Records/TextRulerAtom.cpp index e70bdc1d0a..046ad7c3bd 100644 --- a/MsBinaryFile/PptFile/Records/TextRulerAtom.cpp +++ b/MsBinaryFile/PptFile/Records/TextRulerAtom.cpp @@ -1,5 +1,36 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextRulerAtom.h" - +#include "../../../OOXML/SystemUtility/File.h" CRecordTextRulerAtom::CRecordTextRulerAtom() { diff --git a/MsBinaryFile/PptFile/Records/TextRulerAtom.h b/MsBinaryFile/PptFile/Records/TextRulerAtom.h index 7380ae6869..82c890d0be 100644 --- a/MsBinaryFile/PptFile/Records/TextRulerAtom.h +++ b/MsBinaryFile/PptFile/Records/TextRulerAtom.h @@ -38,9 +38,25 @@ public: PPT_FORMAT::CTextRuler m_oTextRuler; public: - CRecordTextRulerAtom(); - ~CRecordTextRulerAtom(); + + CRecordTextRulerAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordTextRulerAtom() + { + } -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + LONG lOffset = 0; + StreamUtils::StreamPosition(lOffset, pStream); + + NSStreamReader::Read(pStream, m_oTextRuler); + + // на всякий случай... + StreamUtils::StreamSeek(lOffset + m_oHeader.RecLen, pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/TextSIException.cpp b/MsBinaryFile/PptFile/Records/TextSIException.cpp index 1b21a2e4b1..c364d54ad2 100644 --- a/MsBinaryFile/PptFile/Records/TextSIException.cpp +++ b/MsBinaryFile/PptFile/Records/TextSIException.cpp @@ -1,5 +1,36 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextSIException.h" - +#include "../../../OOXML/SystemUtility/File.h" SSmartTags::SSmartTags(){} diff --git a/MsBinaryFile/PptFile/Records/TextSIException.h b/MsBinaryFile/PptFile/Records/TextSIException.h index 24da790232..095d7a243f 100644 --- a/MsBinaryFile/PptFile/Records/TextSIException.h +++ b/MsBinaryFile/PptFile/Records/TextSIException.h @@ -36,21 +36,38 @@ namespace PPT_FORMAT { struct SSmartTags { - SSmartTags(); - SSmartTags(const SSmartTags& other); + SSmartTags(){} + SSmartTags(const SSmartTags& other) + { + m_count = other.m_count; + m_rgSmartTagIndex = other.m_rgSmartTagIndex; + } ~SSmartTags(){} _UINT32 m_count; std::vector<_UINT32> m_rgSmartTagIndex; - - void ReadFromStream(POLE::Stream* pStream); + void ReadFromStream(POLE::Stream* pStream) + { + m_count = StreamUtils::ReadDWORD(pStream); + for (_UINT32 i = 0; i < m_count; i++) + { + _UINT32 SmartTagIndex = StreamUtils::ReadDWORD(pStream); + m_rgSmartTagIndex.push_back(SmartTagIndex); + } + } }; struct STextSIException { - STextSIException(); - ~STextSIException(); + STextSIException() + { + + } + ~STextSIException() + { + + } bool m_spell; bool m_lang; bool m_altLang; @@ -70,7 +87,44 @@ struct STextSIException // nullable m_smartTags; + void ReadFromStream(POLE::Stream* pStream) + { + _UINT16 flags = StreamUtils::ReadWORD(pStream); + StreamUtils::StreamSkip(2, pStream); - void ReadFromStream(POLE::Stream* pStream); + m_spell = 0x1 & flags; + m_lang = 0x2 & flags; + m_altLang = 0x4 & flags; + + + m_fPp10ext = 0x20 & flags; + m_fBidi = 0x40 & flags; + + + m_smartTag = 0x200 & flags; + + if (m_spell) + m_spellInfo = StreamUtils::ReadWORD(pStream); + if (m_lang) + m_altLang = StreamUtils::ReadWORD(pStream); + if (m_altLang) + m_altLid = StreamUtils::ReadWORD(pStream); + if (m_fBidi) + m_bidi = StreamUtils::ReadWORD(pStream); + + if (m_fPp10ext) + { + m_pp10runid = 0x0F & StreamUtils::ReadBYTE(pStream); + StreamUtils::StreamSkip(2, pStream); + m_grammarError = 0x80 & StreamUtils::ReadBYTE(pStream); + } + + if (m_smartTag) + { + StreamUtils::StreamSkip(StreamUtils::ReadDWORD(pStream) * 4, pStream); +// m_smartTags = new SSmartTags; +// m_smartTags->ReadFromStream(pStream); + } + } }; } diff --git a/MsBinaryFile/PptFile/Records/TextSIExceptionAtom.cpp b/MsBinaryFile/PptFile/Records/TextSIExceptionAtom.cpp index e7d09149cf..7ee7d8289f 100644 --- a/MsBinaryFile/PptFile/Records/TextSIExceptionAtom.cpp +++ b/MsBinaryFile/PptFile/Records/TextSIExceptionAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextSIExceptionAtom.h" diff --git a/MsBinaryFile/PptFile/Records/TextSIExceptionAtom.h b/MsBinaryFile/PptFile/Records/TextSIExceptionAtom.h index c84290cf15..6adc9131e5 100644 --- a/MsBinaryFile/PptFile/Records/TextSIExceptionAtom.h +++ b/MsBinaryFile/PptFile/Records/TextSIExceptionAtom.h @@ -37,9 +37,25 @@ class CRecordTextSIExceptionAtom : public CUnknownRecord public: CTextSIRun m_oSIRun; + CRecordTextSIExceptionAtom() + { + } - CRecordTextSIExceptionAtom(); - ~CRecordTextSIExceptionAtom(); + ~CRecordTextSIExceptionAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + LONG lPosition = 0; + StreamUtils::StreamPosition(lPosition, pStream); + + NSStreamReader::Read(pStream, m_oSIRun, false); + + // это на всякий случай... + StreamUtils::StreamSeek(lPosition + m_oHeader.RecLen, pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/TextSpecInfoAtom.cpp b/MsBinaryFile/PptFile/Records/TextSpecInfoAtom.cpp index 522d38d691..c1dba35c61 100644 --- a/MsBinaryFile/PptFile/Records/TextSpecInfoAtom.cpp +++ b/MsBinaryFile/PptFile/Records/TextSpecInfoAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "TextSpecInfoAtom.h" @@ -38,7 +69,7 @@ void CRecordTextSpecInfoAtom::ReadFromStream(SRecordHeader &oHeader, POLE::Strea StreamUtils::StreamSeek(m_lOffsetInStream + m_oHeader.RecLen, pStream); } -void CRecordTextSpecInfoAtom::ApplyProperties(CTextAttributesEx *pText) +void CRecordTextSpecInfoAtom::ApplyProperties(PPT_FORMAT::CTextAttributesEx *pText) { if (m_arrSIs.size() < 1) return; diff --git a/MsBinaryFile/PptFile/Records/TextSpecInfoAtom.h b/MsBinaryFile/PptFile/Records/TextSpecInfoAtom.h index 4f44fddd69..31faf876cd 100644 --- a/MsBinaryFile/PptFile/Records/TextSpecInfoAtom.h +++ b/MsBinaryFile/PptFile/Records/TextSpecInfoAtom.h @@ -43,10 +43,68 @@ public: std::vector m_arrSIs; - CRecordTextSpecInfoAtom(); - ~CRecordTextSpecInfoAtom(); + CRecordTextSpecInfoAtom() + { + m_lCount = 0; + m_lOffsetInStream = 0; + } - void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordTextSpecInfoAtom() + { + m_lCount = 0; + } + + void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + StreamUtils::StreamPosition(m_lOffsetInStream, pStream); + + _UINT32 lMemCount = 0; + while (true) + { + PPT_FORMAT::CTextSIRun elm; + m_arrSIs.push_back(elm); + + NSStreamReader::Read(pStream, m_arrSIs.back()); + lMemCount += m_arrSIs.back().lCount; + + long sz = (long)(pStream->tell() - m_lOffsetInStream); + + if (sz >= (long)m_oHeader.RecLen) + break; + } + + // на всякий случай... + // здесь когда текст сначала другой (т.е. например - placeholder в мастере) - + // то у нас неправильно выставился m_lCount... на число m_lCount пилюем .. берем структур si скока прописано + StreamUtils::StreamSeek(m_lOffsetInStream + m_oHeader.RecLen, pStream); + } + + void ApplyProperties(CTextAttributesEx* pText) + { + if (m_arrSIs.size() < 1) return; + + int pos_text = 0, pos_si = 0; + size_t ind = 0; + + for (size_t i = 0; i < pText->m_arParagraphs.size(); i++) + { + if (ind >= m_arrSIs.size()) break; + + for (size_t j = 0 ; j < pText->m_arParagraphs[i].m_arSpans.size(); j++) + { + if (pos_text + pText->m_arParagraphs[i].m_arSpans[j].m_strText.length() > pos_si + m_arrSIs[ind].lCount ) + { + pos_si += m_arrSIs[ind].lCount; + ind++; + } + if (ind >= m_arrSIs.size()) break; + if (m_arrSIs[ind].bLang) + pText->m_arParagraphs[i].m_arSpans[j].m_oRun.Language = m_arrSIs[ind].Lang; + pos_text += pText->m_arParagraphs[i].m_arSpans[j].m_strText.length() ; + } + + } + } - void ApplyProperties(CTextAttributesEx* pText); }; diff --git a/MsBinaryFile/PptFile/Records/UserEditAtom.cpp b/MsBinaryFile/PptFile/Records/UserEditAtom.cpp index 085bf5831a..38c00b9c16 100644 --- a/MsBinaryFile/PptFile/Records/UserEditAtom.cpp +++ b/MsBinaryFile/PptFile/Records/UserEditAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "UserEditAtom.h" diff --git a/MsBinaryFile/PptFile/Records/UserEditAtom.h b/MsBinaryFile/PptFile/Records/UserEditAtom.h index d3899c0d77..bdcb6e358b 100644 --- a/MsBinaryFile/PptFile/Records/UserEditAtom.h +++ b/MsBinaryFile/PptFile/Records/UserEditAtom.h @@ -53,11 +53,54 @@ public: USHORT m_nLastView; + CRecordUserEditAtom() + { + m_nEncryptSessionPersistIdRef = 0; + } - CRecordUserEditAtom(); - ~CRecordUserEditAtom(); + ~CRecordUserEditAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_nLastSlideIdRef = StreamUtils::ReadDWORD(pStream); - CRecordUserEditAtom& operator =(const CRecordUserEditAtom& oSrc); -}; + m_nVersion = StreamUtils::ReadWORD(pStream); + m_nMinorVersion = StreamUtils::ReadBYTE(pStream); + m_nMajorVersion = StreamUtils::ReadBYTE(pStream); + + m_nOffsetLastEdit = StreamUtils::ReadDWORD(pStream); + m_nOffsetPersistDirectory = StreamUtils::ReadDWORD(pStream); + m_nOffsetDocPersistIdRef = StreamUtils::ReadDWORD(pStream); + + m_nPersistIdSeed = StreamUtils::ReadDWORD(pStream); + m_nLastView = StreamUtils::ReadWORD(pStream); + + StreamUtils::StreamSkip(2, pStream); + + if (m_oHeader.RecLen > 28) + { + m_nEncryptSessionPersistIdRef = StreamUtils::ReadDWORD(pStream); + } + } + + CRecordUserEditAtom& operator =(const CRecordUserEditAtom& oSrc) + { + m_nLastSlideIdRef = oSrc.m_nLastSlideIdRef; + + m_nVersion = oSrc.m_nVersion; + m_nMinorVersion = oSrc.m_nMinorVersion; + m_nMajorVersion = oSrc.m_nMajorVersion; + + m_nOffsetLastEdit = oSrc.m_nOffsetLastEdit; + m_nOffsetPersistDirectory = oSrc.m_nOffsetPersistDirectory; + m_nOffsetDocPersistIdRef = oSrc.m_nOffsetDocPersistIdRef; + m_nPersistIdSeed = oSrc.m_nPersistIdSeed; + m_nLastView = oSrc.m_nLastView; + m_nEncryptSessionPersistIdRef = oSrc.m_nEncryptSessionPersistIdRef; + return (*this); + } +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/VBAInfoAtom.cpp b/MsBinaryFile/PptFile/Records/VBAInfoAtom.cpp index 9d21358f39..4af8644fc7 100644 --- a/MsBinaryFile/PptFile/Records/VBAInfoAtom.cpp +++ b/MsBinaryFile/PptFile/Records/VBAInfoAtom.cpp @@ -1,3 +1,35 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "VBAInfoAtom.h" diff --git a/MsBinaryFile/PptFile/Records/VBAInfoAtom.h b/MsBinaryFile/PptFile/Records/VBAInfoAtom.h index ed1b2c44f5..615100af3c 100644 --- a/MsBinaryFile/PptFile/Records/VBAInfoAtom.h +++ b/MsBinaryFile/PptFile/Records/VBAInfoAtom.h @@ -40,20 +40,37 @@ public: UINT m_nHasMacros; UINT m_nVersion; + CRecordVBAInfoAtom() + { + } - CRecordVBAInfoAtom(); - ~CRecordVBAInfoAtom(); + ~CRecordVBAInfoAtom() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_nObjStgDataRef = StreamUtils::ReadDWORD(pStream); + m_nHasMacros = StreamUtils::ReadDWORD(pStream); + m_nVersion = StreamUtils::ReadDWORD(pStream); + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; }; class CRecordVBAInfoContainer : public CRecordsContainer { public: - CRecordVBAInfoContainer(); - ~CRecordVBAInfoContainer(); - - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream); + CRecordVBAInfoContainer() + {} + ~CRecordVBAInfoContainer() + {} + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + CRecordsContainer::ReadFromStream(oHeader, pStream); + } }; class CRecordVbaProjectStg : public CUnknownRecord @@ -62,9 +79,54 @@ public: std::wstring m_sFileName; std::wstring m_strTmpDirectory; + CRecordVbaProjectStg(std::wstring strTemp) : m_strTmpDirectory(strTemp) + { + } - CRecordVbaProjectStg(std::wstring strTemp); - ~CRecordVbaProjectStg(); + ~CRecordVbaProjectStg() + { + } + + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + ULONG decompressedSize = m_oHeader.RecLen, compressedSize = m_oHeader.RecLen; + + BYTE* pData = new BYTE[compressedSize]; + if (!pData) return; + + if (m_oHeader.RecInstance == 0x01) + { + decompressedSize = StreamUtils::ReadDWORD(pStream) + 64; + compressedSize -= 4; + } + pStream->read(pData, compressedSize); + + //if (pDecryptor) + //{ + // pDecryptor->Decrypt((char*)pData, compressedSize, 0); + //} + + if (m_oHeader.RecInstance == 0x01) + { + BYTE* pDataUncompress = new BYTE[decompressedSize]; + NSZip::Decompress(pData, compressedSize, pDataUncompress, decompressedSize); + + delete []pData; + pData = pDataUncompress; + } + + m_sFileName = m_strTmpDirectory + FILE_SEPARATOR_STR + L"vbaProject.bin"; + + NSFile::CFileBinary file; + if (file.CreateFileW(m_sFileName)) + { + file.WriteFile(pData, decompressedSize); + file.CloseFile(); + } + delete[] pData; + pData = NULL; + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; }; diff --git a/MsBinaryFile/PptFile/Records/ViewInfoAtom.cpp b/MsBinaryFile/PptFile/Records/ViewInfoAtom.cpp index e463393338..3c8d517f55 100644 --- a/MsBinaryFile/PptFile/Records/ViewInfoAtom.cpp +++ b/MsBinaryFile/PptFile/Records/ViewInfoAtom.cpp @@ -1,3 +1,34 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "ViewInfoAtom.h" diff --git a/MsBinaryFile/PptFile/Records/ViewInfoAtom.h b/MsBinaryFile/PptFile/Records/ViewInfoAtom.h index 5cbbd35dc8..549350c120 100644 --- a/MsBinaryFile/PptFile/Records/ViewInfoAtom.h +++ b/MsBinaryFile/PptFile/Records/ViewInfoAtom.h @@ -43,9 +43,29 @@ class CRecordViewInfoAtom : public CUnknownRecord BOOL1 m_bDraftMode; public: - CRecordViewInfoAtom(); - ~CRecordViewInfoAtom(); + + CRecordViewInfoAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + ~CRecordViewInfoAtom() + { + } -}; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_oCurScale.FromStream(pStream); + m_oPrevScale.FromStream(pStream); + NSStreamReader::Read(pStream, m_oViewSize); + NSStreamReader::Read(pStream, m_oOrigin); + + m_bZoomToFit = StreamUtils::ReadBYTE(pStream); + m_bDraftMode = StreamUtils::ReadBYTE(pStream); + + // 2 байта зарезервированы... + StreamUtils::StreamSkip(2, pStream); + } + +}; \ No newline at end of file diff --git a/MsBinaryFile/PptFile/Records/ZoomViewInfoAtom.cpp b/MsBinaryFile/PptFile/Records/ZoomViewInfoAtom.cpp index 4babbcc90e..f0b0774bb0 100644 --- a/MsBinaryFile/PptFile/Records/ZoomViewInfoAtom.cpp +++ b/MsBinaryFile/PptFile/Records/ZoomViewInfoAtom.cpp @@ -1,4 +1,67 @@ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 +* +*/ +/* +* (c) Copyright Ascensio System SIA 2010-2019 +* +* 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-12 Ernesta Birznieka-Upisha +* 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 "ZoomViewInfoAtom.h" +#include "../../../OOXML/SystemUtility/File.h" CRecordZoomViewInfoAtom::CRecordZoomViewInfoAtom() { diff --git a/MsBinaryFile/PptFile/Records/ZoomViewInfoAtom.h b/MsBinaryFile/PptFile/Records/ZoomViewInfoAtom.h index 013ba90d30..8a30222908 100644 --- a/MsBinaryFile/PptFile/Records/ZoomViewInfoAtom.h +++ b/MsBinaryFile/PptFile/Records/ZoomViewInfoAtom.h @@ -46,10 +46,28 @@ public: BOOL1 m_fUseVarScale; BOOL1 m_fDraftMode; + CRecordZoomViewInfoAtom() + { + } - CRecordZoomViewInfoAtom(); - ~CRecordZoomViewInfoAtom(); + ~CRecordZoomViewInfoAtom() + { + } - virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) override; + virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) + { + m_oHeader = oHeader; + + m_oCurScale.ReadFromStream(pStream); + + StreamUtils::StreamSkip(24, pStream); + + m_oOrigin.ReadFromStream(pStream); + + m_fUseVarScale = StreamUtils::ReadBYTE(pStream); + m_fDraftMode = StreamUtils::ReadBYTE(pStream); + + StreamUtils::StreamSkip(2, pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Structures/ColorIndex.h b/MsBinaryFile/PptFile/Structures/ColorIndex.h index 62a263b5e2..b54e5a5182 100644 --- a/MsBinaryFile/PptFile/Structures/ColorIndex.h +++ b/MsBinaryFile/PptFile/Structures/ColorIndex.h @@ -34,18 +34,27 @@ #include "IStruct.h" - namespace PPT_FORMAT { -struct ColorIndex : public IStruct -{ +struct ColorIndex : public IStruct { + BYTE m_red; BYTE m_green; BYTE m_blue; BYTE m_index; + void clear() + { + m_red = m_green = m_blue = 0; + m_index = 0xFF; // Color is undefined. + } - void clear(); - void ReadFromStream(POLE::Stream *pStream) override; + void ReadFromStream(POLE::Stream * pStream) + { + m_red = StreamUtils::ReadBYTE(pStream); + m_green = StreamUtils::ReadBYTE(pStream); + m_blue = StreamUtils::ReadBYTE(pStream); + m_index = StreamUtils::ReadBYTE(pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Structures/ColorIndexStruct.h b/MsBinaryFile/PptFile/Structures/ColorIndexStruct.h index 4b4568862f..293c7c3e80 100644 --- a/MsBinaryFile/PptFile/Structures/ColorIndexStruct.h +++ b/MsBinaryFile/PptFile/Structures/ColorIndexStruct.h @@ -36,16 +36,30 @@ namespace PPT_FORMAT { -struct ColorIndexStruct : public IStruct -{ +struct ColorIndexStruct : public IStruct { + BYTE m_red; BYTE m_green; BYTE m_blue; BYTE m_index; - ColorIndexStruct(); + ColorIndexStruct() + { + clear(); + } - void clear(); - void ReadFromStream(POLE::Stream *pStream) override; + void clear() + { + m_red = m_green = m_blue = 0; + m_index = 0; + } + + void ReadFromStream(POLE::Stream * pStream) + { + m_red = StreamUtils::ReadBYTE(pStream); + m_green = StreamUtils::ReadBYTE(pStream); + m_blue = StreamUtils::ReadBYTE(pStream); + m_index = StreamUtils::ReadBYTE(pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Structures/ColorStruct.h b/MsBinaryFile/PptFile/Structures/ColorStruct.h index 376fcfe886..e3c4705ca7 100644 --- a/MsBinaryFile/PptFile/Structures/ColorStruct.h +++ b/MsBinaryFile/PptFile/Structures/ColorStruct.h @@ -36,16 +36,28 @@ namespace PPT_FORMAT { -struct ColorStruct -{ +struct ColorStruct { + BYTE m_red; BYTE m_green; BYTE m_blue; + ColorStruct() + { + clear(); + } - ColorStruct(); - void clear(); + void clear() + { + m_red = m_green = m_blue = 0; + } - void ReadFromStream(POLE::Stream * pStream) override; + void ReadFromStream(POLE::Stream * pStream) + { + m_red = StreamUtils::ReadBYTE(pStream); + m_green = StreamUtils::ReadBYTE(pStream); + m_blue = StreamUtils::ReadBYTE(pStream); + StreamUtils::StreamSkip(1, pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Structures/DateTimeStruct.h b/MsBinaryFile/PptFile/Structures/DateTimeStruct.h index dd1ebe7654..c9cc52f77f 100644 --- a/MsBinaryFile/PptFile/Structures/DateTimeStruct.h +++ b/MsBinaryFile/PptFile/Structures/DateTimeStruct.h @@ -49,8 +49,21 @@ struct DateTimeStruct : public IStruct WORD m_wSecond; WORD m_wMilliseconds; + DateTimeStruct() : + m_wYear(0), m_wMonth(0), m_wDayOfWeek(0), m_wDay(0), + m_wHour(0), m_wMinute(0), m_wSecond(0), m_wMilliseconds(0) + {} - DateTimeStruct(); - void ReadFromStream(POLE::Stream *pStream) override; + void ReadFromStream(POLE::Stream *pStream) override + { + m_wYear = StreamUtils::ReadWORD(pStream); + m_wMonth = StreamUtils::ReadWORD(pStream); + m_wDayOfWeek = StreamUtils::ReadWORD(pStream); + m_wDay = StreamUtils::ReadWORD(pStream); + m_wHour = StreamUtils::ReadWORD(pStream); + m_wMinute = StreamUtils::ReadWORD(pStream); + m_wSecond = StreamUtils::ReadWORD(pStream); + m_wMilliseconds = StreamUtils::ReadWORD(pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Structures/PointStruct.h b/MsBinaryFile/PptFile/Structures/PointStruct.h index 59cea60472..0760110ded 100644 --- a/MsBinaryFile/PptFile/Structures/PointStruct.h +++ b/MsBinaryFile/PptFile/Structures/PointStruct.h @@ -40,6 +40,10 @@ struct PointStruct : public IStruct _UINT32 m_x; _UINT32 m_y; - void ReadFromStream(POLE::Stream *pStream) override; + void ReadFromStream(POLE::Stream *pStream) override + { + m_x = StreamUtils::ReadLONG(pStream); + m_y = StreamUtils::ReadLONG(pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Structures/RatioStruct.h b/MsBinaryFile/PptFile/Structures/RatioStruct.h index 32fe23a6f0..2d59200650 100644 --- a/MsBinaryFile/PptFile/Structures/RatioStruct.h +++ b/MsBinaryFile/PptFile/Structures/RatioStruct.h @@ -42,7 +42,10 @@ struct RatioStruct : public IStruct LONG m_nNumber; LONG m_nDenom; - - void ReadFromStream(POLE::Stream* pStream) override; + void ReadFromStream(POLE::Stream* pStream) override + { + m_nNumber = StreamUtils::ReadLONG(pStream); + m_nDenom = StreamUtils::ReadLONG(pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Structures/RectStruct.h b/MsBinaryFile/PptFile/Structures/RectStruct.h index c7deaa055d..eee7350217 100644 --- a/MsBinaryFile/PptFile/Structures/RectStruct.h +++ b/MsBinaryFile/PptFile/Structures/RectStruct.h @@ -44,7 +44,12 @@ struct RectStruct : public IStruct _INT32 m_nRight; _INT32 m_nBottom; - - void ReadFromStream(POLE::Stream *pStream) override; + void ReadFromStream(POLE::Stream *pStream) override + { + m_nTop = StreamUtils::ReadLONG(pStream); + m_nLeft = StreamUtils::ReadLONG(pStream); + m_nRight = StreamUtils::ReadLONG(pStream); + m_nBottom = StreamUtils::ReadLONG(pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Structures/ScalingStruct.h b/MsBinaryFile/PptFile/Structures/ScalingStruct.h index 9ef9b0c49d..4df800f955 100644 --- a/MsBinaryFile/PptFile/Structures/ScalingStruct.h +++ b/MsBinaryFile/PptFile/Structures/ScalingStruct.h @@ -42,6 +42,10 @@ struct ScalingStruct : public IStruct RatioStruct m_x; RatioStruct m_y; - void ReadFromStream(POLE::Stream* pStream) override; + void ReadFromStream(POLE::Stream* pStream) override + { + m_x.ReadFromStream(pStream); + m_y.ReadFromStream(pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Structures/SmallRectStruct.h b/MsBinaryFile/PptFile/Structures/SmallRectStruct.h index 9bbdfe38b0..84c5351f97 100644 --- a/MsBinaryFile/PptFile/Structures/SmallRectStruct.h +++ b/MsBinaryFile/PptFile/Structures/SmallRectStruct.h @@ -43,7 +43,12 @@ struct SmallRectStruct : public IStruct _INT16 m_nRight; _INT16 m_nBottom; - - void ReadFromStream(POLE::Stream *pStream) override; + void ReadFromStream(POLE::Stream *pStream) override + { + m_nTop = StreamUtils::ReadSHORT(pStream); + m_nLeft = StreamUtils::ReadSHORT(pStream); + m_nRight = StreamUtils::ReadSHORT(pStream); + m_nBottom = StreamUtils::ReadSHORT(pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Structures/TmsfTimeStruct.h b/MsBinaryFile/PptFile/Structures/TmsfTimeStruct.h index c384437553..5cf0fd4f3f 100644 --- a/MsBinaryFile/PptFile/Structures/TmsfTimeStruct.h +++ b/MsBinaryFile/PptFile/Structures/TmsfTimeStruct.h @@ -44,7 +44,12 @@ struct TmsfTimeStruct : public IStruct BYTE m_nSecond; BYTE m_nFrame; - - void ReadFromStream(POLE::Stream *pStream) override; + void ReadFromStream(POLE::Stream *pStream) override + { + m_nTrack = StreamUtils::ReadBYTE(pStream); + m_nMinute = StreamUtils::ReadBYTE(pStream); + m_nSecond = StreamUtils::ReadBYTE(pStream); + m_nFrame = StreamUtils::ReadBYTE(pStream); + } }; } diff --git a/MsBinaryFile/PptFile/Structures/WideColorStruct.h b/MsBinaryFile/PptFile/Structures/WideColorStruct.h index ff7316caa9..a20dc9b65c 100644 --- a/MsBinaryFile/PptFile/Structures/WideColorStruct.h +++ b/MsBinaryFile/PptFile/Structures/WideColorStruct.h @@ -43,7 +43,11 @@ struct WideColorStruct : IStruct USHORT m_nGreen; USHORT m_nBlue; - - void ReadFromStream(POLE::Stream *pStream) override; + void ReadFromStream(POLE::Stream *pStream) override + { + m_nRed = StreamUtils::ReadWORD(pStream); + m_nGreen = StreamUtils::ReadWORD(pStream); + m_nBlue = StreamUtils::ReadWORD(pStream); + } }; } diff --git a/MsBinaryFile/Projects/PPTFormatLib/Linux/PPTFormatLib.pro b/MsBinaryFile/Projects/PPTFormatLib/Linux/PPTFormatLib.pro index 718708fa94..7393fa17cb 100644 --- a/MsBinaryFile/Projects/PPTFormatLib/Linux/PPTFormatLib.pro +++ b/MsBinaryFile/Projects/PPTFormatLib/Linux/PPTFormatLib.pro @@ -47,7 +47,7 @@ HEADERS += \ ../../../PptFile/PPTXWriter/TxBodyConverter.h \ ../../../PptFile/Reader/ClassesAtom.h \ ../../../PptFile/Reader/CommonZLib.h \ - ../../../PptFile/Reader/ExtXmlUtils.h \ + ../../../PptFile/Reader/ExtXmlUtils.hpp \ ../../../PptFile/Reader/PPTDocumentInfo.h \ ../../../PptFile/Reader/PPTDocumentInfoOneUser.h \ ../../../PptFile/Reader/PPTFileDefines.h \ @@ -287,31 +287,23 @@ core_debug { SOURCES += \ ../../../PptFile/Enums/RecordType.cpp \ ../../../PptFile/Enums/RecordType.cpp \ - \ ../../../PptFile/Reader/ReadStructures.cpp \ ../../../PptFile/Reader/RoundTripExtractor.cpp \ ../../../PptFile/Reader/PPTDocumentInfoOneUser.cpp \ ../../../PptFile/Reader/Records.cpp \ ../../../PptFile/Reader/PPTFileReader.cpp \ ../../../PptFile/Reader/SlidePersist.cpp \ - \ ../../../PptFile/PPTXWriter/Converter.cpp \ ../../../PptFile/PPTXWriter/ShapeWriter.cpp \ - ../../../PptFile/PPTXWriter/StylesWriter.cpp \ - ../../../PptFile/PPTXWriter/TableWriter.cpp \ + ../../../PptFile/PPTXWriter/TableWriter.cpp \ ../../../PptFile/PPTXWriter/TxBodyConverter.cpp \ - ../../../PptFile/PPTXWriter/ImageManager.cpp \ - ../../../PptFile/PPTXWriter/BulletsConverter.cpp \ - \ - ../../../PptFile/Drawing/Element.cpp \ - ../../../PptFile/Drawing/Elements.cpp \ - ../../../PptFile/Drawing/Layout.cpp \ - ../../../PptFile/Drawing/Slide.cpp \ - ../../../PptFile/Drawing/Theme.cpp \ - ../../../PptFile/Drawing/TextStructures.cpp \ - ../../../PptFile/Drawing/TextAttributesEx.cpp \ - \ - ../../../PptFile/Converter/Animation/AnimationParser.cpp \ + ../../../PptFile/Records/Drawing/ArtBlip.cpp \ + ../../../PptFile/Records/Drawing/ShapeContainer.cpp \ + ../../../PptFile/Records/Animations/TimeVariant.cpp \ + ../../../PptFile/Records/BlipEntityAtom.cpp \ + ../../../PptFile/Drawing/Elements.cpp \ + ../../../PptFile/Drawing/TextAttributesEx.cpp \ + ../../../PptFile/Converter/Animation/AnimationParser.cpp \ ../../../PptFile/Converter/Animation/Animation_1995.cpp \ ../../../PptFile/Converter/Animation/TimingUtils.cpp \ ../../../PptFile/Converter/Animation/Timing_1995.cpp \ @@ -320,126 +312,7 @@ SOURCES += \ ../../../PptFile/Converter/Animation/intermediate_anim.cpp \ ../../../PptFile/Converter/timing.cpp \ ../../../PptFile/Converter/transition.cpp \ - \ - ../../../PptFile/Records/Drawing/ArtBlip.cpp \ - ../../../PptFile/Records/Drawing/ShapeContainer.cpp \ - ../../../PptFile/Records/Animations/TimeVariant.cpp \ - ../../../PptFile/Records/BlipEntityAtom.cpp \ - ../../../PptFile/Records/Animations/AnimationInfoAtom.cpp \ - ../../../PptFile/Records/Animations/AnimationInfoContainer.cpp \ - ../../../PptFile/Records/Animations/BuildAtom.cpp \ - ../../../PptFile/Records/Animations/BuildListSubContainer.cpp \ - ../../../PptFile/Records/Animations/ChartBuildAtom.cpp \ - ../../../PptFile/Records/Animations/ChartBuildContainer.cpp \ - ../../../PptFile/Records/Animations/ClientVisualElementContainer.cpp \ - ../../../PptFile/Records/Animations/DiagramBuildAtom.cpp \ - ../../../PptFile/Records/Animations/DiagramBuildContainer.cpp \ - ../../../PptFile/Records/Animations/ExtTimeNodeContainer.cpp \ - ../../../PptFile/Records/Animations/HashCode10Atom.cpp \ - ../../../PptFile/Records/Animations/LevelInfoAtom.cpp \ - ../../../PptFile/Records/Animations/ParaBuildAtom.cpp \ - ../../../PptFile/Records/Animations/ParaBuildContainer.cpp \ - ../../../PptFile/Records/Animations/ParaBuildLevel.cpp \ - ../../../PptFile/Records/Animations/SubEffectContainer.cpp \ - ../../../PptFile/Records/Animations/TimeAnimateBehaviorAtom.cpp \ - ../../../PptFile/Records/Animations/TimeAnimateBehaviorContainer.cpp \ - ../../../PptFile/Records/Animations/TimeAnimateColor.cpp \ - ../../../PptFile/Records/Animations/TimeAnimateColorBy.cpp \ - ../../../PptFile/Records/Animations/TimeAnimationValueAtom.cpp \ - ../../../PptFile/Records/Animations/TimeAnimationValueListContainer.cpp \ - ../../../PptFile/Records/Animations/TimeAnimationValueListEntry.cpp \ - ../../../PptFile/Records/Animations/TimeBehaviorAtom.cpp \ - ../../../PptFile/Records/Animations/TimeBehaviorContainer.cpp \ - ../../../PptFile/Records/Animations/TimeColorBehaviorAtom.cpp \ - ../../../PptFile/Records/Animations/TimeColorBehaviorContainer.cpp \ - ../../../PptFile/Records/Animations/TimeCommandBehaviorAtom.cpp \ - ../../../PptFile/Records/Animations/TimeCommandBehaviorContainer.cpp \ - ../../../PptFile/Records/Animations/TimeConditionAtom.cpp \ - ../../../PptFile/Records/Animations/TimeConditionContainer.cpp \ - ../../../PptFile/Records/Animations/TimeEffectBehaviorAtom.cpp \ - ../../../PptFile/Records/Animations/TimeEffectBehaviorContainer.cpp \ - ../../../PptFile/Records/Animations/TimeIterateDataAtom.cpp \ - ../../../PptFile/Records/Animations/TimeModifierAtom.cpp \ - ../../../PptFile/Records/Animations/TimeMotionBehaviorAtom.cpp \ - ../../../PptFile/Records/Animations/TimeMotionBehaviorContainer.cpp \ - ../../../PptFile/Records/Animations/TimeNodeAtom.cpp \ - ../../../PptFile/Records/Animations/TimePropertyList4TimeBehavior.cpp \ - ../../../PptFile/Records/Animations/TimePropertyList4TimeNodeContainer.cpp \ - ../../../PptFile/Records/Animations/TimeRotationBehaviorAtom.cpp \ - ../../../PptFile/Records/Animations/TimeRotationBehaviorContainer.cpp \ - ../../../PptFile/Records/Animations/TimeScaleBehaviorAtom.cpp \ - ../../../PptFile/Records/Animations/TimeScaleBehaviorContainer.cpp \ - ../../../PptFile/Records/Animations/TimeSequenceDataAtom.cpp \ - ../../../PptFile/Records/Animations/TimeSetBehaviorAtom.cpp \ - ../../../PptFile/Records/Animations/TimeSetBehaviorContainer.cpp \ - ../../../PptFile/Records/Animations/TimeStringListContainer.cpp \ - ../../../PptFile/Records/Animations/TimeVariant4Behavior.cpp \ - ../../../PptFile/Records/Animations/VisualPageAtom.cpp \ - ../../../PptFile/Records/Animations/VisualShapeAtom.cpp \ - ../../../PptFile/Records/Animations/VisualShapeChartElementAtom.cpp \ - ../../../PptFile/Records/Animations/VisualShapeGeneralAtom.cpp \ - ../../../PptFile/Records/Animations/VisualSoundAtom.cpp \ - ../../../PptFile/Records/BlipCollection9Container.cpp \ - ../../../PptFile/Records/BookmarkEntityAtom.cpp \ - ../../../PptFile/Records/BookmarkSeedAtom.cpp \ - ../../../PptFile/Records/BuildAtom.cpp \ - ../../../PptFile/Records/CFMasks.cpp \ - ../../../PptFile/Records/CString.cpp \ - ../../../PptFile/Records/ColorSchemeAtom.cpp \ - ../../../PptFile/Records/Comment10Container.cpp \ - ../../../PptFile/Records/CurrentUserAtom.cpp \ - ../../../PptFile/Records/DocInfoListContainer.cpp \ - ../../../PptFile/Records/DocProgTagsContainer.cpp \ - ../../../PptFile/Records/DocRoutingSlipAtom.cpp \ - ../../../PptFile/Records/DocumentAtom.cpp \ - ../../../PptFile/Records/DocumentRecords.cpp \ - ../../../PptFile/Records/DocumentTextInfo.cpp \ - ../../../PptFile/Records/Drawing/BlipStoreContainer.cpp \ - ../../../PptFile/Records/Drawing/BlipStoreEntry.cpp \ - ../../../PptFile/Records/Drawing/ChildAnchor.cpp \ - ../../../PptFile/Records/Drawing/ClientAnchor.cpp \ - ../../../PptFile/Records/Drawing/DrawingContainer.cpp \ - ../../../PptFile/Records/Drawing/DrawingGroup.cpp \ - ../../../PptFile/Records/Drawing/DrawingRecord.cpp \ - ../../../PptFile/Records/Drawing/GroupShape.cpp \ - ../../../PptFile/Records/Drawing/Shape.cpp \ - ../../../PptFile/Records/Drawing/ShapeProperties.cpp \ - ../../../PptFile/Records/Drawing/TextBox.cpp \ - ../../../PptFile/Records/EndDocument.cpp \ - ../../../PptFile/Records/ExCDAudioContainer.cpp \ - ../../../PptFile/Records/ExControlAtom.cpp \ - ../../../PptFile/Records/ExHyperlinkAtom.cpp \ - ../../../PptFile/Records/ExMIDIAudioContainer.cpp \ - ../../../PptFile/Records/ExMediaAtom.cpp \ - ../../../PptFile/Records/ExObjListAtom.cpp \ - ../../../PptFile/Records/ExObjListContainer.cpp \ - ../../../PptFile/Records/ExObjRefAtom.cpp \ - ../../../PptFile/Records/ExOleEmbedAtom.cpp \ - ../../../PptFile/Records/ExOleLinkAtom.cpp \ - ../../../PptFile/Records/ExOleObjAtom.cpp \ - ../../../PptFile/Records/ExVideoContainer.cpp \ - ../../../PptFile/Records/ExWAVAudioEmbeddedContainer.cpp \ - ../../../PptFile/Records/ExWAVAudioLinkContainer.cpp \ - ../../../PptFile/Records/FontCollection10Container.cpp \ - ../../../PptFile/Records/FontEmbedFlags10Atom.cpp \ - ../../../PptFile/Records/FontEntityAtom.cpp \ - ../../../PptFile/Records/GridSpacing10Atom.cpp \ - ../../../PptFile/Records/GuideAtom.cpp \ - ../../../PptFile/Records/HeadersFootersAtom.cpp \ - ../../../PptFile/Records/InteractiveInfoAtom.cpp \ - ../../../PptFile/Records/KinsokuAtom.cpp \ - ../../../PptFile/Records/KinsokuContainer.cpp \ - ../../../PptFile/Records/KinsokuFollowingAtom.cpp \ - ../../../PptFile/Records/KinsokuLeadingAtom.cpp \ - ../../../PptFile/Records/LinkedShape10Atom.cpp \ - ../../../PptFile/Records/LinkedSlide10Atom.cpp \ - ../../../PptFile/Records/MasterPersistAtom.cpp \ - ../../../PptFile/Records/MasterTextPropAtom.cpp \ - ../../../PptFile/Records/MetafileBlob.cpp \ - ../../../PptFile/Records/MouseInteractiveInfoContainer.cpp \ - ../../../PptFile/Records/MouseTextInteractiveInfoAtom.cpp \ - ../../../PptFile/Records/NamedShowSlidesAtom.cpp - + ../../../PptFile/PPTXWriter/BulletsConverter.cpp } SOURCES += \ diff --git a/MsBinaryFile/Projects/PPTFormatLib/Linux/ppt_format_logic.cpp b/MsBinaryFile/Projects/PPTFormatLib/Linux/ppt_format_logic.cpp index 96ed1ce16b..154a5fd878 100644 --- a/MsBinaryFile/Projects/PPTFormatLib/Linux/ppt_format_logic.cpp +++ b/MsBinaryFile/Projects/PPTFormatLib/Linux/ppt_format_logic.cpp @@ -37,26 +37,16 @@ #include "../../../PptFile/Reader/Records.cpp" #include "../../../PptFile/Reader/PPTFileReader.cpp" #include "../../../PptFile/Reader/SlidePersist.cpp" - #include "../../../PptFile/PPTXWriter/Converter.cpp" #include "../../../PptFile/PPTXWriter/ShapeWriter.cpp" #include "../../../PptFile/PPTXWriter/TableWriter.cpp" #include "../../../PptFile/PPTXWriter/TxBodyConverter.cpp" -#include "../../../PptFile/PPTXWriter/BulletsConverter.cpp" - #include "../../../PptFile/Records/Drawing/ArtBlip.cpp" #include "../../../PptFile/Records/Drawing/ShapeContainer.cpp" #include "../../../PptFile/Records/Animations/TimeVariant.cpp" #include "../../../PptFile/Records/BlipEntityAtom.cpp" - -#include "../../../PptFile/Drawing/Element.cpp" #include "../../../PptFile/Drawing/Elements.cpp" -#include "../../../PptFile/Drawing/Layout.cpp" -#include "../../../PptFile/Drawing/Slide.cpp" -#include "../../../PptFile/Drawing/TextStructures.cpp" #include "../../../PptFile/Drawing/TextAttributesEx.cpp" -#include "../../../PptFile/Drawing/Theme.cpp" - #include "../../../PptFile/Converter/Animation/AnimationParser.cpp" #include "../../../PptFile/Converter/Animation/Animation_1995.cpp" #include "../../../PptFile/Converter/Animation/TimingUtils.cpp" @@ -66,118 +56,4 @@ #include "../../../PptFile/Converter/Animation/intermediate_anim.cpp" #include "../../../PptFile/Converter/timing.cpp" #include "../../../PptFile/Converter/transition.cpp" - -#include "../../../PptFile/Records/Animations/AnimationInfoAtom.cpp" -#include "../../../PptFile/Records/Animations/AnimationInfoContainer.cpp" -#include "../../../PptFile/Records/Animations/BuildAtom.cpp" -#include "../../../PptFile/Records/Animations/BuildListSubContainer.cpp" -#include "../../../PptFile/Records/Animations/ChartBuildAtom.cpp" -#include "../../../PptFile/Records/Animations/ChartBuildContainer.cpp" -#include "../../../PptFile/Records/Animations/ClientVisualElementContainer.cpp" -#include "../../../PptFile/Records/Animations/DiagramBuildAtom.cpp" -#include "../../../PptFile/Records/Animations/DiagramBuildContainer.cpp" -#include "../../../PptFile/Records/Animations/ExtTimeNodeContainer.cpp" -#include "../../../PptFile/Records/Animations/HashCode10Atom.cpp" -#include "../../../PptFile/Records/Animations/LevelInfoAtom.cpp" -#include "../../../PptFile/Records/Animations/ParaBuildAtom.cpp" -#include "../../../PptFile/Records/Animations/ParaBuildContainer.cpp" -#include "../../../PptFile/Records/Animations/ParaBuildLevel.cpp" -#include "../../../PptFile/Records/Animations/SubEffectContainer.cpp" -#include "../../../PptFile/Records/Animations/TimeAnimateBehaviorAtom.cpp" -#include "../../../PptFile/Records/Animations/TimeAnimateBehaviorContainer.cpp" -#include "../../../PptFile/Records/Animations/TimeAnimateColor.cpp" -#include "../../../PptFile/Records/Animations/TimeAnimateColorBy.cpp" -#include "../../../PptFile/Records/Animations/TimeAnimationValueAtom.cpp" -#include "../../../PptFile/Records/Animations/TimeAnimationValueListContainer.cpp" -#include "../../../PptFile/Records/Animations/TimeAnimationValueListEntry.cpp" -#include "../../../PptFile/Records/Animations/TimeBehaviorAtom.cpp" -#include "../../../PptFile/Records/Animations/TimeBehaviorContainer.cpp" -#include "../../../PptFile/Records/Animations/TimeColorBehaviorAtom.cpp" -#include "../../../PptFile/Records/Animations/TimeColorBehaviorContainer.cpp" -#include "../../../PptFile/Records/Animations/TimeCommandBehaviorAtom.cpp" -#include "../../../PptFile/Records/Animations/TimeCommandBehaviorContainer.cpp" -#include "../../../PptFile/Records/Animations/TimeConditionAtom.cpp" -#include "../../../PptFile/Records/Animations/TimeConditionContainer.cpp" -#include "../../../PptFile/Records/Animations/TimeEffectBehaviorAtom.cpp" -#include "../../../PptFile/Records/Animations/TimeEffectBehaviorContainer.cpp" -#include "../../../PptFile/Records/Animations/TimeIterateDataAtom.cpp" -#include "../../../PptFile/Records/Animations/TimeModifierAtom.cpp" -#include "../../../PptFile/Records/Animations/TimeMotionBehaviorAtom.cpp" -#include "../../../PptFile/Records/Animations/TimeMotionBehaviorContainer.cpp" -#include "../../../PptFile/Records/Animations/TimeNodeAtom.cpp" -#include "../../../PptFile/Records/Animations/TimePropertyList4TimeBehavior.cpp" -#include "../../../PptFile/Records/Animations/TimePropertyList4TimeNodeContainer.cpp" -#include "../../../PptFile/Records/Animations/TimeRotationBehaviorAtom.cpp" -#include "../../../PptFile/Records/Animations/TimeRotationBehaviorContainer.cpp" -#include "../../../PptFile/Records/Animations/TimeScaleBehaviorAtom.cpp" -#include "../../../PptFile/Records/Animations/TimeScaleBehaviorContainer.cpp" -#include "../../../PptFile/Records/Animations/TimeSequenceDataAtom.cpp" -#include "../../../PptFile/Records/Animations/TimeSetBehaviorAtom.cpp" -#include "../../../PptFile/Records/Animations/TimeSetBehaviorContainer.cpp" -#include "../../../PptFile/Records/Animations/TimeStringListContainer.cpp" -#include "../../../PptFile/Records/Animations/TimeVariant4Behavior.cpp" -#include "../../../PptFile/Records/Animations/VisualPageAtom.cpp" -#include "../../../PptFile/Records/Animations/VisualShapeAtom.cpp" -#include "../../../PptFile/Records/Animations/VisualShapeChartElementAtom.cpp" -#include "../../../PptFile/Records/Animations/VisualShapeGeneralAtom.cpp" -#include "../../../PptFile/Records/Animations/VisualSoundAtom.cpp" -#include "../../../PptFile/Records/BlipCollection9Container.cpp" -#include "../../../PptFile/Records/BookmarkEntityAtom.cpp" -#include "../../../PptFile/Records/BookmarkSeedAtom.cpp" -#include "../../../PptFile/Records/BuildAtom.cpp" -#include "../../../PptFile/Records/CFMasks.cpp" -#include "../../../PptFile/Records/CString.cpp" -#include "../../../PptFile/Records/ColorSchemeAtom.cpp" -#include "../../../PptFile/Records/Comment10Container.cpp" -#include "../../../PptFile/Records/CurrentUserAtom.cpp" -#include "../../../PptFile/Records/DocInfoListContainer.cpp" -#include "../../../PptFile/Records/DocProgTagsContainer.cpp" -#include "../../../PptFile/Records/DocRoutingSlipAtom.cpp" -#include "../../../PptFile/Records/DocumentAtom.cpp" -#include "../../../PptFile/Records/DocumentRecords.cpp" -#include "../../../PptFile/Records/DocumentTextInfo.cpp" -#include "../../../PptFile/Records/Drawing/BlipStoreContainer.cpp" -#include "../../../PptFile/Records/Drawing/BlipStoreEntry.cpp" -#include "../../../PptFile/Records/Drawing/ChildAnchor.cpp" -#include "../../../PptFile/Records/Drawing/ClientAnchor.cpp" -#include "../../../PptFile/Records/Drawing/DrawingContainer.cpp" -#include "../../../PptFile/Records/Drawing/DrawingGroup.cpp" -#include "../../../PptFile/Records/Drawing/DrawingRecord.cpp" -#include "../../../PptFile/Records/Drawing/GroupShape.cpp" -#include "../../../PptFile/Records/Drawing/Shape.cpp" -#include "../../../PptFile/Records/Drawing/ShapeProperties.cpp" -#include "../../../PptFile/Records/Drawing/TextBox.cpp" -#include "../../../PptFile/Records/EndDocument.cpp" -#include "../../../PptFile/Records/ExCDAudioContainer.cpp" -#include "../../../PptFile/Records/ExControlAtom.cpp" -#include "../../../PptFile/Records/ExHyperlinkAtom.cpp" -#include "../../../PptFile/Records/ExMIDIAudioContainer.cpp" -#include "../../../PptFile/Records/ExMediaAtom.cpp" -#include "../../../PptFile/Records/ExObjListAtom.cpp" -#include "../../../PptFile/Records/ExObjListContainer.cpp" -#include "../../../PptFile/Records/ExObjRefAtom.cpp" -#include "../../../PptFile/Records/ExOleEmbedAtom.cpp" -#include "../../../PptFile/Records/ExOleLinkAtom.cpp" -#include "../../../PptFile/Records/ExOleObjAtom.cpp" -#include "../../../PptFile/Records/ExVideoContainer.cpp" -#include "../../../PptFile/Records/ExWAVAudioEmbeddedContainer.cpp" -#include "../../../PptFile/Records/ExWAVAudioLinkContainer.cpp" -#include "../../../PptFile/Records/FontCollection10Container.cpp" -#include "../../../PptFile/Records/FontEmbedFlags10Atom.cpp" -#include "../../../PptFile/Records/FontEntityAtom.cpp" -#include "../../../PptFile/Records/GridSpacing10Atom.cpp" -#include "../../../PptFile/Records/GuideAtom.cpp" -#include "../../../PptFile/Records/HeadersFootersAtom.cpp" -#include "../../../PptFile/Records/InteractiveInfoAtom.cpp" -#include "../../../PptFile/Records/KinsokuAtom.cpp" -#include "../../../PptFile/Records/KinsokuContainer.cpp" -#include "../../../PptFile/Records/KinsokuFollowingAtom.cpp" -#include "../../../PptFile/Records/KinsokuLeadingAtom.cpp" -#include "../../../PptFile/Records/LinkedShape10Atom.cpp" -#include "../../../PptFile/Records/LinkedSlide10Atom.cpp" -#include "../../../PptFile/Records/MasterPersistAtom.cpp" -#include "../../../PptFile/Records/MasterTextPropAtom.cpp" -#include "../../../PptFile/Records/MetafileBlob.cpp" -#include "../../../PptFile/Records/MouseInteractiveInfoContainer.cpp" -#include "../../../PptFile/Records/MouseTextInteractiveInfoAtom.cpp" -#include "../../../PptFile/Records/NamedShowSlidesAtom.cpp" +#include "../../../PptFile/PPTXWriter/BulletsConverter.cpp" diff --git a/MsBinaryFile/Projects/PPTFormatLib/Windows/PPTFormatLib.vcxproj b/MsBinaryFile/Projects/PPTFormatLib/Windows/PPTFormatLib.vcxproj index 929c4d5331..b169777e76 100644 --- a/MsBinaryFile/Projects/PPTFormatLib/Windows/PPTFormatLib.vcxproj +++ b/MsBinaryFile/Projects/PPTFormatLib/Windows/PPTFormatLib.vcxproj @@ -265,7 +265,6 @@ - @@ -498,15 +497,11 @@ - - - - @@ -515,183 +510,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MsBinaryFile/Projects/PPTFormatLib/Windows/PPTFormatLib.vcxproj.filters b/MsBinaryFile/Projects/PPTFormatLib/Windows/PPTFormatLib.vcxproj.filters index 664c22f22b..83a2a502e2 100644 --- a/MsBinaryFile/Projects/PPTFormatLib/Windows/PPTFormatLib.vcxproj.filters +++ b/MsBinaryFile/Projects/PPTFormatLib/Windows/PPTFormatLib.vcxproj.filters @@ -775,9 +775,6 @@ Converter - - OOXWriter - @@ -860,536 +857,5 @@ Converter - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records - - - Records\Drawing - - - Records\Drawing - - - Records\Drawing - - - Records\Drawing - - - Records\Drawing - - - Records\Drawing - - - Records\Drawing - - - Records\Drawing - - - Records\Drawing - - - Records\Drawing - - - Records\Drawing - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - Records\Animations - - - OOXWriter - - - OOXWriter - - - OOXWriter - - - OOXElements - \ No newline at end of file diff --git a/OOXML/DocxFormat/Drawing/DrawingBody.h b/OOXML/DocxFormat/Drawing/DrawingBody.h deleted file mode 100644 index 4f5dd78d48..0000000000 --- a/OOXML/DocxFormat/Drawing/DrawingBody.h +++ /dev/null @@ -1,517 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * 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-12 Ernesta Birznieka-Upisha - * 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 OOX_LOGIC_DRAWING_BODY_INCLUDE_H_ -#define OOX_LOGIC_DRAWING_BODY_INCLUDE_H_ - -#include "../../Base/Nullable.h" -#include "../../Common/SimpleTypes_Drawing.h" -#include "../../Common/SimpleTypes_Shared.h" - -#include "../WritingElement.h" - -#include "DrawingStyles2.h" -#include "DrawingEffects.h" -#include "Drawing3D.h" -#include "DrawingShape.h" - -namespace OOX -{ - namespace Drawing - { - enum ETextAutofitType - { - textautofitNone = 0, - textautofitNo = 1, - textautofitNormal = 2, - textautofitShape = 3, - }; - //-------------------------------------------------------------------------------- - // CTextNoAutofit 21.1.2.1.2 (Part 1) - //-------------------------------------------------------------------------------- - class CTextNoAutofit : public WritingElement - { - public: - WritingElement_AdditionConstructors(CTextNoAutofit) - CTextNoAutofit() - { - } - virtual ~CTextNoAutofit() - { - } - - public: - - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring toXML() const - { - return _T(""); - } - virtual EElementType getType() const - { - return et_a_noAutofit; - } - }; - - //-------------------------------------------------------------------------------- - // CTextNormalAutofit 21.1.2.1.3 (Part 1) - //-------------------------------------------------------------------------------- - class CTextNormalAutofit : public WritingElement - { - public: - WritingElement_AdditionConstructors(CTextNormalAutofit) - CTextNormalAutofit() - { - } - virtual ~CTextNormalAutofit() - { - } - - public: - - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CTextNormalAutofit::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring toXML() const - { - std::wstring sResult = _T(""); - return sResult; - } - virtual EElementType getType() const - { - return et_a_normAutofit; - } - - private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Выставляем значения по умолчанию - m_oFontScale.SetValue( 100 ); - m_oLnSpcReduction.SetValue( 0 ); - - // Читаем атрибуты - if ( oReader.GetAttributesCount() <= 0 ) - return; - - if ( !oReader.MoveToFirstAttribute() ) - return; - - std::wstring wsName = oReader.GetName(); - while( !wsName.empty() ) - { - wchar_t wsChar0 = wsName[0]; - - switch ( wsChar0 ) - { - case 'f': - if ( _T("fontScale") == wsName ) m_oFontScale = oReader.GetText(); - break; - - case 'l': - if ( _T("lnSpcReduction") == wsName ) m_oLnSpcReduction = oReader.GetText(); - break; - } - - if ( !oReader.MoveToNextAttribute() ) - break; - - wsName = oReader.GetName(); - } - oReader.MoveToElement(); - } - - public: - - SimpleTypes::CTextFontScalePercentOrPercentString m_oFontScale; - SimpleTypes::CTextSpacingPercentOrPercentString m_oLnSpcReduction; - }; - - //-------------------------------------------------------------------------------- - // CTextShapeAutofit 21.1.2.1.4 (Part 1) - //-------------------------------------------------------------------------------- - class CTextShapeAutofit : public WritingElement - { - public: - WritingElement_AdditionConstructors(CTextShapeAutofit) - CTextShapeAutofit() - { - } - virtual ~CTextShapeAutofit() - { - } - - public: - - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring toXML() const - { - return _T(""); - } - virtual EElementType getType() const - { - return et_a_spAutoFit; - } - }; - - //-------------------------------------------------------------------------------- - // CTextBodyProperties 21.1.2.1.1 (Part 1) - //-------------------------------------------------------------------------------- - class CTextBodyProperties : public WritingElement - { - public: - WritingElement_AdditionConstructors(CTextBodyProperties) - CTextBodyProperties() - { - m_eAutoFitType = textautofitNone; - m_eText3DType = text3dtypeUnknown; - } - virtual ~CTextBodyProperties() - { - } - - public: - - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - m_eAutoFitType = textautofitNone; - m_eText3DType = text3dtypeUnknown; - - // TO DO: Реализовать CTextBodyProperties::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - m_eAutoFitType = textautofitNone; - m_eText3DType = text3dtypeUnknown; - - ReadAttributes( oReader ); - - if ( oReader.IsEmptyNode() ) - return; - - int nCurDepth = oReader.GetDepth(); - while ( oReader.ReadNextSiblingNode( nCurDepth ) ) - { - std::wstring sName = oReader.GetName(); - - if ( _T("a:extLst") == sName ) - m_oExtLst = oReader; - else if ( _T("a:flatTx") == sName ) - { - m_eText3DType = text3dtypeFlat; - m_oFlatTx = oReader; - } - else if ( _T("a:noAutofit") == sName ) - { - m_eAutoFitType = textautofitNo; - m_oNoAutofit = oReader; - } - else if ( _T("a:normAutofit") == sName ) - { - m_eAutoFitType = textautofitNormal; - m_oNormAutofit = oReader; - } - else if ( _T("a:prstTxWarp") == sName ) - m_oPrstTxWrap = oReader; - else if ( _T("a:scene3d") == sName ) - m_oScene3D = oReader; - else if ( _T("a:sp3d") == sName ) - { - m_eText3DType = text3dtypeShape; - m_oSp3D = oReader; - } - else if ( _T("a:spAutoFit") == sName ) - { - m_eAutoFitType = textautofitShape; - m_oSpAutoFit = oReader; - } - } - } - virtual std::wstring toXML() const - { - std::wstring sResult = _T("ToString() + _T("\""); - - if ( m_oHorzOverflow.IsInit() ) - sResult += _T(" horzOverflow=\"") + m_oHorzOverflow->ToString() + _T("\""); - - if ( SimpleTypes::textverticaltypeHorz != m_oVert.GetValue() ) - sResult += _T(" vert=\"") + m_oVert.ToString() + _T("\""); - - if ( SimpleTypes::textwrappingtypeSquare != m_oWrap.GetValue() ) - sResult += _T(" wrap=\"") + m_oWrap.ToString() + _T("\""); - - if ( 91440 != m_oLIns.ToEmu() ) - sResult += _T(" lIns=\"") + m_oLIns.ToString() + _T("\""); - - if ( 45720 != m_oTIns.ToEmu() ) - sResult += _T(" tIns=\"") + m_oTIns.ToString() + _T("\""); - - if ( 91440 != m_oRIns.ToEmu() ) - sResult += _T(" rIns=\"") + m_oRIns.ToString() + _T("\""); - - if ( 45720 != m_oBIns.ToEmu() ) - sResult += _T(" bIns=\"") + m_oBIns.ToString() + _T("\""); - - if ( 1 != m_oNumCol.GetValue() ) - sResult += _T(" numCol=\"") + m_oNumCol.ToString() + _T("\""); - - if ( 0 != m_oSpcCol.GetValue() ) - sResult += _T(" spcCol=\"") + m_oSpcCol.ToString() + _T("\""); - - if ( SimpleTypes::onoffFalse != m_oRtlCol.GetValue() ) - sResult += _T(" rtlCol=\"1\""); - - if ( SimpleTypes::onoffFalse != m_oFromWordArt.GetValue() ) - sResult += _T(" fromWordArt=\"1\""); - - if ( SimpleTypes::textanchoringtypeT != m_oAnchor.GetValue() ) - sResult += _T(" anchor=\"") + m_oAnchor.ToString() + _T("\""); - - if ( SimpleTypes::onoffFalse != m_oAnchorCtr.GetValue() ) - sResult += _T(" anchorCtr=\"1\""); - - if ( SimpleTypes::onoffFalse != m_oForceAA.GetValue() ) - sResult += _T(" forceAA=\"1\""); - - if ( SimpleTypes::onoffFalse != m_oUpright.GetValue() ) - sResult += _T(" upright=\"1\""); - - if ( SimpleTypes::onoffFalse != m_oCompatLnSpc.GetValue() ) - sResult += _T(" compatLnSpc=\"1\""); - - sResult += _T(">"); - - if ( m_oPrstTxWrap.IsInit() ) - sResult += m_oPrstTxWrap->toXML(); - - switch ( m_eAutoFitType ) - { - case textautofitNo: - if ( m_oNoAutofit.IsInit() ) - sResult += m_oNoAutofit->toXML(); - - break; - case textautofitNormal: - if ( m_oNormAutofit.IsInit() ) - sResult += m_oNormAutofit->toXML(); - - break; - case textautofitShape: - if ( m_oSpAutoFit.IsInit() ) - sResult += m_oSpAutoFit->toXML(); - break; - } - - if ( m_oScene3D.IsInit() ) - sResult += m_oScene3D->toXML(); - - switch ( m_eText3DType ) - { - case text3dtypeFlat: - - if ( m_oFlatTx.IsInit() ) - sResult += m_oFlatTx->toXML(); - - break; - - case text3dtypeShape: - - if ( m_oSp3D.IsInit() ) - sResult += m_oSp3D->toXML(); - - break; - } - - if ( m_oExtLst.IsInit() ) - sResult += m_oExtLst->toXML(); - - sResult += _T(""); - return sResult; - } - virtual EElementType getType() const - { - return et_a_bodyPr; - } - - private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Устанавливаем значения по умолчанию - m_oBIns.SetValue(Emu_To_Pt(45720)); - m_oLIns.SetValue(Emu_To_Pt(91440)); - m_oRIns.SetValue(Emu_To_Pt(91440)); - m_oTIns.SetValue(Emu_To_Pt(45720)); - - // Читаем атрибуты - if ( oReader.GetAttributesCount() <= 0 ) - return; - - if ( !oReader.MoveToFirstAttribute() ) - return; - - std::wstring wsName = oReader.GetName(); - while( !wsName.empty() ) - { - wchar_t wsChar0 = wsName[0]; - - switch ( wsChar0 ) - { - case 'a': - if ( _T("anchor") == wsName ) m_oAnchor = oReader.GetText(); - else if ( _T("anchorCtr") == wsName ) m_oAnchorCtr = oReader.GetText(); - break; - case 'b': - if ( _T("bIns") == wsName ) m_oBIns = oReader.GetText(); - break; - case 'c': - if ( _T("compatLnSpc") == wsName ) m_oCompatLnSpc = oReader.GetText(); - break; - case 'f': - if ( _T("forceAA") == wsName ) m_oForceAA = oReader.GetText(); - else if ( _T("fromWordArt") == wsName ) m_oFromWordArt = oReader.GetText(); - break; - case 'h': - if ( _T("horzOverflow") == wsName ) m_oHorzOverflow = oReader.GetText(); - break; - case 'l': - if ( _T("lIns") == wsName ) m_oLIns = oReader.GetText(); - break; - case 'n': - if ( _T("numCol") == wsName ) m_oNumCol = oReader.GetText(); - break; - case 'r': - if ( _T("rIns") == wsName ) m_oRIns = oReader.GetText(); - else if ( _T("rot") == wsName ) m_oRot = oReader.GetText(); - else if ( _T("rtlCol") == wsName ) m_oRtlCol = oReader.GetText(); - break; - case 's': - if ( _T("spcCol") == wsName ) m_oSpcCol = oReader.GetText(); - else if ( _T("spcFirstLastPara") == wsName ) m_oSpcFirstLastPara = oReader.GetText(); - break; - case 't': - if ( _T("tIns") == wsName ) m_oTIns = oReader.GetText(); - break; - case 'u': - if ( _T("upright") == wsName ) m_oUpright = oReader.GetText(); - break; - case 'v': - if ( _T("vert") == wsName ) m_oVert = oReader.GetText(); - else if ( _T("vertOverflow") == wsName ) m_oVertOverflow = oReader.GetText(); - break; - case 'w': - if ( _T("wrap") == wsName ) m_oWrap = oReader.GetText(); - break; - } - - if ( !oReader.MoveToNextAttribute() ) - break; - - wsName = oReader.GetName(); - } - oReader.MoveToElement(); - } - - - public: - - // Attributes - SimpleTypes::CTextAnchoringType m_oAnchor; - SimpleTypes::COnOff m_oAnchorCtr; - SimpleTypes::CCoordinate32 m_oBIns; - SimpleTypes::COnOff m_oCompatLnSpc; - SimpleTypes::COnOff m_oForceAA; - SimpleTypes::COnOff m_oFromWordArt; - nullable> m_oHorzOverflow; - SimpleTypes::CCoordinate32 m_oLIns; - SimpleTypes::CTextColumnCount<1> m_oNumCol; - SimpleTypes::CCoordinate32 m_oRIns; - SimpleTypes::CAngle<0> m_oRot; - SimpleTypes::COnOff m_oRtlCol; - SimpleTypes::CPositiveCoordinate32<0> m_oSpcCol; - SimpleTypes::COnOff m_oSpcFirstLastPara; - SimpleTypes::CCoordinate32 m_oTIns; - SimpleTypes::COnOff m_oUpright; - SimpleTypes::CTextVerticalType m_oVert; - nullable> m_oVertOverflow; - SimpleTypes::CTextWrappingType m_oWrap; - - // Childs - ETextAutofitType m_eAutoFitType; - EText3DType m_eText3DType; - nullable m_oExtLst; - nullable m_oFlatTx; - nullable m_oNoAutofit; - nullable m_oNormAutofit; - nullable m_oPrstTxWrap; - nullable m_oScene3D; - nullable m_oSp3D; - nullable m_oSpAutoFit; - }; - - } // namespace Logic -} // namespace OOX - -#endif // OOX_LOGIC_DRAWING_BODY_INCLUDE_H_ diff --git a/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro b/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro index c70fe4db3b..6d1824744a 100644 --- a/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro +++ b/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro @@ -92,8 +92,9 @@ SOURCES += \ ../../../../MsBinaryFile/Common/Vml/toVmlConvert.cpp \ ../../../../MsBinaryFile/Common/Vml/PPTShape/PptFormula.cpp \ ../../../../MsBinaryFile/Common/Vml/PPTShape/PptShape.cpp \ - ../../../../MsBinaryFile/Common/Vml/PPTXShape/PptxFormula.cpp \ - ../../../PPTXFormat/DrawingConverter/ASCOfficeDrawingConverter.cpp \ + ../../../../MsBinaryFile/Common/Vml/PPTXShape/ElementSettings.cpp \ + ../../../../MsBinaryFile/Common/Vml/PPTXShape/PptxFormula.cpp \ + ../../../PPTXFormat/DrawingConverter/ASCOfficeDrawingConverter.cpp \ ../../../PPTXFormat/DrawingConverter/ASCOfficePPTXFileRealization.cpp \ ../../../Binary/Presentation/BinaryFileReaderWriter.cpp \ ../../../Binary/Presentation/FontPicker.cpp \ diff --git a/OOXML/Projects/Windows/BinaryFormatLib/BinaryFormatLib.vcxproj b/OOXML/Projects/Windows/BinaryFormatLib/BinaryFormatLib.vcxproj index 36cad0d9b9..eacbbd5f98 100644 --- a/OOXML/Projects/Windows/BinaryFormatLib/BinaryFormatLib.vcxproj +++ b/OOXML/Projects/Windows/BinaryFormatLib/BinaryFormatLib.vcxproj @@ -21,6 +21,7 @@ + diff --git a/OOXML/Projects/Windows/BinaryFormatLib/BinaryFormatLib.vcxproj.filters b/OOXML/Projects/Windows/BinaryFormatLib/BinaryFormatLib.vcxproj.filters index 23864b192a..df116ce485 100644 --- a/OOXML/Projects/Windows/BinaryFormatLib/BinaryFormatLib.vcxproj.filters +++ b/OOXML/Projects/Windows/BinaryFormatLib/BinaryFormatLib.vcxproj.filters @@ -135,6 +135,9 @@ Common + + Common\Vml\PptShape + diff --git a/OOXML/XlsxFormat/SharedStrings/rPr.cpp b/OOXML/XlsxFormat/SharedStrings/rPr.cpp deleted file mode 100644 index ee23acb64b..0000000000 --- a/OOXML/XlsxFormat/SharedStrings/rPr.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * 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-12 Ernesta Birznieka-Upisha - * 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 "rPr.h" - -namespace OOX -{ - namespace Spreadsheet - { - CColor::CColor() - { - } - CColor::~CColor() - { - } - void CColor::fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - void CColor::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, _T("auto"), m_oAuto ) - WritingElement_ReadAttributes_Read_if ( oReader, _T("indexed"), m_oIndexed ) - WritingElement_ReadAttributes_Read_if ( oReader, _T("rgb"), m_oRgb ) - WritingElement_ReadAttributes_Read_if ( oReader, _T("theme"), m_oTheme ) - WritingElement_ReadAttributes_Read_if ( oReader, _T("tint"), m_oTint ) - WritingElement_ReadAttributes_End( oReader ) - } - - CRPr::CRPr() - { - } - CRPr::~CRPr() - { - } - void CRPr::fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - - if ( oReader.IsEmptyNode() ) - return; - - int nCurDepth = oReader.GetDepth(); - while( oReader.ReadNextSiblingNode( nCurDepth ) ) - { - std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName()); - - if ( _T("b") == sName ) - m_oBold = oReader; - else if ( _T("charset") == sName ) - ;//pItem = new CText( oReader ); - else if ( _T("color") == sName ) - m_oColor = oReader; - else if ( _T("condense") == sName ) - m_oCondense = oReader; - else if ( _T("extend") == sName ) - m_oExtend = oReader; - else if ( _T("family") == sName ) - ;//m_oFamily = oReader; - else if ( _T("i") == sName ) - m_oItalic = oReader; - else if ( _T("outline") == sName ) - m_oOutline = oReader; - else if ( _T("rFont") == sName ) - m_oRFont = oReader; - else if ( _T("scheme") == sName ) - ;//m_oScheme = oReader; - else if ( _T("shadow") == sName ) - m_oShadow = oReader; - else if ( _T("strike") == sName ) - m_oStrike = oReader; - else if ( _T("sz") == sName ) - m_oSz = oReader; - else if ( _T("u") == sName ) - m_oUnderline = oReader; - else if ( _T("vertAlign") == sName ) - m_oVertAlign = oReader; - - } - } - EElementType CRPr::getType () const - { - return et_rPr; - } - void CRPr::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - } - - } //Spreadsheet -} // namespace OOX diff --git a/OOXML/XlsxFormat/SharedStrings/rPr.h b/OOXML/XlsxFormat/SharedStrings/rPr.h deleted file mode 100644 index 38e824b39b..0000000000 --- a/OOXML/XlsxFormat/SharedStrings/rPr.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2019 - * - * 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-12 Ernesta Birznieka-Upisha - * 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 "../../Base/Nullable.h" -#include "../WritingElement.h" - -#include "../../Common/SimpleTypes_Word.h" -#include "../../Common/SimpleTypes_Shared.h" -#include "../../Common/ComplexTypes.h" - -#include "../../Common/SimpleTypes_Spreadsheet.h" - -namespace OOX -{ - namespace Spreadsheet - { - class CColor - { - public: - WritingElement_AdditionConstructors(CColor) - CColor(); - virtual ~CColor(); - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - - private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - - public: - nullable m_oAuto; - nullable m_oIndexed; - nullable_string m_oRgb; - nullable m_oTheme; - nullable m_oTint; - }; - - //необработано: - class CRPr : public WritingElementWithChilds - { - public: - WritingElement_AdditionConstructors(CRPr) - CRPr(); - virtual ~CRPr(); - - public: - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - virtual EElementType getType () const; - - private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - - public: - nullable m_oBold; - nullable m_oCharset; - nullable m_oColor; - nullable m_oCondense; - nullable m_oExtend; - //nullable > m_oFamily; - nullable m_oItalic; - nullable m_oOutline; - nullable m_oRFont; - //nullable > m_oScheme; - nullable m_oShadow; - nullable m_oStrike; - nullable m_oSz; - nullable m_oUnderline; - nullable m_oVertAlign; - }; - } //Spreadsheet -} // namespace OOX