Commit 4138e5b4 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@53170 954022d7-b5bf-4e40-9824-e11837661b57
parent d6c28e21
...@@ -104,6 +104,10 @@ protected: ...@@ -104,6 +104,10 @@ protected:
BOOL m_bIsUseSystemFonts; BOOL m_bIsUseSystemFonts;
CString m_strEmbeddedFontsDirectory; CString m_strEmbeddedFontsDirectory;
#ifdef USE_ODF_FILE
ODFFile::IOfficeOdfFile* m_pODFFile;
#endif
public: public:
__event __interface _IAVSPresentationEditorEvents; __event __interface _IAVSPresentationEditorEvents;
...@@ -133,12 +137,15 @@ public: ...@@ -133,12 +137,15 @@ public:
m_strMediaDirectory = _T(""); m_strMediaDirectory = _T("");
m_bIsUseSystemFonts = FALSE; m_bIsUseSystemFonts = FALSE;
m_strEmbeddedFontsDirectory = _T(""); m_strEmbeddedFontsDirectory = _T("");
m_pODFFile = NULL;
} }
~CAVSPresentationEditor() ~CAVSPresentationEditor()
{ {
CloseFile(VARIANT_TRUE); CloseFile(VARIANT_TRUE);
RELEASEINTERFACE(m_pWinFonts); RELEASEINTERFACE(m_pWinFonts);
RELEASEINTERFACE(m_pODFFile);
} }
public: public:
...@@ -232,6 +239,7 @@ public: ...@@ -232,6 +239,7 @@ public:
} }
if (S_OK != hRes) if (S_OK != hRes)
{ {
#ifndef USE_ODF_FILE
if (SUCCEEDED(CoCreateInstance(ODPFile::CLSID_CAVSOfficeODPFile, NULL, CLSCTX_ALL, ODPFile::IID_IAVSOfficeODPFile, (void**)&m_pODPFile))) if (SUCCEEDED(CoCreateInstance(ODPFile::CLSID_CAVSOfficeODPFile, NULL, CLSCTX_ALL, ODPFile::IID_IAVSOfficeODPFile, (void**)&m_pODPFile)))
{ {
m_pODPFile->put_TempDirectory(bstrTemp); m_pODPFile->put_TempDirectory(bstrTemp);
...@@ -255,6 +263,17 @@ public: ...@@ -255,6 +263,17 @@ public:
RELEASEINTERFACE(m_pODPFile); RELEASEINTERFACE(m_pODPFile);
} }
#else
CoCreateInstance(ODFFile::CLSID_COfficeOdfFile, NULL, CLSCTX_ALL, ODFFile::IID_IOfficeOdfFile, (void**)&m_pODFFile);
CString strOptions = _T("<Options><onlyPresentation></onlyPresentation></Options>");
BSTR bsOptions = strOptions.AllocSysString();
HRESULT hRes = m_pODFFile->LoadFromFile(fileName, bstrTemp, bsOptions);
SysFreeString(bsOptions);
if (hRes != S_OK)
m_pODFFile = NULL;
#endif
} }
SysFreeString(bstrTemp); SysFreeString(bstrTemp);
...@@ -356,6 +375,8 @@ public: ...@@ -356,6 +375,8 @@ public:
m_strFileName = _T(""); m_strFileName = _T("");
m_strEditorXml = _T(""); m_strEditorXml = _T("");
m_pODFFile = NULL;
RELEASEOBJECT(m_pInfoStorage); RELEASEOBJECT(m_pInfoStorage);
RELEASEOBJECT(m_pStatusStorage); RELEASEOBJECT(m_pStatusStorage);
...@@ -448,6 +469,23 @@ public: ...@@ -448,6 +469,23 @@ public:
} }
case 1: case 1:
{ {
#ifdef USE_ODF_FILE
if (NULL != m_pODFFile)
{
// temp
AVSOfficeUtils::IOfficeUtils* pOfficeUtils = NULL;
if (S_OK != CoCreateInstance(__uuidof(AVSOfficeUtils::COfficeUtils), NULL, CLSCTX_INPROC_SERVER, __uuidof(AVSOfficeUtils::IOfficeUtils),(void**)&pOfficeUtils))
return S_FALSE;
//
BSTR bstrSrcPath = m_strTempDirectory.AllocSysString();
pOfficeUtils->CompressFileOrDirectory( bstrSrcPath, bsFilePath, -1 );
SysFreeString(bstrSrcPath);
RELEASEINTERFACE(pOfficeUtils);
return S_OK;
}
#endif
// //
CPPTXWriter oWriter; CPPTXWriter oWriter;
...@@ -606,6 +644,7 @@ public: ...@@ -606,6 +644,7 @@ public:
} }
if (S_OK != hRes) if (S_OK != hRes)
{ {
#ifndef USE_ODF_FILE
if (SUCCEEDED(CoCreateInstance(ODPFile::CLSID_CAVSOfficeODPFile, NULL, CLSCTX_ALL, ODPFile::IID_IAVSOfficeODPFile, (void**)&m_pODPFile))) if (SUCCEEDED(CoCreateInstance(ODPFile::CLSID_CAVSOfficeODPFile, NULL, CLSCTX_ALL, ODPFile::IID_IAVSOfficeODPFile, (void**)&m_pODPFile)))
{ {
m_pODPFile->put_TempDirectory(bstrTemp); m_pODPFile->put_TempDirectory(bstrTemp);
...@@ -679,6 +718,78 @@ public: ...@@ -679,6 +718,78 @@ public:
RELEASEINTERFACE(m_pODPFile); RELEASEINTERFACE(m_pODPFile);
} }
#else
ODFFile::IOfficeOdfFile* pODPFile = NULL;
CoCreateInstance(ODFFile::CLSID_COfficeOdfFile, NULL, CLSCTX_ALL, ODFFile::IID_IOfficeOdfFile, (void**)&pODPFile);
CString strOptions = _T("<Options><onlyPresentation></onlyPresentation></Options>");
BSTR bsOptions = strOptions.AllocSysString();
CString strTemp2 = m_strTempDirectoryFile + "\\OpenFolder\\";
AVSOfficeUtils::IOfficeUtilsPtr pOfficeUtils;
pOfficeUtils.CreateInstance(AVSOfficeUtils::CLSID_COfficeUtils);
BSTR bsTemp2 = strTemp2.AllocSysString();
CreateDirectoryW(strTemp2, NULL);
HRESULT hr = pOfficeUtils->ExtractToDirectory(bsSrc, bsTemp2, NULL, 0);
CString strTemp1 = m_strTempDirectoryFile + "\\WritePPTX\\";
CreateDirectory(strTemp1, NULL);
BSTR bsTemp1 = strTemp1.AllocSysString();
HRESULT hRes = pODPFile->LoadFromFile(bsTemp2, bsTemp1, bsOptions);
SysFreeString(bsOptions);
SysFreeString(bsTemp2);
RELEASEINTERFACE(pODPFile);
SHFILEOPSTRUCTW shfos;
ZeroMemory(&shfos, sizeof(shfos));
shfos.wFunc = FO_DELETE;
CStringW _local = strTemp2 + L"*.*";
_local.AppendChar(0);
_local.AppendChar(0);
shfos.pFrom = _local.GetString();
shfos.fFlags = FOF_SILENT + FOF_NOCONFIRMATION;
SHFileOperationW(&shfos);
RemoveDirectoryW(strTemp2);
PPTXFile::IAVSOfficePPTXFile2* pPPTX2 = NULL;
CoCreateInstance(PPTXFile::CLSID_CAVSOfficePPTXFile, NULL, CLSCTX_ALL, PPTXFile::IID_IAVSOfficePPTXFile2, (void**)&pPPTX2);
BSTR bsMediaDir = m_strMediaDirectory.AllocSysString();
BSTR bsFontDir = m_strFontDirectory.AllocSysString();
VARIANT_BOOL vbSystem = (m_bIsUseSystemFonts == TRUE) ? VARIANT_TRUE : VARIANT_FALSE;
pPPTX2->SetMediaDir(bsMediaDir);
pPPTX2->SetFontDir(bsFontDir);
pPPTX2->SetUseSystemFonts(vbSystem);
SysFreeString(bsMediaDir);
SysFreeString(bsFontDir);
if (_T("") != m_strEmbeddedFontsDirectory)
{
PPTXFile::IAVSOfficePPTXFile* pPPTX1 = NULL;
pPPTX2->QueryInterface(PPTXFile::IID_IAVSOfficePPTXFile, (void**)&pPPTX1);
if (NULL != pPPTX1)
{
VARIANT var;
var.vt = VT_BSTR;
var.bstrVal = m_strEmbeddedFontsDirectory.AllocSysString();
pPPTX1->SetAdditionalParam(L"EmbeddedFontsDirectory", var);
SysFreeString(var.bstrVal);
RELEASEINTERFACE(pPPTX1);
}
}
pPPTX2->OpenDirectoryToPPTY(bsTemp1, bsDst);
SysFreeString(bsTemp1);
RELEASEINTERFACE(pPPTX2);
#endif
} }
SysFreeString(bstrTemp); SysFreeString(bstrTemp);
......
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="..\..\..\Redist\VersionControl.exe &quot;$(ProjectDir)\version.h&quot;" CommandLine="..\Redist\VersionControl.exe &quot;$(ProjectDir)\version.h&quot;"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
......
...@@ -66,3 +66,9 @@ using namespace Gdiplus; ...@@ -66,3 +66,9 @@ using namespace Gdiplus;
#import "../Redist/ASCOfficeOdpFile.dll" named_guids rename_namespace("ODPFile"), raw_interfaces_only, exclude("IAVSOfficeFileTemplate", "_IAVSOfficeFileTemplateEvents", "_IAVSOfficeFileTemplateEvents2", "IAVSOfficeFile") #import "../Redist/ASCOfficeOdpFile.dll" named_guids rename_namespace("ODPFile"), raw_interfaces_only, exclude("IAVSOfficeFileTemplate", "_IAVSOfficeFileTemplateEvents", "_IAVSOfficeFileTemplateEvents2", "IAVSOfficeFile")
#import "../Redist/ASCOfficePDFWriter.dll" named_guids rename_namespace("PDFFile"), raw_interfaces_only, exclude("IASCRenderer") #import "../Redist/ASCOfficePDFWriter.dll" named_guids rename_namespace("PDFFile"), raw_interfaces_only, exclude("IASCRenderer")
#define USE_ODF_FILE
#ifdef USE_ODF_FILE
#import "../Redist/ASCOfficeOdfFile.dll" named_guids raw_interfaces_only rename_namespace("ODFFile")
#endif
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