This commit is contained in:
Elena.Subbotina
2023-03-20 10:59:25 +03:00
parent 9ffb756c4f
commit fdd3685df3
7 changed files with 62 additions and 0 deletions

View File

@ -33,6 +33,7 @@
#include "../DesktopEditor/common/Directory.h"
#include "../OfficeUtils/src/OfficeUtils.h"
#include "../DesktopEditor/xml/include/xmlutils.h"
//#if defined FILE_FORMAT_CHECKER_WITH_MACRO
// #include "../MsBinaryFile/PptFile/Main/PPTFormatLib.h"
@ -68,6 +69,18 @@ bool COfficeFileFormatChecker::isMultiPartsHtmlFormatFile(unsigned char* pBuffer
}
return false;
}
bool COfficeFileFormatChecker::iXmlFile(const std::wstring & fileName)
{
XmlUtils::CXmlLiteReader oReader;
if (!oReader.FromFile(fileName))
return false;
if (!oReader.ReadNextNode())
return false;
return true;
}
bool COfficeFileFormatChecker::isHtmlFormatFile(unsigned char* pBuffer, int dwBytes, bool testCloseTag)
{
if (pBuffer == NULL || dwBytes < 4) return false;
@ -585,6 +598,11 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
}
if (nFileType != AVS_OFFICESTUDIO_FILE_UNKNOWN) return true;
//------------------------------------------------------------------------------------------------
if (iXmlFile(fileName))
{
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_XML;
return true;
}
//// by Extension
std::wstring::size_type nExtPos = fileName.rfind(L'.');