| 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/page/cpdf_page.h" | 12 #include "core/fpdfapi/page/cpdf_page.h" |
| 13 #include "core/fpdfapi/parser/cpdf_document.h" | 13 #include "core/fpdfapi/parser/cpdf_document.h" |
| 14 #include "core/fpdfapi/render/cpdf_renderoptions.h" | 14 #include "core/fpdfapi/render/cpdf_renderoptions.h" |
| 15 #include "core/fpdfdoc/cpdf_formcontrol.h" | 15 #include "core/fpdfdoc/cpdf_formcontrol.h" |
| 16 #include "core/fpdfdoc/cpdf_formfield.h" | 16 #include "core/fpdfdoc/cpdf_formfield.h" |
| 17 #include "core/fpdfdoc/cpdf_interform.h" | 17 #include "core/fpdfdoc/cpdf_interform.h" |
| 18 #include "core/fpdfdoc/cpdf_occontext.h" | 18 #include "core/fpdfdoc/cpdf_occontext.h" |
| 19 #include "core/fxge/cfx_fxgedevice.h" | 19 #include "core/fxge/cfx_fxgedevice.h" |
| 20 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" | 20 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" |
| 21 #include "fpdfsdk/cpdfsdk_interform.h" | 21 #include "fpdfsdk/cpdfsdk_interform.h" |
| 22 #include "fpdfsdk/cpdfsdk_pageview.h" | 22 #include "fpdfsdk/cpdfsdk_pageview.h" |
| 23 #include "fpdfsdk/fsdk_actionhandler.h" | 23 #include "fpdfsdk/fsdk_actionhandler.h" |
| 24 #include "fpdfsdk/fsdk_define.h" | 24 #include "fpdfsdk/fsdk_define.h" |
| 25 #include "public/fpdfview.h" | 25 #include "public/fpdfview.h" |
| 26 #include "third_party/base/ptr_util.h" | 26 #include "third_party/base/ptr_util.h" |
| 27 #include "third_party/base/stl_util.h" | 27 #include "third_party/base/stl_util.h" |
| 28 | 28 |
| 29 #ifdef PDF_ENABLE_XFA | 29 #ifdef PDF_ENABLE_XFA |
| 30 #include "fpdfsdk/fpdfxfa/cpdfxfa_document.h" | 30 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" |
| 31 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h" | 31 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h" |
| 32 #include "xfa/fxfa/xfa_ffdocview.h" | 32 #include "xfa/fxfa/xfa_ffdocview.h" |
| 33 #include "xfa/fxfa/xfa_ffpageview.h" | 33 #include "xfa/fxfa/xfa_ffpageview.h" |
| 34 #include "xfa/fxfa/xfa_ffwidget.h" | 34 #include "xfa/fxfa/xfa_ffwidget.h" |
| 35 #endif // PDF_ENABLE_XFA | 35 #endif // PDF_ENABLE_XFA |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 CPDFSDK_FormFillEnvironment* HandleToCPDFSDKEnvironment( | 39 CPDFSDK_FormFillEnvironment* HandleToCPDFSDKEnvironment( |
| 40 FPDF_FORMHANDLE handle) { | 40 FPDF_FORMHANDLE handle) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 int rotate, | 79 int rotate, |
| 80 int flags) { | 80 int flags) { |
| 81 if (!hHandle) | 81 if (!hHandle) |
| 82 return; | 82 return; |
| 83 | 83 |
| 84 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); | 84 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); |
| 85 if (!pPage) | 85 if (!pPage) |
| 86 return; | 86 return; |
| 87 | 87 |
| 88 #ifdef PDF_ENABLE_XFA | 88 #ifdef PDF_ENABLE_XFA |
| 89 CPDFXFA_Document* pDocument = pPage->GetDocument(); | 89 CPDFXFA_Context* pContext = pPage->GetContext(); |
| 90 if (!pDocument) | 90 if (!pContext) |
| 91 return; | 91 return; |
| 92 CPDF_Document* pPDFDoc = pDocument->GetPDFDoc(); | 92 CPDF_Document* pPDFDoc = pContext->GetPDFDoc(); |
| 93 if (!pPDFDoc) | 93 if (!pPDFDoc) |
| 94 return; | 94 return; |
| 95 CPDFSDK_FormFillEnvironment* pFormFillEnv = | 95 CPDFSDK_FormFillEnvironment* pFormFillEnv = |
| 96 HandleToCPDFSDKEnvironment(hHandle); | 96 HandleToCPDFSDKEnvironment(hHandle); |
| 97 if (!pFormFillEnv) | 97 if (!pFormFillEnv) |
| 98 return; | 98 return; |
| 99 #endif // PDF_ENABLE_XFA | 99 #endif // PDF_ENABLE_XFA |
| 100 | 100 |
| 101 CFX_Matrix matrix; | 101 CFX_Matrix matrix; |
| 102 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); | 102 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 const int kRequiredVersion = 1; | 238 const int kRequiredVersion = 1; |
| 239 #endif // PDF_ENABLE_XFA | 239 #endif // PDF_ENABLE_XFA |
| 240 if (!formInfo || formInfo->version != kRequiredVersion) | 240 if (!formInfo || formInfo->version != kRequiredVersion) |
| 241 return nullptr; | 241 return nullptr; |
| 242 | 242 |
| 243 UnderlyingDocumentType* pDocument = UnderlyingFromFPDFDocument(document); | 243 UnderlyingDocumentType* pDocument = UnderlyingFromFPDFDocument(document); |
| 244 if (!pDocument) | 244 if (!pDocument) |
| 245 return nullptr; | 245 return nullptr; |
| 246 | 246 |
| 247 #ifdef PDF_ENABLE_XFA | 247 #ifdef PDF_ENABLE_XFA |
| 248 // If the CPDFXFA_Document has a FormFillEnvironment already then we've done | 248 // If the CPDFXFA_Context has a FormFillEnvironment already then we've done |
| 249 // this and can just return the old Env. Otherwise, we'll end up setting a new | 249 // this and can just return the old Env. Otherwise, we'll end up setting a new |
| 250 // environment into the XFADocument and, that could get weird. | 250 // environment into the XFADocument and, that could get weird. |
| 251 if (pDocument->GetFormFillEnv()) | 251 if (pDocument->GetFormFillEnv()) |
| 252 return pDocument->GetFormFillEnv(); | 252 return pDocument->GetFormFillEnv(); |
| 253 #endif | 253 #endif |
| 254 | 254 |
| 255 CPDFSDK_FormFillEnvironment* pFormFillEnv = | 255 CPDFSDK_FormFillEnvironment* pFormFillEnv = |
| 256 new CPDFSDK_FormFillEnvironment(pDocument, formInfo); | 256 new CPDFSDK_FormFillEnvironment(pDocument, formInfo); |
| 257 | 257 |
| 258 #ifdef PDF_ENABLE_XFA | 258 #ifdef PDF_ENABLE_XFA |
| (...skipping 10 matching lines...) Expand all Loading... |
| 269 | 269 |
| 270 CPDFSDK_FormFillEnvironment* pFormFillEnv = | 270 CPDFSDK_FormFillEnvironment* pFormFillEnv = |
| 271 HandleToCPDFSDKEnvironment(hHandle); | 271 HandleToCPDFSDKEnvironment(hHandle); |
| 272 | 272 |
| 273 #ifdef PDF_ENABLE_XFA | 273 #ifdef PDF_ENABLE_XFA |
| 274 // Reset the focused annotations and remove the SDK document from the | 274 // Reset the focused annotations and remove the SDK document from the |
| 275 // XFA document. | 275 // XFA document. |
| 276 pFormFillEnv->ClearAllFocusedAnnots(); | 276 pFormFillEnv->ClearAllFocusedAnnots(); |
| 277 // If the document was closed first, it's possible the XFA document | 277 // If the document was closed first, it's possible the XFA document |
| 278 // is now a nullptr. | 278 // is now a nullptr. |
| 279 if (pFormFillEnv->GetXFADocument()) | 279 if (pFormFillEnv->GetXFAContext()) |
| 280 pFormFillEnv->GetXFADocument()->SetFormFillEnv(nullptr); | 280 pFormFillEnv->GetXFAContext()->SetFormFillEnv(nullptr); |
| 281 #endif // PDF_ENABLE_XFA | 281 #endif // PDF_ENABLE_XFA |
| 282 | 282 |
| 283 delete pFormFillEnv; | 283 delete pFormFillEnv; |
| 284 } | 284 } |
| 285 | 285 |
| 286 DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, | 286 DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, |
| 287 FPDF_PAGE page, | 287 FPDF_PAGE page, |
| 288 int modifier, | 288 int modifier, |
| 289 double page_x, | 289 double page_x, |
| 290 double page_y) { | 290 double page_y) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 rotate, flags); | 418 rotate, flags); |
| 419 } | 419 } |
| 420 #endif | 420 #endif |
| 421 | 421 |
| 422 #ifdef PDF_ENABLE_XFA | 422 #ifdef PDF_ENABLE_XFA |
| 423 DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, | 423 DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, |
| 424 FPDF_WIDGET hWidget) { | 424 FPDF_WIDGET hWidget) { |
| 425 if (!hWidget || !document) | 425 if (!hWidget || !document) |
| 426 return; | 426 return; |
| 427 | 427 |
| 428 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 428 CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document); |
| 429 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 429 if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 430 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 430 pContext->GetDocType() != XFA_DOCTYPE_Static) |
| 431 return; | 431 return; |
| 432 | 432 |
| 433 static_cast<CXFA_FFWidget*>(hWidget)->Undo(); | 433 static_cast<CXFA_FFWidget*>(hWidget)->Undo(); |
| 434 } | 434 } |
| 435 |
| 435 DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document, | 436 DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document, |
| 436 FPDF_WIDGET hWidget) { | 437 FPDF_WIDGET hWidget) { |
| 437 if (!hWidget || !document) | 438 if (!hWidget || !document) |
| 438 return; | 439 return; |
| 439 | 440 |
| 440 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 441 CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document); |
| 441 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 442 if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 442 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 443 pContext->GetDocType() != XFA_DOCTYPE_Static) |
| 443 return; | 444 return; |
| 444 | 445 |
| 445 static_cast<CXFA_FFWidget*>(hWidget)->Redo(); | 446 static_cast<CXFA_FFWidget*>(hWidget)->Redo(); |
| 446 } | 447 } |
| 447 | 448 |
| 448 DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document, | 449 DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document, |
| 449 FPDF_WIDGET hWidget) { | 450 FPDF_WIDGET hWidget) { |
| 450 if (!hWidget || !document) | 451 if (!hWidget || !document) |
| 451 return; | 452 return; |
| 452 | 453 |
| 453 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 454 CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document); |
| 454 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 455 if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 455 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 456 pContext->GetDocType() != XFA_DOCTYPE_Static) |
| 456 return; | 457 return; |
| 457 | 458 |
| 458 static_cast<CXFA_FFWidget*>(hWidget)->SelectAll(); | 459 static_cast<CXFA_FFWidget*>(hWidget)->SelectAll(); |
| 459 } | 460 } |
| 461 |
| 460 DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document, | 462 DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document, |
| 461 FPDF_WIDGET hWidget, | 463 FPDF_WIDGET hWidget, |
| 462 FPDF_WIDESTRING wsText, | 464 FPDF_WIDESTRING wsText, |
| 463 FPDF_DWORD* size) { | 465 FPDF_DWORD* size) { |
| 464 if (!hWidget || !document) | 466 if (!hWidget || !document) |
| 465 return; | 467 return; |
| 466 | 468 |
| 467 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 469 CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document); |
| 468 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 470 if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 469 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 471 pContext->GetDocType() != XFA_DOCTYPE_Static) |
| 470 return; | 472 return; |
| 471 | 473 |
| 472 CFX_WideString wsCpText; | 474 CFX_WideString wsCpText; |
| 473 static_cast<CXFA_FFWidget*>(hWidget)->Copy(wsCpText); | 475 static_cast<CXFA_FFWidget*>(hWidget)->Copy(wsCpText); |
| 474 | 476 |
| 475 CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode(); | 477 CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode(); |
| 476 uint32_t len = bsCpText.GetLength() / sizeof(unsigned short); | 478 uint32_t len = bsCpText.GetLength() / sizeof(unsigned short); |
| 477 if (!wsText) { | 479 if (!wsText) { |
| 478 *size = len; | 480 *size = len; |
| 479 return; | 481 return; |
| 480 } | 482 } |
| 481 | 483 |
| 482 uint32_t real_size = len < *size ? len : *size; | 484 uint32_t real_size = len < *size ? len : *size; |
| 483 if (real_size > 0) { | 485 if (real_size > 0) { |
| 484 FXSYS_memcpy((void*)wsText, | 486 FXSYS_memcpy((void*)wsText, |
| 485 bsCpText.GetBuffer(real_size * sizeof(unsigned short)), | 487 bsCpText.GetBuffer(real_size * sizeof(unsigned short)), |
| 486 real_size * sizeof(unsigned short)); | 488 real_size * sizeof(unsigned short)); |
| 487 bsCpText.ReleaseBuffer(real_size * sizeof(unsigned short)); | 489 bsCpText.ReleaseBuffer(real_size * sizeof(unsigned short)); |
| 488 } | 490 } |
| 489 *size = real_size; | 491 *size = real_size; |
| 490 } | 492 } |
| 491 | 493 |
| 492 DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document, | 494 DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document, |
| 493 FPDF_WIDGET hWidget, | 495 FPDF_WIDGET hWidget, |
| 494 FPDF_WIDESTRING wsText, | 496 FPDF_WIDESTRING wsText, |
| 495 FPDF_DWORD* size) { | 497 FPDF_DWORD* size) { |
| 496 if (!hWidget || !document) | 498 if (!hWidget || !document) |
| 497 return; | 499 return; |
| 498 | 500 |
| 499 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 501 CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document); |
| 500 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 502 if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 501 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 503 pContext->GetDocType() != XFA_DOCTYPE_Static) |
| 502 return; | 504 return; |
| 503 | 505 |
| 504 CFX_WideString wsCpText; | 506 CFX_WideString wsCpText; |
| 505 static_cast<CXFA_FFWidget*>(hWidget)->Cut(wsCpText); | 507 static_cast<CXFA_FFWidget*>(hWidget)->Cut(wsCpText); |
| 506 | 508 |
| 507 CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode(); | 509 CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode(); |
| 508 uint32_t len = bsCpText.GetLength() / sizeof(unsigned short); | 510 uint32_t len = bsCpText.GetLength() / sizeof(unsigned short); |
| 509 if (!wsText) { | 511 if (!wsText) { |
| 510 *size = len; | 512 *size = len; |
| 511 return; | 513 return; |
| 512 } | 514 } |
| 513 | 515 |
| 514 uint32_t real_size = len < *size ? len : *size; | 516 uint32_t real_size = len < *size ? len : *size; |
| 515 if (real_size > 0) { | 517 if (real_size > 0) { |
| 516 FXSYS_memcpy((void*)wsText, | 518 FXSYS_memcpy((void*)wsText, |
| 517 bsCpText.GetBuffer(real_size * sizeof(unsigned short)), | 519 bsCpText.GetBuffer(real_size * sizeof(unsigned short)), |
| 518 real_size * sizeof(unsigned short)); | 520 real_size * sizeof(unsigned short)); |
| 519 bsCpText.ReleaseBuffer(real_size * sizeof(unsigned short)); | 521 bsCpText.ReleaseBuffer(real_size * sizeof(unsigned short)); |
| 520 } | 522 } |
| 521 *size = real_size; | 523 *size = real_size; |
| 522 } | 524 } |
| 523 | 525 |
| 524 DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document, | 526 DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document, |
| 525 FPDF_WIDGET hWidget, | 527 FPDF_WIDGET hWidget, |
| 526 FPDF_WIDESTRING wsText, | 528 FPDF_WIDESTRING wsText, |
| 527 FPDF_DWORD size) { | 529 FPDF_DWORD size) { |
| 528 if (!hWidget || !document) | 530 if (!hWidget || !document) |
| 529 return; | 531 return; |
| 530 | 532 |
| 531 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 533 CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document); |
| 532 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 534 if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 533 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 535 pContext->GetDocType() != XFA_DOCTYPE_Static) |
| 534 return; | 536 return; |
| 535 | 537 |
| 536 CFX_WideString wstr = CFX_WideString::FromUTF16LE(wsText, size); | 538 CFX_WideString wstr = CFX_WideString::FromUTF16LE(wsText, size); |
| 537 static_cast<CXFA_FFWidget*>(hWidget)->Paste(wstr); | 539 static_cast<CXFA_FFWidget*>(hWidget)->Paste(wstr); |
| 538 } | 540 } |
| 539 | 541 |
| 540 DLLEXPORT void STDCALL | 542 DLLEXPORT void STDCALL |
| 541 FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document, | 543 FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document, |
| 542 FPDF_WIDGET hWidget, | 544 FPDF_WIDGET hWidget, |
| 543 float x, | 545 float x, |
| 544 float y, | 546 float y, |
| 545 FPDF_BYTESTRING bsText) { | 547 FPDF_BYTESTRING bsText) { |
| 546 if (!hWidget || !document) | 548 if (!hWidget || !document) |
| 547 return; | 549 return; |
| 548 | 550 |
| 549 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 551 CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document); |
| 550 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 552 if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 551 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 553 pContext->GetDocType() != XFA_DOCTYPE_Static) |
| 552 return; | 554 return; |
| 553 | 555 |
| 554 CFX_PointF ptPopup; | 556 CFX_PointF ptPopup; |
| 555 ptPopup.x = x; | 557 ptPopup.x = x; |
| 556 ptPopup.y = y; | 558 ptPopup.y = y; |
| 557 CFX_ByteStringC bs(bsText); | 559 CFX_ByteStringC bs(bsText); |
| 558 static_cast<CXFA_FFWidget*>(hWidget)->ReplaceSpellCheckWord(ptPopup, bs); | 560 static_cast<CXFA_FFWidget*>(hWidget)->ReplaceSpellCheckWord(ptPopup, bs); |
| 559 } | 561 } |
| 560 | 562 |
| 561 DLLEXPORT void STDCALL | 563 DLLEXPORT void STDCALL |
| 562 FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, | 564 FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, |
| 563 FPDF_WIDGET hWidget, | 565 FPDF_WIDGET hWidget, |
| 564 float x, | 566 float x, |
| 565 float y, | 567 float y, |
| 566 FPDF_STRINGHANDLE* stringHandle) { | 568 FPDF_STRINGHANDLE* stringHandle) { |
| 567 if (!hWidget || !document) | 569 if (!hWidget || !document) |
| 568 return; | 570 return; |
| 569 | 571 |
| 570 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; | 572 CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document); |
| 571 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && | 573 if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic && |
| 572 pDocument->GetDocType() != XFA_DOCTYPE_Static) | 574 pContext->GetDocType() != XFA_DOCTYPE_Static) |
| 573 return; | 575 return; |
| 574 | 576 |
| 575 std::vector<CFX_ByteString>* sSuggestWords = new std::vector<CFX_ByteString>; | 577 std::vector<CFX_ByteString>* sSuggestWords = new std::vector<CFX_ByteString>; |
| 576 CFX_PointF ptPopup; | 578 CFX_PointF ptPopup; |
| 577 ptPopup.x = x; | 579 ptPopup.x = x; |
| 578 ptPopup.y = y; | 580 ptPopup.y = y; |
| 579 static_cast<CXFA_FFWidget*>(hWidget) | 581 static_cast<CXFA_FFWidget*>(hWidget) |
| 580 ->GetSuggestWords(ptPopup, *sSuggestWords); | 582 ->GetSuggestWords(ptPopup, *sSuggestWords); |
| 581 *stringHandle = ToFPDFStringHandle(sSuggestWords); | 583 *stringHandle = ToFPDFStringHandle(sSuggestWords); |
| 582 } | 584 } |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 pFormFillEnv); | 742 pFormFillEnv); |
| 741 } | 743 } |
| 742 } else { | 744 } else { |
| 743 if (aa.ActionExist(CPDF_AAction::ClosePage)) { | 745 if (aa.ActionExist(CPDF_AAction::ClosePage)) { |
| 744 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); | 746 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); |
| 745 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, | 747 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, |
| 746 pFormFillEnv); | 748 pFormFillEnv); |
| 747 } | 749 } |
| 748 } | 750 } |
| 749 } | 751 } |
| OLD | NEW |