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

Side by Side Diff: fpdfsdk/formfiller/cffl_textfield.cpp

Issue 2412523002: Cleanup env variable names (Closed)
Patch Set: Fix spelling 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/formfiller/cffl_radiobutton.cpp ('k') | fpdfsdk/fpdfformfill.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/formfiller/cffl_textfield.h" 7 #include "fpdfsdk/formfiller/cffl_textfield.h"
8 8
9 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" 9 #include "fpdfsdk/cpdfsdk_formfillenvironment.h"
10 #include "fpdfsdk/cpdfsdk_widget.h" 10 #include "fpdfsdk/cpdfsdk_widget.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 break; 66 break;
67 case BF_ALIGN_MIDDLE: 67 case BF_ALIGN_MIDDLE:
68 cp.dwFlags |= PES_MIDDLE; 68 cp.dwFlags |= PES_MIDDLE;
69 break; 69 break;
70 case BF_ALIGN_RIGHT: 70 case BF_ALIGN_RIGHT:
71 cp.dwFlags |= PES_RIGHT; 71 cp.dwFlags |= PES_RIGHT;
72 break; 72 break;
73 } 73 }
74 74
75 if (!m_pFontMap) { 75 if (!m_pFontMap) {
76 m_pFontMap = 76 m_pFontMap = pdfium::MakeUnique<CBA_FontMap>(
77 pdfium::MakeUnique<CBA_FontMap>(m_pWidget, m_pEnv->GetSysHandler()); 77 m_pWidget, m_pFormFillEnv->GetSysHandler());
78 } 78 }
79 cp.pFontMap = m_pFontMap.get(); 79 cp.pFontMap = m_pFontMap.get();
80 cp.pFocusHandler = this; 80 cp.pFocusHandler = this;
81 81
82 return cp; 82 return cp;
83 } 83 }
84 84
85 CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, 85 CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp,
86 CPDFSDK_PageView* pPageView) { 86 CPDFSDK_PageView* pPageView) {
87 CPWL_Edit* pWnd = new CPWL_Edit(); 87 CPWL_Edit* pWnd = new CPWL_Edit();
88 pWnd->AttachFFLData(this); 88 pWnd->AttachFFLData(this);
89 pWnd->Create(cp); 89 pWnd->Create(cp);
90 pWnd->SetFillerNotify(m_pEnv->GetInteractiveFormFiller()); 90 pWnd->SetFillerNotify(m_pFormFillEnv->GetInteractiveFormFiller());
91 91
92 int32_t nMaxLen = m_pWidget->GetMaxLen(); 92 int32_t nMaxLen = m_pWidget->GetMaxLen();
93 CFX_WideString swValue = m_pWidget->GetValue(); 93 CFX_WideString swValue = m_pWidget->GetValue();
94 94
95 if (nMaxLen > 0) { 95 if (nMaxLen > 0) {
96 if (pWnd->HasFlag(PES_CHARARRAY)) { 96 if (pWnd->HasFlag(PES_CHARARRAY)) {
97 pWnd->SetCharArray(nMaxLen); 97 pWnd->SetCharArray(nMaxLen);
98 pWnd->SetAlignFormatV(PEAV_CENTER); 98 pWnd->SetAlignFormatV(PEAV_CENTER);
99 } else { 99 } else {
100 pWnd->SetLimitChar(nMaxLen); 100 pWnd->SetLimitChar(nMaxLen);
101 } 101 }
102 } 102 }
103 103
104 pWnd->SetText(swValue); 104 pWnd->SetText(swValue);
105 return pWnd; 105 return pWnd;
106 } 106 }
107 107
108 FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, 108 FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot,
109 uint32_t nChar, 109 uint32_t nChar,
110 uint32_t nFlags) { 110 uint32_t nFlags) {
111 switch (nChar) { 111 switch (nChar) {
112 case FWL_VKEY_Return: 112 case FWL_VKEY_Return:
113 if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE)) { 113 if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE)) {
114 CPDFSDK_PageView* pPageView = GetCurPageView(true); 114 CPDFSDK_PageView* pPageView = GetCurPageView(true);
115 ASSERT(pPageView); 115 ASSERT(pPageView);
116 m_bValid = !m_bValid; 116 m_bValid = !m_bValid;
117 CFX_FloatRect rcAnnot = pAnnot->GetRect(); 117 CFX_FloatRect rcAnnot = pAnnot->GetRect();
118 m_pEnv->Invalidate(pAnnot->GetUnderlyingPage(), rcAnnot.left, 118 m_pFormFillEnv->Invalidate(pAnnot->GetUnderlyingPage(), rcAnnot.left,
119 rcAnnot.top, rcAnnot.right, rcAnnot.bottom); 119 rcAnnot.top, rcAnnot.right, rcAnnot.bottom);
120 120
121 if (m_bValid) { 121 if (m_bValid) {
122 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) 122 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE))
123 pWnd->SetFocus(); 123 pWnd->SetFocus();
124 } else { 124 } else {
125 if (CommitData(pPageView, nFlags)) { 125 if (CommitData(pPageView, nFlags)) {
126 DestroyPDFWindow(pPageView); 126 DestroyPDFWindow(pPageView);
127 return TRUE; 127 return TRUE;
128 } 128 }
129 return FALSE; 129 return FALSE;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 FX_BOOL CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) { 264 FX_BOOL CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) {
265 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { 265 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) {
266 return pWnd->IsTextFull(); 266 return pWnd->IsTextFull();
267 } 267 }
268 268
269 return FALSE; 269 return FALSE;
270 } 270 }
271 #endif // PDF_ENABLE_XFA 271 #endif // PDF_ENABLE_XFA
272 272
273 void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) { 273 void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) {
274 ASSERT(m_pEnv); 274 ASSERT(m_pFormFillEnv);
275 if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) { 275 if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) {
276 CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; 276 CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
277 pEdit->SetCharSet(FXFONT_GB2312_CHARSET); 277 pEdit->SetCharSet(FXFONT_GB2312_CHARSET);
278 pEdit->SetCodePage(936); 278 pEdit->SetCodePage(936);
279 279
280 pEdit->SetReadyToInput(); 280 pEdit->SetReadyToInput();
281 CFX_WideString wsText = pEdit->GetText(); 281 CFX_WideString wsText = pEdit->GetText();
282 int nCharacters = wsText.GetLength(); 282 int nCharacters = wsText.GetLength();
283 CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); 283 CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
284 unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); 284 unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str();
285 m_pEnv->OnSetFieldInputFocus(pBuffer, nCharacters, TRUE); 285 m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, TRUE);
286 } 286 }
287 } 287 }
OLDNEW
« no previous file with comments | « fpdfsdk/formfiller/cffl_radiobutton.cpp ('k') | fpdfsdk/fpdfformfill.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698