mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Develop gradient support (in porgress)
This commit is contained in:
@ -458,13 +458,11 @@ HRESULT CDocxRenderer::BrushRect(const INT& nVal, const double& dLeft, const dou
|
|||||||
}
|
}
|
||||||
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)
|
||||||
{
|
{
|
||||||
// TODO:
|
return m_pInternal->m_oDocument.BrushBounds(dLeft, dTop, dWidth, dHeight);
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
HRESULT CDocxRenderer::put_BrushGradientColors(LONG* pColors, double* pPositions, LONG lCount)
|
HRESULT CDocxRenderer::put_BrushGradientColors(LONG* pColors, double* pPositions, LONG lCount)
|
||||||
{
|
{
|
||||||
// TODO:
|
return m_pInternal->m_oDocument.put_BrushGradientColors(pColors, pPositions, lCount);
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
HRESULT CDocxRenderer::get_BrushTextureImage(Aggplus::CImage** pImage)
|
HRESULT CDocxRenderer::get_BrushTextureImage(Aggplus::CImage** pImage)
|
||||||
{
|
{
|
||||||
@ -485,6 +483,11 @@ HRESULT CDocxRenderer::put_BrushTextureImage(Aggplus::CImage* pImage)
|
|||||||
}
|
}
|
||||||
HRESULT CDocxRenderer::get_BrushTransform(Aggplus::CMatrix& oMatrix) { return S_OK; }
|
HRESULT CDocxRenderer::get_BrushTransform(Aggplus::CMatrix& oMatrix) { return S_OK; }
|
||||||
HRESULT CDocxRenderer::put_BrushTransform(const Aggplus::CMatrix& oMatrix) { return S_OK; }
|
HRESULT CDocxRenderer::put_BrushTransform(const Aggplus::CMatrix& oMatrix) { return S_OK; }
|
||||||
|
void CDocxRenderer::put_BrushGradInfo(void* pGradInfo)
|
||||||
|
{
|
||||||
|
m_pInternal->m_oDocument.m_oBrush.m_oGradientInfo = *((NSStructures::GradientInfo*)pGradInfo);
|
||||||
|
m_pInternal->m_oDocument.m_oCurrentPage.m_bIsGradient = true;
|
||||||
|
}
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Функции для работы со шрифтами
|
// Функции для работы со шрифтами
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -121,6 +121,7 @@ public:
|
|||||||
virtual HRESULT put_BrushTextureImage(Aggplus::CImage* pImage);
|
virtual HRESULT put_BrushTextureImage(Aggplus::CImage* pImage);
|
||||||
virtual HRESULT get_BrushTransform(Aggplus::CMatrix& oMatrix);
|
virtual HRESULT get_BrushTransform(Aggplus::CMatrix& oMatrix);
|
||||||
virtual HRESULT put_BrushTransform(const Aggplus::CMatrix& oMatrix);
|
virtual HRESULT put_BrushTransform(const Aggplus::CMatrix& oMatrix);
|
||||||
|
virtual void put_BrushGradInfo(void* pGradInfo) override;
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// Функции для работы со шрифтами
|
// Функции для работы со шрифтами
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -285,6 +285,26 @@ namespace NSDocxRenderer
|
|||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
HRESULT CDocument::BrushBounds(const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight)
|
||||||
|
{
|
||||||
|
m_oBrush.Bounds.left = dLeft;
|
||||||
|
m_oBrush.Bounds.top = dTop;
|
||||||
|
m_oBrush.Bounds.right = dLeft + dWidth;
|
||||||
|
m_oBrush.Bounds.bottom = dTop + dHeight;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
HRESULT CDocument::put_BrushGradientColors(LONG* pColors, double* pPositions, LONG lCount)
|
||||||
|
{
|
||||||
|
m_oBrush.m_arrSubColors.clear();
|
||||||
|
for (LONG i = 0; i < lCount; ++i)
|
||||||
|
{
|
||||||
|
NSStructures::CBrush::TSubColor color;
|
||||||
|
color.color = pColors[i];
|
||||||
|
color.position = (long)(pPositions[i] * 65536);
|
||||||
|
m_oBrush.m_arrSubColors.push_back(color);
|
||||||
|
}
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
// font -------------------------------------------------------------------------------------
|
// font -------------------------------------------------------------------------------------
|
||||||
HRESULT CDocument::get_FontName(std::wstring* sName)
|
HRESULT CDocument::get_FontName(std::wstring* sName)
|
||||||
{
|
{
|
||||||
@ -814,6 +834,7 @@ namespace NSDocxRenderer
|
|||||||
&m_oEdge,
|
&m_oEdge,
|
||||||
&m_oTransform,
|
&m_oTransform,
|
||||||
&m_oSimpleGraphicsConverter,
|
&m_oSimpleGraphicsConverter,
|
||||||
|
&m_oImageManager,
|
||||||
&m_oFontStyleManager,
|
&m_oFontStyleManager,
|
||||||
&m_oFontManager,
|
&m_oFontManager,
|
||||||
&m_oFontSelector,
|
&m_oFontSelector,
|
||||||
|
|||||||
@ -105,6 +105,8 @@ namespace NSDocxRenderer
|
|||||||
HRESULT get_BrushLinearAngle(double* dAngle);
|
HRESULT get_BrushLinearAngle(double* dAngle);
|
||||||
HRESULT put_BrushLinearAngle(double dAngle);
|
HRESULT put_BrushLinearAngle(double dAngle);
|
||||||
HRESULT BrushRect(bool val, double left, double top, double width, double height);
|
HRESULT BrushRect(bool val, double left, double top, double width, double height);
|
||||||
|
HRESULT BrushBounds(const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight);
|
||||||
|
HRESULT put_BrushGradientColors(LONG* pColors, double* pPositions, LONG lCount);
|
||||||
// font -------------------------------------------------------------------------------------
|
// font -------------------------------------------------------------------------------------
|
||||||
HRESULT get_FontName(std::wstring* sName);
|
HRESULT get_FontName(std::wstring* sName);
|
||||||
HRESULT put_FontName(std::wstring sName);
|
HRESULT put_FontName(std::wstring sName);
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "../../../DesktopEditor/graphics/GraphicsPath.h"
|
#include "../../../DesktopEditor/graphics/GraphicsPath.h"
|
||||||
|
#include "../../../DesktopEditor/graphics/pro/Graphics.h"
|
||||||
|
|
||||||
#include "elements/DropCap.h"
|
#include "elements/DropCap.h"
|
||||||
#include "../resources/Constants.h"
|
#include "../resources/Constants.h"
|
||||||
@ -14,17 +15,19 @@ namespace NSDocxRenderer
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPage::Init(NSStructures::CFont* pFont,
|
void CPage::Init(
|
||||||
NSStructures::CPen* pPen,
|
NSStructures::CFont* pFont,
|
||||||
NSStructures::CBrush* pBrush,
|
NSStructures::CPen* pPen,
|
||||||
NSStructures::CShadow* pShadow,
|
NSStructures::CBrush* pBrush,
|
||||||
NSStructures::CEdgeText* pEdge,
|
NSStructures::CShadow* pShadow,
|
||||||
Aggplus::CMatrix* pMatrix,
|
NSStructures::CEdgeText* pEdge,
|
||||||
Aggplus::CGraphicsPathSimpleConverter* pSimple,
|
Aggplus::CMatrix* pMatrix,
|
||||||
CFontStyleManager* pFontStyleManager,
|
Aggplus::CGraphicsPathSimpleConverter* pSimple,
|
||||||
CFontManager *pFontManager,
|
CImageManager* pImageManager,
|
||||||
CFontSelector* pFontSelector,
|
CFontStyleManager* pFontStyleManager,
|
||||||
CParagraphStyleManager* pParagraphStyleManager)
|
CFontManager *pFontManager,
|
||||||
|
CFontSelector* pFontSelector,
|
||||||
|
CParagraphStyleManager* pParagraphStyleManager)
|
||||||
{
|
{
|
||||||
m_pFont = pFont;
|
m_pFont = pFont;
|
||||||
m_pPen = pPen;
|
m_pPen = pPen;
|
||||||
@ -35,6 +38,7 @@ namespace NSDocxRenderer
|
|||||||
m_pTransform = pMatrix;
|
m_pTransform = pMatrix;
|
||||||
m_pSimpleGraphicsConverter = pSimple;
|
m_pSimpleGraphicsConverter = pSimple;
|
||||||
|
|
||||||
|
m_pImageManager = pImageManager;
|
||||||
m_pFontStyleManager = pFontStyleManager;
|
m_pFontStyleManager = pFontStyleManager;
|
||||||
m_pFontManager = pFontManager;
|
m_pFontManager = pFontManager;
|
||||||
m_pFontSelector = pFontSelector;
|
m_pFontSelector = pFontSelector;
|
||||||
@ -171,6 +175,8 @@ namespace NSDocxRenderer
|
|||||||
double right = m_oCurrVectorGraphics.GetRight();
|
double right = m_oCurrVectorGraphics.GetRight();
|
||||||
double top = m_oCurrVectorGraphics.GetTop();
|
double top = m_oCurrVectorGraphics.GetTop();
|
||||||
double bot = m_oCurrVectorGraphics.GetBottom();
|
double bot = m_oCurrVectorGraphics.GetBottom();
|
||||||
|
double width = right - left;
|
||||||
|
double height = bot - top;
|
||||||
|
|
||||||
if (!m_arShapes.empty())
|
if (!m_arShapes.empty())
|
||||||
{
|
{
|
||||||
@ -193,45 +199,29 @@ namespace NSDocxRenderer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pShape = std::make_shared<CShape>();
|
auto shape = std::make_shared<CShape>();
|
||||||
if (pInfo)
|
|
||||||
{
|
|
||||||
pShape->m_pImageInfo = pInfo;
|
|
||||||
pShape->m_eType = CShape::eShapeType::stVectorTexture;
|
|
||||||
|
|
||||||
pShape->m_dImageBot = m_oCurrVectorGraphics.GetBottom();
|
|
||||||
pShape->m_dImageTop = m_oCurrVectorGraphics.GetTop();
|
|
||||||
pShape->m_dImageLeft = m_oCurrVectorGraphics.GetLeft();
|
|
||||||
pShape->m_dImageRight = m_oCurrVectorGraphics.GetRight();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pShape->m_eType = CShape::eShapeType::stVectorGraphics;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0x00 != (lType & 0x01))
|
if (0x00 != (lType & 0x01))
|
||||||
{
|
{
|
||||||
pShape->m_bIsNoStroke = false;
|
shape->m_bIsNoStroke = false;
|
||||||
pShape->m_oPen = *m_pPen;
|
shape->m_oPen = *m_pPen;
|
||||||
}
|
}
|
||||||
if (0x00 != (lType >> 8))
|
if (0x00 != (lType >> 8))
|
||||||
{
|
{
|
||||||
pShape->m_bIsNoFill = false;
|
shape->m_bIsNoFill = false;
|
||||||
pShape->m_oBrush = *m_pBrush;
|
shape->m_oBrush = *m_pBrush;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pShape->m_bIsNoStroke)
|
if (shape->m_bIsNoStroke)
|
||||||
{
|
{
|
||||||
if ((fabs(left - right) < 0.3) || (fabs(top - bot) < 0.3))
|
if ((fabs(left - right) < 0.3) || (fabs(top - bot) < 0.3))
|
||||||
{
|
{
|
||||||
pShape->m_oPen.Color = m_pBrush->Color1;
|
shape->m_oPen.Color = m_pBrush->Color1;
|
||||||
pShape->m_oPen.Alpha = m_pBrush->Alpha1;
|
shape->m_oPen.Alpha = m_pBrush->Alpha1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double dDeterminant = sqrt(fabs(m_pTransform->Determinant()));
|
double dDeterminant = sqrt(fabs(m_pTransform->Determinant()));
|
||||||
pShape->m_oPen.Size *= dDeterminant;
|
shape->m_oPen.Size *= dDeterminant;
|
||||||
|
|
||||||
|
|
||||||
if (!m_oClipVectorGraphics.IsEmpty())
|
if (!m_oClipVectorGraphics.IsEmpty())
|
||||||
{
|
{
|
||||||
@ -241,30 +231,80 @@ namespace NSDocxRenderer
|
|||||||
m_lClipMode);
|
m_lClipMode);
|
||||||
m_oCurrVectorGraphics = std::move(new_vector_graphics);
|
m_oCurrVectorGraphics = std::move(new_vector_graphics);
|
||||||
}
|
}
|
||||||
|
shape->SetVector(std::move(m_oCurrVectorGraphics));
|
||||||
|
|
||||||
pShape->SetVector(std::move(m_oCurrVectorGraphics));
|
auto info = pInfo;
|
||||||
|
if (!info && m_bIsGradient)
|
||||||
|
{
|
||||||
|
const int width_pix = shape->m_dWidth * c_dMMToPt;
|
||||||
|
const int height_pix = shape->m_dHeight * c_dMMToPt;
|
||||||
|
const int step = 4;
|
||||||
|
const int stride = step * width;
|
||||||
|
|
||||||
|
std::unique_ptr<CBgraFrame> frame(new CBgraFrame());
|
||||||
|
size_t data_size = width_pix * height_pix * step;
|
||||||
|
BYTE* data = new BYTE[data_size] {};
|
||||||
|
|
||||||
|
frame->put_Data(data);
|
||||||
|
frame->put_Height(height_pix);
|
||||||
|
frame->put_Width(width_pix);
|
||||||
|
frame->put_Stride(stride);
|
||||||
|
|
||||||
|
NSGraphics::IGraphicsRenderer* g_renderer = NSGraphics::Create();
|
||||||
|
g_renderer->CreateFromBgraFrame(frame.get());
|
||||||
|
|
||||||
|
Aggplus::CDoubleRect prev_bounds = m_pBrush->Bounds;
|
||||||
|
m_pBrush->Bounds.left = shape->m_dLeft;
|
||||||
|
m_pBrush->Bounds.right = shape->m_dRight;
|
||||||
|
m_pBrush->Bounds.bottom = shape->m_dBaselinePos;
|
||||||
|
m_pBrush->Bounds.top = shape->m_dTop;
|
||||||
|
|
||||||
|
g_renderer->RestoreBrush(*m_pBrush);
|
||||||
|
g_renderer->AddRect(0, 0, shape->m_dWidth, shape->m_dHeight);
|
||||||
|
g_renderer->DrawPath(c_nWindingFillMode);
|
||||||
|
m_pBrush->Bounds = prev_bounds;
|
||||||
|
|
||||||
|
Aggplus::CImage img;
|
||||||
|
img.Create(data, width_pix, height_pix, stride, true);
|
||||||
|
info = m_pImageManager->WriteImage(&img, shape->m_dTop, shape->m_dBaselinePos, shape->m_dWidth, shape->m_dHeight);
|
||||||
|
m_bIsGradient = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info)
|
||||||
|
{
|
||||||
|
shape->m_pImageInfo = info;
|
||||||
|
shape->m_eType = CShape::eShapeType::stVectorTexture;
|
||||||
|
|
||||||
|
shape->m_dImageBot = m_oCurrVectorGraphics.GetBottom();
|
||||||
|
shape->m_dImageTop = m_oCurrVectorGraphics.GetTop();
|
||||||
|
shape->m_dImageLeft = m_oCurrVectorGraphics.GetLeft();
|
||||||
|
shape->m_dImageRight = m_oCurrVectorGraphics.GetRight();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
shape->m_eType = CShape::eShapeType::stVectorGraphics;
|
||||||
|
|
||||||
// big white shape with page width & height skip
|
// big white shape with page width & height skip
|
||||||
if (fabs(pShape->m_dHeight - m_dHeight) <= c_dSHAPE_X_OFFSET * 2 &&
|
if (fabs(shape->m_dHeight - m_dHeight) <= c_dSHAPE_X_OFFSET * 2 &&
|
||||||
fabs(pShape->m_dWidth - m_dWidth) <= c_dSHAPE_X_OFFSET * 2 &&
|
fabs(shape->m_dWidth - m_dWidth) <= c_dSHAPE_X_OFFSET * 2 &&
|
||||||
pShape->m_oBrush.Color1 == c_iWhiteColor)
|
shape->m_oBrush.Color1 == c_iWhiteColor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pShape->m_nOrder = ++m_nShapeOrder;
|
shape->m_nOrder = ++m_nShapeOrder;
|
||||||
pShape->m_dRotation = rotation;
|
shape->m_dRotation = rotation;
|
||||||
m_arShapes.push_back(pShape);
|
m_arShapes.push_back(shape);
|
||||||
|
|
||||||
m_oClipVectorGraphics.Clear();
|
m_oClipVectorGraphics.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPage::CollectTextData(const PUINT pUnicodes,
|
void CPage::CollectTextData(
|
||||||
const PUINT pGids,
|
const PUINT pUnicodes,
|
||||||
const UINT& nCount,
|
const PUINT pGids,
|
||||||
const double& fX,
|
const UINT& nCount,
|
||||||
const double& fY,
|
const double& fX,
|
||||||
const double& fWidth,
|
const double& fY,
|
||||||
const double& fHeight,
|
const double& fWidth,
|
||||||
const double& fBaseLineOffset)
|
const double& fHeight,
|
||||||
|
const double& fBaseLineOffset)
|
||||||
{
|
{
|
||||||
// 9 - \t
|
// 9 - \t
|
||||||
if (*pUnicodes == 9)
|
if (*pUnicodes == 9)
|
||||||
@ -337,9 +377,10 @@ namespace NSDocxRenderer
|
|||||||
m_pCurrCont->m_pFontStyle->UpdateAvgSpaceWidth(avg_width);
|
m_pCurrCont->m_pFontStyle->UpdateAvgSpaceWidth(avg_width);
|
||||||
|
|
||||||
double avg_space_width = m_pCurrCont->m_pFontStyle->GetAvgSpaceWidth();
|
double avg_space_width = m_pCurrCont->m_pFontStyle->GetAvgSpaceWidth();
|
||||||
double space_width = avg_space_width != 0.0 ?
|
double space_width =
|
||||||
avg_space_width * c_dAVERAGE_SPACE_WIDTH_COEF :
|
avg_space_width != 0.0 ?
|
||||||
m_pCurrCont->CalculateSpace() * c_dSPACE_WIDTH_COEF;
|
avg_space_width * c_dAVERAGE_SPACE_WIDTH_COEF :
|
||||||
|
m_pCurrCont->CalculateSpace() * c_dSPACE_WIDTH_COEF;
|
||||||
|
|
||||||
bool is_added = false;
|
bool is_added = false;
|
||||||
|
|
||||||
@ -394,11 +435,12 @@ namespace NSDocxRenderer
|
|||||||
|
|
||||||
// первичное получение стиля для текущего символа
|
// первичное получение стиля для текущего символа
|
||||||
// при дальнейшем анализе может измениться
|
// при дальнейшем анализе может измениться
|
||||||
pCont->m_pFontStyle = m_pFontStyleManager->GetOrAddFontStyle(*m_pBrush,
|
pCont->m_pFontStyle = m_pFontStyleManager->GetOrAddFontStyle(
|
||||||
m_pFontSelector->GetSelectedName(),
|
*m_pBrush,
|
||||||
m_pFont->Size,
|
m_pFontSelector->GetSelectedName(),
|
||||||
m_pFontSelector->IsSelectedItalic(),
|
m_pFont->Size,
|
||||||
m_pFontSelector->IsSelectedBold() || bForcedBold);
|
m_pFontSelector->IsSelectedItalic(),
|
||||||
|
m_pFontSelector->IsSelectedBold() || bForcedBold);
|
||||||
|
|
||||||
// just in case if oText contains more than 1 symbol
|
// just in case if oText contains more than 1 symbol
|
||||||
std::vector<double> ar_widths;
|
std::vector<double> ar_widths;
|
||||||
@ -937,11 +979,12 @@ namespace NSDocxRenderer
|
|||||||
auto oBrush = curr_cont->m_pFontStyle->oBrush;
|
auto oBrush = curr_cont->m_pFontStyle->oBrush;
|
||||||
oBrush.Color1 = shape->m_oPen.Color;
|
oBrush.Color1 = shape->m_oPen.Color;
|
||||||
|
|
||||||
curr_cont->m_pFontStyle = m_pFontStyleManager->GetOrAddFontStyle(oBrush,
|
curr_cont->m_pFontStyle = m_pFontStyleManager->GetOrAddFontStyle(
|
||||||
curr_cont->m_pFontStyle->wsFontName,
|
oBrush,
|
||||||
curr_cont->m_pFontStyle->dFontSize,
|
curr_cont->m_pFontStyle->wsFontName,
|
||||||
curr_cont->m_pFontStyle->bItalic,
|
curr_cont->m_pFontStyle->dFontSize,
|
||||||
curr_cont->m_pFontStyle->bBold);
|
curr_cont->m_pFontStyle->bItalic,
|
||||||
|
curr_cont->m_pFontStyle->bBold);
|
||||||
|
|
||||||
curr_cont->m_bIsShadowPresent = true;
|
curr_cont->m_bIsShadowPresent = true;
|
||||||
curr_cont->m_bIsOutlinePresent = true;
|
curr_cont->m_bIsOutlinePresent = true;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "../../../DesktopEditor/graphics/GraphicsPath.h"
|
|
||||||
|
|
||||||
#include "elements/Paragraph.h"
|
#include "elements/Paragraph.h"
|
||||||
#include "elements/Shape.h"
|
#include "elements/Shape.h"
|
||||||
|
#include "managers/ImageManager.h"
|
||||||
#include "managers/FontStyleManager.h"
|
#include "managers/FontStyleManager.h"
|
||||||
#include "managers/ParagraphStyleManager.h"
|
#include "managers/ParagraphStyleManager.h"
|
||||||
#include "convert_params.h"
|
#include "convert_params.h"
|
||||||
@ -17,6 +17,7 @@ namespace NSDocxRenderer
|
|||||||
|
|
||||||
LONG m_lCurrentCommand{0};
|
LONG m_lCurrentCommand{0};
|
||||||
LONG m_lClipMode{0};
|
LONG m_lClipMode{0};
|
||||||
|
bool m_bIsGradient = false;
|
||||||
|
|
||||||
TextAssociationType m_eTextAssociationType {TextAssociationType::tatPlainParagraph};
|
TextAssociationType m_eTextAssociationType {TextAssociationType::tatPlainParagraph};
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ namespace NSDocxRenderer
|
|||||||
Aggplus::CMatrix* m_pTransform {nullptr};
|
Aggplus::CMatrix* m_pTransform {nullptr};
|
||||||
Aggplus::CGraphicsPathSimpleConverter* m_pSimpleGraphicsConverter{nullptr};
|
Aggplus::CGraphicsPathSimpleConverter* m_pSimpleGraphicsConverter{nullptr};
|
||||||
|
|
||||||
|
CImageManager* m_pImageManager {nullptr};
|
||||||
CFontStyleManager* m_pFontStyleManager {nullptr};
|
CFontStyleManager* m_pFontStyleManager {nullptr};
|
||||||
CParagraphStyleManager* m_pParagraphStyleManager{nullptr};
|
CParagraphStyleManager* m_pParagraphStyleManager{nullptr};
|
||||||
CFontManager* m_pFontManager {nullptr};
|
CFontManager* m_pFontManager {nullptr};
|
||||||
@ -54,17 +56,19 @@ namespace NSDocxRenderer
|
|||||||
CPage();
|
CPage();
|
||||||
~CPage();
|
~CPage();
|
||||||
|
|
||||||
void Init(NSStructures::CFont* pFont,
|
void Init(
|
||||||
NSStructures::CPen* pPen,
|
NSStructures::CFont* pFont,
|
||||||
NSStructures::CBrush* pBrush,
|
NSStructures::CPen* pPen,
|
||||||
NSStructures::CShadow* pShadow,
|
NSStructures::CBrush* pBrush,
|
||||||
NSStructures::CEdgeText* pEdge,
|
NSStructures::CShadow* pShadow,
|
||||||
Aggplus::CMatrix* pMatrix,
|
NSStructures::CEdgeText* pEdge,
|
||||||
Aggplus::CGraphicsPathSimpleConverter* pSimple,
|
Aggplus::CMatrix* pMatrix,
|
||||||
CFontStyleManager* pStyleManager,
|
Aggplus::CGraphicsPathSimpleConverter* pSimple,
|
||||||
CFontManager *pFontManager,
|
CImageManager* pImageManager,
|
||||||
CFontSelector* pFontSelector,
|
CFontStyleManager* pStyleManager,
|
||||||
CParagraphStyleManager* pParagraphStyleManager);
|
CFontManager *pFontManager,
|
||||||
|
CFontSelector* pFontSelector,
|
||||||
|
CParagraphStyleManager* pParagraphStyleManager);
|
||||||
|
|
||||||
void BeginCommand(DWORD lType);
|
void BeginCommand(DWORD lType);
|
||||||
void EndCommand(DWORD lType);
|
void EndCommand(DWORD lType);
|
||||||
@ -87,14 +91,15 @@ namespace NSDocxRenderer
|
|||||||
//набивается содержимым вектор m_arShapes
|
//набивается содержимым вектор m_arShapes
|
||||||
void DrawPath(LONG lType, const std::shared_ptr<CImageInfo> pInfo);
|
void DrawPath(LONG lType, const std::shared_ptr<CImageInfo> pInfo);
|
||||||
|
|
||||||
void CollectTextData(const PUINT pUnicodes,
|
void CollectTextData(
|
||||||
const PUINT pGids,
|
const PUINT pUnicodes,
|
||||||
const UINT& nCount,
|
const PUINT pGids,
|
||||||
const double& fX,
|
const UINT& nCount,
|
||||||
const double& fY,
|
const double& fX,
|
||||||
const double& fWidth,
|
const double& fY,
|
||||||
const double& fHeight,
|
const double& fWidth,
|
||||||
const double& fBaseLineOffset);
|
const double& fHeight,
|
||||||
|
const double& fBaseLineOffset);
|
||||||
|
|
||||||
void Analyze();
|
void Analyze();
|
||||||
void Record(NSStringUtils::CStringBuilder& oWriter, bool bIsLastPage);
|
void Record(NSStringUtils::CStringBuilder& oWriter, bool bIsLastPage);
|
||||||
@ -147,7 +152,6 @@ namespace NSDocxRenderer
|
|||||||
std::shared_ptr<CContText> m_pCurrCont {nullptr};
|
std::shared_ptr<CContText> m_pCurrCont {nullptr};
|
||||||
NSStructures::CFont m_oPrevFont;
|
NSStructures::CFont m_oPrevFont;
|
||||||
NSStructures::CBrush m_oPrevBrush;
|
NSStructures::CBrush m_oPrevBrush;
|
||||||
|
|
||||||
size_t m_nShapeOrder = 0;
|
size_t m_nShapeOrder = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,17 +26,19 @@ namespace NSDocxRenderer
|
|||||||
|
|
||||||
std::shared_ptr<CFontStyle> CFontStyleManager::GetOrAddFontStyle(const CFontStyle& oFontStyle)
|
std::shared_ptr<CFontStyle> CFontStyleManager::GetOrAddFontStyle(const CFontStyle& oFontStyle)
|
||||||
{
|
{
|
||||||
return GetOrAddFontStyle(oFontStyle.oBrush,
|
return GetOrAddFontStyle(
|
||||||
oFontStyle.wsFontName,
|
oFontStyle.oBrush,
|
||||||
oFontStyle.dFontSize,
|
oFontStyle.wsFontName,
|
||||||
oFontStyle.bItalic,
|
oFontStyle.dFontSize,
|
||||||
oFontStyle.bBold);
|
oFontStyle.bItalic,
|
||||||
|
oFontStyle.bBold);
|
||||||
}
|
}
|
||||||
std::shared_ptr<CFontStyle> CFontStyleManager::GetOrAddFontStyle(const NSStructures::CBrush& oBrush,
|
std::shared_ptr<CFontStyle> CFontStyleManager::GetOrAddFontStyle(
|
||||||
const std::wstring& wsFontName,
|
const NSStructures::CBrush& oBrush,
|
||||||
double dFontSize,
|
const std::wstring& wsFontName,
|
||||||
bool bItalic,
|
double dFontSize,
|
||||||
bool bBold)
|
bool bItalic,
|
||||||
|
bool bBold)
|
||||||
{
|
{
|
||||||
for(auto it = m_arFontStyles.begin(); it != m_arFontStyles.end(); ++it)
|
for(auto it = m_arFontStyles.begin(); it != m_arFontStyles.end(); ++it)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -15,11 +15,12 @@ namespace NSDocxRenderer
|
|||||||
void ToXml(NSStringUtils::CStringBuilder& oWriter);
|
void ToXml(NSStringUtils::CStringBuilder& oWriter);
|
||||||
|
|
||||||
std::shared_ptr<CFontStyle> GetOrAddFontStyle(const CFontStyle& oFontStyle);
|
std::shared_ptr<CFontStyle> GetOrAddFontStyle(const CFontStyle& oFontStyle);
|
||||||
std::shared_ptr<CFontStyle> GetOrAddFontStyle(const NSStructures::CBrush& oBrush,
|
std::shared_ptr<CFontStyle> GetOrAddFontStyle(
|
||||||
const std::wstring& wsFontName,
|
const NSStructures::CBrush& oBrush,
|
||||||
double dFontSize,
|
const std::wstring& wsFontName,
|
||||||
bool bItalic,
|
double dFontSize,
|
||||||
bool bBold);
|
bool bItalic,
|
||||||
|
bool bBold);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::list<std::shared_ptr<CFontStyle>> m_arFontStyles;
|
std::list<std::shared_ptr<CFontStyle>> m_arFontStyles;
|
||||||
|
|||||||
Reference in New Issue
Block a user