| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } else if (iPageNum >= iPageCount) { | 253 } else if (iPageNum >= iPageCount) { |
| 254 pEnv->JS_docgotoPage(iPageCount - 1); | 254 pEnv->JS_docgotoPage(iPageCount - 1); |
| 255 } else if (iPageNum < 0) { | 255 } else if (iPageNum < 0) { |
| 256 pEnv->JS_docgotoPage(0); | 256 pEnv->JS_docgotoPage(0); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 | 259 |
| 260 return TRUE; | 260 return TRUE; |
| 261 } | 261 } |
| 262 | 262 |
| 263 FX_BOOL Document::ParserParams(JSObject* pObj, CJS_AnnotObj& annotobj) { | |
| 264 // Not supported. | |
| 265 return TRUE; | |
| 266 } | |
| 267 | |
| 268 FX_BOOL Document::addAnnot(IFXJS_Context* cc, | 263 FX_BOOL Document::addAnnot(IFXJS_Context* cc, |
| 269 const CJS_Parameters& params, | 264 const CJS_Parameters& params, |
| 270 CJS_Value& vRet, | 265 CJS_Value& vRet, |
| 271 CFX_WideString& sError) { | 266 CFX_WideString& sError) { |
| 272 // Not supported. | 267 // Not supported. |
| 273 return TRUE; | 268 return TRUE; |
| 274 } | 269 } |
| 275 | 270 |
| 276 FX_BOOL Document::addField(IFXJS_Context* cc, | 271 FX_BOOL Document::addField(IFXJS_Context* cc, |
| 277 const CJS_Parameters& params, | 272 const CJS_Parameters& params, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 CFX_WideString wideName = params[0].ToCFXWideString(); | 318 CFX_WideString wideName = params[0].ToCFXWideString(); |
| 324 | 319 |
| 325 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); | 320 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); |
| 326 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); | 321 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); |
| 327 if (pPDFForm->CountFields(wideName) <= 0) { | 322 if (pPDFForm->CountFields(wideName) <= 0) { |
| 328 vRet.SetNull(); | 323 vRet.SetNull(); |
| 329 return TRUE; | 324 return TRUE; |
| 330 } | 325 } |
| 331 | 326 |
| 332 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 327 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 333 JSFXObject pFieldObj = JS_NewFxDynamicObj( | 328 v8::Local<v8::Object> pFieldObj = |
| 334 *pRuntime, pContext, JS_GetObjDefnID(*pRuntime, L"Field")); | 329 JS_NewFxDynamicObj(pRuntime->GetIsolate(), pContext, |
| 330 JS_GetObjDefnID(pRuntime->GetIsolate(), L"Field")); |
| 335 | 331 |
| 336 v8::Isolate* isolate = GetIsolate(cc); | 332 v8::Isolate* isolate = GetIsolate(cc); |
| 337 CJS_Field* pJSField = (CJS_Field*)JS_GetPrivate(isolate, pFieldObj); | 333 CJS_Field* pJSField = (CJS_Field*)JS_GetPrivate(isolate, pFieldObj); |
| 338 Field* pField = (Field*)pJSField->GetEmbedObject(); | 334 Field* pField = (Field*)pJSField->GetEmbedObject(); |
| 339 pField->AttachField(this, wideName); | 335 pField->AttachField(this, wideName); |
| 340 | 336 |
| 341 vRet = pJSField; | 337 vRet = pJSField; |
| 342 return TRUE; | 338 return TRUE; |
| 343 } | 339 } |
| 344 | 340 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 int nEnd = 0; | 451 int nEnd = 0; |
| 456 FX_BOOL bSilent = FALSE; | 452 FX_BOOL bSilent = FALSE; |
| 457 FX_BOOL bShrinkToFit = FALSE; | 453 FX_BOOL bShrinkToFit = FALSE; |
| 458 FX_BOOL bPrintAsImage = FALSE; | 454 FX_BOOL bPrintAsImage = FALSE; |
| 459 FX_BOOL bReverse = FALSE; | 455 FX_BOOL bReverse = FALSE; |
| 460 FX_BOOL bAnnotations = FALSE; | 456 FX_BOOL bAnnotations = FALSE; |
| 461 | 457 |
| 462 int nlength = params.size(); | 458 int nlength = params.size(); |
| 463 if (nlength == 9) { | 459 if (nlength == 9) { |
| 464 if (params[8].GetType() == VT_fxobject) { | 460 if (params[8].GetType() == VT_fxobject) { |
| 465 JSFXObject pObj = params[8].ToV8Object(); | 461 v8::Local<v8::Object> pObj = params[8].ToV8Object(); |
| 466 { | 462 { |
| 467 if (JS_GetObjDefnID(pObj) == | 463 if (JS_GetObjDefnID(pObj) == |
| 468 JS_GetObjDefnID(*pRuntime, L"PrintParamsObj")) { | 464 JS_GetObjDefnID(pRuntime->GetIsolate(), L"PrintParamsObj")) { |
| 469 if (CJS_Object* pJSObj = params[8].ToCJSObject()) { | 465 if (CJS_Object* pJSObj = params[8].ToCJSObject()) { |
| 470 if (PrintParamsObj* pprintparamsObj = | 466 if (PrintParamsObj* pprintparamsObj = |
| 471 (PrintParamsObj*)pJSObj->GetEmbedObject()) { | 467 (PrintParamsObj*)pJSObj->GetEmbedObject()) { |
| 472 bUI = pprintparamsObj->bUI; | 468 bUI = pprintparamsObj->bUI; |
| 473 nStart = pprintparamsObj->nStart; | 469 nStart = pprintparamsObj->nStart; |
| 474 nEnd = pprintparamsObj->nEnd; | 470 nEnd = pprintparamsObj->nEnd; |
| 475 bSilent = pprintparamsObj->bSilent; | 471 bSilent = pprintparamsObj->bSilent; |
| 476 bShrinkToFit = pprintparamsObj->bShrinkToFit; | 472 bShrinkToFit = pprintparamsObj->bShrinkToFit; |
| 477 bPrintAsImage = pprintparamsObj->bPrintAsImage; | 473 bPrintAsImage = pprintparamsObj->bPrintAsImage; |
| 478 bReverse = pprintparamsObj->bReverse; | 474 bReverse = pprintparamsObj->bReverse; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 CJS_Value v = params[0]; | 653 CJS_Value v = params[0]; |
| 658 if (v.GetType() == VT_string) { | 654 if (v.GetType() == VT_string) { |
| 659 strURL = params[0].ToCFXWideString(); | 655 strURL = params[0].ToCFXWideString(); |
| 660 if (nSize > 1) | 656 if (nSize > 1) |
| 661 bFDF = params[1].ToBool(); | 657 bFDF = params[1].ToBool(); |
| 662 if (nSize > 2) | 658 if (nSize > 2) |
| 663 bEmpty = params[2].ToBool(); | 659 bEmpty = params[2].ToBool(); |
| 664 if (nSize > 3) | 660 if (nSize > 3) |
| 665 aFields.Attach(params[3].ToV8Array()); | 661 aFields.Attach(params[3].ToV8Array()); |
| 666 } else if (v.GetType() == VT_object) { | 662 } else if (v.GetType() == VT_object) { |
| 667 JSObject pObj = params[0].ToV8Object(); | 663 v8::Local<v8::Object> pObj = params[0].ToV8Object(); |
| 668 v8::Local<v8::Value> pValue = JS_GetObjectElement(isolate, pObj, L"cURL"); | 664 v8::Local<v8::Value> pValue = JS_GetObjectElement(isolate, pObj, L"cURL"); |
| 669 if (!pValue.IsEmpty()) | 665 if (!pValue.IsEmpty()) |
| 670 strURL = | 666 strURL = |
| 671 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 667 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
| 672 pValue = JS_GetObjectElement(isolate, pObj, L"bFDF"); | 668 pValue = JS_GetObjectElement(isolate, pObj, L"bFDF"); |
| 673 bFDF = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToBool(); | 669 bFDF = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToBool(); |
| 674 pValue = JS_GetObjectElement(isolate, pObj, L"bEmpty"); | 670 pValue = JS_GetObjectElement(isolate, pObj, L"bEmpty"); |
| 675 bEmpty = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToBool(); | 671 bEmpty = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToBool(); |
| 676 pValue = JS_GetObjectElement(isolate, pObj, L"aFields"); | 672 pValue = JS_GetObjectElement(isolate, pObj, L"aFields"); |
| 677 aFields.Attach( | 673 aFields.Attach( |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 if (params.size() >= 4) | 760 if (params.size() >= 4) |
| 765 cBcc = params[3].ToCFXWideString(); | 761 cBcc = params[3].ToCFXWideString(); |
| 766 if (params.size() >= 5) | 762 if (params.size() >= 5) |
| 767 cSubject = params[4].ToCFXWideString(); | 763 cSubject = params[4].ToCFXWideString(); |
| 768 if (params.size() >= 6) | 764 if (params.size() >= 6) |
| 769 cMsg = params[5].ToCFXWideString(); | 765 cMsg = params[5].ToCFXWideString(); |
| 770 | 766 |
| 771 v8::Isolate* isolate = GetIsolate(cc); | 767 v8::Isolate* isolate = GetIsolate(cc); |
| 772 | 768 |
| 773 if (params.size() >= 1 && params[0].GetType() == VT_object) { | 769 if (params.size() >= 1 && params[0].GetType() == VT_object) { |
| 774 JSObject pObj = params[0].ToV8Object(); | 770 v8::Local<v8::Object> pObj = params[0].ToV8Object(); |
| 775 | 771 |
| 776 v8::Local<v8::Value> pValue = JS_GetObjectElement(isolate, pObj, L"bUI"); | 772 v8::Local<v8::Value> pValue = JS_GetObjectElement(isolate, pObj, L"bUI"); |
| 777 bUI = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToInt(); | 773 bUI = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToInt(); |
| 778 | 774 |
| 779 pValue = JS_GetObjectElement(isolate, pObj, L"cTo"); | 775 pValue = JS_GetObjectElement(isolate, pObj, L"cTo"); |
| 780 cTo = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 776 cTo = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
| 781 | 777 |
| 782 pValue = JS_GetObjectElement(isolate, pObj, L"cCc"); | 778 pValue = JS_GetObjectElement(isolate, pObj, L"cCc"); |
| 783 cCc = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 779 cCc = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
| 784 | 780 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 CFX_WideString cwCreator = pDictionary->GetUnicodeText("Creator"); | 845 CFX_WideString cwCreator = pDictionary->GetUnicodeText("Creator"); |
| 850 CFX_WideString cwProducer = pDictionary->GetUnicodeText("Producer"); | 846 CFX_WideString cwProducer = pDictionary->GetUnicodeText("Producer"); |
| 851 CFX_WideString cwCreationDate = pDictionary->GetUnicodeText("CreationDate"); | 847 CFX_WideString cwCreationDate = pDictionary->GetUnicodeText("CreationDate"); |
| 852 CFX_WideString cwModDate = pDictionary->GetUnicodeText("ModDate"); | 848 CFX_WideString cwModDate = pDictionary->GetUnicodeText("ModDate"); |
| 853 CFX_WideString cwTrapped = pDictionary->GetUnicodeText("Trapped"); | 849 CFX_WideString cwTrapped = pDictionary->GetUnicodeText("Trapped"); |
| 854 | 850 |
| 855 v8::Isolate* isolate = GetIsolate(cc); | 851 v8::Isolate* isolate = GetIsolate(cc); |
| 856 if (vp.IsGetting()) { | 852 if (vp.IsGetting()) { |
| 857 CJS_Context* pContext = (CJS_Context*)cc; | 853 CJS_Context* pContext = (CJS_Context*)cc; |
| 858 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 854 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 859 | 855 v8::Local<v8::Object> pObj = |
| 860 JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, -1); | 856 JS_NewFxDynamicObj(pRuntime->GetIsolate(), pContext, -1); |
| 861 | |
| 862 JS_PutObjectString(isolate, pObj, L"Author", cwAuthor.c_str()); | 857 JS_PutObjectString(isolate, pObj, L"Author", cwAuthor.c_str()); |
| 863 JS_PutObjectString(isolate, pObj, L"Title", cwTitle.c_str()); | 858 JS_PutObjectString(isolate, pObj, L"Title", cwTitle.c_str()); |
| 864 JS_PutObjectString(isolate, pObj, L"Subject", cwSubject.c_str()); | 859 JS_PutObjectString(isolate, pObj, L"Subject", cwSubject.c_str()); |
| 865 JS_PutObjectString(isolate, pObj, L"Keywords", cwKeywords.c_str()); | 860 JS_PutObjectString(isolate, pObj, L"Keywords", cwKeywords.c_str()); |
| 866 JS_PutObjectString(isolate, pObj, L"Creator", cwCreator.c_str()); | 861 JS_PutObjectString(isolate, pObj, L"Creator", cwCreator.c_str()); |
| 867 JS_PutObjectString(isolate, pObj, L"Producer", cwProducer.c_str()); | 862 JS_PutObjectString(isolate, pObj, L"Producer", cwProducer.c_str()); |
| 868 JS_PutObjectString(isolate, pObj, L"CreationDate", cwCreationDate.c_str()); | 863 JS_PutObjectString(isolate, pObj, L"CreationDate", cwCreationDate.c_str()); |
| 869 JS_PutObjectString(isolate, pObj, L"ModDate", cwModDate.c_str()); | 864 JS_PutObjectString(isolate, pObj, L"ModDate", cwModDate.c_str()); |
| 870 JS_PutObjectString(isolate, pObj, L"Trapped", cwTrapped.c_str()); | 865 JS_PutObjectString(isolate, pObj, L"Trapped", cwTrapped.c_str()); |
| 871 | 866 |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 if (params.size() != 2) { | 1402 if (params.size() != 2) { |
| 1408 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); | 1403 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); |
| 1409 return FALSE; | 1404 return FALSE; |
| 1410 } | 1405 } |
| 1411 CFX_WideString swIconName = params[0].ToCFXWideString(); | 1406 CFX_WideString swIconName = params[0].ToCFXWideString(); |
| 1412 | 1407 |
| 1413 if (params[1].GetType() != VT_object) { | 1408 if (params[1].GetType() != VT_object) { |
| 1414 sError = JSGetStringFromID(pContext, IDS_STRING_JSTYPEERROR); | 1409 sError = JSGetStringFromID(pContext, IDS_STRING_JSTYPEERROR); |
| 1415 return FALSE; | 1410 return FALSE; |
| 1416 } | 1411 } |
| 1417 JSFXObject pJSIcon = params[1].ToV8Object(); | 1412 v8::Local<v8::Object> pJSIcon = params[1].ToV8Object(); |
| 1418 | 1413 |
| 1419 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 1414 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 1420 if (JS_GetObjDefnID(pJSIcon) != JS_GetObjDefnID(*pRuntime, L"Icon")) { | 1415 if (JS_GetObjDefnID(pJSIcon) != |
| 1416 JS_GetObjDefnID(pRuntime->GetIsolate(), L"Icon")) { |
| 1421 sError = JSGetStringFromID(pContext, IDS_STRING_JSTYPEERROR); | 1417 sError = JSGetStringFromID(pContext, IDS_STRING_JSTYPEERROR); |
| 1422 return FALSE; | 1418 return FALSE; |
| 1423 } | 1419 } |
| 1424 | 1420 |
| 1425 CJS_EmbedObj* pEmbedObj = params[1].ToCJSObject()->GetEmbedObject(); | 1421 CJS_EmbedObj* pEmbedObj = params[1].ToCJSObject()->GetEmbedObject(); |
| 1426 if (!pEmbedObj) { | 1422 if (!pEmbedObj) { |
| 1427 sError = JSGetStringFromID(pContext, IDS_STRING_JSTYPEERROR); | 1423 sError = JSGetStringFromID(pContext, IDS_STRING_JSTYPEERROR); |
| 1428 return FALSE; | 1424 return FALSE; |
| 1429 } | 1425 } |
| 1430 | 1426 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1457 CJS_Array Icons(m_isolate); | 1453 CJS_Array Icons(m_isolate); |
| 1458 IconElement* pIconElement = NULL; | 1454 IconElement* pIconElement = NULL; |
| 1459 int iIconTreeLength = m_pIconTree->GetLength(); | 1455 int iIconTreeLength = m_pIconTree->GetLength(); |
| 1460 | 1456 |
| 1461 CJS_Context* pContext = (CJS_Context*)cc; | 1457 CJS_Context* pContext = (CJS_Context*)cc; |
| 1462 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 1458 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 1463 | 1459 |
| 1464 for (int i = 0; i < iIconTreeLength; i++) { | 1460 for (int i = 0; i < iIconTreeLength; i++) { |
| 1465 pIconElement = (*m_pIconTree)[i]; | 1461 pIconElement = (*m_pIconTree)[i]; |
| 1466 | 1462 |
| 1467 JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, | 1463 v8::Local<v8::Object> pObj = |
| 1468 JS_GetObjDefnID(*pRuntime, L"Icon")); | 1464 JS_NewFxDynamicObj(pRuntime->GetIsolate(), pContext, |
| 1465 JS_GetObjDefnID(pRuntime->GetIsolate(), L"Icon")); |
| 1469 if (pObj.IsEmpty()) | 1466 if (pObj.IsEmpty()) |
| 1470 return FALSE; | 1467 return FALSE; |
| 1471 | 1468 |
| 1472 CJS_Icon* pJS_Icon = (CJS_Icon*)JS_GetPrivate(pObj); | 1469 CJS_Icon* pJS_Icon = (CJS_Icon*)JS_GetPrivate(pObj); |
| 1473 if (!pJS_Icon) | 1470 if (!pJS_Icon) |
| 1474 return FALSE; | 1471 return FALSE; |
| 1475 | 1472 |
| 1476 Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject(); | 1473 Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject(); |
| 1477 if (!pIcon) | 1474 if (!pIcon) |
| 1478 return FALSE; | 1475 return FALSE; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1500 return FALSE; | 1497 return FALSE; |
| 1501 CFX_WideString swIconName = params[0].ToCFXWideString(); | 1498 CFX_WideString swIconName = params[0].ToCFXWideString(); |
| 1502 int iIconCounts = m_pIconTree->GetLength(); | 1499 int iIconCounts = m_pIconTree->GetLength(); |
| 1503 | 1500 |
| 1504 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 1501 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 1505 | 1502 |
| 1506 for (int i = 0; i < iIconCounts; i++) { | 1503 for (int i = 0; i < iIconCounts; i++) { |
| 1507 if ((*m_pIconTree)[i]->IconName == swIconName) { | 1504 if ((*m_pIconTree)[i]->IconName == swIconName) { |
| 1508 Icon* pRetIcon = (*m_pIconTree)[i]->IconStream; | 1505 Icon* pRetIcon = (*m_pIconTree)[i]->IconStream; |
| 1509 | 1506 |
| 1510 JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, | 1507 v8::Local<v8::Object> pObj = |
| 1511 JS_GetObjDefnID(*pRuntime, L"Icon")); | 1508 JS_NewFxDynamicObj(pRuntime->GetIsolate(), pContext, |
| 1509 JS_GetObjDefnID(pRuntime->GetIsolate(), L"Icon")); |
| 1512 if (pObj.IsEmpty()) | 1510 if (pObj.IsEmpty()) |
| 1513 return FALSE; | 1511 return FALSE; |
| 1514 | 1512 |
| 1515 CJS_Icon* pJS_Icon = (CJS_Icon*)JS_GetPrivate(pObj); | 1513 CJS_Icon* pJS_Icon = (CJS_Icon*)JS_GetPrivate(pObj); |
| 1516 if (!pJS_Icon) | 1514 if (!pJS_Icon) |
| 1517 return FALSE; | 1515 return FALSE; |
| 1518 | 1516 |
| 1519 Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject(); | 1517 Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject(); |
| 1520 if (!pIcon) | 1518 if (!pIcon) |
| 1521 return FALSE; | 1519 return FALSE; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 | 1699 |
| 1702 return TRUE; | 1700 return TRUE; |
| 1703 } | 1701 } |
| 1704 | 1702 |
| 1705 FX_BOOL Document::getPrintParams(IFXJS_Context* cc, | 1703 FX_BOOL Document::getPrintParams(IFXJS_Context* cc, |
| 1706 const CJS_Parameters& params, | 1704 const CJS_Parameters& params, |
| 1707 CJS_Value& vRet, | 1705 CJS_Value& vRet, |
| 1708 CFX_WideString& sError) { | 1706 CFX_WideString& sError) { |
| 1709 CJS_Context* pContext = (CJS_Context*)cc; | 1707 CJS_Context* pContext = (CJS_Context*)cc; |
| 1710 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 1708 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 1711 JSFXObject pRetObj = JS_NewFxDynamicObj( | 1709 v8::Local<v8::Object> pRetObj = JS_NewFxDynamicObj( |
| 1712 *pRuntime, pContext, JS_GetObjDefnID(*pRuntime, L"PrintParamsObj")); | 1710 pRuntime->GetIsolate(), pContext, |
| 1711 JS_GetObjDefnID(pRuntime->GetIsolate(), L"PrintParamsObj")); |
| 1713 | 1712 |
| 1714 // Not implemented yet. | 1713 // Not implemented yet. |
| 1715 | 1714 |
| 1716 vRet = pRetObj; | 1715 vRet = pRetObj; |
| 1717 return TRUE; | 1716 return TRUE; |
| 1718 } | 1717 } |
| 1719 | 1718 |
| 1720 #define ISLATINWORD(u) (u != 0x20 && u <= 0x28FF) | 1719 #define ISLATINWORD(u) (u != 0x20 && u <= 0x28FF) |
| 1721 | 1720 |
| 1722 int Document::CountWords(CPDF_TextObject* pTextObj) { | 1721 int Document::CountWords(CPDF_TextObject* pTextObj) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1825 return FALSE; | 1824 return FALSE; |
| 1826 | 1825 |
| 1827 int iSize = params.size(); | 1826 int iSize = params.size(); |
| 1828 | 1827 |
| 1829 int nStart = 0; | 1828 int nStart = 0; |
| 1830 int nEnd = 0; | 1829 int nEnd = 0; |
| 1831 | 1830 |
| 1832 if (iSize < 1) { | 1831 if (iSize < 1) { |
| 1833 } else if (iSize == 1) { | 1832 } else if (iSize == 1) { |
| 1834 if (params[0].GetType() == VT_object) { | 1833 if (params[0].GetType() == VT_object) { |
| 1835 JSObject pObj = params[0].ToV8Object(); | 1834 v8::Local<v8::Object> pObj = params[0].ToV8Object(); |
| 1836 v8::Local<v8::Value> pValue = | 1835 v8::Local<v8::Value> pValue = |
| 1837 JS_GetObjectElement(isolate, pObj, L"nStart"); | 1836 JS_GetObjectElement(isolate, pObj, L"nStart"); |
| 1838 nStart = CJS_Value(m_isolate, pValue, GET_VALUE_TYPE(pValue)).ToInt(); | 1837 nStart = CJS_Value(m_isolate, pValue, GET_VALUE_TYPE(pValue)).ToInt(); |
| 1839 | 1838 |
| 1840 pValue = JS_GetObjectElement(isolate, pObj, L"nEnd"); | 1839 pValue = JS_GetObjectElement(isolate, pObj, L"nEnd"); |
| 1841 nEnd = CJS_Value(m_isolate, pValue, GET_VALUE_TYPE(pValue)).ToInt(); | 1840 nEnd = CJS_Value(m_isolate, pValue, GET_VALUE_TYPE(pValue)).ToInt(); |
| 1842 } else { | 1841 } else { |
| 1843 nStart = params[0].ToInt(); | 1842 nStart = params[0].ToInt(); |
| 1844 } | 1843 } |
| 1845 } else { | 1844 } else { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 CFX_DWordArray DelArray; | 1929 CFX_DWordArray DelArray; |
| 1931 | 1930 |
| 1932 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { | 1931 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { |
| 1933 m_DelayData.RemoveAt(DelArray[j]); | 1932 m_DelayData.RemoveAt(DelArray[j]); |
| 1934 } | 1933 } |
| 1935 } | 1934 } |
| 1936 | 1935 |
| 1937 CJS_Document* Document::GetCJSDoc() const { | 1936 CJS_Document* Document::GetCJSDoc() const { |
| 1938 return static_cast<CJS_Document*>(m_pJSObject); | 1937 return static_cast<CJS_Document*>(m_pJSObject); |
| 1939 } | 1938 } |
| OLD | NEW |