Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: fpdfsdk/src/formfiller/FFL_ComboBox.cpp

Issue 1243883003: Fix else-after-returns throughout pdfium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, Address comments. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxge/win32/fx_win32_print.cpp ('k') | fpdfsdk/src/formfiller/FFL_IFormFiller.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "../../include/formfiller/FFL_ComboBox.h" 11 #include "../../include/formfiller/FFL_ComboBox.h"
12 12
13 13
14 /* ------------------------------- CFFL_ComboBox ------------------------------- */ 14 /* ------------------------------- CFFL_ComboBox ------------------------------- */
15 15
16 CFFL_ComboBox::CFFL_ComboBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot) : 16 CFFL_ComboBox::CFFL_ComboBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot) :
17 » CFFL_FormFiller(pApp, pAnnot), m_pFontMap( NULL ) 17 CFFL_FormFiller(pApp, pAnnot), m_pFontMap( NULL )
18 { 18 {
19 m_State.nIndex = 0; 19 m_State.nIndex = 0;
20 m_State.nStart = 0; 20 m_State.nStart = 0;
21 m_State.nEnd = 0; 21 m_State.nEnd = 0;
22 } 22 }
23 23
24 CFFL_ComboBox::~CFFL_ComboBox() 24 CFFL_ComboBox::~CFFL_ComboBox()
25 { 25 {
26 delete m_pFontMap; 26 delete m_pFontMap;
27 } 27 }
28 28
29 PWL_CREATEPARAM CFFL_ComboBox::GetCreateParam() 29 PWL_CREATEPARAM CFFL_ComboBox::GetCreateParam()
30 { 30 {
31 » PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); 31 PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam();
32 32
33 » ASSERT(m_pWidget != NULL); 33 ASSERT(m_pWidget != NULL);
34 34
35 » int nFlags = m_pWidget->GetFieldFlags(); 35 int nFlags = m_pWidget->GetFieldFlags();
36 36
37 » if (nFlags & FIELDFLAG_EDIT) 37 if (nFlags & FIELDFLAG_EDIT)
38 » { 38 {
39 » » cp.dwFlags |= PCBS_ALLOWCUSTOMTEXT; 39 cp.dwFlags |= PCBS_ALLOWCUSTOMTEXT;
40 » } 40 }
41 41
42 » if (!m_pFontMap) 42 if (!m_pFontMap)
43 » { 43 {
44 » » m_pFontMap = new CBA_FontMap(m_pWidget, GetSystemHandler()); 44 m_pFontMap = new CBA_FontMap(m_pWidget, GetSystemHandler());
45 » » m_pFontMap->Initial(); 45 m_pFontMap->Initial();
46 » } 46 }
47 47
48 » cp.pFontMap = m_pFontMap; 48 cp.pFontMap = m_pFontMap;
49 » cp.pFocusHandler = this; 49 cp.pFocusHandler = this;
50 50
51 » return cp; 51 return cp;
52 } 52 }
53 53
54 CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVie w* pPageView) 54 CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVie w* pPageView)
55 { 55 {
56 » CPWL_ComboBox * pWnd = new CPWL_ComboBox(); 56 CPWL_ComboBox * pWnd = new CPWL_ComboBox();
57 » pWnd->AttachFFLData(this); 57 pWnd->AttachFFLData(this);
58 » pWnd->Create(cp); 58 pWnd->Create(cp);
59 59
60 » CFFL_IFormFiller* pFormFiller = m_pApp->GetIFormFiller(); 60 CFFL_IFormFiller* pFormFiller = m_pApp->GetIFormFiller();
61 » pWnd->SetFillerNotify(pFormFiller); 61 pWnd->SetFillerNotify(pFormFiller);
62 62
63 » int32_t nCurSel = m_pWidget->GetSelectedIndex(0); 63 int32_t nCurSel = m_pWidget->GetSelectedIndex(0);
64 » CFX_WideString swText; 64 CFX_WideString swText;
65 » if (nCurSel < 0) 65 if (nCurSel < 0)
66 » » swText = m_pWidget->GetValue(); 66 swText = m_pWidget->GetValue();
67 » else 67 else
68 » » swText = m_pWidget->GetOptionLabel(nCurSel); 68 swText = m_pWidget->GetOptionLabel(nCurSel);
69 69
70 » for (int32_t i=0,sz=m_pWidget->CountOptions(); i<sz; i++) 70 for (int32_t i=0,sz=m_pWidget->CountOptions(); i<sz; i++)
71 » { 71 {
72 » » pWnd->AddString(m_pWidget->GetOptionLabel(i).c_str()); 72 pWnd->AddString(m_pWidget->GetOptionLabel(i).c_str());
73 » } 73 }
74 74
75 » pWnd->SetSelect(nCurSel); 75 pWnd->SetSelect(nCurSel);
76 » pWnd->SetText(swText.c_str()); 76 pWnd->SetText(swText.c_str());
77 » return pWnd; 77 return pWnd;
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 93 if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT))
94 » » if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT) 94 return nCurSel != m_pWidget->GetSelectedIndex(0);
95 » » { 95
96 » » » if (nCurSel >= 0) 96 if (nCurSel >= 0)
97 » » » { 97 return nCurSel != m_pWidget->GetSelectedIndex(0);
98 » » » » return nCurSel != m_pWidget->GetSelectedIndex(0) ; 98
99 » » » } 99 return pWnd->GetText() != m_pWidget->GetValue();
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
111 » return FALSE;
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();
122 110
123 » » //mantis:0004157 111 //mantis:0004157
124 » » FX_BOOL bSetValue = TRUE; 112 FX_BOOL bSetValue = TRUE;
125 113
126 » » if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT) 114 if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT)
127 » » { 115 {
128 » » » if (nCurSel >= 0) 116 if (nCurSel >= 0)
129 » » » { 117 {
130 » » » » if (swText != m_pWidget->GetOptionLabel(nCurSel) ) 118 if (swText != m_pWidget->GetOptionLabel(nCurSel))
131 » » » » » bSetValue = TRUE; 119 bSetValue = TRUE;
132 » » » » else 120 else
133 » » » » » bSetValue = FALSE; 121 bSetValue = FALSE;
134 » » » } 122 }
135 » » » else 123 else
136 » » » » bSetValue = TRUE; 124 bSetValue = TRUE;
137 » » } 125 }
138 » » else 126 else
139 » » » bSetValue = FALSE; 127 bSetValue = FALSE;
140 128
141 » » CFX_WideString sOldValue; 129 CFX_WideString sOldValue;
142 130
143 131
144 » » if (bSetValue) 132 if (bSetValue)
145 » » { 133 {
146 » » » sOldValue = m_pWidget->GetValue(); 134 sOldValue = m_pWidget->GetValue();
147 » » » m_pWidget->SetValue(swText, FALSE); 135 m_pWidget->SetValue(swText, FALSE);
148 » » } 136 }
149 » » else 137 else
150 » » { 138 {
151 » » » m_pWidget->GetSelectedIndex(0); 139 m_pWidget->GetSelectedIndex(0);
152 » » » m_pWidget->SetOptionSelection(nCurSel, TRUE, FALSE); 140 m_pWidget->SetOptionSelection(nCurSel, TRUE, FALSE);
153 » » } 141 }
154 142
155 » » m_pWidget->ResetFieldAppearance(TRUE); 143 m_pWidget->ResetFieldAppearance(TRUE);
156 » » m_pWidget->UpdateField(); 144 m_pWidget->UpdateField();
157 » » SetChangeMark(); 145 SetChangeMark();
158 146
159 » » m_pWidget->GetPDFPage(); 147 m_pWidget->GetPDFPage();
160 148
161 149
162 » } 150 }
163 } 151 }
164 152
165 void CFFL_ComboBox::GetActionData( CPDFSDK_PageView* pPageView, CPDF_AAction::A ActionType type, PDFSDK_FieldAction& fa) 153 void CFFL_ComboBox::GetActionData( CPDFSDK_PageView* pPageView, CPDF_AAction::A ActionType type, PDFSDK_FieldAction& fa)
166 { 154 {
167 » switch (type) 155 switch (type)
168 » { 156 {
169 » case CPDF_AAction::KeyStroke: 157 case CPDF_AAction::KeyStroke:
170 » » if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPag eView, FALSE)) 158 if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, F ALSE))
171 » » { 159 {
172 » » » if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) 160 if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox)
173 » » » { 161 {
174 » » » » fa.bFieldFull = pEdit->IsTextFull(); 162 fa.bFieldFull = pEdit->IsTextFull();
175 » » » » int nSelStart = 0; 163 int nSelStart = 0;
176 » » » » int nSelEnd = 0; 164 int nSelEnd = 0;
177 » » » » pEdit->GetSel(nSelStart, nSelEnd); 165 pEdit->GetSel(nSelStart, nSelEnd);
178 » » » » fa.nSelEnd = nSelEnd; 166 fa.nSelEnd = nSelEnd;
179 » » » » fa.nSelStart = nSelStart; 167 fa.nSelStart = nSelStart;
180 » » » » fa.sValue = pEdit->GetText(); 168 fa.sValue = pEdit->GetText();
181 » » » » fa.sChangeEx = GetSelectExportText(); 169 fa.sChangeEx = GetSelectExportText();
182 170
183 » » » » if (fa.bFieldFull) 171 if (fa.bFieldFull)
184 » » » » { 172 {
185 » » » » » fa.sChange = L""; 173 fa.sChange = L"";
186 » » » » » fa.sChangeEx = L""; 174 fa.sChangeEx = L"";
187 » » » » } 175 }
188 » » » } 176 }
189 » » } 177 }
190 » » break; 178 break;
191 » case CPDF_AAction::Validate: 179 case CPDF_AAction::Validate:
192 » » if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPag eView, FALSE)) 180 if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, F ALSE))
193 » » { 181 {
194 » » » if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) 182 if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox)
195 » » » { 183 {
196 » » » » fa.sValue = pEdit->GetText(); 184 fa.sValue = pEdit->GetText();
197 » » » } 185 }
198 » » } 186 }
199 » » break; 187 break;
200 » case CPDF_AAction::LoseFocus: 188 case CPDF_AAction::LoseFocus:
201 » case CPDF_AAction::GetFocus: 189 case CPDF_AAction::GetFocus:
202 » » ASSERT(m_pWidget != NULL); 190 ASSERT(m_pWidget != NULL);
203 » » fa.sValue = m_pWidget->GetValue(); 191 fa.sValue = m_pWidget->GetValue();
204 » » break; 192 break;
205 » default: 193 default:
206 » » break; 194 break;
207 » } 195 }
208 } 196 }
209 197
210 198
211 199
212 void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AAc tionType type, 200 void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AAc tionType type,
213 » » » » » » » » » const PD FSDK_FieldAction& fa) 201 const PDFSDK_FieldAction& fa)
214 { 202 {
215 » switch (type) 203 switch (type)
216 » { 204 {
217 » case CPDF_AAction::KeyStroke: 205 case CPDF_AAction::KeyStroke:
218 » » if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPag eView, FALSE)) 206 if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, F ALSE))
219 » » { 207 {
220 » » » if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) 208 if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox)
221 » » » { 209 {
222 » » » » pEdit->SetSel(fa.nSelStart, fa.nSelEnd); 210 pEdit->SetSel(fa.nSelStart, fa.nSelEnd);
223 » » » » pEdit->ReplaceSel(fa.sChange.c_str()); 211 pEdit->ReplaceSel(fa.sChange.c_str());
224 » » » } 212 }
225 » » } 213 }
226 » » break; 214 break;
227 » default: 215 default:
228 » » break; 216 break;
229 » } 217 }
230 } 218 }
231 219
232 FX_BOOL»CFFL_ComboBox::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, 220 FX_BOOL CFFL_ComboBox::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld,
233 » » » » » » » » » const PD FSDK_FieldAction& faNew) 221 const PDFSDK_FieldAction& faNew)
234 { 222 {
235 » switch (type) 223 switch (type)
236 » { 224 {
237 » case CPDF_AAction::KeyStroke: 225 case CPDF_AAction::KeyStroke:
238 » » return (!faOld.bFieldFull && faOld.nSelEnd != faNew.nSelEnd) || faOld.nSelStart != faNew.nSelStart || 226 return (!faOld.bFieldFull && faOld.nSelEnd != faNew.nSelEnd) || faOld.nS elStart != faNew.nSelStart ||
239 » » » faOld.sChange != faNew.sChange; 227 faOld.sChange != faNew.sChange;
240 » default: 228 default:
241 » » break; 229 break;
242 » } 230 }
243 231
244 » return FALSE; 232 return FALSE;
245 } 233 }
246 234
247 void CFFL_ComboBox::SaveState(CPDFSDK_PageView* pPageView) 235 void CFFL_ComboBox::SaveState(CPDFSDK_PageView* pPageView)
248 { 236 {
249 » ASSERT(pPageView != NULL); 237 ASSERT(pPageView != NULL);
250 238
251 » if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, F ALSE)) 239 if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE ))
252 » { 240 {
253 » » m_State.nIndex = pComboBox->GetSelect(); 241 m_State.nIndex = pComboBox->GetSelect();
254 242
255 » » if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) 243 if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox)
256 » » { 244 {
257 » » » pEdit->GetSel(m_State.nStart, m_State.nEnd); 245 pEdit->GetSel(m_State.nStart, m_State.nEnd);
258 » » » m_State.sValue = pEdit->GetText(); 246 m_State.sValue = pEdit->GetText();
259 » » } 247 }
260 » } 248 }
261 } 249 }
262 250
263 void CFFL_ComboBox::RestoreState(CPDFSDK_PageView* pPageView) 251 void CFFL_ComboBox::RestoreState(CPDFSDK_PageView* pPageView)
264 { 252 {
265 » ASSERT(pPageView != NULL); 253 ASSERT(pPageView != NULL);
266 254
267 » if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, T RUE)) 255 if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, TRUE) )
268 » { 256 {
269 » » if (m_State.nIndex >= 0) 257 if (m_State.nIndex >= 0)
270 » » » pComboBox->SetSelect(m_State.nIndex); 258 pComboBox->SetSelect(m_State.nIndex);
271 » » else 259 else
272 » » { 260 {
273 » » » if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) 261 if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox)
274 » » » { 262 {
275 » » » » pEdit->SetText(m_State.sValue.c_str()); 263 pEdit->SetText(m_State.sValue.c_str());
276 » » » » pEdit->SetSel(m_State.nStart, m_State.nEnd); 264 pEdit->SetSel(m_State.nStart, m_State.nEnd);
277 » » » } 265 }
278 » » } 266 }
279 » } 267 }
280 } 268 }
281 269
282 CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRe storeValue) 270 CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRe storeValue)
283 { 271 {
284 » if (bRestoreValue) 272 if (bRestoreValue)
285 » » SaveState(pPageView); 273 SaveState(pPageView);
286 274
287 » DestroyPDFWindow(pPageView); 275 DestroyPDFWindow(pPageView);
288 276
289 » CPWL_Wnd* pRet = NULL; 277 CPWL_Wnd* pRet = NULL;
290 278
291 » if (bRestoreValue) 279 if (bRestoreValue)
292 » { 280 {
293 » » RestoreState(pPageView); 281 RestoreState(pPageView);
294 » » pRet = GetPDFWindow(pPageView, FALSE); 282 pRet = GetPDFWindow(pPageView, FALSE);
295 » } 283 }
296 » else 284 else
297 » » pRet = GetPDFWindow(pPageView, TRUE); 285 pRet = GetPDFWindow(pPageView, TRUE);
298 286
299 » m_pWidget->UpdateField(); 287 m_pWidget->UpdateField();
300 288
301 » return pRet; 289 return pRet;
302 } 290 }
303 291
304 void CFFL_ComboBox::OnKeyStroke(FX_BOOL bKeyDown, FX_UINT nFlag) 292 void CFFL_ComboBox::OnKeyStroke(FX_BOOL bKeyDown, FX_UINT nFlag)
305 { 293 {
306 » ASSERT(m_pWidget != NULL); 294 ASSERT(m_pWidget != NULL);
307 295
308 » int nFlags = m_pWidget->GetFieldFlags(); 296 int nFlags = m_pWidget->GetFieldFlags();
309 297
310 » if (nFlags & FIELDFLAG_COMMITONSELCHANGE) 298 if (nFlags & FIELDFLAG_COMMITONSELCHANGE)
311 » { 299 {
312 » » if (m_bValid) 300 if (m_bValid)
313 » » { 301 {
314 » » » CPDFSDK_PageView* pPageView = GetCurPageView(); 302 CPDFSDK_PageView* pPageView = GetCurPageView();
315 » » » ASSERT(pPageView != NULL); 303 ASSERT(pPageView != NULL);
316 304
317 » » » if (CommitData(pPageView, nFlag)) 305 if (CommitData(pPageView, nFlag))
318 » » » { 306 {
319 » » » » DestroyPDFWindow(pPageView); 307 DestroyPDFWindow(pPageView);
320 » » » » m_bValid = FALSE; 308 m_bValid = FALSE;
321 » » » } 309 }
322 » » } 310 }
323 » } 311 }
324 } 312 }
325 313
326 void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd) 314 void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd)
327 { 315 {
328 » ASSERT(m_pApp != NULL); 316 ASSERT(m_pApp != NULL);
329 317
330 » ASSERT(pWnd != NULL); 318 ASSERT(pWnd != NULL);
331 319
332 » if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) 320 if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT)
333 » { 321 {
334 » » CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; 322 CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
335 » » pEdit->SetCharSet(134); 323 pEdit->SetCharSet(134);
336 » » pEdit->SetCodePage(936); 324 pEdit->SetCodePage(936);
337 325
338 » » pEdit->SetReadyToInput(); 326 pEdit->SetReadyToInput();
339 » » CFX_WideString wsText = pEdit->GetText(); 327 CFX_WideString wsText = pEdit->GetText();
340 » » int nCharacters = wsText.GetLength(); 328 int nCharacters = wsText.GetLength();
341 » » CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); 329 CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
342 » » unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); 330 unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str();
343 » » m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuf fer, nCharacters, TRUE); 331 m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, nCh aracters, TRUE);
344 332
345 » » pEdit->SetEditNotify(this); 333 pEdit->SetEditNotify(this);
346 » } 334 }
347 } 335 }
348 336
349 void CFFL_ComboBox::OnKillFocus(CPWL_Wnd* pWnd) 337 void CFFL_ComboBox::OnKillFocus(CPWL_Wnd* pWnd)
350 { 338 {
351 » ASSERT(m_pApp != NULL); 339 ASSERT(m_pApp != NULL);
352 } 340 }
353 341
354 FX_BOOL»CFFL_ComboBox::CanCopy(CPDFSDK_Document* pDocument) 342 FX_BOOL CFFL_ComboBox::CanCopy(CPDFSDK_Document* pDocument)
355 { 343 {
356 » ASSERT(pDocument != NULL); 344 ASSERT(pDocument != NULL);
357 345
358 » return FALSE; 346 return FALSE;
359 } 347 }
360 348
361 FX_BOOL CFFL_ComboBox::CanCut(CPDFSDK_Document* pDocument) 349 FX_BOOL CFFL_ComboBox::CanCut(CPDFSDK_Document* pDocument)
362 { 350 {
363 » ASSERT(pDocument != NULL); 351 ASSERT(pDocument != NULL);
364 352
365 » return FALSE; 353 return FALSE;
366 } 354 }
367 355
368 FX_BOOL»CFFL_ComboBox::CanPaste(CPDFSDK_Document* pDocument) 356 FX_BOOL CFFL_ComboBox::CanPaste(CPDFSDK_Document* pDocument)
369 { 357 {
370 » ASSERT(pDocument != NULL); 358 ASSERT(pDocument != NULL);
371 359
372 » return FALSE; 360 return FALSE;
373 } 361 }
374 362
375 void CFFL_ComboBox::OnAddUndo(CPWL_Edit* pEdit) 363 void CFFL_ComboBox::OnAddUndo(CPWL_Edit* pEdit)
376 { 364 {
377 » ASSERT(pEdit != NULL); 365 ASSERT(pEdit != NULL);
378 } 366 }
379 367
380 CFX_WideString CFFL_ComboBox::GetSelectExportText() 368 CFX_WideString CFFL_ComboBox::GetSelectExportText()
381 { 369 {
382 » CFX_WideString swRet; 370 CFX_WideString swRet;
383 371
384 » int nExport = -1; 372 int nExport = -1;
385 » CPDFSDK_PageView *pPageView = GetCurPageView(); 373 CPDFSDK_PageView *pPageView = GetCurPageView();
386 » if (CPWL_ComboBox * pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) 374 if (CPWL_ComboBox * pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALS E))
387 » { 375 {
388 » » nExport = pComboBox->GetSelect(); 376 nExport = pComboBox->GetSelect();
389 » } 377 }
390 378
391 » if (nExport >= 0) 379 if (nExport >= 0)
392 » { 380 {
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 }
OLDNEW
« no previous file with comments | « core/src/fxge/win32/fx_win32_print.cpp ('k') | fpdfsdk/src/formfiller/FFL_IFormFiller.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698