summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/include/fsdk_baseannot.h4
-rw-r--r--fpdfsdk/include/fsdk_baseform.h10
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_SpecialButton.h12
-rw-r--r--fpdfsdk/src/formfiller/FFL_CheckBox.cpp4
-rw-r--r--fpdfsdk/src/formfiller/FFL_RadioButton.cpp4
-rw-r--r--fpdfsdk/src/fpdfsave.cpp3
-rw-r--r--fpdfsdk/src/fsdk_baseannot.cpp6
-rw-r--r--fpdfsdk/src/fsdk_baseform.cpp14
-rw-r--r--fpdfsdk/src/javascript/Document.cpp4
-rw-r--r--fpdfsdk/src/javascript/Field.cpp8
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp12
11 files changed, 41 insertions, 40 deletions
diff --git a/fpdfsdk/include/fsdk_baseannot.h b/fpdfsdk/include/fsdk_baseannot.h
index 8cee331f64..afaa3bc9f9 100644
--- a/fpdfsdk/include/fsdk_baseannot.h
+++ b/fpdfsdk/include/fsdk_baseannot.h
@@ -148,8 +148,8 @@ class CPDFSDK_BAAnnot : public CPDFSDK_Annot {
void SetModifiedDate(const FX_SYSTEMTIME& st);
FX_SYSTEMTIME GetModifiedDate() const;
- void SetFlags(int nFlags);
- int GetFlags() const;
+ void SetFlags(FX_DWORD nFlags);
+ FX_DWORD GetFlags() const;
void SetAppState(const CFX_ByteString& str);
CFX_ByteString GetAppState() const;
diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h
index e796254adf..c2d09e8d4d 100644
--- a/fpdfsdk/include/fsdk_baseform.h
+++ b/fpdfsdk/include/fsdk_baseform.h
@@ -127,7 +127,7 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
int CountOptions() const;
FX_BOOL IsOptionSelected(int nIndex) const;
int GetTopVisibleIndex() const;
- FX_BOOL IsChecked() const;
+ bool IsChecked() const;
/*
BF_ALIGN_LEFT
BF_ALIGN_MIDDL
@@ -141,7 +141,7 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
CFX_WideString GetAlternateName() const;
// Set Properties.
- void SetCheck(FX_BOOL bChecked, FX_BOOL bNotify);
+ void SetCheck(bool bChecked, bool bNotify);
void SetValue(const CFX_WideString& sValue, FX_BOOL bNotify);
void SetDefaultValue(const CFX_WideString& sValue);
void SetOptionSelection(int index, FX_BOOL bSelected, FX_BOOL bNotify);
@@ -298,12 +298,12 @@ class CPDFSDK_InterForm : public CPDF_FormNotify {
FX_BOOL IsValidField(CPDF_Dictionary* pFieldDict);
FX_BOOL SubmitFields(const CFX_WideString& csDestination,
const std::vector<CPDF_FormField*>& fields,
- FX_BOOL bIncludeOrExclude,
- FX_BOOL bUrlEncoded);
+ bool bIncludeOrExclude,
+ bool bUrlEncoded);
FX_BOOL SubmitForm(const CFX_WideString& sDestination, FX_BOOL bUrlEncoded);
FX_BOOL ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf);
FX_BOOL ExportFieldsToFDFTextBuf(const std::vector<CPDF_FormField*>& fields,
- FX_BOOL bIncludeOrExclude,
+ bool bIncludeOrExclude,
CFX_ByteTextBuf& textBuf);
CFX_WideString GetTemporaryFileName(const CFX_WideString& sFileExt);
diff --git a/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h b/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h
index 6135b87862..8731562726 100644
--- a/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h
+++ b/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h
@@ -29,11 +29,11 @@ class CPWL_CheckBox : public CPWL_Button {
FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag) override;
- void SetCheck(FX_BOOL bCheck);
- FX_BOOL IsChecked() const;
+ void SetCheck(bool bCheck);
+ bool IsChecked() const;
private:
- FX_BOOL m_bChecked;
+ bool m_bChecked;
};
class CPWL_RadioButton : public CPWL_Button {
@@ -46,11 +46,11 @@ class CPWL_RadioButton : public CPWL_Button {
FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override;
FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag) override;
- void SetCheck(FX_BOOL bCheck);
- FX_BOOL IsChecked() const;
+ void SetCheck(bool bCheck);
+ bool IsChecked() const;
private:
- FX_BOOL m_bChecked;
+ bool m_bChecked;
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_SPECIALBUTTON_H_
diff --git a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
index 78a689af64..485f86ba75 100644
--- a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
@@ -96,7 +96,7 @@ FX_BOOL CFFL_CheckBox::IsDataChanged(CPDFSDK_PageView* pPageView) {
void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) {
if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) {
- FX_BOOL bNewChecked = pWnd->IsChecked();
+ bool bNewChecked = pWnd->IsChecked();
if (bNewChecked) {
CPDF_FormField* pField = m_pWidget->GetFormField();
@@ -109,7 +109,7 @@ void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) {
}
}
- m_pWidget->SetCheck(bNewChecked, FALSE);
+ m_pWidget->SetCheck(bNewChecked, false);
m_pWidget->UpdateField();
SetChangeMark();
}
diff --git a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp
index 845df115ca..029bcf1a17 100644
--- a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp
+++ b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp
@@ -101,7 +101,7 @@ FX_BOOL CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView) {
void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) {
if (CPWL_RadioButton* pWnd =
(CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) {
- FX_BOOL bNewChecked = pWnd->IsChecked();
+ bool bNewChecked = pWnd->IsChecked();
if (bNewChecked) {
CPDF_FormField* pField = m_pWidget->GetFormField();
@@ -114,7 +114,7 @@ void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) {
}
}
- m_pWidget->SetCheck(bNewChecked, FALSE);
+ m_pWidget->SetCheck(bNewChecked, false);
m_pWidget->UpdateField();
SetChangeMark();
}
diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp
index 1aa1651e47..81defbf0a7 100644
--- a/fpdfsdk/src/fpdfsave.cpp
+++ b/fpdfsdk/src/fpdfsave.cpp
@@ -302,10 +302,9 @@ bool FPDF_Doc_Save(FPDF_DOCUMENT document,
}
CFX_IFileWrite* pStreamWrite = NULL;
- FX_BOOL bRet;
pStreamWrite = new CFX_IFileWrite;
pStreamWrite->Init(pFileWrite);
- bRet = FileMaker.Create(pStreamWrite, flags);
+ bool bRet = FileMaker.Create(pStreamWrite, flags);
#ifdef PDF_ENABLE_XFA
SendPostSaveToXFADoc(pDoc);
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp
index b007e68fa1..276d302bdd 100644
--- a/fpdfsdk/src/fsdk_baseannot.cpp
+++ b/fpdfsdk/src/fsdk_baseannot.cpp
@@ -623,11 +623,11 @@ FX_SYSTEMTIME CPDFSDK_BAAnnot::GetModifiedDate() const {
return systime;
}
-void CPDFSDK_BAAnnot::SetFlags(int nFlags) {
+void CPDFSDK_BAAnnot::SetFlags(FX_DWORD nFlags) {
m_pAnnot->GetAnnotDict()->SetAtInteger("F", nFlags);
}
-int CPDFSDK_BAAnnot::GetFlags() const {
+FX_DWORD CPDFSDK_BAAnnot::GetFlags() const {
return m_pAnnot->GetAnnotDict()->GetIntegerBy("F");
}
@@ -885,7 +885,7 @@ FX_BOOL CPDFSDK_BAAnnot::CreateFormFiller() {
return TRUE;
}
FX_BOOL CPDFSDK_BAAnnot::IsVisible() const {
- int nFlags = GetFlags();
+ FX_DWORD nFlags = GetFlags();
return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) ||
(nFlags & ANNOTFLAG_NOVIEW));
}
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp
index 8541193bda..89d27726e8 100644
--- a/fpdfsdk/src/fsdk_baseform.cpp
+++ b/fpdfsdk/src/fsdk_baseform.cpp
@@ -663,7 +663,7 @@ int CPDFSDK_Widget::GetTopVisibleIndex() const {
return pFormField->GetTopVisibleIndex();
}
-FX_BOOL CPDFSDK_Widget::IsChecked() const {
+bool CPDFSDK_Widget::IsChecked() const {
#ifdef PDF_ENABLE_XFA
if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
if (IXFA_Widget* hWidget = GetMixXFAWidget()) {
@@ -686,7 +686,7 @@ int CPDFSDK_Widget::GetMaxLen() const {
return pFormField->GetMaxLen();
}
-void CPDFSDK_Widget::SetCheck(FX_BOOL bChecked, FX_BOOL bNotify) {
+void CPDFSDK_Widget::SetCheck(bool bChecked, bool bNotify) {
CPDF_FormControl* pFormCtrl = GetFormControl();
CPDF_FormField* pFormField = pFormCtrl->GetField();
pFormField->CheckControl(pFormField->GetControlIndex(pFormCtrl), bChecked,
@@ -2373,7 +2373,7 @@ FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) {
ASSERT(pControl);
if (CPDFSDK_Widget* pWidget = GetWidget(pControl)) {
- int nFlags = pWidget->GetFlags();
+ FX_DWORD nFlags = pWidget->GetFlags();
nFlags &= ~ANNOTFLAG_INVISIBLE;
nFlags &= ~ANNOTFLAG_NOVIEW;
if (bHide)
@@ -2406,7 +2406,7 @@ FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) {
if (m_pInterForm->CheckRequiredFields(&fields, bIncludeOrExclude))
return FALSE;
- return SubmitFields(sDestination, fields, bIncludeOrExclude, FALSE);
+ return SubmitFields(sDestination, fields, bIncludeOrExclude, false);
}
}
if (m_pInterForm->CheckRequiredFields(nullptr, true))
@@ -2418,8 +2418,8 @@ FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) {
FX_BOOL CPDFSDK_InterForm::SubmitFields(
const CFX_WideString& csDestination,
const std::vector<CPDF_FormField*>& fields,
- FX_BOOL bIncludeOrExclude,
- FX_BOOL bUrlEncoded) {
+ bool bIncludeOrExclude,
+ bool bUrlEncoded) {
CPDFDoc_Environment* pEnv = m_pDocument->GetEnv();
CFX_ByteTextBuf textBuf;
@@ -2483,7 +2483,7 @@ FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf,
FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(
const std::vector<CPDF_FormField*>& fields,
- FX_BOOL bIncludeOrExclude,
+ bool bIncludeOrExclude,
CFX_ByteTextBuf& textBuf) {
std::unique_ptr<CFDF_Document> pFDF(m_pInterForm->ExportToFDF(
m_pDocument->GetPath(), fields, bIncludeOrExclude));
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp
index 1c9c1f31f4..672a3a3874 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -652,7 +652,7 @@ FX_BOOL Document::submitForm(IJS_Context* cc,
if (pPDFInterForm->CheckRequiredFields(&fieldObjects, true)) {
pRuntime->BeginBlock();
- pInterForm->SubmitFields(strURL, fieldObjects, TRUE, !bFDF);
+ pInterForm->SubmitFields(strURL, fieldObjects, true, !bFDF);
pRuntime->EndBlock();
}
return TRUE;
@@ -803,7 +803,7 @@ FX_BOOL Document::info(IJS_Context* cc,
(float)pValueObj->GetNumber());
} else if (pValueObj->IsBoolean()) {
FXJS_PutObjectBoolean(isolate, pObj, wsKey.c_str(),
- (bool)pValueObj->GetInteger());
+ !!pValueObj->GetInteger());
}
}
vp << pObj;
diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp
index 35ef8b42da..0c0dfd17bf 100644
--- a/fpdfsdk/src/javascript/Field.cpp
+++ b/fpdfsdk/src/javascript/Field.cpp
@@ -3022,7 +3022,7 @@ FX_BOOL Field::checkThisBox(IJS_Context* cc,
int nWidget = params[0].ToInt();
- FX_BOOL bCheckit = TRUE;
+ bool bCheckit = true;
if (iSize >= 2)
bCheckit = params[1].ToBool();
@@ -3036,10 +3036,12 @@ FX_BOOL Field::checkThisBox(IJS_Context* cc,
return FALSE;
if (nWidget < 0 || nWidget >= pFormField->CountControls())
return FALSE;
+ // TODO(weili): Check whether anything special needed for radio button,
+ // otherwise merge these branches.
if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON)
- pFormField->CheckControl(nWidget, bCheckit, TRUE);
+ pFormField->CheckControl(nWidget, bCheckit, true);
else
- pFormField->CheckControl(nWidget, bCheckit, TRUE);
+ pFormField->CheckControl(nWidget, bCheckit, true);
UpdateFormField(m_pDocument, pFormField, TRUE, TRUE, TRUE);
return TRUE;
diff --git a/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp b/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp
index 44c3ec8a94..c19a233940 100644
--- a/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp
@@ -21,7 +21,7 @@ CFX_FloatRect CPWL_PushButton::GetFocusRect() const {
return CPWL_Utils::DeflateRect(GetWindowRect(), (FX_FLOAT)GetBorderWidth());
}
-CPWL_CheckBox::CPWL_CheckBox() : m_bChecked(FALSE) {}
+CPWL_CheckBox::CPWL_CheckBox() : m_bChecked(false) {}
CPWL_CheckBox::~CPWL_CheckBox() {}
@@ -29,11 +29,11 @@ CFX_ByteString CPWL_CheckBox::GetClassName() const {
return "CPWL_CheckBox";
}
-void CPWL_CheckBox::SetCheck(FX_BOOL bCheck) {
+void CPWL_CheckBox::SetCheck(bool bCheck) {
m_bChecked = bCheck;
}
-FX_BOOL CPWL_CheckBox::IsChecked() const {
+bool CPWL_CheckBox::IsChecked() const {
return m_bChecked;
}
@@ -51,7 +51,7 @@ FX_BOOL CPWL_CheckBox::OnChar(FX_WORD nChar, FX_DWORD nFlag) {
return TRUE;
}
-CPWL_RadioButton::CPWL_RadioButton() : m_bChecked(FALSE) {}
+CPWL_RadioButton::CPWL_RadioButton() : m_bChecked(false) {}
CPWL_RadioButton::~CPWL_RadioButton() {}
@@ -68,11 +68,11 @@ FX_BOOL CPWL_RadioButton::OnLButtonUp(const CFX_FloatPoint& point,
return TRUE;
}
-void CPWL_RadioButton::SetCheck(FX_BOOL bCheck) {
+void CPWL_RadioButton::SetCheck(bool bCheck) {
m_bChecked = bCheck;
}
-FX_BOOL CPWL_RadioButton::IsChecked() const {
+bool CPWL_RadioButton::IsChecked() const {
return m_bChecked;
}