| 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 "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" | 7 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| (...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 pEnv->FFI_UploadTo( | 1207 pEnv->FFI_UploadTo( |
| 1208 pFileHandler, fileFlag, | 1208 pFileHandler, fileFlag, |
| 1209 (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short))); | 1209 (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short))); |
| 1210 bs.ReleaseBuffer(len * sizeof(unsigned short)); | 1210 bs.ReleaseBuffer(len * sizeof(unsigned short)); |
| 1211 } | 1211 } |
| 1212 return bRet; | 1212 return bRet; |
| 1213 } | 1213 } |
| 1214 | 1214 |
| 1215 FX_BOOL CPDFXFA_Document::SetGlobalProperty(CXFA_FFDoc* hDoc, | 1215 FX_BOOL CPDFXFA_Document::SetGlobalProperty(CXFA_FFDoc* hDoc, |
| 1216 const CFX_ByteStringC& szPropName, | 1216 const CFX_ByteStringC& szPropName, |
| 1217 FXJSE_HVALUE hValue) { | 1217 CFXJSE_Value* pValue) { |
| 1218 if (hDoc != m_pXFADoc) | 1218 if (hDoc != m_pXFADoc) |
| 1219 return FALSE; | 1219 return FALSE; |
| 1220 | 1220 |
| 1221 if (m_pSDKDoc && m_pSDKDoc->GetEnv()->GetJSRuntime()) | 1221 if (m_pSDKDoc && m_pSDKDoc->GetEnv()->GetJSRuntime()) |
| 1222 return m_pSDKDoc->GetEnv()->GetJSRuntime()->SetHValueByName(szPropName, | 1222 return m_pSDKDoc->GetEnv()->GetJSRuntime()->SetValueByName(szPropName, |
| 1223 hValue); | 1223 pValue); |
| 1224 return FALSE; | 1224 return FALSE; |
| 1225 } | 1225 } |
| 1226 FX_BOOL CPDFXFA_Document::GetPDFScriptObject(CXFA_FFDoc* hDoc, | 1226 FX_BOOL CPDFXFA_Document::GetPDFScriptObject(CXFA_FFDoc* hDoc, |
| 1227 const CFX_ByteStringC& utf8Name, | 1227 const CFX_ByteStringC& utf8Name, |
| 1228 FXJSE_HVALUE hValue) { | 1228 CFXJSE_Value* pValue) { |
| 1229 if (hDoc != m_pXFADoc) | 1229 if (hDoc != m_pXFADoc) |
| 1230 return FALSE; | 1230 return FALSE; |
| 1231 | 1231 |
| 1232 if (!m_pSDKDoc || !m_pSDKDoc->GetEnv()->GetJSRuntime()) | 1232 if (!m_pSDKDoc || !m_pSDKDoc->GetEnv()->GetJSRuntime()) |
| 1233 return FALSE; | 1233 return FALSE; |
| 1234 | 1234 |
| 1235 if (!m_pJSContext) { | 1235 if (!m_pJSContext) { |
| 1236 m_pSDKDoc->GetEnv()->GetJSRuntime()->SetReaderDocument(m_pSDKDoc); | 1236 m_pSDKDoc->GetEnv()->GetJSRuntime()->SetReaderDocument(m_pSDKDoc); |
| 1237 m_pJSContext = m_pSDKDoc->GetEnv()->GetJSRuntime()->NewContext(); | 1237 m_pJSContext = m_pSDKDoc->GetEnv()->GetJSRuntime()->NewContext(); |
| 1238 } | 1238 } |
| 1239 | 1239 |
| 1240 return _GetHValueByName(utf8Name, hValue, | 1240 return m_pSDKDoc->GetEnv()->GetJSRuntime()->GetValueByName(utf8Name, pValue); |
| 1241 m_pSDKDoc->GetEnv()->GetJSRuntime()); | |
| 1242 } | 1241 } |
| 1243 FX_BOOL CPDFXFA_Document::GetGlobalProperty(CXFA_FFDoc* hDoc, | 1242 FX_BOOL CPDFXFA_Document::GetGlobalProperty(CXFA_FFDoc* hDoc, |
| 1244 const CFX_ByteStringC& szPropName, | 1243 const CFX_ByteStringC& szPropName, |
| 1245 FXJSE_HVALUE hValue) { | 1244 CFXJSE_Value* pValue) { |
| 1246 if (hDoc != m_pXFADoc) | 1245 if (hDoc != m_pXFADoc) |
| 1247 return FALSE; | 1246 return FALSE; |
| 1248 if (!m_pSDKDoc || !m_pSDKDoc->GetEnv()->GetJSRuntime()) | 1247 if (!m_pSDKDoc || !m_pSDKDoc->GetEnv()->GetJSRuntime()) |
| 1249 return FALSE; | 1248 return FALSE; |
| 1250 | 1249 |
| 1251 if (!m_pJSContext) { | 1250 if (!m_pJSContext) { |
| 1252 m_pSDKDoc->GetEnv()->GetJSRuntime()->SetReaderDocument(m_pSDKDoc); | 1251 m_pSDKDoc->GetEnv()->GetJSRuntime()->SetReaderDocument(m_pSDKDoc); |
| 1253 m_pJSContext = m_pSDKDoc->GetEnv()->GetJSRuntime()->NewContext(); | 1252 m_pJSContext = m_pSDKDoc->GetEnv()->GetJSRuntime()->NewContext(); |
| 1254 } | 1253 } |
| 1255 | 1254 |
| 1256 return _GetHValueByName(szPropName, hValue, | 1255 return m_pSDKDoc->GetEnv()->GetJSRuntime()->GetValueByName(szPropName, |
| 1257 m_pSDKDoc->GetEnv()->GetJSRuntime()); | 1256 pValue); |
| 1258 } | 1257 } |
| 1259 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, | |
| 1260 FXJSE_HVALUE hValue, | |
| 1261 IJS_Runtime* runTime) { | |
| 1262 return runTime->GetHValueByName(utf8Name, hValue); | |
| 1263 } | |
| OLD | NEW |