summaryrefslogtreecommitdiff
path: root/xfa/fgas/layout
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fgas/layout')
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.cpp82
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.h20
-rw-r--r--xfa/fgas/layout/fgas_textbreak.cpp87
-rw-r--r--xfa/fgas/layout/fgas_textbreak.h10
4 files changed, 92 insertions, 107 deletions
diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp
index 80591f1714..8a4f6eac2b 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -23,7 +23,7 @@ CFX_RTFBreak::CFX_RTFBreak(uint32_t dwPolicies)
m_bVertical(FALSE),
m_bSingleLine(FALSE),
m_bCharCode(FALSE),
- m_pFont(NULL),
+ m_pFont(nullptr),
m_iFontHeight(240),
m_iFontSize(240),
m_iTabWidth(720000),
@@ -42,12 +42,12 @@ CFX_RTFBreak::CFX_RTFBreak(uint32_t dwPolicies)
m_iWordSpace(0),
m_bRTL(FALSE),
m_iAlignment(FX_RTFLINEALIGNMENT_Left),
- m_pUserData(NULL),
+ m_pUserData(nullptr),
m_eCharType(FX_CHARTYPE_Unknown),
m_dwIdentity(0),
m_RTFLine1(),
m_RTFLine2(),
- m_pCurLine(NULL),
+ m_pCurLine(nullptr),
m_iReady(0),
m_iTolerance(0) {
m_pCurLine = &m_RTFLine1;
@@ -55,7 +55,7 @@ CFX_RTFBreak::CFX_RTFBreak(uint32_t dwPolicies)
CFX_RTFBreak::~CFX_RTFBreak() {
Reset();
m_PositionedTabs.RemoveAll();
- if (m_pUserData != NULL) {
+ if (m_pUserData) {
m_pUserData->Release();
}
}
@@ -88,7 +88,7 @@ void CFX_RTFBreak::SetLayoutStyles(uint32_t dwLayoutStyles) {
m_iRotation %= 4;
}
void CFX_RTFBreak::SetFont(CFGAS_GEFont* pFont) {
- if (pFont == NULL) {
+ if (!pFont) {
return;
}
if (m_pFont == pFont) {
@@ -97,7 +97,7 @@ void CFX_RTFBreak::SetFont(CFGAS_GEFont* pFont) {
SetBreakStatus();
m_pFont = pFont;
m_iDefChar = 0;
- if (m_pFont != NULL) {
+ if (m_pFont) {
m_iFontHeight = m_iFontSize;
if (m_wDefChar != 0xFEFF) {
m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE);
@@ -113,7 +113,7 @@ void CFX_RTFBreak::SetFontSize(FX_FLOAT fFontSize) {
SetBreakStatus();
m_iFontSize = iFontSize;
m_iDefChar = 0;
- if (m_pFont != NULL) {
+ if (m_pFont) {
m_iFontHeight = m_iFontSize;
if (m_wDefChar != 0xFEFF) {
m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE);
@@ -173,7 +173,7 @@ void CFX_RTFBreak::ClearPositionedTabs() {
void CFX_RTFBreak::SetDefaultChar(FX_WCHAR wch) {
m_wDefChar = wch;
m_iDefChar = 0;
- if (m_wDefChar != 0xFEFF && m_pFont != NULL) {
+ if (m_wDefChar != 0xFEFF && m_pFont) {
m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE);
if (m_iDefChar < 0) {
m_iDefChar = 0;
@@ -245,11 +245,11 @@ void CFX_RTFBreak::SetUserData(IFX_Retainable* pUserData) {
return;
}
SetBreakStatus();
- if (m_pUserData != NULL) {
+ if (m_pUserData) {
m_pUserData->Release();
}
m_pUserData = pUserData;
- if (m_pUserData != NULL) {
+ if (m_pUserData) {
m_pUserData->Retain();
}
}
@@ -272,7 +272,7 @@ CFX_RTFChar* CFX_RTFBreak::GetLastChar(int32_t index) const {
CFX_RTFCharArray& tca = m_pCurLine->m_LineChars;
int32_t iCount = tca.GetSize();
if (index < 0 || index >= iCount) {
- return NULL;
+ return nullptr;
}
CFX_RTFChar* pTC;
int32_t iStart = iCount - 1;
@@ -285,7 +285,7 @@ CFX_RTFChar* CFX_RTFBreak::GetLastChar(int32_t index) const {
}
}
}
- return NULL;
+ return nullptr;
}
CFX_RTFLine* CFX_RTFBreak::GetRTFLine(FX_BOOL bReady) const {
if (bReady) {
@@ -294,18 +294,15 @@ CFX_RTFLine* CFX_RTFBreak::GetRTFLine(FX_BOOL bReady) const {
} else if (m_iReady == 2) {
return (CFX_RTFLine*)&m_RTFLine2;
} else {
- return NULL;
+ return nullptr;
}
}
- ASSERT(m_pCurLine != NULL);
+ ASSERT(m_pCurLine);
return m_pCurLine;
}
CFX_RTFPieceArray* CFX_RTFBreak::GetRTFPieces(FX_BOOL bReady) const {
CFX_RTFLine* pRTFLine = GetRTFLine(bReady);
- if (pRTFLine == NULL) {
- return NULL;
- }
- return &pRTFLine->m_LinePieces;
+ return pRTFLine ? &pRTFLine->m_LinePieces : nullptr;
}
inline FX_CHARTYPE CFX_RTFBreak::GetUnifiedCharType(
FX_CHARTYPE chartype) const {
@@ -362,7 +359,7 @@ uint32_t CFX_RTFBreak::AppendChar(FX_WCHAR wch) {
pCurChar->m_nRotation = m_iCharRotation;
pCurChar->m_iCharWidth = 0;
pCurChar->m_dwIdentity = m_dwIdentity;
- if (m_pUserData != NULL) {
+ if (m_pUserData) {
m_pUserData->Retain();
}
pCurChar->m_pUserData = m_pUserData;
@@ -392,7 +389,7 @@ uint32_t CFX_RTFBreak::AppendChar(FX_WCHAR wch) {
return std::max(dwRet1, dwRet2);
}
uint32_t CFX_RTFBreak::AppendChar_CharCode(FX_WCHAR wch) {
- ASSERT(m_pFont != NULL && m_pCurLine != NULL);
+ ASSERT(m_pFont && m_pCurLine);
ASSERT(m_bCharCode);
m_pCurLine->m_iMBCSChars++;
CFX_RTFCharArray& tca = m_pCurLine->m_LineChars;
@@ -409,7 +406,7 @@ uint32_t CFX_RTFBreak::AppendChar_CharCode(FX_WCHAR wch) {
pCurChar->m_nRotation = m_iCharRotation;
pCurChar->m_iCharWidth = 0;
pCurChar->m_dwIdentity = m_dwIdentity;
- if (m_pUserData != NULL) {
+ if (m_pUserData) {
m_pUserData->Retain();
}
pCurChar->m_pUserData = m_pUserData;
@@ -447,7 +444,7 @@ uint32_t CFX_RTFBreak::AppendChar_Combination(CFX_RTFChar* pCurChar,
iCharWidth *= m_iFontSize;
iCharWidth = iCharWidth * m_iHorizontalScale / 100;
CFX_RTFChar* pLastChar = GetLastChar(0);
- if (pLastChar != NULL && pLastChar->GetCharType() > FX_CHARTYPE_Combination) {
+ if (pLastChar && pLastChar->GetCharType() > FX_CHARTYPE_Combination) {
iCharWidth = -iCharWidth;
} else {
m_eCharType = FX_CHARTYPE_Combination;
@@ -509,7 +506,7 @@ uint32_t CFX_RTFBreak::AppendChar_Control(CFX_RTFChar* pCurChar,
}
uint32_t CFX_RTFBreak::AppendChar_Arabic(CFX_RTFChar* pCurChar,
int32_t iRotation) {
- CFX_RTFChar* pLastChar = NULL;
+ CFX_RTFChar* pLastChar = nullptr;
int32_t& iLineWidth = m_pCurLine->m_iWidth;
int32_t iCharWidth = 0;
FX_WCHAR wForm;
@@ -517,7 +514,7 @@ uint32_t CFX_RTFBreak::AppendChar_Arabic(CFX_RTFChar* pCurChar,
if (m_eCharType >= FX_CHARTYPE_ArabicAlef &&
m_eCharType <= FX_CHARTYPE_ArabicDistortion) {
pLastChar = GetLastChar(1);
- if (pLastChar != NULL) {
+ if (pLastChar) {
iLineWidth -= pLastChar->m_iCharWidth;
CFX_RTFChar* pPrevChar = GetLastChar(2);
wForm = pdfium::arabic::GetFormChar(pLastChar, pPrevChar, pCurChar);
@@ -621,7 +618,7 @@ uint32_t CFX_RTFBreak::EndBreak(uint32_t dwStatus) {
return dwStatus;
} else {
CFX_RTFLine* pLastLine = GetRTFLine(TRUE);
- if (pLastLine != NULL) {
+ if (pLastLine) {
pCurPieces = &pLastLine->m_LinePieces;
iCount = pCurPieces->GetSize();
if (iCount-- > 0) {
@@ -1063,7 +1060,7 @@ int32_t CFX_RTFBreak::GetBreakPos(CFX_RTFCharArray& tca,
void CFX_RTFBreak::SplitTextLine(CFX_RTFLine* pCurLine,
CFX_RTFLine* pNextLine,
FX_BOOL bAllChars) {
- ASSERT(pCurLine != NULL && pNextLine != NULL);
+ ASSERT(pCurLine && pNextLine);
int32_t iCount = pCurLine->CountChars();
if (iCount < 2) {
return;
@@ -1110,25 +1107,22 @@ void CFX_RTFBreak::SplitTextLine(CFX_RTFLine* pCurLine,
}
int32_t CFX_RTFBreak::CountBreakPieces() const {
CFX_RTFPieceArray* pRTFPieces = GetRTFPieces(TRUE);
- if (pRTFPieces == NULL) {
- return 0;
- }
- return pRTFPieces->GetSize();
+ return pRTFPieces ? pRTFPieces->GetSize() : 0;
}
const CFX_RTFPiece* CFX_RTFBreak::GetBreakPiece(int32_t index) const {
CFX_RTFPieceArray* pRTFPieces = GetRTFPieces(TRUE);
- if (pRTFPieces == NULL) {
- return NULL;
+ if (!pRTFPieces) {
+ return nullptr;
}
if (index < 0 || index >= pRTFPieces->GetSize()) {
- return NULL;
+ return nullptr;
}
return pRTFPieces->GetPtrAt(index);
}
void CFX_RTFBreak::GetLineRect(CFX_RectF& rect) const {
rect.top = 0;
CFX_RTFLine* pRTFLine = GetRTFLine(TRUE);
- if (pRTFLine == NULL) {
+ if (!pRTFLine) {
rect.left = ((FX_FLOAT)m_iBoundaryStart) / 20000.0f;
rect.width = rect.height = 0;
return;
@@ -1158,7 +1152,7 @@ void CFX_RTFBreak::GetLineRect(CFX_RectF& rect) const {
}
void CFX_RTFBreak::ClearBreakPieces() {
CFX_RTFLine* pRTFLine = GetRTFLine(TRUE);
- if (pRTFLine != NULL) {
+ if (pRTFLine) {
pRTFLine->RemoveAll(TRUE);
}
m_iReady = 0;
@@ -1173,11 +1167,10 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
FX_BOOL bCharCode,
CFX_WideString* pWSForms,
FX_AdjustCharDisplayPos pAdjustPos) const {
- if (pText == NULL || pText->iLength < 1) {
+ if (!pText || pText->iLength < 1) {
return 0;
}
- ASSERT(pText->pStr != NULL && pText->pWidths != NULL &&
- pText->pFont != NULL && pText->pRect != NULL);
+ ASSERT(pText->pStr && pText->pWidths && pText->pFont && pText->pRect);
const FX_WCHAR* pStr = pText->pStr;
int32_t* pWidths = pText->pWidths;
int32_t iLength = pText->iLength - 1;
@@ -1248,7 +1241,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
if (!bEmptyChar) {
iCount++;
}
- if (pCharPos != NULL) {
+ if (pCharPos) {
iCharWidth /= iFontSize;
wForm = wch;
if (!bMBCSCode) {
@@ -1416,11 +1409,10 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
int32_t CFX_RTFBreak::GetCharRects(const FX_RTFTEXTOBJ* pText,
CFX_RectFArray& rtArray,
FX_BOOL bCharBBox) const {
- if (pText == NULL || pText->iLength < 1) {
+ if (!pText || pText->iLength < 1) {
return 0;
}
- ASSERT(pText->pStr != NULL && pText->pWidths != NULL &&
- pText->pFont != NULL && pText->pRect != NULL);
+ ASSERT(pText->pStr && pText->pWidths && pText->pFont && pText->pRect);
const FX_WCHAR* pStr = pText->pStr;
int32_t* pWidths = pText->pWidths;
int32_t iLength = pText->iLength;
@@ -1430,7 +1422,7 @@ int32_t CFX_RTFBreak::GetCharRects(const FX_RTFTEXTOBJ* pText,
int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
FX_FLOAT fScale = fFontSize / 1000.0f;
CFGAS_GEFont* pFont = pText->pFont;
- if (pFont == NULL) {
+ if (!pFont) {
bCharBBox = FALSE;
}
CFX_Rect bbox;
@@ -1533,8 +1525,8 @@ CFX_RTFPiece::CFX_RTFPiece()
m_iVerticalScale(100),
m_dwLayoutStyles(0),
m_dwIdentity(0),
- m_pChars(NULL),
- m_pUserData(NULL) {}
+ m_pChars(nullptr),
+ m_pUserData(nullptr) {}
CFX_RTFPiece::~CFX_RTFPiece() {
Reset();
diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h
index 993dc50f97..9d01809045 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.h
+++ b/xfa/fgas/layout/fgas_rtfbreak.h
@@ -86,7 +86,7 @@ class CFX_RTFPiece : public CFX_Target {
~CFX_RTFPiece() override;
void AppendChar(const CFX_RTFChar& tc) {
- ASSERT(m_pChars != NULL);
+ ASSERT(m_pChars);
m_pChars->Add(tc);
if (m_iWidth < 0) {
m_iWidth = tc.m_iCharWidth;
@@ -101,15 +101,15 @@ class CFX_RTFPiece : public CFX_Target {
int32_t GetLength() const { return m_iChars; }
int32_t GetEndChar() const { return m_iStartChar + m_iChars; }
CFX_RTFChar& GetChar(int32_t index) {
- ASSERT(index > -1 && index < m_iChars && m_pChars != NULL);
+ ASSERT(index > -1 && index < m_iChars && m_pChars);
return *m_pChars->GetDataPtr(m_iStartChar + index);
}
CFX_RTFChar* GetCharPtr(int32_t index) const {
- ASSERT(index > -1 && index < m_iChars && m_pChars != NULL);
+ ASSERT(index > -1 && index < m_iChars && m_pChars);
return m_pChars->GetDataPtr(m_iStartChar + index);
}
void GetString(FX_WCHAR* pText) const {
- ASSERT(pText != NULL);
+ ASSERT(pText);
int32_t iEndChar = m_iStartChar + m_iChars;
CFX_RTFChar* pChar;
for (int32_t i = m_iStartChar; i < iEndChar; i++) {
@@ -123,7 +123,7 @@ class CFX_RTFPiece : public CFX_Target {
wsText.ReleaseBuffer(m_iChars);
}
void GetWidths(int32_t* pWidths) const {
- ASSERT(pWidths != NULL);
+ ASSERT(pWidths);
int32_t iEndChar = m_iStartChar + m_iChars;
CFX_RTFChar* pChar;
for (int32_t i = m_iStartChar; i < iEndChar; i++) {
@@ -190,13 +190,11 @@ class CFX_RTFLine {
int32_t GetLineEnd() const { return m_iStart + m_iWidth; }
void RemoveAll(FX_BOOL bLeaveMemory = FALSE) {
CFX_RTFChar* pChar;
- IFX_Retainable* pUnknown;
int32_t iCount = m_LineChars.GetSize();
for (int32_t i = 0; i < iCount; i++) {
pChar = m_LineChars.GetDataPtr(i);
- if ((pUnknown = pChar->m_pUserData) != NULL) {
- pUnknown->Release();
- }
+ if (pChar->m_pUserData)
+ pChar->m_pUserData->Release();
}
m_LineChars.RemoveAll();
m_LinePieces.RemoveAll(bLeaveMemory);
@@ -249,8 +247,8 @@ class CFX_RTFBreak {
int32_t GetDisplayPos(const FX_RTFTEXTOBJ* pText,
FXTEXT_CHARPOS* pCharPos,
FX_BOOL bCharCode = FALSE,
- CFX_WideString* pWSForms = NULL,
- FX_AdjustCharDisplayPos pAdjustPos = NULL) const;
+ CFX_WideString* pWSForms = nullptr,
+ FX_AdjustCharDisplayPos pAdjustPos = nullptr) const;
int32_t GetCharRects(const FX_RTFTEXTOBJ* pText,
CFX_RectFArray& rtArray,
FX_BOOL bCharBBox = FALSE) const;
diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp
index a272d0cfc7..0c1c6a2202 100644
--- a/xfa/fgas/layout/fgas_textbreak.cpp
+++ b/xfa/fgas/layout/fgas_textbreak.cpp
@@ -45,7 +45,7 @@ CFX_TxtBreak::CFX_TxtBreak(uint32_t dwPolicies)
m_bCombText(FALSE),
m_iArabicContext(1),
m_iCurArabicContext(1),
- m_pFont(NULL),
+ m_pFont(nullptr),
m_iFontSize(240),
m_bEquidistant(TRUE),
m_iTabWidth(720000),
@@ -58,11 +58,11 @@ CFX_TxtBreak::CFX_TxtBreak(uint32_t dwPolicies)
m_iAlignment(FX_TXTLINEALIGNMENT_Left),
m_dwContextCharStyles(0),
m_iCombWidth(360000),
- m_pUserData(NULL),
+ m_pUserData(nullptr),
m_eCharType(FX_CHARTYPE_Unknown),
m_bArabicNumber(FALSE),
m_bArabicComma(FALSE),
- m_pCurLine(NULL),
+ m_pCurLine(nullptr),
m_iReady(0),
m_iTolerance(0),
m_iHorScale(100),
@@ -113,7 +113,7 @@ void CFX_TxtBreak::SetLayoutStyles(uint32_t dwLayoutStyles) {
m_iRotation %= 4;
}
void CFX_TxtBreak::SetFont(CFGAS_GEFont* pFont) {
- if (pFont == NULL) {
+ if (!pFont) {
return;
}
if (m_pFont == pFont) {
@@ -122,7 +122,7 @@ void CFX_TxtBreak::SetFont(CFGAS_GEFont* pFont) {
SetBreakStatus();
m_pFont = pFont;
m_iDefChar = 0;
- if (m_wDefChar != 0xFEFF && m_pFont != NULL) {
+ if (m_wDefChar != 0xFEFF && m_pFont) {
m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE);
m_iDefChar *= m_iFontSize;
}
@@ -135,7 +135,7 @@ void CFX_TxtBreak::SetFontSize(FX_FLOAT fFontSize) {
SetBreakStatus();
m_iFontSize = iFontSize;
m_iDefChar = 0;
- if (m_wDefChar != 0xFEFF && m_pFont != NULL) {
+ if (m_wDefChar != 0xFEFF && m_pFont) {
m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE);
m_iDefChar *= m_iFontSize;
}
@@ -150,7 +150,7 @@ void CFX_TxtBreak::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) {
void CFX_TxtBreak::SetDefaultChar(FX_WCHAR wch) {
m_wDefChar = wch;
m_iDefChar = 0;
- if (m_wDefChar != 0xFEFF && m_pFont != NULL) {
+ if (m_wDefChar != 0xFEFF && m_pFont) {
m_pFont->GetCharWidth(m_wDefChar, m_iDefChar, FALSE);
if (m_iDefChar < 0) {
m_iDefChar = 0;
@@ -266,7 +266,7 @@ CFX_TxtChar* CFX_TxtBreak::GetLastChar(int32_t index, FX_BOOL bOmitChar) const {
CFX_TxtCharArray& ca = *m_pCurLine->m_pLineChars;
int32_t iCount = ca.GetSize();
if (index < 0 || index >= iCount) {
- return NULL;
+ return nullptr;
}
CFX_TxtChar* pTC;
int32_t iStart = iCount - 1;
@@ -279,24 +279,21 @@ CFX_TxtChar* CFX_TxtBreak::GetLastChar(int32_t index, FX_BOOL bOmitChar) const {
return pTC;
}
}
- return NULL;
+ return nullptr;
}
CFX_TxtLine* CFX_TxtBreak::GetTxtLine(FX_BOOL bReady) const {
- if (!bReady) {
+ if (!bReady)
return m_pCurLine;
- }
- if (m_iReady == 1) {
+ if (m_iReady == 1)
return m_pTxtLine1;
- } else if (m_iReady == 2) {
+ if (m_iReady == 2)
return m_pTxtLine2;
- } else {
- return NULL;
- }
+ return nullptr;
}
CFX_TxtPieceArray* CFX_TxtBreak::GetTxtPieces(FX_BOOL bReady) const {
CFX_TxtLine* pTxtLine = GetTxtLine(bReady);
- if (pTxtLine == NULL) {
- return NULL;
+ if (!pTxtLine) {
+ return nullptr;
}
return pTxtLine->m_pLinePieces;
}
@@ -350,7 +347,7 @@ void CFX_TxtBreak::AppendChar_PageLoad(CFX_TxtChar* pCurChar,
ResetArabicContext();
if (!m_bPagination) {
CFX_TxtChar* pLastChar = GetLastChar(1, FALSE);
- if (pLastChar != NULL && pLastChar->m_dwStatus < 1) {
+ if (pLastChar && pLastChar->m_dwStatus < 1) {
pLastChar->m_dwStatus = FX_TXTBREAK_PieceBreak;
}
}
@@ -468,12 +465,12 @@ uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_TxtChar* pCurChar,
int32_t& iLineWidth = m_pCurLine->m_iWidth;
FX_WCHAR wForm;
int32_t iCharWidth = 0;
- CFX_Char* pLastChar = NULL;
+ CFX_Char* pLastChar = nullptr;
FX_BOOL bAlef = FALSE;
if (!m_bCombText && m_eCharType >= FX_CHARTYPE_ArabicAlef &&
m_eCharType <= FX_CHARTYPE_ArabicDistortion) {
pLastChar = GetLastChar(1);
- if (pLastChar != NULL) {
+ if (pLastChar) {
iCharWidth = pLastChar->m_iCharWidth;
if (iCharWidth > 0) {
iLineWidth -= iCharWidth;
@@ -502,7 +499,8 @@ uint32_t CFX_TxtBreak::AppendChar_Arabic(CFX_TxtChar* pCurChar,
}
}
m_eCharType = chartype;
- wForm = pdfium::arabic::GetFormChar(pCurChar, bAlef ? NULL : pLastChar, NULL);
+ wForm = pdfium::arabic::GetFormChar(pCurChar, bAlef ? nullptr : pLastChar,
+ nullptr);
if (m_bCombText) {
iCharWidth = m_iCombWidth;
} else {
@@ -585,7 +583,7 @@ uint32_t CFX_TxtBreak::AppendChar(FX_WCHAR wch) {
pCurChar->m_iBidiLevel = 0;
pCurChar->m_iBidiPos = 0;
pCurChar->m_iBidiOrder = 0;
- pCurChar->m_pUserData = NULL;
+ pCurChar->m_pUserData = nullptr;
AppendChar_PageLoad(pCurChar, dwProps);
uint32_t dwRet1 = FX_TXTBREAK_None;
if (chartype != FX_CHARTYPE_Combination &&
@@ -630,7 +628,7 @@ void CFX_TxtBreak::EndBreak_UpdateArabicShapes() {
pNext = m_pCurLine->GetCharPtr(i);
bNextNum = (pNext->m_dwCharStyles & FX_TXTCHARSTYLE_ArabicIndic) != 0;
} else {
- pNext = NULL;
+ pNext = nullptr;
bNextNum = FALSE;
}
wch = pCur->m_wCharCode;
@@ -923,7 +921,7 @@ uint32_t CFX_TxtBreak::EndBreak(uint32_t dwStatus) {
return dwStatus;
} else {
CFX_TxtLine* pLastLine = GetTxtLine(TRUE);
- if (pLastLine != NULL) {
+ if (pLastLine) {
pCurPieces = pLastLine->m_pLinePieces;
iCount = pCurPieces->GetSize();
if (iCount-- > 0) {
@@ -1074,7 +1072,7 @@ int32_t CFX_TxtBreak::GetBreakPos(CFX_TxtCharArray& ca,
void CFX_TxtBreak::SplitTextLine(CFX_TxtLine* pCurLine,
CFX_TxtLine* pNextLine,
FX_BOOL bAllChars) {
- ASSERT(pCurLine != NULL && pNextLine != NULL);
+ ASSERT(pCurLine && pNextLine);
int32_t iCount = pCurLine->CountChars();
if (iCount < 2) {
return;
@@ -1124,28 +1122,25 @@ void CFX_TxtBreak::SplitTextLine(CFX_TxtLine* pCurLine,
}
int32_t CFX_TxtBreak::CountBreakChars() const {
CFX_TxtLine* pTxtLine = GetTxtLine(TRUE);
- return pTxtLine == NULL ? 0 : pTxtLine->CountChars();
+ return pTxtLine ? pTxtLine->CountChars() : 0;
}
int32_t CFX_TxtBreak::CountBreakPieces() const {
CFX_TxtPieceArray* pTxtPieces = GetTxtPieces(TRUE);
- if (pTxtPieces == NULL) {
- return 0;
- }
- return pTxtPieces->GetSize();
+ return pTxtPieces ? pTxtPieces->GetSize() : 0;
}
const CFX_TxtPiece* CFX_TxtBreak::GetBreakPiece(int32_t index) const {
CFX_TxtPieceArray* pTxtPieces = GetTxtPieces(TRUE);
- if (pTxtPieces == NULL) {
- return NULL;
+ if (!pTxtPieces) {
+ return nullptr;
}
if (index < 0 || index >= pTxtPieces->GetSize()) {
- return NULL;
+ return nullptr;
}
return pTxtPieces->GetPtrAt(index);
}
void CFX_TxtBreak::ClearBreakPieces() {
CFX_TxtLine* pTxtLine = GetTxtLine(TRUE);
- if (pTxtLine != NULL) {
+ if (pTxtLine) {
pTxtLine->RemoveAll(TRUE);
}
m_iReady = 0;
@@ -1169,7 +1164,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
FX_BOOL bCharCode,
CFX_WideString* pWSForms,
FX_AdjustCharDisplayPos pAdjustPos) const {
- if (pTxtRun == NULL || pTxtRun->iLength < 1) {
+ if (!pTxtRun || pTxtRun->iLength < 1) {
return 0;
}
IFX_TxtAccess* pAccess = pTxtRun->pAccess;
@@ -1226,7 +1221,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
for (int32_t i = 0; i <= iLength; i++) {
int32_t iWidth;
FX_WCHAR wch;
- if (pAccess != NULL) {
+ if (pAccess) {
wch = pAccess->GetChar(pIdentity, i);
iWidth = pAccess->GetWidth(pIdentity, i);
} else {
@@ -1242,7 +1237,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
}
if (chartype >= FX_CHARTYPE_ArabicAlef) {
if (i < iLength) {
- if (pAccess != NULL) {
+ if (pAccess) {
iNext = i + 1;
while (iNext <= iLength) {
wNext = pAccess->GetChar(pIdentity, iNext);
@@ -1282,7 +1277,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
bShadda = FALSE;
} else {
wNext = 0xFEFF;
- if (pAccess != NULL) {
+ if (pAccess) {
iNext = i + 1;
if (iNext <= iLength) {
wNext = pAccess->GetChar(pIdentity, iNext);
@@ -1316,7 +1311,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
wForm = wch;
if (bArabicNumber) {
wNext = 0xFEFF;
- if (pAccess != NULL) {
+ if (pAccess) {
iNext = i + 1;
if (iNext <= iLength) {
wNext = pAccess->GetChar(pIdentity, iNext);
@@ -1359,7 +1354,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
}
int32_t iForms = bLam ? 3 : 1;
iCount += (bEmptyChar && bSkipSpace) ? 0 : iForms;
- if (pCharPos == NULL) {
+ if (!pCharPos) {
if (iWidth > 0) {
wPrev = wch;
}
@@ -1556,7 +1551,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
CFX_RectFArray& rtArray,
FX_BOOL bCharBBox) const {
- if (pTxtRun == NULL || pTxtRun->iLength < 1) {
+ if (!pTxtRun || pTxtRun->iLength < 1) {
return 0;
}
IFX_TxtAccess* pAccess = pTxtRun->pAccess;
@@ -1571,7 +1566,7 @@ int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
int32_t iFontSize = FXSYS_round(fFontSize * 20.0f);
FX_FLOAT fScale = fFontSize / 1000.0f;
CFGAS_GEFont* pFont = pTxtRun->pFont;
- if (pFont == NULL) {
+ if (!pFont) {
bCharBBox = FALSE;
}
CFX_Rect bbox;
@@ -1596,7 +1591,7 @@ int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
fStart = bRTLPiece ? rect.right() : rect.left;
}
for (int32_t i = 0; i < iLength; i++) {
- if (pAccess != NULL) {
+ if (pAccess) {
wch = pAccess->GetChar(pIdentity, i);
iCharSize = pAccess->GetWidth(pIdentity, i);
} else {
@@ -1696,8 +1691,8 @@ CFX_TxtPiece::CFX_TxtPiece()
m_iHorizontalScale(100),
m_iVerticalScale(100),
m_dwCharStyles(0),
- m_pChars(NULL),
- m_pUserData(NULL) {}
+ m_pChars(nullptr),
+ m_pUserData(nullptr) {}
CFX_TxtLine::CFX_TxtLine(int32_t iBlockSize)
: m_iStart(0), m_iWidth(0), m_iArabicChars(0) {
diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h
index 020fa1a3d3..3d8e3bdbb8 100644
--- a/xfa/fgas/layout/fgas_textbreak.h
+++ b/xfa/fgas/layout/fgas_textbreak.h
@@ -113,11 +113,11 @@ class CFX_TxtPiece : public CFX_Target {
int32_t GetLength() const { return m_iChars; }
int32_t GetEndChar() const { return m_iStartChar + m_iChars; }
CFX_TxtChar* GetCharPtr(int32_t index) const {
- ASSERT(index > -1 && index < m_iChars && m_pChars != NULL);
+ ASSERT(index > -1 && index < m_iChars && m_pChars);
return m_pChars->GetDataPtr(m_iStartChar + index);
}
void GetString(FX_WCHAR* pText) const {
- ASSERT(pText != NULL);
+ ASSERT(pText);
int32_t iEndChar = m_iStartChar + m_iChars;
CFX_Char* pChar;
for (int32_t i = m_iStartChar; i < iEndChar; i++) {
@@ -131,7 +131,7 @@ class CFX_TxtPiece : public CFX_Target {
wsText.ReleaseBuffer(m_iChars);
}
void GetWidths(int32_t* pWidths) const {
- ASSERT(pWidths != NULL);
+ ASSERT(pWidths);
int32_t iEndChar = m_iStartChar + m_iChars;
CFX_Char* pChar;
for (int32_t i = m_iStartChar; i < iEndChar; i++) {
@@ -229,8 +229,8 @@ class CFX_TxtBreak {
int32_t GetDisplayPos(const FX_TXTRUN* pTxtRun,
FXTEXT_CHARPOS* pCharPos,
FX_BOOL bCharCode = FALSE,
- CFX_WideString* pWSForms = NULL,
- FX_AdjustCharDisplayPos pAdjustPos = NULL) const;
+ CFX_WideString* pWSForms = nullptr,
+ FX_AdjustCharDisplayPos pAdjustPos = nullptr) const;
int32_t GetCharRects(const FX_TXTRUN* pTxtRun,
CFX_RectFArray& rtArray,
FX_BOOL bCharBBox = FALSE) const;