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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 78 } |
79 | 79 |
80 | 80 |
81 FX_BOOL CFFL_ComboBox::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFla
gs) | 81 FX_BOOL CFFL_ComboBox::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFla
gs) |
82 { | 82 { |
83 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); | 83 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); |
84 } | 84 } |
85 | 85 |
86 FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) | 86 FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) |
87 { | 87 { |
88 » if (CPWL_ComboBox * pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE
)) | 88 CPWL_ComboBox* pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE); |
89 » { | 89 » if (!pWnd) |
90 » » int32_t nCurSel = pWnd->GetSelect(); | 90 return FALSE; |
91 | 91 |
92 » » ASSERT(m_pWidget != NULL); | 92 int32_t nCurSel = pWnd->GetSelect(); |
| 93 » if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT)) |
| 94 return nCurSel != m_pWidget->GetSelectedIndex(0); |
93 | 95 |
94 » » if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT) | 96 if (nCurSel >= 0) |
95 » » { | 97 return nCurSel != m_pWidget->GetSelectedIndex(0); |
96 » » » if (nCurSel >= 0) | |
97 » » » { | |
98 » » » » return nCurSel != m_pWidget->GetSelectedIndex(0)
; | |
99 » » » } | |
100 » » » else | |
101 » » » { | |
102 » » » » return pWnd->GetText() != m_pWidget->GetValue(); | |
103 » » » } | |
104 » » } | |
105 » » else | |
106 » » { | |
107 » » » return nCurSel != m_pWidget->GetSelectedIndex(0); | |
108 » » } | |
109 » } | |
110 | 98 |
111 » return FALSE; | 99 return pWnd->GetText() != m_pWidget->GetValue(); |
112 } | 100 } |
113 | 101 |
114 void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) | 102 void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) |
115 { | 103 { |
116 ASSERT(m_pWidget != NULL); | 104 ASSERT(m_pWidget != NULL); |
117 | 105 |
118 if (CPWL_ComboBox* pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)
) | 106 if (CPWL_ComboBox* pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)
) |
119 { | 107 { |
120 CFX_WideString swText = pWnd->GetText(); | 108 CFX_WideString swText = pWnd->GetText(); |
121 int32_t nCurSel = pWnd->GetSelect(); | 109 int32_t nCurSel = pWnd->GetSelect(); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 if (CPDF_FormField * pFormField = m_pWidget->GetFormField()) | 381 if (CPDF_FormField * pFormField = m_pWidget->GetFormField()) |
394 { | 382 { |
395 swRet = pFormField->GetOptionValue(nExport); | 383 swRet = pFormField->GetOptionValue(nExport); |
396 if (swRet.IsEmpty()) | 384 if (swRet.IsEmpty()) |
397 swRet = pFormField->GetOptionLabel(nExport); | 385 swRet = pFormField->GetOptionLabel(nExport); |
398 } | 386 } |
399 } | 387 } |
400 | 388 |
401 return swRet; | 389 return swRet; |
402 } | 390 } |
OLD | NEW |