diff --git a/DocxRenderer/DocxRenderer.cpp b/DocxRenderer/DocxRenderer.cpp index 8f9414a232..604dd79be2 100644 --- a/DocxRenderer/DocxRenderer.cpp +++ b/DocxRenderer/DocxRenderer.cpp @@ -30,6 +30,7 @@ * */ +#include "DocxRenderer.h" #include "src/logic/Document.h" class CDocxRenderer_Private @@ -63,411 +64,411 @@ CDocxRenderer::~CDocxRenderer() RELEASEOBJECT(m_pInternal); } -void CDocxRenderer::CreateFile(const std::wstring& wsPath) +HRESULT CDocxRenderer::CreateNewFile(const std::wstring& wsPath) { return S_OK; } -void CDocxRenderer::Close() +HRESULT CDocxRenderer::Close() { return S_OK; } -void CDocxRenderer::SetTextAssociationType(const NSDocxRenderer::TextAssociationType& eType) +HRESULT CDocxRenderer::SetTextAssociationType(const NSDocxRenderer::TextAssociationType& eType) { return S_OK; } -void CDocxRenderer::SetTempFolder(const std::wstring& wsPath) +HRESULT CDocxRenderer::SetTempFolder(const std::wstring& wsPath) { return S_OK; } //---------------------------------------------------------------------------------------- // Тип рендерера //---------------------------------------------------------------------------------------- -virtual HRESULT CDocxRenderer::get_Type(LONG* lType) +HRESULT CDocxRenderer::get_Type(LONG* lType) { return S_OK; } //---------------------------------------------------------------------------------------- // Функции для работы со страницей //---------------------------------------------------------------------------------------- -virtual HRESULT CDocxRenderer::NewPage() +HRESULT CDocxRenderer::NewPage() { return S_OK; } -virtual HRESULT CDocxRenderer::get_Height(double* dHeight) +HRESULT CDocxRenderer::get_Height(double* dHeight) { return S_OK; } -virtual HRESULT CDocxRenderer::put_Height(const double& dHeight) +HRESULT CDocxRenderer::put_Height(const double& dHeight) { return S_OK; } -virtual HRESULT CDocxRenderer::get_Width(double* dWidth) +HRESULT CDocxRenderer::get_Width(double* dWidth) { return S_OK; } -virtual HRESULT CDocxRenderer::put_Width(const double& dWidth) +HRESULT CDocxRenderer::put_Width(const double& dWidth) { return S_OK; } -virtual HRESULT CDocxRenderer::get_DpiX(double* dDpiX) +HRESULT CDocxRenderer::get_DpiX(double* dDpiX) { return S_OK; } -virtual HRESULT CDocxRenderer::get_DpiY(double* dDpiY) +HRESULT CDocxRenderer::get_DpiY(double* dDpiY) { return S_OK; } //---------------------------------------------------------------------------------------- // Функции для работы с Pen //---------------------------------------------------------------------------------------- -virtual HRESULT CDocxRenderer::get_PenColor(LONG* lColor) +HRESULT CDocxRenderer::get_PenColor(LONG* lColor) { return S_OK; } -virtual HRESULT CDocxRenderer::put_PenColor(const LONG& lColor) +HRESULT CDocxRenderer::put_PenColor(const LONG& lColor) { return S_OK; } -virtual HRESULT CDocxRenderer::get_PenAlpha(LONG* lAlpha) +HRESULT CDocxRenderer::get_PenAlpha(LONG* lAlpha) { return S_OK; } -virtual HRESULT CDocxRenderer::put_PenAlpha(const LONG& lAlpha) +HRESULT CDocxRenderer::put_PenAlpha(const LONG& lAlpha) { return S_OK; } -virtual HRESULT CDocxRenderer::get_PenSize(double* dSize) +HRESULT CDocxRenderer::get_PenSize(double* dSize) { return S_OK; } -virtual HRESULT CDocxRenderer::put_PenSize(const double& dSize) +HRESULT CDocxRenderer::put_PenSize(const double& dSize) { return S_OK; } -virtual HRESULT CDocxRenderer::get_PenDashStyle(BYTE* nDashStyle) +HRESULT CDocxRenderer::get_PenDashStyle(BYTE* nDashStyle) { return S_OK; } -virtual HRESULT CDocxRenderer::put_PenDashStyle(const BYTE& nDashStyle) +HRESULT CDocxRenderer::put_PenDashStyle(const BYTE& nDashStyle) { return S_OK; } -virtual HRESULT CDocxRenderer::get_PenLineStartCap(BYTE* nCapStyle) +HRESULT CDocxRenderer::get_PenLineStartCap(BYTE* nCapStyle) { return S_OK; } -virtual HRESULT CDocxRenderer::put_PenLineStartCap(const BYTE& nCapStyle) +HRESULT CDocxRenderer::put_PenLineStartCap(const BYTE& nCapStyle) { return S_OK; } -virtual HRESULT CDocxRenderer::get_PenLineEndCap(BYTE* nCapStyle) +HRESULT CDocxRenderer::get_PenLineEndCap(BYTE* nCapStyle) { return S_OK; } -virtual HRESULT CDocxRenderer::put_PenLineEndCap(const BYTE& nCapStyle) +HRESULT CDocxRenderer::put_PenLineEndCap(const BYTE& nCapStyle) { return S_OK; } -virtual HRESULT CDocxRenderer::get_PenLineJoin(BYTE* nJoinStyle) +HRESULT CDocxRenderer::get_PenLineJoin(BYTE* nJoinStyle) { return S_OK; } -virtual HRESULT CDocxRenderer::put_PenLineJoin(const BYTE& nJoinStyle) +HRESULT CDocxRenderer::put_PenLineJoin(const BYTE& nJoinStyle) { return S_OK; } -virtual HRESULT CDocxRenderer::get_PenDashOffset(double* dOffset) +HRESULT CDocxRenderer::get_PenDashOffset(double* dOffset) { return S_OK; } -virtual HRESULT CDocxRenderer::put_PenDashOffset(const double& dOffset) +HRESULT CDocxRenderer::put_PenDashOffset(const double& dOffset) { return S_OK; } -virtual HRESULT CDocxRenderer::get_PenAlign(LONG* lAlign) +HRESULT CDocxRenderer::get_PenAlign(LONG* lAlign) { return S_OK; } -virtual HRESULT CDocxRenderer::put_PenAlign(const LONG& lAlign) +HRESULT CDocxRenderer::put_PenAlign(const LONG& lAlign) { return S_OK; } -virtual HRESULT CDocxRenderer::get_PenMiterLimit(double* dMiter) +HRESULT CDocxRenderer::get_PenMiterLimit(double* dMiter) { return S_OK; } -virtual HRESULT CDocxRenderer::put_PenMiterLimit(const double& dMiter) +HRESULT CDocxRenderer::put_PenMiterLimit(const double& dMiter) { return S_OK; } -virtual HRESULT CDocxRenderer::PenDashPattern(double* pPattern, LONG lCount) +HRESULT CDocxRenderer::PenDashPattern(double* pPattern, LONG lCount) { return S_OK; } //---------------------------------------------------------------------------------------- // Функции для работы с Brush //---------------------------------------------------------------------------------------- -virtual HRESULT CDocxRenderer::get_BrushType(LONG* lType) +HRESULT CDocxRenderer::get_BrushType(LONG* lType) { return S_OK; } -virtual HRESULT CDocxRenderer::put_BrushType(const LONG& lType) +HRESULT CDocxRenderer::put_BrushType(const LONG& lType) { return S_OK; } -virtual HRESULT CDocxRenderer::get_BrushColor1(LONG* lColor) +HRESULT CDocxRenderer::get_BrushColor1(LONG* lColor) { return S_OK; } -virtual HRESULT CDocxRenderer::put_BrushColor1(const LONG& lColor) +HRESULT CDocxRenderer::put_BrushColor1(const LONG& lColor) { return S_OK; } -virtual HRESULT CDocxRenderer::get_BrushAlpha1(LONG* lAlpha) +HRESULT CDocxRenderer::get_BrushAlpha1(LONG* lAlpha) { return S_OK; } -virtual HRESULT CDocxRenderer::put_BrushAlpha1(const LONG& lAlpha) +HRESULT CDocxRenderer::put_BrushAlpha1(const LONG& lAlpha) { return S_OK; } -virtual HRESULT CDocxRenderer::get_BrushColor2(LONG* lColor) +HRESULT CDocxRenderer::get_BrushColor2(LONG* lColor) { return S_OK; } -virtual HRESULT CDocxRenderer::put_BrushColor2(const LONG& lColor) +HRESULT CDocxRenderer::put_BrushColor2(const LONG& lColor) { return S_OK; } -virtual HRESULT CDocxRenderer::get_BrushAlpha2(LONG* lAlpha) +HRESULT CDocxRenderer::get_BrushAlpha2(LONG* lAlpha) { return S_OK; } -virtual HRESULT CDocxRenderer::put_BrushAlpha2(const LONG& lAlpha) +HRESULT CDocxRenderer::put_BrushAlpha2(const LONG& lAlpha) { return S_OK; } -virtual HRESULT CDocxRenderer::get_BrushTexturePath(std::wstring* wsPath) +HRESULT CDocxRenderer::get_BrushTexturePath(std::wstring* wsPath) { return S_OK; } -virtual HRESULT CDocxRenderer::put_BrushTexturePath(const std::wstring& wsPath) +HRESULT CDocxRenderer::put_BrushTexturePath(const std::wstring& wsPath) { return S_OK; } -virtual HRESULT CDocxRenderer::get_BrushTextureMode(LONG* lMode) +HRESULT CDocxRenderer::get_BrushTextureMode(LONG* lMode) { return S_OK; } -virtual HRESULT CDocxRenderer::put_BrushTextureMode(const LONG& lMode) +HRESULT CDocxRenderer::put_BrushTextureMode(const LONG& lMode) { return S_OK; } -virtual HRESULT CDocxRenderer::get_BrushTextureAlpha(LONG* lAlpha) +HRESULT CDocxRenderer::get_BrushTextureAlpha(LONG* lAlpha) { return S_OK; } -virtual HRESULT CDocxRenderer::put_BrushTextureAlpha(const LONG& lAlpha) +HRESULT CDocxRenderer::put_BrushTextureAlpha(const LONG& lAlpha) { return S_OK; } -virtual HRESULT CDocxRenderer::get_BrushLinearAngle(double* dAngle) +HRESULT CDocxRenderer::get_BrushLinearAngle(double* dAngle) { return S_OK; } -virtual HRESULT CDocxRenderer::put_BrushLinearAngle(const double& dAngle) +HRESULT CDocxRenderer::put_BrushLinearAngle(const double& dAngle) { return S_OK; } -virtual HRESULT CDocxRenderer::BrushRect(const INT& nVal, const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight) +HRESULT CDocxRenderer::BrushRect(const INT& nVal, const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight) { return S_OK; } -virtual HRESULT CDocxRenderer::BrushBounds(const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight) +HRESULT CDocxRenderer::BrushBounds(const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight) { return S_OK; } -virtual HRESULT CDocxRenderer::put_BrushGradientColors(LONG* pColors, double* pPositions, LONG lCount) +HRESULT CDocxRenderer::put_BrushGradientColors(LONG* pColors, double* pPositions, LONG lCount) { return S_OK; } //---------------------------------------------------------------------------------------- // Функции для работы со шрифтами //---------------------------------------------------------------------------------------- -virtual HRESULT CDocxRenderer::get_FontName(std::wstring* wsName) +HRESULT CDocxRenderer::get_FontName(std::wstring* wsName) { return S_OK; } -virtual HRESULT CDocxRenderer::put_FontName(const std::wstring& wsName) +HRESULT CDocxRenderer::put_FontName(const std::wstring& wsName) { return S_OK; } -virtual HRESULT CDocxRenderer::get_FontPath(std::wstring* wsPath) +HRESULT CDocxRenderer::get_FontPath(std::wstring* wsPath) { return S_OK; } -virtual HRESULT CDocxRenderer::put_FontPath(const std::wstring& wsPath) +HRESULT CDocxRenderer::put_FontPath(const std::wstring& wsPath) { return S_OK; } -virtual HRESULT CDocxRenderer::get_FontSize(double* dSize) +HRESULT CDocxRenderer::get_FontSize(double* dSize) { return S_OK; } -virtual HRESULT CDocxRenderer::put_FontSize(const double& dSize) +HRESULT CDocxRenderer::put_FontSize(const double& dSize) { return S_OK; } -virtual HRESULT CDocxRenderer::get_FontStyle(LONG* lStyle) +HRESULT CDocxRenderer::get_FontStyle(LONG* lStyle) { return S_OK; } -virtual HRESULT CDocxRenderer::put_FontStyle(const LONG& lStyle) +HRESULT CDocxRenderer::put_FontStyle(const LONG& lStyle) { return S_OK; } -virtual HRESULT CDocxRenderer::get_FontStringGID(INT* bGid) +HRESULT CDocxRenderer::get_FontStringGID(INT* bGid) { return S_OK; } -virtual HRESULT CDocxRenderer::put_FontStringGID(const INT& bGid) +HRESULT CDocxRenderer::put_FontStringGID(const INT& bGid) { return S_OK; } -virtual HRESULT CDocxRenderer::get_FontCharSpace(double* dSpace) +HRESULT CDocxRenderer::get_FontCharSpace(double* dSpace) { return S_OK; } -virtual HRESULT CDocxRenderer::put_FontCharSpace(const double& dSpace) +HRESULT CDocxRenderer::put_FontCharSpace(const double& dSpace) { return S_OK; } -virtual HRESULT CDocxRenderer::get_FontFaceIndex(int* lFaceIndex) +HRESULT CDocxRenderer::get_FontFaceIndex(int* lFaceIndex) { return S_OK; } -virtual HRESULT CDocxRenderer::put_FontFaceIndex(const int& lFaceIndex) +HRESULT CDocxRenderer::put_FontFaceIndex(const int& lFaceIndex) { return S_OK; } //---------------------------------------------------------------------------------------- // Функции для вывода текста //---------------------------------------------------------------------------------------- -virtual HRESULT CDocxRenderer::CommandDrawTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH) +HRESULT CDocxRenderer::CommandDrawTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH) { return S_OK; } -virtual HRESULT CDocxRenderer::CommandDrawTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH) +HRESULT CDocxRenderer::CommandDrawTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH) { return S_OK; } -virtual HRESULT CDocxRenderer::CommandDrawText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH) +HRESULT CDocxRenderer::CommandDrawText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH) { return S_OK; } -virtual HRESULT CDocxRenderer::CommandDrawTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH) +HRESULT CDocxRenderer::CommandDrawTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH) { return S_OK; } //---------------------------------------------------------------------------------------- // Маркеры команд //---------------------------------------------------------------------------------------- -virtual HRESULT CDocxRenderer::BeginCommand(const DWORD& lType) +HRESULT CDocxRenderer::BeginCommand(const DWORD& lType) { return S_OK; } -virtual HRESULT CDocxRenderer::EndCommand(const DWORD& lType) +HRESULT CDocxRenderer::EndCommand(const DWORD& lType) { return S_OK; } //---------------------------------------------------------------------------------------- // Функции для работы с патом //---------------------------------------------------------------------------------------- -virtual HRESULT CDocxRenderer::PathCommandMoveTo(const double& dX, const double& dY) +HRESULT CDocxRenderer::PathCommandMoveTo(const double& dX, const double& dY) { return S_OK; } -virtual HRESULT CDocxRenderer::PathCommandLineTo(const double& dX, const double& dY) +HRESULT CDocxRenderer::PathCommandLineTo(const double& dX, const double& dY) { return S_OK; } -virtual HRESULT CDocxRenderer::PathCommandLinesTo(double* pPoints, const int& nCount) +HRESULT CDocxRenderer::PathCommandLinesTo(double* pPoints, const int& nCount) { return S_OK; } -virtual HRESULT CDocxRenderer::PathCommandCurveTo(const double& dX1, const double& dY1, const double& dX2, const double& dY2, const double& dXe, const double& dYe) +HRESULT CDocxRenderer::PathCommandCurveTo(const double& dX1, const double& dY1, const double& dX2, const double& dY2, const double& dXe, const double& dYe) { return S_OK; } -virtual HRESULT CDocxRenderer::PathCommandCurvesTo(double* pPoints, const int& nCount) +HRESULT CDocxRenderer::PathCommandCurvesTo(double* pPoints, const int& nCount) { return S_OK; } -virtual HRESULT CDocxRenderer::PathCommandArcTo(const double& dX, const double& dY, const double& dW, const double& dH, const double& dStartAngle, const double& dSweepAngle) +HRESULT CDocxRenderer::PathCommandArcTo(const double& dX, const double& dY, const double& dW, const double& dH, const double& dStartAngle, const double& dSweepAngle) { return S_OK; } -virtual HRESULT CDocxRenderer::PathCommandClose() +HRESULT CDocxRenderer::PathCommandClose() { return S_OK; } -virtual HRESULT CDocxRenderer::PathCommandEnd() +HRESULT CDocxRenderer::PathCommandEnd() { return S_OK; } -virtual HRESULT CDocxRenderer::DrawPath(const LONG& lType) +HRESULT CDocxRenderer::DrawPath(const LONG& lType) { return S_OK; } -virtual HRESULT CDocxRenderer::PathCommandStart() +HRESULT CDocxRenderer::PathCommandStart() { return S_OK; } -virtual HRESULT CDocxRenderer::PathCommandGetCurrentPoint(double* dX, double* dY) +HRESULT CDocxRenderer::PathCommandGetCurrentPoint(double* dX, double* dY) { return S_OK; } -virtual HRESULT CDocxRenderer::PathCommandTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH) +HRESULT CDocxRenderer::PathCommandTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH) { return S_OK; } -virtual HRESULT CDocxRenderer::PathCommandTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH) +HRESULT CDocxRenderer::PathCommandTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH) { return S_OK; } -virtual HRESULT CDocxRenderer::PathCommandText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH) +HRESULT CDocxRenderer::PathCommandText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH) { return S_OK; } -virtual HRESULT CDocxRenderer::PathCommandTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH) +HRESULT CDocxRenderer::PathCommandTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH) { return S_OK; } //---------------------------------------------------------------------------------------- // Функции для вывода изображений //---------------------------------------------------------------------------------------- -virtual HRESULT CDocxRenderer::DrawImage(IGrObject* pImage, const double& dX, const double& dY, const double& dW, const double& dH) +HRESULT CDocxRenderer::DrawImage(IGrObject* pImage, const double& dX, const double& dY, const double& dW, const double& dH) { return S_OK; } -virtual HRESULT CDocxRenderer::DrawImageFromFile(const std::wstring& wsImagePath, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha = 255) +HRESULT CDocxRenderer::DrawImageFromFile(const std::wstring& wsImagePath, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha) { return S_OK; } //---------------------------------------------------------------------------------------- // Функции для выставления преобразования //---------------------------------------------------------------------------------------- -virtual HRESULT CDocxRenderer::SetTransform(const double& dM11, const double& dM12, const double& dM21, const double& dM22, const double& dX, const double& dY) +HRESULT CDocxRenderer::SetTransform(const double& dM11, const double& dM12, const double& dM21, const double& dM22, const double& dX, const double& dY) { return S_OK; } -virtual HRESULT CDocxRenderer::GetTransform(double* dM11, double* dM12, double* dM21, double* dM22, double* dX, double* dY) +HRESULT CDocxRenderer::GetTransform(double* dM11, double* dM12, double* dM21, double* dM22, double* dX, double* dY) { return S_OK; } -virtual HRESULT CDocxRenderer::ResetTransform() +HRESULT CDocxRenderer::ResetTransform() { return S_OK; } @@ -475,11 +476,11 @@ virtual HRESULT CDocxRenderer::ResetTransform() //---------------------------------------------------------------------------------------- // Тип клипа //---------------------------------------------------------------------------------------- -virtual HRESULT CDocxRenderer::get_ClipMode(LONG* lMode) +HRESULT CDocxRenderer::get_ClipMode(LONG* lMode) { return S_OK; } -virtual HRESULT CDocxRenderer::put_ClipMode(const LONG& lMode) +HRESULT CDocxRenderer::put_ClipMode(const LONG& lMode) { return S_OK; } @@ -487,15 +488,15 @@ virtual HRESULT CDocxRenderer::put_ClipMode(const LONG& lMode) //---------------------------------------------------------------------------------------- // Дополнительные функции //---------------------------------------------------------------------------------------- -virtual HRESULT CDocxRenderer::CommandLong(const LONG& lType, const LONG& lCommand) +HRESULT CDocxRenderer::CommandLong(const LONG& lType, const LONG& lCommand) { return S_OK; } -virtual HRESULT CDocxRenderer::CommandDouble(const LONG& lType, const double& dCommand) +HRESULT CDocxRenderer::CommandDouble(const LONG& lType, const double& dCommand) { return S_OK; } -virtual HRESULT CDocxRenderer::CommandString(const LONG& lType, const std::wstring& sCommand) +HRESULT CDocxRenderer::CommandString(const LONG& lType, const std::wstring& sCommand) { return S_OK; } diff --git a/DocxRenderer/DocxRenderer.h b/DocxRenderer/DocxRenderer.h index cf73d3ddcc..10f702cd32 100644 --- a/DocxRenderer/DocxRenderer.h +++ b/DocxRenderer/DocxRenderer.h @@ -66,10 +66,10 @@ public: CDocxRenderer(CApplicationFonts* pAppFonts); ~CDocxRenderer(); - void CreateFile(const std::wstring& wsPath); - void Close(); + HRESULT CreateNewFile(const std::wstring& wsPath); + HRESULT Close(); - void SetTempFolder(const std::wstring& wsPath); + HRESULT SetTempFolder(const std::wstring& wsPath); //---------------------------------------------------------------------------------------- // Тип рендерера //---------------------------------------------------------------------------------------- @@ -203,7 +203,7 @@ public: virtual HRESULT CommandString(const LONG& lType, const std::wstring& sCommand); // методы, которыми будет пользоваться конвертер - void SetTextAssociationType(const NSDocxRenderer::TextAssociationType& eType); + HRESULT SetTextAssociationType(const NSDocxRenderer::TextAssociationType& eType); int Convert(IOfficeDrawingFile* pFile, const std::wstring& sDstFile); private: diff --git a/DocxRenderer/src/logic/Common.h b/DocxRenderer/src/logic/Common.h index 9d36da8130..3d6169f4e4 100644 --- a/DocxRenderer/src/logic/Common.h +++ b/DocxRenderer/src/logic/Common.h @@ -8,9 +8,13 @@ #include "../DesktopEditor/graphics/TemporaryCS.h" #include "../DesktopEditor/raster/BgraFrame.h" #include "../DesktopEditor/common/Directory.h" - +#include "../DesktopEditor/xml/include/xmlutils.h" #include +#ifndef max +#define max(x, y) x < y ? y : x +#endif + namespace NSDocxRenderer { inline LONG ConvertColor(LONG lBGR) diff --git a/DocxRenderer/src/logic/FontManagerBase.h b/DocxRenderer/src/logic/FontManagerBase.h index 1812c263d3..9d7ee12eff 100644 --- a/DocxRenderer/src/logic/FontManagerBase.h +++ b/DocxRenderer/src/logic/FontManagerBase.h @@ -3,6 +3,8 @@ #include "Common.h" #include "../DesktopEditor/graphics/pro/Fonts.h" +#include +#include namespace NSFontManager { @@ -129,7 +131,7 @@ namespace NSFontManager protected: CApplicationFonts* m_pFonts; - CFontManager* m_pManager; + NSFonts::IFontManager* m_pManager; std::wstring m_strDefaultFont; public: @@ -150,7 +152,7 @@ namespace NSFontManager m_pManager = NULL; CoCreateInstance(AVSGraphics::CLSID_CASCFontManager, NULL, CLSCTX_ALL, AVSGraphics::IID_IASCFontManager, (void**)&m_pManager); - m_pManager->Initialize(L""); + m_pManager->Initialize(); SetDefaultFont(_T("Arial")); @@ -166,8 +168,8 @@ namespace NSFontManager } __forceinline void ClearPickUps() - { - m_arListPicUps.RemoveAll(); + { + m_arListPicUps.clear(); m_strCurrentPickFont = _T(""); m_lCurrentPictFontStyle = 0; } @@ -177,13 +179,13 @@ namespace NSFontManager { m_strDefaultFont = strName; - BSTR bsDefault = m_strDefaultFont.AllocSysString(); + BSTR bsDefault = const_cast(m_strDefaultFont.c_str()); m_pManager->SetDefaultFont(bsDefault); SysFreeString(bsDefault); } __forceinline CString GetDefaultFont() { - return m_strDefaultFont; + return m_strDefaultFont.c_str(); } virtual void LoadFont(long lFaceIndex = 0, bool bIsNeedAddToMap = true) @@ -241,8 +243,10 @@ namespace NSFontManager XmlUtils::CXmlNode oCurNode; if ( oNode.GetNode( _T("AvgWidth"), oCurNode ) ) { - CString sValue = oCurNode.GetAttribute( _T("value") ); - m_oFont.m_lAvgWidth = XmlUtils::GetInteger( sValue ); + std::wstring sValue = oCurNode.GetAttribute(_T("value")); + try { + m_oFont.m_lAvgWidth = std::stol(sValue); + } catch (std::invalid_argument &) {} } } } @@ -256,8 +260,10 @@ namespace NSFontManager XmlUtils::CXmlNode oCurNode; if ( oNode.GetNode( _T("AvgWidth"), oCurNode ) ) { - CString sValue = oCurNode.GetAttribute( _T("value") ); - m_oFont.m_lAvgWidth = XmlUtils::GetInteger( sValue ); + std::wstring sValue = oCurNode.GetAttribute(_T("value")); + try { + m_oFont.m_lAvgWidth = std::stol(sValue); + } catch (std::invalid_argument &) {} } } } @@ -404,7 +410,7 @@ namespace NSFontManager } } - m_oFont.m_arSignature.push_bak(value); + m_oFont.m_arSignature.push_back(value); } } @@ -1246,7 +1252,8 @@ namespace NSFontManager inline void CheckRanges(DWORD& lRange1, DWORD& lRange2, DWORD& lRange3, DWORD& lRange4, const std::wstring& strText) { int lCount = (int)strText.length(); - WCHAR* pData = strText.c_str(); + std::wstring strTextTemp = strText; + WCHAR* pData = const_cast(strTextTemp.c_str()); BYTE lRangeNum = 0xFF; BYTE lRange = 0xFF; @@ -1292,18 +1299,22 @@ namespace NSFontManager BYTE lRange = 0xFF; GetRange(strText[0], lRangeNum, lRange); - POSITION posStart = m_arListPicUps.GetHeadPosition(); - POSITION pos = posStart; + std::list::iterator posStart, pos; + posStart = pos = m_arListPicUps.begin(); + //POSITION posStart = m_arListPicUps.GetHeadPosition(); + //POSITION pos = posStart; - while (NULL != pos) + while (m_arListPicUps.end() != pos) { - POSITION posOld = pos; - CFontPickUp& oPick = m_arListPicUps.GetNext(pos); - if ((oPick.m_oFont.m_oFont.IsEqual3(&m_oFont.m_oFont)) && (lRangeNum == oPick.m_lRangeNum) && (lRange == oPick.m_lRange)) + std::list::iterator posOld = pos; + CFontPickUp& oPick = *(pos++); //m_arListPicUps.GetNext(pos); + if ((oPick.m_oFont.m_oFont.IsEqual(&m_oFont.m_oFont)) && (lRangeNum == oPick.m_lRangeNum) && (lRange == oPick.m_lRange)) { // нашли! ничего подбирать не нужно // нужно просто выкинуть этот шрифт наверх - m_arListPicUps.MoveToHead(posOld); + m_arListPicUps.push_front(*posOld); + m_arListPicUps.erase(posOld); + //m_arListPicUps.MoveToHead(posOld); m_strCurrentPickFont = oPick.m_strPickFont; m_lCurrentPictFontStyle = oPick.m_lPickStyle; return false; @@ -1311,19 +1322,19 @@ namespace NSFontManager } // не нашли... - m_arListPicUps.AddHead(); - CFontPickUp& oPick = m_arListPicUps.GetHead(); - + //m_arListPicUps.AddHead(); + CFontPickUp oPick;// = m_arListPicUps.GetHead(); oPick.m_lRangeNum = lRangeNum; oPick.m_lRange = lRange; oPick.m_oFont = m_oFont; oPick.m_strPickFont = m_oFont.m_strFamilyName; - oPick.m_lPickStyle = m_oFont.m_lStyle; + oPick.m_lPickStyle = m_oFont.m_lStyle; AVSGraphics::IASCFontManager2* pManager2 = NULL; m_pManager->QueryInterface(AVSGraphics::IID_IASCFontManager2, (void**)&pManager2); - BSTR bsFontName = m_oFont.m_strFamilyName.AllocSysString(); + std::wstring m_strFamilyNameTemp = m_oFont.m_strFamilyName; + BSTR bsFontName = const_cast(m_strFamilyNameTemp.c_str()); BSTR bsNewFontName = NULL; DWORD dwR1 = m_oFont.m_arSignature[0]; @@ -1350,7 +1361,8 @@ namespace NSFontManager CheckRanges(dwR1, dwR2, dwR3, dwR4, lRangeNum, lRange); } - BSTR bsPanose = m_oFont.m_strPANOSE.AllocSysString(); + std::wstring m_strPANOSETemp = m_oFont.m_strPANOSE; + BSTR bsPanose = const_cast(m_strPANOSETemp.c_str()); LONG lFontStyle = m_oFont.m_oFont.GetStyle(); pManager2->GetWinFontByParams2(&bsNewFontName, bsFontName, -1, NULL, &lFontStyle, m_oFont.m_bIsFixedWidth ? 1 : 0, bsPanose, @@ -1367,6 +1379,7 @@ namespace NSFontManager RELEASEINTERFACE(pManager2); + m_arListPicUps.push_front(oPick); return true; } };