summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fsdk_mgr.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-03-05 16:30:09 -0800
committerTom Sepez <tsepez@chromium.org>2015-03-05 16:30:09 -0800
commit624b6c1e0fc6a5b0467061ef37b6db6856681afb (patch)
tree8b1083b0b3f167da7fa7747ab530a9b37dab44b7 /fpdfsdk/src/fsdk_mgr.cpp
parent61c25eebf5a0fcf44dd1a434c88f502a34073eac (diff)
downloadpdfium-624b6c1e0fc6a5b0467061ef37b6db6856681afb.tar.xz
Make conversion between CPDF_Action and its dictionary explicit.
Precursor to taking a second shot at cleaning up the FPDF_* APIs. A FPDF_Action is a CPDF_Dictionary, and a CPDF_Action is a structure holding a FPDF_Action. This goes against the convention that FPDF_ types get cast to CPDF_* types, so we want to make it clear where objects are getting constructed, etc. Also tidy fpdf_actionhandler.cpp because it bugs me. R=thestig@chromium.org Review URL: https://codereview.chromium.org/984773002
Diffstat (limited to 'fpdfsdk/src/fsdk_mgr.cpp')
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp46
1 files changed, 24 insertions, 22 deletions
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index efb21a7efc..9e0b230439 100644
--- a/fpdfsdk/src/fsdk_mgr.cpp
+++ b/fpdfsdk/src/fsdk_mgr.cpp
@@ -424,30 +424,32 @@ void CPDFSDK_Document:: ProcJavascriptFun()
FX_BOOL CPDFSDK_Document::ProcOpenAction()
{
- if(!m_pDoc) return FALSE;
-
- CPDF_Dictionary* pRoot = m_pDoc->GetRoot();
- if (!pRoot) return FALSE;
- CPDF_Object* pOpenAction = pRoot->GetDict("OpenAction");//
- if(!pOpenAction) pOpenAction = pRoot->GetArray("OpenAction");//
- if(!pOpenAction) return FALSE;
-
+ if(!m_pDoc)
+ return FALSE;
+
+ CPDF_Dictionary* pRoot = m_pDoc->GetRoot();
+ if (!pRoot)
+ return FALSE;
+
+ CPDF_Object* pOpenAction = pRoot->GetDict("OpenAction");
+ if(!pOpenAction)
+ pOpenAction = pRoot->GetArray("OpenAction");
+
+ if(!pOpenAction)
+ return FALSE;
+
if(pOpenAction->GetType()==PDFOBJ_ARRAY)
- {
- }
- else if(pOpenAction->GetType()==PDFOBJ_DICTIONARY)
- {
- CPDF_Dictionary * pDict=(CPDF_Dictionary*)pOpenAction;
- CPDF_Action Action = pDict;
-
- if(m_pEnv->GetActionHander())
- m_pEnv->GetActionHander()->DoAction_DocOpen(Action,this);
- }
- else
+ return TRUE;
+
+ if(pOpenAction->GetType()==PDFOBJ_DICTIONARY)
{
- return FALSE;
- }
- return TRUE;
+ CPDF_Dictionary * pDict=(CPDF_Dictionary*)pOpenAction;
+ CPDF_Action action(pDict);
+ if(m_pEnv->GetActionHander())
+ m_pEnv->GetActionHander()->DoAction_DocOpen(action, this);
+ return TRUE;
+ }
+ return FALSE;
}
CPDF_OCContext* CPDFSDK_Document::GetOCContext()