summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfxfa
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdfxfa')
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_context.cpp40
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_context.h22
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp155
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h64
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.cpp34
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.h8
6 files changed, 161 insertions, 162 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index 739e16959f..b239d70695 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -78,28 +78,28 @@ void CPDFXFA_Context::SetFormFillEnv(
m_pFormFillEnv = pFormFillEnv;
}
-FX_BOOL CPDFXFA_Context::LoadXFADoc() {
+bool CPDFXFA_Context::LoadXFADoc() {
m_nLoadStatus = FXFA_LOADSTATUS_LOADING;
if (!m_pPDFDoc)
- return FALSE;
+ return false;
m_XFAPageList.RemoveAll();
CXFA_FFApp* pApp = GetXFAApp();
if (!pApp)
- return FALSE;
+ return false;
m_pXFADoc.reset(pApp->CreateDoc(&m_DocEnv, m_pPDFDoc.get()));
if (!m_pXFADoc) {
SetLastError(FPDF_ERR_XFALOAD);
- return FALSE;
+ return false;
}
CXFA_FFDocHandler* pDocHandler = pApp->GetDocHandler();
if (!pDocHandler) {
SetLastError(FPDF_ERR_XFALOAD);
- return FALSE;
+ return false;
}
m_pXFADoc->StartLoad();
@@ -107,7 +107,7 @@ FX_BOOL CPDFXFA_Context::LoadXFADoc() {
if (iStatus != XFA_PARSESTATUS_Done) {
CloseXFADoc();
SetLastError(FPDF_ERR_XFALOAD);
- return FALSE;
+ return false;
}
m_pXFADoc->StopLoad();
m_pXFADoc->GetXFADoc()->InitScriptContext(GetJSERuntime());
@@ -121,14 +121,14 @@ FX_BOOL CPDFXFA_Context::LoadXFADoc() {
if (m_pXFADocView->StartLayout() < 0) {
CloseXFADoc();
SetLastError(FPDF_ERR_XFALAYOUT);
- return FALSE;
+ return false;
}
m_pXFADocView->DoLayout(nullptr);
m_pXFADocView->StopLayout();
m_nLoadStatus = FXFA_LOADSTATUS_LOADED;
- return TRUE;
+ return true;
}
int CPDFXFA_Context::GetPageCount() const {
@@ -304,7 +304,7 @@ int32_t CPDFXFA_Context::MsgBox(const CFX_WideString& wsMessage,
CFX_WideString CPDFXFA_Context::Response(const CFX_WideString& wsQuestion,
const CFX_WideString& wsTitle,
const CFX_WideString& wsDefaultAnswer,
- FX_BOOL bMark) {
+ bool bMark) {
CFX_WideString wsAnswer;
if (!m_pFormFillEnv)
return wsAnswer;
@@ -332,24 +332,24 @@ IFX_SeekableReadStream* CPDFXFA_Context::DownloadURL(
: nullptr;
}
-FX_BOOL CPDFXFA_Context::PostRequestURL(const CFX_WideString& wsURL,
- const CFX_WideString& wsData,
- const CFX_WideString& wsContentType,
- const CFX_WideString& wsEncode,
- const CFX_WideString& wsHeader,
- CFX_WideString& wsResponse) {
+bool CPDFXFA_Context::PostRequestURL(const CFX_WideString& wsURL,
+ const CFX_WideString& wsData,
+ const CFX_WideString& wsContentType,
+ const CFX_WideString& wsEncode,
+ const CFX_WideString& wsHeader,
+ CFX_WideString& wsResponse) {
if (!m_pFormFillEnv)
- return FALSE;
+ return false;
wsResponse = m_pFormFillEnv->PostRequestURL(
wsURL.c_str(), wsData.c_str(), wsContentType.c_str(), wsEncode.c_str(),
wsHeader.c_str());
- return TRUE;
+ return true;
}
-FX_BOOL CPDFXFA_Context::PutRequestURL(const CFX_WideString& wsURL,
- const CFX_WideString& wsData,
- const CFX_WideString& wsEncode) {
+bool CPDFXFA_Context::PutRequestURL(const CFX_WideString& wsURL,
+ const CFX_WideString& wsData,
+ const CFX_WideString& wsEncode) {
return m_pFormFillEnv &&
m_pFormFillEnv->PutRequestURL(wsURL.c_str(), wsData.c_str(),
wsEncode.c_str());
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.h b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
index 02588e3fad..98161e2b3e 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
@@ -32,7 +32,7 @@ class CPDFXFA_Context : public IXFA_AppProvider {
CPDFXFA_Context(std::unique_ptr<CPDF_Document> pPDFDoc);
~CPDFXFA_Context() override;
- FX_BOOL LoadXFADoc();
+ bool LoadXFADoc();
CPDF_Document* GetPDFDoc() { return m_pPDFDoc.get(); }
CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); }
CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; }
@@ -66,17 +66,17 @@ class CPDFXFA_Context : public IXFA_AppProvider {
CFX_WideString Response(const CFX_WideString& wsQuestion,
const CFX_WideString& wsTitle,
const CFX_WideString& wsDefaultAnswer,
- FX_BOOL bMark) override;
+ bool bMark) override;
IFX_SeekableReadStream* DownloadURL(const CFX_WideString& wsURL) override;
- FX_BOOL PostRequestURL(const CFX_WideString& wsURL,
- const CFX_WideString& wsData,
- const CFX_WideString& wsContentType,
- const CFX_WideString& wsEncode,
- const CFX_WideString& wsHeader,
- CFX_WideString& wsResponse) override;
- FX_BOOL PutRequestURL(const CFX_WideString& wsURL,
- const CFX_WideString& wsData,
- const CFX_WideString& wsEncode) override;
+ bool PostRequestURL(const CFX_WideString& wsURL,
+ const CFX_WideString& wsData,
+ const CFX_WideString& wsContentType,
+ const CFX_WideString& wsEncode,
+ const CFX_WideString& wsHeader,
+ CFX_WideString& wsResponse) override;
+ bool PutRequestURL(const CFX_WideString& wsURL,
+ const CFX_WideString& wsData,
+ const CFX_WideString& wsEncode) override;
void LoadString(int32_t iStringID, CFX_WideString& wsString) override;
IFWL_AdapterTimerMgr* GetTimerMgr() override;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 34a0a56364..26227c068e 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -72,7 +72,7 @@ void CPDFXFA_DocEnvironment::InvalidateRect(CXFA_FFPageView* pPageView,
}
void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget,
- FX_BOOL bVisible,
+ bool bVisible,
const CFX_RectF* pRtAnchor) {
if (!hWidget || !pRtAnchor || !m_pContext->GetXFADoc() ||
!m_pContext->GetFormFillEnv() || !m_pContext->GetXFADocView())
@@ -103,27 +103,27 @@ void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget,
rcCaret.top, rcCaret.right, rcCaret.bottom);
}
-FX_BOOL CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget,
- FX_FLOAT fMinPopup,
- FX_FLOAT fMaxPopup,
- const CFX_RectF& rtAnchor,
- CFX_RectF& rtPopup) {
+bool CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget,
+ FX_FLOAT fMinPopup,
+ FX_FLOAT fMaxPopup,
+ const CFX_RectF& rtAnchor,
+ CFX_RectF& rtPopup) {
if (!hWidget)
- return FALSE;
+ return false;
CXFA_FFPageView* pXFAPageView = hWidget->GetPageView();
if (!pXFAPageView)
- return FALSE;
+ return false;
CPDFXFA_Page* pPage = m_pContext->GetXFAPage(pXFAPageView);
if (!pPage)
- return FALSE;
+ return false;
CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc();
int nRotate = pWidgetAcc->GetRotate();
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
- return FALSE;
+ return false;
FS_RECTF pageViewRect = {0.0f, 0.0f, 0.0f, 0.0f};
pFormFillEnv->GetPageViewRect(pPage, pageViewRect);
@@ -166,7 +166,7 @@ FX_BOOL CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget,
int t;
uint32_t dwPos;
if (t1 <= 0 && t2 <= 0)
- return FALSE;
+ return false;
if (t1 <= 0) {
t = t2;
dwPos = 1;
@@ -216,25 +216,25 @@ FX_BOOL CPDFXFA_DocEnvironment::GetPopupPos(CXFA_FFWidget* hWidget,
break;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDFXFA_DocEnvironment::PopupMenu(CXFA_FFWidget* hWidget,
- CFX_PointF ptPopup) {
+bool CPDFXFA_DocEnvironment::PopupMenu(CXFA_FFWidget* hWidget,
+ CFX_PointF ptPopup) {
if (!hWidget)
- return FALSE;
+ return false;
CXFA_FFPageView* pXFAPageView = hWidget->GetPageView();
if (!pXFAPageView)
- return FALSE;
+ return false;
CPDFXFA_Page* pPage = m_pContext->GetXFAPage(pXFAPageView);
if (!pPage)
- return FALSE;
+ return false;
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
- return FALSE;
+ return false;
int menuFlag = 0;
if (hWidget->CanUndo())
@@ -358,19 +358,19 @@ void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc,
pFormFillEnv->SetCurrentPage(this, iCurPage);
}
-FX_BOOL CPDFXFA_DocEnvironment::IsCalculationsEnabled(CXFA_FFDoc* hDoc) {
+bool CPDFXFA_DocEnvironment::IsCalculationsEnabled(CXFA_FFDoc* hDoc) {
if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
- return FALSE;
+ return false;
if (m_pContext->GetFormFillEnv()->GetInterForm()) {
return m_pContext->GetFormFillEnv()
->GetInterForm()
->IsXfaCalculateEnabled();
}
- return FALSE;
+ return false;
}
void CPDFXFA_DocEnvironment::SetCalculationsEnabled(CXFA_FFDoc* hDoc,
- FX_BOOL bEnabled) {
+ bool bEnabled) {
if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
return;
if (m_pContext->GetFormFillEnv()->GetInterForm()) {
@@ -403,7 +403,7 @@ void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc,
void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
const CFX_WideString& wsFilePath,
- FX_BOOL bXDP) {
+ bool bXDP) {
if (hDoc != m_pContext->GetXFADoc())
return;
@@ -519,19 +519,19 @@ void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc,
pFormFillEnv->GotoURL(this, str);
}
-FX_BOOL CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) {
+bool CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) {
if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
- return FALSE;
+ return false;
if (m_pContext->GetFormFillEnv()->GetInterForm()) {
return m_pContext->GetFormFillEnv()
->GetInterForm()
->IsXfaValidationsEnabled();
}
- return TRUE;
+ return true;
}
void CPDFXFA_DocEnvironment::SetValidationsEnabled(CXFA_FFDoc* hDoc,
- FX_BOOL bEnabled) {
+ bool bEnabled) {
if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
return;
if (m_pContext->GetFormFillEnv()->GetInterForm()) {
@@ -599,27 +599,27 @@ FX_ARGB CPDFXFA_DocEnvironment::GetHighlightColor(CXFA_FFDoc* hDoc) {
pInterForm->GetHighlightColor(FPDF_FORMFIELD_XFA));
}
-FX_BOOL CPDFXFA_DocEnvironment::NotifySubmit(FX_BOOL bPrevOrPost) {
+bool CPDFXFA_DocEnvironment::NotifySubmit(bool bPrevOrPost) {
if (bPrevOrPost)
return OnBeforeNotifySubmit();
OnAfterNotifySubmit();
- return TRUE;
+ return true;
}
-FX_BOOL CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
+bool CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) {
- return TRUE;
+ return true;
}
if (!m_pContext->GetXFADocView())
- return TRUE;
+ return true;
CXFA_FFWidgetHandler* pWidgetHandler =
m_pContext->GetXFADocView()->GetWidgetHandler();
if (!pWidgetHandler)
- return TRUE;
+ return true;
std::unique_ptr<CXFA_WidgetAccIterator> pWidgetAccIterator(
m_pContext->GetXFADocView()->CreateWidgetAccIterator());
@@ -633,7 +633,7 @@ FX_BOOL CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
pWidgetAccIterator.reset(
m_pContext->GetXFADocView()->CreateWidgetAccIterator());
if (!pWidgetAccIterator)
- return TRUE;
+ return true;
CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext();
pWidgetAcc = pWidgetAccIterator->MoveToNext();
@@ -642,7 +642,7 @@ FX_BOOL CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
if (fRet == XFA_EVENTERROR_Error) {
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
- return FALSE;
+ return false;
CFX_WideString ws;
ws.FromLocal(IDS_XFA_Validate_Input);
@@ -651,13 +651,13 @@ FX_BOOL CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len),
(FPDF_WIDESTRING)L"", 0, 1);
bs.ReleaseBuffer(len);
- return FALSE;
+ return false;
}
pWidgetAcc = pWidgetAccIterator->MoveToNext();
}
m_pContext->GetXFADocView()->UpdateDocView();
- return TRUE;
+ return true;
}
void CPDFXFA_DocEnvironment::OnAfterNotifySubmit() {
@@ -688,14 +688,13 @@ void CPDFXFA_DocEnvironment::OnAfterNotifySubmit() {
m_pContext->GetXFADocView()->UpdateDocView();
}
-FX_BOOL CPDFXFA_DocEnvironment::SubmitData(CXFA_FFDoc* hDoc,
- CXFA_Submit submit) {
- if (!NotifySubmit(TRUE) || !m_pContext->GetXFADocView())
- return FALSE;
+bool CPDFXFA_DocEnvironment::SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) {
+ if (!NotifySubmit(true) || !m_pContext->GetXFADocView())
+ return false;
m_pContext->GetXFADocView()->UpdateDocView();
- FX_BOOL ret = SubmitDataInternal(hDoc, submit);
- NotifySubmit(FALSE);
+ bool ret = SubmitDataInternal(hDoc, submit);
+ NotifySubmit(false);
return ret;
}
@@ -717,17 +716,17 @@ IFX_SeekableReadStream* CPDFXFA_DocEnvironment::OpenLinkedFile(
return new CFPDF_FileStream(pFileHandler);
}
-FX_BOOL CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
- int fileType,
- FPDF_DWORD encodeType,
- FPDF_DWORD flag) {
+bool CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
+ int fileType,
+ FPDF_DWORD encodeType,
+ FPDF_DWORD flag) {
if (!m_pContext->GetXFADocView())
- return FALSE;
+ return false;
CFX_ByteString content;
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
- return FALSE;
+ return false;
CFPDF_FileStream fileStream(pFileHandler);
if (fileType == FXFA_SAVEAS_XML) {
@@ -735,11 +734,11 @@ FX_BOOL CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
fileStream.WriteBlock(kContent, 0, strlen(kContent));
m_pContext->GetXFADoc()->SavePackage(XFA_HASHCODE_Data, &fileStream,
nullptr);
- return TRUE;
+ return true;
}
if (fileType != FXFA_SAVEAS_XDP)
- return TRUE;
+ return true;
if (!flag) {
flag = FXFA_CONFIG | FXFA_TEMPLATE | FXFA_LOCALESET | FXFA_DATASETS |
@@ -747,25 +746,25 @@ FX_BOOL CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
}
if (!m_pContext->GetPDFDoc()) {
fileStream.Flush();
- return FALSE;
+ return false;
}
CPDF_Dictionary* pRoot = m_pContext->GetPDFDoc()->GetRoot();
if (!pRoot) {
fileStream.Flush();
- return FALSE;
+ return false;
}
CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm");
if (!pAcroForm) {
fileStream.Flush();
- return FALSE;
+ return false;
}
CPDF_Array* pArray = ToArray(pAcroForm->GetObjectFor("XFA"));
if (!pArray) {
fileStream.Flush();
- return FALSE;
+ return false;
}
int size = pArray->GetCount();
@@ -804,7 +803,7 @@ FX_BOOL CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
// PDF,creator.
}
}
- return TRUE;
+ return true;
}
void CPDFXFA_DocEnvironment::ToXFAContentFlags(CFX_WideString csSrcContent,
@@ -829,23 +828,23 @@ void CPDFXFA_DocEnvironment::ToXFAContentFlags(CFX_WideString csSrcContent,
}
}
-FX_BOOL CPDFXFA_DocEnvironment::MailToInfo(CFX_WideString& csURL,
- CFX_WideString& csToAddress,
- CFX_WideString& csCCAddress,
- CFX_WideString& csBCCAddress,
- CFX_WideString& csSubject,
- CFX_WideString& csMsg) {
+bool CPDFXFA_DocEnvironment::MailToInfo(CFX_WideString& csURL,
+ CFX_WideString& csToAddress,
+ CFX_WideString& csCCAddress,
+ CFX_WideString& csBCCAddress,
+ CFX_WideString& csSubject,
+ CFX_WideString& csMsg) {
CFX_WideString srcURL = csURL;
srcURL.TrimLeft();
if (srcURL.Left(7).CompareNoCase(L"mailto:") != 0)
- return FALSE;
+ return false;
int pos = srcURL.Find(L'?', 0);
CFX_WideString tmp;
if (pos == -1) {
pos = srcURL.Find(L'@', 0);
if (pos == -1)
- return FALSE;
+ return false;
tmp = srcURL.Right(csURL.GetLength() - 7);
} else {
@@ -891,14 +890,14 @@ FX_BOOL CPDFXFA_DocEnvironment::MailToInfo(CFX_WideString& csURL,
csToAddress.Replace(L",", L";");
csCCAddress.Replace(L",", L";");
csBCCAddress.Replace(L",", L";");
- return TRUE;
+ return true;
}
-FX_BOOL CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
- CXFA_Submit submit) {
+bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
+ CXFA_Submit submit) {
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
if (!pFormFillEnv)
- return FALSE;
+ return false;
CFX_WideStringC csURLC;
submit.GetSubmitTarget(csURLC);
@@ -911,7 +910,7 @@ FX_BOOL CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len),
(FPDF_WIDESTRING)L"", 0, 4);
bs.ReleaseBuffer(len);
- return FALSE;
+ return false;
}
FPDF_FILEHANDLER* pFileHandler = nullptr;
@@ -953,7 +952,7 @@ FX_BOOL CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
return false;
}
if (!pFileHandler)
- return FALSE;
+ return false;
if (csURL.Left(7).CompareNoCase(L"mailto:") == 0) {
CFX_WideString csToAddress;
CFX_WideString csCCAddress;
@@ -962,7 +961,7 @@ FX_BOOL CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
CFX_WideString csMsg;
if (!MailToInfo(csURL, csToAddress, csCCAddress, csBCCAddress, csSubject,
csMsg)) {
- return FALSE;
+ return false;
}
CFX_ByteString bsTo = CFX_WideString(csToAddress).UTF16LE_Encode();
CFX_ByteString bsCC = CFX_WideString(csCCAddress).UTF16LE_Encode();
@@ -990,33 +989,33 @@ FX_BOOL CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
(FPDF_WIDESTRING)bs.GetBuffer(len));
bs.ReleaseBuffer(len);
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDFXFA_DocEnvironment::SetGlobalProperty(
+bool CPDFXFA_DocEnvironment::SetGlobalProperty(
CXFA_FFDoc* hDoc,
const CFX_ByteStringC& szPropName,
CFXJSE_Value* pValue) {
if (hDoc != m_pContext->GetXFADoc())
- return FALSE;
+ return false;
if (m_pContext->GetFormFillEnv() &&
m_pContext->GetFormFillEnv()->GetJSRuntime()) {
return m_pContext->GetFormFillEnv()->GetJSRuntime()->SetValueByName(
szPropName, pValue);
}
- return FALSE;
+ return false;
}
-FX_BOOL CPDFXFA_DocEnvironment::GetGlobalProperty(
+bool CPDFXFA_DocEnvironment::GetGlobalProperty(
CXFA_FFDoc* hDoc,
const CFX_ByteStringC& szPropName,
CFXJSE_Value* pValue) {
if (hDoc != m_pContext->GetXFADoc())
- return FALSE;
+ return false;
if (!m_pContext->GetFormFillEnv() ||
!m_pContext->GetFormFillEnv()->GetJSRuntime()) {
- return FALSE;
+ return false;
}
CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
index 6056e22b79..8909cf6429 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
@@ -26,15 +26,15 @@ class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment {
uint32_t dwFlags) override;
// show or hide caret
void DisplayCaret(CXFA_FFWidget* hWidget,
- FX_BOOL bVisible,
+ bool bVisible,
const CFX_RectF* pRtAnchor) override;
// dwPos: (0:bottom 1:top)
- FX_BOOL GetPopupPos(CXFA_FFWidget* hWidget,
- FX_FLOAT fMinPopup,
- FX_FLOAT fMaxPopup,
- const CFX_RectF& rtAnchor,
- CFX_RectF& rtPopup) override;
- FX_BOOL PopupMenu(CXFA_FFWidget* hWidget, CFX_PointF ptPopup) override;
+ bool GetPopupPos(CXFA_FFWidget* hWidget,
+ FX_FLOAT fMinPopup,
+ FX_FLOAT fMaxPopup,
+ const CFX_RectF& rtAnchor,
+ CFX_RectF& rtPopup) override;
+ bool PopupMenu(CXFA_FFWidget* hWidget, CFX_PointF ptPopup) override;
// dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing
void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags) override;
@@ -47,16 +47,16 @@ class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment {
int32_t CountPages(CXFA_FFDoc* hDoc) override;
int32_t GetCurrentPage(CXFA_FFDoc* hDoc) override;
void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) override;
- FX_BOOL IsCalculationsEnabled(CXFA_FFDoc* hDoc) override;
- void SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) override;
+ bool IsCalculationsEnabled(CXFA_FFDoc* hDoc) override;
+ void SetCalculationsEnabled(CXFA_FFDoc* hDoc, bool bEnabled) override;
void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) override;
void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle) override;
void ExportData(CXFA_FFDoc* hDoc,
const CFX_WideString& wsFilePath,
- FX_BOOL bXDP) override;
+ bool bXDP) override;
void GotoURL(CXFA_FFDoc* hDoc, const CFX_WideString& bsURL) override;
- FX_BOOL IsValidationsEnabled(CXFA_FFDoc* hDoc) override;
- void SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) override;
+ bool IsValidationsEnabled(CXFA_FFDoc* hDoc) override;
+ void SetValidationsEnabled(CXFA_FFDoc* hDoc, bool bEnabled) override;
void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override;
void Print(CXFA_FFDoc* hDoc,
int32_t nStartPage,
@@ -76,33 +76,33 @@ class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment {
* @param[in] bEmbedPDF, specifies whether PDF is embedded in the submitted
*content or not.
*/
- FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) override;
+ bool SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) override;
- FX_BOOL GetGlobalProperty(CXFA_FFDoc* hDoc,
- const CFX_ByteStringC& szPropName,
- CFXJSE_Value* pValue) override;
- FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc,
- const CFX_ByteStringC& szPropName,
- CFXJSE_Value* pValue) override;
+ bool GetGlobalProperty(CXFA_FFDoc* hDoc,
+ const CFX_ByteStringC& szPropName,
+ CFXJSE_Value* pValue) override;
+ bool SetGlobalProperty(CXFA_FFDoc* hDoc,
+ const CFX_ByteStringC& szPropName,
+ CFXJSE_Value* pValue) override;
IFX_SeekableReadStream* OpenLinkedFile(CXFA_FFDoc* hDoc,
const CFX_WideString& wsLink) override;
private:
- FX_BOOL OnBeforeNotifySubmit();
+ bool OnBeforeNotifySubmit();
void OnAfterNotifySubmit();
- FX_BOOL NotifySubmit(FX_BOOL bPrevOrPost);
- FX_BOOL SubmitDataInternal(CXFA_FFDoc* hDoc, CXFA_Submit submit);
- FX_BOOL MailToInfo(CFX_WideString& csURL,
- CFX_WideString& csToAddress,
- CFX_WideString& csCCAddress,
- CFX_WideString& csBCCAddress,
- CFX_WideString& csSubject,
- CFX_WideString& csMsg);
- FX_BOOL ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler,
- int fileType,
- FPDF_DWORD encodeType,
- FPDF_DWORD flag);
+ bool NotifySubmit(bool bPrevOrPost);
+ bool SubmitDataInternal(CXFA_FFDoc* hDoc, CXFA_Submit submit);
+ bool MailToInfo(CFX_WideString& csURL,
+ CFX_WideString& csToAddress,
+ CFX_WideString& csCCAddress,
+ CFX_WideString& csBCCAddress,
+ CFX_WideString& csSubject,
+ CFX_WideString& csMsg);
+ bool ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler,
+ int fileType,
+ FPDF_DWORD encodeType,
+ FPDF_DWORD flag);
void ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag);
CPDFXFA_Context* const m_pContext; // Not owned;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index 96ffd0b90e..8cc325009b 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -27,48 +27,48 @@ CPDFXFA_Page::~CPDFXFA_Page() {
m_pContext->RemovePage(this);
}
-FX_BOOL CPDFXFA_Page::LoadPDFPage() {
+bool CPDFXFA_Page::LoadPDFPage() {
if (!m_pContext)
- return FALSE;
+ return false;
CPDF_Document* pPDFDoc = m_pContext->GetPDFDoc();
if (!pPDFDoc)
- return FALSE;
+ return false;
CPDF_Dictionary* pDict = pPDFDoc->GetPage(m_iPageIndex);
if (!pDict)
- return FALSE;
+ return false;
if (!m_pPDFPage || m_pPDFPage->m_pFormDict != pDict) {
m_pPDFPage = pdfium::MakeUnique<CPDF_Page>(pPDFDoc, pDict, true);
m_pPDFPage->ParseContent();
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDFXFA_Page::LoadXFAPageView() {
+bool CPDFXFA_Page::LoadXFAPageView() {
if (!m_pContext)
- return FALSE;
+ return false;
CXFA_FFDoc* pXFADoc = m_pContext->GetXFADoc();
if (!pXFADoc)
- return FALSE;
+ return false;
CXFA_FFDocView* pXFADocView = m_pContext->GetXFADocView();
if (!pXFADocView)
- return FALSE;
+ return false;
CXFA_FFPageView* pPageView = pXFADocView->GetPageView(m_iPageIndex);
if (!pPageView)
- return FALSE;
+ return false;
m_pXFAPageView = pPageView;
- return TRUE;
+ return true;
}
-FX_BOOL CPDFXFA_Page::LoadPage() {
+bool CPDFXFA_Page::LoadPage() {
if (!m_pContext || m_iPageIndex < 0)
- return FALSE;
+ return false;
int iDocType = m_pContext->GetDocType();
switch (iDocType) {
@@ -80,18 +80,18 @@ FX_BOOL CPDFXFA_Page::LoadPage() {
return LoadXFAPageView();
}
default:
- return FALSE;
+ return false;
}
}
-FX_BOOL CPDFXFA_Page::LoadPDFPage(CPDF_Dictionary* pageDict) {
+bool CPDFXFA_Page::LoadPDFPage(CPDF_Dictionary* pageDict) {
if (!m_pContext || m_iPageIndex < 0 || !pageDict)
- return FALSE;
+ return false;
m_pPDFPage =
pdfium::MakeUnique<CPDF_Page>(m_pContext->GetPDFDoc(), pageDict, true);
m_pPDFPage->ParseContent();
- return TRUE;
+ return true;
}
FX_FLOAT CPDFXFA_Page::GetPageWidth() const {
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.h b/fpdfsdk/fpdfxfa/cpdfxfa_page.h
index 81f0a305c9..79158f4ea7 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.h
@@ -27,8 +27,8 @@ class CPDFXFA_Page {
delete this;
}
- FX_BOOL LoadPage();
- FX_BOOL LoadPDFPage(CPDF_Dictionary* pageDict);
+ bool LoadPage();
+ bool LoadPDFPage(CPDF_Dictionary* pageDict);
CPDFXFA_Context* GetContext() const { return m_pContext; }
int GetPageIndex() const { return m_iPageIndex; }
CPDF_Page* GetPDFPage() const { return m_pPDFPage.get(); }
@@ -71,8 +71,8 @@ class CPDFXFA_Page {
// Refcounted class.
~CPDFXFA_Page();
- FX_BOOL LoadPDFPage();
- FX_BOOL LoadXFAPageView();
+ bool LoadPDFPage();
+ bool LoadXFAPageView();
private:
std::unique_ptr<CPDF_Page> m_pPDFPage;