| 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 "../../include/javascript/JavaScript.h" | 7 #include "../../include/javascript/JavaScript.h" |
| 8 #include "../../include/javascript/IJavaScript.h" | 8 #include "../../include/javascript/IJavaScript.h" |
| 9 #include "../../include/javascript/JS_Define.h" | 9 #include "../../include/javascript/JS_Define.h" |
| 10 #include "../../include/javascript/JS_Object.h" | 10 #include "../../include/javascript/JS_Object.h" |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 sError = JSGetStringFromID(pContext, IDS_STRING_JSVALUEERROR); | 363 sError = JSGetStringFromID(pContext, IDS_STRING_JSVALUEERROR); |
| 364 return FALSE; | 364 return FALSE; |
| 365 } | 365 } |
| 366 | 366 |
| 367 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); | 367 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); |
| 368 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); | 368 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); |
| 369 CPDF_FormField* pField = pPDFForm->GetField(nIndex); | 369 CPDF_FormField* pField = pPDFForm->GetField(nIndex); |
| 370 if (!pField) | 370 if (!pField) |
| 371 return FALSE; | 371 return FALSE; |
| 372 | 372 |
| 373 » vRet = pField->GetFullName(); | 373 » vRet = pField->GetFullName().c_str(); |
| 374 return TRUE; | 374 return TRUE; |
| 375 } | 375 } |
| 376 | 376 |
| 377 FX_BOOL Document::importAnFDF(IFXJS_Context* cc, const CJS_Parameters& params, C
JS_Value& vRet, CFX_WideString& sError) | 377 FX_BOOL Document::importAnFDF(IFXJS_Context* cc, const CJS_Parameters& params, C
JS_Value& vRet, CFX_WideString& sError) |
| 378 { | 378 { |
| 379 // Unsafe, not supported. | 379 // Unsafe, not supported. |
| 380 return TRUE; | 380 return TRUE; |
| 381 } | 381 } |
| 382 | 382 |
| 383 FX_BOOL Document::importAnXFDF(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError) | 383 FX_BOOL Document::importAnXFDF(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError) |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 CFX_WideString cwTrapped = pDictionary->GetUnicodeText("T
rapped"); | 871 CFX_WideString cwTrapped = pDictionary->GetUnicodeText("T
rapped"); |
| 872 | 872 |
| 873 v8::Isolate* isolate = GetIsolate(cc); | 873 v8::Isolate* isolate = GetIsolate(cc); |
| 874 if (vp.IsGetting()) | 874 if (vp.IsGetting()) |
| 875 { | 875 { |
| 876 CJS_Context* pContext = (CJS_Context *)cc; | 876 CJS_Context* pContext = (CJS_Context *)cc; |
| 877 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 877 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 878 | 878 |
| 879 JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, -1); | 879 JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, -1); |
| 880 | 880 |
| 881 » » JS_PutObjectString(isolate,pObj, L"Author", cwAuthor); | 881 » » JS_PutObjectString(isolate, pObj, L"Author", cwAuthor.c_str()); |
| 882 » » JS_PutObjectString(isolate,pObj, L"Title", cwTitle); | 882 » » JS_PutObjectString(isolate, pObj, L"Title", cwTitle.c_str()); |
| 883 » » JS_PutObjectString(isolate,pObj, L"Subject", cwSubject); | 883 » » JS_PutObjectString(isolate, pObj, L"Subject", cwSubject.c_str())
; |
| 884 » » JS_PutObjectString(isolate,pObj, L"Keywords", cwKeywords); | 884 » » JS_PutObjectString(isolate, pObj, L"Keywords", cwKeywords.c_str(
)); |
| 885 » » JS_PutObjectString(isolate,pObj, L"Creator", cwCreator); | 885 » » JS_PutObjectString(isolate, pObj, L"Creator", cwCreator.c_str())
; |
| 886 » » JS_PutObjectString(isolate,pObj, L"Producer", cwProducer); | 886 » » JS_PutObjectString(isolate, pObj, L"Producer", cwProducer.c_str(
)); |
| 887 » » JS_PutObjectString(isolate,pObj, L"CreationDate", cwCreationDate
); | 887 » » JS_PutObjectString(isolate, pObj, L"CreationDate", cwCreationDat
e.c_str()); |
| 888 » » JS_PutObjectString(isolate,pObj, L"ModDate", cwModDate); | 888 » » JS_PutObjectString(isolate, pObj, L"ModDate", cwModDate.c_str())
; |
| 889 » » JS_PutObjectString(isolate,pObj, L"Trapped", cwTrapped); | 889 » » JS_PutObjectString(isolate, pObj, L"Trapped", cwTrapped.c_str())
; |
| 890 | 890 |
| 891 // It's to be compatible to non-standard info dictionary. | 891 // It's to be compatible to non-standard info dictionary. |
| 892 FX_POSITION pos = pDictionary->GetStartPos(); | 892 FX_POSITION pos = pDictionary->GetStartPos(); |
| 893 while(pos) | 893 while(pos) |
| 894 { | 894 { |
| 895 CFX_ByteString bsKey; | 895 CFX_ByteString bsKey; |
| 896 CPDF_Object* pValueObj = pDictionary->GetNextElement(pos
, bsKey); | 896 CPDF_Object* pValueObj = pDictionary->GetNextElement(pos
, bsKey); |
| 897 CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey,
bsKey.GetLength()); | 897 CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey,
bsKey.GetLength()); |
| 898 if((pValueObj->GetType()==PDFOBJ_STRING) || (pValueObj->
GetType()==PDFOBJ_NAME) ) | 898 if((pValueObj->GetType()==PDFOBJ_STRING) || (pValueObj->
GetType()==PDFOBJ_NAME) ) |
| 899 » » » » » JS_PutObjectString(isolate,pObj, wsKey,
pValueObj->GetUnicodeText()); | 899 » » » » JS_PutObjectString(isolate, pObj, wsKey.c_str(),
pValueObj->GetUnicodeText().c_str()); |
| 900 if(pValueObj->GetType()==PDFOBJ_NUMBER) | 900 if(pValueObj->GetType()==PDFOBJ_NUMBER) |
| 901 » » » » JS_PutObjectNumber(isolate,pObj, wsKey, (float)p
ValueObj->GetNumber()); | 901 » » » » JS_PutObjectNumber(isolate,pObj, wsKey.c_str(),
(float)pValueObj->GetNumber()); |
| 902 if(pValueObj->GetType()==PDFOBJ_BOOLEAN) | 902 if(pValueObj->GetType()==PDFOBJ_BOOLEAN) |
| 903 » » » » JS_PutObjectBoolean(isolate,pObj, wsKey, (bool)p
ValueObj->GetInteger()); | 903 » » » » JS_PutObjectBoolean(isolate,pObj, wsKey.c_str(),
(bool)pValueObj->GetInteger()); |
| 904 } | 904 } |
| 905 | 905 |
| 906 vp << pObj; | 906 vp << pObj; |
| 907 return TRUE; | 907 return TRUE; |
| 908 } | 908 } |
| 909 else | 909 else |
| 910 { | 910 { |
| 911 return TRUE; | 911 return TRUE; |
| 912 } | 912 } |
| 913 } | 913 } |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1665 } | 1665 } |
| 1666 } | 1666 } |
| 1667 } | 1667 } |
| 1668 | 1668 |
| 1669 if (bStrip) | 1669 if (bStrip) |
| 1670 { | 1670 { |
| 1671 swRet.TrimLeft(); | 1671 swRet.TrimLeft(); |
| 1672 swRet.TrimRight(); | 1672 swRet.TrimRight(); |
| 1673 } | 1673 } |
| 1674 | 1674 |
| 1675 » vRet = swRet; | 1675 » vRet = swRet.c_str(); |
| 1676 return TRUE; | 1676 return TRUE; |
| 1677 } | 1677 } |
| 1678 | 1678 |
| 1679 FX_BOOL Document::getPageNthWordQuads(IFXJS_Context* cc, const CJS_Parameters& p
arams, CJS_Value& vRet, CFX_WideString& sError) | 1679 FX_BOOL Document::getPageNthWordQuads(IFXJS_Context* cc, const CJS_Parameters& p
arams, CJS_Value& vRet, CFX_WideString& sError) |
| 1680 { | 1680 { |
| 1681 ASSERT(m_pDocument != NULL); | 1681 ASSERT(m_pDocument != NULL); |
| 1682 | 1682 |
| 1683 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; | 1683 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; |
| 1684 | 1684 |
| 1685 return FALSE; | 1685 return FALSE; |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1961 { | 1961 { |
| 1962 m_DelayData.RemoveAt(DelArray[j]); | 1962 m_DelayData.RemoveAt(DelArray[j]); |
| 1963 } | 1963 } |
| 1964 } | 1964 } |
| 1965 | 1965 |
| 1966 CJS_Document* Document::GetCJSDoc() const | 1966 CJS_Document* Document::GetCJSDoc() const |
| 1967 { | 1967 { |
| 1968 return static_cast<CJS_Document*>(m_pJSObject); | 1968 return static_cast<CJS_Document*>(m_pJSObject); |
| 1969 } | 1969 } |
| 1970 | 1970 |
| OLD | NEW |