diff --git a/ASCOfficePPTFile/PPTFormatLib/Linux/PPTFormatLib.pro b/ASCOfficePPTFile/PPTFormatLib/Linux/PPTFormatLib.pro new file mode 100644 index 0000000000..be91f9ef63 --- /dev/null +++ b/ASCOfficePPTFile/PPTFormatLib/Linux/PPTFormatLib.pro @@ -0,0 +1,320 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2014-12-16T18:28:23 +# +#------------------------------------------------- + +QT -= core gui + +TARGET = PptFormatLib +TEMPLATE = lib +CONFIG += staticlib + +CORE_ROOT_DIR = $$PWD/../../.. +PWD_ROOT_DIR = $$PWD + +CONFIG += core_x2t +include(../../../Common/base.pri) + +#BOOST +include($$PWD/../../../Common/3dParty/boost/boost.pri) + +DEFINES += UNICODE \ + _UNICODE \ + _PRESENTATION_WRITER_ \ + _SVG_CONVERT_TO_IMAGE_ \ + DONT_WRITE_EMBEDDED_FONTS + #DISABLE_FILE_DOWNLOADER + +HEADERS += \ + ../Converter/Animation/AnimationParser.h \ + ../Converter/Animation/Animation_1995.h \ + ../Converter/Animation/TimingExeption.h \ + ../Converter/Animation/TimingUtils.h \ + ../Converter/Animation/Timing_1995.h \ + ../Converter/Animation/Timing_2010.h \ + ../Converter/Animation/hashcode10.h \ + ../Converter/Animation/intermediate_anim.h \ + ../Converter/timing.h \ + ../Converter/transition.h \ + ../Enums/RecordType.h \ + ../Enums/_includer.h \ + ../Enums/enums.h \ + ../PPTFormatLib.h \ + ../PPTXWriter/BulletsConverter.h \ + ../PPTXWriter/TableWriter.h \ + ../PPTXWriter/TxBodyConverter.h \ + ../Reader/ClassesAtom.h \ + ../Reader/CommonZLib.h \ + ../Reader/ExtXmlUtils.hpp \ + ../Reader/PPTDocumentInfo.h \ + ../Reader/PPTDocumentInfoOneUser.h \ + ../Reader/PPTFileDefines.h \ + ../Reader/PPTFileReader.h \ + ../Reader/ReadStructures.h \ + ../Reader/Records.h \ + ../Reader/RoundTripExtractor.h \ + ../Reader/Slide.h \ + ../Reader/SlideInfo.h \ + ../Reader/SlidePersist.h \ + ../Records/Animations/AnimationInfoAtom.h \ + ../Records/Animations/AnimationInfoContainer.h \ + ../Records/Animations/BuildAtom.h \ + ../Records/Animations/BuildListContainer.h \ + ../Records/Animations/BuildListSubContainer.h \ + ../Records/Animations/ChartBuildAtom.h \ + ../Records/Animations/ChartBuildContainer.h \ + ../Records/Animations/ClientVisualElementContainer.h \ + ../Records/Animations/DiagramBuildAtom.h \ + ../Records/Animations/DiagramBuildContainer.h \ + ../Records/Animations/ExtTimeNodeContainer.h \ + ../Records/Animations/HashCode10Atom.h \ + ../Records/Animations/LevelInfoAtom.h \ + ../Records/Animations/ParaBuildAtom.h \ + ../Records/Animations/ParaBuildContainer.h \ + ../Records/Animations/ParaBuildLevel.h \ + ../Records/Animations/SubEffectContainer.h \ + ../Records/Animations/TimeAnimateBehaviorAtom.h \ + ../Records/Animations/TimeAnimateBehaviorContainer.h \ + ../Records/Animations/TimeAnimateColor.h \ + ../Records/Animations/TimeAnimateColorBy.h \ + ../Records/Animations/TimeAnimationValueAtom.h \ + ../Records/Animations/TimeAnimationValueListContainer.h \ + ../Records/Animations/TimeAnimationValueListEntry.h \ + ../Records/Animations/TimeBehaviorAtom.h \ + ../Records/Animations/TimeBehaviorContainer.h \ + ../Records/Animations/TimeColorBehaviorAtom.h \ + ../Records/Animations/TimeColorBehaviorContainer.h \ + ../Records/Animations/TimeCommandBehaviorAtom.h \ + ../Records/Animations/TimeCommandBehaviorContainer.h \ + ../Records/Animations/TimeConditionAtom.h \ + ../Records/Animations/TimeConditionContainer.h \ + ../Records/Animations/TimeDisplayType.h \ + ../Records/Animations/TimeEffectBehaviorAtom.h \ + ../Records/Animations/TimeEffectBehaviorContainer.h \ + ../Records/Animations/TimeEffectID.h \ + ../Records/Animations/TimeEffectNodeType.h \ + ../Records/Animations/TimeEffectType.h \ + ../Records/Animations/TimeGroupID.h \ + ../Records/Animations/TimeIterateDataAtom.h \ + ../Records/Animations/TimeMasterRelType.h \ + ../Records/Animations/TimeModifierAtom.h \ + ../Records/Animations/TimeMotionBehaviorAtom.h \ + ../Records/Animations/TimeMotionBehaviorContainer.h \ + ../Records/Animations/TimeNodeAtom.h \ + ../Records/Animations/TimeNodeTimeFilter.h \ + ../Records/Animations/TimePropertyList4TimeBehavior.h \ + ../Records/Animations/TimePropertyList4TimeNodeContainer.h \ + ../Records/Animations/TimeRotationBehaviorAtom.h \ + ../Records/Animations/TimeRotationBehaviorContainer.h \ + ../Records/Animations/TimeScaleBehaviorAtom.h \ + ../Records/Animations/TimeScaleBehaviorContainer.h \ + ../Records/Animations/TimeSequenceDataAtom.h \ + ../Records/Animations/TimeSetBehaviorAtom.h \ + ../Records/Animations/TimeSetBehaviorContainer.h \ + ../Records/Animations/TimeStringListContainer.h \ + ../Records/Animations/TimeVariant.h \ + ../Records/Animations/TimeVariant4Behavior.h \ + ../Records/Animations/VisualPageAtom.h \ + ../Records/Animations/VisualShapeAtom.h \ + ../Records/Animations/VisualShapeChartElementAtom.h \ + ../Records/Animations/VisualShapeGeneralAtom.h \ + ../Records/Animations/VisualSoundAtom.h \ + ../Records/Animations/_includer.h \ + ../Records/BlipCollection9Container.h \ + ../Records/BlipEntityAtom.h \ + ../Records/BookmarkEntityAtom.h \ + ../Records/BookmarkSeedAtom.h \ + ../Records/BuildAtom.h \ + ../Records/DocInfoListContainer.h \ + ../Records/DocProgTagsContainer.h \ + ../Records/MouseInteractiveInfoContainer.h \ + ../Records/OfficeArtClientData.h \ + ../Records/OfficeArtClientTextbox.h \ + ../Records/PlaceHolderAtom.h \ + ../Records/RoundTrip.h \ + ../Records/ShapeProgBinaryTagSubContainerOrAtom.h \ + ../Records/CFMasks.h \ + ../Records/ColorSchemeAtom.h \ + ../Records/CString.h \ + ../Records/CurrentUserAtom.h \ + ../Records/DocRoutingSlipAtom.h \ + ../Records/DocumentAtom.h \ + ../Records/DocumentRecords.h \ + ../Records/DocumentTextInfo.h \ + ../Records/EndDocument.h \ + ../Records/ExCDAudioContainer.h \ + ../Records/ExControlAtom.h \ + ../Records/ExHyperlinkAtom.h \ + ../Records/ExMediaAtom.h \ + ../Records/ExMIDIAudioContainer.h \ + ../Records/ExObjListAtom.h \ + ../Records/ExObjListContainer.h \ + ../Records/ExObjRefAtom.h \ + ../Records/ExOleEmbedAtom.h \ + ../Records/ExOleLinkAtom.h \ + ../Records/ExOleObjAtom.h \ + ../Records/ExVideoContainer.h \ + ../Records/ExWAVAudioEmbeddedContainer.h \ + ../Records/ExWAVAudioLinkContainer.h \ + ../Records/FontEntityAtom.h \ + ../Records/GridSpacing10Atom.h \ + ../Records/GuideAtom.h \ + ../Records/HeadersFootersAtom.h \ + ../Records/InteractiveInfoAtom.h \ + ../Records/KinsokuAtom.h \ + ../Records/KinsokuContainer.h \ + ../Records/KinsokuFollowingAtom.h \ + ../Records/KinsokuLeadingAtom.h \ + ../Records/MasterPersistAtom.h \ + ../Records/MasterTextPropAtom.h \ + ../Records/MetafileBlob.h \ + ../Records/MouseTextInteractiveInfoAtom.h \ + ../Records/NamedShowSlidesAtom.h \ + ../Records/NormalViewSetInfoAtom.h \ + ../Records/NotesAtom.h \ + ../Records/NotesPersistAtom.h \ + ../Records/NoZoomViewInfoAtom.h \ + ../Records/OutlineTextRefAtom.h \ + ../Records/FontCollection10Container.h \ + ../Records/FontEmbedFlags10Atom.h \ + ../Records/OutlineTextProps9Container.h \ + ../Records/OutlineTextPropsHeaderExAtom.h \ + ../Records/PFMasks.h \ + ../Records/PersistDirectoryAtom.h \ + ../Records/PlaceHolderAtom.h \ + ../Records/ProgStringTagContainer.h \ + ../Records/RecordsIncluder.h \ + ../Records/ShapeFlags10Atom.h \ + ../Records/ShapeFlagsAtom.h \ + ../Records/Comment10Container.h \ + ../Records/LinkedShape10Atom.h \ + ../Records/LinkedSlide10Atom.h \ + ../Records/SlideFlags10Atom.h \ + ../Records/SlideProgTagsContainer.h \ + ../Records/SlideTime10Atom.h \ + ../Records/SlideAtom.h \ + ../Records/SlideColorSchemeAtom.h \ + ../Records/SlideContainer.h \ + ../Records/SlideListWithText.h \ + ../Records/SlidePersistAtom.h \ + ../Records/SlideProgTagsContainer.h \ + ../Records/SlideViewInfoAtom.h \ + ../Records/SoundCollAtom.h \ + ../Records/SoundCollectionContainer.h \ + ../Records/SoundContainer.h \ + ../Records/SoundDataBlob.h \ + ../Records/SSDocInfoAtom.h \ + ../Records/SSlideLayoutAtom.h \ + ../Records/SSSlideInfoAtom.h \ + ../Records/StyleTextPropAtom.h \ + ../Records/StyleTextProp10Atom.h \ + ../Records/StyleTextProp11Atom.h \ + ../Records/StyleTextProp9Atom.h \ + ../Records/TextCFException10.h \ + ../Records/TextCFException9.h \ + ../Records/TextDefaults9Atom.h \ + ../Records/TextMasterStyle9Atom.h \ + ../Records/TextMasterStyle9Level.h \ + ../Records/TextSIException.h \ + ../Records/TextBookmarkAtom.h \ + ../Records/TextBytesAtom.h \ + ../Records/TextCFExceptionAtom.h \ + ../Records/TextCharsAtom.h \ + ../Records/TextFullSettings.h \ + ../Records/TextHeaderAtom.h \ + ../Records/TextInteractiveInfoAtom.h \ + ../Records/TextMasterStyle9Atom.h \ + ../Records/TextMasterStyle9Level.h \ + ../Records/TextMasterStyleAtom.h \ + ../Records/TextPFException9.h \ + ../Records/TextPFExceptionAtom.h \ + ../Records/TextRulerAtom.h \ + ../Records/TextSIExceptionAtom.h \ + ../Records/TextSpecInfoAtom.h \ + ../Records/UserEditAtom.h \ + ../Records/VBAInfoAtom.h \ + ../Records/ViewInfoAtom.h \ + ../Records/ZoomViewInfoAtom.h \ + ../Records/Animations/AnimationTypes.h \ + ../Records/Drawing/BlipStoreContainer.h \ + ../Records/Drawing/BlipStoreEntry.h \ + ../Records/Drawing/ChildAnchor.h \ + ../Records/Drawing/ClientAnchor.h \ + ../Records/Drawing/DrawingContainer.h \ + ../Records/Drawing/DrawingGroup.h \ + ../Records/Drawing/DrawingRecord.h \ + ../Records/Drawing/GroupShape.h \ + ../Records/Drawing/GroupShapeContainer.h \ + ../Records/Drawing/RegGroupItems.h \ + ../Records/Drawing/Shape.h \ + ../Records/Drawing/ShapeContainer.h \ + ../Records/Drawing/ShapeProperties.h \ + ../Records/Drawing/TextBox.h \ + ../Records/Drawing/ArtBlip.h \ + ../PPTXWriter/Converter.h \ + ../PPTXWriter/ImageManager.h \ + ../PPTXWriter/ShapeWriter.h \ + ../PPTXWriter/StylesWriter.h \ + ../../../ASCOfficePPTXFile/Editor/Drawing/Element.h \ + ../../../ASCOfficePPTXFile/Editor/Drawing/Elements.h \ + ../../../ASCOfficePPTXFile/Editor/Drawing/Layout.h \ + ../../../ASCOfficePPTXFile/Editor/Drawing/Slide.h \ + ../../../ASCOfficePPTXFile/Editor/Drawing/TextAttributesEx.h \ + ../../../ASCOfficePPTXFile/Editor/Drawing/TextStructures.h \ + ../../../ASCOfficePPTXFile/Editor/Drawing/Theme.h \ + ../../../Common/3dParty/pole/pole.h \ + ../Structures/ColorIndex.h \ + ../Structures/ColorIndexStruct.h \ + ../Structures/ColorStruct.h \ + ../Structures/DateTimeStruct.h \ + ../Structures/IStruct.h \ + ../Structures/PointStruct.h \ + ../Structures/RatioStruct.h \ + ../Structures/RectStruct.h \ + ../Structures/ScalingStruct.h \ + ../Structures/SmallRectStruct.h \ + ../Structures/TmsfTimeStruct.h \ + ../Structures/WideColorStruct.h \ + ../Structures/_includer.h + +core_release { +SOURCES += \ + pptformatlib_logic.cpp +} + +core_debug { +SOURCES += \ + ../Enums/RecordType.cpp \ + ../PPTFormatLib.cpp \ + ../Reader/ReadStructures.cpp \ + ../Reader/RoundTripExtractor.cpp \ + ../Reader/PPTDocumentInfoOneUser.cpp \ + ../Reader/Records.cpp \ + ../Reader/PPTFileReader.cpp \ + ../Reader/SlidePersist.cpp \ + ../PPTXWriter/Converter.cpp \ + ../PPTXWriter/ShapeWriter.cpp \ + ../PPTXWriter/TableWriter.cpp \ + ../PPTXWriter/TxBodyConverter.cpp \ + ../Records/Drawing/ArtBlip.cpp \ + ../Records/Drawing/ShapeContainer.cpp \ + ../Records/Animations/TimeVariant.cpp \ + ../Records/BlipEntityAtom.cpp +} + +SOURCES += \ + ../../../ASCOfficePPTXFile/Editor/Drawing/Elements.cpp \ + ../../../ASCOfficePPTXFile/Editor/Drawing/TextAttributesEx.cpp \ + ../../../Common/3dParty/pole/pole.cpp \ + ../Converter/Animation/AnimationParser.cpp \ + ../Converter/Animation/Animation_1995.cpp \ + ../Converter/Animation/TimingUtils.cpp \ + ../Converter/Animation/Timing_1995.cpp \ + ../Converter/Animation/Timing_2010.cpp \ + ../Converter/Animation/hashcode10.cpp \ + ../Converter/Animation/intermediate_anim.cpp \ + ../Converter/timing.cpp \ + ../Converter/transition.cpp \ + ../PPTXWriter/BulletsConverter.cpp + diff --git a/MsBinaryFile/PptFile/Converter/Animation/AnimationParser.cpp b/MsBinaryFile/PptFile/Converter/Animation/AnimationParser.cpp new file mode 100644 index 0000000000..0d53022351 --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/Animation/AnimationParser.cpp @@ -0,0 +1,47 @@ +#include "AnimationParser.h" +#include "../../Records/Drawing/ShapeContainer.h" +#include "Timing_1995.h" + +namespace PPT { +namespace Intermediate { + + +CRecordPP10SlideBinaryTagExtension* getPP10SlideBinaryTagExtension(CRecordSlide *pSlide) +{ + CRecordSlideProgTagsContainer* progTag = pSlide->m_pSlideProgTagsContainer; + return progTag ? progTag->getPP10SlideBinaryTagExtension() : nullptr; +} + +std::vector getOldSlideAnimation(CRecordSlide *pSlide) +{ + std::vector arrShapeCont; + pSlide->GetRecordsByType(&arrShapeCont, true); + + std::vector listOfRawAnimIC; + for (auto* pShapeCont : arrShapeCont) + { + std::vector shape; + pShapeCont->GetRecordsByType(&shape, true); + std::vector anim; + pShapeCont->GetRecordsByType(&anim, true); + SOldAnimation animIC; + if (!anim.empty() && !shape.empty()) + { + animIC.shapeId = shape[0]->m_nID; + animIC.anim = anim[0]; + listOfRawAnimIC.push_back(animIC); + } + } + + return listOfRawAnimIC; +} +SlideAnimation ParseSlideAnimation(CRecordSlide *pSlide) +{ + SlideAnimation slideAnim; + slideAnim.arrAnim_1995 = getOldSlideAnimation(pSlide); + slideAnim.pAnim_2010 = getPP10SlideBinaryTagExtension(pSlide); + + return slideAnim; +} +} +} diff --git a/MsBinaryFile/PptFile/Converter/Animation/AnimationParser.h b/MsBinaryFile/PptFile/Converter/Animation/AnimationParser.h new file mode 100644 index 0000000000..efb490449b --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/Animation/AnimationParser.h @@ -0,0 +1,11 @@ +#pragma once + +#include "intermediate_anim.h" +#include "../../Records/SlideContainer.h" + + +namespace PPT { +namespace Intermediate { +SlideAnimation ParseSlideAnimation(CRecordSlide* pSlide); +} +} diff --git a/MsBinaryFile/PptFile/Converter/Animation/Animation_1995.cpp b/MsBinaryFile/PptFile/Converter/Animation/Animation_1995.cpp new file mode 100644 index 0000000000..dd4b332cb0 --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/Animation/Animation_1995.cpp @@ -0,0 +1,871 @@ +#include "Animation_1995.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/BldP.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Anim.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimClr.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimEffect.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimMotion.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimRot.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimScale.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimVariant.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Audio.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/CBhvr.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/ChildTnLst.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Cmd.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/CondLst.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Set.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Video.h" +#include "../../Records/Animations/AnimationInfoContainer.h" + +using namespace PPT::Converter; + +Animation_1995::Animation_1995(_INT32 &cTnId) : + cTnId(cTnId) +{} + +void Animation_1995::FillCTnAnimation(PPTX::Logic::CTn &oCTN, Intermediate::SOldAnimation *pOldAnim) +{ + oCTN.presetClass = L"entr"; + oCTN.grpId = 0; + oCTN.childTnLst = new PPTX::Logic::ChildTnLst; + oCTN.presetSubtype = 0; + int presetSub = -1; + + const UINT effect = pOldAnim->anim->m_AnimationAtom.m_AnimEffect; + const UINT direct = pOldAnim->anim->m_AnimationAtom.m_AnimEffectDirection; + + // Todo 4, 7. 0x11 - 0x1B + switch (effect) + { + case 0x00: + { + if (direct != 1) + { + oCTN.presetID = 1; + ConvertAppear(oCTN.childTnLst.get2(), pOldAnim); + } + else + { + oCTN.presetID = 10; + ConvertFade(oCTN.childTnLst.get2(), pOldAnim); + } + break; + } + case 0x01: + { + oCTN.presetID = 24; + ConvertRandomEffect(oCTN.childTnLst.get2(), pOldAnim); + break; + } + case 0x02: + { + oCTN.presetID = 3; + ConvertBlinds(oCTN.childTnLst.get2(), pOldAnim, presetSub); + break; + } + case 0x03: + { + oCTN.presetID = 5; + ConvertCheckerboard(oCTN.childTnLst.get2(), pOldAnim); + break; + } + case 0x05: + { + oCTN.presetID = 9; + ConvertDissolveIn(oCTN.childTnLst.get2(), pOldAnim); + break; + } + case 0x06: + { + oCTN.presetID = 10; + ConvertFade(oCTN.childTnLst.get2(), pOldAnim); + break; + } + case 0x08: + { + oCTN.presetID = 14; + ConvertRandomBars(oCTN.childTnLst.get2(), pOldAnim, presetSub); + break; + } + case 0x09: + { + oCTN.presetID = 18; + ConvertStrips(oCTN.childTnLst.get2(), pOldAnim, presetSub); + break; + } + case 0x0A: + { + oCTN.presetID = 22; + ConvertWipe(oCTN.childTnLst.get2(), pOldAnim, presetSub); + break; + } + case 0x0B: + { + oCTN.presetID = 4; + ConvertShape(oCTN.childTnLst.get2(), pOldAnim, presetSub); + break; + } + case 0x0C: + { + if (direct >= 0 && direct <= 7) + { + oCTN.presetID = 2; + ConvertFlyIn(oCTN.childTnLst.get2(), pOldAnim, presetSub); + } else if (direct >= 8 && direct <= 11) + { + oCTN.presetID = 12; + ConvertPeekIn(oCTN.childTnLst.get2(), pOldAnim, presetSub); + } else if (direct >= 12 && direct <= 15) + { + oCTN.presetID = 7; + ConvertCrawlIn(oCTN.childTnLst.get2(), pOldAnim, presetSub); + } else if (direct >= 16 && direct <= 21) + { + oCTN.presetID = 23; + ConvertBasicZoom(oCTN.childTnLst.get2(), pOldAnim, presetSub); + } else if (direct >= 22 && direct <= 26) + { + oCTN.presetID = 17; + ConvertStretch(oCTN.childTnLst.get2(), pOldAnim, presetSub); + } else if (direct == 27) + { + oCTN.presetID = 19; + ConvertBasicSwivel(oCTN.childTnLst.get2(), pOldAnim, presetSub); + } else if (direct == 28) + { + oCTN.presetID = 15; + ConvertSpiralIn(oCTN.childTnLst.get2(), pOldAnim); + } + break; + } + case 0x0D: + { + oCTN.presetID = 16; + ConvertSplit(oCTN.childTnLst.get2(), pOldAnim, presetSub); + break; + } + case 0x0E: + { + oCTN.presetID = 11; + ConvertFlashOnce(oCTN.childTnLst.get2(), pOldAnim, presetSub); + break; + } + default: + oCTN.presetID = 1; + ConvertAppear(oCTN.childTnLst.get2(), pOldAnim); + std::wcout << "Error: Unknown old animation id: " << std::to_wstring(effect) << L"\n"; + + } + + if (presetSub != -1) + { + oCTN.presetSubtype = presetSub; + } +} + + + +void Animation_1995::FillCBhvrForAnim (PPTX::Logic::Anim& oAnim, Intermediate::SOldAnimation* pOldAnim, int dur, std::wstring attrname) +{ + FillCBhvr(oAnim.cBhvr, dur, pOldAnim->shapeId, attrname, -1); + + oAnim.cBhvr.additive = new PPTX::Limit::TLAdditive; + oAnim.cBhvr.additive->set(L"base"); + + oAnim.calcmode = new PPTX::Limit::TLCalcMode; + oAnim.calcmode->set(L"lin"); + oAnim.valueType = new PPTX::Limit::TLValueType; + oAnim.valueType->set(L"num"); +} + +void Animation_1995::FillCBhvr(PPTX::Logic::CBhvr &oBhvr, int dur, UINT spid, std::wstring attrname, int delay) +{ + oBhvr.cTn.id = cTnId++; + oBhvr.cTn.fill = L"hold"; + oBhvr.cTn.dur = std::to_wstring(dur); + if (delay > -1) + { + oBhvr.cTn.stCondLst = new PPTX::Logic::CondLst; + oBhvr.cTn.stCondLst->node_name = L"stCondLst"; + PPTX::Logic::Cond cond; + cond.delay = std::to_wstring(delay); + oBhvr.cTn.stCondLst->list.push_back(cond); + } + + oBhvr.tgtEl.spTgt = new PPTX::Logic::SpTgt; + oBhvr.tgtEl.spTgt->spid = std::to_wstring(spid); + + if (!attrname.empty()) + { + oBhvr.attrNameLst = new PPTX::Logic::AttrNameLst; + PPTX::Logic::AttrName attrName; + attrName.text = attrname; + oBhvr.attrNameLst->list.push_back(attrName); + } +} + +void Animation_1995::FillCBhvr(PPTX::Logic::CBhvr &oCBhvr, Intermediate::SOldAnimation *pOldAnim, int delay) +{ + FillCBhvr(oCBhvr, 1, pOldAnim->shapeId, L"style.visibility", delay); +} + +void Animation_1995::FillAnim (PPTX::Logic::Anim& oAnim, Intermediate::SOldAnimation* pOldAnim, int dur, std::wstring attrname, + Intermediate::SValue val1, Intermediate::SValue val2, std::wstring fmla) +{ + FillCBhvrForAnim(oAnim, pOldAnim, dur, attrname); + + oAnim.tavLst = new PPTX::Logic::TavLst; + PPTX::Logic::Tav tav; + + tav.tm = L"0"; + if (fmla.size()) + { + tav.fmla = fmla; + } + auto val = new PPTX::Logic::AnimVariant; + val->node_name = L"val"; + if (val1.type == Intermediate::SValue::str) + val->strVal = val1.strVal; + else if (val1.type == Intermediate::SValue::dbl) + val->fltVal = val1.dblVal; + + tav.val = val; + oAnim.tavLst->list.push_back(tav); + tav.fmla.reset(); + + tav.tm = L"100000"; + val = new PPTX::Logic::AnimVariant; + val->node_name = L"val"; + if (val2.type == Intermediate::SValue::str) + val->strVal = val2.strVal; + else if (val2.type == Intermediate::SValue::dbl) + val->fltVal = val2.dblVal; + + tav.val = val; + oAnim.tavLst->list.push_back(tav); + +} + +void Animation_1995::FillAnimEffect (PPTX::Logic::AnimEffect& oAnimEffect, Intermediate::SOldAnimation* pOldAnim, std::wstring filter, std::wstring transition) +{ + oAnimEffect.transition = new PPTX::Limit::TLTransition(); + oAnimEffect.transition->set(transition); + oAnimEffect.filter = filter; + + oAnimEffect.cBhvr.cTn.id = cTnId++; + oAnimEffect.cBhvr.cTn.dur = std::to_wstring(pOldAnim->getAnimDur()); + oAnimEffect.cBhvr.tgtEl.spTgt = new PPTX::Logic::SpTgt; + oAnimEffect.cBhvr.tgtEl.spTgt->spid = std::to_wstring(pOldAnim->shapeId); +} + +// This methods fill ChildTnLst with anim nodes +void Animation_1995::ConvertAppear(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim) +{ + PushSet(oParent, pOldAnim, 0); +} + +void Animation_1995::ConvertFlyIn(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim, int& presetSub) +{ + PushSet(oParent, pOldAnim); + + switch (pOldAnim->anim->m_AnimationAtom.m_AnimEffectDirection) + { + case 0: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_x", L"0-#ppt_w/2", L"#ppt_x", + L"ppt_y", L"#ppt_y", L"#ppt_y"); + + presetSub = 8; + break; + } + case 1: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_x", L"#ppt_x", L"#ppt_x", + L"ppt_y", L"0-#ppt_h/2", L"#ppt_y"); + + presetSub = 1; + break; + } + case 2: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_x", L"1+#ppt_w/2", L"#ppt_x", + L"ppt_y", L"#ppt_y", L"#ppt_y"); + + presetSub = 2; + break; + } + case 3: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_x", L"#ppt_x", L"#ppt_x", + L"ppt_y", L"1+#ppt_h/2", L"#ppt_y"); + + presetSub = 4; + break; + } + case 4: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_x", L"0-#ppt_w/2", L"#ppt_x", + L"ppt_y", L"0-#ppt_h/2", L"#ppt_y"); + + presetSub = 9; + break; + } + case 5: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_x", L"1+#ppt_w/2", L"#ppt_x", + L"ppt_y", L"0-#ppt_h/2", L"#ppt_y"); + + presetSub = 3; + break; + } + case 6: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_x", L"0-#ppt_w/2", L"#ppt_x", + L"ppt_y", L"1+#ppt_h/2", L"#ppt_y"); + + presetSub = 12; + break; + } + case 7: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_x", L"1+#ppt_w/2", L"#ppt_x", + L"ppt_y", L"1+#ppt_h/2", L"#ppt_y"); + + presetSub = 6; + break; + } + } +} + +void Animation_1995::ConvertBlinds(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim, int &presetSub) +{ + PushSet(oParent, pOldAnim); + + switch (pOldAnim->anim->m_AnimationAtom.m_AnimEffectDirection) + { + case 0: + { + PushAnimEffect(oParent, pOldAnim, L"blinds(vertical)", L"in"); + + presetSub = 5; + break; + } + case 1: + { + PushAnimEffect(oParent, pOldAnim, L"blinds(horizontal)", L"in"); + + presetSub = 10; + break; + } + } +} + +void Animation_1995::ConvertShape(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim, int& presetSub) +{ + PushSet(oParent, pOldAnim); + + switch (pOldAnim->anim->m_AnimationAtom.m_AnimEffectDirection) + { + case 0: + { + PushAnimEffect(oParent, pOldAnim, L"box(out)", L"in"); + + presetSub = 32; + break; + } + case 1: + { + PushAnimEffect(oParent, pOldAnim, L"box(in)", L"in"); + + presetSub = 16; + break; + } + } +} + +void Animation_1995::ConvertCheckerboard(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim) +{ + PushSet(oParent, pOldAnim); + PushAnimEffect(oParent, pOldAnim, L"checkerboard(across)", L"in"); +} + +void Animation_1995::ConvertCrawlIn(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim, int& presetSub) +{ + PushSet(oParent, pOldAnim); + + switch (pOldAnim->anim->m_AnimationAtom.m_AnimEffectDirection) + { + case 15: + { + PushAnim(oParent, pOldAnim, 5000, + L"ppt_x", L"#ppt_x", L"#ppt_x", + L"ppt_y", L"1+#ppt_h/2", L"#ppt_y"); + + presetSub = 4; + break; + } + case 12: + { + PushAnim(oParent, pOldAnim, 5000, + L"ppt_x", L"0-#ppt_w/2", L"#ppt_x", + L"ppt_y", L"#ppt_y", L"#ppt_y"); + + presetSub = 8; + break; + } + case 14: + { + PushAnim(oParent, pOldAnim, 5000, + L"ppt_x", L"1+#ppt_w/2", L"#ppt_x", + L"ppt_y", L"#ppt_y", L"#ppt_y"); + + presetSub = 2; + break; + } + case 13: + { + PushAnim(oParent, pOldAnim, 5000, + L"ppt_x", L"#ppt_x", L"#ppt_x", + L"ppt_y", L"0-#ppt_h/2", L"#ppt_y"); + + presetSub = 1; + break; + } + } +} + +void Animation_1995::ConvertDissolveIn(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim) +{ + PushSet(oParent, pOldAnim); + PushAnimEffect(oParent, pOldAnim, L"dissolve", L"in"); +} + +void Animation_1995::ConvertFade(PPTX::Logic::ChildTnLst &oParent, Intermediate::SOldAnimation *pOldAnim) +{ + PushSet(oParent, pOldAnim); + PushAnimEffect(oParent, pOldAnim, L"fade", L"in"); +} + +void Animation_1995::ConvertFlashOnce(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim, int& presetSub) +{ + PushSet(oParent, pOldAnim); + presetSub = 0; + + // correct cTn params + auto set = dynamic_cast(oParent.list.front().m_node.GetPointer()); + if (!set) return; + set->cBhvr.cTn.dur = std::to_wstring(pOldAnim->getAnimDur()); + set->cBhvr.cTn.fill.reset(); +} + +void Animation_1995::ConvertPeekIn(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim, int& presetSub) +{ + PushSet(oParent, pOldAnim); + + switch (pOldAnim->anim->m_AnimationAtom.m_AnimEffectDirection) + { + case 8: + { + PushAnim(oParent, pOldAnim, L"ppt_x", L"#ppt_x-#ppt_w*1.125000", L"#ppt_x"); + PushAnimEffect(oParent, pOldAnim, L"wipe(right)", L"in"); + + presetSub = 8; + break; + } + case 9: + { + PushAnim(oParent, pOldAnim, L"ppt_y", L"#ppt_y+#ppt_h*1.125000", L"#ppt_y"); + PushAnimEffect(oParent, pOldAnim, L"wipe(up)", L"in"); + + presetSub = 4; + break; + } + case 10: + { + PushAnim(oParent, pOldAnim, L"ppt_x", L"#ppt_x+#ppt_w*1.125000", L"#ppt_x"); + PushAnimEffect(oParent, pOldAnim, L"wipe(left)", L"in"); + + presetSub = 2; + break; + } + case 11: + { + PushAnim(oParent, pOldAnim, L"ppt_y", L"#ppt_y-#ppt_h*1.125000", L"#ppt_y"); + PushAnimEffect(oParent, pOldAnim, L"wipe(down)", L"in"); + + presetSub = 1; + break; + } + } +} + +void Animation_1995::ConvertRandomBars(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim, int& presetSub) +{ + PushSet(oParent, pOldAnim); + + switch (pOldAnim->anim->m_AnimationAtom.m_AnimEffectDirection) + { + case 0: + { + PushAnimEffect(oParent, pOldAnim, L"randombar(horizontal)", L"in"); + + presetSub = 10; + break; + } + case 1: + { + PushAnimEffect(oParent, pOldAnim, L"randombar(vertical)", L"in"); + + presetSub = 5; + break; + } + } +} + +void Animation_1995::ConvertSpiralIn(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim) +{ + PushSet(oParent, pOldAnim); + // TODO + PushAnim(oParent, pOldAnim, 1000, + L"ppt_w", double(0), L"#ppt_w", + L"ppt_h", double(0), L"#ppt_h"); + PushAnim(oParent, pOldAnim, 1000, + L"ppt_x", double(0), double(1), + L"ppt_y", double(0), double(1), + L"#ppt_x+(cos(-2*pi*(1-$))*-#ppt_x-sin(-2*pi*(1-$))*(1-#ppt_y))*(1-$)", + L"#ppt_y+(sin(-2*pi*(1-$))*-#ppt_x+cos(-2*pi*(1-$))*(1-#ppt_y))*(1-$)"); + + // remove additive from + for (auto& child : oParent.list) + { + auto anim = dynamic_cast(child.m_node.GetPointer()); + if (!anim) continue; + anim->cBhvr.additive.reset(); + } + +} + +void Animation_1995::ConvertSplit(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub) +{ + PushSet(oParent, pOldAnim); + + switch (pOldAnim->anim->m_AnimationAtom.m_AnimEffectDirection) + { + case 0: + { + PushAnimEffect(oParent, pOldAnim, L"barn(outHorizontal)", L"in"); + + presetSub = 42; + break; + } + case 1: + { + PushAnimEffect(oParent, pOldAnim, L"barn(inHorizontal)", L"in"); + + presetSub = 26; + break; + } + case 2: + { + PushAnimEffect(oParent, pOldAnim, L"barn(outVertical)", L"in"); + + presetSub = 37; + break; + } + case 3: + { + PushAnimEffect(oParent, pOldAnim, L"barn(inVertical)", L"in"); + + presetSub = 21; + break; + } + } +} + +void Animation_1995::ConvertStretch(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub) +{ + PushSet(oParent, pOldAnim); + + switch (pOldAnim->anim->m_AnimationAtom.m_AnimEffectDirection) + { + case 22: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_w", double(0), L"#ppt_w", + L"ppt_h", L"#ppt_h", L"#ppt_h"); + + presetSub = 10; + break; + } + case 26: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_x", L"#ppt_x", L"#ppt_x", + L"ppt_y", L"#ppt_y+#ppt_h/2", L"#ppt_y"); + PushAnim(oParent, pOldAnim, 500, + L"ppt_w", L"#ppt_w", L"#ppt_w", + L"ppt_h", double(0), L"#ppt_h"); + + presetSub = 4; + break; + } + case 23: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_x", L"##ppt_x-#ppt_w/2", L"#ppt_x", + L"ppt_y", L"#ppt_y", L"#ppt_y"); + PushAnim(oParent, pOldAnim, 500, + L"ppt_w", double(0), L"#ppt_w", + L"ppt_h", L"#ppt_h", L"#ppt_h"); + + presetSub = 8; + break; + } + case 25: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_x", L"#ppt_x-#ppt_w/2", L"#ppt_x", + L"ppt_y", L"#ppt_y", L"#ppt_y"); + PushAnim(oParent, pOldAnim, 500, + L"ppt_w", double(0), L"#ppt_w", + L"ppt_h", L"#ppt_h", L"#ppt_h"); + + presetSub = 2; + break; + } + case 24: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_x", L"#ppt_x+#ppt_w/2", L"#ppt_x", + L"ppt_y", L"#ppt_y", L"#ppt_y"); + PushAnim(oParent, pOldAnim, 500, + L"ppt_w", double(0), L"#ppt_w", + L"ppt_h", L"#ppt_h", L"#ppt_h"); + + presetSub = 1; + break; + } + } +} + +void Animation_1995::ConvertStrips(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub) +{ + PushSet(oParent, pOldAnim); + + switch (pOldAnim->anim->m_AnimationAtom.m_AnimEffectDirection) + { + case 6: + { + PushAnimEffect(oParent, pOldAnim, L"strips(downLeft)", L"in"); + + presetSub = 12; + break; + } + case 4: + { + PushAnimEffect(oParent, pOldAnim, L"strips(upLeft)", L"in"); + + presetSub = 9; + break; + } + case 7: + { + PushAnimEffect(oParent, pOldAnim, L"strips(downRight)", L"in"); + + presetSub = 6; + break; + } + case 5: + { + PushAnimEffect(oParent, pOldAnim, L"strips(upRight)", L"in"); + + presetSub = 3; + break; + } + } +} + +void Animation_1995::ConvertBasicSwivel(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub) +{ + PushSet(oParent, pOldAnim); + presetSub = 10; + + PushAnim(oParent, pOldAnim, 5000, + L"ppt_w", double(0), double(1), + L"ppt_h", L"#ppt_h", L"#ppt_h", + L"#ppt_w*sin(2.5*pi*$)"); +} + +void Animation_1995::ConvertWipe(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub) +{ + PushSet(oParent, pOldAnim); + + switch (pOldAnim->anim->m_AnimationAtom.m_AnimEffectDirection) + { + case 3: + { + PushAnimEffect(oParent, pOldAnim, L"wipe(up)", L"in"); + + presetSub = 1; + break; + } + case 0: + { + PushAnimEffect(oParent, pOldAnim, L"wipe(left)", L"in"); + + presetSub = 2; + break; + } + case 2: + { + PushAnimEffect(oParent, pOldAnim, L"wipe(right)", L"in"); + + presetSub = 8; + break; + } + case 1: + { + PushAnimEffect(oParent, pOldAnim, L"wipe(down)", L"in"); + + presetSub = 4; + break; + } + } +} + +void Animation_1995::ConvertBasicZoom(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub) +{ + PushSet(oParent, pOldAnim); + + switch (pOldAnim->anim->m_AnimationAtom.m_AnimEffectDirection) + { + case 16: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_w", double(0), L"#ppt_w", + L"ppt_h", double(0), L"#ppt_h"); + + presetSub = 16; + break; + } + case 20: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_w", double(0), L"#ppt_w", + L"ppt_h", double(0), L"#ppt_h"); + PushAnim(oParent, pOldAnim, 500, + L"ppt_x", double(0.5), L"#ppt_x", + L"ppt_y", double(0.5), L"#ppt_y"); + + presetSub = 528; + break; + } + case 17: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_w", L"2/3*#ppt_w", L"#ppt_w", + L"ppt_h", L"2/3*#ppt_h", L"#ppt_h"); + + presetSub = 272; + break; + } + case 18: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_w", L"#ppt_w", L"#ppt_w", + L"ppt_h", L"4*#ppt_h", L"#ppt_h"); + + presetSub = 32; + break; + } + case 21: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_w", L"(6*min(max(#ppt_w*#ppt_h,.3),1)-7.4)/-.7*#ppt_w", L"#ppt_w", + L"ppt_h", L"(6*min(max(#ppt_w*#ppt_h,.3),1)-7.4)/-.7*#ppt_h", L"#ppt_h"); + PushAnim(oParent, pOldAnim, 500, + L"ppt_x", double(0.5), L"#ppt_x", + L"ppt_y", L"1+(6*min(max(#ppt_w*#ppt_h,.3),1)-7.4)/-.7*#ppt_h/2", L"#ppt_y"); + + presetSub = 36; + break; + } + case 19: + { + PushAnim(oParent, pOldAnim, 500, + L"ppt_w", L"4/3*#ppt_w", L"#ppt_w", + L"ppt_h", L"4/3*#ppt_h", L"#ppt_h"); + + presetSub = 288; + break; + } + } +} + +void Animation_1995::ConvertRandomEffect(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim) +{ + PushSet(oParent, pOldAnim, 0); + + PPTX::Logic::TimeNodeBase childTimeNode; + + auto anim = new PPTX::Logic::Anim; + anim->to = L""; + anim->calcmode = new PPTX::Limit::TLCalcMode; + anim->calcmode->set(L"lin"); + anim->valueType = new PPTX::Limit::TLValueType; + anim->valueType->set(L"num"); + + FillCBhvr(anim->cBhvr, 1, pOldAnim->shapeId, L"", -1); + childTimeNode.m_node = anim; + oParent.list.push_back(childTimeNode); +} + +void Animation_1995::PushAnim(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim, int dur, + std::wstring attrname1, Intermediate::SValue val1, Intermediate::SValue val2, + std::wstring attrname2, Intermediate::SValue val3, Intermediate::SValue val4, std::wstring fmla1, std::wstring fmla2) +{ + PushAnim(oParent, pOldAnim, attrname1, val1, val2, fmla1); + PushAnim(oParent, pOldAnim, attrname2, val3, val4, fmla2); +} + +void Animation_1995::PushAnim(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim, + std::wstring attrname1, Intermediate::SValue val1, Intermediate::SValue val2,std::wstring fmla1) +{ + PPTX::Logic::TimeNodeBase childTimeNode; + + auto anim = new PPTX::Logic::Anim; + FillAnim(*anim, pOldAnim, pOldAnim->getAnimDur(), attrname1, val1, val2, fmla1); + childTimeNode.m_node = anim; + oParent.list.push_back(childTimeNode); +} + +void Animation_1995::PushAnimEffect(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim, std::wstring filter, std::wstring transition) +{ + PPTX::Logic::TimeNodeBase childTimeNode; + + auto animEffect = new PPTX::Logic::AnimEffect; + FillAnimEffect(*animEffect, pOldAnim, filter, transition); + childTimeNode.m_node = animEffect; + oParent.list.push_back(childTimeNode); +} + +void Animation_1995::PushSet(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim, int dur) +{ + PPTX::Logic::TimeNodeBase childTimeNode; + auto set = new PPTX::Logic::Set; + + FillCBhvr(set->cBhvr, pOldAnim, dur); + set->to = new PPTX::Logic::AnimVariant; + set->to->node_name = L"to"; + set->to->strVal = L"visible"; + + childTimeNode.m_node = set; + oParent.list.push_back(childTimeNode); +} diff --git a/MsBinaryFile/PptFile/Converter/Animation/Animation_1995.h b/MsBinaryFile/PptFile/Converter/Animation/Animation_1995.h new file mode 100644 index 0000000000..b2d3d1e870 --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/Animation/Animation_1995.h @@ -0,0 +1,61 @@ +#pragma once + +#include "intermediate_anim.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/ChildTnLst.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Anim.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimEffect.h" + + +namespace PPT { +namespace Converter { +class Animation_1995 +{ +public: + Animation_1995(_INT32& cTnId); + void FillCTnAnimation(PPTX::Logic::CTn &oCTN, Intermediate::SOldAnimation *pOldAnim); + +private: + void FillAnim (PPTX::Logic::Anim& oAnim, Intermediate::SOldAnimation* pOldAnim, int dur, std::wstring attrname, + Intermediate::SValue val1, Intermediate::SValue val2, std::wstring fmla = L""); + void FillAnimEffect (PPTX::Logic::AnimEffect& oAnimEffect, Intermediate::SOldAnimation* pOldAnim, std::wstring filter, std::wstring transition = L"in"); + + void FillCBhvrForAnim (PPTX::Logic::Anim& oAnim, Intermediate::SOldAnimation* pOldAnim, int dur, std::wstring attrname); + void FillCBhvr(PPTX::Logic::CBhvr &oBhvr, int dur, UINT spid, std::wstring attrname, int delay=499); + void FillCBhvr(PPTX::Logic::CBhvr &oCBhvr, Intermediate::SOldAnimation* pOldAnim, int delay = 499); + + // This methods fill ChildTnLst with anim nodes + void ConvertAppear(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim); + void ConvertFlyIn(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub); + void ConvertBlinds(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub); + void ConvertShape(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub); + void ConvertCheckerboard(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim); + void ConvertCrawlIn(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub); + void ConvertDissolveIn(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim); + void ConvertFade(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim); + void ConvertFlashOnce(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub); + void ConvertPeekIn(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub); + void ConvertRandomBars(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub); + void ConvertSpiralIn(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim); + void ConvertSplit(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub); + void ConvertStretch(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub); + void ConvertStrips(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub); + void ConvertBasicSwivel(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub); + void ConvertWipe(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub); + void ConvertBasicZoom(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim, int& presetSub); + void ConvertRandomEffect(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation* pOldAnim); + + void PushAnim(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim, int dur, + std::wstring attrname1, Intermediate::SValue val1, Intermediate::SValue val2, + std::wstring attrname2, Intermediate::SValue val3, Intermediate::SValue val4, + std::wstring fmla1 = L"", std::wstring fmla2 = L""); + void PushAnim(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim, + std::wstring attrname1, Intermediate::SValue val1, Intermediate::SValue val2,std::wstring fmla1 = L""); + + void PushAnimEffect(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim, std::wstring filter, std::wstring transition = L"in"); + void PushSet(PPTX::Logic::ChildTnLst& oParent, Intermediate::SOldAnimation *pOldAnim, int dur = 0); + +private: + _INT32 & cTnId; +}; +} +} diff --git a/MsBinaryFile/PptFile/Converter/Animation/TimingExeption.h b/MsBinaryFile/PptFile/Converter/Animation/TimingExeption.h new file mode 100644 index 0000000000..c53e4c36b3 --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/Animation/TimingExeption.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include + +namespace PPT { +namespace Converter { +class TimingExeption : virtual public std::exception +{ +public: + TimingExeption() {} + TimingExeption(std::string message) : errorMessage(message) {} + TimingExeption(std::string message, std::exception& ex) : std::exception(ex), errorMessage(message) {} + TimingExeption(std::wstring message) : werrorMessage(message) {} + TimingExeption(std::wstring message, std::exception& ex) : std::exception(ex), werrorMessage(message) {} + + virtual ~TimingExeption() throw () {} + + virtual const char* what() const throw () { + return errorMessage.c_str(); + } + virtual const wchar_t* what_w() const throw () { + return werrorMessage.c_str(); + } + +protected: + std::string errorMessage; + std::wstring werrorMessage; +}; +} +} diff --git a/MsBinaryFile/PptFile/Converter/Animation/TimingUtils.cpp b/MsBinaryFile/PptFile/Converter/Animation/TimingUtils.cpp new file mode 100644 index 0000000000..7d70219c32 --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/Animation/TimingUtils.cpp @@ -0,0 +1,90 @@ +#include "TimingUtils.h" +#include "../../Reader/ExtXmlUtils.hpp" +#include "../../Enums/enums.h" + + +PPT::Intermediate::ShapeAnim PPT::Intermediate::ParseExisting5Level_CTn(const PPTX::Logic::CTn &oCTn) +{ + ShapeAnim spAn; + spAn.presetID = oCTn.presetID.get_value_or(-1); + std::wstring xml = oCTn.toXML(); + auto arrSpids = XmlUtils::FindAttrValuesInt(xml, L"spid"); + if (arrSpids.size()) + spAn.spid = arrSpids[0]; + + return spAn; +} + +PPT::Intermediate::ShapeAnim PPT::Intermediate::ParseExisting5Level_ETNC(const CRecordExtTimeNodeContainer *pETNC) +{ + if (pETNC == nullptr) + return {}; + + ShapeAnim spAn; + for (const auto& child : pETNC->m_arrRgExtTimeNodeChildren) + { + auto foundSpid = GetSpID(child); + if (foundSpid != -1) + { + spAn.spid = foundSpid; + break; + } + } + + if (pETNC->m_haveTimePropertyList && pETNC->m_pTimePropertyList != nullptr) + { + for (const auto prop : pETNC->m_pTimePropertyList->m_arrElements) + { + if (prop->m_oHeader.RecInstance == TL_TPID_EffectID) + { + spAn.presetID = dynamic_cast(prop)->m_Value; + break; + } + } + } + return spAn; +} + +bool PPT::Intermediate::operator==(const ShapeAnim &s1, const ShapeAnim &s2) +{ + if (s1.IsValid() == false) + return false; + + return s1.spid == s2.spid && (s1.presetID == s2.presetID || s1.presetID == 1 || s2.presetID == 1); /// 1 - Appear +} + +CRecordTimeBehaviorContainer* PPT::Intermediate::GetTimeBehaviorContainer(CRecordExtTimeNodeContainer *pETNC) +{ + CRecordTimeBehaviorContainer *pBhvr = nullptr; + if (pETNC->m_haveSetBehavior) + pBhvr = &(pETNC->m_pTimeSetBehavior->m_oBehavior); + else if (pETNC->m_haveEffectBehavior) + pBhvr = &(pETNC->m_pTimeEffectBehavior->m_oBehavior); + else if (pETNC->m_haveAnimateBehavior) + pBhvr = &(pETNC->m_pTimeAnimateBehavior->m_oBehavior); + else if (pETNC->m_haveColorBehavior) + pBhvr = &(pETNC->m_pTimeColorBehavior->m_oBehavior); + else if (pETNC->m_haveMotionBehavior) + pBhvr = &(pETNC->m_pTimeMotionBehavior->m_oTimeBehavior); + else if (pETNC->m_haveRotationBehavior) + pBhvr = &(pETNC->m_pTimeRotationBehavior->m_oBehavior); + else if (pETNC->m_haveScaleBehavior) + pBhvr = &(pETNC->m_pTimeScaleBehavior->m_oBehavior); + else + pBhvr = &(pETNC->m_pTimeCommandBehavior->m_oBevavior); + + return pBhvr; +} + +_INT32 PPT::Intermediate::GetSpID(CRecordExtTimeNodeContainer *pETNC) +{ + auto pBhvr = GetTimeBehaviorContainer(pETNC); + if (pBhvr == nullptr) + return -1; + + if (pBhvr->m_oClientVisualElement.m_bVisualShapeAtom && + pBhvr->m_oClientVisualElement.m_oVisualShapeAtom.m_RefType == TL_ET_ShapeType) + return pBhvr->m_oClientVisualElement.m_oVisualShapeAtom.m_nObjectIdRef; + + return -1; +} diff --git a/MsBinaryFile/PptFile/Converter/Animation/TimingUtils.h b/MsBinaryFile/PptFile/Converter/Animation/TimingUtils.h new file mode 100644 index 0000000000..590b69f505 --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/Animation/TimingUtils.h @@ -0,0 +1,33 @@ +#pragma once + +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/CTn.h" +#include "../../Records/Animations/ExtTimeNodeContainer.h" + +namespace PPT { +namespace Intermediate { +struct ShapeAnim +{ + _INT32 spid = -1; + _INT32 presetID = -1; // where 1 is any animation or simpless: appear + + inline bool IsValid()const + {return spid > 0 && presetID > 0;} +}; + +bool operator==(const ShapeAnim &s1, const ShapeAnim &s2); + +// look at enum TimeNodeLevel +ShapeAnim ParseExisting3Level_CTn(const PPTX::Logic::CTn &oCTn); +ShapeAnim ParseExisting3Level_ETNC(const CRecordExtTimeNodeContainer *pETNC); + +ShapeAnim ParseExisting4Level_CTn(const PPTX::Logic::CTn &oCTn); +ShapeAnim ParseExisting4Level_ETNC(const CRecordExtTimeNodeContainer *pETNC); + +ShapeAnim ParseExisting5Level_CTn(const PPTX::Logic::CTn &oCTn); +ShapeAnim ParseExisting5Level_ETNC(const CRecordExtTimeNodeContainer *pETNC); + +CRecordTimeBehaviorContainer* GetTimeBehaviorContainer(CRecordExtTimeNodeContainer *pETNC); +_INT32 GetSpID(CRecordExtTimeNodeContainer *pETNC); + +} +} diff --git a/MsBinaryFile/PptFile/Converter/Animation/Timing_1995.cpp b/MsBinaryFile/PptFile/Converter/Animation/Timing_1995.cpp new file mode 100644 index 0000000000..ef2b3a9f29 --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/Animation/Timing_1995.cpp @@ -0,0 +1,312 @@ +#include "Timing_1995.h" +#include "Animation_1995.h" +#include "../../Records/Animations/BuildListContainer.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/BldLst.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/BldP.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/BldOleChart.h" +#include "../../Records/Animations/BuildListContainer.h" +#include + + +namespace PPT { +namespace Converter { + +Timing_1995::Timing_1995(const std::vector &vecAIC) : + arrOldAnim(vecAIC), + animConverter(new Animation_1995(cTnId)) +{} + +void Timing_1995::Convert(PPTX::Logic::Timing& timimg, CExMedia* pExMedia, CRelsGenerator* pRels) +{ + if (InitAndCheckVars(timimg, pExMedia, pRels) == false) + return; + ConvertBldLst(); + ConvertTnLst(); +} + +Timing_1995::~Timing_1995() +{ + delete animConverter; +} + +bool Timing_1995::InitAndCheckVars(PPTX::Logic::Timing &timimg, CExMedia *pExMedia, CRelsGenerator *pRels) +{ + this->pExMedia = pExMedia; + this->pRels = pRels; + this->pTiming = &timimg; + + return pExMedia && pRels && pTiming && !arrOldAnim.empty(); +} + +void Timing_1995::ConvertBldLst() +{ + pTiming->bldLst = new PPTX::Logic::BldLst(); + for (auto oldAnim : arrOldAnim) + { + PPTX::Logic::BuildNodeBase oBuildNodeBase; + PPTX::Logic::BldP *pBldP = new PPTX::Logic::BldP(); + pBldP->spid = std::to_wstring(oldAnim.shapeId); + pBldP->grpId = false; + pBldP->animBg = (bool)(oldAnim.anim->m_AnimationAtom.m_fAnimateBg != 0); + + oBuildNodeBase.m_node = pBldP; + pTiming->bldLst->list.push_back(oBuildNodeBase); + } +} + +void Timing_1995::ConvertTnLst() +{ + pTiming->tnLst = new PPTX::Logic::TnLst(); + auto clickGroupsAnim = SplitRawAnim(); + auto mainSeq = ConvertMainSeqAnimation(clickGroupsAnim); + InsertMainSeqToTnLst(mainSeq); +} + +LstLstAnim Timing_1995::SplitRawAnim() +{ + SortAnim(); + + LstLstAnim splitedAnim; + + for (auto& oldAnim : arrOldAnim) + { + if (splitedAnim.empty()) + { + std::list clickPar; + clickPar.push_back(&oldAnim); + splitedAnim.push_back(clickPar); + } else if (oldAnim.anim->m_AnimationAtom.m_fAutomatic) + { + splitedAnim.back().push_back(&oldAnim); + } else + { + std::list clickPar; + clickPar.push_back(&oldAnim); + splitedAnim.push_back(clickPar); + } + } + + return splitedAnim; +} + +PPTX::Logic::Seq *Timing_1995::ConvertMainSeqAnimation(LstLstAnim &splitedAnim) +{ + auto seq2 = InitMainSeq(); + for (auto& clickGroup : splitedAnim) + { + PPTX::Logic::TimeNodeBase child; + FillClickGroup(clickGroup, child); + seq2->cTn.childTnLst->list.push_back(child); + } + return seq2; +} + +void Timing_1995::InsertMainSeqToTnLst(PPTX::Logic::Seq *mainSeq) +{ + PPTX::Logic::TimeNodeBase timeNodeBase; + timeNodeBase.m_node = mainSeq; + auto par1 = InitRootNode(); + par1->cTn.childTnLst = new PPTX::Logic::ChildTnLst; + par1->cTn.childTnLst->list.push_back(timeNodeBase); + timeNodeBase.m_node = par1; + + pTiming->tnLst->list.push_back(timeNodeBase); +} + +PPTX::Logic::Par* Timing_1995::InitRootNode() +{ + auto par1 = new PPTX::Logic::Par; + par1->cTn.id = 1; + par1->cTn.dur = L"indefinite"; + par1->cTn.restart = L"never"; + par1->cTn.nodeType = L"tmRoot"; + + return par1; +} + +PPTX::Logic::Seq *Timing_1995::InitMainSeq() +{ + auto seq2 = new PPTX::Logic::Seq; + seq2->cTn.id = 2; + seq2->cTn.dur = L"indefinite"; + seq2->cTn.nodeType = L"mainSeq"; + seq2->concurrent = L"1"; + seq2->nextAc = L"seek"; + seq2->cTn.childTnLst = new PPTX::Logic::ChildTnLst; + + PPTX::Logic::Cond cond; + cond.tgtEl = new PPTX::Logic::TgtEl; + if (arrOldAnim.front().anim->m_AnimationAtom.m_fAutomatic) + cond.delay = L"0"; + + seq2->nextCondLst = new PPTX::Logic::CondLst; + seq2->nextCondLst->node_name = L"nextCondLst"; + cond.evt = L"onNext"; + cond.delay = L"0"; + seq2->nextCondLst->list.push_back(cond); + + seq2->prevCondLst = new PPTX::Logic::CondLst; + seq2->prevCondLst->node_name = L"prevCondLst"; + cond.evt = L"onPrev"; + cond.delay = L"0"; + seq2->prevCondLst->list.push_back(cond); + + return seq2; +} + +void Timing_1995::SortAnim() +{ + std::sort(arrOldAnim.begin(), arrOldAnim.end(), + [] (const Intermediate::SOldAnimation& a1, const Intermediate::SOldAnimation& a2) + { + return a1.anim->m_AnimationAtom.m_OrderID + < + a2.anim->m_AnimationAtom.m_OrderID; + } + ); +} + +void Timing_1995::FillClickGroup(LstAnim &clickGroup, PPTX::Logic::TimeNodeBase &oTimeNodeBase) +{ + const auto& animAtom = clickGroup.front()->anim->m_AnimationAtom; + auto parGroups = SplitClickGroupByParrallelShow(clickGroup); + + auto par3 = new PPTX::Logic::Par; + FillCTnParams(par3->cTn, L"", L"indefinite", L"hold"); + + FillFirstAutomaticGroup(par3->cTn, animAtom); + + par3->cTn.childTnLst = new PPTX::Logic::ChildTnLst; + _UINT32 groupDelay = 0; + + for (auto& group : parGroups) + { + PPTX::Logic::TimeNodeBase childTimeNode; + ConvertParallelGroupAnimation(group, childTimeNode, groupDelay); + par3->cTn.childTnLst->list.push_back(childTimeNode); + } + + oTimeNodeBase.m_node = par3; +} + +LstLstAnim Timing_1995::SplitClickGroupByParrallelShow(LstAnim &clickGroup) +{ + LstLstAnim lstParallelGroups; + bool needNewGroup = true; + for (auto* anim : clickGroup) + { + auto& animAtom = anim->anim->m_AnimationAtom; + if (needNewGroup) + lstParallelGroups.push_back({anim}); + else + lstParallelGroups.back().push_back(anim); + + needNewGroup = animAtom.m_fSynchronous; + } + return lstParallelGroups; +} + +void Timing_1995::FillFirstAutomaticGroup(PPTX::Logic::CTn &cTn, const CRecordAnimationInfoAtom &animAtom) const +{ + PPTX::Logic::Cond cond; + if (animAtom.m_OrderID == arrOldAnim[0].anim->m_AnimationAtom.m_OrderID && + animAtom.m_fAutomatic) + { + cond.evt = L"onBegin"; + cond.delay = L"0"; + cond.tn = 2; + cTn.stCondLst->list.push_back(cond); + } +} + +void Timing_1995::FillCTnParams(PPTX::Logic::CTn &cTn, std::wstring nodeType, std::wstring condDelay, std::wstring fill, Intermediate::SOldAnimation* pOldAnim) +{ + cTn.id = cTnId++; + if (!fill.empty()) + cTn.fill = fill; + if (!nodeType.empty()) + cTn.nodeType = nodeType; + + if (pOldAnim) + animConverter->FillCTnAnimation(cTn, pOldAnim); + + // p:stCondLst + cTn.stCondLst = new PPTX::Logic::CondLst; + cTn.stCondLst->node_name = L"stCondLst"; + PPTX::Logic::Cond cond; + cond.delay = condDelay; + cTn.stCondLst->list.push_back(cond); +} + +void Timing_1995::ConvertParallelGroupAnimation(LstAnim &parGroup, PPTX::Logic::TimeNodeBase &oTimeNodeBase, _UINT32 &groupDelay) +{ + // par4 - 4 level - all 1995 animation level + auto par4 = new PPTX::Logic::Par; + par4->cTn.childTnLst = new PPTX::Logic::ChildTnLst; + + FillCTnParams(par4->cTn, L"", std::to_wstring(groupDelay)); + groupDelay += GetParallelGroupDuration(parGroup); + + ConvertHeadEfectInParallelShow(parGroup, par4->cTn); + ConvertWithEfectsInParallelShow(parGroup, par4->cTn); + + oTimeNodeBase.m_node = par4; +} + +_INT32 Timing_1995::GetParallelGroupDuration(LstAnim &parGroup) +{ + auto iterSlowestAnim = std::max_element(parGroup.begin(), parGroup.end(), + [] (Intermediate::SOldAnimation const* a1, Intermediate::SOldAnimation const* a2) + { + return a1->getAnimDur() < a2->getAnimDur(); +}); + + return (*iterSlowestAnim)->getAnimDur();; +} + +void Timing_1995::ConvertHeadEfectInParallelShow(const LstAnim& group, PPTX::Logic::CTn &cTn) +{ + PPTX::Logic::TimeNodeBase childTimeNode; + auto* pOldAnimation = group.front(); + + if (pOldAnimation->anim->m_AnimationAtom.m_fAutomatic) + FillAfterEffect(pOldAnimation, childTimeNode); + else + FillClickEffect(pOldAnimation, childTimeNode); + cTn.childTnLst->list.push_back(childTimeNode); +} + +void Timing_1995::ConvertWithEfectsInParallelShow(const LstAnim& group, PPTX::Logic::CTn &cTn) +{ + for (auto itAnim = ++group.begin(); itAnim != group.end(); itAnim++) + { + PPTX::Logic::TimeNodeBase childTimeNode; + FillWithEffect(*itAnim, childTimeNode); + cTn.childTnLst->list.push_back(childTimeNode); + } +} + +void Timing_1995::FillClickEffect(Intermediate::SOldAnimation *pOldAnim, PPTX::Logic::TimeNodeBase &oTimeNodeBase) +{ + FillEffectType(pOldAnim, oTimeNodeBase, L"clickEffect"); +} + +void Timing_1995::FillAfterEffect(Intermediate::SOldAnimation *pOldAnim, PPTX::Logic::TimeNodeBase &oTimeNodeBase) +{ + FillEffectType(pOldAnim, oTimeNodeBase, L"afterEffect"); +} + +void Timing_1995::FillWithEffect(Intermediate::SOldAnimation *pOldAnim, PPTX::Logic::TimeNodeBase &oTimeNodeBase) +{ + FillEffectType(pOldAnim, oTimeNodeBase, L"withEffect"); +} + +void Timing_1995::FillEffectType(Intermediate::SOldAnimation *pOldAnim, PPTX::Logic::TimeNodeBase &oTimeNodeBase, std::wstring nodeType) +{ + auto par = new PPTX::Logic::Par; + FillCTnParams(par->cTn, nodeType, L"0", L"hold", pOldAnim); + oTimeNodeBase.m_node = par; +} + +} +} diff --git a/MsBinaryFile/PptFile/Converter/Animation/Timing_1995.h b/MsBinaryFile/PptFile/Converter/Animation/Timing_1995.h new file mode 100644 index 0000000000..2702837932 --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/Animation/Timing_1995.h @@ -0,0 +1,58 @@ +#pragma once + +#include "../../PPTXWriter/ImageManager.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Timing.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Par.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Seq.h" +#include "intermediate_anim.h" + + +namespace PPT { +namespace Converter { +class Animation_1995; + +using LstAnim = std::list; +using LstLstAnim = std::list; + +class Timing_1995 +{ +public: + Timing_1995(const std::vector& vecAIC); + void Convert(PPTX::Logic::Timing& timimg, CExMedia* pExMedia, CRelsGenerator* pRels); + ~Timing_1995(); + +private: + bool InitAndCheckVars(PPTX::Logic::Timing& timimg, CExMedia* pExMedia, CRelsGenerator* pRels); + void ConvertBldLst(); + void ConvertTnLst(); + PPTX::Logic::Seq *ConvertMainSeqAnimation(LstLstAnim& splitedAnim); + LstLstAnim SplitRawAnim(); + void InsertMainSeqToTnLst(PPTX::Logic::Seq *mainSeq); + PPTX::Logic::Par *InitRootNode(); + PPTX::Logic::Seq *InitMainSeq(); + void SortAnim(); + + void FillClickGroup(LstAnim &clickPar, PPTX::Logic::TimeNodeBase &oTimeNodeBase); + static LstLstAnim SplitClickGroupByParrallelShow(LstAnim &clickGroup); + void FillFirstAutomaticGroup(PPTX::Logic::CTn &cTn, const CRecordAnimationInfoAtom& animAtom) const; + void FillCTnParams(PPTX::Logic::CTn &cTn, std::wstring nodeType, std::wstring condDelay=L"", std::wstring fill=L"hold", Intermediate::SOldAnimation* pOldAnim = nullptr); + void ConvertParallelGroupAnimation(LstAnim& parGroup, PPTX::Logic::TimeNodeBase &oTimeNodeBase, _UINT32& groupDelay); + static _INT32 GetParallelGroupDuration(LstAnim &parGroup); + void ConvertHeadEfectInParallelShow(const LstAnim& group, PPTX::Logic::CTn &cTn); + void ConvertWithEfectsInParallelShow(const LstAnim& group, PPTX::Logic::CTn &cTn); + void FillClickEffect(Intermediate::SOldAnimation* pOldAnim, PPTX::Logic::TimeNodeBase &oTimeNodeBase); + void FillAfterEffect(Intermediate::SOldAnimation* pOldAnim, PPTX::Logic::TimeNodeBase &oTimeNodeBase); + void FillWithEffect (Intermediate::SOldAnimation* pOldAnim, PPTX::Logic::TimeNodeBase &oTimeNodeBase); + void FillEffectType (Intermediate::SOldAnimation* pOldAnim, PPTX::Logic::TimeNodeBase &oTimeNodeBase, std::wstring nodeType); + +private: + std::vector arrOldAnim; + Animation_1995* animConverter; + + PPTX::Logic::Timing* pTiming = nullptr; + CExMedia* pExMedia; + CRelsGenerator* pRels; + _INT32 cTnId = 3; +}; +} +} diff --git a/MsBinaryFile/PptFile/Converter/Animation/Timing_2010.cpp b/MsBinaryFile/PptFile/Converter/Animation/Timing_2010.cpp new file mode 100644 index 0000000000..a68a6f4036 --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/Animation/Timing_2010.cpp @@ -0,0 +1,1387 @@ +#include "Timing_2010.h" +#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SchemeClr.h" +#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SrgbClr.h" +#include "TimingExeption.h" +#include "TimingUtils.h" + + +namespace PPT { +namespace Converter { + +Timing_2010::Timing_2010(CRecordPP10SlideBinaryTagExtension *pAnim_2010, const std::unordered_set &shapesID) : + pTagExtAnim(pAnim_2010), + slideShapes(shapesID) +{} + +void Timing_2010::Convert(PPTX::Logic::Timing &timing, CExMedia *pExMedia, CRelsGenerator *pRels) +{ + m_pExMedia = pExMedia; + m_pRels = pRels; + + + if (pTagExtAnim == nullptr || pTagExtAnim->m_haveExtTime == false) + return; + + ConvertTnLst(timing, pTagExtAnim->m_pExtTimeNodeContainer); + ConvertBldLst(timing, pTagExtAnim->m_pBuildListContainer); +} + +void Timing_2010::ConvertBldLst(PPTX::Logic::Timing &timimg, CRecordBuildListContainer *pBLC) +{ + if (pBLC == nullptr) + return; + if (timimg.bldLst.IsInit()) + timimg.bldLst->list.clear(); + if (pBLC->m_arRecords.empty()) + return; + if (!timimg.bldLst.IsInit()) + timimg.bldLst = new PPTX::Logic::BldLst; + + + for (IRecord* pDBC : pBLC->m_arRecords) + { + PPTX::Logic::BuildNodeBase oBuildNodeBase; + auto* pSub = dynamic_cast(pDBC); + if (pSub == nullptr) + continue; + if (slideShapes.count(pSub->buildAtom.m_nShapeIdRef) == false) + continue; + + FillBuildNodeBase(pSub, oBuildNodeBase); + InsertBuildNode(timimg.bldLst.get2(), oBuildNodeBase); + } +} + +void Timing_2010::InsertBuildNode(PPTX::Logic::BldLst &bldLst, PPTX::Logic::BuildNodeBase &bnb) +{ + if (bnb.m_node.is()) + InsertBldP(bldLst, bnb); + else if (bnb.m_node.IsInit()) // TODO BldOleChart and RT_DiagramBuild. Now it is not support (20.11.22). + bldLst.list.push_back(bnb); + else + return; +} + +void Timing_2010::InsertBldP(PPTX::Logic::BldLst &bldLst, PPTX::Logic::BuildNodeBase &bnb) +{ + auto bldP = bnb.m_node.as(); + _INT32 spid = -1; + try { + spid = std::stoi(bldP.spid); + } catch (...) { + } + if (IsCorrectAnimationSpId(spid)) + bldLst.list.push_back(bnb); +} + +void Timing_2010::FillBuildNodeBase(CRecordBuildListSubContainer *pSub, PPTX::Logic::BuildNodeBase &oBuildNodeBase) +{ + switch (pSub->m_oHeader.RecType) + { + case RT_ParaBuild: + { + auto pBldP = new PPTX::Logic::BldP(); + FillBldP(dynamic_cast(pSub), *pBldP); + + oBuildNodeBase.m_node = pBldP; + break; + } + case RT_ChartBuild: + { + auto pBldOleChart = new PPTX::Logic::BldOleChart(); + FillBldOleChart(dynamic_cast(pSub), *pBldOleChart); + + oBuildNodeBase.m_node = pBldOleChart; + break; + } + case RT_DiagramBuild: + { + auto pBldDgm = new PPTX::Logic::BldDgm(); + FillBldDgm(dynamic_cast(pSub), *pBldDgm); + + oBuildNodeBase.m_node = pBldDgm; + break; + } + default: + break; + } +} + +void Timing_2010::FillBldP(CRecordParaBuildContainer* pPBC, PPTX::Logic::BldP &oBP) +{ + if (pPBC == nullptr) + return; + + oBP.spid = std::to_wstring(pPBC->buildAtom.m_nShapeIdRef); + oBP.grpId = (int)pPBC->buildAtom.m_nBuildId; + oBP.uiExpand = pPBC->buildAtom.m_fExpanded; + + oBP.advAuto = std::to_wstring(pPBC->m_oParaBuildAtom.m_nDelayTime); + oBP.animBg = pPBC->m_oParaBuildAtom.m_fAnimBackground; + oBP.rev = pPBC->m_oParaBuildAtom.m_fReverse; + oBP.autoUpdateAnimBg = pPBC->m_oParaBuildAtom.m_fAutomatic; + + std::vector ST_TLParaBuildType = + { + L"allAtOnce", + L"p", + L"cust", + L"whole" + }; + oBP.build = ST_TLParaBuildType[pPBC->m_oParaBuildAtom.m_nParaBuild % 4]; +} + +void Timing_2010::FillBldOleChart(CRecordChartBuildContainer *pCBC, PPTX::Logic::BldOleChart &oBP) +{ + if (pCBC == nullptr) + return; + + oBP.spid = std::to_wstring(pCBC->buildAtom.m_nShapeIdRef); + oBP.grpId = (int)pCBC->buildAtom.m_nBuildId; + oBP.uiExpand = pCBC->buildAtom.m_fExpanded; + + oBP.animBg = pCBC->m_oChartBuildAtom.m_fAnimBackground; + + std::vector ST_TLOleChartBuildType = + { + L"allAtOnce", + L"series", + L"category", + L"seriesEl", + L"categoryEl" + }; + oBP.bld = ST_TLOleChartBuildType[pCBC->m_oChartBuildAtom.m_ChartBuild % 5]; +} + +void Timing_2010::FillBldDgm(CRecordDiagramBuildContainer *pDBC, PPTX::Logic::BldDgm &oBP) +{ + if (pDBC == nullptr) + return; + + oBP.spid = std::to_wstring(pDBC->buildAtom.m_nShapeIdRef); + oBP.grpId = (int)pDBC->buildAtom.m_nBuildId; + oBP.uiExpand = pDBC->buildAtom.m_fExpanded; + + std::vector ST_TLDiagramBuildType = + { + L"whole", + L"depthByNode", + L"depthByBranch", + L"breadthByNode", + L"breadthByLvl", + L"cw", + L"cwIn", + L"cwOut", + L"ccw", + L"ccwIn", + L"ccwOut", + L"inByRing", + L"outByRing", + L"up", + L"down", + L"allAtOnce", + L"cust" + }; + oBP.bld = ST_TLDiagramBuildType[pDBC->m_oDiagramBuildAtom.m_oDiagramBuild % 17]; +} + +void Timing_2010::ConvertTnLst(PPTX::Logic::Timing &timing, CRecordExtTimeNodeContainer *pETNC) +{ + if (!timing.tnLst.IsInit()) + timing.tnLst = new PPTX::Logic::TnLst; + + auto& tnLst = timing.tnLst.get2(); + if (tnLst.list.empty()) + tnLst.list.push_back(PPTX::Logic::TimeNodeBase()); + + FillTnChild(pETNC, tnLst.list.back()); +} + +bool Timing_2010::FillTnChild(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::TimeNodeBase &oChild) +{ + if (pETNC->m_haveSequenceAtom) + { + oChild.m_node = new PPTX::Logic::Seq; + FillSeq(pETNC, oChild.m_node.as()); + } + else if (pETNC->m_haveSetBehavior) + { + oChild.m_node = new PPTX::Logic::Set; + FillSet(pETNC, oChild.m_node.as()); + } + else if (pETNC->m_haveAnimateBehavior) + { + oChild.m_node = new PPTX::Logic::Anim; + + auto& anim = oChild.m_node.as(); + FillAnim(pETNC->m_pTimeAnimateBehavior, anim); + FillCTnRecursive(pETNC, anim.cBhvr.cTn); + } + else if (pETNC->m_haveColorBehavior) + { + oChild.m_node = new PPTX::Logic::AnimClr; + FillAnimClr(pETNC->m_pTimeColorBehavior, pETNC->m_pTimePropertyList, oChild.m_node.as()); + } + else if (pETNC->m_haveEffectBehavior) + { + oChild.m_node = new PPTX::Logic::AnimEffect; + FillAnimEffect(pETNC, oChild.m_node.as()); + } + else if (pETNC->m_haveMotionBehavior) + { + oChild.m_node = new PPTX::Logic::AnimMotion; + FillAnimMotion(pETNC, oChild.m_node.as()); + } + else if (pETNC->m_haveRotationBehavior) + { + oChild.m_node = new PPTX::Logic::AnimRot; + FillAnimRot(pETNC, oChild.m_node.as()); + } + else if (pETNC->m_haveScaleBehavior) + { + oChild.m_node = new PPTX::Logic::AnimScale; + FillAnimScale(pETNC, oChild.m_node.as()); + } + else if (pETNC->m_haveCommandBehavior) + { + oChild.m_node = new PPTX::Logic::Cmd; + FillCmd(pETNC, oChild.m_node.as()); + } + else if (pETNC->m_oTimeNodeAtom.m_dwType == TL_TNT_Parallel) + { + oChild.m_node = new PPTX::Logic::Par; + FillPar(pETNC, oChild.m_node.as()); + } + else if (pETNC->m_haveClientVisualElement) + { + if (pETNC->m_pClientVisualElement->m_bVisualPageAtom) + { + + } + if (pETNC->m_pClientVisualElement->m_bVisualShapeAtom) + { + if (pETNC->m_pClientVisualElement->m_oVisualShapeAtom.m_Type == TL_TVET_Video) + { + oChild.m_node = new PPTX::Logic::Video; + FillVideo(pETNC, oChild.m_node.as()); + } + + if (pETNC->m_pClientVisualElement->m_oVisualShapeAtom.m_Type == TL_TVET_Audio) + { + oChild.m_node = new PPTX::Logic::Audio; + FillAudio(pETNC, oChild.m_node.as()); + } + } + } + + return true; +} + +void Timing_2010::FillSeq(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::Seq &oSec) +{ + if (pETNC->m_haveSequenceAtom) + { + if (pETNC->m_pTimeSequenceDataAtom->m_fConcurrencyPropertyUsed) + oSec.concurrent = (bool)pETNC->m_pTimeSequenceDataAtom->m_nConcurrency; + if (pETNC->m_pTimeSequenceDataAtom->m_fNextActionPropertyUsed) + oSec.nextAc = pETNC->m_pTimeSequenceDataAtom->m_nNextAction ? L"seek" : L"none"; + if (pETNC->m_pTimeSequenceDataAtom->m_fPreviousActionPropertyUsed) + oSec.prevAc = pETNC->m_pTimeSequenceDataAtom->m_nPreviousAction ? L"skipTimed" : L"none"; + } + FillCTnRecursive(pETNC, oSec.cTn); + + // Fill cond lists + if (!pETNC->m_arrRgEndTimeCondition.empty()) + { + oSec.prevCondLst = new PPTX::Logic::CondLst(); + oSec.prevCondLst->node_name = L"prevCondLst"; + } + for (auto oldCond : pETNC->m_arrRgEndTimeCondition) + { + PPTX::Logic::Cond cond; + cond.node_name = L"cond"; + FillCond(oldCond, cond); + if (cTNLevel == TimeNodeLevel::root) + FillEmptyTargetCond(cond); + oSec.prevCondLst->list.push_back(cond); + } + + if (!pETNC->m_arrRgNextTimeCondition.empty()) + { + oSec.nextCondLst = new PPTX::Logic::CondLst(); + oSec.nextCondLst->node_name = L"nextCondLst"; + } + for (auto oldCond : pETNC->m_arrRgNextTimeCondition) + { + PPTX::Logic::Cond cond; + cond.node_name = L"cond"; + FillCond(oldCond, cond); + if (cTNLevel == TimeNodeLevel::root) + FillEmptyTargetCond(cond); + oSec.nextCondLst->list.push_back(cond); + } +} + +void Timing_2010::FillPar(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::Par &oPar) +{ + FillCTnRecursive(pETNC, oPar.cTn); +} + +void Timing_2010::FillCBhvr(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::CBhvr &oBhvr) +{ + auto *bhvr = Intermediate::GetTimeBehaviorContainer(pETNC); + FillCBhvr(bhvr, oBhvr); + FillCTnRecursive(pETNC, oBhvr.cTn); +} + +void Timing_2010::FillCBhvr(CRecordTimeBehaviorContainer *pBhvr, PPTX::Logic::CBhvr &oBhvr) +{ + //// Atom //// + + // additive + if (pBhvr->m_oBehaviorAtom.m_bAdditivePropertyUsed) { + oBhvr.additive = new PPTX::Limit::TLAdditive; + oBhvr.additive = pBhvr->m_oBehaviorAtom.m_nBehaviorAdditive ? + L"repl" : L"base"; + } + + // accumulate - MUST be 0 + // xfrmType - MUST be 0 + + if (pBhvr->m_haveStringList) + { + if (!pBhvr->m_pStringList->m_arrRgChildRec.empty()) + { + oBhvr.attrNameLst = new PPTX::Logic::AttrNameLst(); + } + for (const auto &oldAttr : pBhvr->m_pStringList->m_arrRgChildRec) + { + PPTX::Logic::AttrName addAttr; + addAttr.text = oldAttr.m_Value; + oBhvr.attrNameLst->list.push_back(addAttr); + + } + } + + if (pBhvr->m_oClientVisualElement.m_bVisualShapeAtom) + { + UINT spid = pBhvr-> + m_oClientVisualElement. + m_oVisualShapeAtom.m_nObjectIdRef; + + if (!oBhvr.tgtEl.spTgt.IsInit()) + { + oBhvr.tgtEl.spTgt = new PPTX::Logic::SpTgt; + oBhvr.tgtEl.spTgt->spid = std::to_wstring(spid); + } + + if (m_currentBldP) + { + m_currentBldP->spid = + oBhvr.tgtEl.spTgt->spid; + } + if (pBhvr->m_oClientVisualElement.m_oVisualShapeAtom.m_nData2 != 0xFFFFFFFF && + pBhvr->m_oClientVisualElement.m_oVisualShapeAtom.m_nData1 != 0xFFFFFFFF) + { + oBhvr.tgtEl.spTgt->txEl = new PPTX::Logic::TxEl; + oBhvr.tgtEl.spTgt->txEl->charRg = false; + oBhvr.tgtEl.spTgt->txEl->st = pBhvr->m_oClientVisualElement.m_oVisualShapeAtom.m_nData1; + oBhvr.tgtEl.spTgt->txEl->end = pBhvr->m_oClientVisualElement.m_oVisualShapeAtom.m_nData2; + } + } + + + if (pBhvr->m_pPropertyList == nullptr) + return; + + for (const auto prop : pBhvr->m_pPropertyList->m_arRecords) + { + if (prop == nullptr) + continue; + + switch (prop->m_oHeader.RecInstance) + { + case TL_TBPID_RuntimeContext: + break; + case TL_TBPID_MotionPathEditRelative: + break; + case TL_TBPID_ColorColorModel: + break; + case TL_TBPID_ColorDirection: + break; + case TL_TBPID_Override: + { + auto override_ = new PPTX::Limit::TLOverride; + override_->set(L"childStyle"); + oBhvr.override_= override_; + break; + } + case TL_TBPID_PathEditRotationAngle: + break; + case TL_TBPID_PathEditRotationX: + break; + case TL_TBPID_PathEditRotationY: + break; + case TL_TBPID_PointsTypes: + break; + case TL_TBPID_UnknownPropertyList: + default: + break; + } + } +} + +void Timing_2010::FillCBhvr(PPTX::Logic::CBhvr &oBhvr, int dur, UINT spid, std::wstring attrname, int delay) +{ + oBhvr.cTn.id = cTnId++; + oBhvr.cTn.fill = L"hold"; + oBhvr.cTn.dur = std::to_wstring(dur); + if (delay > -1) + { + oBhvr.cTn.stCondLst = new PPTX::Logic::CondLst; + oBhvr.cTn.stCondLst->node_name = L"stCondLst"; + PPTX::Logic::Cond cond; + cond.delay = std::to_wstring(delay); + oBhvr.cTn.stCondLst->list.push_back(cond); + } + + oBhvr.tgtEl.spTgt = new PPTX::Logic::SpTgt; + oBhvr.tgtEl.spTgt->spid = std::to_wstring(spid); + + if (!attrname.empty()) + { + oBhvr.attrNameLst = new PPTX::Logic::AttrNameLst; + PPTX::Logic::AttrName attrName; + attrName.text = attrname; + oBhvr.attrNameLst->list.push_back(attrName); + } +} + +void Timing_2010::FillSet(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::Set &oSet) +{ + if (!pETNC->m_haveSetBehavior) + return; + + FillCBhvr(pETNC, oSet.cBhvr); + oSet.to = new PPTX::Logic::AnimVariant(); + oSet.to->node_name = L"to"; + oSet.to->strVal = pETNC->m_pTimeSetBehavior->m_oVarTo.m_Value; +} + +void Timing_2010::FillAnim(CRecordTimeAnimateBehaviorContainer *pTimeAnimateBehavior, PPTX::Logic::Anim &oAnim) +{ + if (pTimeAnimateBehavior->m_oAnimateBehaviorAtom.m_bCalcModePropertyUsed) + { + std::wstring calcmode; + switch (pTimeAnimateBehavior->m_oAnimateBehaviorAtom.m_nCalcMode) { + case 0: calcmode = L"discrete"; break; + case 1: calcmode = L"lin"; break; + case 2: calcmode = L"fmla"; break; + } + oAnim.calcmode = new PPTX::Limit::TLCalcMode; + oAnim.calcmode = calcmode; + } + + if (pTimeAnimateBehavior->m_oAnimateBehaviorAtom.m_bValueTypePropertyUsed) + { + std::wstring valueType; + switch (pTimeAnimateBehavior->m_oAnimateBehaviorAtom.m_ValueType) { + case TL_TABVT_Color: valueType = L"Color"; break; + case TL_TABVT_Number: valueType = L"Number"; break; + case TL_TABVT_String: valueType = L"String"; break; + } + if (!valueType.empty()) + { + oAnim.valueType = new PPTX::Limit::TLValueType; + oAnim.valueType = valueType; + } + } + + // By + if (pTimeAnimateBehavior->m_oAnimateBehaviorAtom.m_bByPropertyUsed) + { + oAnim.by = pTimeAnimateBehavior->m_oVarBy.m_Value; + } + // To + if (pTimeAnimateBehavior->m_oAnimateBehaviorAtom.m_bToPropertyUsed) + { + oAnim.to = pTimeAnimateBehavior->m_oVarTo.m_Value; + } + //From + if (pTimeAnimateBehavior->m_oAnimateBehaviorAtom.m_bFromPropertyUsed) + { + oAnim.from = pTimeAnimateBehavior->m_oVarFrom.m_Value; + } + + //// Writing childs + + if (!pTimeAnimateBehavior->m_oAnimateValueList.m_arrEntry.empty()) + oAnim.tavLst = new PPTX::Logic::TavLst; + for (auto &animValue : pTimeAnimateBehavior->m_oAnimateValueList.m_arrEntry) + { + PPTX::Logic::Tav tav; + tav.val = new PPTX::Logic::AnimVariant; + + tav.val->node_name = L"val"; + + if (animValue->m_pVarValue.is_init()) + switch (animValue->m_pVarValue->m_Type) { + case TL_TVT_String: + { + tav.val->strVal = dynamic_cast + (animValue->m_pVarValue.get()).m_Value; + break; + } + case TL_TVT_Bool: + { + tav.val->boolVal = dynamic_cast + (animValue->m_pVarValue.get()).m_Value; + break; + } + case TL_TVT_Int: + { + tav.val->intVal = dynamic_cast + (animValue->m_pVarValue.get()).m_Value; + break; + } + case TL_TVT_Float: + { + tav.val->fltVal = dynamic_cast + (animValue->m_pVarValue.get()).m_Value; + break; + } + } + + auto tavTime = animValue->m_oTimeAnimationValueAtom.m_nTime; + if (tavTime <= 1000 && tavTime >= 0) // todo check + tav.tm = std::to_wstring((/*1000 - */tavTime) * 100); + + if (!animValue->m_VarFormula.m_Value.empty()) + { + tav.fmla = animValue->m_VarFormula.m_Value; + } + + oAnim.tavLst->list.push_back(tav); + } + FillCBhvr(&(pTimeAnimateBehavior->m_oBehavior), oAnim.cBhvr); +} + +void Timing_2010::FillCTnRecursive(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::CTn &oCTn) +{ + if (cTNLevel+1 == TimeNodeLevel::oneAnim && + !CheckAnimation5Level(pETNC, oCTn)) + throw TimingExeption("Slide was edited without animation 2010 synchronization"); + + cTNLevel++; + + FillCTnHeadArgs(pETNC, oCTn); + + ConvertChildTnLst(pETNC, oCTn); + ConvertCTnIterate(pETNC, oCTn); + ConvertCTnEndSync(pETNC, oCTn); + ConvertCTnIterate(pETNC, oCTn); + ConvertCTnStCondLst(pETNC, oCTn); + + cTNLevel--; +} + +bool Timing_2010::CheckAnimation5Level(const CRecordExtTimeNodeContainer *pETNC, const PPTX::Logic::CTn &oCTn) +{ + auto anim_2010 = Intermediate::ParseExisting5Level_ETNC(pETNC); + bool isSlideShape = IsSlideSpId(anim_2010.spid); + if (isSlideShape) + InsertAnimationSpId(anim_2010.spid); + return isSlideShape; +} + +bool Timing_2010::IsSlideSpId(_INT32 spid) const +{ + return slideShapes.find(spid) != slideShapes.end(); +} + +bool Timing_2010::IsCorrectAnimationSpId(_INT32 spid) const +{ + return correctAnimatedShapes.find(spid) != correctAnimatedShapes.end(); +} + +void Timing_2010::InsertAnimationSpId(_INT32 spid) +{ + if (spid != -1) + correctAnimatedShapes.insert(spid); +} + +void Timing_2010::ConvertChildTnLst(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::CTn &oCTn) +{ + if (oCTn.childTnLst.IsInit() == false) + oCTn.childTnLst = new PPTX::Logic::ChildTnLst; + + for (size_t i = 0; i < pETNC->m_arrRgExtTimeNodeChildren.size(); i++) + { + auto *pETNC_child = pETNC->m_arrRgExtTimeNodeChildren[i]; + if (oCTn.childTnLst->list.size() == i) + oCTn.childTnLst->list.push_back(PPTX::Logic::TimeNodeBase()); + + auto& pptx_child = oCTn.childTnLst->list[i]; + FillTnChild(pETNC_child, pptx_child); + } +} + +void Timing_2010::ConvertCTnIterate(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::CTn &oCTn) +{ + if (!pETNC->m_haveIterateDataAtom) + return; + + auto *iter = pETNC->m_pTimeIterateDataAtom; + oCTn.iterate = new PPTX::Logic::Iterate; + + std::wstring type[] = {L"el", L"wd", L"lt"}; + if (iter->m_fIterateTypePropertyUsed) + oCTn.iterate->type = type[iter->m_nIterateType % 3]; + + if (iter->m_fIterateDirectionPropertyUsed) + oCTn.iterate->backwards = (bool)iter->m_nIterateDirection; + + int intervalType = iter->m_fIterateIntervalTypePropertyUsed ? + iter->m_nIterateIntervalType : 0; + uint iterateInterval = iter->m_fIterateIntervalPropertyUsed ? + iter->m_nIterateInterval : 0; + + if (intervalType) + oCTn.iterate->tmPct = iterateInterval > 1000 ? 10000 : iterateInterval * 10; + else + oCTn.iterate->tmAbs = std::to_wstring(iterateInterval); +} + +void Timing_2010::ConvertCTnEndSync(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::CTn &oCTn) +{ + if (!pETNC->m_haveTimeEndSyncTime) + return; + + auto *sync = pETNC->m_pTimeEndSyncTimeCondition; + oCTn.endSync = new PPTX::Logic::Cond; + oCTn.endSync->node_name = L"endSync"; + FillCond(sync, *(oCTn.endSync)); +} + +void Timing_2010::ConvertCTnSubTnLst(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::CTn &oCTn) +{ + if (pETNC->m_arrRgSubEffect.empty()) + return; + + // if ( + // pETNC->m_arrRgSubEffect[0]->m_oTimeNodeAtom.m_fGroupingTypeProperty && + // m_pBldLst && + // m_pPPT10->m_haveBuildList + // ) + // { + // oCTn.grpId = 0; + // auto bldP = new PPTX::Logic::BldP; + // bldP->grpId = 0; + // m_currentBldP = bldP; + // } + + auto sub = new PPTX::Logic::TnLst; + sub->node_name = L"subTnLst"; + FillSubTnLst(pETNC->m_arrRgSubEffect, *sub); + oCTn.subTnLst = sub; + + if (m_currentBldP) + { + PPTX::Logic::BuildNodeBase oBuildNodeBase; + oBuildNodeBase.m_node = m_currentBldP; + m_pBldLst->list.push_back(oBuildNodeBase); + m_currentBldP = nullptr; + } + + for (auto timeModAtom : pETNC->m_arrRgTimeModifierAtom) + { + switch (timeModAtom->m_nType) + { + case 0: + { + oCTn.repeatCount = std::to_wstring((int) + timeModAtom->m_Value * 1000); + break; + } + case 1: + { + // Check 1000 + oCTn.repeatDur = std::to_wstring((int) + timeModAtom->m_Value * 1000); + break; + } + case 2: + { + // Check 1000 + oCTn.spd = std::to_wstring((int) + timeModAtom->m_Value * 1000); + break; + } + case 3: + { + // Check 1000 + oCTn.accel = std::to_wstring((int) + timeModAtom->m_Value * 1000); + break; + } + case 4: + { + // Check 1000 + oCTn.decel = std::to_wstring((int) + timeModAtom->m_Value * 1000); + break; + } + case 5: + { + // Check 1000 + oCTn.autoRev = (bool)timeModAtom->m_Value; + break; + } + + } + } +} + +void Timing_2010::ConvertCTnStCondLst(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::CTn &oCTn) +{ + if (pETNC->m_arrRgBeginTimeCondition.empty()) + return; + + oCTn.stCondLst = new PPTX::Logic::CondLst; + oCTn.stCondLst->node_name = L"stCondLst"; + FillStCondLst(pETNC->m_arrRgBeginTimeCondition, oCTn.stCondLst.get2()); +} + +void Timing_2010::FillCond(CRecordTimeConditionContainer *oldCond, PPTX::Logic::Cond &cond) +{ + if (oldCond->m_oTimeConditionAtom.m_nTimeDelay != -1) + cond.delay = std::to_wstring(oldCond->m_oTimeConditionAtom.m_nTimeDelay); + else + cond.delay = L"indefinite"; + + // if (oldCond->m_oTimeConditionAtom.m_TriggerObject == TL_TOT_RuntimeNodeRef || + // oldCond->m_oTimeConditionAtom.m_TriggerObject == TL_TOT_TimeNode) + // { + // cond.tn = oldCond->m_oTimeConditionAtom.m_nID; + // } + + if (oldCond->m_oTimeConditionAtom.m_TriggerObject == TL_TOT_RuntimeNodeRef) + { + cond.rtn = new PPTX::Limit::TLRuntimeTrigger; + cond.rtn->SetBYTECode(0); + } + + std::wstring str; + + switch (oldCond->m_oTimeConditionAtom.m_nTriggerEvent) + { + case 1: str = L"onBegin"; break; + case 3: str = L"begin"; break; + case 4: str = L"end"; break; + case 5: str = L"onClick"; break; + case 7: str = L"onMouseOver"; break; + case 9: str = L"onNext"; break; + case 10: str = L"onPrev"; break; + case 11: str = L"onStopAudio"; break; + default: str.clear(); + } + + if (!str.empty()) cond.evt = str; + + if (oldCond->m_oVisualElement.m_bVisualShapeAtom) + { + cond.tgtEl = new PPTX::Logic::TgtEl; + cond.tgtEl->spTgt = new PPTX::Logic::SpTgt; + cond.tgtEl->spTgt->spid = std::to_wstring( + oldCond->m_oVisualElement.m_oVisualShapeAtom.m_nObjectIdRef); + } else if (oldCond->m_oVisualElement.m_bVisualPageAtom) + { + cond.tgtEl = new PPTX::Logic::TgtEl; + } +} + +void Timing_2010::FillStCondLst(const std::vector &timeCondCont, PPTX::Logic::CondLst &stCondLst) +{ + for (const auto& pCond : timeCondCont) + { + int target = -1; + if (pCond->m_oVisualElement.m_bVisualShapeAtom) + target = pCond->m_oVisualElement.m_oVisualShapeAtom.m_nObjectIdRef; + + PPTX::Logic::Cond cond; + FillCond(pCond, cond); + + stCondLst.list.push_back(cond); + } +} + +void Timing_2010::FillSubTnLst(std::vector &vecSEC, PPTX::Logic::TnLst &oSubTnLst) +{ + for (auto pSEC : vecSEC) + { + if (pSEC->m_haveClientVisualElement) + { + PPTX::Logic::TimeNodeBase TNB; + auto audio = new PPTX::Logic::Audio; + + FillAudio(pSEC->m_pClientVisualElement, *audio); + TNB.m_node = audio; + oSubTnLst.list.push_back(TNB); + + // Write endCondLst + if (pSEC->m_arrRgEndTimeCondition.empty() == false) + { + audio->cMediaNode.cTn.endCondLst = new PPTX::Logic::CondLst; + audio->cMediaNode.cTn.endCondLst->node_name = L"endCondLst"; + } + FillCondLst(pSEC->m_arrRgEndTimeCondition, + audio->cMediaNode.cTn.endCondLst.get2()); + + // Write stCondLst + if (pSEC->m_arrRgBeginTimeCondition.empty() == false) + { + audio->cMediaNode.cTn.stCondLst = new PPTX::Logic::CondLst; + audio->cMediaNode.cTn.stCondLst->node_name = L"stCondLst"; + } + FillCondLst(pSEC->m_arrRgBeginTimeCondition, + audio->cMediaNode.cTn.stCondLst.get2()); + FillCTnProps(pSEC->m_pTimePropertyList, audio->cMediaNode.cTn); + } + + if (pSEC->m_haveColorBehavior) + { + PPTX::Logic::TimeNodeBase TNB; + auto color = new PPTX::Logic::AnimClr; + + FillAnimClr(pSEC->m_pTimeColorBehavior, pSEC->m_pTimePropertyList, *color); + TNB.m_node = color; + oSubTnLst.list.push_back(TNB); + } + } +} + +void Timing_2010::FillAudio(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::Audio &oAudio) +{ + auto* pCVEC = pETNC->m_pClientVisualElement; + if (pCVEC->m_bVisualShapeAtom && m_pRels) + { + CExFilesInfo* pInfo1 = m_pExMedia->LockAudioFromCollection(pCVEC->m_oVisualShapeAtom.m_nObjectIdRef); + if (pInfo1) + { + bool bExternal(false); + oAudio.cMediaNode.tgtEl.embed = + new OOX::RId(m_pRels->WriteAudio(pInfo1->m_strFilePath, bExternal)); + oAudio.cMediaNode.tgtEl.name = XmlUtils::EncodeXmlString(pInfo1->m_name); + } else if (pCVEC->m_oVisualShapeAtom.m_RefType == TL_ET_ShapeType) + { + oAudio.cMediaNode.tgtEl.spTgt = new PPTX::Logic::SpTgt; + oAudio.cMediaNode.tgtEl.spTgt->spid = std::to_wstring(pCVEC->m_oVisualShapeAtom.m_nObjectIdRef); + // oAudio.isNarration = true; + // oAudio.cMediaNode.showWhenStopped = false; + } else + return; + FillCTnRecursive(pETNC, oAudio.cMediaNode.cTn); + } +} + +void Timing_2010::FillAudio(CRecordClientVisualElementContainer *pCVEC, PPTX::Logic::Audio &oAudio) +{ + if (pCVEC->m_bVisualShapeAtom) + { + CExFilesInfo* pInfo1 = m_pExMedia->LockAudioFromCollection(pCVEC->m_oVisualShapeAtom.m_nObjectIdRef); + if (pInfo1 && m_pRels) + { + bool bExternal(false); + oAudio.cMediaNode.tgtEl.embed = + new OOX::RId(m_pRels->WriteAudio(pInfo1->m_strFilePath, bExternal)); + oAudio.cMediaNode.tgtEl.name = XmlUtils::EncodeXmlString(pInfo1->m_name); + } + } +} + +void Timing_2010::FillCmd(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::Cmd &oCmd) +{ + if (!pETNC || !pETNC->m_pTimeCommandBehavior) + return; + + auto pCommand = pETNC->m_pTimeCommandBehavior; + const auto& oAtom = pCommand->m_oCommandBehaviorAtom; + + FillCBhvr(pETNC, oCmd.cBhvr); + + if (oAtom.m_fTypePropertyUsed) + { + oCmd.type = new PPTX::Limit::TLCommandType; + std::wstring type; + switch (oAtom.m_eCommandBehaviorType) + { + case TL_TCBT_Eventv: type = L"evt"; break; + case TL_TCBT_Call: type = L"call"; break; + case TL_TCBT_OleVerb: type = L"verb"; break; + } + oCmd.type->set(type); + } + if (oAtom.m_fCommandPropertyUsed) + { + oCmd.cmd = pCommand->m_oVarCommand.m_Value; + } +} + +void Timing_2010::FillCondLst(std::vector &oCondVec, PPTX::Logic::CondLst &oCondLst) +{ + for (auto *oldCond : oCondVec) { + PPTX::Logic::Cond cond; + cond.node_name = L"cond"; + FillCond(oldCond, cond); + oCondLst.list.push_back(cond); + } +} + +void Timing_2010::FillEmptyTargetCond(PPTX::Logic::Cond &cond) +{ + cond.tgtEl = new PPTX::Logic::TgtEl; +} + +void Timing_2010::FillCTnProps(CRecordTimePropertyList4TimeNodeContainer *pProp, PPTX::Logic::CTn &oCTn) +{ + if (pProp == nullptr || pProp->m_bEmtyNode) + return; + for (auto *pRec : pProp->m_arrElements) + { + TimePropertyID4TimeNode VariableType = ( TimePropertyID4TimeNode ) pRec->m_oHeader.RecInstance; + + switch ( VariableType ) + { + case TL_TPID_Display: + { + oCTn.display = !(bool)dynamic_cast(pRec)->m_Value; + break; + } + case TL_TPID_MasterPos: + { + oCTn.masterRel = new PPTX::Limit::TLMasterRelation; + oCTn.masterRel = dynamic_cast(pRec)->m_Value ? + L"nextClick" : L"sameClick"; + break; + } + case TL_TPID_SubType: break; + case TL_TPID_EffectID: + { + oCTn.presetID = dynamic_cast(pRec)->m_Value; + break; + } + case TL_TPID_EffectDir: + { + oCTn.presetSubtype = dynamic_cast(pRec)->m_Value; + break; + } + case TL_TPID_EffectType: + { + // Write presetClass + std::wstring presetClass; + switch (dynamic_cast(pRec)->m_Value) { + case 0: break; + case 1: presetClass = L"entr"; break; + case 2: presetClass = L"exit"; break; + case 3: presetClass = L"emph"; break; + case 4: presetClass = L"path"; break; + case 5: presetClass = L"verb"; break; + case 6: presetClass = L"mediacall"; break; + } + if (!presetClass.empty()) + { + oCTn.presetClass = new PPTX::Limit::TLPresetClass; + oCTn.presetClass = presetClass; + } + break; + } + case TL_TPID_AfterEffect: + { + oCTn.afterEffect = (bool)dynamic_cast(pRec)->m_Value; + break; + } + case TL_TPID_SlideCount: break; + case TL_TPID_TimeFilter: + { + oCTn.tmFilter = dynamic_cast(pRec)->m_Value; + break; + } + case TL_TPID_EventFilter: + { + oCTn.evtFilter = dynamic_cast(pRec)->m_Value; + break; + } + case TL_TPID_HideWhenStopped: + break; + case TL_TPID_GroupID: + { + oCTn.grpId = dynamic_cast(pRec)->m_Value; + break; + } + case TL_TPID_EffectNodeType: + { + // Write nodeType + std::wstring nodeType; + switch (dynamic_cast(pRec)->m_Value) + { + case 1: nodeType = L"clickEffect"; break; + case 2: nodeType = L"withEffect"; break; + case 3: nodeType = L"afterEffect"; break; + case 4: nodeType = L"mainSeq"; break; + case 5: nodeType = L"interactiveSeq"; break; + case 6: nodeType = L"clickPar"; break; + case 7: nodeType = L"withGroup"; break; + case 8: nodeType = L"afterGroup"; break; + case 9: nodeType = L"tmRoot"; break; + } + if (!nodeType.empty()) + { + oCTn.nodeType = new PPTX::Limit::TLNodeType; + oCTn.nodeType = nodeType; + } + + break; + } + case TL_TPID_PlaceholderNode: + { + oCTn.nodePh = (bool)dynamic_cast(pRec)->m_Value; + break; + } + case TL_TPID_MediaVolume: + break; + case TL_TPID_MediaMute: + break; + case TL_TPID_ZoomToFullScreen: + break; + default : + break; + } + } +} + +void Timing_2010::FillCTnHeadArgs(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::CTn &oCTn) +{ + oCTn.id = cTnId++; + + // Reading TimeNodeAtom + const auto &oTimeNodeAtom = pETNC->m_oTimeNodeAtom; + + // Write restart + if (oTimeNodeAtom.m_fRestartProperty) + oCTn.restart = PPTX::Limit::TLRestart(oTimeNodeAtom.m_dwRestart) ; + + + // Write fill + if (oTimeNodeAtom.m_fFillProperty) + oCTn.fill = PPTX::Limit::TLNodeFillType(oTimeNodeAtom.m_dwFill); + + // Write dur + if (oTimeNodeAtom.m_fDurationProperty) + { + if (oTimeNodeAtom.m_nDuration == -1) + oCTn.dur = L"indefinite"; + else + oCTn.dur = std::to_wstring(oTimeNodeAtom.m_nDuration); + } + + if (pETNC->m_haveTimePropertyList && !pETNC->m_pTimePropertyList->m_bEmtyNode) + FillCTnProps(pETNC->m_pTimePropertyList, oCTn); + + if (cTNLevel == TimeNodeLevel::mainSeqOrTrigger) + isMainSeq = oCTn.nodeType.get_value_or(L"") == L"mainSeq"; + + if (!pETNC->m_haveSequenceAtom) + { + // Write stCondLst + if (pETNC->m_arrRgBeginTimeCondition.empty() == false) + { + oCTn.stCondLst = new PPTX::Logic::CondLst; + oCTn.stCondLst->node_name = L"stCondLst"; + } + for (auto *oldCond : pETNC->m_arrRgBeginTimeCondition) { + PPTX::Logic::Cond cond; + cond.node_name = L"cond"; + FillCond(oldCond, cond); + oCTn.stCondLst->list.push_back(cond); + } + + + // Write endCondLst + if (pETNC->m_arrRgEndTimeCondition.empty() == false) + { + oCTn.endCondLst = new PPTX::Logic::CondLst; + oCTn.endCondLst->node_name = L"endCondLst"; + FillCondLst(pETNC->m_arrRgEndTimeCondition, oCTn.endCondLst.get2()); + } + } +} + +void Timing_2010::FillAnimClr( + CRecordTimeColorBehaviorContainer *pColor, + CRecordTimePropertyList4TimeNodeContainer *pProp, + PPTX::Logic::AnimClr &oAnimClr) +{ + auto &clrAtom = pColor->m_oColorBehaviorAtom; + + FillCBhvr(&(pColor->m_oBehavior), oAnimClr.cBhvr); + FillCTnProps(pProp, oAnimClr.cBhvr.cTn); + + // Write Attributes + if (pColor->m_oBehavior.m_havePropertyList){ + for (auto pRec : pColor->m_oBehavior.m_pPropertyList->m_arRecords) + { + if (pRec->m_oHeader.RecInstance == TL_TBPID_ColorColorModel) + { + auto oTimeColorModel = dynamic_cast(pRec); + oAnimClr.clrSpc = new PPTX::Limit::TLColorSpace; + std::wstring clrSpc; + if (!clrAtom.m_fColorSpacePropertyUsed) clrSpc = L"rgb"; + else clrSpc = oTimeColorModel->m_Value ? L"hsl" : L"rgb"; + oAnimClr.clrSpc = clrSpc; + } + else if (pRec->m_oHeader.RecInstance == TL_TBPID_ColorDirection) + { + auto oTimeColorDirection = dynamic_cast(pRec); + oAnimClr.dir = new PPTX::Limit::TLColorDirection; + std::wstring dir; + if (!clrAtom.m_fDirectionPropertyUsed) dir = L"cw"; + else dir = oTimeColorDirection->m_Value ? L"ccw" : L"cw"; + oAnimClr.dir = dir; + } + } + } + + if (clrAtom.m_fByPropertyUsed) + { + if (clrAtom.m_sColorBy.model == 0) // RGB == 0 + { + oAnimClr.byR = clrAtom.m_sColorBy.component0; + oAnimClr.byG = clrAtom.m_sColorBy.component1; + oAnimClr.byB = clrAtom.m_sColorBy.component2; + } + else if (clrAtom.m_sColorBy.model == 1) // HSL == 1 + { + oAnimClr.byH = clrAtom.m_sColorBy.component0; + oAnimClr.byS = clrAtom.m_sColorBy.component1; + oAnimClr.byL = clrAtom.m_sColorBy.component2; + } + } + + if (clrAtom.m_fFromPropertyUsed) + { + oAnimClr.from = *new PPTX::Logic::UniColor; + if (clrAtom.m_sColorFrom.model == 0) + { + auto pSrgb = new PPTX::Logic::SrgbClr; + pSrgb->red = clrAtom.m_sColorFrom.component0; + pSrgb->green = clrAtom.m_sColorFrom.component1; + pSrgb->blue = clrAtom.m_sColorFrom.component2; + oAnimClr.from.Color = pSrgb; + } + else + { + auto pScheme = new PPTX::Logic::SchemeClr; + std::wstring strVal; + UINT index = clrAtom.m_sColorFrom.component0; + if (index >= 4 && index < 10) + { + strVal = L"accent" + std::to_wstring(index - 3); + } + pScheme->val = strVal; + oAnimClr.from.Color = pScheme; + } + } + + if (clrAtom.m_fToPropertyUsed) + { + oAnimClr.to = *new PPTX::Logic::UniColor; + if (clrAtom.m_sColorTo.model == 0) + { + auto pSrgb = new PPTX::Logic::SrgbClr; + pSrgb->red = clrAtom.m_sColorTo.component0; + pSrgb->green = clrAtom.m_sColorTo.component1; + pSrgb->blue = clrAtom.m_sColorTo.component2; + oAnimClr.to.Color = pSrgb; + } + else + { + auto pScheme = new PPTX::Logic::SchemeClr; + std::wstring strVal; + UINT index = clrAtom.m_sColorTo.component0; + if (index >= 4 && index < 10) + { + strVal = L"accent" + std::to_wstring(index - 3); + } + pScheme->val = strVal; + oAnimClr.to.Color = smart_ptr(pScheme); + } + } +} + +void Timing_2010::FillAnimEffect( + CRecordExtTimeNodeContainer *pETNC, + PPTX::Logic::AnimEffect &oAnim) +{ + auto *bhvr = pETNC->m_pTimeEffectBehavior; + oAnim.filter = bhvr->m_oVarType.m_Value; + + if (bhvr->m_effectBehaviorAtom.m_bProgressPropertyUsed) + { + if (!oAnim.progress.is_init()) + oAnim.progress = new PPTX::Logic::AnimVariant; + oAnim.progress->fltVal = bhvr->m_oVarProgress.m_Value; + } + + if (bhvr->m_effectBehaviorAtom.m_bRuntimeContextObsolete) + { + if (!oAnim.progress.is_init()) + oAnim.progress = new PPTX::Logic::AnimVariant; + oAnim.progress->strVal = bhvr->m_oVarRuntimeContext.m_Value; + } + + if (bhvr->m_effectBehaviorAtom.m_bTransitionPropertyUsed) + { + oAnim.transition = bhvr->m_effectBehaviorAtom.m_nEffectTransition ? + L"out" : L"in"; + } + + FillCBhvr(pETNC, oAnim.cBhvr); + +} + +void Timing_2010::FillAnimMotion( + CRecordExtTimeNodeContainer *pETNC, + PPTX::Logic::AnimMotion &oAnim) +{ + if (!pETNC || !pETNC->m_pTimeMotionBehavior) + return; + + auto pMotion = pETNC->m_pTimeMotionBehavior; + const auto& oAtom = pMotion->m_oMotionBehaviorAtom; + + FillCBhvr(pETNC, oAnim.cBhvr); + + if (oAtom.m_bFromPropertyUsed) + { + oAnim.fromX = oAtom.m_nXFROM; + oAnim.fromY = oAtom.m_nYFROM; + } + if (oAtom.m_bToPropertyUsed) + { + oAnim.toX = oAtom.m_nXTO; + oAnim.toY = oAtom.m_nYTO; + } + if (oAtom.m_bByPropertyUsed) + { + oAnim.byX = oAtom.m_nXBY; + oAnim.byY = oAtom.m_nYBY; + } + + if (oAtom.m_bOriginPropertyUsed) + { + oAnim.origin = new PPTX::Limit::TLOrigin; + oAnim.origin->set(oAtom.m_nBehaviorOrigin == 2 ? + L"layout" : L"parent"); + } + + if (!pMotion->m_pVarPath->m_Value.empty()) + oAnim.path = pMotion->m_pVarPath->m_Value; + + // oAnim.ptsTypes + + + oAnim.pathEditMode = new PPTX::Limit::TLPathEditMode; + oAnim.pathEditMode->set(oAtom.m_bEditRotationPropertyUsed ? L"fixed" : L"relative"); +} + +void Timing_2010::FillAnimRot( + CRecordExtTimeNodeContainer *pETNC, + PPTX::Logic::AnimRot &oAnim) +{ + if (!pETNC || !pETNC->m_pTimeRotationBehavior) return; + + auto pRot = pETNC->m_pTimeRotationBehavior; + const auto& oAtom = pRot->m_oRotationBehaviorAtom; + + FillCBhvr(pETNC, oAnim.cBhvr); + + const auto mult = 60000; + + if (oAtom.m_fByPropertyUsed) + oAnim.by = oAtom.m_By *mult; + if (oAtom.m_fToPropertyUsed) + oAnim.to = oAtom.m_To *mult; + if (oAtom.m_fFromPropertyUsed) + oAnim.from = oAtom.m_From *mult; + +} + +void Timing_2010::FillAnimScale( + CRecordExtTimeNodeContainer *pETNC, + PPTX::Logic::AnimScale &oAnim) +{ + if (!pETNC || !pETNC->m_pTimeScaleBehavior) return; + + auto pScale = pETNC->m_pTimeScaleBehavior; + const auto& oAtom = pScale->m_oScaleBehaviorAtom; + + FillCBhvr(pETNC, oAnim.cBhvr); + + const auto mult = 1000; + if (oAtom.m_fByPropertyUsed) + { + oAnim.byX = oAtom.m_XBy *mult; + oAnim.byY = oAtom.m_YBy *mult; + } + if (oAtom.m_fToPropertyUsed) + { + oAnim.toX = oAtom.m_XTo *mult; + oAnim.toY = oAtom.m_YTo *mult; + } + if (oAtom.m_fFromPropertyUsed) + { + oAnim.fromX = oAtom.m_XFrom *mult; + oAnim.fromY = oAtom.m_YFrom *mult; + } + + if (oAtom.m_fZoomContentsUsed) + oAnim.zoomContents = oAtom.m_fZoomContents; +} + + + +void Timing_2010::FillVideo( + CRecordExtTimeNodeContainer* pETNC, + PPTX::Logic::Video& oVideo) +{ + const auto& video = pETNC->m_pClientVisualElement->m_oVisualShapeAtom; + + FillCTnRecursive(pETNC, oVideo.cMediaNode.cTn); + + if (pETNC->m_pTimePropertyList->m_arrElements.size() >= 5) + { + try { + oVideo.cMediaNode.vol = (int)(static_cast + (pETNC->m_pTimePropertyList->m_arrElements[1])-> + m_Value * 100000); + oVideo.cMediaNode.mute = static_cast + (pETNC->m_pTimePropertyList->m_arrElements[2])-> + m_Value; + oVideo.fullScrn = static_cast + (pETNC->m_pTimePropertyList->m_arrElements[3])-> + m_Value; + oVideo.cMediaNode.showWhenStopped = static_cast + (pETNC->m_pTimePropertyList->m_arrElements[4])-> + m_Value; + } catch (...) { + + } + } + + + oVideo.cMediaNode.tgtEl.spTgt = new PPTX::Logic::SpTgt(); + oVideo.cMediaNode.tgtEl.spTgt->spid = std::to_wstring(video.m_nObjectIdRef); +} + +} +} diff --git a/MsBinaryFile/PptFile/Converter/Animation/Timing_2010.h b/MsBinaryFile/PptFile/Converter/Animation/Timing_2010.h new file mode 100644 index 0000000000..fa4e706358 --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/Animation/Timing_2010.h @@ -0,0 +1,144 @@ +#pragma once + +#include "../../PPTXWriter/ImageManager.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Timing.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Par.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Seq.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Audio.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimClr.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimEffect.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimMotion.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimRot.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/AnimScale.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Cmd.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Video.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Anim.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Set.h" + +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/BldP.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/BldDgm.h" +#include "../../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/BldOleChart.h" + +#include "../../Records/Animations/ParaBuildContainer.h" +#include "../../Records/Animations/ChartBuildContainer.h" +#include "../../Records/Animations/DiagramBuildContainer.h" + +#include "intermediate_anim.h" // it using + + +namespace PPT { +namespace Converter { +class Animation_2010; + +class Timing_2010 +{ +public: + Timing_2010(CRecordPP10SlideBinaryTagExtension* pAnim_2010, const std::unordered_set& shapesID); + void Convert(PPTX::Logic::Timing& timing, CExMedia* pExMedia, CRelsGenerator* pRels); + +public: + enum TimeNodeLevel { + zero, + root = 1, + mainSeqOrTrigger = 2, + eventOrClickGroup = 3, + parallelShow = 4, + oneAnim = 5, + animEffectDescription = 6 + }; + + +private: + void ConvertBldLst(PPTX::Logic::Timing& timimg, CRecordBuildListContainer *pBLC); + void InsertBuildNode(PPTX::Logic::BldLst &bldLst, PPTX::Logic::BuildNodeBase &bnb); + void InsertBldP(PPTX::Logic::BldLst &bldLst, PPTX::Logic::BuildNodeBase &bnb); + void FillBuildNodeBase(CRecordBuildListSubContainer* pSub, PPTX::Logic::BuildNodeBase &oBuildNodeBase); + void FillBldP(CRecordParaBuildContainer *pPBC, PPTX::Logic::BldP &oBP); + void FillBldOleChart(CRecordChartBuildContainer* pCBC, PPTX::Logic::BldOleChart &oBP); + void FillBldDgm(CRecordDiagramBuildContainer *pDBC, PPTX::Logic::BldDgm &oBP); + + void ConvertTnLst(PPTX::Logic::Timing &timing, CRecordExtTimeNodeContainer* pETNC); + bool FillTnChild(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::TimeNodeBase &oChild); + void FillSeq(PPT_FORMAT::CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::Seq& oSec); + void FillPar( + CRecordExtTimeNodeContainer *pETNC, + PPTX::Logic::Par &oPar); + void FillCBhvr( + CRecordExtTimeNodeContainer *pETNC, + PPTX::Logic::CBhvr &oBhvr); + void FillCBhvr( + CRecordTimeBehaviorContainer *pBhvr, + PPTX::Logic::CBhvr &oBhvr); + void FillCBhvr( + PPTX::Logic::CBhvr &oBhvr, int dur, + UINT spid, std::wstring attrname, int delay); + void FillSet( + PPT_FORMAT::CRecordExtTimeNodeContainer *pETNC, + PPTX::Logic::Set& oSet); + void FillAnim( + CRecordTimeAnimateBehaviorContainer *pTimeAnimateBehavior, + PPTX::Logic::Anim &oAnim); + + void FillCTnRecursive(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::CTn &oCTn); + bool CheckAnimation5Level(const CRecordExtTimeNodeContainer *pETNC, const PPTX::Logic::CTn &oCTn); + bool IsSlideSpId(_INT32 spid) const; + bool IsCorrectAnimationSpId(_INT32 spid) const; + void InsertAnimationSpId(_INT32 spid); + void ConvertChildTnLst(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::CTn &oCTn); + void ConvertCTnIterate(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::CTn &oCTn); + void ConvertCTnEndSync(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::CTn &oCTn); + void ConvertCTnSubTnLst(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::CTn &oCTn); + void ConvertCTnStCondLst(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::CTn &oCTn); + void FillCond(PPT_FORMAT::CRecordTimeConditionContainer *oldCond, PPTX::Logic::Cond &cond); + void FillStCondLst(const std::vector& timeCondCont, PPTX::Logic::CondLst& stCondLst); + void FillSubTnLst (std::vector &vecSEC, PPTX::Logic::TnLst &oSubTnLst); + void FillCondLst(std::vector& oCondVec, PPTX::Logic::CondLst &oCondLst); + void FillEmptyTargetCond(PPTX::Logic::Cond &cond); + void FillCTnProps(CRecordTimePropertyList4TimeNodeContainer *pProp, PPTX::Logic::CTn &oCTn); + void FillCTnHeadArgs(CRecordExtTimeNodeContainer *pETNC, PPTX::Logic::CTn &oCTn); + + + void FillAnimClr( + CRecordTimeColorBehaviorContainer *pColor, + CRecordTimePropertyList4TimeNodeContainer *pProp, + PPTX::Logic::AnimClr &oAnimClr); + void FillAnimEffect( + CRecordExtTimeNodeContainer *pETNC, + PPTX::Logic::AnimEffect &oAnim); + void FillAnimMotion( + CRecordExtTimeNodeContainer *pETNC, + PPTX::Logic::AnimMotion &oAnim); + void FillAnimRot( + CRecordExtTimeNodeContainer *pETNC, + PPTX::Logic::AnimRot &oAnim); + void FillAnimScale( + CRecordExtTimeNodeContainer *pETNC, + PPTX::Logic::AnimScale &oAnim); + void FillAudio(CRecordExtTimeNodeContainer *pETNC, + PPTX::Logic::Audio &oAudio); + void FillAudio(CRecordClientVisualElementContainer *pCVEC, + PPTX::Logic::Audio &oAudio); + void FillCmd( + CRecordExtTimeNodeContainer *pETNC, + PPTX::Logic::Cmd &oCmd); + void FillVideo( + CRecordExtTimeNodeContainer *pETNC, + PPTX::Logic::Video &oVideo); + +private: + CRecordPP10SlideBinaryTagExtension* pTagExtAnim = nullptr; + const std::unordered_set slideShapes; + std::unordered_set correctAnimatedShapes; + CExMedia *m_pExMedia = nullptr; + CRelsGenerator *m_pRels = nullptr; + bool isMainSeq = false; + + PPTX::Logic::BldLst *m_pBldLst = nullptr; // Do not delete + PPTX::Logic::BldP *m_currentBldP = nullptr; + + int cTnId = 1; + int cTNLevel = TimeNodeLevel::zero; +}; + +} +} diff --git a/MsBinaryFile/PptFile/Converter/Animation/hashcode10.cpp b/MsBinaryFile/PptFile/Converter/Animation/hashcode10.cpp new file mode 100644 index 0000000000..b03168a330 --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/Animation/hashcode10.cpp @@ -0,0 +1,93 @@ +#include "hashcode10.h" + + +namespace PPT { +namespace Converter { +std::array<_UINT32, HashCode10::RASize> HashCode10::InitRandomArray() +{ + std::array<_UINT32, 256*256> randomArray; + std::fill(randomArray.begin(), randomArray.end(), 0); + _UINT32 randomSeed = 1; + for (int iRow = 0; iRow < 256; iRow++) + for (int iCol = 0; iCol < 256; iCol++) + { + _UINT32 r0 = randomSeed; + _UINT32 r1 = ((r0 * 0x000343FD + 0x00269EC3) >> 16) & 0x00007FFF; + _UINT32 r2 = ((r1 * 0x000343FD + 0x00269EC3) >> 16) & 0x00007FFF; + _UINT32 r3 = ((r2 * 0x000343FD + 0x00269EC3) >> 16) & 0x00007FFF; + _UINT32 r4 = ((r3 * 0x000343FD + 0x00269EC3) >> 16) & 0x00007FFF; + randomSeed = r4; + r1 = (r1 % 0x100) << 0; + r2 = (r2 % 0x100) << 8; + r3 = (r3 % 0x100) << 16; + r4 = (r4 % 0x100) << 24; + randomArray[iRow*256+iCol] = r4 | r3 | r2 | r1; + } + + + return randomArray; +} + +_UINT32 HashCode10::GetHash1995(const std::vector& anim95) +{ + auto hashTabble = InitRandomArray(); + auto& randomArray = hashTabble; + _UINT32 hash = 0; + for (const auto& animInfoAtom : anim95) + { + std::array asByteArr{}; // {} - init 0 + if (animInfoAtom.anim != nullptr) + asByteArr = animInfoAtom.anim->m_AnimationAtom.asByteArr; + + const auto byteLen = 36; + const _UINT32 shapeId = animInfoAtom.shapeId; + for (int byteIndex = 0; byteIndex < byteLen; byteIndex++) + { + int rowIndex = (shapeId * (byteIndex + 1)) % 256; + hash ^= randomArray[rowIndex*256+asByteArr[byteIndex]]; + } + + } + + return hash; +} + +std::vector HashCode10::MergeSlideShapesWithAnim95Struct(const std::vector &vecAnim95, std::unordered_set<_INT32> sldShapesID) +{ + std::vector merged; + for (const auto& anim : vecAnim95) + { + merged.push_back(anim); + auto iter = sldShapesID.find(anim.shapeId); + if (iter != sldShapesID.end()) + sldShapesID.erase(iter); + } + for (const auto& spid : sldShapesID) + { + Intermediate::SOldAnimation emptyAnim; + emptyAnim.shapeId = spid; + merged.push_back(emptyAnim); + } + + return merged; +} + +_UINT32 HashCode10::GetWroteHash(CRecordPP10SlideBinaryTagExtension *pTagExt) +{ + return pTagExt->m_pHashCode10Atom->m_nHash; +} + +bool HashCode10::IsValidHash(const Intermediate::SlideAnimation &sldAnim) const +{ + if (sldAnim.pAnim_2010 == nullptr || sldAnim.pAnim_2010->m_haveHashCode == false || sldAnim.pAnim_2010->m_pHashCode10Atom == nullptr) + return false; + + auto wroteHash = GetWroteHash(sldAnim.pAnim_2010); + auto calculatedHash = GetHash1995( + MergeSlideShapesWithAnim95Struct(sldAnim.arrAnim_1995, sldAnim.realShapesIds)); + + return wroteHash == calculatedHash; +} + +} +} diff --git a/MsBinaryFile/PptFile/Converter/Animation/hashcode10.h b/MsBinaryFile/PptFile/Converter/Animation/hashcode10.h new file mode 100644 index 0000000000..89437db927 --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/Animation/hashcode10.h @@ -0,0 +1,24 @@ +#pragma once + +#include "intermediate_anim.h" + +namespace PPT { +namespace Converter { + +// I couldn't calculate simplest correct hash. Not correct now +class HashCode10 +{ +public: + HashCode10(){}; + bool IsValidHash(const Intermediate::SlideAnimation& sldAnim)const; + +private: + // 1995 hash + static constexpr size_t RASize = 256*256; // row * col + static std::array<_UINT32, RASize> InitRandomArray(); + static _UINT32 GetHash1995(const std::vector& anim95); + static std::vector MergeSlideShapesWithAnim95Struct(const std::vector& vecAnim95, std::unordered_set<_INT32> sldShapesID); + static _UINT32 GetWroteHash(CRecordPP10SlideBinaryTagExtension* pTagExt); +}; +} +} diff --git a/MsBinaryFile/PptFile/Converter/Animation/intermediate_anim.cpp b/MsBinaryFile/PptFile/Converter/Animation/intermediate_anim.cpp new file mode 100644 index 0000000000..1304b74340 --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/Animation/intermediate_anim.cpp @@ -0,0 +1,29 @@ +#include "intermediate_anim.h" + + +_UINT32 PPT::Intermediate::SOldAnimation::getAnimDur() const +{ + _UINT32 dur = 500; + if (!anim) + return 0; + + const BYTE effect = anim->m_AnimationAtom.m_AnimEffect; + const BYTE direct = anim->m_AnimationAtom.m_AnimEffectDirection; + + if (effect == 12 && ((direct >= 12 && direct <= 15) || direct == 27)) // Crawl In, Basic Swivel + dur = 5000; + else if (effect == 12 && direct == 28) + dur = 1000; + else if (effect == 14) + { + switch (direct) + { + case 0: dur = 75; break; + case 1: dur = 500; break; + case 2: dur = 1000; break; + } + } else if (effect == 19 || effect == 26) + dur = 2000; + + return dur; +} diff --git a/MsBinaryFile/PptFile/Converter/Animation/intermediate_anim.h b/MsBinaryFile/PptFile/Converter/Animation/intermediate_anim.h new file mode 100644 index 0000000000..79fd2229f9 --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/Animation/intermediate_anim.h @@ -0,0 +1,44 @@ +#pragma once + +#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Timing.h" + +#include "../Records/SlideProgTagsContainer.h" +#include "../PPTXWriter/ImageManager.h" +#include "../Records/Animations/AnimationInfoContainer.h" +#include + + +namespace PPT { +namespace Intermediate { +struct SValue +{ + enum + { + str, + dbl + }; + SValue(const std::wstring& str) : strVal(str), type(SValue::str) {} + SValue(const wchar_t* str) : strVal(str), type(SValue::str) {} + SValue(const double& dbl) : dblVal(dbl), type(SValue::dbl) {} + + std::wstring strVal; + double dblVal; + const int type; +}; + +struct SOldAnimation +{ + _INT32 shapeId; + CRecordAnimationInfoContainer* anim; + + _UINT32 getAnimDur() const; +}; + +struct SlideAnimation +{ + CRecordPP10SlideBinaryTagExtension* pAnim_2010 = nullptr; + std::vector arrAnim_1995; + std::unordered_set<_INT32> realShapesIds; +}; +} +} diff --git a/MsBinaryFile/PptFile/Converter/timing.cpp b/MsBinaryFile/PptFile/Converter/timing.cpp new file mode 100644 index 0000000000..02534005d9 --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/timing.cpp @@ -0,0 +1,67 @@ +#include "timing.h" + +#include "Animation/intermediate_anim.h" +#include "Animation/Timing_1995.h" +#include "Animation/Timing_2010.h" +#include "Animation/TimingExeption.h" +#include "Animation/hashcode10.h" // not work correct + + +using namespace PPT::Converter; + +Timing::Timing(const Intermediate::SlideAnimation& slideAnim, const std::unordered_set &shapesID) : + slideAnim(slideAnim), + shapesID(shapesID) +{} + +PPTX::Logic::Timing Timing::Convert(CExMedia *pExMedia, CRelsGenerator *pRels) +{ + this->pExMedia = pExMedia; + this->pRels = pRels; + + if (TryToConvertTiming2010() == false) + if (TryToConvertTiming1995() == false) + return {}; + + if (timing.bldLst.IsInit() && timing.bldLst->list.empty()) // You can't leave an empty tag + timing.bldLst.reset(); + + return std::move(timing); +} + +bool Timing::HasAnimation() const +{ + if (slideAnim.arrAnim_1995.empty() && (slideAnim.pAnim_2010 == nullptr || slideAnim.pAnim_2010->m_haveExtTime == false)) + return false; + else + return true; +} + +bool Timing::TryToConvertTiming2010() +{ + timing = PPTX::Logic::Timing(); + try { + Timing_2010(slideAnim.pAnim_2010, shapesID). + Convert(timing, pExMedia, pRels); + } catch (const TimingExeption &ex) { + return false; + } catch (...) { + return false; + } + return true; +} + +bool Timing::TryToConvertTiming1995() +{ + timing = PPTX::Logic::Timing(); + try { + Timing_1995(slideAnim.arrAnim_1995). + Convert(timing, pExMedia, pRels); + } catch (const TimingExeption &ex) { + return false; + } catch (...) { + return false; + } + return true; +} + diff --git a/MsBinaryFile/PptFile/Converter/timing.h b/MsBinaryFile/PptFile/Converter/timing.h new file mode 100644 index 0000000000..5065d012c1 --- /dev/null +++ b/MsBinaryFile/PptFile/Converter/timing.h @@ -0,0 +1,30 @@ +#pragma once + +#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Timing/Timing.h" +#include "../PPTXWriter/ImageManager.h" +#include "Animation/intermediate_anim.h" + + +namespace PPT { +namespace Converter { +class Timing +{ +public: + Timing(const Intermediate::SlideAnimation& slideAnim, const std::unordered_set& shapesID); + PPTX::Logic::Timing Convert(CExMedia* pExMedia, CRelsGenerator *pRels); + + bool HasAnimation() const; + +private: + bool TryToConvertTiming2010(); + bool TryToConvertTiming1995(); + +private: + const Intermediate::SlideAnimation& slideAnim; + CExMedia* pExMedia; + CRelsGenerator* pRels; + const std::unordered_set shapesID; + PPTX::Logic::Timing timing; +}; +} +} diff --git a/MsBinaryFile/PptFile/Converter/transition.cpp b/MsBinaryFile/PptFile/Converter/transition.cpp index 14fb093390..03f862f728 100644 --- a/MsBinaryFile/PptFile/Converter/transition.cpp +++ b/MsBinaryFile/PptFile/Converter/transition.cpp @@ -1,47 +1,16 @@ -/* -* (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 "transition.h" -#include "../../../OOXML/PPTXFormat/Logic/Transitions/Transition.h" -#include "../../../OOXML/PPTXFormat/Logic/Transitions/TransitionBase.h" -#include "../../../OOXML/PPTXFormat/Logic/Transitions/EmptyTransition.h" -#include "../../../OOXML/PPTXFormat/Logic/Transitions/OrientationTransition.h" -#include "../../../OOXML/PPTXFormat/Logic/Transitions/EightDirectionTransition.h" -#include "../../../OOXML/PPTXFormat/Logic/Transitions/OptionalBlackTransition.h" -#include "../../../OOXML/PPTXFormat/Logic/Transitions/SideDirectionTransition.h" -#include "../../../OOXML/PPTXFormat/Logic/Transitions/CornerDirectionTransition.h" -#include "../../../OOXML/PPTXFormat/Logic/Transitions/WheelTransition.h" -#include "../../../OOXML/PPTXFormat/Logic/Transitions/SplitTransition.h" -#include "../../../OOXML/PPTXFormat/Logic/Transitions/ZoomTransition.h" +#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/Transition.h" +#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/TransitionBase.h" +#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/EmptyTransition.h" +#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/OrientationTransition.h" +#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/EightDirectionTransition.h" +#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/OptionalBlackTransition.h" +#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/SideDirectionTransition.h" +#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/CornerDirectionTransition.h" +#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/WheelTransition.h" +#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/SplitTransition.h" +#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Transitions/ZoomTransition.h" using namespace PPT::Converter; @@ -67,7 +36,7 @@ PPTX::Logic::Transition Transition::Convert() void Transition::ConvertClick() { - if (slideShowInfo.m_bAdvClick == false) + if (slideShowInfo.m_bManulClick == false) newTransition.advClick = false; } diff --git a/MsBinaryFile/PptFile/PPTXWriter/Converter.cpp b/MsBinaryFile/PptFile/PPTXWriter/Converter.cpp index 8aab14704e..6578899484 100644 --- a/MsBinaryFile/PptFile/PPTXWriter/Converter.cpp +++ b/MsBinaryFile/PptFile/PPTXWriter/Converter.cpp @@ -31,14 +31,14 @@ */ #pragma once -#include "../Drawing/Document.h" +#include "../../../ASCOfficePPTXFile/Editor/Drawing/Document.h" -#include "../../../OOXML/Binary/Presentation/DefaultNotesMaster.h" -#include "../../../OOXML/Binary/Presentation/DefaultNotesTheme.h" +#include "../../../ASCOfficePPTXFile/Editor/DefaultNotesMaster.h" +#include "../../../ASCOfficePPTXFile/Editor/DefaultNotesTheme.h" -#include "../../../OOXML/PPTXFormat/NotesMaster.h" -#include "../../../OOXML/PPTXFormat/SlideMaster.h" -#include "../../../OOXML/PPTXFormat/HandoutMaster.h" +#include "../../../ASCOfficePPTXFile/PPTXFormat/NotesMaster.h" +#include "../../../ASCOfficePPTXFile/PPTXFormat/SlideMaster.h" +#include "../../../ASCOfficePPTXFile/PPTXFormat/HandoutMaster.h" #include "TableWriter.h" #include "../Reader/PPTDocumentInfo.h" @@ -47,10 +47,11 @@ #include "StylesWriter.h" #include "Converter.h" -#include "Animation.h" +#include "../Converter/timing.h" +#include "../Converter/Animation/AnimationParser.h" #include "../Converter/transition.h" -#include "../../Common/Utils/simple_xml_writer.h" +#include "../../../ASCOfficeXlsFile2/source/Common/simple_xml_writer.h" #include "../Reader/RoundTripExtractor.h" #include "../../../DesktopEditor/common/Directory.h" @@ -59,8 +60,6 @@ #include #include -#include "../../../OOXML/SystemUtility/File.h" - typedef boost::uuids::detail::md5 MD5; namespace PPT_FORMAT @@ -718,7 +717,7 @@ bool CPPTXWriter::WriteRoundTripTheme(const CRecordSlide *pSlide, std::unordered // compare hash char* pointerToThemeElems = strstr((char*)utf8Data, ""); UINT hashShift = pointerToThemeElems ? pointerToThemeElems - (char*)utf8Data : 0; - auto strHash = StreamUtils::md5(utf8Data+hashShift, utf8DataSize-hashShift); + auto strHash = CFile::md5(utf8Data+hashShift, utf8DataSize-hashShift); needRels = (int)std::string(utf8Data, utf8Data + utf8DataSize).find("rId") != -1; @@ -1287,29 +1286,29 @@ void PPT_FORMAT::CPPTXWriter::WriteColorScheme(CStringWriter& oStringWriter, con oStringWriter.WriteStringXML(name); oStringWriter.WriteString(L"\">"); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); oStringWriter.WriteString(L""); if (extra) @@ -1534,7 +1533,7 @@ void PPT_FORMAT::CPPTXWriter::WriteSlide(int nIndexSlide) CGroupElement *pGroupElement = !pSlide->m_arElements.empty() ? dynamic_cast(pSlide->m_arElements[0].get()) : NULL; size_t start_index = 0; - std::unordered_set realShapesId; + std::unordered_set realShapesId; // todo Wrap in context when code is restructured if (pGroupElement) { @@ -1564,7 +1563,7 @@ void PPT_FORMAT::CPPTXWriter::WriteSlide(int nIndexSlide) WriteTransition(oWriter, pSlide->m_oSlideShow); // TODO write new method and class for timing - WriteTiming(oWriter, oRels, realShapesId, nIndexSlide); + WriteTiming(oWriter, oRels, nIndexSlide, realShapesId); oWriter.WriteString(std::wstring(L"")); @@ -1860,42 +1859,15 @@ void CPPTXWriter::WriteLayoutAfterTheme(CThemePtr pTheme, const int nIndexTheme, } -void PPT_FORMAT::CPPTXWriter::WriteTiming(CStringWriter& oWriter, CRelsGenerator &oRels, const std::unordered_set& realShapesId, int nIndexSlide) +void PPT_FORMAT::CPPTXWriter::WriteTiming(CStringWriter& oWriter, CRelsGenerator &oRels, int nIndexSlide, const std::unordered_set& shapesID) { - PPTX::Logic::Timing oTiming; - auto slide_iter = m_pUserInfo->m_mapSlides.find(m_pUserInfo->m_arrSlidesOrder[nIndexSlide]); - // This part for new animation - CRecordSlideProgTagsContainer* progTag = slide_iter->second->m_pSlideProgTagsContainer; - CRecordPP10SlideBinaryTagExtension* pPP10SlideBinaryTag = progTag ? progTag->getPP10SlideBinaryTagExtension() : NULL; - // This part for old animation - std::vector arrShapeCont; - slide_iter->second->GetRecordsByType(&arrShapeCont, true); - std::vector arrOldAnim; - for (auto ShapeCont : arrShapeCont) - { - SOldAnimation oldAnim; - std::vector shape; - ShapeCont->GetRecordsByType(&shape, true); - std::vector anim; - ShapeCont->GetRecordsByType(&anim, true); - if (!anim.empty() && !shape.empty()) - { - oldAnim.shapeId = shape[0]->m_nID; - oldAnim.anim = anim[0]; - arrOldAnim.push_back(oldAnim); - } - } - - if (/*!pPP10SlideBinaryTag && */arrOldAnim.empty()) // todo check condition - return; - - Animation animation(pPP10SlideBinaryTag, arrOldAnim, &(m_pUserInfo->m_oExMedia), &oRels, realShapesId); - - animation.Convert(oTiming); - oWriter.WriteString(oTiming.toXML()); - //oWriter.WriteString(std::wstring(L"")); - + auto intermediateSlideAnimation = PPT::Intermediate::ParseSlideAnimation(slide_iter->second); + intermediateSlideAnimation.realShapesIds = shapesID; + auto timing = + PPT::Converter::Timing(intermediateSlideAnimation, shapesID). + Convert(&(m_pUserInfo->m_oExMedia), &oRels); + oWriter.WriteString(timing.toXML()); } std::vector PPT_FORMAT::CPPTXWriter::GrepPaths(const std::vector &paths, const std::wstring &strRegEx) diff --git a/MsBinaryFile/PptFile/PPTXWriter/Converter.h b/MsBinaryFile/PptFile/PPTXWriter/Converter.h index 000dd719f4..508779c945 100644 --- a/MsBinaryFile/PptFile/PPTXWriter/Converter.h +++ b/MsBinaryFile/PptFile/PPTXWriter/Converter.h @@ -89,7 +89,7 @@ namespace PPT_FORMAT // void WriteRelsMaster (std::wstring path, int type, ) void WriteSlide (int nIndexSlide); void WriteNotes (int nIndexNotes); - void WriteTiming (CStringWriter& oWriter, CRelsGenerator &oRels, const std::unordered_set &realShapesId, int nIndexSlide); + void WriteTiming (CStringWriter& oWriter, CRelsGenerator &oRels, int nIndexSlide, const std::unordered_set& shapesID); void WriteTransition (CStringWriter& oWriter, CSlideShowInfo& oSSInfo); void WriteColorScheme (CStringWriter& oWriter, const std::wstring & name, const std::vector & colors, bool extra = false); diff --git a/MsBinaryFile/PptFile/Reader/ExtXmlUtils.hpp b/MsBinaryFile/PptFile/Reader/ExtXmlUtils.hpp new file mode 100644 index 0000000000..e1e63c4e12 --- /dev/null +++ b/MsBinaryFile/PptFile/Reader/ExtXmlUtils.hpp @@ -0,0 +1,46 @@ +#pragma once + +#include +#include +#include + + +namespace XmlUtils { +std::vector FindAttrValues(const std::wstring& xml, std::wstring attrName) +{ + attrName += L"=\""; + std::vector values; + size_t posBeg = xml.find(attrName); + auto endTagPos = posBeg + attrName.size(); + size_t posEnd = xml.find(L"\"", endTagPos); + + // Repeat till end is reached + while( posBeg != std::string::npos) + { + auto strValue = xml.substr(endTagPos, posEnd - (endTagPos)); + values.push_back(strValue); + + // Get the next occurrence from the current position + posBeg = xml.find(attrName, endTagPos); + endTagPos = posBeg + attrName.size(); + posEnd = xml.find(L"\"", endTagPos); + } + return values; +} + +std::vector FindAttrValuesInt(const std::wstring& xml, std::wstring attrName) +{ + auto vecStrValues = FindAttrValues(xml, attrName); + std::vector vecIntValues; + for (const auto& strValue : vecStrValues) + { + try { + vecIntValues.push_back(std::stoi(strValue)); + } catch (...) { + } + } + return vecIntValues; +} + +} + diff --git a/MsBinaryFile/PptFile/Reader/Records.cpp b/MsBinaryFile/PptFile/Reader/Records.cpp index 7d43a76034..cd19c9714c 100644 --- a/MsBinaryFile/PptFile/Reader/Records.cpp +++ b/MsBinaryFile/PptFile/Reader/Records.cpp @@ -454,7 +454,7 @@ IRecord* CreateByType(SRecordHeader oHeader) CREATE_BY_TYPE(RT_HashCodeAtom, CRecordHashCode10Atom) CREATE_BY_TYPE(RT_BuildList, CRecordBuildListContainer) CREATE_BY_TYPE(RT_ParaBuild, CRecordParaBuildContainer) - CREATE_BY_TYPE(RT_ChartBuild, CRecordChartBuildContainer) + CREATE_BY_TYPE(RT_ChartBuild, CRecordDiagramBuildAtom) CREATE_BY_TYPE(RT_DiagramBuild, CRecordDiagramBuildContainer) CREATE_BY_TYPE(RT_ParaBuildAtom, CRecordParaBuildAtom) CREATE_BY_TYPE(RT_LevelInfoAtom, CRecordLevelInfoAtom) diff --git a/MsBinaryFile/PptFile/Records/Animations/AnimationInfoAtom.h b/MsBinaryFile/PptFile/Records/Animations/AnimationInfoAtom.h index 0fc9eb1579..3c0da55311 100644 --- a/MsBinaryFile/PptFile/Records/Animations/AnimationInfoAtom.h +++ b/MsBinaryFile/PptFile/Records/Animations/AnimationInfoAtom.h @@ -32,7 +32,7 @@ #pragma once -#include "../../Reader/Records.h" +#include "../Reader/Records.h" #include "../../Structures/ColorIndexStruct.h" namespace PPT_FORMAT @@ -87,6 +87,8 @@ public: BYTE m_AnimAfterEffect; BYTE m_TextBuildSubEffect; BYTE m_OleVerb; + + std::array asByteArr{}; public: CRecordAnimationInfoAtom() @@ -132,8 +134,11 @@ public: 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/BuildListContainer.h b/MsBinaryFile/PptFile/Records/Animations/BuildListContainer.h index 8db69409a6..94ea6e4c0d 100644 --- a/MsBinaryFile/PptFile/Records/Animations/BuildListContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/BuildListContainer.h @@ -32,53 +32,14 @@ #pragma once -#include "../../Reader/Records.h" +#include "../Reader/Records.h" #include "ParaBuildContainer.h" +#include "BuildListSubContainer.h" namespace PPT_FORMAT { -class CRecordBuildListContainer : public CUnknownRecord +class CRecordBuildListContainer : public CRecordsContainer { -public: - - CRecordBuildListContainer () - { - - } - - virtual ~CRecordBuildListContainer() - { - for ( size_t i = 0; i < n_arrRgChildRec.size(); ++i ) - RELEASEOBJECT (n_arrRgChildRec[i]); - } - - 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; - - IRecord* pBuildListSubContainer = CreateByType(ReadHeader); - pBuildListSubContainer->ReadFromStream(ReadHeader, pStream); - - n_arrRgChildRec.push_back(pBuildListSubContainer); - } - - StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); - } -public: - std::vector n_arrRgChildRec; }; } diff --git a/MsBinaryFile/PptFile/Records/Animations/BuildListSubContainer.h b/MsBinaryFile/PptFile/Records/Animations/BuildListSubContainer.h new file mode 100644 index 0000000000..c82f6daede --- /dev/null +++ b/MsBinaryFile/PptFile/Records/Animations/BuildListSubContainer.h @@ -0,0 +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 + * + */ +#pragma once + + +#include "../Reader/Records.h" +#include "BuildAtom.h" +#include "ChartBuildAtom.h" + +namespace PPT_FORMAT +{ +class CRecordBuildListSubContainer : public CUnknownRecord +{ +public: + CRecordBuildListSubContainer() + { + + } + + ~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/ChartBuildContainer.h b/MsBinaryFile/PptFile/Records/Animations/ChartBuildContainer.h index de90171fd9..c75d27df9a 100644 --- a/MsBinaryFile/PptFile/Records/Animations/ChartBuildContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/ChartBuildContainer.h @@ -32,13 +32,11 @@ #pragma once -#include "../../Reader/Records.h" -#include "BuildAtom.h" -#include "ChartBuildAtom.h" +#include "BuildListSubContainer.h" namespace PPT_FORMAT { -class CRecordChartBuildContainer : public CUnknownRecord +class CRecordChartBuildContainer : public CRecordBuildListSubContainer { public: CRecordChartBuildContainer() @@ -51,22 +49,16 @@ public: } - void ReadFromStream(SRecordHeader &thisHeader, POLE::Stream *pStream) override + void ReadFromStream(SRecordHeader &header, POLE::Stream *pStream) override { - m_oHeader = thisHeader; - - - SRecordHeader oHeader; - if (oHeader.ReadFromStream(pStream)) - m_oBuildAtom.ReadFromStream ( oHeader, pStream ); - - if (oHeader.ReadFromStream(pStream)) - m_oChartBuildAtom.ReadFromStream ( oHeader, pStream ); + CRecordBuildListSubContainer::ReadFromStream(header, pStream); + SRecordHeader childHeader; + if (childHeader.ReadFromStream(pStream)) + m_oChartBuildAtom.ReadFromStream ( childHeader, pStream ); } public: - CRecordBuildAtom m_oBuildAtom; CRecordChartBuildAtom m_oChartBuildAtom; }; } diff --git a/MsBinaryFile/PptFile/Records/Animations/DiagramBuildContainer.h b/MsBinaryFile/PptFile/Records/Animations/DiagramBuildContainer.h index 60b7837c8a..7333b02535 100644 --- a/MsBinaryFile/PptFile/Records/Animations/DiagramBuildContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/DiagramBuildContainer.h @@ -32,14 +32,13 @@ #pragma once -#include "../../Reader/Records.h" -#include "BuildAtom.h" +#include "BuildListSubContainer.h" #include "DiagramBuildAtom.h" namespace PPT_FORMAT { -class CRecordDiagramBuildContainer : public CUnknownRecord +class CRecordDiagramBuildContainer : public CRecordBuildListSubContainer { public: CRecordDiagramBuildContainer() @@ -52,22 +51,17 @@ public: } - void ReadFromStream(SRecordHeader &thisHeader, POLE::Stream *pStream) override + void ReadFromStream(SRecordHeader &header, POLE::Stream *pStream) override { - m_oHeader = thisHeader; + CRecordBuildListSubContainer::ReadFromStream(header, pStream); + SRecordHeader diagramBuildAtomHeader; - SRecordHeader oHeader; - if (oHeader.ReadFromStream(pStream)) - m_oBuildAtom.ReadFromStream ( oHeader, pStream ); - - if (oHeader.ReadFromStream(pStream)) - m_oDiagramBuildAtom.ReadFromStream ( oHeader, pStream ); - + if (diagramBuildAtomHeader.ReadFromStream(pStream)) + m_oDiagramBuildAtom.ReadFromStream (diagramBuildAtomHeader, pStream); } public: - CRecordBuildAtom m_oBuildAtom; CRecordDiagramBuildAtom m_oDiagramBuildAtom; }; } diff --git a/MsBinaryFile/PptFile/Records/Animations/ParaBuildContainer.h b/MsBinaryFile/PptFile/Records/Animations/ParaBuildContainer.h index 9b765b9922..9148900dd6 100644 --- a/MsBinaryFile/PptFile/Records/Animations/ParaBuildContainer.h +++ b/MsBinaryFile/PptFile/Records/Animations/ParaBuildContainer.h @@ -32,14 +32,13 @@ #pragma once -#include "../../Reader/Records.h" +#include "BuildListSubContainer.h" #include "ParaBuildLevel.h" -#include "BuildAtom.h" #include "ParaBuildAtom.h" namespace PPT_FORMAT { -class CRecordParaBuildContainer : public CUnknownRecord +class CRecordParaBuildContainer : public CRecordBuildListSubContainer { public: @@ -50,49 +49,38 @@ public: virtual ~CRecordParaBuildContainer() { - for ( size_t i = 0; i < m_arrRgParaBuildLevel.size(); ++i ) - RELEASEOBJECT (m_arrRgParaBuildLevel[i]); } - virtual void ReadFromStream ( SRecordHeader & thisHeader, POLE::Stream* pStream ) + virtual void ReadFromStream ( SRecordHeader & header, POLE::Stream* pStream ) override { - m_oHeader = thisHeader; - LONG lPos(0); StreamUtils::StreamPosition(lPos, pStream); - UINT lCurLen = 0; - SRecordHeader oHeader; -// UINT res = 0; + CRecordBuildListSubContainer::ReadFromStream(header, pStream); - if (oHeader.ReadFromStream(pStream)){ - m_oBuildAtom.ReadFromStream ( oHeader, pStream ); - lCurLen += oHeader.RecLen + 8; - } + UINT lCurLen = buildAtom.m_oHeader.RecLen + 8 + 24; // BuildAtom - 24 - if (oHeader.ReadFromStream(pStream)) + + SRecordHeader paraBuildAtomHeader; + if (paraBuildAtomHeader.ReadFromStream(pStream)) { - m_oParaBuildAtom.ReadFromStream ( oHeader, pStream ); - lCurLen += oHeader.RecLen + 8; + m_oParaBuildAtom.ReadFromStream ( paraBuildAtomHeader, pStream ); + lCurLen += paraBuildAtomHeader.RecLen + 8; } - // TODO may not work + while (lCurLen < m_oHeader.RecLen ) + { + CRecordParaBuildLevel buildLevel; + buildLevel.ReadFromStream(pStream); + rgParaBuildLevel.push_back(buildLevel); - SRecordHeader ReadHeader; - - while ( lCurLen < m_oHeader.RecLen ) { - CRecordParaBuildLevel* pLevel = new CRecordParaBuildLevel(); - pLevel->ReadFromStream(pStream); - - m_arrRgParaBuildLevel.push_back(pLevel); - - lCurLen += pLevel->getRecordLen(); + lCurLen += buildLevel.getRecordLen(); } + StreamUtils::StreamSeek(lPos + m_oHeader.RecLen, pStream); } -public: - CRecordBuildAtom m_oBuildAtom; - CRecordParaBuildAtom m_oParaBuildAtom; - std::vector m_arrRgParaBuildLevel; +public: + CRecordParaBuildAtom m_oParaBuildAtom; + std::vector rgParaBuildLevel; }; } diff --git a/MsBinaryFile/Projects/PPTFormatLib/Linux/PPTFormatLib.pro b/MsBinaryFile/Projects/PPTFormatLib/Linux/PPTFormatLib.pro index 0f38cdd98d..7393fa17cb 100644 --- a/MsBinaryFile/Projects/PPTFormatLib/Linux/PPTFormatLib.pro +++ b/MsBinaryFile/Projects/PPTFormatLib/Linux/PPTFormatLib.pro @@ -28,16 +28,26 @@ DEFINES += UNICODE \ HEADERS += \ ../../../PptFile/Main/PPTFormatLib.h \ + ../../../PptFile/Converter/Animation/AnimationParser.h \ + ../../../PptFile/Converter/Animation/Animation_1995.h \ + ../../../PptFile/Converter/Animation/TimingExeption.h \ + ../../../PptFile/Converter/Animation/TimingUtils.h \ + ../../../PptFile/Converter/Animation/Timing_1995.h \ + ../../../PptFile/Converter/Animation/Timing_2010.h \ + ../../../PptFile/Converter/Animation/hashcode10.h \ + ../../../PptFile/Converter/Animation/intermediate_anim.h \ + ../../../PptFile/Converter/timing.h \ ../../../PptFile/Converter/transition.h \ ../../../PptFile/Enums/RecordType.h \ ../../../PptFile/Enums/_includer.h \ ../../../PptFile/Enums/enums.h \ - ../../../PptFile/PPTXWriter/Animation.h \ + ../../../PptFile/PPTFormatLib.h \ ../../../PptFile/PPTXWriter/BulletsConverter.h \ ../../../PptFile/PPTXWriter/TableWriter.h \ ../../../PptFile/PPTXWriter/TxBodyConverter.h \ ../../../PptFile/Reader/ClassesAtom.h \ ../../../PptFile/Reader/CommonZLib.h \ + ../../../PptFile/Reader/ExtXmlUtils.hpp \ ../../../PptFile/Reader/PPTDocumentInfo.h \ ../../../PptFile/Reader/PPTDocumentInfoOneUser.h \ ../../../PptFile/Reader/PPTFileDefines.h \ @@ -52,6 +62,7 @@ HEADERS += \ ../../../PptFile/Records/Animations/AnimationInfoContainer.h \ ../../../PptFile/Records/Animations/BuildAtom.h \ ../../../PptFile/Records/Animations/BuildListContainer.h \ + ../../../PptFile/Records/Animations/BuildListSubContainer.h \ ../../../PptFile/Records/Animations/ChartBuildAtom.h \ ../../../PptFile/Records/Animations/ChartBuildContainer.h \ ../../../PptFile/Records/Animations/ClientVisualElementContainer.h \ @@ -265,8 +276,7 @@ HEADERS += \ ../../../PptFile/Structures/SmallRectStruct.h \ ../../../PptFile/Structures/TmsfTimeStruct.h \ ../../../PptFile/Structures/WideColorStruct.h \ - ../../../PptFile/Structures/_includer.h \ - ../../../../Common/3dParty/pole/pole.h + ../../../PptFile/Structures/_includer.h core_release { SOURCES += \ @@ -275,6 +285,7 @@ SOURCES += \ core_debug { SOURCES += \ + ../../../PptFile/Enums/RecordType.cpp \ ../../../PptFile/Enums/RecordType.cpp \ ../../../PptFile/Reader/ReadStructures.cpp \ ../../../PptFile/Reader/RoundTripExtractor.cpp \ @@ -284,19 +295,26 @@ SOURCES += \ ../../../PptFile/Reader/SlidePersist.cpp \ ../../../PptFile/PPTXWriter/Converter.cpp \ ../../../PptFile/PPTXWriter/ShapeWriter.cpp \ - ../../../PptFile/PPTXWriter/Animation.cpp \ ../../../PptFile/PPTXWriter/TableWriter.cpp \ ../../../PptFile/PPTXWriter/TxBodyConverter.cpp \ ../../../PptFile/Records/Drawing/ArtBlip.cpp \ ../../../PptFile/Records/Drawing/ShapeContainer.cpp \ ../../../PptFile/Records/Animations/TimeVariant.cpp \ - ../../../PptFile/Records/BlipEntityAtom.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 \ + ../../../PptFile/Converter/Animation/Timing_2010.cpp \ + ../../../PptFile/Converter/Animation/hashcode10.cpp \ + ../../../PptFile/Converter/Animation/intermediate_anim.cpp \ + ../../../PptFile/Converter/timing.cpp \ + ../../../PptFile/Converter/transition.cpp \ + ../../../PptFile/PPTXWriter/BulletsConverter.cpp } SOURCES += \ ../../../PptFile/Main/PPTFormatLib.cpp \ - ../../../PptFile/Drawing/Elements.cpp \ - ../../../PptFile/Drawing/TextAttributesEx.cpp \ - ../../../PptFile/Converter/transition.cpp \ - ../../../PptFile/PPTXWriter/BulletsConverter.cpp \ ../../../../Common/3dParty/pole/pole.cpp diff --git a/MsBinaryFile/Projects/PPTFormatLib/Linux/ppt_format_logic.cpp b/MsBinaryFile/Projects/PPTFormatLib/Linux/ppt_format_logic.cpp index 13f371a6ab..4af14400cc 100644 --- a/MsBinaryFile/Projects/PPTFormatLib/Linux/ppt_format_logic.cpp +++ b/MsBinaryFile/Projects/PPTFormatLib/Linux/ppt_format_logic.cpp @@ -30,6 +30,8 @@ * */ +#include "../../../PptFile/Enums/RecordType.cpp" +#include "../../../PptFile/Enums/RecordType.cpp" #include "../../../PptFile/Enums/RecordType.cpp" #include "../../../PptFile/Reader/ReadStructures.cpp" #include "../../../PptFile/Reader/RoundTripExtractor.cpp" @@ -39,10 +41,21 @@ #include "../../../PptFile/Reader/SlidePersist.cpp" #include "../../../PptFile/PPTXWriter/Converter.cpp" #include "../../../PptFile/PPTXWriter/ShapeWriter.cpp" -#include "../../../PptFile/PPTXWriter/Animation.cpp" #include "../../../PptFile/PPTXWriter/TableWriter.cpp" #include "../../../PptFile/PPTXWriter/TxBodyConverter.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/Elements.cpp" +#include "../../../PptFile/Drawing/TextAttributesEx.cpp" +#include "../../../PptFile/Converter/Animation/AnimationParser.cpp" +#include "../../../PptFile/Converter/Animation/Animation_1995.cpp" +#include "../../../PptFile/Converter/Animation/TimingUtils.cpp" +#include "../../../PptFile/Converter/Animation/Timing_1995.cpp" +#include "../../../PptFile/Converter/Animation/Timing_2010.cpp" +#include "../../../PptFile/Converter/Animation/hashcode10.cpp" +#include "../../../PptFile/Converter/Animation/intermediate_anim.cpp" +#include "../../../PptFile/Converter/timing.cpp" +#include "../../../PptFile/Converter/transition.cpp" +#include "../../../PptFile/PPTXWriter/BulletsConverter.cpp