Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: fpdfsdk/fsdk_actionhandler.cpp

Issue 2227173002: Merge CPDFSDK_FormActionHandler into CPDFSDK_ActionHandler (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Merge CPDFSDK_FormActionHandler into CPDFSDK_ActionHandler Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | fpdfsdk/include/fsdk_actionhandler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/include/fsdk_actionhandler.h" 7 #include "fpdfsdk/include/fsdk_actionhandler.h"
8 8
9 #include <set> 9 #include <set>
10 10
11 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
12 #include "core/fpdfdoc/include/cpdf_formfield.h" 12 #include "core/fpdfdoc/include/cpdf_formfield.h"
13 #include "core/fpdfdoc/include/cpdf_interform.h" 13 #include "core/fpdfdoc/include/cpdf_interform.h"
14 #include "fpdfsdk/include/fsdk_define.h" 14 #include "fpdfsdk/include/fsdk_define.h"
15 #include "fpdfsdk/include/fsdk_mgr.h" 15 #include "fpdfsdk/include/fsdk_mgr.h"
16 #include "fpdfsdk/javascript/ijs_context.h" 16 #include "fpdfsdk/javascript/ijs_context.h"
17 #include "fpdfsdk/javascript/ijs_runtime.h" 17 #include "fpdfsdk/javascript/ijs_runtime.h"
18 #include "third_party/base/stl_util.h" 18 #include "third_party/base/stl_util.h"
19 19
20 CPDFSDK_ActionHandler::CPDFSDK_ActionHandler()
21 : m_pFormActionHandler(new CPDFSDK_FormActionHandler) {}
22
23 CPDFSDK_ActionHandler::~CPDFSDK_ActionHandler() {}
24
25 FX_BOOL CPDFSDK_ActionHandler::DoAction_DocOpen(const CPDF_Action& action, 20 FX_BOOL CPDFSDK_ActionHandler::DoAction_DocOpen(const CPDF_Action& action,
26 CPDFSDK_Document* pDocument) { 21 CPDFSDK_Document* pDocument) {
27 std::set<CPDF_Dictionary*> visited; 22 std::set<CPDF_Dictionary*> visited;
28 return ExecuteDocumentOpenAction(action, pDocument, &visited); 23 return ExecuteDocumentOpenAction(action, pDocument, &visited);
29 } 24 }
30 25
31 FX_BOOL CPDFSDK_ActionHandler::DoAction_JavaScript( 26 FX_BOOL CPDFSDK_ActionHandler::DoAction_JavaScript(
32 const CPDF_Action& JsAction, 27 const CPDF_Action& JsAction,
33 CFX_WideString csJSName, 28 CFX_WideString csJSName,
34 CPDFSDK_Document* pDocument) { 29 CPDFSDK_Document* pDocument) {
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 case CPDF_Action::Thread: 371 case CPDF_Action::Thread:
377 break; 372 break;
378 case CPDF_Action::URI: 373 case CPDF_Action::URI:
379 DoAction_URI(pDocument, action); 374 DoAction_URI(pDocument, action);
380 break; 375 break;
381 case CPDF_Action::Sound: 376 case CPDF_Action::Sound:
382 break; 377 break;
383 case CPDF_Action::Movie: 378 case CPDF_Action::Movie:
384 break; 379 break;
385 case CPDF_Action::Hide: 380 case CPDF_Action::Hide:
386 if (m_pFormActionHandler) { 381 DoAction_Hide(action, pDocument);
387 m_pFormActionHandler->DoAction_Hide(action, pDocument);
388 }
389 break; 382 break;
390 case CPDF_Action::Named: 383 case CPDF_Action::Named:
391 DoAction_Named(pDocument, action); 384 DoAction_Named(pDocument, action);
392 break; 385 break;
393 case CPDF_Action::SubmitForm: 386 case CPDF_Action::SubmitForm:
394 if (m_pFormActionHandler) { 387 DoAction_SubmitForm(action, pDocument);
395 m_pFormActionHandler->DoAction_SubmitForm(action, pDocument);
396 }
397 break; 388 break;
398 case CPDF_Action::ResetForm: 389 case CPDF_Action::ResetForm:
399 if (m_pFormActionHandler) { 390 DoAction_ResetForm(action, pDocument);
400 m_pFormActionHandler->DoAction_ResetForm(action, pDocument);
401 }
402 break; 391 break;
403 case CPDF_Action::ImportData: 392 case CPDF_Action::ImportData:
404 if (m_pFormActionHandler) { 393 DoAction_ImportData(action, pDocument);
405 m_pFormActionHandler->DoAction_ImportData(action, pDocument);
406 }
407 break; 394 break;
408 case CPDF_Action::JavaScript: 395 case CPDF_Action::JavaScript:
409 ASSERT(FALSE); 396 ASSERT(FALSE);
410 break; 397 break;
411 case CPDF_Action::SetOCGState: 398 case CPDF_Action::SetOCGState:
412 DoAction_SetOCGState(pDocument, action); 399 DoAction_SetOCGState(pDocument, action);
413 break; 400 break;
414 case CPDF_Action::Rendition: 401 case CPDF_Action::Rendition:
415 break; 402 break;
416 case CPDF_Action::Trans: 403 case CPDF_Action::Trans:
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 586
600 CFX_WideString csInfo; 587 CFX_WideString csInfo;
601 FX_BOOL bRet = pContext->RunScript(script, &csInfo); 588 FX_BOOL bRet = pContext->RunScript(script, &csInfo);
602 if (!bRet) { 589 if (!bRet) {
603 // FIXME: return error. 590 // FIXME: return error.
604 } 591 }
605 592
606 pRuntime->ReleaseContext(pContext); 593 pRuntime->ReleaseContext(pContext);
607 } 594 }
608 595
609 FX_BOOL CPDFSDK_FormActionHandler::DoAction_Hide(const CPDF_Action& action, 596 FX_BOOL CPDFSDK_ActionHandler::DoAction_Hide(const CPDF_Action& action,
610 CPDFSDK_Document* pDocument) { 597 CPDFSDK_Document* pDocument) {
611 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); 598 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm();
612 if (pInterForm->DoAction_Hide(action)) { 599 if (pInterForm->DoAction_Hide(action)) {
613 pDocument->SetChangeMark(); 600 pDocument->SetChangeMark();
614 return TRUE; 601 return TRUE;
615 } 602 }
616 603
617 return FALSE; 604 return FALSE;
618 } 605 }
619 606
620 FX_BOOL CPDFSDK_FormActionHandler::DoAction_SubmitForm( 607 FX_BOOL CPDFSDK_ActionHandler::DoAction_SubmitForm(
621 const CPDF_Action& action, 608 const CPDF_Action& action,
622 CPDFSDK_Document* pDocument) { 609 CPDFSDK_Document* pDocument) {
623 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); 610 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm();
624 return pInterForm->DoAction_SubmitForm(action); 611 return pInterForm->DoAction_SubmitForm(action);
625 } 612 }
626 613
627 FX_BOOL CPDFSDK_FormActionHandler::DoAction_ResetForm( 614 FX_BOOL CPDFSDK_ActionHandler::DoAction_ResetForm(const CPDF_Action& action,
628 const CPDF_Action& action, 615 CPDFSDK_Document* pDocument) {
629 CPDFSDK_Document* pDocument) {
630 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); 616 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm();
631 return pInterForm->DoAction_ResetForm(action); 617 return pInterForm->DoAction_ResetForm(action);
632 } 618 }
633 619
634 FX_BOOL CPDFSDK_FormActionHandler::DoAction_ImportData( 620 FX_BOOL CPDFSDK_ActionHandler::DoAction_ImportData(
635 const CPDF_Action& action, 621 const CPDF_Action& action,
636 CPDFSDK_Document* pDocument) { 622 CPDFSDK_Document* pDocument) {
637 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); 623 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm();
638 if (pInterForm->DoAction_ImportData(action)) { 624 if (pInterForm->DoAction_ImportData(action)) {
639 pDocument->SetChangeMark(); 625 pDocument->SetChangeMark();
640 return TRUE; 626 return TRUE;
641 } 627 }
642 628
643 return FALSE; 629 return FALSE;
644 } 630 }
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/include/fsdk_actionhandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698