summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfdoc')
-rw-r--r--core/src/fpdfdoc/doc_action.cpp4
-rw-r--r--core/src/fpdfdoc/doc_annot.cpp32
-rw-r--r--core/src/fpdfdoc/doc_ap.cpp96
-rw-r--r--core/src/fpdfdoc/doc_basic.cpp20
-rw-r--r--core/src/fpdfdoc/doc_form.cpp164
-rw-r--r--core/src/fpdfdoc/doc_formcontrol.cpp36
-rw-r--r--core/src/fpdfdoc/doc_formfield.cpp200
-rw-r--r--core/src/fpdfdoc/doc_metadata.cpp2
-rw-r--r--core/src/fpdfdoc/doc_ocg.cpp72
-rw-r--r--core/src/fpdfdoc/doc_tagged.cpp36
-rw-r--r--core/src/fpdfdoc/doc_utils.cpp54
-rw-r--r--core/src/fpdfdoc/doc_utils.h8
-rw-r--r--core/src/fpdfdoc/doc_viewerPreferences.cpp8
-rw-r--r--core/src/fpdfdoc/doc_vt.cpp290
-rw-r--r--core/src/fpdfdoc/pdf_vt.h72
-rw-r--r--core/src/fpdfdoc/tagged_int.h14
16 files changed, 554 insertions, 554 deletions
diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp
index 851b2d6709..e7a339ce36 100644
--- a/core/src/fpdfdoc/doc_action.cpp
+++ b/core/src/fpdfdoc/doc_action.cpp
@@ -289,10 +289,10 @@ const FX_CHAR* g_sAATypes[] = {"E", "X", "D", "U", "Fo", "Bl", "PO", "PC", "PV",
"WC", "WS", "DS", "WP", "DP",
""
};
-FX_BOOL CPDF_AAction::ActionExist(AActionType eType) const
+bool CPDF_AAction::ActionExist(AActionType eType) const
{
if (m_pDict == NULL) {
- return FALSE;
+ return false;
}
return m_pDict->KeyExist(g_sAATypes[(int)eType]);
}
diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp
index 0a746190c0..5430079abc 100644
--- a/core/src/fpdfdoc/doc_annot.cpp
+++ b/core/src/fpdfdoc/doc_annot.cpp
@@ -22,7 +22,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
}
CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
CPDF_Dictionary* pAcroForm = pRoot->GetDict("AcroForm");
- FX_BOOL bRegenerateAP = pAcroForm && pAcroForm->GetBoolean("NeedAppearances");
+ bool bRegenerateAP = pAcroForm && pAcroForm->GetBoolean("NeedAppearances");
for (FX_DWORD i = 0; i < pAnnots->GetCount(); ++i) {
CPDF_Dictionary* pDict = (CPDF_Dictionary*)pAnnots->GetElementValue(i);
if (pDict == NULL || pDict->GetType() != PDFOBJ_DICTIONARY) {
@@ -55,12 +55,12 @@ CPDF_AnnotList::~CPDF_AnnotList()
}
}
void CPDF_AnnotList::DisplayPass(const CPDF_Page* pPage, CFX_RenderDevice* pDevice,
- CPDF_RenderContext* pContext, FX_BOOL bPrinting, CFX_AffineMatrix* pMatrix,
- FX_BOOL bWidgetPass, CPDF_RenderOptions* pOptions, FX_RECT* clip_rect)
+ CPDF_RenderContext* pContext, bool bPrinting, CFX_AffineMatrix* pMatrix,
+ bool bWidgetPass, CPDF_RenderOptions* pOptions, FX_RECT* clip_rect)
{
for (int i = 0; i < m_AnnotList.GetSize(); ++i) {
CPDF_Annot* pAnnot = (CPDF_Annot*)m_AnnotList[i];
- FX_BOOL bWidget = pAnnot->GetSubType() == "Widget";
+ bool bWidget = pAnnot->GetSubType() == "Widget";
if ((bWidgetPass && !bWidget) || (!bWidgetPass && bWidget)) {
continue;
}
@@ -103,24 +103,24 @@ void CPDF_AnnotList::DisplayPass(const CPDF_Page* pPage, CFX_RenderDevice* pDevi
}
void CPDF_AnnotList::DisplayAnnots(const CPDF_Page* pPage, CFX_RenderDevice* pDevice,
CFX_AffineMatrix* pUser2Device,
- FX_BOOL bShowWidget, CPDF_RenderOptions* pOptions)
+ bool bShowWidget, CPDF_RenderOptions* pOptions)
{
FX_RECT clip_rect;
if (pDevice) {
clip_rect = pDevice->GetClipBox();
}
- FX_BOOL bPrinting = pDevice->GetDeviceClass() == FXDC_PRINTER || (pOptions && (pOptions->m_Flags & RENDER_PRINTPREVIEW));
+ bool bPrinting = pDevice->GetDeviceClass() == FXDC_PRINTER || (pOptions && (pOptions->m_Flags & RENDER_PRINTPREVIEW));
DisplayAnnots(pPage, pDevice, NULL, bPrinting, pUser2Device, bShowWidget ? 3 : 1, pOptions, &clip_rect);
}
void CPDF_AnnotList::DisplayAnnots(const CPDF_Page* pPage, CFX_RenderDevice* pDevice, CPDF_RenderContext* pContext,
- FX_BOOL bPrinting, CFX_AffineMatrix* pUser2Device, FX_DWORD dwAnnotFlags,
+ bool bPrinting, CFX_AffineMatrix* pUser2Device, FX_DWORD dwAnnotFlags,
CPDF_RenderOptions* pOptions, FX_RECT* pClipRect)
{
if (dwAnnotFlags & 0x01) {
- DisplayPass(pPage, pDevice, pContext, bPrinting, pUser2Device, FALSE, pOptions, pClipRect);
+ DisplayPass(pPage, pDevice, pContext, bPrinting, pUser2Device, false, pOptions, pClipRect);
}
if (dwAnnotFlags & 0x02) {
- DisplayPass(pPage, pDevice, pContext, bPrinting, pUser2Device, TRUE, pOptions, pClipRect);
+ DisplayPass(pPage, pDevice, pContext, bPrinting, pUser2Device, true, pOptions, pClipRect);
}
}
int CPDF_AnnotList::GetIndex(CPDF_Annot* pAnnot)
@@ -246,28 +246,28 @@ static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage, CPDF_Annot* pA
matrix.Concat(*pUser2Device);
return pForm;
}
-FX_BOOL CPDF_Annot::DrawAppearance(const CPDF_Page* pPage, CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pUser2Device,
+bool CPDF_Annot::DrawAppearance(const CPDF_Page* pPage, CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pUser2Device,
AppearanceMode mode, const CPDF_RenderOptions* pOptions)
{
CFX_Matrix matrix;
CPDF_Form* pForm = FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix);
if (!pForm) {
- return FALSE;
+ return false;
}
CPDF_RenderContext context;
context.Create((CPDF_Page*)pPage);
context.DrawObjectList(pDevice, pForm, &matrix, pOptions);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_Annot::DrawInContext(const CPDF_Page* pPage, const CPDF_RenderContext* pContext, const CFX_AffineMatrix* pUser2Device, AppearanceMode mode)
+bool CPDF_Annot::DrawInContext(const CPDF_Page* pPage, const CPDF_RenderContext* pContext, const CFX_AffineMatrix* pUser2Device, AppearanceMode mode)
{
CFX_Matrix matrix;
CPDF_Form* pForm = FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix);
if (!pForm) {
- return FALSE;
+ return false;
}
((CPDF_RenderContext*)pContext)->AppendObjectList(pForm, &matrix);
- return TRUE;
+ return true;
}
void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pUser2Device, const CPDF_RenderOptions* pOptions)
{
@@ -278,7 +278,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CFX_AffineMatrix* p
if (annot_flags & ANNOTFLAG_HIDDEN) {
return;
}
- FX_BOOL bPrinting = pDevice->GetDeviceClass() == FXDC_PRINTER || (pOptions && (pOptions->m_Flags & RENDER_PRINTPREVIEW));
+ bool bPrinting = pDevice->GetDeviceClass() == FXDC_PRINTER || (pOptions && (pOptions->m_Flags & RENDER_PRINTPREVIEW));
if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) {
return;
}
diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp
index f94a4d60e0..4f3f178007 100644
--- a/core/src/fpdfdoc/doc_ap.cpp
+++ b/core/src/fpdfdoc/doc_ap.cpp
@@ -8,10 +8,10 @@
#include "../../include/fpdfdoc/fpdf_vt.h"
#include "pdf_vt.h"
#include "../../include/fpdfdoc/fpdf_ap.h"
-FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict)
+bool FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict)
{
if (!pAnnotDict || pAnnotDict->GetConstString("Subtype") != FX_BSTRC("Widget")) {
- return FALSE;
+ return false;
}
CFX_ByteString field_type = FPDF_GetFieldAttr(pAnnotDict, "FT")->GetString();
FX_DWORD flags = FPDF_GetFieldAttr(pAnnotDict, "Ff")? FPDF_GetFieldAttr(pAnnotDict, "Ff")->GetInteger() : 0;
@@ -34,7 +34,7 @@ FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict)
}
}
}
- return FALSE;
+ return false;
}
class CPVT_FontMap : public IPVT_FontMap
{
@@ -154,12 +154,12 @@ int32_t CPVT_Provider::GetWordFontIndex(FX_WORD word, int32_t charset, int32_t n
}
return -1;
}
-FX_BOOL CPVT_Provider::IsLatinWord(FX_WORD word)
+bool CPVT_Provider::IsLatinWord(FX_WORD word)
{
if ((word >= 0x61 && word <= 0x7A) || (word >= 0x41 && word <= 0x5A) || word == 0x2D || word == 0x27) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
int32_t CPVT_Provider::GetDefaultFontIndex()
{
@@ -244,14 +244,14 @@ static CPVT_Color ParseColor(const CPDF_Array & array)
}
return rt;
}
-static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict, const int32_t & nWidgetType)
+static bool GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict, const int32_t & nWidgetType)
{
CPDF_Dictionary* pFormDict = NULL;
if (CPDF_Dictionary * pRootDict = pDoc->GetRoot()) {
pFormDict = pRootDict->GetDict("AcroForm");
}
if (!pFormDict) {
- return FALSE;
+ return false;
}
CFX_ByteString DA;
if (CPDF_Object* pDAObj = FPDF_GetFieldAttr(pAnnotDict, "DA")) {
@@ -261,23 +261,23 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
DA = pFormDict->GetString("DA");
}
if (DA.IsEmpty()) {
- return FALSE;
+ return false;
}
CPDF_SimpleParser syntax(DA);
syntax.FindTagParam("Tf", 2);
CFX_ByteString sFontName = syntax.GetWord();
sFontName = PDF_NameDecode(sFontName);
if (sFontName.IsEmpty()) {
- return FALSE;
+ return false;
}
FX_FLOAT fFontSize = FX_atof(syntax.GetWord());
CPVT_Color crText = ParseColor(DA);
- FX_BOOL bUseFormRes = FALSE;
+ bool bUseFormRes = false;
CPDF_Dictionary * pFontDict = NULL;
CPDF_Dictionary* pDRDict = pAnnotDict->GetDict(FX_BSTRC("DR"));
if (pDRDict == NULL) {
pDRDict = pFormDict->GetDict(FX_BSTRC("DR"));
- bUseFormRes = TRUE;
+ bUseFormRes = true;
}
CPDF_Dictionary * pDRFontDict = NULL;
if (pDRDict && (pDRFontDict = pDRDict->GetDict("Font"))) {
@@ -291,12 +291,12 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
}
}
if (!pDRFontDict) {
- return FALSE;
+ return false;
}
if (!pFontDict) {
pFontDict = CPDF_Dictionary::Create();
if (pFontDict == NULL) {
- return FALSE;
+ return false;
}
pFontDict->SetAtName(FX_BSTRC("Type"), "Font");
pFontDict->SetAtName(FX_BSTRC("Subtype"), "Type1");
@@ -307,7 +307,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
}
CPDF_Font* pDefFont = pDoc->LoadFont(pFontDict);
if (!pDefFont) {
- return FALSE;
+ return false;
}
CPDF_Rect rcAnnot = pAnnotDict->GetRect("Rect");
int32_t nRotate = 0;
@@ -378,7 +378,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
}
}
CFX_ByteTextBuf sAppStream;
- CFX_ByteString sBG = CPVT_GenerateAP::GenerateColorAP(crBG, TRUE);
+ CFX_ByteString sBG = CPVT_GenerateAP::GenerateColorAP(crBG, true);
if (sBG.GetLength() > 0) {
sAppStream << "q\n" << sBG << rcBBox.left << " " << rcBBox.bottom << " "
<< rcBBox.Width() << " " << rcBBox.Height() << " re f\n" << "Q\n";
@@ -395,7 +395,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
if (pAPDict == NULL) {
pAPDict = CPDF_Dictionary::Create();
if (pAPDict == NULL) {
- return FALSE;
+ return false;
}
pAnnotDict->SetAt("AP", pAPDict);
}
@@ -403,7 +403,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
if (pNormalStream == NULL) {
pNormalStream = CPDF_Stream::Create(NULL, 0, NULL);
if (pNormalStream == NULL) {
- return FALSE;
+ return false;
}
int32_t objnum = pDoc->AddIndirectObject(pNormalStream);
pAnnotDict->GetDict("AP")->SetAtReference("N", pDoc, objnum);
@@ -418,7 +418,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
if (!pStreamResFontList) {
pStreamResFontList = CPDF_Dictionary::Create();
if (pStreamResFontList == NULL) {
- return FALSE;
+ return false;
}
pStreamResList->SetAt("Font", pStreamResFontList);
}
@@ -443,21 +443,21 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
vt.SetPlateRect(rcBody);
vt.SetAlignment(nAlign);
if (IsFloatZero(fFontSize)) {
- vt.SetAutoFontSize(TRUE);
+ vt.SetAutoFontSize(true);
} else {
vt.SetFontSize(fFontSize);
}
- FX_BOOL bMultiLine = (dwFlags >> 12) & 1;
+ bool bMultiLine = (dwFlags >> 12) & 1;
if (bMultiLine) {
- vt.SetMultiLine(TRUE);
- vt.SetAutoReturn(TRUE);
+ vt.SetMultiLine(true);
+ vt.SetAutoReturn(true);
}
FX_WORD subWord = 0;
if ((dwFlags >> 13) & 1) {
subWord = '*';
vt.SetPasswordChar(subWord);
}
- FX_BOOL bCharArray = (dwFlags >> 24) & 1;
+ bool bCharArray = (dwFlags >> 24) & 1;
if (bCharArray) {
vt.SetCharArray(dwMaxLen);
} else {
@@ -479,7 +479,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
sAppStream << rcBody.left << " " << rcBody.bottom << " "
<< rcBody.Width() << " " << rcBody.Height() << " re\nW\nn\n";
}
- sAppStream << "BT\n" << CPVT_GenerateAP::GenerateColorAP(crText, TRUE) << sBody << "ET\n" << "Q\nEMC\n";
+ sAppStream << "BT\n" << CPVT_GenerateAP::GenerateColorAP(crText, true) << sBody << "ET\n" << "Q\nEMC\n";
}
}
break;
@@ -497,7 +497,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
rcEdit.Normalize();
vt.SetPlateRect(rcEdit);
if (IsFloatZero(fFontSize)) {
- vt.SetAutoFontSize(TRUE);
+ vt.SetAutoFontSize(true);
} else {
vt.SetFontSize(fFontSize);
}
@@ -506,14 +506,14 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
vt.RearrangeAll();
CPDF_Rect rcContent = vt.GetContentRect();
CPDF_Point ptOffset = CPDF_Point(0.0f, (rcContent.Height() - rcEdit.Height()) / 2.0f);
- CFX_ByteString sEdit = CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(), ptOffset, TRUE, 0);
+ CFX_ByteString sEdit = CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(), ptOffset, true, 0);
if (sEdit.GetLength() > 0) {
sAppStream << "/Tx BMC\n" << "q\n";
sAppStream << rcEdit.left << " " << rcEdit.bottom << " "
<< rcEdit.Width() << " " << rcEdit.Height() << " re\nW\nn\n";
- sAppStream << "BT\n" << CPVT_GenerateAP::GenerateColorAP(crText, TRUE) << sEdit << "ET\n" << "Q\nEMC\n";
+ sAppStream << "BT\n" << CPVT_GenerateAP::GenerateColorAP(crText, true) << sEdit << "ET\n" << "Q\nEMC\n";
}
- CFX_ByteString sButton = CPVT_GenerateAP::GenerateColorAP(CPVT_Color(CT_RGB, 220.0f / 255.0f, 220.0f / 255.0f, 220.0f / 255.0f), TRUE);
+ CFX_ByteString sButton = CPVT_GenerateAP::GenerateColorAP(CPVT_Color(CT_RGB, 220.0f / 255.0f, 220.0f / 255.0f, 220.0f / 255.0f), true);
if (sButton.GetLength() > 0 && !rcButton.IsEmpty()) {
sAppStream << "q\n" << sButton;
sAppStream << rcButton.left << " " << rcButton.bottom << " "
@@ -555,11 +555,11 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
} else if (pOpt->GetType() == PDFOBJ_ARRAY) {
swItem = ((CPDF_Array*)pOpt)->GetElementValue(1)->GetUnicodeText();
}
- FX_BOOL bSelected = FALSE;
+ bool bSelected = false;
if (pSels) {
for (FX_DWORD s = 0, ssz = pSels->GetCount(); s < ssz; s++) {
if (i == pSels->GetInteger(s)) {
- bSelected = TRUE;
+ bSelected = true;
break;
}
}
@@ -578,11 +578,11 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
FX_FLOAT fItemHeight = vt.GetContentRect().Height();
if (bSelected) {
CPDF_Rect rcItem = CPDF_Rect(rcBody.left, fy - fItemHeight, rcBody.right, fy);
- sBody << "q\n" << CPVT_GenerateAP::GenerateColorAP(CPVT_Color(CT_RGB, 0, 51.0f / 255.0f, 113.0f / 255.0f), TRUE)
+ sBody << "q\n" << CPVT_GenerateAP::GenerateColorAP(CPVT_Color(CT_RGB, 0, 51.0f / 255.0f, 113.0f / 255.0f), true)
<< rcItem.left << " " << rcItem.bottom << " " << rcItem.Width() << " " << rcItem.Height() << " re f\n" << "Q\n";
- sBody << "BT\n" << CPVT_GenerateAP::GenerateColorAP(CPVT_Color(CT_GRAY, 1), TRUE) << CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(), CPDF_Point(0.0f, fy), TRUE, 0) << "ET\n";
+ sBody << "BT\n" << CPVT_GenerateAP::GenerateColorAP(CPVT_Color(CT_GRAY, 1), true) << CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(), CPDF_Point(0.0f, fy), true, 0) << "ET\n";
} else {
- sBody << "BT\n" << CPVT_GenerateAP::GenerateColorAP(crText, TRUE) << CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(), CPDF_Point(0.0f, fy), TRUE, 0) << "ET\n";
+ sBody << "BT\n" << CPVT_GenerateAP::GenerateColorAP(crText, true) << CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(), CPDF_Point(0.0f, fy), true, 0) << "ET\n";
}
fy -= fItemHeight;
}
@@ -598,7 +598,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
break;
}
if (pNormalStream) {
- pNormalStream->SetData((uint8_t*)sAppStream.GetBuffer(), sAppStream.GetSize(), FALSE, FALSE);
+ pNormalStream->SetData((uint8_t*)sAppStream.GetBuffer(), sAppStream.GetSize(), false, false);
pStreamDict = pNormalStream->GetDict();
if (pStreamDict) {
pStreamDict->SetAtMatrix("Matrix", matrix);
@@ -609,7 +609,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
if (!pStreamResFontList) {
pStreamResFontList = CPDF_Dictionary::Create();
if (pStreamResFontList == NULL) {
- return FALSE;
+ return false;
}
pStreamResList->SetAt("Font", pStreamResFontList);
}
@@ -622,21 +622,21 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict
}
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CPVT_GenerateAP::GenerateTextFieldAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict)
+bool CPVT_GenerateAP::GenerateTextFieldAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict)
{
return GenerateWidgetAP(pDoc, pAnnotDict, 0);
}
-FX_BOOL CPVT_GenerateAP::GenerateComboBoxAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict)
+bool CPVT_GenerateAP::GenerateComboBoxAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict)
{
return GenerateWidgetAP(pDoc, pAnnotDict, 1);
}
-FX_BOOL CPVT_GenerateAP::GenerateListBoxAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict)
+bool CPVT_GenerateAP::GenerateListBoxAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict)
{
return GenerateWidgetAP(pDoc, pAnnotDict, 2);
}
-CFX_ByteString CPVT_GenerateAP::GenerateEditAP(IPVT_FontMap * pFontMap, IPDF_VariableText_Iterator* pIterator, const CPDF_Point & ptOffset, FX_BOOL bContinuous, FX_WORD SubWord, const CPVT_WordRange * pVisible)
+CFX_ByteString CPVT_GenerateAP::GenerateEditAP(IPVT_FontMap * pFontMap, IPDF_VariableText_Iterator* pIterator, const CPDF_Point & ptOffset, bool bContinuous, FX_WORD SubWord, const CPVT_WordRange * pVisible)
{
CFX_ByteTextBuf sEditStream, sLineStream, sWords;
CPDF_Point ptOld(0.0f, 0.0f), ptNew(0.0f, 0.0f);
@@ -726,7 +726,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(const CPDF_Rect & rect, FX_FLOA
switch (nStyle) {
default:
case PBS_SOLID:
- sColor = GenerateColorAP(color, TRUE);
+ sColor = GenerateColorAP(color, true);
if (sColor.GetLength() > 0) {
sAppStream << sColor;
sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " << fTop - fBottom << " re\n";
@@ -736,7 +736,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(const CPDF_Rect & rect, FX_FLOA
}
break;
case PBS_DASH:
- sColor = GenerateColorAP(color, FALSE);
+ sColor = GenerateColorAP(color, false);
if (sColor.GetLength() > 0) {
sAppStream << sColor;
sAppStream << fWidth << " w" << " [" << dash.nDash << " " << dash.nGap << "] " << dash.nPhase << " d\n";
@@ -749,7 +749,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(const CPDF_Rect & rect, FX_FLOA
break;
case PBS_BEVELED:
case PBS_INSET:
- sColor = GenerateColorAP(crLeftTop, TRUE);
+ sColor = GenerateColorAP(crLeftTop, true);
if (sColor.GetLength() > 0) {
sAppStream << sColor;
sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth << " m\n";
@@ -759,7 +759,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(const CPDF_Rect & rect, FX_FLOA
sAppStream << fLeft + fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 << " l\n";
sAppStream << fLeft + fHalfWidth * 2 << " " << fBottom + fHalfWidth * 2 << " l f\n";
}
- sColor = GenerateColorAP(crRightBottom, TRUE);
+ sColor = GenerateColorAP(crRightBottom, true);
if (sColor.GetLength() > 0) {
sAppStream << sColor;
sAppStream << fRight - fHalfWidth << " " << fTop - fHalfWidth << " m\n";
@@ -769,7 +769,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(const CPDF_Rect & rect, FX_FLOA
sAppStream << fRight - fHalfWidth * 2 << " " << fBottom + fHalfWidth * 2 << " l\n";
sAppStream << fRight - fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 << " l f\n";
}
- sColor = GenerateColorAP(color, TRUE);
+ sColor = GenerateColorAP(color, true);
if (sColor.GetLength() > 0) {
sAppStream << sColor;
sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " << fTop - fBottom << " re\n";
@@ -778,7 +778,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(const CPDF_Rect & rect, FX_FLOA
}
break;
case PBS_UNDERLINED:
- sColor = GenerateColorAP(color, FALSE);
+ sColor = GenerateColorAP(color, false);
if (sColor.GetLength() > 0) {
sAppStream << sColor;
sAppStream << fWidth << " w\n";
@@ -790,7 +790,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(const CPDF_Rect & rect, FX_FLOA
}
return sAppStream.GetByteString();
}
-CFX_ByteString CPVT_GenerateAP::GenerateColorAP(const CPVT_Color & color, const FX_BOOL & bFillOrStroke)
+CFX_ByteString CPVT_GenerateAP::GenerateColorAP(const CPVT_Color & color, const bool & bFillOrStroke)
{
CFX_ByteTextBuf sColorStream;
switch (color.nColorType) {
diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp
index 3ba109b016..647b7cb718 100644
--- a/core/src/fpdfdoc/doc_basic.cpp
+++ b/core/src/fpdfdoc/doc_basic.cpp
@@ -313,10 +313,10 @@ static CFX_WideString FILESPEC_DecodeFileName(const CFX_WideStringC& filepath)
return filepath;
#endif
}
-FX_BOOL CPDF_FileSpec::GetFileName(CFX_WideString &csFileName) const
+bool CPDF_FileSpec::GetFileName(CFX_WideString &csFileName) const
{
if (m_pObj == NULL) {
- return FALSE;
+ return false;
}
if (m_pObj->GetType() == PDFOBJ_DICTIONARY) {
CPDF_Dictionary* pDict = (CPDF_Dictionary*)m_pObj;
@@ -325,7 +325,7 @@ FX_BOOL CPDF_FileSpec::GetFileName(CFX_WideString &csFileName) const
csFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("F")));
}
if (pDict->GetString(FX_BSTRC("FS")) == FX_BSTRC("URL")) {
- return TRUE;
+ return true;
}
if (csFileName.IsEmpty()) {
if (pDict->KeyExist(FX_BSTRC("DOS"))) {
@@ -335,14 +335,14 @@ FX_BOOL CPDF_FileSpec::GetFileName(CFX_WideString &csFileName) const
} else if (pDict->KeyExist(FX_BSTRC("Unix"))) {
csFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("Unix")));
} else {
- return FALSE;
+ return false;
}
}
} else {
csFileName = CFX_WideString::FromLocal(m_pObj->GetString());
}
csFileName = FILESPEC_DecodeFileName(csFileName);
- return TRUE;
+ return true;
}
CPDF_FileSpec::CPDF_FileSpec()
{
@@ -351,13 +351,13 @@ CPDF_FileSpec::CPDF_FileSpec()
((CPDF_Dictionary*)m_pObj)->SetAtName(FX_BSTRC("Type"), FX_BSTRC("Filespec"));
}
}
-FX_BOOL CPDF_FileSpec::IsURL() const
+bool CPDF_FileSpec::IsURL() const
{
if (m_pObj == NULL) {
- return FALSE;
+ return false;
}
if (m_pObj->GetType() != PDFOBJ_DICTIONARY) {
- return FALSE;
+ return false;
}
return ((CPDF_Dictionary*)m_pObj)->GetString(FX_BSTRC("FS")) == FX_BSTRC("URL");
}
@@ -416,7 +416,7 @@ CPDF_Stream* CPDF_FileSpec::GetFileStream() const
}
return NULL;
}
-static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object *pObj, const CFX_WideStringC& wsFileName, FX_BOOL bURL)
+static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object *pObj, const CFX_WideStringC& wsFileName, bool bURL)
{
ASSERT(pObj != NULL);
CFX_WideString wsStr;
@@ -434,7 +434,7 @@ static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object *pObj, const CFX_WideString
pDict->SetAtString(FX_BSTRC("UF"), PDF_EncodeText(wsStr));
}
}
-void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName, FX_BOOL bURL)
+void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName, bool bURL)
{
ASSERT(m_pObj != NULL);
if (m_pObj->GetType() == PDFOBJ_DICTIONARY && bURL) {
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 735231cc1d..6057f56437 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -241,12 +241,12 @@ CFieldTree::_Node *CFieldTree::FindNode(const CFX_WideString& full_name)
}
return pNode;
}
-CPDF_InterForm::CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bGenerateAP) : CFX_PrivateData()
+CPDF_InterForm::CPDF_InterForm(CPDF_Document* pDocument, bool bGenerateAP) : CFX_PrivateData()
{
m_pDocument = pDocument;
m_bGenerateAP = bGenerateAP;
m_pFormNotify = NULL;
- m_bUpdated = FALSE;
+ m_bUpdated = false;
m_pFieldTree = new CFieldTree;
CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
m_pFormDict = pRoot->GetDict("AcroForm");
@@ -280,12 +280,12 @@ CPDF_InterForm::~CPDF_InterForm()
delete m_pFieldTree;
}
}
-FX_BOOL CPDF_InterForm::m_bUpdateAP = TRUE;
-FX_BOOL CPDF_InterForm::UpdatingAPEnabled()
+bool CPDF_InterForm::m_bUpdateAP = true;
+bool CPDF_InterForm::UpdatingAPEnabled()
{
return m_bUpdateAP;
}
-void CPDF_InterForm::EnableUpdateAP(FX_BOOL bUpdateAP)
+void CPDF_InterForm::EnableUpdateAP(bool bUpdateAP)
{
m_bUpdateAP = bUpdateAP;
}
@@ -328,7 +328,7 @@ CFX_ByteString CPDF_InterForm::GenerateNewResourceName(const CPDF_Dictionary* pR
}
int num = 0;
CFX_ByteString bsNum;
- while (TRUE) {
+ while (true) {
if (!pDict->KeyExist(csTmp + bsNum)) {
return csTmp + bsNum;
}
@@ -343,7 +343,7 @@ CFX_ByteString CPDF_InterForm::GenerateNewResourceName(const CPDF_Dictionary* pR
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
typedef struct _PDF_FONTDATA {
- FX_BOOL bFind;
+ bool bFind;
LOGFONTA lf;
} PDF_FONTDATA, FAR* LPDF_FONTDATA;
static int CALLBACK EnumFontFamExProc( ENUMLOGFONTEXA *lpelfe,
@@ -357,10 +357,10 @@ static int CALLBACK EnumFontFamExProc( ENUMLOGFONTEXA *lpelfe,
}
LPDF_FONTDATA pData = (LPDF_FONTDATA)lParam;
memcpy(&pData->lf, &lpelfe->elfLogFont, sizeof(LOGFONTA));
- pData->bFind = TRUE;
+ pData->bFind = true;
return 0;
}
-static FX_BOOL RetrieveSpecificFont(LOGFONTA& lf)
+static bool RetrieveSpecificFont(LOGFONTA& lf)
{
PDF_FONTDATA fd;
memset(&fd, 0, sizeof(PDF_FONTDATA));
@@ -372,7 +372,7 @@ static FX_BOOL RetrieveSpecificFont(LOGFONTA& lf)
}
return fd.bFind;
}
-static FX_BOOL RetrieveSpecificFont(uint8_t charSet, uint8_t pitchAndFamily, LPCSTR pcsFontName, LOGFONTA& lf)
+static bool RetrieveSpecificFont(uint8_t charSet, uint8_t pitchAndFamily, LPCSTR pcsFontName, LOGFONTA& lf)
{
memset(&lf, 0, sizeof(LOGFONTA));
lf.lfCharSet = charSet;
@@ -382,7 +382,7 @@ static FX_BOOL RetrieveSpecificFont(uint8_t charSet, uint8_t pitchAndFamily, LPC
}
return RetrieveSpecificFont(lf);
}
-static FX_BOOL RetrieveStockFont(int iFontObject, uint8_t charSet, LOGFONTA& lf)
+static bool RetrieveStockFont(int iFontObject, uint8_t charSet, LOGFONTA& lf)
{
HFONT hFont = (HFONT)::GetStockObject(iFontObject);
if (hFont != NULL) {
@@ -392,7 +392,7 @@ static FX_BOOL RetrieveStockFont(int iFontObject, uint8_t charSet, LOGFONTA& lf)
return RetrieveSpecificFont(lf);
}
}
- return FALSE;
+ return false;
}
#endif
CPDF_Font* CPDF_InterForm::AddSystemDefaultFont(const CPDF_Document* pDocument)
@@ -403,13 +403,13 @@ CPDF_Font* CPDF_InterForm::AddSystemDefaultFont(const CPDF_Document* pDocument)
CPDF_Font* pFont = NULL;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
LOGFONTA lf;
- FX_BOOL bRet;
+ bool bRet;
bRet = RetrieveStockFont(DEFAULT_GUI_FONT, 255, lf);
if (!bRet) {
bRet = RetrieveStockFont(SYSTEM_FONT, 255, lf);
}
if (bRet) {
- pFont = ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE);
+ pFont = ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, false, true);
}
#endif
return pFont;
@@ -430,7 +430,7 @@ CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_Byt
::GetObjectA(hFont, sizeof(LOGFONTA), &lf);
::DeleteObject(hFont);
if (strlen(lf.lfFaceName) > 0) {
- return ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE);
+ return ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, false, true);
}
}
#endif
@@ -452,7 +452,7 @@ CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_Wid
::GetObject(hFont, sizeof(LOGFONTA), &lf);
::DeleteObject(hFont);
if (strlen(lf.lfFaceName) > 0) {
- return ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE);
+ return ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, false, true);
}
}
#endif
@@ -477,12 +477,12 @@ CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont)
CFX_ByteString csFontName;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
LOGFONTA lf;
- FX_BOOL bRet;
+ bool bRet;
if (charSet == ANSI_CHARSET) {
csFontName = "Helvetica";
return csFontName;
}
- bRet = FALSE;
+ bRet = false;
if (charSet == SHIFTJIS_CHARSET) {
bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, "MS Mincho", lf);
} else if (charSet == GB2312_CHARSET) {
@@ -591,7 +591,7 @@ CPDF_Font* CPDF_InterForm::AddNativeFont(uint8_t charSet, const CPDF_Document* p
if (csFontName == "Helvetica") {
pFont = AddStandardFont(pDocument, csFontName);
} else {
- pFont = ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE);
+ pFont = ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, false, true);
}
}
#endif
@@ -607,15 +607,15 @@ CPDF_Font* CPDF_InterForm::AddNativeFont(const CPDF_Document* pDocument)
pFont = AddNativeFont(charSet, pDocument);
return pFont;
}
-FX_BOOL CPDF_InterForm::ValidateFieldName(CFX_WideString& csNewFieldName, int iType, const CPDF_FormField* pExcludedField, const CPDF_FormControl* pExcludedControl)
+bool CPDF_InterForm::ValidateFieldName(CFX_WideString& csNewFieldName, int iType, const CPDF_FormField* pExcludedField, const CPDF_FormControl* pExcludedControl)
{
if (csNewFieldName.IsEmpty()) {
- return FALSE;
+ return false;
}
int iPos = 0;
int iLength = csNewFieldName.GetLength();
CFX_WideString csSub;
- while (TRUE) {
+ while (true) {
while (iPos < iLength && (csNewFieldName[iPos] == L'.' || csNewFieldName[iPos] == L' ')) {
iPos ++;
}
@@ -651,15 +651,15 @@ FX_BOOL CPDF_InterForm::ValidateFieldName(CFX_WideString& csNewFieldName, int iT
int iRet = CompareFieldName(csSub, csFullName);
if (iRet == 1) {
if (pField->GetFieldType() != iType) {
- return FALSE;
+ return false;
}
} else if (iRet == 2 && csSub == csNewFieldName) {
if (csFullName[iPos] == L'.') {
- return FALSE;
+ return false;
}
} else if (iRet == 3 && csSub == csNewFieldName) {
if (csNewFieldName[csFullName.GetLength()] == L'.') {
- return FALSE;
+ return false;
}
}
}
@@ -668,26 +668,26 @@ FX_BOOL CPDF_InterForm::ValidateFieldName(CFX_WideString& csNewFieldName, int iT
}
}
if (csSub.IsEmpty()) {
- return FALSE;
+ return false;
}
csNewFieldName = csSub;
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_InterForm::ValidateFieldName(CFX_WideString& csNewFieldName, int iType)
+bool CPDF_InterForm::ValidateFieldName(CFX_WideString& csNewFieldName, int iType)
{
return ValidateFieldName(csNewFieldName, iType, NULL, NULL);
}
-FX_BOOL CPDF_InterForm::ValidateFieldName(const CPDF_FormField* pField, CFX_WideString& csNewFieldName)
+bool CPDF_InterForm::ValidateFieldName(const CPDF_FormField* pField, CFX_WideString& csNewFieldName)
{
if (pField == NULL || csNewFieldName.IsEmpty()) {
- return FALSE;
+ return false;
}
return ValidateFieldName(csNewFieldName, ((CPDF_FormField*)pField)->GetFieldType(), pField, NULL);
}
-FX_BOOL CPDF_InterForm::ValidateFieldName(const CPDF_FormControl* pControl, CFX_WideString& csNewFieldName)
+bool CPDF_InterForm::ValidateFieldName(const CPDF_FormControl* pControl, CFX_WideString& csNewFieldName)
{
if (pControl == NULL || csNewFieldName.IsEmpty()) {
- return FALSE;
+ return false;
}
CPDF_FormField* pField = ((CPDF_FormControl*)pControl)->GetField();
return ValidateFieldName(csNewFieldName, pField->GetFieldType(), pField, pControl);
@@ -764,19 +764,19 @@ void CPDF_InterForm::GetAllFieldNames(CFX_WideStringArray& allFieldNames)
}
}
}
-FX_BOOL CPDF_InterForm::IsValidFormField(const void* pField)
+bool CPDF_InterForm::IsValidFormField(const void* pField)
{
if (pField == NULL) {
- return FALSE;
+ return false;
}
int nCount = m_pFieldTree->m_Root.CountFields();
for (int i = 0; i < nCount; i++) {
CPDF_FormField *pFormField = m_pFieldTree->m_Root.GetField(i);
if (pField == pFormField) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
CPDF_FormField* CPDF_InterForm::GetFieldByDict(CPDF_Dictionary* pFieldDict) const
{
@@ -808,10 +808,10 @@ CPDF_FormControl* CPDF_InterForm::GetControl(FX_DWORD index, CFX_WideString csFi
}
return NULL;
}
-FX_BOOL CPDF_InterForm::IsValidFormControl(const void* pControl)
+bool CPDF_InterForm::IsValidFormControl(const void* pControl)
{
if (pControl == NULL) {
- return FALSE;
+ return false;
}
FX_POSITION pos = m_ControlMap.GetStartPosition();
while (pos) {
@@ -819,10 +819,10 @@ FX_BOOL CPDF_InterForm::IsValidFormControl(const void* pControl)
void* pFormControl = NULL;
m_ControlMap.GetNextAssoc(pos, (void*&)pWidgetDict, pFormControl);
if (pControl == pFormControl) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
int CPDF_InterForm::CountPageControls(CPDF_Page* pPage) const
{
@@ -919,7 +919,7 @@ FX_DWORD CPDF_InterForm::CountInternalFields(const CFX_WideString& csFieldName)
csSub += csFieldName[iPos ++];
}
int iCount = pArray->GetCount();
- FX_BOOL bFind = FALSE;
+ bool bFind = false;
for (int i = 0; i < iCount; i ++) {
pDict = pArray->GetDict(i);
if (pDict == NULL) {
@@ -927,7 +927,7 @@ FX_DWORD CPDF_InterForm::CountInternalFields(const CFX_WideString& csFieldName)
}
CFX_WideString csT = pDict->GetUnicodeText("T");
if (csT == csSub) {
- bFind = TRUE;
+ bFind = true;
break;
}
}
@@ -970,7 +970,7 @@ CPDF_Dictionary* CPDF_InterForm::GetInternalField(FX_DWORD index, const CFX_Wide
csSub += csFieldName[iPos ++];
}
int iCount = pArray->GetCount();
- FX_BOOL bFind = FALSE;
+ bool bFind = false;
for (int i = 0; i < iCount; i ++) {
pDict = pArray->GetDict(i);
if (pDict == NULL) {
@@ -978,7 +978,7 @@ CPDF_Dictionary* CPDF_InterForm::GetInternalField(FX_DWORD index, const CFX_Wide
}
CFX_WideString csT = pDict->GetUnicodeText("T");
if (csT == csSub) {
- bFind = TRUE;
+ bFind = true;
break;
}
}
@@ -996,14 +996,14 @@ CPDF_Dictionary* CPDF_InterForm::GetInternalField(FX_DWORD index, const CFX_Wide
pArray = pDict->GetArray("Kids");
return pArray ? pArray->GetDict(index) : pDict;
}
-FX_BOOL CPDF_InterForm::NeedConstructAP()
+bool CPDF_InterForm::NeedConstructAP()
{
if (m_pFormDict == NULL) {
- return FALSE;
+ return false;
}
return m_pFormDict->GetBoolean("NeedAppearances");
}
-void CPDF_InterForm::NeedConstructAP(FX_BOOL bNeedAP)
+void CPDF_InterForm::NeedConstructAP(bool bNeedAP)
{
if (m_pFormDict == NULL) {
InitInterFormDict(m_pFormDict, m_pDocument);
@@ -1078,37 +1078,37 @@ CPDF_Font* CPDF_InterForm::GetNativeFormFont(CFX_ByteString& csNameTag)
{
return GetNativeInterFormFont(m_pFormDict, m_pDocument, csNameTag);
}
-FX_BOOL CPDF_InterForm::FindFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag)
+bool CPDF_InterForm::FindFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag)
{
return FindInterFormFont(m_pFormDict, pFont, csNameTag);
}
-FX_BOOL CPDF_InterForm::FindFormFont(CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag)
+bool CPDF_InterForm::FindFormFont(CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag)
{
return FindInterFormFont(m_pFormDict, m_pDocument, csFontName, pFont, csNameTag);
}
void CPDF_InterForm::AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag)
{
AddInterFormFont(m_pFormDict, m_pDocument, pFont, csNameTag);
- m_bUpdated = TRUE;
+ m_bUpdated = true;
}
CPDF_Font* CPDF_InterForm::AddNativeFormFont(uint8_t charSet, CFX_ByteString& csNameTag)
{
- m_bUpdated = TRUE;
+ m_bUpdated = true;
return AddNativeInterFormFont(m_pFormDict, m_pDocument, charSet, csNameTag);
}
CPDF_Font* CPDF_InterForm::AddNativeFormFont(CFX_ByteString& csNameTag)
{
- m_bUpdated = TRUE;
+ m_bUpdated = true;
return AddNativeInterFormFont(m_pFormDict, m_pDocument, csNameTag);
}
void CPDF_InterForm::RemoveFormFont(const CPDF_Font* pFont)
{
- m_bUpdated = TRUE;
+ m_bUpdated = true;
RemoveInterFormFont(m_pFormDict, pFont);
}
void CPDF_InterForm::RemoveFormFont(CFX_ByteString csNameTag)
{
- m_bUpdated = TRUE;
+ m_bUpdated = true;
RemoveInterFormFont(m_pFormDict, csNameTag);
}
CPDF_DefaultAppearance CPDF_InterForm::GetDefaultAppearance()
@@ -1131,12 +1131,12 @@ int CPDF_InterForm::GetFormAlignment()
}
return m_pFormDict->GetInteger("Q", 0);
}
-FX_BOOL CPDF_InterForm::ResetForm(const CFX_PtrArray& fields, FX_BOOL bIncludeOrExclude, FX_BOOL bNotify)
+bool CPDF_InterForm::ResetForm(const CFX_PtrArray& fields, bool bIncludeOrExclude, bool bNotify)
{
if (bNotify && m_pFormNotify != NULL) {
int iRet = m_pFormNotify->BeforeFormReset(this);
if (iRet < 0) {
- return FALSE;
+ return false;
}
}
int nCount = m_pFieldTree->m_Root.CountFields();
@@ -1145,11 +1145,11 @@ FX_BOOL CPDF_InterForm::ResetForm(const CFX_PtrArray& fields, FX_BOOL bIncludeOr
if (pField == NULL) {
continue;
}
- FX_BOOL bFind = FALSE;
+ bool bFind = false;
int iCount = fields.GetSize();
for (int i = 0; i < iCount; i ++) {
if (pField == (CPDF_FormField*)fields[i]) {
- bFind = TRUE;
+ bFind = true;
break;
}
}
@@ -1160,14 +1160,14 @@ FX_BOOL CPDF_InterForm::ResetForm(const CFX_PtrArray& fields, FX_BOOL bIncludeOr
if (bNotify && m_pFormNotify != NULL) {
m_pFormNotify->AfterFormReset(this);
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_InterForm::ResetForm(FX_BOOL bNotify)
+bool CPDF_InterForm::ResetForm(bool bNotify)
{
if (bNotify && m_pFormNotify != NULL) {
int iRet = m_pFormNotify->BeforeFormReset(this);
if (iRet < 0) {
- return FALSE;
+ return false;
}
}
int nCount = m_pFieldTree->m_Root.CountFields();
@@ -1181,7 +1181,7 @@ FX_BOOL CPDF_InterForm::ResetForm(FX_BOOL bNotify)
if (bNotify && m_pFormNotify != NULL) {
m_pFormNotify->AfterFormReset(this);
}
- return TRUE;
+ return true;
}
void CPDF_InterForm::ReloadForm()
{
@@ -1242,7 +1242,7 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel)
AddTerminalField(pFieldDict);
}
}
-FX_BOOL CPDF_InterForm::HasXFAForm() const
+bool CPDF_InterForm::HasXFAForm() const
{
return m_pFormDict && m_pFormDict->GetArray(FX_BSTRC("XFA")) != NULL;
}
@@ -1303,7 +1303,7 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(const CPDF_Dictionary* pFieldDi
pField = new CPDF_FormField(this, pParent);
CPDF_Object* pTObj = pDict->GetElement("T");
if (pTObj && pTObj->GetType() == PDFOBJ_REFERENCE) {
- CPDF_Object* pClone = pTObj->Clone(TRUE);
+ CPDF_Object* pClone = pTObj->Clone(true);
if (pClone) {
pDict->SetAt("T", pClone);
} else {
@@ -1342,7 +1342,7 @@ CPDF_FormControl* CPDF_InterForm::AddControl(const CPDF_FormField* pField, const
((CPDF_FormField*)pField)->m_ControlList.Add(pControl);
return pControl;
}
-CPDF_FormField* CPDF_InterForm::CheckRequiredFields(const CFX_PtrArray *fields, FX_BOOL bIncludeOrExclude) const
+CPDF_FormField* CPDF_InterForm::CheckRequiredFields(const CFX_PtrArray *fields, bool bIncludeOrExclude) const
{
int nCount = m_pFieldTree->m_Root.CountFields();
for (int i = 0; i < nCount; i++) {
@@ -1358,7 +1358,7 @@ CPDF_FormField* CPDF_InterForm::CheckRequiredFields(const CFX_PtrArray *fields,
if (dwFlags & 0x04) {
continue;
}
- FX_BOOL bFind = TRUE;
+ bool bFind = true;
if (fields != NULL) {
bFind = fields->Find(pField, 0) >= 0;
}
@@ -1371,7 +1371,7 @@ CPDF_FormField* CPDF_InterForm::CheckRequiredFields(const CFX_PtrArray *fields,
}
return NULL;
}
-CFDF_Document* CPDF_InterForm::ExportToFDF(const CFX_WideStringC& pdf_path, FX_BOOL bSimpleFileSpec) const
+CFDF_Document* CPDF_InterForm::ExportToFDF(const CFX_WideStringC& pdf_path, bool bSimpleFileSpec) const
{
CFX_PtrArray fields;
int nCount = m_pFieldTree->m_Root.CountFields();
@@ -1379,10 +1379,10 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(const CFX_WideStringC& pdf_path, FX_B
CPDF_FormField* pField = m_pFieldTree->m_Root.GetField(i);
fields.Add(pField);
}
- return ExportToFDF(pdf_path, fields, TRUE, bSimpleFileSpec);
+ return ExportToFDF(pdf_path, fields, true, bSimpleFileSpec);
}
CFX_WideString FILESPEC_EncodeFileName(const CFX_WideStringC& filepath);
-CFDF_Document* CPDF_InterForm::ExportToFDF(const CFX_WideStringC& pdf_path, CFX_PtrArray& fields, FX_BOOL bIncludeOrExclude, FX_BOOL bSimpleFileSpec) const
+CFDF_Document* CPDF_InterForm::ExportToFDF(const CFX_WideStringC& pdf_path, CFX_PtrArray& fields, bool bIncludeOrExclude, bool bSimpleFileSpec) const
{
CFDF_Document* pDoc = CFDF_Document::CreateNewDoc();
if (pDoc == NULL) {
@@ -1415,7 +1415,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(const CFX_WideStringC& pdf_path, CFX_
if (dwFlags & 0x04) {
continue;
}
- FX_BOOL bFind = fields.Find(pField, 0) >= 0;
+ bool bFind = fields.Find(pField, 0) >= 0;
if ((bIncludeOrExclude && bFind) || (!bIncludeOrExclude && !bFind)) {
if ((dwFlags & 0x02) != 0 && pField->m_pDict->GetString("V").IsEmpty()) {
continue;
@@ -1432,7 +1432,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(const CFX_WideStringC& pdf_path, CFX_
}
pFieldDict->SetAt("T", pString);
if (pField->GetType() == CPDF_FormField::CheckBox || pField->GetType() == CPDF_FormField::RadioButton) {
- CFX_WideString csExport = pField->GetCheckValue(FALSE);
+ CFX_WideString csExport = pField->GetCheckValue(false);
CFX_ByteString csBExport = PDF_EncodeText(csExport);
CPDF_Object* pOpt = FPDF_GetFieldAttr(pField->m_pDict, "Opt");
if (pOpt == NULL) {
@@ -1443,7 +1443,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(const CFX_WideStringC& pdf_path, CFX_
} else {
CPDF_Object* pV = FPDF_GetFieldAttr(pField->m_pDict, "V");
if (pV != NULL) {
- pFieldDict->SetAt("V", pV->Clone(TRUE));
+ pFieldDict->SetAt("V", pV->Clone(true));
}
}
pFields->Add(pFieldDict);
@@ -1483,7 +1483,7 @@ static void FPDFDOC_FDF_GetFieldValue(CPDF_Dictionary *pFieldDict, CFX_WideStrin
csValue = CFX_WideString::FromLocal(csBValue);
}
}
-void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict, const CFX_WideString& parent_name, FX_BOOL bNotify, int nLevel)
+void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict, const CFX_WideString& parent_name, bool bNotify, int nLevel)
{
CFX_WideString name;
if (!parent_name.IsEmpty()) {
@@ -1531,7 +1531,7 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict, const CFX_Wide
pField->SetValue(csWValue);
CPDF_FormField::Type eType = pField->GetType();
if ((eType == CPDF_FormField::ListBox || eType == CPDF_FormField::ComboBox) && pFieldDict->KeyExist("Opt")) {
- pField->m_pDict->SetAt("Opt", pFieldDict->GetElementValue("Opt")->Clone(TRUE));
+ pField->m_pDict->SetAt("Opt", pFieldDict->GetElementValue("Opt")->Clone(true));
}
if (bNotify && m_pFormNotify != NULL) {
if (iType == FIELDTYPE_CHECKBOX || iType == FIELDTYPE_RADIOBUTTON) {
@@ -1546,24 +1546,24 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict, const CFX_Wide
pField->UpdateAP(NULL);
}
}
-FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF, FX_BOOL bNotify)
+bool CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF, bool bNotify)
{
if (pFDF == NULL) {
- return FALSE;
+ return false;
}
CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDict("FDF");
if (pMainDict == NULL) {
- return FALSE;
+ return false;
}
CPDF_Array* pFields = pMainDict->GetArray("Fields");
if (pFields == NULL) {
- return FALSE;
+ return false;
}
m_bsEncoding = pMainDict->GetString(FX_BSTRC("Encoding"));
if (bNotify && m_pFormNotify != NULL) {
int iRet = m_pFormNotify->BeforeFormImportData(this);
if (iRet < 0) {
- return FALSE;
+ return false;
}
}
for (FX_DWORD i = 0; i < pFields->GetCount(); i ++) {
@@ -1576,13 +1576,13 @@ FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF, FX_BOOL bNotify
if (bNotify && m_pFormNotify != NULL) {
m_pFormNotify->AfterFormImportData(this);
}
- return TRUE;
+ return true;
}
void CPDF_InterForm::SetFormNotify(const CPDF_FormNotify* pNotify)
{
m_pFormNotify = (CPDF_FormNotify*)pNotify;
}
-int CPDF_InterForm::GetPageWithWidget(int iCurPage, FX_BOOL bNext)
+int CPDF_InterForm::GetPageWithWidget(int iCurPage, bool bNext)
{
if (iCurPage < 0) {
return -1;
@@ -1622,6 +1622,6 @@ int CPDF_InterForm::GetPageWithWidget(int iCurPage, FX_BOOL bNext)
return iNewPage;
}
}
- } while (TRUE);
+ } while (true);
return -1;
}
diff --git a/core/src/fpdfdoc/doc_formcontrol.cpp b/core/src/fpdfdoc/doc_formcontrol.cpp
index 87eee92c2e..62eb591f94 100644
--- a/core/src/fpdfdoc/doc_formcontrol.cpp
+++ b/core/src/fpdfdoc/doc_formcontrol.cpp
@@ -113,25 +113,25 @@ CFX_WideString CPDF_FormControl::GetExportValue()
CFX_WideString csWOn = PDF_DecodeText(csOn);
return csWOn;
}
-FX_BOOL CPDF_FormControl::IsChecked()
+bool CPDF_FormControl::IsChecked()
{
ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton);
CFX_ByteString csOn = GetOnStateName();
CFX_ByteString csAS = m_pWidgetDict->GetString("AS");
return csAS == csOn;
}
-FX_BOOL CPDF_FormControl::IsDefaultChecked()
+bool CPDF_FormControl::IsDefaultChecked()
{
ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton);
CPDF_Object* pDV = FPDF_GetFieldAttr(m_pField->m_pDict, "DV");
if (pDV == NULL) {
- return FALSE;
+ return false;
}
CFX_ByteString csDV = pDV->GetString();
CFX_ByteString csOn = GetOnStateName();
return (csDV == csOn);
}
-void CPDF_FormControl::CheckControl(FX_BOOL bChecked)
+void CPDF_FormControl::CheckControl(bool bChecked)
{
ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton);
CFX_ByteString csOn = GetOnStateName();
@@ -144,7 +144,7 @@ void CPDF_FormControl::CheckControl(FX_BOOL bChecked)
return;
}
m_pWidgetDict->SetAtName("AS", csAS);
- m_pForm->m_bUpdated = TRUE;
+ m_pForm->m_bUpdated = true;
}
CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, CPDF_Annot::AppearanceMode mode);
void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice, CFX_AffineMatrix* pMatrix, CPDF_Page* pPage,
@@ -186,7 +186,7 @@ CPDF_FormControl::HighlightingMode CPDF_FormControl::GetHighlightingMode()
}
return Invert;
}
-CPDF_ApSettings CPDF_FormControl::GetMK(FX_BOOL bCreate)
+CPDF_ApSettings CPDF_FormControl::GetMK(bool bCreate)
{
if (!m_pWidgetDict) {
return NULL;
@@ -201,49 +201,49 @@ CPDF_ApSettings CPDF_FormControl::GetMK(FX_BOOL bCreate)
}
return mk;
}
-FX_BOOL CPDF_FormControl::HasMKEntry(CFX_ByteString csEntry)
+bool CPDF_FormControl::HasMKEntry(CFX_ByteString csEntry)
{
- CPDF_ApSettings mk = GetMK(FALSE);
+ CPDF_ApSettings mk = GetMK(false);
return mk.HasMKEntry(csEntry);
}
int CPDF_FormControl::GetRotation()
{
- CPDF_ApSettings mk = GetMK(FALSE);
+ CPDF_ApSettings mk = GetMK(false);
return mk.GetRotation();
}
FX_ARGB CPDF_FormControl::GetColor(int& iColorType, CFX_ByteString csEntry)
{
- CPDF_ApSettings mk = GetMK(FALSE);
+ CPDF_ApSettings mk = GetMK(false);
return mk.GetColor(iColorType, csEntry);
}
FX_FLOAT CPDF_FormControl::GetOriginalColor(int index, CFX_ByteString csEntry)
{
- CPDF_ApSettings mk = GetMK(FALSE);
+ CPDF_ApSettings mk = GetMK(false);
return mk.GetOriginalColor(index, csEntry);
}
void CPDF_FormControl::GetOriginalColor(int& iColorType, FX_FLOAT fc[4], CFX_ByteString csEntry)
{
- CPDF_ApSettings mk = GetMK(FALSE);
+ CPDF_ApSettings mk = GetMK(false);
mk.GetOriginalColor(iColorType, fc, csEntry);
}
CFX_WideString CPDF_FormControl::GetCaption(CFX_ByteString csEntry)
{
- CPDF_ApSettings mk = GetMK(FALSE);
+ CPDF_ApSettings mk = GetMK(false);
return mk.GetCaption(csEntry);
}
CPDF_Stream* CPDF_FormControl::GetIcon(CFX_ByteString csEntry)
{
- CPDF_ApSettings mk = GetMK(FALSE);
+ CPDF_ApSettings mk = GetMK(false);
return mk.GetIcon(csEntry);
}
CPDF_IconFit CPDF_FormControl::GetIconFit()
{
- CPDF_ApSettings mk = GetMK(FALSE);
+ CPDF_ApSettings mk = GetMK(false);
return mk.GetIconFit();
}
int CPDF_FormControl::GetTextPosition()
{
- CPDF_ApSettings mk = GetMK(FALSE);
+ CPDF_ApSettings mk = GetMK(false);
return mk.GetTextPosition();
}
CPDF_Action CPDF_FormControl::GetAction()
@@ -343,10 +343,10 @@ int CPDF_FormControl::GetControlAlignment()
}
return pObj->GetInteger();
}
-FX_BOOL CPDF_ApSettings::HasMKEntry(const CFX_ByteStringC& csEntry)
+bool CPDF_ApSettings::HasMKEntry(const CFX_ByteStringC& csEntry)
{
if (m_pDict == NULL) {
- return FALSE;
+ return false;
}
return m_pDict->KeyExist(csEntry);
}
diff --git a/core/src/fpdfdoc/doc_formfield.cpp b/core/src/fpdfdoc/doc_formfield.cpp
index 087eba8aa4..8d9887e796 100644
--- a/core/src/fpdfdoc/doc_formfield.cpp
+++ b/core/src/fpdfdoc/doc_formfield.cpp
@@ -7,11 +7,11 @@
#include "../../include/fpdfdoc/fpdf_doc.h"
#include "doc_utils.h"
-FX_BOOL PDF_FormField_IsUnison(CPDF_FormField *pField)
+bool PDF_FormField_IsUnison(CPDF_FormField *pField)
{
- FX_BOOL bUnison = FALSE;
+ bool bUnison = false;
if (pField->GetType() == CPDF_FormField::CheckBox) {
- bUnison = TRUE;
+ bUnison = true;
} else {
FX_DWORD dwFlags = pField->GetFieldFlags();
bUnison = ((dwFlags & 0x2000000) != 0);
@@ -100,7 +100,7 @@ CFX_WideString CPDF_FormField::GetFullName()
{
return ::GetFullName(m_pDict);
}
-FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify)
+bool CPDF_FormField::ResetField(bool bNotify)
{
switch (m_Type) {
case CPDF_FormField::CheckBox:
@@ -113,13 +113,13 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify)
if (iCount) {
if (PDF_FormField_IsUnison(this)) {
for(int i = 0; i < iCount; i++) {
- CheckControl(i, GetControl(i)->IsDefaultChecked(), FALSE);
+ CheckControl(i, GetControl(i)->IsDefaultChecked(), false);
}
} else {
for (int i = 0; i < iCount; i ++) {
CPDF_FormControl* pControl = GetControl(i);
- FX_BOOL bChecked = pControl->IsDefaultChecked();
- CheckControl(i, bChecked, FALSE);
+ bool bChecked = pControl->IsDefaultChecked();
+ CheckControl(i, bChecked, false);
}
}
}
@@ -138,10 +138,10 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify)
if (bNotify && m_pForm->m_pFormNotify != NULL) {
int iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
if (iRet < 0) {
- return FALSE;
+ return false;
}
}
- SetItemSelection(iIndex, TRUE);
+ SetItemSelection(iIndex, true);
if (bNotify && m_pForm->m_pFormNotify != NULL) {
m_pForm->m_pFormNotify->AfterValueChange(this);
}
@@ -157,10 +157,10 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify)
if (bNotify && m_pForm->m_pFormNotify != NULL) {
int iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue);
if (iRet < 0) {
- return FALSE;
+ return false;
}
}
- SetItemSelection(iIndex, TRUE);
+ SetItemSelection(iIndex, true);
if (bNotify && m_pForm->m_pFormNotify != NULL) {
m_pForm->m_pFormNotify->AfterSelectionChange(this);
}
@@ -182,12 +182,12 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify)
}
CPDF_Object* pRV = FPDF_GetFieldAttr(m_pDict, "RV");
if (!pRV && (csDValue == csValue)) {
- return FALSE;
+ return false;
}
if (bNotify && m_pForm->m_pFormNotify != NULL) {
int iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csDValue);
if (iRet < 0) {
- return FALSE;
+ return false;
}
}
if (pDV == NULL) {
@@ -196,7 +196,7 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify)
} else {
CPDF_Object* pClone = pDV->Clone();
if (pClone == NULL) {
- return FALSE;
+ return false;
}
m_pDict->SetAt("V", pClone);
if(pRV) {
@@ -207,11 +207,11 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify)
if (bNotify && m_pForm->m_pFormNotify != NULL) {
m_pForm->m_pFormNotify->AfterValueChange(this);
}
- m_pForm->m_bUpdated = TRUE;
+ m_pForm->m_bUpdated = true;
}
break;
}
- return TRUE;
+ return true;
}
int CPDF_FormField::GetControlIndex(const CPDF_FormControl* pControl)
{
@@ -299,7 +299,7 @@ CFX_WideString CPDF_FormField::GetRichTextString()
}
return pObj->GetUnicodeText();
}
-CFX_WideString CPDF_FormField::GetValue(FX_BOOL bDefault)
+CFX_WideString CPDF_FormField::GetValue(bool bDefault)
{
if (GetType() == CheckBox || GetType() == RadioButton) {
return GetCheckValue(bDefault);
@@ -333,19 +333,19 @@ CFX_WideString CPDF_FormField::GetValue(FX_BOOL bDefault)
}
CFX_WideString CPDF_FormField::GetValue()
{
- return GetValue(FALSE);
+ return GetValue(false);
}
CFX_WideString CPDF_FormField::GetDefaultValue()
{
- return GetValue(TRUE);
+ return GetValue(true);
}
-FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, FX_BOOL bDefault, FX_BOOL bNotify)
+bool CPDF_FormField::SetValue(const CFX_WideString& value, bool bDefault, bool bNotify)
{
switch (m_Type) {
case CheckBox:
case RadioButton: {
SetCheckValue(value, bDefault, bNotify);
- return TRUE;
+ return true;
}
case File:
case RichText:
@@ -355,7 +355,7 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, FX_BOOL bDefault,
if (bNotify && m_pForm->m_pFormNotify != NULL) {
int iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
if (iRet < 0) {
- return FALSE;
+ return false;
}
}
int iIndex = FindOptionValue(csValue);
@@ -371,39 +371,39 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, FX_BOOL bDefault,
if (bDefault) {
} else {
ClearSelection();
- SetItemSelection(iIndex, TRUE);
+ SetItemSelection(iIndex, true);
}
}
if (bNotify && m_pForm->m_pFormNotify != NULL) {
m_pForm->m_pFormNotify->AfterValueChange(this);
}
- m_pForm->m_bUpdated = TRUE;
+ m_pForm->m_bUpdated = true;
}
break;
case ListBox: {
int iIndex = FindOptionValue(value);
if (iIndex < 0) {
- return FALSE;
+ return false;
}
if (bDefault && iIndex == GetDefaultSelectedItem()) {
- return FALSE;
+ return false;
}
if (bNotify && m_pForm->m_pFormNotify != NULL) {
CFX_WideString csValue = value;
int iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue);
if (iRet < 0) {
- return FALSE;
+ return false;
}
}
if (bDefault) {
} else {
ClearSelection();
- SetItemSelection(iIndex, TRUE);
+ SetItemSelection(iIndex, true);
}
if (bNotify && m_pForm->m_pFormNotify != NULL) {
m_pForm->m_pFormNotify->AfterSelectionChange(this);
}
- m_pForm->m_bUpdated = TRUE;
+ m_pForm->m_bUpdated = true;
break;
}
default:
@@ -412,11 +412,11 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, FX_BOOL bDefault,
if (CPDF_InterForm::m_bUpdateAP) {
UpdateAP(NULL);
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, FX_BOOL bNotify)
+bool CPDF_FormField::SetValue(const CFX_WideString& value, bool bNotify)
{
- return SetValue(value, FALSE, bNotify);
+ return SetValue(value, false, bNotify);
}
int CPDF_FormField::GetMaxLen()
{
@@ -506,7 +506,7 @@ int CPDF_FormField::GetSelectedIndex(int index)
}
return -1;
}
-FX_BOOL CPDF_FormField::ClearSelection(FX_BOOL bNotify)
+bool CPDF_FormField::ClearSelection(bool bNotify)
{
if (bNotify && m_pForm->m_pFormNotify != NULL) {
int iRet = 0;
@@ -522,7 +522,7 @@ FX_BOOL CPDF_FormField::ClearSelection(FX_BOOL bNotify)
iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
}
if (iRet < 0) {
- return FALSE;
+ return false;
}
}
m_pDict->RemoveAt("V");
@@ -538,43 +538,43 @@ FX_BOOL CPDF_FormField::ClearSelection(FX_BOOL bNotify)
if (CPDF_InterForm::m_bUpdateAP) {
UpdateAP(NULL);
}
- m_pForm->m_bUpdated = TRUE;
- return TRUE;
+ m_pForm->m_bUpdated = true;
+ return true;
}
-FX_BOOL CPDF_FormField::IsItemSelected(int index)
+bool CPDF_FormField::IsItemSelected(int index)
{
ASSERT(GetType() == ComboBox || GetType() == ListBox);
if (index < 0 || index >= CountOptions()) {
- return FALSE;
+ return false;
}
if (IsOptionSelected(index)) {
- return TRUE;
+ return true;
}
CFX_WideString opt_value = GetOptionValue(index);
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
if (pValue == NULL) {
pValue = FPDF_GetFieldAttr(m_pDict, "I");
if (pValue == NULL) {
- return FALSE;
+ return false;
}
}
if (pValue->GetType() == PDFOBJ_STRING) {
if (pValue->GetUnicodeText() == opt_value) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
if (pValue->GetType() == PDFOBJ_NUMBER) {
if (pValue->GetString().IsEmpty()) {
- return FALSE;
+ return false;
}
if (pValue->GetInteger() == index) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
if (pValue->GetType() != PDFOBJ_ARRAY) {
- return FALSE;
+ return false;
}
CPDF_Array* pArray = (CPDF_Array*)pValue;
int iPos = -1;
@@ -586,15 +586,15 @@ FX_BOOL CPDF_FormField::IsItemSelected(int index)
}
for (FX_DWORD i = 0; i < pArray->GetCount(); i ++)
if (pArray->GetElementValue(i)->GetUnicodeText() == opt_value && (int)i == iPos) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_FormField::SetItemSelection(int index, FX_BOOL bSelected, FX_BOOL bNotify)
+bool CPDF_FormField::SetItemSelection(int index, bool bSelected, bool bNotify)
{
ASSERT(GetType() == ComboBox || GetType() == ListBox);
if (index < 0 || index >= CountOptions()) {
- return FALSE;
+ return false;
}
CFX_WideString opt_value = GetOptionValue(index);
if (bNotify && m_pForm->m_pFormNotify != NULL) {
@@ -606,14 +606,14 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index, FX_BOOL bSelected, FX_BOOL b
iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, opt_value);
}
if (iRet < 0) {
- return FALSE;
+ return false;
}
}
if (!bSelected) {
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
if (pValue != NULL) {
if (m_Type == ListBox) {
- SelectOption(index, FALSE);
+ SelectOption(index, false);
if (pValue->GetType() == PDFOBJ_STRING) {
if (pValue->GetUnicodeText() == opt_value) {
m_pDict->RemoveAt("V");
@@ -621,7 +621,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index, FX_BOOL bSelected, FX_BOOL b
} else if (pValue->GetType() == PDFOBJ_ARRAY) {
CPDF_Array* pArray = CPDF_Array::Create();
if (pArray == NULL) {
- return FALSE;
+ return false;
}
int iCount = CountOptions();
for (int i = 0; i < iCount; i ++) {
@@ -645,21 +645,21 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index, FX_BOOL bSelected, FX_BOOL b
}
} else {
if (m_Type == ListBox) {
- SelectOption(index, TRUE);
+ SelectOption(index, true);
if (!(m_Flags & FORMLIST_MULTISELECT)) {
m_pDict->SetAtString("V", PDF_EncodeText(opt_value));
} else {
CPDF_Array* pArray = CPDF_Array::Create();
if (pArray == NULL) {
- return FALSE;
+ return false;
}
- FX_BOOL bSelected;
+ bool bSelected;
int iCount = CountOptions();
for (int i = 0; i < iCount; i ++) {
if (i != index) {
bSelected = IsItemSelected(i);
} else {
- bSelected = TRUE;
+ bSelected = true;
}
if (bSelected) {
opt_value = GetOptionValue(i);
@@ -672,7 +672,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index, FX_BOOL bSelected, FX_BOOL b
m_pDict->SetAtString("V", PDF_EncodeText(opt_value));
CPDF_Array* pI = CPDF_Array::Create();
if (pI == NULL) {
- return FALSE;
+ return false;
}
pI->AddInteger(index);
m_pDict->SetAt("I", pI);
@@ -689,18 +689,18 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index, FX_BOOL bSelected, FX_BOOL b
if (CPDF_InterForm::m_bUpdateAP) {
UpdateAP(NULL);
}
- m_pForm->m_bUpdated = TRUE;
- return TRUE;
+ m_pForm->m_bUpdated = true;
+ return true;
}
-FX_BOOL CPDF_FormField::IsItemDefaultSelected(int index)
+bool CPDF_FormField::IsItemDefaultSelected(int index)
{
ASSERT(GetType() == ComboBox || GetType() == ListBox);
if (index < 0 || index >= CountOptions()) {
- return FALSE;
+ return false;
}
int iDVIndex = GetDefaultSelectedItem();
if (iDVIndex < 0) {
- return FALSE;
+ return false;
}
return (iDVIndex == index);
}
@@ -798,15 +798,15 @@ int CPDF_FormField::FindOptionValue(const CFX_WideString& csOptValue, int iStart
}
return -1;
}
-FX_BOOL CPDF_FormField::CheckControl(int iControlIndex, FX_BOOL bChecked, FX_BOOL bNotify)
+bool CPDF_FormField::CheckControl(int iControlIndex, bool bChecked, bool bNotify)
{
ASSERT(GetType() == CheckBox || GetType() == RadioButton);
CPDF_FormControl* pControl = GetControl(iControlIndex);
if (pControl == NULL) {
- return FALSE;
+ return false;
}
if (!bChecked && pControl->IsChecked() == bChecked) {
- return FALSE;
+ return false;
}
CFX_ByteArray statusArray;
if (bNotify && m_pForm->m_pFormNotify != NULL) {
@@ -815,7 +815,7 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex, FX_BOOL bChecked, FX_BOO
CFX_WideString csWExport = pControl->GetExportValue();
CFX_ByteString csBExport = PDF_EncodeText(csWExport);
int iCount = CountControls();
- FX_BOOL bUnison = PDF_FormField_IsUnison(this);
+ bool bUnison = PDF_FormField_IsUnison(this);
for (int i = 0; i < iCount; i ++) {
CPDF_FormControl* pCtrl = GetControl(i);
if (bUnison) {
@@ -824,16 +824,16 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex, FX_BOOL bChecked, FX_BOO
if (pCtrl->GetOnStateName() == pControl->GetOnStateName()) {
pCtrl->CheckControl(bChecked);
} else if (bChecked) {
- pCtrl->CheckControl(FALSE);
+ pCtrl->CheckControl(false);
}
} else if (bChecked) {
- pCtrl->CheckControl(FALSE);
+ pCtrl->CheckControl(false);
}
} else {
if (i == iControlIndex) {
pCtrl->CheckControl(bChecked);
} else if (bChecked) {
- pCtrl->CheckControl(FALSE);
+ pCtrl->CheckControl(false);
}
}
}
@@ -859,14 +859,14 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex, FX_BOOL bChecked, FX_BOO
if (bNotify && m_pForm->m_pFormNotify != NULL) {
m_pForm->m_pFormNotify->AfterCheckedStatusChange(this, statusArray);
}
- m_pForm->m_bUpdated = TRUE;
- return TRUE;
+ m_pForm->m_bUpdated = true;
+ return true;
}
-CFX_WideString CPDF_FormField::GetCheckValue(FX_BOOL bDefault)
+CFX_WideString CPDF_FormField::GetCheckValue(bool bDefault)
{
ASSERT(GetType() == CheckBox || GetType() == RadioButton);
CFX_WideString csExport = L"Off";
- FX_BOOL bChecked;
+ bool bChecked;
int iCount = CountControls();
for (int i = 0; i < iCount; i ++) {
CPDF_FormControl* pControl = GetControl(i);
@@ -882,7 +882,7 @@ CFX_WideString CPDF_FormField::GetCheckValue(FX_BOOL bDefault)
}
return csExport;
}
-FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value, FX_BOOL bDefault, FX_BOOL bNotify)
+bool CPDF_FormField::SetCheckValue(const CFX_WideString& value, bool bDefault, bool bNotify)
{
ASSERT(GetType() == CheckBox || GetType() == RadioButton);
CFX_ByteArray statusArray;
@@ -896,21 +896,21 @@ FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value, FX_BOOL bDefa
if (csExport == value) {
if (bDefault) {
} else {
- CheckControl(GetControlIndex(pControl), TRUE);
+ CheckControl(GetControlIndex(pControl), true);
}
break;
} else {
if (bDefault) {
} else {
- CheckControl(GetControlIndex(pControl), FALSE);
+ CheckControl(GetControlIndex(pControl), false);
}
}
}
if (bNotify && m_pForm->m_pFormNotify != NULL) {
m_pForm->m_pFormNotify->AfterCheckedStatusChange(this, statusArray);
}
- m_pForm->m_bUpdated = TRUE;
- return TRUE;
+ m_pForm->m_bUpdated = true;
+ return true;
}
int CPDF_FormField::GetTopVisibleIndex()
{
@@ -948,43 +948,43 @@ int CPDF_FormField::GetSelectedOptionIndex(int index)
}
return -1;
}
-FX_BOOL CPDF_FormField::IsOptionSelected(int iOptIndex)
+bool CPDF_FormField::IsOptionSelected(int iOptIndex)
{
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "I");
if (pObj == NULL) {
- return FALSE;
+ return false;
}
CPDF_Array* pArray = pObj->GetArray();
if (pArray == NULL) {
- return FALSE;
+ return false;
}
int iCount = (int)pArray->GetCount();
for (int i = 0; i < iCount; i ++) {
if (pArray->GetInteger(i) == iOptIndex) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, FX_BOOL bSelected, FX_BOOL bNotify)
+bool CPDF_FormField::SelectOption(int iOptIndex, bool bSelected, bool bNotify)
{
CPDF_Array* pArray = m_pDict->GetArray("I");
if (pArray == NULL) {
if (!bSelected) {
- return TRUE;
+ return true;
}
pArray = CPDF_Array::Create();
if (pArray == NULL) {
- return FALSE;
+ return false;
}
m_pDict->SetAt("I", pArray);
}
- FX_BOOL bReturn = FALSE;
+ bool bReturn = false;
for (int i = 0; i < (int)pArray->GetCount(); i ++) {
int iFind = pArray->GetInteger(i);
if (iFind == iOptIndex) {
if (bSelected) {
- return TRUE;
+ return true;
}
if (bNotify && m_pForm->m_pFormNotify != NULL) {
int iRet = 0;
@@ -996,11 +996,11 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, FX_BOOL bSelected, FX_BOOL b
iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
}
if (iRet < 0) {
- return FALSE;
+ return false;
}
}
pArray->RemoveAt(i);
- bReturn = TRUE;
+ bReturn = true;
break;
} else if (iFind > iOptIndex) {
if (!bSelected) {
@@ -1016,15 +1016,15 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, FX_BOOL bSelected, FX_BOOL b
iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
}
if (iRet < 0) {
- return FALSE;
+ return false;
}
}
CPDF_Number* pNum = CPDF_Number::Create(iOptIndex);
if (pNum == NULL) {
- return FALSE;
+ return false;
}
pArray->InsertAt(i, pNum);
- bReturn = TRUE;
+ bReturn = true;
break;
}
}
@@ -1044,10 +1044,10 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, FX_BOOL bSelected, FX_BOOL b
m_pForm->m_pFormNotify->AfterValueChange(this);
}
}
- m_pForm->m_bUpdated = TRUE;
- return TRUE;
+ m_pForm->m_bUpdated = true;
+ return true;
}
-FX_BOOL CPDF_FormField::ClearSelectedOptions(FX_BOOL bNotify)
+bool CPDF_FormField::ClearSelectedOptions(bool bNotify)
{
if (bNotify && m_pForm->m_pFormNotify != NULL) {
int iRet = 0;
@@ -1063,7 +1063,7 @@ FX_BOOL CPDF_FormField::ClearSelectedOptions(FX_BOOL bNotify)
iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
}
if (iRet < 0) {
- return FALSE;
+ return false;
}
}
m_pDict->RemoveAt("I");
@@ -1075,8 +1075,8 @@ FX_BOOL CPDF_FormField::ClearSelectedOptions(FX_BOOL bNotify)
m_pForm->m_pFormNotify->AfterValueChange(this);
}
}
- m_pForm->m_bUpdated = TRUE;
- return TRUE;
+ m_pForm->m_bUpdated = true;
+ return true;
}
void CPDF_FormField::LoadDA()
{
diff --git a/core/src/fpdfdoc/doc_metadata.cpp b/core/src/fpdfdoc/doc_metadata.cpp
index aeeb1d1f60..33e1e23d0f 100644
--- a/core/src/fpdfdoc/doc_metadata.cpp
+++ b/core/src/fpdfdoc/doc_metadata.cpp
@@ -58,7 +58,7 @@ void CPDF_Metadata::LoadDoc(CPDF_Document *pDoc)
return;
}
CPDF_StreamAcc acc;
- acc.LoadAllData(pStream, FALSE);
+ acc.LoadAllData(pStream, false);
int size = acc.GetSize();
const uint8_t* pBuf = acc.GetData();
CXML_Element *&pXmlElmnt = ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt;
diff --git a/core/src/fpdfdoc/doc_ocg.cpp b/core/src/fpdfdoc/doc_ocg.cpp
index d525227219..6e88309fee 100644
--- a/core/src/fpdfdoc/doc_ocg.cpp
+++ b/core/src/fpdfdoc/doc_ocg.cpp
@@ -25,7 +25,7 @@ static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object *pObject, const CPDF_Dict
}
return -1;
}
-static FX_BOOL FPDFDOC_OCG_HasIntent(const CPDF_Dictionary *pDict, const CFX_ByteStringC& csElement, const CFX_ByteStringC& csDef = FX_BSTRC(""))
+static bool FPDFDOC_OCG_HasIntent(const CPDF_Dictionary *pDict, const CFX_ByteStringC& csElement, const CFX_ByteStringC& csDef = FX_BSTRC(""))
{
FXSYS_assert(pDict != NULL);
CPDF_Object *pIntent = pDict->GetElementValue(FX_BSTRC("Intent"));
@@ -38,10 +38,10 @@ static FX_BOOL FPDFDOC_OCG_HasIntent(const CPDF_Dictionary *pDict, const CFX_Byt
for (FX_DWORD i = 0; i < dwCount; i++) {
bsIntent = ((CPDF_Array*)pIntent)->GetString(i);
if (bsIntent == FX_BSTRC("All") || bsIntent == csElement) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
bsIntent = pIntent->GetString();
return bsIntent == FX_BSTRC("All") || bsIntent == csElement;
@@ -101,24 +101,24 @@ CPDF_OCContext::~CPDF_OCContext()
{
m_OCGStates.clear();
}
-FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig, const CPDF_Dictionary *pOCGDict, FX_BOOL &bValidConfig) const
+bool CPDF_OCContext::LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig, const CPDF_Dictionary *pOCGDict, bool &bValidConfig) const
{
CPDF_Dictionary *pConfig = FPDFDOC_OCG_GetConfig(m_pDocument, pOCGDict, csConfig);
if (!pConfig) {
- return TRUE;
+ return true;
}
- bValidConfig = TRUE;
- FX_BOOL bState = pConfig->GetString(FX_BSTRC("BaseState"), FX_BSTRC("ON")) != FX_BSTRC("OFF");
+ bValidConfig = true;
+ bool bState = pConfig->GetString(FX_BSTRC("BaseState"), FX_BSTRC("ON")) != FX_BSTRC("OFF");
CPDF_Array *pArray = pConfig->GetArray(FX_BSTRC("ON"));
if (pArray) {
if (FPDFDOC_OCG_FindGroup(pArray, pOCGDict) >= 0) {
- bState = TRUE;
+ bState = true;
}
}
pArray = pConfig->GetArray(FX_BSTRC("OFF"));
if (pArray) {
if (FPDFDOC_OCG_FindGroup(pArray, pOCGDict) >= 0) {
- bState = FALSE;
+ bState = false;
}
}
pArray = pConfig->GetArray(FX_BSTRC("AS"));
@@ -149,10 +149,10 @@ FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig,
}
return bState;
}
-FX_BOOL CPDF_OCContext::LoadOCGState(const CPDF_Dictionary *pOCGDict) const
+bool CPDF_OCContext::LoadOCGState(const CPDF_Dictionary *pOCGDict) const
{
if (!FPDFDOC_OCG_HasIntent(pOCGDict, FX_BSTRC("View"), FX_BSTRC("View"))) {
- return TRUE;
+ return true;
}
CFX_ByteString csState = FPDFDOC_OCG_GetUsageTypeString(m_eUsageType);
CPDF_Dictionary *pUsage = pOCGDict->GetDict(FX_BSTRC("Usage"));
@@ -171,31 +171,31 @@ FX_BOOL CPDF_OCContext::LoadOCGState(const CPDF_Dictionary *pOCGDict) const
}
}
}
- FX_BOOL bDefValid = FALSE;
+ bool bDefValid = false;
return LoadOCGStateFromConfig(csState, pOCGDict, bDefValid);
}
-FX_BOOL CPDF_OCContext::GetOCGVisible(const CPDF_Dictionary* pOCGDict)
+bool CPDF_OCContext::GetOCGVisible(const CPDF_Dictionary* pOCGDict)
{
if (!pOCGDict)
- return FALSE;
+ return false;
const auto it = m_OCGStates.find(pOCGDict);
if (it != m_OCGStates.end())
return it->second;
- FX_BOOL bState = LoadOCGState(pOCGDict);
+ bool bState = LoadOCGState(pOCGDict);
m_OCGStates[pOCGDict] = bState;
return bState;
}
-FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, int nLevel)
+bool CPDF_OCContext::GetOCGVE(CPDF_Array *pExpression, bool bFromConfig, int nLevel)
{
if (nLevel > 32) {
- return FALSE;
+ return false;
}
if (pExpression == NULL) {
- return FALSE;
+ return false;
}
int32_t iCount = pExpression->GetCount();
CPDF_Object *pOCGObj;
@@ -203,7 +203,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, i
if (csOperator == FX_BSTRC("Not")) {
pOCGObj = pExpression->GetElementValue(1);
if (pOCGObj == NULL) {
- return FALSE;
+ return false;
}
if (pOCGObj->GetType() == PDFOBJ_DICTIONARY) {
return !(bFromConfig ? LoadOCGState((CPDF_Dictionary*)pOCGObj) : GetOCGVisible((CPDF_Dictionary*)pOCGObj));
@@ -211,16 +211,16 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, i
if (pOCGObj->GetType() == PDFOBJ_ARRAY) {
return !GetOCGVE((CPDF_Array*)pOCGObj, bFromConfig, nLevel + 1);
}
- return FALSE;
+ return false;
}
if (csOperator == FX_BSTRC("Or") || csOperator == FX_BSTRC("And")) {
- FX_BOOL bValue = FALSE;
+ bool bValue = false;
for (int32_t i = 1; i < iCount; i ++) {
pOCGObj = pExpression->GetElementValue(1);
if (pOCGObj == NULL) {
continue;
}
- FX_BOOL bItem = FALSE;
+ bool bItem = false;
if (pOCGObj->GetType() == PDFOBJ_DICTIONARY) {
bItem = bFromConfig ? LoadOCGState((CPDF_Dictionary*)pOCGObj) : GetOCGVisible((CPDF_Dictionary*)pOCGObj);
} else if (pOCGObj->GetType() == PDFOBJ_ARRAY) {
@@ -238,9 +238,9 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, i
}
return bValue;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary *pOCMDDict, FX_BOOL bFromConfig)
+bool CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary *pOCMDDict, bool bFromConfig)
{
FXSYS_assert(pOCMDDict != NULL);
CPDF_Array *pVE = pOCMDDict->GetArray(FX_BSTRC("VE"));
@@ -250,50 +250,50 @@ FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary *pOCMDDict, FX_BOOL
CFX_ByteString csP = pOCMDDict->GetString(FX_BSTRC("P"), FX_BSTRC("AnyOn"));
CPDF_Object *pOCGObj = pOCMDDict->GetElementValue(FX_BSTRC("OCGs"));
if (pOCGObj == NULL) {
- return TRUE;
+ return true;
}
if (pOCGObj->GetType() == PDFOBJ_DICTIONARY) {
return bFromConfig ? LoadOCGState((CPDF_Dictionary*)pOCGObj) : GetOCGVisible((CPDF_Dictionary*)pOCGObj);
}
if (pOCGObj->GetType() != PDFOBJ_ARRAY) {
- return TRUE;
+ return true;
}
- FX_BOOL bState = FALSE;
+ bool bState = false;
if (csP == FX_BSTRC("AllOn") || csP == FX_BSTRC("AllOff")) {
- bState = TRUE;
+ bState = true;
}
int32_t iCount = ((CPDF_Array*)pOCGObj)->GetCount();
for (int32_t i = 0; i < iCount; i ++) {
- FX_BOOL bItem = TRUE;
+ bool bItem = true;
CPDF_Dictionary* pItemDict = ((CPDF_Array*)pOCGObj)->GetDict(i);
if (pItemDict) {
bItem = bFromConfig ? LoadOCGState(pItemDict) : GetOCGVisible(pItemDict);
}
if (csP == FX_BSTRC("AnyOn") && bItem) {
- return TRUE;
+ return true;
}
if (csP == FX_BSTRC("AnyOff") && !bItem) {
- return TRUE;
+ return true;
}
if (csP == FX_BSTRC("AllOn") && !bItem) {
- return FALSE;
+ return false;
}
if (csP == FX_BSTRC("AllOff") && bItem) {
- return FALSE;
+ return false;
}
}
return bState;
}
-FX_BOOL CPDF_OCContext::CheckOCGVisible(const CPDF_Dictionary *pOCGDict)
+bool CPDF_OCContext::CheckOCGVisible(const CPDF_Dictionary *pOCGDict)
{
if (!pOCGDict) {
- return TRUE;
+ return true;
}
CFX_ByteString csType = pOCGDict->GetString(FX_BSTRC("Type"), FX_BSTRC("OCG"));
if (csType == FX_BSTRC("OCG")) {
return GetOCGVisible(pOCGDict);
}
- return LoadOCMDState(pOCGDict, FALSE);
+ return LoadOCMDState(pOCGDict, false);
}
void CPDF_OCContext::ResetOCContext()
{
diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp
index e9f0c55e2b..3e44b1ac9b 100644
--- a/core/src/fpdfdoc/doc_tagged.cpp
+++ b/core/src/fpdfdoc/doc_tagged.cpp
@@ -9,7 +9,7 @@
#include "../../include/fpdfdoc/fpdf_tagged.h"
#include "tagged_int.h"
const int nMaxRecursion = 32;
-static FX_BOOL IsTagged(const CPDF_Document* pDoc)
+static bool IsTagged(const CPDF_Document* pDoc)
{
CPDF_Dictionary* pCatalog = pDoc->GetRoot();
CPDF_Dictionary* pMarkInfo = pCatalog->GetDict(FX_BSTRC("MarkInfo"));
@@ -138,7 +138,7 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(CPDF_Dictionary* pDict,
}
} else {
CPDF_StructElementImpl* pParentElement = AddPageNode(pParent, map, nLevel + 1);
- FX_BOOL bSave = FALSE;
+ bool bSave = false;
for (int i = 0; i < pParentElement->m_Kids.GetSize(); i ++) {
if (pParentElement->m_Kids[i].m_Type != CPDF_StructKid::Element) {
continue;
@@ -147,7 +147,7 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(CPDF_Dictionary* pDict,
continue;
}
pParentElement->m_Kids[i].m_Element.m_pElement = pElement->Retain();
- bSave = TRUE;
+ bSave = true;
}
if (!bSave) {
pElement->Release();
@@ -156,11 +156,11 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(CPDF_Dictionary* pDict,
}
return pElement;
}
-FX_BOOL CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict, CPDF_StructElementImpl* pElement)
+bool CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict, CPDF_StructElementImpl* pElement)
{
CPDF_Object *pObj = m_pTreeRoot->GetElementValue(FX_BSTRC("K"));
if (!pObj) {
- return FALSE;
+ return false;
}
if (pObj->GetType() == PDFOBJ_DICTIONARY) {
if (pObj->GetObjNum() == pDict->GetObjNum()) {
@@ -169,13 +169,13 @@ FX_BOOL CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict, CPDF_Struct
}
m_Kids[0] = pElement->Retain();
} else {
- return FALSE;
+ return false;
}
}
if (pObj->GetType() == PDFOBJ_ARRAY) {
CPDF_Array* pTopKids = (CPDF_Array*)pObj;
FX_DWORD i;
- FX_BOOL bSave = FALSE;
+ bool bSave = false;
for (i = 0; i < pTopKids->GetCount(); i ++) {
CPDF_Object* pKidRef = pTopKids->GetElement(i);
if (pKidRef == NULL || pKidRef->GetType() != PDFOBJ_REFERENCE) {
@@ -188,13 +188,13 @@ FX_BOOL CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict, CPDF_Struct
m_Kids[i]->Release();
}
m_Kids[i] = pElement->Retain();
- bSave = TRUE;
+ bSave = true;
}
if (!bSave) {
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, CPDF_StructElementImpl* pParent, CPDF_Dictionary* pDict)
: m_RefCount(0)
@@ -340,20 +340,20 @@ static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs, const CFX_ByteStringC&
}
return NULL;
}
-CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_BOOL bInheritable, FX_FLOAT fLevel)
+CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, bool bInheritable, FX_FLOAT fLevel)
{
if (fLevel > nMaxRecursion) {
return NULL;
}
if (bInheritable) {
- CPDF_Object* pAttr = GetAttr(owner, name, FALSE);
+ CPDF_Object* pAttr = GetAttr(owner, name, false);
if (pAttr) {
return pAttr;
}
if (m_pParent == NULL) {
return NULL;
}
- return m_pParent->GetAttr(owner, name, TRUE, fLevel + 1);
+ return m_pParent->GetAttr(owner, name, true, fLevel + 1);
}
CPDF_Object* pA = m_pDict->GetElementValue(FX_BSTRC("A"));
if (pA) {
@@ -391,7 +391,7 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, const
}
return NULL;
}
-CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_BOOL bInheritable, int subindex)
+CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, bool bInheritable, int subindex)
{
CPDF_Object* pAttr = GetAttr(owner, name, bInheritable);
if (pAttr == NULL || subindex == -1 || pAttr->GetType() != PDFOBJ_ARRAY) {
@@ -403,7 +403,7 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, const
}
return pArray->GetElementValue(subindex);
}
-CFX_ByteString CPDF_StructElementImpl::GetName(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, const CFX_ByteStringC& default_value, FX_BOOL bInheritable, int subindex)
+CFX_ByteString CPDF_StructElementImpl::GetName(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, const CFX_ByteStringC& default_value, bool bInheritable, int subindex)
{
CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex);
if (pAttr == NULL || pAttr->GetType() != PDFOBJ_NAME) {
@@ -411,7 +411,7 @@ CFX_ByteString CPDF_StructElementImpl::GetName(const CFX_ByteStringC& owner, con
}
return pAttr->GetString();
}
-FX_ARGB CPDF_StructElementImpl::GetColor(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_ARGB default_value, FX_BOOL bInheritable, int subindex)
+FX_ARGB CPDF_StructElementImpl::GetColor(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_ARGB default_value, bool bInheritable, int subindex)
{
CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex);
if (pAttr == NULL || pAttr->GetType() != PDFOBJ_ARRAY) {
@@ -420,7 +420,7 @@ FX_ARGB CPDF_StructElementImpl::GetColor(const CFX_ByteStringC& owner, const CFX
CPDF_Array* pArray = (CPDF_Array*)pAttr;
return 0xff000000 | ((int)(pArray->GetNumber(0) * 255) << 16) | ((int)(pArray->GetNumber(1) * 255) << 8) | (int)(pArray->GetNumber(2) * 255);
}
-FX_FLOAT CPDF_StructElementImpl::GetNumber(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_FLOAT default_value, FX_BOOL bInheritable, int subindex)
+FX_FLOAT CPDF_StructElementImpl::GetNumber(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_FLOAT default_value, bool bInheritable, int subindex)
{
CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex);
if (pAttr == NULL || pAttr->GetType() != PDFOBJ_NUMBER) {
@@ -428,7 +428,7 @@ FX_FLOAT CPDF_StructElementImpl::GetNumber(const CFX_ByteStringC& owner, const C
}
return pAttr->GetNumber();
}
-int CPDF_StructElementImpl::GetInteger(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, int default_value, FX_BOOL bInheritable, int subindex)
+int CPDF_StructElementImpl::GetInteger(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, int default_value, bool bInheritable, int subindex)
{
CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex);
if (pAttr == NULL || pAttr->GetType() != PDFOBJ_NUMBER) {
diff --git a/core/src/fpdfdoc/doc_utils.cpp b/core/src/fpdfdoc/doc_utils.cpp
index 96d2ccf689..26c93f1791 100644
--- a/core/src/fpdfdoc/doc_utils.cpp
+++ b/core/src/fpdfdoc/doc_utils.cpp
@@ -26,10 +26,10 @@ CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict)
}
return full_name;
}
-FX_BOOL CPDF_DefaultAppearance::HasFont()
+bool CPDF_DefaultAppearance::HasFont()
{
if (m_csDA.IsEmpty()) {
- return FALSE;
+ return false;
}
CPDF_SimpleParser syntax(m_csDA);
return syntax.FindTagParam("Tf", 2);
@@ -65,23 +65,23 @@ void CPDF_DefaultAppearance::GetFont(CFX_ByteString& csFontNameTag, FX_FLOAT& fF
}
csFontNameTag = PDF_NameDecode(csFontNameTag);
}
-FX_BOOL CPDF_DefaultAppearance::HasColor(FX_BOOL bStrokingOperation)
+bool CPDF_DefaultAppearance::HasColor(bool bStrokingOperation)
{
if (m_csDA.IsEmpty()) {
- return FALSE;
+ return false;
}
CPDF_SimpleParser syntax(m_csDA);
if (syntax.FindTagParam(bStrokingOperation ? "G" : "g", 1)) {
- return TRUE;
+ return true;
}
syntax.SetPos(0);
if (syntax.FindTagParam(bStrokingOperation ? "RG" : "rg", 3)) {
- return TRUE;
+ return true;
}
syntax.SetPos(0);
return syntax.FindTagParam(bStrokingOperation ? "K" : "k", 4);
}
-CFX_ByteString CPDF_DefaultAppearance::GetColorString(FX_BOOL bStrokingOperation)
+CFX_ByteString CPDF_DefaultAppearance::GetColorString(bool bStrokingOperation)
{
CFX_ByteString csColor;
if (m_csDA.IsEmpty()) {
@@ -119,7 +119,7 @@ CFX_ByteString CPDF_DefaultAppearance::GetColorString(FX_BOOL bStrokingOperation
}
return csColor;
}
-void CPDF_DefaultAppearance::GetColor(int& iColorType, FX_FLOAT fc[4], FX_BOOL bStrokingOperation)
+void CPDF_DefaultAppearance::GetColor(int& iColorType, FX_FLOAT fc[4], bool bStrokingOperation)
{
iColorType = COLORTYPE_TRANSPARENT;
for (int c = 0; c < 4; c ++) {
@@ -151,7 +151,7 @@ void CPDF_DefaultAppearance::GetColor(int& iColorType, FX_FLOAT fc[4], FX_BOOL b
fc[3] = FX_atof((CFX_ByteString)syntax.GetWord());
}
}
-void CPDF_DefaultAppearance::GetColor(FX_ARGB& color, int& iColorType, FX_BOOL bStrokingOperation)
+void CPDF_DefaultAppearance::GetColor(FX_ARGB& color, int& iColorType, bool bStrokingOperation)
{
color = 0;
iColorType = COLORTYPE_TRANSPARENT;
@@ -187,10 +187,10 @@ void CPDF_DefaultAppearance::GetColor(FX_ARGB& color, int& iColorType, FX_BOOL b
color = ArgbEncode(255, (int)(r * 255 + 0.5f), (int)(g * 255 + 0.5f), (int)(b * 255 + 0.5f));
}
}
-FX_BOOL CPDF_DefaultAppearance::HasTextMatrix()
+bool CPDF_DefaultAppearance::HasTextMatrix()
{
if (m_csDA.IsEmpty()) {
- return FALSE;
+ return false;
}
CPDF_SimpleParser syntax(m_csDA);
return syntax.FindTagParam("Tm", 6);
@@ -468,18 +468,18 @@ CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDo
}
return GetNativeInterFormFont(pFormDict, pDocument, charSet, csNameTag);
}
-FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CFX_ByteString& csNameTag)
+bool FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CFX_ByteString& csNameTag)
{
if (pFormDict == NULL || pFont == NULL) {
- return FALSE;
+ return false;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (pDR == NULL) {
- return FALSE;
+ return false;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (pFonts == NULL) {
- return FALSE;
+ return false;
}
FX_POSITION pos = pFonts->GetStartPos();
while (pos) {
@@ -499,23 +499,23 @@ FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CF
}
if (pFont->GetFontDict() == pElement) {
csNameTag = csKey;
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag)
+bool FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag)
{
if (pFormDict == NULL) {
- return FALSE;
+ return false;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (pDR == NULL) {
- return FALSE;
+ return false;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (pFonts == NULL) {
- return FALSE;
+ return false;
}
if (csFontName.GetLength() > 0) {
csFontName.Remove(' ');
@@ -545,10 +545,10 @@ FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument,
csBaseFont.Remove(' ');
if (csBaseFont == csFontName) {
csNameTag = csKey;
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
void AddInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, const CPDF_Font* pFont, CFX_ByteString& csNameTag)
{
@@ -670,10 +670,10 @@ CPDF_IconFit::ScaleMethod CPDF_IconFit::GetScaleMethod()
}
return Always;
}
-FX_BOOL CPDF_IconFit::IsProportionalScale()
+bool CPDF_IconFit::IsProportionalScale()
{
if (m_pDict == NULL) {
- return TRUE;
+ return true;
}
return m_pDict->GetString("S", "P") != "A";
}
@@ -694,10 +694,10 @@ void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom)
}
}
}
-FX_BOOL CPDF_IconFit::GetFittingBounds()
+bool CPDF_IconFit::GetFittingBounds()
{
if (m_pDict == NULL) {
- return FALSE;
+ return false;
}
return m_pDict->GetBoolean("FB");
}
diff --git a/core/src/fpdfdoc/doc_utils.h b/core/src/fpdfdoc/doc_utils.h
index 6bb1d30dbb..6dcf5b0d28 100644
--- a/core/src/fpdfdoc/doc_utils.h
+++ b/core/src/fpdfdoc/doc_utils.h
@@ -15,8 +15,8 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocumen
CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CFX_ByteString& csNameTag);
CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, uint8_t charSet, CFX_ByteString& csNameTag);
CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag);
-FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CFX_ByteString& csNameTag);
-FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag);
+bool FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CFX_ByteString& csNameTag);
+bool FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag);
void AddInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, const CPDF_Font* pFont, CFX_ByteString& csNameTag);
CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, uint8_t charSet, CFX_ByteString& csNameTag);
CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag);
@@ -25,8 +25,8 @@ void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag)
CPDF_Font* GetDefaultInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument);
void SetDefaultInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, const CPDF_Font* pFont);
void SaveCheckedFieldStatus(CPDF_FormField* pField, CFX_ByteArray& statusArray);
-FX_BOOL NeedPDFEncodeForFieldFullName(const CFX_WideString& csFieldName);
-FX_BOOL NeedPDFEncodeForFieldTree(CPDF_Dictionary* pFieldDict, int nLevel = 0);
+bool NeedPDFEncodeForFieldFullName(const CFX_WideString& csFieldName);
+bool NeedPDFEncodeForFieldTree(CPDF_Dictionary* pFieldDict, int nLevel = 0);
void EncodeFieldName(const CFX_WideString& csName, CFX_ByteString& csT);
void UpdateEncodeFieldName(CPDF_Dictionary* pFieldDict, int nLevel = 0);
diff --git a/core/src/fpdfdoc/doc_viewerPreferences.cpp b/core/src/fpdfdoc/doc_viewerPreferences.cpp
index eb824eb5a4..1c014dbd38 100644
--- a/core/src/fpdfdoc/doc_viewerPreferences.cpp
+++ b/core/src/fpdfdoc/doc_viewerPreferences.cpp
@@ -11,21 +11,21 @@ CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document *pDoc): m_pDoc(pDoc
CPDF_ViewerPreferences::~CPDF_ViewerPreferences()
{
}
-FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const
+bool CPDF_ViewerPreferences::IsDirectionR2L() const
{
CPDF_Dictionary *pDict = m_pDoc->GetRoot();
pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
if (!pDict) {
- return FALSE;
+ return false;
}
return FX_BSTRC("R2L") == pDict->GetString(FX_BSTRC("Direction"));
}
-FX_BOOL CPDF_ViewerPreferences::PrintScaling() const
+bool CPDF_ViewerPreferences::PrintScaling() const
{
CPDF_Dictionary *pDict = m_pDoc->GetRoot();
pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
if (!pDict) {
- return TRUE;
+ return true;
}
return FX_BSTRC("None") != pDict->GetString(FX_BSTRC("PrintScaling"));
}
diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp
index 230ba764e4..8cc6b7c9f5 100644
--- a/core/src/fpdfdoc/doc_vt.cpp
+++ b/core/src/fpdfdoc/doc_vt.cpp
@@ -183,8 +183,8 @@ CPVT_WordPlace CSection::SearchWordPlace(const CPDF_Point & point) const
{
ASSERT(m_pVT != NULL);
CPVT_WordPlace place = GetBeginWordPlace();
- FX_BOOL bUp = TRUE;
- FX_BOOL bDown = TRUE;
+ bool bUp = true;
+ bool bDown = true;
int32_t nLeft = 0;
int32_t nRight = m_LineArray.GetSize() - 1;
int32_t nMid = m_LineArray.GetSize() / 2;
@@ -195,10 +195,10 @@ CPVT_WordPlace CSection::SearchWordPlace(const CPDF_Point & point) const
fTop = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineAscent - m_pVT->GetLineLeading(m_SecInfo);
fBottom = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineDescent;
if (IsFloatBigger(point.y, fTop)) {
- bUp = FALSE;
+ bUp = false;
}
if (IsFloatSmaller(point.y, fBottom)) {
- bDown = FALSE;
+ bDown = false;
}
if (IsFloatSmaller(point.y, fTop)) {
nRight = nMid - 1;
@@ -394,7 +394,7 @@ CPVT_Size CTypeset::GetEditSize(FX_FLOAT fFontSize)
{
ASSERT(m_pSection != NULL);
ASSERT(m_pVT != NULL);
- SplitLines(FALSE, fFontSize);
+ SplitLines(false, fFontSize);
return CPVT_Size(m_rcRet.Width(), m_rcRet.Height());
}
CPVT_FloatRect CTypeset::Typeset()
@@ -402,7 +402,7 @@ CPVT_FloatRect CTypeset::Typeset()
ASSERT(m_pSection != NULL);
ASSERT(m_pVT != NULL);
m_pSection->m_LineArray.Empty();
- SplitLines(TRUE, 0.0f);
+ SplitLines(true, 0.0f);
m_pSection->m_LineArray.Clear();
OutputLines();
return m_rcRet;
@@ -425,11 +425,11 @@ static int special_chars[128] = {
0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
0x0001, 0x0001, 0x0001, 0x000C, 0x0000, 0x0008, 0x0000, 0x0000,
};
-static FX_BOOL IsLatin(FX_WORD word)
+static bool IsLatin(FX_WORD word)
{
if (word <= 0x007F) {
if (special_chars[word] & 0x0001) {
- return TRUE;
+ return true;
}
}
if ((word >= 0x00C0 && word <= 0x00FF) ||
@@ -439,15 +439,15 @@ static FX_BOOL IsLatin(FX_WORD word)
(word >= 0xA720 && word <= 0xA7FF) ||
(word >= 0xFF21 && word <= 0xFF3A) ||
(word >= 0xFF41 && word <= 0xFF5A)) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-static FX_BOOL IsDigit(FX_DWORD word)
+static bool IsDigit(FX_DWORD word)
{
- return (word >= 0x0030 && word <= 0x0039) ? TRUE : FALSE;
+ return (word >= 0x0030 && word <= 0x0039) ? true : false;
}
-static FX_BOOL IsCJK(FX_DWORD word)
+static bool IsCJK(FX_DWORD word)
{
if ((word >= 0x1100 && word <= 0x11FF) ||
(word >= 0x2E80 && word <= 0x2FFF) ||
@@ -457,33 +457,33 @@ static FX_BOOL IsCJK(FX_DWORD word)
(word >= 0xFE30 && word <= 0xFE4F) ||
(word >= 0x20000 && word <= 0x2A6DF) ||
(word >= 0x2F800 && word <= 0x2FA1F)) {
- return TRUE;
+ return true;
}
if (word >= 0x3000 && word <= 0x303F) {
if (word == 0x3005 || word == 0x3006 || word == 0x3021 || word == 0x3022 ||
word == 0x3023 || word == 0x3024 || word == 0x3025 || word == 0x3026 ||
word == 0x3027 || word == 0x3028 || word == 0x3029 || word == 0x3031 ||
word == 0x3032 || word == 0x3033 || word == 0x3034 || word == 0x3035) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
if (word >= 0xFF66 && word <= 0xFF9D) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-static FX_BOOL IsPunctuation(FX_DWORD word)
+static bool IsPunctuation(FX_DWORD word)
{
if (word <= 0x007F) {
if ((special_chars[word] >> 3) & 1) {
- return TRUE;
+ return true;
}
} else if (word >= 0x0080 && word <= 0x00FF) {
if (word == 0x0082 || word == 0x0084 || word == 0x0085 || word == 0x0091 ||
word == 0x0092 || word == 0x0093 || word <= 0x0094 || word == 0x0096 ||
word == 0x00B4 || word == 0x00B8) {
- return TRUE;
+ return true;
}
} else if (word >= 0x2000 && word <= 0x206F) {
if (word == 0x2010 || word == 0x2011 || word == 0x2012 || word == 0x2013 ||
@@ -492,7 +492,7 @@ static FX_BOOL IsPunctuation(FX_DWORD word)
word == 0x2032 || word == 0x2033 || word == 0x2034 || word == 0x2035 ||
word == 0x2036 || word == 0x2037 || word == 0x203C || word == 0x203D ||
word == 0x203E || word == 0x2044) {
- return TRUE;
+ return true;
}
} else if (word >= 0x3000 && word <= 0x303F) {
if (word == 0x3001 || word == 0x3002 || word == 0x3003 || word == 0x3005 ||
@@ -501,11 +501,11 @@ static FX_BOOL IsPunctuation(FX_DWORD word)
word == 0x3011 || word == 0x3014 || word == 0x3015 || word == 0x3016 ||
word == 0x3017 || word == 0x3018 || word == 0x3019 || word == 0x301A ||
word == 0x301B || word == 0x301D || word == 0x301E || word == 0x301F) {
- return TRUE;
+ return true;
}
} else if (word >= 0xFE50 && word <= 0xFE6F) {
if ((word >= 0xFE50 && word <= 0xFE5E) || word == 0xFE63) {
- return TRUE;
+ return true;
}
} else if (word >= 0xFF00 && word <= 0xFFEF) {
if (word == 0xFF01 || word == 0xFF02 || word == 0xFF07 || word == 0xFF08 ||
@@ -514,83 +514,83 @@ static FX_BOOL IsPunctuation(FX_DWORD word)
word == 0xFF3D || word == 0xFF40 || word == 0xFF5B || word == 0xFF5C ||
word == 0xFF5D || word == 0xFF61 || word == 0xFF62 || word == 0xFF63 ||
word == 0xFF64 || word == 0xFF65 || word == 0xFF9E || word == 0xFF9F) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-static FX_BOOL IsConnectiveSymbol(FX_DWORD word)
+static bool IsConnectiveSymbol(FX_DWORD word)
{
if (word <= 0x007F) {
if ((special_chars[word] >> 5) & 1) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-static FX_BOOL IsOpenStylePunctuation(FX_DWORD word)
+static bool IsOpenStylePunctuation(FX_DWORD word)
{
if (word <= 0x007F) {
if ((special_chars[word] >> 2) & 1) {
- return TRUE;
+ return true;
}
} else if (word == 0x300A || word == 0x300C || word == 0x300E || word == 0x3010 ||
word == 0x3014 || word == 0x3016 || word == 0x3018 || word == 0x301A ||
word == 0xFF08 || word == 0xFF3B || word == 0xFF5B || word == 0xFF62) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-static FX_BOOL IsCurrencySymbol(FX_WORD word)
+static bool IsCurrencySymbol(FX_WORD word)
{
if (word == 0x0024 || word == 0x0080 || word == 0x00A2 || word == 0x00A3 ||
word == 0x00A4 || word == 0x00A5 || (word >= 0x20A0 && word <= 0x20CF) ||
word == 0xFE69 || word == 0xFF04 || word == 0xFFE0 || word == 0xFFE1 ||
word == 0xFFE5 || word == 0xFFE6) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-static FX_BOOL IsPrefixSymbol(FX_WORD word)
+static bool IsPrefixSymbol(FX_WORD word)
{
if (IsCurrencySymbol(word)) {
- return TRUE;
+ return true;
}
if (word == 0x2116) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-static FX_BOOL IsSpace(FX_WORD word)
+static bool IsSpace(FX_WORD word)
{
- return (word == 0x0020 || word == 0x3000) ? TRUE : FALSE;
+ return (word == 0x0020 || word == 0x3000) ? true : false;
}
-static FX_BOOL NeedDivision(FX_WORD prevWord, FX_WORD curWord)
+static bool NeedDivision(FX_WORD prevWord, FX_WORD curWord)
{
if ((IsLatin(prevWord) || IsDigit(prevWord)) && (IsLatin(curWord) || IsDigit(curWord))) {
- return FALSE;
+ return false;
}
if (IsSpace(curWord) || IsPunctuation(curWord)) {
- return FALSE;
+ return false;
}
if (IsConnectiveSymbol(prevWord) || IsConnectiveSymbol(curWord)) {
- return FALSE;
+ return false;
}
if (IsSpace(prevWord) || IsPunctuation(prevWord)) {
- return TRUE;
+ return true;
}
if (IsPrefixSymbol(prevWord)) {
- return FALSE;
+ return false;
}
if (IsPrefixSymbol(curWord) || IsCJK(curWord)) {
- return TRUE;
+ return true;
}
if (IsCJK(prevWord)) {
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize)
+void CTypeset::SplitLines(bool bTypeset, FX_FLOAT fFontSize)
{
ASSERT(m_pVT != NULL);
ASSERT(m_pSection != NULL);
@@ -601,14 +601,14 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize)
FX_FLOAT fLineAscent = 0.0f, fBackupLineAscent = 0.0f;
FX_FLOAT fLineDescent = 0.0f, fBackupLineDescent = 0.0f;
int32_t nWordStartPos = 0;
- FX_BOOL bFullWord = FALSE;
+ bool bFullWord = false;
int32_t nLineFullWordIndex = 0;
int32_t nCharIndex = 0;
CPVT_LineInfo line;
FX_FLOAT fWordWidth = 0;
FX_FLOAT fTypesetWidth = FPDF_MAX(m_pVT->GetPlateWidth() - m_pVT->GetLineIndent(m_pSection->m_SecInfo), 0.0f);
int32_t nTotalWords = m_pSection->m_WordArray.GetSize();
- FX_BOOL bOpened = FALSE;
+ bool bOpened = false;
if (nTotalWords > 0) {
int32_t i = 0;
while (i < nTotalWords) {
@@ -619,8 +619,8 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize)
}
if (pWord) {
if (bTypeset) {
- fLineAscent = FPDF_MAX(fLineAscent, m_pVT->GetWordAscent(*pWord, TRUE));
- fLineDescent = FPDF_MIN(fLineDescent, m_pVT->GetWordDescent(*pWord, TRUE));
+ fLineAscent = FPDF_MAX(fLineAscent, m_pVT->GetWordAscent(*pWord, true));
+ fLineDescent = FPDF_MIN(fLineDescent, m_pVT->GetWordDescent(*pWord, true));
fWordWidth = m_pVT->GetWordWidth(*pWord);
} else {
fLineAscent = FPDF_MAX(fLineAscent, m_pVT->GetWordAscent(*pWord, fFontSize));
@@ -636,20 +636,20 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize)
}
if (!bOpened) {
if (IsOpenStylePunctuation(pWord->Word)) {
- bOpened = TRUE;
- bFullWord = TRUE;
+ bOpened = true;
+ bFullWord = true;
} else if (pOldWord != NULL) {
if (NeedDivision(pOldWord->Word, pWord->Word)) {
- bFullWord = TRUE;
+ bFullWord = true;
}
}
} else {
if (!IsSpace(pWord->Word) && !IsOpenStylePunctuation(pWord->Word)) {
- bOpened = FALSE;
+ bOpened = false;
}
}
if (bFullWord) {
- bFullWord = FALSE;
+ bFullWord = false;
if (nCharIndex > 0) {
nLineFullWordIndex ++;
}
@@ -691,7 +691,7 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize)
fLineDescent = 0.0f;
nCharIndex = 0;
nLineFullWordIndex = 0;
- bFullWord = FALSE;
+ bFullWord = false;
} else {
fLineWidth += fWordWidth;
i++;
@@ -809,17 +809,17 @@ void CTypeset::OutputLines()
CPDF_VariableText::CPDF_VariableText() :
m_nLimitChar(0),
m_nCharArray(0),
- m_bMultiLine(FALSE),
- m_bLimitWidth(FALSE),
- m_bAutoFontSize(FALSE),
+ m_bMultiLine(false),
+ m_bLimitWidth(false),
+ m_bAutoFontSize(false),
m_nAlignment(0),
m_fLineLeading(0.0f),
m_fCharSpace(0.0f),
m_nHorzScale(100),
m_wSubWord(0),
m_fFontSize(0.0f),
- m_bInitial(FALSE),
- m_bRichText(FALSE),
+ m_bInitial(false),
+ m_bRichText(false),
m_pVTProvider(NULL),
m_pVTIterator(NULL)
{
@@ -848,12 +848,12 @@ void CPDF_VariableText::Initialize()
if (CSection * pSection = m_SectionArray.GetAt(0)) {
pSection->ResetLinePlace();
}
- m_bInitial = TRUE;
+ m_bInitial = true;
}
}
void CPDF_VariableText::ResetAll()
{
- m_bInitial = FALSE;
+ m_bInitial = false;
ResetSectionArray();
}
CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WORD word, int32_t charset,
@@ -956,7 +956,7 @@ CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace & place, const
}
CPVT_WordPlace CPDF_VariableText::DeleteWords(const CPVT_WordRange & PlaceRange)
{
- FX_BOOL bLastSecPos = FALSE;
+ bool bLastSecPos = false;
if (CSection * pSection = m_SectionArray.GetAt(PlaceRange.EndPos.nSecIndex)) {
bLastSecPos = (PlaceRange.EndPos == pSection->GetEndWordPlace());
}
@@ -971,11 +971,11 @@ CPVT_WordPlace CPDF_VariableText::DeleteWords(const CPVT_WordRange & PlaceRange)
}
CPVT_WordPlace CPDF_VariableText::DeleteWord(const CPVT_WordPlace & place)
{
- return ClearRightWord(AjustLineHeader(place, TRUE));
+ return ClearRightWord(AjustLineHeader(place, true));
}
CPVT_WordPlace CPDF_VariableText::BackSpaceWord(const CPVT_WordPlace & place)
{
- return ClearLeftWord(AjustLineHeader(place, TRUE));
+ return ClearLeftWord(AjustLineHeader(place, true));
}
void CPDF_VariableText::SetText(const FX_WCHAR* text, int32_t charset, const CPVT_SecProps * pSecProps,
const CPVT_WordProps * pWordProps)
@@ -1044,7 +1044,7 @@ void CPDF_VariableText::UpdateWordPlace(CPVT_WordPlace & place) const
if (place.nSecIndex >= m_SectionArray.GetSize()) {
place = GetEndWordPlace();
}
- place = AjustLineHeader(place, TRUE);
+ place = AjustLineHeader(place, true);
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
pSection->UpdateWordPlace(place);
}
@@ -1073,19 +1073,19 @@ CPVT_WordPlace CPDF_VariableText::WordIndexToWordPlace(int32_t index) const
{
CPVT_WordPlace place = GetBeginWordPlace();
int32_t nOldIndex = 0 , nIndex = 0;
- FX_BOOL bFind = FALSE;
+ bool bFind = false;
for (int32_t i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) {
if (CSection * pSection = m_SectionArray.GetAt(i)) {
nIndex += pSection->m_WordArray.GetSize();
if (nIndex == index) {
place = pSection->GetEndWordPlace();
- bFind = TRUE;
+ bFind = true;
break;
} else if (nIndex > index) {
place.nSecIndex = i;
place.nWordIndex = index - nOldIndex - 1;
pSection->UpdateWordPlace(place);
- bFind = TRUE;
+ bFind = true;
break;
}
if (i != m_SectionArray.GetSize() - 1) {
@@ -1155,15 +1155,15 @@ CPVT_WordPlace CPDF_VariableText::SearchWordPlace(const CPDF_Point & point) cons
int32_t nLeft = 0;
int32_t nRight = m_SectionArray.GetSize() - 1;
int32_t nMid = m_SectionArray.GetSize() / 2;
- FX_BOOL bUp = TRUE;
- FX_BOOL bDown = TRUE;
+ bool bUp = true;
+ bool bDown = true;
while (nLeft <= nRight) {
if (CSection * pSection = m_SectionArray.GetAt(nMid)) {
if (IsFloatBigger(pt.y, pSection->m_SecInfo.rcSection.top)) {
- bUp = FALSE;
+ bUp = false;
}
if (IsFloatBigger(pSection->m_SecInfo.rcSection.bottom, pt.y)) {
- bDown = FALSE;
+ bDown = false;
}
if (IsFloatSmaller(pt.y, pSection->m_SecInfo.rcSection.top)) {
nRight = nMid - 1;
@@ -1303,49 +1303,49 @@ CPVT_WordPlace CPDF_VariableText::AddWord(const CPVT_WordPlace & place, const CP
}
return place;
}
-FX_BOOL CPDF_VariableText::GetWordInfo(const CPVT_WordPlace & place, CPVT_WordInfo & wordinfo)
+bool CPDF_VariableText::GetWordInfo(const CPVT_WordPlace & place, CPVT_WordInfo & wordinfo)
{
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
if (CPVT_WordInfo * pWord = pSection->m_WordArray.GetAt(place.nWordIndex)) {
wordinfo = *pWord;
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText::SetWordInfo(const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo)
+bool CPDF_VariableText::SetWordInfo(const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo)
{
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
if (CPVT_WordInfo * pWord = pSection->m_WordArray.GetAt(place.nWordIndex)) {
*pWord = wordinfo;
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText::GetLineInfo(const CPVT_WordPlace & place, CPVT_LineInfo & lineinfo)
+bool CPDF_VariableText::GetLineInfo(const CPVT_WordPlace & place, CPVT_LineInfo & lineinfo)
{
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
if (CLine * pLine = pSection->m_LineArray.GetAt(place.nLineIndex)) {
lineinfo = pLine->m_LineInfo;
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText::GetSectionInfo(const CPVT_WordPlace & place, CPVT_SectionInfo & secinfo)
+bool CPDF_VariableText::GetSectionInfo(const CPVT_WordPlace & place, CPVT_SectionInfo & secinfo)
{
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
secinfo = pSection->m_SecInfo;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
CPDF_Rect CPDF_VariableText::GetContentRect() const
{
return InToOut(CPDF_EditContainer::GetContentRect());
}
-FX_FLOAT CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize)
+FX_FLOAT CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo & WordInfo, bool bFactFontSize)
{
return m_bRichText && WordInfo.pWordProps ? (WordInfo.pWordProps->nScriptType == PVTWORD_SCRIPT_NORMAL || bFactFontSize ? WordInfo.pWordProps->fFontSize : WordInfo.pWordProps->fFontSize * PVT_HALF) : GetFontSize();
}
@@ -1391,11 +1391,11 @@ FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo & WordInfo, FX_FL
{
return GetFontDescent(GetWordFontIndex(WordInfo), fFontSize);
}
-FX_FLOAT CPDF_VariableText::GetWordAscent(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize)
+FX_FLOAT CPDF_VariableText::GetWordAscent(const CPVT_WordInfo & WordInfo, bool bFactFontSize)
{
return GetFontAscent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo, bFactFontSize));
}
-FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize)
+FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo & WordInfo, bool bFactFontSize)
{
return GetFontDescent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo, bFactFontSize));
}
@@ -1421,7 +1421,7 @@ int32_t CPDF_VariableText::GetHorzScale(const CPVT_WordInfo & WordInfo)
}
void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace & place)
{
- CPVT_WordPlace wordplace = AjustLineHeader(place, TRUE);
+ CPVT_WordPlace wordplace = AjustLineHeader(place, true);
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
for (int32_t w = pSection->m_WordArray.GetSize() - 1; w > wordplace.nWordIndex; w--) {
delete pSection->m_WordArray.GetAt(w);
@@ -1429,26 +1429,26 @@ void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace & place)
}
}
}
-CPVT_WordPlace CPDF_VariableText::AjustLineHeader(const CPVT_WordPlace & place, FX_BOOL bPrevOrNext) const
+CPVT_WordPlace CPDF_VariableText::AjustLineHeader(const CPVT_WordPlace & place, bool bPrevOrNext) const
{
if (place.nWordIndex < 0 && place.nLineIndex > 0) {
return bPrevOrNext ? GetPrevWordPlace(place) : GetNextWordPlace(place);
}
return place;
}
-FX_BOOL CPDF_VariableText::ClearEmptySection(const CPVT_WordPlace & place)
+bool CPDF_VariableText::ClearEmptySection(const CPVT_WordPlace & place)
{
if (place.nSecIndex == 0 && m_SectionArray.GetSize() == 1) {
- return FALSE;
+ return false;
}
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
if (pSection->m_WordArray.GetSize() == 0) {
delete pSection;
m_SectionArray.RemoveAt(place.nSecIndex);
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
void CPDF_VariableText::ClearEmptySections(const CPVT_WordRange & PlaceRange)
{
@@ -1460,7 +1460,7 @@ void CPDF_VariableText::ClearEmptySections(const CPVT_WordRange & PlaceRange)
}
void CPDF_VariableText::LinkLatterSection(const CPVT_WordPlace & place)
{
- CPVT_WordPlace oldplace = AjustLineHeader(place, TRUE);
+ CPVT_WordPlace oldplace = AjustLineHeader(place, true);
if (CSection * pNextSection = m_SectionArray.GetAt(place.nSecIndex + 1)) {
if (CSection * pSection = m_SectionArray.GetAt(oldplace.nSecIndex)) {
for (int32_t w = 0, sz = pNextSection->m_WordArray.GetSize(); w < sz; w++) {
@@ -1477,8 +1477,8 @@ void CPDF_VariableText::LinkLatterSection(const CPVT_WordPlace & place)
void CPDF_VariableText::ClearWords(const CPVT_WordRange & PlaceRange)
{
CPVT_WordRange NewRange;
- NewRange.BeginPos = AjustLineHeader(PlaceRange.BeginPos, TRUE);
- NewRange.EndPos = AjustLineHeader(PlaceRange.EndPos, TRUE);
+ NewRange.BeginPos = AjustLineHeader(PlaceRange.BeginPos, true);
+ NewRange.EndPos = AjustLineHeader(PlaceRange.EndPos, true);
for (int32_t s = NewRange.EndPos.nSecIndex; s >= NewRange.BeginPos.nSecIndex; s--) {
if (CSection * pSection = m_SectionArray.GetAt(s)) {
pSection->ClearWords(NewRange);
@@ -1507,7 +1507,7 @@ CPVT_WordPlace CPDF_VariableText::ClearLeftWord(const CPVT_WordPlace & place)
CPVT_WordPlace CPDF_VariableText::ClearRightWord(const CPVT_WordPlace & place)
{
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
- CPVT_WordPlace rightplace = AjustLineHeader(GetNextWordPlace(place), FALSE);
+ CPVT_WordPlace rightplace = AjustLineHeader(GetNextWordPlace(place), false);
if (rightplace != place) {
if(rightplace.nSecIndex != place.nSecIndex) {
LinkLatterSection(place);
@@ -1568,9 +1568,9 @@ FX_FLOAT CPDF_VariableText::GetAutoFontSize()
}
return (FX_FLOAT)gFontSizeSteps[nMid];
}
-FX_BOOL CPDF_VariableText::IsBigger(FX_FLOAT fFontSize)
+bool CPDF_VariableText::IsBigger(FX_FLOAT fFontSize)
{
- FX_BOOL bBigger = FALSE;
+ bool bBigger = false;
CPVT_Size szTotal;
for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) {
if (CSection * pSection = m_SectionArray.GetAt(s)) {
@@ -1580,7 +1580,7 @@ FX_BOOL CPDF_VariableText::IsBigger(FX_FLOAT fFontSize)
if (IsFloatBigger(szTotal.x, GetPlateWidth())
|| IsFloatBigger(szTotal.y, GetPlateHeight())
) {
- bBigger = TRUE;
+ bBigger = true;
break;
}
}
@@ -1652,9 +1652,9 @@ int32_t CPDF_VariableText::GetDefaultFontIndex()
{
return m_pVTProvider ? m_pVTProvider->GetDefaultFontIndex() : -1;
}
-FX_BOOL CPDF_VariableText::IsLatinWord(FX_WORD word)
+bool CPDF_VariableText::IsLatinWord(FX_WORD word)
{
- return m_pVTProvider ? m_pVTProvider->IsLatinWord(word) : FALSE;
+ return m_pVTProvider ? m_pVTProvider->IsLatinWord(word) : false;
}
IPDF_VariableText_Iterator * CPDF_VariableText::GetIterator()
{
@@ -1687,70 +1687,70 @@ void CPDF_VariableText_Iterator::SetAt(const CPVT_WordPlace & place)
ASSERT(m_pVT != NULL);
m_CurPos = place;
}
-FX_BOOL CPDF_VariableText_Iterator::NextWord()
+bool CPDF_VariableText_Iterator::NextWord()
{
if (m_CurPos == m_pVT->GetEndWordPlace()) {
- return FALSE;
+ return false;
}
m_CurPos = m_pVT->GetNextWordPlace(m_CurPos);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_VariableText_Iterator::PrevWord()
+bool CPDF_VariableText_Iterator::PrevWord()
{
if (m_CurPos == m_pVT->GetBeginWordPlace()) {
- return FALSE;
+ return false;
}
m_CurPos = m_pVT->GetPrevWordPlace(m_CurPos);
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_VariableText_Iterator::NextLine()
+bool CPDF_VariableText_Iterator::NextLine()
{
if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
if (m_CurPos.nLineIndex < pSection->m_LineArray.GetSize() - 1) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex + 1, -1);
- return TRUE;
+ return true;
}
if (m_CurPos.nSecIndex < m_pVT->m_SectionArray.GetSize() - 1) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1);
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText_Iterator::PrevLine()
+bool CPDF_VariableText_Iterator::PrevLine()
{
if (m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
if (m_CurPos.nLineIndex > 0) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex - 1, -1);
- return TRUE;
+ return true;
}
if (m_CurPos.nSecIndex > 0) {
if (CSection * pLastSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex - 1)) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1, pLastSection->m_LineArray.GetSize() - 1, -1);
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText_Iterator::NextSection()
+bool CPDF_VariableText_Iterator::NextSection()
{
if (m_CurPos.nSecIndex < m_pVT->m_SectionArray.GetSize() - 1) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText_Iterator::PrevSection()
+bool CPDF_VariableText_Iterator::PrevSection()
{
ASSERT(m_pVT != NULL);
if (m_CurPos.nSecIndex > 0) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1, 0, -1);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText_Iterator::GetWord(CPVT_Word & word) const
+bool CPDF_VariableText_Iterator::GetWord(CPVT_Word & word) const
{
ASSERT(m_pVT != NULL);
word.WordPlace = m_CurPos;
@@ -1770,13 +1770,13 @@ FX_BOOL CPDF_VariableText_Iterator::GetWord(CPVT_Word & word) const
}
word.nFontIndex = m_pVT->GetWordFontIndex(*pWord);
word.fFontSize = m_pVT->GetWordFontSize(*pWord);
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText_Iterator::SetWord(const CPVT_Word & word)
+bool CPDF_VariableText_Iterator::SetWord(const CPVT_Word & word)
{
ASSERT(m_pVT != NULL);
if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
@@ -1784,12 +1784,12 @@ FX_BOOL CPDF_VariableText_Iterator::SetWord(const CPVT_Word & word)
if (pWord->pWordProps) {
*pWord->pWordProps = word.WordProps;
}
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText_Iterator::GetLine(CPVT_Line & line) const
+bool CPDF_VariableText_Iterator::GetLine(CPVT_Line & line) const
{
ASSERT(m_pVT != NULL);
line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1);
@@ -1802,12 +1802,12 @@ FX_BOOL CPDF_VariableText_Iterator::GetLine(CPVT_Line & line) const
line.fLineAscent = pLine->m_LineInfo.fLineAscent;
line.fLineDescent = pLine->m_LineInfo.fLineDescent;
line.lineEnd = pLine->GetEndWordPlace();
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText_Iterator::GetSection(CPVT_Section & section) const
+bool CPDF_VariableText_Iterator::GetSection(CPVT_Section & section) const
{
ASSERT(m_pVT != NULL);
section.secplace = CPVT_WordPlace(m_CurPos.nSecIndex, 0, -1);
@@ -1819,11 +1819,11 @@ FX_BOOL CPDF_VariableText_Iterator::GetSection(CPVT_Section & section) const
if (pSection->m_SecInfo.pWordProps) {
section.WordProps = *pSection->m_SecInfo.pWordProps;
}
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDF_VariableText_Iterator::SetSection(const CPVT_Section & section)
+bool CPDF_VariableText_Iterator::SetSection(const CPVT_Section & section)
{
ASSERT(m_pVT != NULL);
if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
@@ -1833,7 +1833,7 @@ FX_BOOL CPDF_VariableText_Iterator::SetSection(const CPVT_Section & section)
if (pSection->m_SecInfo.pWordProps) {
*pSection->m_SecInfo.pWordProps = section.WordProps;
}
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
diff --git a/core/src/fpdfdoc/pdf_vt.h b/core/src/fpdfdoc/pdf_vt.h
index a75490fcd5..fb7910bff5 100644
--- a/core/src/fpdfdoc/pdf_vt.h
+++ b/core/src/fpdfdoc/pdf_vt.h
@@ -191,7 +191,7 @@ struct CPVT_FloatRange {
template<class TYPE> class CPVT_ArrayTemplate : public CFX_ArrayTemplate<TYPE>
{
public:
- FX_BOOL IsEmpty()
+ bool IsEmpty()
{
return CFX_ArrayTemplate<TYPE>::GetSize() <= 0;
}
@@ -316,7 +316,7 @@ public:
CPVT_FloatRect Typeset();
CPVT_FloatRect CharArray();
private:
- void SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize);
+ void SplitLines(bool bTypeset, FX_FLOAT fFontSize);
void OutputLines();
CPVT_FloatRect m_rcRet;
@@ -423,11 +423,11 @@ public:
{
m_nHorzScale = nHorzScale;
}
- void SetMultiLine(FX_BOOL bMultiLine = TRUE)
+ void SetMultiLine(bool bMultiLine = true)
{
m_bMultiLine = bMultiLine;
}
- void SetAutoReturn(FX_BOOL bAuto = TRUE)
+ void SetAutoReturn(bool bAuto = true)
{
m_bLimitWidth = bAuto;
}
@@ -439,11 +439,11 @@ public:
{
m_nCharArray = nCharArray;
}
- void SetAutoFontSize(FX_BOOL bAuto = TRUE)
+ void SetAutoFontSize(bool bAuto = true)
{
m_bAutoFontSize = bAuto;
}
- void SetRichText(FX_BOOL bRichText)
+ void SetRichText(bool bRichText)
{
m_bRichText = bRichText;
}
@@ -452,11 +452,11 @@ public:
m_fLineLeading = fLineLeading;
}
void Initialize();
- FX_BOOL IsValid() const
+ bool IsValid() const
{
return m_bInitial;
}
- FX_BOOL IsRichText() const
+ bool IsRichText() const
{
return m_bRichText;
}
@@ -496,7 +496,7 @@ public:
{
return m_nLimitChar;
}
- FX_BOOL IsMultiLine() const
+ bool IsMultiLine() const
{
return m_bMultiLine;
}
@@ -537,25 +537,25 @@ private:
int32_t GetTypeDescent(int32_t nFontIndex);
int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex);
int32_t GetDefaultFontIndex();
- FX_BOOL IsLatinWord(FX_WORD word);
+ bool IsLatinWord(FX_WORD word);
private:
CPVT_WordPlace AddSection(const CPVT_WordPlace & place, const CPVT_SectionInfo & secinfo);
CPVT_WordPlace AddLine(const CPVT_WordPlace & place, const CPVT_LineInfo & lineinfo);
CPVT_WordPlace AddWord(const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo);
- FX_BOOL GetWordInfo(const CPVT_WordPlace & place, CPVT_WordInfo & wordinfo);
- FX_BOOL SetWordInfo(const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo);
- FX_BOOL GetLineInfo(const CPVT_WordPlace & place, CPVT_LineInfo & lineinfo);
- FX_BOOL GetSectionInfo(const CPVT_WordPlace & place, CPVT_SectionInfo & secinfo);
- FX_FLOAT GetWordFontSize(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize = FALSE);
+ bool GetWordInfo(const CPVT_WordPlace & place, CPVT_WordInfo & wordinfo);
+ bool SetWordInfo(const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo);
+ bool GetLineInfo(const CPVT_WordPlace & place, CPVT_LineInfo & lineinfo);
+ bool GetSectionInfo(const CPVT_WordPlace & place, CPVT_SectionInfo & secinfo);
+ FX_FLOAT GetWordFontSize(const CPVT_WordInfo & WordInfo, bool bFactFontSize = false);
FX_FLOAT GetWordWidth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord,
FX_FLOAT fCharSpace, int32_t nHorzScale,
FX_FLOAT fFontSize, FX_FLOAT fWordTail, int32_t nWordStyle);
FX_FLOAT GetWordWidth(const CPVT_WordInfo & WordInfo);
FX_FLOAT GetWordAscent(const CPVT_WordInfo & WordInfo, FX_FLOAT fFontSize);
FX_FLOAT GetWordDescent(const CPVT_WordInfo & WordInfo, FX_FLOAT fFontSize);
- FX_FLOAT GetWordAscent(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize = FALSE);
- FX_FLOAT GetWordDescent(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize = FALSE);
+ FX_FLOAT GetWordAscent(const CPVT_WordInfo & WordInfo, bool bFactFontSize = false);
+ FX_FLOAT GetWordDescent(const CPVT_WordInfo & WordInfo, bool bFactFontSize = false);
FX_FLOAT GetLineAscent(const CPVT_SectionInfo & SecInfo);
FX_FLOAT GetLineDescent(const CPVT_SectionInfo & SecInfo);
FX_FLOAT GetFontAscent(int32_t nFontIndex, FX_FLOAT fFontSize);
@@ -568,8 +568,8 @@ private:
int32_t GetAlignment(const CPVT_SectionInfo& SecInfo);
void ClearSectionRightWords(const CPVT_WordPlace & place);
- CPVT_WordPlace AjustLineHeader(const CPVT_WordPlace & place, FX_BOOL bPrevOrNext) const;
- FX_BOOL ClearEmptySection(const CPVT_WordPlace & place);
+ CPVT_WordPlace AjustLineHeader(const CPVT_WordPlace & place, bool bPrevOrNext) const;
+ bool ClearEmptySection(const CPVT_WordPlace & place);
void ClearEmptySections(const CPVT_WordRange & PlaceRange);
void LinkLatterSection(const CPVT_WordPlace & place);
void ClearWords(const CPVT_WordRange & PlaceRange);
@@ -578,7 +578,7 @@ private:
private:
CPVT_FloatRect Rearrange(const CPVT_WordRange & PlaceRange);
FX_FLOAT GetAutoFontSize();
- FX_BOOL IsBigger(FX_FLOAT fFontSize);
+ bool IsBigger(FX_FLOAT fFontSize);
CPVT_FloatRect RearrangeSections(const CPVT_WordRange & PlaceRange);
private:
void ResetSectionArray();
@@ -586,9 +586,9 @@ private:
CPVT_ArrayTemplate<CSection*> m_SectionArray;
int32_t m_nLimitChar;
int32_t m_nCharArray;
- FX_BOOL m_bMultiLine;
- FX_BOOL m_bLimitWidth;
- FX_BOOL m_bAutoFontSize;
+ bool m_bMultiLine;
+ bool m_bLimitWidth;
+ bool m_bAutoFontSize;
int32_t m_nAlignment;
FX_FLOAT m_fLineLeading;
FX_FLOAT m_fCharSpace;
@@ -597,8 +597,8 @@ private:
FX_FLOAT m_fFontSize;
private:
- FX_BOOL m_bInitial;
- FX_BOOL m_bRichText;
+ bool m_bInitial;
+ bool m_bRichText;
IPDF_VariableText_Provider * m_pVTProvider;
CPDF_VariableText_Iterator * m_pVTIterator;
};
@@ -607,17 +607,17 @@ class CPDF_VariableText_Iterator : public IPDF_VariableText_Iterator
public:
CPDF_VariableText_Iterator(CPDF_VariableText * pVT);
virtual ~CPDF_VariableText_Iterator();
- FX_BOOL NextWord();
- FX_BOOL PrevWord();
- FX_BOOL NextLine();
- FX_BOOL PrevLine();
- FX_BOOL NextSection();
- FX_BOOL PrevSection();
- FX_BOOL SetWord(const CPVT_Word & word);
- FX_BOOL GetWord(CPVT_Word & word) const;
- FX_BOOL GetLine(CPVT_Line & line) const;
- FX_BOOL GetSection(CPVT_Section & section) const;
- FX_BOOL SetSection(const CPVT_Section & section);
+ bool NextWord();
+ bool PrevWord();
+ bool NextLine();
+ bool PrevLine();
+ bool NextSection();
+ bool PrevSection();
+ bool SetWord(const CPVT_Word & word);
+ bool GetWord(CPVT_Word & word) const;
+ bool GetLine(CPVT_Line & line) const;
+ bool GetSection(CPVT_Section & section) const;
+ bool SetSection(const CPVT_Section & section);
void SetAt(int32_t nWordIndex);
void SetAt(const CPVT_WordPlace & place);
const CPVT_WordPlace & GetAt() const
diff --git a/core/src/fpdfdoc/tagged_int.h b/core/src/fpdfdoc/tagged_int.h
index 9c643a6d6b..1279617681 100644
--- a/core/src/fpdfdoc/tagged_int.h
+++ b/core/src/fpdfdoc/tagged_int.h
@@ -26,7 +26,7 @@ public:
void LoadDocTree();
void LoadPageTree(const CPDF_Dictionary* pPageDict);
CPDF_StructElementImpl* AddPageNode(CPDF_Dictionary* pElement, CFX_MapPtrToPtr& map, int nLevel = 0);
- FX_BOOL AddTopLevelNode(CPDF_Dictionary* pDict, CPDF_StructElementImpl* pElement);
+ bool AddTopLevelNode(CPDF_Dictionary* pDict, CPDF_StructElementImpl* pElement);
protected:
const CPDF_Dictionary* m_pTreeRoot;
const CPDF_Dictionary* m_pRoleMap;
@@ -67,16 +67,16 @@ public:
return &m_ObjectArray;
}
- CPDF_Object* GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_BOOL bInheritable = FALSE, FX_FLOAT fLevel = 0.0F);
+ CPDF_Object* GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, bool bInheritable = false, FX_FLOAT fLevel = 0.0F);
- CFX_ByteString GetName(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, const CFX_ByteStringC& default_value, FX_BOOL bInheritable = FALSE, int subindex = -1);
- FX_ARGB GetColor(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_ARGB default_value, FX_BOOL bInheritable = FALSE, int subindex = -1);
- FX_FLOAT GetNumber(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_FLOAT default_value, FX_BOOL bInheritable = FALSE, int subindex = -1);
- int GetInteger(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, int default_value, FX_BOOL bInheritable = FALSE, int subindex = -1);
+ CFX_ByteString GetName(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, const CFX_ByteStringC& default_value, bool bInheritable = false, int subindex = -1);
+ FX_ARGB GetColor(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_ARGB default_value, bool bInheritable = false, int subindex = -1);
+ FX_FLOAT GetNumber(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_FLOAT default_value, bool bInheritable = false, int subindex = -1);
+ int GetInteger(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, int default_value, bool bInheritable = false, int subindex = -1);
CFX_PtrArray m_ObjectArray;
void LoadKids(CPDF_Dictionary* pDict);
void LoadKid(FX_DWORD PageObjNum, CPDF_Object* pObj, CPDF_StructKid* pKid);
- CPDF_Object* GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_BOOL bInheritable, int subindex);
+ CPDF_Object* GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, bool bInheritable, int subindex);
CPDF_StructElementImpl* Retain();
void Release();
protected: