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

Side by Side Diff: fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp

Issue 1477583002: Inflict PDF_ENABLE_XFA ifdefs on XFA fpdfsdk/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years 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
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/pdfwindow/PDFWindow.h" 7 #include "fpdfsdk/include/pdfwindow/PDFWindow.h"
8 #include "fpdfsdk/include/pdfwindow/PWL_ComboBox.h" 8 #include "fpdfsdk/include/pdfwindow/PWL_ComboBox.h"
9 #include "fpdfsdk/include/pdfwindow/PWL_Edit.h" 9 #include "fpdfsdk/include/pdfwindow/PWL_Edit.h"
10 #include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h" 10 #include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h"
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 if (!m_pList) 464 if (!m_pList)
465 return; 465 return;
466 if (bPopup == m_bPopup) 466 if (bPopup == m_bPopup)
467 return; 467 return;
468 FX_FLOAT fListHeight = m_pList->GetContentRect().Height(); 468 FX_FLOAT fListHeight = m_pList->GetContentRect().Height();
469 if (!IsFloatBigger(fListHeight, 0.0f)) 469 if (!IsFloatBigger(fListHeight, 0.0f))
470 return; 470 return;
471 471
472 if (bPopup) { 472 if (bPopup) {
473 if (m_pFillerNotify) { 473 if (m_pFillerNotify) {
474 #ifdef PDF_ENABLE_XFA
474 FX_BOOL bExit = FALSE; 475 FX_BOOL bExit = FALSE;
475 m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, 0); 476 m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, 0);
476 if (bExit) 477 if (bExit)
477 return; 478 return;
478 479
480 #endif
479 int32_t nWhere = 0; 481 int32_t nWhere = 0;
480 FX_FLOAT fPopupRet = 0.0f; 482 FX_FLOAT fPopupRet = 0.0f;
481 FX_FLOAT fPopupMin = 0.0f; 483 FX_FLOAT fPopupMin = 0.0f;
482 if (m_pList->GetCount() > 3) 484 if (m_pList->GetCount() > 3)
483 fPopupMin = 485 fPopupMin =
484 m_pList->GetFirstHeight() * 3 + m_pList->GetBorderWidth() * 2; 486 m_pList->GetFirstHeight() * 3 + m_pList->GetBorderWidth() * 2;
485 FX_FLOAT fPopupMax = fListHeight + m_pList->GetBorderWidth() * 2; 487 FX_FLOAT fPopupMax = fListHeight + m_pList->GetBorderWidth() * 2;
486 m_pFillerNotify->QueryWherePopup(GetAttachedData(), fPopupMin, fPopupMax, 488 m_pFillerNotify->QueryWherePopup(GetAttachedData(), fPopupMin, fPopupMax,
487 nWhere, fPopupRet); 489 nWhere, fPopupRet);
488 490
489 if (IsFloatBigger(fPopupRet, 0.0f)) { 491 if (IsFloatBigger(fPopupRet, 0.0f)) {
490 m_bPopup = bPopup; 492 m_bPopup = bPopup;
491 493
492 CPDF_Rect rcWindow = CPWL_Wnd::GetWindowRect(); 494 CPDF_Rect rcWindow = CPWL_Wnd::GetWindowRect();
493 m_rcOldWindow = rcWindow; 495 m_rcOldWindow = rcWindow;
494 switch (nWhere) { 496 switch (nWhere) {
495 default: 497 default:
496 case 0: 498 case 0:
497 rcWindow.bottom -= fPopupRet; 499 rcWindow.bottom -= fPopupRet;
498 break; 500 break;
499 case 1: 501 case 1:
500 rcWindow.top += fPopupRet; 502 rcWindow.top += fPopupRet;
501 break; 503 break;
502 } 504 }
503 505
504 m_nPopupWhere = nWhere; 506 m_nPopupWhere = nWhere;
505 Move(rcWindow, TRUE, TRUE); 507 Move(rcWindow, TRUE, TRUE);
508 #ifdef PDF_ENABLE_XFA
506 509
507 bExit = FALSE; 510 bExit = FALSE;
508 m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, 0); 511 m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, 0);
509 if (bExit) 512 if (bExit)
510 return; 513 return;
514 #endif
511 } 515 }
512 } 516 }
513 } else { 517 } else {
514 m_bPopup = bPopup; 518 m_bPopup = bPopup;
515 Move(m_rcOldWindow, TRUE, TRUE); 519 Move(m_rcOldWindow, TRUE, TRUE);
516 } 520 }
517 } 521 }
518 522
519 FX_BOOL CPWL_ComboBox::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) { 523 FX_BOOL CPWL_ComboBox::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) {
520 if (!m_pList) 524 if (!m_pList)
521 return FALSE; 525 return FALSE;
522 if (!m_pEdit) 526 if (!m_pEdit)
523 return FALSE; 527 return FALSE;
524 528
525 m_nSelectItem = -1; 529 m_nSelectItem = -1;
526 530
527 switch (nChar) { 531 switch (nChar) {
528 case FWL_VKEY_Up: 532 case FWL_VKEY_Up:
529 if (m_pList->GetCurSel() > 0) { 533 if (m_pList->GetCurSel() > 0) {
530 FX_BOOL bExit = FALSE; 534 FX_BOOL bExit = FALSE;
535 #ifdef PDF_ENABLE_XFA
531 536
532 if (m_pFillerNotify) { 537 if (m_pFillerNotify) {
533 m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, nFlag); 538 m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, nFlag);
534 if (bExit) 539 if (bExit)
535 return FALSE; 540 return FALSE;
536 bExit = FALSE; 541 bExit = FALSE;
537 m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, nFlag); 542 m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, nFlag);
538 if (bExit) 543 if (bExit)
539 return FALSE; 544 return FALSE;
540 } 545 }
546 #endif
541 if (m_pList->OnKeyDownWithExit(nChar, bExit, nFlag)) { 547 if (m_pList->OnKeyDownWithExit(nChar, bExit, nFlag)) {
542 if (bExit) 548 if (bExit)
543 return FALSE; 549 return FALSE;
544 SetSelectText(); 550 SetSelectText();
545 } 551 }
546 } 552 }
547 return TRUE; 553 return TRUE;
548 case FWL_VKEY_Down: 554 case FWL_VKEY_Down:
549 if (m_pList->GetCurSel() < m_pList->GetCount() - 1) { 555 if (m_pList->GetCurSel() < m_pList->GetCount() - 1) {
550 FX_BOOL bExit = FALSE; 556 FX_BOOL bExit = FALSE;
557 #ifdef PDF_ENABLE_XFA
551 558
552 if (m_pFillerNotify) { 559 if (m_pFillerNotify) {
553 m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, nFlag); 560 m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, nFlag);
554 if (bExit) 561 if (bExit)
555 return FALSE; 562 return FALSE;
556 bExit = FALSE; 563 bExit = FALSE;
557 m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, nFlag); 564 m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, nFlag);
558 if (bExit) 565 if (bExit)
559 return FALSE; 566 return FALSE;
560 } 567 }
568 #endif
561 if (m_pList->OnKeyDownWithExit(nChar, bExit, nFlag)) { 569 if (m_pList->OnKeyDownWithExit(nChar, bExit, nFlag)) {
562 if (bExit) 570 if (bExit)
563 return FALSE; 571 return FALSE;
564 SetSelectText(); 572 SetSelectText();
565 } 573 }
566 } 574 }
567 return TRUE; 575 return TRUE;
568 } 576 }
569 577
570 if (HasFlag(PCBS_ALLOWCUSTOMTEXT)) 578 if (HasFlag(PCBS_ALLOWCUSTOMTEXT))
571 return m_pEdit->OnKeyDown(nChar, nFlag); 579 return m_pEdit->OnKeyDown(nChar, nFlag);
572 580
573 return FALSE; 581 return FALSE;
574 } 582 }
575 583
576 FX_BOOL CPWL_ComboBox::OnChar(FX_WORD nChar, FX_DWORD nFlag) { 584 FX_BOOL CPWL_ComboBox::OnChar(FX_WORD nChar, FX_DWORD nFlag) {
577 if (!m_pList) 585 if (!m_pList)
578 return FALSE; 586 return FALSE;
579 587
580 if (!m_pEdit) 588 if (!m_pEdit)
581 return FALSE; 589 return FALSE;
582 590
583 m_nSelectItem = -1; 591 m_nSelectItem = -1;
584 if (HasFlag(PCBS_ALLOWCUSTOMTEXT)) 592 if (HasFlag(PCBS_ALLOWCUSTOMTEXT))
585 return m_pEdit->OnChar(nChar, nFlag); 593 return m_pEdit->OnChar(nChar, nFlag);
586 594
587 FX_BOOL bExit = FALSE; 595 FX_BOOL bExit = FALSE;
596 #ifdef PDF_ENABLE_XFA
588 if (m_pFillerNotify) { 597 if (m_pFillerNotify) {
589 m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, nFlag); 598 m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), bExit, nFlag);
590 if (bExit) 599 if (bExit)
591 return FALSE; 600 return FALSE;
592 601
593 m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, nFlag); 602 m_pFillerNotify->OnPopupPostOpen(GetAttachedData(), bExit, nFlag);
594 if (bExit) 603 if (bExit)
595 return FALSE; 604 return FALSE;
596 } 605 }
606 #endif
597 return m_pList->OnCharWithExit(nChar, bExit, nFlag) ? bExit : FALSE; 607 return m_pList->OnCharWithExit(nChar, bExit, nFlag) ? bExit : FALSE;
598 } 608 }
599 609
600 void CPWL_ComboBox::OnNotify(CPWL_Wnd* pWnd, 610 void CPWL_ComboBox::OnNotify(CPWL_Wnd* pWnd,
601 FX_DWORD msg, 611 FX_DWORD msg,
602 intptr_t wParam, 612 intptr_t wParam,
603 intptr_t lParam) { 613 intptr_t lParam) {
604 switch (msg) { 614 switch (msg) {
605 case PNM_LBUTTONDOWN: 615 case PNM_LBUTTONDOWN:
606 if (pWnd == m_pButton) { 616 if (pWnd == m_pButton) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 652
643 void CPWL_ComboBox::SetFillerNotify(IPWL_Filler_Notify* pNotify) { 653 void CPWL_ComboBox::SetFillerNotify(IPWL_Filler_Notify* pNotify) {
644 m_pFillerNotify = pNotify; 654 m_pFillerNotify = pNotify;
645 655
646 if (m_pEdit) 656 if (m_pEdit)
647 m_pEdit->SetFillerNotify(pNotify); 657 m_pEdit->SetFillerNotify(pNotify);
648 658
649 if (m_pList) 659 if (m_pList)
650 m_pList->SetFillerNotify(pNotify); 660 m_pList->SetFillerNotify(pNotify);
651 } 661 }
OLDNEW
« fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp ('K') | « fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698