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

Side by Side Diff: fpdfsdk/src/formfiller/FFL_TextField.cpp

Issue 1477583002: Inflict PDF_ENABLE_XFA ifdefs on XFA fpdfsdk/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years 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/include/formfiller/FFL_CBA_Fontmap.h" 7 #include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
8 #include "fpdfsdk/include/formfiller/FFL_TextField.h" 8 #include "fpdfsdk/include/formfiller/FFL_TextField.h"
9 9
10 /* ------------------------------- CFFL_TextField 10 /* ------------------------------- CFFL_TextField
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, 112 FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot,
113 FX_UINT nChar, 113 FX_UINT nChar,
114 FX_UINT nFlags) { 114 FX_UINT nFlags) {
115 switch (nChar) { 115 switch (nChar) {
116 case FWL_VKEY_Return: 116 case FWL_VKEY_Return:
117 if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE)) { 117 if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE)) {
118 CPDFSDK_PageView* pPageView = GetCurPageView(); 118 CPDFSDK_PageView* pPageView = GetCurPageView();
119 ASSERT(pPageView != NULL); 119 ASSERT(pPageView != NULL);
120 m_bValid = !m_bValid; 120 m_bValid = !m_bValid;
121 CPDF_Rect rcAnnot = pAnnot->GetRect(); 121 CPDF_Rect rcAnnot = pAnnot->GetRect();
122 #ifndef PDF_ENABLE_XFA
123 m_pApp->FFI_Invalidate(pAnnot->GetPDFPage(), rcAnnot.left, rcAnnot.top,
Lei Zhang 2015/11/25 00:12:02 GetUnderlyingPage?
124 rcAnnot.right, rcAnnot.bottom);
125 #else
122 m_pApp->FFI_Invalidate(pAnnot->GetPDFXFAPage(), rcAnnot.left, 126 m_pApp->FFI_Invalidate(pAnnot->GetPDFXFAPage(), rcAnnot.left,
123 rcAnnot.top, rcAnnot.right, rcAnnot.bottom); 127 rcAnnot.top, rcAnnot.right, rcAnnot.bottom);
128 #endif
124 129
125 if (m_bValid) { 130 if (m_bValid) {
126 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) 131 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE))
127 pWnd->SetFocus(); 132 pWnd->SetFocus();
128 } else { 133 } else {
129 if (CommitData(pPageView, nFlags)) { 134 if (CommitData(pPageView, nFlags)) {
130 DestroyPDFWindow(pPageView); 135 DestroyPDFWindow(pPageView);
131 return TRUE; 136 return TRUE;
132 } 137 }
133 return FALSE; 138 return FALSE;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 RestoreState(pPageView); 266 RestoreState(pPageView);
262 pRet = GetPDFWindow(pPageView, FALSE); 267 pRet = GetPDFWindow(pPageView, FALSE);
263 } else 268 } else
264 pRet = GetPDFWindow(pPageView, TRUE); 269 pRet = GetPDFWindow(pPageView, TRUE);
265 270
266 m_pWidget->UpdateField(); 271 m_pWidget->UpdateField();
267 272
268 return pRet; 273 return pRet;
269 } 274 }
270 275
276 #ifdef PDF_ENABLE_XFA
271 FX_BOOL CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) { 277 FX_BOOL CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) {
272 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { 278 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) {
273 return pWnd->IsTextFull(); 279 return pWnd->IsTextFull();
274 } 280 }
275 281
276 return FALSE; 282 return FALSE;
277 } 283 }
278 284
285 #endif
279 void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) { 286 void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) {
280 ASSERT(m_pApp != NULL); 287 ASSERT(m_pApp != NULL);
281 288
282 ASSERT(pWnd != NULL); 289 ASSERT(pWnd != NULL);
283 290
284 if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) { 291 if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) {
285 CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; 292 CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
286 pEdit->SetCharSet(134); 293 pEdit->SetCharSet(134);
287 pEdit->SetCodePage(936); 294 pEdit->SetCodePage(936);
288 295
289 pEdit->SetReadyToInput(); 296 pEdit->SetReadyToInput();
290 CFX_WideString wsText = pEdit->GetText(); 297 CFX_WideString wsText = pEdit->GetText();
291 int nCharacters = wsText.GetLength(); 298 int nCharacters = wsText.GetLength();
292 CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); 299 CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
293 unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); 300 unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str();
294 m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, 301 m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer,
295 nCharacters, TRUE); 302 nCharacters, TRUE);
296 303
297 pEdit->SetEditNotify(this); 304 pEdit->SetEditNotify(this);
298 } 305 }
299 } 306 }
300 307
301 void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd) {} 308 void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd) {}
302 309
303 void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit) {} 310 void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit) {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698