OLD | NEW |
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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 RestoreState(pPageView); | 261 RestoreState(pPageView); |
262 pRet = GetPDFWindow(pPageView, FALSE); | 262 pRet = GetPDFWindow(pPageView, FALSE); |
263 } else | 263 } else |
264 pRet = GetPDFWindow(pPageView, TRUE); | 264 pRet = GetPDFWindow(pPageView, TRUE); |
265 | 265 |
266 m_pWidget->UpdateField(); | 266 m_pWidget->UpdateField(); |
267 | 267 |
268 return pRet; | 268 return pRet; |
269 } | 269 } |
270 | 270 |
| 271 #ifdef PDF_ENABLE_XFA |
271 FX_BOOL CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) { | 272 FX_BOOL CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) { |
272 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { | 273 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { |
273 return pWnd->IsTextFull(); | 274 return pWnd->IsTextFull(); |
274 } | 275 } |
275 | 276 |
276 return FALSE; | 277 return FALSE; |
277 } | 278 } |
278 | 279 |
| 280 #endif |
279 void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) { | 281 void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) { |
280 ASSERT(m_pApp != NULL); | 282 ASSERT(m_pApp != NULL); |
281 | 283 |
282 ASSERT(pWnd != NULL); | 284 ASSERT(pWnd != NULL); |
283 | 285 |
284 if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) { | 286 if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) { |
285 CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; | 287 CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; |
286 pEdit->SetCharSet(134); | 288 pEdit->SetCharSet(134); |
287 pEdit->SetCodePage(936); | 289 pEdit->SetCodePage(936); |
288 | 290 |
289 pEdit->SetReadyToInput(); | 291 pEdit->SetReadyToInput(); |
290 CFX_WideString wsText = pEdit->GetText(); | 292 CFX_WideString wsText = pEdit->GetText(); |
291 int nCharacters = wsText.GetLength(); | 293 int nCharacters = wsText.GetLength(); |
292 CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); | 294 CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); |
293 unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); | 295 unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); |
294 m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, | 296 m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, |
295 nCharacters, TRUE); | 297 nCharacters, TRUE); |
296 | 298 |
297 pEdit->SetEditNotify(this); | 299 pEdit->SetEditNotify(this); |
298 } | 300 } |
299 } | 301 } |
300 | 302 |
301 void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd) {} | 303 void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd) {} |
302 | 304 |
303 void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit) {} | 305 void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit) {} |
OLD | NEW |