Commit f49c8a05 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@61920 954022d7-b5bf-4e40-9824-e11837661b57
parent d5726524
......@@ -355,6 +355,17 @@ 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
ASCOfficePPTXFile/PPTXFormat/DocxFormat/Drawing svnc_tsvn_003alogminsize=5
ASCOfficePPTXFile/PPTXLib/Mac svnc_tsvn_003alogminsize=5
ASCOfficePPTXFile/PPTXLib/Mac/PPTXFormatLib svnc_tsvn_003alogminsize=5
ASCOfficePPTXFile/PPTXLib/Mac/PPTXFormatLib.xcodeproj svnc_tsvn_003alogminsize=5
ASCOfficePPTXFile/PPTXLib/Mac/PPTXFormatLib.xcodeproj/project.xcworkspace svnc_tsvn_003alogminsize=5
ASCOfficePPTXFile/PPTXLib/Mac/PPTXFormatLib.xcodeproj/project.xcworkspace/xcuserdata svnc_tsvn_003alogminsize=5
ASCOfficePPTXFile/PPTXLib/Mac/PPTXFormatLib.xcodeproj/project.xcworkspace/xcuserdata/alexey.musinov.xcuserdatad svnc_tsvn_003alogminsize=5
ASCOfficePPTXFile/PPTXLib/Mac/PPTXFormatLib.xcodeproj/project.xcworkspace/xcuserdata/alexey.musinov.xcuserdatad/UserInterfaceState.xcuserstate svn_mime_002dtype=application%2Foctet-stream
ASCOfficePPTXFile/PPTXLib/Mac/PPTXFormatLib.xcodeproj/xcuserdata svnc_tsvn_003alogminsize=5
ASCOfficePPTXFile/PPTXLib/Mac/PPTXFormatLib.xcodeproj/xcuserdata/alexey.musinov.xcuserdatad svnc_tsvn_003alogminsize=5
ASCOfficePPTXFile/PPTXLib/Mac/PPTXFormatLib.xcodeproj/xcuserdata/alexey.musinov.xcuserdatad/xcschemes 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
......
......@@ -78,6 +78,11 @@ ASCOfficeOdpFile/ODPFormat/Release
ASCOfficeOdpFile/Odp2DrawingXML/Debug
ASCOfficeOdpFile/Odp2DrawingXML/Release
ASCOfficeOdtFile/Projects/*
ASCOfficePPTXFile/*.suo
ASCOfficePPTXFile/Debug
ASCOfficePPTXFile/PPTXFormat/!_
ASCOfficePPTXFile/PPTXFormat/_
ASCOfficePPTXFile/Release
_tags/rev_61879/ASCImageStudio3/AVSImageRaw3/trunk/dcraw_8-94/Output
_tags/rev_61879/ASCImageStudio3/AVSImageRaw3/trunk/dcraw_8-94/Test/AVSImageRawSimpleConverter/bin
_tags/rev_61879/ASCImageStudio3/AVSImageRaw3/trunk/dcraw_8-94/Test/AVSImageRawSimpleConverter/obj
......
This source diff could not be displayed because it is too large. You can view the blob instead.
#ifndef ASC_OFFICE_DRAWING_CONVERTER
#define ASC_OFFICE_DRAWING_CONVERTER
#if defined(_WIN32) || defined (_WIN64)
#include <atlbase.h>
#include <atlstr.h>
#else
#include "../DesktopEditor/common/ASCVariant.h"
#endif
#include "../Common/DocxFormat/Source/Base/Base.h"
#include "../Common/DocxFormat/Source/Base/Nullable.h"
#include "../ASCPresentationEditor/OfficeDrawing/Shapes/BaseShape/PPTShape/PPTShapeEnum.h"
#include <vector>
#include <map>
class IRenderer;
class CShape;
class CPPTShape;
class CFontManager;
class COfficeFontPicker;
namespace XmlUtils
{
class CXmlNode;
}
namespace NSCommon
{
template<typename Type> class smart_ptr;
}
namespace BinDocxRW
{
class CDocxSerializer;
}
namespace NSBinPptxRW
{
class CBinaryFileWriter;
class CBinaryFileReader;
class CImageManager2;
class CXmlWriter;
}
namespace PPTX
{
class WrapperFile;
class WrapperWritingElement;
class CCommonRels;
namespace Logic
{
class SpTreeElem;
class Xfrm;
class Shape;
}
class CStringTrimmer
{
public:
std::vector<CString> m_arParams;
TCHAR m_Separator;
public:
CStringTrimmer();
~CStringTrimmer();
public:
void LoadFromString(CString& strParams);
double GetParameter(int nIndex, double dDefault);
};
class CCSS
{
public:
std::map<CString, CString> m_mapSettings;
CString m_strClassName;
public:
CCSS();
~CCSS();
AVSINLINE void Clear();
public:
void LoadFromString(CString& strParams);
void LoadFromString2(CString& strParams);
};
class CStylesCSS
{
public:
std::vector<CCSS> m_arStyles;
public:
CStylesCSS();
~CStylesCSS();
AVSINLINE void Clear();
public:
void LoadStyles(CString& strParams);
};
}
class CSpTreeElemProps
{
public:
LONG X;
LONG Y;
LONG Width;
LONG Height;
bool IsTop;
public:
CSpTreeElemProps();
};
class CElementProps
{
public:
std::map<LONG, VARIANT> m_Properties;
public:
CElementProps();
~CElementProps();
void FinalRelease();
public:
HRESULT(GetProperty)(LONG lId, VARIANT* pProp);
HRESULT(SetProperty)(LONG lId, VARIANT prop);
public:
static bool CopyProperty(VARIANT& oDst, const VARIANT& oSrc);
};
namespace NSBinPptxRW
{
class CDrawingConverter
{
public:
class CElement
{
public:
PPTX::WrapperWritingElement* m_pElement;
CElementProps* m_pProps;
public:
CElement();
~CElement();
CElement& operator=(const CElement& oSrc);
CElement(const CElement& oSrc);
};
std::map<CString, CShape*> m_mapShapeTypes;
std::map<CString, NSCommon::smart_ptr<PPTX::CCommonRels>> m_mapRels;
CString m_strCurrentRelsPath;
NSBinPptxRW::CBinaryFileWriter* m_pBinaryWriter;
int m_lNextId;
int m_lCurrentObjectTop;
NSBinPptxRW::CBinaryFileReader* m_pReader;
NSBinPptxRW::CImageManager2* m_pImageManager;
NSBinPptxRW::CXmlWriter* m_pXmlWriter;
int m_nCurrentIndexObject;
IRenderer* m_pOOXToVMLRenderer;
BOOL m_bIsUseConvertion2007;
NSCommon::smart_ptr<PPTX::WrapperFile>* m_pTheme;
NSCommon::smart_ptr<PPTX::WrapperWritingElement>* m_pClrMap;
CString m_strFontDirectory;
public:
CDrawingConverter();
~CDrawingConverter();
public:
HRESULT SetMainDocument (BinDocxRW::CDocxSerializer* pDocument);
HRESULT SetRelsPath (const CString& bsRelsPath);
CString GetRelsPath();
HRESULT SetMediaDstPath (const CString& bsMediaPath);
HRESULT AddShapeType(const CString& bsXml);
HRESULT AddObject(const CString& bsXml, CString** pMainProps);
HRESULT GetThemeBinary(BYTE** ppBinary, long& lBinarySize, const CString& bsThemeFilePath);
HRESULT SaveThemeXml(LONG lStart, LONG lLength, const CString& bsThemePath);
HRESULT SaveObject(LONG lStart, LONG lLength, const CString& bsMainProps, CString** bsXml);
HRESULT SaveObjectEx(LONG lStart, LONG lLength, const CString& bsMainProps, LONG lDocType, CString** bsXml);
HRESULT GetRecordBinary(LONG lRecordType, const CString& bsXml);
HRESULT GetRecordXml(LONG lStart, LONG lLength, LONG lRecType, LONG lDocType, CString** bsXml);
HRESULT SetDstContentRels();
HRESULT SaveDstContentRels(const CString& bsRelsPath);
HRESULT WriteRels (const CString& bsType, const CString& bsTarget, const CString& bsTargetMode, LONG* lId);
HRESULT LoadClrMap (const CString& bsXml);
HRESULT(GetTxBodyBinary)(const CString& bsXml);
HRESULT(GetTxBodyXml)(LONG lStart, LONG lLength, CString** pbstrXml);
HRESULT(SetFontDir)(const CString& bsFontDir);
HRESULT SetFontPicker(COfficeFontPicker* pFontPicker);
HRESULT(SetAdditionalParam)(const CString& ParamName, BYTE *pArray, size_t szCount);
HRESULT(SetAdditionalParam)(const CString& ParamName, VARIANT ParamValue);
HRESULT(GetAdditionalParam)(const CString& ParamName, BYTE **pArray, size_t& szCount);
HRESULT(GetAdditionalParam)(const CString& ParamName, VARIANT* ParamValue);
public:
void SetFontManager(CFontManager* pFontManager);
protected:
nullable<PPTX::Logic::Xfrm> m_oxfrm_override;
bool ParceObject(const CString& strXml, CString** pMainProps);
void SendMainProps(const CString& strMainProps, CString**& pMainProps);
PPTX::Logic::SpTreeElem doc_LoadShape(XmlUtils::CXmlNode& oNodeShape, CString**& pMainProps, bool bIsTop = true);
PPTX::Logic::SpTreeElem doc_LoadGroup(XmlUtils::CXmlNode& oNode, CString**& pMainProps, bool bIsTop = true);
CString GetVMLShapeXml(CPPTShape* pPPTShape);
CString GetVMLShapeXml(PPTX::Logic::SpTreeElem& oElem);
void CheckBrushShape(PPTX::Logic::SpTreeElem& oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape);
void CheckPenShape(PPTX::Logic::SpTreeElem& oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape);
void LoadCoordSize(XmlUtils::CXmlNode& oNode, ::CShape* pShape);
CString GetDrawingMainProps(XmlUtils::CXmlNode& oNode, PPTX::CCSS& oCssStyles, CSpTreeElemProps& oProps);
void ConvertMainPropsToVML(const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter, PPTX::Logic::SpTreeElem& oElem);
void ConvertShapeVML(PPTX::Logic::SpTreeElem& oShape, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter);
void ConvertGroupVML(PPTX::Logic::SpTreeElem& oGroup, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter);
void ConvertTextVML(XmlUtils::CXmlNode &nodeTextBox, PPTX::Logic::Shape* pShape);
void Clear();
HRESULT SetCurrentRelsPath();
};
}
#endif //OOX_IFILE_CONTAINER_INCLUDE_H_
// AVSOfficeDrawingConverter.h : Declaration of the CAVSOfficeDrawingConverter.h
#pragma once
#include "stdafx.h"
#include "resource.h" // main symbols
#include "../Common/OfficeFileTemplate.h"
#include "ASCOfficeDrawingConverter.h"
// IAVSODObjectProps
[object, uuid("44B693E1-F4F9-4547-ACEF-0AE037C84485"), dual, pointer_default(unique)]
__interface IAVSODObjectProps : IDispatch
{
[id(1)] HRESULT GetProperty([in] LONG lId, [out, retval] VARIANT* pProp);
[id(2)] HRESULT SetProperty([in] LONG lId, [in] VARIANT prop);
[id(1000)] HRESULT SetAdditionalParam([in] BSTR ParamName, [in] VARIANT ParamValue);
[id(1001)] HRESULT GetAdditionalParam([in] BSTR ParamName, [out, retval] VARIANT* ParamValue);
};
// IAVSOfficeDrawingConverter
[object, uuid("8E0FBC40-9B34-40bf-B68A-0FA320E1B004"), dual, pointer_default(unique)]
__interface IAVSOfficeDrawingConverter : IDispatch
{
[id(1)] HRESULT SetMainDocument([in] IUnknown* pDocument);
[id(2)] HRESULT SetRelsPath([in] BSTR bsRelsPath);
[id(3)] HRESULT SetMediaDstPath([in] BSTR bsMediaPath);
[id(9)] HRESULT AddShapeType([in] BSTR bsXml);
[id(10)] HRESULT AddObject([in] BSTR bsXml, [out] BSTR* pMainProps, [out, satype("BYTE")] SAFEARRAY** ppBinary);
[id(11)] HRESULT SaveObject([in, satype("BYTE")] SAFEARRAY* pBinaryObj, [in] LONG lStart, [in] LONG lLength, [in] BSTR bsMainProps, [out] BSTR* bsXml);
[id(12)] HRESULT SaveObjectEx([in, satype("BYTE")] SAFEARRAY* pBinaryObj, [in] LONG lStart, [in] LONG lLength, [in] BSTR bsMainProps, [in] LONG lDocType, [out] BSTR* bsXml);
[id(13)] HRESULT GetRecordBinary([in] LONG lRecordType, [in] BSTR bsXml, [out, satype("BYTE")] SAFEARRAY** ppBinary);
[id(14)] HRESULT GetRecordXml([in, satype("BYTE")] SAFEARRAY* pBinaryObj, [in] LONG lStart, [in] LONG lLength, [in] LONG lRecType, [in] LONG lDocType, [out] BSTR* bsXml);
[id(20)] HRESULT AddObject2([in] BSTR bsXml, [in, satype("BYTE")] SAFEARRAY* pBinaryObj, [out] BSTR* pXmlOutput);
[id(30)] HRESULT GetThemeBinary([in] BSTR bsThemeFilePath, [out, satype("BYTE")] SAFEARRAY** ppBinary);
[id(31)] HRESULT SaveThemeXml([in, satype("BYTE")] SAFEARRAY* pBinaryTheme, [in] LONG lStart, [in] LONG lLength, [in] BSTR bsThemePath);
[id(40)] HRESULT SetDstContentRels();
[id(41)] HRESULT SaveDstContentRels([in] BSTR bsRelsPath);
[id(42)] HRESULT WriteRels([in] BSTR bsType, [in] BSTR bsTarget, [in] BSTR bsTargetMode, [out] LONG* lId);
[id(50)] HRESULT LoadClrMap([in] BSTR bsXml);
[id(60)] HRESULT GetTxBodyBinary([in] BSTR bsXml, [out, satype("BYTE")] SAFEARRAY** ppBinary);
[id(61)] HRESULT GetTxBodyXml([in, satype("BYTE")] SAFEARRAY* pBinary, [in] LONG lStart, [in] LONG lLength, BSTR* pbstrXml);
[id(62)] HRESULT SetFontDir([in] BSTR bsFontDir);
[id(1000)] HRESULT SetAdditionalParam([in] BSTR ParamName, [in] VARIANT ParamValue);
[id(1001)] HRESULT GetAdditionalParam([in] BSTR ParamName, [out, retval] VARIANT* ParamValue);
};
// CAVSODObjectProps
[coclass, uuid("4AB04382-4B51-4674-A691-BE2691A5F387"), threading(apartment), vi_progid("AVSOfficePPTXFile.ODObjectProps"), progid("AVSOfficePPTXFile.ODObjectProps.1"), version(1.0), registration_script("control.rgs")]
class ATL_NO_VTABLE CAVSODObjectProps
: public IAVSODObjectProps
{
private:
CElementProps m_oProps;
public:
CAVSODObjectProps() : m_oProps()
{
}
~CAVSODObjectProps()
{
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
STDMETHOD(GetProperty)(LONG lId, VARIANT* pProp)
{
return m_oProps.GetProperty(lId, pProp);
}
STDMETHOD(SetProperty)(LONG lId, VARIANT prop)
{
return m_oProps.SetProperty(lId, prop);
}
STDMETHOD(SetAdditionalParam)(BSTR ParamName, VARIANT ParamValue)
{
return S_OK;
}
STDMETHOD(GetAdditionalParam)(BSTR ParamName, VARIANT* ParamValue)
{
return S_OK;
}
};
// CAVSOfficeDrawingConverter
[coclass, uuid("BA240E3F-CFE4-45d7-96BB-97CDD73F63C3"), event_source(com), threading(apartment), vi_progid("AVSOfficePPTXFile.ODConverter"), progid("AVSOfficePPTXFile.ODConverter.1"), version(1.0), registration_script("control.rgs")]
class ATL_NO_VTABLE CAVSOfficeDrawingConverter
: public IAVSOfficeDrawingConverter
{
private:
NSBinPptxRW::CDrawingConverter m_oDrawingConverter;
public:
__event __interface _IAVSOfficeFileTemplateEvents2;
CAVSOfficeDrawingConverter()
{
}
~CAVSOfficeDrawingConverter()
{
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
STDMETHOD(SetMainDocument)(IUnknown* pDocument)
{
return S_OK;//m_oDrawingConverter.SetMainDocument(pDocument);
}
STDMETHOD(SetRelsPath)(BSTR bsRelsPath)
{
return m_oDrawingConverter.SetRelsPath(CString(bsRelsPath));
}
STDMETHOD(SetMediaDstPath)(BSTR bsMediaPath)
{
return m_oDrawingConverter.SetMediaDstPath(CString(bsMediaPath));
}
STDMETHOD(AddShapeType)(BSTR bsXml)
{
return m_oDrawingConverter.AddShapeType(CString(bsXml));
}
STDMETHOD(AddObject)(BSTR bsXml, BSTR* pMainProps, SAFEARRAY** ppBinary)
{
return S_OK;//m_oDrawingConverter.AddObject(bsXml, pMainProps, ppBinary);
}
STDMETHOD(AddObject2)(BSTR bsXml, SAFEARRAY* pBinaryObj, BSTR* pXmlOutput)
{
return S_OK;
}
STDMETHOD(GetThemeBinary)(BSTR bsThemeFilePath, SAFEARRAY** ppBinary)
{
return S_OK;//m_oDrawingConverter.GetThemeBinary(bsThemeFilePath, ppBinary);
}
STDMETHOD(SaveThemeXml)(SAFEARRAY* pBinaryTheme, LONG lStart, LONG lLength, BSTR bsThemePath)
{
return S_OK;//m_oDrawingConverter.SaveThemeXml(pBinaryTheme, lStart, lLength, bsThemePath);
}
STDMETHOD(SaveObject)(SAFEARRAY* pBinaryObj, LONG lStart, LONG lLength, BSTR bsMainProps, BSTR* bsXml)
{
return S_OK;//m_oDrawingConverter.SaveObject(pBinaryObj, lStart, lLength, bsMainProps, bsXml);
}
STDMETHOD(SaveObjectEx)(SAFEARRAY* pBinaryObj, LONG lStart, LONG lLength, BSTR bsMainProps, LONG lDocType, BSTR* bsXml)
{
return S_OK;//m_oDrawingConverter.SaveObjectEx(pBinaryObj, lStart, lLength, bsMainProps, lDocType, bsXml);
}
STDMETHOD(GetRecordBinary)(LONG lRecordType, BSTR bsXml, SAFEARRAY** ppBinary)
{
return S_OK;//m_oDrawingConverter.GetRecordBinary(lRecordType, bsXml, ppBinary);
}
STDMETHOD(GetRecordXml)(SAFEARRAY* pBinaryObj, LONG lStart, LONG lLength, LONG lRecType, LONG lDocType, BSTR* bsXml)
{
return S_OK;//m_oDrawingConverter.GetRecordXml(pBinaryObj, lStart, lLength, lRecType, lDocType, bsXml);
}
STDMETHOD(SetDstContentRels)()
{
return m_oDrawingConverter.SetDstContentRels();
}
STDMETHOD(SaveDstContentRels)(BSTR bsRelsPath)
{
return m_oDrawingConverter.SaveDstContentRels(CString(bsRelsPath));
}
STDMETHOD(WriteRels)(BSTR bsType, BSTR bsTarget, BSTR bsTargetMode, LONG* lId)
{
return m_oDrawingConverter.WriteRels(CString(bsType), CString(bsTarget), CString(bsTargetMode), lId);
}
STDMETHOD(LoadClrMap)(BSTR bsXml)
{
return m_oDrawingConverter.LoadClrMap(CString(bsXml));
}
STDMETHOD(GetTxBodyBinary)(BSTR bsXml, SAFEARRAY** ppBinary)
{
return S_OK;//m_oDrawingConverter.GetTxBodyBinary(bsXml, ppBinary);
}
STDMETHOD(GetTxBodyXml)(SAFEARRAY* pBinary, LONG lStart, LONG lLength, BSTR *pbstrXml)
{
return S_OK;//m_oDrawingConverter.GetTxBodyXml(pBinary, lStart, lLength, pbstrXml);
}
STDMETHOD(SetFontDir)(BSTR bsFontDir)
{
return m_oDrawingConverter.SetFontDir(CString(bsFontDir));
}
STDMETHOD(SetAdditionalParam)(BSTR ParamName, VARIANT ParamValue)
{
CString name = (CString)ParamName;
if (name == _T("SerializeImageManager") || name == _T("SerializeImageManager2"))
{
#ifdef _WIN32
SAFEARRAY *pArray = ParamValue.parray;
return m_oDrawingConverter.SetAdditionalParam(CString(ParamName), (BYTE*) pArray->pvData, pArray->rgsabound[0].cElements);
#endif
return S_OK;
}
else
return m_oDrawingConverter.SetAdditionalParam(CString(ParamName), ParamValue);
}
STDMETHOD(GetAdditionalParam)(BSTR ParamName, VARIANT* ParamValue)
{
// convert
CString name = (CString)ParamName;
if (name == _T("SerializeImageManager") || name == _T("SerializeImageManager2"))
{
BYTE* pBuffer = NULL;
size_t nCount = 0;
HRESULT hRes = m_oDrawingConverter.GetAdditionalParam(CString(ParamName), &pBuffer, nCount);
if (S_OK == hRes && NULL != pBuffer)
{
#ifdef _WIN32
SAFEARRAY* pArray = SafeArrayCreateVector(VT_UI1, nCount);
BYTE* pDataD = (BYTE*) pArray->pvData;
memcpy(pDataD, pBuffer, nCount);
ParamValue->vt = VT_ARRAY;
ParamValue->parray = pArray;
#endif
}
delete [] pBuffer;
return hRes;
}
else
return m_oDrawingConverter.GetAdditionalParam(CString(ParamName), ParamValue);
}
};
//ASCOfficePPTXFile.cpp : Implementation of DLL Exports.
#include "stdafx.h"
#include "resource.h"
#include "ASCOfficePPTXFileComInterface.h"
#include "ASCOfficeDrawingConverterComInterface.h"
// The module attribute causes DllMain, DllRegisterServer and DllUnregisterServer to be automatically implemented for you
[ module(dll, uuid = "{95DEE027-7707-4078-A314-33D35AE842FD}",
name = "ASCOfficePPTXFile",
helpstring = "ASCOfficePPTXFile 1.0 Type Library",
resource_name = "IDR_ASCOFFICEPPTXFILE") ];
#ifndef ASC_OFFICE_PPTX_FILE
#define ASC_OFFICE_PPTX_FILE
//todo
#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 "../Common/DocxFormat/Source/Base/Base.h"
#include "PPTXFormat/PPTXEvent.h"
typedef void (*load_from_resource)(void*, int, CString&);
typedef bool (*extract_to_directory)(void*, CString&, CString&);
typedef bool (*compress_from_directory)(void*, CString&, CString&);
typedef bool (*progress_operation)(void*, long, long);
namespace PPTX
{
class Folder;
}
class CPPTXFile : public PPTX::IPPTXEvent
{
private:
//todo
//OfficeUtils::IOfficeUtils* m_pOfficeUtils;
PPTX::Folder* m_pFolder;
CString m_strTempDir;
CString m_strDirectory;
// writer to ppty
CString m_strFontDirectory;
CString m_strMediaDirectory;
BOOL m_bIsUseSystemFonts;
CString m_strEmbeddedFontsDirectory;
CString m_strFolderThemes;
//load_from_resource m_fCallbackResource;
extract_to_directory m_fCallbackExtract;
compress_from_directory m_fCallbackCompress;
progress_operation m_fCallbackProgress;
void* m_pCallbackArg;
public:
CPPTXFile(extract_to_directory fCallbackExtract, compress_from_directory fCallbackCompress, progress_operation fCallbackProgress, void* pCallbackArg);
~CPPTXFile();
HRESULT LoadFromFile(BSTR sSrcFileName, BSTR sDstPath, BSTR sXMLOptions);
HRESULT SaveToFile(BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions);
#if defined(_WIN32) || defined (_WIN64)
STDMETHOD(get_TempDirectory)(BSTR* pVal);
STDMETHOD(put_TempDirectory)(BSTR newVal);
STDMETHOD(GetDVDXml)(BSTR* pbstrPTTXml);
STDMETHOD(GetBluRayXml)(BSTR* pbstrDVDXml);
STDMETHOD(get_DrawingXml)(BSTR* pVal);
STDMETHOD(SetAdditionalParam)(BSTR ParamName, VARIANT ParamValue);
STDMETHOD(GetAdditionalParam)(BSTR ParamName, VARIANT* ParamValue);
virtual bool Progress(long ID, long Percent);
// to PPTY
STDMETHOD(SetMediaDir)(BSTR bsMediaDir);
STDMETHOD(SetFontDir)(BSTR bsFontDir);
STDMETHOD(SetThemesDir)(BSTR bsDir);
STDMETHOD(SetUseSystemFonts)(VARIANT_BOOL useSystemFonts);
STDMETHOD(OpenFileToPPTY)(BSTR bsInput, BSTR bsOutput);
STDMETHOD(OpenDirectoryToPPTY)(BSTR bsInput, BSTR bsOutput);
STDMETHOD(ConvertPPTYToPPTX)(BSTR bsInput, BSTR bsOutput);
#else
HRESULT get_TempDirectory(BSTR* pVal);
HRESULT put_TempDirectory(BSTR newVal);
HRESULT GetDVDXml(BSTR* pbstrPTTXml);
HRESULT GetBluRayXml(BSTR* pbstrDVDXml);
HRESULT get_DrawingXml(BSTR* pVal);
HRESULT SetAdditionalParam(BSTR ParamName, VARIANT ParamValue);
HRESULT GetAdditionalParam(BSTR ParamName, VARIANT* ParamValue);
virtual bool Progress(long ID, long Percent);
// to PPTY
HRESULT SetMediaDir(BSTR bsMediaDir);
HRESULT SetFontDir(BSTR bsFontDir);
HRESULT SetThemesDir(BSTR bsDir);
HRESULT SetUseSystemFonts(VARIANT_BOOL useSystemFonts);
HRESULT OpenFileToPPTY(BSTR bsInput, BSTR bsOutput);
HRESULT OpenDirectoryToPPTY(BSTR bsInput, BSTR bsOutput);
HRESULT ConvertPPTYToPPTX(BSTR bsInput, BSTR bsOutput);
#endif
};
#endif //ASC_OFFICE_PPTX_FILE
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define COMPONENT_NAME "OfficePPTXFile"
#include "../Common/FileInfo.h"
#include "version.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Russian resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
#ifdef _WIN32
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // Russian resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION INTVER
PRODUCTVERSION INTVER
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", COMPANY_NAME
VALUE "FileDescription", FILE_DESCRIPTION_ACTIVEX
VALUE "FileVersion", STRVER
VALUE "InternalName", COMPONENT_FILE_NAME_DLL
VALUE "LegalCopyright", LEGAL_COPYRIGHT
VALUE "OriginalFilename", COMPONENT_FILE_NAME_DLL
VALUE "ProductName", FILE_DESCRIPTION_ACTIVEX
VALUE "ProductVersion", STRVER
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_ASCOFFICEPPTXFILE REGISTRY "ASCOfficePPTXFile.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_PROJNAME "ASCOfficePPTXFile"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
\ No newline at end of file
HKCR
{
NoRemove AppID
{
'%APPID%' = s 'ASCOfficePPTXFile'
'ASCOfficePPTXFile.DLL'
{
val AppID = s '%APPID%'
}
}
}
This diff is collapsed.
This diff is collapsed.
// CAVSOfficePPTXFile.h : Declaration of the CAVSOfficePPTXFile
#pragma once
#include "stdafx.h"
#include "resource.h" // main symbols
#include "../Common/OfficeFileTemplate.h"
#include "ASCOfficePPTXFile.h"
#include "../ASCOfficeUtils/ASCOfficeUtilsLib/OfficeUtils.h"
#include "../Common/DocxFormat/Source/SystemUtility/File.h"
bool comExtractFile(void* pArg, CString& sFile, CString& sDir);
bool comCompressFile(void* pArg, CString& sDir, CString& sFile);
bool comProgress(void* pArg, long ID, long Percent);
// IAVSOfficePPTXFile
[object, uuid("ED1EC17E-EE0E-4cae-9E63-1C57235CE286"), dual, pointer_default(unique)]
__interface IAVSOfficePPTXFile : IAVSOfficeFileTemplate
{
// [id(3), helpstring("method SaveAsDrawingXML")] HRESULT SaveAsDrawingXML([in] BSTR sSrcFileName, [in] BSTR sDestPath, [in] BSTR sDestXMLFileName);
[propget, id(4), helpstring("property TempDirectory")] HRESULT TempDirectory([out, retval] BSTR* pVal);
[propput, id(4), helpstring("property TempDirectory")] HRESULT TempDirectory([in] BSTR newVal);
[id(5), helpstring("method GetDVDXml")] HRESULT GetDVDXml([out,retval] BSTR* pbstrPTTXml);
[id(6), helpstring("method GetBluRayXml")] HRESULT GetBluRayXml([out,retval] BSTR* pbstrDVDXml);
[propget, id(7), helpstring("property DrawingXml")] HRESULT DrawingXml([out, retval] BSTR* pVal);
[id(2000 + 0)] HRESULT SetAdditionalParam([in] BSTR ParamName, [in] VARIANT ParamValue);
[id(2001 + 1)] HRESULT GetAdditionalParam([in] BSTR ParamName, [out, retval] VARIANT* ParamValue);
};
// IAVSOfficePPTXFile2
[object, uuid("4F4EA472-EC78-495c-B627-5798EA364468"), dual, pointer_default(unique)]
__interface IAVSOfficePPTXFile2 : IDispatch
{
[id(10000 + 0)] HRESULT OpenFileToPPTY([in] BSTR bsInputDir, [in] BSTR bsFileDst);
[id(10000 + 1)] HRESULT OpenDirectoryToPPTY([in] BSTR bsInputDir, [in] BSTR bsFileDst);
[id(10000 + 2)] HRESULT SetMediaDir([in] BSTR bsMediaDir);
[id(10000 + 3)] HRESULT SetFontDir([in] BSTR bsFontDir);
[id(10000 + 4)] HRESULT SetUseSystemFonts([in] VARIANT_BOOL useSystemFonts);
[id(10000 + 5)] HRESULT ConvertPPTYToPPTX([in] BSTR bsInputFile, [in] BSTR bsFileDst);
[id(10000 + 6)] HRESULT SetThemesDir([in] BSTR bsThemesPath);
};
// CAVSOfficePPTXFile
[coclass, uuid("5731F488-94FF-44b7-8A3E-54CBB746F5B1"), event_source(com), threading(apartment), vi_progid("AVSOfficePPTXFile.OfficePPTXFile"), progid("AVSOfficePPTXFile.OfficePPTXFile.1"), version(1.0), registration_script("control.rgs")]
class ATL_NO_VTABLE CAVSOfficePPTXFile
: public IAVSOfficePPTXFile
, public IAVSOfficePPTXFile2
{
private:
CPPTXFile m_oCPPTXFile;
public:
__event __interface _IAVSOfficeFileTemplateEvents2;
CAVSOfficePPTXFile() : m_oCPPTXFile(comExtractFile, comCompressFile, comProgress, this)
{
}
~CAVSOfficePPTXFile()
{
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
HRESULT LoadFromFile(BSTR sSrcFileName, BSTR sDstPath, BSTR sXMLOptions)
{
return m_oCPPTXFile.LoadFromFile(sSrcFileName, sDstPath, sXMLOptions);
}
public:
HRESULT SaveToFile(BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions)
{
return m_oCPPTXFile.SaveToFile(sDstFileName, sSrcPath, sXMLOptions);
}
public:
STDMETHOD(get_TempDirectory)(BSTR* pVal)
{
return m_oCPPTXFile.get_TempDirectory(pVal);
}
STDMETHOD(put_TempDirectory)(BSTR newVal)
{
return m_oCPPTXFile.put_TempDirectory(newVal);
}
public:
STDMETHOD(GetDVDXml)(BSTR* pbstrPTTXml)
{
return m_oCPPTXFile.GetDVDXml(pbstrPTTXml);
}
STDMETHOD(GetBluRayXml)(BSTR* pbstrDVDXml)
{
return m_oCPPTXFile.GetBluRayXml(pbstrDVDXml);
}
public:
STDMETHOD(get_DrawingXml)(BSTR* pVal)
{
return m_oCPPTXFile.get_DrawingXml(pVal);
}
STDMETHOD(SetAdditionalParam)(BSTR ParamName, VARIANT ParamValue)
{
return m_oCPPTXFile.SetAdditionalParam(ParamName, ParamValue);
}
STDMETHOD(GetAdditionalParam)(BSTR ParamName, VARIANT* ParamValue)
{
return m_oCPPTXFile.GetAdditionalParam(ParamName, ParamValue);
}
// to PPTY
STDMETHOD(SetMediaDir)(BSTR bsMediaDir)
{
return m_oCPPTXFile.SetMediaDir(bsMediaDir);
}
STDMETHOD(SetFontDir)(BSTR bsFontDir)
{
return m_oCPPTXFile.SetFontDir(bsFontDir);
}
STDMETHOD(SetThemesDir)(BSTR bsDir)
{
return m_oCPPTXFile.SetThemesDir(bsDir);
}
STDMETHOD(SetUseSystemFonts)(VARIANT_BOOL useSystemFonts)
{
return m_oCPPTXFile.SetUseSystemFonts(useSystemFonts);
}
STDMETHOD(OpenFileToPPTY)(BSTR bsInput, BSTR bsOutput)
{
return m_oCPPTXFile.OpenFileToPPTY(bsInput, bsOutput);
}
STDMETHOD(OpenDirectoryToPPTY)(BSTR bsInput, BSTR bsOutput)
{
return m_oCPPTXFile.OpenDirectoryToPPTY(bsInput, bsOutput);
}
STDMETHOD(ConvertPPTYToPPTX)(BSTR bsInput, BSTR bsOutput)
{
return m_oCPPTXFile.ConvertPPTYToPPTX(bsInput, bsOutput);
}
void LoadResourceFile(HINSTANCE hInst, LPCTSTR sResName, LPCTSTR sResType, const CString& strDstFile)
{
HRSRC hrRes = FindResource(hInst, sResName, sResType);
if (!hrRes)
return;
HGLOBAL hGlobal = LoadResource(hInst, hrRes);
DWORD sz = SizeofResource(hInst, hrRes);
void* ptrRes = LockResource(hGlobal);
CFile oFile;
oFile.CreateFile(strDstFile);
oFile.WriteFile(ptrRes, sz);
UnlockResource(hGlobal);
FreeResource(hGlobal);
}
};
bool comExtractFile(void* pArg, CString& sFile, CString& sDir)
{
COfficeUtils *pOfficeUtils = new COfficeUtils(NULL);
if (pOfficeUtils == NULL) return false;
BSTR bsFile = sFile.AllocSysString();
BSTR bsDir = sDir.AllocSysString();
HRESULT hr = pOfficeUtils->ExtractToDirectory( bsFile, bsDir, NULL, 0);
SysFreeString(bsFile);
SysFreeString(bsDir);
delete pOfficeUtils;
if(hr != S_OK)
return false;
return true;
}
bool comCompressFile(void* pArg, CString& sDir, CString& sFile)
{
COfficeUtils *pOfficeUtils = new COfficeUtils(NULL);
if (pOfficeUtils == NULL) return false;
BSTR bsDir = sDir.AllocSysString();
BSTR bsFile = sFile.AllocSysString();
HRESULT hr = pOfficeUtils->CompressFileOrDirectory( bsDir, bsFile, -1 );
SysFreeString(bsDir);
SysFreeString(bsFile);
delete pOfficeUtils;
if(hr != S_OK)
return false;
return true;
}
bool comProgress(void* pArg, long ID, long Percent)
{
CAVSOfficePPTXFile* pCAVSOfficePPTXFile = static_cast<CAVSOfficePPTXFile*>(pArg);
SHORT res = 0;
pCAVSOfficePPTXFile->OnProgressEx(ID, Percent, &res);
return (res != 0);
}
\ No newline at end of file
This diff is collapsed.
//#include "stdafx.h"
#include "Directory.h"
//#include <strsafe.h>
//#include <shlobj.h>
namespace FileSystem {
LPCTSTR Directory::GetCurrentDirectory() {
static const int bufferSize = MAX_PATH;
LPTSTR directory = new TCHAR[bufferSize];
DWORD lenght = ::GetCurrentDirectory(bufferSize, directory);
if (lenght == 0) {
delete[] directory;
directory = NULL;
}
return directory;
}
String Directory::GetCurrentDirectoryS() {
LPCTSTR directory = GetCurrentDirectory();
if (directory == NULL)
return String();
return String(directory);
}
bool Directory::CreateDirectory(LPCTSTR path) {
bool directoryCreated = false;
if (::CreateDirectory(path, NULL) == TRUE)
directoryCreated = true;
return directoryCreated;
}
bool Directory::CreateDirectory(const String& path) {
return CreateDirectory(path.c_str());
}
bool Directory::CreateDirectories(LPCTSTR path)
{
int codeResult = ERROR_SUCCESS;
codeResult = ::CreateDirectory (path, NULL);
//codeResult = SHCreateDirectory (NULL, path);
bool created = false;
if (codeResult == ERROR_SUCCESS)
created = true;
return created;
}
StringArray Directory::GetFilesInDirectory(LPCTSTR path, const bool& andSubdirectories) {
size_t pathLength = 0;
StringCchLength(path, MAX_PATH, &pathLength);
++pathLength;
size_t pathToFilesLength = pathLength + 3;
LPTSTR pathToFiles = new TCHAR[pathToFilesLength];
StringCchCopy(pathToFiles, pathLength, path);
StringCchCat(pathToFiles, pathToFilesLength, TEXT("\\*"));
WIN32_FIND_DATA findData;
HANDLE findResult = FindFirstFile(pathToFiles, &findData);
delete[] pathToFiles;
if (findResult == INVALID_HANDLE_VALUE)
return StringArray();
StringArray files;
do {
if (andSubdirectories || !(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
String file = findData.cFileName;
files.insert(files.end(), file);
}
} while (FindNextFile(findResult, &findData));
FindClose(findResult);
return files;
}
StringArray Directory::GetFilesInDirectory(const String& path, const bool& andSubdirectories) {
LPCTSTR pathW = path.c_str();
return GetFilesInDirectory(pathW, andSubdirectories);
}
int Directory::GetFilesCount(const CString& path, const bool& recursive) {
CString pathMask = path + _T("\\*");
WIN32_FIND_DATA findData;
HANDLE findResult = FindFirstFile(pathMask, &findData);
int filesCount = 0;
do {
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
if (!recursive)
continue;
if ((CString) findData.cFileName == _T("."))
continue;
if ((CString) findData.cFileName == _T(".."))
continue;
CString innerPath = path + _T('\\') + (CString) findData.cFileName;
filesCount += GetFilesCount(innerPath, recursive);
}
else
++filesCount;
} while (FindNextFile(findResult, &findData));
FindClose(findResult);
return filesCount;
}
}
#pragma once
#include "Settings.h"
#if defined(_WIN32) || defined (_WIN64)
#include <windows.h>
#else
#endif
namespace FileSystem {
class Directory {
public:
static LPCTSTR GetCurrentDirectory();
static String GetCurrentDirectoryS();
static bool CreateDirectory(LPCTSTR path);
static bool CreateDirectory(const String& path);
static bool CreateDirectories(LPCTSTR path);
static StringArray GetFilesInDirectory(LPCTSTR path, const bool& andSubdirectories = false);
static StringArray GetFilesInDirectory(const String& path, const bool& andSubdirectories = false);
static int GetFilesCount(const CString& path, const bool& recursive = false);
};
}
#pragma once
namespace NSBinPptxRW
{
const double eps = 0.001;
const double g_dKoef_mm_to_pt = 72 / (2.54 * 10);
const double g_dKoef_mm_to_twips = 20 * g_dKoef_mm_to_pt;
const double g_dKoef_mm_to_emu = 36000;
const double g_dKoef_mm_to_eightpoint = 8 * g_dKoef_mm_to_pt;
const BYTE g_nodeAttributeStart = 0xFA;
const BYTE g_nodeAttributeEnd = 0xFB;
namespace NSSerFormat
{
enum SerFormat
{
Version = 0,
Signature = 0x50505459
};
}
namespace NSMainTables
{
enum MainTables
{
Main = 255,
App = 1,
Core = 2,
Presentation = 3,
ViewProps = 4,
VmlDrawing = 5,
TableStyles = 6,
Themes = 20,
ThemeOverride = 21,
SlideMasters = 22,
SlideLayouts = 23,
Slides = 24,
NotesMasters = 25,
NotesSlides = 26,
HandoutMasters = 30,
SlideRels = 40,
ThemeRels = 41,
ImageMap = 42,
FontMap = 43,
FontsEmbedded = 44
};
}
}
#define COLOR_TYPE_NONE 0
#define COLOR_TYPE_SRGB 1
#define COLOR_TYPE_PRST 2
#define COLOR_TYPE_SCHEME 3
#define COLOR_TYPE_SYS 4
#define FILL_TYPE_NONE 0
#define FILL_TYPE_BLIP 1
#define FILL_TYPE_NOFILL 2
#define FILL_TYPE_SOLID 3
#define FILL_TYPE_GRAD 4
#define FILL_TYPE_PATT 5
#define EFFECT_TYPE_NONE 0
#define EFFECT_TYPE_OUTERSHDW 1
#define EFFECT_TYPE_GLOW 2
#define EFFECT_TYPE_DUOTONE 3
#define EFFECT_TYPE_XFRM 4
#define EFFECT_TYPE_BLUR 5
#define EFFECT_TYPE_PRSTSHDW 6
#define EFFECT_TYPE_INNERSHDW 7
#define EFFECT_TYPE_REFLECTION 8
#define EFFECT_TYPE_SOFTEDGE 9
#define EFFECT_TYPE_FILLOVERLAY 10
#define EFFECT_TYPE_ALPHACEILING 11
#define EFFECT_TYPE_ALPHAFLOOR 12
#define EFFECT_TYPE_TINTEFFECT 13
#define EFFECT_TYPE_RELOFF 14
#define EFFECT_TYPE_LUM 15
#define EFFECT_TYPE_HSL 16
#define EFFECT_TYPE_GRAYSCL 17
#define EFFECT_TYPE_ELEMENT 18
#define EFFECT_TYPE_ALPHAREPL 19
#define EFFECT_TYPE_ALPHAOUTSET 20
#define EFFECT_TYPE_ALPHAMODFIX 21
#define EFFECT_TYPE_ALPHABILEVEL 22
#define EFFECT_TYPE_BILEVEL 23
#define EFFECT_TYPE_DAG 24
#define EFFECT_TYPE_FILL 25
#define EFFECT_TYPE_CLRREPL 26
#define EFFECT_TYPE_CLRCHANGE 27
#define EFFECT_TYPE_ALPHAINV 28
#define EFFECT_TYPE_ALPHAMOD 29
#define EFFECT_TYPE_BLEND 30
#define GEOMETRY_TYPE_NONE 0
#define GEOMETRY_TYPE_PRST 1
#define GEOMETRY_TYPE_CUSTOM 2
#define GEOMETRY_TYPE_AH_NONE 0
#define GEOMETRY_TYPE_AH_POLAR 1
#define GEOMETRY_TYPE_AH_XY 2
#define GEOMETRY_TYPE_PATH_NONE 0
#define GEOMETRY_TYPE_PATH_MOVETO 1
#define GEOMETRY_TYPE_PATH_LINETO 2
#define GEOMETRY_TYPE_PATH_CLOZE 3
#define GEOMETRY_TYPE_PATH_CUBICBEZTO 4
#define GEOMETRY_TYPE_PATH_ARCTO 5
#define GEOMETRY_TYPE_PATH_QUADBEZTO 6
#define EFFECTPROPERTIES_TYPE_NONE 0
#define EFFECTPROPERTIES_TYPE_LIST 1
#define EFFECTPROPERTIES_TYPE_DAG EFFECT_TYPE_DAG
#define BULLET_TYPE_COLOR_NONE 0
#define BULLET_TYPE_COLOR_CLRTX 1
#define BULLET_TYPE_COLOR_CLR 2
#define BULLET_TYPE_SIZE_NONE 0
#define BULLET_TYPE_SIZE_TX 1
#define BULLET_TYPE_SIZE_PCT 2
#define BULLET_TYPE_SIZE_PTS 3
#define BULLET_TYPE_TYPEFACE_NONE 0
#define BULLET_TYPE_TYPEFACE_TX 1
#define BULLET_TYPE_TYPEFACE_BUFONT 2
#define BULLET_TYPE_BULLET_NONE 0
#define BULLET_TYPE_BULLET_CHAR 1
#define BULLET_TYPE_BULLET_AUTONUM 2
#define BULLET_TYPE_BULLET_BLIP 3
#define PARRUN_TYPE_NONE 0
#define PARRUN_TYPE_RUN 1
#define PARRUN_TYPE_FLD 2
#define PARRUN_TYPE_BR 3
#define SPTREE_TYPE_NONE 0
#define SPTREE_TYPE_SHAPE 1
#define SPTREE_TYPE_PIC 2
#define SPTREE_TYPE_CXNSP 3
#define SPTREE_TYPE_SPTREE 4
#define SPTREE_TYPE_GRFRAME 5
static BYTE SchemeClr_GetBYTECode(const CString& sValue)
{
if (_T("accent1") == sValue)
return 0;
if (_T("accent2") == sValue)
return 1;
if (_T("accent3") == sValue)
return 2;
if (_T("accent4") == sValue)
return 3;
if (_T("accent5") == sValue)
return 4;
if (_T("accent6") == sValue)
return 5;
if (_T("bg1") == sValue)
return 6;
if (_T("bg2") == sValue)
return 7;
if (_T("dk1") == sValue)
return 8;
if (_T("dk2") == sValue)
return 9;
if (_T("folHlink") == sValue)
return 10;
if (_T("hlink") == sValue)
return 11;
if (_T("lt1") == sValue)
return 12;
if (_T("lt2") == sValue)
return 13;
if (_T("phClr") == sValue)
return 14;
if (_T("tx1") == sValue)
return 15;
if (_T("tx2") == sValue)
return 16;
return 0;
}
static CString SchemeClr_GetStringCode(const BYTE& val)
{
switch (val)
{
case 0:
return _T("accent1");
case 1:
return _T("accent2");
case 2:
return _T("accent3");
case 3:
return _T("accent4");
case 4:
return _T("accent5");
case 5:
return _T("accent6");
case 6:
return _T("bg1");
case 7:
return _T("bg2");
case 8:
return _T("dk1");
case 9:
return _T("dk2");
case 10:
return _T("folHlink");
case 11:
return _T("hlink");
case 12:
return _T("lt1");
case 13:
return _T("lt2");
case 14:
return _T("phClr");
case 15:
return _T("tx1");
case 16:
return _T("tx2");
}
return _T("accent1");
}
#define XMLWRITER_DOC_TYPE_PPTX 0
#define XMLWRITER_DOC_TYPE_DOCX 1
#define XMLWRITER_DOC_TYPE_XLSX 2
#define XMLWRITER_DOC_TYPE_CHART 3
#define XMLWRITER_RECORD_TYPE_SPPR 0
#define XMLWRITER_RECORD_TYPE_CLRMAPOVR 1
\ No newline at end of file
#pragma once
#include "../../Common/DocxFormat/Source/Base/Nullable.h"
#include "BinReaderWriterDefines.h"
#include "../../Common/Base64.h"
#include "imagemanager.h"
#include "./XmlWriter.h"
#include "../PPTXFormat/FileContainer.h"
#include "../PPTXFormat/DocxFormat/WritingElement.h"
#include "../../ASCOfficeDocxFile2/DocWrapper/DocxSerializer.h"
#include "BinaryFileReaderWriter.h"
This diff is collapsed.
This diff is collapsed.
#pragma once
const long g_clFilePartSize = 20*1024;
class CCalculatorCRC32
{
public:
CCalculatorCRC32()
{
m_dwMagicWord = 0xEDB88320;
m_dwInitCrc = 0xFFFFFFFF;
m_bInitTable = FALSE;
}
public:
DWORD Calc(BYTE const*pStream, int nSize)
{
InitCRCTable();
DWORD dwRes = m_dwInitCrc;
for (int i=0;i<nSize;i++)
{
dwRes = m_arCRCTable[(dwRes ^ pStream[i])& 0xFF] ^ (dwRes >> 8);
}
dwRes = dwRes ^ 0xFFFFFFFF;
return dwRes;
}
DWORD Calc(const CString &sStream)
{
InitCRCTable();
DWORD dwRes = m_dwInitCrc;
int nSize = sStream.GetLength();
for (int i=0;i<nSize;i++)
{
dwRes = m_arCRCTable[(dwRes ^ (BYTE)sStream[i]) & 0xFF] ^ (dwRes >> 8);
}
dwRes = dwRes ^ 0xFFFFFFFF;
return dwRes;
}
DWORD CalcPartFile(const CString &sFilepath)
{
DWORD dwRet = 0xFFFFFFFF;
//LPBYTE pBuffer = new BYTE[g_clFilePartSize];
//if (NULL==pBuffer)
// return dwRet;
//FILE *pFile = fopen(sFilepath, "rb");
//if (NULL==pFile)
//{
// delete [] pBuffer;
// return dwRet;
//}
//size_t nReaded = fread(pBuffer, 1, 1024, pFile);
//fclose(pFile);
//dwRet = CCalculatorCRC32::Calc(pBuffer, nReaded);
//
////ATLTRACE("CRC32: 0x%08X\n", dwRet);
//delete [] pBuffer;
return dwRet;
}
private:
void InitCRCTable()
{
if (m_bInitTable)
return;
DWORD dwTemp;
for (int i=0;i<256;i++)
{
dwTemp = i;
for (int j=0;j<8;j++)
{
if (0x1==(dwTemp & 0x1))
dwTemp = (dwTemp >> 1) ^ m_dwMagicWord;
else
dwTemp = dwTemp >> 1;
}
m_arCRCTable[i] = dwTemp;
}
}
DWORD m_dwMagicWord;
DWORD m_dwInitCrc;
DWORD m_arCRCTable[255];
BOOL m_bInitTable;
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include "BinWriters.h"
/*
HRESULT COfficeFontPicker::GetBinaryData(LONG lType, SAFEARRAY** ppBinaryArray)
{
if (NULL == ppBinaryArray)
return S_FALSE;
*ppBinaryArray = NULL;
if (FONT_PICKER_BINARYDATA_SAVEEMBEDDED == lType)
{
NSBinPptxRW::CBinaryFileWriter oWriter;
m_oPicker.m_oEmbeddedFonts.CheckString(_T(".)abcdefghijklmnopqrstuvwxyz"));
m_oPicker.m_oEmbeddedFonts.CheckFont(_T("Wingdings 3"), m_oPicker.m_pFontManager);
m_oPicker.m_oEmbeddedFonts.CheckFont(_T("Arial"), m_oPicker.m_pFontManager);
oWriter.StartRecord(NSBinPptxRW::NSMainTables::FontsEmbedded);
m_oPicker.m_oEmbeddedFonts.WriteEmbeddedFonts(&oWriter);
oWriter.EndRecord();
*ppBinaryArray = oWriter.GetSafearray();
}
else if (FONT_PICKER_BINARYDATA_SAVEMAP == lType)
{
}
return S_OK;
}
*/
HRESULT COfficeFontPicker::GetBinaryData(LONG lType, BYTE** ppyArray, size_t& szCount)
{
if (NULL == ppyArray)
return S_FALSE;
*ppyArray = NULL;
if (FONT_PICKER_BINARYDATA_SAVEEMBEDDED == lType)
{
NSBinPptxRW::CBinaryFileWriter oWriter;
m_oPicker.m_oEmbeddedFonts.CheckString(_T(".)abcdefghijklmnopqrstuvwxyz"));
m_oPicker.m_oEmbeddedFonts.CheckFont(_T("Wingdings 3"), m_oPicker.m_pFontManager);
m_oPicker.m_oEmbeddedFonts.CheckFont(_T("Arial"), m_oPicker.m_pFontManager);
oWriter.StartRecord(NSBinPptxRW::NSMainTables::FontsEmbedded);
m_oPicker.m_oEmbeddedFonts.WriteEmbeddedFonts(&oWriter);
oWriter.EndRecord();
oWriter.GetSafearray(ppyArray, szCount);
}
else if (FONT_PICKER_BINARYDATA_SAVEMAP == lType)
{
}
return S_OK;
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
//#include "stdafx.h"
#include "File.h"
namespace FileSystem {
bool File::Exists(LPCTSTR path) {
WIN32_FIND_DATA findData;
ZeroMemory(&findData, sizeof(findData));
HANDLE handle = ::FindFirstFile(path, &findData);
bool fileExists = true;
if (handle == INVALID_HANDLE_VALUE)
fileExists = false;
FindClose(handle);
return fileExists;
}
bool File::Exists(const String& path) {
return Exists(path.c_str());
}
void File::Create(LPCTSTR path) {
CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
}
void File::Create(const String& path) {
Create(path.c_str());
}
}
\ No newline at end of file
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.
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.
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.
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.
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.
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.
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