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

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

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

Powered by Google App Engine
This is Rietveld 408576698