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

Side by Side Diff: fpdfsdk/fsdk_mgr.cpp

Issue 2287703002: Rename CPDFSDK_Annot::GetType to CPDFSDK_Annot::GetAnnotSubtype. (Closed)
Patch Set: Rename CPDFSDK_Annot::GetType to CPDFSDK_Annot::GetAnnotSubtype. Created 4 years, 3 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 | « fpdfsdk/fsdk_baseform_embeddertest.cpp ('k') | fpdfsdk/include/cba_annotiterator.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_mgr.h" 7 #include "fpdfsdk/include/fsdk_mgr.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 CPDFSDK_AnnotHandlerMgr* pAnnotHandler = m_pEnv->GetAnnotHandlerMgr(); 435 CPDFSDK_AnnotHandlerMgr* pAnnotHandler = m_pEnv->GetAnnotHandlerMgr();
436 CPDFSDK_Annot* pFocusAnnot = m_pFocusAnnot; 436 CPDFSDK_Annot* pFocusAnnot = m_pFocusAnnot;
437 m_pFocusAnnot = nullptr; 437 m_pFocusAnnot = nullptr;
438 438
439 #ifdef PDF_ENABLE_XFA 439 #ifdef PDF_ENABLE_XFA
440 if (!pAnnotHandler->Annot_OnChangeFocus(nullptr, pFocusAnnot)) 440 if (!pAnnotHandler->Annot_OnChangeFocus(nullptr, pFocusAnnot))
441 return FALSE; 441 return FALSE;
442 #endif // PDF_ENABLE_XFA 442 #endif // PDF_ENABLE_XFA
443 443
444 if (pAnnotHandler->Annot_OnKillFocus(pFocusAnnot, nFlag)) { 444 if (pAnnotHandler->Annot_OnKillFocus(pFocusAnnot, nFlag)) {
445 if (pFocusAnnot->GetType() == "Widget") { 445 if (pFocusAnnot->GetAnnotSubtype() == "Widget") {
446 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pFocusAnnot; 446 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pFocusAnnot;
447 int nFieldType = pWidget->GetFieldType(); 447 int nFieldType = pWidget->GetFieldType();
448 if (FIELDTYPE_TEXTFIELD == nFieldType || 448 if (FIELDTYPE_TEXTFIELD == nFieldType ||
449 FIELDTYPE_COMBOBOX == nFieldType) { 449 FIELDTYPE_COMBOBOX == nFieldType) {
450 m_pEnv->FFI_OnSetFieldInputFocus(nullptr, nullptr, 0, FALSE); 450 m_pEnv->FFI_OnSetFieldInputFocus(nullptr, nullptr, 0, FALSE);
451 } 451 }
452 } 452 }
453 453
454 if (!m_pFocusAnnot) 454 if (!m_pFocusAnnot)
455 return TRUE; 455 return TRUE;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 CFX_FloatRect annotRect = pAnnot->GetRect(); 579 CFX_FloatRect annotRect = pAnnot->GetRect();
580 if (annotRect.Contains(pageX, pageY)) 580 if (annotRect.Contains(pageX, pageY))
581 return pAnnot.get(); 581 return pAnnot.get();
582 } 582 }
583 return nullptr; 583 return nullptr;
584 } 584 }
585 585
586 const CPDF_Annot* CPDFSDK_PageView::GetPDFWidgetAtPoint(FX_FLOAT pageX, 586 const CPDF_Annot* CPDFSDK_PageView::GetPDFWidgetAtPoint(FX_FLOAT pageX,
587 FX_FLOAT pageY) { 587 FX_FLOAT pageY) {
588 for (const auto& pAnnot : m_pAnnotList->All()) { 588 for (const auto& pAnnot : m_pAnnotList->All()) {
589 if (pAnnot->GetSubType() == "Widget") { 589 if (pAnnot->GetSubtype() == "Widget") {
590 CFX_FloatRect annotRect = pAnnot->GetRect(); 590 CFX_FloatRect annotRect = pAnnot->GetRect();
591 if (annotRect.Contains(pageX, pageY)) 591 if (annotRect.Contains(pageX, pageY))
592 return pAnnot.get(); 592 return pAnnot.get();
593 } 593 }
594 } 594 }
595 return nullptr; 595 return nullptr;
596 } 596 }
597 597
598 CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX, 598 CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX,
599 FX_FLOAT pageY) { 599 FX_FLOAT pageY) {
600 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 600 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
601 CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr(); 601 CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr();
602 CPDFSDK_AnnotIterator annotIterator(this, false); 602 CPDFSDK_AnnotIterator annotIterator(this, false);
603 while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) { 603 while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) {
604 CFX_FloatRect rc = pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot); 604 CFX_FloatRect rc = pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot);
605 if (rc.Contains(pageX, pageY)) 605 if (rc.Contains(pageX, pageY))
606 return pSDKAnnot; 606 return pSDKAnnot;
607 } 607 }
608 608
609 return nullptr; 609 return nullptr;
610 } 610 }
611 611
612 CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, 612 CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX,
613 FX_FLOAT pageY) { 613 FX_FLOAT pageY) {
614 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 614 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
615 CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr(); 615 CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr();
616 CPDFSDK_AnnotIterator annotIterator(this, false); 616 CPDFSDK_AnnotIterator annotIterator(this, false);
617 while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) { 617 while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) {
618 bool bHitTest = pSDKAnnot->GetType() == "Widget"; 618 bool bHitTest = pSDKAnnot->GetAnnotSubtype() == "Widget";
619 #ifdef PDF_ENABLE_XFA 619 #ifdef PDF_ENABLE_XFA
620 bHitTest = bHitTest || pSDKAnnot->GetType() == FSDK_XFAWIDGET_TYPENAME; 620 bHitTest =
621 bHitTest || pSDKAnnot->GetAnnotSubtype() == FSDK_XFAWIDGET_TYPENAME;
621 #endif // PDF_ENABLE_XFA 622 #endif // PDF_ENABLE_XFA
622 if (bHitTest) { 623 if (bHitTest) {
623 pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot); 624 pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot);
624 CFX_FloatPoint point(pageX, pageY); 625 CFX_FloatPoint point(pageX, pageY);
625 if (pAnnotMgr->Annot_OnHitTest(this, pSDKAnnot, point)) 626 if (pAnnotMgr->Annot_OnHitTest(this, pSDKAnnot, point))
626 return pSDKAnnot; 627 return pSDKAnnot;
627 } 628 }
628 } 629 }
629 630
630 return nullptr; 631 return nullptr;
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 return pAnnot; 1020 return pAnnot;
1020 } 1021 }
1021 return nullptr; 1022 return nullptr;
1022 } 1023 }
1023 1024
1024 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { 1025 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const {
1025 CPDF_Dictionary* pDict = GetPDFPage()->m_pFormDict; 1026 CPDF_Dictionary* pDict = GetPDFPage()->m_pFormDict;
1026 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); 1027 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument();
1027 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; 1028 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1;
1028 } 1029 }
OLDNEW
« no previous file with comments | « fpdfsdk/fsdk_baseform_embeddertest.cpp ('k') | fpdfsdk/include/cba_annotiterator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698