| 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 "public/fpdf_formfill.h" | 7 #include "public/fpdf_formfill.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 12 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
| 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| 14 #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" | 14 #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" |
| 15 #include "fpdfsdk/include/fsdk_define.h" | 15 #include "fpdfsdk/include/fsdk_define.h" |
| 16 #include "fpdfsdk/include/fsdk_mgr.h" | 16 #include "fpdfsdk/include/fsdk_mgr.h" |
| 17 #include "public/fpdfview.h" | 17 #include "public/fpdfview.h" |
| 18 #include "third_party/base/stl_util.h" | 18 #include "third_party/base/stl_util.h" |
| 19 | 19 |
| 20 #ifdef PDF_ENABLE_XFA | 20 #ifdef PDF_ENABLE_XFA |
| 21 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" | 21 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" |
| 22 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" | 22 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" |
| 23 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" | 23 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" |
| 24 #include "xfa/include/fxfa/xfa_ffapp.h" |
| 25 #include "xfa/include/fxfa/xfa_ffdocview.h" |
| 26 #include "xfa/include/fxfa/xfa_ffpageview.h" |
| 24 #endif // PDF_ENABLE_XFA | 27 #endif // PDF_ENABLE_XFA |
| 25 | 28 |
| 26 namespace { | 29 namespace { |
| 27 | 30 |
| 28 CPDFSDK_InterForm* FormHandleToInterForm(FPDF_FORMHANDLE hHandle) { | 31 CPDFSDK_InterForm* FormHandleToInterForm(FPDF_FORMHANDLE hHandle) { |
| 29 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle); | 32 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle); |
| 30 return pSDKDoc ? pSDKDoc->GetInterForm() : nullptr; | 33 return pSDKDoc ? pSDKDoc->GetInterForm() : nullptr; |
| 31 } | 34 } |
| 32 | 35 |
| 33 CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle, | 36 CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return -1; | 71 return -1; |
| 69 CPDF_FormField* pFormField = pFormCtrl->GetField(); | 72 CPDF_FormField* pFormField = pFormCtrl->GetField(); |
| 70 return pFormField ? pFormField->GetFieldType() : -1; | 73 return pFormField ? pFormField->GetFieldType() : -1; |
| 71 } | 74 } |
| 72 | 75 |
| 73 #ifdef PDF_ENABLE_XFA | 76 #ifdef PDF_ENABLE_XFA |
| 74 CPDFXFA_Page* pXFAPage = UnderlyingFromFPDFPage(page); | 77 CPDFXFA_Page* pXFAPage = UnderlyingFromFPDFPage(page); |
| 75 if (!pXFAPage) | 78 if (!pXFAPage) |
| 76 return -1; | 79 return -1; |
| 77 | 80 |
| 78 IXFA_PageView* pPageView = pXFAPage->GetXFAPageView(); | 81 CXFA_FFPageView* pPageView = pXFAPage->GetXFAPageView(); |
| 79 if (!pPageView) | 82 if (!pPageView) |
| 80 return -1; | 83 return -1; |
| 81 | 84 |
| 82 IXFA_DocView* pDocView = pPageView->GetDocView(); | 85 CXFA_FFDocView* pDocView = pPageView->GetDocView(); |
| 83 if (!pDocView) | 86 if (!pDocView) |
| 84 return -1; | 87 return -1; |
| 85 | 88 |
| 86 IXFA_WidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); | 89 CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); |
| 87 if (!pWidgetHandler) | 90 if (!pWidgetHandler) |
| 88 return -1; | 91 return -1; |
| 89 | 92 |
| 90 std::unique_ptr<IXFA_WidgetIterator, ReleaseDeleter<IXFA_WidgetIterator>> | 93 std::unique_ptr<IXFA_WidgetIterator, ReleaseDeleter<IXFA_WidgetIterator>> |
| 91 pWidgetIterator(pPageView->CreateWidgetIterator( | 94 pWidgetIterator(pPageView->CreateWidgetIterator( |
| 92 XFA_TRAVERSEWAY_Form, | 95 XFA_TRAVERSEWAY_Form, |
| 93 XFA_WIDGETFILTER_Viewable | XFA_WIDGETFILTER_AllType)); | 96 XFA_WIDGETFILTER_Viewable | XFA_WIDGETFILTER_AllType)); |
| 94 if (!pWidgetIterator) | 97 if (!pWidgetIterator) |
| 95 return -1; | 98 return -1; |
| 96 | 99 |
| 97 IXFA_Widget* pXFAAnnot = pWidgetIterator->MoveToNext(); | 100 CXFA_FFWidget* pXFAAnnot = pWidgetIterator->MoveToNext(); |
| 98 while (pXFAAnnot) { | 101 while (pXFAAnnot) { |
| 99 CFX_RectF rcBBox; | 102 CFX_RectF rcBBox; |
| 100 pWidgetHandler->GetBBox(pXFAAnnot, rcBBox, 0); | 103 pWidgetHandler->GetBBox(pXFAAnnot, rcBBox, 0); |
| 101 CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, | 104 CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, |
| 102 rcBBox.top + rcBBox.height); | 105 rcBBox.top + rcBBox.height); |
| 103 rcWidget.left -= 1.0f; | 106 rcWidget.left -= 1.0f; |
| 104 rcWidget.right += 1.0f; | 107 rcWidget.right += 1.0f; |
| 105 rcWidget.bottom -= 1.0f; | 108 rcWidget.bottom -= 1.0f; |
| 106 rcWidget.top += 1.0f; | 109 rcWidget.top += 1.0f; |
| 107 | 110 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, | 413 DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, |
| 411 FPDF_WIDGET hWidget) { | 414 FPDF_WIDGET hWidget) { |
| 412 if (NULL == hWidget || NULL == document) | 415 if (NULL == hWidget || NULL == document) |
| 413 return; | 416 return; |
| 414 | 417 |
| 415 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 418 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; |
| 416 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 419 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 417 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 420 pDocument->GetDocType() != XFA_DOCTYPE_Static) |
| 418 return; | 421 return; |
| 419 | 422 |
| 420 IXFA_MenuHandler* pXFAMenuHander = | 423 CXFA_FFMenuHandler* pXFAMenuHander = |
| 421 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); | 424 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); |
| 422 if (pXFAMenuHander == NULL) | 425 if (pXFAMenuHander == NULL) |
| 423 return; | 426 return; |
| 424 | 427 |
| 425 pXFAMenuHander->Undo((IXFA_Widget*)hWidget); | 428 pXFAMenuHander->Undo((CXFA_FFWidget*)hWidget); |
| 426 } | 429 } |
| 427 DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document, | 430 DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document, |
| 428 FPDF_WIDGET hWidget) { | 431 FPDF_WIDGET hWidget) { |
| 429 if (NULL == hWidget || NULL == document) | 432 if (NULL == hWidget || NULL == document) |
| 430 return; | 433 return; |
| 431 | 434 |
| 432 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 435 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; |
| 433 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 436 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 434 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 437 pDocument->GetDocType() != XFA_DOCTYPE_Static) |
| 435 return; | 438 return; |
| 436 | 439 |
| 437 IXFA_MenuHandler* pXFAMenuHander = | 440 CXFA_FFMenuHandler* pXFAMenuHander = |
| 438 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); | 441 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); |
| 439 if (pXFAMenuHander == NULL) | 442 if (pXFAMenuHander == NULL) |
| 440 return; | 443 return; |
| 441 | 444 |
| 442 pXFAMenuHander->Redo((IXFA_Widget*)hWidget); | 445 pXFAMenuHander->Redo((CXFA_FFWidget*)hWidget); |
| 443 } | 446 } |
| 444 | 447 |
| 445 DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document, | 448 DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document, |
| 446 FPDF_WIDGET hWidget) { | 449 FPDF_WIDGET hWidget) { |
| 447 if (NULL == hWidget || NULL == document) | 450 if (NULL == hWidget || NULL == document) |
| 448 return; | 451 return; |
| 449 | 452 |
| 450 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 453 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; |
| 451 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 454 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 452 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 455 pDocument->GetDocType() != XFA_DOCTYPE_Static) |
| 453 return; | 456 return; |
| 454 | 457 |
| 455 IXFA_MenuHandler* pXFAMenuHander = | 458 CXFA_FFMenuHandler* pXFAMenuHander = |
| 456 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); | 459 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); |
| 457 if (pXFAMenuHander == NULL) | 460 if (pXFAMenuHander == NULL) |
| 458 return; | 461 return; |
| 459 | 462 |
| 460 pXFAMenuHander->SelectAll((IXFA_Widget*)hWidget); | 463 pXFAMenuHander->SelectAll((CXFA_FFWidget*)hWidget); |
| 461 } | 464 } |
| 462 DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document, | 465 DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document, |
| 463 FPDF_WIDGET hWidget, | 466 FPDF_WIDGET hWidget, |
| 464 FPDF_WIDESTRING wsText, | 467 FPDF_WIDESTRING wsText, |
| 465 FPDF_DWORD* size) { | 468 FPDF_DWORD* size) { |
| 466 if (NULL == hWidget || NULL == document) | 469 if (NULL == hWidget || NULL == document) |
| 467 return; | 470 return; |
| 468 | 471 |
| 469 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 472 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; |
| 470 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 473 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 471 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 474 pDocument->GetDocType() != XFA_DOCTYPE_Static) |
| 472 return; | 475 return; |
| 473 | 476 |
| 474 IXFA_MenuHandler* pXFAMenuHander = | 477 CXFA_FFMenuHandler* pXFAMenuHander = |
| 475 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); | 478 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); |
| 476 if (pXFAMenuHander == NULL) | 479 if (pXFAMenuHander == NULL) |
| 477 return; | 480 return; |
| 478 | 481 |
| 479 CFX_WideString wsCpText; | 482 CFX_WideString wsCpText; |
| 480 pXFAMenuHander->Copy((IXFA_Widget*)hWidget, wsCpText); | 483 pXFAMenuHander->Copy((CXFA_FFWidget*)hWidget, wsCpText); |
| 481 | 484 |
| 482 CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode(); | 485 CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode(); |
| 483 uint32_t len = bsCpText.GetLength() / sizeof(unsigned short); | 486 uint32_t len = bsCpText.GetLength() / sizeof(unsigned short); |
| 484 if (wsText == NULL) { | 487 if (wsText == NULL) { |
| 485 *size = len; | 488 *size = len; |
| 486 return; | 489 return; |
| 487 } | 490 } |
| 488 | 491 |
| 489 uint32_t real_size = len < *size ? len : *size; | 492 uint32_t real_size = len < *size ? len : *size; |
| 490 if (real_size > 0) { | 493 if (real_size > 0) { |
| 491 FXSYS_memcpy((void*)wsText, | 494 FXSYS_memcpy((void*)wsText, |
| 492 bsCpText.GetBuffer(real_size * sizeof(unsigned short)), | 495 bsCpText.GetBuffer(real_size * sizeof(unsigned short)), |
| 493 real_size * sizeof(unsigned short)); | 496 real_size * sizeof(unsigned short)); |
| 494 bsCpText.ReleaseBuffer(real_size * sizeof(unsigned short)); | 497 bsCpText.ReleaseBuffer(real_size * sizeof(unsigned short)); |
| 495 } | 498 } |
| 496 *size = real_size; | 499 *size = real_size; |
| 497 } | 500 } |
| 498 | 501 |
| 499 DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document, | 502 DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document, |
| 500 FPDF_WIDGET hWidget, | 503 FPDF_WIDGET hWidget, |
| 501 FPDF_WIDESTRING wsText, | 504 FPDF_WIDESTRING wsText, |
| 502 FPDF_DWORD* size) { | 505 FPDF_DWORD* size) { |
| 503 if (NULL == hWidget || NULL == document) | 506 if (NULL == hWidget || NULL == document) |
| 504 return; | 507 return; |
| 505 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 508 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; |
| 506 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 509 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 507 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 510 pDocument->GetDocType() != XFA_DOCTYPE_Static) |
| 508 return; | 511 return; |
| 509 | 512 |
| 510 IXFA_MenuHandler* pXFAMenuHander = | 513 CXFA_FFMenuHandler* pXFAMenuHander = |
| 511 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); | 514 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); |
| 512 if (pXFAMenuHander == NULL) | 515 if (pXFAMenuHander == NULL) |
| 513 return; | 516 return; |
| 514 | 517 |
| 515 CFX_WideString wsCpText; | 518 CFX_WideString wsCpText; |
| 516 pXFAMenuHander->Cut((IXFA_Widget*)hWidget, wsCpText); | 519 pXFAMenuHander->Cut((CXFA_FFWidget*)hWidget, wsCpText); |
| 517 | 520 |
| 518 CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode(); | 521 CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode(); |
| 519 uint32_t len = bsCpText.GetLength() / sizeof(unsigned short); | 522 uint32_t len = bsCpText.GetLength() / sizeof(unsigned short); |
| 520 if (wsText == NULL) { | 523 if (wsText == NULL) { |
| 521 *size = len; | 524 *size = len; |
| 522 return; | 525 return; |
| 523 } | 526 } |
| 524 | 527 |
| 525 uint32_t real_size = len < *size ? len : *size; | 528 uint32_t real_size = len < *size ? len : *size; |
| 526 if (real_size > 0) { | 529 if (real_size > 0) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 537 FPDF_WIDESTRING wsText, | 540 FPDF_WIDESTRING wsText, |
| 538 FPDF_DWORD size) { | 541 FPDF_DWORD size) { |
| 539 if (NULL == hWidget || NULL == document) | 542 if (NULL == hWidget || NULL == document) |
| 540 return; | 543 return; |
| 541 | 544 |
| 542 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 545 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; |
| 543 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 546 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 544 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 547 pDocument->GetDocType() != XFA_DOCTYPE_Static) |
| 545 return; | 548 return; |
| 546 | 549 |
| 547 IXFA_MenuHandler* pXFAMenuHander = | 550 CXFA_FFMenuHandler* pXFAMenuHander = |
| 548 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); | 551 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); |
| 549 if (pXFAMenuHander == NULL) | 552 if (pXFAMenuHander == NULL) |
| 550 return; | 553 return; |
| 551 | 554 |
| 552 CFX_WideString wstr = CFX_WideString::FromUTF16LE(wsText, size); | 555 CFX_WideString wstr = CFX_WideString::FromUTF16LE(wsText, size); |
| 553 pXFAMenuHander->Paste((IXFA_Widget*)hWidget, wstr); | 556 pXFAMenuHander->Paste((CXFA_FFWidget*)hWidget, wstr); |
| 554 } | 557 } |
| 555 | 558 |
| 556 DLLEXPORT void STDCALL | 559 DLLEXPORT void STDCALL |
| 557 FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document, | 560 FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document, |
| 558 FPDF_WIDGET hWidget, | 561 FPDF_WIDGET hWidget, |
| 559 float x, | 562 float x, |
| 560 float y, | 563 float y, |
| 561 FPDF_BYTESTRING bsText) { | 564 FPDF_BYTESTRING bsText) { |
| 562 if (NULL == hWidget || NULL == document) | 565 if (NULL == hWidget || NULL == document) |
| 563 return; | 566 return; |
| 564 | 567 |
| 565 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 568 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; |
| 566 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 569 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 567 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 570 pDocument->GetDocType() != XFA_DOCTYPE_Static) |
| 568 return; | 571 return; |
| 569 | 572 |
| 570 IXFA_MenuHandler* pXFAMenuHander = | 573 CXFA_FFMenuHandler* pXFAMenuHander = |
| 571 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); | 574 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); |
| 572 if (pXFAMenuHander == NULL) | 575 if (pXFAMenuHander == NULL) |
| 573 return; | 576 return; |
| 574 | 577 |
| 575 CFX_PointF ptPopup; | 578 CFX_PointF ptPopup; |
| 576 ptPopup.x = x; | 579 ptPopup.x = x; |
| 577 ptPopup.y = y; | 580 ptPopup.y = y; |
| 578 CFX_ByteStringC bs(bsText); | 581 CFX_ByteStringC bs(bsText); |
| 579 pXFAMenuHander->ReplaceSpellCheckWord((IXFA_Widget*)hWidget, ptPopup, bs); | 582 pXFAMenuHander->ReplaceSpellCheckWord( |
| 583 reinterpret_cast<CXFA_FFWidget*>(hWidget), ptPopup, bs); |
| 580 } | 584 } |
| 581 | 585 |
| 582 DLLEXPORT void STDCALL | 586 DLLEXPORT void STDCALL |
| 583 FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, | 587 FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, |
| 584 FPDF_WIDGET hWidget, | 588 FPDF_WIDGET hWidget, |
| 585 float x, | 589 float x, |
| 586 float y, | 590 float y, |
| 587 FPDF_STRINGHANDLE* stringHandle) { | 591 FPDF_STRINGHANDLE* stringHandle) { |
| 588 if (!hWidget || !document) | 592 if (!hWidget || !document) |
| 589 return; | 593 return; |
| 590 | 594 |
| 591 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 595 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; |
| 592 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 596 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 593 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 597 pDocument->GetDocType() != XFA_DOCTYPE_Static) |
| 594 return; | 598 return; |
| 595 | 599 |
| 596 IXFA_MenuHandler* pXFAMenuHander = | 600 CXFA_FFMenuHandler* pXFAMenuHander = |
| 597 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); | 601 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); |
| 598 if (!pXFAMenuHander) | 602 if (!pXFAMenuHander) |
| 599 return; | 603 return; |
| 600 | 604 |
| 601 std::vector<CFX_ByteString>* sSuggestWords = new std::vector<CFX_ByteString>; | 605 std::vector<CFX_ByteString>* sSuggestWords = new std::vector<CFX_ByteString>; |
| 602 CFX_PointF ptPopup; | 606 CFX_PointF ptPopup; |
| 603 ptPopup.x = x; | 607 ptPopup.x = x; |
| 604 ptPopup.y = y; | 608 ptPopup.y = y; |
| 605 pXFAMenuHander->GetSuggestWords(reinterpret_cast<IXFA_Widget*>(hWidget), | 609 pXFAMenuHander->GetSuggestWords(reinterpret_cast<CXFA_FFWidget*>(hWidget), |
| 606 ptPopup, *sSuggestWords); | 610 ptPopup, *sSuggestWords); |
| 607 *stringHandle = ToFPDFStringHandle(sSuggestWords); | 611 *stringHandle = ToFPDFStringHandle(sSuggestWords); |
| 608 } | 612 } |
| 609 | 613 |
| 610 DLLEXPORT int STDCALL FPDF_StringHandleCounts(FPDF_STRINGHANDLE sHandle) { | 614 DLLEXPORT int STDCALL FPDF_StringHandleCounts(FPDF_STRINGHANDLE sHandle) { |
| 611 std::vector<CFX_ByteString>* sSuggestWords = FromFPDFStringHandle(sHandle); | 615 std::vector<CFX_ByteString>* sSuggestWords = FromFPDFStringHandle(sHandle); |
| 612 return sSuggestWords ? pdfium::CollectionSize<int>(*sSuggestWords) : -1; | 616 return sSuggestWords ? pdfium::CollectionSize<int>(*sSuggestWords) : -1; |
| 613 } | 617 } |
| 614 | 618 |
| 615 DLLEXPORT FPDF_BOOL STDCALL | 619 DLLEXPORT FPDF_BOOL STDCALL |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); | 759 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); |
| 756 } | 760 } |
| 757 } else { | 761 } else { |
| 758 if (aa.ActionExist(CPDF_AAction::ClosePage)) { | 762 if (aa.ActionExist(CPDF_AAction::ClosePage)) { |
| 759 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); | 763 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); |
| 760 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); | 764 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); |
| 761 } | 765 } |
| 762 } | 766 } |
| 763 } | 767 } |
| 764 } | 768 } |
| OLD | NEW |