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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 case CPDF_Action::Trans: | 418 case CPDF_Action::Trans: |
419 break; | 419 break; |
420 case CPDF_Action::GoTo3DView: | 420 case CPDF_Action::GoTo3DView: |
421 break; | 421 break; |
422 default: | 422 default: |
423 break; | 423 break; |
424 } | 424 } |
425 } | 425 } |
426 | 426 |
427 FX_BOOL CPDFSDK_ActionHandler::IsValidDocView(CPDFSDK_Document* pDocument) { | 427 FX_BOOL CPDFSDK_ActionHandler::IsValidDocView(CPDFSDK_Document* pDocument) { |
428 ASSERT(pDocument != NULL); | 428 ASSERT(pDocument); |
429 return TRUE; | 429 return TRUE; |
430 } | 430 } |
431 | 431 |
432 void CPDFSDK_ActionHandler::DoAction_GoTo(CPDFSDK_Document* pDocument, | 432 void CPDFSDK_ActionHandler::DoAction_GoTo(CPDFSDK_Document* pDocument, |
433 const CPDF_Action& action) { | 433 const CPDF_Action& action) { |
434 ASSERT(action); | 434 ASSERT(action); |
435 | 435 |
436 CPDF_Document* pPDFDocument = pDocument->GetDocument(); | 436 CPDF_Document* pPDFDocument = pDocument->GetDocument(); |
437 ASSERT(pPDFDocument != NULL); | 437 ASSERT(pPDFDocument); |
438 CPDFDoc_Environment* pApp = pDocument->GetEnv(); | |
439 ASSERT(pApp != NULL); | |
440 | 438 |
441 CPDF_Dest MyDest = action.GetDest(pPDFDocument); | 439 CPDF_Dest MyDest = action.GetDest(pPDFDocument); |
442 int nPageIndex = MyDest.GetPageIndex(pPDFDocument); | 440 int nPageIndex = MyDest.GetPageIndex(pPDFDocument); |
443 int nFitType = MyDest.GetZoomMode(); | 441 int nFitType = MyDest.GetZoomMode(); |
444 const CPDF_Array* pMyArray = (CPDF_Array*)MyDest.GetObject(); | 442 const CPDF_Array* pMyArray = ToArray(MyDest.GetObject()); |
445 float* pPosAry = NULL; | 443 float* pPosAry = nullptr; |
446 int sizeOfAry = 0; | 444 int sizeOfAry = 0; |
447 if (pMyArray != NULL) { | 445 if (pMyArray) { |
448 pPosAry = new float[pMyArray->GetCount()]; | 446 pPosAry = new float[pMyArray->GetCount()]; |
449 int j = 0; | 447 int j = 0; |
450 for (int i = 2; i < (int)pMyArray->GetCount(); i++) { | 448 for (int i = 2; i < (int)pMyArray->GetCount(); i++) { |
451 pPosAry[j++] = pMyArray->GetFloat(i); | 449 pPosAry[j++] = pMyArray->GetFloat(i); |
452 } | 450 } |
453 sizeOfAry = j; | 451 sizeOfAry = j; |
454 } | 452 } |
| 453 |
| 454 CPDFDoc_Environment* pApp = pDocument->GetEnv(); |
455 pApp->FFI_DoGoToAction(nPageIndex, nFitType, pPosAry, sizeOfAry); | 455 pApp->FFI_DoGoToAction(nPageIndex, nFitType, pPosAry, sizeOfAry); |
456 delete[] pPosAry; | 456 delete[] pPosAry; |
457 } | 457 } |
458 | 458 |
459 void CPDFSDK_ActionHandler::DoAction_GoToR(CPDFSDK_Document* pDocument, | 459 void CPDFSDK_ActionHandler::DoAction_GoToR(CPDFSDK_Document* pDocument, |
460 const CPDF_Action& action) {} | 460 const CPDF_Action& action) {} |
461 | 461 |
462 void CPDFSDK_ActionHandler::DoAction_Launch(CPDFSDK_Document* pDocument, | 462 void CPDFSDK_ActionHandler::DoAction_Launch(CPDFSDK_Document* pDocument, |
463 const CPDF_Action& action) {} | 463 const CPDF_Action& action) {} |
464 | 464 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); | 678 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); |
679 ASSERT(pInterForm != NULL); | 679 ASSERT(pInterForm != NULL); |
680 | 680 |
681 if (pInterForm->DoAction_ImportData(action)) { | 681 if (pInterForm->DoAction_ImportData(action)) { |
682 pDocument->SetChangeMark(); | 682 pDocument->SetChangeMark(); |
683 return TRUE; | 683 return TRUE; |
684 } | 684 } |
685 | 685 |
686 return FALSE; | 686 return FALSE; |
687 } | 687 } |
OLD | NEW |