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

Side by Side Diff: fpdfsdk/cpdfsdk_widgethandler.cpp

Issue 2410193005: Remove unused widget handler overrides (Closed)
Patch Set: Created 4 years, 2 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/cpdfsdk_widgethandler.h ('k') | fpdfsdk/cpdfsdk_xfawidgethandler.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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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/cpdfsdk_widgethandler.h" 7 #include "fpdfsdk/cpdfsdk_widgethandler.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 if (m_pFormFiller) 82 if (m_pFormFiller)
83 m_pFormFiller->OnDelete(pAnnot); 83 m_pFormFiller->OnDelete(pAnnot);
84 84
85 std::unique_ptr<CPDFSDK_Widget> pWidget(static_cast<CPDFSDK_Widget*>(pAnnot)); 85 std::unique_ptr<CPDFSDK_Widget> pWidget(static_cast<CPDFSDK_Widget*>(pAnnot));
86 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); 86 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm();
87 CPDF_FormControl* pControl = pWidget->GetFormControl(); 87 CPDF_FormControl* pControl = pWidget->GetFormControl();
88 pInterForm->RemoveMap(pControl); 88 pInterForm->RemoveMap(pControl);
89 } 89 }
90 90
91 void CPDFSDK_WidgetHandler::DeleteAnnot(CPDFSDK_Annot* pAnnot) {}
92
93 void CPDFSDK_WidgetHandler::OnDraw(CPDFSDK_PageView* pPageView, 91 void CPDFSDK_WidgetHandler::OnDraw(CPDFSDK_PageView* pPageView,
94 CPDFSDK_Annot* pAnnot, 92 CPDFSDK_Annot* pAnnot,
95 CFX_RenderDevice* pDevice, 93 CFX_RenderDevice* pDevice,
96 CFX_Matrix* pUser2Device, 94 CFX_Matrix* pUser2Device,
97 bool bDrawAnnots) { 95 bool bDrawAnnots) {
98 if (pAnnot->IsSignatureWidget()) { 96 if (pAnnot->IsSignatureWidget()) {
99 static_cast<CPDFSDK_BAAnnot*>(pAnnot)->DrawAppearance( 97 static_cast<CPDFSDK_BAAnnot*>(pAnnot)->DrawAppearance(
100 pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); 98 pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
101 } else { 99 } else {
102 if (m_pFormFiller) 100 if (m_pFormFiller)
103 m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device); 101 m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device);
104 } 102 }
105 } 103 }
106 104
107 void CPDFSDK_WidgetHandler::OnDelete(CPDFSDK_Annot* pAnnot) {}
108
109 void CPDFSDK_WidgetHandler::OnRelease(CPDFSDK_Annot* pAnnot) {}
110
111 void CPDFSDK_WidgetHandler::OnMouseEnter(CPDFSDK_PageView* pPageView, 105 void CPDFSDK_WidgetHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
112 CPDFSDK_Annot::ObservedPtr* pAnnot, 106 CPDFSDK_Annot::ObservedPtr* pAnnot,
113 uint32_t nFlag) { 107 uint32_t nFlag) {
114 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) 108 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller)
115 m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag); 109 m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag);
116 } 110 }
117 111
118 void CPDFSDK_WidgetHandler::OnMouseExit(CPDFSDK_PageView* pPageView, 112 void CPDFSDK_WidgetHandler::OnMouseExit(CPDFSDK_PageView* pPageView,
119 CPDFSDK_Annot::ObservedPtr* pAnnot, 113 CPDFSDK_Annot::ObservedPtr* pAnnot,
120 uint32_t nFlag) { 114 uint32_t nFlag) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 214
221 return FALSE; 215 return FALSE;
222 } 216 }
223 217
224 FX_BOOL CPDFSDK_WidgetHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, 218 FX_BOOL CPDFSDK_WidgetHandler::OnKeyUp(CPDFSDK_Annot* pAnnot,
225 int nKeyCode, 219 int nKeyCode,
226 int nFlag) { 220 int nFlag) {
227 return FALSE; 221 return FALSE;
228 } 222 }
229 223
230 void CPDFSDK_WidgetHandler::OnCreate(CPDFSDK_Annot* pAnnot) {
231 if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
232 m_pFormFiller->OnCreate(pAnnot);
233 }
234
235 void CPDFSDK_WidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) { 224 void CPDFSDK_WidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) {
236 if (pAnnot->IsSignatureWidget()) 225 if (pAnnot->IsSignatureWidget())
237 return; 226 return;
238 227
239 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); 228 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot);
240 if (!pWidget->IsAppearanceValid()) 229 if (!pWidget->IsAppearanceValid())
241 pWidget->ResetAppearance(nullptr, FALSE); 230 pWidget->ResetAppearance(nullptr, FALSE);
242 231
243 int nFieldType = pWidget->GetFieldType(); 232 int nFieldType = pWidget->GetFieldType();
244 if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) { 233 if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) {
245 FX_BOOL bFormatted = FALSE; 234 FX_BOOL bFormatted = FALSE;
246 CFX_WideString sValue = pWidget->OnFormat(bFormatted); 235 CFX_WideString sValue = pWidget->OnFormat(bFormatted);
247 if (bFormatted && nFieldType == FIELDTYPE_COMBOBOX) 236 if (bFormatted && nFieldType == FIELDTYPE_COMBOBOX)
248 pWidget->ResetAppearance(&sValue, FALSE); 237 pWidget->ResetAppearance(&sValue, FALSE);
249 } 238 }
250 239
251 #ifdef PDF_ENABLE_XFA 240 #ifdef PDF_ENABLE_XFA
252 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); 241 CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
253 CPDFXFA_Document* pDoc = 242 CPDFXFA_Document* pDoc =
254 pPageView->GetFormFillEnv()->GetSDKDocument()->GetXFADocument(); 243 pPageView->GetFormFillEnv()->GetSDKDocument()->GetXFADocument();
255 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { 244 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
256 if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty()) 245 if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty())
257 pWidget->ResetAppearance(FALSE); 246 pWidget->ResetAppearance(FALSE);
258 } 247 }
259 #endif // PDF_ENABLE_XFA 248 #endif // PDF_ENABLE_XFA
260 if (m_pFormFiller)
261 m_pFormFiller->OnLoad(pAnnot);
262 } 249 }
263 250
264 FX_BOOL CPDFSDK_WidgetHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, 251 FX_BOOL CPDFSDK_WidgetHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
265 uint32_t nFlag) { 252 uint32_t nFlag) {
266 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) 253 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller)
267 return m_pFormFiller->OnSetFocus(pAnnot, nFlag); 254 return m_pFormFiller->OnSetFocus(pAnnot, nFlag);
268 255
269 return TRUE; 256 return TRUE;
270 } 257 }
271 258
(...skipping 23 matching lines...) Expand all
295 282
296 FX_BOOL CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView, 283 FX_BOOL CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView,
297 CPDFSDK_Annot* pAnnot, 284 CPDFSDK_Annot* pAnnot,
298 const CFX_FloatPoint& point) { 285 const CFX_FloatPoint& point) {
299 ASSERT(pPageView); 286 ASSERT(pPageView);
300 ASSERT(pAnnot); 287 ASSERT(pAnnot);
301 288
302 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); 289 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot);
303 return rect.Contains(point.x, point.y); 290 return rect.Contains(point.x, point.y);
304 } 291 }
OLDNEW
« no previous file with comments | « fpdfsdk/cpdfsdk_widgethandler.h ('k') | fpdfsdk/cpdfsdk_xfawidgethandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698