summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-28 14:46:18 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-28 20:17:15 +0000
commitd2ee0f309037e3f4e8384b616a2a615e7ee8d6ee (patch)
tree0d242a27091d087e3f467e7448c063a569835378
parentd7de8e15eaae5a37abfcb8d1cf7028fbcebbaccd (diff)
downloadpdfium-d2ee0f309037e3f4e8384b616a2a615e7ee8d6ee.tar.xz
Convert the FX_RTFBREAK defines to an enum class
This Cl converts the type and updates the usage as required. Change-Id: I7c0f13aeabee1117086728333618504d3b65bb06 Reviewed-on: https://pdfium-review.googlesource.com/2876 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
-rw-r--r--core/fxcrt/fx_ucd.h6
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.cpp100
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.h30
-rw-r--r--xfa/fxfa/app/cxfa_textlayout.cpp26
-rw-r--r--xfa/fxfa/app/cxfa_textlayout.h4
5 files changed, 85 insertions, 81 deletions
diff --git a/core/fxcrt/fx_ucd.h b/core/fxcrt/fx_ucd.h
index c3d876671a..feb258d7fc 100644
--- a/core/fxcrt/fx_ucd.h
+++ b/core/fxcrt/fx_ucd.h
@@ -165,13 +165,15 @@ class CFX_TxtChar : public CFX_Char {
void* m_pUserData;
};
+enum class CFX_RTFBreakType { None = 0, Piece, Line, Paragraph, Page };
+
class CFX_RTFChar : public CFX_Char {
public:
CFX_RTFChar();
CFX_RTFChar(const CFX_RTFChar& other);
~CFX_RTFChar();
- uint32_t m_dwStatus;
+ CFX_RTFBreakType m_dwStatus;
int32_t m_iFontSize;
int32_t m_iFontHeight;
int16_t m_iBidiClass;
@@ -183,7 +185,7 @@ class CFX_RTFChar : public CFX_Char {
};
inline CFX_RTFChar::CFX_RTFChar()
- : m_dwStatus(0),
+ : m_dwStatus(CFX_RTFBreakType::None),
m_iFontSize(0),
m_iFontHeight(0),
m_iBidiClass(0),
diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp
index ce6de0de66..a564301ec7 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -212,8 +212,8 @@ void CFX_RTFBreak::SetBreakStatus() {
return;
CFX_RTFChar& tc = m_pCurLine->GetChar(iCount - 1);
- if (tc.m_dwStatus == 0)
- tc.m_dwStatus = FX_RTFBREAK_PieceBreak;
+ if (tc.m_dwStatus == CFX_RTFBreakType::None)
+ tc.m_dwStatus = CFX_RTFBreakType::Piece;
}
CFX_RTFChar* CFX_RTFBreak::GetLastChar(int32_t index) const {
@@ -272,7 +272,7 @@ bool CFX_RTFBreak::GetPositionedTab(int32_t& iTabPos) const {
}
return false;
}
-typedef uint32_t (CFX_RTFBreak::*FX_RTFBreak_LPFAppendChar)(
+typedef CFX_RTFBreakType (CFX_RTFBreak::*FX_RTFBreak_LPFAppendChar)(
CFX_RTFChar* pCurChar);
static const FX_RTFBreak_LPFAppendChar g_FX_RTFBreak_lpfAppendChar[16] = {
&CFX_RTFBreak::AppendChar_Others, &CFX_RTFBreak::AppendChar_Tab,
@@ -284,7 +284,8 @@ static const FX_RTFBreak_LPFAppendChar g_FX_RTFBreak_lpfAppendChar[16] = {
&CFX_RTFBreak::AppendChar_Arabic, &CFX_RTFBreak::AppendChar_Others,
&CFX_RTFBreak::AppendChar_Others, &CFX_RTFBreak::AppendChar_Others,
};
-uint32_t CFX_RTFBreak::AppendChar(FX_WCHAR wch) {
+
+CFX_RTFBreakType CFX_RTFBreak::AppendChar(FX_WCHAR wch) {
ASSERT(m_pFont && m_pCurLine);
uint32_t dwProps = kTextLayoutCodeProperties[(uint16_t)wch];
@@ -292,7 +293,7 @@ uint32_t CFX_RTFBreak::AppendChar(FX_WCHAR wch) {
m_pCurLine->m_LineChars.emplace_back();
CFX_RTFChar* pCurChar = &m_pCurLine->m_LineChars.back();
- pCurChar->m_dwStatus = 0;
+ pCurChar->m_dwStatus = CFX_RTFBreakType::None;
pCurChar->m_wCharCode = wch;
pCurChar->m_dwCharProps = dwProps;
pCurChar->m_iFontSize = m_iFontSize;
@@ -302,13 +303,13 @@ uint32_t CFX_RTFBreak::AppendChar(FX_WCHAR wch) {
pCurChar->m_iCharWidth = 0;
pCurChar->m_dwIdentity = m_dwIdentity;
pCurChar->m_pUserData = m_pUserData;
- uint32_t dwRet1 = FX_RTFBREAK_None;
+ CFX_RTFBreakType dwRet1 = CFX_RTFBreakType::None;
if (chartype != FX_CHARTYPE_Combination &&
GetUnifiedCharType(m_eCharType) != GetUnifiedCharType(chartype)) {
if (m_eCharType != FX_CHARTYPE_Unknown &&
m_pCurLine->GetLineEnd() > m_iBoundaryEnd + m_iTolerance) {
if (m_eCharType != FX_CHARTYPE_Space || chartype != FX_CHARTYPE_Control) {
- dwRet1 = EndBreak(FX_RTFBREAK_LineBreak);
+ dwRet1 = EndBreak(CFX_RTFBreakType::Line);
int32_t iCount = m_pCurLine->CountChars();
if (iCount > 0) {
pCurChar = &m_pCurLine->m_LineChars[iCount - 1];
@@ -316,14 +317,14 @@ uint32_t CFX_RTFBreak::AppendChar(FX_WCHAR wch) {
}
}
}
- uint32_t dwRet2 =
+ CFX_RTFBreakType dwRet2 =
(this->*g_FX_RTFBreak_lpfAppendChar[chartype >> FX_CHARTYPEBITS])(
pCurChar);
m_eCharType = chartype;
return std::max(dwRet1, dwRet2);
}
-uint32_t CFX_RTFBreak::AppendChar_Combination(CFX_RTFChar* pCurChar) {
+CFX_RTFBreakType CFX_RTFBreak::AppendChar_Combination(CFX_RTFChar* pCurChar) {
int32_t iCharWidth = 0;
if (!m_pFont->GetCharWidth(pCurChar->m_wCharCode, iCharWidth, false))
iCharWidth = 0;
@@ -331,18 +332,19 @@ uint32_t CFX_RTFBreak::AppendChar_Combination(CFX_RTFChar* pCurChar) {
iCharWidth *= m_iFontSize;
iCharWidth = iCharWidth * m_iHorizontalScale / 100;
CFX_RTFChar* pLastChar = GetLastChar(0);
- if (pLastChar && pLastChar->GetCharType() > FX_CHARTYPE_Combination) {
+ if (pLastChar && pLastChar->GetCharType() > FX_CHARTYPE_Combination)
iCharWidth = -iCharWidth;
- } else {
+ else
m_eCharType = FX_CHARTYPE_Combination;
- }
+
pCurChar->m_iCharWidth = iCharWidth;
- if (iCharWidth > 0) {
+ if (iCharWidth > 0)
m_pCurLine->m_iWidth += iCharWidth;
- }
- return FX_RTFBREAK_None;
+
+ return CFX_RTFBreakType::None;
}
-uint32_t CFX_RTFBreak::AppendChar_Tab(CFX_RTFChar* pCurChar) {
+
+CFX_RTFBreakType CFX_RTFBreak::AppendChar_Tab(CFX_RTFChar* pCurChar) {
if (m_dwLayoutStyles & FX_RTFLAYOUTSTYLE_ExpandTab) {
int32_t& iLineWidth = m_pCurLine->m_iWidth;
int32_t iCharWidth = iLineWidth;
@@ -354,34 +356,35 @@ uint32_t CFX_RTFBreak::AppendChar_Tab(CFX_RTFChar* pCurChar) {
pCurChar->m_iCharWidth = iCharWidth;
iLineWidth += iCharWidth;
}
- return FX_RTFBREAK_None;
+ return CFX_RTFBreakType::None;
}
-uint32_t CFX_RTFBreak::AppendChar_Control(CFX_RTFChar* pCurChar) {
- uint32_t dwRet2 = FX_RTFBREAK_None;
+
+CFX_RTFBreakType CFX_RTFBreak::AppendChar_Control(CFX_RTFChar* pCurChar) {
+ CFX_RTFBreakType dwRet2 = CFX_RTFBreakType::None;
switch (pCurChar->m_wCharCode) {
case L'\v':
case 0x2028:
- dwRet2 = FX_RTFBREAK_LineBreak;
+ dwRet2 = CFX_RTFBreakType::Line;
break;
case L'\f':
- dwRet2 = FX_RTFBREAK_PageBreak;
+ dwRet2 = CFX_RTFBreakType::Page;
break;
case 0x2029:
- dwRet2 = FX_RTFBREAK_ParagraphBreak;
+ dwRet2 = CFX_RTFBreakType::Paragraph;
break;
default:
if (pCurChar->m_wCharCode == m_wLineBreakChar) {
- dwRet2 = FX_RTFBREAK_ParagraphBreak;
+ dwRet2 = CFX_RTFBreakType::Paragraph;
}
break;
}
- if (dwRet2 != FX_RTFBREAK_None)
+ if (dwRet2 != CFX_RTFBreakType::None)
dwRet2 = EndBreak(dwRet2);
return dwRet2;
}
-uint32_t CFX_RTFBreak::AppendChar_Arabic(CFX_RTFChar* pCurChar) {
+CFX_RTFBreakType CFX_RTFBreak::AppendChar_Arabic(CFX_RTFChar* pCurChar) {
CFX_RTFChar* pLastChar = nullptr;
int32_t& iLineWidth = m_pCurLine->m_iWidth;
int32_t iCharWidth = 0;
@@ -421,12 +424,12 @@ uint32_t CFX_RTFBreak::AppendChar_Arabic(CFX_RTFChar* pCurChar) {
iLineWidth += iCharWidth;
m_pCurLine->m_iArabicChars++;
if (m_pCurLine->GetLineEnd() > m_iBoundaryEnd + m_iTolerance) {
- return EndBreak(FX_RTFBREAK_LineBreak);
+ return EndBreak(CFX_RTFBreakType::Line);
}
- return FX_RTFBREAK_None;
+ return CFX_RTFBreakType::None;
}
-uint32_t CFX_RTFBreak::AppendChar_Others(CFX_RTFChar* pCurChar) {
+CFX_RTFBreakType CFX_RTFBreak::AppendChar_Others(CFX_RTFChar* pCurChar) {
FX_CHARTYPE chartype = pCurChar->GetCharType();
FX_WCHAR wForm;
if (chartype == FX_CHARTYPE_Numeric) {
@@ -437,6 +440,7 @@ uint32_t CFX_RTFBreak::AppendChar_Others(CFX_RTFChar* pCurChar) {
} else {
wForm = pCurChar->m_wCharCode;
}
+
int32_t iCharWidth = 0;
if (!m_pFont->GetCharWidth(wForm, iCharWidth, false))
iCharWidth = m_iDefChar;
@@ -451,20 +455,20 @@ uint32_t CFX_RTFBreak::AppendChar_Others(CFX_RTFChar* pCurChar) {
m_pCurLine->m_iWidth += iCharWidth;
if (chartype != FX_CHARTYPE_Space &&
m_pCurLine->GetLineEnd() > m_iBoundaryEnd + m_iTolerance) {
- return EndBreak(FX_RTFBREAK_LineBreak);
+ return EndBreak(CFX_RTFBreakType::Line);
}
- return FX_RTFBREAK_None;
+ return CFX_RTFBreakType::None;
}
-uint32_t CFX_RTFBreak::EndBreak(uint32_t dwStatus) {
- ASSERT(dwStatus >= FX_RTFBREAK_PieceBreak &&
- dwStatus <= FX_RTFBREAK_PageBreak);
+CFX_RTFBreakType CFX_RTFBreak::EndBreak(CFX_RTFBreakType dwStatus) {
+ ASSERT(dwStatus != CFX_RTFBreakType::None);
+
m_dwIdentity++;
CFX_RTFPieceArray* pCurPieces = &m_pCurLine->m_LinePieces;
int32_t iCount = pCurPieces->GetSize();
if (iCount > 0) {
CFX_RTFPiece* pLastPiece = pCurPieces->GetPtrAt(--iCount);
- if (dwStatus > FX_RTFBREAK_PieceBreak)
+ if (dwStatus != CFX_RTFBreakType::Piece)
pLastPiece->m_dwStatus = dwStatus;
else
dwStatus = pLastPiece->m_dwStatus;
@@ -477,21 +481,22 @@ uint32_t CFX_RTFBreak::EndBreak(uint32_t dwStatus) {
iCount = pCurPieces->GetSize();
if (iCount-- > 0) {
CFX_RTFPiece* pLastPiece = pCurPieces->GetPtrAt(iCount);
- if (dwStatus > FX_RTFBREAK_PieceBreak)
+ if (dwStatus != CFX_RTFBreakType::Piece)
pLastPiece->m_dwStatus = dwStatus;
else
dwStatus = pLastPiece->m_dwStatus;
return dwStatus;
}
- return FX_RTFBREAK_None;
+ return CFX_RTFBreakType::None;
}
+
iCount = m_pCurLine->CountChars();
if (iCount < 1)
- return FX_RTFBREAK_None;
+ return CFX_RTFBreakType::None;
CFX_RTFChar& tc = m_pCurLine->GetChar(iCount - 1);
tc.m_dwStatus = dwStatus;
- if (dwStatus <= FX_RTFBREAK_PieceBreak)
+ if (dwStatus == CFX_RTFBreakType::Piece)
return dwStatus;
m_iReady = (m_pCurLine == &m_RTFLine1) ? 1 : 2;
@@ -516,7 +521,7 @@ uint32_t CFX_RTFBreak::EndBreak(uint32_t dwStatus) {
bool CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine,
bool bAllChars,
- uint32_t dwStatus) {
+ CFX_RTFBreakType dwStatus) {
bool bDone = false;
if (m_pCurLine->GetLineEnd() > m_iBoundaryEnd + m_iTolerance) {
CFX_RTFChar& tc = m_pCurLine->GetChar(m_pCurLine->CountChars() - 1);
@@ -557,7 +562,7 @@ bool CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine,
j = i;
bNew = false;
}
- if (i == iLast || pTC->m_dwStatus != FX_RTFBREAK_None ||
+ if (i == iLast || pTC->m_dwStatus != CFX_RTFBreakType::None ||
pTC->m_dwIdentity != dwIdentity) {
tp.m_iChars = i - j;
if (pTC->m_dwIdentity == dwIdentity) {
@@ -581,7 +586,8 @@ bool CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine,
}
return false;
}
-void CFX_RTFBreak::EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus) {
+void CFX_RTFBreak::EndBreak_BidiLine(CFX_TPOArray& tpos,
+ CFX_RTFBreakType dwStatus) {
FX_TPO tpo;
CFX_RTFPiece tp;
CFX_RTFChar* pTC;
@@ -610,7 +616,7 @@ void CFX_RTFBreak::EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus) {
pTC->m_iBidiOrder = 0;
}
}
- tp.m_dwStatus = FX_RTFBREAK_PieceBreak;
+ tp.m_dwStatus = CFX_RTFBreakType::Piece;
tp.m_iStartPos = m_pCurLine->m_iStart;
tp.m_pChars = &chars;
CFX_RTFPieceArray* pCurPieces = &m_pCurLine->m_LinePieces;
@@ -636,7 +642,7 @@ void CFX_RTFBreak::EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus) {
dwIdentity = pTC->m_dwIdentity;
tp.m_dwIdentity = dwIdentity;
tp.m_pUserData = pTC->m_pUserData;
- tp.m_dwStatus = FX_RTFBREAK_PieceBreak;
+ tp.m_dwStatus = CFX_RTFBreakType::Piece;
i++;
} else if (iBidiLevel != pTC->m_iBidiLevel ||
pTC->m_dwIdentity != dwIdentity) {
@@ -678,7 +684,7 @@ void CFX_RTFBreak::EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus) {
void CFX_RTFBreak::EndBreak_Alignment(CFX_TPOArray& tpos,
bool bAllChars,
- uint32_t dwStatus) {
+ CFX_RTFBreakType dwStatus) {
CFX_RTFPieceArray* pCurPieces = &m_pCurLine->m_LinePieces;
int32_t iNetWidth = m_pCurLine->m_iWidth, iGapChars = 0, iCharWidth;
int32_t iCount = pCurPieces->GetSize();
@@ -725,7 +731,7 @@ void CFX_RTFBreak::EndBreak_Alignment(CFX_TPOArray& tpos,
int32_t iOffset = m_iBoundaryEnd - iNetWidth;
if (iGapChars > 0 && (m_iAlignment == CFX_RTFLineAlignment::Distributed ||
(m_iAlignment == CFX_RTFLineAlignment::Justified &&
- dwStatus != FX_RTFBREAK_ParagraphBreak))) {
+ dwStatus != CFX_RTFBreakType::Paragraph))) {
int32_t iStart = -1;
for (i = 0; i < iCount; i++) {
tpo = tpos.GetAt(i);
@@ -897,7 +903,7 @@ void CFX_RTFBreak::SplitTextLine(CFX_RTFLine* pCurLine,
pCurLine->m_iArabicChars--;
pNextLine->m_iArabicChars++;
}
- tc->m_dwStatus = 0;
+ tc->m_dwStatus = CFX_RTFBreakType::None;
}
}
@@ -1102,7 +1108,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
}
CFX_RTFPiece::CFX_RTFPiece()
- : m_dwStatus(FX_RTFBREAK_PieceBreak),
+ : m_dwStatus(CFX_RTFBreakType::Piece),
m_iStartPos(0),
m_iWidth(-1),
m_iStartChar(0),
diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h
index 9119f9df3d..ad501fd054 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.h
+++ b/xfa/fgas/layout/fgas_rtfbreak.h
@@ -18,12 +18,6 @@
class CFGAS_GEFont;
-#define FX_RTFBREAK_None 0x00
-#define FX_RTFBREAK_PieceBreak 0x01
-#define FX_RTFBREAK_LineBreak 0x02
-#define FX_RTFBREAK_ParagraphBreak 0x03
-#define FX_RTFBREAK_PageBreak 0x04
-
#define FX_RTFLAYOUTSTYLE_Pagination 0x01
#define FX_RTFLAYOUTSTYLE_ExpandTab 0x10
@@ -105,7 +99,7 @@ class CFX_RTFPiece {
}
void Reset() {
- m_dwStatus = FX_RTFBREAK_PieceBreak;
+ m_dwStatus = CFX_RTFBreakType::Piece;
if (m_iWidth > -1) {
m_iStartPos += m_iWidth;
}
@@ -118,7 +112,7 @@ class CFX_RTFPiece {
m_iVerticalScale = 100;
}
- uint32_t m_dwStatus;
+ CFX_RTFBreakType m_dwStatus;
int32_t m_iStartPos;
int32_t m_iWidth;
int32_t m_iStartChar;
@@ -201,8 +195,8 @@ class CFX_RTFBreak {
void SetReadingOrder(bool bRTL = false);
void SetAlignment(CFX_RTFLineAlignment align) { m_iAlignment = align; }
void SetUserData(const CFX_RetainPtr<CFX_Retainable>& pUserData);
- uint32_t AppendChar(FX_WCHAR wch);
- uint32_t EndBreak(uint32_t dwStatus = FX_RTFBREAK_PieceBreak);
+ CFX_RTFBreakType AppendChar(FX_WCHAR wch);
+ CFX_RTFBreakType EndBreak(CFX_RTFBreakType dwStatus);
int32_t CountBreakPieces() const;
const CFX_RTFPiece* GetBreakPiece(int32_t index) const;
void GetLineRect(CFX_RectF& rect) const;
@@ -213,11 +207,11 @@ class CFX_RTFBreak {
bool bCharCode = false,
CFX_WideString* pWSForms = nullptr,
FX_AdjustCharDisplayPos pAdjustPos = nullptr) const;
- uint32_t AppendChar_Combination(CFX_RTFChar* pCurChar);
- uint32_t AppendChar_Tab(CFX_RTFChar* pCurChar);
- uint32_t AppendChar_Control(CFX_RTFChar* pCurChar);
- uint32_t AppendChar_Arabic(CFX_RTFChar* pCurChar);
- uint32_t AppendChar_Others(CFX_RTFChar* pCurChar);
+ CFX_RTFBreakType AppendChar_Combination(CFX_RTFChar* pCurChar);
+ CFX_RTFBreakType AppendChar_Tab(CFX_RTFChar* pCurChar);
+ CFX_RTFBreakType AppendChar_Control(CFX_RTFChar* pCurChar);
+ CFX_RTFBreakType AppendChar_Arabic(CFX_RTFChar* pCurChar);
+ CFX_RTFBreakType AppendChar_Others(CFX_RTFChar* pCurChar);
protected:
void SetBreakStatus();
@@ -237,11 +231,11 @@ class CFX_RTFBreak {
bool bAllChars = false);
bool EndBreak_SplitLine(CFX_RTFLine* pNextLine,
bool bAllChars,
- uint32_t dwStatus);
- void EndBreak_BidiLine(CFX_TPOArray& tpos, uint32_t dwStatus);
+ CFX_RTFBreakType dwStatus);
+ void EndBreak_BidiLine(CFX_TPOArray& tpos, CFX_RTFBreakType dwStatus);
void EndBreak_Alignment(CFX_TPOArray& tpos,
bool bAllChars,
- uint32_t dwStatus);
+ CFX_RTFBreakType dwStatus);
int32_t m_iBoundaryStart;
int32_t m_iBoundaryEnd;
diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp
index fe0e249c1f..9b7e2455a6 100644
--- a/xfa/fxfa/app/cxfa_textlayout.cpp
+++ b/xfa/fxfa/app/cxfa_textlayout.cpp
@@ -694,7 +694,7 @@ void CXFA_TextLayout::LoadText(CXFA_Node* pNode,
if (bRet && m_pLoader)
m_pLoader->m_pNode = pNode;
else
- EndBreak(FX_RTFBREAK_ParagraphBreak, fLinePos, bSavePieces);
+ EndBreak(CFX_RTFBreakType::Paragraph, fLinePos, bSavePieces);
}
bool CXFA_TextLayout::LoadRichText(
@@ -857,7 +857,7 @@ bool CXFA_TextLayout::LoadRichText(
m_pLoader->m_dwFlags |= XFA_LOADERCNTXTFLG_FILTERSPACE;
}
if (bCurLi)
- EndBreak(FX_RTFBREAK_LineBreak, fLinePos, bSavePieces);
+ EndBreak(CFX_RTFBreakType::Line, fLinePos, bSavePieces);
} else {
if (pContext)
eDisplay = pContext->GetDisplay();
@@ -865,9 +865,9 @@ bool CXFA_TextLayout::LoadRichText(
if (m_bBlockContinue) {
if (pContext && !bContentNode) {
- uint32_t dwStatus = (eDisplay == FDE_CSSDisplay::Block)
- ? FX_RTFBREAK_ParagraphBreak
- : FX_RTFBREAK_PieceBreak;
+ CFX_RTFBreakType dwStatus = (eDisplay == FDE_CSSDisplay::Block)
+ ? CFX_RTFBreakType::Paragraph
+ : CFX_RTFBreakType::Piece;
EndBreak(dwStatus, fLinePos, bSavePieces);
if (eDisplay == FDE_CSSDisplay::Block) {
fLinePos += fSpaceBelow;
@@ -891,7 +891,7 @@ bool CXFA_TextLayout::AppendChar(const CFX_WideString& wsText,
FX_FLOAT& fLinePos,
FX_FLOAT fSpaceAbove,
bool bSavePieces) {
- uint32_t dwStatus = 0;
+ CFX_RTFBreakType dwStatus = CFX_RTFBreakType::None;
int32_t iChar = 0;
if (m_pLoader)
iChar = m_pLoader->m_iChar;
@@ -902,14 +902,16 @@ bool CXFA_TextLayout::AppendChar(const CFX_WideString& wsText,
if (wch == 0xA0)
wch = 0x20;
- if ((dwStatus = m_pBreak->AppendChar(wch)) > FX_RTFBREAK_PieceBreak) {
+ dwStatus = m_pBreak->AppendChar(wch);
+ if (dwStatus != CFX_RTFBreakType::None &&
+ dwStatus != CFX_RTFBreakType::Piece) {
AppendTextLine(dwStatus, fLinePos, bSavePieces);
if (IsEnd(bSavePieces)) {
if (m_pLoader)
m_pLoader->m_iChar = i;
return true;
}
- if (dwStatus == FX_RTFBREAK_ParagraphBreak && m_bRichText)
+ if (dwStatus == CFX_RTFBreakType::Paragraph && m_bRichText)
fLinePos += fSpaceAbove;
}
}
@@ -949,11 +951,11 @@ void CXFA_TextLayout::ProcessText(CFX_WideString& wsText) {
wsText = wsText.Left(iTrimLeft);
}
-void CXFA_TextLayout::EndBreak(uint32_t dwStatus,
+void CXFA_TextLayout::EndBreak(CFX_RTFBreakType dwStatus,
FX_FLOAT& fLinePos,
bool bSavePieces) {
dwStatus = m_pBreak->EndBreak(dwStatus);
- if (dwStatus > FX_RTFBREAK_PieceBreak)
+ if (dwStatus != CFX_RTFBreakType::None && dwStatus != CFX_RTFBreakType::Piece)
AppendTextLine(dwStatus, fLinePos, bSavePieces, true);
}
@@ -1013,7 +1015,7 @@ void CXFA_TextLayout::DoTabstops(CFDE_CSSComputedStyle* pStyle,
}
}
-void CXFA_TextLayout::AppendTextLine(uint32_t dwStatus,
+void CXFA_TextLayout::AppendTextLine(CFX_RTFBreakType dwStatus,
FX_FLOAT& fLinePos,
bool bSavePieces,
bool bEndBreak) {
@@ -1119,7 +1121,7 @@ void CXFA_TextLayout::AppendTextLine(uint32_t dwStatus,
}
m_pBreak->ClearBreakPieces();
- if (dwStatus == FX_RTFBREAK_ParagraphBreak) {
+ if (dwStatus == CFX_RTFBreakType::Paragraph) {
m_pBreak->Reset();
if (!pStyle && bEndBreak) {
CXFA_Para para = m_pTextProvider->GetParaNode();
diff --git a/xfa/fxfa/app/cxfa_textlayout.h b/xfa/fxfa/app/cxfa_textlayout.h
index 1210056a01..cbc7160c28 100644
--- a/xfa/fxfa/app/cxfa_textlayout.h
+++ b/xfa/fxfa/app/cxfa_textlayout.h
@@ -92,11 +92,11 @@ class CXFA_TextLayout {
FX_FLOAT& fLinePos,
FX_FLOAT fSpaceAbove,
bool bSavePieces);
- void AppendTextLine(uint32_t dwStatus,
+ void AppendTextLine(CFX_RTFBreakType dwStatus,
FX_FLOAT& fLinePos,
bool bSavePieces,
bool bEndBreak = false);
- void EndBreak(uint32_t dwStatus, FX_FLOAT& fLinePos, bool bDefault);
+ void EndBreak(CFX_RTFBreakType dwStatus, FX_FLOAT& fLinePos, bool bDefault);
bool IsEnd(bool bSavePieces);
void ProcessText(CFX_WideString& wsText);
void UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom);