OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/src/foxitlib.h" | 7 #include "xfa/src/foxitlib.h" |
8 #include "xfa/src/fxfa/src/common/xfa_common.h" | 8 #include "xfa/src/fxfa/src/common/xfa_common.h" |
9 #include "xfa_ffdochandler.h" | 9 #include "xfa_ffdochandler.h" |
10 #include "xfa_ffdoc.h" | 10 #include "xfa_ffdoc.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 if (!pScriptContext) { | 72 if (!pScriptContext) { |
73 return NULL; | 73 return NULL; |
74 } | 74 } |
75 return pScriptContext->GetJSValueFromMap(pXFADoc->GetRoot()); | 75 return pScriptContext->GetJSValueFromMap(pXFADoc->GetRoot()); |
76 } | 76 } |
77 XFA_ATTRIBUTEENUM CXFA_FFDocHandler::GetRestoreState(IXFA_Doc* hDoc) { | 77 XFA_ATTRIBUTEENUM CXFA_FFDocHandler::GetRestoreState(IXFA_Doc* hDoc) { |
78 CXFA_Document* pXFADoc = static_cast<CXFA_FFDoc*>(hDoc)->GetXFADoc(); | 78 CXFA_Document* pXFADoc = static_cast<CXFA_FFDoc*>(hDoc)->GetXFADoc(); |
79 if (!pXFADoc) { | 79 if (!pXFADoc) { |
80 return XFA_ATTRIBUTEENUM_Unknown; | 80 return XFA_ATTRIBUTEENUM_Unknown; |
81 } | 81 } |
82 CXFA_Node* pForm = (CXFA_Node*)pXFADoc->GetXFAObject(XFA_HASHCODE_Form); | 82 CXFA_Node* pForm = ToNode(pXFADoc->GetXFAObject(XFA_HASHCODE_Form)); |
83 if (!pForm) { | 83 if (!pForm) { |
84 return XFA_ATTRIBUTEENUM_Unknown; | 84 return XFA_ATTRIBUTEENUM_Unknown; |
85 } | 85 } |
86 CXFA_Node* pSubForm = pForm->GetFirstChildByClass(XFA_ELEMENT_Subform); | 86 CXFA_Node* pSubForm = pForm->GetFirstChildByClass(XFA_ELEMENT_Subform); |
87 if (!pSubForm) { | 87 if (!pSubForm) { |
88 return XFA_ATTRIBUTEENUM_Unknown; | 88 return XFA_ATTRIBUTEENUM_Unknown; |
89 } | 89 } |
90 return pSubForm->GetEnum(XFA_ATTRIBUTE_RestoreState); | 90 return pSubForm->GetEnum(XFA_ATTRIBUTE_RestoreState); |
91 } | 91 } |
92 FX_BOOL CXFA_FFDocHandler::RunDocScript(IXFA_Doc* hDoc, | 92 FX_BOOL CXFA_FFDocHandler::RunDocScript(IXFA_Doc* hDoc, |
93 XFA_SCRIPTTYPE eScriptType, | 93 XFA_SCRIPTTYPE eScriptType, |
94 const CFX_WideStringC& wsScript, | 94 const CFX_WideStringC& wsScript, |
95 FXJSE_HVALUE hRetValue, | 95 FXJSE_HVALUE hRetValue, |
96 FXJSE_HVALUE hThisObject) { | 96 FXJSE_HVALUE hThisObject) { |
97 CXFA_Document* pXFADoc = static_cast<CXFA_FFDoc*>(hDoc)->GetXFADoc(); | 97 CXFA_Document* pXFADoc = static_cast<CXFA_FFDoc*>(hDoc)->GetXFADoc(); |
98 if (!pXFADoc) { | 98 if (!pXFADoc) { |
99 return FALSE; | 99 return FALSE; |
100 } | 100 } |
101 IXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext(); | 101 IXFA_ScriptContext* pScriptContext = pXFADoc->GetScriptContext(); |
102 if (!pScriptContext) { | 102 if (!pScriptContext) { |
103 return FALSE; | 103 return FALSE; |
104 } | 104 } |
105 return pScriptContext->RunScript( | 105 return pScriptContext->RunScript( |
106 (XFA_SCRIPTLANGTYPE)eScriptType, wsScript, hRetValue, | 106 (XFA_SCRIPTLANGTYPE)eScriptType, wsScript, hRetValue, |
107 hThisObject ? (CXFA_Object*)FXJSE_Value_ToObject(hThisObject, NULL) | 107 hThisObject ? (CXFA_Object*)FXJSE_Value_ToObject(hThisObject, NULL) |
108 : NULL); | 108 : NULL); |
109 } | 109 } |
OLD | NEW |