Commit d5726524 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@61919 954022d7-b5bf-4e40-9824-e11837661b57
parent c12f4518
......@@ -350,6 +350,11 @@ ASCOfficePDFWriter/Tests/TestSvgToPDF/bin/Test.exe svn_mime_002dtype=application
ASCOfficePDFWriter/Tests/TestSvgToPDF/bin/Test.pdb svn_mime_002dtype=application%2Foctet-stream
ASCOfficePDFWriter/Tests/TestSvgToPDF/bin/files/coffe.jpg svn_mime_002dtype=application%2Foctet-stream
ASCOfficePDFWriter/Win32 svnc_tsvn_003alogminsize=5
ASCOfficePPTFile/trunk/Linux svnc_tsvn_003alogminsize=5
ASCOfficePPTFile/trunk/PPTFormatLib svnc_tsvn_003alogminsize=5
ASCOfficePPTFile/trunk/PPTFormatLib/Linux svnc_tsvn_003alogminsize=5
ASCOfficePPTFile/trunk/PPTFormatLib/Win32 svnc_tsvn_003alogminsize=5
ASCOfficePPTFile/trunk/Win32 svnc_tsvn_003alogminsize=5
ASCOfficeXlsFile/ASCWorksheetConverter/Documents/22_04_09[!!-~]Презентация/xls-xlsx.odp svn_mime_002dtype=application%2Foctet-stream
ASCOfficeXlsFile/ASCWorksheetConverter/Documents/22_04_09[!!-~]Презентация/xls-xlsx_short.odp svn_mime_002dtype=application%2Foctet-stream
ASCOfficeXlsFile/ASCWorksheetConverter/Documents/22_04_09[!!-~]Презентация/Презентация[!!-~]конвертера[!!-~]XLSX.doc svn_mime_002dtype=application%2Foctet-stream
......
#include "../PPTFormatLib/PPTFormatLib.h"
#include <iostream>
#include "../Win32/version.h"
static std::wstring utf8_to_unicode(const char *src)
{
if (src == NULL) return _T("");
std::string temp = src;
unsigned int nLength = temp.length();
UTF32 *pStrUtf32 = new UTF32 [nLength+1];
memset ((void *) pStrUtf32, 0, sizeof (UTF32) * (nLength+1));
UTF8 *pStrUtf8 = (UTF8 *) src;
// this values will be modificated
const UTF8 *pStrUtf8_Conv = pStrUtf8;
UTF32 *pStrUtf32_Conv = pStrUtf32;
ConversionResult eUnicodeConversionResult = ConvertUTF8toUTF32 (&pStrUtf8_Conv,
&pStrUtf8[nLength]
, &pStrUtf32_Conv
, &pStrUtf32 [nLength]
, strictConversion);
if (conversionOK != eUnicodeConversionResult)
{
delete [] pStrUtf32;
return L"";
}
std::wstring wsEntryName ((wchar_t *) pStrUtf32);
delete [] pStrUtf32;
return wsEntryName;
}
int main(int argc, char *argv[])
{
// check arguments
if (argc < 3)
{
// print out help topic
std::cout << std::endl;
std::cout << std::endl;
std::cout << "-------------------------------------------------------------------------------" << std::endl;
std::cout << "\t\tPPT/PPTX file converter. Version: " << STRVER << std::endl;
std::cout << "-------------------------------------------------------------------------------" << std::endl;
std::cout << std::endl;
std::cout << "USAGE: ASCPptConverter \"path_to_file_1\" \"path_to_file_2\" " << std::endl;
std::cout << "WHERE:" << std::endl;
std::cout << "\t\"path_to_file_1\" is a path to file to be converted" << std::endl;
std::cout << "\t\"path_to_file_2\" is a path to the corresponding output file" << std::endl << std::endl;
return 1;
}
CString sArg1, sArg2, sExePath;
sExePath = utf8_to_unicode(argv [0]);
sArg1 = utf8_to_unicode(argv [1]);
sArg2 = utf8_to_unicode(argv [2]);
CString sXMLOptions = _T("");
{// ppt -> pptx
COfficePPTFile pptFile;
HRESULT hRes = pptFile.LoadFromFile(sArg1, sArg2, sXMLOptions);
if (hRes != S_OK)return 2;
}
return 0;
}
#-------------------------------------------------
#
# Project created by QtCreator 2014-12-16T18:25:28
#
#-------------------------------------------------
QT -= core
QT -= gui
QMAKE_CXXFLAGS += -std=c++11 -Wall -Wno-ignored-qualifiers
DEFINES += UNICODE \
_UNICODE \
_USE_LIBXML2_READER_ \
_LINUX_QT \
_LINUX \
LINUX \
_USE_XMLLITE_READER_ \
USE_LITE_READER \
PPTX_DEF\
PPT_DEF\
PPT_FORMAT\
USE_AVSOFFICESTUDIO_XMLUTILS \
SOLUTION_ASCOFFICEDOCXFILE2 \
ENABLE_PPT_TO_PPTX_CONVERT \
_PRESENTATION_WRITER_ \
NODOCX \
#DISABLE_FILE_DOWNLOADER \
BUILD_CONFIG_FULL_VERSION \
DONT_WRITE_EMBEDDED_FONTS \
CXIMAGE_DONT_DECLARE_TCHAR
TARGET = ASCPptConverter
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
INCLUDEPATH += \
/usr/include/libxml2
SOURCES += \
PptFileConverter.cpp
CONFIG(debug, debug|release){
message(Debug)
#pptformat
unix:!macx: LIBS += -L$$PWD/../PPTFormatLib/Linux/build-PPTFormatLib-Desktop-Debug/ -lPptFormatLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../PPTFormatLib/Linux/build-PPTFormatLib-Desktop-Debug/libPptFormatLib.a
#pptxformat
unix:!macx: LIBS += -L$$PWD/../../../ASCOfficePPTXFile/PPTXLib/Linux/build-PPTXFormatLib-Desktop-Debug/ -lPPTXFormatLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../../ASCOfficePPTXFile/PPTXLib/Linux/build-PPTXFormatLib-Desktop-Debug/libPPTXFormatLib.a
#docxfile2
unix:!macx: LIBS += -L$$PWD/../../../ASCOfficeDocxFile2/build-ASCOfficeDocxFile2Lib-Desktop-Debug/ -lASCOfficeDocxFile2Lib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../../ASCOfficeDocxFile2/build-ASCOfficeDocxFile2Lib-Desktop-Debug/libASCOfficeDocxFile2Lib.a
#docxformat
unix:!macx: LIBS += -L$$PWD/../../../Common/DocxFormat/build-DocxFormatLib-Desktop-Debug/ -lDocxFormatLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../../Common/DocxFormat/build-DocxFormatLib-Desktop-Debug/libDocxFormatLib.a
#htmlRenderer
unix:!macx: LIBS += -L$$PWD/../../../ASCHTMLRenderer/build-ASCHTMLRendererLib-Desktop-Debug/ -lASCHTMLRendererLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../../ASCHTMLRenderer/build-ASCHTMLRendererLib-Desktop-Debug/libASCHTMLRendererLib.a
#OfficeUtils
unix:!macx: LIBS += -L$$PWD/../../../ASCOfficeUtils/ASCOfficeUtilsLib/build-ASCOfficeUtilsLib-Desktop-Debug/ -lASCOfficeUtilsLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../../ASCOfficeUtils/ASCOfficeUtilsLib/build-ASCOfficeUtilsLib-Desktop-Debug/libASCOfficeUtilsLib.a
#Graphics
unix:!macx: LIBS += -L$$PWD/../../../DesktopEditor/Qt_build/graphics/build-graphics-Desktop-Debug/ -lgraphics
unix:!macx: PRE_TARGETDEPS += $$PWD/../../../DesktopEditor/Qt_build/graphics/build-graphics-Desktop-Debug/libgraphics.a
}
CONFIG(release, debug|release){
message(Release)
#pptformat
unix:!macx: LIBS += -L$$PWD/../PPTFormatLib/Linux/build-PPTFormatLib-Desktop-Release/ -lPPTFormatLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../PPTFormatLib/Linux/build-PPTFormatLib-Desktop-Release/libPPTFormatLib.a
#pptxformat
unix:!macx: LIBS += -L$$PWD/../../../ASCOfficePPTXFile/PPTXLib/Linux/build-PPTXFormatLib-Desktop-Release/ -lPPTXFormatLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../../ASCOfficePPTXFile/PPTXLib/Linux/build-PPTXFormatLib-Desktop-Release/libPPTXFormatLib.a
#docxfile2
unix:!macx: LIBS += -L$$PWD/../../../ASCOfficeDocxFile2/build-ASCOfficeDocxFile2Lib-Desktop-Release/ -lASCOfficeDocxFile2Lib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../../ASCOfficeDocxFile2/build-ASCOfficeDocxFile2Lib-Desktop-Release/libASCOfficeDocxFile2Lib.a
#docxformat
unix:!macx: LIBS += -L$$PWD/../../../Common/DocxFormat/build-DocxFormatLib-Desktop-Release/ -lDocxFormatLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../../Common/DocxFormat/build-DocxFormatLib-Desktop-Release/libDocxFormatLib.a
#htmlRenderer
unix:!macx: LIBS += -L$$PWD/../../../ASCHTMLRenderer/build-ASCHTMLRendererLib-Desktop-Release/ -lASCHTMLRendererLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../../ASCHTMLRenderer/build-ASCHTMLRendererLib-Desktop-Release/libASCHTMLRendererLib.a
#OfficeUtils
unix:!macx: LIBS += -L$$PWD/../../../ASCOfficeUtils/ASCOfficeUtilsLib/build-ASCOfficeUtilsLib-Desktop-Release/ -lASCOfficeUtilsLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../../ASCOfficeUtils/ASCOfficeUtilsLib/build-ASCOfficeUtilsLib-Desktop-Release/libASCOfficeUtilsLib.a
#Graphics
unix:!macx: LIBS += -L$$PWD/../../../DesktopEditor/Qt_build/graphics/build-graphics-Desktop-Release/ -lgraphics
unix:!macx: PRE_TARGETDEPS += $$PWD/../../../DesktopEditor/Qt_build/graphics/build-graphics-Desktop-Release/libgraphics.a
}
unix:!macx: LIBS += -lxml2 -lcurl
#unix:!macx: LIBS += -L$$PWD/../../../../../../../../usr/lib/x86_64-linux-gnu/ -lcurl
#INCLUDEPATH += $$PWD/../../../../../../../../usr/lib/x86_64-linux-gnu
#DEPENDPATH += $$PWD/../../../../../../../../usr/lib/x86_64-linux-gnu
#unix:!macx: PRE_TARGETDEPS += $$PWD/../../../../../../../../usr/lib/x86_64-linux-gnu/libcurl.a
#-------------------------------------------------
#
# Project created by QtCreator 2014-12-16T18:28:23
#
#-------------------------------------------------
QT -= core gui
TARGET = PptFormatLib
TEMPLATE = lib
CONFIG += staticlib
QMAKE_CXXFLAGS += -std=c++11 -Wall -Wno-ignored-qualifiers
DEFINES += UNICODE \
_UNICODE \
LINUX \
_LINUX_QT\
USE_ATL_CSTRING \
PPTX_DEF \
PPT_DEF \
ENABLE_PPT_TO_PPTX_CONVERT \
PPT_FORMAT \
_USE_LIBXML2_READER_ \
LIBXML_READER_ENABLED \
USE_LITE_READER \
_USE_XMLLITE_READER_ \
_PRESENTATION_WRITER_ \
_SVG_CONVERT_TO_IMAGE_ \
BUILD_CONFIG_FULL_VERSION \
DONT_WRITE_EMBEDDED_FONTS
#DISABLE_FILE_DOWNLOADER
INCLUDEPATH += \
../../../Common/DocxFormat/Source/XML/libxml2/XML/include
INCLUDEPATH += \
/usr/include/libxml2 \
INCLUDEPATH += \
../../../../DesktopEditor/freetype-2.5.2/include
LIBS += -lxml2
unix {
target.path = /usr/lib
INSTALLS += target
}
HEADERS += \
../Reader/AudioOverlay.h \
../Reader/ClassesAtom.h \
../Reader/CommonZLib.h \
../Reader/PPTDocumentInfo.h \
../Reader/PPTDocumentInfoOneUser.h \
../Reader/PPTFileDefines.h \
../Reader/PPTFileReader.h \
../Reader/ReadStructures.h \
../Reader/Records.h \
../Reader/Slide.h \
../Reader/SlideInfo.h \
../Reader/SlidePersist.h \
../Records/AnimationInfoAtom.h \
../Records/BlipEntityAtom.h \
../Records/BookmarkEntityAtom.h \
../Records/BookmarkSeedAtom.h \
../Records/ColorSchemeAtom.h \
../Records/CString.h \
../Records/CurrentUserAtom.h \
../Records/DateTimeMCAtom.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/GenericDateMCAtom.h \
../Records/GridSpacing10Atom.h \
../Records/GuideAtom.h \
../Records/HeadersFootersAtom.h \
../Records/InteractiveInfoAtom.h \
../Records/KinsokuAtom.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/PersistDirectoryAtom.h \
../Records/PlaceHolderAtom.h \
../Records/RecordsIncluder.h \
../Records/RoundTripColorMappingAtom.h \
../Records/RoundTripCompositeMainMasterId12Atom.h \
../Records/RoundTripNewPlaceholderId12Atom.h \
../Records/RoundTripOriginalMainMasterId12Atom.h \
../Records/RoundTripThemeAtom.h \
../Records/ShapeFlags10Atom.h \
../Records/ShapeFlagsAtom.h \
../Records/SlideAtom.h \
../Records/SlideColorSchemeAtom.h \
../Records/SlideContainer.h \
../Records/SlideListWithText.h \
../Records/SlideNumberMCAtom.h \
../Records/SlidePersistAtom.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/TextBookmarkAtom.h \
../Records/TextBytesAtom.h \
../Records/TextCFExceptionAtom.h \
../Records/TextCharsAtom.h \
../Records/TextFullSettings.h \
../Records/TextHeaderAtom.h \
../Records/TextInteractiveInfoAtom.h \
../Records/TextMasterStyleAtom.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/BitmapBlip.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 \
../../../../ASCPresentationEditor/PPTXWriter/Converter.h \
../../../../ASCPresentationEditor/PPTXWriter/CSS.h \
../../../../ASCPresentationEditor/PPTXWriter/ImageManager.h \
../../../../ASCPresentationEditor/PPTXWriter/ShapeWriter.h \
../../../../ASCPresentationEditor/PPTXWriter/StylesWriter.h \
../../../../ASCOfficeDocFile/pole/pole.h \
../../../../ASCPresentationEditor/OfficeDrawing/Element.h \
../../../../ASCPresentationEditor/OfficeDrawing/ElementProperties.h \
../../../../ASCPresentationEditor/OfficeDrawing/Elements.h \
../../../../ASCPresentationEditor/OfficeDrawing/Layout.h \
../../../../ASCPresentationEditor/OfficeDrawing/Slide.h \
../../../../ASCPresentationEditor/OfficeDrawing/SVGConverter.h \
../../../../ASCPresentationEditor/OfficeDrawing/SVGFramework.h \
../../../../ASCPresentationEditor/OfficeDrawing/SVGTransformer.h \
../../../../ASCPresentationEditor/OfficeDrawing/TextAttributesEx.h \
../../../../ASCPresentationEditor/OfficeDrawing/TextStructures.h \
../../../../ASCPresentationEditor/OfficeDrawing/Theme.h \
../PPTFormatLib.h
SOURCES += \
../Reader/PPTDocumentInfoOneUser.cpp \
../Reader/Records.cpp \
../Reader/SlidePersist.cpp \
../Records/Animations/AnimationTypes.cpp \
../../../../ASCPresentationEditor/PPTXWriter/Converter.cpp \
../../../../ASCPresentationEditor/PPTXWriter/ShapeWriter.cpp \
../../../../ASCOfficeDocFile/pole/pole.cpp \
../../../../ASCPresentationEditor/OfficeDrawing/Elements.cpp \
../../../../ASCPresentationEditor/OfficeDrawing/Layout.cpp \
../../../../ASCPresentationEditor/OfficeDrawing/SVGConverter.cpp \
../../../../ASCPresentationEditor/OfficeDrawing/SVGFramework.cpp \
../../../../ASCPresentationEditor/OfficeDrawing/SVGTransformer.cpp \
../../../../ASCPresentationEditor/OfficeDrawing/TextAttributesEx.cpp \
../../../../ASCPresentationEditor/OfficeDrawing/Theme.cpp \
../PPTFormatLib.cpp

