summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app
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 /xfa/fxfa/app
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>
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r--xfa/fxfa/app/cxfa_textlayout.cpp26
-rw-r--r--xfa/fxfa/app/cxfa_textlayout.h4
2 files changed, 16 insertions, 14 deletions
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);