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

fix WIN32

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@59203 954022d7-b5bf-4e40-9824-e11837661b57
parent 2ebabd2c
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "../Common/OfficeFileTemplate.h" #include "../Common/OfficeFileTemplate.h"
#include "ASCOfficePPTXFile.h" #include "ASCOfficePPTXFile.h"
#include "../ASCOfficeUtils/ASCOfficeUtilsLib/OfficeUtils.h"
#include "../Common/DocxFormat/Source/SystemUtility/File.h" #include "../Common/DocxFormat/Source/SystemUtility/File.h"
void comLoadTheme(void* pArg, int nIndex, CString& strDstFolder); void comLoadTheme(void* pArg, int nIndex, CString& strDstFolder);
...@@ -194,38 +194,40 @@ void comLoadTheme(void* pArg, int nIndex, CString& strDstFolder) ...@@ -194,38 +194,40 @@ void comLoadTheme(void* pArg, int nIndex, CString& strDstFolder)
} }
bool comExtractFile(void* pArg, CString& sFile, CString& sDir) bool comExtractFile(void* pArg, CString& sFile, CString& sDir)
{ {
OfficeUtils::IOfficeUtils* pOfficeUtils = NULL; COfficeUtils *pOfficeUtils = new COfficeUtils(NULL);
if (pOfficeUtils == NULL) return false;
if (S_OK != CoCreateInstance(__uuidof(OfficeUtils::COfficeUtils), NULL, CLSCTX_INPROC_SERVER, __uuidof(OfficeUtils::IOfficeUtils),(void**)&pOfficeUtils))
return false;
BSTR bsFile = sFile.AllocSysString(); BSTR bsFile = sFile.AllocSysString();
BSTR bsDir = sDir.AllocSysString(); BSTR bsDir = sDir.AllocSysString();
HRESULT hr = pOfficeUtils->ExtractToDirectory( bsFile, bsDir, NULL, 0); HRESULT hr = pOfficeUtils->ExtractToDirectory( bsFile, bsDir, NULL, 0);
SysFreeString(bsFile); SysFreeString(bsFile);
SysFreeString(bsDir); SysFreeString(bsDir);
delete pOfficeUtils;
if(hr != S_OK) if(hr != S_OK)
return false; return false;
RELEASEINTERFACE(pOfficeUtils);
return true; return true;
} }
bool comCompressFile(void* pArg, CString& sDir, CString& sFile) bool comCompressFile(void* pArg, CString& sDir, CString& sFile)
{ {
OfficeUtils::IOfficeUtils* pOfficeUtils = NULL; COfficeUtils *pOfficeUtils = new COfficeUtils(NULL);
if (pOfficeUtils == NULL) return false;
if (S_OK != CoCreateInstance(__uuidof(OfficeUtils::COfficeUtils), NULL, CLSCTX_INPROC_SERVER, __uuidof(OfficeUtils::IOfficeUtils),(void**)&pOfficeUtils))
return false;
BSTR bsDir = sDir.AllocSysString(); BSTR bsDir = sDir.AllocSysString();
BSTR bsFile = sFile.AllocSysString(); BSTR bsFile = sFile.AllocSysString();
HRESULT hr = pOfficeUtils->CompressFileOrDirectory( bsDir, bsFile, -1 ); HRESULT hr = pOfficeUtils->CompressFileOrDirectory( bsDir, bsFile, -1 );
SysFreeString(bsDir); SysFreeString(bsDir);
SysFreeString(bsFile); SysFreeString(bsFile);
delete pOfficeUtils;
if(hr != S_OK) if(hr != S_OK)
return false; return false;
RELEASEINTERFACE(pOfficeUtils);
return true; return true;
} }
bool comProgress(void* pArg, long ID, long Percent) bool comProgress(void* pArg, long ID, long Percent)
......
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