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

Side by Side Diff: fpdfsdk/javascript/Field.cpp

Issue 2391313002: Rename CPDFSDK_Environment to CPDFSDK_FormfillEnvironment (Closed)
Patch Set: Rebase to master 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
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/javascript/Field.h" 7 #include "fpdfsdk/javascript/Field.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "core/fpdfapi/font/cpdf_font.h" 14 #include "core/fpdfapi/font/cpdf_font.h"
15 #include "core/fpdfapi/page/cpdf_page.h" 15 #include "core/fpdfapi/page/cpdf_page.h"
16 #include "core/fpdfapi/parser/cpdf_document.h" 16 #include "core/fpdfapi/parser/cpdf_document.h"
17 #include "core/fpdfdoc/cpdf_interform.h" 17 #include "core/fpdfdoc/cpdf_interform.h"
18 #include "fpdfsdk/cpdfsdk_document.h" 18 #include "fpdfsdk/cpdfsdk_document.h"
19 #include "fpdfsdk/cpdfsdk_environment.h" 19 #include "fpdfsdk/cpdfsdk_formfillenvironment.h"
20 #include "fpdfsdk/cpdfsdk_interform.h" 20 #include "fpdfsdk/cpdfsdk_interform.h"
21 #include "fpdfsdk/cpdfsdk_pageview.h" 21 #include "fpdfsdk/cpdfsdk_pageview.h"
22 #include "fpdfsdk/cpdfsdk_widget.h" 22 #include "fpdfsdk/cpdfsdk_widget.h"
23 #include "fpdfsdk/javascript/Document.h" 23 #include "fpdfsdk/javascript/Document.h"
24 #include "fpdfsdk/javascript/Icon.h" 24 #include "fpdfsdk/javascript/Icon.h"
25 #include "fpdfsdk/javascript/JS_Define.h" 25 #include "fpdfsdk/javascript/JS_Define.h"
26 #include "fpdfsdk/javascript/JS_EventHandler.h" 26 #include "fpdfsdk/javascript/JS_EventHandler.h"
27 #include "fpdfsdk/javascript/JS_Object.h" 27 #include "fpdfsdk/javascript/JS_Object.h"
28 #include "fpdfsdk/javascript/JS_Value.h" 28 #include "fpdfsdk/javascript/JS_Value.h"
29 #include "fpdfsdk/javascript/PublicMethods.h" 29 #include "fpdfsdk/javascript/PublicMethods.h"
(...skipping 2798 matching lines...) Expand 10 before | Expand all | Expand 10 after
2828 2828
2829 FX_BOOL Field::browseForFileToSubmit(IJS_Context* cc, 2829 FX_BOOL Field::browseForFileToSubmit(IJS_Context* cc,
2830 const std::vector<CJS_Value>& params, 2830 const std::vector<CJS_Value>& params,
2831 CJS_Value& vRet, 2831 CJS_Value& vRet,
2832 CFX_WideString& sError) { 2832 CFX_WideString& sError) {
2833 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); 2833 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
2834 if (FieldArray.empty()) 2834 if (FieldArray.empty())
2835 return FALSE; 2835 return FALSE;
2836 2836
2837 CPDF_FormField* pFormField = FieldArray[0]; 2837 CPDF_FormField* pFormField = FieldArray[0];
2838 CPDFSDK_Environment* pApp = m_pDocument->GetEnv(); 2838 CPDFSDK_FormFillEnvironment* pApp = m_pDocument->GetEnv();
2839 if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) && 2839 if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) &&
2840 (pFormField->GetFieldType() == FIELDTYPE_TEXTFIELD)) { 2840 (pFormField->GetFieldType() == FIELDTYPE_TEXTFIELD)) {
2841 CFX_WideString wsFileName = pApp->JS_fieldBrowse(); 2841 CFX_WideString wsFileName = pApp->JS_fieldBrowse();
2842 if (!wsFileName.IsEmpty()) { 2842 if (!wsFileName.IsEmpty()) {
2843 pFormField->SetValue(wsFileName); 2843 pFormField->SetValue(wsFileName);
2844 UpdateFormField(m_pDocument.Get(), pFormField, TRUE, TRUE, TRUE); 2844 UpdateFormField(m_pDocument.Get(), pFormField, TRUE, TRUE, TRUE);
2845 } 2845 }
2846 return TRUE; 2846 return TRUE;
2847 } 2847 }
2848 return FALSE; 2848 return FALSE;
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
3195 CPDF_FormField* pFormField = FieldArray[0]; 3195 CPDF_FormField* pFormField = FieldArray[0];
3196 int32_t nCount = pFormField->CountControls(); 3196 int32_t nCount = pFormField->CountControls();
3197 if (nCount < 1) 3197 if (nCount < 1)
3198 return FALSE; 3198 return FALSE;
3199 3199
3200 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); 3200 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm();
3201 CPDFSDK_Widget* pWidget = nullptr; 3201 CPDFSDK_Widget* pWidget = nullptr;
3202 if (nCount == 1) { 3202 if (nCount == 1) {
3203 pWidget = pInterForm->GetWidget(pFormField->GetControl(0), false); 3203 pWidget = pInterForm->GetWidget(pFormField->GetControl(0), false);
3204 } else { 3204 } else {
3205 CPDFSDK_Environment* pEnv = m_pDocument->GetEnv(); 3205 CPDFSDK_FormFillEnvironment* pEnv = m_pDocument->GetEnv();
3206 UnderlyingPageType* pPage = UnderlyingFromFPDFPage( 3206 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(
3207 pEnv->GetCurrentPage(m_pDocument->GetUnderlyingDocument())); 3207 pEnv->GetCurrentPage(m_pDocument->GetUnderlyingDocument()));
3208 if (!pPage) 3208 if (!pPage)
3209 return FALSE; 3209 return FALSE;
3210 if (CPDFSDK_PageView* pCurPageView = 3210 if (CPDFSDK_PageView* pCurPageView =
3211 m_pDocument->GetPageView(pPage, true)) { 3211 m_pDocument->GetPageView(pPage, true)) {
3212 for (int32_t i = 0; i < nCount; i++) { 3212 for (int32_t i = 0; i < nCount; i++) {
3213 if (CPDFSDK_Widget* pTempWidget = 3213 if (CPDFSDK_Widget* pTempWidget =
3214 pInterForm->GetWidget(pFormField->GetControl(i), false)) { 3214 pInterForm->GetWidget(pFormField->GetControl(i), false)) {
3215 if (pTempWidget->GetPDFPage() == pCurPageView->GetPDFPage()) { 3215 if (pTempWidget->GetPDFPage() == pCurPageView->GetPDFPage()) {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
3492 } 3492 }
3493 } 3493 }
3494 3494
3495 void Field::AddField(CPDFSDK_Document* pDocument, 3495 void Field::AddField(CPDFSDK_Document* pDocument,
3496 int nPageIndex, 3496 int nPageIndex,
3497 int nFieldType, 3497 int nFieldType,
3498 const CFX_WideString& sName, 3498 const CFX_WideString& sName,
3499 const CFX_FloatRect& rcCoords) { 3499 const CFX_FloatRect& rcCoords) {
3500 // Not supported. 3500 // Not supported.
3501 } 3501 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698