Commit 150ff1fa authored by Oleg Korshul's avatar Oleg Korshul

.

parent dd1b9ca9
......@@ -30,11 +30,179 @@
*
*/
#include "src/logic/Document.h"
class CDocxRenderer_Private
{
public:
NSDocxRenderer::CDocument m_oDocument;
CApplicationFonts* m_pApplicationFonts;
std::wstring m_strDstFilePath;
std::wstring m_strTempFileDir;
std::wstring m_strTempFileName;
public:
CDocxRenderer_Private(CApplicationFonts* pFonts)
{
m_pApplicationFonts = pFonts;
}
~CDocxRenderer_Private()
{
}
};
CDocxRenderer::CDocxRenderer(CApplicationFonts* pAppFonts)
{
m_pInternal = new CDocxRenderer_Private(pAppFonts);
}
CDocxRenderer::~CDocxRenderer()
{
RELEASEOBJECT(m_pInternal);
}
void CreateFile(const std::wstring& wsPath);
void Close();
void SetTextAssociationType(const NSDocxRenderer::TextAssociationType& eType);
void SetTempFolder(const std::wstring& wsPath);
//----------------------------------------------------------------------------------------
// Тип рендерера
//----------------------------------------------------------------------------------------
virtual HRESULT get_Type(LONG* lType);
//----------------------------------------------------------------------------------------
//
// CDocxRenderer
//
// Функции для работы со страницей
//----------------------------------------------------------------------------------------
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* nDashStyle);
virtual HRESULT put_PenDashStyle(const BYTE& nDashStyle);
virtual HRESULT get_PenLineStartCap(BYTE* nCapStyle);
virtual HRESULT put_PenLineStartCap(const BYTE& nCapStyle);
virtual HRESULT get_PenLineEndCap(BYTE* nCapStyle);
virtual HRESULT put_PenLineEndCap(const BYTE& nCapStyle);
virtual HRESULT get_PenLineJoin(BYTE* nJoinStyle);
virtual HRESULT put_PenLineJoin(const BYTE& nJoinStyle);
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* dMiter);
virtual HRESULT put_PenMiterLimit(const double& dMiter);
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* wsPath);
virtual HRESULT put_BrushTexturePath(const std::wstring& wsPath);
virtual HRESULT get_BrushTextureMode(LONG* lMode);
virtual HRESULT put_BrushTextureMode(const LONG& lMode);
virtual HRESULT get_BrushTextureAlpha(LONG* lAlpha);
virtual HRESULT put_BrushTextureAlpha(const LONG& lAlpha);
virtual HRESULT get_BrushLinearAngle(double* dAngle);
virtual HRESULT put_BrushLinearAngle(const double& dAngle);
virtual HRESULT BrushRect(const INT& nVal, const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight);
virtual HRESULT BrushBounds(const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight);
virtual HRESULT put_BrushGradientColors(LONG* pColors, double* pPositions, LONG lCount);
//----------------------------------------------------------------------------------------
// Функции для работы со шрифтами
//----------------------------------------------------------------------------------------
virtual HRESULT get_FontName(std::wstring* wsName);
virtual HRESULT put_FontName(const std::wstring& wsName);
virtual HRESULT get_FontPath(std::wstring* wsPath);
virtual HRESULT put_FontPath(const std::wstring& wsPath);
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& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH);
virtual HRESULT CommandDrawTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH);
virtual HRESULT CommandDrawText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH);
virtual HRESULT 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);
//----------------------------------------------------------------------------------------
// Маркеры команд
//----------------------------------------------------------------------------------------
virtual HRESULT BeginCommand(const DWORD& lType);
virtual HRESULT EndCommand(const DWORD& lType);
//----------------------------------------------------------------------------------------
// Функции для работы с патом
//----------------------------------------------------------------------------------------
virtual HRESULT PathCommandMoveTo(const double& dX, const double& dY);
virtual HRESULT PathCommandLineTo(const double& dX, const double& dY);
virtual HRESULT PathCommandLinesTo(double* pPoints, const int& nCount);
virtual HRESULT PathCommandCurveTo(const double& dX1, const double& dY1, const double& dX2, const double& dY2, const double& dXe, const double& dYe);
virtual HRESULT PathCommandCurvesTo(double* pPoints, const int& nCount);
virtual HRESULT PathCommandArcTo(const double& dX, const double& dY, const double& dW, const double& dH, const double& dStartAngle, const double& dSweepAngle);
virtual HRESULT PathCommandClose();
virtual HRESULT PathCommandEnd();
virtual HRESULT DrawPath(const LONG& lType);
virtual HRESULT PathCommandStart();
virtual HRESULT PathCommandGetCurrentPoint(double* dX, double* dY);
virtual HRESULT PathCommandTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH);
virtual HRESULT PathCommandTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH);
virtual HRESULT PathCommandText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH);
virtual HRESULT 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);
//----------------------------------------------------------------------------------------
// Функции для вывода изображений
//----------------------------------------------------------------------------------------
virtual HRESULT DrawImage(IGrObject* pImage, const double& dX, const double& dY, const double& dW, const double& dH);
virtual HRESULT DrawImageFromFile(const std::wstring& wsImagePath, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha = 255);
//----------------------------------------------------------------------------------------
// Функции для выставления преобразования
//----------------------------------------------------------------------------------------
virtual HRESULT SetTransform(const double& dM11, const double& dM12, const double& dM21, const double& dM22, const double& dX, const double& dY);
virtual HRESULT GetTransform(double* dM11, double* dM12, double* dM21, double* dM22, double* dX, double* dY);
virtual HRESULT ResetTransform();
//----------------------------------------------------------------------------------------
// Тип клипа
//----------------------------------------------------------------------------------------
virtual HRESULT get_ClipMode(LONG* lMode);
virtual HRESULT put_ClipMode(const LONG& lMode);
//----------------------------------------------------------------------------------------
// Дополнительные функции
//----------------------------------------------------------------------------------------
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);
CPdfRenderer::CPdfRenderer(CApplicationFonts* pAppFonts) : m_oCommandManager(this)
{
m_pAppFonts = pAppFonts;
......
#pragma once
#ifndef AVSINLINE
#if defined(_MSC_VER)
#define AVSINLINE __forceinline
#else
#define AVSINLINE inline
#endif
#endif
#include "../../Common/TemporaryCS.h"
#include "../Graphics/Matrix.h"
#include "../Graphics/Structures.h"
#include "StringWriter.h"
#include "CalculatorCRC32.h"
#ifndef DOCX_RENDERER_COMMON_H
#define DOCX_RENDERER_COMMON_H
#include "../DesktopEditor/common/StringBuilder.h"
#include "../DesktopEditor/common/CalculatorCRC32.h"
#include "../DesktopEditor/graphics/Matrix.h"
#include "../DesktopEditor/graphics/structures.h"
#include "../DesktopEditor/graphics/TemporaryCS.h"
#include "../DesktopEditor/raster/BgraFrame.h"
#include "../DesktopEditor/common/Directory.h"
#include <map>
namespace NSDocxRenderer
{
AVSINLINE LONG ConvertColor(LONG lBGR)
inline LONG ConvertColor(LONG lBGR)
{
return (0x00FFFFFF & (((lBGR & 0xFF) << 16) | (lBGR & 0x0000FF00) | ((lBGR >> 16) & 0xFF)));
}
AVSINLINE void CorrectString(CString& strValue)
{
strValue.Replace(_T("&"), _T("&amp;"));
strValue.Replace(_T("'"), _T("&apos;"));
strValue.Replace(_T("<"), _T("&lt;"));
strValue.Replace(_T(">"), _T("&gt;"));
strValue.Replace(_T("\""), _T("&quot;"));
}
class CBaseItem
{
public:
......@@ -47,19 +35,39 @@ namespace NSDocxRenderer
m_eType = etShape;
}
virtual void ToXml(NSDocxRenderer::CStringWriter& oWriter) = 0;
virtual void ToXml(NSStringUtils::CStringBuilder& oWriter) = 0;
};
class CImageInfo
{
public:
enum ImageType
{
itPNG = 0,
itJPG = 1
};
public:
ImageType m_eType;
int m_nId;
CImageInfo()
{
m_eType = itPNG;
m_nId = 0;
}
};
class CImageManager
{
public:
CAtlMap<CString, CImageInfo> m_mapImagesFile;
CAtlMap<DWORD, CImageInfo> m_mapImageData;
std::map<std::wstring, CImageInfo> m_mapImagesFile;
std::map<DWORD, CImageInfo> m_mapImageData;
CString m_strDstMedia;
std::wstring m_strDstMedia;
LONG m_lMaxSizeImage;
LONG m_lNextIDImage;
int m_lMaxSizeImage;
int m_lNextIDImage;
CCalculatorCRC32 m_oCRC;
......@@ -67,187 +75,77 @@ namespace NSDocxRenderer
CImageManager()
{
m_strDstMedia = _T("");
m_lMaxSizeImage = 800;
m_strDstMedia = L"";
m_lMaxSizeImage = 1200;
m_lNextIDImage = 0;
}
AVSINLINE void NewDocument()
inline void NewDocument()
{
m_strDstMedia = _T("");
m_lMaxSizeImage = 800;
m_strDstMedia = L"";
m_lMaxSizeImage = 1200;
m_lNextIDImage = 0;
m_mapImageData.RemoveAll();
m_mapImagesFile.RemoveAll();
m_mapImageData.clear();
m_mapImagesFile.clear();
}
public:
CImageInfo WriteImage(IUnknown* punkImage, double& x, double& y, double& width, double& height)
CImageInfo WriteImage(CBgraFrame* pImage, double& x, double& y, double& width, double& height)
{
if (height < 0)
{
FlipY(punkImage);
FlipY(pImage);
height = -height;
y -= height;
}
return GenerateImageID(punkImage);
return GenerateImageID(pImage);
}
CImageInfo WriteImage(CString& strFile, double& x, double& y, double& width, double& height)
CImageInfo WriteImage(std::wstring& strFile, double& x, double& y, double& width, double& height)
{
return GenerateImageID(strFile);
}
protected:
inline void CopyFile(CString& strFileSrc, CString& strFileDst)
inline void CopyFile(std::wstring& strFileSrc, std::wstring& strFileDst)
{
CDirectory::CopyFile(strFileSrc, strFileDst, NULL, NULL);
NSFile::CFileBinary::Copy(strFileSrc, strFileDst);
}
void SaveImage(CString& strFileSrc, CImageInfo& oInfo)
{
CString strLoadXml = _T("<transforms><ImageFile-LoadImage sourcepath=\"") + strFileSrc + _T("\"/></transforms>");
ImageStudio::IImageTransforms* pTransform = NULL;
CoCreateInstance(ImageStudio::CLSID_ImageTransforms, NULL, CLSCTX_INPROC_SERVER, ImageStudio::IID_IImageTransforms, (void**)&pTransform);
VARIANT_BOOL vbRes = VARIANT_FALSE;
BSTR bsLoad = strLoadXml.AllocSysString();
pTransform->SetXml(bsLoad, &vbRes);
SysFreeString(bsLoad);
pTransform->Transform(&vbRes);
VARIANT var;
var.punkVal = NULL;
pTransform->GetResult(0, &var);
if (NULL == var.punkVal)
void SaveImage(std::wstring& strFileSrc, CImageInfo& oInfo)
{
RELEASEINTERFACE(pTransform);
return;
CBgraFrame oFrame;
if (oFrame.OpenFile(strFileSrc))
return SaveImage(&oFrame, oInfo);
}
MediaCore::IAVSUncompressedVideoFrame* pFrame = NULL;
var.punkVal->QueryInterface(MediaCore::IID_IAVSUncompressedVideoFrame, (void**)&pFrame);
RELEASEINTERFACE((var.punkVal));
if (NULL == pFrame)
void SaveImage(CBgraFrame* pImage, CImageInfo& oInfo)
{
RELEASEINTERFACE(pTransform);
if (NULL == pImage)
return;
}
LONG lWidth = 0;
LONG lHeight = 0;
pFrame->get_Width(&lWidth);
pFrame->get_Height(&lHeight);
oInfo.m_eType = GetImageType(pFrame);
int w = pImage->get_Width();
int h = pImage->get_Height();
RELEASEINTERFACE(pFrame);
CString strSaveItem = _T("");
strSaveItem.Format(_T("\\image%d."), oInfo.m_lID);
if (itJPG == oInfo.m_eType)
{
strSaveItem = _T("<ImageFile-SaveAsJpeg destinationpath=\"") + m_strDstMedia + strSaveItem + _T("jpg\" format=\"888\"/>");
}
else
{
strSaveItem = _T("<ImageFile-SaveAsPng destinationpath=\"") + m_strDstMedia + strSaveItem + _T("png\" format=\"888\"/>");
}
oInfo.m_eType = GetImageType(pImage);
CString strXml = _T("");
if ((lWidth <= m_lMaxSizeImage) && (lHeight <= m_lMaxSizeImage))
{
strXml = _T("<transforms>") + strSaveItem + _T("</transforms>");
}
else
{
LONG lW = 0;
LONG lH = 0;
double dAspect = (double)lWidth / lHeight;
if (lWidth >= lHeight)
{
lW = m_lMaxSizeImage;
lH = (LONG)((double)lW / dAspect);
}
else
{
lH = m_lMaxSizeImage;
lW = (LONG)(dAspect * lH);
}
CString strResize = _T("");
strResize.Format(_T("<ImageTransform-TransformResize width=\"%d\" height=\"%d\"/>"), lW, lH);
strXml = _T("<transforms>") + strResize + strSaveItem + _T("</transforms>");
}
VARIANT_BOOL vbSuccess = VARIANT_FALSE;
BSTR bsXml = strXml.AllocSysString();
pTransform->SetXml(bsXml, &vbSuccess);
SysFreeString(bsXml);
pTransform->Transform(&vbSuccess);
RELEASEINTERFACE(pTransform);
}
void SaveImage(IUnknown* punkImage, CImageInfo& oInfo)
{
MediaCore::IAVSUncompressedVideoFrame* pFrame = NULL;
punkImage->QueryInterface(MediaCore::IID_IAVSUncompressedVideoFrame, (void**)&pFrame);
if (NULL == pFrame)
return;
LONG lWidth = 0;
LONG lHeight = 0;
pFrame->get_Width(&lWidth);
pFrame->get_Height(&lHeight);
oInfo.m_eType = GetImageType(pFrame);
RELEASEINTERFACE(pFrame);
ImageStudio::IImageTransforms* pTransform = NULL;
CoCreateInstance(ImageStudio::CLSID_ImageTransforms, NULL ,CLSCTX_INPROC_SERVER, ImageStudio::IID_IImageTransforms, (void**)&pTransform);
VARIANT var;
var.vt = VT_UNKNOWN;
var.punkVal = punkImage;
pTransform->SetSource(0, var);
CString strSaveItem = _T("");
strSaveItem.Format(_T("\\image%d."), oInfo.m_lID);
if (itJPG == oInfo.m_eType)
{
strSaveItem = _T("<ImageFile-SaveAsJpeg destinationpath=\"") + m_strDstMedia + strSaveItem + _T("jpg\" format=\"888\"/>");
}
else
{
strSaveItem = _T("<ImageFile-SaveAsPng destinationpath=\"") + m_strDstMedia + strSaveItem + _T("png\" format=\"888\"/>");
}
int format = (oInfo.m_eType == CImageInfo::itJPG) ? 3 : 4;
std::wstring sSavedFile = m_strDstMedia + L"/image" + std::to_wstring(oInfo.m_nId);
sSavedFile += ((oInfo.m_eType == CImageInfo::itJPG) ? L".jpg" : L".png");
CString strXml = _T("");
if ((lWidth <= m_lMaxSizeImage) && (lHeight <= m_lMaxSizeImage))
if (w <= m_lMaxSizeImage && h <= m_lMaxSizeImage)
{
strXml = _T("<transforms>") + strSaveItem + _T("</transforms>");
pImage->SaveFile(sSavedFile, format);
}
else
{
LONG lW = 0;
LONG lH = 0;
double dAspect = (double)lWidth / lHeight;
int lW = 0;
int lH = 0;
double dAspect = (double)w / h;
if (lWidth >= lHeight)
if (w >= h)
{
lW = m_lMaxSizeImage;
lH = (LONG)((double)lW / dAspect);
lH = (int)((double)lW / dAspect);
}
else
{
......@@ -255,91 +153,53 @@ namespace NSDocxRenderer
lW = (LONG)(dAspect * lH);
}
CString strResize = _T("");
strResize.Format(_T("<ImageTransform-TransformResize width=\"%d\" height=\"%d\"/>"), lW, lH);
strXml = _T("<transforms>") + strResize + strSaveItem + _T("</transforms>");
// TODO: resize
pImage->SaveFile(sSavedFile, format);
}
VARIANT_BOOL vbSuccess = VARIANT_FALSE;
BSTR bsXml = strXml.AllocSysString();
pTransform->SetXml(bsXml, &vbSuccess);
SysFreeString(bsXml);
pTransform->Transform(&vbSuccess);
RELEASEINTERFACE(pTransform);
}
CImageInfo GenerateImageID(IUnknown* punkData)
CImageInfo GenerateImageID(CBgraFrame* pImage)
{
CImageInfo oInfo;
if (NULL == punkData)
return oInfo;
BYTE* pData = pImage->get_Data();
int nSize = pImage->get_Stride() * pImage->get_Height();
if (nSize < 0)
nSize = -nSize;
MediaCore::IAVSUncompressedVideoFrame* pFrame = NULL;
punkData->QueryInterface(MediaCore::IID_IAVSUncompressedVideoFrame, (void**)&pFrame);
DWORD dwSum = m_oCRC.Calc(pData, nSize);
BYTE* pBuffer = NULL;
LONG lLen = 0;
std::map<DWORD, CImageInfo>::iterator find = m_mapImageData.find(dwSum);
if (find != m_mapImageData.end())
return *find;
pFrame->get_Buffer(&pBuffer);
pFrame->get_BufferSize(&lLen);
DWORD dwSum = m_oCRC.Calc(pBuffer, lLen);
CAtlMap<DWORD, CImageInfo>::CPair* pPair = m_mapImageData.Lookup(dwSum);
if (NULL == pPair)
{
//
++m_lNextIDImage;
CImageInfo oInfo;
oInfo.m_lID = m_lNextIDImage;
SaveImage(punkData, oInfo);
m_mapImageData.SetAt(dwSum, oInfo);
}
else
{
oInfo = pPair->m_value;
}
RELEASEINTERFACE(pFrame);
SaveImage(pImage, oInfo);
m_mapImageData.insert(std::pair<std::DWORD, CImageInfo>(dwSum, oInfo);
return oInfo;
}
CImageInfo GenerateImageID(CString& strFileName)
CImageInfo GenerateImageID(std::wstring& strFileName)
{
CImageInfo oInfo;
CAtlMap<CString, CImageInfo>::CPair* pPair = m_mapImagesFile.Lookup(strFileName);
std::map<std::wstring, CImageInfo>::iterator find = m_mapImagesFile.find(strFileName);
if (find != m_mapImagesFile.end())
return *find;
if (NULL == pPair)
{
//
++m_lNextIDImage;
CImageInfo oInfo;
oInfo.m_lID = m_lNextIDImage;
SaveImage(strFileName, oInfo);
m_mapImagesFile.SetAt(strFileName, oInfo);
}
else
{
oInfo = pPair->m_value;
}
m_mapImagesFile.insert(std::pair<std::wstring, CImageInfo>(strFileName, oInfo);
return oInfo;
}
ImageType GetImageType(MediaCore::IAVSUncompressedVideoFrame* pFrame)
CImageInfo::ImageType GetImageType(CBgraFrame* pFrame)
{
LONG lWidth = 0;
LONG lHeight = 0;
BYTE* pBuffer = NULL;
pFrame->get_Width(&lWidth);
pFrame->get_Height(&lHeight);
pFrame->get_Buffer(&pBuffer);
int w = pFrame->get_Width();
int h = pFrame->get_Height();
BYTE* pBuffer = pFrame->get_Data();
BYTE* pBufferMem = pBuffer + 3;
LONG lCountPix = lWidth * lHeight;
......@@ -347,95 +207,66 @@ namespace NSDocxRenderer
for (LONG i = 0; i < lCountPix; ++i, pBufferMem += 4)
{
if (255 != *pBufferMem)
return itPNG;
return CImageInfo::itPNG;
}
return itJPG;
return CImageInfo::itJPG;
}
void FlipY(IUnknown* punkImage)
void FlipY(CBgraFrame* pImage)
{
if (NULL == punkImage)
return;
MediaCore::IAVSUncompressedVideoFrame* pFrame = NULL;
punkImage->QueryInterface(MediaCore::IID_IAVSUncompressedVideoFrame, (void**)&pFrame);
if (NULL == pFrame)
if (NULL == pImage)
return;
BYTE* pBuffer = NULL;
LONG lWidth = 0;
LONG lHeight = 0;
LONG lStride = 0;
pFrame->get_Buffer(&pBuffer);
pFrame->get_Width(&lWidth);
pFrame->get_Height(&lHeight);
pFrame->get_Stride(0, &lStride);
int w = pImage->get_Width();
int h = pImage->get_Height();
BYTE* pBuffer = pImage->get_Data();
int stride = pImage->get_Stride();
if (lStride < 0)
lStride = -lStride;
if (stride < 0)
stride = -stride;
if ((lWidth * 4) != lStride)
{
RELEASEINTERFACE(pFrame);
if ((w * 4) != stride)
return;
}
BYTE* pBufferMem = new BYTE[lStride];
BYTE* pBufferMem = new BYTE[stride];
BYTE* pBufferEnd = pBuffer + lStride * (lHeight - 1);
BYTE* pBufferEnd = pBuffer + stride * (h - 1);
LONG lCountV = lHeight / 2;
LONG lCountV = h / 2;
for (LONG lIndexV = 0; lIndexV < lCountV; ++lIndexV)
{
memcpy(pBufferMem, pBuffer, lStride);
memcpy(pBuffer, pBufferEnd, lStride);
memcpy(pBufferEnd, pBufferMem, lStride);
memcpy(pBufferMem, pBuffer, stride);
memcpy(pBuffer, pBufferEnd, stride);
memcpy(pBufferEnd, pBufferMem, stride);
pBuffer += lStride;
pBufferEnd -= lStride;
pBuffer += stride;
pBufferEnd -= stride;
}
RELEASEARRAYOBJECTS(pBufferMem);
RELEASEINTERFACE(pFrame);
}
void FlipX(IUnknown* punkImage)
void FlipX(CBgraFrame* pImage)
{
if (NULL == punkImage)
if (NULL == pImage)
return;
MediaCore::IAVSUncompressedVideoFrame* pFrame = NULL;
punkImage->QueryInterface(MediaCore::IID_IAVSUncompressedVideoFrame, (void**)&pFrame);
int w = pImage->get_Width();
int h = pImage->get_Height();
BYTE* pBuffer = pImage->get_Data();
int stride = pImage->get_Stride();
if (NULL == pFrame)
return;
BYTE* pBuffer = NULL;
LONG lWidth = 0;
LONG lHeight = 0;
LONG lStride = 0;
pFrame->get_Buffer(&pBuffer);
pFrame->get_Width(&lWidth);
pFrame->get_Height(&lHeight);
pFrame->get_Stride(0, &lStride);
if (stride < 0)
stride = -stride;
if (lStride < 0)
lStride = -lStride;
if ((lWidth * 4) != lStride)
{
RELEASEINTERFACE(pFrame);
if ((w * 4) != stride)
return;
}
DWORD* pBufferDWORD = (DWORD*)pBuffer;
LONG lW2 = lWidth / 2;
for (LONG lIndexV = 0; lIndexV < lHeight; ++lIndexV)
LONG lW2 = w / 2;
for (LONG lIndexV = 0; lIndexV < h; ++lIndexV)
{
DWORD* pMem1 = pBufferDWORD;
DWORD* pMem2 = pBufferDWORD + lWidth - 1;
......@@ -448,8 +279,6 @@ namespace NSDocxRenderer
*pMem2-- = dwMem;
}
}
RELEASEINTERFACE(pFrame);
}
};
......@@ -470,49 +299,6 @@ namespace NSDocxRenderer
{
return ( ( i & 0xff ) << 24 ) + ( ( i & 0xff00 ) << 8 ) + ( ( i & 0xff0000 ) >> 8 ) + ( ( i >> 24 ) & 0xff );
}
AVSINLINE CString ToHexString( unsigned int ui )
{
CString strRes = _T("");
strRes.Format(_T("%08X"), ui);
return strRes;
}
/*========================================================================================================*/
AVSINLINE CString ToHexString( short s )
{
CString strRes = _T("");
strRes.Format(_T("%04X"), s);
return strRes;
}
/*========================================================================================================*/
AVSINLINE CString ToHexString( unsigned short us )
{
CString strRes = _T("");
strRes.Format(_T("%04X"), us);
return strRes;
}
/*========================================================================================================*/
AVSINLINE CString ToHexString( char c )
{
CString strRes = _T("");
strRes.Format(_T("%02X"), c);
return strRes;
}
/*========================================================================================================*/
AVSINLINE CString ToHexString( BYTE uc )
{
CString strRes = _T("");
strRes.Format(_T("%02X"), uc);
return strRes;
}
/*========================================================================================================*/
}
#endif // DOCX_RENDERER_COMMON_H
#pragma once
#ifndef DOCX_RENDERER_ELEMENT_IMAGE_H
#define DOCX_RENDERER_ELEMENT_IMAGE_H
#include "Common.h"
namespace NSDocxRenderer
{
static _bstr_t g_bstr_image_1 = L"<w:r><w:pict><v:shape id=\"\" type=\"\" style=\"position:absolute;";
static _bstr_t g_bstr_image_2 = L"z-index:-1;mso-position-horizontal-relative:page;mso-position-vertical-relative:page\" filled=\"f\">";
static _bstr_t g_bstr_image_3 = L"</v:shape></w:pict></w:r>";
static CString g_string_image_position = _T("margin-left:%.2lfmm;margin-top:%.2lfmm;width:%.2lfmm;height:%.2lfmm;");
static CString g_string_image_position_rotate = _T("margin-left:%.2lfmm;margin-top:%.2lfmm;width:%.2lfmm;height:%.2lfmm;rotation:%d;");
static CString g_string_image_rid = _T("<v:imagedata r:id=\"rId%d\" o:title=\"\"/>");
class CImage : public CBaseItem
{
public:
CString m_strPath;
LONG m_lID;
std::wstring m_strPath;
int m_lID;
double m_dLeft;
double m_dTop;
......@@ -28,18 +22,18 @@ namespace NSDocxRenderer
CImage()
{
m_eType = etImage;
m_strPath = _T("");
m_strPath = L"";
m_lID = -1;
}
CImage(const CImage& oSrc)
{
*this = oSrc;
}
CImage(const CImageInfo& oInfo, const CString& strDstMedia)
CImage(const CImageInfo& oInfo, const std::wstring& strDstMedia)
{
m_eType = etImage;
m_strPath = strDstMedia;
m_lID = oInfo.m_lID;
m_lID = oInfo.m_nId;
}
CImage& operator=(const CImage& oSrc)
{
......@@ -57,31 +51,36 @@ namespace NSDocxRenderer
return *this;
}
virtual void ToXml(NSDocxRenderer::CStringWriter& oWriter)
virtual void ToXml(NSStringUtils::CStringBuilder& oWriter)
{
oWriter.WriteString(g_bstr_image_1);
oWriter.WriteString(L"<w:r><w:pict><v:shape id=\"\" type=\"\" style=\"position:absolute;");
if (0.0 == m_dRotate)
{
CString strPosition = _T("");
strPosition.Format(g_string_image_position, m_dLeft, m_dTop, m_dWidth, m_dHeight);
oWriter.WriteString(strPosition);
}
else
oWriter.WriteString(L"margin-left:");
oWriter.AddDouble(m_dLeft, 2);
oWriter.WriteString(L"mm;margin-top:");
oWriter.AddDouble(m_dTop, 2);
oWriter.WriteString(L"mm;width:");
oWriter.AddDouble(m_dWidth, 2);
oWriter.WriteString(L"mm;height:");
oWriter.AddDouble(m_dHeight, 2);
oWriter.WriteString(L"mm;");
if (fabs(m_dRotate) > 0.01)
{
CString strPosition = _T("");
strPosition.Format(g_string_image_position_rotate, m_dLeft, m_dTop, m_dWidth, m_dHeight, (int)m_dRotate);
oWriter.WriteString(strPosition);
oWriter.WriteString(L"rotation:");
oWriter.AddInt((int)m_dRotate);
oWriter.AddCharSafe(';');
}
oWriter.WriteString(g_bstr_image_2);
oWriter.WriteString(L"z-index:-1;mso-position-horizontal-relative:page;mso-position-vertical-relative:page\" filled=\"f\">");
CString strRid = _T("");
strRid.Format(g_string_image_rid, 10 + m_lID);
oWriter.WriteString(L"<v:imagedata r:id=\"rId");
oWriter.AddInt(10 + m_lID);
oWriter.WriteString(L"\" o:title=\"\"/>");
oWriter.WriteString(strRid);
oWriter.WriteString(g_bstr_image_3);
oWriter.WriteString(L"</v:shape></w:pict></w:r>");
}
};
}
#endif // DOCX_RENDERER_ELEMENT_IMAGE_H
#pragma once
#include "Common.h"
//#include "../../Common/DocxFormat/Source/DocxFormat/Logic/Paragraph.h"
#include "FontManager.h"
namespace NSDocxRenderer
......@@ -10,7 +9,7 @@ namespace NSDocxRenderer
// T IsBigger, IsBiggerOrEqual
template<typename T>
void SortElements(CAtlArray<T*>& oArray)
void SortElements(CArray<T*>& oArray)
{
int nSize = (int)oArray.GetCount();
......@@ -111,7 +110,7 @@ namespace NSDocxRenderer
static CString g_string_par_props_mode2 = _T("<w:pPr><w:framePr w:hAnchor=\"page\" w:vAnchor=\"page\" w:x=\"%d\" w:y=\"%d\"/></w:pPr>");
AVSINLINE void DeleteSpaces(CString& strText)
inline void DeleteSpaces(CString& strText)
{
int nLen = strText.GetLength();
int nStart = 0;
......
#pragma once
#ifndef DOCX_RENDERER_ELEMENT_SHAPE_H
#define DOCX_RENDERER_ELEMENT_SHAPE_H
#include "Common.h"
namespace NSDocxRenderer
{
static _bstr_t g_vml_bstr_ClosePath = L"x";
static _bstr_t g_vml_bstr_EndPath = L"e";
static _bstr_t g_vml_bstr_NoFill = L"nf";
static _bstr_t g_vml_bstr_NoStroke = L"ns";
static CString g_vml_string_MoveTo = _T("m%d,%d");
static CString g_vml_string_LineTo = _T("l%d,%d");
static CString g_vml_string_CurveTo = _T("c%d,%d %d,%d %d,%d");
static _bstr_t g_bstr_shape1 = L"<w:r><w:pict><v:shape id=\"\" o:spid=\"\" style=\"position:absolute;";
static _bstr_t g_bstr_shape2 = L"z-index:-1;mso-position-horizontal-relative:page;mso-position-vertical-relative:page;\"";
static CString g_string_shape_position = _T("margin-left:%.2lfmm;margin-top:%.2lfmm;width:%.2lfmm;height:%.2lfmm;");
static CString g_string_shape_geometry = _T(" coordsize=\"%d,%d\" path=\"%s\" fillcolor=\"#%06x\" strokecolor=\"#%06x\" strokeweight=\"%.2lfmm\">");
static CString g_string_tx_rid = _T("<v:imagedata r:id=\"rId%d\" o:title=\"\"/>");
static CString g_string_fill_opacity = _T("<v:fill opacity=\"%.2lf\"/>");
static CString g_string_stroke_opacity = _T("<v:stroke opacity=\"%.2lf\"/>");
static _bstr_t g_bstr_shape3 = L"<w10:wrap anchorx=\"page\" anchory=\"page\"/></v:shape></w:pict></w:r>";
class CVectorGraphics
{
public:
......@@ -54,7 +36,7 @@ namespace NSDocxRenderer
RELEASEMEM(m_pData);
}
AVSINLINE void AddSize(size_t nSize)
inline void AddSize(size_t nSize)
{
if (NULL == m_pData)
{
......@@ -93,7 +75,7 @@ namespace NSDocxRenderer
}
public:
AVSINLINE void MoveTo(const double& x1, const double& y1)
inline void MoveTo(const double& x1, const double& y1)
{
AddSize(3);
*m_pDataCur = 0; ++m_pDataCur;
......@@ -105,7 +87,7 @@ namespace NSDocxRenderer
CheckPoint(x1, y1);
}
AVSINLINE void LineTo(const double& x1, const double& y1)
inline void LineTo(const double& x1, const double& y1)
{
AddSize(3);
*m_pDataCur = 1; ++m_pDataCur;
......@@ -117,7 +99,7 @@ namespace NSDocxRenderer
CheckPoint(x1, y1);
}
AVSINLINE void CurveTo(const double& x1, const double& y1, const double& x2, const double& y2, const double& x3, const double& y3)
inline void CurveTo(const double& x1, const double& y1, const double& x2, const double& y2, const double& x3, const double& y3)
{
AddSize(7);
*m_pDataCur = 2; ++m_pDataCur;
......@@ -135,7 +117,7 @@ namespace NSDocxRenderer
CheckPoint(x2, y2);
CheckPoint(x3, y3);
}
AVSINLINE void Close()
inline void Close()
{
AddSize(1);
*m_pDataCur = 3; ++m_pDataCur;
......@@ -143,12 +125,12 @@ namespace NSDocxRenderer
m_lSizeCur += 1;
}
AVSINLINE size_t GetCurSize()
inline size_t GetCurSize()
{
return m_lSizeCur;
}
AVSINLINE void Clear()
inline void Clear()
{
RELEASEMEM(m_pData);
......@@ -158,13 +140,13 @@ namespace NSDocxRenderer
m_pDataCur = m_pData;
m_lSizeCur = 0;
}
AVSINLINE void ClearNoAttack()
inline void ClearNoAttack()
{
m_pDataCur = m_pData;
m_lSizeCur = 0;
}
AVSINLINE void End()
inline void End()
{
ClearNoAttack();
......@@ -174,7 +156,7 @@ namespace NSDocxRenderer
m_dBottom = -0xFFFFFF;
}
AVSINLINE void CheckPoint(const double& x, const double& y)
inline void CheckPoint(const double& x, const double& y)
{
if (m_dLeft > x)
m_dLeft = x;
......@@ -190,7 +172,7 @@ namespace NSDocxRenderer
class CShape : public CBaseItem
{
public:
CString m_strPath;
std::wstring m_strPath;
NSStructures::CBrush m_oBrush;
NSStructures::CPen m_oPen;
......@@ -250,7 +232,7 @@ namespace NSDocxRenderer
return *this;
}
void CreateFromVectorData(CVectorGraphics* pVector, NSDocxRenderer::CStringWriter& oWriter, const LONG& lCoordSize, LONG lType)
void CreateFromVectorData(CVectorGraphics* pVector, NSStringUtils::CStringBuilder& oWriter, const LONG& lCoordSize, LONG lType)
{
m_dLeft = pVector->m_dLeft;
m_dTop = pVector->m_dTop;
......@@ -272,10 +254,10 @@ namespace NSDocxRenderer
LONG lY = (LONG)((*pData - m_dTop) * lCoordSize / m_dHeight);
++pData;
CString strPath = _T("");
strPath.Format(g_vml_string_MoveTo, lX, lY);
oWriter.WriteString(strPath);
oWriter.AddCharSafe('m');
oWriter.AddInt(lX);
oWriter.AddCharSafe(',');
oWriter.AddInt(lY);
nCount -= 3;
}
......@@ -286,10 +268,10 @@ namespace NSDocxRenderer
LONG lY = (LONG)((*pData - m_dTop) * lCoordSize / m_dHeight);
++pData;
CString strPath = _T("");
strPath.Format(g_vml_string_LineTo, lX, lY);
oWriter.WriteString(strPath);
oWriter.AddCharSafe('l');
oWriter.AddInt(lX);
oWriter.AddCharSafe(',');
oWriter.AddInt(lY);
nCount -= 3;
}
......@@ -310,76 +292,104 @@ namespace NSDocxRenderer
LONG lY3 = (LONG)((*pData - m_dTop) * lCoordSize / m_dHeight);
++pData;
CString strPath = _T("");
strPath.Format(g_vml_string_CurveTo, lX1, lY1, lX2, lY2, lX3, lY3);
oWriter.WriteString(strPath);
oWriter.AddCharSafe('c');
oWriter.AddInt(lX1);
oWriter.AddCharSafe(',');
oWriter.AddInt(lY1);
oWriter.AddCharSafe(',');
oWriter.AddInt(lX2);
oWriter.AddCharSafe(',');
oWriter.AddInt(lY2);
oWriter.AddCharSafe(',');
oWriter.AddInt(lX3);
oWriter.AddCharSafe(',');
oWriter.AddInt(lY3);
nCount -= 7;
}
else
{
oWriter.WriteString(g_vml_bstr_ClosePath);
oWriter.AddCharSafe('x');
--nCount;
}
}
if (0x00 == (lType & 0x01))
oWriter.WriteString(g_vml_bstr_NoStroke);
oWriter.WriteString(L"ns");
if (0x00 == (lType >> 8))
oWriter.WriteString(g_vml_bstr_NoFill);
oWriter.WriteString(L"nf");
oWriter.WriteString(g_vml_bstr_EndPath);
oWriter.AddCharSafe('e');
m_strPath = oWriter.GetData();
oWriter.ClearNoAttack();
}
virtual void ToXml(NSDocxRenderer::CStringWriter& oWriter)
{
oWriter.WriteString(g_bstr_shape1);
CString strPosition = _T("");
strPosition.Format(g_string_shape_position, m_dLeft, m_dTop, m_dWidth, m_dHeight);
oWriter.WriteString(strPosition);
virtual void ToXml(NSStringUtils::CStringBuilder& oWriter)
{
oWriter.WriteString(L"<w:r><w:pict><v:shape id=\"\" o:spid=\"\" style=\"position:absolute;");
oWriter.WriteString(L"margin-left:");
oWriter.AddDouble(m_dLeft, 2);
oWriter.WriteString(L"mm;margin-top:");
oWriter.AddDouble(m_dTop, 2);
oWriter.WriteString(L"mm;width:");
oWriter.AddDouble(m_dWidth, 2);
oWriter.WriteString(L"mm;height:");
oWriter.AddDouble(m_dHeight, 2);
oWriter.WriteString(L"mm;");
oWriter.WriteString(L"z-index:-1;mso-position-horizontal-relative:page;mso-position-vertical-relative:page;\"");
oWriter.WriteString(L" coordsize=\"");
oWriter.AddInt((int)m_lCoordSizeX);
oWriter.AddCharSafe(',');
oWriter.AddInt((int)m_lCoordSizeY);
oWriter.WriteString(L"\" path=\"");
oWriter.WriteString(m_strPath);
oWriter.WriteString(L"\" fillcolor=\"");
oWriter.WriteHexInt3((int)ConvertColor(m_oBrush.Color1));
oWriter.WriteString(L"\" strokecolor=\"");
oWriter.WriteHexInt3((int)ConvertColor(m_oPen.Color));
oWriter.WriteString(L"\" strokeweight=\"");
oWriter.AddDouble(m_oPen.Size, 2);
oWriter.WriteString(L"mm\">");
oWriter.WriteString(strPosition);
oWriter.WriteString(g_bstr_shape2);
CString strStyle = _T("");
strStyle.Format(g_string_shape_geometry, m_lCoordSizeX, m_lCoordSizeY, m_strPath, ConvertColor(m_oBrush.Color1), ConvertColor(m_oPen.Color), m_oPen.Size);
oWriter.WriteString(strStyle);
static CString g_string_fill_opacity = _T("<v:fill opacity=\"%.2lf\"/>");
static CString g_string_stroke_opacity = _T("<v:stroke opacity=\"%.2lf\"/>");
if (c_BrushTypeTexture == m_oBrush.Type)
{
CString strImage = _T("");
strImage.Format(g_string_tx_rid, 10 + m_lTxId);
oWriter.WriteString(strImage);
oWriter.WriteString(L"<v:imagedata r:id=\"rId");
oWriter.AddInt(10 + m_lTxId);
oWriter.WriteString(L"\" o:title=\"\"/>");
if (0xFF != m_oBrush.TextureAlpha)
{
CString strFillOpacity = _T("");
strFillOpacity.Format(g_string_fill_opacity, (double)m_oBrush.TextureAlpha / 255.0);
oWriter.WriteString(strFillOpacity);
oWriter.WriteString(L"<v:fill opacity=\"");
oWriter.AddDouble((double)m_oBrush.TextureAlpha / 255.0, 2);
oWriter.WriteString(L"\"/>");
}
}
else
{
if (0xFF != m_oBrush.Alpha1)
{
CString strFillOpacity = _T("");
strFillOpacity.Format(g_string_fill_opacity, (double)m_oBrush.Alpha1 / 255.0);
oWriter.WriteString(strFillOpacity);
oWriter.WriteString(L"<v:fill opacity=\"");
oWriter.AddDouble((double)m_oBrush.Alpha1 / 255.0, 2);
oWriter.WriteString(L"\"/>");
}
if (0xFF != m_oPen.Alpha)
{
CString strPenOpacity = _T("");
strPenOpacity.Format(g_string_stroke_opacity, (double)m_oPen.Alpha / 255.0);
oWriter.WriteString(strPenOpacity);
oWriter.WriteString(L"<v:stroke opacity=\"");
oWriter.AddDouble((double)m_oPen.Alpha / 255.0, 2);
oWriter.WriteString(L"\"/>");
}
}
oWriter.WriteString(g_bstr_shape3);
oWriter.WriteString(L"<w10:wrap anchorx=\"page\" anchory=\"page\"/></v:shape></w:pict></w:r>");
}
};
}
#endif // DOCX_RENDERER_ELEMENT_SHAPE_H
#pragma once
#ifndef DOCX_RENDERER_FMB_H
#define DOCX_RENDERER_FMB_H
#include "..\stdafx.h"
#include "StringWriter.h"
#include "..\Graphics\Structures.h"
#include "..\Graphics\Matrix.h"
#include "Common.h"
#include "../DesktopEditor/fontengine/ApplicationFonts.h"
namespace NSFontManager
{
......@@ -28,10 +27,10 @@ namespace NSFontManager
double m_dSpaceWidthMM;
// font params
CString m_strFamilyName;
CString m_strPANOSE;
std::wstring m_strFamilyName;
std::wstring m_strPANOSE;
LONG m_lStyle;
CAtlArray<DWORD> m_arSignature;
CArray<DWORD> m_arSignature;
bool m_bIsFixedWidth;
LONG m_lAvgWidth;
......@@ -49,8 +48,8 @@ namespace NSFontManager
m_dSpaceWidthMM = 0;
m_strFamilyName = _T("");
m_strPANOSE = _T("");
m_strFamilyName = L"";
m_strPANOSE = L"";
m_lStyle = 0;
m_arSignature.RemoveAll();
m_bIsFixedWidth = false;
......@@ -78,7 +77,7 @@ namespace NSFontManager
m_strFamilyName = oSrc.m_strFamilyName;
m_strPANOSE = oSrc.m_strPANOSE;
m_lStyle = oSrc.m_lStyle;
m_arSignature.Copy(oSrc.m_arSignature);
m_arSignature = m_arSignature;
m_bIsFixedWidth = oSrc.m_bIsFixedWidth;
m_lAvgWidth = oSrc.m_lAvgWidth;
......@@ -92,7 +91,7 @@ namespace NSFontManager
CFontAdvanced m_oFont;
BYTE m_lRangeNum;
BYTE m_lRange;
CString m_strPickFont;
std::wstring m_strPickFont;
LONG m_lPickStyle;
public:
......@@ -100,7 +99,7 @@ namespace NSFontManager
{
m_lRangeNum = 0xFF;
m_lRange = 0xFF;
m_strPickFont = _T("");
m_strPickFont = L"";
m_lPickStyle = 0;
}
CFontPickUp(const CFontPickUp& oSrc)
......@@ -129,9 +128,9 @@ namespace NSFontManager
};
protected:
AVSGraphics::IASCWinFonts* m_pWinFonts;
AVSGraphics::IASCFontManager* m_pManager;
CString m_strDefaultFont;
CApplicationFonts* m_pFonts;
CFontManager* m_pManager;
std::wstring m_strDefaultFont;
public:
......@@ -141,8 +140,8 @@ namespace NSFontManager
BYTE m_pRanges[0xFFFF];
BYTE m_pRangesNums[0xFFFF];
CAtlList<CFontPickUp> m_arListPicUps;
CString m_strCurrentPickFont;
std::list<CFontPickUp> m_arListPicUps;
std::wstring m_strCurrentPickFont;
LONG m_lCurrentPictFontStyle;
public:
......@@ -1236,7 +1235,7 @@ namespace NSFontManager
//case 31: sUCRName = "Reserved for process-internal usage"; break;
}
__forceinline bool GetRange(const WCHAR& symbol, BYTE& lRangeNum, BYTE& lRange)
inline bool GetRange(const WCHAR& symbol, BYTE& lRangeNum, BYTE& lRange)
{
lRangeNum = m_pRangesNums[symbol];
lRange = m_pRanges[symbol];
......@@ -1244,10 +1243,10 @@ namespace NSFontManager
return (0xFF != lRangeNum);
}
__forceinline void CheckRanges(DWORD& lRange1, DWORD& lRange2, DWORD& lRange3, DWORD& lRange4, CString strText)
inline void CheckRanges(DWORD& lRange1, DWORD& lRange2, DWORD& lRange3, DWORD& lRange4, const std::wstring& strText)
{
int lCount = strText.GetLength();
WCHAR* pData = strText.GetBuffer();
int lCount = (int)strText.length();
WCHAR* pData = strText.c_str();
BYTE lRangeNum = 0xFF;
BYTE lRange = 0xFF;
......@@ -1266,7 +1265,7 @@ namespace NSFontManager
}
}
}
__forceinline void CheckRanges(DWORD& lRange1, DWORD& lRange2, DWORD& lRange3, DWORD& lRange4, BYTE& lRangeNum, BYTE& lRange)
inline void CheckRanges(DWORD& lRange1, DWORD& lRange2, DWORD& lRange3, DWORD& lRange4, BYTE& lRangeNum, BYTE& lRange)
{
if (0 == lRangeNum)
lRange1 |= 1 << lRange;
......@@ -1372,3 +1371,5 @@ namespace NSFontManager
}
};
};
#endif // DOCX_RENDERER_FMB_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