From e533b93601c7e9eb328619681a78c188d1a89191 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 16 Mar 2017 11:47:20 -0400 Subject: Create common base class for TxtBreak and RTFBreak. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL starts extracting common members between the two break classes into a common base class. This also normalizes some of the member names to be the same across classes. Change-Id: I7f4e5065f2dac79eb4ebba397458236cc0609d38 Reviewed-on: https://pdfium-review.googlesource.com/3058 Reviewed-by: Nicolás Peña Commit-Queue: dsinclair --- xfa/fgas/layout/fgas_rtfbreak.h | 41 +++++++---------------------------------- 1 file changed, 7 insertions(+), 34 deletions(-) (limited to 'xfa/fgas/layout/fgas_rtfbreak.h') diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h index 978634d1c8..681dc58455 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.h +++ b/xfa/fgas/layout/fgas_rtfbreak.h @@ -12,14 +12,13 @@ #include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_basic.h" +#include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_ucd.h" -#include "xfa/fgas/layout/fgas_textbreak.h" +#include "core/fxge/cfx_renderdevice.h" +#include "xfa/fgas/layout/cfx_break.h" class CFGAS_GEFont; -#define FX_RTFLAYOUTSTYLE_Pagination 0x01 -#define FX_RTFLAYOUTSTYLE_ExpandTab 0x10 - enum class CFX_RTFLineAlignment { Left = 0, Center, @@ -44,20 +43,13 @@ struct FX_RTFTEXTOBJ { int32_t iVerticalScale; }; -class CFX_RTFBreak { +class CFX_RTFBreak : public CFX_Break { public: explicit CFX_RTFBreak(uint32_t dwLayoutStyles); - ~CFX_RTFBreak(); + ~CFX_RTFBreak() override; - void SetLineBoundary(float fLineStart, float fLineEnd); void SetLineStartPos(float fLinePos); - void SetFont(const CFX_RetainPtr& pFont); - void SetFontSize(float fFontSize); - void SetTabWidth(float fTabWidth); - void SetLineBreakTolerance(float fTolerance); - void SetHorizontalScale(int32_t iScale); - void SetVerticalScale(int32_t iScale); - void SetCharSpace(float fCharSpace); + void SetAlignment(CFX_RTFLineAlignment align) { m_iAlignment = align; } void SetUserData(const CFX_RetainPtr& pUserData); @@ -84,8 +76,7 @@ class CFX_RTFBreak { CFX_BreakType AppendChar_Control(CFX_Char* pCurChar); CFX_BreakType AppendChar_Arabic(CFX_Char* pCurChar); CFX_BreakType AppendChar_Others(CFX_Char* pCurChar); - void FontChanged(); - void SetBreakStatus(); + void SetBreakStatus() override; CFX_Char* GetLastChar(int32_t index) const; bool HasRTFLine() const { return m_iReadyLineIndex >= 0; } FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE chartype) const; @@ -107,29 +98,11 @@ class CFX_RTFBreak { bool bAllChars, CFX_BreakType dwStatus); - int32_t m_iBoundaryStart; - int32_t m_iBoundaryEnd; - uint32_t m_dwLayoutStyles; bool m_bPagination; - CFX_RetainPtr m_pFont; - int32_t m_iFontHeight; - int32_t m_iFontSize; - int32_t m_iTabWidth; std::vector m_PositionedTabs; - wchar_t m_wDefChar; - int32_t m_iDefChar; - wchar_t m_wLineBreakChar; - int32_t m_iHorizontalScale; - int32_t m_iVerticalScale; - int32_t m_iCharSpace; CFX_RTFLineAlignment m_iAlignment; CFX_RetainPtr m_pUserData; - FX_CHARTYPE m_eCharType; uint32_t m_dwIdentity; - CFX_BreakLine m_RTFLine[2]; - CFX_BreakLine* m_pCurLine; - int32_t m_iTolerance; - int8_t m_iReadyLineIndex; }; #endif // XFA_FGAS_LAYOUT_FGAS_RTFBREAK_H_ -- cgit v1.2.3