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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 CFFL_IFormFiller* pFormFiller = m_pApp->GetIFormFiller(); | 80 CFFL_IFormFiller* pFormFiller = m_pApp->GetIFormFiller(); |
81 pWnd->SetFillerNotify(pFormFiller); | 81 pWnd->SetFillerNotify(pFormFiller); |
82 | 82 |
83 » FX_INT32 nCurSel = m_pWidget->GetSelectedIndex(0); | 83 » int32_t nCurSel = m_pWidget->GetSelectedIndex(0); |
84 CFX_WideString swText; | 84 CFX_WideString swText; |
85 if (nCurSel < 0) | 85 if (nCurSel < 0) |
86 swText = m_pWidget->GetValue(); | 86 swText = m_pWidget->GetValue(); |
87 else | 87 else |
88 swText = m_pWidget->GetOptionLabel(nCurSel); | 88 swText = m_pWidget->GetOptionLabel(nCurSel); |
89 | 89 |
90 » for (FX_INT32 i=0,sz=m_pWidget->CountOptions(); i<sz; i++) | 90 » for (int32_t i=0,sz=m_pWidget->CountOptions(); i<sz; i++) |
91 { | 91 { |
92 pWnd->AddString(m_pWidget->GetOptionLabel(i).c_str()); | 92 pWnd->AddString(m_pWidget->GetOptionLabel(i).c_str()); |
93 } | 93 } |
94 | 94 |
95 pWnd->SetSelect(nCurSel); | 95 pWnd->SetSelect(nCurSel); |
96 pWnd->SetText(swText.c_str()); | 96 pWnd->SetText(swText.c_str()); |
97 return pWnd; | 97 return pWnd; |
98 } | 98 } |
99 | 99 |
100 | 100 |
101 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) |
102 { | 102 { |
103 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); | 103 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); |
104 } | 104 } |
105 | 105 |
106 FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) | 106 FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) |
107 { | 107 { |
108 if (CPWL_ComboBox * pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE
)) | 108 if (CPWL_ComboBox * pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE
)) |
109 { | 109 { |
110 » » FX_INT32 nCurSel = pWnd->GetSelect(); | 110 » » int32_t nCurSel = pWnd->GetSelect(); |
111 | 111 |
112 ASSERT(m_pWidget != NULL); | 112 ASSERT(m_pWidget != NULL); |
113 | 113 |
114 if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT) | 114 if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT) |
115 { | 115 { |
116 if (nCurSel >= 0) | 116 if (nCurSel >= 0) |
117 { | 117 { |
118 return nCurSel != m_pWidget->GetSelectedIndex(0)
; | 118 return nCurSel != m_pWidget->GetSelectedIndex(0)
; |
119 } | 119 } |
120 else | 120 else |
(...skipping 10 matching lines...) Expand all Loading... |
131 return FALSE; | 131 return FALSE; |
132 } | 132 } |
133 | 133 |
134 void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) | 134 void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) |
135 { | 135 { |
136 ASSERT(m_pWidget != NULL); | 136 ASSERT(m_pWidget != NULL); |
137 | 137 |
138 if (CPWL_ComboBox* pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)
) | 138 if (CPWL_ComboBox* pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)
) |
139 { | 139 { |
140 CFX_WideString swText = pWnd->GetText(); | 140 CFX_WideString swText = pWnd->GetText(); |
141 » » FX_INT32 nCurSel = pWnd->GetSelect(); | 141 » » int32_t nCurSel = pWnd->GetSelect(); |
142 | 142 |
143 //mantis:0004157 | 143 //mantis:0004157 |
144 FX_BOOL bSetValue = TRUE; | 144 FX_BOOL bSetValue = TRUE; |
145 | 145 |
146 if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT) | 146 if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT) |
147 { | 147 { |
148 if (nCurSel >= 0) | 148 if (nCurSel >= 0) |
149 { | 149 { |
150 if (swText != m_pWidget->GetOptionLabel(nCurSel)
) | 150 if (swText != m_pWidget->GetOptionLabel(nCurSel)
) |
151 bSetValue = TRUE; | 151 bSetValue = TRUE; |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 if (CPDF_FormField * pFormField = m_pWidget->GetFormField()) | 441 if (CPDF_FormField * pFormField = m_pWidget->GetFormField()) |
442 { | 442 { |
443 swRet = pFormField->GetOptionValue(nExport); | 443 swRet = pFormField->GetOptionValue(nExport); |
444 if (swRet.IsEmpty()) | 444 if (swRet.IsEmpty()) |
445 swRet = pFormField->GetOptionLabel(nExport); | 445 swRet = pFormField->GetOptionLabel(nExport); |
446 } | 446 } |
447 } | 447 } |
448 | 448 |
449 return swRet; | 449 return swRet; |
450 } | 450 } |
OLD | NEW |