mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
FontStyles refactoring
This commit is contained in:
@ -35,10 +35,9 @@ HEADERS += \
|
||||
src/logic/elements/Shape.h \
|
||||
src/logic/elements/Table.h \
|
||||
src/logic/elements/TextLine.h \
|
||||
src/logic/managers/FontStyleManager.h \
|
||||
src/logic/managers/ImageManager.h \
|
||||
src/logic/managers/FontManager.h \
|
||||
src/logic/managers/StyleManager.h \
|
||||
src/logic/styles/BaseStyle.h \
|
||||
src/logic/styles/FontStyle.h \
|
||||
src/resources/ColorTable.h \
|
||||
src/resources/Constants.h \
|
||||
@ -63,8 +62,8 @@ SOURCES += \
|
||||
src/logic/elements/Table.cpp \
|
||||
src/logic/elements/TextLine.cpp \
|
||||
src/logic/managers/FontManager.cpp \
|
||||
src/logic/managers/FontStyleManager.cpp \
|
||||
src/logic/managers/ImageManager.cpp \
|
||||
src/logic/managers/StyleManager.cpp \
|
||||
src/logic/styles/FontStyle.cpp \
|
||||
src/logic/Page.cpp \
|
||||
src/logic/Document.cpp \
|
||||
|
||||
@ -812,10 +812,10 @@ namespace NSDocxRenderer
|
||||
Clear();
|
||||
|
||||
m_lCurrentCommandType = 0;
|
||||
m_oCurrentPage.Init(&m_oFont, &m_oPen, &m_oBrush, &m_oShadow, &m_oEdge, &m_oTransform, &m_oSimpleGraphicsConverter, &m_oStyleManager, &m_oFontManager, &m_oFontSelector);
|
||||
m_oCurrentPage.Init(&m_oFont, &m_oPen, &m_oBrush, &m_oShadow, &m_oEdge, &m_oTransform, &m_oSimpleGraphicsConverter, &m_oFontStyleManager, &m_oFontManager, &m_oFontSelector);
|
||||
|
||||
m_oImageManager.NewDocument();
|
||||
m_oStyleManager.NewDocument();
|
||||
m_oFontStyleManager.NewDocument();
|
||||
|
||||
// media
|
||||
m_oImageManager.m_strDstMedia = m_strTempDirectory + L"/word/media";
|
||||
@ -1212,10 +1212,8 @@ namespace NSDocxRenderer
|
||||
oWriter.WriteString(L"</w:tblPr>");
|
||||
oWriter.WriteString(L"</w:style>");
|
||||
|
||||
for (size_t i = 0; i < m_oStyleManager.m_arStyles.size(); ++i)
|
||||
{
|
||||
m_oStyleManager.m_arStyles[i]->ToXml(oWriter);
|
||||
}
|
||||
|
||||
m_oFontStyleManager.ToXml(oWriter);
|
||||
|
||||
oWriter.WriteString(L"</w:styles>");
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#include "../DesktopEditor/common/Directory.h"
|
||||
#include "../resources/resources.h"
|
||||
#include "managers/ImageManager.h"
|
||||
#include "managers/StyleManager.h"
|
||||
#include "managers/FontStyleManager.h"
|
||||
|
||||
namespace NSDocxRenderer
|
||||
{
|
||||
@ -31,7 +31,7 @@ namespace NSDocxRenderer
|
||||
CPage m_oCurrentPage;
|
||||
|
||||
CImageManager m_oImageManager;
|
||||
CStyleManager m_oStyleManager;
|
||||
CFontStyleManager m_oFontStyleManager;
|
||||
CFontManager m_oFontManager;
|
||||
CFontSelector m_oFontSelector;
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ namespace NSDocxRenderer
|
||||
|
||||
void CPage::Init(NSStructures::CFont* pFont, NSStructures::CPen* pPen, NSStructures::CBrush* pBrush,
|
||||
NSStructures::CShadow* pShadow, NSStructures::CEdgeText* pEdge, Aggplus::CMatrix* pMatrix,
|
||||
Aggplus::CGraphicsPathSimpleConverter* pSimple, CStyleManager* pStyleManager, CFontManager *pFontManager,
|
||||
Aggplus::CGraphicsPathSimpleConverter* pSimple, CFontStyleManager* pFontStyleManager, CFontManager *pFontManager,
|
||||
CFontSelector* pFontSelector)
|
||||
{
|
||||
m_pFont = pFont;
|
||||
@ -25,7 +25,7 @@ namespace NSDocxRenderer
|
||||
m_pTransform = pMatrix;
|
||||
m_pSimpleGraphicsConverter = pSimple;
|
||||
|
||||
m_pStyleManager = pStyleManager;
|
||||
m_pFontStyleManager = pFontStyleManager;
|
||||
m_pFontManager = pFontManager;
|
||||
m_pFontSelector = pFontSelector;
|
||||
|
||||
@ -415,21 +415,13 @@ namespace NSDocxRenderer
|
||||
|
||||
pCont->m_oText = oText;
|
||||
|
||||
//Первичное заполнение стилей
|
||||
m_pStyleManager->m_pCurrentStyle->m_oFont = *m_pFont;
|
||||
m_pStyleManager->m_pCurrentStyle->m_oBrush = *m_pBrush;
|
||||
|
||||
m_pStyleManager->m_pCurrentStyle->m_strPickFontName = m_pFontSelector->GetSelectedName();
|
||||
|
||||
long lStyle = 0;
|
||||
if (m_pFontSelector->IsSelectedBold()) lStyle |= 0x01;
|
||||
if (m_pFontSelector->IsSelectedItalic()) lStyle |= 0x02;
|
||||
|
||||
m_pStyleManager->m_pCurrentStyle->m_lPickFontStyle = lStyle;
|
||||
|
||||
//первичное получение стиля для текущего символа
|
||||
//при дальнейшем анализе может измениться
|
||||
pCont->m_pFontStyle = m_pStyleManager->GetStyle();
|
||||
// первичное получение стиля для текущего символа
|
||||
// при дальнейшем анализе может измениться
|
||||
pCont->m_pFontStyle = m_pFontStyleManager->GetOrAddFontStyle(*m_pBrush,
|
||||
m_pFontSelector->GetSelectedName(),
|
||||
m_pFont->Size,
|
||||
m_pFontSelector->IsSelectedItalic(),
|
||||
m_pFontSelector->IsSelectedBold());
|
||||
pCont->m_dSpaceWidthMM = m_pFontManager->GetSpaceWidthMM();
|
||||
|
||||
// собираем отдельно, т.к. такие символы не имею размера m_dWidth
|
||||
@ -1029,6 +1021,7 @@ namespace NSDocxRenderer
|
||||
|
||||
void CPage::DetermineStrikeoutsUnderlinesHighlights()
|
||||
{
|
||||
|
||||
//определение различных эффектов на основании взаимного расположения символов и шейпов
|
||||
for (size_t i = 0; i < m_arShapes.size(); ++i)
|
||||
{
|
||||
@ -1057,7 +1050,6 @@ namespace NSDocxRenderer
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
eVerticalCrossingType eVType = pCurrCont->GetVerticalCrossingType(pShape);
|
||||
eHorizontalCrossingType eHType = pCurrCont->GetHorizontalCrossingType(pShape);
|
||||
|
||||
@ -1096,7 +1088,7 @@ namespace NSDocxRenderer
|
||||
|
||||
if (!bIsComplicatedFigure)
|
||||
{
|
||||
bool bIf1 = pCurrCont->m_pFontStyle->m_oBrush.Color1 == c_iGreyColor;
|
||||
bool bIf1 = pCurrCont->m_pFontStyle->GetBrush().Color1 == c_iGreyColor;
|
||||
bool bIf2 = pCurrCont->m_bIsShadowPresent && pCurrCont->m_bIsOutlinePresent;
|
||||
bool bIf3 = eVType == eVerticalCrossingType::vctCurrentOutsideNext;
|
||||
bool bIf4 = eHType == eHorizontalCrossingType::hctCurrentOutsideNext;
|
||||
@ -1106,9 +1098,14 @@ namespace NSDocxRenderer
|
||||
{
|
||||
if (!bIf2)
|
||||
{
|
||||
m_pStyleManager->m_pCurrentStyle->CopyFormat(*pCurrCont->m_pFontStyle);
|
||||
m_pStyleManager->m_pCurrentStyle->m_oBrush.Color1 = pShape->m_oPen.Color;
|
||||
pCurrCont->m_pFontStyle = m_pStyleManager->GetStyle();
|
||||
auto oBrush = pCurrCont->m_pFontStyle->GetBrush();
|
||||
oBrush.Color1 = pShape->m_oPen.Color;
|
||||
|
||||
pCurrCont->m_pFontStyle = m_pFontStyleManager->GetOrAddFontStyle(oBrush,
|
||||
pCurrCont->m_pFontStyle->GetFontName(),
|
||||
pCurrCont->m_pFontStyle->GetFontSize(),
|
||||
pCurrCont->m_pFontStyle->IsItalic(),
|
||||
pCurrCont->m_pFontStyle->IsBold());
|
||||
|
||||
pCurrCont->m_bIsShadowPresent = true;
|
||||
pCurrCont->m_bIsOutlinePresent = true;
|
||||
@ -1169,7 +1166,7 @@ namespace NSDocxRenderer
|
||||
return bIf1 && bIf2 && bIf3 && bIf4;
|
||||
}
|
||||
|
||||
bool CPage::IsItHighlightingBackground(CShape *pShape, CContText* pCont, const eHorizontalCrossingType& eHType)
|
||||
bool CPage::IsItHighlightingBackground(const CShape *pShape, CContText* pCont, const eHorizontalCrossingType& eHType)
|
||||
{
|
||||
double dSomeBaseLine1 = pCont->m_dBaselinePos - pCont->m_dHeight * 0.75;
|
||||
double dSomeBaseLine2 = pCont->m_dBaselinePos - pCont->m_dHeight * 0.5;
|
||||
@ -1189,7 +1186,7 @@ namespace NSDocxRenderer
|
||||
eHType != eHorizontalCrossingType::hctNoCrossingCurrentRightOfNext;
|
||||
|
||||
//Цвета должны быть разными
|
||||
bool bIf4 = pCont->m_pFontStyle->m_oBrush.Color1 != pShape->m_oBrush.Color1;
|
||||
bool bIf4 = pCont->m_pFontStyle->GetBrush().Color1 != pShape->m_oBrush.Color1;
|
||||
bool bIf5 = pShape->m_oBrush.Color1 == c_iBlackColor && pShape->m_oPen.Color == c_iWhiteColor;
|
||||
bool bIf6 = pShape->m_bIsNoFill == false;
|
||||
bool bIf7 = pShape->m_bIsNoStroke == true;
|
||||
@ -1295,16 +1292,17 @@ namespace NSDocxRenderer
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
dFontSize = pCont->m_pFontStyle->m_oFont.Size;
|
||||
dFontSize = pCont->m_pFontStyle->GetFontSize();
|
||||
break;
|
||||
}
|
||||
|
||||
for (auto pCont : pCurrLine->m_arConts)
|
||||
{
|
||||
m_pStyleManager->m_pCurrentStyle->CopyFormat(*pCont->m_pFontStyle);
|
||||
m_pStyleManager->m_pCurrentStyle->m_oFont.Size = dFontSize;
|
||||
pCont->m_pFontStyle = m_pStyleManager->GetStyle();
|
||||
pCont->m_pFontStyle = m_pFontStyleManager->GetOrAddFontStyle(pCont->m_pFontStyle->GetBrush(),
|
||||
pCont->m_pFontStyle->GetFontName(),
|
||||
dFontSize,
|
||||
pCont->m_pFontStyle->IsItalic(),
|
||||
pCont->m_pFontStyle->IsBold());
|
||||
|
||||
if (pBaseLine->m_dLeft > pCont->m_dLeft)
|
||||
{
|
||||
@ -1337,16 +1335,17 @@ namespace NSDocxRenderer
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
dFontSize = pCont->m_pFontStyle->m_oFont.Size;
|
||||
dFontSize = pCont->m_pFontStyle->GetFontSize();
|
||||
break;
|
||||
}
|
||||
|
||||
for (auto pCont : pSubLine->m_arConts)
|
||||
{
|
||||
m_pStyleManager->m_pCurrentStyle->CopyFormat(*pCont->m_pFontStyle);
|
||||
m_pStyleManager->m_pCurrentStyle->m_oFont.Size = dFontSize;
|
||||
pCont->m_pFontStyle = m_pStyleManager->GetStyle();
|
||||
pCont->m_pFontStyle = m_pFontStyleManager->GetOrAddFontStyle(pCont->m_pFontStyle->GetBrush(),
|
||||
pCont->m_pFontStyle->GetFontName(),
|
||||
dFontSize,
|
||||
pCont->m_pFontStyle->IsItalic(),
|
||||
pCont->m_pFontStyle->IsBold());
|
||||
|
||||
if (pCurrLine->m_dLeft > pCont->m_dLeft)
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#include "elements/Paragraph.h"
|
||||
#include "elements/Shape.h"
|
||||
#include "elements/Table.h"
|
||||
#include "managers/StyleManager.h"
|
||||
#include "managers/FontStyleManager.h"
|
||||
|
||||
|
||||
namespace NSDocxRenderer
|
||||
@ -20,7 +20,7 @@ namespace NSDocxRenderer
|
||||
Aggplus::CMatrix* m_pTransform {nullptr};
|
||||
Aggplus::CGraphicsPathSimpleConverter* m_pSimpleGraphicsConverter {nullptr};
|
||||
|
||||
CStyleManager* m_pStyleManager {nullptr};
|
||||
CFontStyleManager* m_pFontStyleManager {nullptr};
|
||||
CFontManager* m_pFontManager {nullptr};
|
||||
CFontSelector* m_pFontSelector {nullptr};
|
||||
CVectorGraphics m_oVector;
|
||||
@ -57,7 +57,7 @@ namespace NSDocxRenderer
|
||||
~CPage();
|
||||
void Init(NSStructures::CFont* pFont, NSStructures::CPen* pPen, NSStructures::CBrush* pBrush,
|
||||
NSStructures::CShadow* pShadow, NSStructures::CEdgeText* pEdge, Aggplus::CMatrix* pMatrix,
|
||||
Aggplus::CGraphicsPathSimpleConverter* pSimple, CStyleManager* pStyleManager, CFontManager *pFontManager,
|
||||
Aggplus::CGraphicsPathSimpleConverter* pSimple, CFontStyleManager* pStyleManager, CFontManager *pFontManager,
|
||||
CFontSelector* pFontSelector);
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@ namespace NSDocxRenderer
|
||||
void DetermineStrikeoutsUnderlinesHighlights();
|
||||
bool IsLineCrossingText(const CShape* pGraphicItem, CContText* pCont, const eHorizontalCrossingType& eHType);
|
||||
bool IsLineBelowText(const CShape* pGraphicItem, CContText* pCont, const eHorizontalCrossingType& eHType);
|
||||
bool IsItHighlightingBackground(CShape* pGraphicItem, CContText* pCont, const eHorizontalCrossingType& eHType);
|
||||
bool IsItHighlightingBackground(const CShape* pGraphicItem, CContText* pCont, const eHorizontalCrossingType& eHType);
|
||||
void AddDiacriticalSymbols();
|
||||
void MergeLinesByVertAlignType();
|
||||
void DetermineTextColumns();
|
||||
|
||||
@ -80,21 +80,22 @@ namespace NSDocxRenderer
|
||||
oWriter.WriteString(L"<w:rPr>");
|
||||
|
||||
oWriter.WriteString(L"<w:rStyle w:val=\"");
|
||||
oWriter.WriteString(m_pFontStyle->GetStyleId());
|
||||
oWriter.WriteString(m_pFontStyle->GetFontStyleId());
|
||||
oWriter.WriteString(L"\"/>");
|
||||
|
||||
LONG lCalculatedSpacing = 0;
|
||||
|
||||
if (!m_pFontStyle->m_strPickFontName.empty() && !m_oText.empty())
|
||||
if (!m_pFontStyle->GetFontName().empty() && !m_oText.empty())
|
||||
{
|
||||
if (m_eVertAlignType != eVertAlignType::vatSubscript &&
|
||||
m_eVertAlignType != eVertAlignType::vatSuperscript)
|
||||
{
|
||||
// нужно перемерять...
|
||||
NSStructures::CFont oFont;
|
||||
oFont.Name = m_pFontStyle->m_strPickFontName;
|
||||
oFont.SetStyle(m_pFontStyle->m_lPickFontStyle);
|
||||
oFont.Size = m_pFontStyle->m_oFont.Size;
|
||||
oFont.Name = m_pFontStyle->GetFontName();
|
||||
oFont.Bold = m_pFontStyle->IsBold();
|
||||
oFont.Italic = m_pFontStyle->IsItalic();
|
||||
oFont.Size = m_pFontStyle->GetFontSize();
|
||||
m_pManager->LoadFontByName(oFont);
|
||||
|
||||
double dBoxX;
|
||||
@ -158,7 +159,7 @@ namespace NSDocxRenderer
|
||||
oWriter.WriteString(L"<w:u w:val=");
|
||||
oWriter.WriteString(SingletonInstance<LinesTable>().ConverLineToString(m_eUnderlineType));
|
||||
|
||||
if (m_lUnderlineColor != m_pFontStyle->m_oBrush.Color1)
|
||||
if (m_lUnderlineColor != m_pFontStyle->GetBrush().Color1)
|
||||
{
|
||||
oWriter.WriteString(L" w:color=\"");
|
||||
oWriter.WriteHexInt3(ConvertColorBGRToRGB(m_lUnderlineColor));
|
||||
@ -209,15 +210,10 @@ namespace NSDocxRenderer
|
||||
oWriter.WriteString(L"<w:r><w:rPr>");
|
||||
|
||||
oWriter.WriteString(L"<w:rStyle w:val=\"");
|
||||
oWriter.WriteString(m_pFontStyle->GetStyleId());
|
||||
oWriter.WriteString(m_pFontStyle->GetFontStyleId());
|
||||
oWriter.WriteString(L"\"/>");
|
||||
|
||||
double dSpaceMMSize = m_dSpaceWidthMM;
|
||||
if (!m_pFontStyle->m_strPickFontName.empty())
|
||||
{
|
||||
dSpaceMMSize = m_pManager->GetSpaceWidthMM();
|
||||
}
|
||||
|
||||
LONG lCalculatedSpacing = static_cast<LONG>((dSpacingMM - dSpaceMMSize) * c_dMMToDx);
|
||||
|
||||
//note принудительно уменьшаем spacing чтобы текстовые линии не выходили за правую границу
|
||||
@ -266,7 +262,7 @@ namespace NSDocxRenderer
|
||||
oWriter.WriteString(L"<w:u w:val=");
|
||||
oWriter.WriteString(SingletonInstance<LinesTable>().ConverLineToString(m_eUnderlineType));
|
||||
|
||||
if (m_lUnderlineColor != m_pFontStyle->m_oBrush.Color1)
|
||||
if (m_lUnderlineColor != m_pFontStyle->GetBrush().Color1)
|
||||
{
|
||||
oWriter.WriteString(L" w:color=\"");
|
||||
oWriter.WriteHexInt3(ConvertColorBGRToRGB(m_lUnderlineColor));
|
||||
@ -303,7 +299,7 @@ namespace NSDocxRenderer
|
||||
|
||||
bool CContText::IsEqual(const CContText *pCont)
|
||||
{
|
||||
bool bIf1 = m_pFontStyle->GetStyleId() == pCont->m_pFontStyle->GetStyleId();
|
||||
bool bIf1 = m_pFontStyle->GetFontStyleId() == pCont->m_pFontStyle->GetFontStyleId();
|
||||
bool bIf2 = m_bIsStrikeoutPresent == pCont->m_bIsStrikeoutPresent;
|
||||
bool bIf3 = m_bIsDoubleStrikeout == pCont->m_bIsDoubleStrikeout;
|
||||
bool bIf4 = m_bIsHighlightPresent == pCont->m_bIsHighlightPresent;
|
||||
@ -326,12 +322,11 @@ namespace NSDocxRenderer
|
||||
UINT CContText::GetNumberOfFeatures()
|
||||
{
|
||||
UINT ret = 0;
|
||||
|
||||
if (m_pFontStyle->m_oFont.Bold)
|
||||
if (m_pFontStyle->IsBold())
|
||||
{
|
||||
ret++;
|
||||
}
|
||||
if (m_pFontStyle->m_oFont.Italic)
|
||||
if (m_pFontStyle->IsItalic())
|
||||
{
|
||||
ret++;
|
||||
}
|
||||
@ -382,16 +377,16 @@ namespace NSDocxRenderer
|
||||
bool bIf4 = eHType == eHorizontalCrossingType::hctCurrentRightOfNext; //текущий cont правее
|
||||
|
||||
//Размеры шрифта и текст должны бать одинаковыми
|
||||
bool bIf5 = m_pFontStyle->m_oFont.Size == pCont->m_pFontStyle->m_oFont.Size;
|
||||
bool bIf5 = m_pFontStyle->GetFontSize() == m_pFontStyle->GetFontSize();
|
||||
bool bIf6 = m_oText == pCont->m_oText;
|
||||
|
||||
//Цвет тени должен быть серым
|
||||
bool bIf7 = m_pFontStyle->m_oBrush.Color1 == c_iGreyColor;
|
||||
bool bIf8 = pCont->m_pFontStyle->m_oBrush.Color1 == c_iGreyColor;
|
||||
bool bIf9 = m_pFontStyle->m_oBrush.Color1 == c_iBlackColor;
|
||||
bool bIf10 = pCont->m_pFontStyle->m_oBrush.Color1 == c_iBlackColor;
|
||||
bool bIf11 = m_pFontStyle->m_oBrush.Color1 == c_iGreyColor2;
|
||||
bool bIf12 = pCont->m_pFontStyle->m_oBrush.Color1 == c_iGreyColor2;
|
||||
bool bIf7 = m_pFontStyle->GetBrush().Color1 == c_iGreyColor;
|
||||
bool bIf8 = pCont->m_pFontStyle->GetBrush().Color1 == c_iGreyColor;
|
||||
bool bIf9 = m_pFontStyle->GetBrush().Color1 == c_iBlackColor;
|
||||
bool bIf10 = pCont->m_pFontStyle->GetBrush().Color1 == c_iBlackColor;
|
||||
bool bIf11 = m_pFontStyle->GetBrush().Color1 == c_iGreyColor2;
|
||||
bool bIf12 = pCont->m_pFontStyle->GetBrush().Color1 == c_iGreyColor2;
|
||||
|
||||
//note Каждый символ с Emboss или Engrave разбиваются на 3 символа с разными цветами
|
||||
//note Логика подобрана для конкретного примера - возможно нужно будет ее обобщить.
|
||||
@ -466,8 +461,8 @@ namespace NSDocxRenderer
|
||||
eHType == eHorizontalCrossingType::hctCurrentRightOfNext) &&
|
||||
fabs(m_dLeft - pCont->m_dRight) < c_dTHE_STRING_X_PRECISION_MM * 3;
|
||||
//Размеры шрифта должны бать разными
|
||||
bool bIf5 = m_pFontStyle->m_oFont.Size * 0.7 > pCont->m_pFontStyle->m_oFont.Size;
|
||||
bool bIf6 = m_pFontStyle->m_oFont.Size < pCont->m_pFontStyle->m_oFont.Size * 0.7;
|
||||
bool bIf5 = m_pFontStyle->GetFontSize() * 0.7 > pCont->m_pFontStyle->GetFontSize();
|
||||
bool bIf6 = m_pFontStyle->GetFontSize() < pCont->m_pFontStyle->GetFontSize() * 0.7;
|
||||
|
||||
if (bIf3 || bIf4)
|
||||
{
|
||||
|
||||
@ -2,8 +2,7 @@
|
||||
#include "BaseItem.h"
|
||||
#include "../DesktopEditor/common/StringBuilder.h"
|
||||
#include "../managers/FontManager.h"
|
||||
#include "../managers/StyleManager.h"
|
||||
#include "../styles/FontStyle.h"
|
||||
#include "../managers/FontStyleManager.h"
|
||||
#include "../../resources/Constants.h"
|
||||
#include "../../resources/LinesTable.h"
|
||||
|
||||
@ -22,7 +21,7 @@ namespace NSDocxRenderer
|
||||
class CContText : public CBaseItem
|
||||
{
|
||||
public:
|
||||
std::shared_ptr<CFontStyle> m_pFontStyle {nullptr};
|
||||
std::shared_ptr<const CFontStyle> m_pFontStyle {nullptr};
|
||||
|
||||
bool m_bIsStrikeoutPresent {false};
|
||||
bool m_bIsDoubleStrikeout {false};
|
||||
@ -54,7 +53,7 @@ namespace NSDocxRenderer
|
||||
UINT m_iNumDuplicates {0};
|
||||
|
||||
public:
|
||||
CContText(CFontManager* m_pManager);
|
||||
CContText(CFontManager* pManager);
|
||||
CContText(const CContText& rCont);
|
||||
virtual ~CContText();
|
||||
virtual void Clear() override final;
|
||||
|
||||
@ -94,6 +94,7 @@ namespace NSDocxRenderer
|
||||
CTextLine* pCurrLine, *pNextLine, *pNextNextLine, *pPrevLine;
|
||||
double dCurrBeforeSpacing = 0, dNextBeforeSpacing = 0, dPrevBeforeSpacing = 0;
|
||||
double dBeforeSpacingWithShapes = 0;
|
||||
|
||||
//note Все параграфы были сдвинуты на данное значение от верхнего края страницы
|
||||
double dPreviousStringBaseline = c_dCORRECTION_FOR_FIRST_PARAGRAPH;
|
||||
eVerticalCrossingType eCrossingType;
|
||||
|
||||
@ -183,6 +183,7 @@ namespace NSDocxRenderer
|
||||
|
||||
CParagraph::TextAlignmentType CParagraph::DetermineTextAlignmentType(CTextLine* pCurrentLine, CTextLine* pNextLine, CTextLine* pNextNextLine, double dPageWidth, bool &bIsUseNextNextLine, bool &bIsSingleLineParagraph)
|
||||
{
|
||||
// поменять логику
|
||||
if (!pCurrentLine || !pNextLine)
|
||||
{
|
||||
return tatUnknown;
|
||||
|
||||
@ -131,7 +131,7 @@ namespace NSDocxRenderer
|
||||
return false;
|
||||
}
|
||||
|
||||
std::wstring CShape::PathToStr()
|
||||
std::wstring CShape::PathToWString()
|
||||
{
|
||||
auto arData = m_oVector.GetData();
|
||||
|
||||
@ -852,7 +852,7 @@ namespace NSDocxRenderer
|
||||
|
||||
void CShape::BuildGraphicProperties(NSStringUtils::CStringBuilder &oWriter)
|
||||
{
|
||||
std::wstring strPath = std::move(PathToStr());
|
||||
std::wstring strPath = PathToWString();
|
||||
//отвечает за размеры прямоугольного фрейма шейпа
|
||||
oWriter.WriteString(L"<a:xfrm");
|
||||
if (fabs(m_dRotate) > 0.01)
|
||||
|
||||
@ -31,7 +31,6 @@ namespace NSDocxRenderer
|
||||
|
||||
public:
|
||||
eShapeType m_eType {eShapeType::stUnknown};
|
||||
//std::wstring m_strPath {L""};
|
||||
CVectorGraphics m_oVector;
|
||||
std::wstring m_strDstMedia;
|
||||
NSStructures::CBrush m_oBrush;
|
||||
@ -68,7 +67,7 @@ namespace NSDocxRenderer
|
||||
|
||||
void SetVector(CVectorGraphics&& oVector);
|
||||
bool TryMergeShape(CShape* pShape);
|
||||
std::wstring PathToStr();
|
||||
std::wstring PathToWString();
|
||||
void DetermineGraphicsType(double dWidth, double dHeight, size_t nPeacks, size_t nCurves);
|
||||
bool IsItFitLine();
|
||||
bool IsCorrelated(const CShape* pShape);
|
||||
|
||||
@ -16,16 +16,12 @@ namespace NSDocxRenderer
|
||||
};
|
||||
|
||||
std::vector<CContText*> m_arConts;
|
||||
|
||||
AssumedTextAlignmentType m_eAlignmentType {atatUnknown};
|
||||
|
||||
eVertAlignType m_eVertAlignType {eVertAlignType::vatUnknown};
|
||||
|
||||
CTextLine* m_pLine {nullptr}; //Если не nullptr, то есть привязка к vatSubscript или vatSuperscript;
|
||||
|
||||
CShape* m_pDominantShape {nullptr};
|
||||
|
||||
UINT m_iNumDuplicates {0};
|
||||
|
||||
public:
|
||||
CTextLine();
|
||||
virtual ~CTextLine();
|
||||
|
||||
68
DocxRenderer/src/logic/managers/FontStyleManager.cpp
Normal file
68
DocxRenderer/src/logic/managers/FontStyleManager.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
#include "FontStyleManager.h"
|
||||
#include <utility>
|
||||
|
||||
namespace NSDocxRenderer
|
||||
{
|
||||
CFontStyleManager::CFontStyleManager()
|
||||
{
|
||||
}
|
||||
|
||||
CFontStyleManager::~CFontStyleManager()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
void CFontStyleManager::Clear()
|
||||
{
|
||||
m_arFontStyles.clear();
|
||||
}
|
||||
|
||||
void CFontStyleManager::NewDocument()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
void CFontStyleManager::ToXml(NSStringUtils::CStringBuilder& oWriter)
|
||||
{
|
||||
for(auto& val : m_arFontStyles)
|
||||
val->ToXml(oWriter);
|
||||
}
|
||||
|
||||
std::shared_ptr<const CFontStyle> CFontStyleManager::GetOrAddFontStyle(const CFontStyle& oFontStyle)
|
||||
{
|
||||
return GetOrAddFontStyle(oFontStyle.GetBrush(),
|
||||
oFontStyle.GetFontName(),
|
||||
oFontStyle.GetFontSize(),
|
||||
oFontStyle.IsItalic(),
|
||||
oFontStyle.IsBold());
|
||||
}
|
||||
std::shared_ptr<const CFontStyle> CFontStyleManager::GetOrAddFontStyle(const NSStructures::CBrush& oBrush,
|
||||
const std::wstring& wsFontName,
|
||||
double dFontSize,
|
||||
bool bItalic,
|
||||
bool bBold)
|
||||
{
|
||||
for(auto& val : m_arFontStyles)
|
||||
{
|
||||
if(oBrush.Type == val->GetBrush().Type &&
|
||||
oBrush.Color1 == val->GetBrush().Color1 &&
|
||||
oBrush.Color2 == val->GetBrush().Color2 &&
|
||||
oBrush.Alpha1 == val->GetBrush().Alpha1 &&
|
||||
oBrush.Alpha2 == val->GetBrush().Alpha2 &&
|
||||
oBrush.LinearAngle == val->GetBrush().LinearAngle &&
|
||||
dFontSize == val->GetFontSize() &&
|
||||
wsFontName == val->GetFontName() &&
|
||||
(bItalic == val->IsItalic()) && (bBold == val->IsBold()))
|
||||
|
||||
return val;
|
||||
}
|
||||
auto pFontStyle = std::make_shared<CFontStyle>();
|
||||
pFontStyle->SetBrush(oBrush);
|
||||
pFontStyle->SetFontName(wsFontName);
|
||||
pFontStyle->SetFontSize(dFontSize);
|
||||
pFontStyle->SetItalic(bItalic);
|
||||
pFontStyle->SetBold(bBold);
|
||||
|
||||
m_arFontStyles.push_front(pFontStyle);
|
||||
return pFontStyle;
|
||||
}
|
||||
}
|
||||
31
DocxRenderer/src/logic/managers/FontStyleManager.h
Normal file
31
DocxRenderer/src/logic/managers/FontStyleManager.h
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include <list>
|
||||
|
||||
#include "../styles/FontStyle.h"
|
||||
|
||||
namespace NSDocxRenderer
|
||||
{
|
||||
class CFontStyleManager
|
||||
{
|
||||
public:
|
||||
CFontStyleManager();
|
||||
~CFontStyleManager();
|
||||
|
||||
void Clear();
|
||||
void NewDocument();
|
||||
void ToXml(NSStringUtils::CStringBuilder& oWriter);
|
||||
|
||||
const std::shared_ptr<CFontStyle> GetFontStyle(const std::wstring& wsFontStyleId) const;
|
||||
|
||||
std::shared_ptr<const CFontStyle> GetOrAddFontStyle(const CFontStyle& oFontStyle);
|
||||
std::shared_ptr<const CFontStyle> GetOrAddFontStyle(const NSStructures::CBrush& oBrush,
|
||||
const std::wstring& wsFontName,
|
||||
double dFontSize,
|
||||
bool bItalic,
|
||||
bool bBold);
|
||||
|
||||
private:
|
||||
std::list<std::shared_ptr<CFontStyle>> m_arFontStyles;
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,38 +0,0 @@
|
||||
#include "StyleManager.h"
|
||||
#include <utility>
|
||||
|
||||
namespace NSDocxRenderer
|
||||
{
|
||||
CStyleManager::CStyleManager()
|
||||
{
|
||||
m_pCurrentStyle = std::make_shared<CFontStyle>();
|
||||
}
|
||||
|
||||
CStyleManager::~CStyleManager()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
void CStyleManager::Clear()
|
||||
{
|
||||
m_arStyles.clear();
|
||||
}
|
||||
|
||||
void CStyleManager::NewDocument()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
std::shared_ptr<CFontStyle> CStyleManager::GetStyle()
|
||||
{
|
||||
for (size_t i = 0; i < m_arStyles.size(); ++i)
|
||||
if (m_arStyles[i]->IsEqual(m_pCurrentStyle))
|
||||
return m_arStyles[i];
|
||||
|
||||
m_arStyles.push_back(m_pCurrentStyle);
|
||||
auto pStyle = m_pCurrentStyle;
|
||||
m_pCurrentStyle = std::make_shared<CFontStyle>();
|
||||
|
||||
return pStyle;
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
#pragma once
|
||||
#include "../styles/FontStyle.h"
|
||||
|
||||
namespace NSDocxRenderer
|
||||
{
|
||||
class CStyleManager
|
||||
{
|
||||
public:
|
||||
std::vector<std::shared_ptr<CFontStyle>> m_arStyles;
|
||||
std::shared_ptr<CFontStyle> m_pCurrentStyle;
|
||||
|
||||
public:
|
||||
CStyleManager();
|
||||
virtual ~CStyleManager();
|
||||
|
||||
void Clear();
|
||||
void NewDocument();
|
||||
std::shared_ptr<CFontStyle> GetStyle();
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
#include "BaseStyle.h"
|
||||
|
||||
CBaseStyle::CBaseStyle()
|
||||
{
|
||||
|
||||
}
|
||||
@ -1,45 +0,0 @@
|
||||
#pragma once
|
||||
#include "../DesktopEditor/common/StringBuilder.h"
|
||||
|
||||
namespace NSDocxRenderer
|
||||
{
|
||||
class CBaseStyle
|
||||
{
|
||||
protected:
|
||||
enum class eStyleType
|
||||
{
|
||||
stUnknown,
|
||||
stParagraph,
|
||||
stCharacter,
|
||||
stTable,
|
||||
stNumbering
|
||||
};
|
||||
|
||||
public:
|
||||
CBaseStyle(const eStyleType& eType): m_eType(eType) {}
|
||||
virtual ~CBaseStyle() {}
|
||||
|
||||
CBaseStyle& operator=(const CBaseStyle& oSrc)
|
||||
{
|
||||
if (this == &oSrc)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
m_eType = oSrc.m_eType;
|
||||
m_bIsNotNecessaryToUse = oSrc.m_bIsNotNecessaryToUse;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual void ToXml(NSStringUtils::CStringBuilder& oWriter) = 0;
|
||||
|
||||
private:
|
||||
eStyleType m_eType {eStyleType::stUnknown};
|
||||
|
||||
public:
|
||||
bool m_bIsNotNecessaryToUse {false};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -4,103 +4,119 @@
|
||||
|
||||
namespace NSDocxRenderer
|
||||
{
|
||||
CFontStyle::CFontStyle() : CBaseStyle(CBaseStyle::eStyleType::stCharacter)
|
||||
CFontStyle::CFontStyle()
|
||||
{
|
||||
static UINT iId = 0;
|
||||
iId++;
|
||||
if (iId < 10)
|
||||
{
|
||||
m_strStyleId = L"fontstyle0" + std::to_wstring(iId);
|
||||
}
|
||||
static LONG lId = 0;
|
||||
lId++;
|
||||
m_wsFontStyleId = m_wsIdStart;
|
||||
|
||||
if(lId < 10)
|
||||
m_wsFontStyleId += L"0" + std::to_wstring(lId);
|
||||
else
|
||||
{
|
||||
m_strStyleId = L"fontstyle" + std::to_wstring(iId);
|
||||
}
|
||||
m_wsFontStyleId += std::to_wstring(lId);
|
||||
}
|
||||
CFontStyle::CFontStyle(const CFontStyle& oFontStyle) : CFontStyle()
|
||||
{
|
||||
*this = oFontStyle;
|
||||
}
|
||||
CFontStyle::~CFontStyle()
|
||||
{
|
||||
}
|
||||
|
||||
CFontStyle& CFontStyle::operator=(const CFontStyle& oSrc)
|
||||
{
|
||||
if (this == &oSrc)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBaseStyle::operator=(oSrc);
|
||||
|
||||
m_strStyleId = oSrc.m_strStyleId;
|
||||
|
||||
m_oFont = oSrc.m_oFont;
|
||||
m_oBrush = oSrc.m_oBrush;
|
||||
|
||||
m_strPickFontName = oSrc.m_strPickFontName;
|
||||
m_lPickFontStyle = oSrc.m_lPickFontStyle;
|
||||
m_dFontSize = oSrc.m_dFontSize;
|
||||
m_oBrush = oSrc.m_oBrush;
|
||||
|
||||
m_wsFontName = oSrc.m_wsFontName;
|
||||
m_bBold = oSrc.m_bBold;
|
||||
m_bItalic = oSrc.m_bItalic;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void CFontStyle::CopyFormat(const CFontStyle& oSrc)
|
||||
bool CFontStyle::operator==(const CFontStyle& oSrc)
|
||||
{
|
||||
if (this == &oSrc)
|
||||
{
|
||||
return;
|
||||
}
|
||||
bool bIf1 = m_oBrush.Type == oSrc.m_oBrush.Type;
|
||||
bool bIf2 = m_oBrush.Color1 == oSrc.m_oBrush.Color1;
|
||||
bool bIf3 = m_oBrush.Color2 == oSrc.m_oBrush.Color2;
|
||||
bool bIf4 = m_oBrush.Alpha1 == oSrc.m_oBrush.Alpha1;
|
||||
bool bIf5 = m_oBrush.Alpha2 == oSrc.m_oBrush.Alpha2;
|
||||
bool bIf6 = m_oBrush.LinearAngle == oSrc.m_oBrush.LinearAngle;
|
||||
|
||||
CBaseStyle::operator=(oSrc);
|
||||
|
||||
m_oFont = oSrc.m_oFont;
|
||||
m_oBrush = oSrc.m_oBrush;
|
||||
|
||||
m_strPickFontName = oSrc.m_strPickFontName;
|
||||
m_lPickFontStyle = oSrc.m_lPickFontStyle;
|
||||
}
|
||||
|
||||
bool CFontStyle::IsEqual(std::shared_ptr<CFontStyle> oSrc)
|
||||
{
|
||||
//note Бывают fonts только с разными path => новый стиль => m_oFont.IsEqual не берем
|
||||
//todo проверить FaceIndex StringGID
|
||||
bool bIf1 = m_oFont.Name == oSrc->m_oFont.Name;
|
||||
bool bIf2 = m_oFont.Size == oSrc->m_oFont.Size;
|
||||
bool bIf3 = m_oFont.Bold == oSrc->m_oFont.Bold;
|
||||
bool bIf4 = m_oFont.Italic == oSrc->m_oFont.Italic;
|
||||
bool bIf5 = m_oFont.Underline == oSrc->m_oFont.Underline;
|
||||
bool bIf6 = m_oFont.Strikeout == oSrc->m_oFont.Strikeout;
|
||||
|
||||
bool bIf7 = m_oBrush.Type == oSrc->m_oBrush.Type;
|
||||
bool bIf8 = m_oBrush.Color1 == oSrc->m_oBrush.Color1;
|
||||
bool bIf9 = m_oBrush.Color2 == oSrc->m_oBrush.Color2;
|
||||
bool bIf10 = m_oBrush.Alpha1 == oSrc->m_oBrush.Alpha1;
|
||||
bool bIf11 = m_oBrush.Alpha2 == oSrc->m_oBrush.Alpha2;
|
||||
bool bIf12 = m_oBrush.LinearAngle == oSrc->m_oBrush.LinearAngle;
|
||||
bool bIf7 = m_dFontSize == oSrc.m_dFontSize;
|
||||
bool bIf8 = m_wsFontName == oSrc.m_wsFontName;
|
||||
bool bIf9 = (m_bItalic == oSrc.m_bItalic) && (m_bBold == oSrc.m_bBold);
|
||||
|
||||
//todo
|
||||
// (TexturePath == pBrush->TexturePath) && (TextureAlpha == pBrush->TextureAlpha) && (TextureMode == pBrush->TextureMode) &&
|
||||
// (Rectable == pBrush->Rectable) && (Rect.Equals(pBrush->Rect)));
|
||||
//bool bIf7 = m_oBrush.IsEqual(&oSrc->m_oBrush);
|
||||
|
||||
bool bIf13 = m_strPickFontName == oSrc->m_strPickFontName;
|
||||
bool bIf14 = m_lPickFontStyle == oSrc->m_lPickFontStyle;
|
||||
|
||||
return (bIf1 && bIf2 && bIf3 && bIf4 && bIf5 && bIf6 &&
|
||||
bIf7 && bIf8 && bIf9 && bIf10 && bIf11 && bIf12 &&
|
||||
bIf13 && bIf14);
|
||||
bIf7 && bIf8 && bIf9);
|
||||
}
|
||||
|
||||
const std::wstring& CFontStyle::GetFontStyleId() const noexcept
|
||||
{
|
||||
return m_wsFontStyleId;
|
||||
}
|
||||
const std::wstring& CFontStyle::GetFontName() const noexcept
|
||||
{
|
||||
return m_wsFontName;
|
||||
}
|
||||
const NSStructures::CBrush& CFontStyle::GetBrush() const noexcept
|
||||
{
|
||||
return m_oBrush;
|
||||
}
|
||||
|
||||
double CFontStyle::GetFontSize() const noexcept
|
||||
{
|
||||
return m_dFontSize;
|
||||
}
|
||||
bool CFontStyle::IsBold() const noexcept
|
||||
{
|
||||
return m_bBold;
|
||||
}
|
||||
bool CFontStyle::IsItalic() const noexcept
|
||||
{
|
||||
return m_bItalic;
|
||||
}
|
||||
|
||||
void CFontStyle::SetFontName(const std::wstring& wsFontName)
|
||||
{
|
||||
m_wsFontName = wsFontName;
|
||||
}
|
||||
void CFontStyle::SetBrush(const NSStructures::CBrush& oBrush)
|
||||
{
|
||||
m_oBrush = oBrush;
|
||||
}
|
||||
|
||||
void CFontStyle::SetFontSize(double dFontSize)
|
||||
{
|
||||
m_dFontSize = dFontSize;
|
||||
}
|
||||
void CFontStyle::SetBold(bool bBold)
|
||||
{
|
||||
m_bBold = bBold;
|
||||
}
|
||||
void CFontStyle::SetItalic(double bItalic)
|
||||
{
|
||||
m_bItalic = bItalic;
|
||||
}
|
||||
|
||||
void CFontStyle::ToXml(NSStringUtils::CStringBuilder& oWriter)
|
||||
{
|
||||
if (m_bIsNotNecessaryToUse)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
oWriter.WriteString(L"<w:style");
|
||||
oWriter.WriteString(L" w:type=\"character\"");
|
||||
oWriter.WriteString(L" w:customStyle=\"1\"");
|
||||
oWriter.WriteString(L" w:styleId=\"");
|
||||
oWriter.WriteString(m_strStyleId);
|
||||
oWriter.WriteString(m_wsFontStyleId);
|
||||
oWriter.WriteString(L"\">");
|
||||
|
||||
oWriter.WriteString(L"<w:name w:val=\"");
|
||||
oWriter.WriteString(m_strStyleId);
|
||||
oWriter.WriteString(m_wsFontStyleId);
|
||||
oWriter.WriteString(L"\"/>");
|
||||
|
||||
oWriter.WriteString(L"<w:basedOn w:val=\"");
|
||||
@ -111,40 +127,23 @@ namespace NSDocxRenderer
|
||||
|
||||
oWriter.WriteString(L"<w:rPr>");
|
||||
|
||||
std::wstring& strFontName = m_strPickFontName.empty() ? m_oFont.Name : m_strPickFontName;
|
||||
oWriter.WriteString(L"<w:rFonts w:ascii=\"");
|
||||
oWriter.WriteEncodeXmlString(strFontName);
|
||||
oWriter.WriteEncodeXmlString(m_wsFontName);
|
||||
oWriter.WriteString(L"\" w:hAnsi=\"");
|
||||
oWriter.WriteEncodeXmlString(strFontName);
|
||||
oWriter.WriteEncodeXmlString(m_wsFontName);
|
||||
oWriter.WriteString(L"\" w:cs=\"");
|
||||
oWriter.WriteEncodeXmlString(strFontName);
|
||||
oWriter.WriteEncodeXmlString(m_wsFontName);
|
||||
oWriter.WriteString(L"\" w:hint=\"default\"/>");
|
||||
|
||||
if (m_strPickFontName.empty())
|
||||
if (m_bBold)
|
||||
{
|
||||
if (m_oFont.Bold)
|
||||
{
|
||||
oWriter.WriteString(L"<w:b/>");
|
||||
oWriter.WriteString(L"<w:bCs/>");
|
||||
}
|
||||
if (m_oFont.Italic)
|
||||
{
|
||||
oWriter.WriteString(L"<w:i/>");
|
||||
oWriter.WriteString(L"<w:iCs/>");
|
||||
}
|
||||
oWriter.WriteString(L"<w:b/>");
|
||||
oWriter.WriteString(L"<w:bCs/>");
|
||||
}
|
||||
else
|
||||
if (m_bItalic)
|
||||
{
|
||||
if (0x01 == (0x01 & m_lPickFontStyle))
|
||||
{
|
||||
oWriter.WriteString(L"<w:b/>");
|
||||
oWriter.WriteString(L"<w:bCs/>");
|
||||
}
|
||||
if (0x02 == (0x02 & m_lPickFontStyle))
|
||||
{
|
||||
oWriter.WriteString(L"<w:i/>");
|
||||
oWriter.WriteString(L"<w:iCs/>");
|
||||
}
|
||||
oWriter.WriteString(L"<w:i/>");
|
||||
oWriter.WriteString(L"<w:iCs/>");
|
||||
}
|
||||
|
||||
if (ConvertColorBGRToRGB(m_oBrush.Color1) != c_iBlackColor2)
|
||||
@ -154,7 +153,7 @@ namespace NSDocxRenderer
|
||||
oWriter.WriteString(L"\"/>");
|
||||
}
|
||||
|
||||
int lSize = static_cast<int>(2 * m_oFont.Size);
|
||||
int lSize = static_cast<int>(2 * m_dFontSize);
|
||||
oWriter.WriteString(L"<w:sz w:val=\"");
|
||||
oWriter.AddInt(lSize);
|
||||
oWriter.WriteString(L"\"/><w:szCs w:val=\"");
|
||||
@ -162,7 +161,6 @@ namespace NSDocxRenderer
|
||||
oWriter.WriteString(L"\"/>");
|
||||
|
||||
oWriter.WriteString(L"</w:rPr>");
|
||||
|
||||
oWriter.WriteString(L"</w:style>");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,33 +1,49 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include "BaseStyle.h"
|
||||
#include "../managers/FontManager.h"
|
||||
|
||||
#include "../DesktopEditor/graphics/structures.h"
|
||||
#include "../DesktopEditor/common/StringBuilder.h"
|
||||
|
||||
|
||||
namespace NSDocxRenderer
|
||||
{
|
||||
class CFontStyle : public CBaseStyle
|
||||
class CFontStyle
|
||||
{
|
||||
public:
|
||||
NSStructures::CFont m_oFont;
|
||||
NSStructures::CBrush m_oBrush;
|
||||
|
||||
std::wstring m_strPickFontName {L""};
|
||||
LONG m_lPickFontStyle {0};
|
||||
|
||||
private:
|
||||
std::wstring m_strStyleId {L""};
|
||||
|
||||
public:
|
||||
CFontStyle();
|
||||
~CFontStyle(){}
|
||||
CFontStyle(const CFontStyle& oFontStyle);
|
||||
~CFontStyle();
|
||||
|
||||
CFontStyle& operator=(const CFontStyle& oSrc);
|
||||
bool operator==(const CFontStyle& oSrc);
|
||||
|
||||
void CopyFormat(const CFontStyle& oSrc);
|
||||
void ToXml(NSStringUtils::CStringBuilder& oWriter) override final;
|
||||
bool IsEqual(std::shared_ptr<CFontStyle> oSrc);
|
||||
std::wstring GetStyleId() {return m_strStyleId;}
|
||||
const std::wstring& GetFontStyleId() const noexcept;
|
||||
const std::wstring& GetFontName() const noexcept;
|
||||
const NSStructures::CBrush& GetBrush() const noexcept;
|
||||
|
||||
double GetFontSize() const noexcept;
|
||||
bool IsBold() const noexcept;
|
||||
bool IsItalic() const noexcept;
|
||||
|
||||
void SetFontName(const std::wstring& wsFontName);
|
||||
void SetBrush(const NSStructures::CBrush& oBrush);
|
||||
|
||||
void SetFontSize(double dFontSize);
|
||||
void SetBold(bool bBold);
|
||||
void SetItalic(double bItalic);
|
||||
|
||||
void CopyNoId(const CFontStyle& oSrc);
|
||||
void ToXml(NSStringUtils::CStringBuilder& oWriter);
|
||||
|
||||
private:
|
||||
std::wstring m_wsFontStyleId {L""};
|
||||
NSStructures::CBrush m_oBrush;
|
||||
std::wstring m_wsFontName {L""};
|
||||
double m_dFontSize {0};
|
||||
bool m_bItalic {false};
|
||||
bool m_bBold {false};
|
||||
|
||||
const std::wstring m_wsIdStart = L"fontstyle";
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
#include <numeric>
|
||||
|
||||
#include "VectorGraphics.h"
|
||||
#include "../DesktopEditor/common/Types.h"
|
||||
|
||||
|
||||
namespace NSDocxRenderer
|
||||
|
||||
@ -26,13 +26,11 @@ namespace NSDocxRenderer
|
||||
std::list<Point> points;
|
||||
};
|
||||
|
||||
public:
|
||||
CVectorGraphics();
|
||||
~CVectorGraphics();
|
||||
|
||||
CVectorGraphics& operator=(CVectorGraphics&& other);
|
||||
|
||||
public:
|
||||
const std::list<PathCommand>& GetData() const;
|
||||
|
||||
double GetLeft() const noexcept;
|
||||
@ -40,7 +38,6 @@ namespace NSDocxRenderer
|
||||
double GetRight() const noexcept;
|
||||
double GetBottom() const noexcept;
|
||||
|
||||
public:
|
||||
void MoveTo(const double& x1, const double& y1);
|
||||
void LineTo(const double& x1, const double& y1);
|
||||
void CurveTo(const double& x1, const double& y1, const double& x2, const double& y2, const double& x3, const double& y3);
|
||||
|
||||
Reference in New Issue
Block a user