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