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/FFL_TextField.h" | 7 #include "../../include/formfiller/FFL_TextField.h" |
8 #include "../../include/formfiller/FFL_CBA_Fontmap.h" | 8 #include "../../include/formfiller/FFL_CBA_Fontmap.h" |
9 | 9 |
10 /* ------------------------------- CFFL_TextField ------------------------------
- */ | 10 /* ------------------------------- CFFL_TextField ------------------------------
- */ |
11 | 11 |
12 CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot)
: | 12 CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot)
: |
13 » CFFL_FormFiller(pApp, pAnnot), | 13 CFFL_FormFiller(pApp, pAnnot), |
14 » m_pFontMap(NULL)//, | 14 m_pFontMap(NULL)//, |
15 » //m_pSpellCheck(NULL) | 15 //m_pSpellCheck(NULL) |
16 { | 16 { |
17 » m_State.nStart = m_State.nEnd = 0; | 17 m_State.nStart = m_State.nEnd = 0; |
18 } | 18 } |
19 | 19 |
20 CFFL_TextField::~CFFL_TextField() | 20 CFFL_TextField::~CFFL_TextField() |
21 { | 21 { |
22 delete m_pFontMap; | 22 delete m_pFontMap; |
23 } | 23 } |
24 | 24 |
25 PWL_CREATEPARAM CFFL_TextField::GetCreateParam() | 25 PWL_CREATEPARAM CFFL_TextField::GetCreateParam() |
26 { | 26 { |
27 » PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); | 27 PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); |
28 | 28 |
29 » ASSERT(m_pWidget != NULL); | 29 ASSERT(m_pWidget != NULL); |
30 » int nFlags = m_pWidget->GetFieldFlags(); | 30 int nFlags = m_pWidget->GetFieldFlags(); |
31 | 31 |
32 | 32 |
33 » if (nFlags & FIELDFLAG_PASSWORD) | 33 if (nFlags & FIELDFLAG_PASSWORD) |
34 » { | 34 { |
35 » » cp.dwFlags |= PES_PASSWORD; | 35 cp.dwFlags |= PES_PASSWORD; |
36 » } | 36 } |
37 | 37 |
38 » if (!(nFlags & FIELDFLAG_DONOTSPELLCHECK)) | 38 if (!(nFlags & FIELDFLAG_DONOTSPELLCHECK)) |
39 » { | 39 { |
40 » } | 40 } |
41 | 41 |
42 » if (nFlags & FIELDFLAG_MULTILINE) | 42 if (nFlags & FIELDFLAG_MULTILINE) |
43 » { | 43 { |
44 » » cp.dwFlags |= PES_MULTILINE | PES_AUTORETURN | PES_TOP; | 44 cp.dwFlags |= PES_MULTILINE | PES_AUTORETURN | PES_TOP; |
45 | 45 |
46 » » if (!(nFlags & FIELDFLAG_DONOTSCROLL)) | 46 if (!(nFlags & FIELDFLAG_DONOTSCROLL)) |
47 » » { | 47 { |
48 » » » cp.dwFlags |= PWS_VSCROLL | PES_AUTOSCROLL; | 48 cp.dwFlags |= PWS_VSCROLL | PES_AUTOSCROLL; |
49 » » } | 49 } |
50 » } | 50 } |
51 » else | 51 else |
52 » { | 52 { |
53 » » cp.dwFlags |= PES_CENTER; | 53 cp.dwFlags |= PES_CENTER; |
54 | 54 |
55 » » if (!(nFlags & FIELDFLAG_DONOTSCROLL)) | 55 if (!(nFlags & FIELDFLAG_DONOTSCROLL)) |
56 » » { | 56 { |
57 » » » cp.dwFlags |= PES_AUTOSCROLL; | 57 cp.dwFlags |= PES_AUTOSCROLL; |
58 » » } | 58 } |
59 » } | 59 } |
60 | 60 |
61 » if (nFlags & FIELDFLAG_COMB) | 61 if (nFlags & FIELDFLAG_COMB) |
62 » { | 62 { |
63 » » cp.dwFlags |= PES_CHARARRAY; | 63 cp.dwFlags |= PES_CHARARRAY; |
64 » } | 64 } |
65 | 65 |
66 » if (nFlags & FIELDFLAG_RICHTEXT) | 66 if (nFlags & FIELDFLAG_RICHTEXT) |
67 » { | 67 { |
68 » » cp.dwFlags |= PES_RICH; | 68 cp.dwFlags |= PES_RICH; |
69 » } | 69 } |
70 | 70 |
71 » cp.dwFlags |= PES_UNDO; | 71 cp.dwFlags |= PES_UNDO; |
72 | 72 |
73 » switch (m_pWidget->GetAlignment()) | 73 switch (m_pWidget->GetAlignment()) |
74 » { | 74 { |
75 » default: | 75 default: |
76 » case BF_ALIGN_LEFT: | 76 case BF_ALIGN_LEFT: |
77 » » cp.dwFlags |= PES_LEFT; | 77 cp.dwFlags |= PES_LEFT; |
78 » » break; | 78 break; |
79 » case BF_ALIGN_MIDDLE: | 79 case BF_ALIGN_MIDDLE: |
80 » » cp.dwFlags |= PES_MIDDLE; | 80 cp.dwFlags |= PES_MIDDLE; |
81 » » break; | 81 break; |
82 » case BF_ALIGN_RIGHT: | 82 case BF_ALIGN_RIGHT: |
83 » » cp.dwFlags |= PES_RIGHT; | 83 cp.dwFlags |= PES_RIGHT; |
84 » » break; | 84 break; |
85 » } | 85 } |
86 | 86 |
87 » if (!m_pFontMap) | 87 if (!m_pFontMap) |
88 » { | 88 { |
89 » » m_pFontMap = new CBA_FontMap(m_pWidget, m_pApp->GetSysHandler())
; | 89 m_pFontMap = new CBA_FontMap(m_pWidget, m_pApp->GetSysHandler()); |
90 » » m_pFontMap->Initial(); | 90 m_pFontMap->Initial(); |
91 » } | 91 } |
92 » cp.pFontMap = m_pFontMap; | 92 cp.pFontMap = m_pFontMap; |
93 » cp.pFocusHandler = this; | 93 cp.pFocusHandler = this; |
94 | 94 |
95 » return cp; | 95 return cp; |
96 } | 96 } |
97 | 97 |
98 CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVi
ew* pPageView) | 98 CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVi
ew* pPageView) |
99 { | 99 { |
100 » CPWL_Edit * pWnd = new CPWL_Edit(); | 100 CPWL_Edit * pWnd = new CPWL_Edit(); |
101 » » pWnd->AttachFFLData(this); | 101 pWnd->AttachFFLData(this); |
102 » pWnd->Create(cp); | 102 pWnd->Create(cp); |
103 | 103 |
104 | 104 |
105 | 105 |
106 » ASSERT(m_pApp != NULL); | 106 ASSERT(m_pApp != NULL); |
107 » CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); | 107 CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); |
108 » pWnd->SetFillerNotify(pIFormFiller); | 108 pWnd->SetFillerNotify(pIFormFiller); |
109 | 109 |
110 » ASSERT(m_pWidget != NULL); | 110 ASSERT(m_pWidget != NULL); |
111 » int32_t nMaxLen = m_pWidget->GetMaxLen(); | 111 int32_t nMaxLen = m_pWidget->GetMaxLen(); |
112 » CFX_WideString swValue = m_pWidget->GetValue(); | 112 CFX_WideString swValue = m_pWidget->GetValue(); |
113 | 113 |
114 » if (nMaxLen > 0) | 114 if (nMaxLen > 0) |
115 » { | 115 { |
116 » » if (pWnd->HasFlag(PES_CHARARRAY)) | 116 if (pWnd->HasFlag(PES_CHARARRAY)) |
117 » » { | 117 { |
118 » » » pWnd->SetCharArray(nMaxLen); | 118 pWnd->SetCharArray(nMaxLen); |
119 » » » pWnd->SetAlignFormatV(PEAV_CENTER); | 119 pWnd->SetAlignFormatV(PEAV_CENTER); |
120 » » } | 120 } |
121 » » else | 121 else |
122 » » { | 122 { |
123 » » » pWnd->SetLimitChar(nMaxLen); | 123 pWnd->SetLimitChar(nMaxLen); |
124 » » } | 124 } |
125 » } | 125 } |
126 | 126 |
127 » pWnd->SetText(swValue.c_str()); | 127 pWnd->SetText(swValue.c_str()); |
128 » return pWnd; | 128 return pWnd; |
129 } | 129 } |
130 | 130 |
131 | 131 |
132 FX_BOOL»CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFl
ags) | 132 FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFl
ags) |
133 { | 133 { |
134 » switch (nChar) | 134 switch (nChar) |
135 » { | 135 { |
136 » case FWL_VKEY_Return: | 136 case FWL_VKEY_Return: |
137 » » if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE)) | 137 if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE)) |
138 » » { | 138 { |
139 » » » CPDFSDK_PageView* pPageView = GetCurPageView(); | 139 CPDFSDK_PageView* pPageView = GetCurPageView(); |
140 » » » ASSERT(pPageView != NULL); | 140 ASSERT(pPageView != NULL); |
141 » » » m_bValid = !m_bValid; | 141 m_bValid = !m_bValid; |
142 » » » CPDF_Rect rcAnnot = pAnnot->GetRect(); | 142 CPDF_Rect rcAnnot = pAnnot->GetRect(); |
143 » » » m_pApp->FFI_Invalidate(pAnnot->GetPDFPage(), rcAnnot.lef
t, rcAnnot.top, rcAnnot.right, rcAnnot.bottom); | 143 m_pApp->FFI_Invalidate(pAnnot->GetPDFPage(), rcAnnot.left, rcAnnot.t
op, rcAnnot.right, rcAnnot.bottom); |
144 | 144 |
145 » » » if (m_bValid) | 145 if (m_bValid) |
146 » » » { | 146 { |
147 » » » » if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRU
E)) | 147 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) |
148 » » » » » pWnd->SetFocus(); | 148 pWnd->SetFocus(); |
149 » » » } | 149 } |
150 » » » else | 150 else |
151 » » » { | 151 { |
152 » » » » if (CommitData(pPageView, nFlags)) | 152 if (CommitData(pPageView, nFlags)) |
153 » » » » { | 153 { |
154 » » » » » DestroyPDFWindow(pPageView); | 154 DestroyPDFWindow(pPageView); |
155 » » » » » return TRUE; | 155 return TRUE; |
156 » » » » } | 156 } |
157 » » » » else | 157 return FALSE; |
158 » » » » { | 158 } |
159 » » » » » return FALSE; | 159 } |
160 » » » » } | 160 break; |
161 » » » } | 161 case FWL_VKEY_Escape: |
162 » » } | 162 { |
163 » » break; | 163 CPDFSDK_PageView* pPageView = GetCurPageView(); |
164 » case FWL_VKEY_Escape: | 164 ASSERT(pPageView != NULL); |
165 » » { | 165 EscapeFiller(pPageView,TRUE); |
166 » » » CPDFSDK_PageView* pPageView = GetCurPageView(); | 166 return TRUE; |
167 » » » ASSERT(pPageView != NULL); | 167 } |
168 » » » EscapeFiller(pPageView,TRUE); | 168 } |
169 » » » return TRUE; | 169 |
170 » » } | 170 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); |
171 » } | 171 } |
172 | 172 |
173 » return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); | 173 FX_BOOL CFFL_TextField::IsDataChanged(CPDFSDK_PageView* pPageView) |
174 } | 174 { |
175 | 175 ASSERT(m_pWidget != NULL); |
176 FX_BOOL»CFFL_TextField::IsDataChanged(CPDFSDK_PageView* pPageView) | 176 |
177 { | 177 if (CPWL_Edit * pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) |
178 » ASSERT(m_pWidget != NULL); | 178 return pEdit->GetText() != m_pWidget->GetValue(); |
179 | 179 |
180 » if (CPWL_Edit * pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) | 180 return FALSE; |
181 » » return pEdit->GetText() != m_pWidget->GetValue(); | |
182 | |
183 » return FALSE; | |
184 } | 181 } |
185 | 182 |
186 void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) | 183 void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) |
187 { | 184 { |
188 » ASSERT(m_pWidget != NULL); | 185 ASSERT(m_pWidget != NULL); |
189 | 186 |
190 » if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) | 187 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) |
191 » { | 188 { |
192 » » CFX_WideString sOldValue = m_pWidget->GetValue(); | 189 CFX_WideString sOldValue = m_pWidget->GetValue(); |
193 » » CFX_WideString sNewValue = pWnd->GetText(); | 190 CFX_WideString sNewValue = pWnd->GetText(); |
194 | 191 |
195 » » m_pWidget->SetValue(sNewValue, FALSE); | 192 m_pWidget->SetValue(sNewValue, FALSE); |
196 » » m_pWidget->ResetFieldAppearance(TRUE); | 193 m_pWidget->ResetFieldAppearance(TRUE); |
197 » » m_pWidget->UpdateField(); | 194 m_pWidget->UpdateField(); |
198 » » SetChangeMark(); | 195 SetChangeMark(); |
199 » } | 196 } |
200 } | 197 } |
201 | 198 |
202 void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA
ctionType type, | 199 void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA
ctionType type, |
203 » » » » » » » » » PDFSDK_F
ieldAction& fa) | 200 PDFSDK_FieldAction& fa) |
204 { | 201 { |
205 » switch (type) | 202 switch (type) |
206 » { | 203 { |
207 » case CPDF_AAction::KeyStroke: | 204 case CPDF_AAction::KeyStroke: |
208 » » if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)
) | 205 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) |
209 » » { | 206 { |
210 » » » fa.bFieldFull = pWnd->IsTextFull(); | 207 fa.bFieldFull = pWnd->IsTextFull(); |
211 | 208 |
212 » » » fa.sValue = pWnd->GetText(); | 209 fa.sValue = pWnd->GetText(); |
213 | 210 |
214 » » » if (fa.bFieldFull) | 211 if (fa.bFieldFull) |
215 » » » { | 212 { |
216 » » » » fa.sChange = L""; | 213 fa.sChange = L""; |
217 » » » » fa.sChangeEx = L""; | 214 fa.sChangeEx = L""; |
218 » » » } | 215 } |
219 » » } | 216 } |
220 » » break; | 217 break; |
221 » case CPDF_AAction::Validate: | 218 case CPDF_AAction::Validate: |
222 » » if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)
) | 219 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) |
223 » » { | 220 { |
224 » » » fa.sValue = pWnd->GetText(); | 221 fa.sValue = pWnd->GetText(); |
225 » » } | 222 } |
226 » » break; | 223 break; |
227 » case CPDF_AAction::LoseFocus: | 224 case CPDF_AAction::LoseFocus: |
228 » case CPDF_AAction::GetFocus: | 225 case CPDF_AAction::GetFocus: |
229 » » ASSERT(m_pWidget != NULL); | 226 ASSERT(m_pWidget != NULL); |
230 » » fa.sValue = m_pWidget->GetValue(); | 227 fa.sValue = m_pWidget->GetValue(); |
231 » » break; | 228 break; |
232 » default: | 229 default: |
233 » » break; | 230 break; |
234 » } | 231 } |
235 } | 232 } |
236 | 233 |
237 void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA
ctionType type, | 234 void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA
ctionType type, |
238 » » » » » » » » » const PD
FSDK_FieldAction& fa) | 235 const PDFSDK_FieldAction& fa) |
239 { | 236 { |
240 » switch (type) | 237 switch (type) |
241 » { | 238 { |
242 » case CPDF_AAction::KeyStroke: | 239 case CPDF_AAction::KeyStroke: |
243 » » if (CPWL_Edit * pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALS
E)) | 240 if (CPWL_Edit * pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) |
244 » » { | 241 { |
245 » » » pEdit->SetFocus(); | 242 pEdit->SetFocus(); |
246 » » » pEdit->SetSel(fa.nSelStart, fa.nSelEnd); | 243 pEdit->SetSel(fa.nSelStart, fa.nSelEnd); |
247 » » » pEdit->ReplaceSel(fa.sChange.c_str()); | 244 pEdit->ReplaceSel(fa.sChange.c_str()); |
248 » » } | 245 } |
249 » » break; | 246 break; |
250 » default: | 247 default: |
251 » » break; | 248 break; |
252 » } | 249 } |
253 } | 250 } |
254 | 251 |
255 | 252 |
256 FX_BOOL»CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, cons
t PDFSDK_FieldAction& faOld, | 253 FX_BOOL CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, cons
t PDFSDK_FieldAction& faOld, |
257 » » » » » » » » » const PD
FSDK_FieldAction& faNew) | 254 const PDFSDK_FieldAction& faNew) |
258 { | 255 { |
259 » switch (type) | 256 switch (type) |
260 » { | 257 { |
261 » case CPDF_AAction::KeyStroke: | 258 case CPDF_AAction::KeyStroke: |
262 » » return (!faOld.bFieldFull && faOld.nSelEnd != faNew.nSelEnd) ||
faOld.nSelStart != faNew.nSelStart || | 259 return (!faOld.bFieldFull && faOld.nSelEnd != faNew.nSelEnd) || faOld.nS
elStart != faNew.nSelStart || |
263 » » » faOld.sChange != faNew.sChange; | 260 faOld.sChange != faNew.sChange; |
264 » default: | 261 default: |
265 » » break; | 262 break; |
266 » } | 263 } |
267 | 264 |
268 » return FALSE; | 265 return FALSE; |
269 } | 266 } |
270 | 267 |
271 void CFFL_TextField::SaveState(CPDFSDK_PageView* pPageView) | 268 void CFFL_TextField::SaveState(CPDFSDK_PageView* pPageView) |
272 { | 269 { |
273 » ASSERT(pPageView != NULL); | 270 ASSERT(pPageView != NULL); |
274 | 271 |
275 » if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) | 272 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) |
276 » { | 273 { |
277 » » pWnd->GetSel(m_State.nStart, m_State.nEnd); | 274 pWnd->GetSel(m_State.nStart, m_State.nEnd); |
278 » » m_State.sValue = pWnd->GetText(); | 275 m_State.sValue = pWnd->GetText(); |
279 » } | 276 } |
280 } | 277 } |
281 | 278 |
282 void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView) | 279 void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView) |
283 { | 280 { |
284 » ASSERT(pPageView != NULL); | 281 ASSERT(pPageView != NULL); |
285 | 282 |
286 » if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, TRUE)) | 283 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, TRUE)) |
287 » { | 284 { |
288 » » pWnd->SetText(m_State.sValue.c_str()); | 285 pWnd->SetText(m_State.sValue.c_str()); |
289 » » pWnd->SetSel(m_State.nStart, m_State.nEnd); | 286 pWnd->SetSel(m_State.nStart, m_State.nEnd); |
290 » } | 287 } |
291 } | 288 } |
292 | 289 |
293 CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bR
estoreValue) | 290 CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bR
estoreValue) |
294 { | 291 { |
295 » if (bRestoreValue) | 292 if (bRestoreValue) |
296 » » SaveState(pPageView); | 293 SaveState(pPageView); |
297 | 294 |
298 » DestroyPDFWindow(pPageView); | 295 DestroyPDFWindow(pPageView); |
299 | 296 |
300 » CPWL_Wnd* pRet = NULL; | 297 CPWL_Wnd* pRet = NULL; |
301 | 298 |
302 » if (bRestoreValue) | 299 if (bRestoreValue) |
303 » { | 300 { |
304 » » RestoreState(pPageView); | 301 RestoreState(pPageView); |
305 » » pRet = GetPDFWindow(pPageView, FALSE); | 302 pRet = GetPDFWindow(pPageView, FALSE); |
306 » } | 303 } |
307 » else | 304 else |
308 » » pRet = GetPDFWindow(pPageView, TRUE); | 305 pRet = GetPDFWindow(pPageView, TRUE); |
309 | 306 |
310 » m_pWidget->UpdateField(); | 307 m_pWidget->UpdateField(); |
311 | 308 |
312 » return pRet; | 309 return pRet; |
313 } | 310 } |
314 | 311 |
315 void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) | 312 void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) |
316 { | 313 { |
317 » ASSERT(m_pApp != NULL); | 314 ASSERT(m_pApp != NULL); |
318 | 315 |
319 » ASSERT(pWnd != NULL); | 316 ASSERT(pWnd != NULL); |
320 | 317 |
321 » if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) | 318 if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) |
322 » { | 319 { |
323 » » CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; | 320 CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; |
324 » » pEdit->SetCharSet(134); | 321 pEdit->SetCharSet(134); |
325 » » pEdit->SetCodePage(936); | 322 pEdit->SetCodePage(936); |
326 | 323 |
327 » » pEdit->SetReadyToInput(); | 324 pEdit->SetReadyToInput(); |
328 » » CFX_WideString wsText = pEdit->GetText(); | 325 CFX_WideString wsText = pEdit->GetText(); |
329 » » int nCharacters = wsText.GetLength(); | 326 int nCharacters = wsText.GetLength(); |
330 » » CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); | 327 CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); |
331 » » unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); | 328 unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); |
332 » » m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuf
fer, nCharacters, TRUE); | 329 m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, nCh
aracters, TRUE); |
333 | 330 |
334 » » pEdit->SetEditNotify(this); | 331 pEdit->SetEditNotify(this); |
335 » » //pUndo->BeginEdit(pDocument); | 332 //pUndo->BeginEdit(pDocument); |
336 » } | 333 } |
337 } | 334 } |
338 | 335 |
339 void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd) | 336 void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd) |
340 { | 337 { |
341 | 338 |
342 } | 339 } |
343 | 340 |
344 FX_BOOL»CFFL_TextField::CanCopy(CPDFSDK_Document* pDocument) | 341 FX_BOOL CFFL_TextField::CanCopy(CPDFSDK_Document* pDocument) |
345 { | 342 { |
346 » return FALSE; | 343 return FALSE; |
347 } | 344 } |
348 | 345 |
349 FX_BOOL CFFL_TextField::CanCut(CPDFSDK_Document* pDocument) | 346 FX_BOOL CFFL_TextField::CanCut(CPDFSDK_Document* pDocument) |
350 { | 347 { |
351 » return FALSE; | 348 return FALSE; |
352 } | 349 } |
353 | 350 |
354 FX_BOOL»CFFL_TextField::CanPaste(CPDFSDK_Document* pDocument) | 351 FX_BOOL CFFL_TextField::CanPaste(CPDFSDK_Document* pDocument) |
355 { | 352 { |
356 » return FALSE; | 353 return FALSE; |
357 } | 354 } |
358 | 355 |
359 void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit) | 356 void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit) |
360 { | 357 { |
361 } | 358 } |
362 | 359 |
OLD | NEW |