diff options
131 files changed, 5265 insertions, 5460 deletions
diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp index 541ef2ba64..f38be4c3e8 100644 --- a/fpdfsdk/cfx_systemhandler.cpp +++ b/fpdfsdk/cfx_systemhandler.cpp @@ -121,8 +121,8 @@ CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF( return nullptr; std::unique_ptr<CFX_Font> pFXFont(new CFX_Font); - pFXFont->LoadSubst(sFontFaceName, TRUE, 0, 0, 0, CharSet2CP(nCharset), false); - return pDoc->AddFont(pFXFont.get(), nCharset, FALSE); + pFXFont->LoadSubst(sFontFaceName, true, 0, 0, 0, CharSet2CP(nCharset), false); + return pDoc->AddFont(pFXFont.get(), nCharset, false); } int32_t CFX_SystemHandler::SetTimer(int32_t uElapse, diff --git a/fpdfsdk/cpdfsdk_annot.cpp b/fpdfsdk/cpdfsdk_annot.cpp index 4e62d93cc1..4dcce48465 100644 --- a/fpdfsdk/cpdfsdk_annot.cpp +++ b/fpdfsdk/cpdfsdk_annot.cpp @@ -23,14 +23,14 @@ const float kMinHeight = 1.0f; } // namespace CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView) - : m_pPageView(pPageView), m_bSelected(FALSE) {} + : m_pPageView(pPageView), m_bSelected(false) {} CPDFSDK_Annot::~CPDFSDK_Annot() {} #ifdef PDF_ENABLE_XFA -FX_BOOL CPDFSDK_Annot::IsXFAField() { - return FALSE; +bool CPDFSDK_Annot::IsXFAField() { + return false; } CXFA_FFWidget* CPDFSDK_Annot::GetXFAWidget() const { @@ -77,11 +77,11 @@ void CPDFSDK_Annot::Annot_OnDraw(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, CPDF_RenderOptions* pOptions) {} -FX_BOOL CPDFSDK_Annot::IsSelected() { +bool CPDFSDK_Annot::IsSelected() { return m_bSelected; } -void CPDFSDK_Annot::SetSelected(FX_BOOL bSelected) { +void CPDFSDK_Annot::SetSelected(bool bSelected) { m_bSelected = bSelected; } diff --git a/fpdfsdk/cpdfsdk_annot.h b/fpdfsdk/cpdfsdk_annot.h index 874da2d5dc..36e7b56612 100644 --- a/fpdfsdk/cpdfsdk_annot.h +++ b/fpdfsdk/cpdfsdk_annot.h @@ -28,7 +28,7 @@ class CPDFSDK_Annot : public CFX_Observable<CPDFSDK_Annot> { virtual ~CPDFSDK_Annot(); #ifdef PDF_ENABLE_XFA - virtual FX_BOOL IsXFAField(); + virtual bool IsXFAField(); virtual CXFA_FFWidget* GetXFAWidget() const; #endif // PDF_ENABLE_XFA @@ -54,12 +54,12 @@ class CPDFSDK_Annot : public CFX_Observable<CPDFSDK_Annot> { void SetPage(CPDFSDK_PageView* pPageView); CPDFSDK_PageView* GetPageView() const { return m_pPageView; } - FX_BOOL IsSelected(); - void SetSelected(FX_BOOL bSelected); + bool IsSelected(); + void SetSelected(bool bSelected); protected: CPDFSDK_PageView* m_pPageView; - FX_BOOL m_bSelected; + bool m_bSelected; }; #endif // FPDFSDK_CPDFSDK_ANNOT_H_ diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp index 098bf3d709..0d252a47df 100644 --- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp +++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp @@ -99,7 +99,7 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, bDrawAnnots); } -FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown( +bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, @@ -109,7 +109,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown( ->OnLButtonDown(pPageView, pAnnot, nFlags, point); } -FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp( +bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, @@ -119,7 +119,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp( ->OnLButtonUp(pPageView, pAnnot, nFlags, point); } -FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk( +bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, @@ -129,7 +129,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk( ->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); } -FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove( +bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, @@ -139,7 +139,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove( ->OnMouseMove(pPageView, pAnnot, nFlags, point); } -FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel( +bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, @@ -150,7 +150,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel( ->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); } -FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown( +bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, @@ -160,7 +160,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown( ->OnRButtonDown(pPageView, pAnnot, nFlags, point); } -FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp( +bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, @@ -186,15 +186,15 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit( GetAnnotHandler(pAnnot->Get())->OnMouseExit(pPageView, pAnnot, nFlag); } -FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) { +bool CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, + uint32_t nChar, + uint32_t nFlags) { return GetAnnotHandler(pAnnot)->OnChar(pAnnot, nChar, nFlags); } -FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, - int nKeyCode, - int nFlag) { +bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, + int nKeyCode, + int nFlag) { if (m_pFormFillEnv->IsCTRLKeyDown(nFlag) || m_pFormFillEnv->IsALTKeyDown(nFlag)) return GetAnnotHandler(pAnnot)->OnKeyDown(pAnnot, nKeyCode, nFlag); @@ -206,27 +206,27 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, GetNextAnnot(pFocusAnnot, !m_pFormFillEnv->IsSHIFTKeyDown(nFlag))); if (pNext && pNext.Get() != pFocusAnnot) { pPage->GetFormFillEnv()->SetFocusAnnot(&pNext); - return TRUE; + return true; } } - return FALSE; + return false; } -FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, - int nKeyCode, - int nFlag) { - return FALSE; +bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, + int nKeyCode, + int nFlag) { + return false; } -FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus( +bool CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus( CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) { ASSERT(*pAnnot); return GetAnnotHandler(pAnnot->Get())->OnSetFocus(pAnnot, nFlag); } -FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus( +bool CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus( CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) { ASSERT(*pAnnot); @@ -234,11 +234,11 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus( } #ifdef PDF_ENABLE_XFA -FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus( +bool CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus( CPDFSDK_Annot::ObservedPtr* pSetAnnot, CPDFSDK_Annot::ObservedPtr* pKillAnnot) { - FX_BOOL bXFA = (*pSetAnnot && (*pSetAnnot)->GetXFAWidget()) || - (*pKillAnnot && (*pKillAnnot)->GetXFAWidget()); + bool bXFA = (*pSetAnnot && (*pSetAnnot)->GetXFAWidget()) || + (*pKillAnnot && (*pKillAnnot)->GetXFAWidget()); if (bXFA) { if (IPDFSDK_AnnotHandler* pXFAAnnotHandler = @@ -246,7 +246,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus( return pXFAAnnotHandler->OnXFAChangedFocus(pKillAnnot, pSetAnnot); } - return TRUE; + return true; } #endif // PDF_ENABLE_XFA @@ -257,19 +257,19 @@ CFX_FloatRect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox( return GetAnnotHandler(pAnnot)->GetViewBBox(pPageView, pAnnot); } -FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point) { +bool CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + const CFX_FloatPoint& point) { ASSERT(pAnnot); IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot); if (pAnnotHandler->CanAnswer(pAnnot)) return pAnnotHandler->HitTest(pPageView, pAnnot, point); - return FALSE; + return false; } CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, - FX_BOOL bNext) { + bool bNext) { #ifdef PDF_ENABLE_XFA CPDFSDK_PageView* pPageView = pSDKAnnot->GetPageView(); CPDFXFA_Page* pPage = pPageView->GetPDFXFAPage(); diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.h b/fpdfsdk/cpdfsdk_annothandlermgr.h index 4d96397588..7742fd6ed3 100644 --- a/fpdfsdk/cpdfsdk_annothandlermgr.h +++ b/fpdfsdk/cpdfsdk_annothandlermgr.h @@ -55,56 +55,56 @@ class CPDFSDK_AnnotHandlerMgr { void Annot_OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags); - FX_BOOL Annot_OnLButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - FX_BOOL Annot_OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - FX_BOOL Annot_OnLButtonDblClk(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - FX_BOOL Annot_OnMouseMove(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - FX_BOOL Annot_OnMouseWheel(CPDFSDK_PageView* pPageView, + bool Annot_OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point); + bool Annot_OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point); + bool Annot_OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - short zDelta, const CFX_FloatPoint& point); - FX_BOOL Annot_OnRButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - FX_BOOL Annot_OnRButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - FX_BOOL Annot_OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags); - FX_BOOL Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag); - FX_BOOL Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag); - - FX_BOOL Annot_OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag); - FX_BOOL Annot_OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag); + bool Annot_OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point); + bool Annot_OnMouseWheel(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + short zDelta, + const CFX_FloatPoint& point); + bool Annot_OnRButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point); + bool Annot_OnRButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point); + bool Annot_OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags); + bool Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag); + bool Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag); + + bool Annot_OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag); + bool Annot_OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag); #ifdef PDF_ENABLE_XFA - FX_BOOL Annot_OnChangeFocus(CPDFSDK_Annot::ObservedPtr* pSetAnnot, - CPDFSDK_Annot::ObservedPtr* pKillAnnot); + bool Annot_OnChangeFocus(CPDFSDK_Annot::ObservedPtr* pSetAnnot, + CPDFSDK_Annot::ObservedPtr* pKillAnnot); #endif // PDF_ENABLE_XFA CFX_FloatRect Annot_OnGetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot); - FX_BOOL Annot_OnHitTest(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point); + bool Annot_OnHitTest(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + const CFX_FloatPoint& point); private: IPDFSDK_AnnotHandler* GetAnnotHandler(CPDF_Annot::Subtype nSubtype) const; - CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, FX_BOOL bNext); + CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, bool bNext); std::unique_ptr<CPDFSDK_BAAnnotHandler> m_pBAAnnotHandler; std::unique_ptr<CPDFSDK_WidgetHandler> m_pWidgetHandler; diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp index 72468e180f..0e6c53cc78 100644 --- a/fpdfsdk/cpdfsdk_baannot.cpp +++ b/fpdfsdk/cpdfsdk_baannot.cpp @@ -55,14 +55,14 @@ void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice, mode, pOptions); } -FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() { +bool CPDFSDK_BAAnnot::IsAppearanceValid() { return !!m_pAnnot->GetAnnotDict()->GetDictFor("AP"); } -FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { +bool CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDictFor("AP"); if (!pAP) - return FALSE; + return false; // Choose the right sub-ap const FX_CHAR* ap_entry = "N"; @@ -252,7 +252,7 @@ void CPDFSDK_BAAnnot::RemoveColor() { m_pAnnot->GetAnnotDict()->RemoveFor("C"); } -FX_BOOL CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const { +bool CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const { if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArrayFor("C")) { size_t nCount = pEntry->GetCount(); if (nCount == 1) { @@ -260,7 +260,7 @@ FX_BOOL CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const { color = FXSYS_RGB((int)g, (int)g, (int)g); - return TRUE; + return true; } else if (nCount == 3) { FX_FLOAT r = pEntry->GetNumberAt(0) * 255; FX_FLOAT g = pEntry->GetNumberAt(1) * 255; @@ -268,7 +268,7 @@ FX_BOOL CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const { color = FXSYS_RGB((int)r, (int)g, (int)b); - return TRUE; + return true; } else if (nCount == 4) { FX_FLOAT c = pEntry->GetNumberAt(0); FX_FLOAT m = pEntry->GetNumberAt(1); @@ -281,11 +281,11 @@ FX_BOOL CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const { color = FXSYS_RGB((int)(r * 255), (int)(g * 255), (int)(b * 255)); - return TRUE; + return true; } } - return FALSE; + return false; } void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, @@ -340,7 +340,7 @@ void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength()); } -FX_BOOL CPDFSDK_BAAnnot::IsVisible() const { +bool CPDFSDK_BAAnnot::IsVisible() const { uint32_t nFlags = GetFlags(); return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) || (nFlags & ANNOTFLAG_NOVIEW)); diff --git a/fpdfsdk/cpdfsdk_baannot.h b/fpdfsdk/cpdfsdk_baannot.h index 96b4962ca5..10f27e6dec 100644 --- a/fpdfsdk/cpdfsdk_baannot.h +++ b/fpdfsdk/cpdfsdk_baannot.h @@ -65,9 +65,9 @@ class CPDFSDK_BAAnnot : public CPDFSDK_Annot { void SetColor(FX_COLORREF color); void RemoveColor(); - FX_BOOL GetColor(FX_COLORREF& color) const; + bool GetColor(FX_COLORREF& color) const; - FX_BOOL IsVisible() const; + bool IsVisible() const; CPDF_Action GetAction() const; void SetAction(const CPDF_Action& a); @@ -78,8 +78,8 @@ class CPDFSDK_BAAnnot : public CPDFSDK_Annot { void RemoveAAction(); virtual CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT); - virtual FX_BOOL IsAppearanceValid(); - virtual FX_BOOL IsAppearanceValid(CPDF_Annot::AppearanceMode mode); + virtual bool IsAppearanceValid(); + virtual bool IsAppearanceValid(CPDF_Annot::AppearanceMode mode); virtual void DrawAppearance(CFX_RenderDevice* pDevice, const CFX_Matrix* pUser2Device, CPDF_Annot::AppearanceMode mode, diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp index 581af1baf9..5cabef994a 100644 --- a/fpdfsdk/cpdfsdk_baannothandler.cpp +++ b/fpdfsdk/cpdfsdk_baannothandler.cpp @@ -37,8 +37,8 @@ CPDFSDK_BAAnnotHandler::CPDFSDK_BAAnnotHandler() {} CPDFSDK_BAAnnotHandler::~CPDFSDK_BAAnnotHandler() {} -FX_BOOL CPDFSDK_BAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { - return FALSE; +bool CPDFSDK_BAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { + return false; } CPDFSDK_Annot* CPDFSDK_BAAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, @@ -88,102 +88,98 @@ void CPDFSDK_BAAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView, UpdateAnnotRects(pPageView, pBAAnnot); } -FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonDown( - CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { - return FALSE; +bool CPDFSDK_BAAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { + return false; } -FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { - return FALSE; +bool CPDFSDK_BAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { + return false; } -FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonDblClk( - CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { - return FALSE; +bool CPDFSDK_BAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { + return false; } -FX_BOOL CPDFSDK_BAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { - return FALSE; +bool CPDFSDK_BAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { + return false; } -FX_BOOL CPDFSDK_BAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - short zDelta, - const CFX_FloatPoint& point) { - return FALSE; +bool CPDFSDK_BAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + short zDelta, + const CFX_FloatPoint& point) { + return false; } -FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonDown( - CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { - return FALSE; +bool CPDFSDK_BAAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { + return false; } -FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { - return FALSE; +bool CPDFSDK_BAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { + return false; } -FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonDblClk( - CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { - return FALSE; +bool CPDFSDK_BAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { + return false; } -FX_BOOL CPDFSDK_BAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) { - return FALSE; +bool CPDFSDK_BAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, + uint32_t nChar, + uint32_t nFlags) { + return false; } -FX_BOOL CPDFSDK_BAAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, - int nKeyCode, - int nFlag) { - return FALSE; +bool CPDFSDK_BAAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, + int nKeyCode, + int nFlag) { + return false; } -FX_BOOL CPDFSDK_BAAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, - int nKeyCode, - int nFlag) { - return FALSE; +bool CPDFSDK_BAAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, + int nKeyCode, + int nFlag) { + return false; } void CPDFSDK_BAAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) {} -FX_BOOL CPDFSDK_BAAnnotHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlag) { - return FALSE; +bool CPDFSDK_BAAnnotHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlag) { + return false; } -FX_BOOL CPDFSDK_BAAnnotHandler::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlag) { - return FALSE; +bool CPDFSDK_BAAnnotHandler::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlag) { + return false; } #ifdef PDF_ENABLE_XFA -FX_BOOL CPDFSDK_BAAnnotHandler::OnXFAChangedFocus( +bool CPDFSDK_BAAnnotHandler::OnXFAChangedFocus( CPDFSDK_Annot::ObservedPtr* pOldAnnot, CPDFSDK_Annot::ObservedPtr* pNewAnnot) { - return TRUE; + return true; } #endif // PDF_ENABLE_XFA @@ -192,9 +188,9 @@ CFX_FloatRect CPDFSDK_BAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, return pAnnot->GetRect(); } -FX_BOOL CPDFSDK_BAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point) { +bool CPDFSDK_BAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + const CFX_FloatPoint& point) { ASSERT(pPageView); ASSERT(pAnnot); diff --git a/fpdfsdk/cpdfsdk_baannothandler.h b/fpdfsdk/cpdfsdk_baannothandler.h index 66f8a0881b..2efed0e269 100644 --- a/fpdfsdk/cpdfsdk_baannothandler.h +++ b/fpdfsdk/cpdfsdk_baannothandler.h @@ -28,7 +28,7 @@ class CPDFSDK_BAAnnotHandler : public IPDFSDK_AnnotHandler { CPDFSDK_BAAnnotHandler(); ~CPDFSDK_BAAnnotHandler() override; - FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; + bool CanAnswer(CPDFSDK_Annot* pAnnot) override; CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; #ifdef PDF_ENABLE_XFA CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* hWidget, @@ -37,9 +37,9 @@ class CPDFSDK_BAAnnotHandler : public IPDFSDK_AnnotHandler { void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) override; - FX_BOOL HitTest(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point) override; + bool HitTest(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + const CFX_FloatPoint& point) override; void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, @@ -53,51 +53,47 @@ class CPDFSDK_BAAnnotHandler : public IPDFSDK_AnnotHandler { void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override; - FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, + bool OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnMouseWheel(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + short zDelta, + const CFX_FloatPoint& point) override; + bool OnRButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnRButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - short zDelta, const CFX_FloatPoint& point) override; - FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) override; - FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; - FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; - FX_BOOL OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlag) override; - FX_BOOL OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlag) override; + bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; + bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; + bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; + bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override; + bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override; #ifdef PDF_ENABLE_XFA - FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot, - CPDFSDK_Annot::ObservedPtr* pNewAnnot) override; + bool OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot, + CPDFSDK_Annot::ObservedPtr* pNewAnnot) override; #endif // PDF_ENABLE_XFA }; diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp index 3907845d54..9852bdc9b9 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp +++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp @@ -287,15 +287,15 @@ void CPDFSDK_FormFillEnvironment::OnChange() { m_pInfo->FFI_OnChange(m_pInfo); } -FX_BOOL CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(uint32_t nFlag) const { +bool CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(uint32_t nFlag) const { return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0; } -FX_BOOL CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(uint32_t nFlag) const { +bool CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(uint32_t nFlag) const { return (nFlag & FWL_EVENTFLAG_ControlKey) != 0; } -FX_BOOL CPDFSDK_FormFillEnvironment::IsALTKeyDown(uint32_t nFlag) const { +bool CPDFSDK_FormFillEnvironment::IsALTKeyDown(uint32_t nFlag) const { return (nFlag & FWL_EVENTFLAG_AltKey) != 0; } @@ -321,7 +321,7 @@ void CPDFSDK_FormFillEnvironment::ExecuteNamedAction( void CPDFSDK_FormFillEnvironment::OnSetFieldInputFocus( FPDF_WIDESTRING focusText, FPDF_DWORD nTextLen, - FX_BOOL bFocus) { + bool bFocus) { if (m_pInfo && m_pInfo->FFI_SetTextFieldFocus) m_pInfo->FFI_SetTextFieldFocus(m_pInfo, focusText, nTextLen, bFocus); } @@ -417,10 +417,10 @@ void CPDFSDK_FormFillEnvironment::GetPageViewRect(FPDF_PAGE page, dstRect.right = static_cast<float>(right); } -FX_BOOL CPDFSDK_FormFillEnvironment::PopupMenu(FPDF_PAGE page, - FPDF_WIDGET hWidget, - int menuFlag, - CFX_PointF pt) { +bool CPDFSDK_FormFillEnvironment::PopupMenu(FPDF_PAGE page, + FPDF_WIDGET hWidget, + int menuFlag, + CFX_PointF pt) { return m_pInfo && m_pInfo->FFI_PopupMenu && m_pInfo->FFI_PopupMenu(m_pInfo, page, hWidget, menuFlag, pt.x, pt.y); } @@ -517,7 +517,7 @@ FPDF_BOOL CPDFSDK_FormFillEnvironment::PutRequestURL(const FX_WCHAR* wsURL, const FX_WCHAR* wsData, const FX_WCHAR* wsEncode) { if (!m_pInfo || !m_pInfo->FFI_PutRequestURL) - return FALSE; + return false; CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode(); FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength()); @@ -618,31 +618,31 @@ void CPDFSDK_FormFillEnvironment::ProcJavascriptFun() { } } -FX_BOOL CPDFSDK_FormFillEnvironment::ProcOpenAction() { +bool CPDFSDK_FormFillEnvironment::ProcOpenAction() { if (!m_pUnderlyingDoc) - return FALSE; + return false; CPDF_Dictionary* pRoot = GetPDFDocument()->GetRoot(); if (!pRoot) - return FALSE; + return false; CPDF_Object* pOpenAction = pRoot->GetDictFor("OpenAction"); if (!pOpenAction) pOpenAction = pRoot->GetArrayFor("OpenAction"); if (!pOpenAction) - return FALSE; + return false; if (pOpenAction->IsArray()) - return TRUE; + return true; if (CPDF_Dictionary* pDict = pOpenAction->AsDictionary()) { CPDF_Action action(pDict); if (GetActionHander()) GetActionHander()->DoAction_DocOpen(action, this); - return TRUE; + return true; } - return FALSE; + return false; } void CPDFSDK_FormFillEnvironment::RemovePageView( @@ -691,16 +691,16 @@ void CPDFSDK_FormFillEnvironment::UpdateAllViews(CPDFSDK_PageView* pSender, } } -FX_BOOL CPDFSDK_FormFillEnvironment::SetFocusAnnot( +bool CPDFSDK_FormFillEnvironment::SetFocusAnnot( CPDFSDK_Annot::ObservedPtr* pAnnot) { if (m_bBeingDestroyed) - return FALSE; + return false; if (m_pFocusAnnot == *pAnnot) - return TRUE; + return true; if (m_pFocusAnnot && !KillFocusAnnot(0)) - return FALSE; + return false; if (!*pAnnot) - return FALSE; + return false; #ifdef PDF_ENABLE_XFA CPDFSDK_Annot::ObservedPtr pLastFocusAnnot(m_pFocusAnnot.Get()); @@ -711,20 +711,20 @@ FX_BOOL CPDFSDK_FormFillEnvironment::SetFocusAnnot( if (!m_pFocusAnnot) { #ifdef PDF_ENABLE_XFA if (!pAnnotHandler->Annot_OnChangeFocus(pAnnot, &pLastFocusAnnot)) - return FALSE; + return false; #endif // PDF_ENABLE_XFA if (!pAnnotHandler->Annot_OnSetFocus(pAnnot, 0)) - return FALSE; + return false; if (!m_pFocusAnnot) { m_pFocusAnnot.Reset(pAnnot->Get()); - return TRUE; + return true; } } } - return FALSE; + return false; } -FX_BOOL CPDFSDK_FormFillEnvironment::KillFocusAnnot(uint32_t nFlag) { +bool CPDFSDK_FormFillEnvironment::KillFocusAnnot(uint32_t nFlag) { if (m_pFocusAnnot) { CPDFSDK_AnnotHandlerMgr* pAnnotHandler = GetAnnotHandlerMgr(); CPDFSDK_Annot::ObservedPtr pFocusAnnot(m_pFocusAnnot.Get()); @@ -733,7 +733,7 @@ FX_BOOL CPDFSDK_FormFillEnvironment::KillFocusAnnot(uint32_t nFlag) { #ifdef PDF_ENABLE_XFA CPDFSDK_Annot::ObservedPtr pNull; if (!pAnnotHandler->Annot_OnChangeFocus(&pNull, &pFocusAnnot)) - return FALSE; + return false; #endif // PDF_ENABLE_XFA if (pAnnotHandler->Annot_OnKillFocus(&pFocusAnnot, nFlag)) { @@ -743,18 +743,18 @@ FX_BOOL CPDFSDK_FormFillEnvironment::KillFocusAnnot(uint32_t nFlag) { int nFieldType = pWidget->GetFieldType(); if (FIELDTYPE_TEXTFIELD == nFieldType || FIELDTYPE_COMBOBOX == nFieldType) { - OnSetFieldInputFocus(nullptr, 0, FALSE); + OnSetFieldInputFocus(nullptr, 0, false); } } if (!m_pFocusAnnot) - return TRUE; + return true; } else { m_pFocusAnnot.Reset(pFocusAnnot.Get()); } } - return FALSE; + return false; } -FX_BOOL CPDFSDK_FormFillEnvironment::GetPermissions(int nFlag) { +bool CPDFSDK_FormFillEnvironment::GetPermissions(int nFlag) { return !!(GetPDFDocument()->GetUserPermissions() & nFlag); } diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h index 283c06a7df..2438019707 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.h +++ b/fpdfsdk/cpdfsdk_formfillenvironment.h @@ -41,21 +41,21 @@ class CPDFSDK_FormFillEnvironment void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot); CPDFSDK_Annot* GetFocusAnnot() { return m_pFocusAnnot.Get(); } - FX_BOOL SetFocusAnnot(CPDFSDK_Annot::ObservedPtr* pAnnot); - FX_BOOL KillFocusAnnot(uint32_t nFlag); + bool SetFocusAnnot(CPDFSDK_Annot::ObservedPtr* pAnnot); + bool KillFocusAnnot(uint32_t nFlag); void ClearAllFocusedAnnots(); - FX_BOOL ExtractPages(const std::vector<uint16_t>& arrExtraPages, - CPDF_Document* pDstDoc); - FX_BOOL InsertPages(int nInsertAt, - const CPDF_Document* pSrcDoc, - const std::vector<uint16_t>& arrSrcPages); - FX_BOOL ReplacePages(int nPage, - const CPDF_Document* pSrcDoc, - const std::vector<uint16_t>& arrSrcPages); + bool ExtractPages(const std::vector<uint16_t>& arrExtraPages, + CPDF_Document* pDstDoc); + bool InsertPages(int nInsertAt, + const CPDF_Document* pSrcDoc, + const std::vector<uint16_t>& arrSrcPages); + bool ReplacePages(int nPage, + const CPDF_Document* pSrcDoc, + const std::vector<uint16_t>& arrSrcPages); int GetPageCount() { return m_pUnderlyingDoc->GetPageCount(); } - FX_BOOL GetPermissions(int nFlag); + bool GetPermissions(int nFlag); bool GetChangeMark() const { return m_bChangeMask; } void SetChangeMark() { m_bChangeMask = true; } @@ -64,7 +64,7 @@ class CPDFSDK_FormFillEnvironment UnderlyingPageType* GetPage(int nIndex); void ProcJavascriptFun(); - FX_BOOL ProcOpenAction(); + bool ProcOpenAction(); void Invalidate(FPDF_PAGE page, double left, @@ -83,9 +83,9 @@ class CPDFSDK_FormFillEnvironment FX_SYSTEMTIME GetLocalTime() const; void OnChange(); - FX_BOOL IsSHIFTKeyDown(uint32_t nFlag) const; - FX_BOOL IsCTRLKeyDown(uint32_t nFlag) const; - FX_BOOL IsALTKeyDown(uint32_t nFlag) const; + bool IsSHIFTKeyDown(uint32_t nFlag) const; + bool IsCTRLKeyDown(uint32_t nFlag) const; + bool IsALTKeyDown(uint32_t nFlag) const; FPDF_PAGE GetPage(FPDF_DOCUMENT document, int nPageIndex); FPDF_PAGE GetCurrentPage(FPDF_DOCUMENT document); @@ -93,7 +93,7 @@ class CPDFSDK_FormFillEnvironment void ExecuteNamedAction(const FX_CHAR* namedAction); void OnSetFieldInputFocus(FPDF_WIDESTRING focusText, FPDF_DWORD nTextLen, - FX_BOOL bFocus); + bool bFocus); void DoURIAction(const FX_CHAR* bsURI); void DoGoToAction(int nPageIndex, int zoomMode, @@ -129,10 +129,10 @@ class CPDFSDK_FormFillEnvironment CFX_WideString GetPlatform(); void GotoURL(FPDF_DOCUMENT document, const CFX_WideStringC& wsURL); void GetPageViewRect(FPDF_PAGE page, FS_RECTF& dstRect); - FX_BOOL PopupMenu(FPDF_PAGE page, - FPDF_WIDGET hWidget, - int menuFlag, - CFX_PointF pt); + bool PopupMenu(FPDF_PAGE page, + FPDF_WIDGET hWidget, + int menuFlag, + CFX_PointF pt); void Alert(FPDF_WIDESTRING Msg, FPDF_WIDESTRING Title, int Type, int Icon); void EmailTo(FPDF_FILEHANDLER* fileHandler, @@ -196,7 +196,7 @@ class CPDFSDK_FormFillEnvironment FPDF_BOOL bAnnotations); void JS_docgotoPage(int nPageNum); - FX_BOOL IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } + bool IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } CFX_ByteString GetAppName() const { return ""; } CFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); } FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; } diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp index a8024faaea..5229f95528 100644 --- a/fpdfsdk/cpdfsdk_interform.cpp +++ b/fpdfsdk/cpdfsdk_interform.cpp @@ -49,15 +49,15 @@ CPDFSDK_InterForm::CPDFSDK_InterForm(CPDFSDK_FormFillEnvironment* pFormFillEnv) : m_pFormFillEnv(pFormFillEnv), m_pInterForm(new CPDF_InterForm(m_pFormFillEnv->GetPDFDocument())), #ifdef PDF_ENABLE_XFA - m_bXfaCalculate(TRUE), - m_bXfaValidationsEnabled(TRUE), + m_bXfaCalculate(true), + m_bXfaValidationsEnabled(true), #endif // PDF_ENABLE_XFA - m_bCalculate(TRUE), - m_bBusy(FALSE), + m_bCalculate(true), + m_bBusy(false), m_iHighlightAlpha(0) { m_pInterForm->SetFormNotify(this); for (int i = 0; i < kNumFieldTypes; ++i) - m_bNeedHightlight[i] = FALSE; + m_bNeedHightlight[i] = false; } CPDFSDK_InterForm::~CPDFSDK_InterForm() { @@ -67,12 +67,12 @@ CPDFSDK_InterForm::~CPDFSDK_InterForm() { #endif // PDF_ENABLE_XFA } -FX_BOOL CPDFSDK_InterForm::HighlightWidgets() { - return FALSE; +bool CPDFSDK_InterForm::HighlightWidgets() { + return false; } CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget, - FX_BOOL bNext) const { + bool bNext) const { std::unique_ptr<CBA_AnnotIterator> pIterator(new CBA_AnnotIterator( pWidget->GetPageView(), CPDF_Annot::Subtype::WIDGET)); @@ -169,11 +169,11 @@ void CPDFSDK_InterForm::RemoveMap(CPDF_FormControl* pControl) { m_Map.erase(pControl); } -void CPDFSDK_InterForm::EnableCalculate(FX_BOOL bEnabled) { +void CPDFSDK_InterForm::EnableCalculate(bool bEnabled) { m_bCalculate = bEnabled; } -FX_BOOL CPDFSDK_InterForm::IsCalculateEnabled() const { +bool CPDFSDK_InterForm::IsCalculateEnabled() const { return m_bCalculate; } @@ -195,22 +195,22 @@ CPDFSDK_XFAWidget* CPDFSDK_InterForm::GetXFAWidget(CXFA_FFWidget* hWidget) { return it != m_XFAMap.end() ? it->second : nullptr; } -void CPDFSDK_InterForm::XfaEnableCalculate(FX_BOOL bEnabled) { +void CPDFSDK_InterForm::XfaEnableCalculate(bool bEnabled) { m_bXfaCalculate = bEnabled; } -FX_BOOL CPDFSDK_InterForm::IsXfaCalculateEnabled() const { +bool CPDFSDK_InterForm::IsXfaCalculateEnabled() const { return m_bXfaCalculate; } -FX_BOOL CPDFSDK_InterForm::IsXfaValidationsEnabled() { +bool CPDFSDK_InterForm::IsXfaValidationsEnabled() { return m_bXfaValidationsEnabled; } -void CPDFSDK_InterForm::XfaSetValidationsEnabled(FX_BOOL bEnabled) { +void CPDFSDK_InterForm::XfaSetValidationsEnabled(bool bEnabled) { m_bXfaValidationsEnabled = bEnabled; } void CPDFSDK_InterForm::SynchronizeField(CPDF_FormField* pFormField, - FX_BOOL bSynchronizeElse) { + bool bSynchronizeElse) { for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) { CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl, false)) @@ -226,10 +226,10 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { if (m_bBusy) return; - m_bBusy = TRUE; + m_bBusy = true; if (!IsCalculateEnabled()) { - m_bBusy = FALSE; + m_bBusy = false; return; } @@ -259,25 +259,25 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { IJS_Context* pContext = pRuntime->NewContext(); CFX_WideString sOldValue = pField->GetValue(); CFX_WideString sValue = sOldValue; - FX_BOOL bRC = TRUE; + bool bRC = true; pContext->OnField_Calculate(pFormField, pField, sValue, bRC); CFX_WideString sInfo; - FX_BOOL bRet = pContext->RunScript(csJS, &sInfo); + bool bRet = pContext->RunScript(csJS, &sInfo); pRuntime->ReleaseContext(pContext); if (bRet && bRC && sValue.Compare(sOldValue) != 0) - pField->SetValue(sValue, TRUE); + pField->SetValue(sValue, true); } - m_bBusy = FALSE; + m_bBusy = false; } CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, - FX_BOOL& bFormatted) { + bool& bFormatted) { CFX_WideString sValue = pFormField->GetValue(); if (!m_pFormFillEnv->IsJSInitiated()) { - bFormatted = FALSE; + bFormatted = false; return sValue; } @@ -289,7 +289,7 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, sValue = pFormField->GetOptionLabel(index); } - bFormatted = FALSE; + bFormatted = false; CPDF_AAction aAction = pFormField->GetAdditionalAction(); if (aAction.GetDict() && aAction.ActionExist(CPDF_AAction::Format)) { @@ -300,14 +300,14 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, CFX_WideString Value = sValue; IJS_Context* pContext = pRuntime->NewContext(); - pContext->OnField_Format(pFormField, Value, TRUE); + pContext->OnField_Format(pFormField, Value, true); CFX_WideString sInfo; - FX_BOOL bRet = pContext->RunScript(script, &sInfo); + bool bRet = pContext->RunScript(script, &sInfo); pRuntime->ReleaseContext(pContext); if (bRet) { sValue = Value; - bFormatted = TRUE; + bFormatted = true; } } } @@ -318,7 +318,7 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField, const CFX_WideString* sValue, - FX_BOOL bValueChanged) { + bool bValueChanged) { for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) { CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); ASSERT(pFormCtrl); @@ -344,15 +344,15 @@ void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) { } } -FX_BOOL CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, - const CFX_WideString& csValue) { +bool CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, + const CFX_WideString& csValue) { CPDF_AAction aAction = pFormField->GetAdditionalAction(); if (!aAction.GetDict() || !aAction.ActionExist(CPDF_AAction::KeyStroke)) - return TRUE; + return true; CPDF_Action action = aAction.GetAction(CPDF_AAction::KeyStroke); if (!action.GetDict()) - return TRUE; + return true; CPDFSDK_ActionHandler* pActionHandler = m_pFormFillEnv->GetActionHander(); PDFSDK_FieldAction fa; @@ -364,15 +364,15 @@ FX_BOOL CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, return fa.bRC; } -FX_BOOL CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, - const CFX_WideString& csValue) { +bool CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, + const CFX_WideString& csValue) { CPDF_AAction aAction = pFormField->GetAdditionalAction(); if (!aAction.GetDict() || !aAction.ActionExist(CPDF_AAction::Validate)) - return TRUE; + return true; CPDF_Action action = aAction.GetAction(CPDF_AAction::Validate); if (!action.GetDict()) - return TRUE; + return true; CPDFSDK_ActionHandler* pActionHandler = m_pFormFillEnv->GetActionHander(); PDFSDK_FieldAction fa; @@ -384,7 +384,7 @@ FX_BOOL CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, return fa.bRC; } -FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { +bool CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { ASSERT(action.GetDict()); CPDF_ActionFields af(&action); @@ -392,7 +392,7 @@ FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects); bool bHide = action.GetHideStatus(); - FX_BOOL bChanged = FALSE; + bool bChanged = false; for (CPDF_FormField* pField : fields) { for (int i = 0, sz = pField->CountControls(); i < sz; ++i) { @@ -409,7 +409,7 @@ FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { nFlags &= ~ANNOTFLAG_HIDDEN; pWidget->SetFlags(nFlags); pWidget->GetPageView()->UpdateView(pWidget); - bChanged = TRUE; + bChanged = true; } } } @@ -417,10 +417,10 @@ FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { return bChanged; } -FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) { +bool CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) { CFX_WideString sDestination = action.GetFilePath(); if (sDestination.IsEmpty()) - return FALSE; + return false; CPDF_Dictionary* pActionDict = action.GetDict(); if (pActionDict->KeyExist("Fields")) { @@ -431,22 +431,21 @@ FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) { if (!fields.empty()) { bool bIncludeOrExclude = !(dwFlags & 0x01); if (m_pInterForm->CheckRequiredFields(&fields, bIncludeOrExclude)) - return FALSE; + return false; return SubmitFields(sDestination, fields, bIncludeOrExclude, false); } } if (m_pInterForm->CheckRequiredFields(nullptr, true)) - return FALSE; + return false; - return SubmitForm(sDestination, FALSE); + return SubmitForm(sDestination, false); } -FX_BOOL CPDFSDK_InterForm::SubmitFields( - const CFX_WideString& csDestination, - const std::vector<CPDF_FormField*>& fields, - bool bIncludeOrExclude, - bool bUrlEncoded) { +bool CPDFSDK_InterForm::SubmitFields(const CFX_WideString& csDestination, + const std::vector<CPDF_FormField*>& fields, + bool bIncludeOrExclude, + bool bUrlEncoded) { CFX_ByteTextBuf textBuf; ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude, textBuf); @@ -454,30 +453,30 @@ FX_BOOL CPDFSDK_InterForm::SubmitFields( FX_STRSIZE nBufSize = textBuf.GetLength(); if (bUrlEncoded && !FDFToURLEncodedData(pBuffer, nBufSize)) - return FALSE; + return false; m_pFormFillEnv->JS_docSubmitForm(pBuffer, nBufSize, csDestination.c_str()); - return TRUE; + return true; } -FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(CFX_WideString csFDFFile, - CFX_WideString csTxtFile) { - return TRUE; +bool CPDFSDK_InterForm::FDFToURLEncodedData(CFX_WideString csFDFFile, + CFX_WideString csTxtFile) { + return true; } -FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, - FX_STRSIZE& nBufSize) { +bool CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, + FX_STRSIZE& nBufSize) { CFDF_Document* pFDF = CFDF_Document::ParseMemory(pBuf, nBufSize); if (!pFDF) - return TRUE; + return true; CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDictFor("FDF"); if (!pMainDict) - return FALSE; + return false; CPDF_Array* pFields = pMainDict->GetArrayFor("Fields"); if (!pFields) - return FALSE; + return false; CFX_ByteTextBuf fdfEncodedData; for (uint32_t i = 0; i < pFields->GetCount(); i++) { @@ -503,17 +502,17 @@ FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, nBufSize = fdfEncodedData.GetLength(); pBuf = FX_Alloc(uint8_t, nBufSize); FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize); - return TRUE; + return true; } -FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf( +bool CPDFSDK_InterForm::ExportFieldsToFDFTextBuf( const std::vector<CPDF_FormField*>& fields, bool bIncludeOrExclude, CFX_ByteTextBuf& textBuf) { std::unique_ptr<CFDF_Document> pFDF( m_pInterForm->ExportToFDF(m_pFormFillEnv->JS_docGetFilePath().AsStringC(), fields, bIncludeOrExclude, false)); - return pFDF ? pFDF->WriteBuf(textBuf) : FALSE; + return pFDF ? pFDF->WriteBuf(textBuf) : false; } CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName( @@ -521,53 +520,53 @@ CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName( return L""; } -FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, - FX_BOOL bUrlEncoded) { +bool CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, + bool bUrlEncoded) { if (sDestination.IsEmpty()) - return FALSE; + return false; if (!m_pFormFillEnv || !m_pInterForm) - return FALSE; + return false; CFX_WideString wsPDFFilePath = m_pFormFillEnv->JS_docGetFilePath(); CFDF_Document* pFDFDoc = m_pInterForm->ExportToFDF(wsPDFFilePath.AsStringC(), false); if (!pFDFDoc) - return FALSE; + return false; CFX_ByteTextBuf FdfBuffer; - FX_BOOL bRet = pFDFDoc->WriteBuf(FdfBuffer); + bool bRet = pFDFDoc->WriteBuf(FdfBuffer); delete pFDFDoc; if (!bRet) - return FALSE; + return false; uint8_t* pBuffer = FdfBuffer.GetBuffer(); FX_STRSIZE nBufSize = FdfBuffer.GetLength(); if (bUrlEncoded && !FDFToURLEncodedData(pBuffer, nBufSize)) - return FALSE; + return false; m_pFormFillEnv->JS_docSubmitForm(pBuffer, nBufSize, sDestination.c_str()); if (bUrlEncoded) FX_Free(pBuffer); - return TRUE; + return true; } -FX_BOOL CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf) { +bool CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf) { CFDF_Document* pFDF = m_pInterForm->ExportToFDF( m_pFormFillEnv->JS_docGetFilePath().AsStringC(), false); if (!pFDF) - return FALSE; + return false; - FX_BOOL bRet = pFDF->WriteBuf(textBuf); + bool bRet = pFDF->WriteBuf(textBuf); delete pFDF; return bRet; } -FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) { +bool CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) { ASSERT(action.GetDict()); CPDF_Dictionary* pActionDict = action.GetDict(); @@ -582,8 +581,8 @@ FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) { return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), true); } -FX_BOOL CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action) { - return FALSE; +bool CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action) { + return false; } std::vector<CPDF_FormField*> CPDFSDK_InterForm::GetFieldFromObjects( @@ -617,14 +616,14 @@ int CPDFSDK_InterForm::BeforeValueChange(CPDF_FormField* pField, void CPDFSDK_InterForm::AfterValueChange(CPDF_FormField* pField) { #ifdef PDF_ENABLE_XFA - SynchronizeField(pField, FALSE); + SynchronizeField(pField, false); #endif // PDF_ENABLE_XFA int nType = pField->GetFieldType(); if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) { OnCalculate(pField); - FX_BOOL bFormatted = FALSE; + bool bFormatted = false; CFX_WideString sValue = OnFormat(pField, bFormatted); - ResetFieldAppearance(pField, bFormatted ? &sValue : nullptr, TRUE); + ResetFieldAppearance(pField, bFormatted ? &sValue : nullptr, true); UpdateField(pField); } } @@ -648,7 +647,7 @@ void CPDFSDK_InterForm::AfterSelectionChange(CPDF_FormField* pField) { return; OnCalculate(pField); - ResetFieldAppearance(pField, nullptr, TRUE); + ResetFieldAppearance(pField, nullptr, true); UpdateField(pField); } @@ -677,15 +676,15 @@ void CPDFSDK_InterForm::AfterFormImportData(CPDF_InterForm* pForm) { OnCalculate(nullptr); } -FX_BOOL CPDFSDK_InterForm::IsNeedHighLight(int nFieldType) { +bool CPDFSDK_InterForm::IsNeedHighLight(int nFieldType) { if (nFieldType < 1 || nFieldType > kNumFieldTypes) - return FALSE; + return false; return m_bNeedHightlight[nFieldType - 1]; } void CPDFSDK_InterForm::RemoveAllHighLight() { for (int i = 0; i < kNumFieldTypes; ++i) - m_bNeedHightlight[i] = FALSE; + m_bNeedHightlight[i] = false; } void CPDFSDK_InterForm::SetHighlightColor(FX_COLORREF clr, int nFieldType) { @@ -695,13 +694,13 @@ void CPDFSDK_InterForm::SetHighlightColor(FX_COLORREF clr, int nFieldType) { case 0: { for (int i = 0; i < kNumFieldTypes; ++i) { m_aHighlightColor[i] = clr; - m_bNeedHightlight[i] = TRUE; + m_bNeedHightlight[i] = true; } break; } default: { m_aHighlightColor[nFieldType - 1] = clr; - m_bNeedHightlight[nFieldType - 1] = TRUE; + m_bNeedHightlight[nFieldType - 1] = true; break; } } diff --git a/fpdfsdk/cpdfsdk_interform.h b/fpdfsdk/cpdfsdk_interform.h index f6848f3def..f0921a97f4 100644 --- a/fpdfsdk/cpdfsdk_interform.h +++ b/fpdfsdk/cpdfsdk_interform.h @@ -36,9 +36,9 @@ class CPDFSDK_InterForm : public IPDF_FormNotify { CPDF_InterForm* GetInterForm() const { return m_pInterForm.get(); } CPDFSDK_FormFillEnvironment* GetFormFillEnv() const { return m_pFormFillEnv; } - FX_BOOL HighlightWidgets(); + bool HighlightWidgets(); - CPDFSDK_Widget* GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL bNext) const; + CPDFSDK_Widget* GetSibling(CPDFSDK_Widget* pWidget, bool bNext) const; CPDFSDK_Widget* GetWidget(CPDF_FormControl* pControl, bool createIfNeeded) const; void GetWidgets(const CFX_WideString& sFieldName, @@ -49,51 +49,51 @@ class CPDFSDK_InterForm : public IPDF_FormNotify { void AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidget); void RemoveMap(CPDF_FormControl* pControl); - void EnableCalculate(FX_BOOL bEnabled); - FX_BOOL IsCalculateEnabled() const; + void EnableCalculate(bool bEnabled); + bool IsCalculateEnabled() const; #ifdef PDF_ENABLE_XFA void AddXFAMap(CXFA_FFWidget* hWidget, CPDFSDK_XFAWidget* pWidget); void RemoveXFAMap(CXFA_FFWidget* hWidget); CPDFSDK_XFAWidget* GetXFAWidget(CXFA_FFWidget* hWidget); - void XfaEnableCalculate(FX_BOOL bEnabled); - FX_BOOL IsXfaCalculateEnabled() const; - FX_BOOL IsXfaValidationsEnabled(); - void XfaSetValidationsEnabled(FX_BOOL bEnabled); - void SynchronizeField(CPDF_FormField* pFormField, FX_BOOL bSynchronizeElse); + void XfaEnableCalculate(bool bEnabled); + bool IsXfaCalculateEnabled() const; + bool IsXfaValidationsEnabled(); + void XfaSetValidationsEnabled(bool bEnabled); + void SynchronizeField(CPDF_FormField* pFormField, bool bSynchronizeElse); #endif // PDF_ENABLE_XFA - FX_BOOL OnKeyStrokeCommit(CPDF_FormField* pFormField, - const CFX_WideString& csValue); - FX_BOOL OnValidate(CPDF_FormField* pFormField, const CFX_WideString& csValue); + bool OnKeyStrokeCommit(CPDF_FormField* pFormField, + const CFX_WideString& csValue); + bool OnValidate(CPDF_FormField* pFormField, const CFX_WideString& csValue); void OnCalculate(CPDF_FormField* pFormField = nullptr); - CFX_WideString OnFormat(CPDF_FormField* pFormField, FX_BOOL& bFormatted); + CFX_WideString OnFormat(CPDF_FormField* pFormField, bool& bFormatted); void ResetFieldAppearance(CPDF_FormField* pFormField, const CFX_WideString* sValue, - FX_BOOL bValueChanged); + bool bValueChanged); void UpdateField(CPDF_FormField* pFormField); - FX_BOOL DoAction_Hide(const CPDF_Action& action); - FX_BOOL DoAction_SubmitForm(const CPDF_Action& action); - FX_BOOL DoAction_ResetForm(const CPDF_Action& action); - FX_BOOL DoAction_ImportData(const CPDF_Action& action); + bool DoAction_Hide(const CPDF_Action& action); + bool DoAction_SubmitForm(const CPDF_Action& action); + bool DoAction_ResetForm(const CPDF_Action& action); + bool DoAction_ImportData(const CPDF_Action& action); std::vector<CPDF_FormField*> GetFieldFromObjects( const std::vector<CPDF_Object*>& objects) const; - FX_BOOL IsValidField(CPDF_Dictionary* pFieldDict); - FX_BOOL SubmitFields(const CFX_WideString& csDestination, - const std::vector<CPDF_FormField*>& fields, - 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, - bool bIncludeOrExclude, - CFX_ByteTextBuf& textBuf); + bool IsValidField(CPDF_Dictionary* pFieldDict); + bool SubmitFields(const CFX_WideString& csDestination, + const std::vector<CPDF_FormField*>& fields, + bool bIncludeOrExclude, + bool bUrlEncoded); + bool SubmitForm(const CFX_WideString& sDestination, bool bUrlEncoded); + bool ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf); + bool ExportFieldsToFDFTextBuf(const std::vector<CPDF_FormField*>& fields, + bool bIncludeOrExclude, + CFX_ByteTextBuf& textBuf); CFX_WideString GetTemporaryFileName(const CFX_WideString& sFileExt); - FX_BOOL IsNeedHighLight(int nFieldType); + bool IsNeedHighLight(int nFieldType); void RemoveAllHighLight(); void SetHighlightAlpha(uint8_t alpha) { m_iHighlightAlpha = alpha; } uint8_t GetHighlightAlpha() { return m_iHighlightAlpha; } @@ -114,9 +114,8 @@ class CPDFSDK_InterForm : public IPDF_FormNotify { int BeforeFormImportData(CPDF_InterForm* pForm) override; void AfterFormImportData(CPDF_InterForm* pForm) override; - FX_BOOL FDFToURLEncodedData(CFX_WideString csFDFFile, - CFX_WideString csTxtFile); - FX_BOOL FDFToURLEncodedData(uint8_t*& pBuf, FX_STRSIZE& nBufSize); + bool FDFToURLEncodedData(CFX_WideString csFDFFile, CFX_WideString csTxtFile); + bool FDFToURLEncodedData(uint8_t*& pBuf, FX_STRSIZE& nBufSize); int GetPageIndexByAnnotDict(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict) const; @@ -127,18 +126,18 @@ class CPDFSDK_InterForm : public IPDF_FormNotify { CPDFSDK_WidgetMap m_Map; #ifdef PDF_ENABLE_XFA std::map<CXFA_FFWidget*, CPDFSDK_XFAWidget*> m_XFAMap; - FX_BOOL m_bXfaCalculate; - FX_BOOL m_bXfaValidationsEnabled; + bool m_bXfaCalculate; + bool m_bXfaValidationsEnabled; static const int kNumFieldTypes = 7; #else // PDF_ENABLE_XFA static const int kNumFieldTypes = 6; #endif // PDF_ENABLE_XFA - FX_BOOL m_bCalculate; - FX_BOOL m_bBusy; + bool m_bCalculate; + bool m_bBusy; FX_COLORREF m_aHighlightColor[kNumFieldTypes]; uint8_t m_iHighlightAlpha; - FX_BOOL m_bNeedHightlight[kNumFieldTypes]; + bool m_bNeedHightlight[kNumFieldTypes]; }; #endif // FPDFSDK_CPDFSDK_INTERFORM_H_ diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp index 5a384d5f1f..fedc95a6ad 100644 --- a/fpdfsdk/cpdfsdk_pageview.cpp +++ b/fpdfsdk/cpdfsdk_pageview.cpp @@ -36,11 +36,11 @@ CPDFSDK_PageView::CPDFSDK_PageView(CPDFSDK_FormFillEnvironment* pFormFillEnv, #ifndef PDF_ENABLE_XFA m_bOwnsPage(false), #endif // PDF_ENABLE_XFA - m_bEnterWidget(FALSE), - m_bExitWidget(FALSE), - m_bOnWidget(FALSE), - m_bValid(FALSE), - m_bLocked(FALSE), + m_bEnterWidget(false), + m_bExitWidget(false), + m_bOnWidget(false), + m_bValid(false), + m_bLocked(false), m_bBeingDestroyed(false) { CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); if (pInterForm) { @@ -105,7 +105,7 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, gs.SetClipRect(rectClip); std::unique_ptr<CXFA_RenderContext> pRenderContext(new CXFA_RenderContext); CXFA_RenderOptions renderOptions; - renderOptions.m_bHighlight = TRUE; + renderOptions.m_bHighlight = true; CXFA_FFPageView* xfaView = pPage->GetXFAPageView(); pRenderContext->StartRender(xfaView, &gs, *pUser2Device, renderOptions); pRenderContext->DoRender(); @@ -118,7 +118,7 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, return; // Render the focus widget docView->GetWidgetHandler()->RenderWidget(annot->GetXFAWidget(), &gs, - pUser2Device, FALSE); + pUser2Device, false); return; } #endif // PDF_ENABLE_XFA @@ -187,13 +187,13 @@ CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(CXFA_FFWidget* pPDFAnnot) { return pSDKAnnot; } -FX_BOOL CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) { +bool CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) { if (!pAnnot) - return FALSE; + return false; CPDFXFA_Page* pPage = pAnnot->GetPDFXFAPage(); if (!pPage || (pPage->GetContext()->GetDocType() != DOCTYPE_STATIC_XFA && pPage->GetContext()->GetDocType() != DOCTYPE_DYNAMIC_XFA)) - return FALSE; + return false; if (GetFocusAnnot() == pAnnot) m_pFormFillEnv->KillFocusAnnot(0); @@ -207,7 +207,7 @@ FX_BOOL CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) { if (m_pCaptureWidget.Get() == pAnnot) m_pCaptureWidget.Reset(); - return TRUE; + return true; } #endif // PDF_ENABLE_XFA @@ -251,63 +251,62 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByXFAWidget(CXFA_FFWidget* hWidget) { } #endif // PDF_ENABLE_XFA -FX_BOOL CPDFSDK_PageView::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPDFSDK_PageView::OnLButtonDown(const CFX_FloatPoint& point, + uint32_t nFlag) { CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point.x, point.y)); if (!pAnnot) { m_pFormFillEnv->KillFocusAnnot(nFlag); - return FALSE; + return false; } CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); if (!pAnnotHandlerMgr->Annot_OnLButtonDown(this, &pAnnot, nFlag, point)) - return FALSE; + return false; if (!pAnnot) - return FALSE; + return false; m_pFormFillEnv->SetFocusAnnot(&pAnnot); - return TRUE; + return true; } #ifdef PDF_ENABLE_XFA -FX_BOOL CPDFSDK_PageView::OnRButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPDFSDK_PageView::OnRButtonDown(const CFX_FloatPoint& point, + uint32_t nFlag) { CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point.x, point.y)); if (!pAnnot) - return FALSE; + return false; CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); - FX_BOOL ok = - pAnnotHandlerMgr->Annot_OnRButtonDown(this, &pAnnot, nFlag, point); + bool ok = pAnnotHandlerMgr->Annot_OnRButtonDown(this, &pAnnot, nFlag, point); if (!pAnnot) - return FALSE; + return false; if (ok) m_pFormFillEnv->SetFocusAnnot(&pAnnot); - return TRUE; + return true; } -FX_BOOL CPDFSDK_PageView::OnRButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPDFSDK_PageView::OnRButtonUp(const CFX_FloatPoint& point, + uint32_t nFlag) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point.x, point.y)); if (!pFXAnnot) - return FALSE; + return false; if (pAnnotHandlerMgr->Annot_OnRButtonUp(this, &pFXAnnot, nFlag, point)) m_pFormFillEnv->SetFocusAnnot(&pFXAnnot); - return TRUE; + return true; } #endif // PDF_ENABLE_XFA -FX_BOOL CPDFSDK_PageView::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPDFSDK_PageView::OnLButtonUp(const CFX_FloatPoint& point, + uint32_t nFlag) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point.x, point.y)); @@ -315,51 +314,51 @@ FX_BOOL CPDFSDK_PageView::OnLButtonUp(const CFX_FloatPoint& point, if (pFocusAnnot && pFocusAnnot != pFXAnnot) { // Last focus Annot gets a chance to handle the event. if (pAnnotHandlerMgr->Annot_OnLButtonUp(this, &pFocusAnnot, nFlag, point)) - return TRUE; + return true; } return pFXAnnot && pAnnotHandlerMgr->Annot_OnLButtonUp(this, &pFXAnnot, nFlag, point); } -FX_BOOL CPDFSDK_PageView::OnMouseMove(const CFX_FloatPoint& point, int nFlag) { +bool CPDFSDK_PageView::OnMouseMove(const CFX_FloatPoint& point, int nFlag) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXAnnotAtPoint(point.x, point.y)); if (pFXAnnot) { if (m_pCaptureWidget && m_pCaptureWidget != pFXAnnot) { - m_bExitWidget = TRUE; - m_bEnterWidget = FALSE; + m_bExitWidget = true; + m_bEnterWidget = false; pAnnotHandlerMgr->Annot_OnMouseExit(this, &m_pCaptureWidget, nFlag); } m_pCaptureWidget.Reset(pFXAnnot.Get()); - m_bOnWidget = TRUE; + m_bOnWidget = true; if (!m_bEnterWidget) { - m_bEnterWidget = TRUE; - m_bExitWidget = FALSE; + m_bEnterWidget = true; + m_bExitWidget = false; pAnnotHandlerMgr->Annot_OnMouseEnter(this, &pFXAnnot, nFlag); } pAnnotHandlerMgr->Annot_OnMouseMove(this, &pFXAnnot, nFlag, point); - return TRUE; + return true; } if (m_bOnWidget) { - m_bOnWidget = FALSE; - m_bExitWidget = TRUE; - m_bEnterWidget = FALSE; + m_bOnWidget = false; + m_bExitWidget = true; + m_bEnterWidget = false; if (m_pCaptureWidget) { pAnnotHandlerMgr->Annot_OnMouseExit(this, &m_pCaptureWidget, nFlag); m_pCaptureWidget.Reset(); } } - return FALSE; + return false; } -FX_BOOL CPDFSDK_PageView::OnMouseWheel(double deltaX, - double deltaY, - const CFX_FloatPoint& point, - int nFlag) { +bool CPDFSDK_PageView::OnMouseWheel(double deltaX, + double deltaY, + const CFX_FloatPoint& point, + int nFlag) { CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point.x, point.y)); if (!pAnnot) - return FALSE; + return false; CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); @@ -367,34 +366,34 @@ FX_BOOL CPDFSDK_PageView::OnMouseWheel(double deltaX, point); } -FX_BOOL CPDFSDK_PageView::OnChar(int nChar, uint32_t nFlag) { +bool CPDFSDK_PageView::OnChar(int nChar, uint32_t nFlag) { if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); return pAnnotHandlerMgr->Annot_OnChar(pAnnot, nChar, nFlag); } - return FALSE; + return false; } -FX_BOOL CPDFSDK_PageView::OnKeyDown(int nKeyCode, int nFlag) { +bool CPDFSDK_PageView::OnKeyDown(int nKeyCode, int nFlag) { if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); return pAnnotHandlerMgr->Annot_OnKeyDown(pAnnot, nKeyCode, nFlag); } - return FALSE; + return false; } -FX_BOOL CPDFSDK_PageView::OnKeyUp(int nKeyCode, int nFlag) { - return FALSE; +bool CPDFSDK_PageView::OnKeyUp(int nKeyCode, int nFlag) { + return false; } void CPDFSDK_PageView::LoadFXAnnots() { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); - SetLock(TRUE); + SetLock(true); #ifdef PDF_ENABLE_XFA CFX_RetainPtr<CPDFXFA_Page> protector(m_page); @@ -405,7 +404,7 @@ void CPDFSDK_PageView::LoadFXAnnots() { XFA_TRAVERSEWAY_Form, XFA_WidgetStatus_Visible | XFA_WidgetStatus_Viewable)); if (!pWidgetHander) { - SetLock(FALSE); + SetLock(false); return; } @@ -417,7 +416,7 @@ void CPDFSDK_PageView::LoadFXAnnots() { pAnnotHandlerMgr->Annot_OnLoad(pAnnot); } - SetLock(FALSE); + SetLock(false); return; } #endif // PDF_ENABLE_XFA @@ -441,7 +440,7 @@ void CPDFSDK_PageView::LoadFXAnnots() { pAnnotHandlerMgr->Annot_OnLoad(pAnnot); } - SetLock(FALSE); + SetLock(false); } void CPDFSDK_PageView::UpdateRects(const std::vector<CFX_FloatRect>& rects) { diff --git a/fpdfsdk/cpdfsdk_pageview.h b/fpdfsdk/cpdfsdk_pageview.h index 6878324514..9a3443b4b0 100644 --- a/fpdfsdk/cpdfsdk_pageview.h +++ b/fpdfsdk/cpdfsdk_pageview.h @@ -49,7 +49,7 @@ class CPDFSDK_PageView final : public CPDF_Page::View { CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary* pDict); #ifdef PDF_ENABLE_XFA - FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot); + bool DeleteAnnot(CPDFSDK_Annot* pAnnot); CPDFSDK_Annot* AddAnnot(CXFA_FFWidget* pPDFAnnot); CPDFSDK_Annot* GetAnnotByXFAWidget(CXFA_FFWidget* hWidget); @@ -59,21 +59,21 @@ class CPDFSDK_PageView final : public CPDF_Page::View { CPDF_Page* GetPDFPage() const; CPDF_Document* GetPDFDocument(); CPDFSDK_FormFillEnvironment* GetFormFillEnv() const { return m_pFormFillEnv; } - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); #ifdef PDF_ENABLE_XFA - FX_BOOL OnRButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); - FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); + bool OnRButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); + bool OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); #endif // PDF_ENABLE_XFA - FX_BOOL OnChar(int nChar, uint32_t nFlag); - FX_BOOL OnKeyDown(int nKeyCode, int nFlag); - FX_BOOL OnKeyUp(int nKeyCode, int nFlag); + bool OnChar(int nChar, uint32_t nFlag); + bool OnKeyDown(int nKeyCode, int nFlag); + bool OnKeyUp(int nKeyCode, int nFlag); - FX_BOOL OnMouseMove(const CFX_FloatPoint& point, int nFlag); - FX_BOOL OnMouseWheel(double deltaX, - double deltaY, - const CFX_FloatPoint& point, - int nFlag); + bool OnMouseMove(const CFX_FloatPoint& point, int nFlag); + bool OnMouseWheel(double deltaX, + double deltaY, + const CFX_FloatPoint& point, + int nFlag); void GetCurrentMatrix(CFX_Matrix& matrix) { matrix = m_curMatrix; } void UpdateRects(const std::vector<CFX_FloatRect>& rects); @@ -81,11 +81,11 @@ class CPDFSDK_PageView final : public CPDF_Page::View { int GetPageIndex() const; - void SetValid(FX_BOOL bValid) { m_bValid = bValid; } - FX_BOOL IsValid() { return m_bValid; } + void SetValid(bool bValid) { m_bValid = bValid; } + bool IsValid() { return m_bValid; } - void SetLock(FX_BOOL bLocked) { m_bLocked = bLocked; } - FX_BOOL IsLocked() { return m_bLocked; } + void SetLock(bool bLocked) { m_bLocked = bLocked; } + bool IsLocked() { return m_bLocked; } void SetBeingDestroyed() { m_bBeingDestroyed = true; } bool IsBeingDestroyed() const { return m_bBeingDestroyed; } @@ -107,11 +107,11 @@ class CPDFSDK_PageView final : public CPDF_Page::View { #ifndef PDF_ENABLE_XFA bool m_bOwnsPage; #endif // PDF_ENABLE_XFA - FX_BOOL m_bEnterWidget; - FX_BOOL m_bExitWidget; - FX_BOOL m_bOnWidget; - FX_BOOL m_bValid; - FX_BOOL m_bLocked; + bool m_bEnterWidget; + bool m_bExitWidget; + bool m_bOnWidget; + bool m_bValid; + bool m_bLocked; bool m_bBeingDestroyed; }; diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index 4ef636b1e3..b1c3379ac9 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -139,7 +139,7 @@ static XFA_EVENTTYPE GetXFAEventType(PDFSDK_XFAAActionType eXFAAAT) { } static XFA_EVENTTYPE GetXFAEventType(CPDF_AAction::AActionType eAAT, - FX_BOOL bWillCommit) { + bool bWillCommit) { XFA_EVENTTYPE eEventType = XFA_EVENT_Unknown; switch (eAAT) { @@ -191,14 +191,14 @@ static XFA_EVENTTYPE GetXFAEventType(CPDF_AAction::AActionType eAAT, return eEventType; } -FX_BOOL CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) { +bool CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) { CXFA_FFWidget* hWidget = GetMixXFAWidget(); if (!hWidget) - return FALSE; + return false; CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler(); if (!pXFAWidgetHandler) - return FALSE; + return false; XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); @@ -208,7 +208,7 @@ FX_BOOL CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) { if (CXFA_FFWidget* hGroupWidget = GetGroupMixXFAWidget()) { pAcc = hGroupWidget->GetDataAcc(); if (pXFAWidgetHandler->HasEvent(pAcc, eEventType)) - return TRUE; + return true; } } @@ -216,22 +216,22 @@ FX_BOOL CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) { return pXFAWidgetHandler->HasEvent(pAcc, eEventType); } -FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, - PDFSDK_FieldAction& data, - CPDFSDK_PageView* pPageView) { +bool CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, + PDFSDK_FieldAction& data, + CPDFSDK_PageView* pPageView) { CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext(); CXFA_FFWidget* hWidget = GetMixXFAWidget(); if (!hWidget) - return FALSE; + return false; XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); if (eEventType == XFA_EVENT_Unknown) - return FALSE; + return false; CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler(); if (!pXFAWidgetHandler) - return FALSE; + return false; CXFA_EventParam param; param.m_eType = eEventType; @@ -258,7 +258,7 @@ FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, param.m_pTarget = pAcc; if (pXFAWidgetHandler->ProcessEvent(pAcc, ¶m) != XFA_EVENTERROR_Success) { - return FALSE; + return false; } } } @@ -272,7 +272,7 @@ FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, return nRet == XFA_EVENTERROR_Success; } -void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) { +void CPDFSDK_Widget::Synchronize(bool bSynchronizeElse) { CXFA_FFWidget* hWidget = GetMixXFAWidget(); if (!hWidget) return; @@ -300,7 +300,7 @@ void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) { for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) { int nIndex = pFormField->GetSelectedIndex(i); if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems()) - pWidgetAcc->SetItemState(nIndex, TRUE, false, FALSE, TRUE); + pWidgetAcc->SetItemState(nIndex, true, false, false, true); } break; } @@ -310,7 +310,7 @@ void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) { for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) { int nIndex = pFormField->GetSelectedIndex(i); if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems()) - pWidgetAcc->SetItemState(nIndex, TRUE, false, FALSE, TRUE); + pWidgetAcc->SetItemState(nIndex, true, false, false, true); } pWidgetAcc->SetValue(pFormField->GetValue(), XFA_VALUEPICTURE_Edit); break; @@ -377,39 +377,39 @@ void CPDFSDK_Widget::SynchronizeXFAValue(CXFA_FFDocView* pXFADocView, if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { CFX_WideString sValue; pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display); - pFormField->SetValue(sValue, TRUE); + pFormField->SetValue(sValue, true); } break; } case FIELDTYPE_LISTBOX: { - pFormField->ClearSelection(FALSE); + pFormField->ClearSelection(false); if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { for (int i = 0, sz = pWidgetAcc->CountSelectedItems(); i < sz; i++) { int nIndex = pWidgetAcc->GetSelectedItem(i); if (nIndex > -1 && nIndex < pFormField->CountOptions()) { - pFormField->SetItemSelection(nIndex, TRUE, TRUE); + pFormField->SetItemSelection(nIndex, true, true); } } } break; } case FIELDTYPE_COMBOBOX: { - pFormField->ClearSelection(FALSE); + pFormField->ClearSelection(false); if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { for (int i = 0, sz = pWidgetAcc->CountSelectedItems(); i < sz; i++) { int nIndex = pWidgetAcc->GetSelectedItem(i); if (nIndex > -1 && nIndex < pFormField->CountOptions()) { - pFormField->SetItemSelection(nIndex, TRUE, TRUE); + pFormField->SetItemSelection(nIndex, true, true); } } CFX_WideString sValue; pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display); - pFormField->SetValue(sValue, TRUE); + pFormField->SetValue(sValue, true); } break; } @@ -424,44 +424,43 @@ void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, switch (pFormField->GetFieldType()) { case FIELDTYPE_LISTBOX: { - pFormField->ClearSelection(FALSE); - pFormField->ClearOptions(TRUE); + pFormField->ClearSelection(false); + pFormField->ClearOptions(true); if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(); i < sz; i++) { CFX_WideString swText; pWidgetAcc->GetChoiceListItem(swText, i); - pFormField->InsertOption(swText, i, TRUE); + pFormField->InsertOption(swText, i, true); } } break; } case FIELDTYPE_COMBOBOX: { - pFormField->ClearSelection(FALSE); - pFormField->ClearOptions(FALSE); + pFormField->ClearSelection(false); + pFormField->ClearOptions(false); if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(); i < sz; i++) { CFX_WideString swText; pWidgetAcc->GetChoiceListItem(swText, i); - pFormField->InsertOption(swText, i, FALSE); + pFormField->InsertOption(swText, i, false); } } - pFormField->SetValue(L"", TRUE); + pFormField->SetValue(L"", true); break; } } } #endif // PDF_ENABLE_XFA -FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid( - CPDF_Annot::AppearanceMode mode) { +bool CPDFSDK_Widget::IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode) { CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDictFor("AP"); if (!pAP) - return FALSE; + return false; // Choose the right sub-ap const FX_CHAR* ap_entry = "N"; @@ -475,7 +474,7 @@ FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid( // Get the AP stream or subdirectory CPDF_Object* psub = pAP->GetDirectObjectFor(ap_entry); if (!psub) - return FALSE; + return false; int nFieldType = GetFieldType(); switch (nFieldType) { @@ -490,9 +489,9 @@ FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid( if (CPDF_Dictionary* pSubDict = psub->AsDictionary()) { return !!pSubDict->GetStreamFor(GetAppState()); } - return FALSE; + return false; } - return TRUE; + return true; } int CPDFSDK_Widget::GetFieldType() const { @@ -500,12 +499,12 @@ int CPDFSDK_Widget::GetFieldType() const { return pField ? pField->GetFieldType() : FIELDTYPE_UNKNOWN; } -FX_BOOL CPDFSDK_Widget::IsAppearanceValid() { +bool CPDFSDK_Widget::IsAppearanceValid() { #ifdef PDF_ENABLE_XFA CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext(); int nDocType = pContext->GetDocType(); if (nDocType != DOCTYPE_PDF && nDocType != DOCTYPE_STATIC_XFA) - return TRUE; + return true; #endif // PDF_ENABLE_XFA return CPDFSDK_BAAnnot::IsAppearanceValid(); } @@ -555,25 +554,25 @@ CFX_WideString CPDFSDK_Widget::GetName() const { } #endif // PDF_ENABLE_XFA -FX_BOOL CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const { +bool CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const { CPDF_FormControl* pFormCtrl = GetFormControl(); int iColorType = 0; color = ARGBToColorRef(pFormCtrl->GetBackgroundColor(iColorType)); return iColorType != COLORTYPE_TRANSPARENT; } -FX_BOOL CPDFSDK_Widget::GetBorderColor(FX_COLORREF& color) const { +bool CPDFSDK_Widget::GetBorderColor(FX_COLORREF& color) const { CPDF_FormControl* pFormCtrl = GetFormControl(); int iColorType = 0; color = ARGBToColorRef(pFormCtrl->GetBorderColor(iColorType)); return iColorType != COLORTYPE_TRANSPARENT; } -FX_BOOL CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const { +bool CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const { CPDF_FormControl* pFormCtrl = GetFormControl(); CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance(); if (!da.HasColor()) - return FALSE; + return false; FX_ARGB argb; int iColorType = COLORTYPE_TRANSPARENT; @@ -606,7 +605,7 @@ int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const { } #ifdef PDF_ENABLE_XFA -CFX_WideString CPDFSDK_Widget::GetValue(FX_BOOL bDisplay) const { +CFX_WideString CPDFSDK_Widget::GetValue(bool bDisplay) const { if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { CFX_WideString sValue; @@ -637,14 +636,14 @@ int CPDFSDK_Widget::CountOptions() const { return pFormField->CountOptions(); } -FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) const { +bool CPDFSDK_Widget::IsOptionSelected(int nIndex) const { #ifdef PDF_ENABLE_XFA if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems()) return pWidgetAcc->GetItemState(nIndex); - return FALSE; + return false; } } #endif // PDF_ENABLE_XFA @@ -685,75 +684,75 @@ void CPDFSDK_Widget::SetCheck(bool bChecked, bool bNotify) { bNotify); #ifdef PDF_ENABLE_XFA if (!IsWidgetAppearanceValid(CPDF_Annot::Normal)) - ResetAppearance(TRUE); + ResetAppearance(true); if (!bNotify) - Synchronize(TRUE); + Synchronize(true); #endif // PDF_ENABLE_XFA } -void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, FX_BOOL bNotify) { +void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, bool bNotify) { CPDF_FormField* pFormField = GetFormField(); pFormField->SetValue(sValue, bNotify); #ifdef PDF_ENABLE_XFA if (!bNotify) - Synchronize(TRUE); + Synchronize(true); #endif // PDF_ENABLE_XFA } void CPDFSDK_Widget::SetDefaultValue(const CFX_WideString& sValue) {} void CPDFSDK_Widget::SetOptionSelection(int index, - FX_BOOL bSelected, - FX_BOOL bNotify) { + bool bSelected, + bool bNotify) { CPDF_FormField* pFormField = GetFormField(); pFormField->SetItemSelection(index, bSelected, bNotify); #ifdef PDF_ENABLE_XFA if (!bNotify) - Synchronize(TRUE); + Synchronize(true); #endif // PDF_ENABLE_XFA } -void CPDFSDK_Widget::ClearSelection(FX_BOOL bNotify) { +void CPDFSDK_Widget::ClearSelection(bool bNotify) { CPDF_FormField* pFormField = GetFormField(); pFormField->ClearSelection(bNotify); #ifdef PDF_ENABLE_XFA if (!bNotify) - Synchronize(TRUE); + Synchronize(true); #endif // PDF_ENABLE_XFA } void CPDFSDK_Widget::SetTopVisibleIndex(int index) {} void CPDFSDK_Widget::SetAppModified() { - m_bAppModified = TRUE; + m_bAppModified = true; } void CPDFSDK_Widget::ClearAppModified() { - m_bAppModified = FALSE; + m_bAppModified = false; } -FX_BOOL CPDFSDK_Widget::IsAppModified() const { +bool CPDFSDK_Widget::IsAppModified() const { return m_bAppModified; } #ifdef PDF_ENABLE_XFA -void CPDFSDK_Widget::ResetAppearance(FX_BOOL bValueChanged) { +void CPDFSDK_Widget::ResetAppearance(bool bValueChanged) { switch (GetFieldType()) { case FIELDTYPE_TEXTFIELD: case FIELDTYPE_COMBOBOX: { - FX_BOOL bFormatted = FALSE; + bool bFormatted = false; CFX_WideString sValue = OnFormat(bFormatted); - ResetAppearance(bFormatted ? &sValue : nullptr, TRUE); + ResetAppearance(bFormatted ? &sValue : nullptr, true); break; } default: - ResetAppearance(nullptr, FALSE); + ResetAppearance(nullptr, false); break; } } #endif // PDF_ENABLE_XFA void CPDFSDK_Widget::ResetAppearance(const CFX_WideString* sValue, - FX_BOOL bValueChanged) { + bool bValueChanged) { SetAppModified(); m_nAppAge++; @@ -788,13 +787,13 @@ void CPDFSDK_Widget::ResetAppearance(const CFX_WideString* sValue, m_pAnnot->ClearCachedAP(); } -CFX_WideString CPDFSDK_Widget::OnFormat(FX_BOOL& bFormatted) { +CFX_WideString CPDFSDK_Widget::OnFormat(bool& bFormatted) { CPDF_FormField* pFormField = GetFormField(); ASSERT(pFormField); return m_pInterForm->OnFormat(pFormField, bFormatted); } -void CPDFSDK_Widget::ResetFieldAppearance(FX_BOOL bValueChanged) { +void CPDFSDK_Widget::ResetFieldAppearance(bool bValueChanged) { CPDF_FormField* pFormField = GetFormField(); ASSERT(pFormField); m_pInterForm->ResetFieldAppearance(pFormField, nullptr, bValueChanged); @@ -1360,7 +1359,7 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const CFX_WideString* sValue) { rcButton.Normalize(); std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); - pEdit->EnableRefresh(FALSE); + pEdit->EnableRefresh(false); CBA_FontMap font_map(this, m_pInterForm->GetFormFillEnv()->GetSysHandler()); pEdit->SetFontMap(&font_map); @@ -1370,11 +1369,11 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const CFX_WideString* sValue) { rcEdit.Normalize(); pEdit->SetPlateRect(rcEdit); - pEdit->SetAlignmentV(1, TRUE); + pEdit->SetAlignmentV(1, true); FX_FLOAT fFontSize = GetFontSize(); if (IsFloatZero(fFontSize)) - pEdit->SetAutoFontSize(TRUE, TRUE); + pEdit->SetAutoFontSize(true, true); else pEdit->SetFontSize(fFontSize); @@ -1424,7 +1423,7 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() { CFX_ByteTextBuf sBody, sLines; std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); - pEdit->EnableRefresh(FALSE); + pEdit->EnableRefresh(false); CBA_FontMap font_map(this, m_pInterForm->GetFormFillEnv()->GetSysHandler()); pEdit->SetFontMap(&font_map); @@ -1465,21 +1464,21 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() { << CPWL_Utils::GetColorAppStream( CPWL_Color(COLORTYPE_RGB, 0, 51.0f / 255.0f, 113.0f / 255.0f), - TRUE) + true) << rcItem.left << " " << rcItem.bottom << " " << rcItem.Width() << " " << rcItem.Height() << " re f\n" << "Q\n"; sList << "BT\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_GRAY, 1), - TRUE) + true) << CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, fy)) << "ET\n"; } else { CPWL_Color crText = GetTextPWLColor(); sList << "BT\n" - << CPWL_Utils::GetColorAppStream(crText, TRUE) + << CPWL_Utils::GetColorAppStream(crText, true) << CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, fy)) << "ET\n"; @@ -1508,39 +1507,39 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) { CFX_ByteTextBuf sBody, sLines; std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); - pEdit->EnableRefresh(FALSE); + pEdit->EnableRefresh(false); CBA_FontMap font_map(this, m_pInterForm->GetFormFillEnv()->GetSysHandler()); pEdit->SetFontMap(&font_map); CFX_FloatRect rcClient = GetClientRect(); pEdit->SetPlateRect(rcClient); - pEdit->SetAlignmentH(pControl->GetControlAlignment(), TRUE); + pEdit->SetAlignmentH(pControl->GetControlAlignment(), true); uint32_t dwFieldFlags = pField->GetFieldFlags(); - FX_BOOL bMultiLine = (dwFieldFlags >> 12) & 1; + bool bMultiLine = (dwFieldFlags >> 12) & 1; if (bMultiLine) { - pEdit->SetMultiLine(TRUE, TRUE); - pEdit->SetAutoReturn(TRUE, TRUE); + pEdit->SetMultiLine(true, true); + pEdit->SetAutoReturn(true, true); } else { - pEdit->SetAlignmentV(1, TRUE); + pEdit->SetAlignmentV(1, true); } uint16_t subWord = 0; if ((dwFieldFlags >> 13) & 1) { subWord = '*'; - pEdit->SetPasswordChar(subWord, TRUE); + pEdit->SetPasswordChar(subWord, true); } int nMaxLen = pField->GetMaxLen(); - FX_BOOL bCharArray = (dwFieldFlags >> 24) & 1; + bool bCharArray = (dwFieldFlags >> 24) & 1; FX_FLOAT fFontSize = GetFontSize(); #ifdef PDF_ENABLE_XFA CFX_WideString sValueTmp; if (!sValue && GetMixXFAWidget()) { - sValueTmp = GetValue(TRUE); + sValueTmp = GetValue(true); sValue = &sValueTmp; } #endif // PDF_ENABLE_XFA @@ -1561,7 +1560,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) { } if (IsFloatZero(fFontSize)) - pEdit->SetAutoFontSize(TRUE, TRUE); + pEdit->SetAutoFontSize(true, true); else pEdit->SetFontSize(fFontSize); @@ -1590,11 +1589,11 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) { switch (GetBorderStyle()) { case BorderStyle::SOLID: { CFX_ByteString sColor = - CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE); + CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), false); if (sColor.GetLength() > 0) { sLines << "q\n" << GetBorderWidth() << " w\n" - << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE) + << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), false) << " 2 J 0 j\n"; for (int32_t i = 1; i < nMaxLen; ++i) { @@ -1612,13 +1611,13 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) { } case BorderStyle::DASH: { CFX_ByteString sColor = - CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE); + CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), false); if (sColor.GetLength() > 0) { CPWL_Dash dsBorder = CPWL_Dash(3, 3, 0); sLines << "q\n" << GetBorderWidth() << " w\n" - << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE) + << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), false) << "[" << dsBorder.nDash << " " << dsBorder.nGap << "] " << dsBorder.nPhase << " d\n"; @@ -1820,9 +1819,9 @@ void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) { pAPDict->RemoveFor(sAPType); } -FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, - PDFSDK_FieldAction& data, - CPDFSDK_PageView* pPageView) { +bool CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, + PDFSDK_FieldAction& data, + CPDFSDK_PageView* pPageView) { CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv(); #ifdef PDF_ENABLE_XFA @@ -1858,7 +1857,7 @@ FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, pDocView->UpdateDocView(); if (nRet == XFA_EVENTERROR_Success) - return TRUE; + return true; } } } @@ -1870,7 +1869,7 @@ FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, return pActionHandler->DoAction_Field(action, type, pFormFillEnv, GetFormField(), data); } - return FALSE; + return false; } CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT) { @@ -1916,17 +1915,17 @@ int32_t CPDFSDK_Widget::GetValueAge() const { return m_nValueAge; } -FX_BOOL CPDFSDK_Widget::HitTest(FX_FLOAT pageX, FX_FLOAT pageY) { +bool CPDFSDK_Widget::HitTest(FX_FLOAT pageX, FX_FLOAT pageY) { CPDF_Annot* pAnnot = GetPDFAnnot(); CFX_FloatRect annotRect = pAnnot->GetRect(); if (!annotRect.Contains(pageX, pageY)) - return FALSE; + return false; if (!IsVisible()) - return FALSE; + return false; if ((GetFieldFlags() & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) - return FALSE; + return false; - return TRUE; + return true; } diff --git a/fpdfsdk/cpdfsdk_widget.h b/fpdfsdk/cpdfsdk_widget.h index 1ab988a660..b630738995 100644 --- a/fpdfsdk/cpdfsdk_widget.h +++ b/fpdfsdk/cpdfsdk_widget.h @@ -40,12 +40,12 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { CXFA_FFWidget* GetGroupMixXFAWidget(); CXFA_FFWidgetHandler* GetXFAWidgetHandler() const; - FX_BOOL HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT); - FX_BOOL OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, - PDFSDK_FieldAction& data, - CPDFSDK_PageView* pPageView); + bool HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT); + bool OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, + PDFSDK_FieldAction& data, + CPDFSDK_PageView* pPageView); - void Synchronize(FX_BOOL bSynchronizeElse); + void Synchronize(bool bSynchronizeElse); void SynchronizeXFAValue(); void SynchronizeXFAItems(); @@ -66,7 +66,7 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { bool IsSignatureWidget() const override; CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT) override; - FX_BOOL IsAppearanceValid() override; + bool IsAppearanceValid() override; int GetLayoutOrder() const override; @@ -74,21 +74,21 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { int GetFieldFlags() const; int GetRotate() const; - FX_BOOL GetFillColor(FX_COLORREF& color) const; - FX_BOOL GetBorderColor(FX_COLORREF& color) const; - FX_BOOL GetTextColor(FX_COLORREF& color) const; + bool GetFillColor(FX_COLORREF& color) const; + bool GetBorderColor(FX_COLORREF& color) const; + bool GetTextColor(FX_COLORREF& color) const; FX_FLOAT GetFontSize() const; int GetSelectedIndex(int nIndex) const; #ifndef PDF_ENABLE_XFA CFX_WideString GetValue() const; #else - CFX_WideString GetValue(FX_BOOL bDisplay = TRUE) const; + CFX_WideString GetValue(bool bDisplay = true) const; #endif // PDF_ENABLE_XFA CFX_WideString GetDefaultValue() const; CFX_WideString GetOptionLabel(int nIndex) const; int CountOptions() const; - FX_BOOL IsOptionSelected(int nIndex) const; + bool IsOptionSelected(int nIndex) const; int GetTopVisibleIndex() const; bool IsChecked() const; int GetAlignment() const; @@ -99,23 +99,23 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { CFX_WideString GetAlternateName() const; void SetCheck(bool bChecked, bool bNotify); - void SetValue(const CFX_WideString& sValue, FX_BOOL bNotify); + void SetValue(const CFX_WideString& sValue, bool bNotify); void SetDefaultValue(const CFX_WideString& sValue); - void SetOptionSelection(int index, FX_BOOL bSelected, FX_BOOL bNotify); - void ClearSelection(FX_BOOL bNotify); + void SetOptionSelection(int index, bool bSelected, bool bNotify); + void ClearSelection(bool bNotify); void SetTopVisibleIndex(int index); #ifdef PDF_ENABLE_XFA - void ResetAppearance(FX_BOOL bValueChanged); + void ResetAppearance(bool bValueChanged); #endif // PDF_ENABLE_XFA - void ResetAppearance(const CFX_WideString* sValue, FX_BOOL bValueChanged); - void ResetFieldAppearance(FX_BOOL bValueChanged); + void ResetAppearance(const CFX_WideString* sValue, bool bValueChanged); + void ResetFieldAppearance(bool bValueChanged); void UpdateField(); - CFX_WideString OnFormat(FX_BOOL& bFormatted); + CFX_WideString OnFormat(bool& bFormatted); - FX_BOOL OnAAction(CPDF_AAction::AActionType type, - PDFSDK_FieldAction& data, - CPDFSDK_PageView* pPageView); + bool OnAAction(CPDF_AAction::AActionType type, + PDFSDK_FieldAction& data, + CPDFSDK_PageView* pPageView); CPDFSDK_InterForm* GetInterForm() const { return m_pInterForm; } CPDF_FormField* GetFormField() const; @@ -127,18 +127,18 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { void SetAppModified(); void ClearAppModified(); - FX_BOOL IsAppModified() const; + bool IsAppModified() const; int32_t GetAppearanceAge() const; int32_t GetValueAge() const; - FX_BOOL IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode); + bool IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode); void DrawAppearance(CFX_RenderDevice* pDevice, const CFX_Matrix* pUser2Device, CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions) override; - FX_BOOL HitTest(FX_FLOAT pageX, FX_FLOAT pageY); + bool HitTest(FX_FLOAT pageX, FX_FLOAT pageY); private: void ResetAppearance_PushButton(); @@ -163,7 +163,7 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { void RemoveAppearance(const CFX_ByteString& sAPType); CPDFSDK_InterForm* const m_pInterForm; - FX_BOOL m_bAppModified; + bool m_bAppModified; int32_t m_nAppAge; int32_t m_nValueAge; diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp index 715faa9c35..4105ae4f3c 100644 --- a/fpdfsdk/cpdfsdk_widgethandler.cpp +++ b/fpdfsdk/cpdfsdk_widgethandler.cpp @@ -29,21 +29,21 @@ CPDFSDK_WidgetHandler::CPDFSDK_WidgetHandler( CPDFSDK_WidgetHandler::~CPDFSDK_WidgetHandler() {} -FX_BOOL CPDFSDK_WidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { +bool CPDFSDK_WidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { ASSERT(pAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::WIDGET); if (pAnnot->IsSignatureWidget()) - return FALSE; + return false; CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); if (!pWidget->IsVisible()) - return FALSE; + return false; int nFieldFlags = pWidget->GetFieldFlags(); if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) - return FALSE; + return false; if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) - return TRUE; + return true; CPDF_Page* pPage = pWidget->GetPDFPage(); CPDF_Document* pDocument = pPage->m_pDocument; @@ -64,7 +64,7 @@ CPDFSDK_Annot* CPDFSDK_WidgetHandler::NewAnnot(CPDF_Annot* pAnnot, pInterForm->AddMap(pCtrl, pWidget); CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); if (pPDFInterForm && pPDFInterForm->NeedConstructAP()) - pWidget->ResetAppearance(nullptr, FALSE); + pWidget->ResetAppearance(nullptr, false); return pWidget; } @@ -116,109 +116,107 @@ void CPDFSDK_WidgetHandler::OnMouseExit(CPDFSDK_PageView* pPageView, m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); } -FX_BOOL CPDFSDK_WidgetHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CPDFSDK_WidgetHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); - return FALSE; + return false; } -FX_BOOL CPDFSDK_WidgetHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CPDFSDK_WidgetHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); - return FALSE; + return false; } -FX_BOOL CPDFSDK_WidgetHandler::OnLButtonDblClk( - CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CPDFSDK_WidgetHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); - return FALSE; + return false; } -FX_BOOL CPDFSDK_WidgetHandler::OnMouseMove(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CPDFSDK_WidgetHandler::OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); - return FALSE; + return false; } -FX_BOOL CPDFSDK_WidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - short zDelta, - const CFX_FloatPoint& point) { +bool CPDFSDK_WidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + short zDelta, + const CFX_FloatPoint& point) { if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); - return FALSE; + return false; } -FX_BOOL CPDFSDK_WidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CPDFSDK_WidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); - return FALSE; + return false; } -FX_BOOL CPDFSDK_WidgetHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CPDFSDK_WidgetHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); - return FALSE; + return false; } -FX_BOOL CPDFSDK_WidgetHandler::OnRButtonDblClk( - CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { - return FALSE; +bool CPDFSDK_WidgetHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { + return false; } -FX_BOOL CPDFSDK_WidgetHandler::OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) { +bool CPDFSDK_WidgetHandler::OnChar(CPDFSDK_Annot* pAnnot, + uint32_t nChar, + uint32_t nFlags) { if (!pAnnot->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnChar(pAnnot, nChar, nFlags); - return FALSE; + return false; } -FX_BOOL CPDFSDK_WidgetHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, - int nKeyCode, - int nFlag) { +bool CPDFSDK_WidgetHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, + int nKeyCode, + int nFlag) { if (!pAnnot->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlag); - return FALSE; + return false; } -FX_BOOL CPDFSDK_WidgetHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, - int nKeyCode, - int nFlag) { - return FALSE; +bool CPDFSDK_WidgetHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, + int nKeyCode, + int nFlag) { + return false; } void CPDFSDK_WidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) { @@ -227,14 +225,14 @@ void CPDFSDK_WidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) { CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); if (!pWidget->IsAppearanceValid()) - pWidget->ResetAppearance(nullptr, FALSE); + pWidget->ResetAppearance(nullptr, false); int nFieldType = pWidget->GetFieldType(); if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) { - FX_BOOL bFormatted = FALSE; + bool bFormatted = false; CFX_WideString sValue = pWidget->OnFormat(bFormatted); if (bFormatted && nFieldType == FIELDTYPE_COMBOBOX) - pWidget->ResetAppearance(&sValue, FALSE); + pWidget->ResetAppearance(&sValue, false); } #ifdef PDF_ENABLE_XFA @@ -242,32 +240,32 @@ void CPDFSDK_WidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) { CPDFXFA_Context* pContext = pPageView->GetFormFillEnv()->GetXFAContext(); if (pContext->GetDocType() == DOCTYPE_STATIC_XFA) { if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty()) - pWidget->ResetAppearance(FALSE); + pWidget->ResetAppearance(false); } #endif // PDF_ENABLE_XFA } -FX_BOOL CPDFSDK_WidgetHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlag) { +bool CPDFSDK_WidgetHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlag) { if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnSetFocus(pAnnot, nFlag); - return TRUE; + return true; } -FX_BOOL CPDFSDK_WidgetHandler::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlag) { +bool CPDFSDK_WidgetHandler::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlag) { if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->OnKillFocus(pAnnot, nFlag); - return TRUE; + return true; } #ifdef PDF_ENABLE_XFA -FX_BOOL CPDFSDK_WidgetHandler::OnXFAChangedFocus( +bool CPDFSDK_WidgetHandler::OnXFAChangedFocus( CPDFSDK_Annot::ObservedPtr* pOldAnnot, CPDFSDK_Annot::ObservedPtr* pNewAnnot) { - return TRUE; + return true; } #endif // PDF_ENABLE_XFA @@ -279,9 +277,9 @@ CFX_FloatRect CPDFSDK_WidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView, return CFX_FloatRect(0, 0, 0, 0); } -FX_BOOL CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point) { +bool CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + const CFX_FloatPoint& point) { ASSERT(pPageView); ASSERT(pAnnot); diff --git a/fpdfsdk/cpdfsdk_widgethandler.h b/fpdfsdk/cpdfsdk_widgethandler.h index 0918a126c1..7154bda6fd 100644 --- a/fpdfsdk/cpdfsdk_widgethandler.h +++ b/fpdfsdk/cpdfsdk_widgethandler.h @@ -28,7 +28,7 @@ class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler { explicit CPDFSDK_WidgetHandler(CPDFSDK_FormFillEnvironment* pApp); ~CPDFSDK_WidgetHandler() override; - FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; + bool CanAnswer(CPDFSDK_Annot* pAnnot) override; CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; #ifdef PDF_ENABLE_XFA CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* hWidget, @@ -37,9 +37,9 @@ class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler { void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) override; - FX_BOOL HitTest(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point) override; + bool HitTest(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + const CFX_FloatPoint& point) override; void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, @@ -53,51 +53,47 @@ class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler { void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override; - FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, + bool OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnMouseWheel(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + short zDelta, + const CFX_FloatPoint& point) override; + bool OnRButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnRButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - short zDelta, const CFX_FloatPoint& point) override; - FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) override; - FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; - FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; - FX_BOOL OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlag) override; - FX_BOOL OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlag) override; + bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; + bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; + bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; + bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override; + bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override; #ifdef PDF_ENABLE_XFA - FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot, - CPDFSDK_Annot::ObservedPtr* pNewAnnot) override; + bool OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot, + CPDFSDK_Annot::ObservedPtr* pNewAnnot) override; #endif // PDF_ENABLE_XFA void SetFormFiller(CFFL_InteractiveFormFiller* pFiller) { diff --git a/fpdfsdk/cpdfsdk_xfawidget.cpp b/fpdfsdk/cpdfsdk_xfawidget.cpp index de4bd23866..67a8a17df4 100644 --- a/fpdfsdk/cpdfsdk_xfawidget.cpp +++ b/fpdfsdk/cpdfsdk_xfawidget.cpp @@ -16,8 +16,8 @@ CPDFSDK_XFAWidget::CPDFSDK_XFAWidget(CXFA_FFWidget* pAnnot, m_pInterForm(pInterForm), m_hXFAWidget(pAnnot) {} -FX_BOOL CPDFSDK_XFAWidget::IsXFAField() { - return TRUE; +bool CPDFSDK_XFAWidget::IsXFAField() { + return true; } CXFA_FFWidget* CPDFSDK_XFAWidget::GetXFAWidget() const { diff --git a/fpdfsdk/cpdfsdk_xfawidget.h b/fpdfsdk/cpdfsdk_xfawidget.h index f261b9a600..9d0be75f13 100644 --- a/fpdfsdk/cpdfsdk_xfawidget.h +++ b/fpdfsdk/cpdfsdk_xfawidget.h @@ -22,7 +22,7 @@ class CPDFSDK_XFAWidget : public CPDFSDK_Annot { CPDFSDK_InterForm* pInterForm); ~CPDFSDK_XFAWidget() override {} - FX_BOOL IsXFAField() override; + bool IsXFAField() override; CXFA_FFWidget* GetXFAWidget() const override; CPDF_Annot::Subtype GetAnnotSubtype() const override; CFX_FloatRect GetRect() const override; diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp index 2262450b94..2401a6fefa 100644 --- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp +++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp @@ -28,7 +28,7 @@ CPDFSDK_XFAWidgetHandler::CPDFSDK_XFAWidgetHandler( CPDFSDK_XFAWidgetHandler::~CPDFSDK_XFAWidgetHandler() {} -FX_BOOL CPDFSDK_XFAWidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { +bool CPDFSDK_XFAWidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { return !!pAnnot->GetXFAWidget(); } @@ -59,9 +59,9 @@ void CPDFSDK_XFAWidgetHandler::OnDraw(CPDFSDK_PageView* pPageView, CFX_Matrix mt; mt = *pUser2Device; - FX_BOOL bIsHighlight = FALSE; + bool bIsHighlight = false; if (pPageView->GetFormFillEnv()->GetFocusAnnot() != pAnnot) - bIsHighlight = TRUE; + bIsHighlight = true; GetXFAWidgetHandler(pAnnot)->RenderWidget(pAnnot->GetXFAWidget(), &gs, &mt, bIsHighlight); @@ -86,7 +86,7 @@ CFX_FloatRect CPDFSDK_XFAWidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView, CFX_RectF rcBBox; XFA_Element eType = pAnnot->GetXFAWidget()->GetDataAcc()->GetUIType(); if (eType == XFA_Element::Signature) - pAnnot->GetXFAWidget()->GetBBox(rcBBox, XFA_WidgetStatus_Visible, TRUE); + pAnnot->GetXFAWidget()->GetBBox(rcBBox, XFA_WidgetStatus_Visible, true); else pAnnot->GetXFAWidget()->GetBBox(rcBBox, XFA_WidgetStatus_None); @@ -100,27 +100,27 @@ CFX_FloatRect CPDFSDK_XFAWidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView, return rcWidget; } -FX_BOOL CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point) { +bool CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + const CFX_FloatPoint& point) { if (!pPageView || !pAnnot) - return FALSE; + return false; CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv(); if (!pFormFillEnv) - return FALSE; + return false; CPDFXFA_Context* pContext = pFormFillEnv->GetXFAContext(); if (!pContext) - return FALSE; + return false; CXFA_FFDocView* pDocView = pContext->GetXFADocView(); if (!pDocView) - return FALSE; + return false; CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); if (!pWidgetHandler) - return FALSE; + return false; FWL_WidgetHit dwHitTest = pWidgetHandler->OnHitTest(pAnnot->GetXFAWidget(), point.x, point.y); @@ -146,156 +146,149 @@ void CPDFSDK_XFAWidgetHandler::OnMouseExit(CPDFSDK_PageView* pPageView, pWidgetHandler->OnMouseExit((*pAnnot)->GetXFAWidget()); } -FX_BOOL CPDFSDK_XFAWidgetHandler::OnLButtonDown( - CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CPDFSDK_XFAWidgetHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { if (!pPageView || !(*pAnnot)) - return FALSE; + return false; CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot->Get()); return pWidgetHandler->OnLButtonDown((*pAnnot)->GetXFAWidget(), GetFWLFlags(nFlags), point.x, point.y); } -FX_BOOL CPDFSDK_XFAWidgetHandler::OnLButtonUp( - CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CPDFSDK_XFAWidgetHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { if (!pPageView || !(*pAnnot)) - return FALSE; + return false; CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot->Get()); return pWidgetHandler->OnLButtonUp((*pAnnot)->GetXFAWidget(), GetFWLFlags(nFlags), point.x, point.y); } -FX_BOOL CPDFSDK_XFAWidgetHandler::OnLButtonDblClk( +bool CPDFSDK_XFAWidgetHandler::OnLButtonDblClk( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, const CFX_FloatPoint& point) { if (!pPageView || !(*pAnnot)) - return FALSE; + return false; CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot->Get()); return pWidgetHandler->OnLButtonDblClk((*pAnnot)->GetXFAWidget(), GetFWLFlags(nFlags), point.x, point.y); } -FX_BOOL CPDFSDK_XFAWidgetHandler::OnMouseMove( - CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CPDFSDK_XFAWidgetHandler::OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { if (!pPageView || !(*pAnnot)) - return FALSE; + return false; CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot->Get()); return pWidgetHandler->OnMouseMove((*pAnnot)->GetXFAWidget(), GetFWLFlags(nFlags), point.x, point.y); } -FX_BOOL CPDFSDK_XFAWidgetHandler::OnMouseWheel( - CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - short zDelta, - const CFX_FloatPoint& point) { +bool CPDFSDK_XFAWidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + short zDelta, + const CFX_FloatPoint& point) { if (!pPageView || !(*pAnnot)) - return FALSE; + return false; CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot->Get()); return pWidgetHandler->OnMouseWheel( (*pAnnot)->GetXFAWidget(), GetFWLFlags(nFlags), zDelta, point.x, point.y); } -FX_BOOL CPDFSDK_XFAWidgetHandler::OnRButtonDown( - CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CPDFSDK_XFAWidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { if (!pPageView || !(*pAnnot)) - return FALSE; + return false; CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot->Get()); return pWidgetHandler->OnRButtonDown((*pAnnot)->GetXFAWidget(), GetFWLFlags(nFlags), point.x, point.y); } -FX_BOOL CPDFSDK_XFAWidgetHandler::OnRButtonUp( - CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CPDFSDK_XFAWidgetHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { if (!pPageView || !(*pAnnot)) - return FALSE; + return false; CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot->Get()); return pWidgetHandler->OnRButtonUp((*pAnnot)->GetXFAWidget(), GetFWLFlags(nFlags), point.x, point.y); } -FX_BOOL CPDFSDK_XFAWidgetHandler::OnRButtonDblClk( +bool CPDFSDK_XFAWidgetHandler::OnRButtonDblClk( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, const CFX_FloatPoint& point) { if (!pPageView || !(*pAnnot)) - return FALSE; + return false; CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot->Get()); return pWidgetHandler->OnRButtonDblClk((*pAnnot)->GetXFAWidget(), GetFWLFlags(nFlags), point.x, point.y); } -FX_BOOL CPDFSDK_XFAWidgetHandler::OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) { +bool CPDFSDK_XFAWidgetHandler::OnChar(CPDFSDK_Annot* pAnnot, + uint32_t nChar, + uint32_t nFlags) { if (!pAnnot) - return FALSE; + return false; CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); return pWidgetHandler->OnChar(pAnnot->GetXFAWidget(), nChar, GetFWLFlags(nFlags)); } -FX_BOOL CPDFSDK_XFAWidgetHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, - int nKeyCode, - int nFlag) { +bool CPDFSDK_XFAWidgetHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, + int nKeyCode, + int nFlag) { if (!pAnnot) - return FALSE; + return false; CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); return pWidgetHandler->OnKeyDown(pAnnot->GetXFAWidget(), nKeyCode, GetFWLFlags(nFlag)); } -FX_BOOL CPDFSDK_XFAWidgetHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, - int nKeyCode, - int nFlag) { +bool CPDFSDK_XFAWidgetHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, + int nKeyCode, + int nFlag) { if (!pAnnot) - return FALSE; + return false; CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); return pWidgetHandler->OnKeyUp(pAnnot->GetXFAWidget(), nKeyCode, GetFWLFlags(nFlag)); } -FX_BOOL CPDFSDK_XFAWidgetHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlag) { - return TRUE; +bool CPDFSDK_XFAWidgetHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlag) { + return true; } -FX_BOOL CPDFSDK_XFAWidgetHandler::OnKillFocus( - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlag) { - return TRUE; +bool CPDFSDK_XFAWidgetHandler::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlag) { + return true; } -FX_BOOL CPDFSDK_XFAWidgetHandler::OnXFAChangedFocus( +bool CPDFSDK_XFAWidgetHandler::OnXFAChangedFocus( CPDFSDK_Annot::ObservedPtr* pOldAnnot, CPDFSDK_Annot::ObservedPtr* pNewAnnot) { CXFA_FFWidgetHandler* pWidgetHandler = nullptr; @@ -305,19 +298,19 @@ FX_BOOL CPDFSDK_XFAWidgetHandler::OnXFAChangedFocus( pWidgetHandler = GetXFAWidgetHandler(pNewAnnot->Get()); if (!pWidgetHandler) - return TRUE; + return true; CXFA_FFWidget* hWidget = *pNewAnnot ? (*pNewAnnot)->GetXFAWidget() : nullptr; if (!hWidget) - return TRUE; + return true; CXFA_FFPageView* pXFAPageView = hWidget->GetPageView(); if (!pXFAPageView) - return TRUE; + return true; - FX_BOOL bRet = pXFAPageView->GetDocView()->SetFocus(hWidget); + bool bRet = pXFAPageView->GetDocView()->SetFocus(hWidget); if (pXFAPageView->GetDocView()->GetFocusWidget() == hWidget) - bRet = TRUE; + bRet = true; return bRet; } diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.h b/fpdfsdk/cpdfsdk_xfawidgethandler.h index fdbcbcc7ee..1a1a48081d 100644 --- a/fpdfsdk/cpdfsdk_xfawidgethandler.h +++ b/fpdfsdk/cpdfsdk_xfawidgethandler.h @@ -25,16 +25,16 @@ class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler { explicit CPDFSDK_XFAWidgetHandler(CPDFSDK_FormFillEnvironment* pApp); ~CPDFSDK_XFAWidgetHandler() override; - FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; + bool CanAnswer(CPDFSDK_Annot* pAnnot) override; CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* pAnnot, CPDFSDK_PageView* pPage) override; void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) override; - FX_BOOL HitTest(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point) override; + bool HitTest(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + const CFX_FloatPoint& point) override; void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, @@ -47,50 +47,46 @@ class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler { void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override; - FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, + bool OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnMouseWheel(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + short zDelta, + const CFX_FloatPoint& point) override; + bool OnRButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnRButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - short zDelta, const CFX_FloatPoint& point) override; - FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) override; - FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; - FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; - FX_BOOL OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlag) override; - FX_BOOL OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlag) override; - FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot, - CPDFSDK_Annot::ObservedPtr* pNewAnnot) override; + bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; + bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; + bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; + bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override; + bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override; + bool OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot, + CPDFSDK_Annot::ObservedPtr* pNewAnnot) override; private: CXFA_FFWidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot); diff --git a/fpdfsdk/formfiller/cffl_checkbox.cpp b/fpdfsdk/formfiller/cffl_checkbox.cpp index 8b5a97c01d..ffa3a032cf 100644 --- a/fpdfsdk/formfiller/cffl_checkbox.cpp +++ b/fpdfsdk/formfiller/cffl_checkbox.cpp @@ -26,76 +26,76 @@ CPWL_Wnd* CFFL_CheckBox::NewPDFWindow(const PWL_CREATEPARAM& cp, return pWnd; } -FX_BOOL CFFL_CheckBox::OnKeyDown(CPDFSDK_Annot* pAnnot, - uint32_t nKeyCode, - uint32_t nFlags) { +bool CFFL_CheckBox::OnKeyDown(CPDFSDK_Annot* pAnnot, + uint32_t nKeyCode, + uint32_t nFlags) { switch (nKeyCode) { case FWL_VKEY_Return: case FWL_VKEY_Space: - return TRUE; + return true; default: return CFFL_FormFiller::OnKeyDown(pAnnot, nKeyCode, nFlags); } } -FX_BOOL CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) { +bool CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot, + uint32_t nChar, + uint32_t nFlags) { switch (nChar) { case FWL_VKEY_Return: case FWL_VKEY_Space: { CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); ASSERT(pPageView); - FX_BOOL bReset = FALSE; - FX_BOOL bExit = FALSE; + bool bReset = false; + bool bExit = false; CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget); m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp( &pObserved, pPageView, bReset, bExit, nFlags); if (!pObserved) { m_pWidget = nullptr; - return TRUE; + return true; } if (bReset || bExit) - return TRUE; + return true; CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); - if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, TRUE)) + if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, true)) pWnd->SetCheck(!pWnd->IsChecked()); CommitData(pPageView, nFlags); - return TRUE; + return true; } default: return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); } } -FX_BOOL CFFL_CheckBox::OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CFFL_CheckBox::OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point); if (IsValid()) { - if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, TRUE)) { + if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, true)) { CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; pWnd->SetCheck(!pWidget->IsChecked()); } if (!CommitData(pPageView, nFlags)) - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CFFL_CheckBox::IsDataChanged(CPDFSDK_PageView* pPageView) { - CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE); +bool CFFL_CheckBox::IsDataChanged(CPDFSDK_PageView* pPageView) { + CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, false); return pWnd && pWnd->IsChecked() != m_pWidget->IsChecked(); } void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) { - if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) { + if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, false)) { bool bNewChecked = pWnd->IsChecked(); if (bNewChecked) { diff --git a/fpdfsdk/formfiller/cffl_checkbox.h b/fpdfsdk/formfiller/cffl_checkbox.h index 0c62d5741b..65dba29f2e 100644 --- a/fpdfsdk/formfiller/cffl_checkbox.h +++ b/fpdfsdk/formfiller/cffl_checkbox.h @@ -17,17 +17,15 @@ class CFFL_CheckBox : public CFFL_Button { // CFFL_Button CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView) override; - FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, - uint32_t nKeyCode, - uint32_t nFlags) override; - FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, + bool OnKeyDown(CPDFSDK_Annot* pAnnot, + uint32_t nKeyCode, uint32_t nFlags) override; - FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView) override; + bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; + bool OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool IsDataChanged(CPDFSDK_PageView* pPageView) override; void SaveData(CPDFSDK_PageView* pPageView) override; }; diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp index cb2fdf4d73..c8438a3a28 100644 --- a/fpdfsdk/formfiller/cffl_combobox.cpp +++ b/fpdfsdk/formfiller/cffl_combobox.cpp @@ -75,16 +75,16 @@ CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const PWL_CREATEPARAM& cp, return pWnd; } -FX_BOOL CFFL_ComboBox::OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) { +bool CFFL_ComboBox::OnChar(CPDFSDK_Annot* pAnnot, + uint32_t nChar, + uint32_t nFlags) { return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); } -FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) { - CPWL_ComboBox* pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE); +bool CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) { + CPWL_ComboBox* pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, false); if (!pWnd) - return FALSE; + return false; int32_t nCurSel = pWnd->GetSelect(); if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT)) @@ -98,7 +98,7 @@ FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) { void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) { CPWL_ComboBox* pWnd = - static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, FALSE)); + static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, false)); if (!pWnd) return; @@ -111,13 +111,13 @@ void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) { bSetValue = (nCurSel < 0) || (swText != m_pWidget->GetOptionLabel(nCurSel)); if (bSetValue) { - m_pWidget->SetValue(swText, FALSE); + m_pWidget->SetValue(swText, false); } else { m_pWidget->GetSelectedIndex(0); - m_pWidget->SetOptionSelection(nCurSel, TRUE, FALSE); + m_pWidget->SetOptionSelection(nCurSel, true, false); } - m_pWidget->ResetFieldAppearance(TRUE); + m_pWidget->ResetFieldAppearance(true); m_pWidget->UpdateField(); SetChangeMark(); @@ -130,7 +130,7 @@ void CFFL_ComboBox::GetActionData(CPDFSDK_PageView* pPageView, switch (type) { case CPDF_AAction::KeyStroke: if (CPWL_ComboBox* pComboBox = - static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, FALSE))) { + static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, false))) { if (CPWL_Edit* pEdit = pComboBox->GetEdit()) { fa.bFieldFull = pEdit->IsTextFull(); int nSelStart = 0; @@ -150,7 +150,7 @@ void CFFL_ComboBox::GetActionData(CPDFSDK_PageView* pPageView, break; case CPDF_AAction::Validate: if (CPWL_ComboBox* pComboBox = - static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, FALSE))) { + static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, false))) { if (CPWL_Edit* pEdit = pComboBox->GetEdit()) { fa.sValue = pEdit->GetText(); } @@ -171,7 +171,7 @@ void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView, switch (type) { case CPDF_AAction::KeyStroke: if (CPWL_ComboBox* pComboBox = - static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, FALSE))) { + static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, false))) { if (CPWL_Edit* pEdit = pComboBox->GetEdit()) { pEdit->SetSel(fa.nSelStart, fa.nSelEnd); pEdit->ReplaceSel(fa.sChange); @@ -183,9 +183,9 @@ void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView, } } -FX_BOOL CFFL_ComboBox::IsActionDataChanged(CPDF_AAction::AActionType type, - const PDFSDK_FieldAction& faOld, - const PDFSDK_FieldAction& faNew) { +bool CFFL_ComboBox::IsActionDataChanged(CPDF_AAction::AActionType type, + const PDFSDK_FieldAction& faOld, + const PDFSDK_FieldAction& faNew) { switch (type) { case CPDF_AAction::KeyStroke: return (!faOld.bFieldFull && faOld.nSelEnd != faNew.nSelEnd) || @@ -195,14 +195,14 @@ FX_BOOL CFFL_ComboBox::IsActionDataChanged(CPDF_AAction::AActionType type, break; } - return FALSE; + return false; } void CFFL_ComboBox::SaveState(CPDFSDK_PageView* pPageView) { ASSERT(pPageView); if (CPWL_ComboBox* pComboBox = - static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, FALSE))) { + static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, false))) { m_State.nIndex = pComboBox->GetSelect(); if (CPWL_Edit* pEdit = pComboBox->GetEdit()) { @@ -216,7 +216,7 @@ void CFFL_ComboBox::RestoreState(CPDFSDK_PageView* pPageView) { ASSERT(pPageView); if (CPWL_ComboBox* pComboBox = - static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, TRUE))) { + static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, true))) { if (m_State.nIndex >= 0) { pComboBox->SetSelect(m_State.nIndex); } else { @@ -229,7 +229,7 @@ void CFFL_ComboBox::RestoreState(CPDFSDK_PageView* pPageView) { } CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, - FX_BOOL bRestoreValue) { + bool bRestoreValue) { if (bRestoreValue) SaveState(pPageView); @@ -239,9 +239,9 @@ CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, if (bRestoreValue) { RestoreState(pPageView); - pRet = GetPDFWindow(pPageView, FALSE); + pRet = GetPDFWindow(pPageView, false); } else { - pRet = GetPDFWindow(pPageView, TRUE); + pRet = GetPDFWindow(pPageView, true); } m_pWidget->UpdateField(); @@ -250,13 +250,13 @@ CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, } #ifdef PDF_ENABLE_XFA -FX_BOOL CFFL_ComboBox::IsFieldFull(CPDFSDK_PageView* pPageView) { +bool CFFL_ComboBox::IsFieldFull(CPDFSDK_PageView* pPageView) { if (CPWL_ComboBox* pComboBox = - static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, FALSE))) { + static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, false))) { if (CPWL_Edit* pEdit = pComboBox->GetEdit()) return pEdit->IsTextFull(); } - return FALSE; + return false; } #endif // PDF_ENABLE_XFA @@ -273,7 +273,7 @@ void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd) { int nCharacters = wsText.GetLength(); CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); - m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, TRUE); + m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true); } } @@ -283,7 +283,7 @@ CFX_WideString CFFL_ComboBox::GetSelectExportText() { int nExport = -1; CPDFSDK_PageView* pPageView = GetCurPageView(true); if (CPWL_ComboBox* pComboBox = - (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) { + (CPWL_ComboBox*)GetPDFWindow(pPageView, false)) { nExport = pComboBox->GetSelect(); } diff --git a/fpdfsdk/formfiller/cffl_combobox.h b/fpdfsdk/formfiller/cffl_combobox.h index 6881038353..aab10b90e1 100644 --- a/fpdfsdk/formfiller/cffl_combobox.h +++ b/fpdfsdk/formfiller/cffl_combobox.h @@ -28,10 +28,8 @@ class CFFL_ComboBox : public CFFL_FormFiller, public IPWL_FocusHandler { PWL_CREATEPARAM GetCreateParam() override; CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView) override; - FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) override; - FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView) override; + bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; + bool IsDataChanged(CPDFSDK_PageView* pPageView) override; void SaveData(CPDFSDK_PageView* pPageView) override; void GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, @@ -39,20 +37,20 @@ class CFFL_ComboBox : public CFFL_FormFiller, public IPWL_FocusHandler { void SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa) override; - FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type, - const PDFSDK_FieldAction& faOld, - const PDFSDK_FieldAction& faNew) override; + bool IsActionDataChanged(CPDF_AAction::AActionType type, + const PDFSDK_FieldAction& faOld, + const PDFSDK_FieldAction& faNew) override; void SaveState(CPDFSDK_PageView* pPageView) override; void RestoreState(CPDFSDK_PageView* pPageView) override; CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, - FX_BOOL bRestoreValue) override; + bool bRestoreValue) override; // IPWL_FocusHandler: void OnSetFocus(CPWL_Wnd* pWnd) override; #ifdef PDF_ENABLE_XFA // CFFL_FormFiller: - FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView) override; + bool IsFieldFull(CPDFSDK_PageView* pPageView) override; #endif // PDF_ENABLE_XFA private: diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index 1e58d10799..7c1dec46b3 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -23,7 +23,7 @@ CFFL_FormFiller::CFFL_FormFiller(CPDFSDK_FormFillEnvironment* pFormFillEnv, CPDFSDK_Annot* pAnnot) - : m_pFormFillEnv(pFormFillEnv), m_pAnnot(pAnnot), m_bValid(FALSE) { + : m_pFormFillEnv(pFormFillEnv), m_pAnnot(pAnnot), m_bValid(false) { m_pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); } @@ -45,13 +45,13 @@ void CFFL_FormFiller::DestroyWindows() { void CFFL_FormFiller::SetWindowRect(CPDFSDK_PageView* pPageView, const CFX_FloatRect& rcWindow) { - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { - pWnd->Move(CFX_FloatRect(rcWindow), TRUE, FALSE); + if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) { + pWnd->Move(CFX_FloatRect(rcWindow), true, false); } } CFX_FloatRect CFFL_FormFiller::GetWindowRect(CPDFSDK_PageView* pPageView) { - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { + if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) { return pWnd->GetWindowRect(); } @@ -65,7 +65,7 @@ FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CFX_FloatRect rcAnnot = m_pWidget->GetRect(); - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { + if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) { CFX_FloatRect rcWindow = pWnd->GetWindowRect(); rcAnnot = PWLtoFFL(rcWindow); } @@ -87,7 +87,7 @@ void CFFL_FormFiller::OnDraw(CPDFSDK_PageView* pPageView, CFX_Matrix* pUser2Device) { ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { + if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) { CFX_Matrix mt = GetCurMatrix(); mt.Concat(*pUser2Device); pWnd->DrawAppearance(pDevice, &mt); @@ -116,139 +116,139 @@ void CFFL_FormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, ASSERT(m_pWidget); } -FX_BOOL CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) { - m_bValid = TRUE; +bool CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { + if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, true)) { + m_bValid = true; FX_RECT rect = GetViewBBox(pPageView, pAnnot); InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); if (!rect.Contains((int)point.x, (int)point.y)) - return FALSE; + return false; return pWnd->OnLButtonDown(WndtoPWL(pPageView, point), nFlags); } - return FALSE; + return false; } -FX_BOOL CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { - CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE); +bool CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { + CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false); if (!pWnd) - return FALSE; + return false; FX_RECT rcFFL = GetViewBBox(pPageView, pAnnot); InvalidateRect(rcFFL.left, rcFFL.top, rcFFL.right, rcFFL.bottom); pWnd->OnLButtonUp(WndtoPWL(pPageView, point), nFlags); - return TRUE; + return true; } -FX_BOOL CFFL_FormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { - CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE); +bool CFFL_FormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { + CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false); if (!pWnd) - return FALSE; + return false; pWnd->OnLButtonDblClk(WndtoPWL(pPageView, point), nFlags); - return TRUE; + return true; } -FX_BOOL CFFL_FormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CFFL_FormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { if (m_ptOldPos != point) m_ptOldPos = point; - CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE); + CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false); if (!pWnd) - return FALSE; + return false; pWnd->OnMouseMove(WndtoPWL(pPageView, point), nFlags); - return TRUE; + return true; } -FX_BOOL CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - short zDelta, - const CFX_FloatPoint& point) { +bool CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + short zDelta, + const CFX_FloatPoint& point) { if (!IsValid()) - return FALSE; + return false; - CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE); + CPWL_Wnd* pWnd = GetPDFWindow(pPageView, true); return pWnd && pWnd->OnMouseWheel(zDelta, WndtoPWL(pPageView, point), nFlags); } -FX_BOOL CFFL_FormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { - CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE); +bool CFFL_FormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { + CPWL_Wnd* pWnd = GetPDFWindow(pPageView, true); if (!pWnd) - return FALSE; + return false; pWnd->OnRButtonDown(WndtoPWL(pPageView, point), nFlags); - return TRUE; + return true; } -FX_BOOL CFFL_FormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { - CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE); +bool CFFL_FormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { + CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false); if (!pWnd) - return FALSE; + return false; pWnd->OnRButtonUp(WndtoPWL(pPageView, point), nFlags); - return TRUE; + return true; } -FX_BOOL CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, - uint32_t nKeyCode, - uint32_t nFlags) { +bool CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, + uint32_t nKeyCode, + uint32_t nFlags) { if (IsValid()) { CPDFSDK_PageView* pPageView = GetCurPageView(true); ASSERT(pPageView); - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { + if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) { return pWnd->OnKeyDown(nKeyCode, nFlags); } } - return FALSE; + return false; } -FX_BOOL CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) { +bool CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, + uint32_t nChar, + uint32_t nFlags) { if (IsValid()) { CPDFSDK_PageView* pPageView = GetCurPageView(true); ASSERT(pPageView); - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { + if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) { return pWnd->OnChar(nChar, nFlags); } } - return FALSE; + return false; } void CFFL_FormFiller::SetFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag) { CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; UnderlyingPageType* pPage = pWidget->GetUnderlyingPage(); CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetPageView(pPage, true); - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) + if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, true)) pWnd->SetFocus(); - m_bValid = TRUE; + m_bValid = true; FX_RECT rcRect = GetViewBBox(pPageView, pAnnot); InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); } @@ -263,24 +263,24 @@ void CFFL_FormFiller::KillFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag) { CommitData(pPageView, nFlag); - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) + if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) pWnd->KillFocus(); - FX_BOOL bDestroyPDFWindow; + bool bDestroyPDFWindow; switch (m_pWidget->GetFieldType()) { case FIELDTYPE_PUSHBUTTON: case FIELDTYPE_CHECKBOX: case FIELDTYPE_RADIOBUTTON: - bDestroyPDFWindow = TRUE; + bDestroyPDFWindow = true; break; default: - bDestroyPDFWindow = FALSE; + bDestroyPDFWindow = false; break; } EscapeFiller(pPageView, bDestroyPDFWindow); } -FX_BOOL CFFL_FormFiller::IsValid() const { +bool CFFL_FormFiller::IsValid() const { return m_bValid; } @@ -342,7 +342,7 @@ PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() { } CPWL_Wnd* CFFL_FormFiller::GetPDFWindow(CPDFSDK_PageView* pPageView, - FX_BOOL bNew) { + bool bNew) { ASSERT(pPageView); auto it = m_Maps.find(pPageView); @@ -454,7 +454,7 @@ CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView(bool renew) { } CFX_FloatRect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) { - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { + if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) { CFX_FloatRect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect())); CFX_FloatRect rcPage = pPageView->GetPDFPage()->GetPageBBox(); if (rcPage.Contains(rcFocus)) @@ -511,47 +511,46 @@ CFX_FloatRect CFFL_FormFiller::FFLtoWnd(CPDFSDK_PageView* pPageView, return rect; } -FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, - uint32_t nFlag) { +bool CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, uint32_t nFlag) { if (IsDataChanged(pPageView)) { - FX_BOOL bRC = TRUE; - FX_BOOL bExit = FALSE; + bool bRC = true; + bool bExit = false; CFFL_InteractiveFormFiller* pFormFiller = m_pFormFillEnv->GetInteractiveFormFiller(); CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget); pFormFiller->OnKeyStrokeCommit(&pObserved, pPageView, bRC, bExit, nFlag); if (!pObserved || bExit) - return TRUE; + return true; if (!bRC) { - ResetPDFWindow(pPageView, FALSE); - return TRUE; + ResetPDFWindow(pPageView, false); + return true; } pFormFiller->OnValidate(&pObserved, pPageView, bRC, bExit, nFlag); if (!pObserved || bExit) - return TRUE; + return true; if (!bRC) { - ResetPDFWindow(pPageView, FALSE); - return TRUE; + ResetPDFWindow(pPageView, false); + return true; } SaveData(pPageView); pFormFiller->OnCalculate(m_pWidget, pPageView, bExit, nFlag); if (bExit) - return TRUE; + return true; pFormFiller->OnFormat(m_pWidget, pPageView, bExit, nFlag); } - return TRUE; + return true; } -FX_BOOL CFFL_FormFiller::IsDataChanged(CPDFSDK_PageView* pPageView) { - return FALSE; +bool CFFL_FormFiller::IsDataChanged(CPDFSDK_PageView* pPageView) { + return false; } void CFFL_FormFiller::SaveData(CPDFSDK_PageView* pPageView) {} #ifdef PDF_ENABLE_XFA -FX_BOOL CFFL_FormFiller::IsFieldFull(CPDFSDK_PageView* pPageView) { - return FALSE; +bool CFFL_FormFiller::IsFieldFull(CPDFSDK_PageView* pPageView) { + return false; } #endif // PDF_ENABLE_XFA @@ -569,10 +568,10 @@ void CFFL_FormFiller::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa) {} -FX_BOOL CFFL_FormFiller::IsActionDataChanged(CPDF_AAction::AActionType type, - const PDFSDK_FieldAction& faOld, - const PDFSDK_FieldAction& faNew) { - return FALSE; +bool CFFL_FormFiller::IsActionDataChanged(CPDF_AAction::AActionType type, + const PDFSDK_FieldAction& faOld, + const PDFSDK_FieldAction& faNew) { + return false; } void CFFL_FormFiller::SaveState(CPDFSDK_PageView* pPageView) {} @@ -580,8 +579,8 @@ void CFFL_FormFiller::SaveState(CPDFSDK_PageView* pPageView) {} void CFFL_FormFiller::RestoreState(CPDFSDK_PageView* pPageView) {} CPWL_Wnd* CFFL_FormFiller::ResetPDFWindow(CPDFSDK_PageView* pPageView, - FX_BOOL bRestoreValue) { - return GetPDFWindow(pPageView, FALSE); + bool bRestoreValue) { + return GetPDFWindow(pPageView, false); } void CFFL_FormFiller::TimerProc() {} @@ -591,8 +590,8 @@ CFX_SystemHandler* CFFL_FormFiller::GetSystemHandler() const { } void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView, - FX_BOOL bDestroyPDFWindow) { - m_bValid = FALSE; + bool bDestroyPDFWindow) { + m_bValid = false; FX_RECT rcRect = GetViewBBox(pPageView, m_pWidget); InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); @@ -611,20 +610,20 @@ void CFFL_FormFiller::InvalidateRect(double left, CFFL_Button::CFFL_Button(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Annot* pWidget) - : CFFL_FormFiller(pApp, pWidget), m_bMouseIn(FALSE), m_bMouseDown(FALSE) {} + : CFFL_FormFiller(pApp, pWidget), m_bMouseIn(false), m_bMouseDown(false) {} CFFL_Button::~CFFL_Button() {} void CFFL_Button::OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) { - m_bMouseIn = TRUE; + m_bMouseIn = true; FX_RECT rect = GetViewBBox(pPageView, pAnnot); InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); } void CFFL_Button::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) { - m_bMouseIn = FALSE; + m_bMouseIn = false; FX_RECT rect = GetViewBBox(pPageView, pAnnot); InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); @@ -632,44 +631,44 @@ void CFFL_Button::OnMouseExit(CPDFSDK_PageView* pPageView, ASSERT(m_pWidget); } -FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { CFX_FloatRect rcAnnot = pAnnot->GetRect(); if (!rcAnnot.Contains(point.x, point.y)) - return FALSE; + return false; - m_bMouseDown = TRUE; - m_bValid = TRUE; + m_bMouseDown = true; + m_bValid = true; FX_RECT rect = GetViewBBox(pPageView, pAnnot); InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); - return TRUE; + return true; } -FX_BOOL CFFL_Button::OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CFFL_Button::OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { CFX_FloatRect rcAnnot = pAnnot->GetRect(); if (!rcAnnot.Contains(point.x, point.y)) - return FALSE; + return false; - m_bMouseDown = FALSE; + m_bMouseDown = false; m_pWidget->GetPDFPage(); FX_RECT rect = GetViewBBox(pPageView, pAnnot); InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); - return TRUE; + return true; } -FX_BOOL CFFL_Button::OnMouseMove(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CFFL_Button::OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { ASSERT(m_pFormFillEnv); - return TRUE; + return true; } void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView, diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h index cd04de4765..cf1aaf7205 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.h +++ b/fpdfsdk/formfiller/cffl_formfiller.h @@ -38,42 +38,40 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { virtual void OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot); virtual void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot); - virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, + virtual bool OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point); + virtual bool OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point); + virtual bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, - short zDelta, const CFX_FloatPoint& point); - virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - - virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, - uint32_t nKeyCode, - uint32_t nFlags); - virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, + virtual bool OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point); + virtual bool OnMouseWheel(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + short zDelta, + const CFX_FloatPoint& point); + virtual bool OnRButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point); + virtual bool OnRButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point); + + virtual bool OnKeyDown(CPDFSDK_Annot* pAnnot, + uint32_t nKeyCode, uint32_t nFlags); + virtual bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags); void SetFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag); void KillFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag); @@ -92,15 +90,15 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { virtual void SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa); - virtual FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type, - const PDFSDK_FieldAction& faOld, - const PDFSDK_FieldAction& faNew); + virtual bool IsActionDataChanged(CPDF_AAction::AActionType type, + const PDFSDK_FieldAction& faOld, + const PDFSDK_FieldAction& faNew); virtual void SaveState(CPDFSDK_PageView* pPageView); virtual void RestoreState(CPDFSDK_PageView* pPageView); virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, - FX_BOOL bRestoreValue); + bool bRestoreValue); CFX_Matrix GetCurMatrix(); @@ -118,24 +116,24 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { const CFX_FloatRect& rcWindow); CFX_FloatRect GetWindowRect(CPDFSDK_PageView* pPageView); - FX_BOOL CommitData(CPDFSDK_PageView* pPageView, uint32_t nFlag); - virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView); + bool CommitData(CPDFSDK_PageView* pPageView, uint32_t nFlag); + virtual bool IsDataChanged(CPDFSDK_PageView* pPageView); virtual void SaveData(CPDFSDK_PageView* pPageView); #ifdef PDF_ENABLE_XFA - virtual FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView); + virtual bool IsFieldFull(CPDFSDK_PageView* pPageView); #endif // PDF_ENABLE_XFA - CPWL_Wnd* GetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bNew); + CPWL_Wnd* GetPDFWindow(CPDFSDK_PageView* pPageView, bool bNew); void DestroyPDFWindow(CPDFSDK_PageView* pPageView); - void EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroyPDFWindow); + void EscapeFiller(CPDFSDK_PageView* pPageView, bool bDestroyPDFWindow); virtual PWL_CREATEPARAM GetCreateParam(); virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView) = 0; virtual CFX_FloatRect GetFocusBox(CPDFSDK_PageView* pPageView); - FX_BOOL IsValid() const; + bool IsValid() const; CFX_FloatRect GetPDFWindowRect() const; CPDFSDK_PageView* GetCurPageView(bool renew); @@ -162,7 +160,7 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { CPDFSDK_Widget* m_pWidget; CPDFSDK_Annot* m_pAnnot; - FX_BOOL m_bValid; + bool m_bValid; CFFL_PageView2PDFWindow m_Maps; CFX_FloatPoint m_ptOldPos; }; @@ -177,18 +175,18 @@ class CFFL_Button : public CFFL_FormFiller { void OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) override; void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) override; - FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; + bool OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, @@ -199,8 +197,8 @@ class CFFL_Button : public CFFL_FormFiller { CFX_Matrix* pUser2Device) override; protected: - FX_BOOL m_bMouseIn; - FX_BOOL m_bMouseDown; + bool m_bMouseIn; + bool m_bMouseDown; }; #endif // FPDFSDK_FORMFILLER_CFFL_FORMFILLER_H_ diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index a699522aa8..01009d25f0 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -28,20 +28,20 @@ CFFL_InteractiveFormFiller::CFFL_InteractiveFormFiller( CPDFSDK_FormFillEnvironment* pFormFillEnv) - : m_pFormFillEnv(pFormFillEnv), m_bNotifying(FALSE) {} + : m_pFormFillEnv(pFormFillEnv), m_bNotifying(false) {} CFFL_InteractiveFormFiller::~CFFL_InteractiveFormFiller() {} -FX_BOOL CFFL_InteractiveFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - CFX_FloatPoint point) { +bool CFFL_InteractiveFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + CFX_FloatPoint point) { CFX_FloatRect rc = pAnnot->GetRect(); return rc.Contains(point.x, point.y); } FX_RECT CFFL_InteractiveFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) { - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) return pFormFiller->GetViewBBox(pPageView, pAnnot); ASSERT(pPageView); @@ -61,7 +61,7 @@ void CFFL_InteractiveFormFiller::OnDraw(CPDFSDK_PageView* pPageView, if (!IsVisible(pWidget)) return; - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) { if (pFormFiller->IsValid()) { pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device); pAnnot->GetPDFPage(); @@ -90,7 +90,7 @@ void CFFL_InteractiveFormFiller::OnDraw(CPDFSDK_PageView* pPageView, } } - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) { pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device); } else { pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); @@ -112,7 +112,7 @@ void CFFL_InteractiveFormFiller::OnMouseEnter( if (!m_bNotifying) { CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (pWidget->GetAAction(CPDF_AAction::CursorEnter).GetDict()) { - m_bNotifying = TRUE; + m_bNotifying = true; int nValueAge = pWidget->GetValueAge(); pWidget->ClearAppModified(); @@ -122,19 +122,19 @@ void CFFL_InteractiveFormFiller::OnMouseEnter( fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView); - m_bNotifying = FALSE; + m_bNotifying = false; if (!(*pAnnot)) return; if (pWidget->IsAppModified()) { - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) { pFormFiller->ResetPDFWindow(pPageView, pWidget->GetValueAge() == nValueAge); } } } } - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), TRUE)) + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), true)) pFormFiller->OnMouseEnter(pPageView, pAnnot->Get()); } @@ -145,7 +145,7 @@ void CFFL_InteractiveFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, if (!m_bNotifying) { CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (pWidget->GetAAction(CPDF_AAction::CursorExit).GetDict()) { - m_bNotifying = TRUE; + m_bNotifying = true; pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); @@ -156,23 +156,23 @@ void CFFL_InteractiveFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); - m_bNotifying = FALSE; + m_bNotifying = false; if (!(*pAnnot)) return; if (pWidget->IsAppModified()) { - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) { pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); } } } } - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE)) + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), false)) pFormFiller->OnMouseExit(pPageView, pAnnot->Get()); } -FX_BOOL CFFL_InteractiveFormFiller::OnLButtonDown( +bool CFFL_InteractiveFormFiller::OnLButtonDown( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, @@ -182,7 +182,7 @@ FX_BOOL CFFL_InteractiveFormFiller::OnLButtonDown( CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (Annot_HitTest(pPageView, pAnnot->Get(), point) && pWidget->GetAAction(CPDF_AAction::ButtonDown).GetDict()) { - m_bNotifying = TRUE; + m_bNotifying = true; pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); @@ -193,32 +193,31 @@ FX_BOOL CFFL_InteractiveFormFiller::OnLButtonDown( fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlags); fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlags); pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); - m_bNotifying = FALSE; + m_bNotifying = false; if (!(*pAnnot)) - return TRUE; + return true; if (!IsValidAnnot(pPageView, pAnnot->Get())) - return TRUE; + return true; if (pWidget->IsAppModified()) { - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) { pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); } } } } - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE)) + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), false)) return pFormFiller->OnLButtonDown(pPageView, pAnnot->Get(), nFlags, point); - return FALSE; + return false; } -FX_BOOL CFFL_InteractiveFormFiller::OnLButtonUp( - CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CFFL_InteractiveFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); @@ -235,20 +234,20 @@ FX_BOOL CFFL_InteractiveFormFiller::OnLButtonUp( break; } - FX_BOOL bRet = FALSE; - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE)) + bool bRet = false; + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), false)) bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot->Get(), nFlags, point); if (m_pFormFillEnv->GetFocusAnnot() == pAnnot->Get()) { - FX_BOOL bExit = FALSE; - FX_BOOL bReset = FALSE; + bool bExit = false; + bool bReset = false; OnButtonUp(pAnnot, pPageView, bReset, bExit, nFlags); if (!pAnnot || bExit) - return TRUE; + return true; #ifdef PDF_ENABLE_XFA OnClick(pWidget, pPageView, bReset, bExit, nFlags); if (!pAnnot || bExit) - return TRUE; + return true; #endif // PDF_ENABLE_XFA } return bRet; @@ -256,13 +255,13 @@ FX_BOOL CFFL_InteractiveFormFiller::OnLButtonUp( void CFFL_InteractiveFormFiller::OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - FX_BOOL& bReset, - FX_BOOL& bExit, + bool& bReset, + bool& bExit, uint32_t nFlag) { if (!m_bNotifying) { CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (pWidget->GetAAction(CPDF_AAction::ButtonUp).GetDict()) { - m_bNotifying = TRUE; + m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); @@ -272,123 +271,120 @@ void CFFL_InteractiveFormFiller::OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot, fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); - m_bNotifying = FALSE; + m_bNotifying = false; if (!(*pAnnot) || !IsValidAnnot(pPageView, pWidget)) { - bExit = TRUE; + bExit = true; return; } if (nAge != pWidget->GetAppearanceAge()) { - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) { pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); } - bReset = TRUE; + bReset = true; } } } } -FX_BOOL CFFL_InteractiveFormFiller::OnLButtonDblClk( +bool CFFL_InteractiveFormFiller::OnLButtonDblClk( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, const CFX_FloatPoint& point) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); - CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE); + CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), false); return pFormFiller && pFormFiller->OnLButtonDblClk(pPageView, pAnnot->Get(), nFlags, point); } -FX_BOOL CFFL_InteractiveFormFiller::OnMouseMove( - CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CFFL_InteractiveFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); - CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), TRUE); + CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), true); return pFormFiller && pFormFiller->OnMouseMove(pPageView, pAnnot->Get(), nFlags, point); } -FX_BOOL CFFL_InteractiveFormFiller::OnMouseWheel( +bool CFFL_InteractiveFormFiller::OnMouseWheel( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, short zDelta, const CFX_FloatPoint& point) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); - CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE); + CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), false); return pFormFiller && pFormFiller->OnMouseWheel(pPageView, pAnnot->Get(), nFlags, zDelta, point); } -FX_BOOL CFFL_InteractiveFormFiller::OnRButtonDown( +bool CFFL_InteractiveFormFiller::OnRButtonDown( CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, const CFX_FloatPoint& point) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); - CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE); + CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), false); return pFormFiller && pFormFiller->OnRButtonDown(pPageView, pAnnot->Get(), nFlags, point); } -FX_BOOL CFFL_InteractiveFormFiller::OnRButtonUp( - CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CFFL_InteractiveFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); - CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE); + CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), false); return pFormFiller && pFormFiller->OnRButtonUp(pPageView, pAnnot->Get(), nFlags, point); } -FX_BOOL CFFL_InteractiveFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, - uint32_t nKeyCode, - uint32_t nFlags) { +bool CFFL_InteractiveFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, + uint32_t nKeyCode, + uint32_t nFlags) { ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) { return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); } - return FALSE; + return false; } -FX_BOOL CFFL_InteractiveFormFiller::OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) { +bool CFFL_InteractiveFormFiller::OnChar(CPDFSDK_Annot* pAnnot, + uint32_t nChar, + uint32_t nFlags) { ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); if (nChar == FWL_VKEY_Tab) - return TRUE; + return true; - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) return pFormFiller->OnChar(pAnnot, nChar, nFlags); - return FALSE; + return false; } -FX_BOOL CFFL_InteractiveFormFiller::OnSetFocus( - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlag) { +bool CFFL_InteractiveFormFiller::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlag) { if (!(*pAnnot)) - return FALSE; + return false; ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); if (!m_bNotifying) { CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (pWidget->GetAAction(CPDF_AAction::GetFocus).GetDict()) { - m_bNotifying = TRUE; + m_bNotifying = true; pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); pWidget->ClearAppModified(); - CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); + CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, true); if (!pFormFiller) - return FALSE; + return false; CPDFSDK_PageView* pPageView = (*pAnnot)->GetPageView(); ASSERT(pPageView); @@ -398,12 +394,12 @@ FX_BOOL CFFL_InteractiveFormFiller::OnSetFocus( fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); - m_bNotifying = FALSE; + m_bNotifying = false; if (!(*pAnnot)) - return FALSE; + return false; if (pWidget->IsAppModified()) { - if (CFFL_FormFiller* pFiller = GetFormFiller(pWidget, FALSE)) { + if (CFFL_FormFiller* pFiller = GetFormFiller(pWidget, false)) { pFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); } @@ -411,25 +407,24 @@ FX_BOOL CFFL_InteractiveFormFiller::OnSetFocus( } } - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), TRUE)) + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), true)) pFormFiller->SetFocusForAnnot(pAnnot->Get(), nFlag); - return TRUE; + return true; } -FX_BOOL CFFL_InteractiveFormFiller::OnKillFocus( - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlag) { +bool CFFL_InteractiveFormFiller::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlag) { if (!(*pAnnot)) - return FALSE; + return false; ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), false)) { pFormFiller->KillFocusForAnnot(pAnnot->Get(), nFlag); if (!m_bNotifying) { CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (pWidget->GetAAction(CPDF_AAction::LoseFocus).GetDict()) { - m_bNotifying = TRUE; + m_bNotifying = true; pWidget->ClearAppModified(); CPDFSDK_PageView* pPageView = pWidget->GetPageView(); @@ -440,27 +435,27 @@ FX_BOOL CFFL_InteractiveFormFiller::OnKillFocus( fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); - m_bNotifying = FALSE; + m_bNotifying = false; if (!(*pAnnot)) - return FALSE; + return false; } } } - return TRUE; + return true; } -FX_BOOL CFFL_InteractiveFormFiller::IsVisible(CPDFSDK_Widget* pWidget) { +bool CFFL_InteractiveFormFiller::IsVisible(CPDFSDK_Widget* pWidget) { return pWidget->IsVisible(); } -FX_BOOL CFFL_InteractiveFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { +bool CFFL_InteractiveFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { int nFieldFlags = pWidget->GetFieldFlags(); return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; } -FX_BOOL CFFL_InteractiveFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) { +bool CFFL_InteractiveFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) { if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) - return TRUE; + return true; CPDF_Page* pPage = pWidget->GetPDFPage(); CPDF_Document* pDocument = pPage->m_pDocument; @@ -472,7 +467,7 @@ FX_BOOL CFFL_InteractiveFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) { CFFL_FormFiller* CFFL_InteractiveFormFiller::GetFormFiller( CPDFSDK_Annot* pAnnot, - FX_BOOL bRegister) { + bool bRegister) { auto it = m_Maps.find(pAnnot); if (it != m_Maps.end()) return it->second.get(); @@ -567,7 +562,7 @@ void CFFL_InteractiveFormFiller::QueryWherePopup(void* pPrivateData, } FX_FLOAT fFactHeight = 0; - FX_BOOL bBottom = TRUE; + bool bBottom = true; FX_FLOAT fMaxListBoxHeight = 0; if (fPopupMax > FFL_MAXLISTBOXHEIGHT) { if (fPopupMin > FFL_MAXLISTBOXHEIGHT) { @@ -581,18 +576,18 @@ void CFFL_InteractiveFormFiller::QueryWherePopup(void* pPrivateData, if (fBottom > fMaxListBoxHeight) { fFactHeight = fMaxListBoxHeight; - bBottom = TRUE; + bBottom = true; } else { if (fTop > fMaxListBoxHeight) { fFactHeight = fMaxListBoxHeight; - bBottom = FALSE; + bBottom = false; } else { if (fTop > fBottom) { fFactHeight = fTop; - bBottom = FALSE; + bBottom = false; } else { fFactHeight = fBottom; - bBottom = TRUE; + bBottom = true; } } } @@ -604,24 +599,24 @@ void CFFL_InteractiveFormFiller::QueryWherePopup(void* pPrivateData, void CFFL_InteractiveFormFiller::OnKeyStrokeCommit( CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - FX_BOOL& bRC, - FX_BOOL& bExit, + bool& bRC, + bool& bExit, uint32_t nFlag) { if (!m_bNotifying) { CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) { ASSERT(pPageView); - m_bNotifying = TRUE; + m_bNotifying = true; pWidget->ClearAppModified(); PDFSDK_FieldAction fa; fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); - fa.bWillCommit = TRUE; - fa.bKeyDown = TRUE; - fa.bRC = TRUE; + fa.bWillCommit = true; + fa.bKeyDown = true; + fa.bRC = true; - CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); + CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false); pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); pFormFiller->SaveState(pPageView); pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); @@ -629,30 +624,30 @@ void CFFL_InteractiveFormFiller::OnKeyStrokeCommit( return; bRC = fa.bRC; - m_bNotifying = FALSE; + m_bNotifying = false; } } } void CFFL_InteractiveFormFiller::OnValidate(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_PageView* pPageView, - FX_BOOL& bRC, - FX_BOOL& bExit, + bool& bRC, + bool& bExit, uint32_t nFlag) { if (!m_bNotifying) { CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); if (pWidget->GetAAction(CPDF_AAction::Validate).GetDict()) { ASSERT(pPageView); - m_bNotifying = TRUE; + m_bNotifying = true; pWidget->ClearAppModified(); PDFSDK_FieldAction fa; fa.bModifier = m_pFormFillEnv->IsCTRLKeyDown(nFlag); fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); - fa.bKeyDown = TRUE; - fa.bRC = TRUE; + fa.bKeyDown = true; + fa.bRC = true; - CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); + CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false); pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); pFormFiller->SaveState(pPageView); pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); @@ -660,32 +655,32 @@ void CFFL_InteractiveFormFiller::OnValidate(CPDFSDK_Annot::ObservedPtr* pAnnot, return; bRC = fa.bRC; - m_bNotifying = FALSE; + m_bNotifying = false; } } } void CFFL_InteractiveFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, - FX_BOOL& bExit, + bool& bExit, uint32_t nFlag) { if (!m_bNotifying) { ASSERT(pWidget); CPDFSDK_InterForm* pInterForm = pPageView->GetFormFillEnv()->GetInterForm(); pInterForm->OnCalculate(pWidget->GetFormField()); - m_bNotifying = FALSE; + m_bNotifying = false; } } void CFFL_InteractiveFormFiller::OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, - FX_BOOL& bExit, + bool& bExit, uint32_t nFlag) { if (!m_bNotifying) { ASSERT(pWidget); CPDFSDK_InterForm* pInterForm = pPageView->GetFormFillEnv()->GetInterForm(); - FX_BOOL bFormatted = FALSE; + bool bFormatted = false; CFX_WideString sValue = pInterForm->OnFormat(pWidget->GetFormField(), bFormatted); @@ -693,23 +688,23 @@ void CFFL_InteractiveFormFiller::OnFormat(CPDFSDK_Widget* pWidget, return; if (bFormatted) { - pInterForm->ResetFieldAppearance(pWidget->GetFormField(), &sValue, TRUE); + pInterForm->ResetFieldAppearance(pWidget->GetFormField(), &sValue, true); pInterForm->UpdateField(pWidget->GetFormField()); } - m_bNotifying = FALSE; + m_bNotifying = false; } } #ifdef PDF_ENABLE_XFA void CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, - FX_BOOL& bReset, - FX_BOOL& bExit, + bool& bReset, + bool& bExit, uint32_t nFlag) { if (!m_bNotifying) { if (pWidget->HasXFAAAction(PDFSDK_XFA_Click)) { - m_bNotifying = TRUE; + m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); @@ -718,20 +713,20 @@ void CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Widget* pWidget, fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView); - m_bNotifying = FALSE; + m_bNotifying = false; if (!IsValidAnnot(pPageView, pWidget)) { - bExit = TRUE; + bExit = true; return; } if (nAge != pWidget->GetAppearanceAge()) { - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) { pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); } - bReset = TRUE; + bReset = true; } } } @@ -739,12 +734,12 @@ void CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Widget* pWidget, void CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, - FX_BOOL& bReset, - FX_BOOL& bExit, + bool& bReset, + bool& bExit, uint32_t nFlag) { if (!m_bNotifying) { if (pWidget->HasXFAAAction(PDFSDK_XFA_Full)) { - m_bNotifying = TRUE; + m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); @@ -753,61 +748,61 @@ void CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Widget* pWidget, fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView); - m_bNotifying = FALSE; + m_bNotifying = false; if (!IsValidAnnot(pPageView, pWidget)) { - bExit = TRUE; + bExit = true; return; } if (nAge != pWidget->GetAppearanceAge()) { - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) { pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); } - bReset = TRUE; + bReset = true; } } } } void CFFL_InteractiveFormFiller::OnPopupPreOpen(void* pPrivateData, - FX_BOOL& bExit, + bool& bExit, uint32_t nFlag) { CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; ASSERT(pData); ASSERT(pData->pWidget); - FX_BOOL bTempReset = FALSE; - FX_BOOL bTempExit = FALSE; + bool bTempReset = false; + bool bTempExit = false; OnPreOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, nFlag); if (bTempReset || bTempExit) - bExit = TRUE; + bExit = true; } void CFFL_InteractiveFormFiller::OnPopupPostOpen(void* pPrivateData, - FX_BOOL& bExit, + bool& bExit, uint32_t nFlag) { CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; ASSERT(pData); ASSERT(pData->pWidget); - FX_BOOL bTempReset = FALSE; - FX_BOOL bTempExit = FALSE; + bool bTempReset = false; + bool bTempExit = false; OnPostOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, nFlag); if (bTempReset || bTempExit) - bExit = TRUE; + bExit = true; } void CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, - FX_BOOL& bReset, - FX_BOOL& bExit, + bool& bReset, + bool& bExit, uint32_t nFlag) { if (!m_bNotifying) { if (pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) { - m_bNotifying = TRUE; + m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); @@ -816,20 +811,20 @@ void CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Widget* pWidget, fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); pWidget->OnXFAAAction(PDFSDK_XFA_PreOpen, fa, pPageView); - m_bNotifying = FALSE; + m_bNotifying = false; if (!IsValidAnnot(pPageView, pWidget)) { - bExit = TRUE; + bExit = true; return; } if (nAge != pWidget->GetAppearanceAge()) { - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) { pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); } - bReset = TRUE; + bReset = true; } } } @@ -837,12 +832,12 @@ void CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Widget* pWidget, void CFFL_InteractiveFormFiller::OnPostOpen(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, - FX_BOOL& bReset, - FX_BOOL& bExit, + bool& bReset, + bool& bExit, uint32_t nFlag) { if (!m_bNotifying) { if (pWidget->HasXFAAAction(PDFSDK_XFA_PostOpen)) { - m_bNotifying = TRUE; + m_bNotifying = true; int nAge = pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); @@ -851,28 +846,28 @@ void CFFL_InteractiveFormFiller::OnPostOpen(CPDFSDK_Widget* pWidget, fa.bShift = m_pFormFillEnv->IsSHIFTKeyDown(nFlag); pWidget->OnXFAAAction(PDFSDK_XFA_PostOpen, fa, pPageView); - m_bNotifying = FALSE; + m_bNotifying = false; if (!IsValidAnnot(pPageView, pWidget)) { - bExit = TRUE; + bExit = true; return; } if (nAge != pWidget->GetAppearanceAge()) { - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)) { pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); } - bReset = TRUE; + bReset = true; } } } } #endif // PDF_ENABLE_XFA -FX_BOOL CFFL_InteractiveFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot) { +bool CFFL_InteractiveFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot) { return pPageView && pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); } @@ -882,23 +877,23 @@ void CFFL_InteractiveFormFiller::OnBeforeKeyStroke( const CFX_WideString& strChangeEx, int nSelStart, int nSelEnd, - FX_BOOL bKeyDown, - FX_BOOL& bRC, - FX_BOOL& bExit, + bool bKeyDown, + bool& bRC, + bool& bExit, uint32_t nFlag) { CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; ASSERT(pData->pWidget); - CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); + CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, false); #ifdef PDF_ENABLE_XFA if (pFormFiller->IsFieldFull(pData->pPageView)) { - FX_BOOL bFullExit = FALSE; - FX_BOOL bFullReset = FALSE; + bool bFullExit = false; + bool bFullReset = false; OnFull(pData->pWidget, pData->pPageView, bFullReset, bFullExit, nFlag); if (bFullReset || bFullExit) { - bExit = TRUE; + bExit = true; return; } } @@ -906,7 +901,7 @@ void CFFL_InteractiveFormFiller::OnBeforeKeyStroke( if (!m_bNotifying) { if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) { - m_bNotifying = TRUE; + m_bNotifying = true; int nAge = pData->pWidget->GetAppearanceAge(); int nValueAge = pData->pWidget->GetValueAge(); @@ -919,8 +914,8 @@ void CFFL_InteractiveFormFiller::OnBeforeKeyStroke( fa.sChange = strChange; fa.sChangeEx = strChangeEx; fa.bKeyDown = bKeyDown; - fa.bWillCommit = FALSE; - fa.bRC = TRUE; + fa.bWillCommit = false; + fa.bRC = true; fa.nSelStart = nSelStart; fa.nSelEnd = nSelEnd; @@ -931,8 +926,8 @@ void CFFL_InteractiveFormFiller::OnBeforeKeyStroke( if (pData->pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pData->pPageView)) { if (!pObserved || !IsValidAnnot(pData->pPageView, pData->pWidget)) { - bExit = TRUE; - m_bNotifying = FALSE; + bExit = true; + m_bNotifying = false; return; } @@ -940,31 +935,31 @@ void CFFL_InteractiveFormFiller::OnBeforeKeyStroke( CPWL_Wnd* pWnd = pFormFiller->ResetPDFWindow( pData->pPageView, nValueAge == pData->pWidget->GetValueAge()); pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); - bExit = TRUE; + bExit = true; } if (fa.bRC) { pFormFiller->SetActionData(pData->pPageView, CPDF_AAction::KeyStroke, fa); - bRC = FALSE; + bRC = false; } else { pFormFiller->RestoreState(pData->pPageView); - bRC = FALSE; + bRC = false; } if (pFormFillEnv->GetFocusAnnot() != pData->pWidget) { pFormFiller->CommitData(pData->pPageView, nFlag); - bExit = TRUE; + bExit = true; } } else { if (!IsValidAnnot(pData->pPageView, pData->pWidget)) { - bExit = TRUE; - m_bNotifying = FALSE; + bExit = true; + m_bNotifying = false; return; } } - m_bNotifying = FALSE; + m_bNotifying = false; } } } diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h index 70ec43ddd6..e81d3c88d0 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h @@ -25,9 +25,9 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { CPDFSDK_FormFillEnvironment* pFormFillEnv); ~CFFL_InteractiveFormFiller() override; - FX_BOOL Annot_HitTest(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - CFX_FloatPoint point); + bool Annot_HitTest(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + CFX_FloatPoint point); FX_RECT GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot); void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, @@ -42,95 +42,94 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag); - FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, + bool OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point); + bool OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point); + bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - short zDelta, const CFX_FloatPoint& point); - FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point); - - FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, uint32_t nKeyCode, uint32_t nFlags); - FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags); - - FX_BOOL OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag); - FX_BOOL OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag); - - CFFL_FormFiller* GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL bRegister); + bool OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point); + bool OnMouseWheel(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + short zDelta, + const CFX_FloatPoint& point); + bool OnRButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point); + bool OnRButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point); + + bool OnKeyDown(CPDFSDK_Annot* pAnnot, uint32_t nKeyCode, uint32_t nFlags); + bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags); + + bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag); + bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag); + + CFFL_FormFiller* GetFormFiller(CPDFSDK_Annot* pAnnot, bool bRegister); void RemoveFormFiller(CPDFSDK_Annot* pAnnot); - static FX_BOOL IsVisible(CPDFSDK_Widget* pWidget); - static FX_BOOL IsReadOnly(CPDFSDK_Widget* pWidget); - static FX_BOOL IsFillingAllowed(CPDFSDK_Widget* pWidget); - static FX_BOOL IsValidAnnot(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot); + static bool IsVisible(CPDFSDK_Widget* pWidget); + static bool IsReadOnly(CPDFSDK_Widget* pWidget); + static bool IsFillingAllowed(CPDFSDK_Widget* pWidget); + static bool IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot); void OnKeyStrokeCommit(CPDFSDK_Annot::ObservedPtr* pWidget, CPDFSDK_PageView* pPageView, - FX_BOOL& bRC, - FX_BOOL& bExit, + bool& bRC, + bool& bExit, uint32_t nFlag); void OnValidate(CPDFSDK_Annot::ObservedPtr* pWidget, CPDFSDK_PageView* pPageView, - FX_BOOL& bRC, - FX_BOOL& bExit, + bool& bRC, + bool& bExit, uint32_t nFlag); void OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, - FX_BOOL& bExit, + bool& bExit, uint32_t nFlag); void OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, - FX_BOOL& bExit, + bool& bExit, uint32_t nFlag); void OnButtonUp(CPDFSDK_Annot::ObservedPtr* pWidget, CPDFSDK_PageView* pPageView, - FX_BOOL& bReset, - FX_BOOL& bExit, + bool& bReset, + bool& bExit, uint32_t nFlag); #ifdef PDF_ENABLE_XFA void OnClick(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, - FX_BOOL& bReset, - FX_BOOL& bExit, + bool& bReset, + bool& bExit, uint32_t nFlag); void OnFull(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, - FX_BOOL& bReset, - FX_BOOL& bExit, + bool& bReset, + bool& bExit, uint32_t nFlag); void OnPreOpen(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, - FX_BOOL& bReset, - FX_BOOL& bExit, + bool& bReset, + bool& bExit, uint32_t nFlag); void OnPostOpen(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, - FX_BOOL& bReset, - FX_BOOL& bExit, + bool& bReset, + bool& bExit, uint32_t nFlag); #endif // PDF_ENABLE_XFA @@ -149,26 +148,22 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { const CFX_WideString& strChangeEx, int nSelStart, int nSelEnd, - FX_BOOL bKeyDown, - FX_BOOL& bRC, - FX_BOOL& bExit, + bool bKeyDown, + bool& bRC, + bool& bExit, uint32_t nFlag) override; #ifdef PDF_ENABLE_XFA - void OnPopupPreOpen(void* pPrivateData, - FX_BOOL& bExit, - uint32_t nFlag) override; + void OnPopupPreOpen(void* pPrivateData, bool& bExit, uint32_t nFlag) override; void OnPopupPostOpen(void* pPrivateData, - FX_BOOL& bExit, + bool& bExit, uint32_t nFlag) override; - void SetFocusAnnotTab(CPDFSDK_Annot* pWidget, - FX_BOOL bSameField, - FX_BOOL bNext); + void SetFocusAnnotTab(CPDFSDK_Annot* pWidget, bool bSameField, bool bNext); #endif // PDF_ENABLE_XFA void UnRegisterFormFiller(CPDFSDK_Annot* pAnnot); CPDFSDK_FormFillEnvironment* const m_pFormFillEnv; CFFL_Widget2Filler m_Maps; - FX_BOOL m_bNotifying; + bool m_bNotifying; }; class CFFL_PrivateData { diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp index 85b907017c..bc3bb6c4ab 100644 --- a/fpdfsdk/formfiller/cffl_listbox.cpp +++ b/fpdfsdk/formfiller/cffl_listbox.cpp @@ -59,12 +59,12 @@ CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, if (pWnd->HasFlag(PLBS_MULTIPLESEL)) { m_OriginSelections.clear(); - FX_BOOL bSetCaret = FALSE; + bool bSetCaret = false; for (int32_t i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) { if (m_pWidget->IsOptionSelected(i)) { if (!bSetCaret) { pWnd->SetCaret(i); - bSetCaret = TRUE; + bSetCaret = true; } pWnd->Select(i); m_OriginSelections.insert(i); @@ -84,23 +84,23 @@ CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, return pWnd; } -FX_BOOL CFFL_ListBox::OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) { +bool CFFL_ListBox::OnChar(CPDFSDK_Annot* pAnnot, + uint32_t nChar, + uint32_t nFlags) { return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); } -FX_BOOL CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView) { - CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE); +bool CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView) { + CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, false); if (!pListBox) - return FALSE; + return false; if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) { size_t nSelCount = 0; for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; ++i) { if (pListBox->IsItemSelected(i)) { if (m_OriginSelections.count(i) == 0) - return TRUE; + return true; ++nSelCount; } @@ -113,22 +113,22 @@ FX_BOOL CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView) { void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView) { CPWL_ListBox* pListBox = - static_cast<CPWL_ListBox*>(GetPDFWindow(pPageView, FALSE)); + static_cast<CPWL_ListBox*>(GetPDFWindow(pPageView, false)); if (!pListBox) return; int32_t nNewTopIndex = pListBox->GetTopVisibleIndex(); - m_pWidget->ClearSelection(FALSE); + m_pWidget->ClearSelection(false); if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) { for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; i++) { if (pListBox->IsItemSelected(i)) - m_pWidget->SetOptionSelection(i, TRUE, FALSE); + m_pWidget->SetOptionSelection(i, true, false); } } else { - m_pWidget->SetOptionSelection(pListBox->GetCurSel(), TRUE, FALSE); + m_pWidget->SetOptionSelection(pListBox->GetCurSel(), true, false); } m_pWidget->SetTopVisibleIndex(nNewTopIndex); - m_pWidget->ResetFieldAppearance(TRUE); + m_pWidget->ResetFieldAppearance(true); m_pWidget->UpdateField(); SetChangeMark(); } @@ -142,7 +142,7 @@ void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView, fa.sValue = L""; } else { if (CPWL_ListBox* pListBox = - (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) { + (CPWL_ListBox*)GetPDFWindow(pPageView, false)) { int32_t nCurSel = pListBox->GetCurSel(); if (nCurSel >= 0) fa.sValue = m_pWidget->GetOptionLabel(nCurSel); @@ -167,7 +167,7 @@ void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView, void CFFL_ListBox::SaveState(CPDFSDK_PageView* pPageView) { ASSERT(pPageView); - if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) { + if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, false)) { for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; i++) { if (pListBox->IsItemSelected(i)) { m_State.Add(i); @@ -177,14 +177,14 @@ void CFFL_ListBox::SaveState(CPDFSDK_PageView* pPageView) { } void CFFL_ListBox::RestoreState(CPDFSDK_PageView* pPageView) { - if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) { + if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, false)) { for (int i = 0, sz = m_State.GetSize(); i < sz; i++) pListBox->Select(m_State[i]); } } CPWL_Wnd* CFFL_ListBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, - FX_BOOL bRestoreValue) { + bool bRestoreValue) { if (bRestoreValue) SaveState(pPageView); @@ -194,9 +194,9 @@ CPWL_Wnd* CFFL_ListBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, if (bRestoreValue) { RestoreState(pPageView); - pRet = GetPDFWindow(pPageView, FALSE); + pRet = GetPDFWindow(pPageView, false); } else { - pRet = GetPDFWindow(pPageView, TRUE); + pRet = GetPDFWindow(pPageView, true); } m_pWidget->UpdateField(); diff --git a/fpdfsdk/formfiller/cffl_listbox.h b/fpdfsdk/formfiller/cffl_listbox.h index eebe2f58ed..e97ede0deb 100644 --- a/fpdfsdk/formfiller/cffl_listbox.h +++ b/fpdfsdk/formfiller/cffl_listbox.h @@ -23,10 +23,8 @@ class CFFL_ListBox : public CFFL_FormFiller { PWL_CREATEPARAM GetCreateParam() override; CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView) override; - FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) override; - FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView) override; + bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; + bool IsDataChanged(CPDFSDK_PageView* pPageView) override; void SaveData(CPDFSDK_PageView* pPageView) override; void GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, @@ -34,7 +32,7 @@ class CFFL_ListBox : public CFFL_FormFiller { void SaveState(CPDFSDK_PageView* pPageView) override; void RestoreState(CPDFSDK_PageView* pPageView) override; CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, - FX_BOOL bRestoreValue) override; + bool bRestoreValue) override; private: std::unique_ptr<CBA_FontMap> m_pFontMap; diff --git a/fpdfsdk/formfiller/cffl_pushbutton.cpp b/fpdfsdk/formfiller/cffl_pushbutton.cpp index 4fb7b09cc8..9b4121af9d 100644 --- a/fpdfsdk/formfiller/cffl_pushbutton.cpp +++ b/fpdfsdk/formfiller/cffl_pushbutton.cpp @@ -23,9 +23,9 @@ CPWL_Wnd* CFFL_PushButton::NewPDFWindow(const PWL_CREATEPARAM& cp, return pWnd; } -FX_BOOL CFFL_PushButton::OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) { +bool CFFL_PushButton::OnChar(CPDFSDK_Annot* pAnnot, + uint32_t nChar, + uint32_t nFlags) { return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); } diff --git a/fpdfsdk/formfiller/cffl_pushbutton.h b/fpdfsdk/formfiller/cffl_pushbutton.h index 9b0a7b30e3..1d50595c87 100644 --- a/fpdfsdk/formfiller/cffl_pushbutton.h +++ b/fpdfsdk/formfiller/cffl_pushbutton.h @@ -17,9 +17,7 @@ class CFFL_PushButton : public CFFL_Button { // CFFL_Button CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView) override; - FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) override; + bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, diff --git a/fpdfsdk/formfiller/cffl_radiobutton.cpp b/fpdfsdk/formfiller/cffl_radiobutton.cpp index 8186c2f137..70d4c0dee6 100644 --- a/fpdfsdk/formfiller/cffl_radiobutton.cpp +++ b/fpdfsdk/formfiller/cffl_radiobutton.cpp @@ -28,77 +28,77 @@ CPWL_Wnd* CFFL_RadioButton::NewPDFWindow(const PWL_CREATEPARAM& cp, return pWnd; } -FX_BOOL CFFL_RadioButton::OnKeyDown(CPDFSDK_Annot* pAnnot, - uint32_t nKeyCode, - uint32_t nFlags) { +bool CFFL_RadioButton::OnKeyDown(CPDFSDK_Annot* pAnnot, + uint32_t nKeyCode, + uint32_t nFlags) { switch (nKeyCode) { case FWL_VKEY_Return: case FWL_VKEY_Space: - return TRUE; + return true; default: return CFFL_FormFiller::OnKeyDown(pAnnot, nKeyCode, nFlags); } } -FX_BOOL CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) { +bool CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot, + uint32_t nChar, + uint32_t nFlags) { switch (nChar) { case FWL_VKEY_Return: case FWL_VKEY_Space: { CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); ASSERT(pPageView); - FX_BOOL bReset = FALSE; - FX_BOOL bExit = FALSE; + bool bReset = false; + bool bExit = false; CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget); m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp( &pObserved, pPageView, bReset, bExit, nFlags); if (!pObserved || bReset || bExit) - return TRUE; + return true; CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); if (CPWL_RadioButton* pWnd = - (CPWL_RadioButton*)GetPDFWindow(pPageView, TRUE)) - pWnd->SetCheck(TRUE); + (CPWL_RadioButton*)GetPDFWindow(pPageView, true)) + pWnd->SetCheck(true); CommitData(pPageView, nFlags); - return TRUE; + return true; } default: return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); } } -FX_BOOL CFFL_RadioButton::OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) { +bool CFFL_RadioButton::OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) { CFFL_Button::OnLButtonUp(pPageView, pAnnot, nFlags, point); if (IsValid()) { if (CPWL_RadioButton* pWnd = - (CPWL_RadioButton*)GetPDFWindow(pPageView, TRUE)) - pWnd->SetCheck(TRUE); + (CPWL_RadioButton*)GetPDFWindow(pPageView, true)) + pWnd->SetCheck(true); if (!CommitData(pPageView, nFlags)) - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView) { +bool CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView) { if (CPWL_RadioButton* pWnd = - (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) { + (CPWL_RadioButton*)GetPDFWindow(pPageView, false)) { return pWnd->IsChecked() != m_pWidget->IsChecked(); } - return FALSE; + return false; } void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) { if (CPWL_RadioButton* pWnd = - (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) { + (CPWL_RadioButton*)GetPDFWindow(pPageView, false)) { bool bNewChecked = pWnd->IsChecked(); if (bNewChecked) { diff --git a/fpdfsdk/formfiller/cffl_radiobutton.h b/fpdfsdk/formfiller/cffl_radiobutton.h index b3656b945c..49a658f84e 100644 --- a/fpdfsdk/formfiller/cffl_radiobutton.h +++ b/fpdfsdk/formfiller/cffl_radiobutton.h @@ -17,17 +17,15 @@ class CFFL_RadioButton : public CFFL_Button { // CFFL_Button CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView) override; - FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, - uint32_t nKeyCode, - uint32_t nFlags) override; - FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, + bool OnKeyDown(CPDFSDK_Annot* pAnnot, + uint32_t nKeyCode, uint32_t nFlags) override; - FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) override; - FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView) override; + bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; + bool OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) override; + bool IsDataChanged(CPDFSDK_PageView* pPageView) override; void SaveData(CPDFSDK_PageView* pPageView) override; }; diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp index 566051c2de..c1cd7868c8 100644 --- a/fpdfsdk/formfiller/cffl_textfield.cpp +++ b/fpdfsdk/formfiller/cffl_textfield.cpp @@ -105,9 +105,9 @@ CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, return pWnd; } -FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) { +bool CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, + uint32_t nChar, + uint32_t nFlags) { switch (nChar) { case FWL_VKEY_Return: if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE)) { @@ -119,42 +119,42 @@ FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, rcAnnot.top, rcAnnot.right, rcAnnot.bottom); if (m_bValid) { - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) + if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, true)) pWnd->SetFocus(); } else { if (CommitData(pPageView, nFlags)) { DestroyPDFWindow(pPageView); - return TRUE; + return true; } - return FALSE; + return false; } } break; case FWL_VKEY_Escape: { CPDFSDK_PageView* pPageView = GetCurPageView(true); ASSERT(pPageView); - EscapeFiller(pPageView, TRUE); - return TRUE; + EscapeFiller(pPageView, true); + return true; } } return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); } -FX_BOOL CFFL_TextField::IsDataChanged(CPDFSDK_PageView* pPageView) { - if (CPWL_Edit* pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) +bool CFFL_TextField::IsDataChanged(CPDFSDK_PageView* pPageView) { + if (CPWL_Edit* pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, false)) return pEdit->GetText() != m_pWidget->GetValue(); - return FALSE; + return false; } void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) { - if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { + if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, false)) { CFX_WideString sOldValue = m_pWidget->GetValue(); CFX_WideString sNewValue = pWnd->GetText(); - m_pWidget->SetValue(sNewValue, FALSE); - m_pWidget->ResetFieldAppearance(TRUE); + m_pWidget->SetValue(sNewValue, false); + m_pWidget->ResetFieldAppearance(true); m_pWidget->UpdateField(); SetChangeMark(); } @@ -165,7 +165,7 @@ void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView, PDFSDK_FieldAction& fa) { switch (type) { case CPDF_AAction::KeyStroke: - if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { + if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, false)) { fa.bFieldFull = pWnd->IsTextFull(); fa.sValue = pWnd->GetText(); @@ -177,7 +177,7 @@ void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView, } break; case CPDF_AAction::Validate: - if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { + if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, false)) { fa.sValue = pWnd->GetText(); } break; @@ -195,7 +195,7 @@ void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, const PDFSDK_FieldAction& fa) { switch (type) { case CPDF_AAction::KeyStroke: - if (CPWL_Edit* pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { + if (CPWL_Edit* pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, false)) { pEdit->SetFocus(); pEdit->SetSel(fa.nSelStart, fa.nSelEnd); pEdit->ReplaceSel(fa.sChange); @@ -206,9 +206,9 @@ void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, } } -FX_BOOL CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, - const PDFSDK_FieldAction& faOld, - const PDFSDK_FieldAction& faNew) { +bool CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, + const PDFSDK_FieldAction& faOld, + const PDFSDK_FieldAction& faNew) { switch (type) { case CPDF_AAction::KeyStroke: return (!faOld.bFieldFull && faOld.nSelEnd != faNew.nSelEnd) || @@ -218,13 +218,13 @@ FX_BOOL CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, break; } - return FALSE; + return false; } void CFFL_TextField::SaveState(CPDFSDK_PageView* pPageView) { ASSERT(pPageView); - if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { + if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, false)) { pWnd->GetSel(m_State.nStart, m_State.nEnd); m_State.sValue = pWnd->GetText(); } @@ -233,14 +233,14 @@ void CFFL_TextField::SaveState(CPDFSDK_PageView* pPageView) { void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView) { ASSERT(pPageView); - if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, TRUE)) { + if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, true)) { pWnd->SetText(m_State.sValue); pWnd->SetSel(m_State.nStart, m_State.nEnd); } } CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, - FX_BOOL bRestoreValue) { + bool bRestoreValue) { if (bRestoreValue) SaveState(pPageView); @@ -250,9 +250,9 @@ CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, if (bRestoreValue) { RestoreState(pPageView); - pRet = GetPDFWindow(pPageView, FALSE); + pRet = GetPDFWindow(pPageView, false); } else { - pRet = GetPDFWindow(pPageView, TRUE); + pRet = GetPDFWindow(pPageView, true); } m_pWidget->UpdateField(); @@ -261,12 +261,12 @@ CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, } #ifdef PDF_ENABLE_XFA -FX_BOOL CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) { - if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { +bool CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) { + if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, false)) { return pWnd->IsTextFull(); } - return FALSE; + return false; } #endif // PDF_ENABLE_XFA @@ -282,6 +282,6 @@ void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) { int nCharacters = wsText.GetLength(); CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); - m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, TRUE); + m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true); } } diff --git a/fpdfsdk/formfiller/cffl_textfield.h b/fpdfsdk/formfiller/cffl_textfield.h index 74381e5e1c..29579f72a5 100644 --- a/fpdfsdk/formfiller/cffl_textfield.h +++ b/fpdfsdk/formfiller/cffl_textfield.h @@ -34,10 +34,8 @@ class CFFL_TextField : public CFFL_FormFiller, public IPWL_FocusHandler { PWL_CREATEPARAM GetCreateParam() override; CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView) override; - FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) override; - FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView) override; + bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; + bool IsDataChanged(CPDFSDK_PageView* pPageView) override; void SaveData(CPDFSDK_PageView* pPageView) override; void GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, @@ -45,20 +43,20 @@ class CFFL_TextField : public CFFL_FormFiller, public IPWL_FocusHandler { void SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa) override; - FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type, - const PDFSDK_FieldAction& faOld, - const PDFSDK_FieldAction& faNew) override; + bool IsActionDataChanged(CPDF_AAction::AActionType type, + const PDFSDK_FieldAction& faOld, + const PDFSDK_FieldAction& faNew) override; void SaveState(CPDFSDK_PageView* pPageView) override; void RestoreState(CPDFSDK_PageView* pPageView) override; CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, - FX_BOOL bRestoreValue) override; + bool bRestoreValue) override; // IPWL_FocusHandler: void OnSetFocus(CPWL_Wnd* pWnd) override; #ifdef PDF_ENABLE_XFA // CFFL_FormFiller: - FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView) override; + bool IsFieldFull(CPDFSDK_PageView* pPageView) override; #endif // PDF_ENABLE_XFA private: diff --git a/fpdfsdk/fpdf_dataavail.cpp b/fpdfsdk/fpdf_dataavail.cpp index 481dd3b60f..a3accba766 100644 --- a/fpdfsdk/fpdf_dataavail.cpp +++ b/fpdfsdk/fpdf_dataavail.cpp @@ -49,7 +49,7 @@ class CFPDF_FileAvailWrap : public CPDF_DataAvail::FileAvail { void Set(FX_FILEAVAIL* pfileAvail) { m_pfileAvail = pfileAvail; } // CPDF_DataAvail::FileAvail: - FX_BOOL IsDataAvail(FX_FILESIZE offset, uint32_t size) override { + bool IsDataAvail(FX_FILESIZE offset, uint32_t size) override { return !!m_pfileAvail->IsDataAvail(m_pfileAvail, offset, size); } diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp index 8f9c94d5fc..3bcb0c04b6 100644 --- a/fpdfsdk/fpdf_ext.cpp +++ b/fpdfsdk/fpdf_ext.cpp @@ -24,26 +24,26 @@ #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" #endif // PDF_ENABLE_XFA -FX_BOOL FPDF_UnSupportError(int nError) { +bool FPDF_UnSupportError(int nError) { CFSDK_UnsupportInfo_Adapter* pAdapter = CPDF_ModuleMgr::Get()->GetUnsupportInfoAdapter(); if (!pAdapter) - return FALSE; + return false; UNSUPPORT_INFO* info = static_cast<UNSUPPORT_INFO*>(pAdapter->GetUnspInfo()); if (info && info->FSDK_UnSupport_Handler) info->FSDK_UnSupport_Handler(info, nError); - return TRUE; + return true; } DLLEXPORT FPDF_BOOL STDCALL FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info) { if (!unsp_info || unsp_info->version != 1) - return FALSE; + return false; CPDF_ModuleMgr::Get()->SetUnsupportInfoAdapter( pdfium::MakeUnique<CFSDK_UnsupportInfo_Adapter>(unsp_info)); - return TRUE; + return true; } void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { @@ -75,7 +75,7 @@ void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { } } -FX_BOOL CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) { +bool CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) { int count = pElement->CountAttrs(); int i = 0; for (i = 0; i < count; i++) { @@ -110,10 +110,10 @@ FX_BOOL CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) { if (childType == CXML_Element::Element) { CXML_Element* pChild = pElement->GetElement(i); if (CheckSharedForm(pChild, cbName)) - return TRUE; + return true; } } - return FALSE; + return false; } void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code) { diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index 4be0135da9..f7d82773e1 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -26,23 +26,23 @@ enum FPDF_VALUE { TOP, LEFT, RIGHT, BOTTOM }; namespace { -FX_BOOL IsValiableRect(CFX_FloatRect rect, CFX_FloatRect rcPage) { +bool IsValiableRect(CFX_FloatRect rect, CFX_FloatRect rcPage) { if (rect.left - rect.right > 0.000001f || rect.bottom - rect.top > 0.000001f) - return FALSE; + return false; if (rect.left == 0.0f && rect.top == 0.0f && rect.right == 0.0f && rect.bottom == 0.0f) - return FALSE; + return false; if (!rcPage.IsEmpty()) { if (rect.left - rcPage.left < -10.000001f || rect.right - rcPage.right > 10.000001f || rect.top - rcPage.top > 10.000001f || rect.bottom - rcPage.bottom < -10.000001f) - return FALSE; + return false; } - return TRUE; + return true; } void GetContentsRect(CPDF_Document* pDoc, diff --git a/fpdfsdk/fpdf_progressive.cpp b/fpdfsdk/fpdf_progressive.cpp index 13349cd762..cc09d07638 100644 --- a/fpdfsdk/fpdf_progressive.cpp +++ b/fpdfsdk/fpdf_progressive.cpp @@ -53,7 +53,7 @@ DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, IFSDK_PAUSE_Adapter IPauseAdapter(pause); FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, - rotate, flags, FALSE, &IPauseAdapter); + rotate, flags, false, &IPauseAdapter); if (pContext->m_pRenderer) { return CPDF_ProgressiveRenderer::ToFPDFStatus( diff --git a/fpdfsdk/fpdf_sysfontinfo.cpp b/fpdfsdk/fpdf_sysfontinfo.cpp index bfd45e8d2b..ef62ae3f8a 100644 --- a/fpdfsdk/fpdf_sysfontinfo.cpp +++ b/fpdfsdk/fpdf_sysfontinfo.cpp @@ -21,16 +21,16 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { m_pInfo->Release(m_pInfo); } - FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override { + bool EnumFontList(CFX_FontMapper* pMapper) override { if (m_pInfo->EnumFonts) { m_pInfo->EnumFonts(m_pInfo, pMapper); - return TRUE; + return true; } - return FALSE; + return false; } void* MapFont(int weight, - FX_BOOL bItalic, + bool bItalic, int charset, int pitch_family, const FX_CHAR* family, @@ -56,25 +56,25 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { return m_pInfo->GetFontData(m_pInfo, hFont, table, buffer, size); } - FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override { + bool GetFaceName(void* hFont, CFX_ByteString& name) override { if (!m_pInfo->GetFaceName) - return FALSE; + return false; uint32_t size = m_pInfo->GetFaceName(m_pInfo, hFont, nullptr, 0); if (size == 0) - return FALSE; + return false; char* buffer = FX_Alloc(char, size); size = m_pInfo->GetFaceName(m_pInfo, hFont, buffer, size); name = CFX_ByteString(buffer, size); FX_Free(buffer); - return TRUE; + return true; } - FX_BOOL GetFontCharset(void* hFont, int& charset) override { + bool GetFontCharset(void* hFont, int& charset) override { if (!m_pInfo->GetFontCharset) - return FALSE; + return false; charset = m_pInfo->GetFontCharset(m_pInfo, hFont); - return TRUE; + return true; } void DeleteFont(void* hFont) override { diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp index dfaebd3143..63a46dfe7a 100644 --- a/fpdfsdk/fpdf_transformpage.cpp +++ b/fpdfsdk/fpdf_transformpage.cpp @@ -100,7 +100,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_RECTF* clipRect) { CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!pPage) - return FALSE; + return false; CFX_ByteTextBuf textBuf; textBuf << "q "; @@ -123,11 +123,11 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, if (!pContentObj) pContentObj = pPageDic ? pPageDic->GetArrayFor("Contents") : nullptr; if (!pContentObj) - return FALSE; + return false; CPDF_Document* pDoc = pPage->m_pDocument; if (!pDoc) - return FALSE; + return false; CPDF_Dictionary* pDic = new CPDF_Dictionary(pDoc->GetByteStringPool()); CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, pDic); @@ -192,7 +192,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, } } - return TRUE; + return true; } DLLEXPORT void STDCALL @@ -224,7 +224,7 @@ DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, Path.AppendRect(left, bottom, right, top); CPDF_ClipPath* pNewClipPath = new CPDF_ClipPath(); - pNewClipPath->AppendPath(Path, FXFILL_ALTERNATE, FALSE); + pNewClipPath->AppendPath(Path, FXFILL_ALTERNATE, false); return pNewClipPath; } diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp index 37cad53486..5d113596bc 100644 --- a/fpdfsdk/fpdfdoc.cpp +++ b/fpdfsdk/fpdfdoc.cpp @@ -272,13 +272,13 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, int* startPos, FPDF_LINK* linkAnnot) { if (!startPos || !linkAnnot) - return FALSE; + return false; CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!pPage || !pPage->m_pFormDict) - return FALSE; + return false; CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayFor("Annots"); if (!pAnnots) - return FALSE; + return false; for (size_t i = *startPos; i < pAnnots->GetCount(); i++) { CPDF_Dictionary* pDict = ToDictionary(static_cast<CPDF_Object*>(pAnnots->GetDirectObjectAt(i))); @@ -287,16 +287,16 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, if (pDict->GetStringFor("Subtype") == "Link") { *startPos = static_cast<int>(i + 1); *linkAnnot = static_cast<FPDF_LINK>(pDict); - return TRUE; + return true; } } - return FALSE; + return false; } DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, FS_RECTF* rect) { if (!linkAnnot || !rect) - return FALSE; + return false; CPDF_Dictionary* pAnnotDict = ToDictionary(static_cast<CPDF_Object*>(linkAnnot)); CFX_FloatRect rt = pAnnotDict->GetRectFor("Rect"); @@ -304,7 +304,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, rect->bottom = rt.bottom; rect->right = rt.right; rect->top = rt.top; - return TRUE; + return true; } DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot) { @@ -322,7 +322,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, int quadIndex, FS_QUADPOINTSF* quadPoints) { if (!linkAnnot || !quadPoints) - return FALSE; + return false; CPDF_Dictionary* pAnnotDict = ToDictionary(static_cast<CPDF_Object*>(linkAnnot)); CPDF_Array* pArray = pAnnotDict->GetArrayFor("QuadPoints"); @@ -330,7 +330,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, if (quadIndex < 0 || static_cast<size_t>(quadIndex) >= pArray->GetCount() / 8 || (static_cast<size_t>(quadIndex * 8 + 7) >= pArray->GetCount())) - return FALSE; + return false; quadPoints->x1 = pArray->GetNumberAt(quadIndex * 8); quadPoints->y1 = pArray->GetNumberAt(quadIndex * 8 + 1); quadPoints->x2 = pArray->GetNumberAt(quadIndex * 8 + 2); @@ -339,9 +339,9 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, quadPoints->y3 = pArray->GetNumberAt(quadIndex * 8 + 5); quadPoints->x4 = pArray->GetNumberAt(quadIndex * 8 + 6); quadPoints->y4 = pArray->GetNumberAt(quadIndex * 8 + 7); - return TRUE; + return true; } - return FALSE; + return false; } DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp index 282244970d..e256f85c0f 100644 --- a/fpdfsdk/fpdfeditimg.cpp +++ b/fpdfsdk/fpdfeditimg.cpp @@ -30,7 +30,7 @@ FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, FPDF_PAGEOBJECT image_object, FPDF_FILEACCESS* fileAccess) { if (!image_object || !fileAccess || !pages) - return FALSE; + return false; IFX_SeekableReadStream* pFile = new CPDF_CustomAccess(fileAccess); CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object); @@ -41,7 +41,7 @@ FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, } pImgObj->GetImage()->SetJpegImage(pFile); - return TRUE; + return true; } DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, @@ -52,7 +52,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, double e, double f) { if (!image_object) - return FALSE; + return false; CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object); pImgObj->m_Matrix.a = static_cast<FX_FLOAT>(a); @@ -62,7 +62,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, pImgObj->m_Matrix.e = static_cast<FX_FLOAT>(e); pImgObj->m_Matrix.f = static_cast<FX_FLOAT>(f); pImgObj->CalcBoundingBox(); - return TRUE; + return true; } DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages, @@ -70,7 +70,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages, FPDF_PAGEOBJECT image_object, FPDF_BITMAP bitmap) { if (!image_object || !bitmap || !pages) - return FALSE; + return false; CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object); for (int index = 0; index < nCount; index++) { @@ -78,7 +78,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages, if (pPage) pImgObj->GetImage()->ResetCache(pPage, nullptr); } - pImgObj->GetImage()->SetImage(reinterpret_cast<CFX_DIBitmap*>(bitmap), FALSE); + pImgObj->GetImage()->SetImage(reinterpret_cast<CFX_DIBitmap*>(bitmap), false); pImgObj->CalcBoundingBox(); - return TRUE; + return true; } diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp index be9ae67be4..92fd39e78b 100644 --- a/fpdfsdk/fpdfeditpage.cpp +++ b/fpdfsdk/fpdfeditpage.cpp @@ -84,7 +84,7 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument() { pInfoDict = pDoc->GetInfo(); if (pInfoDict) { if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) - pInfoDict->SetFor("CreationDate", new CPDF_String(DateStr, FALSE)); + pInfoDict->SetFor("CreationDate", new CPDF_String(DateStr, false)); pInfoDict->SetFor("Creator", new CPDF_String(L"PDFium")); } @@ -217,23 +217,23 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page) { DLLEXPORT FPDF_BOOL STDCALL FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) { if (!pageObject) - return FALSE; + return false; CPDF_PageObject* pPageObj = reinterpret_cast<CPDF_PageObject*>(pageObject); int blend_type = pPageObj->m_GeneralState.GetBlendType(); if (blend_type != FXDIB_BLEND_NORMAL) - return TRUE; + return true; CPDF_Dictionary* pSMaskDict = ToDictionary(pPageObj->m_GeneralState.GetSoftMask()); if (pSMaskDict) - return TRUE; + return true; if (pPageObj->m_GeneralState.GetFillAlpha() != 1.0f) - return TRUE; + return true; if (pPageObj->IsPath() && pPageObj->m_GeneralState.GetStrokeAlpha() != 1.0f) { - return TRUE; + return true; } if (pPageObj->IsForm()) { @@ -241,21 +241,21 @@ FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) { if (pForm) { int trans = pForm->m_Transparency; if ((trans & PDFTRANS_ISOLATED) || (trans & PDFTRANS_GROUP)) - return TRUE; + return true; } } - return FALSE; + return false; } DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page) { CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!IsPageObject(pPage)) - return FALSE; + return false; CPDF_PageContentGenerator CG(pPage); CG.GenerateContent(); - return TRUE; + return true; } DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp index 25324e3855..e8a8a6e2d0 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -290,7 +290,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, double page_y) { CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); if (!pPageView) - return FALSE; + return false; CFX_FloatPoint pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); return pPageView->OnMouseMove(pt, modifier); @@ -303,7 +303,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle, double page_y) { CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); if (!pPageView) - return FALSE; + return false; CFX_FloatPoint pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); return pPageView->OnLButtonDown(pt, modifier); @@ -316,7 +316,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle, double page_y) { CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); if (!pPageView) - return FALSE; + return false; CFX_FloatPoint pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); return pPageView->OnLButtonUp(pt, modifier); @@ -330,7 +330,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle, double page_y) { CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); if (!pPageView) - return FALSE; + return false; CFX_FloatPoint pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); return pPageView->OnRButtonDown(pt, modifier); @@ -343,7 +343,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, double page_y) { CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); if (!pPageView) - return FALSE; + return false; CFX_FloatPoint pt((FX_FLOAT)page_x, (FX_FLOAT)page_y); return pPageView->OnRButtonUp(pt, modifier); @@ -356,7 +356,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle, int modifier) { CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); if (!pPageView) - return FALSE; + return false; return pPageView->OnKeyDown(nKeyCode, modifier); } @@ -367,7 +367,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyUp(FPDF_FORMHANDLE hHandle, int modifier) { CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); if (!pPageView) - return FALSE; + return false; return pPageView->OnKeyUp(nKeyCode, modifier); } @@ -378,7 +378,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnChar(FPDF_FORMHANDLE hHandle, int modifier) { CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); if (!pPageView) - return FALSE; + return false; return pPageView->OnChar(nChar, modifier); } @@ -387,7 +387,7 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle) { CPDFSDK_FormFillEnvironment* pFormFillEnv = HandleToCPDFSDKEnvironment(hHandle); if (!pFormFillEnv) - return FALSE; + return false; return pFormFillEnv->KillFocusAnnot(0); } @@ -594,24 +594,24 @@ FPDF_StringHandleGetStringByIndex(FPDF_STRINGHANDLE sHandle, FPDF_BYTESTRING bsText, FPDF_DWORD* size) { if (!sHandle || !size) - return FALSE; + return false; int count = FPDF_StringHandleCounts(sHandle); if (index < 0 || index >= count) - return FALSE; + return false; std::vector<CFX_ByteString>* sSuggestWords = FromFPDFStringHandle(sHandle); uint32_t len = (*sSuggestWords)[index].GetLength(); if (!bsText) { *size = len; - return TRUE; + return true; } uint32_t real_size = len < *size ? len : *size; if (real_size > 0) FXSYS_memcpy((void*)bsText, (*sSuggestWords)[index].c_str(), real_size); *size = real_size; - return TRUE; + return true; } DLLEXPORT void STDCALL @@ -624,10 +624,10 @@ FPDF_StringHandleAddString(FPDF_STRINGHANDLE stringHandle, FPDF_BYTESTRING bsText, FPDF_DWORD size) { if (!stringHandle || !bsText || size == 0) - return FALSE; + return false; FromFPDFStringHandle(stringHandle)->push_back(CFX_ByteString(bsText, size)); - return TRUE; + return true; } #endif // PDF_ENABLE_XFA @@ -652,7 +652,7 @@ DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle) { DLLEXPORT void STDCALL FORM_OnAfterLoadPage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle) { if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page)) - pPageView->SetValid(TRUE); + pPageView->SetValid(true); } DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, @@ -671,7 +671,7 @@ DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, CPDFSDK_PageView* pPageView = pFormFillEnv->GetPageView(pPage, false); if (pPageView) { - pPageView->SetValid(FALSE); + pPageView->SetValid(false); // RemovePageView() takes care of the delete for us. pFormFillEnv->RemovePageView(pPage); } diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp index f41f904e17..22b23d1db1 100644 --- a/fpdfsdk/fpdfppo.cpp +++ b/fpdfsdk/fpdfppo.cpp @@ -26,16 +26,16 @@ class CPDF_PageOrganizer { CPDF_PageOrganizer(); ~CPDF_PageOrganizer(); - FX_BOOL PDFDocInit(CPDF_Document* pDestPDFDoc, CPDF_Document* pSrcPDFDoc); - FX_BOOL ExportPage(CPDF_Document* pSrcPDFDoc, - std::vector<uint16_t>* pPageNums, - CPDF_Document* pDestPDFDoc, - int nIndex); + bool PDFDocInit(CPDF_Document* pDestPDFDoc, CPDF_Document* pSrcPDFDoc); + bool ExportPage(CPDF_Document* pSrcPDFDoc, + std::vector<uint16_t>* pPageNums, + CPDF_Document* pDestPDFDoc, + int nIndex); CPDF_Object* PageDictGetInheritableTag(CPDF_Dictionary* pDict, const CFX_ByteString& bsSrctag); - FX_BOOL UpdateReference(CPDF_Object* pObj, - CPDF_Document* pDoc, - ObjectNumberMap* pObjNumberMap); + bool UpdateReference(CPDF_Object* pObj, + CPDF_Document* pDoc, + ObjectNumberMap* pObjNumberMap); uint32_t GetNewObjId(CPDF_Document* pDoc, ObjectNumberMap* pObjNumberMap, CPDF_Reference* pRef); @@ -45,22 +45,22 @@ CPDF_PageOrganizer::CPDF_PageOrganizer() {} CPDF_PageOrganizer::~CPDF_PageOrganizer() {} -FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc, - CPDF_Document* pSrcPDFDoc) { +bool CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc, + CPDF_Document* pSrcPDFDoc) { if (!pDestPDFDoc || !pSrcPDFDoc) - return FALSE; + return false; CPDF_Dictionary* pNewRoot = pDestPDFDoc->GetRoot(); if (!pNewRoot) - return FALSE; + return false; CPDF_Dictionary* DInfoDict = pDestPDFDoc->GetInfo(); if (!DInfoDict) - return FALSE; + return false; CFX_ByteString producerstr; producerstr.Format("PDFium"); - DInfoDict->SetFor("Producer", new CPDF_String(producerstr, FALSE)); + DInfoDict->SetFor("Producer", new CPDF_String(producerstr, false)); CFX_ByteString cbRootType = pNewRoot->GetStringFor("Type", ""); if (cbRootType.IsEmpty()) @@ -86,13 +86,13 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc, pDestPDFDoc->AddIndirectObject(new CPDF_Array)); } - return TRUE; + return true; } -FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc, - std::vector<uint16_t>* pPageNums, - CPDF_Document* pDestPDFDoc, - int nIndex) { +bool CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc, + std::vector<uint16_t>* pPageNums, + CPDF_Document* pDestPDFDoc, + int nIndex) { int curpage = nIndex; std::unique_ptr<ObjectNumberMap> pObjNumberMap(new ObjectNumberMap); int nSize = pdfium::CollectionSize<int>(*pPageNums); @@ -100,7 +100,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc, CPDF_Dictionary* pCurPageDict = pDestPDFDoc->CreateNewPage(curpage); CPDF_Dictionary* pSrcPageDict = pSrcPDFDoc->GetPage(pPageNums->at(i) - 1); if (!pSrcPageDict || !pCurPageDict) - return FALSE; + return false; // Clone the page dictionary for (const auto& it : *pSrcPageDict) { @@ -141,7 +141,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc, if (!pCurPageDict->KeyExist("Resources")) { pInheritable = PageDictGetInheritableTag(pSrcPageDict, "Resources"); if (!pInheritable) - return FALSE; + return false; pCurPageDict->SetFor("Resources", pInheritable->Clone()); } // 3 CropBox //Optional @@ -167,7 +167,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc, ++curpage; } - return TRUE; + return true; } CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag( @@ -202,15 +202,15 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag( return nullptr; } -FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, - CPDF_Document* pDoc, - ObjectNumberMap* pObjNumberMap) { +bool CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, + CPDF_Document* pDoc, + ObjectNumberMap* pObjNumberMap) { switch (pObj->GetType()) { case CPDF_Object::REFERENCE: { CPDF_Reference* pReference = pObj->AsReference(); uint32_t newobjnum = GetNewObjId(pDoc, pObjNumberMap, pReference); if (newobjnum == 0) - return FALSE; + return false; pReference->SetRef(pDoc, newobjnum); break; } @@ -224,7 +224,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, if (key == "Parent" || key == "Prev" || key == "First") continue; if (!pNextObj) - return FALSE; + return false; if (!UpdateReference(pNextObj, pDoc, pObjNumberMap)) pDict->RemoveFor(key); } @@ -235,9 +235,9 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, for (size_t i = 0; i < pArray->GetCount(); ++i) { CPDF_Object* pNextObj = pArray->GetObjectAt(i); if (!pNextObj) - return FALSE; + return false; if (!UpdateReference(pNextObj, pDoc, pObjNumberMap)) - return FALSE; + return false; } break; } @@ -246,9 +246,9 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, CPDF_Dictionary* pDict = pStream->GetDict(); if (pDict) { if (!UpdateReference(pDict, pDoc, pObjNumberMap)) - return FALSE; + return false; } else { - return FALSE; + return false; } break; } @@ -256,7 +256,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, break; } - return TRUE; + return true; } uint32_t CPDF_PageOrganizer::GetNewObjId(CPDF_Document* pDoc, @@ -312,7 +312,7 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, CFX_ByteString cbCompareString("0123456789-,"); for (int i = 0; i < nLength; ++i) { if (cbCompareString.Find(rangstring[i]) == -1) - return FALSE; + return false; } CFX_ByteString cbMidRange; int nStringFrom = 0; @@ -326,22 +326,22 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, if (nMid == -1) { long lPageNum = atol(cbMidRange.c_str()); if (lPageNum <= 0 || lPageNum > nCount) - return FALSE; + return false; pageArray->push_back((uint16_t)lPageNum); } else { int nStartPageNum = atol(cbMidRange.Mid(0, nMid).c_str()); if (nStartPageNum == 0) - return FALSE; + return false; ++nMid; int nEnd = cbMidRange.GetLength() - nMid; if (nEnd == 0) - return FALSE; + return false; int nEndPageNum = atol(cbMidRange.Mid(nMid, nEnd).c_str()); if (nStartPageNum < 0 || nStartPageNum > nEndPageNum || nEndPageNum > nCount) { - return FALSE; + return false; } for (int i = nStartPageNum; i <= nEndPageNum; ++i) { pageArray->push_back(i); @@ -350,7 +350,7 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, nStringFrom = nStringTo + 1; } } - return TRUE; + return true; } DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc, @@ -359,17 +359,17 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc, int index) { CPDF_Document* pDestDoc = CPDFDocumentFromFPDFDocument(dest_doc); if (!dest_doc) - return FALSE; + return false; CPDF_Document* pSrcDoc = CPDFDocumentFromFPDFDocument(src_doc); if (!pSrcDoc) - return FALSE; + return false; std::vector<uint16_t> pageArray; int nCount = pSrcDoc->GetPageCount(); if (pagerange) { if (!ParserPageRangeString(pagerange, &pageArray, nCount)) - return FALSE; + return false; } else { for (int i = 1; i <= nCount; ++i) { pageArray.push_back(i); @@ -385,21 +385,21 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, FPDF_DOCUMENT src_doc) { CPDF_Document* pDstDoc = CPDFDocumentFromFPDFDocument(dest_doc); if (!pDstDoc) - return FALSE; + return false; CPDF_Document* pSrcDoc = CPDFDocumentFromFPDFDocument(src_doc); if (!pSrcDoc) - return FALSE; + return false; CPDF_Dictionary* pSrcDict = pSrcDoc->GetRoot(); pSrcDict = pSrcDict->GetDictFor("ViewerPreferences"); if (!pSrcDict) - return FALSE; + return false; CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); if (!pDstDict) - return FALSE; + return false; pDstDict->SetFor("ViewerPreferences", pSrcDict->CloneDirectObject()); - return TRUE; + return true; } diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp index 257f1fc0fc..1b639b7cc4 100644 --- a/fpdfsdk/fpdfsave.cpp +++ b/fpdfsdk/fpdfsave.cpp @@ -183,7 +183,7 @@ bool SaveXFADocumentData(CPDFXFA_Context* pContext, CPDF_Stream* pData = new CPDF_Stream; pData->InitStreamFromFile(pDsfileWrite.get(), pDataDict); iLast = pArray->GetCount() - 2; - pArray->InsertAt(iLast, new CPDF_String("datasets", FALSE)); + pArray->InsertAt(iLast, new CPDF_String("datasets", false)); pArray->InsertAt( iLast + 1, new CPDF_Reference(pPDFDocument, @@ -207,7 +207,7 @@ bool SaveXFADocumentData(CPDFXFA_Context* pContext, CPDF_Stream* pData = new CPDF_Stream; pData->InitStreamFromFile(pfileWrite.get(), pDataDict); iLast = pArray->GetCount() - 2; - pArray->InsertAt(iLast, new CPDF_String("form", FALSE)); + pArray->InsertAt(iLast, new CPDF_String("form", false)); pArray->InsertAt( iLast + 1, new CPDF_Reference(pPDFDocument, @@ -308,12 +308,12 @@ bool FPDF_Doc_Save(FPDF_DOCUMENT document, DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document, FPDF_FILEWRITE* pFileWrite, FPDF_DWORD flags) { - return FPDF_Doc_Save(document, pFileWrite, flags, FALSE, 0); + return FPDF_Doc_Save(document, pFileWrite, flags, false, 0); } DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document, FPDF_FILEWRITE* pFileWrite, FPDF_DWORD flags, int fileVersion) { - return FPDF_Doc_Save(document, pFileWrite, flags, TRUE, fileVersion); + return FPDF_Doc_Save(document, pFileWrite, flags, true, fileVersion); } diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp index 6f3f45329e..ce195ade26 100644 --- a/fpdfsdk/fpdftext.cpp +++ b/fpdfsdk/fpdftext.cpp @@ -232,7 +232,7 @@ DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle) { if (!handle) - return FALSE; + return false; CPDF_TextPageFind* textpageFind = CPDFTextPageFindFromFPDFSchHandle(handle); return textpageFind->FindNext(); @@ -240,7 +240,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle) { DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle) { if (!handle) - return FALSE; + return false; CPDF_TextPageFind* textpageFind = CPDFTextPageFindFromFPDFSchHandle(handle); return textpageFind->FindPrev(); diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 5d3dfd824a..cde15dff9b 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -224,7 +224,7 @@ FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy) { case FPDF_POLICY_MACHINETIME_ACCESS: return !!(foxit_sandbox_policy & 0x01); default: - return FALSE; + return false; } } @@ -349,28 +349,28 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, int* docType) { if (!document) - return FALSE; + return false; CPDF_Document* pdfDoc = (static_cast<CPDFXFA_Context*>(document))->GetPDFDoc(); if (!pdfDoc) - return FALSE; + return false; CPDF_Dictionary* pRoot = pdfDoc->GetRoot(); if (!pRoot) - return FALSE; + return false; CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm"); if (!pAcroForm) - return FALSE; + return false; CPDF_Object* pXFA = pAcroForm->GetObjectFor("XFA"); if (!pXFA) - return FALSE; + return false; bool bDynamicXFA = pRoot->GetBooleanFor("NeedsRendering", false); *docType = bDynamicXFA ? DOCTYPE_DYNAMIC_XFA : DOCTYPE_STATIC_XFA; - return TRUE; + return true; } DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document) { @@ -446,19 +446,19 @@ FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, int* fileVersion) { if (!fileVersion) - return FALSE; + return false; *fileVersion = 0; CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc); if (!pDoc) - return FALSE; + return false; CPDF_Parser* pParser = pDoc->GetParser(); if (!pParser) - return FALSE; + return false; *fileVersion = pParser->GetFileVersion(); - return TRUE; + return true; } // jabdelmalek: changed return type from uint32_t to build on Linux (and match @@ -554,7 +554,7 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, } FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, - rotate, flags, TRUE, nullptr); + rotate, flags, true, nullptr); if (bNewBitmap) { CFX_WindowsDevice WinDC(dc); @@ -564,7 +564,7 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, pDst->Create(size_x, size_y, FXDIB_Rgb32); FXSYS_memset(pDst->GetBuffer(), -1, pitch * size_y); pDst->CompositeBitmap(0, 0, size_x, size_y, pBitmap.get(), 0, 0, - FXDIB_BLEND_NORMAL, nullptr, FALSE, nullptr); + FXDIB_BLEND_NORMAL, nullptr, false, nullptr); WinDC.StretchDIBits(pDst.get(), 0, 0, size_x, size_y); } else { WinDC.SetDIBits(pBitmap.get(), 0, 0); @@ -598,7 +598,7 @@ DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, pDevice->Attach(pBitmap, !!(flags & FPDF_REVERSE_BYTE_ORDER), nullptr, false); FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, - rotate, flags, TRUE, nullptr); + rotate, flags, true, nullptr); pPage->SetRenderContext(nullptr); } @@ -616,7 +616,7 @@ DLLEXPORT FPDF_RECORDER STDCALL FPDF_RenderPageSkp(FPDF_PAGE page, CFX_FxgeDevice* skDevice = new CFX_FxgeDevice; FPDF_RECORDER recorder = skDevice->CreateRecorder(size_x, size_y); pContext->m_pDevice.reset(skDevice); - FPDF_RenderPage_Retail(pContext, page, 0, 0, size_x, size_y, 0, 0, TRUE, + FPDF_RenderPage_Retail(pContext, page, 0, 0, size_x, size_y, 0, 0, true, nullptr); pPage->SetRenderContext(nullptr); return recorder; @@ -806,7 +806,7 @@ void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext, int size_y, int rotate, int flags, - FX_BOOL bNeedToRestore, + bool bNeedToRestore, IFSDK_PAUSE_Adapter* pause) { CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!pPage) @@ -857,9 +857,9 @@ void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext, if (flags & FPDF_ANNOT) { pContext->m_pAnnots = pdfium::MakeUnique<CPDF_AnnotList>(pPage); - FX_BOOL bPrinting = pContext->m_pDevice->GetDeviceClass() != FXDC_DISPLAY; + bool bPrinting = pContext->m_pDevice->GetDeviceClass() != FXDC_DISPLAY; pContext->m_pAnnots->DisplayAnnots(pPage, pContext->m_pContext.get(), - bPrinting, &matrix, FALSE, nullptr); + bPrinting, &matrix, false, nullptr); } pContext->m_pRenderer = pdfium::MakeUnique<CPDF_ProgressiveRenderer>( @@ -876,35 +876,35 @@ DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, double* height) { UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document); if (!pDoc) - return FALSE; + return false; #ifdef PDF_ENABLE_XFA int count = pDoc->GetPageCount(); if (page_index < 0 || page_index >= count) - return FALSE; + return false; CPDFXFA_Page* pPage = pDoc->GetXFAPage(page_index); if (!pPage) - return FALSE; + return false; *width = pPage->GetPageWidth(); *height = pPage->GetPageHeight(); #else // PDF_ENABLE_XFA CPDF_Dictionary* pDict = pDoc->GetPage(page_index); if (!pDict) - return FALSE; + return false; CPDF_Page page(pDoc, pDict, true); *width = page.GetPageWidth(); *height = page.GetPageHeight(); #endif // PDF_ENABLE_XFA - return TRUE; + return true; } DLLEXPORT FPDF_BOOL STDCALL FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document) { CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); if (!pDoc) - return TRUE; + return true; CPDF_ViewerPreferences viewRef(pDoc); return viewRef.PrintScaling(); } 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; diff --git a/fpdfsdk/fsdk_actionhandler.cpp b/fpdfsdk/fsdk_actionhandler.cpp index c324406359..61d2a52853 100644 --- a/fpdfsdk/fsdk_actionhandler.cpp +++ b/fpdfsdk/fsdk_actionhandler.cpp @@ -18,14 +18,14 @@ #include "fpdfsdk/javascript/ijs_runtime.h" #include "third_party/base/stl_util.h" -FX_BOOL CPDFSDK_ActionHandler::DoAction_DocOpen( +bool CPDFSDK_ActionHandler::DoAction_DocOpen( const CPDF_Action& action, CPDFSDK_FormFillEnvironment* pFormFillEnv) { std::set<CPDF_Dictionary*> visited; return ExecuteDocumentOpenAction(action, pFormFillEnv, &visited); } -FX_BOOL CPDFSDK_ActionHandler::DoAction_JavaScript( +bool CPDFSDK_ActionHandler::DoAction_JavaScript( const CPDF_Action& JsAction, CFX_WideString csJSName, CPDFSDK_FormFillEnvironment* pFormFillEnv) { @@ -33,14 +33,14 @@ FX_BOOL CPDFSDK_ActionHandler::DoAction_JavaScript( CFX_WideString swJS = JsAction.GetJavaScript(); if (!swJS.IsEmpty()) { RunDocumentOpenJavaScript(pFormFillEnv, csJSName, swJS); - return TRUE; + return true; } } - return FALSE; + return false; } -FX_BOOL CPDFSDK_ActionHandler::DoAction_FieldJavaScript( +bool CPDFSDK_ActionHandler::DoAction_FieldJavaScript( const CPDF_Action& JsAction, CPDF_AAction::AActionType type, CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -52,13 +52,13 @@ FX_BOOL CPDFSDK_ActionHandler::DoAction_FieldJavaScript( CFX_WideString swJS = JsAction.GetJavaScript(); if (!swJS.IsEmpty()) { RunFieldJavaScript(pFormFillEnv, pFormField, type, data, swJS); - return TRUE; + return true; } } - return FALSE; + return false; } -FX_BOOL CPDFSDK_ActionHandler::DoAction_Page( +bool CPDFSDK_ActionHandler::DoAction_Page( const CPDF_Action& action, enum CPDF_AAction::AActionType eType, CPDFSDK_FormFillEnvironment* pFormFillEnv) { @@ -66,7 +66,7 @@ FX_BOOL CPDFSDK_ActionHandler::DoAction_Page( return ExecuteDocumentPageAction(action, eType, pFormFillEnv, &visited); } -FX_BOOL CPDFSDK_ActionHandler::DoAction_Document( +bool CPDFSDK_ActionHandler::DoAction_Document( const CPDF_Action& action, enum CPDF_AAction::AActionType eType, CPDFSDK_FormFillEnvironment* pFormFillEnv) { @@ -74,7 +74,7 @@ FX_BOOL CPDFSDK_ActionHandler::DoAction_Document( return ExecuteDocumentPageAction(action, eType, pFormFillEnv, &visited); } -FX_BOOL CPDFSDK_ActionHandler::DoAction_BookMark( +bool CPDFSDK_ActionHandler::DoAction_BookMark( CPDF_Bookmark* pBookMark, const CPDF_Action& action, CPDF_AAction::AActionType type, @@ -83,7 +83,7 @@ FX_BOOL CPDFSDK_ActionHandler::DoAction_BookMark( return ExecuteBookMark(action, pFormFillEnv, pBookMark, &visited); } -FX_BOOL CPDFSDK_ActionHandler::DoAction_Screen( +bool CPDFSDK_ActionHandler::DoAction_Screen( const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -92,14 +92,14 @@ FX_BOOL CPDFSDK_ActionHandler::DoAction_Screen( return ExecuteScreenAction(action, type, pFormFillEnv, pScreen, &visited); } -FX_BOOL CPDFSDK_ActionHandler::DoAction_Link( +bool CPDFSDK_ActionHandler::DoAction_Link( const CPDF_Action& action, CPDFSDK_FormFillEnvironment* pFormFillEnv) { std::set<CPDF_Dictionary*> visited; return ExecuteLinkAction(action, pFormFillEnv, &visited); } -FX_BOOL CPDFSDK_ActionHandler::DoAction_Field( +bool CPDFSDK_ActionHandler::DoAction_Field( const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -110,13 +110,13 @@ FX_BOOL CPDFSDK_ActionHandler::DoAction_Field( &visited); } -FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentOpenAction( +bool CPDFSDK_ActionHandler::ExecuteDocumentOpenAction( const CPDF_Action& action, CPDFSDK_FormFillEnvironment* pFormFillEnv, std::set<CPDF_Dictionary*>* visited) { CPDF_Dictionary* pDict = action.GetDict(); if (pdfium::ContainsKey(*visited, pDict)) - return FALSE; + return false; visited->insert(pDict); @@ -135,19 +135,19 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentOpenAction( for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) { CPDF_Action subaction = action.GetSubAction(i); if (!ExecuteDocumentOpenAction(subaction, pFormFillEnv, visited)) - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CPDFSDK_ActionHandler::ExecuteLinkAction( +bool CPDFSDK_ActionHandler::ExecuteLinkAction( const CPDF_Action& action, CPDFSDK_FormFillEnvironment* pFormFillEnv, std::set<CPDF_Dictionary*>* visited) { CPDF_Dictionary* pDict = action.GetDict(); if (pdfium::ContainsKey(*visited, pDict)) - return FALSE; + return false; visited->insert(pDict); @@ -161,7 +161,7 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteLinkAction( pContext->OnLink_MouseUp(pFormFillEnv); CFX_WideString csInfo; - FX_BOOL bRet = pContext->RunScript(swJS, &csInfo); + bool bRet = pContext->RunScript(swJS, &csInfo); if (!bRet) { // FIXME: return error. } @@ -176,20 +176,20 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteLinkAction( for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) { CPDF_Action subaction = action.GetSubAction(i); if (!ExecuteLinkAction(subaction, pFormFillEnv, visited)) - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentPageAction( +bool CPDFSDK_ActionHandler::ExecuteDocumentPageAction( const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_FormFillEnvironment* pFormFillEnv, std::set<CPDF_Dictionary*>* visited) { CPDF_Dictionary* pDict = action.GetDict(); if (pdfium::ContainsKey(*visited, pDict)) - return FALSE; + return false; visited->insert(pDict); @@ -206,18 +206,18 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentPageAction( } if (!IsValidDocView(pFormFillEnv)) - return FALSE; + return false; for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) { CPDF_Action subaction = action.GetSubAction(i); if (!ExecuteDocumentPageAction(subaction, type, pFormFillEnv, visited)) - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CPDFSDK_ActionHandler::IsValidField( +bool CPDFSDK_ActionHandler::IsValidField( CPDFSDK_FormFillEnvironment* pFormFillEnv, CPDF_Dictionary* pFieldDict) { ASSERT(pFieldDict); @@ -227,7 +227,7 @@ FX_BOOL CPDFSDK_ActionHandler::IsValidField( return !!pPDFInterForm->GetFieldByDict(pFieldDict); } -FX_BOOL CPDFSDK_ActionHandler::ExecuteFieldAction( +bool CPDFSDK_ActionHandler::ExecuteFieldAction( const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -236,7 +236,7 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteFieldAction( std::set<CPDF_Dictionary*>* visited) { CPDF_Dictionary* pDict = action.GetDict(); if (pdfium::ContainsKey(*visited, pDict)) - return FALSE; + return false; visited->insert(pDict); @@ -247,7 +247,7 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteFieldAction( if (!swJS.IsEmpty()) { RunFieldJavaScript(pFormFillEnv, pFormField, type, data, swJS); if (!IsValidField(pFormFillEnv, pFormField->GetFieldDict())) - return FALSE; + return false; } } } else { @@ -258,13 +258,13 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteFieldAction( CPDF_Action subaction = action.GetSubAction(i); if (!ExecuteFieldAction(subaction, type, pFormFillEnv, pFormField, data, visited)) - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CPDFSDK_ActionHandler::ExecuteScreenAction( +bool CPDFSDK_ActionHandler::ExecuteScreenAction( const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -272,7 +272,7 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteScreenAction( std::set<CPDF_Dictionary*>* visited) { CPDF_Dictionary* pDict = action.GetDict(); if (pdfium::ContainsKey(*visited, pDict)) - return FALSE; + return false; visited->insert(pDict); @@ -284,7 +284,7 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteScreenAction( IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime(); IJS_Context* pContext = pRuntime->NewContext(); CFX_WideString csInfo; - FX_BOOL bRet = pContext->RunScript(swJS, &csInfo); + bool bRet = pContext->RunScript(swJS, &csInfo); if (!bRet) { // FIXME: return error. } @@ -299,20 +299,20 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteScreenAction( for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) { CPDF_Action subaction = action.GetSubAction(i); if (!ExecuteScreenAction(subaction, type, pFormFillEnv, pScreen, visited)) - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CPDFSDK_ActionHandler::ExecuteBookMark( +bool CPDFSDK_ActionHandler::ExecuteBookMark( const CPDF_Action& action, CPDFSDK_FormFillEnvironment* pFormFillEnv, CPDF_Bookmark* pBookmark, std::set<CPDF_Dictionary*>* visited) { CPDF_Dictionary* pDict = action.GetDict(); if (pdfium::ContainsKey(*visited, pDict)) - return FALSE; + return false; visited->insert(pDict); @@ -326,7 +326,7 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteBookMark( pContext->OnBookmark_MouseUp(pBookmark); CFX_WideString csInfo; - FX_BOOL bRet = pContext->RunScript(swJS, &csInfo); + bool bRet = pContext->RunScript(swJS, &csInfo); if (!bRet) { // FIXME: return error. } @@ -341,10 +341,10 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteBookMark( for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) { CPDF_Action subaction = action.GetSubAction(i); if (!ExecuteBookMark(subaction, pFormFillEnv, pBookmark, visited)) - return FALSE; + return false; } - return TRUE; + return true; } void CPDFSDK_ActionHandler::DoAction_NoJs( @@ -389,7 +389,7 @@ void CPDFSDK_ActionHandler::DoAction_NoJs( DoAction_ImportData(action, pFormFillEnv); break; case CPDF_Action::JavaScript: - ASSERT(FALSE); + ASSERT(false); break; case CPDF_Action::SetOCGState: DoAction_SetOCGState(pFormFillEnv, action); @@ -405,10 +405,10 @@ void CPDFSDK_ActionHandler::DoAction_NoJs( } } -FX_BOOL CPDFSDK_ActionHandler::IsValidDocView( +bool CPDFSDK_ActionHandler::IsValidDocView( CPDFSDK_FormFillEnvironment* pFormFillEnv) { ASSERT(pFormFillEnv); - return TRUE; + return true; } void CPDFSDK_ActionHandler::DoAction_GoTo( @@ -512,12 +512,12 @@ void CPDFSDK_ActionHandler::RunFieldJavaScript( data.sValue, data.bRC); break; default: - ASSERT(FALSE); + ASSERT(false); break; } CFX_WideString csInfo; - FX_BOOL bRet = pContext->RunScript(script, &csInfo); + bool bRet = pContext->RunScript(script, &csInfo); if (!bRet) { // FIXME: return error. } @@ -534,7 +534,7 @@ void CPDFSDK_ActionHandler::RunDocumentOpenJavaScript( pContext->OnDoc_Open(pFormFillEnv, sScriptName); CFX_WideString csInfo; - FX_BOOL bRet = pContext->RunScript(script, &csInfo); + bool bRet = pContext->RunScript(script, &csInfo); if (!bRet) { // FIXME: return error. } @@ -577,12 +577,12 @@ void CPDFSDK_ActionHandler::RunDocumentPageJavaScript( pContext->OnPage_OutView(pFormFillEnv); break; default: - ASSERT(FALSE); + ASSERT(false); break; } CFX_WideString csInfo; - FX_BOOL bRet = pContext->RunScript(script, &csInfo); + bool bRet = pContext->RunScript(script, &csInfo); if (!bRet) { // FIXME: return error. } @@ -590,40 +590,40 @@ void CPDFSDK_ActionHandler::RunDocumentPageJavaScript( pRuntime->ReleaseContext(pContext); } -FX_BOOL CPDFSDK_ActionHandler::DoAction_Hide( +bool CPDFSDK_ActionHandler::DoAction_Hide( const CPDF_Action& action, CPDFSDK_FormFillEnvironment* pFormFillEnv) { CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); if (pInterForm->DoAction_Hide(action)) { pFormFillEnv->SetChangeMark(); - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CPDFSDK_ActionHandler::DoAction_SubmitForm( +bool CPDFSDK_ActionHandler::DoAction_SubmitForm( const CPDF_Action& action, CPDFSDK_FormFillEnvironment* pFormFillEnv) { CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); return pInterForm->DoAction_SubmitForm(action); } -FX_BOOL CPDFSDK_ActionHandler::DoAction_ResetForm( +bool CPDFSDK_ActionHandler::DoAction_ResetForm( const CPDF_Action& action, CPDFSDK_FormFillEnvironment* pFormFillEnv) { CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); return pInterForm->DoAction_ResetForm(action); } -FX_BOOL CPDFSDK_ActionHandler::DoAction_ImportData( +bool CPDFSDK_ActionHandler::DoAction_ImportData( const CPDF_Action& action, CPDFSDK_FormFillEnvironment* pFormFillEnv) { CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); if (pInterForm->DoAction_ImportData(action)) { pFormFillEnv->SetChangeMark(); - return TRUE; + return true; } - return FALSE; + return false; } diff --git a/fpdfsdk/fsdk_actionhandler.h b/fpdfsdk/fsdk_actionhandler.h index 6eff835c5d..1c8dedefd7 100644 --- a/fpdfsdk/fsdk_actionhandler.h +++ b/fpdfsdk/fsdk_actionhandler.h @@ -23,64 +23,64 @@ class CPDF_FormField; class CPDFSDK_ActionHandler { public: - FX_BOOL DoAction_DocOpen(const CPDF_Action& action, - CPDFSDK_FormFillEnvironment* pFormFillEnv); - FX_BOOL DoAction_JavaScript(const CPDF_Action& JsAction, - CFX_WideString csJSName, - CPDFSDK_FormFillEnvironment* pFormFillEnv); - FX_BOOL DoAction_Page(const CPDF_Action& action, - enum CPDF_AAction::AActionType eType, + bool DoAction_DocOpen(const CPDF_Action& action, CPDFSDK_FormFillEnvironment* pFormFillEnv); - FX_BOOL DoAction_Document(const CPDF_Action& action, - enum CPDF_AAction::AActionType eType, - CPDFSDK_FormFillEnvironment* pFormFillEnv); - FX_BOOL DoAction_BookMark(CPDF_Bookmark* pBookMark, - const CPDF_Action& action, - CPDF_AAction::AActionType type, - CPDFSDK_FormFillEnvironment* pFormFillEnv); - FX_BOOL DoAction_Screen(const CPDF_Action& action, - CPDF_AAction::AActionType type, - CPDFSDK_FormFillEnvironment* pFormFillEnv, - CPDFSDK_Annot* pScreen); - FX_BOOL DoAction_Link(const CPDF_Action& action, - CPDFSDK_FormFillEnvironment* pFormFillEnv); - FX_BOOL DoAction_Field(const CPDF_Action& action, + bool DoAction_JavaScript(const CPDF_Action& JsAction, + CFX_WideString csJSName, + CPDFSDK_FormFillEnvironment* pFormFillEnv); + bool DoAction_Page(const CPDF_Action& action, + enum CPDF_AAction::AActionType eType, + CPDFSDK_FormFillEnvironment* pFormFillEnv); + bool DoAction_Document(const CPDF_Action& action, + enum CPDF_AAction::AActionType eType, + CPDFSDK_FormFillEnvironment* pFormFillEnv); + bool DoAction_BookMark(CPDF_Bookmark* pBookMark, + const CPDF_Action& action, CPDF_AAction::AActionType type, - CPDFSDK_FormFillEnvironment* pFormFillEnv, - CPDF_FormField* pFormField, - PDFSDK_FieldAction& data); - FX_BOOL DoAction_FieldJavaScript(const CPDF_Action& JsAction, - CPDF_AAction::AActionType type, - CPDFSDK_FormFillEnvironment* pFormFillEnv, - CPDF_FormField* pFormField, - PDFSDK_FieldAction& data); + CPDFSDK_FormFillEnvironment* pFormFillEnv); + bool DoAction_Screen(const CPDF_Action& action, + CPDF_AAction::AActionType type, + CPDFSDK_FormFillEnvironment* pFormFillEnv, + CPDFSDK_Annot* pScreen); + bool DoAction_Link(const CPDF_Action& action, + CPDFSDK_FormFillEnvironment* pFormFillEnv); + bool DoAction_Field(const CPDF_Action& action, + CPDF_AAction::AActionType type, + CPDFSDK_FormFillEnvironment* pFormFillEnv, + CPDF_FormField* pFormField, + PDFSDK_FieldAction& data); + bool DoAction_FieldJavaScript(const CPDF_Action& JsAction, + CPDF_AAction::AActionType type, + CPDFSDK_FormFillEnvironment* pFormFillEnv, + CPDF_FormField* pFormField, + PDFSDK_FieldAction& data); private: - FX_BOOL ExecuteDocumentOpenAction(const CPDF_Action& action, - CPDFSDK_FormFillEnvironment* pFormFillEnv, - std::set<CPDF_Dictionary*>* visited); - FX_BOOL ExecuteDocumentPageAction(const CPDF_Action& action, - CPDF_AAction::AActionType type, - CPDFSDK_FormFillEnvironment* pFormFillEnv, - std::set<CPDF_Dictionary*>* visited); - FX_BOOL ExecuteFieldAction(const CPDF_Action& action, - CPDF_AAction::AActionType type, - CPDFSDK_FormFillEnvironment* pFormFillEnv, - CPDF_FormField* pFormField, - PDFSDK_FieldAction& data, - std::set<CPDF_Dictionary*>* visited); - FX_BOOL ExecuteScreenAction(const CPDF_Action& action, - CPDF_AAction::AActionType type, - CPDFSDK_FormFillEnvironment* pFormFillEnv, - CPDFSDK_Annot* pScreen, - std::set<CPDF_Dictionary*>* visited); - FX_BOOL ExecuteBookMark(const CPDF_Action& action, + bool ExecuteDocumentOpenAction(const CPDF_Action& action, + CPDFSDK_FormFillEnvironment* pFormFillEnv, + std::set<CPDF_Dictionary*>* visited); + bool ExecuteDocumentPageAction(const CPDF_Action& action, + CPDF_AAction::AActionType type, + CPDFSDK_FormFillEnvironment* pFormFillEnv, + std::set<CPDF_Dictionary*>* visited); + bool ExecuteFieldAction(const CPDF_Action& action, + CPDF_AAction::AActionType type, CPDFSDK_FormFillEnvironment* pFormFillEnv, - CPDF_Bookmark* pBookmark, + CPDF_FormField* pFormField, + PDFSDK_FieldAction& data, std::set<CPDF_Dictionary*>* visited); - FX_BOOL ExecuteLinkAction(const CPDF_Action& action, - CPDFSDK_FormFillEnvironment* pFormFillEnv, - std::set<CPDF_Dictionary*>* visited); + bool ExecuteScreenAction(const CPDF_Action& action, + CPDF_AAction::AActionType type, + CPDFSDK_FormFillEnvironment* pFormFillEnv, + CPDFSDK_Annot* pScreen, + std::set<CPDF_Dictionary*>* visited); + bool ExecuteBookMark(const CPDF_Action& action, + CPDFSDK_FormFillEnvironment* pFormFillEnv, + CPDF_Bookmark* pBookmark, + std::set<CPDF_Dictionary*>* visited); + bool ExecuteLinkAction(const CPDF_Action& action, + CPDFSDK_FormFillEnvironment* pFormFillEnv, + std::set<CPDF_Dictionary*>* visited); void DoAction_NoJs(const CPDF_Action& action, CPDFSDK_FormFillEnvironment* pFormFillEnv); @@ -96,9 +96,9 @@ class CPDFSDK_ActionHandler { PDFSDK_FieldAction& data, const CFX_WideString& script); - FX_BOOL IsValidField(CPDFSDK_FormFillEnvironment* pFormFillEnv, - CPDF_Dictionary* pFieldDict); - FX_BOOL IsValidDocView(CPDFSDK_FormFillEnvironment* pFormFillEnv); + bool IsValidField(CPDFSDK_FormFillEnvironment* pFormFillEnv, + CPDF_Dictionary* pFieldDict); + bool IsValidDocView(CPDFSDK_FormFillEnvironment* pFormFillEnv); void DoAction_GoTo(CPDFSDK_FormFillEnvironment* pFormFillEnv, const CPDF_Action& action); @@ -113,14 +113,14 @@ class CPDFSDK_ActionHandler { void DoAction_SetOCGState(CPDFSDK_FormFillEnvironment* pFormFillEnv, const CPDF_Action& action); - FX_BOOL DoAction_Hide(const CPDF_Action& action, - CPDFSDK_FormFillEnvironment* pFormFillEnv); - FX_BOOL DoAction_SubmitForm(const CPDF_Action& action, - CPDFSDK_FormFillEnvironment* pFormFillEnv); - FX_BOOL DoAction_ResetForm(const CPDF_Action& action, - CPDFSDK_FormFillEnvironment* pFormFillEnv); - FX_BOOL DoAction_ImportData(const CPDF_Action& action, - CPDFSDK_FormFillEnvironment* pFormFillEnv); + bool DoAction_Hide(const CPDF_Action& action, + CPDFSDK_FormFillEnvironment* pFormFillEnv); + bool DoAction_SubmitForm(const CPDF_Action& action, + CPDFSDK_FormFillEnvironment* pFormFillEnv); + bool DoAction_ResetForm(const CPDF_Action& action, + CPDFSDK_FormFillEnvironment* pFormFillEnv); + bool DoAction_ImportData(const CPDF_Action& action, + CPDFSDK_FormFillEnvironment* pFormFillEnv); }; #endif // FPDFSDK_FSDK_ACTIONHANDLER_H_ diff --git a/fpdfsdk/fsdk_define.h b/fpdfsdk/fsdk_define.h index e5a287fac6..3a75c84500 100644 --- a/fpdfsdk/fsdk_define.h +++ b/fpdfsdk/fsdk_define.h @@ -99,7 +99,7 @@ void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext, int size_y, int rotate, int flags, - FX_BOOL bNeedToRestore, + bool bNeedToRestore, IFSDK_PAUSE_Adapter* pause); void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code); diff --git a/fpdfsdk/fsdk_pauseadapter.cpp b/fpdfsdk/fsdk_pauseadapter.cpp index a1ea46b43e..237266b88b 100644 --- a/fpdfsdk/fsdk_pauseadapter.cpp +++ b/fpdfsdk/fsdk_pauseadapter.cpp @@ -11,6 +11,6 @@ IFSDK_PAUSE_Adapter::IFSDK_PAUSE_Adapter(IFSDK_PAUSE* IPause) IFSDK_PAUSE_Adapter::~IFSDK_PAUSE_Adapter() {} -FX_BOOL IFSDK_PAUSE_Adapter::NeedToPauseNow() { +bool IFSDK_PAUSE_Adapter::NeedToPauseNow() { return m_IPause->NeedToPauseNow && m_IPause->NeedToPauseNow(m_IPause); } diff --git a/fpdfsdk/fsdk_pauseadapter.h b/fpdfsdk/fsdk_pauseadapter.h index a31a77161b..bd302f2613 100644 --- a/fpdfsdk/fsdk_pauseadapter.h +++ b/fpdfsdk/fsdk_pauseadapter.h @@ -16,7 +16,7 @@ class IFSDK_PAUSE_Adapter : public IFX_Pause { explicit IFSDK_PAUSE_Adapter(IFSDK_PAUSE* IPause); ~IFSDK_PAUSE_Adapter() override; - FX_BOOL NeedToPauseNow() override; + bool NeedToPauseNow() override; private: IFSDK_PAUSE* const m_IPause; diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index d4b159cf0a..ececa0b9a3 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -164,42 +164,42 @@ CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit* pEdit, CFX_Edit_Iterator::~CFX_Edit_Iterator() {} -FX_BOOL CFX_Edit_Iterator::NextWord() { +bool CFX_Edit_Iterator::NextWord() { return m_pVTIterator->NextWord(); } -FX_BOOL CFX_Edit_Iterator::PrevWord() { +bool CFX_Edit_Iterator::PrevWord() { return m_pVTIterator->PrevWord(); } -FX_BOOL CFX_Edit_Iterator::GetWord(CPVT_Word& word) const { +bool CFX_Edit_Iterator::GetWord(CPVT_Word& word) const { ASSERT(m_pEdit); if (m_pVTIterator->GetWord(word)) { word.ptWord = m_pEdit->VTToEdit(word.ptWord); - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CFX_Edit_Iterator::GetLine(CPVT_Line& line) const { +bool CFX_Edit_Iterator::GetLine(CPVT_Line& line) const { ASSERT(m_pEdit); if (m_pVTIterator->GetLine(line)) { line.ptLine = m_pEdit->VTToEdit(line.ptLine); - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CFX_Edit_Iterator::GetSection(CPVT_Section& section) const { +bool CFX_Edit_Iterator::GetSection(CPVT_Section& section) const { ASSERT(m_pEdit); if (m_pVTIterator->GetSection(section)) { section.rcSection = m_pEdit->VTToEdit(section.rcSection); - return TRUE; + return true; } - return FALSE; + return false; } void CFX_Edit_Iterator::SetAt(int32_t nWordIndex) { @@ -265,7 +265,7 @@ int32_t CFX_Edit_Provider::GetDefaultFontIndex() { return 0; } -FX_BOOL CFX_Edit_Provider::IsLatinWord(uint16_t word) { +bool CFX_Edit_Provider::IsLatinWord(uint16_t word) { return FX_EDIT_ISLATINWORD(word); } @@ -312,20 +312,20 @@ void CFX_Edit_Refresh::EndRefresh() { CFX_Edit_Undo::CFX_Edit_Undo(int32_t nBufsize) : m_nCurUndoPos(0), m_nBufSize(nBufsize), - m_bModified(FALSE), - m_bVirgin(TRUE), - m_bWorking(FALSE) {} + m_bModified(false), + m_bVirgin(true), + m_bWorking(false) {} CFX_Edit_Undo::~CFX_Edit_Undo() { Reset(); } -FX_BOOL CFX_Edit_Undo::CanUndo() const { +bool CFX_Edit_Undo::CanUndo() const { return m_nCurUndoPos > 0; } void CFX_Edit_Undo::Undo() { - m_bWorking = TRUE; + m_bWorking = true; if (m_nCurUndoPos > 0) { IFX_Edit_UndoItem* pItem = m_UndoItemStack.GetAt(m_nCurUndoPos - 1); @@ -335,15 +335,15 @@ void CFX_Edit_Undo::Undo() { m_bModified = (m_nCurUndoPos != 0); } - m_bWorking = FALSE; + m_bWorking = false; } -FX_BOOL CFX_Edit_Undo::CanRedo() const { +bool CFX_Edit_Undo::CanRedo() const { return m_nCurUndoPos < m_UndoItemStack.GetSize(); } void CFX_Edit_Undo::Redo() { - m_bWorking = TRUE; + m_bWorking = true; int32_t nStackSize = m_UndoItemStack.GetSize(); @@ -355,7 +355,7 @@ void CFX_Edit_Undo::Redo() { m_bModified = (m_nCurUndoPos != 0); } - m_bWorking = FALSE; + m_bWorking = false; } void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) { @@ -368,7 +368,7 @@ void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) { if (m_UndoItemStack.GetSize() >= m_nBufSize) { RemoveHeads(); - m_bVirgin = FALSE; + m_bVirgin = false; } m_UndoItemStack.Add(pItem); @@ -377,8 +377,8 @@ void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) { m_bModified = (m_nCurUndoPos != 0); } -FX_BOOL CFX_Edit_Undo::IsModified() const { - return m_bVirgin ? m_bModified : TRUE; +bool CFX_Edit_Undo::IsModified() const { + return m_bVirgin ? m_bModified : true; } void CFX_Edit_Undo::RemoveHeads() { @@ -403,7 +403,7 @@ void CFX_Edit_Undo::Reset() { m_UndoItemStack.RemoveAll(); } -CFX_Edit_UndoItem::CFX_Edit_UndoItem() : m_bFirst(TRUE), m_bLast(TRUE) {} +CFX_Edit_UndoItem::CFX_Edit_UndoItem() : m_bFirst(true), m_bLast(true) {} CFX_Edit_UndoItem::~CFX_Edit_UndoItem() {} @@ -411,15 +411,15 @@ CFX_WideString CFX_Edit_UndoItem::GetUndoTitle() { return L""; } -void CFX_Edit_UndoItem::SetFirst(FX_BOOL bFirst) { +void CFX_Edit_UndoItem::SetFirst(bool bFirst) { m_bFirst = bFirst; } -void CFX_Edit_UndoItem::SetLast(FX_BOOL bLast) { +void CFX_Edit_UndoItem::SetLast(bool bLast) { m_bLast = bLast; } -FX_BOOL CFX_Edit_UndoItem::IsLast() { +bool CFX_Edit_UndoItem::IsLast() { return m_bLast; } @@ -435,8 +435,8 @@ CFX_Edit_GroupUndoItem::~CFX_Edit_GroupUndoItem() { } void CFX_Edit_GroupUndoItem::AddUndoItem(CFX_Edit_UndoItem* pUndoItem) { - pUndoItem->SetFirst(FALSE); - pUndoItem->SetLast(FALSE); + pUndoItem->SetFirst(false); + pUndoItem->SetLast(false); m_Items.Add(pUndoItem); @@ -447,10 +447,10 @@ void CFX_Edit_GroupUndoItem::AddUndoItem(CFX_Edit_UndoItem* pUndoItem) { void CFX_Edit_GroupUndoItem::UpdateItems() { if (m_Items.GetSize() > 0) { CFX_Edit_UndoItem* pFirstItem = m_Items[0]; - pFirstItem->SetFirst(TRUE); + pFirstItem->SetFirst(true); CFX_Edit_UndoItem* pLastItem = m_Items[m_Items.GetSize() - 1]; - pLastItem->SetLast(TRUE); + pLastItem->SetLast(true); } } @@ -494,7 +494,7 @@ void CFXEU_InsertWord::Redo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wpOld); - m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, FALSE, TRUE); + m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, false, true); } } @@ -502,7 +502,7 @@ void CFXEU_InsertWord::Undo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wpNew); - m_pEdit->Backspace(FALSE, TRUE); + m_pEdit->Backspace(false, true); } } @@ -528,7 +528,7 @@ void CFXEU_InsertReturn::Redo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wpOld); - m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, FALSE, TRUE); + m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, false, true); } } @@ -536,7 +536,7 @@ void CFXEU_InsertReturn::Undo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wpNew); - m_pEdit->Backspace(FALSE, TRUE); + m_pEdit->Backspace(false, true); } } @@ -561,7 +561,7 @@ void CFXEU_Backspace::Redo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wpOld); - m_pEdit->Backspace(FALSE, TRUE); + m_pEdit->Backspace(false, true); } } @@ -570,9 +570,9 @@ void CFXEU_Backspace::Undo() { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wpNew); if (m_wpNew.SecCmp(m_wpOld) != 0) { - m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, FALSE, TRUE); + m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, false, true); } else { - m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, FALSE, TRUE); + m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, false, true); } } } @@ -584,7 +584,7 @@ CFXEU_Delete::CFXEU_Delete(CFX_Edit* pEdit, int32_t charset, const CPVT_SecProps& SecProps, const CPVT_WordProps& WordProps, - FX_BOOL bSecEnd) + bool bSecEnd) : m_pEdit(pEdit), m_wpOld(wpOldPlace), m_wpNew(wpNewPlace), @@ -600,7 +600,7 @@ void CFXEU_Delete::Redo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wpOld); - m_pEdit->Delete(FALSE, TRUE); + m_pEdit->Delete(false, true); } } @@ -609,9 +609,9 @@ void CFXEU_Delete::Undo() { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wpNew); if (m_bSecEnd) { - m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, FALSE, TRUE); + m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, false, true); } else { - m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, FALSE, TRUE); + m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, false, true); } } } @@ -627,7 +627,7 @@ void CFXEU_Clear::Redo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetSel(m_wrSel.BeginPos, m_wrSel.EndPos); - m_pEdit->Clear(FALSE, TRUE); + m_pEdit->Clear(false, true); } } @@ -635,7 +635,7 @@ void CFXEU_Clear::Undo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wrSel.BeginPos); - m_pEdit->InsertText(m_swText, FXFONT_DEFAULT_CHARSET, FALSE, TRUE); + m_pEdit->InsertText(m_swText, FXFONT_DEFAULT_CHARSET, false, true); m_pEdit->SetSel(m_wrSel.BeginPos, m_wrSel.EndPos); } } @@ -657,7 +657,7 @@ void CFXEU_InsertText::Redo() { if (m_pEdit && IsLast()) { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wpOld); - m_pEdit->InsertText(m_swText, m_nCharset, FALSE, TRUE); + m_pEdit->InsertText(m_swText, m_nCharset, false, true); } } @@ -665,7 +665,7 @@ void CFXEU_InsertText::Undo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetSel(m_wpOld, m_wpNew); - m_pEdit->Clear(FALSE, TRUE); + m_pEdit->Clear(false, true); } } @@ -673,7 +673,7 @@ void CFXEU_InsertText::Undo() { CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit, const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange, - FX_BOOL bContinuous, + bool bContinuous, uint16_t SubWord) { CFX_Edit_Iterator* pIterator = pEdit->GetIterator(); if (pRange) @@ -833,7 +833,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, FX_COLORREF crCurFill = crTextFill; FX_COLORREF crOldFill = crCurFill; - FX_BOOL bSelect = FALSE; + bool bSelect = false; const FX_COLORREF crWhite = ArgbEncode(255, 255, 255, 255); const FX_COLORREF crSelBK = ArgbEncode(255, 0, 51, 113); @@ -1005,15 +1005,15 @@ CFX_Edit::CFX_Edit() m_wpCaret(-1, -1, -1), m_wpOldCaret(-1, -1, -1), m_SelState(), - m_bEnableScroll(FALSE), + m_bEnableScroll(false), m_Undo(kEditUndoMaxItems), m_nAlignment(0), - m_bNotifyFlag(FALSE), - m_bEnableOverflow(FALSE), - m_bEnableRefresh(TRUE), + m_bNotifyFlag(false), + m_bEnableOverflow(false), + m_bEnableRefresh(true), m_rcOldContent(0.0f, 0.0f, 0.0f, 0.0f), - m_bEnableUndo(TRUE), - m_bOprNotify(FALSE), + m_bEnableUndo(true), + m_bOprNotify(false), m_pGroupUndoItem(nullptr) {} CFX_Edit::~CFX_Edit() { @@ -1057,19 +1057,19 @@ void CFX_Edit::SetPlateRect(const CFX_FloatRect& rect) { Paint(); } -void CFX_Edit::SetAlignmentH(int32_t nFormat, FX_BOOL bPaint) { +void CFX_Edit::SetAlignmentH(int32_t nFormat, bool bPaint) { m_pVT->SetAlignment(nFormat); if (bPaint) Paint(); } -void CFX_Edit::SetAlignmentV(int32_t nFormat, FX_BOOL bPaint) { +void CFX_Edit::SetAlignmentV(int32_t nFormat, bool bPaint) { m_nAlignment = nFormat; if (bPaint) Paint(); } -void CFX_Edit::SetPasswordChar(uint16_t wSubWord, FX_BOOL bPaint) { +void CFX_Edit::SetPasswordChar(uint16_t wSubWord, bool bPaint) { m_pVT->SetPasswordChar(wSubWord); if (bPaint) Paint(); @@ -1090,19 +1090,19 @@ void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace) { Paint(); } -void CFX_Edit::SetMultiLine(FX_BOOL bMultiLine, FX_BOOL bPaint) { +void CFX_Edit::SetMultiLine(bool bMultiLine, bool bPaint) { m_pVT->SetMultiLine(bMultiLine); if (bPaint) Paint(); } -void CFX_Edit::SetAutoReturn(FX_BOOL bAuto, FX_BOOL bPaint) { +void CFX_Edit::SetAutoReturn(bool bAuto, bool bPaint) { m_pVT->SetAutoReturn(bAuto); if (bPaint) Paint(); } -void CFX_Edit::SetAutoFontSize(FX_BOOL bAuto, FX_BOOL bPaint) { +void CFX_Edit::SetAutoFontSize(bool bAuto, bool bPaint) { m_pVT->SetAutoFontSize(bAuto); if (bPaint) Paint(); @@ -1113,13 +1113,13 @@ void CFX_Edit::SetFontSize(FX_FLOAT fFontSize) { Paint(); } -void CFX_Edit::SetAutoScroll(FX_BOOL bAuto, FX_BOOL bPaint) { +void CFX_Edit::SetAutoScroll(bool bAuto, bool bPaint) { m_bEnableScroll = bAuto; if (bPaint) Paint(); } -void CFX_Edit::SetTextOverflow(FX_BOOL bAllowed, FX_BOOL bPaint) { +void CFX_Edit::SetTextOverflow(bool bAllowed, bool bPaint) { m_bEnableOverflow = bAllowed; if (bPaint) Paint(); @@ -1279,28 +1279,28 @@ void CFX_Edit::SetText(const CFX_WideString& sText) { Paint(); } -FX_BOOL CFX_Edit::InsertWord(uint16_t word, int32_t charset) { - return InsertWord(word, charset, nullptr, TRUE, TRUE); +bool CFX_Edit::InsertWord(uint16_t word, int32_t charset) { + return InsertWord(word, charset, nullptr, true, true); } -FX_BOOL CFX_Edit::InsertReturn() { - return InsertReturn(nullptr, nullptr, TRUE, TRUE); +bool CFX_Edit::InsertReturn() { + return InsertReturn(nullptr, nullptr, true, true); } -FX_BOOL CFX_Edit::Backspace() { - return Backspace(TRUE, TRUE); +bool CFX_Edit::Backspace() { + return Backspace(true, true); } -FX_BOOL CFX_Edit::Delete() { - return Delete(TRUE, TRUE); +bool CFX_Edit::Delete() { + return Delete(true, true); } -FX_BOOL CFX_Edit::Clear() { - return Clear(TRUE, TRUE); +bool CFX_Edit::Clear() { + return Clear(true, true); } -FX_BOOL CFX_Edit::InsertText(const CFX_WideString& sText, int32_t charset) { - return InsertText(sText, charset, TRUE, TRUE); +bool CFX_Edit::InsertText(const CFX_WideString& sText, int32_t charset) { + return InsertText(sText, charset, true, true); } FX_FLOAT CFX_Edit::GetFontSize() const { @@ -1396,9 +1396,9 @@ void CFX_Edit::SetContentChanged() { if (rcContent.Width() != m_rcOldContent.Width() || rcContent.Height() != m_rcOldContent.Height()) { if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; m_pNotify->IOnContentChange(rcContent); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } m_rcOldContent = rcContent; } @@ -1425,7 +1425,7 @@ void CFX_Edit::SelectNone() { } } -FX_BOOL CFX_Edit::IsSelected() const { +bool CFX_Edit::IsSelected() const { return m_SelState.IsExist(); } @@ -1488,11 +1488,11 @@ void CFX_Edit::SetScrollInfo() { CFX_FloatRect rcContent = m_pVT->GetContentRect(); if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, rcContent.bottom, rcContent.top, rcPlate.Height() / 3, rcPlate.Height()); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } } @@ -1520,9 +1520,9 @@ void CFX_Edit::SetScrollPosY(FX_FLOAT fy) { if (m_pNotify) { if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; m_pNotify->IOnSetScrollPosY(fy); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } } @@ -1630,12 +1630,12 @@ void CFX_Edit::Refresh() { if (m_pNotify) { if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; if (const CFX_Edit_RectArray* pRects = m_Refresh.GetRefreshRects()) { for (int32_t i = 0, sz = pRects->GetSize(); i < sz; i++) m_pNotify->IOnInvalidateRect(pRects->GetAt(i)); } - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } @@ -1700,10 +1700,10 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) { if (m_pNotify) { if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; CFX_FloatRect rcRefresh = VTToEdit(rcWord); m_pNotify->IOnInvalidateRect(&rcRefresh); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } } else { @@ -1714,10 +1714,10 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) { if (m_pNotify) { if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; CFX_FloatRect rcRefresh = VTToEdit(rcLine); m_pNotify->IOnInvalidateRect(&rcRefresh); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } @@ -1753,10 +1753,10 @@ void CFX_Edit::SetCaretInfo() { ptFoot.y = line.ptLine.y + line.fLineDescent; } - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; m_pNotify->IOnSetCaret(!m_SelState.IsExist(), VTToEdit(ptHead), VTToEdit(ptFoot), m_wpCaret); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } } @@ -1774,8 +1774,8 @@ void CFX_Edit::SetCaret(int32_t nPos) { } void CFX_Edit::OnMouseDown(const CFX_FloatPoint& point, - FX_BOOL bShift, - FX_BOOL bCtrl) { + bool bShift, + bool bCtrl) { if (m_pVT->IsValid()) { SelectNone(); SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); @@ -1788,8 +1788,8 @@ void CFX_Edit::OnMouseDown(const CFX_FloatPoint& point, } void CFX_Edit::OnMouseMove(const CFX_FloatPoint& point, - FX_BOOL bShift, - FX_BOOL bCtrl) { + bool bShift, + bool bCtrl) { if (m_pVT->IsValid()) { SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); @@ -1804,7 +1804,7 @@ void CFX_Edit::OnMouseMove(const CFX_FloatPoint& point, } } -void CFX_Edit::OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_Edit::OnVK_UP(bool bShift, bool bCtrl) { if (m_pVT->IsValid()) { SetCaret(m_pVT->GetUpWordPlace(m_wpCaret, m_ptCaret)); @@ -1828,7 +1828,7 @@ void CFX_Edit::OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) { } } -void CFX_Edit::OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_Edit::OnVK_DOWN(bool bShift, bool bCtrl) { if (m_pVT->IsValid()) { SetCaret(m_pVT->GetDownWordPlace(m_wpCaret, m_ptCaret)); @@ -1852,7 +1852,7 @@ void CFX_Edit::OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) { } } -void CFX_Edit::OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_Edit::OnVK_LEFT(bool bShift, bool bCtrl) { if (m_pVT->IsValid()) { if (bShift) { if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) && @@ -1896,7 +1896,7 @@ void CFX_Edit::OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) { } } -void CFX_Edit::OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_Edit::OnVK_RIGHT(bool bShift, bool bCtrl) { if (m_pVT->IsValid()) { if (bShift) { SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); @@ -1940,7 +1940,7 @@ void CFX_Edit::OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) { } } -void CFX_Edit::OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_Edit::OnVK_HOME(bool bShift, bool bCtrl) { if (m_pVT->IsValid()) { if (bShift) { if (bCtrl) @@ -1980,7 +1980,7 @@ void CFX_Edit::OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) { } } -void CFX_Edit::OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_Edit::OnVK_END(bool bShift, bool bCtrl) { if (m_pVT->IsValid()) { if (bShift) { if (bCtrl) @@ -2020,13 +2020,13 @@ void CFX_Edit::OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) { } } -FX_BOOL CFX_Edit::InsertWord(uint16_t word, - int32_t charset, - const CPVT_WordProps* pWordProps, - FX_BOOL bAddUndo, - FX_BOOL bPaint) { +bool CFX_Edit::InsertWord(uint16_t word, + int32_t charset, + const CPVT_WordProps* pWordProps, + bool bAddUndo, + bool bPaint) { if (IsTextOverflow()) - return FALSE; + return false; if (m_pVT->IsValid()) { m_pVT->UpdateWordPlace(m_wpCaret); @@ -2047,19 +2047,19 @@ FX_BOOL CFX_Edit::InsertWord(uint16_t word, if (m_bOprNotify && m_pOprNotify) m_pOprNotify->OnInsertWord(m_wpCaret, m_wpOldCaret); - return TRUE; + return true; } } - return FALSE; + return false; } -FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps* pSecProps, - const CPVT_WordProps* pWordProps, - FX_BOOL bAddUndo, - FX_BOOL bPaint) { +bool CFX_Edit::InsertReturn(const CPVT_SecProps* pSecProps, + const CPVT_WordProps* pWordProps, + bool bAddUndo, + bool bPaint) { if (IsTextOverflow()) - return FALSE; + return false; if (m_pVT->IsValid()) { m_pVT->UpdateWordPlace(m_wpCaret); @@ -2083,17 +2083,17 @@ FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps* pSecProps, if (m_bOprNotify && m_pOprNotify) m_pOprNotify->OnInsertReturn(m_wpCaret, m_wpOldCaret); - return TRUE; + return true; } } - return FALSE; + return false; } -FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) { +bool CFX_Edit::Backspace(bool bAddUndo, bool bPaint) { if (m_pVT->IsValid()) { if (m_wpCaret == m_pVT->GetBeginWordPlace()) - return FALSE; + return false; CPVT_Section section; CPVT_Word word; @@ -2132,17 +2132,17 @@ FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) { if (m_bOprNotify && m_pOprNotify) m_pOprNotify->OnBackSpace(m_wpCaret, m_wpOldCaret); - return TRUE; + return true; } } - return FALSE; + return false; } -FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) { +bool CFX_Edit::Delete(bool bAddUndo, bool bPaint) { if (m_pVT->IsValid()) { if (m_wpCaret == m_pVT->GetEndWordPlace()) - return FALSE; + return false; CPVT_Section section; CPVT_Word word; @@ -2155,7 +2155,7 @@ FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) { } m_pVT->UpdateWordPlace(m_wpCaret); - FX_BOOL bSecEnd = (m_wpCaret == m_pVT->GetSectionEndPlace(m_wpCaret)); + bool bSecEnd = (m_wpCaret == m_pVT->GetSectionEndPlace(m_wpCaret)); SetCaret(m_pVT->DeleteWord(m_wpCaret)); m_SelState.Set(m_wpCaret, m_wpCaret); @@ -2182,29 +2182,29 @@ FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) { if (m_bOprNotify && m_pOprNotify) m_pOprNotify->OnDelete(m_wpCaret, m_wpOldCaret); - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CFX_Edit::Empty() { +bool CFX_Edit::Empty() { if (m_pVT->IsValid()) { m_pVT->DeleteWords(GetWholeWordRange()); SetCaret(m_pVT->GetBeginWordPlace()); - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) { +bool CFX_Edit::Clear(bool bAddUndo, bool bPaint) { if (!m_pVT->IsValid()) - return FALSE; + return false; if (!m_SelState.IsExist()) - return FALSE; + return false; CPVT_WordRange range = m_SelState.ConvertToWordRange(); @@ -2226,21 +2226,21 @@ FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) { if (m_bOprNotify && m_pOprNotify) m_pOprNotify->OnClear(m_wpCaret, m_wpOldCaret); - return TRUE; + return true; } -FX_BOOL CFX_Edit::InsertText(const CFX_WideString& sText, - int32_t charset, - FX_BOOL bAddUndo, - FX_BOOL bPaint) { +bool CFX_Edit::InsertText(const CFX_WideString& sText, + int32_t charset, + bool bAddUndo, + bool bPaint) { if (IsTextOverflow()) - return FALSE; + return false; m_pVT->UpdateWordPlace(m_wpCaret); SetCaret(DoInsertText(m_wpCaret, sText, charset)); m_SelState.Set(m_wpCaret, m_wpCaret); if (m_wpCaret == m_wpOldCaret) - return FALSE; + return false; if (bAddUndo && m_bEnableUndo) { AddEditUndoItem( @@ -2253,7 +2253,7 @@ FX_BOOL CFX_Edit::InsertText(const CFX_WideString& sText, if (m_bOprNotify && m_pOprNotify) m_pOprNotify->OnInsertText(m_wpCaret, m_wpOldCaret); - return TRUE; + return true; } void CFX_Edit::PaintInsertText(const CPVT_WordPlace& wpOld, @@ -2267,26 +2267,26 @@ void CFX_Edit::PaintInsertText(const CPVT_WordPlace& wpOld, } } -FX_BOOL CFX_Edit::Redo() { +bool CFX_Edit::Redo() { if (m_bEnableUndo) { if (m_Undo.CanRedo()) { m_Undo.Redo(); - return TRUE; + return true; } } - return FALSE; + return false; } -FX_BOOL CFX_Edit::Undo() { +bool CFX_Edit::Undo() { if (m_bEnableUndo) { if (m_Undo.CanUndo()) { m_Undo.Undo(); - return TRUE; + return true; } } - return FALSE; + return false; } void CFX_Edit::SetCaretOrigin() { @@ -2320,7 +2320,7 @@ CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(int32_t index) const { return CPVT_WordPlace(); } -FX_BOOL CFX_Edit::IsTextFull() const { +bool CFX_Edit::IsTextFull() const { int32_t nTotalWords = m_pVT->GetTotalWords(); int32_t nLimitChar = m_pVT->GetLimitChar(); int32_t nCharArray = m_pVT->GetCharArray(); @@ -2329,48 +2329,48 @@ FX_BOOL CFX_Edit::IsTextFull() const { (nCharArray > 0 && nTotalWords >= nCharArray); } -FX_BOOL CFX_Edit::IsTextOverflow() const { +bool CFX_Edit::IsTextOverflow() const { if (!m_bEnableScroll && !m_bEnableOverflow) { CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); CFX_FloatRect rcContent = m_pVT->GetContentRect(); if (m_pVT->IsMultiLine() && GetTotalLines() > 1 && IsFloatBigger(rcContent.Height(), rcPlate.Height())) { - return TRUE; + return true; } if (IsFloatBigger(rcContent.Width(), rcPlate.Width())) - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CFX_Edit::CanUndo() const { +bool CFX_Edit::CanUndo() const { if (m_bEnableUndo) { return m_Undo.CanUndo(); } - return FALSE; + return false; } -FX_BOOL CFX_Edit::CanRedo() const { +bool CFX_Edit::CanRedo() const { if (m_bEnableUndo) { return m_Undo.CanRedo(); } - return FALSE; + return false; } -void CFX_Edit::EnableRefresh(FX_BOOL bRefresh) { +void CFX_Edit::EnableRefresh(bool bRefresh) { m_bEnableRefresh = bRefresh; } -void CFX_Edit::EnableUndo(FX_BOOL bUndo) { +void CFX_Edit::EnableUndo(bool bUndo) { m_bEnableUndo = bUndo; } -void CFX_Edit::EnableOprNotify(FX_BOOL bNotify) { +void CFX_Edit::EnableOprNotify(bool bNotify) { m_bOprNotify = bNotify; } @@ -2495,7 +2495,7 @@ void CFX_Edit_Select::SetEndPos(const CPVT_WordPlace& end) { EndPos = end; } -FX_BOOL CFX_Edit_Select::IsExist() const { +bool CFX_Edit_Select::IsExist() const { return BeginPos != EndPos; } diff --git a/fpdfsdk/fxedit/fxet_edit.h b/fpdfsdk/fxedit/fxet_edit.h index 394a2fd3f3..1c3e955024 100644 --- a/fpdfsdk/fxedit/fxet_edit.h +++ b/fpdfsdk/fxedit/fxet_edit.h @@ -96,7 +96,7 @@ class CFX_Edit_Select { void SetEndPos(const CPVT_WordPlace& end); CPVT_WordRange ConvertToWordRange() const; - FX_BOOL IsExist() const; + bool IsExist() const; CPVT_WordPlace BeginPos, EndPos; }; @@ -111,9 +111,9 @@ class CFX_Edit_Undo { void AddItem(IFX_Edit_UndoItem* pItem); - FX_BOOL CanUndo() const; - FX_BOOL CanRedo() const; - FX_BOOL IsModified() const; + bool CanUndo() const; + bool CanRedo() const; + bool IsModified() const; void Reset(); @@ -126,9 +126,9 @@ class CFX_Edit_Undo { int32_t m_nCurUndoPos; int32_t m_nBufSize; - FX_BOOL m_bModified; - FX_BOOL m_bVirgin; - FX_BOOL m_bWorking; + bool m_bModified; + bool m_bVirgin; + bool m_bWorking; }; class IFX_Edit_UndoItem { @@ -147,13 +147,13 @@ class CFX_Edit_UndoItem : public IFX_Edit_UndoItem { CFX_WideString GetUndoTitle() override; - void SetFirst(FX_BOOL bFirst); - void SetLast(FX_BOOL bLast); - FX_BOOL IsLast(); + void SetFirst(bool bFirst); + void SetLast(bool bLast); + bool IsLast(); private: - FX_BOOL m_bFirst; - FX_BOOL m_bLast; + bool m_bFirst; + bool m_bLast; }; class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem { @@ -255,7 +255,7 @@ class CFXEU_Delete : public CFX_Edit_UndoItem { int32_t charset, const CPVT_SecProps& SecProps, const CPVT_WordProps& WordProps, - FX_BOOL bSecEnd); + bool bSecEnd); ~CFXEU_Delete() override; // CFX_Edit_UndoItem @@ -271,7 +271,7 @@ class CFXEU_Delete : public CFX_Edit_UndoItem { int32_t m_nCharset; CPVT_SecProps m_SecProps; CPVT_WordProps m_WordProps; - FX_BOOL m_bSecEnd; + bool m_bSecEnd; }; class CFXEU_Clear : public CFX_Edit_UndoItem { @@ -319,7 +319,7 @@ class CFX_Edit { static CFX_ByteString GetEditAppearanceStream(CFX_Edit* pEdit, const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange, - FX_BOOL bContinuous, + bool bContinuous, uint16_t SubWord); static CFX_ByteString GetSelectAppearanceStream( CFX_Edit* pEdit, @@ -360,40 +360,40 @@ class CFX_Edit { void SetScrollPos(const CFX_FloatPoint& point); // Set the horizontal text alignment. (nFormat [0:left, 1:middle, 2:right]) - void SetAlignmentH(int32_t nFormat, FX_BOOL bPaint); + void SetAlignmentH(int32_t nFormat, bool bPaint); // Set the vertical text alignment. (nFormat [0:left, 1:middle, 2:right]) - void SetAlignmentV(int32_t nFormat, FX_BOOL bPaint); + void SetAlignmentV(int32_t nFormat, bool bPaint); // Set the substitution character for hidden text. - void SetPasswordChar(uint16_t wSubWord, FX_BOOL bPaint); + void SetPasswordChar(uint16_t wSubWord, bool bPaint); // Set the maximum number of words in the text. void SetLimitChar(int32_t nLimitChar); void SetCharArray(int32_t nCharArray); void SetCharSpace(FX_FLOAT fCharSpace); - void SetMultiLine(FX_BOOL bMultiLine, FX_BOOL bPaint); - void SetAutoReturn(FX_BOOL bAuto, FX_BOOL bPaint); - void SetAutoFontSize(FX_BOOL bAuto, FX_BOOL bPaint); - void SetAutoScroll(FX_BOOL bAuto, FX_BOOL bPaint); + void SetMultiLine(bool bMultiLine, bool bPaint); + void SetAutoReturn(bool bAuto, bool bPaint); + void SetAutoFontSize(bool bAuto, bool bPaint); + void SetAutoScroll(bool bAuto, bool bPaint); void SetFontSize(FX_FLOAT fFontSize); - void SetTextOverflow(FX_BOOL bAllowed, FX_BOOL bPaint); - void OnMouseDown(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); - void OnMouseMove(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl); + void SetTextOverflow(bool bAllowed, bool bPaint); + void OnMouseDown(const CFX_FloatPoint& point, bool bShift, bool bCtrl); + void OnMouseMove(const CFX_FloatPoint& point, bool bShift, bool bCtrl); + void OnVK_UP(bool bShift, bool bCtrl); + void OnVK_DOWN(bool bShift, bool bCtrl); + void OnVK_LEFT(bool bShift, bool bCtrl); + void OnVK_RIGHT(bool bShift, bool bCtrl); + void OnVK_HOME(bool bShift, bool bCtrl); + void OnVK_END(bool bShift, bool bCtrl); void SetText(const CFX_WideString& sText); - FX_BOOL InsertWord(uint16_t word, int32_t charset); - FX_BOOL InsertReturn(); - FX_BOOL Backspace(); - FX_BOOL Delete(); - FX_BOOL Clear(); - FX_BOOL InsertText(const CFX_WideString& sText, int32_t charset); - FX_BOOL Redo(); - FX_BOOL Undo(); + bool InsertWord(uint16_t word, int32_t charset); + bool InsertReturn(); + bool Backspace(); + bool Delete(); + bool Clear(); + bool InsertText(const CFX_WideString& sText, int32_t charset); + bool Redo(); + bool Undo(); int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const; CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; @@ -414,22 +414,22 @@ class CFX_Edit { void GetSel(int32_t& nStartChar, int32_t& nEndChar) const; void SelectAll(); void SelectNone(); - FX_BOOL IsSelected() const; + bool IsSelected() const; void Paint(); - void EnableRefresh(FX_BOOL bRefresh); + void EnableRefresh(bool bRefresh); void RefreshWordRange(const CPVT_WordRange& wr); void SetCaret(int32_t nPos); CPVT_WordRange GetWholeWordRange() const; CPVT_WordRange GetSelectWordRange() const; - void EnableUndo(FX_BOOL bUndo); - void EnableOprNotify(FX_BOOL bNotify); - FX_BOOL IsTextFull() const; - FX_BOOL IsTextOverflow() const; - FX_BOOL CanUndo() const; - FX_BOOL CanRedo() const; + void EnableUndo(bool bUndo); + void EnableOprNotify(bool bNotify); + bool IsTextFull() const; + bool IsTextOverflow() const; + bool CanUndo() const; + bool CanRedo() const; CPVT_WordRange GetVisibleWordRange() const; - FX_BOOL Empty(); + bool Empty(); CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, const CFX_WideString& sText, @@ -458,22 +458,22 @@ class CFX_Edit { void SetScrollLimit(); void SetContentChanged(); - FX_BOOL InsertWord(uint16_t word, - int32_t charset, - const CPVT_WordProps* pWordProps, - FX_BOOL bAddUndo, - FX_BOOL bPaint); - FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps, - const CPVT_WordProps* pWordProps, - FX_BOOL bAddUndo, - FX_BOOL bPaint); - FX_BOOL Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint); - FX_BOOL Delete(FX_BOOL bAddUndo, FX_BOOL bPaint); - FX_BOOL Clear(FX_BOOL bAddUndo, FX_BOOL bPaint); - FX_BOOL InsertText(const CFX_WideString& sText, - int32_t charset, - FX_BOOL bAddUndo, - FX_BOOL bPaint); + bool InsertWord(uint16_t word, + int32_t charset, + const CPVT_WordProps* pWordProps, + bool bAddUndo, + bool bPaint); + bool InsertReturn(const CPVT_SecProps* pSecProps, + const CPVT_WordProps* pWordProps, + bool bAddUndo, + bool bPaint); + bool Backspace(bool bAddUndo, bool bPaint); + bool Delete(bool bAddUndo, bool bPaint); + bool Clear(bool bAddUndo, bool bPaint); + bool InsertText(const CFX_WideString& sText, + int32_t charset, + bool bAddUndo, + bool bPaint); void PaintInsertText(const CPVT_WordPlace& wpOld, const CPVT_WordPlace& wpNew); @@ -502,18 +502,18 @@ class CFX_Edit { CFX_FloatPoint m_ptScrollPos; CFX_FloatPoint m_ptRefreshScrollPos; - FX_BOOL m_bEnableScroll; + bool m_bEnableScroll; std::unique_ptr<CFX_Edit_Iterator> m_pIterator; CFX_Edit_Refresh m_Refresh; CFX_FloatPoint m_ptCaret; CFX_Edit_Undo m_Undo; int32_t m_nAlignment; - FX_BOOL m_bNotifyFlag; - FX_BOOL m_bEnableOverflow; - FX_BOOL m_bEnableRefresh; + bool m_bNotifyFlag; + bool m_bEnableOverflow; + bool m_bEnableRefresh; CFX_FloatRect m_rcOldContent; - FX_BOOL m_bEnableUndo; - FX_BOOL m_bOprNotify; + bool m_bEnableUndo; + bool m_bOprNotify; CFX_Edit_GroupUndoItem* m_pGroupUndoItem; }; @@ -522,11 +522,11 @@ class CFX_Edit_Iterator { CFX_Edit_Iterator(CFX_Edit* pEdit, CPDF_VariableText::Iterator* pVTIterator); ~CFX_Edit_Iterator(); - FX_BOOL NextWord(); - FX_BOOL PrevWord(); - FX_BOOL GetWord(CPVT_Word& word) const; - FX_BOOL GetLine(CPVT_Line& line) const; - FX_BOOL GetSection(CPVT_Section& section) const; + bool NextWord(); + bool PrevWord(); + bool GetWord(CPVT_Word& word) const; + bool GetLine(CPVT_Line& line) const; + bool GetSection(CPVT_Section& section) const; void SetAt(int32_t nWordIndex); void SetAt(const CPVT_WordPlace& place); const CPVT_WordPlace& GetAt() const; @@ -551,7 +551,7 @@ class CFX_Edit_Provider : public CPDF_VariableText::Provider { int32_t charset, int32_t nFontIndex) override; int32_t GetDefaultFontIndex() override; - FX_BOOL IsLatinWord(uint16_t word) override; + bool IsLatinWord(uint16_t word) override; private: IPVT_FontMap* m_pFontMap; diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/fxedit/fxet_list.cpp index fa4a154e8c..cf718b9acb 100644 --- a/fpdfsdk/fxedit/fxet_list.cpp +++ b/fpdfsdk/fxedit/fxet_list.cpp @@ -12,9 +12,9 @@ CFX_ListItem::CFX_ListItem() : m_pEdit(new CFX_Edit), - m_bSelected(FALSE), + m_bSelected(false), m_rcListItem(0.0f, 0.0f, 0.0f, 0.0f) { - m_pEdit->SetAlignmentV(1, TRUE); + m_pEdit->SetAlignmentV(1, true); m_pEdit->Initialize(); } @@ -41,11 +41,11 @@ CLST_Rect CFX_ListItem::GetRect() const { return m_rcListItem; } -FX_BOOL CFX_ListItem::IsSelected() const { +bool CFX_ListItem::IsSelected() const { return m_bSelected; } -void CFX_ListItem::SetSelect(FX_BOOL bSelected) { +void CFX_ListItem::SetSelect(bool bSelected) { m_bSelected = bSelected; } @@ -143,7 +143,7 @@ int32_t CPLST_Select::Find(int32_t nItemIndex) const { return -1; } -FX_BOOL CPLST_Select::IsExist(int32_t nItemIndex) const { +bool CPLST_Select::IsExist(int32_t nItemIndex) const { return Find(nItemIndex) >= 0; } @@ -190,14 +190,14 @@ void CPLST_Select::Done() { CFX_ListCtrl::CFX_ListCtrl() : m_pNotify(nullptr), - m_bNotifyFlag(FALSE), + m_bNotifyFlag(false), m_nSelItem(-1), m_nFootIndex(-1), - m_bCtrlSel(FALSE), + m_bCtrlSel(false), m_nCaretIndex(-1), m_fFontSize(0.0f), m_pFontMap(nullptr), - m_bMultiple(FALSE) {} + m_bMultiple(false) {} CFX_ListCtrl::~CFX_ListCtrl() { Empty(); @@ -238,8 +238,8 @@ CFX_FloatRect CFX_ListCtrl::OutToIn(const CFX_FloatRect& rect) const { } void CFX_ListCtrl::OnMouseDown(const CFX_FloatPoint& point, - FX_BOOL bShift, - FX_BOOL bCtrl) { + bool bShift, + bool bCtrl) { int32_t nHitIndex = GetItemIndex(point); if (IsMultipleSel()) { @@ -247,11 +247,11 @@ void CFX_ListCtrl::OnMouseDown(const CFX_FloatPoint& point, if (IsItemSelected(nHitIndex)) { m_aSelItems.Sub(nHitIndex); SelectItems(); - m_bCtrlSel = FALSE; + m_bCtrlSel = false; } else { m_aSelItems.Add(nHitIndex); SelectItems(); - m_bCtrlSel = TRUE; + m_bCtrlSel = true; } m_nFootIndex = nHitIndex; @@ -277,8 +277,8 @@ void CFX_ListCtrl::OnMouseDown(const CFX_FloatPoint& point, } void CFX_ListCtrl::OnMouseMove(const CFX_FloatPoint& point, - FX_BOOL bShift, - FX_BOOL bCtrl) { + bool bShift, + bool bCtrl) { int32_t nHitIndex = GetItemIndex(point); if (IsMultipleSel()) { @@ -304,7 +304,7 @@ void CFX_ListCtrl::OnMouseMove(const CFX_FloatPoint& point, ScrollToListItem(nHitIndex); } -void CFX_ListCtrl::OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_ListCtrl::OnVK(int32_t nItemIndex, bool bShift, bool bCtrl) { if (IsMultipleSel()) { if (nItemIndex >= 0 && nItemIndex < GetCount()) { if (bCtrl) { @@ -329,39 +329,39 @@ void CFX_ListCtrl::OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl) { ScrollToListItem(nItemIndex); } -void CFX_ListCtrl::OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_ListCtrl::OnVK_UP(bool bShift, bool bCtrl) { OnVK(IsMultipleSel() ? GetCaret() - 1 : GetSelect() - 1, bShift, bCtrl); } -void CFX_ListCtrl::OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_ListCtrl::OnVK_DOWN(bool bShift, bool bCtrl) { OnVK(IsMultipleSel() ? GetCaret() + 1 : GetSelect() + 1, bShift, bCtrl); } -void CFX_ListCtrl::OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_ListCtrl::OnVK_LEFT(bool bShift, bool bCtrl) { OnVK(0, bShift, bCtrl); } -void CFX_ListCtrl::OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_ListCtrl::OnVK_RIGHT(bool bShift, bool bCtrl) { OnVK(GetCount() - 1, bShift, bCtrl); } -void CFX_ListCtrl::OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_ListCtrl::OnVK_HOME(bool bShift, bool bCtrl) { OnVK(0, bShift, bCtrl); } -void CFX_ListCtrl::OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_ListCtrl::OnVK_END(bool bShift, bool bCtrl) { OnVK(GetCount() - 1, bShift, bCtrl); } -FX_BOOL CFX_ListCtrl::OnChar(uint16_t nChar, FX_BOOL bShift, FX_BOOL bCtrl) { +bool CFX_ListCtrl::OnChar(uint16_t nChar, bool bShift, bool bCtrl) { int32_t nIndex = GetLastSelected(); int32_t nFindIndex = FindNext(nIndex, nChar); if (nFindIndex != nIndex) { OnVK(nFindIndex, bShift, bCtrl); - return TRUE; + return true; } - return FALSE; + return false; } void CFX_ListCtrl::SetPlateRect(const CFX_FloatRect& rect) { @@ -400,16 +400,16 @@ void CFX_ListCtrl::AddString(const CFX_WideString& str) { ReArrange(GetCount() - 1); } -void CFX_ListCtrl::SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected) { +void CFX_ListCtrl::SetMultipleSelect(int32_t nItemIndex, bool bSelected) { if (!IsValid(nItemIndex)) return; if (bSelected != IsItemSelected(nItemIndex)) { if (bSelected) { - SetItemSelect(nItemIndex, TRUE); + SetItemSelect(nItemIndex, true); InvalidateItem(nItemIndex); } else { - SetItemSelect(nItemIndex, FALSE); + SetItemSelect(nItemIndex, false); InvalidateItem(nItemIndex); } } @@ -421,11 +421,11 @@ void CFX_ListCtrl::SetSingleSelect(int32_t nItemIndex) { if (m_nSelItem != nItemIndex) { if (m_nSelItem >= 0) { - SetItemSelect(m_nSelItem, FALSE); + SetItemSelect(m_nSelItem, false); InvalidateItem(m_nSelItem); } - SetItemSelect(nItemIndex, TRUE); + SetItemSelect(nItemIndex, true); InvalidateItem(nItemIndex); m_nSelItem = nItemIndex; } @@ -450,14 +450,14 @@ void CFX_ListCtrl::InvalidateItem(int32_t nItemIndex) { if (m_pNotify) { if (nItemIndex == -1) { if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; CFX_FloatRect rcRefresh = GetPlateRect(); m_pNotify->IOnInvalidateRect(&rcRefresh); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } else { if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; CFX_FloatRect rcRefresh = GetItemRect(nItemIndex); rcRefresh.left -= 1.0f; rcRefresh.right += 1.0f; @@ -465,7 +465,7 @@ void CFX_ListCtrl::InvalidateItem(int32_t nItemIndex) { rcRefresh.top += 1.0f; m_pNotify->IOnInvalidateRect(&rcRefresh); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } } @@ -478,10 +478,10 @@ void CFX_ListCtrl::SelectItems() { switch (nState) { case 1: - SetMultipleSelect(nItemIndex, TRUE); + SetMultipleSelect(nItemIndex, true); break; case -1: - SetMultipleSelect(nItemIndex, FALSE); + SetMultipleSelect(nItemIndex, false); break; } } @@ -501,7 +501,7 @@ void CFX_ListCtrl::Select(int32_t nItemIndex) { } } -FX_BOOL CFX_ListCtrl::IsItemVisible(int32_t nItemIndex) const { +bool CFX_ListCtrl::IsItemVisible(int32_t nItemIndex) const { CFX_FloatRect rcPlate = GetPlateRect(); CFX_FloatRect rcItem = GetItemRect(nItemIndex); @@ -533,11 +533,11 @@ void CFX_ListCtrl::SetScrollInfo() { CFX_FloatRect rcContent = GetContentRectInternal(); if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, rcContent.bottom, rcContent.top, GetFirstHeight(), rcPlate.Height()); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } } @@ -566,9 +566,9 @@ void CFX_ListCtrl::SetScrollPosY(FX_FLOAT fy) { if (m_pNotify) { if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; m_pNotify->IOnSetScrollPosY(fy); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } } @@ -633,19 +633,19 @@ void CFX_ListCtrl::Cancel() { int32_t CFX_ListCtrl::GetItemIndex(const CFX_FloatPoint& point) const { CFX_FloatPoint pt = OuterToInner(OutToIn(point)); - FX_BOOL bFirst = TRUE; - FX_BOOL bLast = TRUE; + bool bFirst = true; + bool bLast = true; for (int32_t i = 0, sz = m_aListItems.GetSize(); i < sz; i++) { if (CFX_ListItem* pListItem = m_aListItems.GetAt(i)) { CLST_Rect rcListItem = pListItem->GetRect(); if (IsFloatBigger(pt.y, rcListItem.top)) { - bFirst = FALSE; + bFirst = false; } if (IsFloatSmaller(pt.y, rcListItem.bottom)) { - bLast = FALSE; + bLast = false; } if (pt.y >= rcListItem.top && pt.y < rcListItem.bottom) { @@ -755,27 +755,27 @@ int32_t CFX_ListCtrl::FindNext(int32_t nIndex, FX_WCHAR nChar) const { return nCircleIndex; } -FX_BOOL CFX_ListCtrl::IsItemSelected(int32_t nIndex) const { +bool CFX_ListCtrl::IsItemSelected(int32_t nIndex) const { if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex)) return pListItem->IsSelected(); - return FALSE; + return false; } -void CFX_ListCtrl::SetItemSelect(int32_t nItemIndex, FX_BOOL bSelected) { +void CFX_ListCtrl::SetItemSelect(int32_t nItemIndex, bool bSelected) { if (CFX_ListItem* pListItem = m_aListItems.GetAt(nItemIndex)) { pListItem->SetSelect(bSelected); } } -void CFX_ListCtrl::SetMultipleSel(FX_BOOL bMultiple) { +void CFX_ListCtrl::SetMultipleSel(bool bMultiple) { m_bMultiple = bMultiple; } -FX_BOOL CFX_ListCtrl::IsMultipleSel() const { +bool CFX_ListCtrl::IsMultipleSel() const { return m_bMultiple; } -FX_BOOL CFX_ListCtrl::IsValid(int32_t nItemIndex) const { +bool CFX_ListCtrl::IsValid(int32_t nItemIndex) const { return nItemIndex >= 0 && nItemIndex < m_aListItems.GetSize(); } diff --git a/fpdfsdk/fxedit/fxet_list.h b/fpdfsdk/fxedit/fxet_list.h index ce7acc4220..f0257056c6 100644 --- a/fpdfsdk/fxedit/fxet_list.h +++ b/fpdfsdk/fxedit/fxet_list.h @@ -104,13 +104,13 @@ class CFX_ListItem final { CFX_Edit* GetEdit() const; void SetRect(const CLST_Rect& rect); - void SetSelect(FX_BOOL bSelected); + void SetSelect(bool bSelected); void SetText(const CFX_WideString& text); void SetFontSize(FX_FLOAT fFontSize); CFX_WideString GetText() const; CLST_Rect GetRect() const; - FX_BOOL IsSelected() const; + bool IsSelected() const; FX_FLOAT GetItemHeight() const; uint16_t GetFirstChar() const; @@ -118,7 +118,7 @@ class CFX_ListItem final { CFX_Edit_Iterator* GetIterator() const; std::unique_ptr<CFX_Edit> m_pEdit; - FX_BOOL m_bSelected; + bool m_bSelected; CLST_Rect m_rcListItem; }; @@ -171,7 +171,7 @@ class CFX_ListContainer { template <class TYPE> class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE> { public: - FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; } + bool IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; } TYPE GetAt(int32_t nIndex) const { if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); @@ -203,7 +203,7 @@ class CPLST_Select { void Add(int32_t nBeginIndex, int32_t nEndIndex); void Sub(int32_t nItemIndex); void Sub(int32_t nBeginIndex, int32_t nEndIndex); - FX_BOOL IsExist(int32_t nItemIndex) const; + bool IsExist(int32_t nItemIndex) const; int32_t Find(int32_t nItemIndex) const; int32_t GetCount() const; int32_t GetItemIndex(int32_t nIndex) const; @@ -224,16 +224,16 @@ class CFX_ListCtrl : protected CFX_ListContainer { void SetPlateRect(const CFX_FloatRect& rect) override; void SetNotify(CPWL_List_Notify* pNotify); - void OnMouseDown(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); - void OnMouseMove(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl); - FX_BOOL OnChar(uint16_t nChar, FX_BOOL bShift, FX_BOOL bCtrl); + void OnMouseDown(const CFX_FloatPoint& point, bool bShift, bool bCtrl); + void OnMouseMove(const CFX_FloatPoint& point, bool bShift, bool bCtrl); + void OnVK_UP(bool bShift, bool bCtrl); + void OnVK_DOWN(bool bShift, bool bCtrl); + void OnVK_LEFT(bool bShift, bool bCtrl); + void OnVK_RIGHT(bool bShift, bool bCtrl); + void OnVK_HOME(bool bShift, bool bCtrl); + void OnVK_END(bool bShift, bool bCtrl); + void OnVK(int32_t nItemIndex, bool bShift, bool bCtrl); + bool OnChar(uint16_t nChar, bool bShift, bool bCtrl); void SetScrollPos(const CFX_FloatPoint& point); void ScrollToListItem(int32_t nItemIndex); @@ -257,11 +257,11 @@ class CFX_ListCtrl : protected CFX_ListContainer { FX_FLOAT GetFontSize() const; CFX_Edit* GetItemEdit(int32_t nIndex) const; int32_t GetCount() const; - FX_BOOL IsItemSelected(int32_t nIndex) const; + bool IsItemSelected(int32_t nIndex) const; FX_FLOAT GetFirstHeight() const; - void SetMultipleSel(FX_BOOL bMultiple); - FX_BOOL IsMultipleSel() const; - FX_BOOL IsValid(int32_t nItemIndex) const; + void SetMultipleSel(bool bMultiple); + bool IsMultipleSel() const; + bool IsValid(int32_t nItemIndex) const; int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const; int32_t GetFirstSelected() const; @@ -274,31 +274,31 @@ class CFX_ListCtrl : protected CFX_ListContainer { void ReArrange(int32_t nItemIndex); CFX_FloatRect GetItemRectInternal(int32_t nIndex) const; CFX_FloatRect GetContentRectInternal() const; - void SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected); + void SetMultipleSelect(int32_t nItemIndex, bool bSelected); void SetSingleSelect(int32_t nItemIndex); void InvalidateItem(int32_t nItemIndex); void SelectItems(); - FX_BOOL IsItemVisible(int32_t nItemIndex) const; + bool IsItemVisible(int32_t nItemIndex) const; void SetScrollInfo(); void SetScrollPosY(FX_FLOAT fy); void AddItem(const CFX_WideString& str); CFX_WideString GetItemText(int32_t nIndex) const; - void SetItemSelect(int32_t nItemIndex, FX_BOOL bSelected); + void SetItemSelect(int32_t nItemIndex, bool bSelected); int32_t GetLastSelected() const; FX_WCHAR Toupper(FX_WCHAR c) const; CPWL_List_Notify* m_pNotify; - FX_BOOL m_bNotifyFlag; + bool m_bNotifyFlag; CFX_FloatPoint m_ptScrollPos; CPLST_Select m_aSelItems; // for multiple int32_t m_nSelItem; // for single int32_t m_nFootIndex; // for multiple - FX_BOOL m_bCtrlSel; // for multiple + bool m_bCtrlSel; // for multiple int32_t m_nCaretIndex; // for multiple CLST_ArrayTemplate<CFX_ListItem*> m_aListItems; FX_FLOAT m_fFontSize; IPVT_FontMap* m_pFontMap; - FX_BOOL m_bMultiple; + bool m_bMultiple; }; #endif // FPDFSDK_FXEDIT_FXET_LIST_H_ diff --git a/fpdfsdk/ipdfsdk_annothandler.h b/fpdfsdk/ipdfsdk_annothandler.h index e91b329eb7..408dcceae2 100644 --- a/fpdfsdk/ipdfsdk_annothandler.h +++ b/fpdfsdk/ipdfsdk_annothandler.h @@ -24,7 +24,7 @@ class IPDFSDK_AnnotHandler { public: virtual ~IPDFSDK_AnnotHandler() {} - virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) = 0; + virtual bool CanAnswer(CPDFSDK_Annot* pAnnot) = 0; virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) = 0; @@ -36,9 +36,9 @@ class IPDFSDK_AnnotHandler { virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0; virtual CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) = 0; - virtual FX_BOOL HitTest(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - const CFX_FloatPoint& point) = 0; + virtual bool HitTest(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + const CFX_FloatPoint& point) = 0; virtual void OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, @@ -52,51 +52,51 @@ class IPDFSDK_AnnotHandler { virtual void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) = 0; - virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) = 0; - virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) = 0; - virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) = 0; - virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) = 0; - virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, + virtual bool OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) = 0; + virtual bool OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) = 0; + virtual bool OnLButtonDblClk(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) = 0; + virtual bool OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) = 0; + virtual bool OnMouseWheel(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + short zDelta, + const CFX_FloatPoint& point) = 0; + virtual bool OnRButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) = 0; + virtual bool OnRButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlags, + const CFX_FloatPoint& point) = 0; + virtual bool OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlags, - short zDelta, const CFX_FloatPoint& point) = 0; - virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) = 0; - virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) = 0; - virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlags, - const CFX_FloatPoint& point) = 0; - virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, - uint32_t nChar, - uint32_t nFlags) = 0; - virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0; - virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0; - virtual FX_BOOL OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlag) = 0; - virtual FX_BOOL OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, - uint32_t nFlag) = 0; + virtual bool OnChar(CPDFSDK_Annot* pAnnot, + uint32_t nChar, + uint32_t nFlags) = 0; + virtual bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0; + virtual bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0; + virtual bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlag) = 0; + virtual bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, + uint32_t nFlag) = 0; #ifdef PDF_ENABLE_XFA - virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot, - CPDFSDK_Annot::ObservedPtr* pNewAnnot) = 0; + virtual bool OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot, + CPDFSDK_Annot::ObservedPtr* pNewAnnot) = 0; #endif // PDF_ENABLE_XFA }; diff --git a/fpdfsdk/javascript/Annot.cpp b/fpdfsdk/javascript/Annot.cpp index 8e6a775dcd..0c16b3b05a 100644 --- a/fpdfsdk/javascript/Annot.cpp +++ b/fpdfsdk/javascript/Annot.cpp @@ -37,17 +37,15 @@ Annot::Annot(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {} Annot::~Annot() {} -FX_BOOL Annot::hidden(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Annot::hidden(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CPDFSDK_BAAnnot* baAnnot = ToBAAnnot(m_pAnnot.Get()); if (!baAnnot) - return FALSE; + return false; if (vp.IsGetting()) { CPDF_Annot* pPDFAnnot = baAnnot->GetPDFAnnot(); vp << CPDF_Annot::IsAnnotationHidden(pPDFAnnot->GetAnnotDict()); - return TRUE; + return true; } bool bHidden; @@ -66,41 +64,37 @@ FX_BOOL Annot::hidden(IJS_Context* cc, flags |= ANNOTFLAG_PRINT; } baAnnot->SetFlags(flags); - return TRUE; + return true; } -FX_BOOL Annot::name(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Annot::name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CPDFSDK_BAAnnot* baAnnot = ToBAAnnot(m_pAnnot.Get()); if (!baAnnot) - return FALSE; + return false; if (vp.IsGetting()) { vp << baAnnot->GetAnnotName(); - return TRUE; + return true; } CFX_WideString annotName; vp >> annotName; baAnnot->SetAnnotName(annotName); - return TRUE; + return true; } -FX_BOOL Annot::type(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Annot::type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); - return FALSE; + return false; } CPDFSDK_BAAnnot* baAnnot = ToBAAnnot(m_pAnnot.Get()); if (!baAnnot) - return FALSE; + return false; vp << CPDF_Annot::AnnotSubtypeToString(baAnnot->GetAnnotSubtype()); - return TRUE; + return true; } void Annot::SetSDKAnnot(CPDFSDK_BAAnnot* annot) { diff --git a/fpdfsdk/javascript/Annot.h b/fpdfsdk/javascript/Annot.h index 291262d18f..39073e6719 100644 --- a/fpdfsdk/javascript/Annot.h +++ b/fpdfsdk/javascript/Annot.h @@ -17,9 +17,9 @@ class Annot : public CJS_EmbedObj { explicit Annot(CJS_Object* pJSObject); ~Annot() override; - FX_BOOL hidden(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool hidden(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); void SetSDKAnnot(CPDFSDK_BAAnnot* annot); diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index ea489c993b..54761a2647 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -48,14 +48,14 @@ IMPLEMENT_JS_CLASS(CJS_PrintParamsObj, PrintParamsObj) PrintParamsObj::PrintParamsObj(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) { - bUI = TRUE; + bUI = true; nStart = 0; nEnd = 0; - bSilent = FALSE; - bShrinkToFit = FALSE; - bPrintAsImage = FALSE; - bReverse = FALSE; - bAnnotations = TRUE; + bSilent = false; + bShrinkToFit = false; + bPrintAsImage = false; + bReverse = false; + bAnnotations = true; } #define MINWIDTH 5.0f @@ -156,35 +156,35 @@ Document::Document(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject), m_pFormFillEnv(nullptr), m_cwBaseURL(L""), - m_bDelay(FALSE) {} + m_bDelay(false) {} Document::~Document() { } // the total number of fileds in document. -FX_BOOL Document::numFields(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::numFields(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); - return FALSE; + return false; } if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); vp << static_cast<int>(pPDFForm->CountFields(CFX_WideString())); - return TRUE; + return true; } -FX_BOOL Document::dirty(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::dirty(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } if (vp.IsGetting()) { vp << !!m_pFormFillEnv->GetChangeMark(); @@ -197,24 +197,24 @@ FX_BOOL Document::dirty(IJS_Context* cc, else m_pFormFillEnv->ClearChangeMark(); } - return TRUE; + return true; } -FX_BOOL Document::ADBE(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::ADBE(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsGetting()) vp.GetJSValue()->SetNull(CJS_Runtime::FromContext(cc)); - return TRUE; + return true; } -FX_BOOL Document::pageNum(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::pageNum(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } if (vp.IsGetting()) { if (CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetCurrentView()) { @@ -234,47 +234,47 @@ FX_BOOL Document::pageNum(IJS_Context* cc, } } - return TRUE; + return true; } -FX_BOOL Document::addAnnot(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::addAnnot(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Not supported. - return TRUE; + return true; } -FX_BOOL Document::addField(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::addField(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Not supported. - return TRUE; + return true; } -FX_BOOL Document::exportAsText(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::exportAsText(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, not supported. - return TRUE; + return true; } -FX_BOOL Document::exportAsFDF(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::exportAsFDF(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, not supported. - return TRUE; + return true; } -FX_BOOL Document::exportAsXFDF(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::exportAsXFDF(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, not supported. - return TRUE; + return true; } // Maps a field object in PDF document to a JavaScript variable @@ -282,17 +282,17 @@ FX_BOOL Document::exportAsXFDF(IJS_Context* cc, // note: the paremter cName, this is clue how to treat if the cName is not a // valiable filed name in this document -FX_BOOL Document::getField(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::getField(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() < 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } CJS_Context* pContext = static_cast<CJS_Context*>(cc); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); @@ -301,7 +301,7 @@ FX_BOOL Document::getField(IJS_Context* cc, CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); if (pPDFForm->CountFields(wideName) <= 0) { vRet.SetNull(pRuntime); - return TRUE; + return true; } v8::Local<v8::Object> pFieldObj = @@ -312,84 +312,84 @@ FX_BOOL Document::getField(IJS_Context* cc, pField->AttachField(this, wideName); vRet = CJS_Value(pRuntime, pJSField); - return TRUE; + return true; } // Gets the name of the nth field in the document -FX_BOOL Document::getNthFieldName(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::getNthFieldName(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } CJS_Context* pContext = static_cast<CJS_Context*>(cc); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); int nIndex = params[0].ToInt(pRuntime); if (nIndex < 0) { sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR); - return FALSE; + return false; } CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); CPDF_FormField* pField = pPDFForm->GetField(nIndex, CFX_WideString()); if (!pField) - return FALSE; + return false; vRet = CJS_Value(pRuntime, pField->GetFullName().c_str()); - return TRUE; + return true; } -FX_BOOL Document::importAnFDF(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::importAnFDF(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, not supported. - return TRUE; + return true; } -FX_BOOL Document::importAnXFDF(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::importAnXFDF(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, not supported. - return TRUE; + return true; } -FX_BOOL Document::importTextData(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::importTextData(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, not supported. - return TRUE; + return true; } // exports the form data and mails the resulting fdf file as an attachment to // all recipients. // comment: need reader supports -FX_BOOL Document::mailForm(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::mailForm(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } if (!m_pFormFillEnv->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) { sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION); - return FALSE; + return false; } CJS_Context* pContext = static_cast<CJS_Context*>(cc); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); int iLength = params.size(); - FX_BOOL bUI = iLength > 0 ? params[0].ToBool(pRuntime) : TRUE; + bool bUI = iLength > 0 ? params[0].ToBool(pRuntime) : true; CFX_WideString cTo = iLength > 1 ? params[1].ToCFXWideString(pRuntime) : L""; CFX_WideString cCc = iLength > 2 ? params[2].ToCFXWideString(pRuntime) : L""; CFX_WideString cBcc = iLength > 3 ? params[3].ToCFXWideString(pRuntime) : L""; @@ -400,7 +400,7 @@ FX_BOOL Document::mailForm(IJS_Context* cc, CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); CFX_ByteTextBuf textBuf; if (!pInterForm->ExportFormToFDFTextBuf(textBuf)) - return FALSE; + return false; pRuntime->BeginBlock(); CPDFSDK_FormFillEnvironment* pFormFillEnv = pContext->GetFormFillEnv(); @@ -408,29 +408,29 @@ FX_BOOL Document::mailForm(IJS_Context* cc, cTo.c_str(), cSubject.c_str(), cCc.c_str(), cBcc.c_str(), cMsg.c_str()); pRuntime->EndBlock(); - return TRUE; + return true; } -FX_BOOL Document::print(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::print(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } CJS_Context* pContext = static_cast<CJS_Context*>(cc); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); - FX_BOOL bUI = TRUE; + bool bUI = true; int nStart = 0; int nEnd = 0; - FX_BOOL bSilent = FALSE; - FX_BOOL bShrinkToFit = FALSE; - FX_BOOL bPrintAsImage = FALSE; - FX_BOOL bReverse = FALSE; - FX_BOOL bAnnotations = FALSE; + bool bSilent = false; + bool bShrinkToFit = false; + bool bPrintAsImage = false; + bool bReverse = false; + bool bAnnotations = false; int nlength = params.size(); if (nlength == 9) { @@ -475,31 +475,31 @@ FX_BOOL Document::print(IJS_Context* cc, if (m_pFormFillEnv) { m_pFormFillEnv->JS_docprint(bUI, nStart, nEnd, bSilent, bShrinkToFit, bPrintAsImage, bReverse, bAnnotations); - return TRUE; + return true; } - return FALSE; + return false; } // removes the specified field from the document. // comment: // note: if the filed name is not rational, adobe is dumb for it. -FX_BOOL Document::removeField(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::removeField(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } if (!(m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY) || m_pFormFillEnv->GetPermissions(FPDFPERM_ANNOT_FORM))) { sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION); - return FALSE; + return false; } CJS_Context* pContext = static_cast<CJS_Context*>(cc); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); @@ -508,7 +508,7 @@ FX_BOOL Document::removeField(IJS_Context* cc, std::vector<CPDFSDK_Widget*> widgets; pInterForm->GetWidgets(sFieldName, &widgets); if (widgets.empty()) - return TRUE; + return true; for (CPDFSDK_Widget* pWidget : widgets) { CFX_FloatRect rcAnnot = pWidget->GetRect(); @@ -534,26 +534,26 @@ FX_BOOL Document::removeField(IJS_Context* cc, } m_pFormFillEnv->SetChangeMark(); - return TRUE; + return true; } // reset filed values within a document. // comment: // note: if the fields names r not rational, aodbe is dumb for it. -FX_BOOL Document::resetForm(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::resetForm(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } if (!(m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY) || m_pFormFillEnv->GetPermissions(FPDFPERM_ANNOT_FORM) || m_pFormFillEnv->GetPermissions(FPDFPERM_FILL_FORM))) { sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION); - return FALSE; + return false; } CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); @@ -561,9 +561,9 @@ FX_BOOL Document::resetForm(IJS_Context* cc, CJS_Array aName; if (params.empty()) { - pPDFForm->ResetForm(TRUE); + pPDFForm->ResetForm(true); m_pFormFillEnv->SetChangeMark(); - return TRUE; + return true; } CJS_Context* pContext = static_cast<CJS_Context*>(cc); @@ -588,47 +588,47 @@ FX_BOOL Document::resetForm(IJS_Context* cc, } if (!aFields.empty()) { - pPDFForm->ResetForm(aFields, TRUE, TRUE); + pPDFForm->ResetForm(aFields, true, true); m_pFormFillEnv->SetChangeMark(); } - return TRUE; + return true; } -FX_BOOL Document::saveAs(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::saveAs(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, not supported. - return TRUE; + return true; } -FX_BOOL Document::syncAnnotScan(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; -} - -FX_BOOL Document::submitForm(IJS_Context* cc, +bool Document::syncAnnotScan(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { + return true; +} + +bool Document::submitForm(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { int nSize = params.size(); if (nSize < 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } CJS_Context* pContext = static_cast<CJS_Context*>(cc); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); CJS_Array aFields; CFX_WideString strURL; - FX_BOOL bFDF = TRUE; - FX_BOOL bEmpty = FALSE; + bool bFDF = true; + bool bEmpty = false; CJS_Value v = params[0]; if (v.GetType() == CJS_Value::VT_string) { strURL = params[0].ToCFXWideString(pRuntime); @@ -659,10 +659,10 @@ FX_BOOL Document::submitForm(IJS_Context* cc, if (aFields.GetLength(pRuntime) == 0 && bEmpty) { if (pPDFInterForm->CheckRequiredFields(nullptr, true)) { pRuntime->BeginBlock(); - pInterForm->SubmitForm(strURL, FALSE); + pInterForm->SubmitForm(strURL, false); pRuntime->EndBlock(); } - return TRUE; + return true; } std::vector<CPDF_FormField*> fieldObjects; @@ -686,28 +686,28 @@ FX_BOOL Document::submitForm(IJS_Context* cc, pInterForm->SubmitFields(strURL, fieldObjects, true, !bFDF); pRuntime->EndBlock(); } - return TRUE; + return true; } void Document::SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv) { m_pFormFillEnv.Reset(pFormFillEnv); } -FX_BOOL Document::bookmarkRoot(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { - return TRUE; +bool Document::bookmarkRoot(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { + return true; } -FX_BOOL Document::mailDoc(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::mailDoc(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { CJS_Context* pContext = static_cast<CJS_Context*>(cc); // TODO(tsepez): Check maximum number of allowed params. - FX_BOOL bUI = TRUE; + bool bUI = true; CFX_WideString cTo = L""; CFX_WideString cCc = L""; CFX_WideString cBcc = L""; @@ -757,29 +757,29 @@ FX_BOOL Document::mailDoc(IJS_Context* cc, cCc.c_str(), cBcc.c_str(), cMsg.c_str()); pRuntime->EndBlock(); - return TRUE; + return true; } -FX_BOOL Document::author(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::author(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { return getPropertyInternal(cc, vp, "Author", sError); } -FX_BOOL Document::info(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::info(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); - return FALSE; + return false; } if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } CPDF_Dictionary* pDictionary = m_pFormFillEnv->GetPDFDocument()->GetInfo(); if (!pDictionary) - return FALSE; + return false; CFX_WideString cwAuthor = pDictionary->GetUnicodeTextFor("Author"); CFX_WideString cwTitle = pDictionary->GetUnicodeTextFor("Title"); @@ -820,61 +820,61 @@ FX_BOOL Document::info(IJS_Context* cc, } } vp << pObj; - return TRUE; + return true; } -FX_BOOL Document::getPropertyInternal(IJS_Context* cc, - CJS_PropValue& vp, - const CFX_ByteString& propName, - CFX_WideString& sError) { +bool Document::getPropertyInternal(IJS_Context* cc, + CJS_PropValue& vp, + const CFX_ByteString& propName, + CFX_WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } CPDF_Dictionary* pDictionary = m_pFormFillEnv->GetPDFDocument()->GetInfo(); if (!pDictionary) - return FALSE; + return false; if (vp.IsGetting()) { vp << pDictionary->GetUnicodeTextFor(propName); } else { if (!m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY)) { sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION); - return FALSE; + return false; } CFX_WideString csProperty; vp >> csProperty; pDictionary->SetStringFor(propName, PDF_EncodeText(csProperty)); m_pFormFillEnv->SetChangeMark(); } - return TRUE; + return true; } -FX_BOOL Document::creationDate(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::creationDate(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { return getPropertyInternal(cc, vp, "CreationDate", sError); } -FX_BOOL Document::creator(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::creator(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { return getPropertyInternal(cc, vp, "Creator", sError); } -FX_BOOL Document::delay(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::delay(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } if (vp.IsGetting()) { vp << m_bDelay; } else { if (!m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY)) { sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION); - return FALSE; + return false; } vp >> m_bDelay; if (m_bDelay) { @@ -886,123 +886,121 @@ FX_BOOL Document::delay(IJS_Context* cc, Field::DoDelay(m_pFormFillEnv.Get(), pData.get()); } } - return TRUE; + return true; } -FX_BOOL Document::keywords(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::keywords(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { return getPropertyInternal(cc, vp, "Keywords", sError); } -FX_BOOL Document::modDate(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::modDate(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { return getPropertyInternal(cc, vp, "ModDate", sError); } -FX_BOOL Document::producer(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::producer(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { return getPropertyInternal(cc, vp, "Producer", sError); } -FX_BOOL Document::subject(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::subject(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { return getPropertyInternal(cc, vp, "Subject", sError); } -FX_BOOL Document::title(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::title(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (!m_pFormFillEnv || !m_pFormFillEnv->GetUnderlyingDocument()) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } return getPropertyInternal(cc, vp, "Title", sError); } -FX_BOOL Document::numPages(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::numPages(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); - return FALSE; + return false; } if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } vp << m_pFormFillEnv->GetPageCount(); - return TRUE; + return true; } -FX_BOOL Document::external(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::external(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { // In Chrome case, should always return true. if (vp.IsGetting()) { vp << true; } - return TRUE; + return true; } -FX_BOOL Document::filesize(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::filesize(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); - return FALSE; + return false; } vp << 0; - return TRUE; + return true; } -FX_BOOL Document::mouseX(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { - return TRUE; -} - -FX_BOOL Document::mouseY(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { - return TRUE; +bool Document::mouseX(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { + return true; } -FX_BOOL Document::URL(IJS_Context* cc, +bool Document::mouseY(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { + return true; +} + +bool Document::URL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); - return FALSE; + return false; } if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } vp << m_pFormFillEnv->JS_docGetFilePath(); - return TRUE; + return true; } -FX_BOOL Document::baseURL(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::baseURL(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsGetting()) { vp << m_cwBaseURL; } else { vp >> m_cwBaseURL; } - return TRUE; + return true; } -FX_BOOL Document::calculate(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::calculate(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); if (vp.IsGetting()) { @@ -1012,19 +1010,19 @@ FX_BOOL Document::calculate(IJS_Context* cc, vp >> bCalculate; pInterForm->EnableCalculate(bCalculate); } - return TRUE; + return true; } -FX_BOOL Document::documentFileName(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::documentFileName(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); - return FALSE; + return false; } if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } CFX_WideString wsFilePath = m_pFormFillEnv->JS_docGetFilePath(); int32_t i = wsFilePath.GetLength() - 1; @@ -1037,68 +1035,68 @@ FX_BOOL Document::documentFileName(IJS_Context* cc, } else { vp << L""; } - return TRUE; + return true; } -FX_BOOL Document::path(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::path(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); - return FALSE; + return false; } if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } vp << app::SysPathToPDFPath(m_pFormFillEnv->JS_docGetFilePath()); - return TRUE; + return true; } -FX_BOOL Document::pageWindowRect(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { - return TRUE; +bool Document::pageWindowRect(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { + return true; } -FX_BOOL Document::layout(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { - return TRUE; +bool Document::layout(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { + return true; } -FX_BOOL Document::addLink(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; +bool Document::addLink(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; } -FX_BOOL Document::closeDoc(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; +bool Document::closeDoc(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; } -FX_BOOL Document::getPageBox(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; +bool Document::getPageBox(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; } -FX_BOOL Document::getAnnot(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::getAnnot(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 2) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } CJS_Context* pContext = static_cast<CJS_Context*>(cc); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); @@ -1106,7 +1104,7 @@ FX_BOOL Document::getAnnot(IJS_Context* cc, CFX_WideString swAnnotName = params[1].ToCFXWideString(pRuntime); CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetPageView(nPageNo); if (!pPageView) - return FALSE; + return false; CPDFSDK_AnnotIterator annotIterator(pPageView, false); CPDFSDK_BAAnnot* pSDKBAAnnot = nullptr; @@ -1119,35 +1117,35 @@ FX_BOOL Document::getAnnot(IJS_Context* cc, } if (!pSDKBAAnnot) - return FALSE; + return false; v8::Local<v8::Object> pObj = pRuntime->NewFxDynamicObj(CJS_Annot::g_nObjDefnID); if (pObj.IsEmpty()) - return FALSE; + return false; CJS_Annot* pJS_Annot = static_cast<CJS_Annot*>(pRuntime->GetObjectPrivate(pObj)); if (!pJS_Annot) - return FALSE; + return false; Annot* pAnnot = static_cast<Annot*>(pJS_Annot->GetEmbedObject()); if (!pAnnot) - return FALSE; + return false; pAnnot->SetSDKAnnot(pSDKBAAnnot); vRet = CJS_Value(pRuntime, pJS_Annot); - return TRUE; + return true; } -FX_BOOL Document::getAnnots(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::getAnnots(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } CJS_Context* pContext = static_cast<CJS_Context*>(cc); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); @@ -1161,28 +1159,28 @@ FX_BOOL Document::getAnnots(IJS_Context* cc, for (int i = 0; i < nPageNo; ++i) { CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetPageView(i); if (!pPageView) - return FALSE; + return false; CPDFSDK_AnnotIterator annotIterator(pPageView, false); while (CPDFSDK_Annot* pSDKAnnotCur = annotIterator.Next()) { CPDFSDK_BAAnnot* pSDKBAAnnot = static_cast<CPDFSDK_BAAnnot*>(pSDKAnnotCur); if (!pSDKBAAnnot) - return FALSE; + return false; v8::Local<v8::Object> pObj = pRuntime->NewFxDynamicObj(CJS_Annot::g_nObjDefnID); if (pObj.IsEmpty()) - return FALSE; + return false; CJS_Annot* pJS_Annot = static_cast<CJS_Annot*>(pRuntime->GetObjectPrivate(pObj)); if (!pJS_Annot) - return FALSE; + return false; Annot* pAnnot = static_cast<Annot*>(pJS_Annot->GetEmbedObject()); if (!pAnnot) - return FALSE; + return false; pAnnot->SetSDKAnnot(pSDKBAAnnot); annots.SetElement(pRuntime, i, CJS_Value(pRuntime, pJS_Annot)); @@ -1190,36 +1188,36 @@ FX_BOOL Document::getAnnots(IJS_Context* cc, } vRet = CJS_Value(pRuntime, annots); - return TRUE; -} - -FX_BOOL Document::getAnnot3D(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - vRet.SetNull(CJS_Runtime::FromContext(cc)); - return TRUE; -} - -FX_BOOL Document::getAnnots3D(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; + return true; } -FX_BOOL Document::getOCGs(IJS_Context* cc, +bool Document::getAnnot3D(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - return TRUE; + vRet.SetNull(CJS_Runtime::FromContext(cc)); + return true; } -FX_BOOL Document::getLinks(IJS_Context* cc, +bool Document::getAnnots3D(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - return TRUE; + return true; +} + +bool Document::getOCGs(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; +} + +bool Document::getLinks(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; } bool Document::IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect) { @@ -1227,13 +1225,13 @@ bool Document::IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect) { rect.right >= LinkRect.right && rect.bottom >= LinkRect.bottom); } -FX_BOOL Document::addIcon(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::addIcon(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 2) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Context* pContext = static_cast<CJS_Context*>(cc); @@ -1242,38 +1240,38 @@ FX_BOOL Document::addIcon(IJS_Context* cc, if (params[1].GetType() != CJS_Value::VT_object) { sError = JSGetStringFromID(IDS_STRING_JSTYPEERROR); - return FALSE; + return false; } v8::Local<v8::Object> pJSIcon = params[1].ToV8Object(pRuntime); if (pRuntime->GetObjDefnID(pJSIcon) != CJS_Icon::g_nObjDefnID) { sError = JSGetStringFromID(IDS_STRING_JSTYPEERROR); - return FALSE; + return false; } CJS_EmbedObj* pEmbedObj = params[1].ToCJSObject(pRuntime)->GetEmbedObject(); if (!pEmbedObj) { sError = JSGetStringFromID(IDS_STRING_JSTYPEERROR); - return FALSE; + return false; } m_Icons.push_back(pdfium::MakeUnique<IconElement>( swIconName, static_cast<Icon*>(pEmbedObj))); - return TRUE; + return true; } -FX_BOOL Document::icons(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Document::icons(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); if (m_Icons.empty()) { vp.GetJSValue()->SetNull(pRuntime); - return TRUE; + return true; } CJS_Array Icons; @@ -1283,16 +1281,16 @@ FX_BOOL Document::icons(IJS_Context* cc, v8::Local<v8::Object> pObj = pRuntime->NewFxDynamicObj(CJS_Icon::g_nObjDefnID); if (pObj.IsEmpty()) - return FALSE; + return false; CJS_Icon* pJS_Icon = static_cast<CJS_Icon*>(pRuntime->GetObjectPrivate(pObj)); if (!pJS_Icon) - return FALSE; + return false; Icon* pIcon = static_cast<Icon*>(pJS_Icon->GetEmbedObject()); if (!pIcon) - return FALSE; + return false; pIcon->SetStream(pIconElement->IconStream->GetStream()); pIcon->SetIconName(pIconElement->IconName); @@ -1300,20 +1298,20 @@ FX_BOOL Document::icons(IJS_Context* cc, } vp << Icons; - return TRUE; + return true; } -FX_BOOL Document::getIcon(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::getIcon(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } if (m_Icons.empty()) - return FALSE; + return false; CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); CFX_WideString swIconName = params[0].ToCFXWideString(pRuntime); @@ -1325,84 +1323,84 @@ FX_BOOL Document::getIcon(IJS_Context* cc, v8::Local<v8::Object> pObj = pRuntime->NewFxDynamicObj(CJS_Icon::g_nObjDefnID); if (pObj.IsEmpty()) - return FALSE; + return false; CJS_Icon* pJS_Icon = static_cast<CJS_Icon*>(pRuntime->GetObjectPrivate(pObj)); if (!pJS_Icon) - return FALSE; + return false; Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject(); if (!pIcon) - return FALSE; + return false; pIcon->SetIconName(swIconName); pIcon->SetStream(pIconElement->IconStream->GetStream()); vRet = CJS_Value(pRuntime, pJS_Icon); - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL Document::removeIcon(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::removeIcon(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, no supported. - return TRUE; + return true; } -FX_BOOL Document::createDataObject(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::createDataObject(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, not implemented. - return TRUE; + return true; } -FX_BOOL Document::media(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { - return TRUE; +bool Document::media(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { + return true; } -FX_BOOL Document::calculateNow(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::calculateNow(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } if (!(m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY) || m_pFormFillEnv->GetPermissions(FPDFPERM_ANNOT_FORM) || m_pFormFillEnv->GetPermissions(FPDFPERM_FILL_FORM))) { sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION); - return FALSE; + return false; } m_pFormFillEnv->GetInterForm()->OnCalculate(); - return TRUE; + return true; } -FX_BOOL Document::Collab(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { - return TRUE; +bool Document::Collab(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { + return true; } -FX_BOOL Document::getPageNthWord(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::getPageNthWord(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } if (!m_pFormFillEnv->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) { sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); @@ -1414,16 +1412,16 @@ FX_BOOL Document::getPageNthWord(IJS_Context* cc, CPDF_Document* pDocument = m_pFormFillEnv->GetPDFDocument(); if (!pDocument) - return FALSE; + return false; if (nPageNo < 0 || nPageNo >= pDocument->GetPageCount()) { sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR); - return FALSE; + return false; } CPDF_Dictionary* pPageDict = pDocument->GetPage(nPageNo); if (!pPageDict) - return FALSE; + return false; CPDF_Page page(pDocument, pPageDict, true); page.ParseContent(); @@ -1448,47 +1446,47 @@ FX_BOOL Document::getPageNthWord(IJS_Context* cc, } vRet = CJS_Value(pRuntime, swRet.c_str()); - return TRUE; + return true; } -FX_BOOL Document::getPageNthWordQuads(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::getPageNthWordQuads(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } if (!m_pFormFillEnv->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } - return FALSE; + return false; } -FX_BOOL Document::getPageNumWords(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::getPageNumWords(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } if (!m_pFormFillEnv->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) { sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); int nPageNo = params.size() > 0 ? params[0].ToInt(pRuntime) : 0; CPDF_Document* pDocument = m_pFormFillEnv->GetPDFDocument(); if (nPageNo < 0 || nPageNo >= pDocument->GetPageCount()) { sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR); - return FALSE; + return false; } CPDF_Dictionary* pPageDict = pDocument->GetPage(nPageNo); if (!pPageDict) - return FALSE; + return false; CPDF_Page page(pDocument, pPageDict, true); page.ParseContent(); @@ -1500,13 +1498,13 @@ FX_BOOL Document::getPageNumWords(IJS_Context* cc, } vRet = CJS_Value(pRuntime, nWords); - return TRUE; + return true; } -FX_BOOL Document::getPrintParams(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::getPrintParams(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; CJS_Runtime* pRuntime = pContext->GetJSRuntime(); v8::Local<v8::Object> pRetObj = @@ -1515,7 +1513,7 @@ FX_BOOL Document::getPrintParams(IJS_Context* cc, // Not implemented yet. vRet = CJS_Value(pRuntime, pRetObj); - return TRUE; + return true; } #define ISLATINWORD(u) (u != 0x20 && u <= 0x28FF) @@ -1530,7 +1528,7 @@ int Document::CountWords(CPDF_TextObject* pTextObj) { if (!pFont) return 0; - FX_BOOL bIsLatin = FALSE; + bool bIsLatin = false; for (int i = 0, sz = pTextObj->CountChars(); i < sz; i++) { uint32_t charcode = CPDF_Font::kInvalidCharCode; @@ -1563,7 +1561,7 @@ CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj, return L""; int nWords = 0; - FX_BOOL bIsLatin = FALSE; + bool bIsLatin = false; for (int i = 0, sz = pTextObj->CountChars(); i < sz; i++) { uint32_t charcode = CPDF_Font::kInvalidCharCode; @@ -1590,10 +1588,10 @@ CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj, return swRet; } -FX_BOOL Document::zoom(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { - return TRUE; +bool Document::zoom(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { + return true; } /** @@ -1606,75 +1604,75 @@ FX_BOOL Document::zoom(IJS_Context* cc, (refW, ReflowWidth) */ -FX_BOOL Document::zoomType(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { - return TRUE; +bool Document::zoomType(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { + return true; } -FX_BOOL Document::deletePages(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::deletePages(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, no supported. - return TRUE; + return true; } -FX_BOOL Document::extractPages(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::extractPages(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, not supported. - return TRUE; + return true; } -FX_BOOL Document::insertPages(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::insertPages(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, not supported. - return TRUE; + return true; } -FX_BOOL Document::replacePages(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::replacePages(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, not supported. - return TRUE; + return true; } -FX_BOOL Document::getURL(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::getURL(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, not supported. - return TRUE; + return true; } -FX_BOOL Document::gotoNamedDest(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Document::gotoNamedDest(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); CFX_WideString wideName = params[0].ToCFXWideString(pRuntime); CFX_ByteString utf8Name = wideName.UTF8Encode(); CPDF_Document* pDocument = m_pFormFillEnv->GetPDFDocument(); if (!pDocument) - return FALSE; + return false; CPDF_NameTree nameTree(pDocument, "Dests"); CPDF_Array* destArray = nameTree.LookupNamedDest(pDocument, utf8Name); if (!destArray) - return FALSE; + return false; CPDF_Dest dest(destArray); const CPDF_Array* arrayObject = ToArray(dest.GetObject()); @@ -1696,7 +1694,7 @@ FX_BOOL Document::gotoNamedDest(IJS_Context* cc, scrollPositionArraySize); pRuntime->EndBlock(); - return TRUE; + return true; } void Document::AddDelayData(CJS_DelayData* pData) { diff --git a/fpdfsdk/javascript/Document.h b/fpdfsdk/javascript/Document.h index 129411a431..227c4284bb 100644 --- a/fpdfsdk/javascript/Document.h +++ b/fpdfsdk/javascript/Document.h @@ -22,14 +22,14 @@ class PrintParamsObj : public CJS_EmbedObj { ~PrintParamsObj() override {} public: - FX_BOOL bUI; + bool bUI; int nStart; int nEnd; - FX_BOOL bSilent; - FX_BOOL bShrinkToFit; - FX_BOOL bPrintAsImage; - FX_BOOL bReverse; - FX_BOOL bAnnotations; + bool bSilent; + bool bShrinkToFit; + bool bPrintAsImage; + bool bReverse; + bool bAnnotations; }; class CJS_PrintParamsObj : public CJS_Object { @@ -61,215 +61,211 @@ class Document : public CJS_EmbedObj { explicit Document(CJS_Object* pJSObject); ~Document() override; - FX_BOOL ADBE(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL author(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL baseURL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL bookmarkRoot(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL Collab(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL creationDate(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL creator(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL delay(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL dirty(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL documentFileName(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL external(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL filesize(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL icons(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL info(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL keywords(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL layout(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL modDate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL mouseX(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL mouseY(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL numFields(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL numPages(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL pageNum(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL pageWindowRect(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL path(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL producer(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL subject(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL title(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL zoom(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL zoomType(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool ADBE(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool author(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool baseURL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool bookmarkRoot(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool Collab(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool creationDate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool creator(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool delay(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool dirty(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool documentFileName(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError); + bool external(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool filesize(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool icons(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool info(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool keywords(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool layout(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool modDate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool mouseX(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool mouseY(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool numFields(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool numPages(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool pageNum(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool pageWindowRect(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError); + bool path(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool producer(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool subject(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool title(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool zoom(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool zoomType(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL addAnnot(IJS_Context* cc, + bool addAnnot(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool addField(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool addLink(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool addIcon(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool calculateNow(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool closeDoc(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool createDataObject(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool deletePages(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL addField(IJS_Context* cc, + bool exportAsText(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool exportAsFDF(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL addLink(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL addIcon(IJS_Context* cc, + bool exportAsXFDF(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool extractPages(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool getAnnot(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool getAnnots(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool getAnnot3D(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL calculateNow(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL closeDoc(IJS_Context* cc, + bool getAnnots3D(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL createDataObject(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL deletePages(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL exportAsText(IJS_Context* cc, + bool getField(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool getIcon(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool getLinks(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool getNthFieldName(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL exportAsFDF(IJS_Context* cc, + bool getOCGs(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool getPageBox(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool getPageNthWord(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL exportAsXFDF(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL extractPages(IJS_Context* cc, + bool getPageNthWordQuads(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool getPageNumWords(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL getAnnot(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL getAnnots(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL getAnnot3D(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL getAnnots3D(IJS_Context* cc, + bool getPrintParams(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL getField(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL getIcon(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL getLinks(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL getNthFieldName(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL getOCGs(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL getPageBox(IJS_Context* cc, + bool getURL(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool gotoNamedDest(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL getPageNthWord(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL getPageNthWordQuads(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL getPageNumWords(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL getPrintParams(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL getURL(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL gotoNamedDest(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL importAnFDF(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL importAnXFDF(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL importTextData(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL insertPages(IJS_Context* cc, + bool importAnFDF(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool importAnXFDF(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool importTextData(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL mailForm(IJS_Context* cc, + bool insertPages(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL print(IJS_Context* cc, + bool mailForm(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL removeField(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL replacePages(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL resetForm(IJS_Context* cc, + bool print(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool removeField(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool replacePages(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL saveAs(IJS_Context* cc, + bool resetForm(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL submitForm(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL syncAnnotScan(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL mailDoc(IJS_Context* cc, + bool saveAs(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool submitForm(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL removeIcon(IJS_Context* cc, + bool syncAnnotScan(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL URL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool mailDoc(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool removeIcon(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool URL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); void SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv); CPDFSDK_FormFillEnvironment* GetFormFillEnv() const { @@ -284,10 +280,10 @@ class Document : public CJS_EmbedObj { int CountWords(CPDF_TextObject* pTextObj); CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex); - FX_BOOL getPropertyInternal(IJS_Context* cc, - CJS_PropValue& vp, - const CFX_ByteString& propName, - CFX_WideString& sError); + bool getPropertyInternal(IJS_Context* cc, + CJS_PropValue& vp, + const CFX_ByteString& propName, + CFX_WideString& sError); CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv; CFX_WideString m_cwBaseURL; diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp index a2118a77c0..4ce1f2e4e8 100644 --- a/fpdfsdk/javascript/Field.cpp +++ b/fpdfsdk/javascript/Field.cpp @@ -176,8 +176,8 @@ Field::Field(CJS_Object* pJSObject) m_pJSDoc(nullptr), m_pFormFillEnv(nullptr), m_nFormControlIndex(-1), - m_bCanSet(FALSE), - m_bDelay(FALSE) {} + m_bCanSet(false), + m_bDelay(false) {} Field::~Field() {} @@ -208,8 +208,8 @@ void Field::ParseFieldName(const std::wstring& strFieldNameParsed, strFieldName = strFieldNameParsed.substr(0, iStart); } -FX_BOOL Field::AttachField(Document* pDocument, - const CFX_WideString& csFieldName) { +bool Field::AttachField(Document* pDocument, + const CFX_WideString& csFieldName) { m_pJSDoc = pDocument; m_pFormFillEnv.Reset(pDocument->GetFormFillEnv()); m_bCanSet = m_pFormFillEnv->GetPermissions(FPDFPERM_FILL_FORM) || @@ -226,17 +226,17 @@ FX_BOOL Field::AttachField(Document* pDocument, int iControlNo = -1; ParseFieldName(swFieldNameTemp.c_str(), strFieldName, iControlNo); if (iControlNo == -1) - return FALSE; + return false; m_FieldName = strFieldName.c_str(); m_nFormControlIndex = iControlNo; - return TRUE; + return true; } m_FieldName = swFieldNameTemp; m_nFormControlIndex = -1; - return TRUE; + return true; } std::vector<CPDF_FormField*> Field::GetFormFields( @@ -259,9 +259,9 @@ std::vector<CPDF_FormField*> Field::GetFormFields( void Field::UpdateFormField(CPDFSDK_FormFillEnvironment* pFormFillEnv, CPDF_FormField* pFormField, - FX_BOOL bChangeMark, - FX_BOOL bResetAP, - FX_BOOL bRefresh) { + bool bChangeMark, + bool bResetAP, + bool bRefresh) { CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); if (bResetAP) { @@ -271,18 +271,18 @@ void Field::UpdateFormField(CPDFSDK_FormFillEnvironment* pFormFillEnv, int nFieldType = pFormField->GetFieldType(); if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) { for (CPDFSDK_Annot* pAnnot : widgets) { - FX_BOOL bFormatted = FALSE; + bool bFormatted = false; CPDFSDK_Annot::ObservedPtr pObserved(pAnnot); CFX_WideString sValue = static_cast<CPDFSDK_Widget*>(pObserved.Get())->OnFormat(bFormatted); if (pObserved) { static_cast<CPDFSDK_Widget*>(pObserved.Get()) - ->ResetAppearance(bFormatted ? &sValue : nullptr, FALSE); + ->ResetAppearance(bFormatted ? &sValue : nullptr, false); } } } else { for (CPDFSDK_Widget* pWidget : widgets) { - pWidget->ResetAppearance(nullptr, FALSE); + pWidget->ResetAppearance(nullptr, false); } } } @@ -310,9 +310,9 @@ void Field::UpdateFormField(CPDFSDK_FormFillEnvironment* pFormFillEnv, void Field::UpdateFormControl(CPDFSDK_FormFillEnvironment* pFormFillEnv, CPDF_FormControl* pFormControl, - FX_BOOL bChangeMark, - FX_BOOL bResetAP, - FX_BOOL bRefresh) { + bool bChangeMark, + bool bResetAP, + bool bRefresh) { ASSERT(pFormControl); CPDFSDK_InterForm* pForm = pFormFillEnv->GetInterForm(); @@ -323,11 +323,11 @@ void Field::UpdateFormControl(CPDFSDK_FormFillEnvironment* pFormFillEnv, int nFieldType = pWidget->GetFieldType(); if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) { - FX_BOOL bFormatted = FALSE; + bool bFormatted = false; CFX_WideString sValue = pWidget->OnFormat(bFormatted); - pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, FALSE); + pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, false); } else { - pWidget->ResetAppearance(nullptr, FALSE); + pWidget->ResetAppearance(nullptr, false); } } @@ -350,14 +350,14 @@ CPDFSDK_Widget* Field::GetWidget(CPDFSDK_FormFillEnvironment* pFormFillEnv, : nullptr; } -FX_BOOL Field::ValueIsOccur(CPDF_FormField* pFormField, - CFX_WideString csOptLabel) { +bool Field::ValueIsOccur(CPDF_FormField* pFormField, + CFX_WideString csOptLabel) { for (int i = 0, sz = pFormField->CountOptions(); i < sz; i++) { if (csOptLabel.Compare(pFormField->GetOptionLabel(i)) == 0) - return TRUE; + return true; } - return FALSE; + return false; } CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField) { @@ -371,14 +371,14 @@ CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField) { return pFormField->GetControl(m_nFormControlIndex); } -FX_BOOL Field::alignment(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::alignment(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; CFX_ByteString alignStr; vp >> alignStr; @@ -392,15 +392,15 @@ FX_BOOL Field::alignment(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) - return FALSE; + return false; CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; switch (pFormControl->GetControlAlignment()) { case 1: @@ -417,7 +417,7 @@ FX_BOOL Field::alignment(IJS_Context* cc, } } - return TRUE; + return true; } void Field::SetAlignment(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -427,14 +427,14 @@ void Field::SetAlignment(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::borderStyle(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::borderStyle(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; CFX_ByteString strType = ""; vp >> strType; @@ -448,16 +448,16 @@ FX_BOOL Field::borderStyle(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (!pFormField) - return FALSE; + return false; CPDFSDK_Widget* pWidget = GetWidget( m_pFormFillEnv.Get(), GetSmartFieldControl(pFormField), false); if (!pWidget) - return FALSE; + return false; switch (pWidget->GetBorderStyle()) { case BorderStyle::SOLID: @@ -481,7 +481,7 @@ FX_BOOL Field::borderStyle(IJS_Context* cc, } } - return TRUE; + return true; } void Field::SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -508,18 +508,18 @@ void Field::SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, GetFormFields(pFormFillEnv, swFieldName); for (CPDF_FormField* pFormField : FieldArray) { if (nControlIndex < 0) { - FX_BOOL bSet = FALSE; + bool bSet = false; for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { if (CPDFSDK_Widget* pWidget = GetWidget(pFormFillEnv, pFormField->GetControl(i), false)) { if (pWidget->GetBorderStyle() != nBorderStyle) { pWidget->SetBorderStyle(nBorderStyle); - bSet = TRUE; + bSet = true; } } } if (bSet) - UpdateFormField(pFormFillEnv, pFormField, TRUE, TRUE, TRUE); + UpdateFormField(pFormFillEnv, pFormField, true, true, true); } else { if (nControlIndex >= pFormField->CountControls()) return; @@ -529,7 +529,7 @@ void Field::SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, GetWidget(pFormFillEnv, pFormControl, false)) { if (pWidget->GetBorderStyle() != nBorderStyle) { pWidget->SetBorderStyle(nBorderStyle); - UpdateFormControl(pFormFillEnv, pFormControl, TRUE, TRUE, TRUE); + UpdateFormControl(pFormFillEnv, pFormControl, true, true, true); } } } @@ -537,14 +537,14 @@ void Field::SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, } } -FX_BOOL Field::buttonAlignX(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::buttonAlignX(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; int nVP; vp >> nVP; @@ -558,15 +558,15 @@ FX_BOOL Field::buttonAlignX(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) - return FALSE; + return false; CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; CPDF_IconFit IconFit = pFormControl->GetIconFit(); @@ -576,7 +576,7 @@ FX_BOOL Field::buttonAlignX(IJS_Context* cc, vp << (int32_t)fLeft; } - return TRUE; + return true; } void Field::SetButtonAlignX(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -586,14 +586,14 @@ void Field::SetButtonAlignX(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::buttonAlignY(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::buttonAlignY(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; int nVP; vp >> nVP; @@ -607,15 +607,15 @@ FX_BOOL Field::buttonAlignY(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) - return FALSE; + return false; CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; CPDF_IconFit IconFit = pFormControl->GetIconFit(); @@ -625,7 +625,7 @@ FX_BOOL Field::buttonAlignY(IJS_Context* cc, vp << (int32_t)fBottom; } - return TRUE; + return true; } void Field::SetButtonAlignY(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -635,14 +635,14 @@ void Field::SetButtonAlignY(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::buttonFitBounds(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::buttonFitBounds(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; @@ -656,20 +656,20 @@ FX_BOOL Field::buttonFitBounds(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) - return FALSE; + return false; CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; vp << pFormControl->GetIconFit().GetFittingBounds(); } - return TRUE; + return true; } void Field::SetButtonFitBounds(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -679,14 +679,14 @@ void Field::SetButtonFitBounds(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::buttonPosition(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::buttonPosition(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; int nVP; vp >> nVP; @@ -700,19 +700,19 @@ FX_BOOL Field::buttonPosition(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) - return FALSE; + return false; CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; vp << pFormControl->GetTextPosition(); } - return TRUE; + return true; } void Field::SetButtonPosition(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -722,14 +722,14 @@ void Field::SetButtonPosition(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::buttonScaleHow(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::buttonScaleHow(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; int nVP; vp >> nVP; @@ -743,15 +743,15 @@ FX_BOOL Field::buttonScaleHow(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) - return FALSE; + return false; CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; CPDF_IconFit IconFit = pFormControl->GetIconFit(); if (IconFit.IsProportionalScale()) @@ -760,7 +760,7 @@ FX_BOOL Field::buttonScaleHow(IJS_Context* cc, vp << (int32_t)1; } - return TRUE; + return true; } void Field::SetButtonScaleHow(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -770,14 +770,14 @@ void Field::SetButtonScaleHow(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::buttonScaleWhen(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::buttonScaleWhen(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; int nVP; vp >> nVP; @@ -791,15 +791,15 @@ FX_BOOL Field::buttonScaleWhen(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) - return FALSE; + return false; CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; CPDF_IconFit IconFit = pFormControl->GetIconFit(); int ScaleM = IconFit.GetScaleMethod(); @@ -819,7 +819,7 @@ FX_BOOL Field::buttonScaleWhen(IJS_Context* cc, } } - return TRUE; + return true; } void Field::SetButtonScaleWhen(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -829,14 +829,14 @@ void Field::SetButtonScaleWhen(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::calcOrderIndex(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::calcOrderIndex(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; int nVP; vp >> nVP; @@ -850,12 +850,12 @@ FX_BOOL Field::calcOrderIndex(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) { - return FALSE; + return false; } CPDFSDK_InterForm* pRDInterForm = m_pFormFillEnv->GetInterForm(); @@ -863,7 +863,7 @@ FX_BOOL Field::calcOrderIndex(IJS_Context* cc, vp << (int32_t)pInterForm->FindFieldInCalculationOrder(pFormField); } - return TRUE; + return true; } void Field::SetCalcOrderIndex(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -873,14 +873,14 @@ void Field::SetCalcOrderIndex(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::charLimit(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::charLimit(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; int nVP; vp >> nVP; @@ -894,15 +894,15 @@ FX_BOOL Field::charLimit(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) - return FALSE; + return false; vp << (int32_t)pFormField->GetMaxLen(); } - return TRUE; + return true; } void Field::SetCharLimit(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -912,14 +912,12 @@ void Field::SetCharLimit(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::comb(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::comb(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; @@ -933,11 +931,11 @@ FX_BOOL Field::comb(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) - return FALSE; + return false; if (pFormField->GetFieldFlags() & FIELDFLAG_COMB) vp << true; @@ -945,7 +943,7 @@ FX_BOOL Field::comb(IJS_Context* cc, vp << false; } - return TRUE; + return true; } void Field::SetComb(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -955,14 +953,14 @@ void Field::SetComb(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::commitOnSelChange(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::commitOnSelChange(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; @@ -976,12 +974,12 @@ FX_BOOL Field::commitOnSelChange(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && pFormField->GetFieldType() != FIELDTYPE_LISTBOX) { - return FALSE; + return false; } if (pFormField->GetFieldFlags() & FIELDFLAG_COMMITONSELCHANGE) @@ -990,7 +988,7 @@ FX_BOOL Field::commitOnSelChange(IJS_Context* cc, vp << false; } - return TRUE; + return true; } void Field::SetCommitOnSelChange(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -1000,14 +998,14 @@ void Field::SetCommitOnSelChange(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::currentValueIndices(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::currentValueIndices(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; std::vector<uint32_t> array; if (vp.GetJSValue()->GetType() == CJS_Value::VT_number) { @@ -1035,12 +1033,12 @@ FX_BOOL Field::currentValueIndices(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && pFormField->GetFieldType() != FIELDTYPE_LISTBOX) { - return FALSE; + return false; } if (pFormField->CountSelectedItems() == 1) { @@ -1057,7 +1055,7 @@ FX_BOOL Field::currentValueIndices(IJS_Context* cc, } } - return TRUE; + return true; } void Field::SetCurrentValueIndices(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -1072,24 +1070,24 @@ void Field::SetCurrentValueIndices(CPDFSDK_FormFillEnvironment* pFormFillEnv, int nFieldType = pFormField->GetFieldType(); if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_LISTBOX) { uint32_t dwFieldFlags = pFormField->GetFieldFlags(); - pFormField->ClearSelection(TRUE); + pFormField->ClearSelection(true); for (size_t i = 0; i < array.size(); ++i) { if (i != 0 && !(dwFieldFlags & (1 << 21))) break; if (array[i] < static_cast<uint32_t>(pFormField->CountOptions()) && !pFormField->IsItemSelected(array[i])) { - pFormField->SetItemSelection(array[i], TRUE); + pFormField->SetItemSelection(array[i], true); } } - UpdateFormField(pFormFillEnv, pFormField, TRUE, TRUE, TRUE); + UpdateFormField(pFormFillEnv, pFormField, true, true, true); } } } -FX_BOOL Field::defaultStyle(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { - return FALSE; +bool Field::defaultStyle(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { + return false; } void Field::SetDefaultStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -1098,14 +1096,14 @@ void Field::SetDefaultStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::defaultValue(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::defaultValue(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; CFX_WideString WideStr; vp >> WideStr; @@ -1119,17 +1117,17 @@ FX_BOOL Field::defaultValue(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON || pFormField->GetFieldType() == FIELDTYPE_SIGNATURE) { - return FALSE; + return false; } vp << pFormField->GetDefaultValue(); } - return TRUE; + return true; } void Field::SetDefaultValue(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -1139,14 +1137,14 @@ void Field::SetDefaultValue(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::doNotScroll(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::doNotScroll(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; @@ -1160,11 +1158,11 @@ FX_BOOL Field::doNotScroll(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) - return FALSE; + return false; if (pFormField->GetFieldFlags() & FIELDFLAG_DONOTSCROLL) vp << true; @@ -1172,7 +1170,7 @@ FX_BOOL Field::doNotScroll(IJS_Context* cc, vp << false; } - return TRUE; + return true; } void Field::SetDoNotScroll(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -1182,26 +1180,26 @@ void Field::SetDoNotScroll(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::doNotSpellCheck(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::doNotSpellCheck(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD && pFormField->GetFieldType() != FIELDTYPE_COMBOBOX) { - return FALSE; + return false; } if (pFormField->GetFieldFlags() & FIELDFLAG_DONOTSPELLCHECK) @@ -1210,10 +1208,10 @@ FX_BOOL Field::doNotSpellCheck(IJS_Context* cc, vp << false; } - return TRUE; + return true; } -void Field::SetDelay(FX_BOOL bDelay) { +void Field::SetDelay(bool bDelay) { m_bDelay = bDelay; if (!m_bDelay) { @@ -1222,12 +1220,10 @@ void Field::SetDelay(FX_BOOL bDelay) { } } -FX_BOOL Field::delay(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::delay(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; @@ -1236,15 +1232,15 @@ FX_BOOL Field::delay(IJS_Context* cc, } else { vp << m_bDelay; } - return TRUE; + return true; } -FX_BOOL Field::display(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::display(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; int nVP; vp >> nVP; @@ -1258,7 +1254,7 @@ FX_BOOL Field::display(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; ASSERT(pFormField); @@ -1266,7 +1262,7 @@ FX_BOOL Field::display(IJS_Context* cc, CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldControl(pFormField), true); if (!pWidget) - return FALSE; + return false; uint32_t dwFlag = pWidget->GetFlags(); @@ -1285,7 +1281,7 @@ FX_BOOL Field::display(IJS_Context* cc, } } - return TRUE; + return true; } void Field::SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -1308,7 +1304,7 @@ void Field::SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv, } if (bAnySet) - UpdateFormField(pFormFillEnv, pFormField, TRUE, FALSE, TRUE); + UpdateFormField(pFormFillEnv, pFormField, true, false, true); } else { if (nControlIndex >= pFormField->CountControls()) return; @@ -1319,36 +1315,36 @@ void Field::SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv, CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl, true); if (SetWidgetDisplayStatus(pWidget, number)) - UpdateFormControl(pFormFillEnv, pFormControl, TRUE, FALSE, TRUE); + UpdateFormControl(pFormFillEnv, pFormControl, true, false, true); } } } -FX_BOOL Field::doc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { +bool Field::doc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (!vp.IsGetting()) { - return FALSE; + return false; } vp << m_pJSDoc->GetCJSDoc(); - return TRUE; + return true; } -FX_BOOL Field::editable(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::editable(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX) - return FALSE; + return false; if (pFormField->GetFieldFlags() & FIELDFLAG_EDIT) vp << true; @@ -1356,28 +1352,28 @@ FX_BOOL Field::editable(IJS_Context* cc, vp << false; } - return TRUE; + return true; } -FX_BOOL Field::exportValues(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::exportValues(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_CHECKBOX && pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON) { - return FALSE; + return false; } if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; if (!vp.GetJSValue()->IsArrayObject()) - return FALSE; + return false; } else { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); CJS_Array ExportValusArray; @@ -1390,12 +1386,12 @@ FX_BOOL Field::exportValues(IJS_Context* cc, } } else { if (m_nFormControlIndex >= pFormField->CountControls()) - return FALSE; + return false; CPDF_FormControl* pFormControl = pFormField->GetControl(m_nFormControlIndex); if (!pFormControl) - return FALSE; + return false; ExportValusArray.SetElement( pRuntime, 0, @@ -1403,23 +1399,23 @@ FX_BOOL Field::exportValues(IJS_Context* cc, } vp << ExportValusArray; } - return TRUE; + return true; } -FX_BOOL Field::fileSelect(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::fileSelect(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) - return FALSE; + return false; if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; @@ -1429,24 +1425,24 @@ FX_BOOL Field::fileSelect(IJS_Context* cc, else vp << false; } - return TRUE; + return true; } -FX_BOOL Field::fillColor(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::fillColor(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); CJS_Array crArray; std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; if (!vp.GetJSValue()->IsArrayObject()) - return FALSE; + return false; vp >> crArray; @@ -1463,7 +1459,7 @@ FX_BOOL Field::fillColor(IJS_Context* cc, ASSERT(pFormField); CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; int iColorType; pFormControl->GetBackgroundColor(iColorType); @@ -1486,14 +1482,14 @@ FX_BOOL Field::fillColor(IJS_Context* cc, pFormControl->GetOriginalBackgroundColor(2), pFormControl->GetOriginalBackgroundColor(3)); } else { - return FALSE; + return false; } color::ConvertPWLColorToArray(pRuntime, color, &crArray); vp << crArray; } - return TRUE; + return true; } void Field::SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -1503,12 +1499,10 @@ void Field::SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::hidden(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::hidden(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; @@ -1522,7 +1516,7 @@ FX_BOOL Field::hidden(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; ASSERT(pFormField); @@ -1530,7 +1524,7 @@ FX_BOOL Field::hidden(IJS_Context* cc, CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldControl(pFormField), false); if (!pWidget) - return FALSE; + return false; uint32_t dwFlags = pWidget->GetFlags(); @@ -1540,7 +1534,7 @@ FX_BOOL Field::hidden(IJS_Context* cc, vp << false; } - return TRUE; + return true; } void Field::SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -1551,14 +1545,14 @@ void Field::SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv, SetDisplay(pFormFillEnv, swFieldName, nControlIndex, display); } -FX_BOOL Field::highlight(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::highlight(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; CFX_ByteString strMode; vp >> strMode; @@ -1572,15 +1566,15 @@ FX_BOOL Field::highlight(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) - return FALSE; + return false; CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; int eHM = pFormControl->GetHighlightingMode(); switch (eHM) { @@ -1602,7 +1596,7 @@ FX_BOOL Field::highlight(IJS_Context* cc, } } - return TRUE; + return true; } void Field::SetHighlight(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -1612,12 +1606,12 @@ void Field::SetHighlight(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::lineWidth(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::lineWidth(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; int iWidth; vp >> iWidth; @@ -1631,27 +1625,27 @@ FX_BOOL Field::lineWidth(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; ASSERT(pFormField); CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); if (!pFormField->CountControls()) - return FALSE; + return false; CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormField->GetControl(0), false); if (!pWidget) - return FALSE; + return false; vp << (int32_t)pWidget->GetBorderWidth(); } - return TRUE; + return true; } void Field::SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -1663,7 +1657,7 @@ void Field::SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv, GetFormFields(pFormFillEnv, swFieldName); for (CPDF_FormField* pFormField : FieldArray) { if (nControlIndex < 0) { - FX_BOOL bSet = FALSE; + bool bSet = false; for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { CPDF_FormControl* pFormControl = pFormField->GetControl(i); ASSERT(pFormControl); @@ -1672,12 +1666,12 @@ void Field::SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv, pInterForm->GetWidget(pFormControl, false)) { if (number != pWidget->GetBorderWidth()) { pWidget->SetBorderWidth(number); - bSet = TRUE; + bSet = true; } } } if (bSet) - UpdateFormField(pFormFillEnv, pFormField, TRUE, TRUE, TRUE); + UpdateFormField(pFormFillEnv, pFormField, true, true, true); } else { if (nControlIndex >= pFormField->CountControls()) return; @@ -1687,7 +1681,7 @@ void Field::SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv, pInterForm->GetWidget(pFormControl, false)) { if (number != pWidget->GetBorderWidth()) { pWidget->SetBorderWidth(number); - UpdateFormControl(pFormFillEnv, pFormControl, TRUE, TRUE, TRUE); + UpdateFormControl(pFormFillEnv, pFormControl, true, true, true); } } } @@ -1695,14 +1689,14 @@ void Field::SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv, } } -FX_BOOL Field::multiline(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::multiline(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; @@ -1716,11 +1710,11 @@ FX_BOOL Field::multiline(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) - return FALSE; + return false; if (pFormField->GetFieldFlags() & FIELDFLAG_MULTILINE) vp << true; @@ -1728,7 +1722,7 @@ FX_BOOL Field::multiline(IJS_Context* cc, vp << false; } - return TRUE; + return true; } void Field::SetMultiline(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -1738,14 +1732,14 @@ void Field::SetMultiline(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::multipleSelection(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::multipleSelection(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; @@ -1759,11 +1753,11 @@ FX_BOOL Field::multipleSelection(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_LISTBOX) - return FALSE; + return false; if (pFormField->GetFieldFlags() & FIELDFLAG_MULTISELECT) vp << true; @@ -1771,7 +1765,7 @@ FX_BOOL Field::multipleSelection(IJS_Context* cc, vp << false; } - return TRUE; + return true; } void Field::SetMultipleSelection(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -1781,61 +1775,57 @@ void Field::SetMultipleSelection(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::name(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; vp << m_FieldName; - return TRUE; + return true; } -FX_BOOL Field::numItems(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::numItems(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && pFormField->GetFieldType() != FIELDTYPE_LISTBOX) { - return FALSE; + return false; } vp << (int32_t)pFormField->CountOptions(); - return TRUE; + return true; } -FX_BOOL Field::page(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::page(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (!pFormField) - return FALSE; + return false; std::vector<CPDFSDK_Widget*> widgets; m_pFormFillEnv->GetInterForm()->GetWidgets(pFormField, &widgets); if (widgets.empty()) { vp << (int32_t)-1; - return TRUE; + return true; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); @@ -1843,24 +1833,24 @@ FX_BOOL Field::page(IJS_Context* cc, for (size_t i = 0; i < widgets.size(); ++i) { CPDFSDK_PageView* pPageView = widgets[i]->GetPageView(); if (!pPageView) - return FALSE; + return false; PageArray.SetElement( pRuntime, i, CJS_Value(pRuntime, (int32_t)pPageView->GetPageIndex())); } vp << PageArray; - return TRUE; + return true; } -FX_BOOL Field::password(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::password(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; @@ -1874,11 +1864,11 @@ FX_BOOL Field::password(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) - return FALSE; + return false; if (pFormField->GetFieldFlags() & FIELDFLAG_PASSWORD) vp << true; @@ -1886,7 +1876,7 @@ FX_BOOL Field::password(IJS_Context* cc, vp << false; } - return TRUE; + return true; } void Field::SetPassword(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -1896,24 +1886,22 @@ void Field::SetPassword(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::print(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::print(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; for (CPDF_FormField* pFormField : FieldArray) { if (m_nFormControlIndex < 0) { - FX_BOOL bSet = FALSE; + bool bSet = false; for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormField->GetControl(i), false)) { @@ -1925,16 +1913,16 @@ FX_BOOL Field::print(IJS_Context* cc, if (dwFlags != pWidget->GetFlags()) { pWidget->SetFlags(dwFlags); - bSet = TRUE; + bSet = true; } } } if (bSet) - UpdateFormField(m_pFormFillEnv.Get(), pFormField, TRUE, FALSE, TRUE); + UpdateFormField(m_pFormFillEnv.Get(), pFormField, true, false, true); } else { if (m_nFormControlIndex >= pFormField->CountControls()) - return FALSE; + return false; if (CPDF_FormControl* pFormControl = pFormField->GetControl(m_nFormControlIndex)) { if (CPDFSDK_Widget* pWidget = @@ -1949,7 +1937,7 @@ FX_BOOL Field::print(IJS_Context* cc, pWidget->SetFlags(dwFlags); UpdateFormControl(m_pFormFillEnv.Get(), pFormField->GetControl(m_nFormControlIndex), - TRUE, FALSE, TRUE); + true, false, true); } } } @@ -1960,7 +1948,7 @@ FX_BOOL Field::print(IJS_Context* cc, CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldControl(pFormField), true); if (!pWidget) - return FALSE; + return false; if (pWidget->GetFlags() & ANNOTFLAG_PRINT) vp << true; @@ -1968,19 +1956,19 @@ FX_BOOL Field::print(IJS_Context* cc, vp << false; } - return TRUE; + return true; } -FX_BOOL Field::radiosInUnison(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::radiosInUnison(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; @@ -1988,7 +1976,7 @@ FX_BOOL Field::radiosInUnison(IJS_Context* cc, } else { CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON) - return FALSE; + return false; if (pFormField->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON) vp << true; @@ -1996,19 +1984,19 @@ FX_BOOL Field::radiosInUnison(IJS_Context* cc, vp << false; } - return TRUE; + return true; } -FX_BOOL Field::readonly(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::readonly(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; @@ -2021,12 +2009,10 @@ FX_BOOL Field::readonly(IJS_Context* cc, vp << false; } - return TRUE; + return true; } -FX_BOOL Field::rect(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::rect(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); CJS_Value Upper_Leftx(pRuntime); CJS_Value Upper_Lefty(pRuntime); @@ -2035,9 +2021,9 @@ FX_BOOL Field::rect(IJS_Context* cc, if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; if (!vp.GetJSValue()->IsArrayObject()) - return FALSE; + return false; CJS_Array rcArray; vp >> rcArray; @@ -2062,14 +2048,14 @@ FX_BOOL Field::rect(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldControl(pFormField), true); if (!pWidget) - return FALSE; + return false; CFX_FloatRect crRect = pWidget->GetRect(); Upper_Leftx = CJS_Value(pRuntime, static_cast<int32_t>(crRect.left)); @@ -2084,7 +2070,7 @@ FX_BOOL Field::rect(IJS_Context* cc, rcArray.SetElement(pRuntime, 3, Lower_Righty); vp << rcArray; } - return TRUE; + return true; } void Field::SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -2096,7 +2082,7 @@ void Field::SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv, GetFormFields(pFormFillEnv, swFieldName); for (CPDF_FormField* pFormField : FieldArray) { if (nControlIndex < 0) { - FX_BOOL bSet = FALSE; + bool bSet = false; for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { CPDF_FormControl* pFormControl = pFormField->GetControl(i); ASSERT(pFormControl); @@ -2113,14 +2099,14 @@ void Field::SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv, if (crRect.left != rcOld.left || crRect.right != rcOld.right || crRect.top != rcOld.top || crRect.bottom != rcOld.bottom) { pWidget->SetRect(crRect); - bSet = TRUE; + bSet = true; } } } } if (bSet) - UpdateFormField(pFormFillEnv, pFormField, TRUE, TRUE, TRUE); + UpdateFormField(pFormFillEnv, pFormField, true, true, true); } else { if (nControlIndex >= pFormField->CountControls()) return; @@ -2138,7 +2124,7 @@ void Field::SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv, if (crRect.left != rcOld.left || crRect.right != rcOld.right || crRect.top != rcOld.top || crRect.bottom != rcOld.bottom) { pWidget->SetRect(crRect); - UpdateFormControl(pFormFillEnv, pFormControl, TRUE, TRUE, TRUE); + UpdateFormControl(pFormFillEnv, pFormControl, true, true, true); } } } @@ -2147,16 +2133,16 @@ void Field::SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv, } } -FX_BOOL Field::required(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::required(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; @@ -2164,7 +2150,7 @@ FX_BOOL Field::required(IJS_Context* cc, } else { CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON) - return FALSE; + return false; if (pFormField->GetFieldFlags() & FIELDFLAG_REQUIRED) vp << true; @@ -2172,17 +2158,17 @@ FX_BOOL Field::required(IJS_Context* cc, vp << false; } - return TRUE; + return true; } -FX_BOOL Field::richText(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::richText(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; bool bVP; vp >> bVP; @@ -2193,11 +2179,11 @@ FX_BOOL Field::richText(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) - return FALSE; + return false; if (pFormField->GetFieldFlags() & FIELDFLAG_RICHTEXT) vp << true; @@ -2205,23 +2191,23 @@ FX_BOOL Field::richText(IJS_Context* cc, vp << false; } - return TRUE; + return true; } -FX_BOOL Field::richValue(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { - return TRUE; +bool Field::richValue(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { + return true; } -FX_BOOL Field::rotation(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::rotation(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; int nVP; vp >> nVP; @@ -2235,17 +2221,17 @@ FX_BOOL Field::rotation(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; vp << (int32_t)pFormControl->GetRotation(); } - return TRUE; + return true; } void Field::SetRotation(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -2255,18 +2241,18 @@ void Field::SetRotation(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::strokeColor(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::strokeColor(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); CJS_Array crArray; if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; if (!vp.GetJSValue()->IsArrayObject()) - return FALSE; + return false; vp >> crArray; @@ -2282,12 +2268,12 @@ FX_BOOL Field::strokeColor(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; int iColorType; pFormControl->GetBorderColor(iColorType); @@ -2309,13 +2295,13 @@ FX_BOOL Field::strokeColor(IJS_Context* cc, pFormControl->GetOriginalBorderColor(2), pFormControl->GetOriginalBorderColor(3)); } else { - return FALSE; + return false; } color::ConvertPWLColorToArray(pRuntime, color, &crArray); vp << crArray; } - return TRUE; + return true; } void Field::SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -2325,14 +2311,12 @@ void Field::SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::style(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::style(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; CFX_ByteString csBCaption; vp >> csBCaption; @@ -2346,17 +2330,17 @@ FX_BOOL Field::style(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON && pFormField->GetFieldType() != FIELDTYPE_CHECKBOX) { - return FALSE; + return false; } CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; CFX_WideString csWCaption = pFormControl->GetNormalCaption(); CFX_ByteString csBCaption; @@ -2384,7 +2368,7 @@ FX_BOOL Field::style(IJS_Context* cc, vp << csBCaption; } - return TRUE; + return true; } void Field::SetStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -2394,24 +2378,24 @@ void Field::SetStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::submitName(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { - return TRUE; +bool Field::submitName(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { + return true; } -FX_BOOL Field::textColor(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::textColor(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); CJS_Array crArray; if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; if (!vp.GetJSValue()->IsArrayObject()) - return FALSE; + return false; vp >> crArray; @@ -2427,12 +2411,12 @@ FX_BOOL Field::textColor(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; int iColorType; FX_ARGB color; @@ -2451,7 +2435,7 @@ FX_BOOL Field::textColor(IJS_Context* cc, color::ConvertPWLColorToArray(pRuntime, crRet, &crArray); vp << crArray; } - return TRUE; + return true; } void Field::SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -2461,19 +2445,19 @@ void Field::SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::textFont(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::textFont(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; CFX_ByteString csFontName; vp >> csFontName; if (csFontName.IsEmpty()) - return FALSE; + return false; if (m_bDelay) { AddDelay_String(FP_TEXTFONT, csFontName); @@ -2484,13 +2468,13 @@ FX_BOOL Field::textFont(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; ASSERT(pFormField); CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; int nFieldType = pFormField->GetFieldType(); @@ -2499,15 +2483,15 @@ FX_BOOL Field::textFont(IJS_Context* cc, nFieldType == FIELDTYPE_TEXTFIELD) { CPDF_Font* pFont = pFormControl->GetDefaultControlFont(); if (!pFont) - return FALSE; + return false; vp << pFont->GetBaseFont(); } else { - return FALSE; + return false; } } - return TRUE; + return true; } void Field::SetTextFont(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -2517,14 +2501,14 @@ void Field::SetTextFont(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::textSize(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::textSize(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; int nVP; vp >> nVP; @@ -2538,13 +2522,13 @@ FX_BOOL Field::textSize(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; ASSERT(pFormField); CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaultAppearance(); @@ -2556,7 +2540,7 @@ FX_BOOL Field::textSize(IJS_Context* cc, vp << (int)fFontSize; } - return TRUE; + return true; } void Field::SetTextSize(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -2566,15 +2550,13 @@ void Field::SetTextSize(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::type(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; switch (pFormField->GetFieldType()) { @@ -2607,17 +2589,17 @@ FX_BOOL Field::type(IJS_Context* cc, break; } - return TRUE; + return true; } -FX_BOOL Field::userName(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::userName(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; CFX_WideString swName; vp >> swName; @@ -2631,13 +2613,13 @@ FX_BOOL Field::userName(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; vp << (CFX_WideString)pFormField->GetAlternateName(); } - return TRUE; + return true; } void Field::SetUserName(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -2647,14 +2629,12 @@ void Field::SetUserName(CPDFSDK_FormFillEnvironment* pFormFillEnv, // Not supported. } -FX_BOOL Field::value(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::value(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); if (vp.IsSetting()) { if (!m_bCanSet) - return FALSE; + return false; std::vector<CFX_WideString> strArray; if (vp.GetJSValue()->IsArrayObject()) { @@ -2680,12 +2660,12 @@ FX_BOOL Field::value(IJS_Context* cc, } else { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; switch (pFormField->GetFieldType()) { case FIELDTYPE_PUSHBUTTON: - return FALSE; + return false; case FIELDTYPE_COMBOBOX: case FIELDTYPE_TEXTFIELD: { vp << pFormField->GetValue(); @@ -2730,7 +2710,7 @@ FX_BOOL Field::value(IJS_Context* cc, } } vp.GetJSValue()->MaybeCoerceToNumber(pRuntime); - return TRUE; + return true; } void Field::SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -2752,33 +2732,33 @@ void Field::SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv, case FIELDTYPE_TEXTFIELD: case FIELDTYPE_COMBOBOX: if (pFormField->GetValue() != strArray[0]) { - pFormField->SetValue(strArray[0], TRUE); - UpdateFormField(pFormFillEnv, pFormField, TRUE, FALSE, TRUE); + pFormField->SetValue(strArray[0], true); + UpdateFormField(pFormFillEnv, pFormField, true, false, true); } break; case FIELDTYPE_CHECKBOX: case FIELDTYPE_RADIOBUTTON: { if (pFormField->GetValue() != strArray[0]) { - pFormField->SetValue(strArray[0], TRUE); - UpdateFormField(pFormFillEnv, pFormField, TRUE, FALSE, TRUE); + pFormField->SetValue(strArray[0], true); + UpdateFormField(pFormFillEnv, pFormField, true, false, true); } } break; case FIELDTYPE_LISTBOX: { - FX_BOOL bModified = FALSE; + bool bModified = false; for (const auto& str : strArray) { if (!pFormField->IsItemSelected(pFormField->FindOption(str))) { - bModified = TRUE; + bModified = true; break; } } if (bModified) { - pFormField->ClearSelection(TRUE); + pFormField->ClearSelection(true); for (const auto& str : strArray) { int index = pFormField->FindOption(str); if (!pFormField->IsItemSelected(index)) - pFormField->SetItemSelection(index, TRUE, TRUE); + pFormField->SetItemSelection(index, true, true); } - UpdateFormField(pFormFillEnv, pFormField, TRUE, FALSE, TRUE); + UpdateFormField(pFormFillEnv, pFormField, true, false, true); } } break; default: @@ -2787,23 +2767,23 @@ void Field::SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv, } } -FX_BOOL Field::valueAsString(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::valueAsString(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON) - return FALSE; + return false; if (pFormField->GetFieldType() == FIELDTYPE_CHECKBOX) { if (!pFormField->CountControls()) - return FALSE; + return false; if (pFormField->GetControl(0)->IsChecked()) vp << L"Yes"; @@ -2826,16 +2806,16 @@ FX_BOOL Field::valueAsString(IJS_Context* cc, vp << pFormField->GetValue().c_str(); } - return TRUE; + return true; } -FX_BOOL Field::browseForFileToSubmit(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Field::browseForFileToSubmit(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) && @@ -2843,17 +2823,17 @@ FX_BOOL Field::browseForFileToSubmit(IJS_Context* cc, CFX_WideString wsFileName = m_pFormFillEnv->JS_fieldBrowse(); if (!wsFileName.IsEmpty()) { pFormField->SetValue(wsFileName); - UpdateFormField(m_pFormFillEnv.Get(), pFormField, TRUE, TRUE, TRUE); + UpdateFormField(m_pFormFillEnv.Get(), pFormField, true, true, true); } - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL Field::buttonGetCaption(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Field::buttonGetCaption(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); int nface = 0; @@ -2863,15 +2843,15 @@ FX_BOOL Field::buttonGetCaption(IJS_Context* cc, std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) - return FALSE; + return false; CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; if (nface == 0) vRet = CJS_Value(pRuntime, pFormControl->GetNormalCaption().c_str()); @@ -2880,15 +2860,15 @@ FX_BOOL Field::buttonGetCaption(IJS_Context* cc, else if (nface == 2) vRet = CJS_Value(pRuntime, pFormControl->GetRolloverCaption().c_str()); else - return FALSE; + return false; - return TRUE; + return true; } -FX_BOOL Field::buttonGetIcon(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Field::buttonGetIcon(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { CJS_Context* pContext = static_cast<CJS_Context*>(cc); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); @@ -2899,19 +2879,19 @@ FX_BOOL Field::buttonGetIcon(IJS_Context* cc, std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) - return FALSE; + return false; CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl) - return FALSE; + return false; v8::Local<v8::Object> pObj = pRuntime->NewFxDynamicObj(CJS_Icon::g_nObjDefnID); - ASSERT(pObj.IsEmpty() == FALSE); + ASSERT(pObj.IsEmpty() == false); CJS_Icon* pJS_Icon = static_cast<CJS_Icon*>(pRuntime->GetObjectPrivate(pObj)); Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject(); @@ -2924,44 +2904,44 @@ FX_BOOL Field::buttonGetIcon(IJS_Context* cc, else if (nface == 2) pIconStream = pFormControl->GetRolloverIcon(); else - return FALSE; + return false; pIcon->SetStream(pIconStream); vRet = CJS_Value(pRuntime, pJS_Icon); - return TRUE; -} - -FX_BOOL Field::buttonImportIcon(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; + return true; } -FX_BOOL Field::buttonSetCaption(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return FALSE; +bool Field::buttonImportIcon(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; } -FX_BOOL Field::buttonSetIcon(IJS_Context* cc, +bool Field::buttonSetCaption(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - return FALSE; + return false; } -FX_BOOL Field::checkThisBox(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Field::buttonSetIcon(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return false; +} + +bool Field::checkThisBox(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { int iSize = params.size(); if (iSize < 1) - return FALSE; + return false; if (!m_bCanSet) - return FALSE; + return false; CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); int nWidget = params[0].ToInt(pRuntime); @@ -2972,14 +2952,14 @@ FX_BOOL Field::checkThisBox(IJS_Context* cc, std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (pFormField->GetFieldType() != FIELDTYPE_CHECKBOX && pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON) - return FALSE; + return false; if (nWidget < 0 || nWidget >= pFormField->CountControls()) - return FALSE; + return false; // TODO(weili): Check whether anything special needed for radio button, // otherwise merge these branches. if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON) @@ -2987,60 +2967,60 @@ FX_BOOL Field::checkThisBox(IJS_Context* cc, else pFormField->CheckControl(nWidget, bCheckit, true); - UpdateFormField(m_pFormFillEnv.Get(), pFormField, TRUE, TRUE, TRUE); - return TRUE; + UpdateFormField(m_pFormFillEnv.Get(), pFormField, true, true, true); + return true; } -FX_BOOL Field::clearItems(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; +bool Field::clearItems(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; } -FX_BOOL Field::defaultIsChecked(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Field::defaultIsChecked(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (!m_bCanSet) - return FALSE; + return false; int iSize = params.size(); if (iSize < 1) - return FALSE; + return false; CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); int nWidget = params[0].ToInt(pRuntime); std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (nWidget < 0 || nWidget >= pFormField->CountControls()) - return FALSE; + return false; vRet = CJS_Value(pRuntime, pFormField->GetFieldType() == FIELDTYPE_CHECKBOX || pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON); - return TRUE; + return true; } -FX_BOOL Field::deleteItemAt(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; +bool Field::deleteItemAt(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; } -FX_BOOL Field::getArray(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Field::getArray(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; std::vector<std::unique_ptr<CFX_WideString>> swSort; for (CPDF_FormField* pFormField : FieldArray) { @@ -3071,13 +3051,13 @@ FX_BOOL Field::getArray(IJS_Context* cc, } vRet = CJS_Value(pRuntime, FormFieldArray); - return TRUE; + return true; } -FX_BOOL Field::getItemAt(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Field::getItemAt(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); int iSize = params.size(); @@ -3085,13 +3065,13 @@ FX_BOOL Field::getItemAt(IJS_Context* cc, if (iSize >= 1) nIdx = params[0].ToInt(pRuntime); - FX_BOOL bExport = TRUE; + bool bExport = true; if (iSize >= 2) bExport = params[1].ToBool(pRuntime); std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if ((pFormField->GetFieldType() == FIELDTYPE_LISTBOX) || @@ -3108,30 +3088,30 @@ FX_BOOL Field::getItemAt(IJS_Context* cc, vRet = CJS_Value(pRuntime, pFormField->GetOptionLabel(nIdx).c_str()); } } else { - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL Field::getLock(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return FALSE; +bool Field::getLock(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return false; } -FX_BOOL Field::insertItemAt(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; +bool Field::insertItemAt(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; } -FX_BOOL Field::isBoxChecked(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Field::isBoxChecked(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); int nIndex = -1; @@ -3140,24 +3120,24 @@ FX_BOOL Field::isBoxChecked(IJS_Context* cc, std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (nIndex < 0 || nIndex >= pFormField->CountControls()) { - return FALSE; + return false; } vRet = CJS_Value(pRuntime, ((pFormField->GetFieldType() == FIELDTYPE_CHECKBOX || pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON) && pFormField->GetControl(nIndex)->IsChecked() != 0)); - return TRUE; + return true; } -FX_BOOL Field::isDefaultChecked(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Field::isDefaultChecked(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); int nIndex = -1; @@ -3166,38 +3146,38 @@ FX_BOOL Field::isDefaultChecked(IJS_Context* cc, std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; if (nIndex < 0 || nIndex >= pFormField->CountControls()) - return FALSE; + return false; vRet = CJS_Value(pRuntime, ((pFormField->GetFieldType() == FIELDTYPE_CHECKBOX || pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON) && pFormField->GetControl(nIndex)->IsDefaultChecked() != 0)); - return TRUE; + return true; } -FX_BOOL Field::setAction(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; +bool Field::setAction(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; } -FX_BOOL Field::setFocus(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Field::setFocus(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) - return FALSE; + return false; CPDF_FormField* pFormField = FieldArray[0]; int32_t nCount = pFormField->CountControls(); if (nCount < 1) - return FALSE; + return false; CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); CPDFSDK_Widget* pWidget = nullptr; @@ -3208,7 +3188,7 @@ FX_BOOL Field::setFocus(IJS_Context* cc, UnderlyingFromFPDFPage(m_pFormFillEnv->GetCurrentPage( m_pFormFillEnv->GetUnderlyingDocument())); if (!pPage) - return FALSE; + return false; if (CPDFSDK_PageView* pCurPageView = m_pFormFillEnv->GetPageView(pPage, true)) { for (int32_t i = 0; i < nCount; i++) { @@ -3228,73 +3208,71 @@ FX_BOOL Field::setFocus(IJS_Context* cc, m_pFormFillEnv->SetFocusAnnot(&pObserved); } - return TRUE; + return true; } -FX_BOOL Field::setItems(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; +bool Field::setItems(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; } -FX_BOOL Field::setLock(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return FALSE; +bool Field::setLock(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return false; } -FX_BOOL Field::signatureGetModifications(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return FALSE; +bool Field::signatureGetModifications(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return false; } -FX_BOOL Field::signatureGetSeedValue(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return FALSE; +bool Field::signatureGetSeedValue(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return false; } -FX_BOOL Field::signatureInfo(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return FALSE; +bool Field::signatureInfo(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return false; } -FX_BOOL Field::signatureSetSeedValue(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return FALSE; +bool Field::signatureSetSeedValue(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return false; } -FX_BOOL Field::signatureSign(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return FALSE; +bool Field::signatureSign(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return false; } -FX_BOOL Field::signatureValidate(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return FALSE; +bool Field::signatureValidate(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return false; } -FX_BOOL Field::source(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::source(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (vp.IsGetting()) { vp << (CJS_Object*)nullptr; } - return TRUE; + return true; } void Field::AddDelay_Int(FIELD_PROP prop, int32_t n) { diff --git a/fpdfsdk/javascript/Field.h b/fpdfsdk/javascript/Field.h index cdff0915b4..d4371ab274 100644 --- a/fpdfsdk/javascript/Field.h +++ b/fpdfsdk/javascript/Field.h @@ -77,205 +77,185 @@ class Field : public CJS_EmbedObj { explicit Field(CJS_Object* pJSObject); ~Field() override; - FX_BOOL alignment(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL borderStyle(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL buttonAlignX(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL buttonAlignY(IJS_Context* cc, + bool alignment(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool borderStyle(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool buttonAlignX(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool buttonAlignY(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool buttonFitBounds(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL buttonFitBounds(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL buttonPosition(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL buttonScaleHow(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL buttonScaleWhen(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL calcOrderIndex(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL charLimit(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL comb(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL commitOnSelChange(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL currentValueIndices(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL defaultStyle(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL defaultValue(IJS_Context* cc, + bool buttonPosition(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError); + bool buttonScaleHow(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError); + bool buttonScaleWhen(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL doNotScroll(IJS_Context* cc, + bool calcOrderIndex(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL doNotSpellCheck(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL delay(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL display(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL doc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL editable(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL exportValues(IJS_Context* cc, + bool charLimit(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool comb(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool commitOnSelChange(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError); + bool currentValueIndices(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError); + bool defaultStyle(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool defaultValue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool doNotScroll(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool doNotSpellCheck(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL fileSelect(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL fillColor(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL hidden(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL highlight(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL lineWidth(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL multiline(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL multipleSelection(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL numItems(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL page(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL password(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL print(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL radiosInUnison(IJS_Context* cc, + bool delay(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool display(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool doc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool editable(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool exportValues(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool fileSelect(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool fillColor(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool hidden(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool highlight(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool lineWidth(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool multiline(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool multipleSelection(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL readonly(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL rect(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL required(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL richText(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL richValue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL rotation(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL strokeColor(IJS_Context* cc, + bool name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool numItems(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool page(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool password(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool print(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool radiosInUnison(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL style(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL submitName(IJS_Context* cc, + bool readonly(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool rect(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool required(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool richText(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool richValue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool rotation(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool strokeColor(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool style(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool submitName(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool textColor(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool textFont(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool textSize(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool userName(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool value(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool valueAsString(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL textColor(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL textFont(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL textSize(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL userName(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL value(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL valueAsString(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL source(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool source(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL browseForFileToSubmit(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL buttonGetCaption(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL buttonGetIcon(IJS_Context* cc, + bool browseForFileToSubmit(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool buttonGetCaption(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL buttonImportIcon(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL buttonSetCaption(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL buttonSetIcon(IJS_Context* cc, + bool buttonGetIcon(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool buttonImportIcon(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL checkThisBox(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL clearItems(IJS_Context* cc, + bool buttonSetCaption(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool buttonSetIcon(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL defaultIsChecked(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL deleteItemAt(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL getArray(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL getItemAt(IJS_Context* cc, + bool checkThisBox(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL getLock(IJS_Context* cc, + bool clearItems(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL insertItemAt(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL isBoxChecked(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL isDefaultChecked(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL setAction(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL setFocus(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL setItems(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL setLock(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL signatureGetModifications(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL signatureGetSeedValue(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL signatureInfo(IJS_Context* cc, + bool defaultIsChecked(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL signatureSetSeedValue(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL signatureSign(IJS_Context* cc, + bool deleteItemAt(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool getArray(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool getItemAt(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool getLock(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool insertItemAt(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool isBoxChecked(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool isDefaultChecked(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL signatureValidate(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); + bool setAction(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool setFocus(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool setItems(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool setLock(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool signatureGetModifications(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool signatureGetSeedValue(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool signatureInfo(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool signatureSetSeedValue(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool signatureSign(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool signatureValidate(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); static void SetAlignment(CPDFSDK_FormFillEnvironment* pFormFillEnv, const CFX_WideString& swFieldName, @@ -417,14 +397,14 @@ class Field : public CJS_EmbedObj { static void UpdateFormField(CPDFSDK_FormFillEnvironment* pFormFillEnv, CPDF_FormField* pFormField, - FX_BOOL bChangeMark, - FX_BOOL bResetAP, - FX_BOOL bRefresh); + bool bChangeMark, + bool bResetAP, + bool bRefresh); static void UpdateFormControl(CPDFSDK_FormFillEnvironment* pFormFillEnv, CPDF_FormControl* pFormControl, - FX_BOOL bChangeMark, - FX_BOOL bResetAP, - FX_BOOL bRefresh); + bool bChangeMark, + bool bResetAP, + bool bRefresh); static CPDFSDK_Widget* GetWidget(CPDFSDK_FormFillEnvironment* pFormFillEnv, CPDF_FormControl* pFormControl, @@ -436,8 +416,8 @@ class Field : public CJS_EmbedObj { static void DoDelay(CPDFSDK_FormFillEnvironment* pFormFillEnv, CJS_DelayData* pData); - FX_BOOL AttachField(Document* pDocument, const CFX_WideString& csFieldName); - void SetDelay(FX_BOOL bDelay); + bool AttachField(Document* pDocument, const CFX_WideString& csFieldName); + void SetDelay(bool bDelay); protected: void ParseFieldName(const std::wstring& strFieldNameParsed, @@ -446,7 +426,7 @@ class Field : public CJS_EmbedObj { std::vector<CPDF_FormField*> GetFormFields( const CFX_WideString& csFieldName) const; CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField); - FX_BOOL ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel); + bool ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel); void AddDelay_Int(FIELD_PROP prop, int32_t n); void AddDelay_Bool(FIELD_PROP prop, bool b); @@ -465,8 +445,8 @@ class Field : public CJS_EmbedObj { CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv; CFX_WideString m_FieldName; int m_nFormControlIndex; - FX_BOOL m_bCanSet; - FX_BOOL m_bDelay; + bool m_bCanSet; + bool m_bDelay; }; class CJS_Field : public CJS_Object { diff --git a/fpdfsdk/javascript/Icon.cpp b/fpdfsdk/javascript/Icon.cpp index 031ec4f63a..94841ef870 100644 --- a/fpdfsdk/javascript/Icon.cpp +++ b/fpdfsdk/javascript/Icon.cpp @@ -44,10 +44,10 @@ CFX_WideString Icon::GetIconName() { return m_swIconName; } -FX_BOOL Icon::name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { +bool Icon::name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; vp << m_swIconName; - return TRUE; + return true; } diff --git a/fpdfsdk/javascript/Icon.h b/fpdfsdk/javascript/Icon.h index f8fa70e076..98a479c148 100644 --- a/fpdfsdk/javascript/Icon.h +++ b/fpdfsdk/javascript/Icon.h @@ -16,7 +16,7 @@ class Icon : public CJS_EmbedObj { explicit Icon(CJS_Object* pJSObject); ~Icon() override; - FX_BOOL name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); void SetStream(CPDF_Stream* pIconStream); CPDF_Stream* GetStream(); void SetIconName(CFX_WideString name); diff --git a/fpdfsdk/javascript/JS_Define.h b/fpdfsdk/javascript/JS_Define.h index 1c688d2c11..17dd8e9c70 100644 --- a/fpdfsdk/javascript/JS_Define.h +++ b/fpdfsdk/javascript/JS_Define.h @@ -70,8 +70,7 @@ struct JSMethodSpec { } \ ; // NOLINT -template <class C, - FX_BOOL (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)> +template <class C, bool (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)> void JSPropGetter(const char* prop_name_string, const char* class_name_string, v8::Local<v8::String> property, @@ -94,8 +93,7 @@ void JSPropGetter(const char* prop_name_string, info.GetReturnValue().Set(value.GetJSValue()->ToV8Value(pRuntime)); } -template <class C, - FX_BOOL (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)> +template <class C, bool (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)> void JSPropSetter(const char* prop_name_string, const char* class_name_string, v8::Local<v8::String> property, @@ -132,10 +130,10 @@ void JSPropSetter(const char* prop_name_string, } template <class C, - FX_BOOL (C::*M)(IJS_Context*, - const std::vector<CJS_Value>&, - CJS_Value&, - CFX_WideString&)> + bool (C::*M)(IJS_Context*, + const std::vector<CJS_Value>&, + CJS_Value&, + CFX_WideString&)> void JSMethod(const char* method_name_string, const char* class_name_string, const v8::FunctionCallbackInfo<v8::Value>& info) { @@ -357,7 +355,7 @@ void JSSpecialPropQuery(const char*, CJS_Object* pJSObj = static_cast<CJS_Object*>(pRuntime->GetObjectPrivate(info.Holder())); Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject()); - FX_BOOL bRet = pObj->QueryProperty(propname.c_str()); + bool bRet = pObj->QueryProperty(propname.c_str()); info.GetReturnValue().Set(bRet ? 4 : 0); } @@ -433,10 +431,10 @@ void JSSpecialPropDel(const char* class_name, } } -template <FX_BOOL (*F)(IJS_Context*, - const std::vector<CJS_Value>&, - CJS_Value&, - CFX_WideString&)> +template <bool (*F)(IJS_Context*, + const std::vector<CJS_Value>&, + CJS_Value&, + CFX_WideString&)> void JSGlobalFunc(const char* func_name_string, const v8::FunctionCallbackInfo<v8::Value>& info) { CJS_Runtime* pRuntime = diff --git a/fpdfsdk/javascript/JS_EventHandler.cpp b/fpdfsdk/javascript/JS_EventHandler.cpp index 27223cfccb..5715cb9217 100644 --- a/fpdfsdk/javascript/JS_EventHandler.cpp +++ b/fpdfsdk/javascript/JS_EventHandler.cpp @@ -17,21 +17,21 @@ CJS_EventHandler::CJS_EventHandler(CJS_Context* pContext) : m_pJSContext(pContext), m_eEventType(JET_UNKNOWN), - m_bValid(FALSE), + m_bValid(false), m_pWideStrChange(nullptr), m_nCommitKey(-1), - m_bKeyDown(FALSE), - m_bModifier(FALSE), - m_bShift(FALSE), + m_bKeyDown(false), + m_bModifier(false), + m_bShift(false), m_pISelEnd(nullptr), m_nSelEndDu(0), m_pISelStart(nullptr), m_nSelStartDu(0), - m_bWillCommit(FALSE), + m_bWillCommit(false), m_pValue(nullptr), - m_bFieldFull(FALSE), + m_bFieldFull(false), m_pbRc(nullptr), - m_bRcDu(FALSE), + m_bRcDu(false), m_pTargetBookMark(nullptr), m_pTargetFormFillEnv(nullptr), m_pTargetAnnot(nullptr) {} @@ -101,8 +101,8 @@ void CJS_EventHandler::OnPage_OutView( m_pTargetFormFillEnv = pFormFillEnv; } -void CJS_EventHandler::OnField_MouseEnter(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_EventHandler::OnField_MouseEnter(bool bModifier, + bool bShift, CPDF_FormField* pTarget) { Initial(JET_FIELD_MOUSEENTER); @@ -112,8 +112,8 @@ void CJS_EventHandler::OnField_MouseEnter(FX_BOOL bModifier, m_strTargetName = pTarget->GetFullName(); } -void CJS_EventHandler::OnField_MouseExit(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_EventHandler::OnField_MouseExit(bool bModifier, + bool bShift, CPDF_FormField* pTarget) { Initial(JET_FIELD_MOUSEEXIT); @@ -122,8 +122,8 @@ void CJS_EventHandler::OnField_MouseExit(FX_BOOL bModifier, m_strTargetName = pTarget->GetFullName(); } -void CJS_EventHandler::OnField_MouseDown(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_EventHandler::OnField_MouseDown(bool bModifier, + bool bShift, CPDF_FormField* pTarget) { Initial(JET_FIELD_MOUSEDOWN); m_eEventType = JET_FIELD_MOUSEDOWN; @@ -133,8 +133,8 @@ void CJS_EventHandler::OnField_MouseDown(FX_BOOL bModifier, m_strTargetName = pTarget->GetFullName(); } -void CJS_EventHandler::OnField_MouseUp(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_EventHandler::OnField_MouseUp(bool bModifier, + bool bShift, CPDF_FormField* pTarget) { Initial(JET_FIELD_MOUSEUP); @@ -143,8 +143,8 @@ void CJS_EventHandler::OnField_MouseUp(FX_BOOL bModifier, m_strTargetName = pTarget->GetFullName(); } -void CJS_EventHandler::OnField_Focus(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_EventHandler::OnField_Focus(bool bModifier, + bool bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) { Initial(JET_FIELD_FOCUS); @@ -155,8 +155,8 @@ void CJS_EventHandler::OnField_Focus(FX_BOOL bModifier, m_pValue = (CFX_WideString*)&Value; } -void CJS_EventHandler::OnField_Blur(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_EventHandler::OnField_Blur(bool bModifier, + bool bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) { Initial(JET_FIELD_BLUR); @@ -169,16 +169,16 @@ void CJS_EventHandler::OnField_Blur(FX_BOOL bModifier, void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange, const CFX_WideString& strChangeEx, - FX_BOOL KeyDown, - FX_BOOL bModifier, + bool KeyDown, + bool bModifier, int& nSelEnd, int& nSelStart, - FX_BOOL bShift, + bool bShift, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL bWillCommit, - FX_BOOL bFieldFull, - FX_BOOL& bRc) { + bool bWillCommit, + bool bFieldFull, + bool& bRc) { Initial(JET_FIELD_KEYSTROKE); m_nCommitKey = 0; @@ -198,12 +198,12 @@ void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange, void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, - FX_BOOL bKeyDown, - FX_BOOL bModifier, - FX_BOOL bShift, + bool bKeyDown, + bool bModifier, + bool bShift, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL& bRc) { + bool& bRc) { Initial(JET_FIELD_VALIDATE); m_pWideStrChange = &strChange; @@ -219,7 +219,7 @@ void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange, void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL& bRc) { + bool& bRc) { Initial(JET_FIELD_CALCULATE); if (pSource) @@ -231,7 +231,7 @@ void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource, void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL bWillCommit) { + bool bWillCommit) { Initial(JET_FIELD_FORMAT); m_nCommitKey = 0; @@ -240,8 +240,8 @@ void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget, m_bWillCommit = bWillCommit; } -void CJS_EventHandler::OnScreen_Focus(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_EventHandler::OnScreen_Focus(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { Initial(JET_SCREEN_FOCUS); @@ -250,8 +250,8 @@ void CJS_EventHandler::OnScreen_Focus(FX_BOOL bModifier, m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_Blur(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_EventHandler::OnScreen_Blur(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { Initial(JET_SCREEN_BLUR); @@ -260,8 +260,8 @@ void CJS_EventHandler::OnScreen_Blur(FX_BOOL bModifier, m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_Open(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_EventHandler::OnScreen_Open(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { Initial(JET_SCREEN_OPEN); @@ -270,8 +270,8 @@ void CJS_EventHandler::OnScreen_Open(FX_BOOL bModifier, m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_Close(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_EventHandler::OnScreen_Close(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { Initial(JET_SCREEN_CLOSE); @@ -280,8 +280,8 @@ void CJS_EventHandler::OnScreen_Close(FX_BOOL bModifier, m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_MouseDown(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_EventHandler::OnScreen_MouseDown(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { Initial(JET_SCREEN_MOUSEDOWN); @@ -290,8 +290,8 @@ void CJS_EventHandler::OnScreen_MouseDown(FX_BOOL bModifier, m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_MouseUp(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_EventHandler::OnScreen_MouseUp(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { Initial(JET_SCREEN_MOUSEUP); @@ -300,8 +300,8 @@ void CJS_EventHandler::OnScreen_MouseUp(FX_BOOL bModifier, m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_MouseEnter(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_EventHandler::OnScreen_MouseEnter(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { Initial(JET_SCREEN_MOUSEENTER); @@ -310,8 +310,8 @@ void CJS_EventHandler::OnScreen_MouseEnter(FX_BOOL bModifier, m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_MouseExit(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_EventHandler::OnScreen_MouseExit(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { Initial(JET_SCREEN_MOUSEEXIT); @@ -320,8 +320,8 @@ void CJS_EventHandler::OnScreen_MouseExit(FX_BOOL bModifier, m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_InView(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_EventHandler::OnScreen_InView(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { Initial(JET_SCREEN_INVIEW); @@ -330,8 +330,8 @@ void CJS_EventHandler::OnScreen_InView(FX_BOOL bModifier, m_pTargetAnnot = pScreen; } -void CJS_EventHandler::OnScreen_OutView(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_EventHandler::OnScreen_OutView(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { Initial(JET_SCREEN_OUTVIEW); @@ -383,31 +383,31 @@ void CJS_EventHandler::Initial(JS_EVENT_T type) { m_WideStrChangeDu = L""; m_WideStrChangeEx = L""; m_nCommitKey = -1; - m_bKeyDown = FALSE; - m_bModifier = FALSE; - m_bShift = FALSE; + m_bKeyDown = false; + m_bModifier = false; + m_bShift = false; m_pISelEnd = nullptr; m_nSelEndDu = 0; m_pISelStart = nullptr; m_nSelStartDu = 0; - m_bWillCommit = FALSE; + m_bWillCommit = false; m_pValue = nullptr; - m_bFieldFull = FALSE; + m_bFieldFull = false; m_pbRc = nullptr; - m_bRcDu = FALSE; + m_bRcDu = false; m_pTargetBookMark = nullptr; m_pTargetFormFillEnv = nullptr; m_pTargetAnnot = nullptr; - m_bValid = TRUE; + m_bValid = true; } void CJS_EventHandler::Destroy() { - m_bValid = FALSE; + m_bValid = false; } -FX_BOOL CJS_EventHandler::IsValid() { +bool CJS_EventHandler::IsValid() { return m_bValid; } @@ -426,15 +426,15 @@ int CJS_EventHandler::CommitKey() { return m_nCommitKey; } -FX_BOOL CJS_EventHandler::FieldFull() { +bool CJS_EventHandler::FieldFull() { return m_bFieldFull; } -FX_BOOL CJS_EventHandler::KeyDown() { +bool CJS_EventHandler::KeyDown() { return m_bKeyDown; } -FX_BOOL CJS_EventHandler::Modifier() { +bool CJS_EventHandler::Modifier() { return m_bModifier; } @@ -564,7 +564,7 @@ const FX_WCHAR* CJS_EventHandler::Type() { } } -FX_BOOL& CJS_EventHandler::Rc() { +bool& CJS_EventHandler::Rc() { if (m_pbRc) { return *m_pbRc; } @@ -585,7 +585,7 @@ int& CJS_EventHandler::SelStart() { return m_nSelStartDu; } -FX_BOOL CJS_EventHandler::Shift() { +bool CJS_EventHandler::Shift() { return m_bShift; } @@ -641,7 +641,7 @@ CFX_WideString& CJS_EventHandler::Value() { return *m_pValue; } -FX_BOOL CJS_EventHandler::WillCommit() { +bool CJS_EventHandler::WillCommit() { return m_bWillCommit; } diff --git a/fpdfsdk/javascript/JS_EventHandler.h b/fpdfsdk/javascript/JS_EventHandler.h index 666ef8410d..fb0e637f5f 100644 --- a/fpdfsdk/javascript/JS_EventHandler.h +++ b/fpdfsdk/javascript/JS_EventHandler.h @@ -81,78 +81,54 @@ class CJS_EventHandler { void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL& bRc); + bool& bRc); void OnField_Format(CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL bWillCommit); + bool bWillCommit); void OnField_Keystroke(CFX_WideString& strChange, const CFX_WideString& strChangeEx, - FX_BOOL KeyDown, - FX_BOOL bModifier, + bool KeyDown, + bool bModifier, int& nSelEnd, int& nSelStart, - FX_BOOL bShift, + bool bShift, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL bWillCommit, - FX_BOOL bFieldFull, - FX_BOOL& bRc); + bool bWillCommit, + bool bFieldFull, + bool& bRc); void OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, - FX_BOOL bKeyDown, - FX_BOOL bModifier, - FX_BOOL bShift, + bool bKeyDown, + bool bModifier, + bool bShift, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL& bRc); - - void OnField_MouseDown(FX_BOOL bModifier, - FX_BOOL bShift, - CPDF_FormField* pTarget); - void OnField_MouseEnter(FX_BOOL bModifier, - FX_BOOL bShift, - CPDF_FormField* pTarget); - void OnField_MouseExit(FX_BOOL bModifier, - FX_BOOL bShift, - CPDF_FormField* pTarget); - void OnField_MouseUp(FX_BOOL bModifier, - FX_BOOL bShift, - CPDF_FormField* pTarget); - void OnField_Blur(FX_BOOL bModifier, - FX_BOOL bShift, + bool& bRc); + + void OnField_MouseDown(bool bModifier, bool bShift, CPDF_FormField* pTarget); + void OnField_MouseEnter(bool bModifier, bool bShift, CPDF_FormField* pTarget); + void OnField_MouseExit(bool bModifier, bool bShift, CPDF_FormField* pTarget); + void OnField_MouseUp(bool bModifier, bool bShift, CPDF_FormField* pTarget); + void OnField_Blur(bool bModifier, + bool bShift, CPDF_FormField* pTarget, const CFX_WideString& Value); - void OnField_Focus(FX_BOOL bModifier, - FX_BOOL bShift, + void OnField_Focus(bool bModifier, + bool bShift, CPDF_FormField* pTarget, const CFX_WideString& Value); - void OnScreen_Focus(FX_BOOL bModifier, - FX_BOOL bShift, - CPDFSDK_Annot* pScreen); - void OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen); - void OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen); - void OnScreen_Close(FX_BOOL bModifier, - FX_BOOL bShift, - CPDFSDK_Annot* pScreen); - void OnScreen_MouseDown(FX_BOOL bModifier, - FX_BOOL bShift, - CPDFSDK_Annot* pScreen); - void OnScreen_MouseUp(FX_BOOL bModifier, - FX_BOOL bShift, - CPDFSDK_Annot* pScreen); - void OnScreen_MouseEnter(FX_BOOL bModifier, - FX_BOOL bShift, - CPDFSDK_Annot* pScreen); - void OnScreen_MouseExit(FX_BOOL bModifier, - FX_BOOL bShift, - CPDFSDK_Annot* pScreen); - void OnScreen_InView(FX_BOOL bModifier, - FX_BOOL bShift, - CPDFSDK_Annot* pScreen); - void OnScreen_OutView(FX_BOOL bModifier, - FX_BOOL bShift, - CPDFSDK_Annot* pScreen); + void OnScreen_Focus(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen); + void OnScreen_Blur(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen); + void OnScreen_Open(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen); + void OnScreen_Close(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen); + void OnScreen_MouseDown(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen); + void OnScreen_MouseUp(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen); + void OnScreen_MouseEnter(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen); + void OnScreen_MouseExit(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen); + void OnScreen_InView(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen); + void OnScreen_OutView(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen); void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark); void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv); @@ -166,24 +142,24 @@ class CJS_EventHandler { public: void Initial(JS_EVENT_T type); void Destroy(); - FX_BOOL IsValid(); + bool IsValid(); CFX_WideString& Change(); CFX_WideString ChangeEx(); int CommitKey(); - FX_BOOL FieldFull(); - FX_BOOL KeyDown(); - FX_BOOL Modifier(); + bool FieldFull(); + bool KeyDown(); + bool Modifier(); const FX_WCHAR* Name(); const FX_WCHAR* Type(); - FX_BOOL& Rc(); + bool& Rc(); int& SelEnd(); int& SelStart(); - FX_BOOL Shift(); + bool Shift(); Field* Source(); Field* Target_Field(); CFX_WideString& Value(); - FX_BOOL WillCommit(); + bool WillCommit(); CFX_WideString TargetName(); JS_EVENT_T EventType() { return m_eEventType; } @@ -191,7 +167,7 @@ class CJS_EventHandler { public: CJS_Context* m_pJSContext; JS_EVENT_T m_eEventType; - FX_BOOL m_bValid; + bool m_bValid; CFX_WideString m_strTargetName; CFX_WideString m_strSourceName; @@ -199,18 +175,18 @@ class CJS_EventHandler { CFX_WideString m_WideStrChangeDu; CFX_WideString m_WideStrChangeEx; int m_nCommitKey; - FX_BOOL m_bKeyDown; - FX_BOOL m_bModifier; - FX_BOOL m_bShift; + bool m_bKeyDown; + bool m_bModifier; + bool m_bShift; int* m_pISelEnd; int m_nSelEndDu; int* m_pISelStart; int m_nSelStartDu; - FX_BOOL m_bWillCommit; + bool m_bWillCommit; CFX_WideString* m_pValue; - FX_BOOL m_bFieldFull; - FX_BOOL* m_pbRc; - FX_BOOL m_bRcDu; + bool m_bFieldFull; + bool* m_pbRc; + bool m_bRcDu; CPDF_Bookmark* m_pTargetBookMark; CPDFSDK_FormFillEnvironment* m_pTargetFormFillEnv; diff --git a/fpdfsdk/javascript/JS_GlobalData.cpp b/fpdfsdk/javascript/JS_GlobalData.cpp index 4e3782ec20..580cb466e6 100644 --- a/fpdfsdk/javascript/JS_GlobalData.cpp +++ b/fpdfsdk/javascript/JS_GlobalData.cpp @@ -179,32 +179,31 @@ void CJS_GlobalData::SetGlobalVariableNull(const CFX_ByteString& propname) { m_arrayGlobalData.push_back(std::move(pNewData)); } -FX_BOOL CJS_GlobalData::SetGlobalVariablePersistent( - const CFX_ByteString& propname, - FX_BOOL bPersistent) { +bool CJS_GlobalData::SetGlobalVariablePersistent(const CFX_ByteString& propname, + bool bPersistent) { CFX_ByteString sPropName(propname); if (!TrimPropName(&sPropName)) - return FALSE; + return false; CJS_GlobalData_Element* pData = GetGlobalVariable(sPropName); if (!pData) - return FALSE; + return false; pData->bPersistent = bPersistent; - return TRUE; + return true; } -FX_BOOL CJS_GlobalData::DeleteGlobalVariable(const CFX_ByteString& propname) { +bool CJS_GlobalData::DeleteGlobalVariable(const CFX_ByteString& propname) { CFX_ByteString sPropName(propname); if (!TrimPropName(&sPropName)) - return FALSE; + return false; auto iter = FindGlobalVariable(sPropName); if (iter == m_arrayGlobalData.end()) - return FALSE; + return false; m_arrayGlobalData.erase(iter); - return TRUE; + return true; } int32_t CJS_GlobalData::GetSize() const { @@ -274,13 +273,13 @@ void CJS_GlobalData::LoadGlobalPersistentVariables() { } break; } SetGlobalVariableNumber(sEntry, dData); - SetGlobalVariablePersistent(sEntry, TRUE); + SetGlobalVariablePersistent(sEntry, true); } break; case JS_GlobalDataType::BOOLEAN: { uint16_t wData = *((uint16_t*)p); p += sizeof(uint16_t); SetGlobalVariableBoolean(sEntry, (bool)(wData == 1)); - SetGlobalVariablePersistent(sEntry, TRUE); + SetGlobalVariablePersistent(sEntry, true); } break; case JS_GlobalDataType::STRING: { uint32_t dwLength = *((uint32_t*)p); @@ -290,12 +289,12 @@ void CJS_GlobalData::LoadGlobalPersistentVariables() { break; SetGlobalVariableString(sEntry, CFX_ByteString(p, dwLength)); - SetGlobalVariablePersistent(sEntry, TRUE); + SetGlobalVariablePersistent(sEntry, true); p += sizeof(char) * dwLength; } break; case JS_GlobalDataType::NULLOBJ: { SetGlobalVariableNull(sEntry); - SetGlobalVariablePersistent(sEntry, TRUE); + SetGlobalVariablePersistent(sEntry, true); } case JS_GlobalDataType::OBJECT: break; diff --git a/fpdfsdk/javascript/JS_GlobalData.h b/fpdfsdk/javascript/JS_GlobalData.h index 7005134423..c8947cd580 100644 --- a/fpdfsdk/javascript/JS_GlobalData.h +++ b/fpdfsdk/javascript/JS_GlobalData.h @@ -21,7 +21,7 @@ class CJS_GlobalData_Element { ~CJS_GlobalData_Element() {} CJS_KeyValue data; - FX_BOOL bPersistent; + bool bPersistent; }; class CJS_GlobalData { @@ -36,9 +36,9 @@ class CJS_GlobalData { void SetGlobalVariableObject(const CFX_ByteString& propname, const CJS_GlobalVariableArray& array); void SetGlobalVariableNull(const CFX_ByteString& propname); - FX_BOOL SetGlobalVariablePersistent(const CFX_ByteString& propname, - FX_BOOL bPersistent); - FX_BOOL DeleteGlobalVariable(const CFX_ByteString& propname); + bool SetGlobalVariablePersistent(const CFX_ByteString& propname, + bool bPersistent); + bool DeleteGlobalVariable(const CFX_ByteString& propname); int32_t GetSize() const; CJS_GlobalData_Element* GetAt(int index) const; diff --git a/fpdfsdk/javascript/JS_Runtime_Stub.cpp b/fpdfsdk/javascript/JS_Runtime_Stub.cpp index e7853fba7a..1daee4d734 100644 --- a/fpdfsdk/javascript/JS_Runtime_Stub.cpp +++ b/fpdfsdk/javascript/JS_Runtime_Stub.cpp @@ -16,9 +16,8 @@ class CJS_ContextStub final : public IJS_Context { ~CJS_ContextStub() override {} // IJS_Context: - FX_BOOL RunScript(const CFX_WideString& script, - CFX_WideString* info) override { - return FALSE; + bool RunScript(const CFX_WideString& script, CFX_WideString* info) override { + return false; } void OnApp_Init() override {} @@ -33,82 +32,82 @@ class CJS_ContextStub final : public IJS_Context { void OnPage_Close(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {} void OnPage_InView(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {} void OnPage_OutView(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {} - void OnField_MouseDown(FX_BOOL bModifier, - FX_BOOL bShift, + void OnField_MouseDown(bool bModifier, + bool bShift, CPDF_FormField* pTarget) override {} - void OnField_MouseEnter(FX_BOOL bModifier, - FX_BOOL bShift, + void OnField_MouseEnter(bool bModifier, + bool bShift, CPDF_FormField* pTarget) override {} - void OnField_MouseExit(FX_BOOL bModifier, - FX_BOOL bShift, + void OnField_MouseExit(bool bModifier, + bool bShift, CPDF_FormField* pTarget) override {} - void OnField_MouseUp(FX_BOOL bModifier, - FX_BOOL bShift, + void OnField_MouseUp(bool bModifier, + bool bShift, CPDF_FormField* pTarget) override {} - void OnField_Focus(FX_BOOL bModifier, - FX_BOOL bShift, + void OnField_Focus(bool bModifier, + bool bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) override {} - void OnField_Blur(FX_BOOL bModifier, - FX_BOOL bShift, + void OnField_Blur(bool bModifier, + bool bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) override {} void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL& bRc) override {} + bool& bRc) override {} void OnField_Format(CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL bWillCommit) override {} + bool bWillCommit) override {} void OnField_Keystroke(CFX_WideString& strChange, const CFX_WideString& strChangeEx, - FX_BOOL KeyDown, - FX_BOOL bModifier, + bool KeyDown, + bool bModifier, int& nSelEnd, int& nSelStart, - FX_BOOL bShift, + bool bShift, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL bWillCommit, - FX_BOOL bFieldFull, - FX_BOOL& bRc) override {} + bool bWillCommit, + bool bFieldFull, + bool& bRc) override {} void OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, - FX_BOOL bKeyDown, - FX_BOOL bModifier, - FX_BOOL bShift, + bool bKeyDown, + bool bModifier, + bool bShift, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL& bRc) override {} - void OnScreen_Focus(FX_BOOL bModifier, - FX_BOOL bShift, + bool& bRc) override {} + void OnScreen_Focus(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override {} - void OnScreen_Blur(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_Blur(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override {} - void OnScreen_Open(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_Open(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override {} - void OnScreen_Close(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_Close(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override {} - void OnScreen_MouseDown(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_MouseDown(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override {} - void OnScreen_MouseUp(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_MouseUp(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override {} - void OnScreen_MouseEnter(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_MouseEnter(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override {} - void OnScreen_MouseExit(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_MouseExit(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override {} - void OnScreen_InView(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_InView(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override {} - void OnScreen_OutView(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_OutView(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override {} void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) override {} void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {} @@ -139,12 +138,12 @@ class CJS_RuntimeStub final : public IJS_Runtime { } #ifdef PDF_ENABLE_XFA - FX_BOOL GetValueByName(const CFX_ByteStringC&, CFXJSE_Value*) override { - return FALSE; + bool GetValueByName(const CFX_ByteStringC&, CFXJSE_Value*) override { + return false; } - FX_BOOL SetValueByName(const CFX_ByteStringC&, CFXJSE_Value*) override { - return FALSE; + bool SetValueByName(const CFX_ByteStringC&, CFXJSE_Value*) override { + return false; } #endif // PDF_ENABLE_XFA diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp index 2310200084..0173bb3ff5 100644 --- a/fpdfsdk/javascript/PublicMethods.cpp +++ b/fpdfsdk/javascript/PublicMethods.cpp @@ -335,8 +335,8 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value, int nYearSub = 99; // nYear - 2000; - FX_BOOL bPm = FALSE; - FX_BOOL bExit = FALSE; + bool bPm = false; + bool bExit = false; bool bBadFormat = false; int i = 0; @@ -459,13 +459,13 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value, switch (c) { case 'm': { CFX_WideString sMonth = ParseStringString(value, j, nSkip); - FX_BOOL bFind = FALSE; + bool bFind = false; for (int m = 0; m < 12; m++) { if (sMonth.CompareNoCase(months[m]) == 0) { nMonth = m + 1; i += 3; j += nSkip; - bFind = TRUE; + bFind = true; break; } } @@ -491,7 +491,7 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value, i += 4; break; case 'm': { - FX_BOOL bFind = FALSE; + bool bFind = false; CFX_WideString sMonth = ParseStringString(value, j, nSkip); sMonth.MakeLower(); @@ -504,7 +504,7 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value, nMonth = m + 1; i += 4; j += nSkip; - bFind = TRUE; + bFind = true; break; } } @@ -523,7 +523,7 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value, } else { if (j >= value.GetLength() || format.GetAt(i) != value.GetAt(j)) { bBadFormat = true; - bExit = TRUE; + bExit = true; } i++; j++; @@ -531,17 +531,17 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value, if (oldj == j) { bBadFormat = true; - bExit = TRUE; + bExit = true; } } break; default: if (value.GetLength() <= j) { - bExit = TRUE; + bExit = true; } else if (format.GetAt(i) != value.GetAt(j)) { bBadFormat = true; - bExit = TRUE; + bExit = true; } i++; @@ -723,33 +723,33 @@ CFX_WideString CJS_PublicMethods::MakeFormatDate(double dDate, // function AFNumber_Format(nDec, sepStyle, negStyle, currStyle, strCurrency, // bCurrencyPrepend) -FX_BOOL CJS_PublicMethods::AFNumber_Format(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFNumber_Format(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { #if _FX_OS_ != _FX_ANDROID_ if (params.size() != 6) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Context* pContext = static_cast<CJS_Context*>(cc); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); CJS_EventHandler* pEvent = pContext->GetEventHandler(); if (!pEvent->m_pValue) - return FALSE; + return false; CFX_WideString& Value = pEvent->Value(); CFX_ByteString strValue = StrTrim(CFX_ByteString::FromUnicode(Value)); if (strValue.IsEmpty()) - return TRUE; + return true; int iDec = params[0].ToInt(pRuntime); int iSepStyle = params[1].ToInt(pRuntime); int iNegStyle = params[2].ToInt(pRuntime); // params[3] is iCurrStyle, it's not used. CFX_WideString wstrCurrency = params[4].ToCFXWideString(pRuntime); - FX_BOOL bCurrencyPrepend = params[5].ToBool(pRuntime); + bool bCurrencyPrepend = params[5].ToBool(pRuntime); if (iDec < 0) iDec = -iDec; @@ -888,24 +888,23 @@ FX_BOOL CJS_PublicMethods::AFNumber_Format(IJS_Context* cc, } } #endif - return TRUE; + return true; } // function AFNumber_Keystroke(nDec, sepStyle, negStyle, currStyle, strCurrency, // bCurrencyPrepend) -FX_BOOL CJS_PublicMethods::AFNumber_Keystroke( - IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFNumber_Keystroke(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { CJS_Context* pContext = static_cast<CJS_Context*>(cc); CJS_EventHandler* pEvent = pContext->GetEventHandler(); if (params.size() < 2) - return FALSE; + return false; if (!pEvent->m_pValue) - return FALSE; + return false; CFX_WideString& val = pEvent->Value(); CFX_WideString& wstrChange = pEvent->Change(); @@ -914,15 +913,15 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke( if (pEvent->WillCommit()) { CFX_WideString swTemp = StrTrim(wstrValue); if (swTemp.IsEmpty()) - return TRUE; + return true; swTemp.Replace(L",", L"."); if (!IsNumber(swTemp.c_str())) { - pEvent->Rc() = FALSE; + pEvent->Rc() = false; sError = JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE); AlertIfPossible(pContext, sError.c_str()); } - return TRUE; // it happens after the last keystroke and before validating, + return true; // it happens after the last keystroke and before validating, } CFX_WideString wstrSelected; @@ -935,9 +934,9 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke( if (bHasSign) { // can't insert "change" in front to sign postion. if (pEvent->SelStart() == 0) { - FX_BOOL& bRc = pEvent->Rc(); - bRc = FALSE; - return TRUE; + bool& bRc = pEvent->Rc(); + bRc = false; + return true; } } @@ -951,38 +950,38 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke( for (FX_STRSIZE i = 0; i < wstrChange.GetLength(); ++i) { if (wstrChange[i] == cSep) { if (bHasSep) { - FX_BOOL& bRc = pEvent->Rc(); - bRc = FALSE; - return TRUE; + bool& bRc = pEvent->Rc(); + bRc = false; + return true; } - bHasSep = TRUE; + bHasSep = true; continue; } if (wstrChange[i] == L'-') { if (bHasSign) { - FX_BOOL& bRc = pEvent->Rc(); - bRc = FALSE; - return TRUE; + bool& bRc = pEvent->Rc(); + bRc = false; + return true; } // sign's position is not correct if (i != 0) { - FX_BOOL& bRc = pEvent->Rc(); - bRc = FALSE; - return TRUE; + bool& bRc = pEvent->Rc(); + bRc = false; + return true; } if (pEvent->SelStart() != 0) { - FX_BOOL& bRc = pEvent->Rc(); - bRc = FALSE; - return TRUE; + bool& bRc = pEvent->Rc(); + bRc = false; + return true; } - bHasSign = TRUE; + bHasSign = true; continue; } if (!FXSYS_iswdigit(wstrChange[i])) { - FX_BOOL& bRc = pEvent->Rc(); - bRc = FALSE; - return TRUE; + bool& bRc = pEvent->Rc(); + bRc = false; + return true; } } @@ -991,15 +990,14 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke( if (pEvent->SelEnd() < wstrValue.GetLength()) wpostfix = wstrValue.Mid(pEvent->SelEnd()); val = wprefix + wstrChange + wpostfix; - return TRUE; + return true; } // function AFPercent_Format(nDec, sepStyle) -FX_BOOL CJS_PublicMethods::AFPercent_Format( - IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFPercent_Format(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { #if _FX_OS_ != _FX_ANDROID_ CJS_Context* pContext = static_cast<CJS_Context*>(cc); CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); @@ -1007,15 +1005,15 @@ FX_BOOL CJS_PublicMethods::AFPercent_Format( if (params.size() != 2) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } if (!pEvent->m_pValue) - return FALSE; + return false; CFX_WideString& Value = pEvent->Value(); CFX_ByteString strValue = StrTrim(CFX_ByteString::FromUnicode(Value)); if (strValue.IsEmpty()) - return TRUE; + return true; int iDec = params[0].ToInt(pRuntime); if (iDec < 0) @@ -1085,10 +1083,10 @@ FX_BOOL CJS_PublicMethods::AFPercent_Format( strValue += "%"; Value = CFX_WideString::FromLocal(strValue.AsStringC()); #endif - return TRUE; + return true; } // AFPercent_Keystroke(nDec, sepStyle) -FX_BOOL CJS_PublicMethods::AFPercent_Keystroke( +bool CJS_PublicMethods::AFPercent_Keystroke( IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, @@ -1097,25 +1095,25 @@ FX_BOOL CJS_PublicMethods::AFPercent_Keystroke( } // function AFDate_FormatEx(cFormat) -FX_BOOL CJS_PublicMethods::AFDate_FormatEx(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFDate_FormatEx(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { CJS_Context* pContext = static_cast<CJS_Context*>(cc); CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); CJS_EventHandler* pEvent = pContext->GetEventHandler(); if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } if (!pEvent->m_pValue) - return FALSE; + return false; CFX_WideString& val = pEvent->Value(); CFX_WideString strValue = val; if (strValue.IsEmpty()) - return TRUE; + return true; CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime); double dDate = 0.0f; @@ -1133,11 +1131,11 @@ FX_BOOL CJS_PublicMethods::AFDate_FormatEx(IJS_Context* cc, swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(), sFormat.c_str()); AlertIfPossible(pContext, swMsg.c_str()); - return FALSE; + return false; } val = MakeFormatDate(dDate, sFormat); - return TRUE; + return true; } double CJS_PublicMethods::MakeInterDate(const CFX_WideString& strValue) { @@ -1197,49 +1195,48 @@ double CJS_PublicMethods::MakeInterDate(const CFX_WideString& strValue) { } // AFDate_KeystrokeEx(cFormat) -FX_BOOL CJS_PublicMethods::AFDate_KeystrokeEx( - IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFDate_KeystrokeEx(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); CJS_EventHandler* pEvent = pContext->GetEventHandler(); if (params.size() != 1) { sError = L"AFDate_KeystrokeEx's parameters' size r not correct"; - return FALSE; + return false; } if (pEvent->WillCommit()) { if (!pEvent->m_pValue) - return FALSE; + return false; CFX_WideString strValue = pEvent->Value(); if (strValue.IsEmpty()) - return TRUE; + return true; CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime); - bool bWrongFormat = FALSE; + bool bWrongFormat = false; double dRet = MakeRegularDate(strValue, sFormat, &bWrongFormat); if (bWrongFormat || JS_PortIsNan(dRet)) { CFX_WideString swMsg; swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(), sFormat.c_str()); AlertIfPossible(pContext, swMsg.c_str()); - pEvent->Rc() = FALSE; - return TRUE; + pEvent->Rc() = false; + return true; } } - return TRUE; + return true; } -FX_BOOL CJS_PublicMethods::AFDate_Format(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFDate_Format(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); @@ -1269,14 +1266,13 @@ FX_BOOL CJS_PublicMethods::AFDate_Format(IJS_Context* cc, } // AFDate_KeystrokeEx(cFormat) -FX_BOOL CJS_PublicMethods::AFDate_Keystroke( - IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFDate_Keystroke(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); @@ -1306,13 +1302,13 @@ FX_BOOL CJS_PublicMethods::AFDate_Keystroke( } // function AFTime_Format(ptf) -FX_BOOL CJS_PublicMethods::AFTime_Format(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFTime_Format(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); @@ -1329,14 +1325,13 @@ FX_BOOL CJS_PublicMethods::AFTime_Format(IJS_Context* cc, return AFDate_FormatEx(cc, newParams, vRet, sError); } -FX_BOOL CJS_PublicMethods::AFTime_Keystroke( - IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFTime_Keystroke(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); @@ -1353,36 +1348,34 @@ FX_BOOL CJS_PublicMethods::AFTime_Keystroke( return AFDate_KeystrokeEx(cc, newParams, vRet, sError); } -FX_BOOL CJS_PublicMethods::AFTime_FormatEx(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFTime_FormatEx(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { return AFDate_FormatEx(cc, params, vRet, sError); } -FX_BOOL CJS_PublicMethods::AFTime_KeystrokeEx( - IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFTime_KeystrokeEx(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { return AFDate_KeystrokeEx(cc, params, vRet, sError); } // function AFSpecial_Format(psf) -FX_BOOL CJS_PublicMethods::AFSpecial_Format( - IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFSpecial_Format(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Context* pContext = static_cast<CJS_Context*>(cc); CJS_EventHandler* pEvent = pContext->GetEventHandler(); if (!pEvent->m_pValue) - return FALSE; + return false; CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); CFX_WideString wsSource = pEvent->Value(); @@ -1406,11 +1399,11 @@ FX_BOOL CJS_PublicMethods::AFSpecial_Format( } pEvent->Value() = util::printx(wsFormat, wsSource); - return TRUE; + return true; } // function AFSpecial_KeystrokeEx(mask) -FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx( +bool CJS_PublicMethods::AFSpecial_KeystrokeEx( IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, @@ -1421,20 +1414,20 @@ FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx( if (params.size() < 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } if (!pEvent->m_pValue) - return FALSE; + return false; CFX_WideString& valEvent = pEvent->Value(); CFX_WideString wstrMask = params[0].ToCFXWideString(pRuntime); if (wstrMask.IsEmpty()) - return TRUE; + return true; if (pEvent->WillCommit()) { if (valEvent.IsEmpty()) - return TRUE; + return true; FX_STRSIZE iIndexMask = 0; for (; iIndexMask < valEvent.GetLength(); ++iIndexMask) { @@ -1446,14 +1439,14 @@ FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx( (iIndexMask != valEvent.GetLength() && wstrMask.GetLength() != 0)) { AlertIfPossible( pContext, JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE).c_str()); - pEvent->Rc() = FALSE; + pEvent->Rc() = false; } - return TRUE; + return true; } CFX_WideString& wideChange = pEvent->Change(); if (wideChange.IsEmpty()) - return TRUE; + return true; CFX_WideString wChange = wideChange; FX_STRSIZE iIndexMask = pEvent->SelStart(); @@ -1462,53 +1455,53 @@ FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx( if (combined_len > wstrMask.GetLength()) { AlertIfPossible(pContext, JSGetStringFromID(IDS_STRING_JSPARAM_TOOLONG).c_str()); - pEvent->Rc() = FALSE; - return TRUE; + pEvent->Rc() = false; + return true; } if (iIndexMask >= wstrMask.GetLength() && !wChange.IsEmpty()) { AlertIfPossible(pContext, JSGetStringFromID(IDS_STRING_JSPARAM_TOOLONG).c_str()); - pEvent->Rc() = FALSE; - return TRUE; + pEvent->Rc() = false; + return true; } for (FX_STRSIZE i = 0; i < wChange.GetLength(); ++i) { if (iIndexMask >= wstrMask.GetLength()) { AlertIfPossible(pContext, JSGetStringFromID(IDS_STRING_JSPARAM_TOOLONG).c_str()); - pEvent->Rc() = FALSE; - return TRUE; + pEvent->Rc() = false; + return true; } FX_WCHAR wMask = wstrMask[iIndexMask]; if (!isReservedMaskChar(wMask)) wChange.SetAt(i, wMask); if (!maskSatisfied(wChange[i], wMask)) { - pEvent->Rc() = FALSE; - return TRUE; + pEvent->Rc() = false; + return true; } iIndexMask++; } wideChange = wChange; - return TRUE; + return true; } // function AFSpecial_Keystroke(psf) -FX_BOOL CJS_PublicMethods::AFSpecial_Keystroke( +bool CJS_PublicMethods::AFSpecial_Keystroke( IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Context* pContext = static_cast<CJS_Context*>(cc); CJS_EventHandler* pEvent = pContext->GetEventHandler(); if (!pEvent->m_pValue) - return FALSE; + return false; const char* cFormat = ""; CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); @@ -1535,13 +1528,13 @@ FX_BOOL CJS_PublicMethods::AFSpecial_Keystroke( return AFSpecial_KeystrokeEx(cc, params2, vRet, sError); } -FX_BOOL CJS_PublicMethods::AFMergeChange(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFMergeChange(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Context* pContext = static_cast<CJS_Context*>(cc); @@ -1554,7 +1547,7 @@ FX_BOOL CJS_PublicMethods::AFMergeChange(IJS_Context* cc, if (pEventHandler->WillCommit()) { vRet = CJS_Value(pRuntime, swValue.c_str()); - return TRUE; + return true; } CFX_WideString prefix, postfix; @@ -1573,16 +1566,16 @@ FX_BOOL CJS_PublicMethods::AFMergeChange(IJS_Context* cc, vRet = CJS_Value(pRuntime, (prefix + pEventHandler->Change() + postfix).c_str()); - return TRUE; + return true; } -FX_BOOL CJS_PublicMethods::AFParseDateEx(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFParseDateEx(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 2) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); @@ -1596,20 +1589,20 @@ FX_BOOL CJS_PublicMethods::AFParseDateEx(IJS_Context* cc, swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(), sFormat.c_str()); AlertIfPossible((CJS_Context*)cc, swMsg.c_str()); - return FALSE; + return false; } vRet = CJS_Value(pRuntime, dDate); - return TRUE; + return true; } -FX_BOOL CJS_PublicMethods::AFSimple(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFSimple(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 3) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); @@ -1618,16 +1611,16 @@ FX_BOOL CJS_PublicMethods::AFSimple(IJS_Context* cc, params[1].ToDouble(pRuntime), params[2].ToDouble(pRuntime)))); - return TRUE; + return true; } -FX_BOOL CJS_PublicMethods::AFMakeNumber(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFMakeNumber(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); @@ -1637,23 +1630,22 @@ FX_BOOL CJS_PublicMethods::AFMakeNumber(IJS_Context* cc, vRet.MaybeCoerceToNumber(pRuntime); if (vRet.GetType() != CJS_Value::VT_number) vRet = CJS_Value(pRuntime, 0); - return TRUE; + return true; } -FX_BOOL CJS_PublicMethods::AFSimple_Calculate( - IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFSimple_Calculate(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 2) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Value params1 = params[1]; if (!params1.IsArrayObject() && params1.GetType() != CJS_Value::VT_string) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Context* pContext = static_cast<CJS_Context*>(cc); @@ -1734,35 +1726,34 @@ FX_BOOL CJS_PublicMethods::AFSimple_Calculate( if (pContext->GetEventHandler()->m_pValue) pContext->GetEventHandler()->Value() = jsValue.ToCFXWideString(pRuntime); - return TRUE; + return true; } /* This function validates the current event to ensure that its value is ** within the specified range. */ -FX_BOOL CJS_PublicMethods::AFRange_Validate( - IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFRange_Validate(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 4) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Context* pContext = static_cast<CJS_Context*>(cc); CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); CJS_EventHandler* pEvent = pContext->GetEventHandler(); if (!pEvent->m_pValue) - return FALSE; + return false; if (pEvent->Value().IsEmpty()) - return TRUE; + return true; double dEentValue = atof(CFX_ByteString::FromUnicode(pEvent->Value()).c_str()); - FX_BOOL bGreaterThan = params[0].ToBool(pRuntime); + bool bGreaterThan = params[0].ToBool(pRuntime); double dGreaterThan = params[1].ToDouble(pRuntime); - FX_BOOL bLessThan = params[2].ToBool(pRuntime); + bool bLessThan = params[2].ToBool(pRuntime); double dLessThan = params[3].ToDouble(pRuntime); CFX_WideString swMsg; @@ -1783,18 +1774,18 @@ FX_BOOL CJS_PublicMethods::AFRange_Validate( if (!swMsg.IsEmpty()) { AlertIfPossible(pContext, swMsg.c_str()); - pEvent->Rc() = FALSE; + pEvent->Rc() = false; } - return TRUE; + return true; } -FX_BOOL CJS_PublicMethods::AFExtractNums(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool CJS_PublicMethods::AFExtractNums(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); @@ -1828,5 +1819,5 @@ FX_BOOL CJS_PublicMethods::AFExtractNums(IJS_Context* cc, else vRet.SetNull(pRuntime); - return TRUE; + return true; } diff --git a/fpdfsdk/javascript/PublicMethods.h b/fpdfsdk/javascript/PublicMethods.h index 67ca082f31..0820c40c3e 100644 --- a/fpdfsdk/javascript/PublicMethods.h +++ b/fpdfsdk/javascript/PublicMethods.h @@ -18,94 +18,94 @@ class CJS_PublicMethods : public CJS_Object { : CJS_Object(pObject) {} ~CJS_PublicMethods() override {} - static FX_BOOL AFNumber_Format(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - static FX_BOOL AFNumber_Keystroke(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - static FX_BOOL AFPercent_Format(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - static FX_BOOL AFPercent_Keystroke(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - static FX_BOOL AFDate_FormatEx(IJS_Context* cc, + static bool AFNumber_Format(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + static bool AFNumber_Keystroke(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - static FX_BOOL AFDate_KeystrokeEx(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - static FX_BOOL AFDate_Format(IJS_Context* cc, + static bool AFPercent_Format(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - static FX_BOOL AFDate_Keystroke(IJS_Context* cc, + static bool AFPercent_Keystroke(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - static FX_BOOL AFTime_FormatEx(IJS_Context* cc, + static bool AFDate_FormatEx(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + static bool AFDate_KeystrokeEx(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, - CFX_WideString& sError); // - static FX_BOOL AFTime_KeystrokeEx(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - static FX_BOOL AFTime_Format(IJS_Context* cc, + CFX_WideString& sError); + static bool AFDate_Format(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + static bool AFDate_Keystroke(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - static FX_BOOL AFTime_Keystroke(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - static FX_BOOL AFSpecial_Format(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - static FX_BOOL AFSpecial_Keystroke(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - static FX_BOOL AFSpecial_KeystrokeEx(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); // - static FX_BOOL AFSimple(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - static FX_BOOL AFMakeNumber(IJS_Context* cc, + static bool AFTime_FormatEx(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, - CFX_WideString& sError); - static FX_BOOL AFSimple_Calculate(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - static FX_BOOL AFRange_Validate(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - static FX_BOOL AFMergeChange(IJS_Context* cc, + CFX_WideString& sError); // + static bool AFTime_KeystrokeEx(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + static bool AFTime_Format(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + static bool AFTime_Keystroke(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - static FX_BOOL AFParseDateEx(IJS_Context* cc, + static bool AFSpecial_Format(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - static FX_BOOL AFExtractNums(IJS_Context* cc, + static bool AFSpecial_Keystroke(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + static bool AFSpecial_KeystrokeEx(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); // + static bool AFSimple(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + static bool AFMakeNumber(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + static bool AFSimple_Calculate(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + static bool AFRange_Validate(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); + static bool AFMergeChange(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + static bool AFParseDateEx(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + static bool AFExtractNums(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); JS_STATIC_GLOBAL_FUN(AFNumber_Format); JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke); diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp index 4d79e41f7a..2b40de0423 100644 --- a/fpdfsdk/javascript/app.cpp +++ b/fpdfsdk/javascript/app.cpp @@ -209,11 +209,11 @@ app::app(CJS_Object* pJSObject) app::~app() { } -FX_BOOL app::activeDocs(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool app::activeDocs(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; CJS_Context* pContext = (CJS_Context*)cc; CJS_Runtime* pRuntime = pContext->GetJSRuntime(); @@ -231,126 +231,121 @@ FX_BOOL app::activeDocs(IJS_Context* cc, else vp.GetJSValue()->SetNull(pRuntime); - return TRUE; + return true; } -FX_BOOL app::calculate(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool app::calculate(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsSetting()) { bool bVP; vp >> bVP; - m_bCalculate = (FX_BOOL)bVP; + m_bCalculate = (bool)bVP; CJS_Context* pContext = (CJS_Context*)cc; - pContext->GetFormFillEnv() - ->GetInterForm() - ->EnableCalculate((FX_BOOL)m_bCalculate); + pContext->GetFormFillEnv()->GetInterForm()->EnableCalculate( + (bool)m_bCalculate); } else { vp << (bool)m_bCalculate; } - return TRUE; + return true; } -FX_BOOL app::formsVersion(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool app::formsVersion(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsGetting()) { vp << JS_NUM_FORMSVERSION; - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL app::viewerType(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool app::viewerType(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsGetting()) { vp << JS_STR_VIEWERTYPE; - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL app::viewerVariation(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool app::viewerVariation(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsGetting()) { vp << JS_STR_VIEWERVARIATION; - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL app::viewerVersion(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool app::viewerVersion(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; #ifdef PDF_ENABLE_XFA CJS_Context* pJSContext = static_cast<CJS_Context*>(cc); CPDFXFA_Context* pXFAContext = pJSContext->GetFormFillEnv()->GetXFAContext(); if (pXFAContext->GetDocType() == 1 || pXFAContext->GetDocType() == 2) { vp << JS_NUM_VIEWERVERSION_XFA; - return TRUE; + return true; } #endif // PDF_ENABLE_XFA vp << JS_NUM_VIEWERVERSION; - return TRUE; + return true; } -FX_BOOL app::platform(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool app::platform(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; #ifdef PDF_ENABLE_XFA CPDFSDK_FormFillEnvironment* pFormFillEnv = static_cast<CJS_Context*>(cc)->GetJSRuntime()->GetFormFillEnv(); if (!pFormFillEnv) - return FALSE; + return false; CFX_WideString platfrom = pFormFillEnv->GetPlatform(); if (!platfrom.IsEmpty()) { vp << platfrom; - return TRUE; + return true; } #endif vp << JS_STR_PLATFORM; - return TRUE; + return true; } -FX_BOOL app::language(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool app::language(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; #ifdef PDF_ENABLE_XFA CPDFSDK_FormFillEnvironment* pFormFillEnv = static_cast<CJS_Context*>(cc)->GetJSRuntime()->GetFormFillEnv(); if (!pFormFillEnv) - return FALSE; + return false; CFX_WideString language = pFormFillEnv->GetLanguage(); if (!language.IsEmpty()) { vp << language; - return TRUE; + return true; } #endif vp << JS_STR_LANGUAGE; - return TRUE; + return true; } // creates a new fdf object that contains no data // comment: need reader support // note: // CFDF_Document * CPDFSDK_FormFillEnvironment::NewFDF(); -FX_BOOL app::newFDF(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; +bool app::newFDF(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; } // opens a specified pdf document and returns its document object // comment:need reader support @@ -359,30 +354,30 @@ FX_BOOL app::newFDF(IJS_Context* cc, // CFDF_Document * CPDFSDK_FormFillEnvironment::OpenFDF(string strPath,bool // bUserConv); -FX_BOOL app::openFDF(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; +bool app::openFDF(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; } -FX_BOOL app::alert(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool app::alert(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); std::vector<CJS_Value> newParams = JS_ExpandKeywordParams( pRuntime, params, 4, L"cMsg", L"nIcon", L"nType", L"cTitle"); if (newParams[0].GetType() == CJS_Value::VT_unknown) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv(); if (!pFormFillEnv) { vRet = CJS_Value(pRuntime, 0); - return TRUE; + return true; } CFX_WideString swMsg; @@ -425,48 +420,48 @@ FX_BOOL app::alert(IJS_Context* cc, vRet = CJS_Value(pRuntime, pFormFillEnv->JS_appAlert( swMsg.c_str(), swTitle.c_str(), iType, iIcon)); pRuntime->EndBlock(); - return TRUE; + return true; } -FX_BOOL app::beep(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool app::beep(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() == 1) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); pRuntime->GetFormFillEnv()->JS_appBeep(params[0].ToInt(pRuntime)); - return TRUE; + return true; } sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } -FX_BOOL app::findComponent(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; +bool app::findComponent(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; } -FX_BOOL app::popUpMenuEx(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return FALSE; +bool app::popUpMenuEx(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return false; } -FX_BOOL app::fs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - return FALSE; +bool app::fs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { + return false; } -FX_BOOL app::setInterval(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool app::setInterval(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() > 2 || params.size() == 0) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); @@ -474,7 +469,7 @@ FX_BOOL app::setInterval(IJS_Context* cc, params.size() > 0 ? params[0].ToCFXWideString(pRuntime) : L""; if (script.IsEmpty()) { sError = JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE); - return TRUE; + return true; } uint32_t dwInterval = params.size() > 1 ? params[1].ToInt(pRuntime) : 1000; @@ -491,23 +486,23 @@ FX_BOOL app::setInterval(IJS_Context* cc, pTimerObj->SetTimer(timerRef); vRet = CJS_Value(pRuntime, pRetObj); - return TRUE; + return true; } -FX_BOOL app::setTimeOut(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool app::setTimeOut(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() > 2 || params.size() == 0) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); CFX_WideString script = params[0].ToCFXWideString(pRuntime); if (script.IsEmpty()) { sError = JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE); - return TRUE; + return true; } uint32_t dwTimeOut = params.size() > 1 ? params[1].ToInt(pRuntime) : 1000; @@ -526,33 +521,33 @@ FX_BOOL app::setTimeOut(IJS_Context* cc, pTimerObj->SetTimer(timerRef); vRet = CJS_Value(pRuntime, pRetObj); - return TRUE; + return true; } -FX_BOOL app::clearTimeOut(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool app::clearTimeOut(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } app::ClearTimerCommon(CJS_Runtime::FromContext(cc), params[0]); - return TRUE; + return true; } -FX_BOOL app::clearInterval(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool app::clearInterval(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } app::ClearTimerCommon(CJS_Runtime::FromContext(cc), params[0]); - return TRUE; + return true; } void app::ClearTimerCommon(CJS_Runtime* pRuntime, const CJS_Value& param) { @@ -574,11 +569,11 @@ void app::ClearTimerCommon(CJS_Runtime* pRuntime, const CJS_Value& param) { GlobalTimer::Cancel(pTimerObj->GetTimerID()); } -FX_BOOL app::execMenuItem(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return FALSE; +bool app::execMenuItem(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return false; } void app::TimerProc(GlobalTimer* pTimer) { @@ -601,26 +596,26 @@ void app::RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript) { } } -FX_BOOL app::goBack(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool app::goBack(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Not supported. - return TRUE; + return true; } -FX_BOOL app::goForward(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool app::goForward(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Not supported. - return TRUE; + return true; } -FX_BOOL app::mailMsg(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool app::mailMsg(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); std::vector<CJS_Value> newParams = JS_ExpandKeywordParams(pRuntime, params, 6, L"bUI", L"cTo", L"cCc", @@ -628,7 +623,7 @@ FX_BOOL app::mailMsg(IJS_Context* cc, if (newParams[0].GetType() == CJS_Value::VT_unknown) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } bool bUI = newParams[0].ToBool(pRuntime); @@ -639,7 +634,7 @@ FX_BOOL app::mailMsg(IJS_Context* cc, if (!bUI) { // cTo parameter required when UI not invoked. sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } } @@ -665,47 +660,47 @@ FX_BOOL app::mailMsg(IJS_Context* cc, cSubject.c_str(), cCc.c_str(), cBcc.c_str(), cMsg.c_str()); pRuntime->EndBlock(); - return TRUE; + return true; } -FX_BOOL app::launchURL(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool app::launchURL(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, not supported. - return TRUE; + return true; } -FX_BOOL app::runtimeHighlight(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool app::runtimeHighlight(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (vp.IsSetting()) { vp >> m_bRuntimeHighLight; } else { vp << m_bRuntimeHighLight; } - return TRUE; + return true; } -FX_BOOL app::fullscreen(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { - return FALSE; +bool app::fullscreen(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { + return false; } -FX_BOOL app::popUpMenu(IJS_Context* cc, +bool app::popUpMenu(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return false; +} + +bool app::browseForDoc(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - return FALSE; -} - -FX_BOOL app::browseForDoc(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { // Unsafe, not supported. - return TRUE; + return true; } CFX_WideString app::SysPathToPDFPath(const CFX_WideString& sOldPath) { @@ -726,24 +721,24 @@ CFX_WideString app::SysPathToPDFPath(const CFX_WideString& sOldPath) { return sRet; } -FX_BOOL app::newDoc(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return FALSE; +bool app::newDoc(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return false; } -FX_BOOL app::openDoc(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return FALSE; +bool app::openDoc(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return false; } -FX_BOOL app::response(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool app::response(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); std::vector<CJS_Value> newParams = JS_ExpandKeywordParams(pRuntime, params, 5, L"cQuestion", L"cTitle", @@ -751,7 +746,7 @@ FX_BOOL app::response(IJS_Context* cc, if (newParams[0].GetType() == CJS_Value::VT_unknown) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CFX_WideString swQuestion = newParams[0].ToCFXWideString(pRuntime); @@ -782,7 +777,7 @@ FX_BOOL app::response(IJS_Context* cc, if (nLengthBytes < 0 || nLengthBytes > MAX_INPUT_BYTES) { sError = JSGetStringFromID(IDS_STRING_JSPARAM_TOOLONG); - return FALSE; + return false; } vRet = CJS_Value(pRuntime, CFX_WideString::FromUTF16LE( @@ -790,16 +785,16 @@ FX_BOOL app::response(IJS_Context* cc, nLengthBytes / sizeof(uint16_t)) .c_str()); - return TRUE; + return true; } -FX_BOOL app::media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - return FALSE; +bool app::media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { + return false; } -FX_BOOL app::execDialog(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; +bool app::execDialog(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; } diff --git a/fpdfsdk/javascript/app.h b/fpdfsdk/javascript/app.h index 1efd34168c..32e2aaf28c 100644 --- a/fpdfsdk/javascript/app.h +++ b/fpdfsdk/javascript/app.h @@ -41,117 +41,109 @@ class app : public CJS_EmbedObj { app(CJS_Object* pJSObject); ~app() override; - FX_BOOL activeDocs(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL formsVersion(IJS_Context* cc, + bool activeDocs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool formsVersion(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool fs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool fullscreen(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool language(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool platform(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool runtimeHighlight(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError); + bool viewerType(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool viewerVariation(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL fs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL fullscreen(IJS_Context* cc, + bool viewerVersion(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL language(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL platform(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL runtimeHighlight(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL viewerType(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL viewerVariation(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL viewerVersion(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL alert(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL beep(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL browseForDoc(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL clearInterval(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL clearTimeOut(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL execDialog(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL execMenuItem(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL findComponent(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL goBack(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL goForward(IJS_Context* cc, + bool alert(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool beep(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool browseForDoc(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL launchURL(IJS_Context* cc, + bool clearInterval(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool clearTimeOut(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL mailMsg(IJS_Context* cc, + bool execDialog(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL newFDF(IJS_Context* cc, + bool execMenuItem(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool findComponent(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool goBack(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool goForward(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL newDoc(IJS_Context* cc, + bool launchURL(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL openDoc(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL openFDF(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL popUpMenuEx(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL popUpMenu(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL response(IJS_Context* cc, + bool mailMsg(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool newFDF(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool newDoc(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool openDoc(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool openFDF(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool popUpMenuEx(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL setInterval(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL setTimeOut(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); + bool popUpMenu(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool response(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool setInterval(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool setTimeOut(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); void TimerProc(GlobalTimer* pTimer); void CancelProc(GlobalTimer* pTimer); diff --git a/fpdfsdk/javascript/cjs_context.cpp b/fpdfsdk/javascript/cjs_context.cpp index 0a34b353b5..e356bdd904 100644 --- a/fpdfsdk/javascript/cjs_context.cpp +++ b/fpdfsdk/javascript/cjs_context.cpp @@ -13,7 +13,7 @@ CJS_Context::CJS_Context(CJS_Runtime* pRuntime) : m_pRuntime(pRuntime), m_pEventHandler(new CJS_EventHandler(this)), - m_bBusy(FALSE) {} + m_bBusy(false) {} CJS_Context::~CJS_Context() {} @@ -21,8 +21,8 @@ CPDFSDK_FormFillEnvironment* CJS_Context::GetFormFillEnv() { return m_pRuntime->GetFormFillEnv(); } -FX_BOOL CJS_Context::RunScript(const CFX_WideString& script, - CFX_WideString* info) { +bool CJS_Context::RunScript(const CFX_WideString& script, + CFX_WideString* info) { v8::Isolate::Scope isolate_scope(m_pRuntime->GetIsolate()); v8::HandleScope handle_scope(m_pRuntime->GetIsolate()); v8::Local<v8::Context> context = m_pRuntime->NewLocalContext(); @@ -30,16 +30,16 @@ FX_BOOL CJS_Context::RunScript(const CFX_WideString& script, if (m_bBusy) { *info = JSGetStringFromID(IDS_STRING_JSBUSY); - return FALSE; + return false; } - m_bBusy = TRUE; + m_bBusy = true; ASSERT(m_pEventHandler->IsValid()); CJS_Runtime::FieldEvent event(m_pEventHandler->TargetName(), m_pEventHandler->EventType()); if (!m_pRuntime->AddEventToSet(event)) { *info = JSGetStringFromID(IDS_STRING_JSEVENT); - return FALSE; + return false; } CFX_WideString sErrorMessage; @@ -56,7 +56,7 @@ FX_BOOL CJS_Context::RunScript(const CFX_WideString& script, m_pRuntime->RemoveEventFromSet(event); m_pEventHandler->Destroy(); - m_bBusy = FALSE; + m_bBusy = false; return nRet >= 0; } @@ -106,39 +106,39 @@ void CJS_Context::OnPage_OutView(CPDFSDK_FormFillEnvironment* pFormFillEnv) { m_pEventHandler->OnPage_OutView(pFormFillEnv); } -void CJS_Context::OnField_MouseDown(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_Context::OnField_MouseDown(bool bModifier, + bool bShift, CPDF_FormField* pTarget) { m_pEventHandler->OnField_MouseDown(bModifier, bShift, pTarget); } -void CJS_Context::OnField_MouseEnter(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_Context::OnField_MouseEnter(bool bModifier, + bool bShift, CPDF_FormField* pTarget) { m_pEventHandler->OnField_MouseEnter(bModifier, bShift, pTarget); } -void CJS_Context::OnField_MouseExit(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_Context::OnField_MouseExit(bool bModifier, + bool bShift, CPDF_FormField* pTarget) { m_pEventHandler->OnField_MouseExit(bModifier, bShift, pTarget); } -void CJS_Context::OnField_MouseUp(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_Context::OnField_MouseUp(bool bModifier, + bool bShift, CPDF_FormField* pTarget) { m_pEventHandler->OnField_MouseUp(bModifier, bShift, pTarget); } -void CJS_Context::OnField_Focus(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_Context::OnField_Focus(bool bModifier, + bool bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) { m_pEventHandler->OnField_Focus(bModifier, bShift, pTarget, Value); } -void CJS_Context::OnField_Blur(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_Context::OnField_Blur(bool bModifier, + bool bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) { m_pEventHandler->OnField_Blur(bModifier, bShift, pTarget, Value); @@ -147,28 +147,28 @@ void CJS_Context::OnField_Blur(FX_BOOL bModifier, void CJS_Context::OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL& bRc) { + bool& bRc) { m_pEventHandler->OnField_Calculate(pSource, pTarget, Value, bRc); } void CJS_Context::OnField_Format(CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL bWillCommit) { + bool bWillCommit) { m_pEventHandler->OnField_Format(pTarget, Value, bWillCommit); } void CJS_Context::OnField_Keystroke(CFX_WideString& strChange, const CFX_WideString& strChangeEx, - FX_BOOL bKeyDown, - FX_BOOL bModifier, + bool bKeyDown, + bool bModifier, int& nSelEnd, int& nSelStart, - FX_BOOL bShift, + bool bShift, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL bWillCommit, - FX_BOOL bFieldFull, - FX_BOOL& bRc) { + bool bWillCommit, + bool bFieldFull, + bool& bRc) { m_pEventHandler->OnField_Keystroke( strChange, strChangeEx, bKeyDown, bModifier, nSelEnd, nSelStart, bShift, pTarget, Value, bWillCommit, bFieldFull, bRc); @@ -176,72 +176,72 @@ void CJS_Context::OnField_Keystroke(CFX_WideString& strChange, void CJS_Context::OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, - FX_BOOL bKeyDown, - FX_BOOL bModifier, - FX_BOOL bShift, + bool bKeyDown, + bool bModifier, + bool bShift, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL& bRc) { + bool& bRc) { m_pEventHandler->OnField_Validate(strChange, strChangeEx, bKeyDown, bModifier, bShift, pTarget, Value, bRc); } -void CJS_Context::OnScreen_Focus(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_Context::OnScreen_Focus(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { m_pEventHandler->OnScreen_Focus(bModifier, bShift, pScreen); } -void CJS_Context::OnScreen_Blur(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_Context::OnScreen_Blur(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { m_pEventHandler->OnScreen_Blur(bModifier, bShift, pScreen); } -void CJS_Context::OnScreen_Open(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_Context::OnScreen_Open(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { m_pEventHandler->OnScreen_Open(bModifier, bShift, pScreen); } -void CJS_Context::OnScreen_Close(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_Context::OnScreen_Close(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { m_pEventHandler->OnScreen_Close(bModifier, bShift, pScreen); } -void CJS_Context::OnScreen_MouseDown(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_Context::OnScreen_MouseDown(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { m_pEventHandler->OnScreen_MouseDown(bModifier, bShift, pScreen); } -void CJS_Context::OnScreen_MouseUp(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_Context::OnScreen_MouseUp(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { m_pEventHandler->OnScreen_MouseUp(bModifier, bShift, pScreen); } -void CJS_Context::OnScreen_MouseEnter(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_Context::OnScreen_MouseEnter(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { m_pEventHandler->OnScreen_MouseEnter(bModifier, bShift, pScreen); } -void CJS_Context::OnScreen_MouseExit(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_Context::OnScreen_MouseExit(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { m_pEventHandler->OnScreen_MouseExit(bModifier, bShift, pScreen); } -void CJS_Context::OnScreen_InView(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_Context::OnScreen_InView(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { m_pEventHandler->OnScreen_InView(bModifier, bShift, pScreen); } -void CJS_Context::OnScreen_OutView(FX_BOOL bModifier, - FX_BOOL bShift, +void CJS_Context::OnScreen_OutView(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) { m_pEventHandler->OnScreen_OutView(bModifier, bShift, pScreen); } diff --git a/fpdfsdk/javascript/cjs_context.h b/fpdfsdk/javascript/cjs_context.h index b845f8b3d3..95a63ada62 100644 --- a/fpdfsdk/javascript/cjs_context.h +++ b/fpdfsdk/javascript/cjs_context.h @@ -23,8 +23,7 @@ class CJS_Context : public IJS_Context { ~CJS_Context() override; // IJS_Context - FX_BOOL RunScript(const CFX_WideString& script, - CFX_WideString* info) override; + bool RunScript(const CFX_WideString& script, CFX_WideString* info) override; void OnApp_Init() override; void OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv, const CFX_WideString& strTargetName) override; @@ -37,82 +36,82 @@ class CJS_Context : public IJS_Context { void OnPage_Close(CPDFSDK_FormFillEnvironment* pFormFillEnv) override; void OnPage_InView(CPDFSDK_FormFillEnvironment* pFormFillEnv) override; void OnPage_OutView(CPDFSDK_FormFillEnvironment* pFormFillEnv) override; - void OnField_MouseDown(FX_BOOL bModifier, - FX_BOOL bShift, + void OnField_MouseDown(bool bModifier, + bool bShift, CPDF_FormField* pTarget) override; - void OnField_MouseEnter(FX_BOOL bModifier, - FX_BOOL bShift, + void OnField_MouseEnter(bool bModifier, + bool bShift, CPDF_FormField* pTarget) override; - void OnField_MouseExit(FX_BOOL bModifier, - FX_BOOL bShift, + void OnField_MouseExit(bool bModifier, + bool bShift, CPDF_FormField* pTarget) override; - void OnField_MouseUp(FX_BOOL bModifier, - FX_BOOL bShift, + void OnField_MouseUp(bool bModifier, + bool bShift, CPDF_FormField* pTarget) override; - void OnField_Focus(FX_BOOL bModifier, - FX_BOOL bShift, + void OnField_Focus(bool bModifier, + bool bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) override; - void OnField_Blur(FX_BOOL bModifier, - FX_BOOL bShift, + void OnField_Blur(bool bModifier, + bool bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) override; void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL& bRc) override; + bool& bRc) override; void OnField_Format(CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL bWillCommit) override; + bool bWillCommit) override; void OnField_Keystroke(CFX_WideString& strChange, const CFX_WideString& strChangeEx, - FX_BOOL bKeyDown, - FX_BOOL bModifier, + bool bKeyDown, + bool bModifier, int& nSelEnd, int& nSelStart, - FX_BOOL bShift, + bool bShift, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL bWillCommit, - FX_BOOL bFieldFull, - FX_BOOL& bRc) override; + bool bWillCommit, + bool bFieldFull, + bool& bRc) override; void OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, - FX_BOOL bKeyDown, - FX_BOOL bModifier, - FX_BOOL bShift, + bool bKeyDown, + bool bModifier, + bool bShift, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL& bRc) override; - void OnScreen_Focus(FX_BOOL bModifier, - FX_BOOL bShift, + bool& bRc) override; + void OnScreen_Focus(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override; - void OnScreen_Blur(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_Blur(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override; - void OnScreen_Open(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_Open(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override; - void OnScreen_Close(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_Close(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override; - void OnScreen_MouseDown(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_MouseDown(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override; - void OnScreen_MouseUp(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_MouseUp(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override; - void OnScreen_MouseEnter(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_MouseEnter(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override; - void OnScreen_MouseExit(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_MouseExit(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override; - void OnScreen_InView(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_InView(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override; - void OnScreen_OutView(FX_BOOL bModifier, - FX_BOOL bShift, + void OnScreen_OutView(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) override; void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) override; void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv) override; @@ -130,7 +129,7 @@ class CJS_Context : public IJS_Context { private: CJS_Runtime* const m_pRuntime; std::unique_ptr<CJS_EventHandler> m_pEventHandler; - FX_BOOL m_bBusy; + bool m_bBusy; }; #endif // FPDFSDK_JAVASCRIPT_CJS_CONTEXT_H_ diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp index ca1c1126ca..f55a59cee6 100644 --- a/fpdfsdk/javascript/cjs_runtime.cpp +++ b/fpdfsdk/javascript/cjs_runtime.cpp @@ -225,8 +225,8 @@ CFX_WideString ChangeObjName(const CFX_WideString& str) { sRet.Replace(L"_", L"."); return sRet; } -FX_BOOL CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name, - CFXJSE_Value* pValue) { +bool CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name, + CFXJSE_Value* pValue) { const FX_CHAR* name = utf8Name.c_str(); v8::Isolate::Scope isolate_scope(GetIsolate()); @@ -240,15 +240,15 @@ FX_BOOL CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name, if (propvalue.IsEmpty()) { pValue->SetUndefined(); - return FALSE; + return false; } pValue->ForceSetValue(propvalue); - return TRUE; + return true; } -FX_BOOL CJS_Runtime::SetValueByName(const CFX_ByteStringC& utf8Name, - CFXJSE_Value* pValue) { +bool CJS_Runtime::SetValueByName(const CFX_ByteStringC& utf8Name, + CFXJSE_Value* pValue) { if (utf8Name.IsEmpty() || !pValue) - return FALSE; + return false; const FX_CHAR* name = utf8Name.c_str(); v8::Isolate* pIsolate = GetIsolate(); v8::Isolate::Scope isolate_scope(pIsolate); @@ -264,6 +264,6 @@ FX_BOOL CJS_Runtime::SetValueByName(const CFX_ByteStringC& utf8Name, v8::String::NewFromUtf8(pIsolate, name, v8::String::kNormalString, utf8Name.GetLength()), propvalue); - return TRUE; + return true; } #endif diff --git a/fpdfsdk/javascript/cjs_runtime.h b/fpdfsdk/javascript/cjs_runtime.h index 1b004ded89..66f08772e1 100644 --- a/fpdfsdk/javascript/cjs_runtime.h +++ b/fpdfsdk/javascript/cjs_runtime.h @@ -47,15 +47,15 @@ class CJS_Runtime : public IJS_Runtime, bool AddEventToSet(const FieldEvent& event); void RemoveEventFromSet(const FieldEvent& event); - void BeginBlock() { m_bBlocking = TRUE; } - void EndBlock() { m_bBlocking = FALSE; } - FX_BOOL IsBlocking() const { return m_bBlocking; } + void BeginBlock() { m_bBlocking = true; } + void EndBlock() { m_bBlocking = false; } + bool IsBlocking() const { return m_bBlocking; } #ifdef PDF_ENABLE_XFA - FX_BOOL GetValueByName(const CFX_ByteStringC& utf8Name, - CFXJSE_Value* pValue) override; - FX_BOOL SetValueByName(const CFX_ByteStringC& utf8Name, - CFXJSE_Value* pValue) override; + bool GetValueByName(const CFX_ByteStringC& utf8Name, + CFXJSE_Value* pValue) override; + bool SetValueByName(const CFX_ByteStringC& utf8Name, + CFXJSE_Value* pValue) override; #endif // PDF_ENABLE_XFA private: diff --git a/fpdfsdk/javascript/color.cpp b/fpdfsdk/javascript/color.cpp index f77d5481dd..882a9035e8 100644 --- a/fpdfsdk/javascript/color.cpp +++ b/fpdfsdk/javascript/color.cpp @@ -134,8 +134,8 @@ void color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime, } #define JS_IMPLEMENT_COLORPROP(prop, var) \ - FX_BOOL color::prop(IJS_Context* cc, CJS_PropValue& vp, \ - CFX_WideString& sError) { \ + bool color::prop(IJS_Context* cc, CJS_PropValue& vp, \ + CFX_WideString& sError) { \ CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); \ CJS_Array array; \ if (vp.IsGetting()) { \ @@ -143,10 +143,10 @@ void color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime, vp << array; \ } else { \ if (!vp.GetJSValue()->ConvertToArray(pRuntime, array)) \ - return FALSE; \ + return false; \ ConvertArrayToPWLColor(pRuntime, array, &var); \ } \ - return TRUE; \ + return true; \ } JS_IMPLEMENT_COLORPROP(transparent, m_crTransparent) @@ -162,18 +162,18 @@ JS_IMPLEMENT_COLORPROP(dkGray, m_crDKGray) JS_IMPLEMENT_COLORPROP(gray, m_crGray) JS_IMPLEMENT_COLORPROP(ltGray, m_crLTGray) -FX_BOOL color::convert(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool color::convert(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { int iSize = params.size(); if (iSize < 2) - return FALSE; + return false; CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); CJS_Array aSource; if (!params[0].ConvertToArray(pRuntime, aSource)) - return FALSE; + return false; CPWL_Color crSource; ConvertArrayToPWLColor(pRuntime, aSource, &crSource); @@ -197,23 +197,23 @@ FX_BOOL color::convert(IJS_Context* cc, ConvertPWLColorToArray(pRuntime, crDest, &aDest); vRet = CJS_Value(pRuntime, aDest); - return TRUE; + return true; } -FX_BOOL color::equal(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool color::equal(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() < 2) - return FALSE; + return false; CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); CJS_Array array1; CJS_Array array2; if (!params[0].ConvertToArray(pRuntime, array1)) - return FALSE; + return false; if (!params[1].ConvertToArray(pRuntime, array2)) - return FALSE; + return false; CPWL_Color color1; CPWL_Color color2; @@ -221,5 +221,5 @@ FX_BOOL color::equal(IJS_Context* cc, ConvertArrayToPWLColor(pRuntime, array2, &color2); color1.ConvertColorType(color2.nColorType); vRet = CJS_Value(pRuntime, color1 == color2); - return TRUE; + return true; } diff --git a/fpdfsdk/javascript/color.h b/fpdfsdk/javascript/color.h index 5c8c99feb6..ab56cac0b6 100644 --- a/fpdfsdk/javascript/color.h +++ b/fpdfsdk/javascript/color.h @@ -17,29 +17,27 @@ class color : public CJS_EmbedObj { color(CJS_Object* pJSObject); ~color() override; - FX_BOOL black(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL blue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL cyan(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL dkGray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL gray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL green(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL ltGray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL magenta(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL red(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL transparent(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL white(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL yellow(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool black(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool blue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool cyan(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool dkGray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool gray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool green(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool ltGray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool magenta(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool red(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool transparent(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool white(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool yellow(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL convert(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL equal(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); + bool convert(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool equal(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); static void ConvertPWLColorToArray(CJS_Runtime* pRuntime, const CPWL_Color& color, diff --git a/fpdfsdk/javascript/console.cpp b/fpdfsdk/javascript/console.cpp index a09fe4db17..0a8c1e05b0 100644 --- a/fpdfsdk/javascript/console.cpp +++ b/fpdfsdk/javascript/console.cpp @@ -33,33 +33,33 @@ console::console(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {} console::~console() {} -FX_BOOL console::clear(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; +bool console::clear(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; } -FX_BOOL console::hide(IJS_Context* cc, +bool console::hide(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; +} + +bool console::println(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - return TRUE; -} - -FX_BOOL console::println(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { if (params.size() < 1) { - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL console::show(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { - return TRUE; +bool console::show(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { + return true; } diff --git a/fpdfsdk/javascript/console.h b/fpdfsdk/javascript/console.h index 589dbc8914..4f18980206 100644 --- a/fpdfsdk/javascript/console.h +++ b/fpdfsdk/javascript/console.h @@ -17,22 +17,22 @@ class console : public CJS_EmbedObj { ~console() override; public: - FX_BOOL clear(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL hide(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL println(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL show(IJS_Context* cc, + bool clear(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool hide(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool println(IJS_Context* cc, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError); + bool show(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); }; class CJS_Console : public CJS_Object { diff --git a/fpdfsdk/javascript/event.cpp b/fpdfsdk/javascript/event.cpp index 880247f249..b4fb951772 100644 --- a/fpdfsdk/javascript/event.cpp +++ b/fpdfsdk/javascript/event.cpp @@ -48,9 +48,7 @@ event::event(CJS_Object* pJsObject) : CJS_EmbedObj(pJsObject) {} event::~event() {} -FX_BOOL event::change(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::change(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); CFX_WideString& wChange = pEvent->Change(); @@ -60,136 +58,132 @@ FX_BOOL event::change(IJS_Context* cc, } else { vp << wChange; } - return TRUE; + return true; } -FX_BOOL event::changeEx(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::changeEx(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); vp << pEvent->ChangeEx(); - return TRUE; + return true; } -FX_BOOL event::commitKey(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::commitKey(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); vp << pEvent->CommitKey(); - return TRUE; + return true; } -FX_BOOL event::fieldFull(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::fieldFull(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); if (!vp.IsGetting() && wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) - return FALSE; + return false; if (pEvent->FieldFull()) - vp << TRUE; + vp << true; else - vp << FALSE; - return TRUE; + vp << false; + return true; } -FX_BOOL event::keyDown(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::keyDown(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); if (pEvent->KeyDown()) - vp << TRUE; + vp << true; else - vp << FALSE; - return TRUE; + vp << false; + return true; } -FX_BOOL event::modifier(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::modifier(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); if (pEvent->Modifier()) - vp << TRUE; + vp << true; else - vp << FALSE; - return TRUE; + vp << false; + return true; } -FX_BOOL event::name(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); vp << pEvent->Name(); - return TRUE; + return true; } -FX_BOOL event::rc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { +bool event::rc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); - FX_BOOL& bRc = pEvent->Rc(); + bool& bRc = pEvent->Rc(); if (vp.IsSetting()) { vp >> bRc; } else { vp << bRc; } - return TRUE; -} - -FX_BOOL event::richChange(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { - return TRUE; + return true; } -FX_BOOL event::richChangeEx(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { - return TRUE; +bool event::richChange(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { + return true; } -FX_BOOL event::richValue(IJS_Context* cc, +bool event::richChangeEx(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - return TRUE; + return true; } -FX_BOOL event::selEnd(IJS_Context* cc, +bool event::richValue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { + return true; +} + +bool event::selEnd(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) { - return TRUE; + return true; } int& iSelEnd = pEvent->SelEnd(); @@ -198,17 +192,17 @@ FX_BOOL event::selEnd(IJS_Context* cc, } else { vp << iSelEnd; } - return TRUE; + return true; } -FX_BOOL event::selStart(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::selStart(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) { - return TRUE; + return true; } int& iSelStart = pEvent->SelStart(); if (vp.IsSetting()) { @@ -216,108 +210,98 @@ FX_BOOL event::selStart(IJS_Context* cc, } else { vp << iSelStart; } - return TRUE; + return true; } -FX_BOOL event::shift(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::shift(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); if (pEvent->Shift()) - vp << TRUE; + vp << true; else - vp << FALSE; - return TRUE; + vp << false; + return true; } -FX_BOOL event::source(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::source(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); vp << pEvent->Source()->GetJSObject(); - return TRUE; + return true; } -FX_BOOL event::target(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::target(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); vp << pEvent->Target_Field()->GetJSObject(); - return TRUE; + return true; } -FX_BOOL event::targetName(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::targetName(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); vp << pEvent->TargetName(); - return TRUE; + return true; } -FX_BOOL event::type(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); vp << pEvent->Type(); - return TRUE; + return true; } -FX_BOOL event::value(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::value(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); if (wcscmp((const wchar_t*)pEvent->Type(), L"Field") != 0) - return FALSE; + return false; if (!pEvent->m_pValue) - return FALSE; + return false; CFX_WideString& val = pEvent->Value(); if (vp.IsSetting()) { vp >> val; } else { vp << val; } - return TRUE; + return true; } -FX_BOOL event::willCommit(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::willCommit(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { if (!vp.IsGetting()) - return FALSE; + return false; CJS_Context* pContext = (CJS_Context*)cc; CJS_EventHandler* pEvent = pContext->GetEventHandler(); if (pEvent->WillCommit()) - vp << TRUE; + vp << true; else - vp << FALSE; - return TRUE; + vp << false; + return true; } diff --git a/fpdfsdk/javascript/event.h b/fpdfsdk/javascript/event.h index 57b3416bf9..d70b57801e 100644 --- a/fpdfsdk/javascript/event.h +++ b/fpdfsdk/javascript/event.h @@ -15,34 +15,26 @@ class event : public CJS_EmbedObj { ~event() override; public: - FX_BOOL change(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL changeEx(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL commitKey(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL fieldFull(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL keyDown(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL modifier(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL rc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL richChange(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL richChangeEx(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL richValue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL selEnd(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL selStart(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL shift(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL source(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL target(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL targetName(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); - FX_BOOL type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL value(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - FX_BOOL willCommit(IJS_Context* cc, - CJS_PropValue& vp, - CFX_WideString& sError); + bool change(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool changeEx(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool commitKey(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool fieldFull(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool keyDown(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool modifier(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool rc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool richChange(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool richChangeEx(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool richValue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool selEnd(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool selStart(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool shift(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool source(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool target(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool targetName(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool value(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); + bool willCommit(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); }; class CJS_Event : public CJS_Object { diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp index eb7d2cac19..c2d3586874 100644 --- a/fpdfsdk/javascript/global.cpp +++ b/fpdfsdk/javascript/global.cpp @@ -39,10 +39,10 @@ void CJS_Global::InitInstance(IJS_Runtime* pIRuntime) { JSGlobalData::JSGlobalData() : nType(JS_GlobalDataType::NUMBER), dData(0), - bData(FALSE), + bData(false), sData(""), - bPersistent(FALSE), - bDeleted(FALSE) {} + bPersistent(false), + bDeleted(false) {} JSGlobalData::~JSGlobalData() { pData.Reset(); @@ -62,25 +62,25 @@ void JSGlobalAlternate::Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv) { UpdateGlobalPersistentVariables(); } -FX_BOOL JSGlobalAlternate::QueryProperty(const FX_WCHAR* propname) { +bool JSGlobalAlternate::QueryProperty(const FX_WCHAR* propname) { return CFX_WideString(propname) != L"setPersistent"; } -FX_BOOL JSGlobalAlternate::DelProperty(IJS_Context* cc, - const FX_WCHAR* propname, - CFX_WideString& sError) { +bool JSGlobalAlternate::DelProperty(IJS_Context* cc, + const FX_WCHAR* propname, + CFX_WideString& sError) { auto it = m_mapGlobal.find(CFX_ByteString::FromUnicode(propname)); if (it == m_mapGlobal.end()) - return FALSE; + return false; - it->second->bDeleted = TRUE; - return TRUE; + it->second->bDeleted = true; + return true; } -FX_BOOL JSGlobalAlternate::DoProperty(IJS_Context* cc, - const FX_WCHAR* propname, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool JSGlobalAlternate::DoProperty(IJS_Context* cc, + const FX_WCHAR* propname, + CJS_PropValue& vp, + CFX_WideString& sError) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); if (vp.IsSetting()) { CFX_ByteString sPropName = CFX_ByteString::FromUnicode(propname); @@ -89,33 +89,33 @@ FX_BOOL JSGlobalAlternate::DoProperty(IJS_Context* cc, double dData; vp >> dData; return SetGlobalVariables(sPropName, JS_GlobalDataType::NUMBER, dData, - false, "", v8::Local<v8::Object>(), FALSE); + false, "", v8::Local<v8::Object>(), false); } case CJS_Value::VT_boolean: { bool bData; vp >> bData; return SetGlobalVariables(sPropName, JS_GlobalDataType::BOOLEAN, 0, - bData, "", v8::Local<v8::Object>(), FALSE); + bData, "", v8::Local<v8::Object>(), false); } case CJS_Value::VT_string: { CFX_ByteString sData; vp >> sData; return SetGlobalVariables(sPropName, JS_GlobalDataType::STRING, 0, - false, sData, v8::Local<v8::Object>(), FALSE); + false, sData, v8::Local<v8::Object>(), false); } case CJS_Value::VT_object: { v8::Local<v8::Object> pData; vp >> pData; return SetGlobalVariables(sPropName, JS_GlobalDataType::OBJECT, 0, - false, "", pData, FALSE); + false, "", pData, false); } case CJS_Value::VT_null: { return SetGlobalVariables(sPropName, JS_GlobalDataType::NULLOBJ, 0, - false, "", v8::Local<v8::Object>(), FALSE); + false, "", v8::Local<v8::Object>(), false); } case CJS_Value::VT_undefined: { DelProperty(cc, propname, sError); - return TRUE; + return true; } default: break; @@ -124,46 +124,46 @@ FX_BOOL JSGlobalAlternate::DoProperty(IJS_Context* cc, auto it = m_mapGlobal.find(CFX_ByteString::FromUnicode(propname)); if (it == m_mapGlobal.end()) { vp.GetJSValue()->SetNull(pRuntime); - return TRUE; + return true; } JSGlobalData* pData = it->second; if (pData->bDeleted) { vp.GetJSValue()->SetNull(pRuntime); - return TRUE; + return true; } switch (pData->nType) { case JS_GlobalDataType::NUMBER: vp << pData->dData; - return TRUE; + return true; case JS_GlobalDataType::BOOLEAN: vp << pData->bData; - return TRUE; + return true; case JS_GlobalDataType::STRING: vp << pData->sData; - return TRUE; + return true; case JS_GlobalDataType::OBJECT: { v8::Local<v8::Object> obj = v8::Local<v8::Object>::New( vp.GetJSRuntime()->GetIsolate(), pData->pData); vp << obj; - return TRUE; + return true; } case JS_GlobalDataType::NULLOBJ: vp.GetJSValue()->SetNull(pRuntime); - return TRUE; + return true; default: break; } } - return FALSE; + return false; } -FX_BOOL JSGlobalAlternate::setPersistent(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool JSGlobalAlternate::setPersistent(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() != 2) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); @@ -172,12 +172,12 @@ FX_BOOL JSGlobalAlternate::setPersistent(IJS_Context* cc, JSGlobalData* pData = it->second; if (!pData->bDeleted) { pData->bPersistent = params[1].ToBool(pRuntime); - return TRUE; + return true; } } sError = JSGetStringFromID(IDS_STRING_JSNOGLOBAL); - return FALSE; + return false; } void JSGlobalAlternate::UpdateGlobalPersistentVariables() { @@ -359,15 +359,15 @@ void JSGlobalAlternate::DestroyGlobalPersisitentVariables() { m_mapGlobal.clear(); } -FX_BOOL JSGlobalAlternate::SetGlobalVariables(const CFX_ByteString& propname, - JS_GlobalDataType nType, - double dData, - bool bData, - const CFX_ByteString& sData, - v8::Local<v8::Object> pData, - bool bDefaultPersistent) { +bool JSGlobalAlternate::SetGlobalVariables(const CFX_ByteString& propname, + JS_GlobalDataType nType, + double dData, + bool bData, + const CFX_ByteString& sData, + v8::Local<v8::Object> pData, + bool bDefaultPersistent) { if (propname.IsEmpty()) - return FALSE; + return false; auto it = m_mapGlobal.find(propname); if (it != m_mapGlobal.end()) { @@ -379,7 +379,7 @@ FX_BOOL JSGlobalAlternate::SetGlobalVariables(const CFX_ByteString& propname, pTemp->nType = nType; } - pTemp->bDeleted = FALSE; + pTemp->bDeleted = false; switch (nType) { case JS_GlobalDataType::NUMBER: { pTemp->dData = dData; @@ -396,9 +396,9 @@ FX_BOOL JSGlobalAlternate::SetGlobalVariables(const CFX_ByteString& propname, case JS_GlobalDataType::NULLOBJ: break; default: - return FALSE; + return false; } - return TRUE; + return true; } JSGlobalData* pNewData = nullptr; @@ -434,9 +434,9 @@ FX_BOOL JSGlobalAlternate::SetGlobalVariables(const CFX_ByteString& propname, pNewData->bPersistent = bDefaultPersistent; } break; default: - return FALSE; + return false; } m_mapGlobal[propname] = pNewData; - return TRUE; + return true; } diff --git a/fpdfsdk/javascript/global.h b/fpdfsdk/javascript/global.h index d5288e38b1..c0eb4447f4 100644 --- a/fpdfsdk/javascript/global.h +++ b/fpdfsdk/javascript/global.h @@ -35,31 +35,31 @@ class JSGlobalAlternate : public CJS_EmbedObj { JSGlobalAlternate(CJS_Object* pJSObject); ~JSGlobalAlternate() override; - FX_BOOL setPersistent(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL QueryProperty(const FX_WCHAR* propname); - FX_BOOL DoProperty(IJS_Context* cc, - const FX_WCHAR* propname, - CJS_PropValue& vp, + bool setPersistent(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, CFX_WideString& sError); - FX_BOOL DelProperty(IJS_Context* cc, - const FX_WCHAR* propname, - CFX_WideString& sError); + bool QueryProperty(const FX_WCHAR* propname); + bool DoProperty(IJS_Context* cc, + const FX_WCHAR* propname, + CJS_PropValue& vp, + CFX_WideString& sError); + bool DelProperty(IJS_Context* cc, + const FX_WCHAR* propname, + CFX_WideString& sError); void Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv); private: void UpdateGlobalPersistentVariables(); void CommitGlobalPersisitentVariables(IJS_Context* cc); void DestroyGlobalPersisitentVariables(); - FX_BOOL SetGlobalVariables(const CFX_ByteString& propname, - JS_GlobalDataType nType, - double dData, - bool bData, - const CFX_ByteString& sData, - v8::Local<v8::Object> pData, - bool bDefaultPersistent); + bool SetGlobalVariables(const CFX_ByteString& propname, + JS_GlobalDataType nType, + double dData, + bool bData, + const CFX_ByteString& sData, + v8::Local<v8::Object> pData, + bool bDefaultPersistent); void ObjectToArray(IJS_Context* cc, v8::Local<v8::Object> pObj, CJS_GlobalVariableArray& array); diff --git a/fpdfsdk/javascript/ijs_context.h b/fpdfsdk/javascript/ijs_context.h index 859d09524b..2d2248f539 100644 --- a/fpdfsdk/javascript/ijs_context.h +++ b/fpdfsdk/javascript/ijs_context.h @@ -18,8 +18,8 @@ class CPDFSDK_FormFillEnvironment; // Records the details of an event and triggers JS execution for it. class IJS_Context { public: - virtual FX_BOOL RunScript(const CFX_WideString& script, - CFX_WideString* info) = 0; + virtual bool RunScript(const CFX_WideString& script, + CFX_WideString* info) = 0; virtual void OnApp_Init() = 0; @@ -36,84 +36,84 @@ class IJS_Context { virtual void OnPage_InView(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0; virtual void OnPage_OutView(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0; - virtual void OnField_MouseDown(FX_BOOL bModifier, - FX_BOOL bShift, + virtual void OnField_MouseDown(bool bModifier, + bool bShift, CPDF_FormField* pTarget) = 0; - virtual void OnField_MouseEnter(FX_BOOL bModifier, - FX_BOOL bShift, + virtual void OnField_MouseEnter(bool bModifier, + bool bShift, CPDF_FormField* pTarget) = 0; - virtual void OnField_MouseExit(FX_BOOL bModifier, - FX_BOOL bShift, + virtual void OnField_MouseExit(bool bModifier, + bool bShift, CPDF_FormField* pTarget) = 0; - virtual void OnField_MouseUp(FX_BOOL bModifier, - FX_BOOL bShift, + virtual void OnField_MouseUp(bool bModifier, + bool bShift, CPDF_FormField* pTarget) = 0; - virtual void OnField_Focus(FX_BOOL bModifier, - FX_BOOL bShift, + virtual void OnField_Focus(bool bModifier, + bool bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) = 0; - virtual void OnField_Blur(FX_BOOL bModifier, - FX_BOOL bShift, + virtual void OnField_Blur(bool bModifier, + bool bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) = 0; virtual void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL& bRc) = 0; + bool& bRc) = 0; virtual void OnField_Format(CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL bWillCommit) = 0; + bool bWillCommit) = 0; virtual void OnField_Keystroke(CFX_WideString& strChange, const CFX_WideString& strChangeEx, - FX_BOOL KeyDown, - FX_BOOL bModifier, + bool KeyDown, + bool bModifier, int& nSelEnd, int& nSelStart, - FX_BOOL bShift, + bool bShift, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL bWillCommit, - FX_BOOL bFieldFull, - FX_BOOL& bRc) = 0; + bool bWillCommit, + bool bFieldFull, + bool& bRc) = 0; virtual void OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, - FX_BOOL bKeyDown, - FX_BOOL bModifier, - FX_BOOL bShift, + bool bKeyDown, + bool bModifier, + bool bShift, CPDF_FormField* pTarget, CFX_WideString& Value, - FX_BOOL& bRc) = 0; + bool& bRc) = 0; - virtual void OnScreen_Focus(FX_BOOL bModifier, - FX_BOOL bShift, + virtual void OnScreen_Focus(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) = 0; - virtual void OnScreen_Blur(FX_BOOL bModifier, - FX_BOOL bShift, + virtual void OnScreen_Blur(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) = 0; - virtual void OnScreen_Open(FX_BOOL bModifier, - FX_BOOL bShift, + virtual void OnScreen_Open(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) = 0; - virtual void OnScreen_Close(FX_BOOL bModifier, - FX_BOOL bShift, + virtual void OnScreen_Close(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) = 0; - virtual void OnScreen_MouseDown(FX_BOOL bModifier, - FX_BOOL bShift, + virtual void OnScreen_MouseDown(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) = 0; - virtual void OnScreen_MouseUp(FX_BOOL bModifier, - FX_BOOL bShift, + virtual void OnScreen_MouseUp(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) = 0; - virtual void OnScreen_MouseEnter(FX_BOOL bModifier, - FX_BOOL bShift, + virtual void OnScreen_MouseEnter(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) = 0; - virtual void OnScreen_MouseExit(FX_BOOL bModifier, - FX_BOOL bShift, + virtual void OnScreen_MouseExit(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) = 0; - virtual void OnScreen_InView(FX_BOOL bModifier, - FX_BOOL bShift, + virtual void OnScreen_InView(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) = 0; - virtual void OnScreen_OutView(FX_BOOL bModifier, - FX_BOOL bShift, + virtual void OnScreen_OutView(bool bModifier, + bool bShift, CPDFSDK_Annot* pScreen) = 0; virtual void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) = 0; diff --git a/fpdfsdk/javascript/ijs_runtime.h b/fpdfsdk/javascript/ijs_runtime.h index c14ed7e623..027c500ece 100644 --- a/fpdfsdk/javascript/ijs_runtime.h +++ b/fpdfsdk/javascript/ijs_runtime.h @@ -35,10 +35,10 @@ class IJS_Runtime { CFX_WideString* info) = 0; #ifdef PDF_ENABLE_XFA - virtual FX_BOOL GetValueByName(const CFX_ByteStringC& utf8Name, - CFXJSE_Value* pValue) = 0; - virtual FX_BOOL SetValueByName(const CFX_ByteStringC& utf8Name, - CFXJSE_Value* pValue) = 0; + virtual bool GetValueByName(const CFX_ByteStringC& utf8Name, + CFXJSE_Value* pValue) = 0; + virtual bool SetValueByName(const CFX_ByteStringC& utf8Name, + CFXJSE_Value* pValue) = 0; #endif // PDF_ENABLE_XFA protected: diff --git a/fpdfsdk/javascript/report.cpp b/fpdfsdk/javascript/report.cpp index 69cc336003..ba6e97d87c 100644 --- a/fpdfsdk/javascript/report.cpp +++ b/fpdfsdk/javascript/report.cpp @@ -29,18 +29,18 @@ Report::Report(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {} Report::~Report() {} -FX_BOOL Report::writeText(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Report::writeText(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, not supported. - return TRUE; + return true; } -FX_BOOL Report::save(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool Report::save(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { // Unsafe, not supported. - return TRUE; + return true; } diff --git a/fpdfsdk/javascript/report.h b/fpdfsdk/javascript/report.h index 3cd3b3b02c..0773472a94 100644 --- a/fpdfsdk/javascript/report.h +++ b/fpdfsdk/javascript/report.h @@ -17,14 +17,14 @@ class Report : public CJS_EmbedObj { ~Report() override; public: - FX_BOOL save(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL writeText(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); + bool save(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool writeText(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); }; class CJS_Report : public CJS_Object { diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp index 50c4c56ee9..3967ceb0cb 100644 --- a/fpdfsdk/javascript/util.cpp +++ b/fpdfsdk/javascript/util.cpp @@ -75,7 +75,7 @@ const TbConvert TbConvertTable[] = { }; int ParseDataType(std::wstring* sFormat) { - bool bPercent = FALSE; + bool bPercent = false; for (size_t i = 0; i < sFormat->length(); ++i) { wchar_t c = (*sFormat)[i]; if (c == L'%') { @@ -114,14 +114,14 @@ util::util(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {} util::~util() {} -FX_BOOL util::printf(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool util::printf(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); int iSize = params.size(); if (iSize < 1) - return FALSE; + return false; std::wstring c_ConvChar(params[0].ToCFXWideString(pRuntime).c_str()); std::vector<std::wstring> c_strConvers; int iOffset = 0; @@ -174,16 +174,16 @@ FX_BOOL util::printf(IJS_Context* cc, c_strResult.erase(c_strResult.begin()); vRet = CJS_Value(pRuntime, c_strResult.c_str()); - return TRUE; + return true; } -FX_BOOL util::printd(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool util::printd(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { int iSize = params.size(); if (iSize < 2) - return FALSE; + return false; CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); CJS_Value p1 = params[0]; @@ -191,12 +191,12 @@ FX_BOOL util::printd(IJS_Context* cc, CJS_Date jsDate; if (!p2.ConvertToDate(pRuntime, jsDate)) { sError = JSGetStringFromID(IDS_STRING_JSPRINT1); - return FALSE; + return false; } if (!jsDate.IsValidDate(pRuntime)) { sError = JSGetStringFromID(IDS_STRING_JSPRINT2); - return FALSE; + return false; } if (p1.GetType() == CJS_Value::VT_number) { @@ -224,17 +224,17 @@ FX_BOOL util::printd(IJS_Context* cc, break; default: sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR); - return FALSE; + return false; } vRet = CJS_Value(pRuntime, swResult.c_str()); - return TRUE; + return true; } if (p1.GetType() == CJS_Value::VT_string) { if (iSize > 2 && params[2].ToBool(pRuntime)) { sError = JSGetStringFromID(IDS_STRING_JSNOTSUPPORT); - return FALSE; // currently, it doesn't support XFAPicture. + return false; // currently, it doesn't support XFAPicture. } // Convert PDF-style format specifiers to wcsftime specifiers. Remove any @@ -300,21 +300,20 @@ FX_BOOL util::printd(IJS_Context* cc, wcsftime(buf, 64, cFormat.c_str(), &time); cFormat = buf; vRet = CJS_Value(pRuntime, cFormat.c_str()); - return TRUE; + return true; } sError = JSGetStringFromID(IDS_STRING_JSTYPEERROR); - return FALSE; + return false; } - -FX_BOOL util::printx(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool util::printx(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() < 2) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); @@ -322,7 +321,7 @@ FX_BOOL util::printx(IJS_Context* cc, params[1].ToCFXWideString(pRuntime)) .c_str()); - return TRUE; + return true; } enum CaseMode { kPreserveCase, kUpperCase, kLowerCase }; @@ -426,14 +425,14 @@ CFX_WideString util::printx(const CFX_WideString& wsFormat, return wsResult; } -FX_BOOL util::scand(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool util::scand(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); int iSize = params.size(); if (iSize < 2) - return FALSE; + return false; CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime); CFX_WideString sDate = params[1].ToCFXWideString(pRuntime); @@ -448,26 +447,26 @@ FX_BOOL util::scand(IJS_Context* cc, vRet.SetNull(pRuntime); } - return TRUE; + return true; } -FX_BOOL util::byteToChar(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError) { +bool util::byteToChar(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError) { if (params.size() < 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); - return FALSE; + return false; } CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); int arg = params[0].ToInt(pRuntime); if (arg < 0 || arg > 255) { sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR); - return FALSE; + return false; } CFX_WideString wStr(static_cast<FX_WCHAR>(arg)); vRet = CJS_Value(pRuntime, wStr.c_str()); - return TRUE; + return true; } diff --git a/fpdfsdk/javascript/util.h b/fpdfsdk/javascript/util.h index 3022efece2..efcf0c8f89 100644 --- a/fpdfsdk/javascript/util.h +++ b/fpdfsdk/javascript/util.h @@ -17,26 +17,26 @@ class util : public CJS_EmbedObj { util(CJS_Object* pJSObject); ~util() override; - FX_BOOL printd(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL printf(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL printx(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL scand(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); - FX_BOOL byteToChar(IJS_Context* cc, - const std::vector<CJS_Value>& params, - CJS_Value& vRet, - CFX_WideString& sError); + bool printd(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool printf(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool printx(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool scand(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); + bool byteToChar(IJS_Context* cc, + const std::vector<CJS_Value>& params, + CJS_Value& vRet, + CFX_WideString& sError); static CFX_WideString printx(const CFX_WideString& cFormat, const CFX_WideString& cSource); diff --git a/fpdfsdk/pdfsdk_fieldaction.cpp b/fpdfsdk/pdfsdk_fieldaction.cpp index c5356cb0b8..61228ea82a 100644 --- a/fpdfsdk/pdfsdk_fieldaction.cpp +++ b/fpdfsdk/pdfsdk_fieldaction.cpp @@ -7,12 +7,12 @@ #include "fpdfsdk/pdfsdk_fieldaction.h" PDFSDK_FieldAction::PDFSDK_FieldAction() - : bModifier(FALSE), - bShift(FALSE), + : bModifier(false), + bShift(false), nCommitKey(0), - bKeyDown(FALSE), + bKeyDown(false), nSelEnd(0), nSelStart(0), - bWillCommit(FALSE), - bFieldFull(FALSE), - bRC(TRUE) {} + bWillCommit(false), + bFieldFull(false), + bRC(true) {} diff --git a/fpdfsdk/pdfsdk_fieldaction.h b/fpdfsdk/pdfsdk_fieldaction.h index 192bfc2075..4ee56ac3f6 100644 --- a/fpdfsdk/pdfsdk_fieldaction.h +++ b/fpdfsdk/pdfsdk_fieldaction.h @@ -22,18 +22,18 @@ struct PDFSDK_FieldAction { PDFSDK_FieldAction(); PDFSDK_FieldAction(const PDFSDK_FieldAction& other) = delete; - FX_BOOL bModifier; - FX_BOOL bShift; + bool bModifier; + bool bShift; int nCommitKey; CFX_WideString sChange; CFX_WideString sChangeEx; - FX_BOOL bKeyDown; + bool bKeyDown; int nSelEnd; int nSelStart; CFX_WideString sValue; - FX_BOOL bWillCommit; - FX_BOOL bFieldFull; - FX_BOOL bRC; + bool bWillCommit; + bool bFieldFull; + bool bRC; }; #endif // FPDFSDK_PDFSDK_FIELDACTION_H_ diff --git a/fpdfsdk/pdfwindow/PWL_Button.cpp b/fpdfsdk/pdfwindow/PWL_Button.cpp index baf9ef0f26..972e55edad 100644 --- a/fpdfsdk/pdfwindow/PWL_Button.cpp +++ b/fpdfsdk/pdfwindow/PWL_Button.cpp @@ -8,7 +8,7 @@ #include "fpdfsdk/pdfwindow/PWL_Utils.h" #include "fpdfsdk/pdfwindow/PWL_Wnd.h" -CPWL_Button::CPWL_Button() : m_bMouseDown(FALSE) {} +CPWL_Button::CPWL_Button() : m_bMouseDown(false) {} CPWL_Button::~CPWL_Button() {} @@ -20,21 +20,20 @@ void CPWL_Button::OnCreate(PWL_CREATEPARAM& cp) { cp.eCursorType = FXCT_HAND; } -FX_BOOL CPWL_Button::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_Button::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); - m_bMouseDown = TRUE; + m_bMouseDown = true; SetCapture(); - return TRUE; + return true; } -FX_BOOL CPWL_Button::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Button::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); ReleaseCapture(); - m_bMouseDown = FALSE; + m_bMouseDown = false; - return TRUE; + return true; } diff --git a/fpdfsdk/pdfwindow/PWL_Button.h b/fpdfsdk/pdfwindow/PWL_Button.h index 809b0614ca..f35e9adf36 100644 --- a/fpdfsdk/pdfwindow/PWL_Button.h +++ b/fpdfsdk/pdfwindow/PWL_Button.h @@ -17,11 +17,11 @@ class CPWL_Button : public CPWL_Wnd { // CPWL_Wnd CFX_ByteString GetClassName() const override; void OnCreate(PWL_CREATEPARAM& cp) override; - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; protected: - FX_BOOL m_bMouseDown; + bool m_bMouseDown; }; #endif // FPDFSDK_PDFWINDOW_PWL_BUTTON_H_ diff --git a/fpdfsdk/pdfwindow/PWL_Caret.cpp b/fpdfsdk/pdfwindow/PWL_Caret.cpp index 0965ce10d0..8a5f539596 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.cpp +++ b/fpdfsdk/pdfwindow/PWL_Caret.cpp @@ -14,7 +14,7 @@ #define PWL_CARET_FLASHINTERVAL 500 -CPWL_Caret::CPWL_Caret() : m_bFlash(FALSE), m_fWidth(0.4f), m_nDelay(0) {} +CPWL_Caret::CPWL_Caret() : m_bFlash(false), m_fWidth(0.4f), m_nDelay(0) {} CPWL_Caret::~CPWL_Caret() {} @@ -105,7 +105,7 @@ CFX_FloatRect CPWL_Caret::GetCaretRect() const { m_ptHead.y); } -void CPWL_Caret::SetCaret(FX_BOOL bVisible, +void CPWL_Caret::SetCaret(bool bVisible, const CFX_FloatPoint& ptHead, const CFX_FloatPoint& ptFoot) { if (bVisible) { @@ -113,25 +113,25 @@ void CPWL_Caret::SetCaret(FX_BOOL bVisible, if (m_ptHead != ptHead || m_ptFoot != ptFoot) { m_ptHead = ptHead; m_ptFoot = ptFoot; - m_bFlash = TRUE; - Move(m_rcInvalid, FALSE, TRUE); + m_bFlash = true; + Move(m_rcInvalid, false, true); } } else { m_ptHead = ptHead; m_ptFoot = ptFoot; EndTimer(); BeginTimer(PWL_CARET_FLASHINTERVAL); - CPWL_Wnd::SetVisible(TRUE); - m_bFlash = TRUE; - Move(m_rcInvalid, FALSE, TRUE); + CPWL_Wnd::SetVisible(true); + m_bFlash = true; + Move(m_rcInvalid, false, true); } } else { m_ptHead = CFX_FloatPoint(); m_ptFoot = CFX_FloatPoint(); - m_bFlash = FALSE; + m_bFlash = false; if (IsVisible()) { EndTimer(); - CPWL_Wnd::SetVisible(FALSE); + CPWL_Wnd::SetVisible(false); } } } diff --git a/fpdfsdk/pdfwindow/PWL_Caret.h b/fpdfsdk/pdfwindow/PWL_Caret.h index 2f5c87639e..ccee96109e 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.h +++ b/fpdfsdk/pdfwindow/PWL_Caret.h @@ -11,9 +11,9 @@ struct PWL_CARET_INFO { public: - PWL_CARET_INFO() : bVisible(FALSE) {} + PWL_CARET_INFO() : bVisible(false) {} - FX_BOOL bVisible; + bool bVisible; CFX_FloatPoint ptHead; CFX_FloatPoint ptFoot; }; @@ -29,10 +29,10 @@ class CPWL_Caret : public CPWL_Wnd { void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; void InvalidateRect(CFX_FloatRect* pRect = nullptr) override; - void SetVisible(FX_BOOL bVisible) override {} + void SetVisible(bool bVisible) override {} void TimerProc() override; - void SetCaret(FX_BOOL bVisible, + void SetCaret(bool bVisible, const CFX_FloatPoint& ptHead, const CFX_FloatPoint& ptFoot); CFX_ByteString GetCaretAppearanceStream(const CFX_FloatPoint& ptOffset); @@ -42,7 +42,7 @@ class CPWL_Caret : public CPWL_Wnd { void GetCaretApp(CFX_ByteTextBuf& sAppStream, const CFX_FloatPoint& ptOffset); CFX_FloatRect GetCaretRect() const; - FX_BOOL m_bFlash; + bool m_bFlash; CFX_FloatPoint m_ptHead; CFX_FloatPoint m_ptFoot; FX_FLOAT m_fWidth; diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp index c5a67f385e..8e9a04b97d 100644 --- a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp @@ -18,30 +18,29 @@ #define PWLCB_DEFAULTFONTSIZE 12.0f -FX_BOOL CPWL_CBListBox::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_CBListBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (!m_bMouseDown) - return TRUE; + return true; ReleaseCapture(); - m_bMouseDown = FALSE; + m_bMouseDown = false; if (!ClientHitTest(point)) - return TRUE; + return true; if (CPWL_Wnd* pParent = GetParentWindow()) pParent->OnNotify(this, PNM_LBUTTONUP, 0, PWL_MAKEDWORD(point.x, point.y)); - FX_BOOL bExit = FALSE; - OnNotifySelChanged(FALSE, bExit, nFlag); + bool bExit = false; + OnNotifySelChanged(false, bExit, nFlag); return !bExit; } -FX_BOOL CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar, - FX_BOOL& bExit, - uint32_t nFlag) { +bool CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar, + bool& bExit, + uint32_t nFlag) { switch (nChar) { case FWL_VKEY_Up: case FWL_VKEY_Down: @@ -51,7 +50,7 @@ FX_BOOL CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar, case FWL_VKEY_Right: break; default: - return FALSE; + return false; } switch (nChar) { @@ -77,22 +76,22 @@ FX_BOOL CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar, break; } - OnNotifySelChanged(TRUE, bExit, nFlag); + OnNotifySelChanged(true, bExit, nFlag); - return TRUE; + return true; } -FX_BOOL CPWL_CBListBox::OnCharWithExit(uint16_t nChar, - FX_BOOL& bExit, - uint32_t nFlag) { +bool CPWL_CBListBox::OnCharWithExit(uint16_t nChar, + bool& bExit, + uint32_t nFlag) { if (!m_pList->OnChar(nChar, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag))) - return FALSE; + return false; if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetParentWindow()) pComboBox->SetSelectText(); - OnNotifySelChanged(TRUE, bExit, nFlag); + OnNotifySelChanged(true, bExit, nFlag); - return TRUE; + return true; } void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { @@ -163,8 +162,7 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } -FX_BOOL CPWL_CBButton::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_CBButton::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); SetCapture(); @@ -174,23 +172,22 @@ FX_BOOL CPWL_CBButton::OnLButtonDown(const CFX_FloatPoint& point, PWL_MAKEDWORD(point.x, point.y)); } - return TRUE; + return true; } -FX_BOOL CPWL_CBButton::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_CBButton::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); ReleaseCapture(); - return TRUE; + return true; } CPWL_ComboBox::CPWL_ComboBox() : m_pEdit(nullptr), m_pButton(nullptr), m_pList(nullptr), - m_bPopup(FALSE), + m_bPopup(false), m_nPopupWhere(0), m_nSelectItem(-1), m_pFillerNotify(nullptr) {} @@ -210,7 +207,7 @@ void CPWL_ComboBox::SetFocus() { } void CPWL_ComboBox::KillFocus() { - SetPopup(FALSE); + SetPopup(false); CPWL_Wnd::KillFocus(); } @@ -394,14 +391,14 @@ void CPWL_ComboBox::RePosChildWnd() { } if (m_pButton) - m_pButton->Move(rcButton, TRUE, FALSE); + m_pButton->Move(rcButton, true, false); if (m_pEdit) - m_pEdit->Move(rcEdit, TRUE, FALSE); + m_pEdit->Move(rcEdit, true, false); if (m_pList) { - m_pList->SetVisible(TRUE); - m_pList->Move(rcList, TRUE, FALSE); + m_pList->SetVisible(true); + m_pList->Move(rcList, true, false); m_pList->ScrollToListItem(m_nSelectItem); } } else { @@ -413,7 +410,7 @@ void CPWL_ComboBox::RePosChildWnd() { rcButton.left = rcClient.left; if (m_pButton) - m_pButton->Move(rcButton, TRUE, FALSE); + m_pButton->Move(rcButton, true, false); CFX_FloatRect rcEdit = rcClient; rcEdit.right = rcButton.left - 1.0f; @@ -425,10 +422,10 @@ void CPWL_ComboBox::RePosChildWnd() { rcEdit.right = rcEdit.left; if (m_pEdit) - m_pEdit->Move(rcEdit, TRUE, FALSE); + m_pEdit->Move(rcEdit, true, false); if (m_pList) - m_pList->SetVisible(FALSE); + m_pList->SetVisible(false); } } @@ -441,7 +438,7 @@ CFX_FloatRect CPWL_ComboBox::GetFocusRect() const { return CFX_FloatRect(); } -void CPWL_ComboBox::SetPopup(FX_BOOL bPopup) { +void CPWL_ComboBox::SetPopup(bool bPopup) { if (!m_pList) return; if (bPopup == m_bPopup) @@ -453,7 +450,7 @@ void CPWL_ComboBox::SetPopup(FX_BOOL bPopup) { if (bPopup) { if (m_pFillerNotify) { #ifdef PDF_ENABLE_XFA - FX_BOOL bExit = FALSE; + bool bExit = false; m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, 0); if (bExit) return; @@ -484,9 +481,9 @@ void CPWL_ComboBox::SetPopup(FX_BOOL bPopup) { } m_nPopupWhere = nWhere; - Move(rcWindow, TRUE, TRUE); + Move(rcWindow, true, true); #ifdef PDF_ENABLE_XFA - bExit = FALSE; + bExit = false; m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, 0); if (bExit) return; @@ -495,93 +492,93 @@ void CPWL_ComboBox::SetPopup(FX_BOOL bPopup) { } } else { m_bPopup = bPopup; - Move(m_rcOldWindow, TRUE, TRUE); + Move(m_rcOldWindow, true, true); } } -FX_BOOL CPWL_ComboBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) { +bool CPWL_ComboBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) { if (!m_pList) - return FALSE; + return false; if (!m_pEdit) - return FALSE; + return false; m_nSelectItem = -1; switch (nChar) { case FWL_VKEY_Up: if (m_pList->GetCurSel() > 0) { - FX_BOOL bExit = FALSE; + bool bExit = false; #ifdef PDF_ENABLE_XFA if (m_pFillerNotify) { m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, nFlag); if (bExit) - return FALSE; - bExit = FALSE; + return false; + bExit = false; m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, nFlag); if (bExit) - return FALSE; + return false; } #endif // PDF_ENABLE_XFA if (m_pList->OnKeyDownWithExit(nChar, bExit, nFlag)) { if (bExit) - return FALSE; + return false; SetSelectText(); } } - return TRUE; + return true; case FWL_VKEY_Down: if (m_pList->GetCurSel() < m_pList->GetCount() - 1) { - FX_BOOL bExit = FALSE; + bool bExit = false; #ifdef PDF_ENABLE_XFA if (m_pFillerNotify) { m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, nFlag); if (bExit) - return FALSE; - bExit = FALSE; + return false; + bExit = false; m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, nFlag); if (bExit) - return FALSE; + return false; } #endif // PDF_ENABLE_XFA if (m_pList->OnKeyDownWithExit(nChar, bExit, nFlag)) { if (bExit) - return FALSE; + return false; SetSelectText(); } } - return TRUE; + return true; } if (HasFlag(PCBS_ALLOWCUSTOMTEXT)) return m_pEdit->OnKeyDown(nChar, nFlag); - return FALSE; + return false; } -FX_BOOL CPWL_ComboBox::OnChar(uint16_t nChar, uint32_t nFlag) { +bool CPWL_ComboBox::OnChar(uint16_t nChar, uint32_t nFlag) { if (!m_pList) - return FALSE; + return false; if (!m_pEdit) - return FALSE; + return false; m_nSelectItem = -1; if (HasFlag(PCBS_ALLOWCUSTOMTEXT)) return m_pEdit->OnChar(nChar, nFlag); - FX_BOOL bExit = FALSE; + bool bExit = false; #ifdef PDF_ENABLE_XFA if (m_pFillerNotify) { m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, nFlag); if (bExit) - return FALSE; + return false; m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, nFlag); if (bExit) - return FALSE; + return false; } #endif // PDF_ENABLE_XFA - return m_pList->OnCharWithExit(nChar, bExit, nFlag) ? bExit : FALSE; + return m_pList->OnCharWithExit(nChar, bExit, nFlag) ? bExit : false; } void CPWL_ComboBox::OnNotify(CPWL_Wnd* pWnd, @@ -601,7 +598,7 @@ void CPWL_ComboBox::OnNotify(CPWL_Wnd* pWnd, SetSelectText(); SelectAll(); m_pEdit->SetFocus(); - SetPopup(FALSE); + SetPopup(false); return; } } @@ -610,7 +607,7 @@ void CPWL_ComboBox::OnNotify(CPWL_Wnd* pWnd, CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); } -FX_BOOL CPWL_ComboBox::IsPopup() const { +bool CPWL_ComboBox::IsPopup() const { return m_bPopup; } diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.h b/fpdfsdk/pdfwindow/PWL_ComboBox.h index 91b833c77f..84261199e9 100644 --- a/fpdfsdk/pdfwindow/PWL_ComboBox.h +++ b/fpdfsdk/pdfwindow/PWL_ComboBox.h @@ -23,10 +23,10 @@ class CPWL_CBListBox : public CPWL_ListBox { ~CPWL_CBListBox() override {} // CPWL_ListBox - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnKeyDownWithExit(uint16_t nChar, FX_BOOL& bExit, uint32_t nFlag); - FX_BOOL OnCharWithExit(uint16_t nChar, FX_BOOL& bExit, uint32_t nFlag); + bool OnKeyDownWithExit(uint16_t nChar, bool& bExit, uint32_t nFlag); + bool OnCharWithExit(uint16_t nChar, bool& bExit, uint32_t nFlag); }; #define PWL_COMBOBOX_BUTTON_WIDTH 13 @@ -40,8 +40,8 @@ class CPWL_CBButton : public CPWL_Wnd { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; }; class CPWL_ComboBox : public CPWL_Wnd { @@ -54,8 +54,8 @@ class CPWL_ComboBox : public CPWL_Wnd { // CPWL_Wnd: CFX_ByteString GetClassName() const override; void OnCreate(PWL_CREATEPARAM& cp) override; - FX_BOOL OnKeyDown(uint16_t nChar, uint32_t nFlag) override; - FX_BOOL OnChar(uint16_t nChar, uint32_t nFlag) override; + bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; + bool OnChar(uint16_t nChar, uint32_t nFlag) override; void OnNotify(CPWL_Wnd* pWnd, uint32_t msg, intptr_t wParam = 0, @@ -78,7 +78,7 @@ class CPWL_ComboBox : public CPWL_Wnd { void GetEditSel(int32_t& nStartChar, int32_t& nEndChar) const; void Clear(); void SelectAll(); - FX_BOOL IsPopup() const; + bool IsPopup() const; void SetSelectText(); @@ -88,12 +88,12 @@ class CPWL_ComboBox : public CPWL_Wnd { void CreateEdit(const PWL_CREATEPARAM& cp); void CreateButton(const PWL_CREATEPARAM& cp); void CreateListBox(const PWL_CREATEPARAM& cp); - void SetPopup(FX_BOOL bPopup); + void SetPopup(bool bPopup); CPWL_CBEdit* m_pEdit; CPWL_CBButton* m_pButton; CPWL_CBListBox* m_pList; - FX_BOOL m_bPopup; + bool m_bPopup; CFX_FloatRect m_rcOldWindow; int32_t m_nPopupWhere; int32_t m_nSelectItem; diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index c8de0d2deb..153e9ab4b7 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -27,10 +27,10 @@ #include "third_party/base/stl_util.h" CPWL_Edit::CPWL_Edit() - : m_pFillerNotify(nullptr), m_bFocus(FALSE), m_pFormFiller(nullptr) {} + : m_pFillerNotify(nullptr), m_bFocus(false), m_pFormFiller(nullptr) {} CPWL_Edit::~CPWL_Edit() { - ASSERT(m_bFocus == FALSE); + ASSERT(m_bFocus == false); } CFX_ByteString CPWL_Edit::GetClassName() const { @@ -46,7 +46,7 @@ void CPWL_Edit::SetText(const CFX_WideString& csText) { if (CXML_Element* pXML = CXML_Element::Parse(sValue.c_str(), sValue.GetLength())) { int32_t nCount = pXML->CountChildren(); - FX_BOOL bFirst = TRUE; + bool bFirst = true; swText.clear(); @@ -61,7 +61,7 @@ void CPWL_Edit::SetText(const CFX_WideString& csText) { } if (bFirst) - bFirst = FALSE; + bFirst = false; else swText += FWL_VKEY_Return; swText += swSection; @@ -82,7 +82,7 @@ void CPWL_Edit::RePosChildWnd() { CFX_FloatRect rcVScroll = CFX_FloatRect(rcWindow.right, rcWindow.bottom, rcWindow.right + PWL_SCROLLBAR_WIDTH, rcWindow.top); - pVSB->Move(rcVScroll, TRUE, FALSE); + pVSB->Move(rcVScroll, true, false); } if (m_pEditCaret && !HasFlag(PES_TEXTOVERFLOW)) @@ -105,25 +105,24 @@ CFX_FloatRect CPWL_Edit::GetClientRect() const { return rcClient; } -void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, - FX_BOOL bPaint) { +void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, bool bPaint) { m_pEdit->SetAlignmentV((int32_t)nFormat, bPaint); } -FX_BOOL CPWL_Edit::CanSelectAll() const { +bool CPWL_Edit::CanSelectAll() const { return GetSelectWordRange() != m_pEdit->GetWholeWordRange(); } -FX_BOOL CPWL_Edit::CanClear() const { +bool CPWL_Edit::CanClear() const { return !IsReadOnly() && m_pEdit->IsSelected(); } -FX_BOOL CPWL_Edit::CanCopy() const { +bool CPWL_Edit::CanCopy() const { return !HasFlag(PES_PASSWORD) && !HasFlag(PES_NOREAD) && m_pEdit->IsSelected(); } -FX_BOOL CPWL_Edit::CanCut() const { +bool CPWL_Edit::CanCut() const { return CanCopy() && !IsReadOnly(); } void CPWL_Edit::CutText() { @@ -145,39 +144,39 @@ void CPWL_Edit::OnCreated() { m_rcOldWindow = GetWindowRect(); m_pEdit->SetOprNotify(this); - m_pEdit->EnableOprNotify(TRUE); + m_pEdit->EnableOprNotify(true); } void CPWL_Edit::SetParamByFlag() { if (HasFlag(PES_RIGHT)) { - m_pEdit->SetAlignmentH(2, FALSE); + m_pEdit->SetAlignmentH(2, false); } else if (HasFlag(PES_MIDDLE)) { - m_pEdit->SetAlignmentH(1, FALSE); + m_pEdit->SetAlignmentH(1, false); } else { - m_pEdit->SetAlignmentH(0, FALSE); + m_pEdit->SetAlignmentH(0, false); } if (HasFlag(PES_BOTTOM)) { - m_pEdit->SetAlignmentV(2, FALSE); + m_pEdit->SetAlignmentV(2, false); } else if (HasFlag(PES_CENTER)) { - m_pEdit->SetAlignmentV(1, FALSE); + m_pEdit->SetAlignmentV(1, false); } else { - m_pEdit->SetAlignmentV(0, FALSE); + m_pEdit->SetAlignmentV(0, false); } if (HasFlag(PES_PASSWORD)) { - m_pEdit->SetPasswordChar('*', FALSE); + m_pEdit->SetPasswordChar('*', false); } - m_pEdit->SetMultiLine(HasFlag(PES_MULTILINE), FALSE); - m_pEdit->SetAutoReturn(HasFlag(PES_AUTORETURN), FALSE); - m_pEdit->SetAutoFontSize(HasFlag(PWS_AUTOFONTSIZE), FALSE); - m_pEdit->SetAutoScroll(HasFlag(PES_AUTOSCROLL), FALSE); + m_pEdit->SetMultiLine(HasFlag(PES_MULTILINE), false); + m_pEdit->SetAutoReturn(HasFlag(PES_AUTORETURN), false); + m_pEdit->SetAutoFontSize(HasFlag(PWS_AUTOFONTSIZE), false); + m_pEdit->SetAutoScroll(HasFlag(PES_AUTOSCROLL), false); m_pEdit->EnableUndo(HasFlag(PES_UNDO)); if (HasFlag(PES_TEXTOVERFLOW)) { SetClipRect(CFX_FloatRect(0.0f, 0.0f, 0.0f, 0.0f)); - m_pEdit->SetTextOverflow(TRUE, FALSE); + m_pEdit->SetTextOverflow(true, false); } else { if (m_pEditCaret) { m_pEditCaret->SetClipRect(CPWL_Utils::InflateRect( @@ -197,8 +196,9 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (nCharArray > 0) { switch (GetBorderStyle()) { case BorderStyle::SOLID: { - sLine << "q\n" << GetBorderWidth() << " w\n" - << CPWL_Utils::GetColorAppStream(GetBorderColor(), FALSE) + sLine << "q\n" + << GetBorderWidth() << " w\n" + << CPWL_Utils::GetColorAppStream(GetBorderColor(), false) .AsStringC() << " 2 J 0 j\n"; @@ -215,8 +215,9 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { break; } case BorderStyle::DASH: { - sLine << "q\n" << GetBorderWidth() << " w\n" - << CPWL_Utils::GetColorAppStream(GetBorderColor(), FALSE) + sLine << "q\n" + << GetBorderWidth() << " w\n" + << CPWL_Utils::GetColorAppStream(GetBorderColor(), false) .AsStringC() << " 2 J 0 j\n" << "[" << GetBorderDash().nDash << " " << GetBorderDash().nGap @@ -397,66 +398,65 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, rcClip, CFX_FloatPoint(), pRange, pSysHandler, m_pFormFiller); } -FX_BOOL CPWL_Edit::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Edit::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { if (m_bMouseDown) InvalidateRect(); - m_bMouseDown = TRUE; + m_bMouseDown = true; SetCapture(); m_pEdit->OnMouseDown(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); } - return TRUE; + return true; } -FX_BOOL CPWL_Edit::OnLButtonDblClk(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_Edit::OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDblClk(point, nFlag); if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { m_pEdit->SelectAll(); } - return TRUE; + return true; } -FX_BOOL CPWL_Edit::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Edit::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { if (m_bMouseDown) - return FALSE; + return false; CPWL_Wnd::OnRButtonUp(point, nFlag); if (!HasFlag(PES_TEXTOVERFLOW) && !ClientHitTest(point)) - return TRUE; + return true; CFX_SystemHandler* pSH = GetSystemHandler(); if (!pSH) - return FALSE; + return false; SetFocus(); - return FALSE; + return false; } void CPWL_Edit::OnSetFocus() { - SetEditCaret(TRUE); + SetEditCaret(true); if (!IsReadOnly()) { if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler()) pFocusHandler->OnSetFocus(this); } - m_bFocus = TRUE; + m_bFocus = true; } void CPWL_Edit::OnKillFocus() { - ShowVScrollBar(FALSE); + ShowVScrollBar(false); m_pEdit->SelectNone(); - SetCaret(FALSE, CFX_FloatPoint(), CFX_FloatPoint()); + SetCaret(false, CFX_FloatPoint(), CFX_FloatPoint()); SetCharSet(FXFONT_ANSI_CHARSET); - m_bFocus = FALSE; + m_bFocus = false; } void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace) { @@ -520,7 +520,7 @@ CFX_FloatPoint CPWL_Edit::GetWordRightBottomPoint( return pt; } -FX_BOOL CPWL_Edit::IsTextFull() const { +bool CPWL_Edit::IsTextFull() const { return m_pEdit->IsTextFull(); } @@ -544,14 +544,14 @@ FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont, void CPWL_Edit::SetCharArray(int32_t nCharArray) { if (HasFlag(PES_CHARARRAY) && nCharArray > 0) { m_pEdit->SetCharArray(nCharArray); - m_pEdit->SetTextOverflow(TRUE, TRUE); + m_pEdit->SetTextOverflow(true, true); if (HasFlag(PWS_AUTOFONTSIZE)) { if (IPVT_FontMap* pFontMap = GetFontMap()) { FX_FLOAT fFontSize = GetCharArrayAutoFontSize( pFontMap->GetPDFFont(0), GetClientRect(), nCharArray); if (fFontSize > 0.0f) { - m_pEdit->SetAutoFontSize(FALSE, TRUE); + m_pEdit->SetAutoFontSize(false, true); m_pEdit->SetFontSize(fFontSize); } } @@ -572,41 +572,41 @@ CFX_FloatRect CPWL_Edit::GetFocusRect() const { return CFX_FloatRect(); } -void CPWL_Edit::ShowVScrollBar(FX_BOOL bShow) { +void CPWL_Edit::ShowVScrollBar(bool bShow) { if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { if (bShow) { if (!pScroll->IsVisible()) { - pScroll->SetVisible(TRUE); + pScroll->SetVisible(true); CFX_FloatRect rcWindow = GetWindowRect(); m_rcOldWindow = rcWindow; rcWindow.right += PWL_SCROLLBAR_WIDTH; - Move(rcWindow, TRUE, TRUE); + Move(rcWindow, true, true); } } else { if (pScroll->IsVisible()) { - pScroll->SetVisible(FALSE); - Move(m_rcOldWindow, TRUE, TRUE); + pScroll->SetVisible(false); + Move(m_rcOldWindow, true, true); } } } } -FX_BOOL CPWL_Edit::IsVScrollBarVisible() const { +bool CPWL_Edit::IsVScrollBarVisible() const { if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { return pScroll->IsVisible(); } - return FALSE; + return false; } -FX_BOOL CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { +bool CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { if (m_bMouseDown) - return TRUE; + return true; if (nChar == FWL_VKEY_Delete) { if (m_pFillerNotify) { - FX_BOOL bRC = TRUE; - FX_BOOL bExit = FALSE; + bool bRC = true; + bool bExit = false; CFX_WideString strChange; CFX_WideString strChangeEx; @@ -617,20 +617,20 @@ FX_BOOL CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { if (nSelStart == nSelEnd) nSelEnd = nSelStart + 1; m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), strChange, - strChangeEx, nSelStart, nSelEnd, TRUE, + strChangeEx, nSelStart, nSelEnd, true, bRC, bExit, nFlag); if (!bRC) - return FALSE; + return false; if (bExit) - return FALSE; + return false; } } - FX_BOOL bRet = CPWL_EditCtrl::OnKeyDown(nChar, nFlag); + bool bRet = CPWL_EditCtrl::OnKeyDown(nChar, nFlag); // In case of implementation swallow the OnKeyDown event. if (IsProceedtoOnChar(nChar, nFlag)) - return TRUE; + return true; return bRet; } @@ -640,9 +640,9 @@ FX_BOOL CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { *If the event is swallowed, implementation may do other unexpected things, which *is not the control means to do. */ -FX_BOOL CPWL_Edit::IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag) { - FX_BOOL bCtrl = IsCTRLpressed(nFlag); - FX_BOOL bAlt = IsALTpressed(nFlag); +bool CPWL_Edit::IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag) { + bool bCtrl = IsCTRLpressed(nFlag); + bool bAlt = IsALTpressed(nFlag); if (bCtrl && !bAlt) { // hot keys for edit control. switch (nKeyCode) { @@ -651,7 +651,7 @@ FX_BOOL CPWL_Edit::IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag) { case 'X': case 'A': case 'Z': - return TRUE; + return true; default: break; } @@ -662,18 +662,18 @@ FX_BOOL CPWL_Edit::IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag) { case FWL_VKEY_Back: case FWL_VKEY_Return: case FWL_VKEY_Space: - return TRUE; + return true; default: - return FALSE; + return false; } } -FX_BOOL CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { +bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { if (m_bMouseDown) - return TRUE; + return true; - FX_BOOL bRC = TRUE; - FX_BOOL bExit = FALSE; + bool bRC = true; + bool bExit = false; if (!IsCTRLpressed(nFlag)) { if (m_pFillerNotify) { @@ -697,15 +697,15 @@ FX_BOOL CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { CFX_WideString strChangeEx; m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange, - strChangeEx, nSelStart, nSelEnd, TRUE, + strChangeEx, nSelStart, nSelEnd, true, bRC, bExit, nFlag); } } if (!bRC) - return TRUE; + return true; if (bExit) - return FALSE; + return false; if (IPVT_FontMap* pFontMap = GetFontMap()) { int32_t nOldCharSet = GetCharSet(); @@ -719,9 +719,9 @@ FX_BOOL CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { return CPWL_EditCtrl::OnChar(nChar, nFlag); } -FX_BOOL CPWL_Edit::OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_Edit::OnMouseWheel(short zDelta, + const CFX_FloatPoint& point, + uint32_t nFlag) { if (HasFlag(PES_MULTILINE)) { CFX_FloatPoint ptScroll = GetScrollPos(); @@ -732,10 +732,10 @@ FX_BOOL CPWL_Edit::OnMouseWheel(short zDelta, } SetScrollPos(ptScroll); - return TRUE; + return true; } - return FALSE; + return false; } void CPWL_Edit::OnInsertReturn(const CPVT_WordPlace& place, @@ -807,25 +807,25 @@ CPVT_WordRange CPWL_Edit::CombineWordRange(const CPVT_WordRange& wr1, CPVT_WordRange CPWL_Edit::GetLatinWordsRange( const CFX_FloatPoint& point) const { - return GetSameWordsRange(m_pEdit->SearchWordPlace(point), TRUE, FALSE); + return GetSameWordsRange(m_pEdit->SearchWordPlace(point), true, false); } CPVT_WordRange CPWL_Edit::GetLatinWordsRange( const CPVT_WordPlace& place) const { - return GetSameWordsRange(place, TRUE, FALSE); + return GetSameWordsRange(place, true, false); } CPVT_WordRange CPWL_Edit::GetArabicWordsRange( const CPVT_WordPlace& place) const { - return GetSameWordsRange(place, FALSE, TRUE); + return GetSameWordsRange(place, false, true); } #define PWL_ISARABICWORD(word) \ ((word >= 0x0600 && word <= 0x06FF) || (word >= 0xFB50 && word <= 0xFEFC)) CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place, - FX_BOOL bLatin, - FX_BOOL bArabic) const { + bool bLatin, + bool bArabic) const { CPVT_WordRange range; CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); diff --git a/fpdfsdk/pdfwindow/PWL_Edit.h b/fpdfsdk/pdfwindow/PWL_Edit.h index ec0fd60ed8..3832236bda 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.h +++ b/fpdfsdk/pdfwindow/PWL_Edit.h @@ -30,16 +30,16 @@ class IPWL_Filler_Notify { const CFX_WideString& strChangeEx, int nSelStart, int nSelEnd, - FX_BOOL bKeyDown, - FX_BOOL& bRC, - FX_BOOL& bExit, + bool bKeyDown, + bool& bRC, + bool& bExit, uint32_t nFlag) = 0; #ifdef PDF_ENABLE_XFA virtual void OnPopupPreOpen(void* pPrivateData, - FX_BOOL& bExit, + bool& bExit, uint32_t nFlag) = 0; virtual void OnPopupPostOpen(void* pPrivateData, - FX_BOOL& bExit, + bool& bExit, uint32_t nFlag) = 0; #endif // PDF_ENABLE_XFA }; @@ -58,30 +58,30 @@ class CPWL_Edit : public CPWL_EditCtrl { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, - uint32_t nFlag) override; - FX_BOOL OnKeyDown(uint16_t nChar, uint32_t nFlag) override; - FX_BOOL OnChar(uint16_t nChar, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnMouseWheel(short zDelta, + const CFX_FloatPoint& point, + uint32_t nFlag) override; + bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; + bool OnChar(uint16_t nChar, uint32_t nFlag) override; CFX_FloatRect GetFocusRect() const override; void OnSetFocus() override; void OnKillFocus() override; void SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat = PEAV_TOP, - FX_BOOL bPaint = TRUE); // 0:top 1:bottom 2:center + bool bPaint = true); // 0:top 1:bottom 2:center void SetCharArray(int32_t nCharArray); void SetLimitChar(int32_t nLimitChar); void SetCharSpace(FX_FLOAT fCharSpace); - FX_BOOL CanSelectAll() const; - FX_BOOL CanClear() const; - FX_BOOL CanCopy() const; - FX_BOOL CanCut() const; + bool CanSelectAll() const; + bool CanClear() const; + bool CanCopy() const; + bool CanCut() const; void CutText(); @@ -93,7 +93,7 @@ class CPWL_Edit : public CPWL_EditCtrl { CFX_ByteString GetSelectAppearanceStream( const CFX_FloatPoint& ptOffset) const; - FX_BOOL IsTextFull() const; + bool IsTextFull() const; static FX_FLOAT GetCharArrayAutoFontSize(CPDF_Font* pFont, const CFX_FloatRect& rcPlate, @@ -109,7 +109,7 @@ class CPWL_Edit : public CPWL_EditCtrl { void GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, const CFX_FloatPoint& ptOffset); - FX_BOOL IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag); + bool IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag); void AttachFFLData(CFFL_FormFiller* pData) { m_pFormFiller = pData; } void OnInsertWord(const CPVT_WordPlace& place, @@ -124,8 +124,8 @@ class CPWL_Edit : public CPWL_EditCtrl { private: CPVT_WordRange GetSelectWordRange() const; - virtual void ShowVScrollBar(FX_BOOL bShow); - FX_BOOL IsVScrollBarVisible() const; + virtual void ShowVScrollBar(bool bShow); + bool IsVScrollBarVisible() const; void SetParamByFlag(); FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray); @@ -137,10 +137,10 @@ class CPWL_Edit : public CPWL_EditCtrl { CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const; CPVT_WordRange GetArabicWordsRange(const CPVT_WordPlace& place) const; CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace& place, - FX_BOOL bLatin, - FX_BOOL bArabic) const; + bool bLatin, + bool bArabic) const; IPWL_Filler_Notify* m_pFillerNotify; - FX_BOOL m_bFocus; + bool m_bFocus; CFX_FloatRect m_rcOldWindow; CFFL_FormFiller* m_pFormFiller; // Not owned. }; diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp index 893ca932a2..94592159d4 100644 --- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp +++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp @@ -20,7 +20,7 @@ CPWL_EditCtrl::CPWL_EditCtrl() : m_pEdit(new CFX_Edit), m_pEditCaret(nullptr), - m_bMouseDown(FALSE), + m_bMouseDown(false), m_nCharSet(FXFONT_DEFAULT_CHARSET), m_nCodePage(0) {} @@ -38,7 +38,7 @@ void CPWL_EditCtrl::OnCreated() { m_pEdit->Initialize(); } -FX_BOOL CPWL_EditCtrl::IsWndHorV() { +bool CPWL_EditCtrl::IsWndHorV() { CFX_Matrix mt = GetWindowMatrix(); CFX_FloatPoint point1(0, 1); CFX_FloatPoint point2(1, 1); @@ -136,16 +136,16 @@ FX_FLOAT CPWL_EditCtrl::GetFontSize() const { return m_pEdit->GetFontSize(); } -FX_BOOL CPWL_EditCtrl::OnKeyDown(uint16_t nChar, uint32_t nFlag) { +bool CPWL_EditCtrl::OnKeyDown(uint16_t nChar, uint32_t nFlag) { if (m_bMouseDown) - return TRUE; + return true; - FX_BOOL bRet = CPWL_Wnd::OnKeyDown(nChar, nFlag); + bool bRet = CPWL_Wnd::OnKeyDown(nChar, nFlag); // FILTER switch (nChar) { default: - return FALSE; + return false; case FWL_VKEY_Delete: case FWL_VKEY_Up: case FWL_VKEY_Down: @@ -173,35 +173,35 @@ FX_BOOL CPWL_EditCtrl::OnKeyDown(uint16_t nChar, uint32_t nFlag) { switch (nChar) { case FWL_VKEY_Delete: Delete(); - return TRUE; + return true; case FWL_VKEY_Insert: if (IsSHIFTpressed(nFlag)) PasteText(); - return TRUE; + return true; case FWL_VKEY_Up: - m_pEdit->OnVK_UP(IsSHIFTpressed(nFlag), FALSE); - return TRUE; + m_pEdit->OnVK_UP(IsSHIFTpressed(nFlag), false); + return true; case FWL_VKEY_Down: - m_pEdit->OnVK_DOWN(IsSHIFTpressed(nFlag), FALSE); - return TRUE; + m_pEdit->OnVK_DOWN(IsSHIFTpressed(nFlag), false); + return true; case FWL_VKEY_Left: - m_pEdit->OnVK_LEFT(IsSHIFTpressed(nFlag), FALSE); - return TRUE; + m_pEdit->OnVK_LEFT(IsSHIFTpressed(nFlag), false); + return true; case FWL_VKEY_Right: - m_pEdit->OnVK_RIGHT(IsSHIFTpressed(nFlag), FALSE); - return TRUE; + m_pEdit->OnVK_RIGHT(IsSHIFTpressed(nFlag), false); + return true; case FWL_VKEY_Home: m_pEdit->OnVK_HOME(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); - return TRUE; + return true; case FWL_VKEY_End: m_pEdit->OnVK_END(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); - return TRUE; + return true; case FWL_VKEY_Unknown: if (!IsSHIFTpressed(nFlag)) Clear(); else CutText(); - return TRUE; + return true; default: break; } @@ -209,9 +209,9 @@ FX_BOOL CPWL_EditCtrl::OnKeyDown(uint16_t nChar, uint32_t nFlag) { return bRet; } -FX_BOOL CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { +bool CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { if (m_bMouseDown) - return TRUE; + return true; CPWL_Wnd::OnChar(nChar, nFlag); @@ -219,14 +219,14 @@ FX_BOOL CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { switch (nChar) { case 0x0A: case 0x1B: - return FALSE; + return false; default: break; } - FX_BOOL bCtrl = IsCTRLpressed(nFlag); - FX_BOOL bAlt = IsALTpressed(nFlag); - FX_BOOL bShift = IsSHIFTpressed(nFlag); + bool bCtrl = IsCTRLpressed(nFlag); + bool bAlt = IsALTpressed(nFlag); + bool bShift = IsSHIFTpressed(nFlag); uint16_t word = nChar; @@ -234,30 +234,30 @@ FX_BOOL CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { switch (nChar) { case 'C' - 'A' + 1: CopyText(); - return TRUE; + return true; case 'V' - 'A' + 1: PasteText(); - return TRUE; + return true; case 'X' - 'A' + 1: CutText(); - return TRUE; + return true; case 'A' - 'A' + 1: SelectAll(); - return TRUE; + return true; case 'Z' - 'A' + 1: if (bShift) Redo(); else Undo(); - return TRUE; + return true; default: if (nChar < 32) - return FALSE; + return false; } } if (IsReadOnly()) - return TRUE; + return true; if (m_pEdit->IsSelected() && word == FWL_VKEY_Back) word = FWL_VKEY_Unknown; @@ -278,28 +278,26 @@ FX_BOOL CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { break; } - return TRUE; + return true; } -FX_BOOL CPWL_EditCtrl::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_EditCtrl::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (ClientHitTest(point)) { if (m_bMouseDown) InvalidateRect(); - m_bMouseDown = TRUE; + m_bMouseDown = true; SetCapture(); m_pEdit->OnMouseDown(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); } - return TRUE; + return true; } -FX_BOOL CPWL_EditCtrl::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_EditCtrl::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (m_bMouseDown) { @@ -308,27 +306,26 @@ FX_BOOL CPWL_EditCtrl::OnLButtonUp(const CFX_FloatPoint& point, SetFocus(); ReleaseCapture(); - m_bMouseDown = FALSE; + m_bMouseDown = false; } - return TRUE; + return true; } -FX_BOOL CPWL_EditCtrl::OnMouseMove(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_EditCtrl::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnMouseMove(point, nFlag); if (m_bMouseDown) - m_pEdit->OnMouseMove(point, FALSE, FALSE); + m_pEdit->OnMouseMove(point, false, false); - return TRUE; + return true; } CFX_FloatRect CPWL_EditCtrl::GetContentRect() const { return m_pEdit->GetContentRect(); } -void CPWL_EditCtrl::SetEditCaret(FX_BOOL bVisible) { +void CPWL_EditCtrl::SetEditCaret(bool bVisible) { CFX_FloatPoint ptHead; CFX_FloatPoint ptFoot; if (bVisible) @@ -364,12 +361,12 @@ void CPWL_EditCtrl::GetCaretPos(int32_t& x, int32_t& y) const { PWLtoWnd(ptHead, x, y); } -void CPWL_EditCtrl::SetCaret(FX_BOOL bVisible, +void CPWL_EditCtrl::SetCaret(bool bVisible, const CFX_FloatPoint& ptHead, const CFX_FloatPoint& ptFoot) { if (m_pEditCaret) { if (!IsFocused() || m_pEdit->IsSelected()) - bVisible = FALSE; + bVisible = false; m_pEditCaret->SetCaret(bVisible, ptHead, ptFoot); } @@ -400,7 +397,7 @@ void CPWL_EditCtrl::Paint() { m_pEdit->Paint(); } -void CPWL_EditCtrl::EnableRefresh(FX_BOOL bRefresh) { +void CPWL_EditCtrl::EnableRefresh(bool bRefresh) { m_pEdit->EnableRefresh(bRefresh); } @@ -473,7 +470,7 @@ void CPWL_EditCtrl::PasteText() {} void CPWL_EditCtrl::CutText() {} -void CPWL_EditCtrl::ShowVScrollBar(FX_BOOL bShow) {} +void CPWL_EditCtrl::ShowVScrollBar(bool bShow) {} void CPWL_EditCtrl::InsertText(const CFX_WideString& wsText) { if (!IsReadOnly()) @@ -500,11 +497,11 @@ void CPWL_EditCtrl::Backspace() { m_pEdit->Backspace(); } -FX_BOOL CPWL_EditCtrl::CanUndo() const { +bool CPWL_EditCtrl::CanUndo() const { return !IsReadOnly() && m_pEdit->CanUndo(); } -FX_BOOL CPWL_EditCtrl::CanRedo() const { +bool CPWL_EditCtrl::CanRedo() const { return !IsReadOnly() && m_pEdit->CanRedo(); } @@ -536,9 +533,9 @@ void CPWL_EditCtrl::IOnSetScrollInfoY(FX_FLOAT fPlateMin, if (IsFloatBigger(Info.fPlateWidth, Info.fContentMax - Info.fContentMin) || IsFloatEqual(Info.fPlateWidth, Info.fContentMax - Info.fContentMin)) { - ShowVScrollBar(FALSE); + ShowVScrollBar(false); } else { - ShowVScrollBar(TRUE); + ShowVScrollBar(true); } } @@ -546,7 +543,7 @@ void CPWL_EditCtrl::IOnSetScrollPosY(FX_FLOAT fy) { OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&fy); } -void CPWL_EditCtrl::IOnSetCaret(FX_BOOL bVisible, +void CPWL_EditCtrl::IOnSetCaret(bool bVisible, const CFX_FloatPoint& ptHead, const CFX_FloatPoint& ptFoot, const CPVT_WordPlace& place) { @@ -590,6 +587,6 @@ CFX_WideString CPWL_EditCtrl::GetText(int32_t& nStartChar, void CPWL_EditCtrl::SetReadyToInput() { if (m_bMouseDown) { ReleaseCapture(); - m_bMouseDown = FALSE; + m_bMouseDown = false; } } diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/pdfwindow/PWL_EditCtrl.h index 161bc57bb0..344d25b72b 100644 --- a/fpdfsdk/pdfwindow/PWL_EditCtrl.h +++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.h @@ -50,7 +50,7 @@ class CPWL_EditCtrl : public CPWL_Wnd { void Paint(); - void EnableRefresh(FX_BOOL bRefresh); + void EnableRefresh(bool bRefresh); CFX_FloatPoint GetScrollPos() const; void SetScrollPos(const CFX_FloatPoint& point); @@ -63,8 +63,8 @@ class CPWL_EditCtrl : public CPWL_Wnd { CPDF_Font* GetCaretFont() const; FX_FLOAT GetCaretFontSize() const; - FX_BOOL CanUndo() const; - FX_BOOL CanRedo() const; + bool CanUndo() const; + bool CanRedo() const; void Redo(); void Undo(); @@ -73,11 +73,11 @@ class CPWL_EditCtrl : public CPWL_Wnd { // CPWL_Wnd void OnCreate(PWL_CREATEPARAM& cp) override; void OnCreated() override; - FX_BOOL OnKeyDown(uint16_t nChar, uint32_t nFlag) override; - FX_BOOL OnChar(uint16_t nChar, uint32_t nFlag) override; - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; + bool OnChar(uint16_t nChar, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; void OnNotify(CPWL_Wnd* pWnd, uint32_t msg, intptr_t wParam = 0, @@ -95,7 +95,7 @@ class CPWL_EditCtrl : public CPWL_Wnd { FX_FLOAT fSmallStep, FX_FLOAT fBigStep); void IOnSetScrollPosY(FX_FLOAT fy); - void IOnSetCaret(FX_BOOL bVisible, + void IOnSetCaret(bool bVisible, const CFX_FloatPoint& ptHead, const CFX_FloatPoint& ptFoot, const CPVT_WordPlace& place); @@ -110,25 +110,25 @@ class CPWL_EditCtrl : public CPWL_Wnd { void CopyText(); void PasteText(); void CutText(); - void ShowVScrollBar(FX_BOOL bShow); + void ShowVScrollBar(bool bShow); void InsertWord(uint16_t word, int32_t nCharset); void InsertReturn(); - FX_BOOL IsWndHorV(); + bool IsWndHorV(); void Delete(); void Backspace(); void GetCaretInfo(CFX_FloatPoint& ptHead, CFX_FloatPoint& ptFoot) const; - void SetCaret(FX_BOOL bVisible, + void SetCaret(bool bVisible, const CFX_FloatPoint& ptHead, const CFX_FloatPoint& ptFoot); - void SetEditCaret(FX_BOOL bVisible); + void SetEditCaret(bool bVisible); std::unique_ptr<CFX_Edit> m_pEdit; CPWL_Caret* m_pEditCaret; - FX_BOOL m_bMouseDown; + bool m_bMouseDown; private: void CreateEditCaret(const PWL_CREATEPARAM& cp); diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp index b2a1f2580d..15fbbeebf6 100644 --- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp @@ -76,14 +76,14 @@ CFX_ByteString CPWL_FontMap::GetPDFFontAlias(int32_t nFontIndex) { return ""; } -FX_BOOL CPWL_FontMap::KnowWord(int32_t nFontIndex, uint16_t word) { +bool CPWL_FontMap::KnowWord(int32_t nFontIndex, uint16_t word) { if (nFontIndex >= 0 && nFontIndex < m_aData.GetSize()) { if (m_aData.GetAt(nFontIndex)) { return CharCodeFromUnicode(nFontIndex, word) >= 0; } } - return FALSE; + return false; } int32_t CPWL_FontMap::GetWordFontIndex(uint16_t word, @@ -104,13 +104,13 @@ int32_t CPWL_FontMap::GetWordFontIndex(uint16_t word, } int32_t nNewFontIndex = - GetFontIndex(GetNativeFontName(nCharset), nCharset, TRUE); + GetFontIndex(GetNativeFontName(nCharset), nCharset, true); if (nNewFontIndex >= 0) { if (KnowWord(nNewFontIndex, word)) return nNewFontIndex; } nNewFontIndex = - GetFontIndex("Arial Unicode MS", FXFONT_DEFAULT_CHARSET, FALSE); + GetFontIndex("Arial Unicode MS", FXFONT_DEFAULT_CHARSET, false); if (nNewFontIndex >= 0) { if (KnowWord(nNewFontIndex, word)) return nNewFontIndex; @@ -170,16 +170,16 @@ void CPWL_FontMap::Empty() { } void CPWL_FontMap::Initialize() { - GetFontIndex(kDefaultFontName, FXFONT_ANSI_CHARSET, FALSE); + GetFontIndex(kDefaultFontName, FXFONT_ANSI_CHARSET, false); } -FX_BOOL CPWL_FontMap::IsStandardFont(const CFX_ByteString& sFontName) { +bool CPWL_FontMap::IsStandardFont(const CFX_ByteString& sFontName) { for (size_t i = 0; i < FX_ArraySize(g_sDEStandardFontName); ++i) { if (sFontName == g_sDEStandardFontName[i]) - return TRUE; + return true; } - return FALSE; + return false; } int32_t CPWL_FontMap::FindFont(const CFX_ByteString& sFontName, @@ -198,7 +198,7 @@ int32_t CPWL_FontMap::FindFont(const CFX_ByteString& sFontName, int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName, int32_t nCharset, - FX_BOOL bFind) { + bool bFind) { int32_t nFontIndex = FindFont(EncodeFontAlias(sFontName, nCharset), nCharset); if (nFontIndex >= 0) return nFontIndex; diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.h b/fpdfsdk/pdfwindow/PWL_FontMap.h index efbc2001b3..fbf5ee0986 100644 --- a/fpdfsdk/pdfwindow/PWL_FontMap.h +++ b/fpdfsdk/pdfwindow/PWL_FontMap.h @@ -56,12 +56,12 @@ class CPWL_FontMap : public IPVT_FontMap { int32_t nCharset); virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias); - FX_BOOL KnowWord(int32_t nFontIndex, uint16_t word); + bool KnowWord(int32_t nFontIndex, uint16_t word); void Empty(); int32_t GetFontIndex(const CFX_ByteString& sFontName, int32_t nCharset, - FX_BOOL bFind); + bool bFind); int32_t AddFontData(CPDF_Font* pFont, const CFX_ByteString& sFontAlias, int32_t nCharset = FXFONT_DEFAULT_CHARSET); @@ -81,7 +81,7 @@ class CPWL_FontMap : public IPVT_FontMap { CPDF_Font* AddFontToDocument(CPDF_Document* pDoc, CFX_ByteString& sFontName, uint8_t nCharset); - FX_BOOL IsStandardFont(const CFX_ByteString& sFontName); + bool IsStandardFont(const CFX_ByteString& sFontName); CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName); CPDF_Font* AddSystemFont(CPDF_Document* pDoc, CFX_ByteString& sFontName, diff --git a/fpdfsdk/pdfwindow/PWL_Icon.cpp b/fpdfsdk/pdfwindow/PWL_Icon.cpp index 19adf91cfe..877921d6e8 100644 --- a/fpdfsdk/pdfwindow/PWL_Icon.cpp +++ b/fpdfsdk/pdfwindow/PWL_Icon.cpp @@ -123,11 +123,11 @@ int32_t CPWL_Icon::GetScaleMethod() { return 0; } -FX_BOOL CPWL_Icon::IsProportionalScale() { +bool CPWL_Icon::IsProportionalScale() { if (m_pIconFit) return m_pIconFit->IsProportionalScale(); - return FALSE; + return false; } void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { diff --git a/fpdfsdk/pdfwindow/PWL_Icon.h b/fpdfsdk/pdfwindow/PWL_Icon.h index b3b59ca1ba..4b62db4c99 100644 --- a/fpdfsdk/pdfwindow/PWL_Icon.h +++ b/fpdfsdk/pdfwindow/PWL_Icon.h @@ -45,7 +45,7 @@ class CPWL_Icon : public CPWL_Image { void GetImageOffset(FX_FLOAT& x, FX_FLOAT& y) override; int32_t GetScaleMethod(); - FX_BOOL IsProportionalScale(); + bool IsProportionalScale(); void GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom); void SetIconFit(CPDF_IconFit* pIconFit) { m_pIconFit = pIconFit; } diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp index 8739c3b515..12cad7b9da 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp @@ -42,12 +42,12 @@ void CPWL_List_Notify::IOnSetScrollInfoY(FX_FLOAT fPlateMin, if (IsFloatBigger(Info.fPlateWidth, Info.fContentMax - Info.fContentMin) || IsFloatEqual(Info.fPlateWidth, Info.fContentMax - Info.fContentMin)) { if (pScroll->IsVisible()) { - pScroll->SetVisible(FALSE); + pScroll->SetVisible(false); m_pList->RePosChildWnd(); } } else { if (!pScroll->IsVisible()) { - pScroll->SetVisible(TRUE); + pScroll->SetVisible(true); m_pList->RePosChildWnd(); } } @@ -64,8 +64,8 @@ void CPWL_List_Notify::IOnInvalidateRect(CFX_FloatRect* pRect) { CPWL_ListBox::CPWL_ListBox() : m_pList(new CFX_ListCtrl), - m_bMouseDown(FALSE), - m_bHoverSel(FALSE), + m_bMouseDown(false), + m_bHoverSel(false), m_pFillerNotify(nullptr) {} CPWL_ListBox::~CPWL_ListBox() { @@ -193,12 +193,12 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, } } -FX_BOOL CPWL_ListBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) { +bool CPWL_ListBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) { CPWL_Wnd::OnKeyDown(nChar, nFlag); switch (nChar) { default: - return FALSE; + return false; case FWL_VKEY_Up: case FWL_VKEY_Down: case FWL_VKEY_Home: @@ -231,58 +231,57 @@ FX_BOOL CPWL_ListBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) { break; } - FX_BOOL bExit = FALSE; - OnNotifySelChanged(TRUE, bExit, nFlag); + bool bExit = false; + OnNotifySelChanged(true, bExit, nFlag); - return TRUE; + return true; } -FX_BOOL CPWL_ListBox::OnChar(uint16_t nChar, uint32_t nFlag) { +bool CPWL_ListBox::OnChar(uint16_t nChar, uint32_t nFlag) { CPWL_Wnd::OnChar(nChar, nFlag); if (!m_pList->OnChar(nChar, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag))) - return FALSE; + return false; - FX_BOOL bExit = FALSE; - OnNotifySelChanged(TRUE, bExit, nFlag); + bool bExit = false; + OnNotifySelChanged(true, bExit, nFlag); - return TRUE; + return true; } -FX_BOOL CPWL_ListBox::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_ListBox::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (ClientHitTest(point)) { - m_bMouseDown = TRUE; + m_bMouseDown = true; SetFocus(); SetCapture(); m_pList->OnMouseDown(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); } - return TRUE; + return true; } -FX_BOOL CPWL_ListBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_ListBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (m_bMouseDown) { ReleaseCapture(); - m_bMouseDown = FALSE; + m_bMouseDown = false; } - FX_BOOL bExit = FALSE; - OnNotifySelChanged(FALSE, bExit, nFlag); + bool bExit = false; + OnNotifySelChanged(false, bExit, nFlag); - return TRUE; + return true; } -void CPWL_ListBox::SetHoverSel(FX_BOOL bHoverSel) { +void CPWL_ListBox::SetHoverSel(bool bHoverSel) { m_bHoverSel = bHoverSel; } -FX_BOOL CPWL_ListBox::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_ListBox::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnMouseMove(point, nFlag); if (m_bHoverSel && !IsCaptureMouse() && ClientHitTest(point)) @@ -290,7 +289,7 @@ FX_BOOL CPWL_ListBox::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { if (m_bMouseDown) m_pList->OnMouseMove(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); - return TRUE; + return true; } void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, @@ -341,13 +340,13 @@ void CPWL_ListBox::RePosChildWnd() { m_pList->SetPlateRect(GetListRect()); } -void CPWL_ListBox::OnNotifySelChanged(FX_BOOL bKeyDown, - FX_BOOL& bExit, +void CPWL_ListBox::OnNotifySelChanged(bool bKeyDown, + bool& bExit, uint32_t nFlag) { if (!m_pFillerNotify) return; - FX_BOOL bRC = TRUE; + bool bRC = true; CFX_WideString swChange = GetText(); CFX_WideString strChangeEx; int nSelStart = 0; @@ -407,7 +406,7 @@ void CPWL_ListBox::Reset() { m_pList->Cancel(); } -FX_BOOL CPWL_ListBox::IsMultipleSel() const { +bool CPWL_ListBox::IsMultipleSel() const { return m_pList->IsMultipleSel(); } @@ -419,7 +418,7 @@ int32_t CPWL_ListBox::GetCurSel() const { return m_pList->GetSelect(); } -FX_BOOL CPWL_ListBox::IsItemSelected(int32_t nItemIndex) const { +bool CPWL_ListBox::IsItemSelected(int32_t nItemIndex) const { return m_pList->IsItemSelected(nItemIndex); } @@ -449,15 +448,15 @@ CFX_FloatRect CPWL_ListBox::GetListRect() const { GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); } -FX_BOOL CPWL_ListBox::OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_ListBox::OnMouseWheel(short zDelta, + const CFX_FloatPoint& point, + uint32_t nFlag) { if (zDelta < 0) m_pList->OnVK_DOWN(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); else m_pList->OnVK_UP(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); - FX_BOOL bExit = FALSE; - OnNotifySelChanged(FALSE, bExit, nFlag); - return TRUE; + bool bExit = false; + OnNotifySelChanged(false, bExit, nFlag); + return true; } diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.h b/fpdfsdk/pdfwindow/PWL_ListBox.h index da7ae3d802..290b8762ef 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.h +++ b/fpdfsdk/pdfwindow/PWL_ListBox.h @@ -32,7 +32,7 @@ class CPWL_List_Notify { void IOnSetScrollPosY(FX_FLOAT fy); void IOnInvalidateRect(CFX_FloatRect* pRect); - void IOnSetCaret(FX_BOOL bVisible, + void IOnSetCaret(bool bVisible, const CFX_FloatPoint& ptHead, const CFX_FloatPoint& ptFoot, const CPVT_WordPlace& place); @@ -53,14 +53,14 @@ class CPWL_ListBox : public CPWL_Wnd { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - FX_BOOL OnKeyDown(uint16_t nChar, uint32_t nFlag) override; - FX_BOOL OnChar(uint16_t nChar, uint32_t nFlag) override; - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, - uint32_t nFlag) override; + bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; + bool OnChar(uint16_t nChar, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnMouseWheel(short zDelta, + const CFX_FloatPoint& point, + uint32_t nFlag) override; void KillFocus() override; void OnNotify(CPWL_Wnd* pWnd, uint32_t msg, @@ -73,7 +73,7 @@ class CPWL_ListBox : public CPWL_Wnd { virtual CFX_WideString GetText() const; - void OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL& bExit, uint32_t nFlag); + void OnNotifySelChanged(bool bKeyDown, bool& bExit, uint32_t nFlag); void AddString(const CFX_WideString& str); void SetTopVisibleIndex(int32_t nItemIndex); @@ -82,13 +82,13 @@ class CPWL_ListBox : public CPWL_Wnd { void Reset(); void Select(int32_t nItemIndex); void SetCaret(int32_t nItemIndex); - void SetHoverSel(FX_BOOL bHoverSel); + void SetHoverSel(bool bHoverSel); int32_t GetCount() const; - FX_BOOL IsMultipleSel() const; + bool IsMultipleSel() const; int32_t GetCaretIndex() const; int32_t GetCurSel() const; - FX_BOOL IsItemSelected(int32_t nItemIndex) const; + bool IsItemSelected(int32_t nItemIndex) const; int32_t GetTopVisibleIndex() const; int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const; CFX_FloatRect GetContentRect() const; @@ -104,8 +104,8 @@ class CPWL_ListBox : public CPWL_Wnd { protected: std::unique_ptr<CFX_ListCtrl> m_pList; std::unique_ptr<CPWL_List_Notify> m_pListNotify; - FX_BOOL m_bMouseDown; - FX_BOOL m_bHoverSel; + bool m_bMouseDown; + bool m_bHoverSel; IPWL_Filler_Notify* m_pFillerNotify; private: diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp index 684f6c337c..8a09ac6636 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp @@ -34,7 +34,7 @@ void PWL_FLOATRANGE::Set(FX_FLOAT min, FX_FLOAT max) { } } -FX_BOOL PWL_FLOATRANGE::In(FX_FLOAT x) const { +bool PWL_FLOATRANGE::In(FX_FLOAT x) const { return (IsFloatBigger(x, fMin) || IsFloatEqual(x, fMin)) && (IsFloatSmaller(x, fMax) || IsFloatEqual(x, fMax)); } @@ -76,12 +76,12 @@ void PWL_SCROLL_PRIVATEDATA::SetBigStep(FX_FLOAT step) { fBigStep = step; } -FX_BOOL PWL_SCROLL_PRIVATEDATA::SetPos(FX_FLOAT pos) { +bool PWL_SCROLL_PRIVATEDATA::SetPos(FX_FLOAT pos) { if (ScrollRange.In(pos)) { fScrollPos = pos; - return TRUE; + return true; } - return FALSE; + return false; } void PWL_SCROLL_PRIVATEDATA::AddSmall() { @@ -109,7 +109,7 @@ CPWL_SBButton::CPWL_SBButton(PWL_SCROLLBAR_TYPE eScrollBarType, m_eScrollBarType = eScrollBarType; m_eSBButtonType = eButtonType; - m_bMouseDown = FALSE; + m_bMouseDown = false; } CPWL_SBButton::~CPWL_SBButton() {} @@ -323,7 +323,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, rcDraw = CPWL_Utils::DeflateRect(rectWnd, 1.0f); if (IsEnabled()) - CPWL_Utils::DrawShadow(pDevice, pUser2Device, TRUE, FALSE, rcDraw, + CPWL_Utils::DrawShadow(pDevice, pUser2Device, true, false, rcDraw, nTransparancy, 80, 220); else CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw, @@ -368,7 +368,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, // draw background rcDraw = CPWL_Utils::DeflateRect(rectWnd, 1.0f); if (IsEnabled()) - CPWL_Utils::DrawShadow(pDevice, pUser2Device, TRUE, FALSE, rcDraw, + CPWL_Utils::DrawShadow(pDevice, pUser2Device, true, false, rcDraw, nTransparancy, 80, 220); else CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw, @@ -536,41 +536,38 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, } } -FX_BOOL CPWL_SBButton::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_SBButton::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (CPWL_Wnd* pParent = GetParentWindow()) pParent->OnNotify(this, PNM_LBUTTONDOWN, 0, (intptr_t)&point); - m_bMouseDown = TRUE; + m_bMouseDown = true; SetCapture(); - return TRUE; + return true; } -FX_BOOL CPWL_SBButton::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_SBButton::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (CPWL_Wnd* pParent = GetParentWindow()) pParent->OnNotify(this, PNM_LBUTTONUP, 0, (intptr_t)&point); - m_bMouseDown = FALSE; + m_bMouseDown = false; ReleaseCapture(); - return TRUE; + return true; } -FX_BOOL CPWL_SBButton::OnMouseMove(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_SBButton::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnMouseMove(point, nFlag); if (CPWL_Wnd* pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_MOUSEMOVE, 0, (intptr_t)&point); } - return TRUE; + return true; } CPWL_ScrollBar::CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType) @@ -578,9 +575,9 @@ CPWL_ScrollBar::CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType) m_pMinButton(nullptr), m_pMaxButton(nullptr), m_pPosButton(nullptr), - m_bMouseDown(FALSE), - m_bMinOrMax(FALSE), - m_bNotifyForever(TRUE) {} + m_bMouseDown(false), + m_bMinOrMax(false), + m_bNotifyForever(true) {} CPWL_ScrollBar::~CPWL_ScrollBar() {} @@ -619,7 +616,7 @@ void CPWL_ScrollBar::RePosChildWnd() { rcMaxButton = CFX_FloatRect(rcClient.right - fBWidth, rcClient.bottom, rcClient.right, rcClient.top); } else { - SetVisible(FALSE); + SetVisible(false); } } break; @@ -645,17 +642,17 @@ void CPWL_ScrollBar::RePosChildWnd() { CFX_FloatRect(rcClient.left, rcClient.bottom, rcClient.right, rcClient.bottom + fBWidth); } else { - SetVisible(FALSE); + SetVisible(false); } } break; } if (m_pMinButton) - m_pMinButton->Move(rcMinButton, TRUE, FALSE); + m_pMinButton->Move(rcMinButton, true, false); if (m_pMaxButton) - m_pMaxButton->Move(rcMaxButton, TRUE, FALSE); - MovePosButton(FALSE); + m_pMaxButton->Move(rcMaxButton, true, false); + MovePosButton(false); } void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { @@ -666,7 +663,7 @@ void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { sButton << "q\n"; sButton << "0 w\n" - << CPWL_Utils::GetColorAppStream(GetBackgroundColor(), TRUE) + << CPWL_Utils::GetColorAppStream(GetBackgroundColor(), true) .AsStringC(); sButton << rectWnd.left << " " << rectWnd.bottom << " " << rectWnd.right - rectWnd.left << " " @@ -698,8 +695,8 @@ void CPWL_ScrollBar::DrawThisAppearance(CFX_RenderDevice* pDevice, } } -FX_BOOL CPWL_ScrollBar::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_ScrollBar::OnLButtonDown(const CFX_FloatPoint& point, + uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (HasFlag(PWS_AUTOTRANSPARENT)) { @@ -740,22 +737,21 @@ FX_BOOL CPWL_ScrollBar::OnLButtonDown(const CFX_FloatPoint& point, if (rcMinArea.Contains(point.x, point.y)) { m_sData.SubBig(); - MovePosButton(TRUE); + MovePosButton(true); NotifyScrollWindow(); } if (rcMaxArea.Contains(point.x, point.y)) { m_sData.AddBig(); - MovePosButton(TRUE); + MovePosButton(true); NotifyScrollWindow(); } } - return TRUE; + return true; } -FX_BOOL CPWL_ScrollBar::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_ScrollBar::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); if (HasFlag(PWS_AUTOTRANSPARENT)) { @@ -766,9 +762,9 @@ FX_BOOL CPWL_ScrollBar::OnLButtonUp(const CFX_FloatPoint& point, } EndTimer(); - m_bMouseDown = FALSE; + m_bMouseDown = false; - return TRUE; + return true; } void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, @@ -864,7 +860,7 @@ void CPWL_ScrollBar::CreateButtons(const PWL_CREATEPARAM& cp) { if (!m_pPosButton) { m_pPosButton = new CPWL_SBButton(m_sbType, PSBT_POS); - m_pPosButton->SetVisible(FALSE); + m_pPosButton->SetVisible(false); m_pPosButton->Create(scp); } } @@ -884,10 +880,10 @@ void CPWL_ScrollBar::SetScrollRange(FX_FLOAT fMin, m_sData.SetClientWidth(fClientWidth); if (IsFloatSmaller(m_sData.ScrollRange.GetWidth(), 0.0f)) { - m_pPosButton->SetVisible(FALSE); + m_pPosButton->SetVisible(false); } else { - m_pPosButton->SetVisible(TRUE); - MovePosButton(TRUE); + m_pPosButton->SetVisible(true); + MovePosButton(true); } } } @@ -898,7 +894,7 @@ void CPWL_ScrollBar::SetScrollPos(FX_FLOAT fPos) { m_sData.SetPos(fPos); if (!IsFloatEqual(m_sData.fScrollPos, fOldPos)) - MovePosButton(TRUE); + MovePosButton(true); } void CPWL_ScrollBar::SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep) { @@ -906,7 +902,7 @@ void CPWL_ScrollBar::SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep) { m_sData.SetSmallStep(fSmallStep); } -void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) { +void CPWL_ScrollBar::MovePosButton(bool bRefresh) { ASSERT(m_pMinButton); ASSERT(m_pMaxButton); @@ -954,16 +950,16 @@ void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) { break; } - m_pPosButton->Move(rcPosButton, TRUE, bRefresh); + m_pPosButton->Move(rcPosButton, true, bRefresh); } } void CPWL_ScrollBar::OnMinButtonLBDown(const CFX_FloatPoint& point) { m_sData.SubSmall(); - MovePosButton(TRUE); + MovePosButton(true); NotifyScrollWindow(); - m_bMinOrMax = TRUE; + m_bMinOrMax = true; EndTimer(); BeginTimer(100); @@ -975,10 +971,10 @@ void CPWL_ScrollBar::OnMinButtonMouseMove(const CFX_FloatPoint& point) {} void CPWL_ScrollBar::OnMaxButtonLBDown(const CFX_FloatPoint& point) { m_sData.AddSmall(); - MovePosButton(TRUE); + MovePosButton(true); NotifyScrollWindow(); - m_bMinOrMax = FALSE; + m_bMinOrMax = false; EndTimer(); BeginTimer(100); @@ -989,7 +985,7 @@ void CPWL_ScrollBar::OnMaxButtonLBUp(const CFX_FloatPoint& point) {} void CPWL_ScrollBar::OnMaxButtonMouseMove(const CFX_FloatPoint& point) {} void CPWL_ScrollBar::OnPosButtonLBDown(const CFX_FloatPoint& point) { - m_bMouseDown = TRUE; + m_bMouseDown = true; if (m_pPosButton) { CFX_FloatRect rcPosButton = m_pPosButton->GetWindowRect(); @@ -1012,7 +1008,7 @@ void CPWL_ScrollBar::OnPosButtonLBUp(const CFX_FloatPoint& point) { if (!m_bNotifyForever) NotifyScrollWindow(); } - m_bMouseDown = FALSE; + m_bMouseDown = false; } void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_FloatPoint& point) { @@ -1064,7 +1060,7 @@ void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_FloatPoint& point) { } if (!IsFloatEqual(fOldScrollPos, m_sData.fScrollPos)) { - MovePosButton(TRUE); + MovePosButton(true); if (m_bNotifyForever) NotifyScrollWindow(); @@ -1188,7 +1184,7 @@ void CPWL_ScrollBar::TimerProc() { m_sData.AddSmall(); if (sTemp != m_sData) { - MovePosButton(TRUE); + MovePosButton(true); NotifyScrollWindow(); } } diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.h b/fpdfsdk/pdfwindow/PWL_ScrollBar.h index ae71472696..19e5151c97 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.h +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.h @@ -53,15 +53,15 @@ class CPWL_SBButton : public CPWL_Wnd { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; protected: PWL_SCROLLBAR_TYPE m_eScrollBarType; PWL_SBBUTTON_TYPE m_eSBButtonType; - FX_BOOL m_bMouseDown; + bool m_bMouseDown; }; struct PWL_FLOATRANGE { @@ -76,7 +76,7 @@ struct PWL_FLOATRANGE { void Default(); void Set(FX_FLOAT min, FX_FLOAT max); - FX_BOOL In(FX_FLOAT x) const; + bool In(FX_FLOAT x) const; FX_FLOAT GetWidth() const; FX_FLOAT fMin; @@ -101,7 +101,7 @@ struct PWL_SCROLL_PRIVATEDATA { void SetClientWidth(FX_FLOAT width); void SetSmallStep(FX_FLOAT step); void SetBigStep(FX_FLOAT step); - FX_BOOL SetPos(FX_FLOAT pos); + bool SetPos(FX_FLOAT pos); void AddSmall(); void SubSmall(); @@ -127,8 +127,8 @@ class CPWL_ScrollBar : public CPWL_Wnd { void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) override; - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; void OnNotify(CPWL_Wnd* pWnd, uint32_t msg, intptr_t wParam = 0, @@ -139,12 +139,12 @@ class CPWL_ScrollBar : public CPWL_Wnd { FX_FLOAT GetScrollBarWidth() const; PWL_SCROLLBAR_TYPE GetScrollBarType() const { return m_sbType; } - void SetNotifyForever(FX_BOOL bForever) { m_bNotifyForever = bForever; } + void SetNotifyForever(bool bForever) { m_bNotifyForever = bForever; } protected: void SetScrollRange(FX_FLOAT fMin, FX_FLOAT fMax, FX_FLOAT fClientWidth); void SetScrollPos(FX_FLOAT fPos); - void MovePosButton(FX_BOOL bRefresh); + void MovePosButton(bool bRefresh); void SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep); void NotifyScrollWindow(); CFX_FloatRect GetScrollArea() const; @@ -173,9 +173,9 @@ class CPWL_ScrollBar : public CPWL_Wnd { CPWL_SBButton* m_pMaxButton; CPWL_SBButton* m_pPosButton; PWL_SCROLL_PRIVATEDATA m_sData; - FX_BOOL m_bMouseDown; - FX_BOOL m_bMinOrMax; - FX_BOOL m_bNotifyForever; + bool m_bMouseDown; + bool m_bMinOrMax; + bool m_bNotifyForever; FX_FLOAT m_nOldPos; FX_FLOAT m_fOldPosButton; }; diff --git a/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp b/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp index b0b944e5aa..defb992c57 100644 --- a/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp +++ b/fpdfsdk/pdfwindow/PWL_SpecialButton.cpp @@ -37,18 +37,17 @@ bool CPWL_CheckBox::IsChecked() const { return m_bChecked; } -FX_BOOL CPWL_CheckBox::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_CheckBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { if (IsReadOnly()) - return FALSE; + return false; SetCheck(!IsChecked()); - return TRUE; + return true; } -FX_BOOL CPWL_CheckBox::OnChar(uint16_t nChar, uint32_t nFlag) { +bool CPWL_CheckBox::OnChar(uint16_t nChar, uint32_t nFlag) { SetCheck(!IsChecked()); - return TRUE; + return true; } CPWL_RadioButton::CPWL_RadioButton() : m_bChecked(false) {} @@ -59,13 +58,13 @@ CFX_ByteString CPWL_RadioButton::GetClassName() const { return "CPWL_RadioButton"; } -FX_BOOL CPWL_RadioButton::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_RadioButton::OnLButtonUp(const CFX_FloatPoint& point, + uint32_t nFlag) { if (IsReadOnly()) - return FALSE; + return false; - SetCheck(TRUE); - return TRUE; + SetCheck(true); + return true; } void CPWL_RadioButton::SetCheck(bool bCheck) { @@ -76,7 +75,7 @@ bool CPWL_RadioButton::IsChecked() const { return m_bChecked; } -FX_BOOL CPWL_RadioButton::OnChar(uint16_t nChar, uint32_t nFlag) { - SetCheck(TRUE); - return TRUE; +bool CPWL_RadioButton::OnChar(uint16_t nChar, uint32_t nFlag) { + SetCheck(true); + return true; } diff --git a/fpdfsdk/pdfwindow/PWL_SpecialButton.h b/fpdfsdk/pdfwindow/PWL_SpecialButton.h index eaaba26c68..0aa6c4510b 100644 --- a/fpdfsdk/pdfwindow/PWL_SpecialButton.h +++ b/fpdfsdk/pdfwindow/PWL_SpecialButton.h @@ -26,8 +26,8 @@ class CPWL_CheckBox : public CPWL_Button { // CPWL_Button CFX_ByteString GetClassName() const override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnChar(uint16_t nChar, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnChar(uint16_t nChar, uint32_t nFlag) override; void SetCheck(bool bCheck); bool IsChecked() const; @@ -43,8 +43,8 @@ class CPWL_RadioButton : public CPWL_Button { // CPWL_Button CFX_ByteString GetClassName() const override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnChar(uint16_t nChar, uint32_t nFlag) override; + bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; + bool OnChar(uint16_t nChar, uint32_t nFlag) override; void SetCheck(bool bCheck); bool IsChecked() const; diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp index cf6c3d6f1f..eb6b3cc221 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp @@ -88,14 +88,14 @@ CFX_FloatRect CPWL_Utils::OffsetRect(const CFX_FloatRect& rect, rect.top + y); } -FX_BOOL CPWL_Utils::ContainsRect(const CFX_FloatRect& rcParent, - const CFX_FloatRect& rcChild) { +bool CPWL_Utils::ContainsRect(const CFX_FloatRect& rcParent, + const CFX_FloatRect& rcChild) { return rcChild.left >= rcParent.left && rcChild.bottom >= rcParent.bottom && rcChild.right <= rcParent.right && rcChild.top <= rcParent.top; } -FX_BOOL CPWL_Utils::IntersectRect(const CFX_FloatRect& rect1, - const CFX_FloatRect& rect2) { +bool CPWL_Utils::IntersectRect(const CFX_FloatRect& rect1, + const CFX_FloatRect& rect2) { FX_FLOAT left = rect1.left > rect2.left ? rect1.left : rect2.left; FX_FLOAT right = rect1.right < rect2.right ? rect1.right : rect2.right; FX_FLOAT bottom = rect1.bottom > rect2.bottom ? rect1.bottom : rect2.bottom; @@ -375,7 +375,7 @@ CFX_FloatRect CPWL_Utils::ScaleRect(const CFX_FloatRect& rcRect, CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CFX_FloatRect& rect, const CPWL_Color& color) { CFX_ByteTextBuf sAppStream; - CFX_ByteString sColor = GetColorAppStream(color, TRUE); + CFX_ByteString sColor = GetColorAppStream(color, true); if (sColor.GetLength() > 0) { sAppStream << "q\n" << sColor; sAppStream << rect.left << " " << rect.bottom << " " @@ -389,7 +389,7 @@ CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CFX_FloatRect& rect, CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CFX_FloatRect& rect, const CPWL_Color& color) { CFX_ByteTextBuf sAppStream; - CFX_ByteString sColor = GetColorAppStream(color, TRUE); + CFX_ByteString sColor = GetColorAppStream(color, true); if (sColor.GetLength() > 0) { sAppStream << "q\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << "f\nQ\n"; } @@ -412,7 +412,7 @@ CFX_FloatRect CPWL_Utils::GetCenterSquare(const CFX_FloatRect& rect) { CFX_ByteString CPWL_Utils::GetEditAppStream(CFX_Edit* pEdit, const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange, - FX_BOOL bContinuous, + bool bContinuous, uint16_t SubWord) { return CFX_Edit::GetEditAppearanceStream(pEdit, ptOffset, pRange, bContinuous, SubWord); @@ -430,20 +430,20 @@ CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox, int32_t nAlignmentH, int32_t nAlignmentV, FX_FLOAT fFontSize, - FX_BOOL bMultiLine, - FX_BOOL bAutoReturn, + bool bMultiLine, + bool bAutoReturn, const CPWL_Color& crText) { CFX_ByteTextBuf sRet; std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); pEdit->SetFontMap(pFontMap); pEdit->SetPlateRect(rcBBox); - pEdit->SetAlignmentH(nAlignmentH, TRUE); - pEdit->SetAlignmentV(nAlignmentV, TRUE); - pEdit->SetMultiLine(bMultiLine, TRUE); - pEdit->SetAutoReturn(bAutoReturn, TRUE); + pEdit->SetAlignmentH(nAlignmentH, true); + pEdit->SetAlignmentV(nAlignmentV, true); + pEdit->SetMultiLine(bMultiLine, true); + pEdit->SetAutoReturn(bAutoReturn, true); if (IsFloatZero(fFontSize)) - pEdit->SetAutoFontSize(TRUE, TRUE); + pEdit->SetAutoFontSize(true, true); else pEdit->SetFontSize(fFontSize); @@ -470,12 +470,12 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); pEdit->SetFontMap(pFontMap); - pEdit->SetAlignmentH(1, TRUE); - pEdit->SetAlignmentV(1, TRUE); - pEdit->SetMultiLine(FALSE, TRUE); - pEdit->SetAutoReturn(FALSE, TRUE); + pEdit->SetAlignmentH(1, true); + pEdit->SetAlignmentV(1, true); + pEdit->SetMultiLine(false, true); + pEdit->SetAutoReturn(false, true); if (IsFloatZero(fFontSize)) - pEdit->SetAutoFontSize(TRUE, TRUE); + pEdit->SetAutoFontSize(true, true); else pEdit->SetFontSize(fFontSize); @@ -654,7 +654,7 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, CFX_ByteTextBuf sAppStream, sTemp; if (!rcIcon.IsEmpty()) { - Icon.Move(rcIcon, FALSE, FALSE); + Icon.Move(rcIcon, false, false); sTemp << Icon.GetImageAppStream(); } @@ -681,7 +681,7 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, } CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color& color, - const FX_BOOL& bFillOrStroke) { + const bool& bFillOrStroke) { CFX_ByteTextBuf sColorStream; switch (color.nColorType) { @@ -727,7 +727,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, switch (nStyle) { default: case BorderStyle::SOLID: - sColor = CPWL_Utils::GetColorAppStream(color, TRUE); + sColor = CPWL_Utils::GetColorAppStream(color, true); if (sColor.GetLength() > 0) { sAppStream << sColor; sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " @@ -739,7 +739,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, } break; case BorderStyle::DASH: - sColor = CPWL_Utils::GetColorAppStream(color, FALSE); + sColor = CPWL_Utils::GetColorAppStream(color, false); if (sColor.GetLength() > 0) { sAppStream << sColor; sAppStream << fWidth << " w" @@ -759,7 +759,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, break; case BorderStyle::BEVELED: case BorderStyle::INSET: - sColor = CPWL_Utils::GetColorAppStream(crLeftTop, TRUE); + sColor = CPWL_Utils::GetColorAppStream(crLeftTop, true); if (sColor.GetLength() > 0) { sAppStream << sColor; sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth @@ -776,7 +776,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, << fBottom + fHalfWidth * 2 << " l f\n"; } - sColor = CPWL_Utils::GetColorAppStream(crRightBottom, TRUE); + sColor = CPWL_Utils::GetColorAppStream(crRightBottom, true); if (sColor.GetLength() > 0) { sAppStream << sColor; sAppStream << fRight - fHalfWidth << " " << fTop - fHalfWidth @@ -793,7 +793,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, << " l f\n"; } - sColor = CPWL_Utils::GetColorAppStream(color, TRUE); + sColor = CPWL_Utils::GetColorAppStream(color, true); if (sColor.GetLength() > 0) { sAppStream << sColor; sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " @@ -804,7 +804,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, } break; case BorderStyle::UNDERLINE: - sColor = CPWL_Utils::GetColorAppStream(color, FALSE); + sColor = CPWL_Utils::GetColorAppStream(color, false); if (sColor.GetLength() > 0) { sAppStream << sColor; sAppStream << fWidth << " w\n"; @@ -838,7 +838,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( default: case BorderStyle::SOLID: case BorderStyle::UNDERLINE: { - sColor = CPWL_Utils::GetColorAppStream(color, FALSE); + sColor = CPWL_Utils::GetColorAppStream(color, false); if (sColor.GetLength() > 0) { sAppStream << "q\n" << fWidth << " w\n" << sColor << CPWL_Utils::GetAP_Circle( @@ -847,7 +847,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( } } break; case BorderStyle::DASH: { - sColor = CPWL_Utils::GetColorAppStream(color, FALSE); + sColor = CPWL_Utils::GetColorAppStream(color, false); if (sColor.GetLength() > 0) { sAppStream << "q\n" << fWidth << " w\n" << "[" << dash.nDash << " " << dash.nGap << "] " @@ -860,13 +860,13 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( case BorderStyle::BEVELED: { FX_FLOAT fHalfWidth = fWidth / 2.0f; - sColor = CPWL_Utils::GetColorAppStream(color, FALSE); + sColor = CPWL_Utils::GetColorAppStream(color, false); if (sColor.GetLength() > 0) { sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << " S\nQ\n"; } - sColor = CPWL_Utils::GetColorAppStream(crLeftTop, FALSE); + sColor = CPWL_Utils::GetColorAppStream(crLeftTop, false); if (sColor.GetLength() > 0) { sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_HalfCircle( @@ -875,7 +875,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( << " S\nQ\n"; } - sColor = CPWL_Utils::GetColorAppStream(crRightBottom, FALSE); + sColor = CPWL_Utils::GetColorAppStream(crRightBottom, false); if (sColor.GetLength() > 0) { sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_HalfCircle( @@ -887,13 +887,13 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( case BorderStyle::INSET: { FX_FLOAT fHalfWidth = fWidth / 2.0f; - sColor = CPWL_Utils::GetColorAppStream(color, FALSE); + sColor = CPWL_Utils::GetColorAppStream(color, false); if (sColor.GetLength() > 0) { sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << " S\nQ\n"; } - sColor = CPWL_Utils::GetColorAppStream(crLeftTop, FALSE); + sColor = CPWL_Utils::GetColorAppStream(crLeftTop, false); if (sColor.GetLength() > 0) { sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_HalfCircle( @@ -902,7 +902,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( << " S\nQ\n"; } - sColor = CPWL_Utils::GetColorAppStream(crRightBottom, FALSE); + sColor = CPWL_Utils::GetColorAppStream(crRightBottom, false); if (sColor.GetLength() > 0) { sAppStream << "q\n" << fHalfWidth << " w\n" << sColor << CPWL_Utils::GetAP_HalfCircle( @@ -973,7 +973,8 @@ CPWL_Color CPWL_Utils::DevideColor(const CPWL_Color& sColor, CFX_ByteString CPWL_Utils::GetAppStream_Check(const CFX_FloatRect& rcBBox, const CPWL_Color& crText) { CFX_ByteTextBuf sAP; - sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) + sAP << "q\n" + << CPWL_Utils::GetColorAppStream(crText, true) << CPWL_Utils::GetAP_Check(rcBBox) << "f\nQ\n"; return sAP.MakeString(); } @@ -981,7 +982,8 @@ CFX_ByteString CPWL_Utils::GetAppStream_Check(const CFX_FloatRect& rcBBox, CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CFX_FloatRect& rcBBox, const CPWL_Color& crText) { CFX_ByteTextBuf sAP; - sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) + sAP << "q\n" + << CPWL_Utils::GetColorAppStream(crText, true) << CPWL_Utils::GetAP_Circle(rcBBox) << "f\nQ\n"; return sAP.MakeString(); } @@ -989,7 +991,8 @@ CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CFX_FloatRect& rcBBox, CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CFX_FloatRect& rcBBox, const CPWL_Color& crText) { CFX_ByteTextBuf sAP; - sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, FALSE) + sAP << "q\n" + << CPWL_Utils::GetColorAppStream(crText, false) << CPWL_Utils::GetAP_Cross(rcBBox) << "S\nQ\n"; return sAP.MakeString(); } @@ -997,7 +1000,8 @@ CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CFX_FloatRect& rcBBox, CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CFX_FloatRect& rcBBox, const CPWL_Color& crText) { CFX_ByteTextBuf sAP; - sAP << "q\n1 w\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) + sAP << "q\n1 w\n" + << CPWL_Utils::GetColorAppStream(crText, true) << CPWL_Utils::GetAP_Diamond(rcBBox) << "f\nQ\n"; return sAP.MakeString(); } @@ -1005,7 +1009,8 @@ CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CFX_FloatRect& rcBBox, CFX_ByteString CPWL_Utils::GetAppStream_Square(const CFX_FloatRect& rcBBox, const CPWL_Color& crText) { CFX_ByteTextBuf sAP; - sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) + sAP << "q\n" + << CPWL_Utils::GetColorAppStream(crText, true) << CPWL_Utils::GetAP_Square(rcBBox) << "f\nQ\n"; return sAP.MakeString(); } @@ -1013,7 +1018,8 @@ CFX_ByteString CPWL_Utils::GetAppStream_Square(const CFX_FloatRect& rcBBox, CFX_ByteString CPWL_Utils::GetAppStream_Star(const CFX_FloatRect& rcBBox, const CPWL_Color& crText) { CFX_ByteTextBuf sAP; - sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) + sAP << "q\n" + << CPWL_Utils::GetColorAppStream(crText, true) << CPWL_Utils::GetAP_Star(rcBBox) << "f\nQ\n"; return sAP.MakeString(); } @@ -1064,10 +1070,11 @@ CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CFX_FloatRect& rcBBox) { CFX_ByteTextBuf sAppStream; if (!rcBBox.IsEmpty()) { - sAppStream << "q\n" << CPWL_Utils::GetColorAppStream( - CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f, - 220.0f / 255.0f, 220.0f / 255.0f), - TRUE); + sAppStream << "q\n" + << CPWL_Utils::GetColorAppStream( + CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f, + 220.0f / 255.0f, 220.0f / 255.0f), + true); sAppStream << rcBBox.left << " " << rcBBox.bottom << " " << rcBBox.right - rcBBox.left << " " << rcBBox.top - rcBBox.bottom << " re f\n"; @@ -1278,8 +1285,8 @@ void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - FX_BOOL bVertical, - FX_BOOL bHorizontal, + bool bVertical, + bool bHorizontal, CFX_FloatRect rect, int32_t nTransparancy, int32_t nStartGray, @@ -1442,10 +1449,10 @@ void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice, } } -FX_BOOL CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color) { +bool CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color) { switch (color.nColorType) { case COLORTYPE_TRANSPARENT: - return FALSE; + return false; case COLORTYPE_GRAY: return color.fColor1 < 0.5f; case COLORTYPE_RGB: @@ -1455,7 +1462,7 @@ FX_BOOL CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color) { 2.0f; } - return TRUE; + return true; } CPWL_Color CPWL_Utils::GetReverseColor(const CPWL_Color& color) { @@ -1485,8 +1492,8 @@ CFX_ByteString CPWL_Utils::GetIconAppStream(int32_t nType, const CFX_FloatRect& rect, const CPWL_Color& crFill, const CPWL_Color& crStroke) { - CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, FALSE); - sAppStream += CPWL_Utils::GetColorAppStream(crFill, TRUE); + CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, false); + sAppStream += CPWL_Utils::GetColorAppStream(crFill, true); CFX_ByteString sPath; CFX_PathData path; diff --git a/fpdfsdk/pdfwindow/PWL_Utils.h b/fpdfsdk/pdfwindow/PWL_Utils.h index bdcba968a6..f14c3c7963 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.h +++ b/fpdfsdk/pdfwindow/PWL_Utils.h @@ -104,10 +104,10 @@ class CPWL_Utils { public: static CFX_FloatRect InflateRect(const CFX_FloatRect& rcRect, FX_FLOAT fSize); static CFX_FloatRect DeflateRect(const CFX_FloatRect& rcRect, FX_FLOAT fSize); - static FX_BOOL IntersectRect(const CFX_FloatRect& rect1, - const CFX_FloatRect& rect2); - static FX_BOOL ContainsRect(const CFX_FloatRect& rcParent, - const CFX_FloatRect& rcChild); + static bool IntersectRect(const CFX_FloatRect& rect1, + const CFX_FloatRect& rect2); + static bool ContainsRect(const CFX_FloatRect& rcParent, + const CFX_FloatRect& rcChild); static CFX_FloatRect ScaleRect(const CFX_FloatRect& rcRect, FX_FLOAT fScale); static CPVT_WordRange OverlapWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2); @@ -126,11 +126,11 @@ class CPWL_Utils { FX_FLOAT y); static FX_COLORREF PWLColorToFXColor(const CPWL_Color& color, int32_t nTransparancy = 255); - static FX_BOOL IsBlackOrWhite(const CPWL_Color& color); + static bool IsBlackOrWhite(const CPWL_Color& color); static CPWL_Color GetReverseColor(const CPWL_Color& color); static CFX_ByteString GetColorAppStream(const CPWL_Color& color, - const FX_BOOL& bFillOrStroke = TRUE); + const bool& bFillOrStroke = true); static CFX_ByteString GetBorderAppStream(const CFX_FloatRect& rect, FX_FLOAT fWidth, const CPWL_Color& color, @@ -169,7 +169,7 @@ class CPWL_Utils { static CFX_ByteString GetEditAppStream(CFX_Edit* pEdit, const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange = nullptr, - FX_BOOL bContinuous = TRUE, + bool bContinuous = true, uint16_t SubWord = 0); static CFX_ByteString GetEditSelAppStream( CFX_Edit* pEdit, @@ -181,8 +181,8 @@ class CPWL_Utils { int32_t nAlignmentH, int32_t nAlignmentV, FX_FLOAT fFontSize, - FX_BOOL bMultiLine, - FX_BOOL bAutoReturn, + bool bMultiLine, + bool bAutoReturn, const CPWL_Color& crText); static CFX_ByteString GetDropButtonAppStream(const CFX_FloatRect& rcBBox); @@ -222,8 +222,8 @@ class CPWL_Utils { const FX_COLORREF& color); static void DrawShadow(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - FX_BOOL bVertical, - FX_BOOL bHorizontal, + bool bVertical, + bool bHorizontal, CFX_FloatRect rect, int32_t nTransparancy, int32_t nStartGray, diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp index 729b27ca5d..78a4363aa5 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp @@ -117,38 +117,38 @@ class CPWL_MsgControl { m_pMainKeyboardWnd = nullptr; } - FX_BOOL IsWndCreated(const CPWL_Wnd* pWnd) const { + bool IsWndCreated(const CPWL_Wnd* pWnd) const { return m_pCreatedWnd == pWnd; } - FX_BOOL IsMainCaptureMouse(const CPWL_Wnd* pWnd) const { + bool IsMainCaptureMouse(const CPWL_Wnd* pWnd) const { return pWnd == m_pMainMouseWnd; } - FX_BOOL IsWndCaptureMouse(const CPWL_Wnd* pWnd) const { + bool IsWndCaptureMouse(const CPWL_Wnd* pWnd) const { if (pWnd) { for (int32_t i = 0, sz = m_aMousePath.GetSize(); i < sz; i++) { if (m_aMousePath.GetAt(i) == pWnd) - return TRUE; + return true; } } - return FALSE; + return false; } - FX_BOOL IsMainCaptureKeyboard(const CPWL_Wnd* pWnd) const { + bool IsMainCaptureKeyboard(const CPWL_Wnd* pWnd) const { return pWnd == m_pMainKeyboardWnd; } - FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const { + bool IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const { if (pWnd) { for (int32_t i = 0, sz = m_aKeyboardPath.GetSize(); i < sz; i++) { if (m_aKeyboardPath.GetAt(i) == pWnd) - return TRUE; + return true; } } - return FALSE; + return false; } void SetFocus(CPWL_Wnd* pWnd) { @@ -207,13 +207,13 @@ CPWL_Wnd::CPWL_Wnd() : m_pVScrollBar(nullptr), m_rcWindow(), m_rcClip(), - m_bCreated(FALSE), - m_bVisible(FALSE), - m_bNotifying(FALSE), - m_bEnabled(TRUE) {} + m_bCreated(false), + m_bVisible(false), + m_bNotifying(false), + m_bEnabled(true) {} CPWL_Wnd::~CPWL_Wnd() { - ASSERT(m_bCreated == FALSE); + ASSERT(m_bCreated == false); } CFX_ByteString CPWL_Wnd::GetClassName() const { @@ -248,7 +248,7 @@ void CPWL_Wnd::Create(const PWL_CREATEPARAM& cp) { OnCreated(); RePosChildWnd(); - m_bCreated = TRUE; + m_bCreated = true; } } @@ -284,7 +284,7 @@ void CPWL_Wnd::Destroy() { if (m_sPrivateParam.pParentWnd) m_sPrivateParam.pParentWnd->OnNotify(this, PNM_REMOVECHILD); - m_bCreated = FALSE; + m_bCreated = false; } DestroyMsgControl(); @@ -294,9 +294,7 @@ void CPWL_Wnd::Destroy() { m_pVScrollBar = nullptr; } -void CPWL_Wnd::Move(const CFX_FloatRect& rcNew, - FX_BOOL bReset, - FX_BOOL bRefresh) { +void CPWL_Wnd::Move(const CFX_FloatRect& rcNew, bool bReset, bool bRefresh) { if (IsValid()) { CFX_FloatRect rcOld = GetWindowRect(); @@ -429,7 +427,7 @@ void CPWL_Wnd::InvalidateRect(CFX_FloatRect* pRect) { } #define PWL_IMPLEMENT_KEY_METHOD(key_method_name) \ - FX_BOOL CPWL_Wnd::key_method_name(uint16_t nChar, uint32_t nFlag) { \ + bool CPWL_Wnd::key_method_name(uint16_t nChar, uint32_t nFlag) { \ if (IsValid() && IsVisible() && IsEnabled()) { \ if (IsWndCaptureKeyboard(this)) { \ for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \ @@ -441,12 +439,12 @@ void CPWL_Wnd::InvalidateRect(CFX_FloatRect* pRect) { } \ } \ } \ - return FALSE; \ + return false; \ } #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name) \ - FX_BOOL CPWL_Wnd::mouse_method_name(const CFX_FloatPoint& point, \ - uint32_t nFlag) { \ + bool CPWL_Wnd::mouse_method_name(const CFX_FloatPoint& point, \ + uint32_t nFlag) { \ if (IsValid() && IsVisible() && IsEnabled()) { \ if (IsWndCaptureMouse(this)) { \ for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \ @@ -471,7 +469,7 @@ void CPWL_Wnd::InvalidateRect(CFX_FloatRect* pRect) { SetCursor(); \ } \ } \ - return FALSE; \ + return false; \ } PWL_IMPLEMENT_KEY_METHOD(OnKeyDown) @@ -488,9 +486,9 @@ PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDown) PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp) PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) -FX_BOOL CPWL_Wnd::OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_Wnd::OnMouseWheel(short zDelta, + const CFX_FloatPoint& point, + uint32_t nFlag) { if (IsValid() && IsVisible() && IsEnabled()) { SetCursor(); if (IsWndCaptureKeyboard(this)) { @@ -504,7 +502,7 @@ FX_BOOL CPWL_Wnd::OnMouseWheel(short zDelta, } } } - return FALSE; + return false; } void CPWL_Wnd::AddChild(CPWL_Wnd* pWnd) { @@ -538,7 +536,7 @@ void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd, } } -FX_BOOL CPWL_Wnd::IsValid() const { +bool CPWL_Wnd::IsValid() const { return m_bCreated; } @@ -571,7 +569,7 @@ CFX_FloatPoint CPWL_Wnd::GetCenterPoint() const { (rcClient.top + rcClient.bottom) * 0.5f); } -FX_BOOL CPWL_Wnd::HasFlag(uint32_t dwFlags) const { +bool CPWL_Wnd::HasFlag(uint32_t dwFlags) const { return (m_sPrivateParam.dwFlags & dwFlags) != 0; } @@ -704,11 +702,11 @@ void CPWL_Wnd::OnSetFocus() {} void CPWL_Wnd::OnKillFocus() {} -FX_BOOL CPWL_Wnd::WndHitTest(const CFX_FloatPoint& point) const { +bool CPWL_Wnd::WndHitTest(const CFX_FloatPoint& point) const { return IsValid() && IsVisible() && GetWindowRect().Contains(point.x, point.y); } -FX_BOOL CPWL_Wnd::ClientHitTest(const CFX_FloatPoint& point) const { +bool CPWL_Wnd::ClientHitTest(const CFX_FloatPoint& point) const { return IsValid() && IsVisible() && GetClientRect().Contains(point.x, point.y); } @@ -719,7 +717,7 @@ const CPWL_Wnd* CPWL_Wnd::GetRootWnd() const { return this; } -void CPWL_Wnd::SetVisible(FX_BOOL bVisible) { +void CPWL_Wnd::SetVisible(bool bVisible) { if (IsValid()) { for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { @@ -744,7 +742,7 @@ const CFX_FloatRect& CPWL_Wnd::GetClipRect() const { return m_rcClip; } -FX_BOOL CPWL_Wnd::IsReadOnly() const { +bool CPWL_Wnd::IsReadOnly() const { return HasFlag(PWS_READONLY); } @@ -759,7 +757,7 @@ void CPWL_Wnd::RePosChildWnd() { rcContent.right - 1.0f, rcContent.top); if (pVSB) - pVSB->Move(rcVScroll, TRUE, FALSE); + pVSB->Move(rcVScroll, true, false); } void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM& cp) {} @@ -788,29 +786,29 @@ CPWL_MsgControl* CPWL_Wnd::GetMsgControl() const { return m_sPrivateParam.pMsgControl; } -FX_BOOL CPWL_Wnd::IsCaptureMouse() const { +bool CPWL_Wnd::IsCaptureMouse() const { return IsWndCaptureMouse(this); } -FX_BOOL CPWL_Wnd::IsWndCaptureMouse(const CPWL_Wnd* pWnd) const { +bool CPWL_Wnd::IsWndCaptureMouse(const CPWL_Wnd* pWnd) const { if (CPWL_MsgControl* pCtrl = GetMsgControl()) return pCtrl->IsWndCaptureMouse(pWnd); - return FALSE; + return false; } -FX_BOOL CPWL_Wnd::IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const { +bool CPWL_Wnd::IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const { if (CPWL_MsgControl* pCtrl = GetMsgControl()) return pCtrl->IsWndCaptureKeyboard(pWnd); - return FALSE; + return false; } -FX_BOOL CPWL_Wnd::IsFocused() const { +bool CPWL_Wnd::IsFocused() const { if (CPWL_MsgControl* pCtrl = GetMsgControl()) return pCtrl->IsMainCaptureKeyboard(this); - return FALSE; + return false; } CFX_FloatRect CPWL_Wnd::GetFocusRect() const { @@ -991,7 +989,7 @@ const CPWL_Wnd* CPWL_Wnd::GetFocused() const { return nullptr; } -void CPWL_Wnd::EnableWindow(FX_BOOL bEnable) { +void CPWL_Wnd::EnableWindow(bool bEnable) { if (m_bEnabled != bEnable) { for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { @@ -1008,7 +1006,7 @@ void CPWL_Wnd::EnableWindow(FX_BOOL bEnable) { } } -FX_BOOL CPWL_Wnd::IsEnabled() { +bool CPWL_Wnd::IsEnabled() { return m_bEnabled; } @@ -1016,26 +1014,26 @@ void CPWL_Wnd::OnEnabled() {} void CPWL_Wnd::OnDisabled() {} -FX_BOOL CPWL_Wnd::IsCTRLpressed(uint32_t nFlag) const { +bool CPWL_Wnd::IsCTRLpressed(uint32_t nFlag) const { if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { return pSystemHandler->IsCTRLKeyDown(nFlag); } - return FALSE; + return false; } -FX_BOOL CPWL_Wnd::IsSHIFTpressed(uint32_t nFlag) const { +bool CPWL_Wnd::IsSHIFTpressed(uint32_t nFlag) const { if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { return pSystemHandler->IsSHIFTKeyDown(nFlag); } - return FALSE; + return false; } -FX_BOOL CPWL_Wnd::IsALTpressed(uint32_t nFlag) const { +bool CPWL_Wnd::IsALTpressed(uint32_t nFlag) const { if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { return pSystemHandler->IsALTKeyDown(nFlag); } - return FALSE; + return false; } diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h index 8fd538f7c4..bba14f26bf 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/pdfwindow/PWL_Wnd.h @@ -255,26 +255,26 @@ class CPWL_Wnd : public CPWL_TimerHandler { void InvalidateFocusHandler(IPWL_FocusHandler* handler); void InvalidateProvider(IPWL_Provider* provider); void Destroy(); - void Move(const CFX_FloatRect& rcNew, FX_BOOL bReset, FX_BOOL bRefresh); + void Move(const CFX_FloatRect& rcNew, bool bReset, bool bRefresh); virtual void InvalidateRect(CFX_FloatRect* pRect = nullptr); void DrawAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device); - virtual FX_BOOL OnKeyDown(uint16_t nChar, uint32_t nFlag); - virtual FX_BOOL OnKeyUp(uint16_t nChar, uint32_t nFlag); - virtual FX_BOOL OnChar(uint16_t nChar, uint32_t nFlag); - virtual FX_BOOL OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnMButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnMButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnMButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnRButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag); - virtual FX_BOOL OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, - uint32_t nFlag); + virtual bool OnKeyDown(uint16_t nChar, uint32_t nFlag); + virtual bool OnKeyUp(uint16_t nChar, uint32_t nFlag); + virtual bool OnChar(uint16_t nChar, uint32_t nFlag); + virtual bool OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnMButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnMButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnMButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnRButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag); + virtual bool OnMouseWheel(short zDelta, + const CFX_FloatPoint& point, + uint32_t nFlag); virtual void SetFocus(); virtual void KillFocus(); @@ -287,7 +287,7 @@ class CPWL_Wnd : public CPWL_TimerHandler { intptr_t lParam = 0); virtual void SetTextColor(const CPWL_Color& color); virtual void SetTextStrokeColor(const CPWL_Color& color); - virtual void SetVisible(FX_BOOL bVisible); + virtual void SetVisible(bool bVisible); virtual CFX_FloatRect GetFocusRect() const; virtual CPWL_Color GetBackgroundColor() const; @@ -309,8 +309,8 @@ class CPWL_Wnd : public CPWL_TimerHandler { virtual CFX_FloatRect GetClientRect() const; CFX_FloatPoint GetCenterPoint() const; int32_t GetBorderWidth() const; - FX_BOOL IsVisible() const { return m_bVisible; } - FX_BOOL HasFlag(uint32_t dwFlags) const; + bool IsVisible() const { return m_bVisible; } + bool HasFlag(uint32_t dwFlags) const; void AddFlag(uint32_t dwFlags); void RemoveFlag(uint32_t dwFlags); const CFX_FloatRect& GetClipRect() const; @@ -319,13 +319,13 @@ class CPWL_Wnd : public CPWL_TimerHandler { const CPWL_Dash& GetBorderDash() const; void* GetAttachedData() const; - FX_BOOL WndHitTest(const CFX_FloatPoint& point) const; - FX_BOOL ClientHitTest(const CFX_FloatPoint& point) const; - FX_BOOL IsCaptureMouse() const; + bool WndHitTest(const CFX_FloatPoint& point) const; + bool ClientHitTest(const CFX_FloatPoint& point) const; + bool IsCaptureMouse() const; const CPWL_Wnd* GetFocused() const; - FX_BOOL IsFocused() const; - FX_BOOL IsReadOnly() const; + bool IsFocused() const; + bool IsReadOnly() const; CPWL_ScrollBar* GetVScrollBar() const; IPVT_FontMap* GetFontMap() const; @@ -350,8 +350,8 @@ class CPWL_Wnd : public CPWL_TimerHandler { virtual FX_FLOAT GetItemLeftMargin(); virtual FX_FLOAT GetItemRightMargin(); - void EnableWindow(FX_BOOL bEnable); - FX_BOOL IsEnabled(); + void EnableWindow(bool bEnable); + bool IsEnabled(); virtual void SetCursor(); protected: @@ -379,11 +379,11 @@ class CPWL_Wnd : public CPWL_TimerHandler { virtual void OnEnabled(); virtual void OnDisabled(); - void SetNotifyFlag(FX_BOOL bNotifying = TRUE) { m_bNotifying = bNotifying; } + void SetNotifyFlag(bool bNotifying = true) { m_bNotifying = bNotifying; } - FX_BOOL IsValid() const; + bool IsValid() const; const PWL_CREATEPARAM& GetCreationParam() const; - FX_BOOL IsNotifying() const { return m_bNotifying; } + bool IsNotifying() const { return m_bNotifying; } void InvalidateRectMove(const CFX_FloatRect& rcOld, const CFX_FloatRect& rcNew); @@ -391,13 +391,13 @@ class CPWL_Wnd : public CPWL_TimerHandler { void PWLtoWnd(const CFX_FloatPoint& point, int32_t& x, int32_t& y) const; FX_RECT PWLtoWnd(const CFX_FloatRect& rect) const; - FX_BOOL IsWndCaptureMouse(const CPWL_Wnd* pWnd) const; - FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const; + bool IsWndCaptureMouse(const CPWL_Wnd* pWnd) const; + bool IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const; const CPWL_Wnd* GetRootWnd() const; - FX_BOOL IsCTRLpressed(uint32_t nFlag) const; - FX_BOOL IsSHIFTpressed(uint32_t nFlag) const; - FX_BOOL IsALTpressed(uint32_t nFlag) const; + bool IsCTRLpressed(uint32_t nFlag) const; + bool IsSHIFTpressed(uint32_t nFlag) const; + bool IsALTpressed(uint32_t nFlag) const; private: void AddChild(CPWL_Wnd* pWnd); @@ -423,10 +423,10 @@ class CPWL_Wnd : public CPWL_TimerHandler { CFX_FloatRect m_rcWindow; CFX_FloatRect m_rcClip; - FX_BOOL m_bCreated; - FX_BOOL m_bVisible; - FX_BOOL m_bNotifying; - FX_BOOL m_bEnabled; + bool m_bCreated; + bool m_bVisible; + bool m_bNotifying; + bool m_bEnabled; }; #endif // FPDFSDK_PDFWINDOW_PWL_WND_H_ |