mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-11 03:42:47 +08:00
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@65406 954022d7-b5bf-4e40-9824-e11837661b57
74 lines
1.1 KiB
C++
74 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#if defined(_WIN32) || defined (_WIN64)
|
|
#include <atlwin.h>
|
|
#include <atltypes.h>
|
|
#include <atlcoll.h>
|
|
#endif
|
|
|
|
#include "../../Common/DocxFormat/Source/SystemUtility/File.h"
|
|
|
|
#include <algorithm>
|
|
|
|
namespace NSWMFToImageConverter
|
|
{
|
|
class CImageExt
|
|
{
|
|
public:
|
|
LONG GetImageType(CString strFile)
|
|
{
|
|
CFile oFile;
|
|
if (S_OK != oFile.OpenFile(strFile))
|
|
{
|
|
oFile.CloseFile();
|
|
return 0;
|
|
}
|
|
|
|
DWORD dwSize = (DWORD)oFile.GetFileSize();
|
|
|
|
if (44 > dwSize)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
DWORD dwKey = 0;
|
|
oFile.ReadFile((BYTE*)(&dwKey), 4);
|
|
|
|
if (0x9AC6CDD7 == dwKey)
|
|
{
|
|
// placeable meta
|
|
oFile.CloseFile();
|
|
return 1;
|
|
}
|
|
|
|
if (0x00000001 == dwKey)
|
|
{
|
|
oFile.SetPosition(40);
|
|
oFile.ReadFile((BYTE*)(&dwKey), 4);
|
|
oFile.CloseFile();
|
|
|
|
if (0x464D4520 == dwKey)
|
|
{
|
|
// EMF/EMF+
|
|
return 2;
|
|
}
|
|
else
|
|
{
|
|
//
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
oFile.CloseFile();
|
|
|
|
if (0x00090001 == dwKey)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
};
|
|
}
|
|
|