Commit 6847df2d authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander Trofimov

для стыковки с docxFile2 как код: код лежащий в PPTXFile поменял namespace OOX...

для стыковки с docxFile2 как код: код лежащий в PPTXFile поменял namespace OOX -> PPTX; отделение com интерфейса от логики.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@58310 954022d7-b5bf-4e40-9824-e11837661b57
parent 30fd8af8
// 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 m_oDrawingConverter.SetMainDocument(pDocument);
}
STDMETHOD(SetRelsPath)(BSTR bsRelsPath)
{
return m_oDrawingConverter.SetRelsPath(bsRelsPath);
}
STDMETHOD(SetMediaDstPath)(BSTR bsMediaPath)
{
return m_oDrawingConverter.SetMediaDstPath(bsMediaPath);
}
STDMETHOD(AddShapeType)(BSTR bsXml)
{
return m_oDrawingConverter.AddShapeType(bsXml);
}
STDMETHOD(AddObject)(BSTR bsXml, BSTR* pMainProps, SAFEARRAY** ppBinary)
{
return m_oDrawingConverter.AddObject(bsXml, pMainProps, ppBinary);
}
STDMETHOD(AddObject2)(BSTR bsXml, SAFEARRAY* pBinaryObj, BSTR* pXmlOutput)
{
return m_oDrawingConverter.AddObject2(bsXml, pBinaryObj, pXmlOutput);
}
STDMETHOD(GetThemeBinary)(BSTR bsThemeFilePath, SAFEARRAY** ppBinary)
{
return m_oDrawingConverter.GetThemeBinary(bsThemeFilePath, ppBinary);
}
STDMETHOD(SaveThemeXml)(SAFEARRAY* pBinaryTheme, LONG lStart, LONG lLength, BSTR bsThemePath)
{
return m_oDrawingConverter.SaveThemeXml(pBinaryTheme, lStart, lLength, bsThemePath);
}
STDMETHOD(SaveObject)(SAFEARRAY* pBinaryObj, LONG lStart, LONG lLength, BSTR bsMainProps, BSTR* bsXml)
{
return m_oDrawingConverter.SaveObject(pBinaryObj, lStart, lLength, bsMainProps, bsXml);
}
STDMETHOD(SaveObjectEx)(SAFEARRAY* pBinaryObj, LONG lStart, LONG lLength, BSTR bsMainProps, LONG lDocType, BSTR* bsXml)
{
return m_oDrawingConverter.SaveObjectEx(pBinaryObj, lStart, lLength, bsMainProps, lDocType, bsXml);
}
STDMETHOD(GetRecordBinary)(LONG lRecordType, BSTR bsXml, SAFEARRAY** ppBinary)
{
return m_oDrawingConverter.GetRecordBinary(lRecordType, bsXml, ppBinary);
}
STDMETHOD(GetRecordXml)(SAFEARRAY* pBinaryObj, LONG lStart, LONG lLength, LONG lRecType, LONG lDocType, BSTR* bsXml)
{
return m_oDrawingConverter.GetRecordXml(pBinaryObj, lStart, lLength, lRecType, lDocType, bsXml);
}
STDMETHOD(SetDstContentRels)()
{
return m_oDrawingConverter.SetDstContentRels();
}
STDMETHOD(SaveDstContentRels)(BSTR bsRelsPath)
{
return m_oDrawingConverter.SaveDstContentRels(bsRelsPath);
}
STDMETHOD(WriteRels)(BSTR bsType, BSTR bsTarget, BSTR bsTargetMode, LONG* lId)
{
return m_oDrawingConverter.WriteRels(bsType, bsTarget, bsTargetMode, lId);
}
STDMETHOD(LoadClrMap)(BSTR bsXml)
{
return m_oDrawingConverter.LoadClrMap(bsXml);
}
STDMETHOD(GetTxBodyBinary)(BSTR bsXml, SAFEARRAY** ppBinary)
{
return m_oDrawingConverter.GetTxBodyBinary(bsXml, ppBinary);
}
STDMETHOD(GetTxBodyXml)(SAFEARRAY* pBinary, LONG lStart, LONG lLength, BSTR *pbstrXml)
{
return m_oDrawingConverter.GetTxBodyXml(pBinary, lStart, lLength, pbstrXml);
}
STDMETHOD(SetFontDir)(BSTR bsFontDir)
{
return m_oDrawingConverter.SetFontDir(bsFontDir);
}
STDMETHOD(SetAdditionalParam)(BSTR ParamName, VARIANT ParamValue)
{
return m_oDrawingConverter.SetAdditionalParam(ParamName, ParamValue);
}
STDMETHOD(GetAdditionalParam)(BSTR ParamName, VARIANT* ParamValue)
{
return m_oDrawingConverter.GetAdditionalParam(ParamName, ParamValue);
}
};
......@@ -3,8 +3,8 @@
#include "stdafx.h"
#include "resource.h"
#include "ASCOfficePPTXFile.h"
#include "ASCOfficeDrawingConverter.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}",
......
This diff is collapsed.
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="ASCOfficePPTXFile"
ProjectGUID="{70078FE7-BE4F-493C-84F3-F98F151587F5}"
RootNamespace="ASCOfficePPTXFile"
......@@ -53,8 +53,8 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\Addons\ZLib"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;_ATL_ATTRIBUTES"
AdditionalIncludeDirectories="..\..\..\..\Addons\ZLib;&quot;$(SolutionDir)/../Common/DocxFormat/Source/XML/libxml2/XML/include&quot;"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;_ATL_ATTRIBUTES;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
......@@ -81,7 +81,7 @@
AdditionalDependencies="Msimg32.lib"
OutputFile="$(OutDir)/ASCOfficePPTXFile.dll"
LinkIncremental="2"
AdditionalLibraryDirectories=""
AdditionalLibraryDirectories="$(SolutionDir)/../Common/DocxFormat/Source/XML/libxml2/win_build/Release"
IgnoreDefaultLibraryNames="LIBC;LIBCD"
ModuleDefinitionFile=""
MergedIDLBaseFileName="_ASCOfficePPTXFile.idl"
......@@ -440,6 +440,14 @@
RelativePath=".\ASCOfficePPTXFile.cpp"
>
</File>
<File
RelativePath=".\ASCOfficePPTXFileRealization.cpp"
>
</File>
<File
RelativePath="..\Common\DocxFormat\Source\XML\libxml2\libxml2.cpp"
>
</File>
<File
RelativePath="stdafx.cpp"
>
......@@ -476,6 +484,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\DocxFormat\Source\XML\stringcommon.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
......@@ -485,10 +497,22 @@
RelativePath=".\ASCOfficeDrawingConverter.h"
>
</File>
<File
RelativePath=".\ASCOfficeDrawingConverterComInterface.h"
>
</File>
<File
RelativePath=".\ASCOfficePPTXFile.h"
>
</File>
<File
RelativePath=".\ASCOfficePPTXFileComInterface.h"
>
</File>
<File
RelativePath="..\Common\DocxFormat\Source\XML\libxml2\libxml2.h"
>
</File>
<File
RelativePath="Resource.h"
>
......@@ -497,6 +521,10 @@
RelativePath="stdafx.h"
>
</File>
<File
RelativePath="..\Common\DocxFormat\Source\XML\stringcommon.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
......
// CAVSOfficePPTXFile.h : Declaration of the CAVSOfficePPTXFile
#pragma once
#include "stdafx.h"
#include "resource.h" // main symbols
#include "../Common/OfficeFileTemplate.h"
#include "ASCOfficePPTXFile.h"
#include "../Common/DocxFormat/Source/SystemUtility/File.h"
void comLoadTheme(void* pArg, int nIndex, CString& strDstFolder);
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(comLoadTheme, 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);
}
};
void comLoadTheme(void* pArg, int nIndex, CString& strDstFolder)
{
CAVSOfficePPTXFile* pCAVSOfficePPTXFile = static_cast<CAVSOfficePPTXFile*>(pArg);
HINSTANCE hInst = _AtlBaseModule.GetModuleInstance();
CString strThemeNotes = _T("");
strThemeNotes.Format(_T("\\ppt\\theme\\theme%d.xml"), nIndex);
pCAVSOfficePPTXFile->LoadResourceFile(hInst, MAKEINTRESOURCE(IDB_XML_NOTESTHEME), _T("PPTXW"), strDstFolder + strThemeNotes);
CDirectory::CreateDirectory(strDstFolder + _T("\\ppt\\notesMasters"));
pCAVSOfficePPTXFile->LoadResourceFile(hInst, MAKEINTRESOURCE(IDB_XML_NOTESMASTER), _T("PPTXW"), strDstFolder + _T("\\ppt\\notesMasters\\notesMaster1.xml"));
CDirectory::CreateDirectory(strDstFolder + _T("\\ppt\\notesMasters\\_rels"));
CString strThemeNotesNum = _T("");
strThemeNotesNum.Format(_T("%d"), nIndex);
CString strVal = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\
<Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme\" Target=\"../theme/theme") + strThemeNotesNum + _T(".xml\"/></Relationships>");
CFile oFileRels;
oFileRels.CreateFile(strDstFolder + _T("\\ppt\\notesMasters\\_rels\\notesMaster1.xml.rels"));
oFileRels.WriteStringUTF8(strVal);
oFileRels.CloseFile();
}
bool comExtractFile(void* pArg, CString& sFile, CString& sDir)
{
OfficeUtils::IOfficeUtils* pOfficeUtils = NULL;
if (S_OK != CoCreateInstance(__uuidof(OfficeUtils::COfficeUtils), NULL, CLSCTX_INPROC_SERVER, __uuidof(OfficeUtils::IOfficeUtils),(void**)&pOfficeUtils))
return false;
BSTR bsFile = sFile.AllocSysString();
BSTR bsDir = sDir.AllocSysString();
HRESULT hr = pOfficeUtils->ExtractToDirectory( bsFile, bsDir, NULL, 0);
SysFreeString(bsFile);
SysFreeString(bsDir);
if(hr != S_OK)
return false;
RELEASEINTERFACE(pOfficeUtils);
return true;
}
bool comCompressFile(void* pArg, CString& sDir, CString& sFile)
{
OfficeUtils::IOfficeUtils* pOfficeUtils = NULL;
if (S_OK != CoCreateInstance(__uuidof(OfficeUtils::COfficeUtils), NULL, CLSCTX_INPROC_SERVER, __uuidof(OfficeUtils::IOfficeUtils),(void**)&pOfficeUtils))
return false;
BSTR bsDir = sDir.AllocSysString();
BSTR bsFile = sFile.AllocSysString();
HRESULT hr = pOfficeUtils->CompressFileOrDirectory( bsDir, bsFile, -1 );
SysFreeString(bsDir);
SysFreeString(bsFile);
if(hr != S_OK)
return false;
RELEASEINTERFACE(pOfficeUtils);
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.
......@@ -398,7 +398,7 @@ namespace NSBinPptxRW
IUnknown* m_pMainDocument;
smart_ptr<PPTX::FileContainer> ThemeDoc;
smart_ptr<OOX::WritingElement> ClrMapDoc;
smart_ptr<PPTX::WritingElement> ClrMapDoc;
private:
BYTE* m_pStreamData;
......@@ -1221,7 +1221,6 @@ namespace NSBinPptxRW
SAFEARRAY* m_pSourceArray;
LONG m_lDocumentType;
IUnknown* m_pDrawingConverter;
CRelsGenerator* m_pRels;
CAtlArray<CRelsGenerator*> m_stackRels;
......@@ -1239,7 +1238,6 @@ namespace NSBinPptxRW
m_strContentTypes = _T("");
m_lDocumentType = XMLWRITER_DOC_TYPE_PPTX;
m_pDrawingConverter = NULL;
m_pRels = new CRelsGenerator();
m_nCurrentRelsStack = -1;
......
......@@ -20,7 +20,7 @@ namespace PPTX2EditorAdvanced
CAtlArray<smart_ptr<PPTX::NotesSlide>> _notes;
CAtlArray<smart_ptr<PPTX::NotesMaster>> _notesMasters;
smart_ptr<PPTX::Presentation> presentation = oFolder.get(OOX::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
smart_ptr<PPTX::Presentation> presentation = oFolder.get(PPTX::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
int cx = presentation->sldSz->cx;
int cy = presentation->sldSz->cy;
......@@ -173,7 +173,7 @@ namespace PPTX2EditorAdvanced
oBinaryWriter.WriteULONG(0);
// App
smart_ptr<PPTX::App> app = oFolder.get(OOX::FileTypes::App).smart_dynamic_cast<PPTX::App>();
smart_ptr<PPTX::App> app = oFolder.get(PPTX::FileTypes::App).smart_dynamic_cast<PPTX::App>();
if (app.is_init())
{
oBinaryWriter.StartMainRecord(NSMainTables::App);
......@@ -181,7 +181,7 @@ namespace PPTX2EditorAdvanced
}
// Core
smart_ptr<PPTX::Core> core = oFolder.get(OOX::FileTypes::Core).smart_dynamic_cast<PPTX::Core>();
smart_ptr<PPTX::Core> core = oFolder.get(PPTX::FileTypes::Core).smart_dynamic_cast<PPTX::Core>();
if (core.is_init())
{
oBinaryWriter.StartMainRecord(NSMainTables::Core);
......@@ -189,7 +189,7 @@ namespace PPTX2EditorAdvanced
}
// ViewProps
smart_ptr<PPTX::ViewProps> viewProps = presentation->get(OOX::FileTypes::ViewProps).smart_dynamic_cast<PPTX::ViewProps>();
smart_ptr<PPTX::ViewProps> viewProps = presentation->get(PPTX::FileTypes::ViewProps).smart_dynamic_cast<PPTX::ViewProps>();
if (viewProps.is_init())
{
oBinaryWriter.StartMainRecord(NSMainTables::ViewProps);
......@@ -197,7 +197,7 @@ namespace PPTX2EditorAdvanced
}
// TableStyles
smart_ptr<PPTX::TableStyles> tablestyles = presentation->get(OOX::FileTypes::TableStyles).smart_dynamic_cast<PPTX::TableStyles>();
smart_ptr<PPTX::TableStyles> tablestyles = presentation->get(PPTX::FileTypes::TableStyles).smart_dynamic_cast<PPTX::TableStyles>();
if (tablestyles.is_init())
{
oBinaryWriter.StartMainRecord(NSMainTables::TableStyles);
......
#pragma once
#include "Converter.h"
typedef void (*load_from_resource)(void*, int, CString&);
namespace NSBinPptxRW
{
class CPPTXWriter
......@@ -38,12 +40,16 @@ namespace NSBinPptxRW
BOOL m_bIsDefaultNoteMaster;
PPTX::NotesSlide m_oDefaultNote;
load_from_resource m_fCallback;
void* m_pCallbackArg;
public:
CPPTXWriter()
CPPTXWriter(load_from_resource fCallback, void* pCallbackArg)
{
m_strDstFolder = _T("");
m_bIsDefaultNoteMaster = TRUE;
m_fCallback = fCallback;
m_pCallbackArg = pCallbackArg;
}
~CPPTXWriter()
{
......@@ -909,25 +915,7 @@ namespace NSBinPptxRW
}
void CreateDefaultNotesMasters(int nIndexTheme)
{
HINSTANCE hInst = _AtlBaseModule.GetModuleInstance();
CString strThemeNotes = _T("");
strThemeNotes.Format(_T("\\ppt\\theme\\theme%d.xml"), (int)m_arThemes.GetCount() + 1);
LoadResourceFile(hInst, MAKEINTRESOURCE(IDB_XML_NOTESTHEME), _T("PPTXW"), m_strDstFolder + strThemeNotes);
CDirectory::CreateDirectory(m_strDstFolder + _T("\\ppt\\notesMasters"));
LoadResourceFile(hInst, MAKEINTRESOURCE(IDB_XML_NOTESMASTER), _T("PPTXW"), m_strDstFolder + _T("\\ppt\\notesMasters\\notesMaster1.xml"));
CDirectory::CreateDirectory(m_strDstFolder + _T("\\ppt\\notesMasters\\_rels"));
CString strThemeNotesNum = _T("");
strThemeNotesNum.Format(_T("%d"), (int)m_arThemes.GetCount() + 1);
CString strVal = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\
<Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme\" Target=\"../theme/theme") + strThemeNotesNum + _T(".xml\"/></Relationships>");
CFile oFileRels;
oFileRels.CreateFile(m_strDstFolder + _T("\\ppt\\notesMasters\\_rels\\notesMaster1.xml.rels"));
oFileRels.WriteStringUTF8(strVal);
oFileRels.CloseFile();
m_fCallback(m_pCallbackArg, nIndexTheme, m_strDstFolder);
}
void CreateDefaultNote()
{
......@@ -977,25 +965,5 @@ namespace NSBinPptxRW
m_oDefaultNote.clrMapOvr = new PPTX::Logic::ClrMapOvr();
}
private:
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);
}
};
}
......@@ -80,11 +80,11 @@ namespace PPTX
Normalize();
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::ContentTypes::File& content)const
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, PPTX::ContentTypes::File& content)const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("xmlns"), OOX::g_Namespaces.xmlns.m_strLink);
oAttr.Write(_T("xmlns:vt"), OOX::g_Namespaces.vt.m_strLink);
oAttr.Write(_T("xmlns"), PPTX::g_Namespaces.xmlns.m_strLink);
oAttr.Write(_T("xmlns:vt"), PPTX::g_Namespaces.vt.m_strLink);
XmlUtils::CNodeValue oValue;
oValue.Write2(_T("Template"), Template);
......@@ -144,9 +144,9 @@ namespace PPTX
}
public:
virtual const OOX::FileType type() const
virtual const PPTX::FileType type() const
{
return OOX::FileTypes::App;
return PPTX::FileTypes::App;
}
virtual const OOX::CPath DefaultDirectory() const
{
......@@ -192,8 +192,8 @@ namespace PPTX
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("xmlns"), OOX::g_Namespaces.xmlns.m_strLink);
pWriter->WriteAttribute(_T("xmlns:vt"), OOX::g_Namespaces.vt.m_strLink);
pWriter->WriteAttribute(_T("xmlns"), PPTX::g_Namespaces.xmlns.m_strLink);
pWriter->WriteAttribute(_T("xmlns:vt"), PPTX::g_Namespaces.vt.m_strLink);
pWriter->EndAttributes();
......
......@@ -140,14 +140,14 @@ namespace PPTX
m_arAuthors[m_arAuthors.GetCount() - 1].fromXML(oCm);
}
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::ContentTypes::File& content)const
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, PPTX::ContentTypes::File& content)const
{
}
public:
virtual const OOX::FileType type() const
virtual const PPTX::FileType type() const
{
return OOX::FileTypes::CommentAuthors;
return PPTX::FileTypes::CommentAuthors;
}
virtual const OOX::CPath DefaultDirectory() const
{
......@@ -169,9 +169,9 @@ namespace PPTX
pWriter->StartNode(_T("p:cmAuthorLst"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("xmlns:a"), OOX::g_Namespaces.a.m_strLink);
pWriter->WriteAttribute(_T("xmlns:r"), OOX::g_Namespaces.r.m_strLink);
pWriter->WriteAttribute(_T("xmlns:p"), OOX::g_Namespaces.p.m_strLink);
pWriter->WriteAttribute(_T("xmlns:a"), PPTX::g_Namespaces.a.m_strLink);
pWriter->WriteAttribute(_T("xmlns:r"), PPTX::g_Namespaces.r.m_strLink);
pWriter->WriteAttribute(_T("xmlns:p"), PPTX::g_Namespaces.p.m_strLink);
pWriter->EndAttributes();
pWriter->WriteArray2(m_arAuthors);
......
......@@ -292,14 +292,14 @@ namespace PPTX
m_arComments[m_arComments.GetCount() - 1].fromXML(oCm);
}
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::ContentTypes::File& content)const
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, PPTX::ContentTypes::File& content)const
{
}
public:
virtual const OOX::FileType type() const
virtual const PPTX::FileType type() const
{
return OOX::FileTypes::SlideComments;
return PPTX::FileTypes::SlideComments;
}
virtual const OOX::CPath DefaultDirectory() const
{
......@@ -321,9 +321,9 @@ namespace PPTX
pWriter->StartNode(_T("p:cmLst"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("xmlns:a"), OOX::g_Namespaces.a.m_strLink);
pWriter->WriteAttribute(_T("xmlns:r"), OOX::g_Namespaces.r.m_strLink);
pWriter->WriteAttribute(_T("xmlns:p"), OOX::g_Namespaces.p.m_strLink);
pWriter->WriteAttribute(_T("xmlns:a"), PPTX::g_Namespaces.a.m_strLink);
pWriter->WriteAttribute(_T("xmlns:r"), PPTX::g_Namespaces.r.m_strLink);
pWriter->WriteAttribute(_T("xmlns:p"), PPTX::g_Namespaces.p.m_strLink);
pWriter->EndAttributes();
pWriter->WriteArray2(m_arComments);
......
......@@ -39,8 +39,8 @@ namespace PPTX
oNode.ReadNodeValueBase(_T("dcterms:modified"), modified);
oNode.ReadNodeValueBase(_T("dcterms:created"), created);
// created = OOX::DateTime::Parse(document.Root.element("created").text().ToString());
// modified = OOX::DateTime::Parse(document.Root.element("modified").text().ToString());
// created = PPTX::DateTime::Parse(document.Root.element("created").text().ToString());
// modified = PPTX::DateTime::Parse(document.Root.element("modified").text().ToString());
/*
category = document.Root.element("category").text();
contentStatus = document.Root.element("contentStatus").text();
......@@ -48,18 +48,18 @@ namespace PPTX
//identifier - ???
// keywords = document.Root.element("keywords").text();
language = document.Root.element("language").text();
// lastPrinted = OOX::DateTime::Parse(document.Root.element("lastPrinted").text().ToString());
// lastPrinted = PPTX::DateTime::Parse(document.Root.element("lastPrinted").text().ToString());
subject = document.Root.element("subject").text();
version = document.Root.element("version").text();
*/
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::ContentTypes::File& content)const
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, PPTX::ContentTypes::File& content)const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("xmlns:dc"), OOX::g_Namespaces.dc.m_strLink);
//oAttr.Write(_T("xmlns:cp"), OOX::g_Namespaces.cp.m_strLink);
oAttr.Write(_T("xmlns:dcterms"), OOX::g_Namespaces.dcterms.m_strLink);
oAttr.Write(_T("xmlns:xsi"), OOX::g_Namespaces.xsi.m_strLink);
oAttr.Write(_T("xmlns:dc"), PPTX::g_Namespaces.dc.m_strLink);
//oAttr.Write(_T("xmlns:cp"), PPTX::g_Namespaces.cp.m_strLink);
oAttr.Write(_T("xmlns:dcterms"), PPTX::g_Namespaces.dcterms.m_strLink);
oAttr.Write(_T("xmlns:xsi"), PPTX::g_Namespaces.xsi.m_strLink);
XmlUtils::CNodeValue oValue;
oValue.Write2(_T("dc:title"), title);
......@@ -113,9 +113,9 @@ namespace PPTX
}
public:
virtual const OOX::FileType type() const
virtual const PPTX::FileType type() const
{
return OOX::FileTypes::Core;
return PPTX::FileTypes::Core;
}
virtual const OOX::CPath DefaultDirectory() const
{
......@@ -149,10 +149,10 @@ namespace PPTX
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("xmlns:cp"), OOX::g_Namespaces.cp.m_strLink);
pWriter->WriteAttribute(_T("xmlns:dc"), OOX::g_Namespaces.dc.m_strLink);
pWriter->WriteAttribute(_T("xmlns:dcterms"), OOX::g_Namespaces.dcterms.m_strLink);
pWriter->WriteAttribute(_T("xmlns:xsi"), OOX::g_Namespaces.xsi.m_strLink);
pWriter->WriteAttribute(_T("xmlns:cp"), PPTX::g_Namespaces.cp.m_strLink);
pWriter->WriteAttribute(_T("xmlns:dc"), PPTX::g_Namespaces.dc.m_strLink);
pWriter->WriteAttribute(_T("xmlns:dcterms"), PPTX::g_Namespaces.dcterms.m_strLink);
pWriter->WriteAttribute(_T("xmlns:xsi"), PPTX::g_Namespaces.xsi.m_strLink);
pWriter->EndAttributes();
......@@ -172,9 +172,9 @@ namespace PPTX
nullable_string creator;
nullable_string lastModifiedBy;
nullable_string revision;
// nullable_property<OOX::DateTime> created;
// nullable_property<PPTX::DateTime> created;
nullable_string created;
// nullable_property<OOX::DateTime> modified;
// nullable_property<PPTX::DateTime> modified;
nullable_string modified;
/*
nullable_property<std::string> category;
......@@ -183,7 +183,7 @@ namespace PPTX
//identifier - ???
// nullable_property<std::string> keywords;
nullable_property<std::string> language;
nullable_property<OOX::DateTime> lastPrinted;
nullable_property<PPTX::DateTime> lastPrinted;
nullable_property<std::string> subject;
nullable_property<std::string> version;
*/
......
......@@ -5,7 +5,7 @@
#include "./../WritingElement.h"
#include "ExtensionTable.h"
namespace OOX
namespace PPTX
{
namespace ContentTypes
{
......@@ -62,6 +62,6 @@ namespace OOX
CString m_extension;
};
} // namespace ContentTypes
} // namespace OOX
} // namespace PPTX
#endif // OOX_CONTENT_TYPES_DEFAULT_INCLUDE_H_
\ No newline at end of file
......@@ -6,7 +6,7 @@
#include "Default.h"
namespace OOX
namespace PPTX
{
namespace ContentTypes
{
......@@ -58,6 +58,6 @@ namespace OOX
}
};
} // namespace ContentTypes
} // namespace OOX
} // namespace PPTX
#endif // OOX_CONTENT)TYPES_DEFAULT_TABLE_INCLUDE_H_
\ No newline at end of file
......@@ -5,7 +5,7 @@
#include "../../../../Common/DocxFormat/Source/Base/Base.h"
namespace OOX
namespace PPTX
{
namespace ContentTypes
{
......@@ -56,6 +56,6 @@ namespace OOX
CAtlMap<CString, CString> m_table;
};
} // namespace ContentTypes
} // namespace OOX
} // namespace PPTX
#endif // OOX_CONTENT_TYPES_EXTENSION_TABLE_INCLUDE_H_
\ No newline at end of file
......@@ -7,11 +7,11 @@
#include "./../FileType.h"
namespace OOX
namespace PPTX
{
namespace ContentTypes
{
static const CPath s_filename = L"[Content_Types].xml";
static const OOX::CPath s_filename = L"[Content_Types].xml";
class File
{
......@@ -19,7 +19,7 @@ namespace OOX
File()
{
}
File(const CPath& path)
File(const OOX::CPath& path)
{
read(path);
}
......@@ -28,7 +28,7 @@ namespace OOX
}
public:
virtual void read(const CPath& path)
virtual void read(const OOX::CPath& path)
{
OOX::CPath oPath = path / s_filename;
XmlUtils::CXmlNode oNode;
......@@ -38,7 +38,7 @@ namespace OOX
Override = oNode;
}
}
virtual void write(const CPath& path) const
virtual void write(const OOX::CPath& path) const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("xmlns"), _T("http://schemas.openxmlformats.org/package/2006/content-types"));
......@@ -57,7 +57,7 @@ namespace OOX
}
public:
void registration(const CString& type, const CPath& directory, const CPath& filename)
void registration(const CString& type, const OOX::CPath& directory, const OOX::CPath& filename)
{
Override.add(type, directory / filename.m_strFilename);
Default.add(directory / filename.m_strFilename);
......@@ -68,6 +68,6 @@ namespace OOX
DefaultTable Default;
};
} // namespace ContentTypes
} // namespace OOX
} // namespace PPTX
#endif // DOCX_CONTENT_TYPES_FILE_INCLUDE_H_
\ No newline at end of file
......@@ -5,7 +5,7 @@
#include "./../WritingElement.h"
#include "../../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
namespace OOX
namespace PPTX
{
namespace ContentTypes
{
......@@ -15,7 +15,7 @@ namespace OOX
Override()
{
}
Override(const CString& type, const CPath& path) : m_type(type), m_part(path)
Override(const CString& type, const OOX::CPath& path) : m_type(type), m_part(path)
{
}
virtual ~Override()
......@@ -65,6 +65,6 @@ namespace OOX
OOX::CPath m_part;
};
} // namespace ContentTypes
} // namespace OOX
} // namespace PPTX
#endif // OOX_CONTENT_TYPES_OVERRIDE_INCLUDE_H_
\ No newline at end of file
......@@ -5,7 +5,7 @@
#include "./../WritingVector.h"
#include "Override.h"
namespace OOX
namespace PPTX
{
namespace ContentTypes
{
......@@ -41,6 +41,6 @@ namespace OOX
}
};
} // namespace ContentTypes
} // namespace OOX
} // namespace PPTX
#endif // OOX_CONTENT_TYPES_OVERRIDE_TABLE_INCLUDE_H_
\ No newline at end of file
......@@ -5,7 +5,7 @@
#include "../../../Common/DocxFormat/Source/Utility/Utility.h"
namespace OOX
namespace PPTX
{
class DateTime
{
......@@ -46,6 +46,6 @@ namespace OOX
};
const CString DateTime::s_pattern = _T("%YYYY-%MM-%DDT%hh:%mm:%ssZ");
} // namespace OOX
} // namespace PPTX
#endif // OOX_DATE_TIME_INCLUDE_H_
\ No newline at end of file
......@@ -6,7 +6,7 @@
#include "../FileTypes.h"
namespace OOX
namespace PPTX
{
class External : public File
{
......@@ -14,7 +14,7 @@ namespace OOX
External()
{
}
External(const CPath& uri)
External(const OOX::CPath& uri)
{
read(uri);
}
......@@ -23,23 +23,23 @@ namespace OOX
}
public:
virtual void read(const CPath& uri)
virtual void read(const OOX::CPath& uri)
{
m_uri = uri;
}
virtual void write(const CPath& filename, const CPath& directory, ContentTypes::File& content) const
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, ContentTypes::File& content) const
{
}
public:
AVSINLINE CPath Uri() const
AVSINLINE OOX::CPath Uri() const
{
return m_uri;
}
protected:
CPath m_uri;
OOX::CPath m_uri;
};
} // namespace OOX
} // namespace PPTX
#endif // OOX_EXTERNAL_INCLUDE_H_
\ No newline at end of file
......@@ -5,7 +5,7 @@
#include "External.h"
namespace OOX
namespace PPTX
{
class ExternalAudio : public External
{
......@@ -13,7 +13,7 @@ namespace OOX
ExternalAudio()
{
}
ExternalAudio(const CPath& uri)
ExternalAudio(const OOX::CPath& uri)
{
read(uri);
}
......@@ -26,15 +26,15 @@ namespace OOX
{
return FileTypes::ExternalAudio;
}
virtual const CPath DefaultDirectory() const
virtual const OOX::CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
virtual const OOX::CPath DefaultFileName() const
{
return type().DefaultFileName();
}
};
} // namespace OOX
} // namespace PPTX
#endif // OOX_EXTERNALAUDIO_INCLUDE_H_
\ No newline at end of file
......@@ -5,7 +5,7 @@
#include "External.h"
namespace OOX
namespace PPTX
{
class ExternalImage : public External
{
......@@ -13,7 +13,7 @@ namespace OOX
ExternalImage()
{
}
ExternalImage(const CPath& uri)
ExternalImage(const OOX::CPath& uri)
{
read(uri);
}
......@@ -26,15 +26,15 @@ namespace OOX
{
return FileTypes::ExternalImage;
}
virtual const CPath DefaultDirectory() const
virtual const OOX::CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
virtual const OOX::CPath DefaultFileName() const
{
return type().DefaultFileName();
}
};
} // namespace OOX
} // namespace PPTX
#endif // OOX_EXTERNALIMAGE_INCLUDE_H_
\ No newline at end of file
......@@ -5,7 +5,7 @@
#include "External.h"
namespace OOX
namespace PPTX
{
class ExternalVideo : public External
{
......@@ -13,7 +13,7 @@ namespace OOX
ExternalVideo()
{
}
ExternalVideo(const CPath& uri)
ExternalVideo(const OOX::CPath& uri)
{
read(uri);
}
......@@ -26,15 +26,15 @@ namespace OOX
{
return FileTypes::ExternalVideo;
}
virtual const CPath DefaultDirectory() const
virtual const OOX::CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
virtual const OOX::CPath DefaultFileName() const
{
return type().DefaultFileName();
}
};
} // namespace OOX
} // namespace PPTX
#endif // OOX_EXTERNALVIDEO_INCLUDE_H_
\ No newline at end of file
......@@ -5,7 +5,7 @@
#include "External.h"
namespace OOX
namespace PPTX
{
class HyperLink : public External
{
......@@ -13,7 +13,7 @@ namespace OOX
HyperLink()
{
}
HyperLink(const CPath& uri)
HyperLink(const OOX::CPath& uri)
{
read(uri);
}
......@@ -26,15 +26,15 @@ namespace OOX
{
return FileTypes::HyperLink;
}
virtual const CPath DefaultDirectory() const
virtual const OOX::CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
virtual const OOX::CPath DefaultFileName() const
{
return type().DefaultFileName();
}
};
} // namespace OOX
} // namespace PPTX
#endif // OOX_HYPERLINK_INCLUDE_H_
\ No newline at end of file
......@@ -8,7 +8,7 @@
#include "FileType.h"
#include "ContentTypes/File.h"
namespace OOX
namespace PPTX
{
class File
{
......@@ -17,14 +17,14 @@ namespace OOX
virtual ~File(){}
public:
virtual void read(const CPath& filename) = 0;
virtual void write(const CPath& filename, const CPath& directory, ContentTypes::File& content) const = 0;
virtual void read(const OOX::CPath& filename) = 0;
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, ContentTypes::File& content) const = 0;
public:
virtual const OOX::FileType type() const = 0;
virtual const CPath DefaultDirectory() const = 0;
virtual const CPath DefaultFileName() const = 0;
virtual const PPTX::FileType type() const = 0;
virtual const OOX::CPath DefaultDirectory() const = 0;
virtual const OOX::CPath DefaultFileName() const = 0;
};
} // namespace OOX
} // namespace PPTX
#endif // OOX_FILE_INCLUDE_H_
\ No newline at end of file
......@@ -4,12 +4,12 @@
#include "../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
namespace OOX
namespace PPTX
{
class FileType
{
public:
FileType(const CPath& defaultDirectory, const CPath& defaultFileName,
FileType(const OOX::CPath& defaultDirectory, const OOX::CPath& defaultFileName,
const CString& overrideType,
const CString& relationType) : m_defaultDirectory(defaultDirectory),
m_defaultFileName(defaultFileName),
......@@ -46,11 +46,11 @@ namespace OOX
{
return m_relationType;
}
inline const CPath DefaultDirectory() const
inline const OOX::CPath DefaultDirectory() const
{
return m_defaultDirectory;
}
inline const CPath DefaultFileName() const
inline const OOX::CPath DefaultFileName() const
{
return m_defaultFileName;
}
......@@ -58,8 +58,8 @@ namespace OOX
private:
CString m_overrideType;
CString m_relationType;
CPath m_defaultDirectory;
CPath m_defaultFileName;
OOX::CPath m_defaultDirectory;
OOX::CPath m_defaultFileName;
};
static const bool operator ==(const CString& type, const FileType& file)
......@@ -70,6 +70,6 @@ namespace OOX
{
return (file.RelationType() == type);
}
} // namespace OOX
} // namespace PPTX
#endif // OOX_FILE_TYPE_INCLUDE_H_
\ No newline at end of file
......@@ -5,7 +5,7 @@
#include "FileType.h"
namespace OOX
namespace PPTX
{
namespace FileTypes
{
......
......@@ -5,7 +5,7 @@
#include "ContentTypes/File.h"
namespace OOX
namespace PPTX
{
class IFileBuilder
{
......@@ -14,8 +14,8 @@ namespace OOX
virtual ~IFileBuilder();
public:
virtual void Commit(const CPath& path) = 0;
virtual void Finalize(const CPath& path, const CPath& directory, ContentTypes::File& content) = 0;
virtual void Commit(const OOX::CPath& path) = 0;
virtual void Finalize(const OOX::CPath& path, const OOX::CPath& directory, ContentTypes::File& content) = 0;
};
} // namespace OOX
......
......@@ -6,16 +6,16 @@
#include "UnknowTypeFile.h"
#include "IFileBuilder.h"
namespace OOX {class File;}
namespace OOX {class FileType;}
namespace OOX {namespace Rels {class File;}}
namespace OOX {namespace ContentTypes {class File;}}
namespace OOX {class Image;}
namespace OOX {class HyperLink;}
namespace OOX {class OleObject;}
namespace PPTX {class File;}
namespace PPTX {class FileType;}
namespace PPTX {namespace Rels {class File;}}
namespace PPTX {namespace ContentTypes {class File;}}
namespace PPTX {class Image;}
namespace PPTX {class HyperLink;}
namespace PPTX {class OleObject;}
namespace OOX
namespace PPTX
{
class IFileContainer
{
......@@ -28,22 +28,22 @@ namespace OOX
{
}
protected:
CAtlMap<CString, smart_ptr<OOX::File>> m_container;
CAtlMap<CString, smart_ptr<PPTX::File>> m_container;
size_t m_lMaxRid;
protected:
void read(const OOX::CPath& filename);
void read(const Rels::File& rels, const CPath& path);
void write(const CPath& filename, const CPath& directory, ContentTypes::File& content) const;
void write(Rels::File& rels, const CPath& current, const CPath& directory, ContentTypes::File& content) const;
void read(const Rels::File& rels, const OOX::CPath& path);
void write(const OOX::CPath& filename, const OOX::CPath& directory, ContentTypes::File& content) const;
void write(Rels::File& rels, const OOX::CPath& current, const OOX::CPath& directory, ContentTypes::File& content) const;
protected:
void Commit(const CPath& path);
void Finalize(const CPath& filename, const CPath& directory, ContentTypes::File& content);
void Finalize(Rels::File& rels, const CPath& current, const CPath& directory, ContentTypes::File& content);
void Commit(const OOX::CPath& path);
void Finalize(const OOX::CPath& filename, const OOX::CPath& directory, ContentTypes::File& content);
void Finalize(Rels::File& rels, const OOX::CPath& current, const OOX::CPath& directory, ContentTypes::File& content);
public:
void extractPictures(const CPath& path) const;
void extractPictures(const OOX::CPath& path) const;
public:
virtual smart_ptr<Image> image(const RId& rId) const;
......@@ -54,20 +54,20 @@ namespace OOX
public:
template<typename T> const bool exist() const;
const bool exist(const FileType& type) const;
const bool exist(const OOX::RId& rId) const;
const bool isExternal(const OOX::RId& rId) const;
const bool exist(const PPTX::RId& rId) const;
const bool isExternal(const PPTX::RId& rId) const;
smart_ptr<OOX::File> get(const FileType& type);
const RId add(const smart_ptr<OOX::File>& file);
void add(const OOX::RId rId, const smart_ptr<OOX::File>& file);
smart_ptr<PPTX::File> get(const FileType& type);
const RId add(const smart_ptr<PPTX::File>& file);
void add(const PPTX::RId rId, const smart_ptr<PPTX::File>& file);
smart_ptr<OOX::File> find(const FileType& type) const;
smart_ptr<PPTX::File> find(const FileType& type) const;
smart_ptr<OOX::File> find(const OOX::RId& type) const;
smart_ptr<PPTX::File> find(const PPTX::RId& type) const;
smart_ptr<OOX::File> operator [](const OOX::RId rId);
smart_ptr<PPTX::File> operator [](const PPTX::RId rId);
smart_ptr<OOX::File> operator [](const FileType& type);
smart_ptr<PPTX::File> operator [](const FileType& type);
template<typename T> T& find();
......@@ -93,6 +93,6 @@ namespace OOX
return dynamic_cast<T&>(find(file.type()));
}
} // namespace OOX
} // namespace PPTX
#endif // OOX_IFILE_CONTAINER_INCLUDE_H_
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -66,7 +66,7 @@ namespace PPTX
public:
OOX::RId link;
PPTX::RId link;
// trim
nullable_double st;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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