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

Side by Side Diff: fpdfsdk/cpdfsdk_widgethandler.cpp

Issue 2469813004: Rename CPDFXFA_Document to CPDFXFA_Context (Closed)
Patch Set: Merge to master Created 4 years, 1 month 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_widget.cpp ('k') | fpdfsdk/cpdfsdk_xfawidgethandler.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 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>
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/fpdfdoc/cpdf_interform.h" 14 #include "core/fpdfdoc/cpdf_interform.h"
15 #include "fpdfsdk/cpdfsdk_annot.h" 15 #include "fpdfsdk/cpdfsdk_annot.h"
16 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" 16 #include "fpdfsdk/cpdfsdk_formfillenvironment.h"
17 #include "fpdfsdk/cpdfsdk_interform.h" 17 #include "fpdfsdk/cpdfsdk_interform.h"
18 #include "fpdfsdk/cpdfsdk_pageview.h" 18 #include "fpdfsdk/cpdfsdk_pageview.h"
19 #include "fpdfsdk/cpdfsdk_widget.h" 19 #include "fpdfsdk/cpdfsdk_widget.h"
20 #include "fpdfsdk/formfiller/cffl_formfiller.h" 20 #include "fpdfsdk/formfiller/cffl_formfiller.h"
21 21
22 #ifdef PDF_ENABLE_XFA 22 #ifdef PDF_ENABLE_XFA
23 #include "fpdfsdk/fpdfxfa/cpdfxfa_document.h" 23 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
24 #endif // PDF_ENABLE_XFA 24 #endif // PDF_ENABLE_XFA
25 25
26 CPDFSDK_WidgetHandler::CPDFSDK_WidgetHandler( 26 CPDFSDK_WidgetHandler::CPDFSDK_WidgetHandler(
27 CPDFSDK_FormFillEnvironment* pFormFillEnv) 27 CPDFSDK_FormFillEnvironment* pFormFillEnv)
28 : m_pFormFillEnv(pFormFillEnv), m_pFormFiller(nullptr) {} 28 : m_pFormFillEnv(pFormFillEnv), m_pFormFiller(nullptr) {}
29 29
30 CPDFSDK_WidgetHandler::~CPDFSDK_WidgetHandler() {} 30 CPDFSDK_WidgetHandler::~CPDFSDK_WidgetHandler() {}
31 31
32 FX_BOOL CPDFSDK_WidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { 32 FX_BOOL CPDFSDK_WidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) {
33 ASSERT(pAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::WIDGET); 33 ASSERT(pAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::WIDGET);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 int nFieldType = pWidget->GetFieldType(); 232 int nFieldType = pWidget->GetFieldType();
233 if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) { 233 if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) {
234 FX_BOOL bFormatted = FALSE; 234 FX_BOOL bFormatted = FALSE;
235 CFX_WideString sValue = pWidget->OnFormat(bFormatted); 235 CFX_WideString sValue = pWidget->OnFormat(bFormatted);
236 if (bFormatted && nFieldType == FIELDTYPE_COMBOBOX) 236 if (bFormatted && nFieldType == FIELDTYPE_COMBOBOX)
237 pWidget->ResetAppearance(&sValue, FALSE); 237 pWidget->ResetAppearance(&sValue, FALSE);
238 } 238 }
239 239
240 #ifdef PDF_ENABLE_XFA 240 #ifdef PDF_ENABLE_XFA
241 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); 241 CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
242 CPDFXFA_Document* pDoc = pPageView->GetFormFillEnv()->GetXFADocument(); 242 CPDFXFA_Context* pContext = pPageView->GetFormFillEnv()->GetXFAContext();
243 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { 243 if (pContext->GetDocType() == DOCTYPE_STATIC_XFA) {
244 if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty()) 244 if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty())
245 pWidget->ResetAppearance(FALSE); 245 pWidget->ResetAppearance(FALSE);
246 } 246 }
247 #endif // PDF_ENABLE_XFA 247 #endif // PDF_ENABLE_XFA
248 } 248 }
249 249
250 FX_BOOL CPDFSDK_WidgetHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, 250 FX_BOOL CPDFSDK_WidgetHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
251 uint32_t nFlag) { 251 uint32_t nFlag) {
252 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) 252 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller)
253 return m_pFormFiller->OnSetFocus(pAnnot, nFlag); 253 return m_pFormFiller->OnSetFocus(pAnnot, nFlag);
(...skipping 27 matching lines...) Expand all
281 281
282 FX_BOOL CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView, 282 FX_BOOL CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView,
283 CPDFSDK_Annot* pAnnot, 283 CPDFSDK_Annot* pAnnot,
284 const CFX_FloatPoint& point) { 284 const CFX_FloatPoint& point) {
285 ASSERT(pPageView); 285 ASSERT(pPageView);
286 ASSERT(pAnnot); 286 ASSERT(pAnnot);
287 287
288 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); 288 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot);
289 return rect.Contains(point.x, point.y); 289 return rect.Contains(point.x, point.y);
290 } 290 }
OLDNEW
« no previous file with comments | « fpdfsdk/cpdfsdk_widget.cpp ('k') | fpdfsdk/cpdfsdk_xfawidgethandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698