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/fsdk_define.h" | 7 #include "../include/fsdk_define.h" |
8 #include "../include/fsdk_mgr.h" | 8 #include "../include/fsdk_mgr.h" |
9 #include "../include/fsdk_actionhandler.h" | 9 #include "../include/fsdk_actionhandler.h" |
10 #include "../include/javascript/IJavaScript.h" | 10 #include "../include/javascript/IJavaScript.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 ASSERT(pRuntime != NULL); | 152 ASSERT(pRuntime != NULL); |
153 | 153 |
154 pRuntime->SetReaderDocument(pDocument); | 154 pRuntime->SetReaderDocument(pDocument); |
155 | 155 |
156 IJS_Context* pContext = pRuntime->NewContext(); | 156 IJS_Context* pContext = pRuntime->NewContext(); |
157 ASSERT(pContext != NULL); | 157 ASSERT(pContext != NULL); |
158 | 158 |
159 pContext->OnLink_MouseUp(pDocument); | 159 pContext->OnLink_MouseUp(pDocument); |
160 | 160 |
161 CFX_WideString csInfo; | 161 CFX_WideString csInfo; |
162 FX_BOOL bRet = pContext->RunScript(swJS, csInfo); | 162 FX_BOOL bRet = pContext->RunScript(swJS, &csInfo); |
163 if (!bRet) { | 163 if (!bRet) { |
164 // FIXME: return error. | 164 // FIXME: return error. |
165 } | 165 } |
166 | 166 |
167 pRuntime->ReleaseContext(pContext); | 167 pRuntime->ReleaseContext(pContext); |
168 } | 168 } |
169 } | 169 } |
170 } else { | 170 } else { |
171 DoAction_NoJs(action, pDocument); | 171 DoAction_NoJs(action, pDocument); |
172 } | 172 } |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
340 // case CPDF_AAction::PageInvisible: | 340 // case CPDF_AAction::PageInvisible: |
341 // pContext->OnScreen_OutView(IsCTRLpressed (), | 341 // pContext->OnScreen_OutView(IsCTRLpressed (), |
342 // IsSHIFTpressed(), pScreen); | 342 // IsSHIFTpressed(), pScreen); |
343 // break; | 343 // break; |
344 // default: | 344 // default: |
345 // ASSERT(FALSE); | 345 // ASSERT(FALSE); |
346 // break; | 346 // break; |
347 // } | 347 // } |
348 | 348 |
349 CFX_WideString csInfo; | 349 CFX_WideString csInfo; |
350 FX_BOOL bRet = pContext->RunScript(swJS, csInfo); | 350 FX_BOOL bRet = pContext->RunScript(swJS, &csInfo); |
351 if (!bRet) { | 351 if (!bRet) { |
352 // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), | 352 // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), |
Lei Zhang
2015/10/09 01:09:29
I wish I didn't see this. Feel free to deal with i
| |
353 // csInfo); | 353 // csInfo); |
354 } | 354 } |
355 | 355 |
356 pRuntime->ReleaseContext(pContext); | 356 pRuntime->ReleaseContext(pContext); |
357 } | 357 } |
358 } | 358 } |
359 } else { | 359 } else { |
360 DoAction_NoJs(action, pDocument); | 360 DoAction_NoJs(action, pDocument); |
361 } | 361 } |
362 | 362 |
(...skipping 28 matching lines...) Expand all Loading... | |
391 ASSERT(pRuntime != NULL); | 391 ASSERT(pRuntime != NULL); |
392 | 392 |
393 pRuntime->SetReaderDocument(pDocument); | 393 pRuntime->SetReaderDocument(pDocument); |
394 | 394 |
395 IJS_Context* pContext = pRuntime->NewContext(); | 395 IJS_Context* pContext = pRuntime->NewContext(); |
396 ASSERT(pContext != NULL); | 396 ASSERT(pContext != NULL); |
397 | 397 |
398 pContext->OnBookmark_MouseUp(pBookmark); | 398 pContext->OnBookmark_MouseUp(pBookmark); |
399 | 399 |
400 CFX_WideString csInfo; | 400 CFX_WideString csInfo; |
401 FX_BOOL bRet = pContext->RunScript(swJS, csInfo); | 401 FX_BOOL bRet = pContext->RunScript(swJS, &csInfo); |
402 if (!bRet) { | 402 if (!bRet) { |
403 // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), | 403 // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), |
404 // csInfo); | 404 // csInfo); |
405 } | 405 } |
406 | 406 |
407 pRuntime->ReleaseContext(pContext); | 407 pRuntime->ReleaseContext(pContext); |
408 } | 408 } |
409 } | 409 } |
410 } else { | 410 } else { |
411 DoAction_NoJs(action, pDocument); | 411 DoAction_NoJs(action, pDocument); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
594 pContext->OnField_Validate(data.sChange, data.sChangeEx, data.bKeyDown, | 594 pContext->OnField_Validate(data.sChange, data.sChangeEx, data.bKeyDown, |
595 data.bModifier, data.bShift, pFormField, | 595 data.bModifier, data.bShift, pFormField, |
596 data.sValue, data.bRC); | 596 data.sValue, data.bRC); |
597 break; | 597 break; |
598 default: | 598 default: |
599 ASSERT(FALSE); | 599 ASSERT(FALSE); |
600 break; | 600 break; |
601 } | 601 } |
602 | 602 |
603 CFX_WideString csInfo; | 603 CFX_WideString csInfo; |
604 FX_BOOL bRet = pContext->RunScript(script, csInfo); | 604 FX_BOOL bRet = pContext->RunScript(script, &csInfo); |
605 if (!bRet) { | 605 if (!bRet) { |
606 // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), csInfo); | 606 // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), csInfo); |
607 } | 607 } |
608 | 608 |
609 pRuntime->ReleaseContext(pContext); | 609 pRuntime->ReleaseContext(pContext); |
610 } | 610 } |
611 | 611 |
612 void CPDFSDK_ActionHandler::RunDocumentOpenJavaScript( | 612 void CPDFSDK_ActionHandler::RunDocumentOpenJavaScript( |
613 CPDFSDK_Document* pDocument, | 613 CPDFSDK_Document* pDocument, |
614 const CFX_WideString& sScriptName, | 614 const CFX_WideString& sScriptName, |
615 const CFX_WideString& script) { | 615 const CFX_WideString& script) { |
616 ASSERT(pDocument != NULL); | 616 ASSERT(pDocument != NULL); |
617 | 617 |
618 IJS_Runtime* pRuntime = pDocument->GetJsRuntime(); | 618 IJS_Runtime* pRuntime = pDocument->GetJsRuntime(); |
619 ASSERT(pRuntime != NULL); | 619 ASSERT(pRuntime != NULL); |
620 | 620 |
621 pRuntime->SetReaderDocument(pDocument); | 621 pRuntime->SetReaderDocument(pDocument); |
622 | 622 |
623 IJS_Context* pContext = pRuntime->NewContext(); | 623 IJS_Context* pContext = pRuntime->NewContext(); |
624 ASSERT(pContext != NULL); | 624 ASSERT(pContext != NULL); |
625 | 625 |
626 pContext->OnDoc_Open(pDocument, sScriptName); | 626 pContext->OnDoc_Open(pDocument, sScriptName); |
627 | 627 |
628 CFX_WideString csInfo; | 628 CFX_WideString csInfo; |
629 FX_BOOL bRet = pContext->RunScript(script, csInfo); | 629 FX_BOOL bRet = pContext->RunScript(script, &csInfo); |
630 if (!bRet) { | 630 if (!bRet) { |
631 // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), csInfo); | 631 // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), csInfo); |
632 } | 632 } |
633 | 633 |
634 pRuntime->ReleaseContext(pContext); | 634 pRuntime->ReleaseContext(pContext); |
635 } | 635 } |
636 | 636 |
637 void CPDFSDK_ActionHandler::RunDocumentPageJavaScript( | 637 void CPDFSDK_ActionHandler::RunDocumentPageJavaScript( |
638 CPDFSDK_Document* pDocument, | 638 CPDFSDK_Document* pDocument, |
639 CPDF_AAction::AActionType type, | 639 CPDF_AAction::AActionType type, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
675 break; | 675 break; |
676 case CPDF_AAction::PageInvisible: | 676 case CPDF_AAction::PageInvisible: |
677 pContext->OnPage_OutView(pDocument); | 677 pContext->OnPage_OutView(pDocument); |
678 break; | 678 break; |
679 default: | 679 default: |
680 ASSERT(FALSE); | 680 ASSERT(FALSE); |
681 break; | 681 break; |
682 } | 682 } |
683 | 683 |
684 CFX_WideString csInfo; | 684 CFX_WideString csInfo; |
685 FX_BOOL bRet = pContext->RunScript(script, csInfo); | 685 FX_BOOL bRet = pContext->RunScript(script, &csInfo); |
686 if (!bRet) { | 686 if (!bRet) { |
687 // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), csInfo); | 687 // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), csInfo); |
688 } | 688 } |
689 | 689 |
690 pRuntime->ReleaseContext(pContext); | 690 pRuntime->ReleaseContext(pContext); |
691 } | 691 } |
692 | 692 |
693 FX_BOOL CPDFSDK_FormActionHandler::DoAction_Hide(const CPDF_Action& action, | 693 FX_BOOL CPDFSDK_FormActionHandler::DoAction_Hide(const CPDF_Action& action, |
694 CPDFSDK_Document* pDocument) { | 694 CPDFSDK_Document* pDocument) { |
695 ASSERT(pDocument != NULL); | 695 ASSERT(pDocument != NULL); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
739 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); | 739 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); |
740 ASSERT(pInterForm != NULL); | 740 ASSERT(pInterForm != NULL); |
741 | 741 |
742 if (pInterForm->DoAction_ImportData(action)) { | 742 if (pInterForm->DoAction_ImportData(action)) { |
743 pDocument->SetChangeMark(); | 743 pDocument->SetChangeMark(); |
744 return TRUE; | 744 return TRUE; |
745 } | 745 } |
746 | 746 |
747 return FALSE; | 747 return FALSE; |
748 } | 748 } |
OLD | NEW |