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

Side by Side Diff: fpdfsdk/fsdk_annothandler.cpp

Issue 1857893002: Cleanup the FF Handler proxy methods. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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/fpdfxfa/fpdfxfa_doc.cpp ('k') | fpdfsdk/fsdk_baseform.cpp » ('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_annothandler.h" 7 #include "fpdfsdk/include/fsdk_annothandler.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
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 "fpdfsdk/formfiller/cffl_formfiller.h" 14 #include "fpdfsdk/formfiller/cffl_formfiller.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 17
18 #ifdef PDF_ENABLE_XFA 18 #ifdef PDF_ENABLE_XFA
19 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" 19 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h"
20 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" 20 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h"
21 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h" 21 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h"
22 #include "xfa/fxgraphics/include/cfx_graphics.h" 22 #include "xfa/fxgraphics/include/cfx_graphics.h"
23 #include "xfa/include/fxfa/xfa_ffwidget.h"
23 #endif // PDF_ENABLE_XFA 24 #endif // PDF_ENABLE_XFA
24 25
25 CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp) { 26 CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp) {
26 m_pApp = pApp; 27 m_pApp = pApp;
27 28
28 CPDFSDK_BFAnnotHandler* pHandler = new CPDFSDK_BFAnnotHandler(m_pApp); 29 CPDFSDK_BFAnnotHandler* pHandler = new CPDFSDK_BFAnnotHandler(m_pApp);
29 pHandler->SetFormFiller(m_pApp->GetIFormFiller()); 30 pHandler->SetFormFiller(m_pApp->GetIFormFiller());
30 RegisterAnnotHandler(pHandler); 31 RegisterAnnotHandler(pHandler);
31 #ifdef PDF_ENABLE_XFA 32 #ifdef PDF_ENABLE_XFA
32 CPDFSDK_XFAAnnotHandler* pXFAAnnotHandler = 33 CPDFSDK_XFAAnnotHandler* pXFAAnnotHandler =
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); 779 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm();
779 pInterForm->RemoveXFAMap(pWidget->GetXFAWidget()); 780 pInterForm->RemoveXFAMap(pWidget->GetXFAWidget());
780 781
781 delete pWidget; 782 delete pWidget;
782 } 783 }
783 784
784 CFX_FloatRect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, 785 CFX_FloatRect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
785 CPDFSDK_Annot* pAnnot) { 786 CPDFSDK_Annot* pAnnot) {
786 ASSERT(pAnnot); 787 ASSERT(pAnnot);
787 788
788 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
789 CFX_RectF rcBBox; 789 CFX_RectF rcBBox;
790 XFA_ELEMENT eType = 790 XFA_ELEMENT eType = pAnnot->GetXFAWidget()->GetDataAcc()->GetUIType();
791 pWidgetHandler->GetDataAcc(pAnnot->GetXFAWidget())->GetUIType();
792 if (eType == XFA_ELEMENT_Signature) 791 if (eType == XFA_ELEMENT_Signature)
793 pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, 792 pAnnot->GetXFAWidget()->GetBBox(rcBBox, XFA_WIDGETSTATUS_Visible, TRUE);
794 XFA_WIDGETSTATUS_Visible, TRUE);
795 else 793 else
796 pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, 0); 794 pAnnot->GetXFAWidget()->GetBBox(rcBBox, 0);
797 795
798 CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, 796 CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width,
799 rcBBox.top + rcBBox.height); 797 rcBBox.top + rcBBox.height);
800 rcWidget.left -= 1.0f; 798 rcWidget.left -= 1.0f;
801 rcWidget.right += 1.0f; 799 rcWidget.right += 1.0f;
802 rcWidget.bottom -= 1.0f; 800 rcWidget.bottom -= 1.0f;
803 rcWidget.top += 1.0f; 801 rcWidget.top += 1.0f;
804 802
805 return rcWidget; 803 return rcWidget;
806 } 804 }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 995
998 if (pOldAnnot) 996 if (pOldAnnot)
999 pWidgetHandler = GetXFAWidgetHandler(pOldAnnot); 997 pWidgetHandler = GetXFAWidgetHandler(pOldAnnot);
1000 else if (pNewAnnot) 998 else if (pNewAnnot)
1001 pWidgetHandler = GetXFAWidgetHandler(pNewAnnot); 999 pWidgetHandler = GetXFAWidgetHandler(pNewAnnot);
1002 1000
1003 if (pWidgetHandler) { 1001 if (pWidgetHandler) {
1004 FX_BOOL bRet = TRUE; 1002 FX_BOOL bRet = TRUE;
1005 CXFA_FFWidget* hWidget = pNewAnnot ? pNewAnnot->GetXFAWidget() : NULL; 1003 CXFA_FFWidget* hWidget = pNewAnnot ? pNewAnnot->GetXFAWidget() : NULL;
1006 if (hWidget) { 1004 if (hWidget) {
1007 CXFA_FFPageView* pXFAPageView = pWidgetHandler->GetPageView(hWidget); 1005 CXFA_FFPageView* pXFAPageView = hWidget->GetPageView();
1008 if (pXFAPageView) { 1006 if (pXFAPageView) {
1009 bRet = pXFAPageView->GetDocView()->SetFocus(hWidget); 1007 bRet = pXFAPageView->GetDocView()->SetFocus(hWidget);
1010 if (pXFAPageView->GetDocView()->GetFocusWidget() == hWidget) 1008 if (pXFAPageView->GetDocView()->GetFocusWidget() == hWidget)
1011 bRet = TRUE; 1009 bRet = TRUE;
1012 } 1010 }
1013 } 1011 }
1014 return bRet; 1012 return bRet;
1015 } 1013 }
1016 1014
1017 return TRUE; 1015 return TRUE;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 1100
1103 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() { 1101 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() {
1104 if (m_pos < m_iteratorAnnotList.size()) 1102 if (m_pos < m_iteratorAnnotList.size())
1105 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos]; 1103 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos];
1106 return nullptr; 1104 return nullptr;
1107 } 1105 }
1108 1106
1109 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() { 1107 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() {
1110 return m_bReverse ? PrevAnnot() : NextAnnot(); 1108 return m_bReverse ? PrevAnnot() : NextAnnot();
1111 } 1109 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp ('k') | fpdfsdk/fsdk_baseform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698