#include "PPTFormatLib.h"
#include "Reader/PPTFileReader.h"
#include "../../../ASCPresentationEditor/PPTXWriter/Converter.h"
#include "../../../ASCOfficeUtils/ASCOfficeUtilsLib/OfficeUtils.h"
#ifndef READMODE
#define READMODE 1
#endif
#ifndef NULLMODE
#define NULLMODE 0
#endif
COfficePPTFile::~COfficePPTFile()
{
CloseFile();
}
BOOL COfficePPTFile::OpenFile(CString sFileName)
{
CloseFile();
POLE::Storage *pStgFrom = new POLE::Storage(sFileName);
if (pStgFrom == NULL) return FALSE;
pStgFrom->open(false,false);
m_pReader = new CPPTFileReader(pStgFrom, m_strTempDirectory);
((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_strFileDirectory = GetDirectory(sFileName);
if (!((CPPTFileReader*)m_pReader)->IsPowerPoint())
{
CPPTFileReader* r = (CPPTFileReader*)m_pReader; RELEASEOBJECT(r);
m_pReader = NULL;
return FALSE;
}
((CPPTFileReader*)m_pReader)->ReadPersistDirectory();
((CPPTFileReader*)m_pReader)->ReadSlideList();
m_Status = READMODE;
return TRUE;
}
BOOL COfficePPTFile::CloseFile()
{
m_Status = NULLMODE;
CPPTFileReader* r = (CPPTFileReader*)m_pReader; RELEASEOBJECT(r);
m_pReader = NULL;
return S_OK;
}
HRESULT COfficePPTFile::LoadFromFile(CString sSrcFileName, CString sDstPath, CString sXMLOptions)
{
if (m_strTempDirectory.GetLength() < 1)
{
m_strTempDirectory = FileSystem::Directory::GetTempPath();
}
BOOL bRes = OpenFile(sSrcFileName);
if (!bRes)
{
CloseFile();
m_Status = NULLMODE;
return S_FALSE;
}
m_strEditorXml = _T("");
if (0 < ((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers.size())
{
m_strEditorXml = ((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers[0]->ToXmlEditor2();
}
//////////////////////////////////////
if (m_strEditorXml.GetLength() <1) return S_FALSE;
if (sDstPath.GetLength() > 0)
{
bool bNeedPPTXFile = false;
#if !(defined(_WIN32) || defined (_WIN64)) || defined(_DEBUG)
bNeedPPTXFile = true;
#endif
NSPresentationEditor::CDocument oPresentationEditor;
NSPresentationEditor::CPPTXWriter oPPTXWriter;
oPresentationEditor.LoadFromXML(m_strEditorXml);
oPPTXWriter.m_strTempDirectory = sDstPath;
if (bNeedPPTXFile)
{
oPPTXWriter.m_strTempDirectory = FileSystem::Directory::CreateDirectoryWithUniqueName(m_strTempDirectory);
}
oPPTXWriter.CreateFile(&oPresentationEditor);
oPPTXWriter.CloseFile();
if (bNeedPPTXFile)
{
COfficeUtils oOfficeUtils(NULL);
std::wstring bstrSrcPath = string2std_string(oPPTXWriter.m_strTempDirectory);
std::wstring bstrDstPath = string2std_string(sDstPath);
oOfficeUtils.CompressFileOrDirectory( bstrSrcPath, bstrDstPath, -1 );
FileSystem::Directory::DeleteDirectory(oPPTXWriter.m_strTempDirectory);
}
}
//CloseFile(); нельзя тута- поскольку в Win32 используется PresentationEditor для конвертации xml -> pptx
return S_OK;
}
HRESULT COfficePPTFile::GetAdditionalParam (CString sParamName, VARIANT* ParamValue)
{
if (NULL == ParamValue)
return S_FALSE;
if (_T("EditorXml") == sParamName)
{
#if defined(_WIN32) || defined (_WIN64)
ParamValue->bstrVal = m_strEditorXml.AllocSysString();
#else
ParamValue->bstrVal = m_strEditorXml;
#endif
}
return S_OK;
}
CString COfficePPTFile::GetDirectory(CString strFileName)
{
int nIndex = strFileName.ReverseFind(FILE_SEPARATOR_CHAR);
if (-1 != nIndex)
{
return strFileName.Mid(0, nIndex + 1);
}
return strFileName;
}
#pragma once
#if defined(_WIN32) || defined (_WIN64)
#include <atlbase.h>
#include <atlstr.h>
#else
#include "../../../DesktopEditor/common/ASCVariant.h"
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
#include <vector>
class COfficePPTFile
{
public:
COfficePPTFile()
{
m_strTempDirectory = L"";
m_pReader = NULL;
m_Status = 0;
}
~COfficePPTFile();
private:
LONG m_Status;
void* m_pReader;
std::vector<CString> m_arUserSources;
CString m_strEditorXml;
CString m_strTempDirectory;
public:
HRESULT put_TempDirectory(CString sDir)
{
m_strTempDirectory = sDir;
return S_OK;
}
CString get_TempDirectory()
{
return m_strTempDirectory;
}
HRESULT LoadFromFile(CString sSrcFileName, CString sDstPath, CString sXMLOptions);
HRESULT GetAdditionalParam (CString sParamName, VARIANT* ParamValue);
private:
BOOL OpenFile(CString sFileName);
BOOL CloseFile();
CString GetDirectory(CString strFileName);
};
#pragma once
#include "Elements.h"
class CAudioPart
{
public:
CString m_strFile;
double m_dStartTime;
double m_dEndTime;
double m_dClipStartTime;
double m_dClipEndTime;
double m_dAudioDuration;
bool m_bLoop;
bool m_bStop;
bool m_bIsTransition;
double m_dAmplify;
public:
CAudioPart()
{
m_strFile = _T("");
m_dStartTime = 0.0;
m_dEndTime = -1.0;
m_dClipStartTime = 0.0;
m_dClipEndTime = -1.0;
m_dAudioDuration = 0.0;
m_bLoop = false;
m_bStop = false;
m_bIsTransition = false;
m_dAmplify = 100.0;
}
~CAudioPart()
{
}
CAudioPart(const CAudioPart& oSrc)
{
*this = oSrc;
}
CAudioPart& operator=(const CAudioPart& oSrc)
{
m_strFile = oSrc.m_strFile;
m_dStartTime = oSrc.m_dStartTime;
m_dEndTime = oSrc.m_dEndTime;
m_dClipStartTime = oSrc.m_dClipStartTime;
m_dClipEndTime = oSrc.m_dClipEndTime;
m_dAudioDuration = oSrc.m_dAudioDuration;
m_bLoop = oSrc.m_bLoop;
m_bStop = oSrc.m_bStop;
m_bIsTransition = oSrc.m_bIsTransition;
m_dAmplify = oSrc.m_dAmplify;
return *this;
}
CAudioPart(CAudioElement* pAudioElem)
{
if (NULL == pAudioElem)
{
m_strFile = _T("");
m_dStartTime = 0.0;
m_dEndTime = -1.0;
m_dClipStartTime = 0.0;
m_dClipEndTime = -1.0;
m_dAudioDuration = 0.0;
m_bLoop = false;
m_bStop = false;
m_bIsTransition = false;
m_dAmplify = 100.0;
}
else
{
m_strFile = pAudioElem->m_strFileName;
m_dStartTime = pAudioElem->m_dStartTime;
m_dEndTime = pAudioElem->m_dEndTime;
m_dClipStartTime = pAudioElem->m_dClipStartTime;
m_dClipEndTime = pAudioElem->m_dClipEndTime;
m_dAudioDuration = pAudioElem->m_dAudioDuration;
m_bLoop = pAudioElem->m_bLoop;
m_bStop = false;
m_bIsTransition = false;
m_dAmplify = 100.0;
}
}
public:
void CalculateDuration()
{
if (0.0 < m_dAudioDuration || _T("") == m_strFile)
return;
VideoFile::IVideoFile3* pVideoFile = NULL;
if (SUCCEEDED(CoCreateInstance(VideoFile::CLSID_CVideoFile3, NULL, CLSCTX_ALL, VideoFile::IID_IVideoFile3, (void**)(&pVideoFile))))
{
if (NULL != pVideoFile)
{
BSTR bsFile = m_strFile.AllocSysString();
if (S_OK == pVideoFile->OpenFile(bsFile))
{
pVideoFile->get_audioDuration(&m_dAudioDuration);
}
SysFreeString(bsFile);
RELEASEINTERFACE(pVideoFile);
}
}
}
};
class CAudioOverlay
{
public:
CAtlArray<CAudioPart> m_arParts;
double m_dAllDuration;
public:
CAudioOverlay() : m_arParts(), m_dAllDuration(0.0)
{
}
~CAudioOverlay()
{
}
CAudioOverlay(const CAudioOverlay& oSrc)
{
*this = oSrc;
}
CAudioOverlay& operator=(const CAudioOverlay& oSrc)
{
m_arParts.Copy(oSrc.m_arParts);
m_dAllDuration = oSrc.m_dAllDuration;
return *this;
}
public:
void Calculate()
{
size_t nCount = m_arParts.GetCount();
//
for (size_t i = 0; i < nCount; ++i)
{
CAudioPart* pPart = &m_arParts[i];
pPart->CalculateDuration();
if (pPart->m_dStartTime < 0.0)
pPart->m_dStartTime = 0.0;
pPart->m_dEndTime = pPart->m_dStartTime + pPart->m_dAudioDuration;
if (pPart->m_dEndTime > m_dAllDuration)
{
pPart->m_dEndTime = m_dAllDuration;
}
if (pPart->m_bLoop)
{
pPart->m_dEndTime = m_dAllDuration;
}
}
//
for (size_t i = 0; i < nCount; ++i)
{
CAudioPart* pPart = &m_arParts[i];
if (pPart->m_bIsTransition)
{
if (pPart->m_bStop)
{
//
for (size_t j = 0; j < nCount; ++j)
{
if (j == i)
continue;
CAudioPart* pMem = &m_arParts[j];
if (pMem->m_dStartTime <= pPart->m_dStartTime && pMem->m_dEndTime > pPart->m_dStartTime)
{
pMem->m_dEndTime = pPart->m_dStartTime;
}
}
}
if (pPart->m_bLoop)
{
//
double dMin = m_dAllDuration;
for (size_t j = 0; j < nCount; ++j)
{
if (j == i)
continue;
CAudioPart* pMem = &m_arParts[j];
if (pMem->m_dStartTime > pPart->m_dEndTime)
{
if (dMin > pMem->m_dStartTime)
dMin = pMem->m_dStartTime;
}
}
pPart->m_dEndTime = dMin;
}
}
else
{
if (pPart->m_bLoop)
{
pPart->m_dEndTime = m_dAllDuration;
}
}
}
}
CString GetAudioOverlay()
{
CString strRes = _T("");
size_t nCount = m_arParts.GetCount();
for (size_t i = 0; i < nCount; ++i)
{
CAudioPart* pPart = &m_arParts[i];
CString strOverlay1 = _T("");
CString strOverlay2 = _T("");
strOverlay1.Format(_T("<AudioSource StartTime='%lf' Duration='%lf' Amplify='%lf'>"),
pPart->m_dStartTime, pPart->m_dEndTime - pPart->m_dStartTime, pPart->m_dAmplify);
int lIndex = pPart->m_strFile.Find(L"file:///");
if (0 == lIndex)
{
pPart->m_strFile = pPart->m_strFile.Mid(8);
pPart->m_strFile.Replace('/', '\\');
pPart->m_strFile.Replace(L"%20", L" ");
}
CString strFile_ = pPart->m_strFile;
CorrectXmlString(strFile_);
strOverlay2.Format(_T("<Source StartTime='%lf' EndTime='%lf'"), pPart->m_dClipStartTime, pPart->m_dClipEndTime);
strOverlay2 += _(" FilePath=\"") + strFile_ + _T("\">");
strOverlay2 += _T("</AudioSource>");
strOverlay1 += strOverlay2;
strRes += strOverlay1;
}
return strRes;
}
};
#pragma once
#include "../Records/CurrentUserAtom.h"
using namespace NSOfficePPT;
class CUserEdit
{
public:
DWORD m_nOffsetLastEdit;
DWORD m_nOffsetPersistDirectory;
DWORD m_nDocumentRef;
DWORD m_nMaxPersistWritten;
public:
CUserEdit()
{
m_nOffsetLastEdit = 0;
m_nOffsetPersistDirectory = 0;
m_nDocumentRef = 0;
m_nMaxPersistWritten = 0;
}
~CUserEdit()
{
}
CUserEdit& operator =(const CUserEdit& oSrc)
{
m_nOffsetLastEdit = oSrc.m_nOffsetLastEdit;
m_nOffsetPersistDirectory = oSrc.m_nOffsetPersistDirectory;
m_nDocumentRef = oSrc.m_nDocumentRef;
m_nMaxPersistWritten = oSrc.m_nMaxPersistWritten;
return (*this);
}
void FromAtom(CRecordUserEditAtom* pAtom)
{
m_nOffsetLastEdit = pAtom->m_nOffsetLastEdit;
m_nOffsetPersistDirectory = pAtom->m_nOffsetPersistDirectory;
m_nDocumentRef = pAtom->m_nOffsetDocPersistIdRef;
m_nMaxPersistWritten = pAtom->m_nPersistIdSeed;
}
};
class CCurrentUser
{
public:
bool m_bIsEncrypt;
DWORD m_nOffsetToCurrentEdit;
CStringW m_strName;
public:
CCurrentUser()
{
m_bIsEncrypt = false;
m_nOffsetToCurrentEdit = 0;
m_strName = _T("");
}
~CCurrentUser()
{
}
CCurrentUser& operator =(const CCurrentUser& oSrc)
{
m_bIsEncrypt = oSrc.m_bIsEncrypt;
m_nOffsetToCurrentEdit = oSrc.m_nOffsetToCurrentEdit;
m_strName = oSrc.m_strName;
return (*this);
}
void FromAtom(CRecordCurrentUserAtom* pAtom)
{
m_bIsEncrypt = (NO_ENCRYPT == pAtom->m_nToken);
m_nOffsetToCurrentEdit = pAtom->m_nOffsetToCurEdit;
m_strName = pAtom->m_strUNICODEUserName;
}
CString ToString()
{
CString str = _T("<CurrentUser Name='") + (CString)m_strName + _T("' />");
return str;
}
};
///----------- constants----------
const int MST_FLAG_OBJECTS = 0x01;
const int MST_FLAG_SCHEME = 0x02;
const int MST_FLAG_BACKGROUND = 0x04;
#define MAX_OBJECTS_IN_LAYOUT 8
const int S_HEADERFOOTER_DATE = 0x01;
const int S_HEADERFOOTER_TODAYDATE = 0x02;
const int S_HEADERFOOTER_USERDATE = 0x04;
const int S_HEADERFOOTER_SLIDENUMBER = 0x08;
const int S_HEADERFOOTER_HEADER = 0x10;
const int S_HEADERFOOTER_FOOTER = 0x20;
#define PSR_NAMEDSHOW_SIZE 32
//---------------------------------
struct SDocInfoAtom
{
SColorAtom PenColor;
INT RestartTime;
SHORT StartSlide;
SHORT EndSlide;
USHORT NamedShow[PSR_NAMEDSHOW_SIZE];
BYTE Flags;
};
struct SSlideInfoAtom
{
INT SlideTime; // how long to show the slide in ticks
UINT SoundRef;
USHORT Effect; // type of transition (2 character signature)
USHORT Flags; // set of flags that determine type of build
BYTE Speed; // speed of transition
};
struct PSR_AnimationInfoAtom
{
SColorAtom DimColor;
UINT Flags;
UINT SoundRef;
USHORT OrderID;
USHORT DelayTime;
USHORT SlideCount;
BYTE BuildType;
BYTE FlyMethod;
BYTE FlyDirection;
BYTE AfterEffect;
BYTE SubEffect;
BYTE OleVerb;
};
struct SInteractiveInfoAtom
{
UINT SoundRef;
UINT ExHyperlinkID;
BYTE Action;
BYTE OleVerb;
BYTE Jump;
BYTE Flags;
};
#pragma once
// zlib - .
// -
#include <zlib.h>
#pragma comment(lib, "zlib.lib")
namespace NSZLib
{
static BOOL Decompress(const BYTE* pSrcBuffer, const ULONG& lSrcBufferLen,
BYTE* pDstBuffer, ULONG& lDstBufferLen)
{
try
{
if (Z_OK == uncompress(pDstBuffer, &lDstBufferLen, pSrcBuffer, lSrcBufferLen))
{
return TRUE;
}
}
catch(...)
{
}
return FALSE;
}
}
\ No newline at end of file
#pragma once
#include "PPTDocumentInfoOneUser.h"
class CPPTDocumentInfo
{
public:
CCurrentUser m_oCurrentUser;
std::vector<CPPTUserInfo*> m_arUsers;
CString m_strFileDirectory;
public:
CPPTDocumentInfo() : m_oCurrentUser(), m_arUsers()
{
m_strFileDirectory = _T("");
}
~CPPTDocumentInfo()
{
Clear();
}
void Clear()
{
size_t nCount = m_arUsers.size();
while(0 != nCount)
{
if (NULL != m_arUsers[nCount-1])
delete m_arUsers[nCount-1];
m_arUsers.pop_back();
--nCount;
}
}
void ReadFromStream(CRecordCurrentUserAtom* pCurrentUser, POLE::Stream* pStream, CStringW strFolderMem)
{
m_oCurrentUser.FromAtom(pCurrentUser);
DWORD offsetToEdit = m_oCurrentUser.m_nOffsetToCurrentEdit;
SRecordHeader oHeader;
CRecordUserEditAtom oUserAtom;
Clear();
size_t nCountUsers = 0;
while (0 < offsetToEdit)
{
StreamUtils::StreamSeek(offsetToEdit, pStream);
oHeader.ReadFromStream(pStream);
oUserAtom.ReadFromStream(oHeader, pStream);
CPPTUserInfo* pInfo = new CPPTUserInfo();
pInfo->m_strFileDirectory = m_strFileDirectory;
BOOL bRes = pInfo->ReadFromStream(&oUserAtom, pStream, strFolderMem);
offsetToEdit = pInfo->m_oUser.m_nOffsetLastEdit;
if (!bRes)
{
delete pInfo;
continue;
}
m_arUsers.push_back(pInfo);
//
pInfo->m_pDocumentInfo = this;
pInfo->m_lIndexThisUser = m_arUsers.size() - 1;
pInfo = NULL;
}
// , blip. -
LONG lCount = m_arUsers.size();
if (1 < lCount)
{
m_arUsers[0]->m_arEmptyPictures = m_arUsers[lCount - 1]->m_arEmptyPictures;
}
// FromDocument...
for (size_t i = 0; i < m_arUsers.size(); ++i)
{
m_arUsers[i]->FromDocument();
}
#ifdef _DEBUG
SaveXmlInfo();
#endif
}
void SaveXmlInfo()
{
if (!PPT_DUMP_LOG)
return;
XmlUtils::CXmlWriter oWriter;
oWriter.WriteNodeBegin(_T("PPTInfo"));
oWriter.WriteString(m_oCurrentUser.ToString());
for (size_t nIndex = 0; nIndex < m_arUsers.size(); ++nIndex)
{
oWriter.WriteString(m_arUsers[nIndex]->m_strXmlInfo);
}
oWriter.WriteNodeEnd(_T("PPTInfo"));
//CDirectory::SaveToFile(_T("C:\\PPTInfo.xml"), oWriter.GetXmlString());
oWriter.SaveToFile(_T("C:\\PPTInfo.xml"), TRUE);
}
LONG GetCountPicturesUsed(size_t nUser)
{
LONG lRes = 0;
for (size_t i = 0; i < m_arUsers[nUser]->m_arEmptyPictures.size(); ++i)
{
if (!m_arUsers[nUser]->m_arEmptyPictures[i])
++lRes;
}
return lRes;
}
};
\ No newline at end of file
#pragma once
#include "ClassesAtom.h"
#include "../Records/Animations/AnimationTypes.h"
#include "../Records/ExObjListContainer.h"
#include "SlideInfo.h"
class CPPTDocumentInfo;
using namespace NSPresentationEditor;
class CPPTUserInfo : public CDocument
{
public:
CUserEdit m_oUser;
std::map<DWORD, DWORD> m_mapOffsetInPIDs;
CRecordDocument m_oDocument;
//todooo C++11 unsorted_map - m_arr .. Order
std::map<DWORD, CRecordSlide*> m_mapSlides;
std::map<DWORD, CRecordSlide*> m_mapMasters;
std::map<DWORD, CRecordSlide*> m_mapNotes;
std::vector<DWORD> m_arrSlidesOrder;
std::vector<DWORD> m_arrMastersOrder;
std::vector<DWORD> m_arrNotesOrder;
// id /
std::map<DWORD, LONG> m_mapMasterToTheme;
std::map<DWORD, LONG> m_mapMasterToLayout;
// original id -> natural id
std::map<DWORD, DWORD> m_mapMasterOriginalIds;
// -
std::vector<CSlideInfo> m_arSlideWrapper;
std::vector<CSlideInfo> m_arMasterWrapper;
// - .
// () -
std::vector<CFont> m_arrFonts;
NSPresentationEditor::CTextStyles m_oDefaultTextStyle;
// ()
CPPTDocumentInfo* m_pDocumentInfo;
size_t m_lIndexThisUser;
// Animations structures
std::map <DWORD, Animations::CSlideTimeLine*> m_mapAnimations;
double m_nWriteSlideTimeOffset;
double m_nWriteSlideTime;
std::map<DWORD, CSlideShowSlideInfoAtom> m_mapTransitions;
// "" -
std::vector<BOOL> m_arEmptyPictures;
BOOL m_bIsSetupEmpty;
CString m_strFileDirectory;
// ex -
CExMedia m_oExMedia;
// DEBUG information
CString m_strXmlInfo;
std::vector<CColor> m_oSchemeColors;
public:
CPPTUserInfo();
~CPPTUserInfo();
void Clear();
BOOL ReadFromStream(CRecordUserEditAtom* pUser, POLE::Stream* pStream, CStringW strFolderMem);
void FromDocument();
void NormalizeCoords(long lWidth, long lHeight);
void LoadSlide(DWORD dwSlideID, CSlide* pSlide);
void LoadMasters(const LONG& lOriginWidth, const LONG& lOriginHeight);
void LoadNoMainMaster (DWORD dwMasterID, const LONG& lOriginWidth, const LONG& lOriginHeight);
void LoadMainMaster (DWORD dwMasterID, const LONG& lOriginWidth, const LONG& lOriginHeight);
void UpdateXMLInfo();
void LoadSlideFromPrevUsers (DWORD dwSlideID);
void LoadMasterFromPrevUsers(DWORD dwSlideID);
void LoadNoteFromPrevUsers (DWORD dwSlideID);
void LoadExternal(CRecordExObjListContainer* pExObjects);
void LoadExVideo(CRecordsContainer* pExObject);
void LoadExAudio(CRecordsContainer* pExObject);
void CreateDefaultStyle(NSPresentationEditor::CTextStyles& pStyle, NSPresentationEditor::CTheme* pTheme)
{
for (int i = 0; i < 10; ++i)
{
if (!pStyle.m_pLevels[i].is_init())
pStyle.m_pLevels[i] = new NSPresentationEditor::CTextStyleLevel();
NSPresentationEditor::CTextPFRun* pPF = &pStyle.m_pLevels[i]->m_oPFRun;
NSPresentationEditor::CTextCFRun* pCF = &pStyle.m_pLevels[i]->m_oCFRun;
pPF->textAlignment = (WORD)0;
pPF->leftMargin = (LONG)0;
pPF->indent = (LONG)0;
pPF->defaultTabSize = (LONG)0;
pPF->fontAlign = (WORD)0;
pPF->wrapFlags = (WORD)0x02;
pPF->textDirection = (WORD)0;
pPF->lineSpacing = (LONG)100;
pPF->spaceBefore = (LONG)0;
pPF->spaceAfter = (LONG)0;
pCF->FontBold = FALSE;
pCF->FontItalic = FALSE;
pCF->FontUnderline = FALSE;
pCF->FontStrikeout = FALSE;
pCF->Size = 18;
pCF->BaseLineOffset = (double)0;
pCF->Cap = (WORD)0;
pCF->FontProperties = new NSPresentationEditor::CFontProperties();
pCF->FontProperties->SetFont(pTheme->m_arFonts[0]);
pCF->Color = new NSPresentationEditor::CColor();
}
}
void CorrectColorScheme(std::vector<CColor>& oScheme)
{
std::vector<CColor> oArrayMem;
oArrayMem.push_back(oScheme[0]);//0
oArrayMem.push_back(oScheme[1]);//1
oArrayMem.push_back(oScheme[2]);//2
oArrayMem.push_back(oScheme[3]);//3
oArrayMem.push_back(oScheme[0]);//4
oArrayMem.push_back(oScheme[5]);//5 //accent1
oArrayMem.push_back(oScheme[6]);//6 //accent2
oArrayMem.push_back(oScheme[7]);//7 //accent3
oArrayMem.push_back(oScheme[5]);//8 //accent4
oArrayMem.push_back(oScheme[6]);//9 //accent5
oArrayMem.push_back(oScheme[7]);//10 //accent6
oArrayMem.push_back(oScheme[5]);//11 //hlink
oArrayMem.push_back(oScheme[6]);//12 //folHlink
oArrayMem.push_back(oScheme[0]);//13 //lt1
oArrayMem.push_back(oScheme[1]);//14 //dk1
oArrayMem.push_back(oScheme[2]);//15 //lt2
oArrayMem.push_back(oScheme[3]);//16 //dk2
//0x00 //Background color
//0x01 //Text color
//0x02 //Shadow color
//0x03 //Title text color
//0x04 //Fill color
//0x05 //Accent 1 color
//0x06 //Accent 2 color
//0x07 //Accent 3 color
oScheme = oArrayMem;
}
CString ConvertLayoutType(INT nGeom, BYTE* pPlaceholders)
{
switch (nGeom)
{
case 0x00:
case 0x02:
return _T("title");
case 0x01:
{
NSOfficePPT::PlaceholderEnum phbody = (NSOfficePPT::PlaceholderEnum)pPlaceholders[0];
switch (phbody)
{
case NSOfficePPT::Table:
return _T("tbl");
case NSOfficePPT::OrganizationChart:
return _T("dgm");
case NSOfficePPT::Graph:
return _T("chart");
default:
break;
}
return _T("obj");
}
case 0x07:
return _T("titleOnly");
case 0x08:
{
NSOfficePPT::PlaceholderEnum leftType = (NSOfficePPT::PlaceholderEnum)pPlaceholders[1];
NSOfficePPT::PlaceholderEnum rightType = (NSOfficePPT::PlaceholderEnum)pPlaceholders[2];
if (leftType == NSOfficePPT::Body && rightType == NSOfficePPT::Object)
{
return _T("txAndObj");
}
else if (leftType == NSOfficePPT::Object && rightType == NSOfficePPT::Body)
{
return _T("objAndTx");
}
else if (leftType == NSOfficePPT::Body && rightType == NSOfficePPT::ClipArt)
{
return _T("txAndClipArt");
}
else if (leftType == NSOfficePPT::ClipArt && rightType == NSOfficePPT::Body)
{
return _T("clipArtAndTx");
}
else if (leftType == NSOfficePPT::Body && rightType == NSOfficePPT::Graph)
{
return _T("txAndChart");
}
else if (leftType == NSOfficePPT::Graph && rightType == NSOfficePPT::Body)
{
return _T("chartAndTx");
}
else if (leftType == NSOfficePPT::Body && rightType == NSOfficePPT::MediaClip)
{
return _T("txAndMedia");
}
else if (leftType == NSOfficePPT::MediaClip && rightType == NSOfficePPT::Body)
{
return _T("mediaAndTx");
}
return _T("twoObj");
}
case 0x09:
{
NSOfficePPT::PlaceholderEnum topType = (NSOfficePPT::PlaceholderEnum)pPlaceholders[1];
NSOfficePPT::PlaceholderEnum bottomType = (NSOfficePPT::PlaceholderEnum)pPlaceholders[2];
if (topType == NSOfficePPT::Body && bottomType == NSOfficePPT::Object)
{
return _T("txOverObj");
}
return _T("objOverTx");
}
case 0x0A:
{
NSOfficePPT::PlaceholderEnum leftType = (NSOfficePPT::PlaceholderEnum)pPlaceholders[1];
if (leftType == NSOfficePPT::Object)
{
return _T("objAndTwoObj");
}
return _T("txAndTwoObj");
}
case 0x0B:
{
NSOfficePPT::PlaceholderEnum rightType = (NSOfficePPT::PlaceholderEnum)pPlaceholders[2];
if (rightType == NSOfficePPT::Object)
{
return _T("twoObjAndObj");
}
return _T("twoObjAndTx");
}
case 0x0D:
return _T("twoObjOverTx");
case 0x0F:
return _T("objOnly");
case 0x10:
return _T("blank");
case 0x0E:
return _T("fourObj");
case 0x11:
return _T("vertTitleAndTx");
case 0x12:
return _T("vertTx");
}
return _T("obj");
}
void AddAnimation (DWORD dwSlideID, double Width, double Height, IElement* pElement);
void AddAudioTransition (DWORD dwSlideID, CTransition* pTransition, const CString& strFilePath);
};
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include "Records.h"
#include "../Records/RecordsIncluder.h"
void SRecordHeader::ToXmlWriter(XmlUtils::CXmlWriter* pWriter, POLE::Stream* pStream)
{
if (IsContainer())
{
pWriter->WriteNodeBegin(GetRecordName((DWORD)RecType), TRUE);
pWriter->WriteAttribute(_T("length"), (int)RecLen);
pWriter->WriteNodeEnd(GetRecordName((DWORD)RecType), TRUE, FALSE);
UINT lCurLen = 0;
SRecordHeader oRec;
while (lCurLen < RecLen)
{
if (oRec.ReadFromStream(pStream) == FALSE )
{
break;
}
lCurLen += (8 + oRec.RecLen);
oRec.ToXmlWriter(pWriter, pStream);
}
pWriter->WriteNodeEnd(GetRecordName((DWORD)RecType));
}
else
{
IRecord* pRecord = CreateByType(*this);
pRecord->ReadFromStream(*this, pStream);
pWriter->WriteString(pRecord->ToString());
}
}
void CRecordsContainer::ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
m_oHeader = oHeader;
m_arRecords.clear();
LONG lPosition = 0;
StreamUtils::StreamPosition(lPosition, pStream);
m_oHeader = oHeader;
UINT lCurLen = 0;
ULONG lReadLen = 0;
SRecordHeader oRec;
while (lCurLen < m_oHeader.RecLen)
{
if (oRec.ReadFromStream(pStream) == FALSE )
{
break;
}
IRecord* pRecord = CreateByType(oRec);
pRecord->ReadFromStream(oRec, pStream);
m_arRecords.push_back(pRecord);
lCurLen += (8 + oRec.RecLen);
}
if (lCurLen != m_oHeader.RecLen)
{
// , !!!
LONG lPosition = 0;
StreamUtils::StreamSeek(lPosition + m_oHeader.RecLen, pStream);
}
}
IRecord* CreateByType(SRecordHeader oHeader)
{
IRecord* pRecord = NULL;
switch (oHeader.RecType)
{
CREATE_BY_TYPE(RECORD_TYPE_SLIDELISTWITHTEXT, CRecordSlideListWithText)
CREATE_BY_TYPE(RECORD_TYPE_DOCUMENT_ATOM, CRecordDocumentAtom)
//CREATE_BY_TYPE(RECORD_TYPE_ENDDOCUMENT, CRecordEndDocument)
//CREATE_BY_TYPE(RECORD_TYPE_SSLIDE_LAYOUT_ATOM, CRecordSSlideLayoutAtom)
CREATE_BY_TYPE(RECORD_TYPE_SLIDE_ATOM, CRecordSlideAtom)
CREATE_BY_TYPE(RECORD_TYPE_NOTES_ATOM, CRecordNotesAtom)
CREATE_BY_TYPE(RECORD_TYPE_SLIDE_PERSIST_ATOM, CRecordSlidePersistAtom)
CREATE_BY_TYPE(RECORD_TYPE_ENVIRONMENT, CRecordDocumentTextInfo)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordMasterPersistAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordNotesPersistAtom)
CREATE_BY_TYPE(RECORD_TYPE_SSSLIDE_INFO_ATOM, CSlideShowSlideInfoAtom)
//CREATE_BY_TYPE(RECORD_TYPE_GUIDE_ATOM, CRecordGuideAtom)
//CREATE_BY_TYPE(RECORD_TYPE_VIEWINFO_ATOM, CRecordZoomViewInfoAtom)
//CREATE_BY_TYPE(RECORD_TYPE_VIEWINFO_ATOM, CRecordNoZoomViewInfoAtom)
CREATE_BY_TYPE(RECORD_TYPE_VIEWINFO_ATOM, CRecordViewInfoAtom)
CREATE_BY_TYPE(RECORD_TYPE_SLIDE_VIEWINFO_ATOM, CRecordSlideViewInfoAtom)
//CREATE_BY_TYPE(RECORD_TYPE_VBAINFO_ATOM, CRecordVBAInfoAtom)
//CREATE_BY_TYPE(RECORD_TYPE_SSDOCINFO_ATOM, CRecordSSDocInfoAtom)
//CREATE_BY_TYPE(RECORD_TYPE_DOC_ROUTING_SLIP, CRecordDocRoutingSlipAtom)
//CREATE_BY_TYPE(RECORD_TYPE_EXOBJLIST_ATOM, CRecordExObjListAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordGridSpacing10Atom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordRoundTripThemeAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordRoundTripColorMappingAtom)
//CREATE_BY_TYPE(RECORD_TYPE_NAMEDSHOW_SLIDES, CRecordNamedShowSlidesAtom)
//CREATE_BY_TYPE(RECORD_TYPE_SHEET_PROPERTIES, CRecordNormalViewSetInfoAtom)
CREATE_BY_TYPE(RECORD_TYPE_COLOR_SCHEME_ATOM, CRecordColorSchemeAtom)
CREATE_BY_TYPE(RECORD_TYPE_ORIGINALMAINMASTERID, CRecordTripOriginalMasterId12Atom)
CREATE_BY_TYPE(RECORD_TYPE_COMPOSITEMASTERID, CRecordTripCompositeMasterId12Atom)
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPCONTENTMASTERINFO12, CRecordRoundTripContentMasterInfo12Atom)
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPSHAPEID12, CRecordRoundTripShapeId12Atom)
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPHFPLACEHOLDER12, CRecordRoundTripHFPlaceholder12Atom)
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPCONTENTMASTERID, CRecordRoundTripContentMasterId12Atom)
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPOARTTEXTSTYLES12, CRecordRoundTripOArtTextStyles12Atom)
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPHEADERFOOTERDEFAULTS12ATOM, CRecordRoundTripHeaderFooterDefaults12Atom)
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPDOCFLAGS12, CRecordRoundTripDocFlags12Atom)
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPSHAPECHECKSUMFORCUSTOMLAYOUTS12, CRecordRoundTripShapeCheckSumForCustomLayouts12Atom)
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPNOTESMASTERTEXTSTYLES12, CRecordRoundTripNotesMasterTextStyles12Atom)
//CREATE_BY_TYPE(RECORD_TYPE_ROUNDTRIPCUSTOMTABLESTYLES12, CRecordRoundTripCustomTableStyles12Atom)
//CREATE_BY_TYPE(RECORD_TYPE_BOOKMARK_SEED_ATOM, CRecordBookmarkSeedAtom)
//CREATE_BY_TYPE(RECORD_TYPE_COLOR_SCHEME_ATOM, CRecordSlideColorSchemeAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordSchemeListElementColorSchemeAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordBlipEntityAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordExObjRefAtom)
CREATE_BY_TYPE(RECORD_TYPE_OEPLACEHOLDER_ATOM, CRecordPlaceHolderAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordShapeFlagsAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordShapeFlags10Atom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordRoundTripNewPlaceholderId12Atom)
CREATE_BY_TYPE(RECORD_TYPE_OUTLINE_TEXTREF_ATOM, CRecordOutlineTextRefAtom)
CREATE_BY_TYPE(RECORD_TYPE_TEXT_HEADER_ATOM, CRecordTextHeaderAtom)
CREATE_BY_TYPE(RECORD_TYPE_TEXT_CHARS_ATOM, CRecordTextCharsAtom)
CREATE_BY_TYPE(RECORD_TYPE_STYLE_TEXTPROP_ATOM, CRecordStyleTextPropAtom)
CREATE_BY_TYPE(RECORD_TYPE_TEXTSPECINFO_ATOM, CRecordTextSpecInfoAtom)
CREATE_BY_TYPE(RECORD_TYPE_BASE_TEXTPROP_ATOM, CRecordMasterTextPropAtom)
CREATE_BY_TYPE(RECORD_TYPE_TXMASTERSTYLE_ATOM, CRecordTextMasterStyleAtom)
CREATE_BY_TYPE(RECORD_TYPE_TXCFSTYLE_ATOM, CRecordTextCFExceptionAtom)
CREATE_BY_TYPE(RECORD_TYPE_TXPFSTYLE_ATOM, CRecordTextPFExceptionAtom)
CREATE_BY_TYPE(RECORD_TYPE_TXSISTYLE_ATOM, CRecordTextSIExceptionAtom)
CREATE_BY_TYPE(RECORD_TYPE_TEXTRULER_ATOM, CRecordTextRulerAtom)
//CREATE_BY_TYPE(RECORD_TYPE_TEXTBOOKMARK_ATOM, CRecordTextBookmarkAtom)
CREATE_BY_TYPE(RECORD_TYPE_TEXTBYTES_ATOM, CRecordTextBytesAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordOutlineTextPropsHeaderExAtom)
CREATE_BY_TYPE(RECORD_TYPE_GUIDE_ATOM, CRecordGuideAtom)
CREATE_BY_TYPE(RECORD_TYPE_FONTENTITY_ATOM, CRecordFontEntityAtom)
//CREATE_BY_TYPE(RECORD_TYPE_FONT_EMBEDDEDDATA, CRecordFontEmbedDataBlob)
//CREATE_BY_TYPE(RECORD_TYPE_METAFILE, CRecordMetafileBlob)
CREATE_BY_TYPE(RECORD_TYPE_CSTRING, CRecordCString)
//CREATE_BY_TYPE(RECORD_TYPE_EXOLEOBJ_ATOM, CRecordExOleObjAtom)
//CREATE_BY_TYPE(RECORD_TYPE_EXEMBEDATOM, CRecordExOleEmbedAtom)
//CREATE_BY_TYPE(RECORD_TYPE_BOOKMARK_ENTITY_ATOM, CRecordBookmarkEntityAtom)
//CREATE_BY_TYPE(RECORD_TYPE_EXLINK_ATOM, CRecordExOleLinkAtom)
//CREATE_BY_TYPE(RECORD_TYPE_SRKINSOKU_ATOM, CRecordKinsokuAtom)
//CREATE_BY_TYPE(RECORD_TYPE_EXHYPERLINK_ATOM, CRecordExHyperlinkAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordSlideNumberMCAtom)
CREATE_BY_TYPE(RECORD_TYPE_HEADERSFOOTERS_ATOM, CRecordHeadersFootersAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordMouseTextInteractiveInfoAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordRecolorInfoAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordAnimationInfoAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordDateTimeMCAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN, CRecordGenericDateMCAtom)
CREATE_BY_TYPE(RECORD_TYPE_EX_VIDEOCONTAINER, CRecordExVideoContainer)
CREATE_BY_TYPE(RECORD_TYPE_EX_OBJREF_ATOM, CRecordExObjRefAtom)
CREATE_BY_TYPE(RECORD_TYPE_EX_MEDIA_ATOM, CRecordExMediaAtom)
//CREATE_BY_TYPE(RECORD_TYPE_EXCONTROL_ATOM, CRecordExControlAtom)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_BSTORE_CONTAINER, CRecordBlipStoreContainer)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_BSE, CRecordBlipStoreEntry)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_DG_CONTAINER, CRecordDrawingContainer)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_DGG, CRecordDrawingGroup)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_DG, CRecordDrawingRecord)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_SPGR, CRecordGroupShape)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_SPGR_CONTAINER, CRecordGroupShapeContainer)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_SP_CONTAINER, CRecordShapeContainer)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_SP, CRecordShape)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_CLIENTANCHOR, CRecordClientAnchor)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_CHILDANCHOR, CRecordChildAnchor)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_OPT, CRecordShapeProperties)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_SECONDARY_OPT, CRecordShapeProperties)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_TETRIARY_OPT, CRecordShapeProperties)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_REGROUPITEMS, CRecordRegGroupItems)
CREATE_BY_TYPE(RECORD_TYPE_EX_CDAUDIO, CRecordExCDAudioContainer)
CREATE_BY_TYPE(RECORD_TYPE_EX_WAVAUDIOLINK, CRecordWAVAudioLinkContainer)
CREATE_BY_TYPE(RECORD_TYPE_EX_WAVAUDIOEMBEDDED, CRecordWAVAudioEmbeddedContainer)
CREATE_BY_TYPE(RECORD_TYPE_EX_MIDIAUDIO, CRecordExMIDIAudioContainer)
//
CREATE_BY_TYPE(RECORD_TYPE_INTERACTIVEINFO_ATOM, CRecordInteractiveInfoAtom)
CREATE_BY_TYPE(RECORD_TYPE_TXINTERACTIVEINFO_ATOM, CRecordTextInteractiveInfoAtom)
//
CREATE_BY_TYPE ( RECORD_PROG_TAGS, SlideProgTagsContainer )
CREATE_BY_TYPE(RECORD_TYPE_SOUNDCOLLECTION, CRecordSoundCollectionContainer)
CREATE_BY_TYPE(RECORD_TYPE_EXOBJLIST, CRecordExObjListContainer)
CREATE_BY_TYPE(RECORD_TYPE_SOUND, CRecordSoundContainer)
CREATE_BY_TYPE(RECORD_TYPE_SOUNDDATA, CRecordSoundDataBlob)
default: break;
};
if (NULL == pRecord)
{
if (oHeader.IsContainer())
{
pRecord = new CRecordsContainer();
}
else
{
pRecord = new CUnknownRecord();
}
}
return pRecord;
}
This diff is collapsed.
This diff is collapsed.
#pragma once
#include "../../../ASCPresentationEditor/OfficeDrawing/Document.h"
class CElementInfo
{
public:
LONG m_lOffsetTextStyle;
LONG m_lOffsetTextProp;
POLE::Stream* m_pStream;
LONG m_lPersistIndex;
LONG m_lMasterTextType;
LONG m_lMasterPlaceholderType;
public:
CElementInfo()
{
m_lOffsetTextStyle = -1;
m_lOffsetTextProp = -1;
m_lPersistIndex = -1;
m_pStream = NULL;
m_lMasterTextType = -1;
m_lMasterPlaceholderType = -1;
}
CElementInfo(const CElementInfo& oSrc)
{
*this = oSrc;
}
CElementInfo& operator=(const CElementInfo& oSrc)
{
m_lOffsetTextStyle = oSrc.m_lOffsetTextStyle;
m_lOffsetTextProp = oSrc.m_lOffsetTextProp;
m_lPersistIndex = oSrc.m_lPersistIndex;
m_pStream = oSrc.m_pStream;
m_lMasterTextType = oSrc.m_lMasterTextType;
m_lMasterPlaceholderType = oSrc.m_lMasterPlaceholderType;
return *this;
}
~CElementInfo()
{
}
};
class CSlideInfo
{
public:
std::vector<CTextFullSettings> m_arTextPlaceHolders;
std::map<LONG, CElementInfo> m_mapElements;
//std::unordered_map<LONG, CElementInfo> m_mapElements;
std::vector<BOOL>* m_parEmptyPictures;
nullable_base<NSPresentationEditor::CTextStyles> m_pStyles[9];
public:
CSlideInfo()
{
}
~CSlideInfo()
{
}
CSlideInfo(const CSlideInfo& oSrc)
{
*this = oSrc;
}
CSlideInfo& operator=(const CSlideInfo& oSrc)
{
m_arTextPlaceHolders = oSrc.m_arTextPlaceHolders;
m_parEmptyPictures = oSrc.m_parEmptyPictures;
for (int i = 0; i < 9; ++i)
{
m_pStyles[i] = oSrc.m_pStyles[i];
}
//m_mapElements.clear();
//for (std::map<LONG, CElementInfo>::const_iterator it = oSrc.m_mapElements.begin(); it != oSrc.m_mapElements.end(); ++it)
//{
// m_mapElements.insert(std::pair<LONG, CElementInfo>(it->first,it->second));
//}
m_mapElements = oSrc.m_mapElements;
return *this;
}
DWORD GetIndexPicture(DWORD lIndex)
{
if (NULL == m_parEmptyPictures)
return lIndex;
LONG lResult = 0;
size_t nCount = m_parEmptyPictures->size();
if (lIndex > nCount)
return 0;
for (size_t nIndex = 0; nIndex < lIndex; ++nIndex)
{
if ((*m_parEmptyPictures)[nIndex])
++lResult;
}
return lIndex - lResult;
}
};
\ No newline at end of file
#include "SlidePersist.h"
#include "../Records/TextFullSettings.h"
SSlidePersist::SSlidePersist() : m_arTextAttrs()
{
}
SSlidePersist::SSlidePersist(const SSlidePersist& oSrc)
{
*this = oSrc;
}
CString SSlidePersist::ToString()
{
CString str = _T("");
str.Format(_T("<SlideInfo PsrRef='%d' SlideID='%d' />"), m_nPsrRef, m_nSlideID);
return str;
}
SSlidePersist& SSlidePersist::operator =(const SSlidePersist& oSrc)
{
m_nPsrRef = oSrc.m_nPsrRef;
m_nSlideID = oSrc.m_nSlideID;
m_arTextAttrs = oSrc.m_arTextAttrs;
return (*this);
}
\ No newline at end of file
#pragma once
#if defined(_WIN32) || defined (_WIN64)
#include <atlbase.h>
#include <atlstr.h>
#else
#include "../../../../DesktopEditor/common/ASCVariant.h"
#include "../../../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
#include <vector>
/**************************************************************
...
**************************************************************/
class CTextFullSettings;
struct SSlidePersist
{
DWORD m_nPsrRef;
DWORD m_nSlideID;
std::vector<CTextFullSettings> m_arTextAttrs;
SSlidePersist();
SSlidePersist(const SSlidePersist& oSrc);
CString ToString();
SSlidePersist& operator =(const SSlidePersist& oSrc);
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment