diff options
author | Lei Zhang <thestig@chromium.org> | 2015-11-10 09:38:57 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-11-10 09:38:57 -0800 |
commit | d88a364c1c79b294b980c20ebc9356ea42635bff (patch) | |
tree | bb44b0a75a3671ba3e305e3d812dcc098144e851 /core/src/fpdfdoc/doc_action.cpp | |
parent | b553bcb6a8e69de61f3b4abd257ee3161aa752c6 (diff) | |
download | pdfium-d88a364c1c79b294b980c20ebc9356ea42635bff.tar.xz |
Merge to XFA: Remove CFX_PtrArray usage in fpdfsdk.
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1430213002 .
(cherry picked from commit 8deeacd23872ecc132a0a678e344a018b5114a3a)
Review URL: https://codereview.chromium.org/1416113010 .
Diffstat (limited to 'core/src/fpdfdoc/doc_action.cpp')
-rw-r--r-- | core/src/fpdfdoc/doc_action.cpp | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp index d685f64cae..3d439ff570 100644 --- a/core/src/fpdfdoc/doc_action.cpp +++ b/core/src/fpdfdoc/doc_action.cpp @@ -111,37 +111,39 @@ FX_DWORD CPDF_ActionFields::GetFieldsCount() const { return pArray->GetCount(); return 0; } -void CPDF_ActionFields::GetAllFields(CFX_PtrArray& fieldObjects) const { - fieldObjects.RemoveAll(); - if (m_pAction == NULL) { - return; - } + +std::vector<CPDF_Object*> CPDF_ActionFields::GetAllFields() const { + std::vector<CPDF_Object*> fields; + if (!m_pAction) + return fields; + CPDF_Dictionary* pDict = m_pAction->GetDict(); - if (pDict == NULL) { - return; - } + if (!pDict) + return fields; + CFX_ByteString csType = pDict->GetString("S"); - CPDF_Object* pFields = NULL; - if (csType == "Hide") { + CPDF_Object* pFields; + if (csType == "Hide") pFields = pDict->GetElementValue("T"); - } else { + else pFields = pDict->GetArray("Fields"); - } if (!pFields) - return; + return fields; if (pFields->IsDictionary() || pFields->IsString()) { - fieldObjects.Add(pFields); + fields.push_back(pFields); } else if (CPDF_Array* pArray = pFields->AsArray()) { FX_DWORD iCount = pArray->GetCount(); - for (FX_DWORD i = 0; i < iCount; i++) { + for (FX_DWORD i = 0; i < iCount; ++i) { CPDF_Object* pObj = pArray->GetElementValue(i); - if (pObj != NULL) { - fieldObjects.Add(pObj); + if (pObj) { + fields.push_back(pObj); } } } + return fields; } + CPDF_Object* CPDF_ActionFields::GetField(FX_DWORD iIndex) const { if (m_pAction == NULL) { return NULL; @@ -291,9 +293,9 @@ CPDF_Action CPDF_AAction::GetNextAction(FX_POSITION& pos, eType = (AActionType)i; return CPDF_Action(pDict); } -CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) { - m_pDocument = pDoc; -} + +CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) : m_pDocument(pDoc) {} + int CPDF_DocJSActions::CountJSActions() const { ASSERT(m_pDocument != NULL); CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript")); |