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

расширение X2t до форматов Rtf, Doc (linux)

FileChecker для входных файлов  (linux)

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62308 954022d7-b5bf-4e40-9824-e11837661b57
parent add4140c
/ svn_global_002dignores=SDK%0A
ASCHTMLRenderer/Mac svnc_tsvn_003alogminsize=5 ASCHTMLRenderer/Mac svnc_tsvn_003alogminsize=5
ASCHTMLRenderer/Mac/ASCHTMLRendererLib svnc_tsvn_003alogminsize=5 ASCHTMLRenderer/Mac/ASCHTMLRendererLib svnc_tsvn_003alogminsize=5
ASCHTMLRenderer/Mac/ASCHTMLRendererLib.xcodeproj svnc_tsvn_003alogminsize=5 ASCHTMLRenderer/Mac/ASCHTMLRendererLib.xcodeproj svnc_tsvn_003alogminsize=5
......
...@@ -160,7 +160,6 @@ namespace DocFileFormat ...@@ -160,7 +160,6 @@ namespace DocFileFormat
long Converter::LoadAndConvert(const CString& strSrcFile, const CString& strDstDirectory, const ProgressCallback* progress) long Converter::LoadAndConvert(const CString& strSrcFile, const CString& strDstDirectory, const ProgressCallback* progress)
{ {
g_oCriticalSection.Enter();
long result = S_FALSE; long result = S_FALSE;
...@@ -190,8 +189,6 @@ namespace DocFileFormat ...@@ -190,8 +189,6 @@ namespace DocFileFormat
} }
} }
g_oCriticalSection.Leave();
return result; return result;
} }
} }
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#include "WordprocessingDocument.h" #include "WordprocessingDocument.h"
#include "ConversionContext.h" #include "ConversionContext.h"
extern ASCOfficeCriticalSection g_oCriticalSection;
namespace DocFileFormat namespace DocFileFormat
{ {
class Converter class Converter
......
...@@ -6,66 +6,17 @@ ...@@ -6,66 +6,17 @@
#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h" #include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include "../../ASCOfficeUtils/ASCOfficeUtilsLib/OfficeUtils.h" #include "../../ASCOfficeUtils/ASCOfficeUtilsLib/OfficeUtils.h"
HRESULT COfficeDocFile::LoadFromFile(CString bsDocFile, CString bsDocx, CString bsXMLOptions, ProgressCallback *ffCallBack ) HRESULT COfficeDocFile::LoadFromFile(CString bsDocFile, CString bsDocxDirectory, CString bsXMLOptions, ProgressCallback *ffCallBack )
{ {
#if defined(_DEBUG) && defined (_WIN32)
//_CrtDumpMemoryLeaks();
//_CrtSetBreakAlloc(11001);
#endif
HRESULT hr = S_FALSE; HRESULT hr = S_FALSE;
DocFileFormat::Converter docToDocx; DocFileFormat::Converter docToDocx;
hr= docToDocx.LoadAndConvert(bsDocFile, bsDocxDirectory, ffCallBack);
if (m_strTempDirectory.GetLength() < 1)
{
m_strTempDirectory = FileSystem::Directory::GetTempPath();
}
CString sDocxDirectory;
#if !defined(_WIN32) && !defined(_WIN64)
sDocxDirectory = FileSystem::Directory::CreateDirectoryWithUniqueName(m_strTempDirectory);
#else
sDocxDirectory = bsDocx;
FileSystem::Directory::CreateDirectory(sDocxDirectory);
#endif
hr= docToDocx.LoadAndConvert(bsDocFile,sDocxDirectory, ffCallBack);
#ifndef _WIN32
if (hr == S_OK)
{
//zipping
COfficeUtils oCOfficeUtils(NULL);
hr = oCOfficeUtils.CompressFileOrDirectory (string2std_string(sDocxDirectory), string2std_string(bsDocx), -1);
FileSystem::Directory::DeleteDirectory(sDocxDirectory);
}
#endif
#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64))
//_CrtDumpMemoryLeaks();
#endif
return hr; return hr;
} }
HRESULT COfficeDocFile::SaveToFile (CString sDstFileName, CString sSrcFileName, CString sXMLOptions, ProgressCallback *ffCallBack ) HRESULT COfficeDocFile::SaveToFile (CString sDstFileName, CString sSrcFileName, CString sXMLOptions, ProgressCallback *ffCallBack )
{ {
HRESULT hr = S_OK; return S_OK;
//DOCXTODOC::CFileTransformer oTransformer;
#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64))
//_CrtDumpMemoryLeaks();
#endif
//hr = oTransformer.Convert(sSrcPath, sDstFileName, ffCallBack);
#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64))
//_CrtDumpMemoryLeaks();
#endif
return hr;
} }
...@@ -1228,14 +1228,6 @@ ...@@ -1228,14 +1228,6 @@
RelativePath="..\DocFormatLib.h" RelativePath="..\DocFormatLib.h"
> >
</File> </File>
<File
RelativePath="..\..\..\Common\DocxFormat\Source\XML\libxml2\libxml2.cpp"
>
</File>
<File
RelativePath="..\..\..\Common\DocxFormat\Source\XML\stringcommon.cpp"
>
</File>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>
......
#include "stdafx.h" #include "stdafx.h"
#include "ASCDocFile.h" #include "ASCDocFile.h"
#include "ASCOfficeCriticalSection.h" //#include "ASCOfficeCriticalSection.h"
#include "../DocFormatLib/DocFormatLib.h" #include "../DocFormatLib/DocFormatLib.h"
#include "../Common/Callback.h" #include "../Common/Callback.h"
...@@ -11,11 +11,9 @@ ...@@ -11,11 +11,9 @@
#include <crtdbg.h> #include <crtdbg.h>
#endif #endif
ASCOfficeCriticalSection g_oCriticalSection;
STDMETHODIMP CASCOfficeDocFile::LoadFromFile(BSTR bsDocFile, BSTR bsDocxFilePath, BSTR bsXMLOptions) STDMETHODIMP CASCOfficeDocFile::LoadFromFile(BSTR bsDocFile, BSTR bsDocxFilePath, BSTR bsXMLOptions)
{ {
g_oCriticalSection.Enter();
#ifdef _DEBUG #ifdef _DEBUG
//_CrtDumpMemoryLeaks(); //_CrtDumpMemoryLeaks();
...@@ -36,13 +34,11 @@ STDMETHODIMP CASCOfficeDocFile::LoadFromFile(BSTR bsDocFile, BSTR bsDocxFilePath ...@@ -36,13 +34,11 @@ STDMETHODIMP CASCOfficeDocFile::LoadFromFile(BSTR bsDocFile, BSTR bsDocxFilePath
//_CrtDumpMemoryLeaks(); //_CrtDumpMemoryLeaks();
#endif #endif
g_oCriticalSection.Leave();
return hr; return hr;
} }
STDMETHODIMP CASCOfficeDocFile::SaveToFile (BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions) STDMETHODIMP CASCOfficeDocFile::SaveToFile (BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions)
{ {
g_oCriticalSection.Enter();
#ifdef _DEBUG #ifdef _DEBUG
//_CrtDumpMemoryLeaks(); //_CrtDumpMemoryLeaks();
...@@ -62,27 +58,21 @@ STDMETHODIMP CASCOfficeDocFile::SaveToFile (BSTR sDstFileName, BSTR sSrcPath, BS ...@@ -62,27 +58,21 @@ STDMETHODIMP CASCOfficeDocFile::SaveToFile (BSTR sDstFileName, BSTR sSrcPath, BS
//_CrtDumpMemoryLeaks(); //_CrtDumpMemoryLeaks();
#endif #endif
g_oCriticalSection.Leave();
return hr; return hr;
} }
void CASCOfficeDocFile::OnProgressFunc (LPVOID lpParam, long nID, long nPercent) void CASCOfficeDocFile::OnProgressFunc (LPVOID lpParam, long nID, long nPercent)
{ {
g_oCriticalSection.Enter();
CASCOfficeDocFile* pDocFile = reinterpret_cast<CASCOfficeDocFile*>(lpParam); CASCOfficeDocFile* pDocFile = reinterpret_cast<CASCOfficeDocFile*>(lpParam);
if (pDocFile != NULL) if (pDocFile != NULL)
{ {
pDocFile->OnProgress(nID, nPercent); pDocFile->OnProgress(nID, nPercent);
} }
g_oCriticalSection.Leave();
} }
void CASCOfficeDocFile::OnProgressExFunc (LPVOID lpParam, long nID, long nPercent, short* pStop) void CASCOfficeDocFile::OnProgressExFunc (LPVOID lpParam, long nID, long nPercent, short* pStop)
{ {
g_oCriticalSection.Enter();
CASCOfficeDocFile* pDocFile = reinterpret_cast<CASCOfficeDocFile*>(lpParam); CASCOfficeDocFile* pDocFile = reinterpret_cast<CASCOfficeDocFile*>(lpParam);
if (NULL != pDocFile) if (NULL != pDocFile)
...@@ -90,5 +80,4 @@ void CASCOfficeDocFile::OnProgressExFunc (LPVOID lpParam, long nID, long nPercen ...@@ -90,5 +80,4 @@ void CASCOfficeDocFile::OnProgressExFunc (LPVOID lpParam, long nID, long nPercen
pDocFile->OnProgressEx(nID, nPercent, pStop); pDocFile->OnProgressEx(nID, nPercent, pStop);
} }
g_oCriticalSection.Leave();
} }
\ No newline at end of file
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//1 //1
//0 //0
//1 //1
//228 //231
#define INTVER 1,0,1,228 #define INTVER 1,0,1,231
#define STRVER "1,0,1,228\0" #define STRVER "1,0,1,231\0"
This diff is collapsed.
...@@ -800,18 +800,6 @@ ...@@ -800,18 +800,6 @@
RelativePath="..\source\ConvertationManager.h" RelativePath="..\source\ConvertationManager.h"
> >
</File> </File>
<File
RelativePath="..\..\..\Common\DocxFormat\Source\XML\libxml2\libxml2.cpp"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocFile\pole\pole.cpp"
>
</File>
<File
RelativePath="..\..\..\Common\DocxFormat\Source\XML\stringcommon.cpp"
>
</File>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>
......
...@@ -23,7 +23,7 @@ public: ...@@ -23,7 +23,7 @@ public:
{ {
} }
HRESULT ConvertRtfToOOX( CString sSrcFileName, CString sDstPath, CString sXMLOptions ) HRESULT ConvertRtfToOOX( std::wstring sSrcFileName, std::wstring sDstPath, CString sXMLOptions )
{ {
m_bParseFirstItem = true; m_bParseFirstItem = true;
...@@ -64,7 +64,7 @@ public: ...@@ -64,7 +64,7 @@ public:
else else
return S_FALSE; return S_FALSE;
} }
HRESULT ConvertOOXToRtf( CString sDstFileName, CString sSrcPath, CString sXMLOptions ) HRESULT ConvertOOXToRtf( std::wstring sDstFileName, std::wstring sSrcPath, CString sXMLOptions )
{ {
m_bParseFirstItem = true; m_bParseFirstItem = true;
......
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
#include "OOXFootnotesReader.h" #include "OOXFootnotesReader.h"
#include "OOXThemeReader.h" #include "OOXThemeReader.h"
OOXReader::OOXReader( RtfDocument& oDocument,CString path ): m_oDocument(oDocument) OOXReader::OOXReader( RtfDocument& oDocument, std::wstring path ): m_oDocument(oDocument)
{ {
m_sPath = path; m_sPath = std_string2string(path);
m_nCurItap = 0; m_nCurItap = 0;
m_convertationManager = NULL; m_convertationManager = NULL;
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
//TempFolder //TempFolder
CString m_sTempFolder; CString m_sTempFolder;
OOXReader( RtfDocument& oDocument, CString path ); OOXReader( RtfDocument& oDocument, std::wstring path );
bool Parse(); bool Parse();
private: private:
void ParseColorTable( RtfDocument& oDocument ); void ParseColorTable( RtfDocument& oDocument );
......
...@@ -33,13 +33,13 @@ public: ...@@ -33,13 +33,13 @@ public:
m_nSizeAbs = 0; m_nSizeAbs = 0;
m_nPosAbs = -1; m_nPosAbs = -1;
} }
void SetSource( CString sPath ) void SetSource( std::wstring sPath )
{ {
Clear(); Clear();
CFile srcFile; CFile srcFile;
if (srcFile.OpenFile(sPath) != S_OK) return; if (srcFile.OpenFile(sPath.c_str()) != S_OK) return;
__int64 totalFileSize = srcFile.GetFileSize(); __int64 totalFileSize = srcFile.GetFileSize();
...@@ -136,7 +136,7 @@ public: ...@@ -136,7 +136,7 @@ public:
{ {
return 1.0 * m_oStream.getCurPosition() / m_oStream.getSize(); return 1.0 * m_oStream.getCurPosition() / m_oStream.getSize();
} }
void SetSource( CString sPath ) void SetSource( std::wstring sPath )
{ {
m_oStream.SetSource( sPath); m_oStream.SetSource( sPath);
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "DestinationCommand.h" #include "DestinationCommand.h"
RtfReader::RtfReader(RtfDocument& oDocument, CString sFilename ):m_oDocument(oDocument),m_sFilename(sFilename) RtfReader::RtfReader(RtfDocument& oDocument, std::wstring sFilename ):m_oDocument(oDocument),m_sFilename(sFilename)
{ {
m_oState = ReaderStatePtr(new ReaderState()); m_oState = ReaderStatePtr(new ReaderState());
m_nFootnote = PROP_DEF; m_nFootnote = PROP_DEF;
......
...@@ -46,7 +46,7 @@ public: ...@@ -46,7 +46,7 @@ public:
int m_nDefFont; int m_nDefFont;
CString m_sTempFolder; CString m_sTempFolder;
RtfReader(RtfDocument& oDocument, CString sFilename ); RtfReader(RtfDocument& oDocument, std::wstring sFilename );
~RtfReader() ~RtfReader()
{ {
} }
...@@ -63,7 +63,7 @@ public: ...@@ -63,7 +63,7 @@ public:
} }
private: private:
RtfDocument& m_oDocument; RtfDocument& m_oDocument;
CString m_sFilename; std::wstring m_sFilename;
}; };
class RtfAbstractReader class RtfAbstractReader
......
...@@ -166,7 +166,7 @@ bool RtfWriter::SaveByItemEnd() ...@@ -166,7 +166,7 @@ bool RtfWriter::SaveByItemEnd()
//формируем выходной файл //формируем выходной файл
try try
{ {
NFileWriter::CBufferedFileWriter oTargetFileWriter( m_sFilename ); NFileWriter::CBufferedFileWriter oTargetFileWriter(m_sFilename );
//пишем заголовок потом все содежимое //пишем заголовок потом все содежимое
sRtf = CreateRtfStart(); sRtf = CreateRtfStart();
......
...@@ -15,10 +15,10 @@ public: ...@@ -15,10 +15,10 @@ public:
std::vector<CString> m_aTempFiles; std::vector<CString> m_aTempFiles;
std::vector<CString> m_aTempFilesSectPr; std::vector<CString> m_aTempFilesSectPr;
RtfWriter( RtfDocument& oDocument , CString sFilename, CString sFolder ):m_oDocument(oDocument) RtfWriter( RtfDocument& oDocument , std::wstring sFilename, std::wstring sFolder ):m_oDocument(oDocument)
{ {
m_sFilename = sFilename; m_sFilename = std_string2string(sFilename);
m_sTempFolder = sFolder; m_sTempFolder = std_string2string(sFolder);
m_bFirst = true; m_bFirst = true;
m_oCurTempFileWriter = NULL; m_oCurTempFileWriter = NULL;
m_oCurTempFileSectWriter = NULL; m_oCurTempFileSectWriter = NULL;
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
#include "../../../../ASCOfficeDocxFile2/BinReader/DefaultThemeWriter.h" #include "../../../../ASCOfficeDocxFile2/BinReader/DefaultThemeWriter.h"
OOXWriter::OOXWriter( RtfDocument& oDocument, CString sPath ) : OOXWriter::OOXWriter( RtfDocument& oDocument, std::wstring sPath ) :
m_oDocument(oDocument), m_oDocument(oDocument),
m_sTargetFolder(sPath), m_sTargetFolder(sPath.c_str()),
m_oRels( _T(""), oDocument ), m_oRels( _T(""), oDocument ),
m_oDocRels( _T("document.xml"), oDocument ) m_oDocRels( _T("document.xml"), oDocument )
{ {
......
...@@ -31,11 +31,11 @@ public: ...@@ -31,11 +31,11 @@ public:
//TempFolder //TempFolder
CString m_sTempFolder; CString m_sTempFolder;
CString m_sTargetFolder; CString m_sTargetFolder;
std::map<CString, int> m_aBookmarksId; std::map<CString, int> m_aBookmarksId;
OOXWriter( RtfDocument& oDocument, CString sPath ); OOXWriter( RtfDocument& oDocument, std::wstring sPath );
~OOXWriter(); ~OOXWriter();
bool Save(); bool Save();
......
...@@ -82,12 +82,11 @@ ...@@ -82,12 +82,11 @@
/> />
</Configuration> </Configuration>
<Configuration <Configuration
Name="Release|Win32" Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(ConfigurationName)" OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4" ConfigurationType="4"
CharacterSet="1" CharacterSet="1"
WholeProgramOptimization="1"
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
...@@ -103,12 +102,16 @@ ...@@ -103,12 +102,16 @@
/> />
<Tool <Tool
Name="VCMIDLTool" Name="VCMIDLTool"
TargetEnvironment="3"
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="D:\WORK\AVS\Sources\TeamlabOffice\branches\Docx2DoctConverter\ServerComponents\DesktopEditor\freetype-2.5.2\include" Optimization="0"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED" AdditionalIncludeDirectories="D:\WORK\AVS\Sources\TeamlabOffice\branches\Docx2DoctConverter\ServerComponents\Common\DocxFormat\Source\DocxFormat;&quot;D:\WORK\AVS\Sources\TeamlabOffice\branches\Docx2DoctConverter\ServerComponents\DesktopEditor\freetype-2.5.2\include&quot;"
RuntimeLibrary="2" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="true" Detect64BitPortabilityProblems="true"
...@@ -143,11 +146,12 @@ ...@@ -143,11 +146,12 @@
/> />
</Configuration> </Configuration>
<Configuration <Configuration
Name="Debug|x64" Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4" ConfigurationType="4"
CharacterSet="1" CharacterSet="1"
WholeProgramOptimization="1"
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
...@@ -163,16 +167,12 @@ ...@@ -163,16 +167,12 @@
/> />
<Tool <Tool
Name="VCMIDLTool" Name="VCMIDLTool"
TargetEnvironment="3"
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" AdditionalIncludeDirectories="D:\WORK\AVS\Sources\TeamlabOffice\branches\Docx2DoctConverter\ServerComponents\DesktopEditor\freetype-2.5.2\include"
AdditionalIncludeDirectories="D:\WORK\AVS\Sources\TeamlabOffice\branches\Docx2DoctConverter\ServerComponents\Common\DocxFormat\Source\DocxFormat;&quot;D:\WORK\AVS\Sources\TeamlabOffice\branches\Docx2DoctConverter\ServerComponents\DesktopEditor\freetype-2.5.2\include&quot;" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED" RuntimeLibrary="2"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="true" Detect64BitPortabilityProblems="true"
...@@ -278,6 +278,14 @@ ...@@ -278,6 +278,14 @@
<File <File
RelativePath="..\Source\Docx2Txt\Converter.cpp" RelativePath="..\Source\Docx2Txt\Converter.cpp"
> >
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath="..\Source\Docx2Txt\Converter.h" RelativePath="..\Source\Docx2Txt\Converter.h"
...@@ -300,16 +308,17 @@ ...@@ -300,16 +308,17 @@
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
Name="Release|Win32" Name="Debug|x64"
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/bigobj"
ObjectFile="$(IntDir)\$(InputName)1.obj" ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
Name="Debug|x64" Name="Release|Win32"
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
...@@ -352,7 +361,7 @@ ...@@ -352,7 +361,7 @@
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
Name="Release|Win32" Name="Debug|x64"
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
...@@ -361,7 +370,7 @@ ...@@ -361,7 +370,7 @@
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
Name="Debug|x64" Name="Release|Win32"
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
...@@ -472,10 +481,6 @@ ...@@ -472,10 +481,6 @@
</File> </File>
</Filter> </Filter>
</Filter> </Filter>
<File
RelativePath="..\..\..\Common\DocxFormat\Source\XML\libxml2\libxml2.cpp"
>
</File>
<File <File
RelativePath="..\Source\TxtXmlFile.cpp" RelativePath="..\Source\TxtXmlFile.cpp"
> >
......
...@@ -438,12 +438,17 @@ namespace ZLibZipUtils ...@@ -438,12 +438,17 @@ namespace ZLibZipUtils
{ {
if (current_file_is_find(unzip_file_handle, filePathInZip) == true) if (current_file_is_find(unzip_file_handle, filePathInZip) == true)
{ {
unz_file_info file_info; unz_file_info file_info;
unzGetCurrentFileInfo(unzip_file_handle, &file_info, NULL, 0, NULL, 0, NULL, 0); unzGetCurrentFileInfo(unzip_file_handle, &file_info, NULL, 0, NULL, 0, NULL, 0);
nFileSize = file_info.uncompressed_size;
(*fileInBytes) = new BYTE[nFileSize]; if (nFileSize > 0)
get_file(unzip_file_handle, (*fileInBytes), nFileSize); nFileSize = (std::min)(nFileSize, file_info.uncompressed_size);
return true; else
nFileSize = file_info.uncompressed_size;
(*fileInBytes) = new BYTE[nFileSize];
get_file(unzip_file_handle, (*fileInBytes), nFileSize);
return true;
} }
// else just skip the erroneous file // else just skip the erroneous file
} while (UNZ_OK == unzGoToNextFile(unzip_file_handle)); } while (UNZ_OK == unzGoToNextFile(unzip_file_handle));
......
...@@ -511,7 +511,7 @@ ...@@ -511,7 +511,7 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -520,7 +520,7 @@ ...@@ -520,7 +520,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/bigobj" AdditionalOptions="/bigobj"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -528,7 +528,7 @@ ...@@ -528,7 +528,7 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -537,7 +537,7 @@ ...@@ -537,7 +537,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/bigobj" AdditionalOptions="/bigobj"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -569,7 +569,7 @@ ...@@ -569,7 +569,7 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -578,7 +578,7 @@ ...@@ -578,7 +578,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/bigobj" AdditionalOptions="/bigobj"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -586,7 +586,7 @@ ...@@ -586,7 +586,7 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -595,7 +595,7 @@ ...@@ -595,7 +595,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/bigobj" AdditionalOptions="/bigobj"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -651,7 +651,7 @@ ...@@ -651,7 +651,7 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AssemblerListingLocation="$(IntDir)\Docx\Logic\" AssemblerListingLocation=""
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -692,7 +692,7 @@ ...@@ -692,7 +692,7 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -700,7 +700,7 @@ ...@@ -700,7 +700,7 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -708,7 +708,7 @@ ...@@ -708,7 +708,7 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -717,7 +717,7 @@ ...@@ -717,7 +717,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/bigobj" AdditionalOptions="/bigobj"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -788,7 +788,7 @@ ...@@ -788,7 +788,7 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -796,7 +796,7 @@ ...@@ -796,7 +796,7 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -804,7 +804,7 @@ ...@@ -804,7 +804,7 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -853,7 +853,7 @@ ...@@ -853,7 +853,7 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -862,7 +862,7 @@ ...@@ -862,7 +862,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/bigobj" AdditionalOptions="/bigobj"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -870,7 +870,7 @@ ...@@ -870,7 +870,7 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -879,7 +879,7 @@ ...@@ -879,7 +879,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/bigobj" AdditionalOptions="/bigobj"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -911,7 +911,7 @@ ...@@ -911,7 +911,7 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -920,7 +920,7 @@ ...@@ -920,7 +920,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/bigobj" AdditionalOptions="/bigobj"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -928,7 +928,7 @@ ...@@ -928,7 +928,7 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
...@@ -937,7 +937,7 @@ ...@@ -937,7 +937,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/bigobj" AdditionalOptions="/bigobj"
ObjectFile="$(IntDir)\Docx\Logic\" ObjectFile="$(IntDir)\"
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
......
#pragma once
#include <string>
#include "OfficeFileFormats.h"
namespace POLE
{
class Storage;
}
class COfficeFileFormatChecker
{
public:
int nFileType;
COfficeFileFormatChecker()
{
nFileType = AVS_OFFICESTUDIO_FILE_UNKNOWN;
}
COfficeFileFormatChecker(std::wstring sFileName)
{
nFileType = AVS_OFFICESTUDIO_FILE_UNKNOWN;
isOfficeFile(sFileName);
}
bool isOfficeFile(const std::wstring & fileName);
std::wstring GetFormatExtension(const std::wstring & fileName);
std::wstring GetExtensionByType(int type);
private:
bool isOOXFormatFile (const std::wstring & fileName);
bool isOpenOfficeFormatFile (const std::wstring & fileName);
bool isOnlyOfficeFormatFile (const std::wstring & fileName);
bool isDocFormatFile (POLE::Storage *storage);
bool isXlsFormatFile (POLE::Storage *storage);
bool isPptFormatFile (POLE::Storage *storage);
bool isRtfFormatFile (unsigned char* pBuffer,int dwBytes);
bool isHtmlFormatFile (unsigned char* pBuffer,int dwBytes);
bool isPdfFormatFile (unsigned char* pBuffer,int dwBytes);
bool isBinaryDoctFormatFile (unsigned char* pBuffer,int dwBytes);
bool isBinaryXlstFormatFile (unsigned char* pBuffer,int dwBytes);
bool isBinaryPpttFormatFile (unsigned char* pBuffer,int dwBytes);
};
...@@ -70,3 +70,4 @@ ...@@ -70,3 +70,4 @@
#define AVS_OFFICESTUDIO_FILE_CANVAS_WORD AVS_OFFICESTUDIO_FILE_CANVAS + 0x0001 #define AVS_OFFICESTUDIO_FILE_CANVAS_WORD AVS_OFFICESTUDIO_FILE_CANVAS + 0x0001
#define AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET AVS_OFFICESTUDIO_FILE_CANVAS + 0x0002 #define AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET AVS_OFFICESTUDIO_FILE_CANVAS + 0x0002
#define AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION AVS_OFFICESTUDIO_FILE_CANVAS + 0x0003 #define AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION AVS_OFFICESTUDIO_FILE_CANVAS + 0x0003
#define AVS_OFFICESTUDIO_FILE_CANVAS_PDF AVS_OFFICESTUDIO_FILE_CANVAS + 0x0004
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