From 6d94535ff8abaedca74b6b1d56d1fc255239afab Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Tue, 18 Jan 2022 12:06:04 +0300 Subject: [PATCH] Add missed files --- HtmlRenderer/include/HTMLRendererText.h | 186 +++++++++ HtmlRenderer/src/HTMLRendererText.cpp | 529 ++++++++++++++++++++++++ 2 files changed, 715 insertions(+) create mode 100644 HtmlRenderer/include/HTMLRendererText.h create mode 100644 HtmlRenderer/src/HTMLRendererText.cpp diff --git a/HtmlRenderer/include/HTMLRendererText.h b/HtmlRenderer/include/HTMLRendererText.h new file mode 100644 index 0000000000..e9c62a5d4a --- /dev/null +++ b/HtmlRenderer/include/HTMLRendererText.h @@ -0,0 +1,186 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2019 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +#ifndef _ASC_HTMLRENDERER3_H_ +#define _ASC_HTMLRENDERER3_H_ + +#include "../../DesktopEditor/graphics/IRenderer.h" +#include "../../DesktopEditor/graphics/pro/officedrawingfile.h" + +#ifndef HTMLRENDERER_USE_DYNAMIC_LIBRARY +#define HTMLRENDERER_DECL_EXPORT +#else +#include "../../DesktopEditor/common/base_export.h" +#define HTMLRENDERER_DECL_EXPORT Q_DECL_EXPORT +#endif + +namespace NSHtmlRenderer +{ + class CHTMLRendererText_Private; + class HTMLRENDERER_DECL_EXPORT CHTMLRendererText : public IRenderer + { + public: + CHTMLRendererText(); + virtual ~CHTMLRendererText(); + + public: + void Init(IOfficeDrawingFile* pFile); + BYTE* GetBuffer(); + + public: + // тип рендерера----------------------------------------------------------------------------- + virtual HRESULT get_Type(LONG* lType); + //-------- Функции для работы со страницей -------------------------------------------------- + virtual HRESULT NewPage(); + virtual HRESULT get_Height(double* dHeight); + virtual HRESULT put_Height(const double& dHeight); + virtual HRESULT get_Width(double* dWidth); + virtual HRESULT put_Width(const double& dWidth); + virtual HRESULT get_DpiX(double* dDpiX); + virtual HRESULT get_DpiY(double* dDpiY); + + // pen -------------------------------------------------------------------------------------- + virtual HRESULT get_PenColor(LONG* lColor); + virtual HRESULT put_PenColor(const LONG& lColor); + virtual HRESULT get_PenAlpha(LONG* lAlpha); + virtual HRESULT put_PenAlpha(const LONG& lAlpha); + virtual HRESULT get_PenSize(double* dSize); + virtual HRESULT put_PenSize(const double& dSize); + virtual HRESULT get_PenDashStyle(BYTE* val); + virtual HRESULT put_PenDashStyle(const BYTE& val); + virtual HRESULT get_PenLineStartCap(BYTE* val); + virtual HRESULT put_PenLineStartCap(const BYTE& val); + virtual HRESULT get_PenLineEndCap(BYTE* val); + virtual HRESULT put_PenLineEndCap(const BYTE& val); + virtual HRESULT get_PenLineJoin(BYTE* val); + virtual HRESULT put_PenLineJoin(const BYTE& val); + virtual HRESULT get_PenDashOffset(double* dOffset); + virtual HRESULT put_PenDashOffset(const double& dOffset); + virtual HRESULT get_PenAlign(LONG* lAlign); + virtual HRESULT put_PenAlign(const LONG& lAlign); + virtual HRESULT get_PenMiterLimit(double* dOffset); + virtual HRESULT put_PenMiterLimit(const double& dOffset); + virtual HRESULT PenDashPattern(double* pPattern, LONG lCount); + + // brush ------------------------------------------------------------------------------------ + virtual HRESULT get_BrushType(LONG* lType); + virtual HRESULT put_BrushType(const LONG& lType); + virtual HRESULT get_BrushColor1(LONG* lColor); + virtual HRESULT put_BrushColor1(const LONG& lColor); + virtual HRESULT get_BrushAlpha1(LONG* lAlpha); + virtual HRESULT put_BrushAlpha1(const LONG& lAlpha); + virtual HRESULT get_BrushColor2(LONG* lColor); + virtual HRESULT put_BrushColor2(const LONG& lColor); + virtual HRESULT get_BrushAlpha2(LONG* lAlpha); + virtual HRESULT put_BrushAlpha2(const LONG& lAlpha); + virtual HRESULT get_BrushTexturePath(std::wstring* bsPath); + virtual HRESULT put_BrushTexturePath(const std::wstring& bsPath); + virtual HRESULT get_BrushTextureMode(LONG* lMode); + virtual HRESULT put_BrushTextureMode(const LONG& lMode); + virtual HRESULT get_BrushTextureAlpha(LONG* lTxAlpha); + virtual HRESULT put_BrushTextureAlpha(const LONG& lTxAlpha); + virtual HRESULT get_BrushLinearAngle(double* dAngle); + virtual HRESULT put_BrushLinearAngle(const double& dAngle); + virtual HRESULT BrushRect(const INT& val, const double& left, const double& top, const double& width, const double& height); + virtual HRESULT BrushBounds(const double& left, const double& top, const double& width, const double& height); + + virtual HRESULT put_BrushGradientColors(LONG* lColors, double* pPositions, LONG nCount); + + // font ------------------------------------------------------------------------------------- + virtual HRESULT get_FontName(std::wstring* bsName); + virtual HRESULT put_FontName(const std::wstring& bsName); + virtual HRESULT get_FontPath(std::wstring* bsName); + virtual HRESULT put_FontPath(const std::wstring& bsName); + virtual HRESULT get_FontSize(double* dSize); + virtual HRESULT put_FontSize(const double& dSize); + virtual HRESULT get_FontStyle(LONG* lStyle); + virtual HRESULT put_FontStyle(const LONG& lStyle); + virtual HRESULT get_FontStringGID(INT* bGID); + virtual HRESULT put_FontStringGID(const INT& bGID); + virtual HRESULT get_FontCharSpace(double* dSpace); + virtual HRESULT put_FontCharSpace(const double& dSpace); + virtual HRESULT get_FontFaceIndex(int* lFaceIndex); + virtual HRESULT put_FontFaceIndex(const int& lFaceIndex); + + //-------- Функции для вывода текста -------------------------------------------------------- + virtual HRESULT CommandDrawTextCHAR(const LONG& c, const double& x, const double& y, const double& w, const double& h); + virtual HRESULT CommandDrawText(const std::wstring& bsText, const double& x, const double& y, const double& w, const double& h); + + virtual HRESULT CommandDrawTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h); + virtual 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); + + //-------- Маркеры для команд --------------------------------------------------------------- + virtual HRESULT BeginCommand(const DWORD& lType); + virtual HRESULT EndCommand(const DWORD& lType); + + //-------- Функции для работы с Graphics Path ----------------------------------------------- + virtual HRESULT PathCommandMoveTo(const double& x, const double& y); + virtual HRESULT PathCommandLineTo(const double& x, const double& y); + virtual HRESULT PathCommandLinesTo(double* points, const int& count); + virtual HRESULT PathCommandCurveTo(const double& x1, const double& y1, const double& x2, const double& y2, const double& x3, const double& y3); + virtual HRESULT PathCommandCurvesTo(double* points, const int& count); + virtual HRESULT PathCommandArcTo(const double& x, const double& y, const double& w, const double& h, const double& startAngle, const double& sweepAngle); + virtual HRESULT PathCommandClose(); + virtual HRESULT PathCommandEnd(); + virtual HRESULT DrawPath(const LONG& nType); + virtual HRESULT PathCommandStart(); + virtual HRESULT PathCommandGetCurrentPoint(double* x, double* y); + + virtual HRESULT PathCommandTextCHAR(const LONG& c, const double& x, const double& y, const double& w, const double& h); + virtual HRESULT PathCommandText(const std::wstring& bsText, const double& x, const double& y, const double& w, const double& h); + + virtual HRESULT PathCommandTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h); + virtual HRESULT PathCommandTextEx(const std::wstring& bsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h); + + //-------- Функции для вывода изображений --------------------------------------------------- + virtual HRESULT DrawImage(IGrObject* pImage, const double& x, const double& y, const double& w, const double& h); + virtual HRESULT DrawImageFromFile(const std::wstring&, const double& x, const double& y, const double& w, const double& h, const BYTE& lAlpha = 255); + + // transform -------------------------------------------------------------------------------- + virtual HRESULT SetTransform(const double& m1, const double& m2, const double& m3, const double& m4, const double& m5, const double& m6); + virtual HRESULT GetTransform(double *pdA, double *pdB, double *pdC, double *pdD, double *pdE, double *pdF); + virtual HRESULT ResetTransform(); + + // ----------------------------------------------------------------------------------------- + virtual HRESULT get_ClipMode(LONG* plMode); + virtual HRESULT put_ClipMode(const LONG& lMode); + + // additiaonal params ---------------------------------------------------------------------- + virtual HRESULT CommandLong(const LONG& lType, const LONG& lCommand); + virtual HRESULT CommandDouble(const LONG& lType, const double& dCommand); + virtual HRESULT CommandString(const LONG& lType, const std::wstring& sCommand); + + protected: + CHTMLRendererText_Private* m_pInternal; + }; +} + +#endif // _ASC_HTMLRENDERER3_H_ diff --git a/HtmlRenderer/src/HTMLRendererText.cpp b/HtmlRenderer/src/HTMLRendererText.cpp new file mode 100644 index 0000000000..0e6038555c --- /dev/null +++ b/HtmlRenderer/src/HTMLRendererText.cpp @@ -0,0 +1,529 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2019 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +#include "../include/HTMLRendererText.h" +#include "./Text.h" + +namespace NSHtmlRenderer +{ + class CHTMLRendererText_Private + { + public: + double m_dWidth; + double m_dHeght; + + NSStructures::CBrush m_oBrush; + NSStructures::CBrush m_oLastBrush; + + NSStructures::CFont m_oFont; + NSStructures::CFont* m_pFont; + NSStructures::CFont m_oInstalledFont; + LONG m_lCurrentFont; + double m_dCurrentFontSize; + + Aggplus::CMatrix m_oTransform; + Aggplus::CMatrix m_oLastTransform; + + bool m_bIsChangedFontParamBetweenDrawText; + LONG m_lCurrentCommandType; + LONG m_lSrcFileType; + + CHText m_oSmartText; + CMetafile m_oPage; + + int* m_pTempUnicodes; + int m_nTempUnicodesAlloc; + int m_nTempUnicodesLen; + + bool m_bIsFontsInit; + + public: + CHTMLRendererText_Private() + { + m_bIsChangedFontParamBetweenDrawText = true; + m_lSrcFileType = 0; + m_pTempUnicodes = NULL; + m_nTempUnicodesLen = 0; + m_nTempUnicodesAlloc = 0; + + m_bIsFontsInit = false; + + m_lCurrentFont = 0; + m_dCurrentFontSize = 0; + m_pFont = &m_oFont; + } + ~CHTMLRendererText_Private() + { + RELEASEARRAYOBJECTS(m_pTempUnicodes); + } + + public: + void GetUnicodes(const std::wstring& sText) + { + int nLen = (int)sText.length(); + if (nLen > m_nTempUnicodesAlloc) + { + RELEASEARRAYOBJECTS(m_pTempUnicodes); + m_nTempUnicodesAlloc = nLen; + m_pTempUnicodes = new int[m_nTempUnicodesAlloc]; + } + + m_nTempUnicodesLen = 0; + const wchar_t* pWchars = sText.c_str(); + + if (sizeof(wchar_t) == 2) + { + for (int nIndex = 0, nGlyphIndex = 0; nIndex < nLen; ++nIndex, ++nGlyphIndex) + { + int code = (int)pWchars[nIndex]; + if (code >= 0xD800 && code <= 0xDFFF && (nIndex + 1) < nLen) + { + ++nIndex; + code = 0x10000 + (((code & 0x3FF) << 10) | (0x03FF & pWchars[nIndex])); + } + + m_pTempUnicodes[m_nTempUnicodesLen++] = code; + } + } + else + { + for ( int nIndex = 0; nIndex < nLen; ++nIndex ) + { + m_pTempUnicodes[m_nTempUnicodesLen++] = (int)pWchars[nIndex]; + } + } + } + + void WriteText(const int* pUnicodes, const int* pGids, const int& nCount, const double& x, const double& y, + const double& width, const double& height, const bool& bIsChangedFontParamBetweenDrawText) + { + bool bIsDumpFont = false; + if (!m_oInstalledFont.IsEqual(&m_oFont)) + { + m_oInstalledFont = m_oFont; + bIsDumpFont = true; + + m_dCurrentFontSize = m_oInstalledFont.Size; + } + + m_oSmartText.CommandText(pUnicodes, pGids, nCount, x, y, width, height, bIsDumpFont, this); + } + }; + + CHTMLRendererText::CHTMLRendererText() + { + m_pInternal = new CHTMLRendererText_Private(); + } + CHTMLRendererText::~CHTMLRendererText() + { + RELEASEOBJECT(m_pInternal); + } + + void CHTMLRendererText::Init(IOfficeDrawingFile* pFile) + { + m_pInternal->m_oBrush.SetDefaultParams(); + m_pInternal->m_oLastBrush.SetDefaultParams(); + + m_pInternal->m_oFont.SetDefaultParams(); + m_pInternal->m_oInstalledFont.SetDefaultParams(); + m_pInternal->m_oInstalledFont.Name = L""; + + m_pInternal->m_oTransform.Reset(); + m_pInternal->m_oLastTransform.Reset(); + + m_pInternal->m_oLastBrush.Color1 = -1; + m_pInternal->m_dCurrentFontSize = 0.0; + + m_pInternal->m_bIsChangedFontParamBetweenDrawText = false; + m_pInternal->m_lCurrentCommandType = -1; + + m_pInternal->m_oSmartText.NewPage(); + + if (!m_pInternal->m_bIsFontsInit) + { + m_pInternal->m_oSmartText.m_oFontManager.m_pFont = &m_pInternal->m_oFont; + + m_pInternal->m_oSmartText.m_pLastBrush = &m_pInternal->m_oLastBrush; + m_pInternal->m_oSmartText.m_pBrush = &m_pInternal->m_oBrush; + + m_pInternal->m_oSmartText.m_pFont = &m_pInternal->m_oFont; + + m_pInternal->m_oSmartText.m_pTransform = &m_pInternal->m_oTransform; + m_pInternal->m_oSmartText.m_pLastTransform = &m_pInternal->m_oLastTransform; + + m_pInternal->m_oSmartText.m_pPageMeta = &m_pInternal->m_oPage; + + OfficeDrawingFileType eType = pFile->GetType(); + switch (eType) + { + case odftPDF: + { + m_pInternal->m_lSrcFileType = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF; + m_pInternal->m_oSmartText.m_dTextSpaceEps = 0.1; + break; + } + case odftDJVU: + { + m_pInternal->m_lSrcFileType = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU; + m_pInternal->m_oSmartText.m_dTextSpaceEps = 0.1; + break; + } + case odftXPS: + { + m_pInternal->m_lSrcFileType = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS; + m_pInternal->m_oSmartText.m_dTextSpaceEps = 0.1; + break; + } + default: + break; + } + + m_pInternal->m_bIsFontsInit = true; + m_pInternal->m_oSmartText.Init(pFile->GetFonts()); + } + + m_pInternal->m_oPage.ClearNoAttack(); + m_pInternal->m_oPage.WriteLONG(0); + } + + BYTE* CHTMLRendererText::GetBuffer() + { + LONG lPos = m_pInternal->m_oPage.GetPosition(); + m_pInternal->m_oPage.Seek(0); + m_pInternal->m_oPage.WriteLONG(lPos); + m_pInternal->m_oPage.Seek(lPos); + return m_pInternal->m_oPage.GetData(); + } + + HRESULT CHTMLRendererText::get_Type(LONG* lType) + { + *lType = c_nHtmlRendrererText; + return S_OK; + } + + //-------- Функции для работы со страницей -------------------------------------------------- + HRESULT CHTMLRendererText::NewPage() + { + return S_OK; + } + HRESULT CHTMLRendererText::get_Height(double* dHeight) + { + *dHeight = m_pInternal->m_dHeght; + return S_OK; + } + HRESULT CHTMLRendererText::put_Height(const double& dHeight) + { + m_pInternal->m_dHeght = dHeight; + return S_OK; + } + HRESULT CHTMLRendererText::get_Width(double* dWidth) + { + *dWidth = m_pInternal->m_dWidth; + return S_OK; + } + HRESULT CHTMLRendererText::put_Width(const double& dWidth) + { + m_pInternal->m_dWidth = dWidth; + return S_OK; + } + HRESULT CHTMLRendererText::get_DpiX(double* dDpiX) + { + *dDpiX = 96; + return S_OK; + } + HRESULT CHTMLRendererText::get_DpiY(double* dDpiY) + { + *dDpiY = 96; + return S_OK; + } + + // pen -------------------------------------------------------------------------------------- + HRESULT CHTMLRendererText::get_PenColor(LONG* lColor) { return S_OK; } + HRESULT CHTMLRendererText::put_PenColor(const LONG& lColor) { return S_OK; } + HRESULT CHTMLRendererText::get_PenAlpha(LONG* lAlpha) { return S_OK; } + HRESULT CHTMLRendererText::put_PenAlpha(const LONG& lAlpha) { return S_OK; } + HRESULT CHTMLRendererText::get_PenSize(double* dSize) { return S_OK; } + HRESULT CHTMLRendererText::put_PenSize(const double& dSize) { return S_OK; } + HRESULT CHTMLRendererText::get_PenDashStyle(BYTE* val) { return S_OK; } + HRESULT CHTMLRendererText::put_PenDashStyle(const BYTE& val) { return S_OK; } + HRESULT CHTMLRendererText::get_PenLineStartCap(BYTE* val) { return S_OK; } + HRESULT CHTMLRendererText::put_PenLineStartCap(const BYTE& val) { return S_OK; } + HRESULT CHTMLRendererText::get_PenLineEndCap(BYTE* val) { return S_OK; } + HRESULT CHTMLRendererText::put_PenLineEndCap(const BYTE& val) { return S_OK; } + HRESULT CHTMLRendererText::get_PenLineJoin(BYTE* val) { return S_OK; } + HRESULT CHTMLRendererText::put_PenLineJoin(const BYTE& val) { return S_OK; } + HRESULT CHTMLRendererText::get_PenDashOffset(double* dOffset) { return S_OK; } + HRESULT CHTMLRendererText::put_PenDashOffset(const double& dOffset) { return S_OK; } + HRESULT CHTMLRendererText::get_PenAlign(LONG* lAlign) { return S_OK; } + HRESULT CHTMLRendererText::put_PenAlign(const LONG& lAlign) { return S_OK; } + HRESULT CHTMLRendererText::get_PenMiterLimit(double* dOffset) { return S_OK; } + HRESULT CHTMLRendererText::put_PenMiterLimit(const double& dOffset) { return S_OK; } + HRESULT CHTMLRendererText::PenDashPattern(double* pPattern, LONG lCount) { return S_OK; } + + // brush ------------------------------------------------------------------------------------ + HRESULT CHTMLRendererText::get_BrushType(LONG* lType) + { + *lType = m_pInternal->m_oBrush.Type; + return S_OK; + } + HRESULT CHTMLRendererText::put_BrushType(const LONG& lType) + { + m_pInternal->m_oBrush.Type = lType; + return S_OK; + } + HRESULT CHTMLRendererText::get_BrushColor1(LONG* lColor) + { + *lColor = m_pInternal->m_oBrush.Color1; + return S_OK; + } + HRESULT CHTMLRendererText::put_BrushColor1(const LONG& lColor) + { + m_pInternal->m_oBrush.Color1 = lColor; + return S_OK; + } + HRESULT CHTMLRendererText::get_BrushAlpha1(LONG* lAlpha) + { + *lAlpha = m_pInternal->m_oBrush.Alpha1; + return S_OK; + } + HRESULT CHTMLRendererText::put_BrushAlpha1(const LONG& lAlpha) + { + m_pInternal->m_oBrush.Alpha1 = lAlpha; + return S_OK; + } + HRESULT CHTMLRendererText::get_BrushColor2(LONG* lColor) { return S_OK; } + HRESULT CHTMLRendererText::put_BrushColor2(const LONG& lColor) { return S_OK; } + HRESULT CHTMLRendererText::get_BrushAlpha2(LONG* lAlpha) { return S_OK; } + HRESULT CHTMLRendererText::put_BrushAlpha2(const LONG& lAlpha) { return S_OK; } + HRESULT CHTMLRendererText::get_BrushTexturePath(std::wstring* bsPath) { return S_OK; } + HRESULT CHTMLRendererText::put_BrushTexturePath(const std::wstring& bsPath) { return S_OK; } + HRESULT CHTMLRendererText::get_BrushTextureMode(LONG* lMode) { return S_OK; } + HRESULT CHTMLRendererText::put_BrushTextureMode(const LONG& lMode) { return S_OK; } + HRESULT CHTMLRendererText::get_BrushTextureAlpha(LONG* lTxAlpha) { return S_OK; } + HRESULT CHTMLRendererText::put_BrushTextureAlpha(const LONG& lTxAlpha) { return S_OK; } + HRESULT CHTMLRendererText::get_BrushLinearAngle(double* dAngle) { return S_OK; } + HRESULT CHTMLRendererText::put_BrushLinearAngle(const double& dAngle) { return S_OK; } + HRESULT CHTMLRendererText::BrushRect(const INT& val, const double& left, const double& top, const double& width, const double& height) { return S_OK; } + HRESULT CHTMLRendererText::BrushBounds(const double& left, const double& top, const double& width, const double& height) { return S_OK; } + HRESULT CHTMLRendererText::put_BrushGradientColors(LONG* lColors, double* pPositions, LONG nCount) { return S_OK; } + + // font ------------------------------------------------------------------------------------- + HRESULT CHTMLRendererText::get_FontName(std::wstring* bsName) + { + *bsName = m_pInternal->m_oFont.Name; + return S_OK; + } + HRESULT CHTMLRendererText::put_FontName(const std::wstring& bsName) + { + m_pInternal->m_oFont.Name = bsName; + m_pInternal->m_bIsChangedFontParamBetweenDrawText = true; + return S_OK; + } + HRESULT CHTMLRendererText::get_FontPath(std::wstring* bsName) + { + *bsName = m_pInternal->m_oFont.Path; + return S_OK; + } + HRESULT CHTMLRendererText::put_FontPath(const std::wstring& bsName) + { + m_pInternal->m_oFont.Path = bsName; + m_pInternal->m_bIsChangedFontParamBetweenDrawText = true; + return S_OK; + } + HRESULT CHTMLRendererText::get_FontSize(double* dSize) + { + *dSize = m_pInternal->m_oFont.Size; + return S_OK; + } + HRESULT CHTMLRendererText::put_FontSize(const double& dSize) + { + if (m_pInternal->m_oFont.Size != dSize) + { + m_pInternal->m_oFont.Size = dSize; + m_pInternal->m_bIsChangedFontParamBetweenDrawText = true; + } + return S_OK; + } + HRESULT CHTMLRendererText::get_FontStyle(LONG* lStyle) + { + *lStyle = m_pInternal->m_oFont.GetStyle(); + return S_OK; + } + HRESULT CHTMLRendererText::put_FontStyle(const LONG& lStyle) + { + LONG lOld = m_pInternal->m_oFont.GetStyle(); + if (lOld != lStyle) + { + m_pInternal->m_oFont.SetStyle(lStyle); + m_pInternal->m_bIsChangedFontParamBetweenDrawText = true; + } + return S_OK; + } + HRESULT CHTMLRendererText::get_FontStringGID(INT* bGID) + { + *bGID = m_pInternal->m_oFont.StringGID; + return S_OK; + } + HRESULT CHTMLRendererText::put_FontStringGID(const INT& bGID) + { + m_pInternal->m_oFont.StringGID = bGID; + return S_OK; + } + HRESULT CHTMLRendererText::get_FontCharSpace(double* dSpace) + { + *dSpace = m_pInternal->m_oFont.CharSpace; + return S_OK; + } + HRESULT CHTMLRendererText::put_FontCharSpace(const double& dSpace) + { + m_pInternal->m_oFont.CharSpace = dSpace; + return S_OK; + } + HRESULT CHTMLRendererText::get_FontFaceIndex(int* lFaceIndex) + { + *lFaceIndex = m_pInternal->m_oFont.FaceIndex; + return S_OK; + } + HRESULT CHTMLRendererText::put_FontFaceIndex(const int& lFaceIndex) + { + m_pInternal->m_oFont.FaceIndex = lFaceIndex; + return S_OK; + } + + //-------- Функции для вывода текста -------------------------------------------------------- + HRESULT CHTMLRendererText::CommandDrawTextCHAR(const LONG& c, const double& x, const double& y, const double& w, const double& h) + { + if (c_nHyperlinkType == m_pInternal->m_lCurrentCommandType) + return S_OK; + + int _c = (int)c; + m_pInternal->WriteText(&_c, NULL, 1, x, y, w, h, m_pInternal->m_bIsChangedFontParamBetweenDrawText); + m_pInternal->m_bIsChangedFontParamBetweenDrawText = false; + return S_OK; + } + HRESULT CHTMLRendererText::CommandDrawText(const std::wstring& bsText, const double& x, const double& y, const double& w, const double& h) + { + if (c_nHyperlinkType == m_pInternal->m_lCurrentCommandType) + return S_OK; + + m_pInternal->GetUnicodes(bsText); + m_pInternal->WriteText(m_pInternal->m_pTempUnicodes, NULL, m_pInternal->m_nTempUnicodesLen, x, y, w, h, m_pInternal->m_bIsChangedFontParamBetweenDrawText); + m_pInternal->m_bIsChangedFontParamBetweenDrawText = false; + return S_OK; + } + HRESULT CHTMLRendererText::CommandDrawTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h) + { + if (c_nHyperlinkType == m_pInternal->m_lCurrentCommandType) + return S_OK; + + int _c = (int)c; + int _g = (int)gid; + + m_pInternal->WriteText(&_c, &_g, 1, x, y, w, h, m_pInternal->m_bIsChangedFontParamBetweenDrawText); + m_pInternal->m_bIsChangedFontParamBetweenDrawText = false; + return S_OK; + } + HRESULT CHTMLRendererText::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) + { + if (c_nHyperlinkType == m_pInternal->m_lCurrentCommandType) + return S_OK; + + m_pInternal->GetUnicodes(bsUnicodeText); + m_pInternal->WriteText(m_pInternal->m_pTempUnicodes, (const int*)pGids, m_pInternal->m_nTempUnicodesLen, x, y, w, h, m_pInternal->m_bIsChangedFontParamBetweenDrawText); + m_pInternal->m_bIsChangedFontParamBetweenDrawText = false; + return S_OK; + } + + //-------- Маркеры для команд --------------------------------------------------------------- + HRESULT CHTMLRendererText::BeginCommand(const DWORD& lType) + { + m_pInternal->m_lCurrentCommandType = lType; + return S_OK; + } + HRESULT CHTMLRendererText::EndCommand(const DWORD& lType) + { + m_pInternal->m_lCurrentCommandType = -1; + return S_OK; + } + + //-------- Функции для работы с Graphics Path ----------------------------------------------- + HRESULT CHTMLRendererText::PathCommandMoveTo(const double& x, const double& y) { return S_OK; } + HRESULT CHTMLRendererText::PathCommandLineTo(const double& x, const double& y) { return S_OK; } + HRESULT CHTMLRendererText::PathCommandLinesTo(double* points, const int& count) { return S_OK; } + HRESULT CHTMLRendererText::PathCommandCurveTo(const double& x1, const double& y1, const double& x2, const double& y2, const double& x3, const double& y3) { return S_OK; } + HRESULT CHTMLRendererText::PathCommandCurvesTo(double* points, const int& count) { return S_OK; } + HRESULT CHTMLRendererText::PathCommandArcTo(const double& x, const double& y, const double& w, const double& h, const double& startAngle, const double& sweepAngle) { return S_OK; } + HRESULT CHTMLRendererText::PathCommandClose() { return S_OK; } + HRESULT CHTMLRendererText::PathCommandEnd() { return S_OK; } + HRESULT CHTMLRendererText::DrawPath(const LONG& nType) { return S_OK; } + HRESULT CHTMLRendererText::PathCommandStart() { return S_OK; } + HRESULT CHTMLRendererText::PathCommandGetCurrentPoint(double* x, double* y) { return S_OK; } + HRESULT CHTMLRendererText::PathCommandTextCHAR(const LONG& c, const double& x, const double& y, const double& w, const double& h) { return S_OK; } + HRESULT CHTMLRendererText::PathCommandText(const std::wstring& bsText, const double& x, const double& y, const double& w, const double& h) { return S_OK; } + HRESULT CHTMLRendererText::PathCommandTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h) { return S_OK; } + HRESULT CHTMLRendererText::PathCommandTextEx(const std::wstring& bsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h) { return S_OK; } + + //-------- Функции для вывода изображений --------------------------------------------------- + HRESULT CHTMLRendererText::DrawImage(IGrObject* pImage, const double& x, const double& y, const double& w, const double& h) { return S_OK; } + + HRESULT CHTMLRendererText::DrawImageFromFile(const std::wstring& sPath, const double& x, const double& y, const double& w, const double& h, const BYTE& lAlpha) { return S_OK; } + + // transform -------------------------------------------------------------------------------- + HRESULT CHTMLRendererText::SetTransform(const double& m1, const double& m2, const double& m3, const double& m4, const double& m5, const double& m6) + { + m_pInternal->m_oTransform.SetElements(m1, m2, m3, m4, m5, m6); + return S_OK; + } + HRESULT CHTMLRendererText::GetTransform(double *pdA, double *pdB, double *pdC, double *pdD, double *pdE, double *pdF) + { + *pdA = m_pInternal->m_oTransform.sx(); + *pdB = m_pInternal->m_oTransform.shy(); + *pdC = m_pInternal->m_oTransform.shx(); + *pdD = m_pInternal->m_oTransform.sy(); + *pdE = m_pInternal->m_oTransform.tx(); + *pdF = m_pInternal->m_oTransform.ty(); + return S_OK; + } + HRESULT CHTMLRendererText::ResetTransform() + { + m_pInternal->m_oTransform.Reset(); + return S_OK; + } + + // ----------------------------------------------------------------------------------------- + HRESULT CHTMLRendererText::get_ClipMode(LONG* plMode) { return S_OK; } + HRESULT CHTMLRendererText::put_ClipMode(const LONG& lMode) { return S_OK; } + + // additiaonal params ---------------------------------------------------------------------- + HRESULT CHTMLRendererText::CommandLong(const LONG& lType, const LONG& lCommand) { return S_OK; } + HRESULT CHTMLRendererText::CommandDouble(const LONG& lType, const double& dCommand) { return S_OK; } + HRESULT CHTMLRendererText::CommandString(const LONG& lType, const std::wstring& sCommand) { return S_OK; } +}