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

включение "новой" конвертилки Wmf/Emf в HtmlRenderer

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62146 954022d7-b5bf-4e40-9824-e11837661b57
parent 3fb9cc75
...@@ -415,64 +415,116 @@ ...@@ -415,64 +415,116 @@
</File> </File>
</Filter> </Filter>
<Filter <Filter
Name="WMF" Name="MetaFile"
> >
<File <File
RelativePath="..\ASCImageStudio3\ASCGraphics\Objects\Image\Wmf\RendererOutput.h" RelativePath="..\DesktopEditor\raster\Metafile\Common.cpp"
> >
</File> </File>
<File <File
RelativePath="..\ASCImageStudio3\ASCGraphics\Objects\Image\Wmf\WmfCharsets.h" RelativePath="..\DesktopEditor\raster\Metafile\Common.h"
> >
</File> </File>
<File <File
RelativePath="..\ASCImageStudio3\ASCGraphics\Objects\Image\Wmf\WmfCodePage1361.h" RelativePath="..\DesktopEditor\raster\Metafile\MetaFile.cpp"
> >
</File> </File>
<File <File
RelativePath="..\ASCImageStudio3\ASCGraphics\Objects\Image\Wmf\WmfCodePage932.h" RelativePath="..\DesktopEditor\raster\Metafile\MetaFile.h"
> >
</File> </File>
<File <Filter
RelativePath="..\ASCImageStudio3\ASCGraphics\Objects\Image\Wmf\WmfCodePage936.h" Name="Wmf"
>
</File>
<File
RelativePath="..\ASCImageStudio3\ASCGraphics\Objects\Image\Wmf\WmfCodePage949.h"
>
</File>
<File
RelativePath="..\ASCImageStudio3\ASCGraphics\Objects\Image\Wmf\WmfCodePage950.h"
>
</File>
<File
RelativePath="..\ASCImageStudio3\ASCGraphics\Objects\Image\Wmf\WmfColor.h"
>
</File>
<File
RelativePath="..\ASCImageStudio3\ASCGraphics\Objects\Image\Wmf\WmfFile.h"
>
</File>
<File
RelativePath="..\ASCImageStudio3\ASCGraphics\Objects\Image\Wmf\WmfMemory.h"
>
</File>
<File
RelativePath="..\ASCImageStudio3\ASCGraphics\Objects\Image\Wmf\WmfOutputDevice.h"
>
</File>
<File
RelativePath="..\ASCImageStudio3\ASCGraphics\Objects\Image\Wmf\WmfRegion.h"
> >
</File> <File
<File RelativePath="..\DesktopEditor\raster\Metafile\Wmf\RendererOutput.h"
RelativePath="..\ASCImageStudio3\ASCGraphics\Objects\Image\Wmf\WmfTypes.h" >
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Wmf\WmfCharsets.h"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Wmf\WmfCodePage1361.h"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Wmf\WmfCodePage932.h"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Wmf\WmfCodePage936.h"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Wmf\WmfCodePage949.h"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Wmf\WmfCodePage950.h"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Wmf\WmfColor.h"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Wmf\WmfFile.h"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Wmf\WmfMemory.h"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Wmf\WmfOutputDevice.h"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Wmf\WmfRegion.h"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Wmf\WmfTypes.h"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Wmf\WmfUtils.h"
>
</File>
</Filter>
<Filter
Name="Emf"
> >
</File> <File
<File RelativePath="..\DesktopEditor\raster\Metafile\Emf\EmfFile.h"
RelativePath="..\ASCImageStudio3\ASCGraphics\Objects\Image\Wmf\WmfUtils.h" >
> </File>
</File> <File
RelativePath="..\DesktopEditor\raster\Metafile\Emf\EmfObjects.h"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Emf\EmfOutputDevice.h"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Emf\EmfPlayer.cpp"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Emf\EmfPlayer.h"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Emf\EmfTypes.h"
>
</File>
<File
RelativePath="..\DesktopEditor\raster\Metafile\Emf\RendererOutput.h"
>
</File>
</Filter>
</Filter> </Filter>
</Files> </Files>
<Globals> <Globals>
......
This diff is collapsed.
...@@ -22,9 +22,13 @@ const long c_lMetaSVG = 0x04; ...@@ -22,9 +22,13 @@ const long c_lMetaSVG = 0x04;
const long c_ag_ImageTypeBitmap = 0; const long c_ag_ImageTypeBitmap = 0;
const long c_ag_ImageTypeMetafile = 1; const long c_ag_ImageTypeMetafile = 1;
namespace MetaFile
{
class CMetaFile;
};
class CFontManager; class CFontManager;
class CWmfFile;
struct TWmfRectF;
namespace Aggplus namespace Aggplus
{ {
class CImage; class CImage;
...@@ -60,9 +64,7 @@ namespace NSHtmlRenderer ...@@ -60,9 +64,7 @@ namespace NSHtmlRenderer
{ {
private: private:
CWmfFile* m_pWmfFile; MetaFile::CMetaFile* m_pMetafile;
TWmfRectF* m_pRect;
CString m_wsTempFilePath; CString m_wsTempFilePath;
......
#include "Common.h" #include "Common.h"
#include "../../../raster/ImageFileFormatChecker.h" #include "../../raster/ImageFileFormatChecker.h"
#include "../../../raster/BgraFrame.h" #include "../../raster/BgraFrame.h"
namespace Metafile namespace MetaFile
{ {
bool ReadImageCoreHeader(BYTE* pHeaderBuffer, unsigned long ulHeaderBufferLen, BYTE* pImageBuffer, unsigned long ulImageBufferLen, BYTE** ppDstBuffer, unsigned long* pulWidth, unsigned long* pulHeight) bool ReadImageCoreHeader(BYTE* pHeaderBuffer, unsigned long ulHeaderBufferLen, BYTE* pImageBuffer, unsigned long ulImageBufferLen, BYTE** ppDstBuffer, unsigned long* pulWidth, unsigned long* pulHeight)
{ {
......
...@@ -16,7 +16,7 @@ typedef unsigned char BYTE; ...@@ -16,7 +16,7 @@ typedef unsigned char BYTE;
#include "Wmf/WmfUtils.h" #include "Wmf/WmfUtils.h"
#include "Emf/EmfObjects.h" #include "Emf/EmfObjects.h"
namespace Metafile namespace MetaFile
{ {
#define METAFILE_RGBA(r, g, b) ((DWORD)( ( (BYTE)(r) )| ( ( (BYTE)(g) ) << 8 ) | ( ( (BYTE)(b) ) << 16 ) | ( (BYTE)(0) << 24 ) ) ) #define METAFILE_RGBA(r, g, b) ((DWORD)( ( (BYTE)(r) )| ( ( (BYTE)(g) ) << 8 ) | ( ( (BYTE)(b) ) << 16 ) | ( (BYTE)(0) << 24 ) ) )
......
...@@ -15,7 +15,11 @@ ...@@ -15,7 +15,11 @@
#include "../../../fontengine/FontManager.h" #include "../../../fontengine/FontManager.h"
#include <iostream> #include <iostream>
namespace Metafile #if !defined(ETO_PDY)
# define ETO_PDY 0x2000
#endif
namespace MetaFile
{ {
class CEmfFile class CEmfFile
{ {
...@@ -556,6 +560,7 @@ namespace Metafile ...@@ -556,6 +560,7 @@ namespace Metafile
m_pDC->SetTextColor(oColor); m_pDC->SetTextColor(oColor);
} }
void Read_EMR_EXTTEXTOUTW() void Read_EMR_EXTTEXTOUTW()
{ {
TEmfExtTextoutW oText; TEmfExtTextoutW oText;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "EmfTypes.h" #include "EmfTypes.h"
#include "../Wmf/WmfTypes.h" #include "../Wmf/WmfTypes.h"
namespace Metafile namespace MetaFile
{ {
typedef enum typedef enum
{ {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "../Wmf/WmfTypes.h" #include "../Wmf/WmfTypes.h"
namespace Metafile namespace MetaFile
{ {
class CEmfOutputDevice class CEmfOutputDevice
......
#include "EmfPlayer.h" #include "EmfPlayer.h"
#include "EmfFile.h" #include "EmfFile.h"
namespace Metafile namespace MetaFile
{ {
CEmfPlayer::CEmfPlayer(CEmfFile* pFile) CEmfPlayer::CEmfPlayer(CEmfFile* pFile)
{ {
...@@ -127,6 +127,8 @@ namespace Metafile ...@@ -127,6 +127,8 @@ namespace Metafile
m_oTransform.Init(); m_oTransform.Init();
m_oTextColor.Init(); m_oTextColor.Init();
m_pBrush = NULL; m_pBrush = NULL;
m_pPen = NULL;
m_pFont = NULL;
} }
CEmfDC::~CEmfDC() CEmfDC::~CEmfDC()
{ {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "EmfTypes.h" #include "EmfTypes.h"
#include "EmfObjects.h" #include "EmfObjects.h"
namespace Metafile namespace MetaFile
{ {
class CEmfFile; class CEmfFile;
class CEmfDC; class CEmfDC;
......
#ifndef _EMF_TYPES_H #ifndef _EMF_TYPES_H
#define _EMF_TYPES_H #define _EMF_TYPES_H
namespace Metafile namespace MetaFile
{ {
struct TEmfColor struct TEmfColor
{ {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "EmfOutputDevice.h" #include "EmfOutputDevice.h"
#include "EmfFile.h" #include "EmfFile.h"
namespace Metafile namespace MetaFile
{ {
class CEmfRendererOutput : public CEmfOutputDevice class CEmfRendererOutput : public CEmfOutputDevice
{ {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "Emf/RendererOutput.h" #include "Emf/RendererOutput.h"
namespace Metafile namespace MetaFile
{ {
CMetaFile::CMetaFile(CApplicationFonts *pAppFonts) CMetaFile::CMetaFile(CApplicationFonts *pAppFonts)
{ {
...@@ -18,12 +18,18 @@ namespace Metafile ...@@ -18,12 +18,18 @@ namespace Metafile
m_pFontManager->SetOwnerCache(pMeasurerCache); m_pFontManager->SetOwnerCache(pMeasurerCache);
m_oWmfFile.SetFontManager(m_pFontManager); m_oWmfFile.SetFontManager(m_pFontManager);
m_oEmfFile.SetFontManager(m_pFontManager); m_oEmfFile.SetFontManager(m_pFontManager);
m_lType = 0;
} }
CMetaFile::~CMetaFile() CMetaFile::~CMetaFile()
{ {
Close(); Close();
RELEASEINTERFACE(m_pFontManager); RELEASEINTERFACE(m_pFontManager);
} }
CFontManager* CMetaFile::get_FontManager()
{
return m_pFontManager;
}
bool CMetaFile::LoadFromFile(const wchar_t *wsFilePath) bool CMetaFile::LoadFromFile(const wchar_t *wsFilePath)
{ {
// Wmf // Wmf
...@@ -116,7 +122,14 @@ namespace Metafile ...@@ -116,7 +122,14 @@ namespace Metafile
void CMetaFile::Close() void CMetaFile::Close()
{ {
m_oWmfFile.Close(); m_oWmfFile.Close();
//m_oEmfFile.Close();
m_lType = 0;
}; };
long CMetaFile::GetType()
{
return m_lType;
}
void CMetaFile::GetBounds(double* pdX, double* pdY, double* pdW, double* pdH) void CMetaFile::GetBounds(double* pdX, double* pdY, double* pdW, double* pdH)
{ {
if (c_lMetaWmf == m_lType) if (c_lMetaWmf == m_lType)
......
...@@ -7,11 +7,12 @@ ...@@ -7,11 +7,12 @@
#include "Wmf/RendererOutput.h" #include "Wmf/RendererOutput.h"
#include "Emf/EmfFile.h" #include "Emf/EmfFile.h"
namespace Metafile namespace MetaFile
{ {
const long c_lMetaWmf = 0x01; const long c_lMetaWmf = 0x01;
const long c_lMetaEmf = 0x02; const long c_lMetaEmf = 0x02;
const long c_lMetaSvg = 0x04; const long c_lMetaSvg = 0x04;
// )
class CMetaFile class CMetaFile
{ {
...@@ -23,7 +24,9 @@ namespace Metafile ...@@ -23,7 +24,9 @@ namespace Metafile
bool DrawOnRenderer(IRenderer* pRenderer, double dX, double dY, double dWidth, double dHeight); bool DrawOnRenderer(IRenderer* pRenderer, double dX, double dY, double dWidth, double dHeight);
void Close(); void Close();
void GetBounds(double* pdX, double* pdY, double* pdW, double* pdH); void GetBounds(double* pdX, double* pdY, double* pdW, double* pdH);
long GetType();
void ConvertToRaster(const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight = -1); void ConvertToRaster(const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight = -1);
CFontManager* get_FontManager();
private: private:
......
...@@ -1292,7 +1292,7 @@ private: ...@@ -1292,7 +1292,7 @@ private:
return L""; return L"";
wsText[nLen] = '\0'; wsText[nLen] = '\0';
#ifdef _WIN32 #if defined(_WIN32) || defined (_WIN64)
// Пытаемся воспользоваться системной функцией // Пытаемся воспользоваться системной функцией
if ( !OemToCharBuffW( sText, wsText, nLen ) ) if ( !OemToCharBuffW( sText, wsText, nLen ) )
{ {
......
...@@ -12,8 +12,10 @@ ...@@ -12,8 +12,10 @@
#include <math.h> #include <math.h>
#include "../../../common/File.h" #include "../../../common/File.h"
#define UTF8_TO_U(val) NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)val, strlen(val)) #define UTF8_TO_U(val) NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)val, strlen(val))
#define U_TO_UTF8(val) NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(val, wcslen(val)) #define U_TO_UTF8(val) NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(val, wcslen(val))
static std::wstring ascii_to_unicode(const char *src) static std::wstring ascii_to_unicode(const char *src)
{ {
size_t nSize = mbstowcs(0, src, 0); size_t nSize = mbstowcs(0, src, 0);
...@@ -153,8 +155,8 @@ static void PolyPoly_To_PolyLine(TWmfPolyPoly *pPolyPoly, TWmfPolyLine *pPolyLin ...@@ -153,8 +155,8 @@ static void PolyPoly_To_PolyLine(TWmfPolyPoly *pPolyPoly, TWmfPolyLine *pPolyLin
static BOOL WmfOpenTempFile(std::wstring *pwsName, FILE **ppFile, wchar_t *wsMode, wchar_t *wsExt, wchar_t *wsFolder) static BOOL WmfOpenTempFile(std::wstring *pwsName, FILE **ppFile, wchar_t *wsMode, wchar_t *wsExt, wchar_t *wsFolder)
{ {
std::wstring wsTemp, wsFileName; std::wstring wsTemp, wsFileName;
FILE *pTempFile; FILE *pTempFile = NULL;
#ifdef _WIN32 #if defined(_WIN32) || defined (_WIN64)
wchar_t *wsTempDir; wchar_t *wsTempDir;
if ((wsTempDir = _wgetenv(L"TEMP")) && (wsFolder == NULL)) if ((wsTempDir = _wgetenv(L"TEMP")) && (wsFolder == NULL))
{ {
...@@ -182,13 +184,15 @@ static BOOL WmfOpenTempFile(std::wstring *pwsName, FILE **ppFile, wchar_t *wsMod ...@@ -182,13 +184,15 @@ static BOOL WmfOpenTempFile(std::wstring *pwsName, FILE **ppFile, wchar_t *wsMod
for (int nIndex = 0; nIndex < 1000; ++nIndex) for (int nIndex = 0; nIndex < 1000; ++nIndex)
{ {
wsFileName = wsTemp; wsFileName = wsTemp;
wsFileName.append(std::to_wstring(nTime + nIndex)); wchar_t buffer[24];
_itow(nTime + nIndex,buffer,10);
wsFileName.append(buffer);
if (wsExt) if (wsExt)
{ {
wsFileName.append(wsExt); wsFileName.append(wsExt);
} }
#ifdef _WIN32 #if defined (_WIN32) || defined (_WIN64)
if (!(pTempFile = _wfopen(wsFileName.c_str(), L"r"))) if (!(pTempFile = _wfopen(wsFileName.c_str(), L"r")))
{ {
if (!(pTempFile = _wfopen(wsFileName.c_str(), wsMode))) if (!(pTempFile = _wfopen(wsFileName.c_str(), wsMode)))
......
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