DocFormatReader - add word doc without compound storage(earlier 1995)

This commit is contained in:
ElenaSubbotina
2018-03-27 16:43:48 +03:00
parent 7ea2b40585
commit 7df5ff1aeb
72 changed files with 2040 additions and 1336 deletions

View File

@ -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();