Commit e281ec8d authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

ASCSVGWriter

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@64124 954022d7-b5bf-4e40-9824-e11837661b57
parent d6793659
......@@ -119,7 +119,8 @@ HEADERS += \
src/VectorGraphicsWriter2.h \
src/VMLWriter.h \
src/Writer.h \
include/HTMLRenderer3.h
include/HTMLRenderer3.h \
src/Common2.h
unix {
target.path = /usr/lib
......
#ifndef _ASC_HTMLRENDERER_SVG_WRITER_H_
#define _ASC_HTMLRENDERER_SVG_WRITER_H_
#include "../../DesktopEditor/graphics/IRenderer.h"
namespace Aggplus
{
class CMatrix;
class CGraphicsPathSimpleConverter;
}
class CFontManager;
namespace NSHtmlRenderer
{
class CSVGGraphicsWriter;
}
namespace NSStructures
{
class CPen;
class CBrush;
class CFont;
}
namespace NSHtmlRenderer
{
class CASCSVGWriter : public IRenderer
{
public:
CASCSVGWriter();
~CASCSVGWriter();
public:
// тип рендерера-----------------------------------------------------------------------------
HRESULT get_Type(LONG* lType);
//-------- Функции для работы со страницей --------------------------------------------------
HRESULT NewPage();
HRESULT get_Height(double* dHeight);
HRESULT put_Height(const double& dHeight);
HRESULT get_Width(double* dWidth);
HRESULT put_Width(const double& dWidth);
HRESULT get_DpiX(double* dDpiX);
HRESULT get_DpiY(double* dDpiY);
// pen --------------------------------------------------------------------------------------
HRESULT get_PenColor(LONG* lColor);
HRESULT put_PenColor(const LONG& lColor);
HRESULT get_PenAlpha(LONG* lAlpha);
HRESULT put_PenAlpha(const LONG& lAlpha);
HRESULT get_PenSize(double* dSize);
HRESULT put_PenSize(const double& dSize);
HRESULT get_PenDashStyle(BYTE* val);
HRESULT put_PenDashStyle(const BYTE& val);
HRESULT get_PenLineStartCap(BYTE* val);
HRESULT put_PenLineStartCap(const BYTE& val);
HRESULT get_PenLineEndCap(BYTE* val);
HRESULT put_PenLineEndCap(const BYTE& val);
HRESULT get_PenLineJoin(BYTE* val);
HRESULT put_PenLineJoin(const BYTE& val);
HRESULT get_PenDashOffset(double* dOffset);
HRESULT put_PenDashOffset(const double& dOffset);
HRESULT get_PenAlign(LONG* lAlign);
HRESULT put_PenAlign(const LONG& lAlign);
HRESULT get_PenMiterLimit(double* dOffset);
HRESULT put_PenMiterLimit(const double& dOffset);
HRESULT PenDashPattern(double* pPattern, LONG lCount);
// brush ------------------------------------------------------------------------------------
HRESULT get_BrushType(LONG* lType);
HRESULT put_BrushType(const LONG& lType);
HRESULT get_BrushColor1(LONG* lColor);
HRESULT put_BrushColor1(const LONG& lColor);
HRESULT get_BrushAlpha1(LONG* lAlpha);
HRESULT put_BrushAlpha1(const LONG& lAlpha);
HRESULT get_BrushColor2(LONG* lColor);
HRESULT put_BrushColor2(const LONG& lColor);
HRESULT get_BrushAlpha2(LONG* lAlpha);
HRESULT put_BrushAlpha2(const LONG& lAlpha);
HRESULT get_BrushTexturePath(std::wstring* bsPath);
HRESULT put_BrushTexturePath(const std::wstring& bsPath);
HRESULT get_BrushTextureMode(LONG* lMode);
HRESULT put_BrushTextureMode(const LONG& lMode);
HRESULT get_BrushTextureAlpha(LONG* lTxAlpha);
HRESULT put_BrushTextureAlpha(const LONG& lTxAlpha);
HRESULT get_BrushLinearAngle(double* dAngle);
HRESULT put_BrushLinearAngle(const double& dAngle);
HRESULT BrushRect(const INT& val, const double& left, const double& top, const double& width, const double& height);
HRESULT BrushBounds(const double& left, const double& top, const double& width, const double& height);
HRESULT put_BrushGradientColors(LONG* lColors, double* pPositions, LONG nCount);
// font -------------------------------------------------------------------------------------
HRESULT get_FontName(std::wstring* bsName);
HRESULT put_FontName(const std::wstring& bsName);
HRESULT get_FontPath(std::wstring* bsName);
HRESULT put_FontPath(const std::wstring& bsName);
HRESULT get_FontSize(double* dSize);
HRESULT put_FontSize(const double& dSize);
HRESULT get_FontStyle(LONG* lStyle) ;
HRESULT put_FontStyle(const LONG& lStyle);
HRESULT get_FontStringGID(INT* bGID);
HRESULT put_FontStringGID(const INT& bGID);
HRESULT get_FontCharSpace(double* dSpace);
HRESULT put_FontCharSpace(const double& dSpace);
HRESULT get_FontFaceIndex(int* lFaceIndex);
HRESULT put_FontFaceIndex(const int& lFaceIndex);
//-------- Функции для вывода текста --------------------------------------------------------
HRESULT CommandDrawTextCHAR(const LONG& c, const double& x, const double& y, const double& w, const double& h);
HRESULT CommandDrawText(const std::wstring& bsText, const double& x, const double& y, const double& w, const double& h);
HRESULT CommandDrawTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h);
HRESULT CommandDrawTextEx(const std::wstring& bsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h);
//-------- Маркеры для команд ---------------------------------------------------------------
HRESULT BeginCommand(const DWORD& lType);
HRESULT EndCommand(const DWORD& lType);
//-------- Функции для работы с Graphics Path -----------------------------------------------
HRESULT PathCommandMoveTo(const double& x, const double& y);
HRESULT PathCommandLineTo(const double& x, const double& y);
HRESULT PathCommandLinesTo(double* points, const int& count);
HRESULT PathCommandCurveTo(const double& x1, const double& y1, const double& x2, const double& y2, const double& x3, const double& y3);
HRESULT PathCommandCurvesTo(double* points, const int& count);
HRESULT PathCommandArcTo(const double& x, const double& y, const double& w, const double& h, const double& startAngle, const double& sweepAngle);
HRESULT PathCommandClose();
HRESULT PathCommandEnd();
HRESULT DrawPath(const LONG& nType);
HRESULT PathCommandStart();
HRESULT PathCommandGetCurrentPoint(double* x, double* y);
HRESULT PathCommandTextCHAR(const LONG& c, const double& x, const double& y, const double& w, const double& h);
HRESULT PathCommandText(const std::wstring& bsText, const double& x, const double& y, const double& w, const double& h);
HRESULT PathCommandTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h);
HRESULT PathCommandTextEx(const std::wstring& sText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h);
//-------- Функции для вывода изображений ---------------------------------------------------
HRESULT DrawImage(IGrObject* pImage, const double& x, const double& y, const double& w, const double& h);
HRESULT DrawImageFromFile(const std::wstring&, const double& x, const double& y, const double& w, const double& h, const BYTE& lAlpha);
// transform --------------------------------------------------------------------------------
HRESULT SetTransform(const double& m1, const double& m2, const double& m3, const double& m4, const double& m5, const double& m6);
HRESULT GetTransform(double *pdA, double *pdB, double *pdC, double *pdD, double *pdE, double *pdF);
HRESULT ResetTransform();
// -----------------------------------------------------------------------------------------
HRESULT get_ClipMode(LONG* plMode);
HRESULT put_ClipMode(const LONG& lMode);
// additiaonal params ----------------------------------------------------------------------
HRESULT SaveFile(const std::wstring& strFileSave);
HRESULT ReInit();
HRESULT IsRaster(bool* bVal);
// additiaonal params ----------------------------------------------------------------------
HRESULT CommandLong(const LONG& lType, const LONG& lCommand);
HRESULT CommandDouble(const LONG& lType, const double& dCommand);
HRESULT CommandString(const LONG& lType, const std::wstring& sCommand);
public:
void OnBaseMatrixUpdate(const double& dWidth, const double& dHeight);
void SetFontManager(CFontManager* pFontManager);
private:
NSHtmlRenderer::CSVGGraphicsWriter* m_pVectorWriter;
Aggplus::CGraphicsPathSimpleConverter* m_pSimpleGraphicsConverter; // конвертер сложных гафических путей в простые
CFontManager* m_pFontManager; // менеджер шрифтов
bool m_bDeleteFontManager;
Aggplus::CMatrix* m_pBaseTransform; // матрица перерасчета координатных осей (здесь: миллиметры -> пикселы)
Aggplus::CMatrix* m_pTransform; // текущая матрица преобразований рендерера
Aggplus::CMatrix* m_pFullTransform; // полная матрица преобразований (m_oBaseTransform * m_oTransform)
double m_dTransformAngle;
LONG m_lCurrentCommandType; // текущая команда
double m_dDpiX;
double m_dDpiY;
double m_dWidth;
double m_dHeight;
LONG m_lClipMode;
NSStructures::CPen* m_pPen; // настройки всей графики (скопирован ашник из AVSGraphics)
NSStructures::CBrush* m_pBrush;
NSStructures::CFont* m_pFont;
NSStructures::CFont* m_pInstalledFont;
bool m_bIsRaster;
//todo
//IASCWinFonts* m_pFonts;
protected:
void CalculateFullTransform();
inline void MoveTo(const double& dX, const double& dY);
inline void LineTo(const double& dX, const double& dY);
inline void CurveTo(const double& x1, const double& y1, const double& x2, const double& y2, const double& x3, const double& y3);
void Start();
void End();
void Close();
void _SetFont();
};
}
#endif // _ASC_HTMLRENDERER_SVG_WRITER_H_
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef _ASC_HTMLRENDERER_SVGWRITER2_H_
#define _ASC_HTMLRENDERER_SVGWRITER2_H_
#include "Common2.h"
#include "SVGWriter.h"
#include "../../DesktopEditor/graphics/GraphicsRenderer.h"
......
......@@ -8,45 +8,70 @@
#include "../../PdfWriter/PdfRenderer.h"
#include "../include/HTMLRenderer3.h"
#include "../include/ASCSVGWriter.h"
#include "../../DesktopEditor/raster/Metafile/MetaFile.h"
int main(int argc, char *argv[])
{
//QCoreApplication a(argc, argv);
CApplicationFonts oFonts;
oFonts.Initialize();
#if 0
NSHtmlRenderer::CASCSVGWriter oWriterSVG;
oWriterSVG.SetFontManager(oFonts.GenerateFontManager());
MetaFile::CMetaFile oMetafile(&oFonts);
oMetafile.LoadFromFile(L"D:\\2\\ppt\\media\\image4.wmf");
double x = 0, y = 0, w = 0, h = 0;
oMetafile.GetBounds(&x, &y, &w, &h);
oWriterSVG.put_Width(100000);
oWriterSVG.put_Height(100000);
oMetafile.DrawOnRenderer(&oWriterSVG, 0, 0, 100000, 100000);
oWriterSVG.SaveFile(L"D:\\oleg.svg");
return 0;
#endif
//QCoreApplication a(argc, argv);
#ifdef WIN32
//std::wstring sFile = L"\\\\KIRILLOV8\\_Office\\PDF\\Android intro(2p).pdf";
std::wstring sFile = L"\\\\kirillov8\\_Office\\PDF\\Main Window(15p).pdf";
//std::wstring sFile = L"D:\\activex\\Pi(1p).pdf";
//std::wstring sFile = L"\\\\192.168.3.208\\allusers\\Files\\PDF\\AllPDF\\asia.pdf";
//std::wstring sFile = L"D:\\knut.djvu";
//std::wstring sFile = L"D:\\bankomats.xps";
std::wstring sFile = L"D:\\bankomats.xps";
std::wstring sDst = L"D:\\test\\Document";
#endif
#if 1
#else
//std::wstring sFile = L"/home/oleg/activex/Android intro(2p).pdf";
//std::wstring sFile = L"/home/oleg/activex/knut.djvu";
std::wstring sFile = L"/home/oleg/activex/bankomats.xps";
//std::wstring sFile = L"/home/oleg/activex/Pi(1p).pdf";
std::wstring sFile = L"/home/oleg/activex/knut.djvu";
//std::wstring sFile = L"/home/oleg/activex/bankomats.xps";
std::wstring sDst = L"/home/oleg/activex/1";
#endif
CApplicationFonts oFonts;
oFonts.Initialize();
#if 0
PdfReader::CPdfReader oReader(&oFonts);
oReader.SetTempFolder(sDst.c_str());
#endif
#if 0
#if 1
CDjVuFile oReader;
#endif
#if 1
#if 0
CXpsFile oReader(&oFonts);
oReader.SetTempFolder(sDst.c_str());
#endif
bool bResult = oReader.LoadFromFile(sFile.c_str());
#if 0
#if 1
NSHtmlRenderer::CASCHTMLRenderer3 oHtmlRenderer;
oHtmlRenderer.CreateOfficeFile(sDst);
#else
......@@ -75,7 +100,7 @@ int main(int argc, char *argv[])
oHtmlRenderer.EndCommand(c_nPageType);
}
#if 0
#if 1
oHtmlRenderer.CloseFile();
#else
oHtmlRenderer.SaveToFile(L"/home/oleg/activex/1/1.pdf");
......
......@@ -12,6 +12,8 @@ TARGET = test
CONFIG += console
CONFIG -= app_bundle
CONFIG += c++11
DEFINES += PDFREADER_USE_DYNAMIC_LIBRARY
DEFINES += PDFWRITER_USE_DYNAMIC_LIBRARY
DEFINES += XPS_USE_DYNAMIC_LIBRARY
......@@ -50,6 +52,7 @@ linux-g++:!contains(QMAKE_HOST.arch, x86_64):{
}
LIBS += -L$$DESTINATION_SDK_PATH -lgraphics
LIBS += -L$$DESTINATION_SDK_PATH -lASCOfficeUtilsLib
LIBS += -L$$DESTINATION_SDK_PATH -lHtmlRenderer
LIBS += -L$$DESTINATION_SDK_PATH -lPdfReader
LIBS += -L$$DESTINATION_SDK_PATH -lDjVuFile
......@@ -63,4 +66,8 @@ LIBS += -lgdi32 \
-lshell32
}
SOURCES += main.cpp
SOURCES += main.cpp \
../src/ASCSVGWriter.cpp
HEADERS += \
../include/ASCSVGWriter.h
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