From ded3634145b214b11212a7c53faa8ba15a1789ca Mon Sep 17 00:00:00 2001 From: thestig Date: Mon, 23 May 2016 17:54:02 -0700 Subject: Change CPDF_Boolean to use bool instead of FX_BOOL. Review-Url: https://codereview.chromium.org/1999313002 --- core/fpdfdoc/doc_action.cpp | 39 +-------------------------------------- core/fpdfdoc/doc_utils.cpp | 8 +++----- core/fpdfdoc/include/fpdf_doc.h | 14 ++------------ 3 files changed, 6 insertions(+), 55 deletions(-) (limited to 'core/fpdfdoc') diff --git a/core/fpdfdoc/doc_action.cpp b/core/fpdfdoc/doc_action.cpp index 6f3e2945fa..e646df2b4c 100644 --- a/core/fpdfdoc/doc_action.cpp +++ b/core/fpdfdoc/doc_action.cpp @@ -193,44 +193,7 @@ CFX_WideString CPDF_Action::GetJavaScript() const { CPDF_Object* pJS = m_pDict->GetDirectObjectBy("JS"); return pJS ? pJS->GetUnicodeText() : csJS; } -CPDF_Dictionary* CPDF_Action::GetAnnot() const { - if (!m_pDict) { - return nullptr; - } - CFX_ByteString csType = m_pDict->GetStringBy("S"); - if (csType == "Rendition") { - return m_pDict->GetDictBy("AN"); - } - if (csType == "Movie") { - return m_pDict->GetDictBy("Annotation"); - } - return nullptr; -} -int32_t CPDF_Action::GetOperationType() const { - if (!m_pDict) { - return 0; - } - CFX_ByteString csType = m_pDict->GetStringBy("S"); - if (csType == "Rendition") { - return m_pDict->GetIntegerBy("OP"); - } - if (csType == "Movie") { - CFX_ByteString csOP = m_pDict->GetStringBy("Operation"); - if (csOP == "Play") { - return 0; - } - if (csOP == "Stop") { - return 1; - } - if (csOP == "Pause") { - return 2; - } - if (csOP == "Resume") { - return 3; - } - } - return 0; -} + size_t CPDF_Action::GetSubActionsCount() const { if (!m_pDict || !m_pDict->KeyExist("Next")) return 0; diff --git a/core/fpdfdoc/doc_utils.cpp b/core/fpdfdoc/doc_utils.cpp index 408f0065e2..6c61c3d75e 100644 --- a/core/fpdfdoc/doc_utils.cpp +++ b/core/fpdfdoc/doc_utils.cpp @@ -716,11 +716,9 @@ void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { } } } -FX_BOOL CPDF_IconFit::GetFittingBounds() { - if (!m_pDict) { - return FALSE; - } - return m_pDict->GetBooleanBy("FB"); + +bool CPDF_IconFit::GetFittingBounds() { + return m_pDict ? m_pDict->GetBooleanBy("FB") : false; } std::vector SaveCheckedFieldStatus(CPDF_FormField* pField) { diff --git a/core/fpdfdoc/include/fpdf_doc.h b/core/fpdfdoc/include/fpdf_doc.h index 4fc5b5232b..3ee583d778 100644 --- a/core/fpdfdoc/include/fpdf_doc.h +++ b/core/fpdfdoc/include/fpdf_doc.h @@ -188,24 +188,14 @@ class CPDF_Action { explicit CPDF_Action(CPDF_Dictionary* pDict) : m_pDict(pDict) {} CPDF_Dictionary* GetDict() const { return m_pDict; } - CFX_ByteString GetTypeName() const { return m_pDict->GetStringBy("S"); } ActionType GetType() const; CPDF_Dest GetDest(CPDF_Document* pDoc) const; CFX_WideString GetFilePath() const; - FX_BOOL GetNewWindow() const { return m_pDict->GetBooleanBy("NewWindow"); } CFX_ByteString GetURI(CPDF_Document* pDoc) const; - FX_BOOL GetMouseMap() const { return m_pDict->GetBooleanBy("IsMap"); } - FX_BOOL GetHideStatus() const { return m_pDict->GetBooleanBy("H", TRUE); } + bool GetHideStatus() const { return m_pDict->GetBooleanBy("H", true); } CFX_ByteString GetNamedAction() const { return m_pDict->GetStringBy("N"); } uint32_t GetFlags() const { return m_pDict->GetIntegerBy("Flags"); } CFX_WideString GetJavaScript() const; - CPDF_Dictionary* GetAnnot() const; - int32_t GetOperationType() const; - CPDF_Stream* GetSoundStream() const { return m_pDict->GetStreamBy("Sound"); } - FX_FLOAT GetVolume() const { return m_pDict->GetNumberBy("Volume"); } - FX_BOOL IsSynchronous() const { return m_pDict->GetBooleanBy("Synchronous"); } - FX_BOOL IsRepeat() const { return m_pDict->GetBooleanBy("Repeat"); } - FX_BOOL IsMixPlay() const { return m_pDict->GetBooleanBy("Mix"); } size_t GetSubActionsCount() const; CPDF_Action GetSubAction(size_t iIndex) const; @@ -794,7 +784,7 @@ class CPDF_IconFit { ScaleMethod GetScaleMethod(); FX_BOOL IsProportionalScale(); void GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom); - FX_BOOL GetFittingBounds(); + bool GetFittingBounds(); const CPDF_Dictionary* GetDict() const { return m_pDict; } protected: -- cgit v1.2.3