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 "../../include/formfiller/FormFiller.h" | 7 #include "../../include/formfiller/FormFiller.h" |
8 #include "../../include/formfiller/FFL_FormFiller.h" | 8 #include "../../include/formfiller/FFL_FormFiller.h" |
9 #include "../../include/formfiller/FFL_IFormFiller.h" | 9 #include "../../include/formfiller/FFL_IFormFiller.h" |
10 #include "../../include/formfiller/FFL_CBA_Fontmap.h" | 10 #include "../../include/formfiller/FFL_CBA_Fontmap.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 return cp; | 71 return cp; |
72 } | 72 } |
73 | 73 |
74 CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVie
w* pPageView) | 74 CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVie
w* pPageView) |
75 { | 75 { |
76 CPWL_ComboBox * pWnd = new CPWL_ComboBox(); | 76 CPWL_ComboBox * pWnd = new CPWL_ComboBox(); |
77 pWnd->AttachFFLData(this); | 77 pWnd->AttachFFLData(this); |
78 pWnd->Create(cp); | 78 pWnd->Create(cp); |
79 | 79 |
80 ASSERT(m_pApp != NULL); | |
81 CFFL_IFormFiller* pFormFiller = m_pApp->GetIFormFiller(); | 80 CFFL_IFormFiller* pFormFiller = m_pApp->GetIFormFiller(); |
82 pWnd->SetFillerNotify(pFormFiller); | 81 pWnd->SetFillerNotify(pFormFiller); |
83 | 82 |
84 ASSERT(m_pWidget != NULL); | |
85 FX_INT32 nCurSel = m_pWidget->GetSelectedIndex(0); | 83 FX_INT32 nCurSel = m_pWidget->GetSelectedIndex(0); |
86 | |
87 CFX_WideString swText; | 84 CFX_WideString swText; |
88 | |
89 if (nCurSel < 0) | 85 if (nCurSel < 0) |
90 swText = m_pWidget->GetValue(); | 86 swText = m_pWidget->GetValue(); |
91 else | 87 else |
92 swText = m_pWidget->GetOptionLabel(nCurSel); | 88 swText = m_pWidget->GetOptionLabel(nCurSel); |
93 » | 89 |
94 for (FX_INT32 i=0,sz=m_pWidget->CountOptions(); i<sz; i++) | 90 for (FX_INT32 i=0,sz=m_pWidget->CountOptions(); i<sz; i++) |
95 { | 91 { |
96 » » pWnd->AddString(m_pWidget->GetOptionLabel(i));» » » | 92 » » pWnd->AddString(m_pWidget->GetOptionLabel(i).c_str()); |
97 } | 93 } |
98 » | 94 |
99 pWnd->SetSelect(nCurSel); | 95 pWnd->SetSelect(nCurSel); |
100 » pWnd->SetText(swText); | 96 » pWnd->SetText(swText.c_str()); |
101 » | |
102 return pWnd; | 97 return pWnd; |
103 } | 98 } |
104 | 99 |
105 | 100 |
106 FX_BOOL CFFL_ComboBox::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFla
gs) | 101 FX_BOOL CFFL_ComboBox::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFla
gs) |
107 { | 102 { |
108 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); | 103 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); |
109 } | 104 } |
110 | 105 |
111 FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) | 106 FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 const PD
FSDK_FieldAction& fa) | 233 const PD
FSDK_FieldAction& fa) |
239 { | 234 { |
240 switch (type) | 235 switch (type) |
241 { | 236 { |
242 case CPDF_AAction::KeyStroke: | 237 case CPDF_AAction::KeyStroke: |
243 if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPag
eView, FALSE)) | 238 if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPag
eView, FALSE)) |
244 { | 239 { |
245 if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) | 240 if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) |
246 { | 241 { |
247 pEdit->SetSel(fa.nSelStart, fa.nSelEnd); | 242 pEdit->SetSel(fa.nSelStart, fa.nSelEnd); |
248 » » » » pEdit->ReplaceSel(fa.sChange); | 243 » » » » pEdit->ReplaceSel(fa.sChange.c_str()); |
249 } | 244 } |
250 } | 245 } |
251 break; | 246 break; |
252 default: | 247 default: |
253 break; | 248 break; |
254 } | 249 } |
255 } | 250 } |
256 | 251 |
257 FX_BOOL CFFL_ComboBox::IsActionDataChanged(CPDF_AAction::AActionType type, const
PDFSDK_FieldAction& faOld, | 252 FX_BOOL CFFL_ComboBox::IsActionDataChanged(CPDF_AAction::AActionType type, const
PDFSDK_FieldAction& faOld, |
258 const PD
FSDK_FieldAction& faNew) | 253 const PD
FSDK_FieldAction& faNew) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 ASSERT(pPageView != NULL); | 285 ASSERT(pPageView != NULL); |
291 | 286 |
292 if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, T
RUE)) | 287 if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, T
RUE)) |
293 { | 288 { |
294 if (m_State.nIndex >= 0) | 289 if (m_State.nIndex >= 0) |
295 pComboBox->SetSelect(m_State.nIndex); | 290 pComboBox->SetSelect(m_State.nIndex); |
296 else | 291 else |
297 { | 292 { |
298 if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) | 293 if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) |
299 { | 294 { |
300 » » » » pEdit->SetText(m_State.sValue); | 295 » » » » pEdit->SetText(m_State.sValue.c_str()); |
301 pEdit->SetSel(m_State.nStart, m_State.nEnd); | 296 pEdit->SetSel(m_State.nStart, m_State.nEnd); |
302 } | 297 } |
303 } | 298 } |
304 } | 299 } |
305 } | 300 } |
306 | 301 |
307 CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRe
storeValue) | 302 CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRe
storeValue) |
308 { | 303 { |
309 if (bRestoreValue) | 304 if (bRestoreValue) |
310 SaveState(pPageView); | 305 SaveState(pPageView); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 if (CPDF_FormField * pFormField = m_pWidget->GetFormField()) | 441 if (CPDF_FormField * pFormField = m_pWidget->GetFormField()) |
447 { | 442 { |
448 swRet = pFormField->GetOptionValue(nExport); | 443 swRet = pFormField->GetOptionValue(nExport); |
449 if (swRet.IsEmpty()) | 444 if (swRet.IsEmpty()) |
450 swRet = pFormField->GetOptionLabel(nExport); | 445 swRet = pFormField->GetOptionLabel(nExport); |
451 } | 446 } |
452 } | 447 } |
453 | 448 |
454 return swRet; | 449 return swRet; |
455 } | 450 } |
OLD | NEW |