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/formfiller/cffl_combobox.h" | 7 #include "fpdfsdk/formfiller/cffl_combobox.h" |
8 | 8 |
9 #include "fpdfsdk/formfiller/cba_fontmap.h" | 9 #include "fpdfsdk/formfiller/cba_fontmap.h" |
10 #include "fpdfsdk/formfiller/cffl_formfiller.h" | 10 #include "fpdfsdk/formfiller/cffl_formfiller.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) { | 264 if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) { |
265 CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; | 265 CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; |
266 pEdit->SetCharSet(FXFONT_GB2312_CHARSET); | 266 pEdit->SetCharSet(FXFONT_GB2312_CHARSET); |
267 pEdit->SetCodePage(936); | 267 pEdit->SetCodePage(936); |
268 | 268 |
269 pEdit->SetReadyToInput(); | 269 pEdit->SetReadyToInput(); |
270 CFX_WideString wsText = pEdit->GetText(); | 270 CFX_WideString wsText = pEdit->GetText(); |
271 int nCharacters = wsText.GetLength(); | 271 int nCharacters = wsText.GetLength(); |
272 CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); | 272 CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); |
273 unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); | 273 unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); |
274 m_pEnv->OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, | 274 m_pEnv->OnSetFieldInputFocus(pBuffer, nCharacters, TRUE); |
275 nCharacters, TRUE); | |
276 } | 275 } |
277 } | 276 } |
278 | 277 |
279 CFX_WideString CFFL_ComboBox::GetSelectExportText() { | 278 CFX_WideString CFFL_ComboBox::GetSelectExportText() { |
280 CFX_WideString swRet; | 279 CFX_WideString swRet; |
281 | 280 |
282 int nExport = -1; | 281 int nExport = -1; |
283 CPDFSDK_PageView* pPageView = GetCurPageView(true); | 282 CPDFSDK_PageView* pPageView = GetCurPageView(true); |
284 if (CPWL_ComboBox* pComboBox = | 283 if (CPWL_ComboBox* pComboBox = |
285 (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) { | 284 (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) { |
286 nExport = pComboBox->GetSelect(); | 285 nExport = pComboBox->GetSelect(); |
287 } | 286 } |
288 | 287 |
289 if (nExport >= 0) { | 288 if (nExport >= 0) { |
290 if (CPDF_FormField* pFormField = m_pWidget->GetFormField()) { | 289 if (CPDF_FormField* pFormField = m_pWidget->GetFormField()) { |
291 swRet = pFormField->GetOptionValue(nExport); | 290 swRet = pFormField->GetOptionValue(nExport); |
292 if (swRet.IsEmpty()) | 291 if (swRet.IsEmpty()) |
293 swRet = pFormField->GetOptionLabel(nExport); | 292 swRet = pFormField->GetOptionLabel(nExport); |
294 } | 293 } |
295 } | 294 } |
296 | 295 |
297 return swRet; | 296 return swRet; |
298 } | 297 } |
OLD | NEW |