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" | |
8 #include "fpdfsdk/include/formfiller/FFL_TextField.h" | 7 #include "fpdfsdk/include/formfiller/FFL_TextField.h" |
9 | 8 |
10 /* ------------------------------- CFFL_TextField | 9 #include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h" |
11 * ------------------------------- */ | 10 #include "fpdfsdk/include/fsdk_common.h" |
| 11 #include "fpdfsdk/include/fsdk_mgr.h" |
12 | 12 |
13 CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot) | 13 CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot) |
14 : CFFL_FormFiller(pApp, pAnnot), m_pFontMap(NULL) { | 14 : CFFL_FormFiller(pApp, pAnnot), m_pFontMap(NULL) { |
15 m_State.nStart = m_State.nEnd = 0; | 15 m_State.nStart = m_State.nEnd = 0; |
16 } | 16 } |
17 | 17 |
18 CFFL_TextField::~CFFL_TextField() { | 18 CFFL_TextField::~CFFL_TextField() { |
19 delete m_pFontMap; | 19 delete m_pFontMap; |
20 } | 20 } |
21 | 21 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 if (bRestoreValue) | 240 if (bRestoreValue) |
241 SaveState(pPageView); | 241 SaveState(pPageView); |
242 | 242 |
243 DestroyPDFWindow(pPageView); | 243 DestroyPDFWindow(pPageView); |
244 | 244 |
245 CPWL_Wnd* pRet = NULL; | 245 CPWL_Wnd* pRet = NULL; |
246 | 246 |
247 if (bRestoreValue) { | 247 if (bRestoreValue) { |
248 RestoreState(pPageView); | 248 RestoreState(pPageView); |
249 pRet = GetPDFWindow(pPageView, FALSE); | 249 pRet = GetPDFWindow(pPageView, FALSE); |
250 } else | 250 } else { |
251 pRet = GetPDFWindow(pPageView, TRUE); | 251 pRet = GetPDFWindow(pPageView, TRUE); |
| 252 } |
252 | 253 |
253 m_pWidget->UpdateField(); | 254 m_pWidget->UpdateField(); |
254 | 255 |
255 return pRet; | 256 return pRet; |
256 } | 257 } |
257 | 258 |
258 void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) { | 259 void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) { |
259 ASSERT(m_pApp); | 260 ASSERT(m_pApp); |
260 if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) { | 261 if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) { |
261 CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; | 262 CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; |
262 pEdit->SetCharSet(134); | 263 pEdit->SetCharSet(134); |
263 pEdit->SetCodePage(936); | 264 pEdit->SetCodePage(936); |
264 | 265 |
265 pEdit->SetReadyToInput(); | 266 pEdit->SetReadyToInput(); |
266 CFX_WideString wsText = pEdit->GetText(); | 267 CFX_WideString wsText = pEdit->GetText(); |
267 int nCharacters = wsText.GetLength(); | 268 int nCharacters = wsText.GetLength(); |
268 CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); | 269 CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); |
269 unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); | 270 unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); |
270 m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, | 271 m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, |
271 nCharacters, TRUE); | 272 nCharacters, TRUE); |
272 | 273 |
273 pEdit->SetEditNotify(this); | 274 pEdit->SetEditNotify(this); |
274 } | 275 } |
275 } | 276 } |
276 | 277 |
277 void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd) {} | 278 void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd) {} |
278 | 279 |
279 void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit) {} | 280 void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit) {} |
OLD | NEW |