mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-17 17:54:35 +08:00
DocFormatReader - add word doc without compound storage(earlier 1995)
This commit is contained in:
@ -145,19 +145,23 @@ bool COfficeFileFormatChecker::isDocFormatFile (POLE::Storage * storage)
|
||||
POLE::Stream stream(storage, L"WordDocument");
|
||||
|
||||
unsigned char buffer[10];
|
||||
if (stream.read(buffer,10) > 0)
|
||||
if (stream.read(buffer, 10) > 0)
|
||||
{
|
||||
//ms office 2007 encrypted contains stream WordDocument !!
|
||||
std::list<std::wstring> entries = storage->entries(L"DataSpaces");
|
||||
if (entries.size() > 0)
|
||||
return false;
|
||||
|
||||
if ((buffer[0] == 0xEC && buffer[1] == 0xA5) || // word 1997-2003
|
||||
(buffer[0] == 0xDC && buffer[1] == 0xA5)) // word 1995
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC;
|
||||
}
|
||||
|
||||
#if defined FILE_FORMAT_CHECKER_WITH_MACRO
|
||||
if (storage->isDirectory(L"Macros"))
|
||||
{
|
||||
bMacroEnabled = true;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -193,14 +197,23 @@ bool COfficeFileFormatChecker::isXlsFormatFile (POLE::Storage * storage)
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined FILE_FORMAT_CHECKER_WITH_MACRO
|
||||
if (storage->isDirectory(L"_VBA_PROJECT_CUR"))
|
||||
{
|
||||
bMacroEnabled = true;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
bool COfficeFileFormatChecker::isDocFlatFormatFile (unsigned char* pBuffer, int dwBytes)
|
||||
{
|
||||
if (pBuffer == NULL) return false;
|
||||
|
||||
if ((pBuffer[0] == 0xEC && pBuffer[1] == 0xA5) ||
|
||||
(pBuffer[0] == 0xDC && pBuffer[1] == 0xA5) ||
|
||||
(pBuffer[0] == 0xDB && pBuffer[1] == 0xA5))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool COfficeFileFormatChecker::isPptFormatFile (POLE::Storage * storage)
|
||||
{
|
||||
@ -236,8 +249,8 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & fileName)
|
||||
{
|
||||
if ( isDocFormatFile(&storage) )
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC;
|
||||
return true;
|
||||
//nFileType внутри
|
||||
return true;
|
||||
}
|
||||
else if ( isXlsFormatFile(&storage) )
|
||||
{
|
||||
@ -335,6 +348,11 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & fileName)
|
||||
{
|
||||
//nFileType
|
||||
}
|
||||
else if (isDocFlatFormatFile(buffer,sizeRead) )
|
||||
{
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC_FLAT; // without compaund container
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
file.CloseFile();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user