From 12f3e4a58f05850b93af35619cb04f0231d86acc Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 2 Nov 2016 15:17:29 -0700 Subject: Remove FX_BOOL from core Review-Url: https://codereview.chromium.org/2477443002 --- core/fpdfdoc/cpdf_aaction.cpp | 2 +- core/fpdfdoc/cpdf_aaction.h | 2 +- core/fpdfdoc/cpdf_annot.cpp | 30 +++--- core/fpdfdoc/cpdf_annot.h | 18 ++-- core/fpdfdoc/cpdf_annotlist.cpp | 14 +-- core/fpdfdoc/cpdf_annotlist.h | 10 +- core/fpdfdoc/cpdf_defaultappearance.cpp | 16 ++-- core/fpdfdoc/cpdf_defaultappearance.h | 6 +- core/fpdfdoc/cpdf_formcontrol.cpp | 4 +- core/fpdfdoc/cpdf_formcontrol.h | 2 +- core/fpdfdoc/cpdf_formfield.cpp | 164 ++++++++++++++++---------------- core/fpdfdoc/cpdf_formfield.h | 40 ++++---- core/fpdfdoc/cpdf_iconfit.cpp | 4 +- core/fpdfdoc/cpdf_iconfit.h | 2 +- core/fpdfdoc/cpdf_interform.cpp | 64 ++++++------- core/fpdfdoc/cpdf_interform.h | 6 +- core/fpdfdoc/cpdf_metadata.cpp | 2 +- core/fpdfdoc/cpdf_variabletext.cpp | 162 +++++++++++++++---------------- core/fpdfdoc/cpdf_variabletext.h | 58 ++++++----- core/fpdfdoc/cpdf_viewerpreferences.cpp | 8 +- core/fpdfdoc/cpdf_viewerpreferences.h | 4 +- core/fpdfdoc/cpvt_generateap.cpp | 30 +++--- core/fpdfdoc/cpvt_generateap.h | 2 +- core/fpdfdoc/cpvt_wordplace.h | 2 +- core/fpdfdoc/cpvt_wordrange.h | 4 +- core/fpdfdoc/csection.cpp | 8 +- core/fpdfdoc/ctypeset.cpp | 22 ++--- core/fpdfdoc/ctypeset.h | 2 +- core/fpdfdoc/doc_tagged.cpp | 32 +++---- core/fpdfdoc/fpdf_tagged.h | 10 +- core/fpdfdoc/tagged_int.h | 16 ++-- 31 files changed, 366 insertions(+), 380 deletions(-) (limited to 'core/fpdfdoc') diff --git a/core/fpdfdoc/cpdf_aaction.cpp b/core/fpdfdoc/cpdf_aaction.cpp index da654b107d..39120fcdb3 100644 --- a/core/fpdfdoc/cpdf_aaction.cpp +++ b/core/fpdfdoc/cpdf_aaction.cpp @@ -14,7 +14,7 @@ const FX_CHAR* g_sAATypes[] = {"E", "X", "D", "U", "Fo", "Bl", "PO", "PC", } // namespace -FX_BOOL CPDF_AAction::ActionExist(AActionType eType) const { +bool CPDF_AAction::ActionExist(AActionType eType) const { return m_pDict && m_pDict->KeyExist(g_sAATypes[eType]); } diff --git a/core/fpdfdoc/cpdf_aaction.h b/core/fpdfdoc/cpdf_aaction.h index cef39f0407..d615915ee3 100644 --- a/core/fpdfdoc/cpdf_aaction.h +++ b/core/fpdfdoc/cpdf_aaction.h @@ -40,7 +40,7 @@ class CPDF_AAction { CPDF_AAction() : m_pDict(nullptr) {} explicit CPDF_AAction(CPDF_Dictionary* pDict) : m_pDict(pDict) {} - FX_BOOL ActionExist(AActionType eType) const; + bool ActionExist(AActionType eType) const; CPDF_Action GetAction(AActionType eType) const; CPDF_Dictionary* GetDict() const { return m_pDict; } diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp index 879353c7b3..80edde8a8f 100644 --- a/core/fpdfdoc/cpdf_annot.cpp +++ b/core/fpdfdoc/cpdf_annot.cpp @@ -349,13 +349,13 @@ CFX_ByteString CPDF_Annot::AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype) { return ""; } -FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage, - CFX_RenderDevice* pDevice, - const CFX_Matrix* pUser2Device, - AppearanceMode mode, - const CPDF_RenderOptions* pOptions) { +bool CPDF_Annot::DrawAppearance(CPDF_Page* pPage, + CFX_RenderDevice* pDevice, + const CFX_Matrix* pUser2Device, + AppearanceMode mode, + const CPDF_RenderOptions* pOptions) { if (!ShouldDrawAnnotation()) - return FALSE; + return false; // It might happen that by the time this annotation instance was created, // it was flagged as "hidden" (e.g. /F 2), and hence CPVT_GenerateAP decided @@ -368,19 +368,19 @@ FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage, CPDF_Form* pForm = FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix); if (!pForm) { - return FALSE; + return false; } CPDF_RenderContext context(pPage); context.AppendLayer(pForm, &matrix); context.Render(pDevice, pOptions, nullptr); - return TRUE; + return true; } -FX_BOOL CPDF_Annot::DrawInContext(const CPDF_Page* pPage, - CPDF_RenderContext* pContext, - const CFX_Matrix* pUser2Device, - AppearanceMode mode) { +bool CPDF_Annot::DrawInContext(const CPDF_Page* pPage, + CPDF_RenderContext* pContext, + const CFX_Matrix* pUser2Device, + AppearanceMode mode) { if (!ShouldDrawAnnotation()) - return FALSE; + return false; // It might happen that by the time this annotation instance was created, // it was flagged as "hidden" (e.g. /F 2), and hence CPVT_GenerateAP decided @@ -393,10 +393,10 @@ FX_BOOL CPDF_Annot::DrawInContext(const CPDF_Page* pPage, CPDF_Form* pForm = FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix); if (!pForm) { - return FALSE; + return false; } pContext->AppendLayer(pForm, &matrix); - return TRUE; + return true; } void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CFX_Matrix* pUser2Device, diff --git a/core/fpdfdoc/cpdf_annot.h b/core/fpdfdoc/cpdf_annot.h index d4bbca91f7..e5404a8c9e 100644 --- a/core/fpdfdoc/cpdf_annot.h +++ b/core/fpdfdoc/cpdf_annot.h @@ -83,15 +83,15 @@ class CPDF_Annot { CPDF_Dictionary* GetAnnotDict() { return m_pAnnotDict; } CPDF_Document* GetDocument() const { return m_pDocument; } - FX_BOOL DrawAppearance(CPDF_Page* pPage, - CFX_RenderDevice* pDevice, - const CFX_Matrix* pUser2Device, - AppearanceMode mode, - const CPDF_RenderOptions* pOptions); - FX_BOOL DrawInContext(const CPDF_Page* pPage, - CPDF_RenderContext* pContext, - const CFX_Matrix* pUser2Device, - AppearanceMode mode); + bool DrawAppearance(CPDF_Page* pPage, + CFX_RenderDevice* pDevice, + const CFX_Matrix* pUser2Device, + AppearanceMode mode, + const CPDF_RenderOptions* pOptions); + bool DrawInContext(const CPDF_Page* pPage, + CPDF_RenderContext* pContext, + const CFX_Matrix* pUser2Device, + AppearanceMode mode); void ClearCachedAP(); void DrawBorder(CFX_RenderDevice* pDevice, diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp index 4821f8e6dd..e89b47705e 100644 --- a/core/fpdfdoc/cpdf_annotlist.cpp +++ b/core/fpdfdoc/cpdf_annotlist.cpp @@ -101,9 +101,9 @@ CPDF_AnnotList::~CPDF_AnnotList() {} void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage, CFX_RenderDevice* pDevice, CPDF_RenderContext* pContext, - FX_BOOL bPrinting, + bool bPrinting, CFX_Matrix* pMatrix, - FX_BOOL bWidgetPass, + bool bWidgetPass, CPDF_RenderOptions* pOptions, FX_RECT* clip_rect) { for (const auto& pAnnot : m_AnnotList) { @@ -151,26 +151,26 @@ void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage, void CPDF_AnnotList::DisplayAnnots(CPDF_Page* pPage, CFX_RenderDevice* pDevice, CPDF_RenderContext* pContext, - FX_BOOL bPrinting, + bool bPrinting, CFX_Matrix* pUser2Device, uint32_t dwAnnotFlags, CPDF_RenderOptions* pOptions, FX_RECT* pClipRect) { if (dwAnnotFlags & ANNOTFLAG_INVISIBLE) { - DisplayPass(pPage, pDevice, pContext, bPrinting, pUser2Device, FALSE, + DisplayPass(pPage, pDevice, pContext, bPrinting, pUser2Device, false, pOptions, pClipRect); } if (dwAnnotFlags & ANNOTFLAG_HIDDEN) { - DisplayPass(pPage, pDevice, pContext, bPrinting, pUser2Device, TRUE, + DisplayPass(pPage, pDevice, pContext, bPrinting, pUser2Device, true, pOptions, pClipRect); } } void CPDF_AnnotList::DisplayAnnots(CPDF_Page* pPage, CPDF_RenderContext* pContext, - FX_BOOL bPrinting, + bool bPrinting, CFX_Matrix* pMatrix, - FX_BOOL bShowWidget, + bool bShowWidget, CPDF_RenderOptions* pOptions) { uint32_t dwAnnotFlags = bShowWidget ? ANNOTFLAG_INVISIBLE | ANNOTFLAG_HIDDEN : ANNOTFLAG_INVISIBLE; diff --git a/core/fpdfdoc/cpdf_annotlist.h b/core/fpdfdoc/cpdf_annotlist.h index 2488c68b0b..e17b958517 100644 --- a/core/fpdfdoc/cpdf_annotlist.h +++ b/core/fpdfdoc/cpdf_annotlist.h @@ -27,15 +27,15 @@ class CPDF_AnnotList { void DisplayAnnots(CPDF_Page* pPage, CPDF_RenderContext* pContext, - FX_BOOL bPrinting, + bool bPrinting, CFX_Matrix* pMatrix, - FX_BOOL bShowWidget, + bool bShowWidget, CPDF_RenderOptions* pOptions); void DisplayAnnots(CPDF_Page* pPage, CFX_RenderDevice* pDevice, CPDF_RenderContext* pContext, - FX_BOOL bPrinting, + bool bPrinting, CFX_Matrix* pMatrix, uint32_t dwAnnotFlags, CPDF_RenderOptions* pOptions, @@ -51,9 +51,9 @@ class CPDF_AnnotList { void DisplayPass(CPDF_Page* pPage, CFX_RenderDevice* pDevice, CPDF_RenderContext* pContext, - FX_BOOL bPrinting, + bool bPrinting, CFX_Matrix* pMatrix, - FX_BOOL bWidget, + bool bWidget, CPDF_RenderOptions* pOptions, FX_RECT* clip_rect); diff --git a/core/fpdfdoc/cpdf_defaultappearance.cpp b/core/fpdfdoc/cpdf_defaultappearance.cpp index e1094604fa..130115bdfb 100644 --- a/core/fpdfdoc/cpdf_defaultappearance.cpp +++ b/core/fpdfdoc/cpdf_defaultappearance.cpp @@ -10,9 +10,9 @@ #include "core/fpdfapi/parser/fpdf_parser_decode.h" #include "core/fpdfdoc/cpdf_formcontrol.h" -FX_BOOL CPDF_DefaultAppearance::HasFont() { +bool CPDF_DefaultAppearance::HasFont() { if (m_csDA.IsEmpty()) - return FALSE; + return false; CPDF_SimpleParser syntax(m_csDA.AsStringC()); return syntax.FindTagParamFromStart("Tf", 2); @@ -50,18 +50,18 @@ void CPDF_DefaultAppearance::GetFont(CFX_ByteString& csFontNameTag, csFontNameTag = PDF_NameDecode(csFontNameTag); } -FX_BOOL CPDF_DefaultAppearance::HasColor(PaintOperation nOperation) { +bool CPDF_DefaultAppearance::HasColor(PaintOperation nOperation) { if (m_csDA.IsEmpty()) - return FALSE; + return false; CPDF_SimpleParser syntax(m_csDA.AsStringC()); if (syntax.FindTagParamFromStart( (nOperation == PaintOperation::STROKE ? "G" : "g"), 1)) { - return TRUE; + return true; } if (syntax.FindTagParamFromStart( (nOperation == PaintOperation::STROKE ? "RG" : "rg"), 3)) { - return TRUE; + return true; } return syntax.FindTagParamFromStart( (nOperation == PaintOperation::STROKE ? "K" : "k"), 4); @@ -182,9 +182,9 @@ void CPDF_DefaultAppearance::GetColor(FX_ARGB& color, } } -FX_BOOL CPDF_DefaultAppearance::HasTextMatrix() { +bool CPDF_DefaultAppearance::HasTextMatrix() { if (m_csDA.IsEmpty()) - return FALSE; + return false; CPDF_SimpleParser syntax(m_csDA.AsStringC()); return syntax.FindTagParamFromStart("Tm", 6); diff --git a/core/fpdfdoc/cpdf_defaultappearance.h b/core/fpdfdoc/cpdf_defaultappearance.h index 4507f4f78f..4fd32ebd0c 100644 --- a/core/fpdfdoc/cpdf_defaultappearance.h +++ b/core/fpdfdoc/cpdf_defaultappearance.h @@ -27,11 +27,11 @@ class CPDF_DefaultAppearance { CFX_ByteString GetStr() const { return m_csDA; } - FX_BOOL HasFont(); + bool HasFont(); CFX_ByteString GetFontString(); void GetFont(CFX_ByteString& csFontNameTag, FX_FLOAT& fFontSize); - FX_BOOL HasColor(PaintOperation nOperation = PaintOperation::FILL); + bool HasColor(PaintOperation nOperation = PaintOperation::FILL); CFX_ByteString GetColorString( PaintOperation nOperation = PaintOperation::FILL); void GetColor(int& iColorType, @@ -41,7 +41,7 @@ class CPDF_DefaultAppearance { int& iColorType, PaintOperation nOperation = PaintOperation::FILL); - FX_BOOL HasTextMatrix(); + bool HasTextMatrix(); CFX_ByteString GetTextMatrixString(); CFX_Matrix GetTextMatrix(); diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp index d0b4a2dced..b01784b8dd 100644 --- a/core/fpdfdoc/cpdf_formcontrol.cpp +++ b/core/fpdfdoc/cpdf_formcontrol.cpp @@ -138,14 +138,14 @@ bool CPDF_FormControl::IsDefaultChecked() const { GetType() == CPDF_FormField::RadioButton); CPDF_Object* pDV = FPDF_GetFieldAttr(m_pField->m_pDict, "DV"); if (!pDV) - 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(); diff --git a/core/fpdfdoc/cpdf_formcontrol.h b/core/fpdfdoc/cpdf_formcontrol.h index e86443402d..d24dd04941 100644 --- a/core/fpdfdoc/cpdf_formcontrol.h +++ b/core/fpdfdoc/cpdf_formcontrol.h @@ -115,7 +115,7 @@ class CPDF_FormControl { CFX_ByteString GetOnStateName() const; void SetOnStateName(const CFX_ByteString& csOn); - void CheckControl(FX_BOOL bChecked); + void CheckControl(bool bChecked); FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry); FX_FLOAT GetOriginalColor(int index, const CFX_ByteString& csEntry); void GetOriginalColor(int& iColorType, diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp index dc45fbcec7..e82ef7800e 100644 --- a/core/fpdfdoc/cpdf_formfield.cpp +++ b/core/fpdfdoc/cpdf_formfield.cpp @@ -161,7 +161,7 @@ CFX_WideString CPDF_FormField::GetFullName() const { return FPDF_GetFullName(m_pDict); } -FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) { +bool CPDF_FormField::ResetField(bool bNotify) { switch (m_Type) { case CPDF_FormField::CheckBox: case CPDF_FormField::RadioButton: { @@ -171,10 +171,10 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) { // unison field. Otherwise, merge these branches. if (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++) - CheckControl(i, GetControl(i)->IsDefaultChecked(), FALSE); + CheckControl(i, GetControl(i)->IsDefaultChecked(), false); } } if (bNotify && m_pForm->m_pFormNotify) @@ -190,9 +190,9 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) { csValue = GetOptionLabel(iIndex); if (bNotify && !NotifyListOrComboBoxBeforeChange(csValue)) - return FALSE; + return false; - SetItemSelection(iIndex, TRUE); + SetItemSelection(iIndex, true); if (bNotify) NotifyListOrComboBoxAfterChange(); break; @@ -213,15 +213,15 @@ 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 && !NotifyBeforeValueChange(csDValue)) - return FALSE; + return false; if (pDV) { CPDF_Object* pClone = pDV->Clone(); if (!pClone) - return FALSE; + return false; m_pDict->SetFor("V", pClone); if (pRV) { @@ -237,7 +237,7 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) { break; } } - return TRUE; + return true; } int CPDF_FormField::GetControlIndex(const CPDF_FormControl* pControl) const { @@ -305,7 +305,7 @@ CFX_WideString CPDF_FormField::GetRichTextString() const { return pObj ? pObj->GetUnicodeText() : L""; } -CFX_WideString CPDF_FormField::GetValue(FX_BOOL bDefault) const { +CFX_WideString CPDF_FormField::GetValue(bool bDefault) const { if (GetType() == CheckBox || GetType() == RadioButton) return GetCheckValue(bDefault); @@ -337,21 +337,21 @@ CFX_WideString CPDF_FormField::GetValue(FX_BOOL bDefault) const { } CFX_WideString CPDF_FormField::GetValue() const { - return GetValue(FALSE); + return GetValue(false); } CFX_WideString CPDF_FormField::GetDefaultValue() const { - 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: @@ -359,7 +359,7 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, case ComboBox: { CFX_WideString csValue = value; if (bNotify && !NotifyBeforeValueChange(csValue)) - return FALSE; + return false; int iIndex = FindOptionValue(csValue); if (iIndex < 0) { @@ -372,7 +372,7 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, m_pDict->SetStringFor(bDefault ? "DV" : "V", PDF_EncodeText(csValue)); if (!bDefault) { ClearSelection(); - SetItemSelection(iIndex, TRUE); + SetItemSelection(iIndex, true); } } if (bNotify) @@ -382,17 +382,17 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, case ListBox: { int iIndex = FindOptionValue(value); if (iIndex < 0) - return FALSE; + return false; if (bDefault && iIndex == GetDefaultSelectedItem()) - return FALSE; + return false; if (bNotify && !NotifyBeforeSelectionChange(value)) - return FALSE; + return false; if (!bDefault) { ClearSelection(); - SetItemSelection(iIndex, TRUE); + SetItemSelection(iIndex, true); } if (bNotify) NotifyAfterSelectionChange(); @@ -401,11 +401,11 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, default: break; } - return TRUE; + return true; } -FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, FX_BOOL bNotify) { - return SetValue(value, FALSE, bNotify); +bool CPDF_FormField::SetValue(const CFX_WideString& value, bool bNotify) { + return SetValue(value, false, bNotify); } int CPDF_FormField::GetMaxLen() const { @@ -476,7 +476,7 @@ int CPDF_FormField::GetSelectedIndex(int index) const { return -1; } -FX_BOOL CPDF_FormField::ClearSelection(FX_BOOL bNotify) { +bool CPDF_FormField::ClearSelection(bool bNotify) { if (bNotify && m_pForm->m_pFormNotify) { CFX_WideString csValue; int iIndex = GetSelectedIndex(0); @@ -484,28 +484,28 @@ FX_BOOL CPDF_FormField::ClearSelection(FX_BOOL bNotify) { csValue = GetOptionLabel(iIndex); if (!NotifyListOrComboBoxBeforeChange(csValue)) - return FALSE; + return false; } m_pDict->RemoveFor("V"); m_pDict->RemoveFor("I"); if (bNotify) NotifyListOrComboBoxAfterChange(); - return TRUE; + return true; } -FX_BOOL CPDF_FormField::IsItemSelected(int index) const { +bool CPDF_FormField::IsItemSelected(int index) const { 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) { pValue = FPDF_GetFieldAttr(m_pDict, "I"); if (!pValue) - return FALSE; + return false; } if (pValue->IsString()) @@ -513,13 +513,13 @@ FX_BOOL CPDF_FormField::IsItemSelected(int index) const { if (pValue->IsNumber()) { if (pValue->GetString().IsEmpty()) - return FALSE; + return false; return (pValue->GetInteger() == index); } CPDF_Array* pArray = pValue->AsArray(); if (!pArray) - return FALSE; + return false; int iPos = -1; for (int j = 0; j < CountSelectedOptions(); j++) { @@ -531,25 +531,23 @@ FX_BOOL CPDF_FormField::IsItemSelected(int index) const { for (int i = 0; i < static_cast(pArray->GetCount()); i++) if (pArray->GetDirectObjectAt(i)->GetUnicodeText() == opt_value && 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 && !NotifyListOrComboBoxBeforeChange(opt_value)) - return FALSE; + return false; if (bSelected) { if (GetType() == ListBox) { - SelectOption(index, TRUE); + SelectOption(index, true); if (!(m_Flags & kFormListMultiSelect)) { m_pDict->SetStringFor("V", PDF_EncodeText(opt_value)); } else { @@ -572,7 +570,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index, CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V"); if (pValue) { if (GetType() == ListBox) { - SelectOption(index, FALSE); + SelectOption(index, false); if (pValue->IsString()) { if (pValue->GetUnicodeText() == opt_value) m_pDict->RemoveFor("V"); @@ -596,13 +594,13 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index, } if (bNotify) NotifyListOrComboBoxAfterChange(); - return TRUE; + return true; } -FX_BOOL CPDF_FormField::IsItemDefaultSelected(int index) const { +bool CPDF_FormField::IsItemDefaultSelected(int index) const { ASSERT(GetType() == ComboBox || GetType() == ListBox); if (index < 0 || index >= CountOptions()) - return FALSE; + return false; int iDVIndex = GetDefaultSelectedItem(); return iDVIndex >= 0 && iDVIndex == index; } @@ -669,7 +667,7 @@ int CPDF_FormField::FindOptionValue(const CFX_WideString& csOptValue) const { #ifdef PDF_ENABLE_XFA int CPDF_FormField::InsertOption(CFX_WideString csOptLabel, int index, - FX_BOOL bNotify) { + bool bNotify) { if (csOptLabel.IsEmpty()) return -1; @@ -690,7 +688,7 @@ int CPDF_FormField::InsertOption(CFX_WideString csOptLabel, pOpt->AddString(csStr); index = iCount; } else { - CPDF_String* pString = new CPDF_String(csStr, FALSE); + CPDF_String* pString = new CPDF_String(csStr, false); pOpt->InsertAt(index, pString); } @@ -699,14 +697,14 @@ int CPDF_FormField::InsertOption(CFX_WideString csOptLabel, return index; } -FX_BOOL CPDF_FormField::ClearOptions(FX_BOOL bNotify) { +bool CPDF_FormField::ClearOptions(bool bNotify) { if (bNotify && m_pForm->m_pFormNotify) { CFX_WideString csValue; int iIndex = GetSelectedIndex(0); if (iIndex >= 0) csValue = GetOptionLabel(iIndex); if (!NotifyListOrComboBoxBeforeChange(csValue)) - return FALSE; + return false; } m_pDict->RemoveFor("Opt"); @@ -718,19 +716,19 @@ FX_BOOL CPDF_FormField::ClearOptions(FX_BOOL bNotify) { if (bNotify) NotifyListOrComboBoxAfterChange(); - return TRUE; + return true; } #endif // PDF_ENABLE_XFA -FX_BOOL CPDF_FormField::CheckControl(int iControlIndex, - bool bChecked, - bool bNotify) { +bool CPDF_FormField::CheckControl(int iControlIndex, + bool bChecked, + bool bNotify) { ASSERT(GetType() == CheckBox || GetType() == RadioButton); CPDF_FormControl* pControl = GetControl(iControlIndex); if (!pControl) - return FALSE; + return false; if (!bChecked && pControl->IsChecked() == bChecked) - return FALSE; + return false; CFX_WideString csWExport = pControl->GetExportValue(); CFX_ByteString csBExport = PDF_EncodeText(csWExport); @@ -744,15 +742,15 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex, 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); } } @@ -775,16 +773,16 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex, } if (bNotify && m_pForm->m_pFormNotify) m_pForm->m_pFormNotify->AfterCheckedStatusChange(this); - return TRUE; + return true; } -CFX_WideString CPDF_FormField::GetCheckValue(FX_BOOL bDefault) const { +CFX_WideString CPDF_FormField::GetCheckValue(bool bDefault) const { ASSERT(GetType() == CheckBox || GetType() == RadioButton); CFX_WideString csExport = L"Off"; int iCount = CountControls(); for (int i = 0; i < iCount; i++) { CPDF_FormControl* pControl = GetControl(i); - FX_BOOL bChecked = + bool bChecked = bDefault ? pControl->IsDefaultChecked() : pControl->IsChecked(); if (bChecked) { csExport = pControl->GetExportValue(); @@ -794,9 +792,9 @@ CFX_WideString CPDF_FormField::GetCheckValue(FX_BOOL bDefault) const { 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); int iCount = CountControls(); for (int i = 0; i < iCount; i++) { @@ -810,7 +808,7 @@ FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value, } if (bNotify && m_pForm->m_pFormNotify) m_pForm->m_pFormNotify->AfterCheckedStatusChange(this); - return TRUE; + return true; } int CPDF_FormField::GetTopVisibleIndex() const { @@ -834,44 +832,42 @@ int CPDF_FormField::GetSelectedOptionIndex(int index) const { return pArray->GetIntegerAt(index); } -FX_BOOL CPDF_FormField::IsOptionSelected(int iOptIndex) const { +bool CPDF_FormField::IsOptionSelected(int iOptIndex) const { CPDF_Array* pArray = ToArray(FPDF_GetFieldAttr(m_pDict, "I")); if (!pArray) - return FALSE; + return false; for (CPDF_Object* pObj : *pArray) { if (pObj->GetInteger() == 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->GetArrayFor("I"); if (!pArray) { if (!bSelected) - return TRUE; + return true; pArray = new CPDF_Array; m_pDict->SetFor("I", pArray); } - FX_BOOL bReturn = FALSE; + bool bReturn = false; for (size_t i = 0; i < pArray->GetCount(); i++) { int iFind = pArray->GetIntegerAt(i); if (iFind == iOptIndex) { if (bSelected) - return TRUE; + return true; if (bNotify && m_pForm->m_pFormNotify) { CFX_WideString csValue = GetOptionLabel(iOptIndex); if (!NotifyListOrComboBoxBeforeChange(csValue)) - return FALSE; + return false; } pArray->RemoveAt(i); - bReturn = TRUE; + bReturn = true; break; } @@ -882,10 +878,10 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, if (bNotify && m_pForm->m_pFormNotify) { CFX_WideString csValue = GetOptionLabel(iOptIndex); if (!NotifyListOrComboBoxBeforeChange(csValue)) - return FALSE; + return false; } pArray->InsertAt(i, new CPDF_Number(iOptIndex)); - bReturn = TRUE; + bReturn = true; break; } } @@ -899,10 +895,10 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, if (bNotify) NotifyListOrComboBoxAfterChange(); - return TRUE; + return true; } -FX_BOOL CPDF_FormField::ClearSelectedOptions(FX_BOOL bNotify) { +bool CPDF_FormField::ClearSelectedOptions(bool bNotify) { if (bNotify && m_pForm->m_pFormNotify) { CFX_WideString csValue; int iIndex = GetSelectedIndex(0); @@ -910,13 +906,13 @@ FX_BOOL CPDF_FormField::ClearSelectedOptions(FX_BOOL bNotify) { csValue = GetOptionLabel(iIndex); if (!NotifyListOrComboBoxBeforeChange(csValue)) - return FALSE; + return false; } m_pDict->RemoveFor("I"); if (bNotify) NotifyListOrComboBoxAfterChange(); - return TRUE; + return true; } void CPDF_FormField::LoadDA() { diff --git a/core/fpdfdoc/cpdf_formfield.h b/core/fpdfdoc/cpdf_formfield.h index abdd6f78b9..37f17c3a8a 100644 --- a/core/fpdfdoc/cpdf_formfield.h +++ b/core/fpdfdoc/cpdf_formfield.h @@ -56,7 +56,7 @@ class CPDF_FormField { CPDF_Dictionary* GetFieldDict() const { return m_pDict; } void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; } - FX_BOOL ResetField(FX_BOOL bNotify = FALSE); + bool ResetField(bool bNotify = false); int CountControls() const { return m_ControlList.GetSize(); } @@ -77,19 +77,17 @@ class CPDF_FormField { CFX_WideString GetValue() const; CFX_WideString GetDefaultValue() const; - FX_BOOL SetValue(const CFX_WideString& value, FX_BOOL bNotify = FALSE); + bool SetValue(const CFX_WideString& value, bool bNotify = false); int GetMaxLen() const; int CountSelectedItems() const; int GetSelectedIndex(int index) const; - FX_BOOL ClearSelection(FX_BOOL bNotify = FALSE); - FX_BOOL IsItemSelected(int index) const; - FX_BOOL SetItemSelection(int index, - FX_BOOL bSelected, - FX_BOOL bNotify = FALSE); + bool ClearSelection(bool bNotify = false); + bool IsItemSelected(int index) const; + bool SetItemSelection(int index, bool bSelected, bool bNotify = false); - FX_BOOL IsItemDefaultSelected(int index) const; + bool IsItemDefaultSelected(int index) const; int GetDefaultSelectedItem() const; int CountOptions() const; @@ -100,26 +98,24 @@ class CPDF_FormField { int FindOption(CFX_WideString csOptLabel) const; int FindOptionValue(const CFX_WideString& csOptValue) const; - FX_BOOL CheckControl(int iControlIndex, bool bChecked, bool bNotify = false); + bool CheckControl(int iControlIndex, bool bChecked, bool bNotify = false); int GetTopVisibleIndex() const; int CountSelectedOptions() const; int GetSelectedOptionIndex(int index) const; - FX_BOOL IsOptionSelected(int iOptIndex) const; + bool IsOptionSelected(int iOptIndex) const; - FX_BOOL SelectOption(int iOptIndex, - FX_BOOL bSelected, - FX_BOOL bNotify = FALSE); + bool SelectOption(int iOptIndex, bool bSelected, bool bNotify = false); - FX_BOOL ClearSelectedOptions(FX_BOOL bNotify = FALSE); + bool ClearSelectedOptions(bool bNotify = false); #ifdef PDF_ENABLE_XFA - FX_BOOL ClearOptions(FX_BOOL bNotify = FALSE); + bool ClearOptions(bool bNotify = false); int InsertOption(CFX_WideString csOptLabel, int index = -1, - FX_BOOL bNotify = FALSE); + bool bNotify = false); #endif // PDF_ENABLE_XFA FX_FLOAT GetFontSize() const { return m_FontSize; } @@ -132,20 +128,16 @@ class CPDF_FormField { CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict); ~CPDF_FormField(); - CFX_WideString GetValue(FX_BOOL bDefault) const; - FX_BOOL SetValue(const CFX_WideString& value, - FX_BOOL bDefault, - FX_BOOL bNotify); + CFX_WideString GetValue(bool bDefault) const; + bool SetValue(const CFX_WideString& value, bool bDefault, bool bNotify); void SyncFieldFlags(); int FindListSel(CPDF_String* str); CFX_WideString GetOptionText(int index, int sub_index) const; void LoadDA(); - CFX_WideString GetCheckValue(FX_BOOL bDefault) const; - FX_BOOL SetCheckValue(const CFX_WideString& value, - FX_BOOL bDefault, - FX_BOOL bNotify); + CFX_WideString GetCheckValue(bool bDefault) const; + bool SetCheckValue(const CFX_WideString& value, bool bDefault, bool bNotify); bool NotifyBeforeSelectionChange(const CFX_WideString& value); void NotifyAfterSelectionChange(); diff --git a/core/fpdfdoc/cpdf_iconfit.cpp b/core/fpdfdoc/cpdf_iconfit.cpp index 7834710588..aedb785912 100644 --- a/core/fpdfdoc/cpdf_iconfit.cpp +++ b/core/fpdfdoc/cpdf_iconfit.cpp @@ -24,8 +24,8 @@ CPDF_IconFit::ScaleMethod CPDF_IconFit::GetScaleMethod() { return Always; } -FX_BOOL CPDF_IconFit::IsProportionalScale() { - return m_pDict ? m_pDict->GetStringFor("S", "P") != "A" : TRUE; +bool CPDF_IconFit::IsProportionalScale() { + return m_pDict ? m_pDict->GetStringFor("S", "P") != "A" : true; } void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { diff --git a/core/fpdfdoc/cpdf_iconfit.h b/core/fpdfdoc/cpdf_iconfit.h index 1ef023ab5f..37df48d43e 100644 --- a/core/fpdfdoc/cpdf_iconfit.h +++ b/core/fpdfdoc/cpdf_iconfit.h @@ -18,7 +18,7 @@ class CPDF_IconFit { explicit CPDF_IconFit(const CPDF_Dictionary* pDict) : m_pDict(pDict) {} ScaleMethod GetScaleMethod(); - FX_BOOL IsProportionalScale(); + bool IsProportionalScale(); void GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom); bool GetFittingBounds(); const CPDF_Dictionary* GetDict() const { return m_pDict; } diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp index b8b4b68e29..f709c57961 100644 --- a/core/fpdfdoc/cpdf_interform.cpp +++ b/core/fpdfdoc/cpdf_interform.cpp @@ -163,19 +163,19 @@ CPDF_Font* GetNativeFont(CPDF_Dictionary* pFormDict, return nullptr; } -FX_BOOL FindFont(CPDF_Dictionary* pFormDict, - const CPDF_Font* pFont, - CFX_ByteString& csNameTag) { +bool FindFont(CPDF_Dictionary* pFormDict, + const CPDF_Font* pFont, + CFX_ByteString& csNameTag) { if (!pFormDict || !pFont) - return FALSE; + return false; CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR"); if (!pDR) - return FALSE; + return false; CPDF_Dictionary* pFonts = pDR->GetDictFor("Font"); if (!pFonts) - return FALSE; + return false; for (const auto& it : *pFonts) { const CFX_ByteString& csKey = it.first; @@ -190,27 +190,27 @@ FX_BOOL FindFont(CPDF_Dictionary* pFormDict, continue; if (pFont->GetFontDict() == pElement) { csNameTag = csKey; - return TRUE; + return true; } } - return FALSE; + return false; } -FX_BOOL FindFont(CPDF_Dictionary* pFormDict, - CPDF_Document* pDocument, - CFX_ByteString csFontName, - CPDF_Font*& pFont, - CFX_ByteString& csNameTag) { +bool FindFont(CPDF_Dictionary* pFormDict, + CPDF_Document* pDocument, + CFX_ByteString csFontName, + CPDF_Font*& pFont, + CFX_ByteString& csNameTag) { if (!pFormDict) - return FALSE; + return false; CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR"); if (!pDR) - return FALSE; + return false; CPDF_Dictionary* pFonts = pDR->GetDictFor("Font"); if (!pFonts) - return FALSE; + return false; if (csFontName.GetLength() > 0) csFontName.Remove(' '); @@ -235,10 +235,10 @@ FX_BOOL FindFont(CPDF_Dictionary* pFormDict, csBaseFont.Remove(' '); if (csBaseFont == csFontName) { csNameTag = csKey; - return TRUE; + return true; } } - return FALSE; + return false; } void AddFont(CPDF_Dictionary*& pFormDict, @@ -329,7 +329,7 @@ class CFieldNameExtractor { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ typedef struct { - FX_BOOL bFind; + bool bFind; LOGFONTA lf; } PDF_FONTDATA; @@ -342,11 +342,11 @@ static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEXA* lpelfe, PDF_FONTDATA* pData = (PDF_FONTDATA*)lParam; memcpy(&pData->lf, &lpelfe->elfLogFont, sizeof(LOGFONTA)); - pData->bFind = TRUE; + pData->bFind = true; return 0; } -FX_BOOL RetrieveSpecificFont(LOGFONTA& lf) { +bool RetrieveSpecificFont(LOGFONTA& lf) { PDF_FONTDATA fd; memset(&fd, 0, sizeof(PDF_FONTDATA)); HDC hDC = ::GetDC(nullptr); @@ -359,10 +359,10 @@ FX_BOOL RetrieveSpecificFont(LOGFONTA& lf) { return fd.bFind; } -FX_BOOL RetrieveSpecificFont(uint8_t charSet, - uint8_t pitchAndFamily, - LPCSTR pcsFontName, - LOGFONTA& lf) { +bool RetrieveSpecificFont(uint8_t charSet, + uint8_t pitchAndFamily, + LPCSTR pcsFontName, + LOGFONTA& lf) { memset(&lf, 0, sizeof(LOGFONTA)); lf.lfCharSet = charSet; lf.lfPitchAndFamily = pitchAndFamily; @@ -730,7 +730,7 @@ CFX_ByteString CPDF_InterForm::GenerateNewResourceName( int num = 0; CFX_ByteString bsNum; - while (TRUE) { + while (true) { CFX_ByteString csKey = csTmp + bsNum; if (!pDict->KeyExist(csKey)) return csKey; @@ -764,7 +764,7 @@ CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) { csFontName = "Helvetica"; return csFontName; } - FX_BOOL bRet = FALSE; + bool bRet = false; if (charSet == FXFONT_SHIFTJIS_CHARSET) { bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, "MS Mincho", lf); @@ -809,7 +809,7 @@ CPDF_Font* CPDF_InterForm::AddNativeFont(uint8_t charSet, if (!csFontName.IsEmpty()) { if (csFontName == "Helvetica") return AddStandardFont(pDocument, csFontName); - return pDocument->AddWindowsFont(&lf, FALSE, TRUE); + return pDocument->AddWindowsFont(&lf, false, true); } #endif return nullptr; @@ -940,7 +940,7 @@ CPDF_FormControl* CPDF_InterForm::GetControlByDict( return it != m_ControlMap.end() ? it->second : nullptr; } -FX_BOOL CPDF_InterForm::NeedConstructAP() const { +bool CPDF_InterForm::NeedConstructAP() const { return m_pFormDict && m_pFormDict->GetBooleanFor("NeedAppearances"); } @@ -1061,7 +1061,7 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) { } } -FX_BOOL CPDF_InterForm::HasXFAForm() const { +bool CPDF_InterForm::HasXFAForm() const { return m_pFormDict && m_pFormDict->GetArrayFor("XFA"); } @@ -1241,7 +1241,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF( pFieldDict->SetFor("T", new CPDF_String(fullname)); 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) @@ -1261,7 +1261,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF( void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict, const CFX_WideString& parent_name, - FX_BOOL bNotify, + bool bNotify, int nLevel) { CFX_WideString name; if (!parent_name.IsEmpty()) diff --git a/core/fpdfdoc/cpdf_interform.h b/core/fpdfdoc/cpdf_interform.h index fef4ae2bc4..fbff0289a1 100644 --- a/core/fpdfdoc/cpdf_interform.h +++ b/core/fpdfdoc/cpdf_interform.h @@ -60,7 +60,7 @@ class CPDF_InterForm { int* z_order) const; CPDF_FormControl* GetControlByDict(const CPDF_Dictionary* pWidgetDict) const; - FX_BOOL NeedConstructAP() const; + bool NeedConstructAP() const; int CountFieldsInCalculationOrder(); CPDF_FormField* GetFieldInCalculationOrder(int index); int FindFieldInCalculationOrder(const CPDF_FormField* pField); @@ -86,7 +86,7 @@ class CPDF_InterForm { bool ResetForm(bool bNotify); void SetFormNotify(IPDF_FormNotify* pNotify); - FX_BOOL HasXFAForm() const; + bool HasXFAForm() const; void FixPageFields(const CPDF_Page* pPage); private: @@ -99,7 +99,7 @@ class CPDF_InterForm { CPDF_Dictionary* pWidgetDict); void FDF_ImportField(CPDF_Dictionary* pField, const CFX_WideString& parent_name, - FX_BOOL bNotify = FALSE, + bool bNotify = false, int nLevel = 0); bool ValidateFieldName(CFX_WideString& csNewFieldName, int iType, diff --git a/core/fpdfdoc/cpdf_metadata.cpp b/core/fpdfdoc/cpdf_metadata.cpp index 226194682c..bdb70c0166 100644 --- a/core/fpdfdoc/cpdf_metadata.cpp +++ b/core/fpdfdoc/cpdf_metadata.cpp @@ -21,7 +21,7 @@ CPDF_Metadata::CPDF_Metadata(CPDF_Document* pDoc) { return; CPDF_StreamAcc acc; - acc.LoadAllData(pStream, FALSE); + acc.LoadAllData(pStream, false); m_pXmlElement.reset(CXML_Element::Parse(acc.GetData(), acc.GetSize())); } diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp index 75454f67ff..5fe8c0137e 100644 --- a/core/fpdfdoc/cpdf_variabletext.cpp +++ b/core/fpdfdoc/cpdf_variabletext.cpp @@ -69,7 +69,7 @@ int32_t CPDF_VariableText::Provider::GetWordFontIndex(uint16_t word, return -1; } -FX_BOOL CPDF_VariableText::Provider::IsLatinWord(uint16_t word) { +bool CPDF_VariableText::Provider::IsLatinWord(uint16_t word) { return (word >= 0x61 && word <= 0x7A) || (word >= 0x41 && word <= 0x5A) || word == 0x2D || word == 0x27; } @@ -92,74 +92,74 @@ void CPDF_VariableText::Iterator::SetAt(const CPVT_WordPlace& place) { 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); 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 { word.WordPlace = m_CurPos; if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { if (pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) { @@ -178,26 +178,26 @@ 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) { if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { if (CPVT_WordInfo* pWord = pSection->m_WordArray.GetAt(m_CurPos.nWordIndex)) { 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); line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1); if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { @@ -209,13 +209,13 @@ 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 { section.secplace = CPVT_WordPlace(m_CurPos.nSecIndex, 0, -1); if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { section.rcSection = m_pVT->InToOut(pSection->m_SecInfo.rcSection); @@ -223,35 +223,35 @@ FX_BOOL CPDF_VariableText::Iterator::GetSection(CPVT_Section& section) const { section.SecProps = *pSection->m_SecInfo.pSecProps; 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) { if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { if (pSection->m_SecInfo.pSecProps) *pSection->m_SecInfo.pSecProps = section.SecProps; if (pSection->m_SecInfo.pWordProps) *pSection->m_SecInfo.pWordProps = section.WordProps; - return TRUE; + return true; } - return FALSE; + return false; } 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_bInitial(false), m_pVTProvider(nullptr) {} CPDF_VariableText::~CPDF_VariableText() { @@ -272,12 +272,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(); } @@ -372,7 +372,7 @@ CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace& place, 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()); @@ -386,11 +386,11 @@ CPVT_WordPlace CPDF_VariableText::DeleteWords( } CPVT_WordPlace CPDF_VariableText::DeleteWord(const CPVT_WordPlace& place) { - return ClearRightWord(AdjustLineHeader(place, TRUE)); + return ClearRightWord(AdjustLineHeader(place, true)); } CPVT_WordPlace CPDF_VariableText::BackSpaceWord(const CPVT_WordPlace& place) { - return ClearLeftWord(AdjustLineHeader(place, TRUE)); + return ClearLeftWord(AdjustLineHeader(place, true)); } void CPDF_VariableText::SetText(const CFX_WideString& swText) { @@ -447,7 +447,7 @@ void CPDF_VariableText::UpdateWordPlace(CPVT_WordPlace& place) const { if (place.nSecIndex >= m_SectionArray.GetSize()) place = GetEndWordPlace(); - place = AdjustLineHeader(place, TRUE); + place = AdjustLineHeader(place, true); if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) pSection->UpdateWordPlace(place); } @@ -475,19 +475,19 @@ int32_t CPDF_VariableText::WordPlaceToWordIndex( 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) @@ -551,15 +551,15 @@ CPVT_WordPlace CPDF_VariableText::SearchWordPlace( 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; @@ -712,46 +712,46 @@ CPVT_WordPlace CPDF_VariableText::AddWord(const CPVT_WordPlace& place, 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; } void CPDF_VariableText::SetPlateRect(const CFX_FloatRect& rect) { @@ -854,7 +854,7 @@ int32_t CPDF_VariableText::GetHorzScale(const CPVT_WordInfo& WordInfo) { } void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace& place) { - CPVT_WordPlace wordplace = AdjustLineHeader(place, TRUE); + CPVT_WordPlace wordplace = AdjustLineHeader(place, true); if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) { for (int32_t w = pSection->m_WordArray.GetSize() - 1; w > wordplace.nWordIndex; w--) { @@ -865,23 +865,23 @@ void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace& place) { } CPVT_WordPlace CPDF_VariableText::AdjustLineHeader(const CPVT_WordPlace& place, - FX_BOOL bPrevOrNext) const { + 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) { @@ -894,7 +894,7 @@ void CPDF_VariableText::ClearEmptySections(const CPVT_WordRange& PlaceRange) { } void CPDF_VariableText::LinkLatterSection(const CPVT_WordPlace& place) { - CPVT_WordPlace oldplace = AdjustLineHeader(place, TRUE); + CPVT_WordPlace oldplace = AdjustLineHeader(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; @@ -912,8 +912,8 @@ void CPDF_VariableText::LinkLatterSection(const CPVT_WordPlace& place) { void CPDF_VariableText::ClearWords(const CPVT_WordRange& PlaceRange) { CPVT_WordRange NewRange; - NewRange.BeginPos = AdjustLineHeader(PlaceRange.BeginPos, TRUE); - NewRange.EndPos = AdjustLineHeader(PlaceRange.EndPos, TRUE); + NewRange.BeginPos = AdjustLineHeader(PlaceRange.BeginPos, true); + NewRange.EndPos = AdjustLineHeader(PlaceRange.EndPos, true); for (int32_t s = NewRange.EndPos.nSecIndex; s >= NewRange.BeginPos.nSecIndex; s--) { if (CSection* pSection = m_SectionArray.GetAt(s)) @@ -942,7 +942,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 = - AdjustLineHeader(GetNextWordPlace(place), FALSE); + AdjustLineHeader(GetNextWordPlace(place), false); if (rightplace != place) { if (rightplace.nSecIndex != place.nSecIndex) LinkLatterSection(place); @@ -1088,8 +1088,8 @@ int32_t CPDF_VariableText::GetDefaultFontIndex() { return m_pVTProvider ? m_pVTProvider->GetDefaultFontIndex() : -1; } -FX_BOOL CPDF_VariableText::IsLatinWord(uint16_t word) { - return m_pVTProvider ? m_pVTProvider->IsLatinWord(word) : FALSE; +bool CPDF_VariableText::IsLatinWord(uint16_t word) { + return m_pVTProvider ? m_pVTProvider->IsLatinWord(word) : false; } CPDF_VariableText::Iterator* CPDF_VariableText::GetIterator() { diff --git a/core/fpdfdoc/cpdf_variabletext.h b/core/fpdfdoc/cpdf_variabletext.h index 21edc35b5b..5983a2978b 100644 --- a/core/fpdfdoc/cpdf_variabletext.h +++ b/core/fpdfdoc/cpdf_variabletext.h @@ -41,17 +41,17 @@ class CPDF_VariableText { explicit Iterator(CPDF_VariableText* pVT); ~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 { return m_CurPos; } @@ -72,7 +72,7 @@ class CPDF_VariableText { virtual int32_t GetWordFontIndex(uint16_t word, int32_t charset, int32_t nFontIndex); - virtual FX_BOOL IsLatinWord(uint16_t word); + virtual bool IsLatinWord(uint16_t word); virtual int32_t GetDefaultFontIndex(); private: @@ -94,14 +94,14 @@ class CPDF_VariableText { void SetPasswordChar(uint16_t wSubWord) { m_wSubWord = wSubWord; } void SetLimitChar(int32_t nLimitChar) { m_nLimitChar = nLimitChar; } void SetCharSpace(FX_FLOAT fCharSpace) { m_fCharSpace = fCharSpace; } - void SetMultiLine(FX_BOOL bMultiLine) { m_bMultiLine = bMultiLine; } - void SetAutoReturn(FX_BOOL bAuto) { m_bLimitWidth = bAuto; } + void SetMultiLine(bool bMultiLine) { m_bMultiLine = bMultiLine; } + void SetAutoReturn(bool bAuto) { m_bLimitWidth = bAuto; } void SetFontSize(FX_FLOAT fFontSize) { m_fFontSize = fFontSize; } void SetCharArray(int32_t nCharArray) { m_nCharArray = nCharArray; } - void SetAutoFontSize(FX_BOOL bAuto) { m_bAutoFontSize = bAuto; } + void SetAutoFontSize(bool bAuto) { m_bAutoFontSize = bAuto; } void Initialize(); - FX_BOOL IsValid() const { return m_bInitial; } + bool IsValid() const { return m_bInitial; } void RearrangeAll(); void RearrangePart(const CPVT_WordRange& PlaceRange); @@ -125,7 +125,7 @@ class CPDF_VariableText { uint16_t GetPasswordChar() const { return GetSubWord(); } int32_t GetCharArray() const { return m_nCharArray; } int32_t GetLimitChar() const { return m_nLimitChar; } - FX_BOOL IsMultiLine() const { return m_bMultiLine; } + bool IsMultiLine() const { return m_bMultiLine; } int32_t GetHorzScale() const { return m_nHorzScale; } FX_FLOAT GetCharSpace() const { return m_fCharSpace; } CPVT_WordPlace GetBeginWordPlace() const; @@ -143,7 +143,7 @@ class CPDF_VariableText { CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const; void UpdateWordPlace(CPVT_WordPlace& place) const; CPVT_WordPlace AdjustLineHeader(const CPVT_WordPlace& place, - FX_BOOL bPrevOrNext) const; + bool bPrevOrNext) const; int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const; CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; @@ -169,7 +169,7 @@ class CPDF_VariableText { int32_t GetTypeDescent(int32_t nFontIndex); int32_t GetWordFontIndex(uint16_t word, int32_t charset, int32_t nFontIndex); int32_t GetDefaultFontIndex(); - FX_BOOL IsLatinWord(uint16_t word); + bool IsLatinWord(uint16_t word); CPVT_WordPlace AddSection(const CPVT_WordPlace& place, const CPVT_SectionInfo& secinfo); @@ -177,12 +177,10 @@ class CPDF_VariableText { 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); + 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); FX_FLOAT GetWordWidth(int32_t nFontIndex, uint16_t Word, @@ -209,7 +207,7 @@ class CPDF_VariableText { void ClearSectionRightWords(const CPVT_WordPlace& place); - FX_BOOL ClearEmptySection(const CPVT_WordPlace& place); + bool ClearEmptySection(const CPVT_WordPlace& place); void ClearEmptySections(const CPVT_WordRange& PlaceRange); void LinkLatterSection(const CPVT_WordPlace& place); void ClearWords(const CPVT_WordRange& PlaceRange); @@ -226,16 +224,16 @@ class CPDF_VariableText { CPVT_ArrayTemplate 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; int32_t m_nHorzScale; uint16_t m_wSubWord; FX_FLOAT m_fFontSize; - FX_BOOL m_bInitial; + bool m_bInitial; CPDF_VariableText::Provider* m_pVTProvider; std::unique_ptr m_pVTIterator; CFX_FloatRect m_rcPlate; diff --git a/core/fpdfdoc/cpdf_viewerpreferences.cpp b/core/fpdfdoc/cpdf_viewerpreferences.cpp index fb005bef86..799f2d5814 100644 --- a/core/fpdfdoc/cpdf_viewerpreferences.cpp +++ b/core/fpdfdoc/cpdf_viewerpreferences.cpp @@ -13,14 +13,14 @@ CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document* pDoc) CPDF_ViewerPreferences::~CPDF_ViewerPreferences() {} -FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const { +bool CPDF_ViewerPreferences::IsDirectionR2L() const { CPDF_Dictionary* pDict = GetViewerPreferences(); - return pDict ? pDict->GetStringFor("Direction") == "R2L" : FALSE; + return pDict ? pDict->GetStringFor("Direction") == "R2L" : false; } -FX_BOOL CPDF_ViewerPreferences::PrintScaling() const { +bool CPDF_ViewerPreferences::PrintScaling() const { CPDF_Dictionary* pDict = GetViewerPreferences(); - return pDict ? pDict->GetStringFor("PrintScaling") != "None" : TRUE; + return pDict ? pDict->GetStringFor("PrintScaling") != "None" : true; } int32_t CPDF_ViewerPreferences::NumCopies() const { diff --git a/core/fpdfdoc/cpdf_viewerpreferences.h b/core/fpdfdoc/cpdf_viewerpreferences.h index f400c37b97..c64292d9f9 100644 --- a/core/fpdfdoc/cpdf_viewerpreferences.h +++ b/core/fpdfdoc/cpdf_viewerpreferences.h @@ -19,8 +19,8 @@ class CPDF_ViewerPreferences { explicit CPDF_ViewerPreferences(CPDF_Document* pDoc); ~CPDF_ViewerPreferences(); - FX_BOOL IsDirectionR2L() const; - FX_BOOL PrintScaling() const; + bool IsDirectionR2L() const; + bool PrintScaling() const; int32_t NumCopies() const; CPDF_Array* PrintPageRange() const; CFX_ByteString Duplex() const; diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp index 28b436a05c..66abde63a8 100644 --- a/core/fpdfdoc/cpvt_generateap.cpp +++ b/core/fpdfdoc/cpvt_generateap.cpp @@ -215,21 +215,21 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, 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); } uint16_t 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 @@ -281,7 +281,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, rcEdit.Normalize(); vt.SetPlateRect(rcEdit); if (IsFloatZero(fFontSize)) - vt.SetAutoFontSize(TRUE); + vt.SetAutoFontSize(true); else vt.SetFontSize(fFontSize); @@ -292,7 +292,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, CFX_FloatPoint ptOffset = CFX_FloatPoint(0.0f, (rcContent.Height() - rcEdit.Height()) / 2.0f); CFX_ByteString sEdit = CPVT_GenerateAP::GenerateEditAP( - &map, vt.GetIterator(), ptOffset, TRUE, 0); + &map, vt.GetIterator(), ptOffset, true, 0); if (sEdit.GetLength() > 0) { sAppStream << "/Tx BMC\n" << "q\n"; @@ -359,12 +359,12 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, else if (CPDF_Array* pArray = pOpt->AsArray()) swItem = pArray->GetDirectObjectAt(1)->GetUnicodeText(); - FX_BOOL bSelected = FALSE; + bool bSelected = false; if (pSels) { for (size_t s = 0, ssz = pSels->GetCount(); s < ssz; s++) { int value = pSels->GetIntegerAt(s); if (value >= 0 && i == static_cast(value)) { - bSelected = TRUE; + bSelected = true; break; } } @@ -396,7 +396,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, PaintOperation::FILL) << CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(), CFX_FloatPoint(0.0f, fy), - TRUE, 0) + true, 0) << "ET\n"; } else { sBody << "BT\n" @@ -404,7 +404,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, PaintOperation::FILL) << CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(), CFX_FloatPoint(0.0f, fy), - TRUE, 0) + true, 0) << "ET\n"; } fy -= fItemHeight; @@ -515,15 +515,15 @@ CFX_ByteString GetPopupContentsString(CPDF_Document* pDoc, vt.SetProvider(&prd); vt.SetPlateRect(pAnnotDict.GetRectFor("Rect")); vt.SetFontSize(12); - vt.SetAutoReturn(TRUE); - vt.SetMultiLine(TRUE); + vt.SetAutoReturn(true); + vt.SetMultiLine(true); vt.Initialize(); vt.SetText(swValue); vt.RearrangeAll(); CFX_FloatPoint ptOffset(3.0f, -3.0f); CFX_ByteString sContent = CPVT_GenerateAP::GenerateEditAP( - &map, vt.GetIterator(), ptOffset, FALSE, 0); + &map, vt.GetIterator(), ptOffset, false, 0); if (sContent.IsEmpty()) return CFX_ByteString(); @@ -1098,7 +1098,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP( IPVT_FontMap* pFontMap, CPDF_VariableText::Iterator* pIterator, const CFX_FloatPoint& ptOffset, - FX_BOOL bContinuous, + bool bContinuous, uint16_t SubWord) { CFX_ByteTextBuf sEditStream; CFX_ByteTextBuf sLineStream; diff --git a/core/fpdfdoc/cpvt_generateap.h b/core/fpdfdoc/cpvt_generateap.h index 5a52d87250..16c939fe92 100644 --- a/core/fpdfdoc/cpvt_generateap.h +++ b/core/fpdfdoc/cpvt_generateap.h @@ -49,7 +49,7 @@ class CPVT_GenerateAP { static CFX_ByteString GenerateEditAP(IPVT_FontMap* pFontMap, CPDF_VariableText::Iterator* pIterator, const CFX_FloatPoint& ptOffset, - FX_BOOL bContinuous, + bool bContinuous, uint16_t SubWord); static CFX_ByteString GenerateBorderAP(const CFX_FloatRect& rect, FX_FLOAT fWidth, diff --git a/core/fpdfdoc/cpvt_wordplace.h b/core/fpdfdoc/cpvt_wordplace.h index 00b5215d57..f4a6b087b9 100644 --- a/core/fpdfdoc/cpvt_wordplace.h +++ b/core/fpdfdoc/cpvt_wordplace.h @@ -27,7 +27,7 @@ struct CPVT_WordPlace { wp.nWordIndex == nWordIndex; } - FX_BOOL operator!=(const CPVT_WordPlace& wp) const { return !(*this == wp); } + bool operator!=(const CPVT_WordPlace& wp) const { return !(*this == wp); } inline int32_t WordCmp(const CPVT_WordPlace& wp) const { if (nSecIndex > wp.nSecIndex) diff --git a/core/fpdfdoc/cpvt_wordrange.h b/core/fpdfdoc/cpvt_wordrange.h index a92613c6a7..b291e50e53 100644 --- a/core/fpdfdoc/cpvt_wordrange.h +++ b/core/fpdfdoc/cpvt_wordrange.h @@ -38,9 +38,9 @@ struct CPVT_WordRange { SwapWordPlace(); } - FX_BOOL IsExist() const { return BeginPos != EndPos; } + bool IsExist() const { return BeginPos != EndPos; } - FX_BOOL operator!=(const CPVT_WordRange& wr) const { + bool operator!=(const CPVT_WordRange& wr) const { return wr.BeginPos != BeginPos || wr.EndPos != EndPos; } diff --git a/core/fpdfdoc/csection.cpp b/core/fpdfdoc/csection.cpp index 6686c0c773..4964504175 100644 --- a/core/fpdfdoc/csection.cpp +++ b/core/fpdfdoc/csection.cpp @@ -149,8 +149,8 @@ void CSection::UpdateWordPlace(CPVT_WordPlace& place) const { CPVT_WordPlace CSection::SearchWordPlace(const CFX_FloatPoint& point) const { ASSERT(m_pVT); 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; @@ -162,10 +162,10 @@ CPVT_WordPlace CSection::SearchWordPlace(const CFX_FloatPoint& point) const { 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; diff --git a/core/fpdfdoc/ctypeset.cpp b/core/fpdfdoc/ctypeset.cpp index cfaeb4ca7c..452143e682 100644 --- a/core/fpdfdoc/ctypeset.cpp +++ b/core/fpdfdoc/ctypeset.cpp @@ -258,20 +258,20 @@ CPVT_FloatRect CTypeset::CharArray() { CFX_SizeF CTypeset::GetEditSize(FX_FLOAT fFontSize) { ASSERT(m_pSection); ASSERT(m_pVT); - SplitLines(FALSE, fFontSize); + SplitLines(false, fFontSize); return CFX_SizeF(m_rcRet.Width(), m_rcRet.Height()); } CPVT_FloatRect CTypeset::Typeset() { ASSERT(m_pVT); m_pSection->m_LineArray.Empty(); - SplitLines(TRUE, 0.0f); + SplitLines(true, 0.0f); m_pSection->m_LineArray.Clear(); OutputLines(); return m_rcRet; } -void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) { +void CTypeset::SplitLines(bool bTypeset, FX_FLOAT fFontSize) { ASSERT(m_pVT); ASSERT(m_pSection); int32_t nLineHead = 0; @@ -281,7 +281,7 @@ 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; @@ -290,7 +290,7 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) { 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) { @@ -316,20 +316,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) { 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++; } @@ -371,7 +371,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++; diff --git a/core/fpdfdoc/ctypeset.h b/core/fpdfdoc/ctypeset.h index 3f6551d18c..4161c03b42 100644 --- a/core/fpdfdoc/ctypeset.h +++ b/core/fpdfdoc/ctypeset.h @@ -23,7 +23,7 @@ class CTypeset final { 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; diff --git a/core/fpdfdoc/doc_tagged.cpp b/core/fpdfdoc/doc_tagged.cpp index b38b484150..10c573b5ca 100644 --- a/core/fpdfdoc/doc_tagged.cpp +++ b/core/fpdfdoc/doc_tagged.cpp @@ -152,14 +152,14 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode( } else { CPDF_StructElementImpl* pParentElement = AddPageNode(pParent, map, nLevel + 1); - FX_BOOL bSave = FALSE; + bool bSave = false; for (CPDF_StructKid& kid : pParentElement->m_Kids) { if (kid.m_Type != CPDF_StructKid::Element) continue; if (kid.m_Element.m_pDict != pDict) continue; kid.m_Element.m_pElement = pElement->Retain(); - bSave = TRUE; + bSave = true; } if (!bSave) { pElement->Release(); @@ -168,15 +168,15 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode( } 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->GetDirectObjectFor("K"); if (!pObj) - return FALSE; + return false; if (pObj->IsDictionary()) { if (pObj->GetObjNum() != pDict->GetObjNum()) - return FALSE; + return false; m_Kids[0].Reset(pElement); } if (CPDF_Array* pTopKids = pObj->AsArray()) { @@ -189,9 +189,9 @@ FX_BOOL CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict, } } if (!bSave) - return FALSE; + return false; } - return TRUE; + return true; } CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, @@ -358,20 +358,20 @@ static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs, } CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, - FX_BOOL bInheritable, + bool bInheritable, FX_FLOAT fLevel) { if (fLevel > nMaxRecursion) { return nullptr; } if (bInheritable) { - CPDF_Object* pAttr = GetAttr(owner, name, FALSE); + CPDF_Object* pAttr = GetAttr(owner, name, false); if (pAttr) { return pAttr; } if (!m_pParent) { return nullptr; } - return m_pParent->GetAttr(owner, name, TRUE, fLevel + 1); + return m_pParent->GetAttr(owner, name, true, fLevel + 1); } CPDF_Object* pA = m_pDict->GetDirectObjectFor("A"); if (pA) { @@ -408,7 +408,7 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, } CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, - FX_BOOL bInheritable, + bool bInheritable, int subindex) { CPDF_Object* pAttr = GetAttr(owner, name, bInheritable); CPDF_Array* pArray = ToArray(pAttr); @@ -423,7 +423,7 @@ CFX_ByteString CPDF_StructElementImpl::GetName( const CFX_ByteStringC& owner, const CFX_ByteStringC& name, const CFX_ByteStringC& default_value, - FX_BOOL bInheritable, + bool bInheritable, int subindex) { CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); if (ToName(pAttr)) @@ -434,7 +434,7 @@ CFX_ByteString CPDF_StructElementImpl::GetName( FX_ARGB CPDF_StructElementImpl::GetColor(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_ARGB default_value, - FX_BOOL bInheritable, + bool bInheritable, int subindex) { CPDF_Array* pArray = ToArray(GetAttr(owner, name, bInheritable, subindex)); if (!pArray) @@ -446,7 +446,7 @@ FX_ARGB CPDF_StructElementImpl::GetColor(const CFX_ByteStringC& owner, FX_FLOAT CPDF_StructElementImpl::GetNumber(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_FLOAT default_value, - FX_BOOL bInheritable, + bool bInheritable, int subindex) { CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); return ToNumber(pAttr) ? pAttr->GetNumber() : default_value; @@ -454,7 +454,7 @@ FX_FLOAT CPDF_StructElementImpl::GetNumber(const CFX_ByteStringC& owner, int CPDF_StructElementImpl::GetInteger(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, int default_value, - FX_BOOL bInheritable, + bool bInheritable, int subindex) { CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex); return ToNumber(pAttr) ? pAttr->GetInteger() : default_value; diff --git a/core/fpdfdoc/fpdf_tagged.h b/core/fpdfdoc/fpdf_tagged.h index da382579ae..716e626743 100644 --- a/core/fpdfdoc/fpdf_tagged.h +++ b/core/fpdfdoc/fpdf_tagged.h @@ -62,31 +62,31 @@ class IPDF_StructElement { virtual CPDF_Object* GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, - FX_BOOL bInheritable = FALSE, + bool bInheritable = false, FX_FLOAT fLevel = 0.0F) = 0; virtual CFX_ByteString GetName(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, const CFX_ByteStringC& default_value, - FX_BOOL bInheritable = FALSE, + bool bInheritable = false, int subindex = -1) = 0; virtual FX_ARGB GetColor(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_ARGB default_value, - FX_BOOL bInheritable = FALSE, + bool bInheritable = false, int subindex = -1) = 0; virtual FX_FLOAT GetNumber(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_FLOAT default_value, - FX_BOOL bInheritable = FALSE, + bool bInheritable = false, int subindex = -1) = 0; virtual int GetInteger(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, int default_value, - FX_BOOL bInheritable = FALSE, + bool bInheritable = false, int subindex = -1) = 0; }; diff --git a/core/fpdfdoc/tagged_int.h b/core/fpdfdoc/tagged_int.h index 14dfaf58b4..43e43f1ed6 100644 --- a/core/fpdfdoc/tagged_int.h +++ b/core/fpdfdoc/tagged_int.h @@ -32,8 +32,8 @@ class CPDF_StructTreeImpl final : public IPDF_StructTree { CPDF_Dictionary* pElement, std::map& 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* const m_pTreeRoot; @@ -59,34 +59,34 @@ class CPDF_StructElementImpl final : public IPDF_StructElement { const CPDF_StructKid& GetKid(int index) const override; CPDF_Object* GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, - FX_BOOL bInheritable = FALSE, + bool bInheritable = false, FX_FLOAT fLevel = 0.0F) override; CFX_ByteString GetName(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, const CFX_ByteStringC& default_value, - FX_BOOL bInheritable = FALSE, + bool bInheritable = false, int subindex = -1) override; FX_ARGB GetColor(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_ARGB default_value, - FX_BOOL bInheritable = FALSE, + bool bInheritable = false, int subindex = -1) override; FX_FLOAT GetNumber(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_FLOAT default_value, - FX_BOOL bInheritable = FALSE, + bool bInheritable = false, int subindex = -1) override; int GetInteger(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, int default_value, - FX_BOOL bInheritable = FALSE, + bool bInheritable = false, int subindex = -1) override; void LoadKids(CPDF_Dictionary* pDict); void LoadKid(uint32_t PageObjNum, CPDF_Object* pObj, CPDF_StructKid* pKid); CPDF_Object* GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, - FX_BOOL bInheritable, + bool bInheritable, int subindex); CPDF_StructElementImpl* Retain(); void Release(); -- cgit v1.2.3