diff options
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fde/cfde_txtedtengine.cpp | 32 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtengine.h | 6 |
2 files changed, 17 insertions, 21 deletions
diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp index 469ec87cf7..be0270960d 100644 --- a/xfa/fde/cfde_txtedtengine.cpp +++ b/xfa/fde/cfde_txtedtengine.cpp @@ -15,7 +15,6 @@ #include "xfa/fde/cfde_txtedtbuf.h" #include "xfa/fde/cfde_txtedtpage.h" #include "xfa/fde/cfde_txtedtparag.h" -#include "xfa/fgas/layout/cfx_txtbreak.h" #include "xfa/fwl/cfwl_edit.h" namespace { @@ -145,9 +144,6 @@ CFDE_TxtEdtEngine::~CFDE_TxtEdtEngine() { } void CFDE_TxtEdtEngine::SetEditParams(const FDE_TXTEDTPARAMS& params) { - if (!m_pTextBreak) - m_pTextBreak = pdfium::MakeUnique<CFX_TxtBreak>(); - m_Param = params; m_bAutoLineEnd = true; UpdateTxtBreak(); @@ -807,7 +803,7 @@ void CFDE_TxtEdtEngine::UpdatePages() { } void CFDE_TxtEdtEngine::UpdateTxtBreak() { - uint32_t dwStyle = m_pTextBreak->GetLayoutStyles(); + uint32_t dwStyle = m_TextBreak.GetLayoutStyles(); if (m_Param.dwMode & FDE_TEXTEDITMODE_MultiLines) dwStyle &= ~FX_LAYOUTSTYLE_SingleLine; else @@ -818,7 +814,7 @@ void CFDE_TxtEdtEngine::UpdateTxtBreak() { else dwStyle &= ~FX_LAYOUTSTYLE_CombText; - m_pTextBreak->SetLayoutStyles(dwStyle); + m_TextBreak.SetLayoutStyles(dwStyle); uint32_t dwAligment = 0; if (m_Param.dwAlignment & FDE_TEXTEDITALIGN_Justified) dwAligment |= CFX_TxtLineAlignment_Justified; @@ -828,12 +824,12 @@ void CFDE_TxtEdtEngine::UpdateTxtBreak() { else if (m_Param.dwAlignment & FDE_TEXTEDITALIGN_Right) dwAligment |= CFX_TxtLineAlignment_Right; - m_pTextBreak->SetAlignment(dwAligment); + m_TextBreak.SetAlignment(dwAligment); if (m_Param.dwMode & FDE_TEXTEDITMODE_AutoLineWrap) - m_pTextBreak->SetLineWidth(m_Param.fPlateWidth); + m_TextBreak.SetLineWidth(m_Param.fPlateWidth); else - m_pTextBreak->SetLineWidth(kPageWidthMax); + m_TextBreak.SetLineWidth(kPageWidthMax); m_nPageLineCount = m_Param.nLineCount; if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText) { @@ -841,16 +837,16 @@ void CFDE_TxtEdtEngine::UpdateTxtBreak() { if (m_nLimit > 0) fCombWidth /= m_nLimit; - m_pTextBreak->SetCombWidth(fCombWidth); + m_TextBreak.SetCombWidth(fCombWidth); } - m_pTextBreak->SetFont(m_Param.pFont); - m_pTextBreak->SetFontSize(m_Param.fFontSize); - m_pTextBreak->SetTabWidth(m_Param.fTabWidth); - m_pTextBreak->SetDefaultChar(0xFEFF); - m_pTextBreak->SetParagraphBreakChar(L'\n'); - m_pTextBreak->SetLineBreakTolerance(m_Param.fFontSize * 0.2f); - m_pTextBreak->SetHorizontalScale(100); - m_pTextBreak->SetCharSpace(0); + m_TextBreak.SetFont(m_Param.pFont); + m_TextBreak.SetFontSize(m_Param.fFontSize); + m_TextBreak.SetTabWidth(m_Param.fTabWidth); + m_TextBreak.SetDefaultChar(0xFEFF); + m_TextBreak.SetParagraphBreakChar(L'\n'); + m_TextBreak.SetLineBreakTolerance(m_Param.fFontSize * 0.2f); + m_TextBreak.SetHorizontalScale(100); + m_TextBreak.SetCharSpace(0); } bool CFDE_TxtEdtEngine::ReplaceParagEnd(wchar_t*& lpText, diff --git a/xfa/fde/cfde_txtedtengine.h b/xfa/fde/cfde_txtedtengine.h index b708984ac4..547cd57eae 100644 --- a/xfa/fde/cfde_txtedtengine.h +++ b/xfa/fde/cfde_txtedtengine.h @@ -16,10 +16,10 @@ #include "xfa/fde/cfde_txtedtbuf.h" #include "xfa/fde/cfde_txtedtpage.h" #include "xfa/fde/cfde_txtedtparag.h" +#include "xfa/fgas/layout/cfx_txtbreak.h" class CFGAS_GEFont; class CFWL_Edit; -class CFX_TxtBreak; class IFDE_TxtEdtDoRecord; class IFX_CharIter; @@ -125,7 +125,7 @@ class CFDE_TxtEdtEngine { } CFDE_TxtEdtBuf* GetTextBuf() const { return m_pTxtBuf.get(); } - CFX_TxtBreak* GetTextBreak() const { return m_pTextBreak.get(); } + CFX_TxtBreak* GetTextBreak() { return &m_TextBreak; } int32_t GetLineCount() const { return m_nLineCount; } int32_t GetPageLineCount() const { return m_nPageLineCount; } @@ -205,7 +205,7 @@ class CFDE_TxtEdtEngine { void DeleteSelect(); std::unique_ptr<CFDE_TxtEdtBuf> m_pTxtBuf; - std::unique_ptr<CFX_TxtBreak> m_pTextBreak; + CFX_TxtBreak m_TextBreak; FDE_TXTEDTPARAMS m_Param; std::vector<std::unique_ptr<CFDE_TxtEdtPage>> m_PagePtrArray; std::vector<std::unique_ptr<CFDE_TxtEdtParag>> m_ParagPtrArray; |