summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fxcrt/fx_ucd.h15
-rw-r--r--xfa/fde/cfde_txtedtpage.cpp20
-rw-r--r--xfa/fde/cfde_txtedtparag.cpp51
-rw-r--r--xfa/fde/tto/fde_textout.cpp77
-rw-r--r--xfa/fde/tto/fde_textout.h5
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.cpp72
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.h18
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak_unittest.cpp16
-rw-r--r--xfa/fgas/layout/fgas_textbreak.cpp122
-rw-r--r--xfa/fgas/layout/fgas_textbreak.h39
-rw-r--r--xfa/fxfa/app/cxfa_textlayout.cpp25
-rw-r--r--xfa/fxfa/app/cxfa_textlayout.h4
12 files changed, 227 insertions, 237 deletions
diff --git a/core/fxcrt/fx_ucd.h b/core/fxcrt/fx_ucd.h
index b07b387ece..0fc0bb32eb 100644
--- a/core/fxcrt/fx_ucd.h
+++ b/core/fxcrt/fx_ucd.h
@@ -118,10 +118,14 @@ FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch,
uint32_t dwProps,
bool bRTL,
bool bVertical);
+
+enum class CFX_BreakType { None = 0, Piece, Line, Paragraph, Page };
+
class CFX_Char {
public:
CFX_Char()
- : m_wCharCode(0),
+ : m_dwStatus(CFX_BreakType::None),
+ m_wCharCode(0),
m_nBreakType(0),
m_dwCharProps(0),
m_iCharWidth(0),
@@ -138,6 +142,7 @@ class CFX_Char {
FX_CHARTYPE GetCharType() const { return GetCharTypeFromProp(m_dwCharProps); }
+ CFX_BreakType m_dwStatus;
uint16_t m_wCharCode;
uint8_t m_nBreakType;
uint32_t m_dwCharProps;
@@ -151,7 +156,6 @@ class CFX_TxtChar : public CFX_Char {
CFX_TxtChar()
: m_nRotation(0),
m_dwCharStyles(0),
- m_dwStatus(0),
m_iBidiClass(0),
m_iBidiLevel(0),
m_iBidiPos(0),
@@ -160,7 +164,6 @@ class CFX_TxtChar : public CFX_Char {
int8_t m_nRotation;
uint32_t m_dwCharStyles;
- uint32_t m_dwStatus;
int16_t m_iBidiClass;
int16_t m_iBidiLevel;
int16_t m_iBidiPos;
@@ -168,15 +171,12 @@ 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();
- CFX_RTFBreakType m_dwStatus;
int32_t m_iFontSize;
int32_t m_iFontHeight;
int16_t m_iBidiClass;
@@ -188,8 +188,7 @@ class CFX_RTFChar : public CFX_Char {
};
inline CFX_RTFChar::CFX_RTFChar()
- : m_dwStatus(CFX_RTFBreakType::None),
- m_iFontSize(0),
+ : m_iFontSize(0),
m_iFontHeight(0),
m_iBidiClass(0),
m_iBidiLevel(0),
diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp
index 8b58b2b443..12333c608d 100644
--- a/xfa/fde/cfde_txtedtpage.cpp
+++ b/xfa/fde/cfde_txtedtpage.cpp
@@ -246,7 +246,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox,
m_pIter.reset(new CFDE_TxtEdtBuf::Iterator(static_cast<CFDE_TxtEdtBuf*>(pBuf),
wcAlias));
CFX_TxtBreak* pBreak = m_pEditEngine->GetTextBreak();
- pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ pBreak->EndBreak(CFX_BreakType::Paragraph);
pBreak->ClearBreakPieces();
int32_t nPageLineCount = m_pEditEngine->GetPageLineCount();
int32_t nStartLine = nPageLineCount * m_nPageIndex;
@@ -274,11 +274,11 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox,
m_pTextSet = pdfium::MakeUnique<CFDE_TxtEdtTextSet>(this);
m_Pieces.clear();
- uint32_t dwBreakStatus = FX_TXTBREAK_None;
+ CFX_BreakType dwBreakStatus = CFX_BreakType::None;
int32_t nPieceStart = 0;
m_CharWidths.resize(nPageEnd - nPageStart + 1, 0);
- pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ pBreak->EndBreak(CFX_BreakType::Paragraph);
pBreak->ClearBreakPieces();
m_nPageStart = nPageStart;
m_nCharCount = nPageEnd - nPageStart + 1;
@@ -290,15 +290,15 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox,
bool bFirstPiece = true;
do {
if (bReload) {
- dwBreakStatus = pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ dwBreakStatus = pBreak->EndBreak(CFX_BreakType::Paragraph);
} else {
FX_WCHAR wAppend = pIter->GetChar();
dwBreakStatus = pBreak->AppendChar(wAppend);
}
- if (pIter->GetAt() == nPageEnd && dwBreakStatus < FX_TXTBREAK_LineBreak) {
- dwBreakStatus = pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
- }
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
+ if (pIter->GetAt() == nPageEnd && CFX_BreakTypeNoneOrPiece(dwBreakStatus))
+ dwBreakStatus = pBreak->EndBreak(CFX_BreakType::Paragraph);
+
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus)) {
int32_t nPieceCount = pBreak->CountBreakPieces();
for (int32_t j = 0; j < nPieceCount; j++) {
const CFX_TxtPiece* pPiece = pBreak->GetBreakPiece(j);
@@ -312,7 +312,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox,
TxtEdtPiece.dwCharStyles |= FX_TXTCHARSTYLE_OddBidiLevel;
}
FX_FLOAT fParaBreakWidth = 0.0f;
- if (pPiece->m_dwStatus > FX_TXTBREAK_PieceBreak) {
+ if (!CFX_BreakTypeNoneOrPiece(pPiece->m_dwStatus)) {
FX_WCHAR wRtChar = pParams->wLineBreakChar;
if (TxtEdtPiece.nCount >= 2) {
FX_WCHAR wChar = pBuf->GetCharByIndex(
@@ -356,7 +356,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox,
fLinePos += fLineStep;
pBreak->ClearBreakPieces();
}
- if (pIter->GetAt() == nPageEnd && dwBreakStatus == FX_TXTBREAK_LineBreak) {
+ if (pIter->GetAt() == nPageEnd && dwBreakStatus == CFX_BreakType::Line) {
bReload = true;
pIter->Next(true);
}
diff --git a/xfa/fde/cfde_txtedtparag.cpp b/xfa/fde/cfde_txtedtparag.cpp
index f9f88bfb5d..f7ba6d9631 100644
--- a/xfa/fde/cfde_txtedtparag.cpp
+++ b/xfa/fde/cfde_txtedtparag.cpp
@@ -8,6 +8,7 @@
#include <memory>
+#include "third_party/base/ptr_util.h"
#include "xfa/fde/cfde_txtedtbuf.h"
#include "xfa/fde/cfde_txtedtengine.h"
#include "xfa/fde/ifde_txtedtengine.h"
@@ -37,28 +38,28 @@ void CFDE_TxtEdtParag::LoadParag() {
CFDE_TxtEdtBuf* pTxtBuf = m_pEngine->GetTextBuf();
const FDE_TXTEDTPARAMS* pParam = m_pEngine->GetEditParams();
FX_WCHAR wcAlias = 0;
- if (pParam->dwMode & FDE_TEXTEDITMODE_Password) {
+ if (pParam->dwMode & FDE_TEXTEDITMODE_Password)
wcAlias = m_pEngine->GetAliasChar();
- }
+
std::unique_ptr<IFX_CharIter> pIter(new CFDE_TxtEdtBuf::Iterator(
static_cast<CFDE_TxtEdtBuf*>(pTxtBuf), wcAlias));
pIter->SetAt(m_nCharStart);
int32_t nEndIndex = m_nCharStart + m_nCharCount;
CFX_ArrayTemplate<int32_t> LineBaseArr;
bool bReload = false;
- uint32_t dwBreakStatus = FX_TXTBREAK_None;
+ CFX_BreakType dwBreakStatus = CFX_BreakType::None;
do {
if (bReload) {
- dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ dwBreakStatus = pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
} else {
FX_WCHAR wAppend = pIter->GetChar();
dwBreakStatus = pTxtBreak->AppendChar(wAppend);
}
if (pIter->GetAt() + 1 == nEndIndex &&
- dwBreakStatus < FX_TXTBREAK_LineBreak) {
- dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ CFX_BreakTypeNoneOrPiece(dwBreakStatus)) {
+ dwBreakStatus = pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
}
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus)) {
int32_t nCount = pTxtBreak->CountBreakPieces();
int32_t nTotal = 0;
for (int32_t j = 0; j < nCount; j++) {
@@ -68,28 +69,28 @@ void CFDE_TxtEdtParag::LoadParag() {
LineBaseArr.Add(nTotal);
pTxtBreak->ClearBreakPieces();
}
- if ((pIter->GetAt() + 1 == nEndIndex) &&
- (dwBreakStatus == FX_TXTBREAK_LineBreak)) {
+ if (pIter->GetAt() + 1 == nEndIndex &&
+ dwBreakStatus == CFX_BreakType::Line) {
bReload = true;
pIter->Next(true);
}
} while (pIter->Next(false) && (pIter->GetAt() < nEndIndex));
- pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
pTxtBreak->ClearBreakPieces();
int32_t nLineCount = LineBaseArr.GetSize();
m_nLineCount = nLineCount;
- if (m_lpData) {
+ if (m_lpData)
m_lpData = FX_Realloc(int32_t, m_lpData, nLineCount + 1);
- } else {
+ else
m_lpData = FX_Alloc(int32_t, nLineCount + 1);
- }
+
int32_t* pIntArr = m_lpData;
pIntArr[0] = 1;
m_nLineCount = nLineCount;
pIntArr++;
- for (int32_t j = 0; j < nLineCount; j++, pIntArr++) {
+ for (int32_t j = 0; j < nLineCount; j++, pIntArr++)
*pIntArr = LineBaseArr[j];
- }
+
LineBaseArr.RemoveAll();
}
@@ -106,34 +107,34 @@ void CFDE_TxtEdtParag::CalcLines() {
CFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak();
CFDE_TxtEdtBuf* pTxtBuf = m_pEngine->GetTextBuf();
int32_t nCount = 0;
- uint32_t dwBreakStatus = FX_TXTBREAK_None;
+ CFX_BreakType dwBreakStatus = CFX_BreakType::None;
int32_t nEndIndex = m_nCharStart + m_nCharCount;
- std::unique_ptr<IFX_CharIter> pIter(
- new CFDE_TxtEdtBuf::Iterator(static_cast<CFDE_TxtEdtBuf*>(pTxtBuf)));
+ auto pIter = pdfium::MakeUnique<CFDE_TxtEdtBuf::Iterator>(
+ static_cast<CFDE_TxtEdtBuf*>(pTxtBuf));
pIter->SetAt(m_nCharStart);
bool bReload = false;
do {
if (bReload) {
- dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ dwBreakStatus = pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
} else {
FX_WCHAR wAppend = pIter->GetChar();
dwBreakStatus = pTxtBreak->AppendChar(wAppend);
}
if (pIter->GetAt() + 1 == nEndIndex &&
- dwBreakStatus < FX_TXTBREAK_LineBreak) {
- dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ CFX_BreakTypeNoneOrPiece(dwBreakStatus)) {
+ dwBreakStatus = pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
}
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus)) {
nCount++;
pTxtBreak->ClearBreakPieces();
}
- if ((pIter->GetAt() + 1 == nEndIndex) &&
- (dwBreakStatus == FX_TXTBREAK_LineBreak)) {
+ if (pIter->GetAt() + 1 == nEndIndex &&
+ dwBreakStatus == CFX_BreakType::Line) {
bReload = true;
pIter->Next(true);
}
} while (pIter->Next(false) && (pIter->GetAt() < nEndIndex));
- pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
+ pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
pTxtBreak->ClearBreakPieces();
m_nLineCount = nCount;
}
diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp
index b4bbe67238..93be50d34a 100644
--- a/xfa/fde/tto/fde_textout.cpp
+++ b/xfa/fde/tto/fde_textout.cpp
@@ -196,7 +196,7 @@ void CFDE_TextOut::CalcTextSize(const FX_WCHAR* pwsStr,
FX_FLOAT fWidth = 0.0f;
FX_FLOAT fHeight = 0.0f;
FX_FLOAT fStartPos = bVertical ? rect.bottom() : rect.right();
- uint32_t dwBreakStatus = 0;
+ CFX_BreakType dwBreakStatus = CFX_BreakType::None;
FX_WCHAR wPreChar = 0;
FX_WCHAR wch;
FX_WCHAR wBreak = 0;
@@ -211,15 +211,15 @@ void CFDE_TextOut::CalcTextSize(const FX_WCHAR* pwsStr,
continue;
}
dwBreakStatus = m_pTxtBreak->AppendChar(wch);
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
RetrieveLineWidth(dwBreakStatus, fStartPos, fWidth, fHeight);
- }
+
wPreChar = 0;
}
- dwBreakStatus = m_pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
+ dwBreakStatus = m_pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
RetrieveLineWidth(dwBreakStatus, fStartPos, fWidth, fHeight);
- }
+
m_pTxtBreak->Reset();
FX_FLOAT fInc = rect.Height() - fHeight;
if (bVertical) {
@@ -265,13 +265,13 @@ void CFDE_TextOut::SetLineWidth(CFX_RectF& rect) {
}
}
-bool CFDE_TextOut::RetrieveLineWidth(uint32_t dwBreakStatus,
+bool CFDE_TextOut::RetrieveLineWidth(CFX_BreakType dwBreakStatus,
FX_FLOAT& fStartPos,
FX_FLOAT& fWidth,
FX_FLOAT& fHeight) {
- if (dwBreakStatus <= FX_TXTBREAK_PieceBreak) {
+ if (CFX_BreakTypeNoneOrPiece(dwBreakStatus))
return false;
- }
+
FX_FLOAT fLineStep =
(m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize;
bool bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap);
@@ -279,14 +279,15 @@ bool CFDE_TextOut::RetrieveLineWidth(uint32_t dwBreakStatus,
int32_t iCount = m_pTxtBreak->CountBreakPieces();
for (int32_t i = 0; i < iCount; i++) {
const CFX_TxtPiece* pPiece = m_pTxtBreak->GetBreakPiece(i);
- fLineWidth += (FX_FLOAT)pPiece->m_iWidth / 20000.0f;
- fStartPos = std::min(fStartPos, (FX_FLOAT)pPiece->m_iStartPos / 20000.0f);
+ fLineWidth += static_cast<FX_FLOAT>(pPiece->m_iWidth) / 20000.0f;
+ fStartPos = std::min(fStartPos,
+ static_cast<FX_FLOAT>(pPiece->m_iStartPos) / 20000.0f);
}
m_pTxtBreak->ClearBreakPieces();
- if (dwBreakStatus == FX_TXTBREAK_ParagraphBreak) {
+ if (dwBreakStatus == CFX_BreakType::Paragraph) {
m_pTxtBreak->Reset();
}
- if (!bLineWrap && dwBreakStatus == FX_TXTBREAK_LineBreak) {
+ if (!bLineWrap && dwBreakStatus == CFX_BreakType::Line) {
fWidth += fLineWidth;
} else {
fWidth = std::max(fWidth, fLineWidth);
@@ -404,17 +405,18 @@ void CFDE_TextOut::LoadEllipsis() {
}
ExpandBuffer(iLength, 1);
const FX_WCHAR* pStr = m_wsEllipsis.c_str();
- uint32_t dwBreakStatus;
+ CFX_BreakType dwBreakStatus;
FX_WCHAR wch;
while (iLength-- > 0) {
wch = *pStr++;
dwBreakStatus = m_pTxtBreak->AppendChar(wch);
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak)
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
RetrieveEllPieces(&m_EllCharWidths);
}
- dwBreakStatus = m_pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak)
+ dwBreakStatus = m_pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
RetrieveEllPieces(&m_EllCharWidths);
+
m_pTxtBreak->Reset();
}
@@ -454,7 +456,7 @@ void CFDE_TextOut::LoadText(const FX_WCHAR* pwsStr,
int32_t iStartChar = 0;
int32_t iChars = 0;
int32_t iPieceWidths = 0;
- uint32_t dwBreakStatus;
+ CFX_BreakType dwBreakStatus;
FX_WCHAR wch;
bool bRet = false;
while (iTxtLength-- > 0) {
@@ -467,11 +469,12 @@ void CFDE_TextOut::LoadText(const FX_WCHAR* pwsStr,
*pStr++ = wch;
iChars++;
dwBreakStatus = m_pTxtBreak->AppendChar(wch);
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus)) {
bool bEndofLine =
- RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, false, rect);
- if (bEndofLine && (bLineWrap || (dwBreakStatus > FX_TXTBREAK_LineBreak &&
- !bLineWrap))) {
+ RetrievePieces(dwBreakStatus, iStartChar, iPieceWidths, false, rect);
+ if (bEndofLine &&
+ (bLineWrap || dwBreakStatus == CFX_BreakType::Paragraph ||
+ dwBreakStatus == CFX_BreakType::Page)) {
iPieceWidths = 0;
m_iCurLine++;
m_fLinePos += fLineStep;
@@ -485,16 +488,16 @@ void CFDE_TextOut::LoadText(const FX_WCHAR* pwsStr,
}
}
}
- dwBreakStatus = m_pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak && !bRet) {
- RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, false, rect);
- }
+ dwBreakStatus = m_pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus) && !bRet)
+ RetrievePieces(dwBreakStatus, iStartChar, iPieceWidths, false, rect);
+
m_pTxtBreak->ClearBreakPieces();
m_pTxtBreak->Reset();
m_wsText.ReleaseBuffer(iLength);
}
-bool CFDE_TextOut::RetriecePieces(uint32_t dwBreakStatus,
+bool CFDE_TextOut::RetrievePieces(CFX_BreakType dwBreakStatus,
int32_t& iStartChar,
int32_t& iPieceWidths,
bool bReload,
@@ -559,9 +562,8 @@ bool CFDE_TextOut::RetriecePieces(uint32_t dwBreakStatus,
iPieceWidths += iWidth;
}
m_pTxtBreak->ClearBreakPieces();
- bool bRet = bSingleLine || bLineWrap || (!bLineWrap && bNeedReload) ||
- dwBreakStatus == FX_TXTBREAK_ParagraphBreak;
- return bRet;
+ return bSingleLine || bLineWrap || bNeedReload ||
+ dwBreakStatus == CFX_BreakType::Paragraph;
}
void CFDE_TextOut::AppendPiece(const FDE_TTOPIECE& ttoPiece,
@@ -650,7 +652,7 @@ void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) {
m_fLinePos = bVertical ? pPiece->rtPiece.left : pPiece->rtPiece.top;
int32_t iPieceCount = pLine->GetSize();
int32_t iPieceIndex = 0;
- uint32_t dwBreakStatus = 0;
+ CFX_BreakType dwBreakStatus = CFX_BreakType::None;
FX_WCHAR wch;
while (iPieceIndex < iPieceCount) {
int32_t iStar = iStartChar;
@@ -658,18 +660,17 @@ void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) {
while (iStar < iEnd) {
wch = *(pwsStr + iStar);
dwBreakStatus = m_pTxtBreak->AppendChar(wch);
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
- RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, true, rect);
- }
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
+ RetrievePieces(dwBreakStatus, iStartChar, iPieceWidths, true, rect);
iStar++;
}
iPieceIndex++;
pPiece = pLine->GetPtrAt(iPieceIndex);
}
- dwBreakStatus = m_pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak);
- if (dwBreakStatus > FX_TXTBREAK_PieceBreak) {
- RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, true, rect);
- }
+ dwBreakStatus = m_pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
+ if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
+ RetrievePieces(dwBreakStatus, iStartChar, iPieceWidths, true, rect);
+
m_pTxtBreak->Reset();
}
diff --git a/xfa/fde/tto/fde_textout.h b/xfa/fde/tto/fde_textout.h
index 04d656776e..fd9f6027f4 100644
--- a/xfa/fde/tto/fde_textout.h
+++ b/xfa/fde/tto/fde_textout.h
@@ -11,6 +11,7 @@
#include <memory>
#include <vector>
+#include "core/fxcrt/fx_ucd.h"
#include "core/fxge/cfx_fxgedevice.h"
#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/fx_dib.h"
@@ -120,7 +121,7 @@ class CFDE_TextOut {
protected:
void CalcTextSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_RectF& rect);
- bool RetrieveLineWidth(uint32_t dwBreakStatus,
+ bool RetrieveLineWidth(CFX_BreakType dwBreakStatus,
FX_FLOAT& fStartPos,
FX_FLOAT& fWidth,
FX_FLOAT& fHeight);
@@ -136,7 +137,7 @@ class CFDE_TextOut {
void Reload(const CFX_RectF& rect);
void ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect);
- bool RetriecePieces(uint32_t dwBreakStatus,
+ bool RetrievePieces(CFX_BreakType dwBreakStatus,
int32_t& iStartChar,
int32_t& iPieceWidths,
bool bReload,
diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp
index 50fda35bdd..8f1761dea8 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -149,8 +149,8 @@ void CFX_RTFBreak::SetBreakStatus() {
return;
CFX_RTFChar& tc = m_pCurLine->GetChar(iCount - 1);
- if (tc.m_dwStatus == CFX_RTFBreakType::None)
- tc.m_dwStatus = CFX_RTFBreakType::Piece;
+ if (tc.m_dwStatus == CFX_BreakType::None)
+ tc.m_dwStatus = CFX_BreakType::Piece;
}
CFX_RTFChar* CFX_RTFBreak::GetLastChar(int32_t index) const {
@@ -190,7 +190,7 @@ bool CFX_RTFBreak::GetPositionedTab(int32_t* iTabPos) const {
return true;
}
-CFX_RTFBreakType CFX_RTFBreak::AppendChar(FX_WCHAR wch) {
+CFX_BreakType CFX_RTFBreak::AppendChar(FX_WCHAR wch) {
ASSERT(m_pFont && m_pCurLine);
uint32_t dwProps = kTextLayoutCodeProperties[static_cast<uint16_t>(wch)];
@@ -198,7 +198,7 @@ CFX_RTFBreakType CFX_RTFBreak::AppendChar(FX_WCHAR wch) {
m_pCurLine->m_LineChars.emplace_back();
CFX_RTFChar* pCurChar = &m_pCurLine->m_LineChars.back();
- pCurChar->m_dwStatus = CFX_RTFBreakType::None;
+ pCurChar->m_dwStatus = CFX_BreakType::None;
pCurChar->m_wCharCode = wch;
pCurChar->m_dwCharProps = dwProps;
pCurChar->m_iFontSize = m_iFontSize;
@@ -209,19 +209,19 @@ CFX_RTFBreakType CFX_RTFBreak::AppendChar(FX_WCHAR wch) {
pCurChar->m_dwIdentity = m_dwIdentity;
pCurChar->m_pUserData = m_pUserData;
- CFX_RTFBreakType dwRet1 = CFX_RTFBreakType::None;
+ CFX_BreakType dwRet1 = CFX_BreakType::None;
if (chartype != FX_CHARTYPE_Combination &&
GetUnifiedCharType(m_eCharType) != GetUnifiedCharType(chartype) &&
m_eCharType != FX_CHARTYPE_Unknown &&
m_pCurLine->GetLineEnd() > m_iBoundaryEnd + m_iTolerance &&
(m_eCharType != FX_CHARTYPE_Space || chartype != FX_CHARTYPE_Control)) {
- dwRet1 = EndBreak(CFX_RTFBreakType::Line);
+ dwRet1 = EndBreak(CFX_BreakType::Line);
int32_t iCount = m_pCurLine->CountChars();
if (iCount > 0)
pCurChar = &m_pCurLine->m_LineChars[iCount - 1];
}
- CFX_RTFBreakType dwRet2 = CFX_RTFBreakType::None;
+ CFX_BreakType dwRet2 = CFX_BreakType::None;
switch (chartype) {
case FX_CHARTYPE_Tab:
AppendChar_Tab(pCurChar);
@@ -286,31 +286,31 @@ void CFX_RTFBreak::AppendChar_Tab(CFX_RTFChar* pCurChar) {
iLineWidth += iCharWidth;
}
-CFX_RTFBreakType CFX_RTFBreak::AppendChar_Control(CFX_RTFChar* pCurChar) {
- CFX_RTFBreakType dwRet2 = CFX_RTFBreakType::None;
+CFX_BreakType CFX_RTFBreak::AppendChar_Control(CFX_RTFChar* pCurChar) {
+ CFX_BreakType dwRet2 = CFX_BreakType::None;
switch (pCurChar->m_wCharCode) {
case L'\v':
case 0x2028:
- dwRet2 = CFX_RTFBreakType::Line;
+ dwRet2 = CFX_BreakType::Line;
break;
case L'\f':
- dwRet2 = CFX_RTFBreakType::Page;
+ dwRet2 = CFX_BreakType::Page;
break;
case 0x2029:
- dwRet2 = CFX_RTFBreakType::Paragraph;
+ dwRet2 = CFX_BreakType::Paragraph;
break;
default:
if (pCurChar->m_wCharCode == m_wLineBreakChar)
- dwRet2 = CFX_RTFBreakType::Paragraph;
+ dwRet2 = CFX_BreakType::Paragraph;
break;
}
- if (dwRet2 != CFX_RTFBreakType::None)
+ if (dwRet2 != CFX_BreakType::None)
dwRet2 = EndBreak(dwRet2);
return dwRet2;
}
-CFX_RTFBreakType CFX_RTFBreak::AppendChar_Arabic(CFX_RTFChar* pCurChar) {
+CFX_BreakType CFX_RTFBreak::AppendChar_Arabic(CFX_RTFChar* pCurChar) {
CFX_RTFChar* pLastChar = nullptr;
int32_t iCharWidth = 0;
FX_WCHAR wForm;
@@ -351,11 +351,11 @@ CFX_RTFBreakType CFX_RTFBreak::AppendChar_Arabic(CFX_RTFChar* pCurChar) {
m_pCurLine->m_iArabicChars++;
if (m_pCurLine->GetLineEnd() > m_iBoundaryEnd + m_iTolerance)
- return EndBreak(CFX_RTFBreakType::Line);
- return CFX_RTFBreakType::None;
+ return EndBreak(CFX_BreakType::Line);
+ return CFX_BreakType::None;
}
-CFX_RTFBreakType CFX_RTFBreak::AppendChar_Others(CFX_RTFChar* pCurChar) {
+CFX_BreakType CFX_RTFBreak::AppendChar_Others(CFX_RTFChar* pCurChar) {
FX_CHARTYPE chartype = pCurChar->GetCharType();
FX_WCHAR wForm = pCurChar->m_wCharCode;
int32_t iCharWidth = 0;
@@ -370,37 +370,37 @@ CFX_RTFBreakType 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(CFX_RTFBreakType::Line);
+ return EndBreak(CFX_BreakType::Line);
}
- return CFX_RTFBreakType::None;
+ return CFX_BreakType::None;
}
-CFX_RTFBreakType CFX_RTFBreak::EndBreak(CFX_RTFBreakType dwStatus) {
- ASSERT(dwStatus != CFX_RTFBreakType::None);
+CFX_BreakType CFX_RTFBreak::EndBreak(CFX_BreakType dwStatus) {
+ ASSERT(dwStatus != CFX_BreakType::None);
++m_dwIdentity;
if (!m_pCurLine->m_LinePieces.empty()) {
- if (dwStatus != CFX_RTFBreakType::Piece)
+ if (dwStatus != CFX_BreakType::Piece)
m_pCurLine->m_LinePieces.back().m_dwStatus = dwStatus;
return m_pCurLine->m_LinePieces.back().m_dwStatus;
}
if (HasRTFLine()) {
if (!m_RTFLine[m_iReady].m_LinePieces.empty()) {
- if (dwStatus != CFX_RTFBreakType::Piece)
+ if (dwStatus != CFX_BreakType::Piece)
m_RTFLine[m_iReady].m_LinePieces.back().m_dwStatus = dwStatus;
return m_RTFLine[m_iReady].m_LinePieces.back().m_dwStatus;
}
- return CFX_RTFBreakType::None;
+ return CFX_BreakType::None;
}
int32_t iCount = m_pCurLine->CountChars();
if (iCount < 1)
- return CFX_RTFBreakType::None;
+ return CFX_BreakType::None;
CFX_RTFChar& tc = m_pCurLine->GetChar(iCount - 1);
tc.m_dwStatus = dwStatus;
- if (dwStatus == CFX_RTFBreakType::Piece)
+ if (dwStatus == CFX_BreakType::Piece)
return dwStatus;
m_iReady = m_pCurLine == &m_RTFLine[0] ? 0 : 1;
@@ -424,7 +424,7 @@ CFX_RTFBreakType CFX_RTFBreak::EndBreak(CFX_RTFBreakType dwStatus) {
bool CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine,
bool bAllChars,
- CFX_RTFBreakType dwStatus) {
+ CFX_BreakType dwStatus) {
bool bDone = false;
if (m_pCurLine->GetLineEnd() > m_iBoundaryEnd + m_iTolerance) {
const CFX_RTFChar& tc = m_pCurLine->GetChar(m_pCurLine->CountChars() - 1);
@@ -473,7 +473,7 @@ bool CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine,
bNew = false;
}
- if (i == iLast || pTC->m_dwStatus != CFX_RTFBreakType::None ||
+ if (i == iLast || pTC->m_dwStatus != CFX_BreakType::None ||
pTC->m_dwIdentity != dwIdentity) {
tp.m_iChars = i - j;
if (pTC->m_dwIdentity == dwIdentity) {
@@ -493,7 +493,7 @@ bool CFX_RTFBreak::EndBreak_SplitLine(CFX_RTFLine* pNextLine,
}
void CFX_RTFBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
- CFX_RTFBreakType dwStatus) {
+ CFX_BreakType dwStatus) {
CFX_RTFChar* pTC;
std::vector<CFX_RTFChar>& chars = m_pCurLine->m_LineChars;
int32_t iCount = m_pCurLine->CountChars();
@@ -518,7 +518,7 @@ void CFX_RTFBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
}
CFX_RTFPiece tp;
- tp.m_dwStatus = CFX_RTFBreakType::Piece;
+ tp.m_dwStatus = CFX_BreakType::Piece;
tp.m_iStartPos = m_pCurLine->m_iStart;
tp.m_pChars = &chars;
@@ -543,7 +543,7 @@ void CFX_RTFBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
dwIdentity = pTC->m_dwIdentity;
tp.m_dwIdentity = dwIdentity;
tp.m_pUserData = pTC->m_pUserData;
- tp.m_dwStatus = CFX_RTFBreakType::Piece;
+ tp.m_dwStatus = CFX_BreakType::Piece;
++i;
} else if (iBidiLevel != pTC->m_iBidiLevel ||
pTC->m_dwIdentity != dwIdentity) {
@@ -585,7 +585,7 @@ void CFX_RTFBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
void CFX_RTFBreak::EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
bool bAllChars,
- CFX_RTFBreakType dwStatus) {
+ CFX_BreakType dwStatus) {
int32_t iNetWidth = m_pCurLine->m_iWidth;
int32_t iGapChars = 0;
bool bFind = false;
@@ -625,7 +625,7 @@ void CFX_RTFBreak::EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
int32_t iOffset = m_iBoundaryEnd - iNetWidth;
if (iGapChars > 0 && (m_iAlignment == CFX_RTFLineAlignment::Distributed ||
(m_iAlignment == CFX_RTFLineAlignment::Justified &&
- dwStatus != CFX_RTFBreakType::Paragraph))) {
+ dwStatus != CFX_BreakType::Paragraph))) {
int32_t iStart = -1;
for (const auto& tpo : tpos) {
CFX_RTFPiece& ttp = m_pCurLine->m_LinePieces[tpo.index];
@@ -789,7 +789,7 @@ void CFX_RTFBreak::SplitTextLine(CFX_RTFLine* pCurLine,
pCurLine->m_iArabicChars--;
pNextLine->m_iArabicChars++;
}
- pNextLine->m_LineChars[i].m_dwStatus = CFX_RTFBreakType::None;
+ pNextLine->m_LineChars[i].m_dwStatus = CFX_BreakType::None;
}
}
@@ -938,7 +938,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
}
CFX_RTFPiece::CFX_RTFPiece()
- : m_dwStatus(CFX_RTFBreakType::Piece),
+ : m_dwStatus(CFX_BreakType::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 125b06fe95..5d29e0e84f 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.h
+++ b/xfa/fgas/layout/fgas_rtfbreak.h
@@ -76,7 +76,7 @@ class CFX_RTFPiece {
return ret;
}
- CFX_RTFBreakType m_dwStatus;
+ CFX_BreakType m_dwStatus;
int32_t m_iStartPos;
int32_t m_iWidth;
int32_t m_iStartChar;
@@ -140,7 +140,7 @@ class CFX_RTFBreak {
void AddPositionedTab(FX_FLOAT fTabPos);
- CFX_RTFBreakType EndBreak(CFX_RTFBreakType dwStatus);
+ CFX_BreakType EndBreak(CFX_BreakType dwStatus);
int32_t CountBreakPieces() const;
const CFX_RTFPiece* GetBreakPieceUnstable(int32_t index) const;
void ClearBreakPieces();
@@ -151,16 +151,16 @@ class CFX_RTFBreak {
FXTEXT_CHARPOS* pCharPos,
bool bCharCode) const;
- CFX_RTFBreakType AppendChar(FX_WCHAR wch);
+ CFX_BreakType AppendChar(FX_WCHAR wch);
CFX_RTFLine* GetCurrentLineForTesting() const { return m_pCurLine; }
private:
void AppendChar_Combination(CFX_RTFChar* pCurChar);
void 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);
+ CFX_BreakType AppendChar_Control(CFX_RTFChar* pCurChar);
+ CFX_BreakType AppendChar_Arabic(CFX_RTFChar* pCurChar);
+ CFX_BreakType AppendChar_Others(CFX_RTFChar* pCurChar);
void FontChanged();
void SetBreakStatus();
CFX_RTFChar* GetLastChar(int32_t index) const;
@@ -178,11 +178,11 @@ class CFX_RTFBreak {
bool bAllChars);
bool EndBreak_SplitLine(CFX_RTFLine* pNextLine,
bool bAllChars,
- CFX_RTFBreakType dwStatus);
- void EndBreak_BidiLine(std::deque<FX_TPO>* tpos, CFX_RTFBreakType dwStatus);
+ CFX_BreakType dwStatus);
+ void EndBreak_BidiLine(std::deque<FX_TPO>* tpos, CFX_BreakType dwStatus);
void EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
bool bAllChars,
- CFX_RTFBreakType dwStatus);
+ CFX_BreakType dwStatus);
int32_t m_iBoundaryStart;
int32_t m_iBoundaryEnd;
diff --git a/xfa/fgas/layout/fgas_rtfbreak_unittest.cpp b/xfa/fgas/layout/fgas_rtfbreak_unittest.cpp
index bbac9d5806..b20afb7103 100644
--- a/xfa/fgas/layout/fgas_rtfbreak_unittest.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak_unittest.cpp
@@ -54,9 +54,9 @@ TEST_F(RTFBreakTest, AddChars) {
CFX_WideString str(L"Input String.");
for (int32_t i = 0; i < str.GetLength(); i++)
- EXPECT_EQ(CFX_RTFBreakType::None, b->AppendChar(str.GetAt(i)));
+ EXPECT_EQ(CFX_BreakType::None, b->AppendChar(str.GetAt(i)));
- EXPECT_EQ(CFX_RTFBreakType::Paragraph, b->AppendChar(L'\n'));
+ EXPECT_EQ(CFX_BreakType::Paragraph, b->AppendChar(L'\n'));
ASSERT_EQ(1, b->CountBreakPieces());
EXPECT_EQ(str + L"\n", b->GetBreakPieceUnstable(0)->GetString());
@@ -66,21 +66,21 @@ TEST_F(RTFBreakTest, AddChars) {
str = L"Second str.";
for (int32_t i = 0; i < str.GetLength(); i++)
- EXPECT_EQ(CFX_RTFBreakType::None, b->AppendChar(str.GetAt(i)));
+ EXPECT_EQ(CFX_BreakType::None, b->AppendChar(str.GetAt(i)));
// Force the end of the break at the end of the string.
- b->EndBreak(CFX_RTFBreakType::Paragraph);
+ b->EndBreak(CFX_BreakType::Paragraph);
ASSERT_EQ(1, b->CountBreakPieces());
EXPECT_EQ(str, b->GetBreakPieceUnstable(0)->GetString());
}
TEST_F(RTFBreakTest, ControlCharacters) {
auto b = CreateBreak(FX_RTFLAYOUTSTYLE_ExpandTab);
- EXPECT_EQ(CFX_RTFBreakType::Line, b->AppendChar(L'\v'));
- EXPECT_EQ(CFX_RTFBreakType::Page, b->AppendChar(L'\f'));
+ EXPECT_EQ(CFX_BreakType::Line, b->AppendChar(L'\v'));
+ EXPECT_EQ(CFX_BreakType::Page, b->AppendChar(L'\f'));
// 0x2029 is the Paragraph Separator unicode character.
- EXPECT_EQ(CFX_RTFBreakType::Paragraph, b->AppendChar(0x2029));
- EXPECT_EQ(CFX_RTFBreakType::Paragraph, b->AppendChar(L'\n'));
+ EXPECT_EQ(CFX_BreakType::Paragraph, b->AppendChar(0x2029));
+ EXPECT_EQ(CFX_BreakType::Paragraph, b->AppendChar(L'\n'));
ASSERT_EQ(1, b->CountBreakPieces());
EXPECT_EQ(L"\v", b->GetBreakPieceUnstable(0)->GetString());
diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp
index e458f4c283..832521dbee 100644
--- a/xfa/fgas/layout/fgas_textbreak.cpp
+++ b/xfa/fgas/layout/fgas_textbreak.cpp
@@ -16,7 +16,7 @@
namespace {
-typedef uint32_t (CFX_TxtBreak::*FX_TxtBreak_LPFAppendChar)(
+typedef CFX_BreakType (CFX_TxtBreak::*FX_TxtBreak_LPFAppendChar)(
CFX_TxtChar* pCurChar,
int32_t iRotation);
const FX_TxtBreak_LPFAppendChar g_FX_TxtBreak_lpfAppendChar[16] = {
@@ -35,6 +35,8 @@ bool IsCtrlCode(FX_WCHAR ch) {
return dwRet == FX_CHARTYPE_Tab || dwRet == FX_CHARTYPE_Control;
}
+const int kMinimumTabWidth = 160000;
+
} // namespace
CFX_TxtBreak::CFX_TxtBreak()
@@ -133,10 +135,7 @@ void CFX_TxtBreak::FontChanged() {
}
void CFX_TxtBreak::SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant) {
- m_iTabWidth = FXSYS_round(fTabWidth * 20000.0f);
- if (m_iTabWidth < FX_TXTBREAK_MinimumTabWidth)
- m_iTabWidth = FX_TXTBREAK_MinimumTabWidth;
-
+ m_iTabWidth = std::max(FXSYS_round(fTabWidth * 20000.0f), kMinimumTabWidth);
m_bEquidistant = bEquidistant;
}
@@ -214,8 +213,8 @@ void CFX_TxtBreak::SetBreakStatus() {
return;
CFX_TxtChar* pTC = m_pCurLine->GetCharPtr(iCount - 1);
- if (pTC->m_dwStatus == 0)
- pTC->m_dwStatus = FX_TXTBREAK_PieceBreak;
+ if (pTC->m_dwStatus == CFX_BreakType::None)
+ pTC->m_dwStatus = CFX_BreakType::Piece;
}
void CFX_TxtBreak::SetHorizontalScale(int32_t iScale) {
@@ -295,7 +294,7 @@ void CFX_TxtBreak::ResetArabicContext() {
void CFX_TxtBreak::AppendChar_PageLoad(CFX_TxtChar* pCurChar,
uint32_t dwProps) {
- pCurChar->m_dwStatus = 0;
+ pCurChar->m_dwStatus = CFX_BreakType::None;
pCurChar->m_pUserData = m_pUserData;
if (m_bArabicContext || m_bArabicShapes) {
@@ -312,15 +311,15 @@ void CFX_TxtBreak::AppendChar_PageLoad(CFX_TxtChar* pCurChar,
ResetArabicContext();
CFX_TxtChar* pLastChar = GetLastChar(1, false);
- if (pLastChar && pLastChar->m_dwStatus < 1)
- pLastChar->m_dwStatus = FX_TXTBREAK_PieceBreak;
+ if (pLastChar && pLastChar->m_dwStatus == CFX_BreakType::None)
+ pLastChar->m_dwStatus = CFX_BreakType::Piece;
}
}
pCurChar->m_dwCharStyles = m_dwContextCharStyles;
}
-uint32_t CFX_TxtBreak::AppendChar_Combination(CFX_TxtChar* pCurChar,
- int32_t iRotation) {
+CFX_BreakType CFX_TxtBreak::AppendChar_Combination(CFX_TxtChar* pCurChar,
+ int32_t iRotation) {
FX_WCHAR wch = pCurChar->m_wCharCode;
FX_WCHAR wForm;
int32_t iCharWidth = 0;
@@ -361,14 +360,14 @@ uint32_t CFX_TxtBreak::AppendChar_Combination(CFX_TxtChar* pCurChar,
iCharWidth = iCharWidth * m_iHorScale / 100;
}
pCurChar->m_iCharWidth = -iCharWidth;
- return FX_TXTBREAK_None;
+ return CFX_BreakType::None;
}
-uint32_t CFX_TxtBreak::AppendChar_Tab(CFX_TxtChar* pCurChar,
- int32_t iRotation) {
+CFX_BreakType CFX_TxtBreak::AppendChar_Tab(CFX_TxtChar* pCurChar,
+ int32_t iRotation) {
m_eCharType = FX_CHARTYPE_Tab;
if ((m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_ExpandTab) == 0)
- return FX_TXTBREAK_None;
+ return CFX_BreakType::None;
int32_t& iLineWidth = m_pCurLine->m_iWidth;
int32_t iCharWidth;
@@ -376,9 +375,8 @@ uint32_t CFX_TxtBreak::AppendChar_Tab(CFX_TxtChar* pCurChar,
iCharWidth = m_iCombWidth;
} else {
if (m_bEquidistant) {
- iCharWidth = iLineWidth;
- iCharWidth = m_iTabWidth * (iCharWidth / m_iTabWidth + 1) - iCharWidth;
- if (iCharWidth < FX_TXTBREAK_MinimumTabWidth)
+ iCharWidth = m_iTabWidth * (iLineWidth / m_iTabWidth + 1) - iLineWidth;
+ if (iCharWidth < kMinimumTabWidth)
iCharWidth += m_iTabWidth;
} else {
iCharWidth = m_iTabWidth;
@@ -388,41 +386,41 @@ uint32_t CFX_TxtBreak::AppendChar_Tab(CFX_TxtChar* pCurChar,
pCurChar->m_iCharWidth = iCharWidth;
iLineWidth += iCharWidth;
if (!m_bSingleLine && iLineWidth >= m_iLineWidth + m_iTolerance)
- return EndBreak(FX_TXTBREAK_LineBreak);
+ return EndBreak(CFX_BreakType::Line);
- return FX_TXTBREAK_None;
+ return CFX_BreakType::None;
}
-uint32_t CFX_TxtBreak::AppendChar_Control(CFX_TxtChar* pCurChar,
- int32_t iRotation) {
+CFX_BreakType CFX_TxtBreak::AppendChar_Control(CFX_TxtChar* pCurChar,
+ int32_t iRotation) {
m_eCharType = FX_CHARTYPE_Control;
- uint32_t dwRet = FX_TXTBREAK_None;
+ CFX_BreakType dwRet = CFX_BreakType::None;
if (!m_bSingleLine) {
FX_WCHAR wch = pCurChar->m_wCharCode;
switch (wch) {
case L'\v':
case 0x2028:
- dwRet = FX_TXTBREAK_LineBreak;
+ dwRet = CFX_BreakType::Line;
break;
case L'\f':
- dwRet = FX_TXTBREAK_PageBreak;
+ dwRet = CFX_BreakType::Page;
break;
case 0x2029:
- dwRet = FX_TXTBREAK_ParagraphBreak;
+ dwRet = CFX_BreakType::Paragraph;
break;
default:
if (wch == m_wParagBreakChar)
- dwRet = FX_TXTBREAK_ParagraphBreak;
+ dwRet = CFX_BreakType::Paragraph;
break;
}
- if (dwRet != FX_TXTBREAK_None)
+ if (dwRet != CFX_BreakType::None)
dwRet = EndBreak(dwRet);
}
return dwRet;
}
-uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_TxtChar* pCurChar,
- int32_t iRotation) {
+CFX_BreakType CFX_TxtBreak::AppendChar_Arabic(CFX_TxtChar* pCurChar,
+ int32_t iRotation) {
FX_CHARTYPE chartype = pCurChar->GetCharType();
int32_t& iLineWidth = m_pCurLine->m_iWidth;
FX_WCHAR wForm;
@@ -481,12 +479,12 @@ uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_TxtChar* pCurChar,
iLineWidth += iCharWidth;
m_pCurLine->m_iArabicChars++;
if (!m_bSingleLine && iLineWidth > m_iLineWidth + m_iTolerance)
- return EndBreak(FX_TXTBREAK_LineBreak);
- return FX_TXTBREAK_None;
+ return EndBreak(CFX_BreakType::Line);
+ return CFX_BreakType::None;
}
-uint32_t CFX_TxtBreak::AppendChar_Others(CFX_TxtChar* pCurChar,
- int32_t iRotation) {
+CFX_BreakType CFX_TxtBreak::AppendChar_Others(CFX_TxtChar* pCurChar,
+ int32_t iRotation) {
uint32_t dwProps = pCurChar->m_dwCharProps;
FX_CHARTYPE chartype = pCurChar->GetCharType();
int32_t& iLineWidth = m_pCurLine->m_iWidth;
@@ -525,13 +523,13 @@ uint32_t CFX_TxtBreak::AppendChar_Others(CFX_TxtChar* pCurChar,
iLineWidth += iCharWidth;
if (!m_bSingleLine && chartype != FX_CHARTYPE_Space &&
iLineWidth > m_iLineWidth + m_iTolerance) {
- return EndBreak(FX_TXTBREAK_LineBreak);
+ return EndBreak(CFX_BreakType::Line);
}
- return FX_TXTBREAK_None;
+ return CFX_BreakType::None;
}
-uint32_t CFX_TxtBreak::AppendChar(FX_WCHAR wch) {
+CFX_BreakType CFX_TxtBreak::AppendChar(FX_WCHAR wch) {
uint32_t dwProps = kTextLayoutCodeProperties[static_cast<uint16_t>(wch)];
FX_CHARTYPE chartype = GetCharTypeFromProp(dwProps);
m_pCurLine->m_LineChars.emplace_back();
@@ -544,20 +542,20 @@ uint32_t CFX_TxtBreak::AppendChar(FX_WCHAR wch) {
pCurChar->m_iCharWidth = 0;
pCurChar->m_iHorizontalScale = m_iHorScale;
pCurChar->m_iVerticalScale = 100;
- pCurChar->m_dwStatus = 0;
+ pCurChar->m_dwStatus = CFX_BreakType::None;
pCurChar->m_iBidiClass = 0;
pCurChar->m_iBidiLevel = 0;
pCurChar->m_iBidiPos = 0;
pCurChar->m_iBidiOrder = 0;
pCurChar->m_pUserData = nullptr;
AppendChar_PageLoad(pCurChar, dwProps);
- uint32_t dwRet1 = FX_TXTBREAK_None;
+ CFX_BreakType dwRet1 = CFX_BreakType::None;
if (chartype != FX_CHARTYPE_Combination &&
GetUnifiedCharType(m_eCharType) != GetUnifiedCharType(chartype) &&
m_eCharType != FX_CHARTYPE_Unknown &&
m_pCurLine->m_iWidth > m_iLineWidth + m_iTolerance && !m_bSingleLine &&
(m_eCharType != FX_CHARTYPE_Space || chartype != FX_CHARTYPE_Control)) {
- dwRet1 = EndBreak(FX_TXTBREAK_LineBreak);
+ dwRet1 = EndBreak(CFX_BreakType::Line);
int32_t iCount = m_pCurLine->CountChars();
if (iCount > 0)
pCurChar = &m_pCurLine->m_LineChars[iCount - 1];
@@ -567,7 +565,7 @@ uint32_t CFX_TxtBreak::AppendChar(FX_WCHAR wch) {
if (m_bVertical && (dwProps & 0x8000) != 0)
iRotation = (iRotation + 1) % 4;
- uint32_t dwRet2 =
+ CFX_BreakType dwRet2 =
(this->*g_FX_TxtBreak_lpfAppendChar[chartype >> FX_CHARTYPEBITS])(
pCurChar, iRotation);
return std::max(dwRet1, dwRet2);
@@ -628,9 +626,7 @@ void CFX_TxtBreak::EndBreak_UpdateArabicShapes() {
} while (i < iCount);
}
-bool CFX_TxtBreak::EndBreak_SplitLine(CFX_TxtLine* pNextLine,
- bool bAllChars,
- uint32_t dwStatus) {
+bool CFX_TxtBreak::EndBreak_SplitLine(CFX_TxtLine* pNextLine, bool bAllChars) {
int32_t iCount = m_pCurLine->CountChars();
bool bDone = false;
CFX_TxtChar* pTC;
@@ -658,7 +654,7 @@ bool CFX_TxtBreak::EndBreak_SplitLine(CFX_TxtLine* pNextLine,
}
void CFX_TxtBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
- uint32_t dwStatus) {
+ CFX_BreakType dwStatus) {
CFX_TxtPiece tp;
FX_TPO tpo;
CFX_TxtChar* pTC;
@@ -682,7 +678,7 @@ void CFX_TxtBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
CFX_TxtPieceArray* pCurPieces = &m_pCurLine->m_LinePieces;
if (bDone || (m_dwLayoutStyles & FX_TXTLAYOUTSTYLE_MutipleFormat) != 0) {
- tp.m_dwStatus = FX_TXTBREAK_PieceBreak;
+ tp.m_dwStatus = CFX_BreakType::Piece;
tp.m_iStartPos = m_pCurLine->m_iStart;
tp.m_pChars = &m_pCurLine->m_LineChars;
int32_t iBidiLevel = -1;
@@ -700,9 +696,10 @@ void CFX_TxtBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
tp.m_pUserData = pTC->m_pUserData;
tp.m_iHorizontalScale = pTC->m_iHorizontalScale;
tp.m_iVerticalScale = pTC->m_iVerticalScale;
- tp.m_dwStatus = FX_TXTBREAK_PieceBreak;
+ tp.m_dwStatus = CFX_BreakType::Piece;
}
- if (iBidiLevel != pTC->m_iBidiLevel || pTC->m_dwStatus != 0) {
+ if (iBidiLevel != pTC->m_iBidiLevel ||
+ pTC->m_dwStatus != CFX_BreakType::None) {
if (iBidiLevel == pTC->m_iBidiLevel) {
tp.m_dwStatus = pTC->m_dwStatus;
iCharWidth = pTC->m_iCharWidth;
@@ -768,7 +765,7 @@ void CFX_TxtBreak::EndBreak_BidiLine(std::deque<FX_TPO>* tpos,
void CFX_TxtBreak::EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
bool bAllChars,
- uint32_t dwStatus) {
+ CFX_BreakType dwStatus) {
int32_t iNetWidth = m_pCurLine->m_iWidth;
int32_t iGapChars = 0;
int32_t iCharWidth;
@@ -817,7 +814,7 @@ void CFX_TxtBreak::EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
int32_t iHigherAlignment = (m_iCurAlignment & FX_TXTLINEALIGNMENT_HigherMask);
if (iGapChars > 0 && (iHigherAlignment == FX_TXTLINEALIGNMENT_Distributed ||
(iHigherAlignment == FX_TXTLINEALIGNMENT_Justified &&
- dwStatus != FX_TXTBREAK_ParagraphBreak))) {
+ dwStatus != CFX_BreakType::Paragraph))) {
int32_t iStart = -1;
for (i = 0; i < iCount; i++) {
tpo = tpos[i];
@@ -854,14 +851,13 @@ void CFX_TxtBreak::EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
}
}
-uint32_t CFX_TxtBreak::EndBreak(uint32_t dwStatus) {
- ASSERT(dwStatus >= FX_TXTBREAK_PieceBreak &&
- dwStatus <= FX_TXTBREAK_PageBreak);
+CFX_BreakType CFX_TxtBreak::EndBreak(CFX_BreakType dwStatus) {
+ ASSERT(dwStatus != CFX_BreakType::None);
const CFX_TxtPieceArray* pCurPieces = &m_pCurLine->m_LinePieces;
int32_t iCount = pCurPieces->GetSize();
if (iCount > 0) {
CFX_TxtPiece* pLastPiece = pCurPieces->GetPtrAt(--iCount);
- if (dwStatus > FX_TXTBREAK_PieceBreak)
+ if (dwStatus != CFX_BreakType::Piece)
pLastPiece->m_dwStatus = dwStatus;
else
dwStatus = pLastPiece->m_dwStatus;
@@ -873,22 +869,22 @@ uint32_t CFX_TxtBreak::EndBreak(uint32_t dwStatus) {
iCount = pCurPieces->GetSize();
if (iCount-- > 0) {
CFX_TxtPiece* pLastPiece = pCurPieces->GetPtrAt(iCount);
- if (dwStatus > FX_TXTBREAK_PieceBreak)
+ if (dwStatus != CFX_BreakType::Piece)
pLastPiece->m_dwStatus = dwStatus;
else
dwStatus = pLastPiece->m_dwStatus;
return dwStatus;
}
- return FX_TXTBREAK_None;
+ return CFX_BreakType::None;
}
iCount = m_pCurLine->CountChars();
if (iCount < 1)
- return FX_TXTBREAK_None;
+ return CFX_BreakType::None;
CFX_TxtChar* pTC = m_pCurLine->GetCharPtr(iCount - 1);
pTC->m_dwStatus = dwStatus;
- if (dwStatus <= FX_TXTBREAK_PieceBreak)
+ if (dwStatus == CFX_BreakType::Piece)
return dwStatus;
}
@@ -899,7 +895,7 @@ uint32_t CFX_TxtBreak::EndBreak(uint32_t dwStatus) {
if (m_bArabicShapes)
EndBreak_UpdateArabicShapes();
- if (!EndBreak_SplitLine(pNextLine, bAllChars, dwStatus)) {
+ if (!EndBreak_SplitLine(pNextLine, bAllChars)) {
std::deque<FX_TPO> tpos;
EndBreak_BidiLine(&tpos, dwStatus);
if (m_iCurAlignment > FX_TXTLINEALIGNMENT_Left)
@@ -909,7 +905,7 @@ uint32_t CFX_TxtBreak::EndBreak(uint32_t dwStatus) {
m_pCurLine = pNextLine;
CFX_Char* pTC = GetLastChar(0, false);
m_eCharType = pTC ? pTC->GetCharType() : FX_CHARTYPE_Unknown;
- if (dwStatus == FX_TXTBREAK_ParagraphBreak) {
+ if (dwStatus == CFX_BreakType::Paragraph) {
m_iArabicContext = m_iCurArabicContext = 1;
ResetArabicContext();
}
@@ -1045,7 +1041,7 @@ void CFX_TxtBreak::SplitTextLine(CFX_TxtLine* pCurLine,
pNextLine->m_iArabicChars++;
}
iWidth += std::max(0, pNextLine->m_LineChars[i].m_iCharWidth);
- pNextLine->m_LineChars[i].m_dwStatus = 0;
+ pNextLine->m_LineChars[i].m_dwStatus = CFX_BreakType::None;
}
pNextLine->m_iWidth = iWidth;
}
@@ -1591,7 +1587,7 @@ FX_TXTRUN::~FX_TXTRUN() {}
FX_TXTRUN::FX_TXTRUN(const FX_TXTRUN& other) = default;
CFX_TxtPiece::CFX_TxtPiece()
- : m_dwStatus(FX_TXTBREAK_PieceBreak),
+ : m_dwStatus(CFX_BreakType::Piece),
m_iStartPos(0),
m_iWidth(-1),
m_iStartChar(0),
diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h
index 72fab9d6a1..75be69b520 100644
--- a/xfa/fgas/layout/fgas_textbreak.h
+++ b/xfa/fgas/layout/fgas_textbreak.h
@@ -23,15 +23,6 @@ class CFX_TxtPiece;
class IFX_TxtAccess;
struct FDE_TEXTEDITPIECE;
-#define FX_TXTBREAK_None 0x00
-#define FX_TXTBREAK_PieceBreak 0x01
-#define FX_TXTBREAK_LineBreak 0x02
-#define FX_TXTBREAK_ParagraphBreak 0x03
-#define FX_TXTBREAK_PageBreak 0x04
-#define FX_TXTBREAK_ControlChar 0x10
-#define FX_TXTBREAK_BreakChar 0x20
-#define FX_TXTBREAK_UnknownChar 0x40
-#define FX_TXTBREAK_RemoveChar 0x80
#define FX_TXTLAYOUTSTYLE_MutipleFormat 0x0001
#define FX_TXTLAYOUTSTYLE_VerticalLayout 0x0002
#define FX_TXTLAYOUTSTYLE_VerticalChars 0x0004
@@ -69,7 +60,6 @@ struct FDE_TEXTEDITPIECE;
(FX_TXTLINEALIGNMENT_Right | FX_TXTLINEALIGNMENT_Distributed)
#define FX_TXTLINEALIGNMENT_LowerMask 0x03
#define FX_TXTLINEALIGNMENT_HigherMask 0x0C
-#define FX_TXTBREAK_MinimumTabWidth 160000
struct FX_TPO {
int32_t index;
@@ -78,6 +68,10 @@ struct FX_TPO {
bool operator<(const FX_TPO& that) const { return pos < that.pos; }
};
+inline bool CFX_BreakTypeNoneOrPiece(CFX_BreakType type) {
+ return type == CFX_BreakType::None || type == CFX_BreakType::Piece;
+}
+
class IFX_TxtAccess {
public:
virtual ~IFX_TxtAccess() {}
@@ -140,7 +134,7 @@ class CFX_TxtPiece {
*pWidths++ = (*m_pChars)[i].m_iCharWidth;
}
- uint32_t m_dwStatus;
+ CFX_BreakType m_dwStatus;
int32_t m_iStartPos;
int32_t m_iWidth;
int32_t m_iStartChar;
@@ -224,8 +218,7 @@ class CFX_TxtBreak {
void SetAlignment(int32_t iAlignment);
void SetCombWidth(FX_FLOAT fCombWidth);
void SetUserData(void* pUserData);
- uint32_t AppendChar(FX_WCHAR wch);
- uint32_t EndBreak(uint32_t dwStatus = FX_TXTBREAK_PieceBreak);
+ CFX_BreakType EndBreak(CFX_BreakType dwStatus);
int32_t CountBreakPieces() const;
const CFX_TxtPiece* GetBreakPiece(int32_t index) const;
void ClearBreakPieces();
@@ -237,11 +230,13 @@ class CFX_TxtBreak {
std::vector<CFX_RectF> GetCharRects(const FX_TXTRUN* pTxtRun,
bool bCharBBox = false) const;
void AppendChar_PageLoad(CFX_TxtChar* pCurChar, uint32_t dwProps);
- uint32_t AppendChar_Combination(CFX_TxtChar* pCurChar, int32_t iRotation);
- uint32_t AppendChar_Tab(CFX_TxtChar* pCurChar, int32_t iRotation);
- uint32_t AppendChar_Control(CFX_TxtChar* pCurChar, int32_t iRotation);
- uint32_t AppendChar_Arabic(CFX_TxtChar* pCurChar, int32_t iRotation);
- uint32_t AppendChar_Others(CFX_TxtChar* pCurChar, int32_t iRotation);
+ CFX_BreakType AppendChar(FX_WCHAR wch);
+ CFX_BreakType AppendChar_Combination(CFX_TxtChar* pCurChar,
+ int32_t iRotation);
+ CFX_BreakType AppendChar_Tab(CFX_TxtChar* pCurChar, int32_t iRotation);
+ CFX_BreakType AppendChar_Control(CFX_TxtChar* pCurChar, int32_t iRotation);
+ CFX_BreakType AppendChar_Arabic(CFX_TxtChar* pCurChar, int32_t iRotation);
+ CFX_BreakType AppendChar_Others(CFX_TxtChar* pCurChar, int32_t iRotation);
private:
void FontChanged();
@@ -254,13 +249,11 @@ class CFX_TxtBreak {
void ResetArabicContext();
void ResetContextCharStyles();
void EndBreak_UpdateArabicShapes();
- bool EndBreak_SplitLine(CFX_TxtLine* pNextLine,
- bool bAllChars,
- uint32_t dwStatus);
- void EndBreak_BidiLine(std::deque<FX_TPO>* tpos, uint32_t dwStatus);
+ bool EndBreak_SplitLine(CFX_TxtLine* pNextLine, bool bAllChars);
+ void EndBreak_BidiLine(std::deque<FX_TPO>* tpos, CFX_BreakType dwStatus);
void EndBreak_Alignment(const std::deque<FX_TPO>& tpos,
bool bAllChars,
- uint32_t dwStatus);
+ CFX_BreakType dwStatus);
int32_t GetBreakPos(std::vector<CFX_TxtChar>& ca,
int32_t& iEndPos,
bool bAllChars = false,
diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp
index 676aded844..3c2c37dcff 100644
--- a/xfa/fxfa/app/cxfa_textlayout.cpp
+++ b/xfa/fxfa/app/cxfa_textlayout.cpp
@@ -693,7 +693,7 @@ void CXFA_TextLayout::LoadText(CXFA_Node* pNode,
if (bRet && m_pLoader)
m_pLoader->m_pNode = pNode;
else
- EndBreak(CFX_RTFBreakType::Paragraph, fLinePos, bSavePieces);
+ EndBreak(CFX_BreakType::Paragraph, fLinePos, bSavePieces);
}
bool CXFA_TextLayout::LoadRichText(
@@ -856,7 +856,7 @@ bool CXFA_TextLayout::LoadRichText(
m_pLoader->m_dwFlags |= XFA_LOADERCNTXTFLG_FILTERSPACE;
}
if (bCurLi)
- EndBreak(CFX_RTFBreakType::Line, fLinePos, bSavePieces);
+ EndBreak(CFX_BreakType::Line, fLinePos, bSavePieces);
} else {
if (pContext)
eDisplay = pContext->GetDisplay();
@@ -864,9 +864,9 @@ bool CXFA_TextLayout::LoadRichText(
if (m_bBlockContinue) {
if (pContext && !bContentNode) {
- CFX_RTFBreakType dwStatus = (eDisplay == FDE_CSSDisplay::Block)
- ? CFX_RTFBreakType::Paragraph
- : CFX_RTFBreakType::Piece;
+ CFX_BreakType dwStatus = (eDisplay == FDE_CSSDisplay::Block)
+ ? CFX_BreakType::Paragraph
+ : CFX_BreakType::Piece;
EndBreak(dwStatus, fLinePos, bSavePieces);
if (eDisplay == FDE_CSSDisplay::Block) {
fLinePos += fSpaceBelow;
@@ -890,7 +890,7 @@ bool CXFA_TextLayout::AppendChar(const CFX_WideString& wsText,
FX_FLOAT& fLinePos,
FX_FLOAT fSpaceAbove,
bool bSavePieces) {
- CFX_RTFBreakType dwStatus = CFX_RTFBreakType::None;
+ CFX_BreakType dwStatus = CFX_BreakType::None;
int32_t iChar = 0;
if (m_pLoader)
iChar = m_pLoader->m_iChar;
@@ -902,15 +902,14 @@ bool CXFA_TextLayout::AppendChar(const CFX_WideString& wsText,
wch = 0x20;
dwStatus = m_pBreak->AppendChar(wch);
- if (dwStatus != CFX_RTFBreakType::None &&
- dwStatus != CFX_RTFBreakType::Piece) {
+ if (dwStatus != CFX_BreakType::None && dwStatus != CFX_BreakType::Piece) {
AppendTextLine(dwStatus, fLinePos, bSavePieces);
if (IsEnd(bSavePieces)) {
if (m_pLoader)
m_pLoader->m_iChar = i;
return true;
}
- if (dwStatus == CFX_RTFBreakType::Paragraph && m_bRichText)
+ if (dwStatus == CFX_BreakType::Paragraph && m_bRichText)
fLinePos += fSpaceAbove;
}
}
@@ -950,11 +949,11 @@ void CXFA_TextLayout::ProcessText(CFX_WideString& wsText) {
wsText = wsText.Left(iTrimLeft);
}
-void CXFA_TextLayout::EndBreak(CFX_RTFBreakType dwStatus,
+void CXFA_TextLayout::EndBreak(CFX_BreakType dwStatus,
FX_FLOAT& fLinePos,
bool bSavePieces) {
dwStatus = m_pBreak->EndBreak(dwStatus);
- if (dwStatus != CFX_RTFBreakType::None && dwStatus != CFX_RTFBreakType::Piece)
+ if (dwStatus != CFX_BreakType::None && dwStatus != CFX_BreakType::Piece)
AppendTextLine(dwStatus, fLinePos, bSavePieces, true);
}
@@ -1014,7 +1013,7 @@ void CXFA_TextLayout::DoTabstops(CFDE_CSSComputedStyle* pStyle,
}
}
-void CXFA_TextLayout::AppendTextLine(CFX_RTFBreakType dwStatus,
+void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus,
FX_FLOAT& fLinePos,
bool bSavePieces,
bool bEndBreak) {
@@ -1118,7 +1117,7 @@ void CXFA_TextLayout::AppendTextLine(CFX_RTFBreakType dwStatus,
}
m_pBreak->ClearBreakPieces();
- if (dwStatus == CFX_RTFBreakType::Paragraph) {
+ if (dwStatus == CFX_BreakType::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 d4d60cf81e..cbf3d33ad9 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(CFX_RTFBreakType dwStatus,
+ void AppendTextLine(CFX_BreakType dwStatus,
FX_FLOAT& fLinePos,
bool bSavePieces,
bool bEndBreak = false);
- void EndBreak(CFX_RTFBreakType dwStatus, FX_FLOAT& fLinePos, bool bDefault);
+ void EndBreak(CFX_BreakType dwStatus, FX_FLOAT& fLinePos, bool bDefault);
bool IsEnd(bool bSavePieces);
void ProcessText(CFX_WideString& wsText);
void UpdateAlign(FX_FLOAT fHeight, FX_FLOAT fBottom);