diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-04 12:08:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-04 12:08:40 -0700 |
commit | 221caf6f6f9810cbc0e0c4c50af9b036a052ae13 (patch) | |
tree | cbccfb1bd8b48387753c45604f0f85e52c48aa07 /xfa/fxfa/app/xfa_ffdochandler.cpp | |
parent | 6e56a5ebc88e05fe0bf05624eba9aeed57fa6d60 (diff) | |
download | pdfium-221caf6f6f9810cbc0e0c4c50af9b036a052ae13.tar.xz |
Cleanup the FF Handler proxy methods.
This CL removes the proxy methods from CXFA_FFWidgetHandler and CXFA_DocHandler
and removes CXFA_FFMenuHandler as it was only proxy methods.
The calls are made directly on the object now.
Review URL: https://codereview.chromium.org/1857893002
Diffstat (limited to 'xfa/fxfa/app/xfa_ffdochandler.cpp')
-rw-r--r-- | xfa/fxfa/app/xfa_ffdochandler.cpp | 89 |
1 files changed, 18 insertions, 71 deletions
diff --git a/xfa/fxfa/app/xfa_ffdochandler.cpp b/xfa/fxfa/app/xfa_ffdochandler.cpp index 949dae4a8b..6aed551fdb 100644 --- a/xfa/fxfa/app/xfa_ffdochandler.cpp +++ b/xfa/fxfa/app/xfa_ffdochandler.cpp @@ -15,100 +15,47 @@ CXFA_FFDocHandler::CXFA_FFDocHandler() {} CXFA_FFDocHandler::~CXFA_FFDocHandler() {} -void CXFA_FFDocHandler::ReleaseDoc(CXFA_FFDoc* hDoc) { - delete hDoc; // virtual dtor. -} -IXFA_DocProvider* CXFA_FFDocHandler::GetDocProvider(CXFA_FFDoc* hDoc) { - return hDoc->GetDocProvider(); -} -uint32_t CXFA_FFDocHandler::GetDocType(CXFA_FFDoc* hDoc) { - return hDoc->GetDocType(); -} -int32_t CXFA_FFDocHandler::StartLoad(CXFA_FFDoc* hDoc) { - return hDoc->StartLoad(); -} -int32_t CXFA_FFDocHandler::DoLoad(CXFA_FFDoc* hDoc, IFX_Pause* pPause) { - return hDoc->DoLoad(pPause); -} -void CXFA_FFDocHandler::StopLoad(CXFA_FFDoc* hDoc) { - hDoc->StopLoad(); -} - -CXFA_FFDocView* CXFA_FFDocHandler::CreateDocView(CXFA_FFDoc* hDoc, - uint32_t dwView) { - return hDoc->CreateDocView(dwView); -} -int32_t CXFA_FFDocHandler::CountPackages(CXFA_FFDoc* hDoc) { - return 0; -} -void CXFA_FFDocHandler::GetPackageName(CXFA_FFDoc* hDoc, - int32_t iPackage, - CFX_WideStringC& wsPackage) {} -CFDE_XMLElement* CXFA_FFDocHandler::GetPackageData( - CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsPackage) { - return hDoc->GetPackageData(wsPackage); -} -FX_BOOL CXFA_FFDocHandler::SavePackage(CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsPackage, - IFX_FileWrite* pFile, - CXFA_ChecksumContext* pCSContext) { - return hDoc->SavePackage(wsPackage, pFile, pCSContext); -} -FX_BOOL CXFA_FFDocHandler::CloseDoc(CXFA_FFDoc* hDoc) { - return hDoc->CloseDoc(); -} - -FX_BOOL CXFA_FFDocHandler::ImportData(CXFA_FFDoc* hDoc, - IFX_FileRead* pStream, - FX_BOOL bXDP) { - return hDoc->ImportData(pStream, bXDP); -} -void CXFA_FFDocHandler::SetJSERuntime(CXFA_FFDoc* hDoc, - FXJSE_HRUNTIME hRuntime) { - hDoc->GetXFADoc()->InitScriptContext(hRuntime); -} FXJSE_HVALUE CXFA_FFDocHandler::GetXFAScriptObject(CXFA_FFDoc* hDoc) { CXFA_Document* pXFADoc = hDoc->GetXFADoc(); - if (!pXFADoc) { - return NULL; - } + if (!pXFADoc) + return nullptr; + CXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext(); - if (!pScriptContext) { - return NULL; - } + if (!pScriptContext) + return nullptr; return pScriptContext->GetJSValueFromMap(pXFADoc->GetRoot()); } + XFA_ATTRIBUTEENUM CXFA_FFDocHandler::GetRestoreState(CXFA_FFDoc* hDoc) { CXFA_Document* pXFADoc = hDoc->GetXFADoc(); - if (!pXFADoc) { + if (!pXFADoc) return XFA_ATTRIBUTEENUM_Unknown; - } + CXFA_Node* pForm = ToNode(pXFADoc->GetXFAObject(XFA_HASHCODE_Form)); - if (!pForm) { + if (!pForm) return XFA_ATTRIBUTEENUM_Unknown; - } + CXFA_Node* pSubForm = pForm->GetFirstChildByClass(XFA_ELEMENT_Subform); - if (!pSubForm) { + if (!pSubForm) return XFA_ATTRIBUTEENUM_Unknown; - } return pSubForm->GetEnum(XFA_ATTRIBUTE_RestoreState); } + FX_BOOL CXFA_FFDocHandler::RunDocScript(CXFA_FFDoc* hDoc, XFA_SCRIPTTYPE eScriptType, const CFX_WideStringC& wsScript, FXJSE_HVALUE hRetValue, FXJSE_HVALUE hThisObject) { CXFA_Document* pXFADoc = hDoc->GetXFADoc(); - if (!pXFADoc) { + if (!pXFADoc) return FALSE; - } + CXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext(); - if (!pScriptContext) { + if (!pScriptContext) return FALSE; - } + return pScriptContext->RunScript( (XFA_SCRIPTLANGTYPE)eScriptType, wsScript, hRetValue, - hThisObject ? (CXFA_Object*)FXJSE_Value_ToObject(hThisObject, NULL) - : NULL); + hThisObject ? (CXFA_Object*)FXJSE_Value_ToObject(hThisObject, nullptr) + : nullptr); } |