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

Side by Side Diff: xfa/src/fxfa/src/app/xfa_fftextedit.cpp

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 6 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 | « xfa/src/fxfa/src/app/xfa_fftextedit.h ('k') | xfa/src/fxfa/src/app/xfa_ffwidget.h » ('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 "../../../foxitlib.h" 7 #include "../../../foxitlib.h"
8 #include "../common/xfa_common.h" 8 #include "../common/xfa_common.h"
9 #include "xfa_fwladapter.h" 9 #include "xfa_fwladapter.h"
10 #include "xfa_ffwidget.h" 10 #include "xfa_ffwidget.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoVScroll; 62 dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoVScroll;
63 } 63 }
64 } else if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) { 64 } else if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) {
65 dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll; 65 dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
66 } 66 }
67 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || !m_pDataAcc->GetDoc ()->GetXFADoc()->IsInteractive()) { 67 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || !m_pDataAcc->GetDoc ()->GetXFADoc()->IsInteractive()) {
68 dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly; 68 dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
69 dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine; 69 dwExtendedStyle |= FWL_STYLEEXT_EDT_MultiLine;
70 } 70 }
71 XFA_ELEMENT eType = XFA_ELEMENT_UNKNOWN; 71 XFA_ELEMENT eType = XFA_ELEMENT_UNKNOWN;
72 FX_INT32 iMaxChars = m_pDataAcc->GetMaxChars(eType); 72 int32_t iMaxChars = m_pDataAcc->GetMaxChars(eType);
73 if (eType == XFA_ELEMENT_ExData) { 73 if (eType == XFA_ELEMENT_ExData) {
74 iMaxChars = 0; 74 iMaxChars = 0;
75 } 75 }
76 FX_INT32 iNumCells = m_pDataAcc->GetNumberOfCells(); 76 int32_t iNumCells = m_pDataAcc->GetNumberOfCells();
77 if (iNumCells == 0) { 77 if (iNumCells == 0) {
78 dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText; 78 dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
79 pWidget->SetLimit(iMaxChars > 0 ? iMaxChars : 1); 79 pWidget->SetLimit(iMaxChars > 0 ? iMaxChars : 1);
80 } else if (iNumCells > 0) { 80 } else if (iNumCells > 0) {
81 dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText; 81 dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
82 pWidget->SetLimit(iNumCells); 82 pWidget->SetLimit(iNumCells);
83 } else { 83 } else {
84 pWidget->SetLimit(iMaxChars); 84 pWidget->SetLimit(iMaxChars);
85 } 85 }
86 dwExtendedStyle |= GetAlignment(); 86 dwExtendedStyle |= GetAlignment();
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
202 } 202 }
203 FX_BOOL CXFA_FFTextEdit::IsDataChanged() 203 FX_BOOL CXFA_FFTextEdit::IsDataChanged()
204 { 204 {
205 return (m_dwStatus & XFA_WIDGETSTATUS_TextEditValueChanged) != 0; 205 return (m_dwStatus & XFA_WIDGETSTATUS_TextEditValueChanged) != 0;
206 } 206 }
207 FX_DWORD CXFA_FFTextEdit::GetAlignment() 207 FX_DWORD CXFA_FFTextEdit::GetAlignment()
208 { 208 {
209 FX_DWORD dwExtendedStyle = 0; 209 FX_DWORD dwExtendedStyle = 0;
210 if (CXFA_Para para = m_pDataAcc->GetPara()) { 210 if (CXFA_Para para = m_pDataAcc->GetPara()) {
211 FX_INT32 iHorz = para.GetHorizontalAlign(); 211 int32_t iHorz = para.GetHorizontalAlign();
212 switch(iHorz) { 212 switch(iHorz) {
213 case XFA_ATTRIBUTEENUM_Center: 213 case XFA_ATTRIBUTEENUM_Center:
214 dwExtendedStyle |= FWL_STYLEEXT_EDT_HCenter; 214 dwExtendedStyle |= FWL_STYLEEXT_EDT_HCenter;
215 break; 215 break;
216 case XFA_ATTRIBUTEENUM_Justify: 216 case XFA_ATTRIBUTEENUM_Justify:
217 dwExtendedStyle |= FWL_STYLEEXT_EDT_Justified; 217 dwExtendedStyle |= FWL_STYLEEXT_EDT_Justified;
218 break; 218 break;
219 case XFA_ATTRIBUTEENUM_JustifyAll: 219 case XFA_ATTRIBUTEENUM_JustifyAll:
220 break; 220 break;
221 case XFA_ATTRIBUTEENUM_Radix: 221 case XFA_ATTRIBUTEENUM_Radix:
222 break; 222 break;
223 case XFA_ATTRIBUTEENUM_Right: 223 case XFA_ATTRIBUTEENUM_Right:
224 dwExtendedStyle |= FWL_STYLEEXT_EDT_HFar; 224 dwExtendedStyle |= FWL_STYLEEXT_EDT_HFar;
225 break; 225 break;
226 default: 226 default:
227 dwExtendedStyle |= FWL_STYLEEXT_EDT_HNear; 227 dwExtendedStyle |= FWL_STYLEEXT_EDT_HNear;
228 break; 228 break;
229 } 229 }
230 FX_INT32 iVert = para.GetVerticalAlign(); 230 int32_t iVert = para.GetVerticalAlign();
231 switch(iVert) { 231 switch(iVert) {
232 case XFA_ATTRIBUTEENUM_Middle: 232 case XFA_ATTRIBUTEENUM_Middle:
233 dwExtendedStyle |= FWL_STYLEEXT_EDT_VCenter; 233 dwExtendedStyle |= FWL_STYLEEXT_EDT_VCenter;
234 break; 234 break;
235 case XFA_ATTRIBUTEENUM_Bottom: 235 case XFA_ATTRIBUTEENUM_Bottom:
236 dwExtendedStyle |= FWL_STYLEEXT_EDT_VFar; 236 dwExtendedStyle |= FWL_STYLEEXT_EDT_VFar;
237 break; 237 break;
238 default: 238 default:
239 dwExtendedStyle |= FWL_STYLEEXT_EDT_VNear; 239 dwExtendedStyle |= FWL_STYLEEXT_EDT_VNear;
240 break; 240 break;
241 } 241 }
242 } 242 }
243 return dwExtendedStyle; 243 return dwExtendedStyle;
244 } 244 }
245 FX_BOOL CXFA_FFTextEdit::UpdateFWLData() 245 FX_BOOL CXFA_FFTextEdit::UpdateFWLData()
246 { 246 {
247 if (!m_pNormalWidget) { 247 if (!m_pNormalWidget) {
248 return FALSE; 248 return FALSE;
249 } 249 }
250 XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display; 250 XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display;
251 if (IsFocused()) { 251 if (IsFocused()) {
252 eType = XFA_VALUEPICTURE_Edit; 252 eType = XFA_VALUEPICTURE_Edit;
253 } 253 }
254 FX_BOOL bUpdate = FALSE; 254 FX_BOOL bUpdate = FALSE;
255 if (m_pDataAcc->GetUIType() == XFA_ELEMENT_TextEdit && m_pDataAcc->GetNumber OfCells() < 0) { 255 if (m_pDataAcc->GetUIType() == XFA_ELEMENT_TextEdit && m_pDataAcc->GetNumber OfCells() < 0) {
256 XFA_ELEMENT elementType = XFA_ELEMENT_UNKNOWN; 256 XFA_ELEMENT elementType = XFA_ELEMENT_UNKNOWN;
257 FX_INT32 iMaxChars = m_pDataAcc->GetMaxChars(elementType); 257 int32_t iMaxChars = m_pDataAcc->GetMaxChars(elementType);
258 if (elementType == XFA_ELEMENT_ExData) { 258 if (elementType == XFA_ELEMENT_ExData) {
259 iMaxChars = eType == XFA_VALUEPICTURE_Edit ? iMaxChars : 0; 259 iMaxChars = eType == XFA_VALUEPICTURE_Edit ? iMaxChars : 0;
260 } 260 }
261 if (((CFWL_Edit*)m_pNormalWidget)->GetLimit() != iMaxChars) { 261 if (((CFWL_Edit*)m_pNormalWidget)->GetLimit() != iMaxChars) {
262 ((CFWL_Edit*)m_pNormalWidget)->SetLimit(iMaxChars); 262 ((CFWL_Edit*)m_pNormalWidget)->SetLimit(iMaxChars);
263 bUpdate = TRUE; 263 bUpdate = TRUE;
264 } 264 }
265 } 265 }
266 CFX_WideString wsText; 266 CFX_WideString wsText;
267 m_pDataAcc->GetValue(wsText, eType); 267 m_pDataAcc->GetValue(wsText, eType);
(...skipping 19 matching lines...) Expand all
287 FX_BOOL CXFA_FFTextEdit::Undo() 287 FX_BOOL CXFA_FFTextEdit::Undo()
288 { 288 {
289 return ((CFWL_Edit*)m_pNormalWidget)->Undo(); 289 return ((CFWL_Edit*)m_pNormalWidget)->Undo();
290 } 290 }
291 FX_BOOL CXFA_FFTextEdit::Redo() 291 FX_BOOL CXFA_FFTextEdit::Redo()
292 { 292 {
293 return ((CFWL_Edit*)m_pNormalWidget)->Redo(); 293 return ((CFWL_Edit*)m_pNormalWidget)->Redo();
294 } 294 }
295 FX_BOOL CXFA_FFTextEdit::CanCopy() 295 FX_BOOL CXFA_FFTextEdit::CanCopy()
296 { 296 {
297 FX_INT32 nCount = ((CFWL_Edit*)m_pNormalWidget)->CountSelRanges(); 297 int32_t nCount = ((CFWL_Edit*)m_pNormalWidget)->CountSelRanges();
298 return nCount > 0; 298 return nCount > 0;
299 } 299 }
300 FX_BOOL CXFA_FFTextEdit::CanCut() 300 FX_BOOL CXFA_FFTextEdit::CanCut()
301 { 301 {
302 if (m_pNormalWidget->GetStylesEx() & FWL_STYLEEXT_EDT_ReadOnly) { 302 if (m_pNormalWidget->GetStylesEx() & FWL_STYLEEXT_EDT_ReadOnly) {
303 return FALSE; 303 return FALSE;
304 } 304 }
305 FX_INT32 nCount = ((CFWL_Edit*)m_pNormalWidget)->CountSelRanges(); 305 int32_t nCount = ((CFWL_Edit*)m_pNormalWidget)->CountSelRanges();
306 return nCount > 0; 306 return nCount > 0;
307 } 307 }
308 FX_BOOL CXFA_FFTextEdit::CanPaste() 308 FX_BOOL CXFA_FFTextEdit::CanPaste()
309 { 309 {
310 return m_pDataAcc->GetAccess() == XFA_ATTRIBUTEENUM_Open; 310 return m_pDataAcc->GetAccess() == XFA_ATTRIBUTEENUM_Open;
311 } 311 }
312 FX_BOOL CXFA_FFTextEdit::CanSelectAll() 312 FX_BOOL CXFA_FFTextEdit::CanSelectAll()
313 { 313 {
314 return ((CFWL_Edit*)m_pNormalWidget)->GetTextLength() > 0; 314 return ((CFWL_Edit*)m_pNormalWidget)->GetTextLength() > 0;
315 } 315 }
316 FX_BOOL CXFA_FFTextEdit::Copy(CFX_WideString &wsCopy) 316 FX_BOOL CXFA_FFTextEdit::Copy(CFX_WideString &wsCopy)
317 { 317 {
318 return ((CFWL_Edit*)m_pNormalWidget)->Copy(wsCopy); 318 return ((CFWL_Edit*)m_pNormalWidget)->Copy(wsCopy);
319 } 319 }
320 FX_BOOL CXFA_FFTextEdit::Cut(CFX_WideString &wsCut) 320 FX_BOOL CXFA_FFTextEdit::Cut(CFX_WideString &wsCut)
321 { 321 {
322 return ((CFWL_Edit*)m_pNormalWidget)->Cut(wsCut); 322 return ((CFWL_Edit*)m_pNormalWidget)->Cut(wsCut);
323 } 323 }
324 FX_BOOL CXFA_FFTextEdit::Paste(const CFX_WideString &wsPaste) 324 FX_BOOL CXFA_FFTextEdit::Paste(const CFX_WideString &wsPaste)
325 { 325 {
326 return ((CFWL_Edit*)m_pNormalWidget)->Paste(wsPaste); 326 return ((CFWL_Edit*)m_pNormalWidget)->Paste(wsPaste);
327 } 327 }
328 FX_BOOL CXFA_FFTextEdit::SelectAll() 328 FX_BOOL CXFA_FFTextEdit::SelectAll()
329 { 329 {
330 FX_INT32 nCount = ((CFWL_Edit*)m_pNormalWidget)->GetTextLength(); 330 int32_t nCount = ((CFWL_Edit*)m_pNormalWidget)->GetTextLength();
331 return ((CFWL_Edit*)m_pNormalWidget)->AddSelRange(0, nCount); 331 return ((CFWL_Edit*)m_pNormalWidget)->AddSelRange(0, nCount);
332 } 332 }
333 FX_BOOL CXFA_FFTextEdit::Delete() 333 FX_BOOL CXFA_FFTextEdit::Delete()
334 { 334 {
335 return ((CFWL_Edit*)m_pNormalWidget)->Delete(); 335 return ((CFWL_Edit*)m_pNormalWidget)->Delete();
336 } 336 }
337 FX_BOOL CXFA_FFTextEdit::DeSelect() 337 FX_BOOL CXFA_FFTextEdit::DeSelect()
338 { 338 {
339 return ((CFWL_Edit*)m_pNormalWidget)->ClearSelections(); 339 return ((CFWL_Edit*)m_pNormalWidget)->ClearSelections();
340 } 340 }
(...skipping 18 matching lines...) Expand all
359 m_dwStatus |= XFA_WIDGETSTATUS_TextEditValueChanged; 359 m_dwStatus |= XFA_WIDGETSTATUS_TextEditValueChanged;
360 CXFA_EventParam eParam; 360 CXFA_EventParam eParam;
361 eParam.m_eType = XFA_EVENT_Change; 361 eParam.m_eType = XFA_EVENT_Change;
362 eParam.m_wsChange = wsChanged; 362 eParam.m_wsChange = wsChanged;
363 eParam.m_pTarget = m_pDataAcc; 363 eParam.m_pTarget = m_pDataAcc;
364 eParam.m_wsPrevText = wsPrevText; 364 eParam.m_wsPrevText = wsPrevText;
365 CFWL_Edit* pEdit = ((CFWL_Edit*)m_pNormalWidget); 365 CFWL_Edit* pEdit = ((CFWL_Edit*)m_pNormalWidget);
366 if (m_pDataAcc->GetUIType() == XFA_ELEMENT_DateTimeEdit) { 366 if (m_pDataAcc->GetUIType() == XFA_ELEMENT_DateTimeEdit) {
367 CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)pEdit; 367 CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)pEdit;
368 pDateTime->GetEditText(eParam.m_wsNewText); 368 pDateTime->GetEditText(eParam.m_wsNewText);
369 FX_INT32 iSels = pDateTime->CountSelRanges(); 369 int32_t iSels = pDateTime->CountSelRanges();
370 if (iSels ) { 370 if (iSels ) {
371 eParam.m_iSelEnd = pDateTime->GetSelRange(0, eParam.m_iSelStart); 371 eParam.m_iSelEnd = pDateTime->GetSelRange(0, eParam.m_iSelStart);
372 } 372 }
373 } else { 373 } else {
374 pEdit->GetText(eParam.m_wsNewText); 374 pEdit->GetText(eParam.m_wsNewText);
375 FX_INT32 iSels = pEdit->CountSelRanges(); 375 int32_t iSels = pEdit->CountSelRanges();
376 if (iSels ) { 376 if (iSels ) {
377 eParam.m_iSelEnd = pEdit->GetSelRange(0, eParam.m_iSelStart); 377 eParam.m_iSelEnd = pEdit->GetSelRange(0, eParam.m_iSelStart);
378 } 378 }
379 } 379 }
380 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); 380 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
381 } 381 }
382 void CXFA_FFTextEdit::OnTextFull(IFWL_Widget *pWidget) 382 void CXFA_FFTextEdit::OnTextFull(IFWL_Widget *pWidget)
383 { 383 {
384 CXFA_EventParam eParam; 384 CXFA_EventParam eParam;
385 eParam.m_eType = XFA_EVENT_Full; 385 eParam.m_eType = XFA_EVENT_Full;
(...skipping 11 matching lines...) Expand all
397 } 397 }
398 return GetDoc()->GetDocProvider()->CheckWord(GetDoc(), sWord); 398 return GetDoc()->GetDocProvider()->CheckWord(GetDoc(), sWord);
399 } 399 }
400 FX_BOOL CXFA_FFTextEdit::GetSuggestWords(FX_BSTR sWord, CFX_ByteStringArray &sSu ggest) 400 FX_BOOL CXFA_FFTextEdit::GetSuggestWords(FX_BSTR sWord, CFX_ByteStringArray &sSu ggest)
401 { 401 {
402 if (m_pDataAcc->GetUIType() != XFA_ELEMENT_TextEdit) { 402 if (m_pDataAcc->GetUIType() != XFA_ELEMENT_TextEdit) {
403 return FALSE; 403 return FALSE;
404 } 404 }
405 return GetDoc()->GetDocProvider()->GetSuggestWords(GetDoc(), sWord, sSuggest ); 405 return GetDoc()->GetDocProvider()->GetSuggestWords(GetDoc(), sWord, sSuggest );
406 } 406 }
407 FX_INT32 CXFA_FFTextEdit::OnProcessMessage(CFWL_Message *pMessage) 407 int32_t CXFA_FFTextEdit::OnProcessMessage(CFWL_Message *pMessage)
408 { 408 {
409 return m_pOldDelegate->OnProcessMessage(pMessage); 409 return m_pOldDelegate->OnProcessMessage(pMessage);
410 } 410 }
411 FWL_ERR CXFA_FFTextEdit::OnProcessEvent(CFWL_Event *pEvent) 411 FWL_ERR CXFA_FFTextEdit::OnProcessEvent(CFWL_Event *pEvent)
412 { 412 {
413 CXFA_FFField::OnProcessEvent(pEvent); 413 CXFA_FFField::OnProcessEvent(pEvent);
414 FX_DWORD dwEventID = pEvent->GetClassID(); 414 FX_DWORD dwEventID = pEvent->GetClassID();
415 switch (dwEventID) { 415 switch (dwEventID) {
416 case FWL_EVTHASH_EDT_TextChanged: { 416 case FWL_EVTHASH_EDT_TextChanged: {
417 CFWL_EvtEdtTextChanged *event = (CFWL_EvtEdtTextChanged*)pEvent; 417 CFWL_EvtEdtTextChanged *event = (CFWL_EvtEdtTextChanged*)pEvent;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 CFWL_Edit* pWidget = (CFWL_Edit*)m_pNormalWidget; 478 CFWL_Edit* pWidget = (CFWL_Edit*)m_pNormalWidget;
479 if (!pWidget) { 479 if (!pWidget) {
480 return; 480 return;
481 } 481 }
482 FX_DWORD dwExtendedStyle = FWL_STYLEEXT_EDT_ShowScrollbarFocus | 482 FX_DWORD dwExtendedStyle = FWL_STYLEEXT_EDT_ShowScrollbarFocus |
483 FWL_STYLEEXT_EDT_OuterScrollbar | FWL_STYLEEXT_ED T_Validate | FWL_STYLEEXT_EDT_Number | FWL_STYLEEXT_EDT_LastLineHeight; 483 FWL_STYLEEXT_EDT_OuterScrollbar | FWL_STYLEEXT_ED T_Validate | FWL_STYLEEXT_EDT_Number | FWL_STYLEEXT_EDT_LastLineHeight;
484 dwExtendedStyle |= UpdateUIProperty(); 484 dwExtendedStyle |= UpdateUIProperty();
485 if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) { 485 if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) {
486 dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll; 486 dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll;
487 } 487 }
488 FX_INT32 iNumCells = m_pDataAcc->GetNumberOfCells(); 488 int32_t iNumCells = m_pDataAcc->GetNumberOfCells();
489 if (iNumCells > 0) { 489 if (iNumCells > 0) {
490 dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText; 490 dwExtendedStyle |= FWL_STYLEEXT_EDT_CombText;
491 pWidget->SetLimit(iNumCells); 491 pWidget->SetLimit(iNumCells);
492 } 492 }
493 dwExtendedStyle |= GetAlignment(); 493 dwExtendedStyle |= GetAlignment();
494 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || !m_pDataAcc->GetDoc ()->GetXFADoc()->IsInteractive()) { 494 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || !m_pDataAcc->GetDoc ()->GetXFADoc()->IsInteractive()) {
495 dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly; 495 dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
496 } 496 }
497 m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); 497 m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
498 } 498 }
499 FWL_ERR CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event *pEvent) 499 FWL_ERR CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event *pEvent)
500 { 500 {
501 FX_DWORD dwEventID = pEvent->GetClassID(); 501 FX_DWORD dwEventID = pEvent->GetClassID();
502 if (dwEventID == FWL_EVTHASH_EDT_Validate) { 502 if (dwEventID == FWL_EVTHASH_EDT_Validate) {
503 CFWL_EvtEdtValidate *event = (CFWL_EvtEdtValidate*)pEvent; 503 CFWL_EvtEdtValidate *event = (CFWL_EvtEdtValidate*)pEvent;
504 CFX_WideString wsChange = event->wsInsert; 504 CFX_WideString wsChange = event->wsInsert;
505 event->bValidate = OnValidate(m_pNormalWidget->GetWidget(), wsChange); 505 event->bValidate = OnValidate(m_pNormalWidget->GetWidget(), wsChange);
506 return event->bValidate; 506 return event->bValidate;
507 } else { 507 } else {
508 return CXFA_FFTextEdit::OnProcessEvent(pEvent); 508 return CXFA_FFTextEdit::OnProcessEvent(pEvent);
509 } 509 }
510 } 510 }
511 FX_BOOL CXFA_FFNumericEdit::OnValidate(IFWL_Widget *pWidget, CFX_WideString &wsT ext) 511 FX_BOOL CXFA_FFNumericEdit::OnValidate(IFWL_Widget *pWidget, CFX_WideString &wsT ext)
512 { 512 {
513 CFX_WideString wsPattern; 513 CFX_WideString wsPattern;
514 m_pDataAcc->GetPictureContent(wsPattern, XFA_VALUEPICTURE_Edit); 514 m_pDataAcc->GetPictureContent(wsPattern, XFA_VALUEPICTURE_Edit);
515 if (!wsPattern.IsEmpty()) { 515 if (!wsPattern.IsEmpty()) {
516 return TRUE; 516 return TRUE;
517 } 517 }
518 FX_INT32 iLeads = 0; 518 int32_t iLeads = 0;
519 m_pDataAcc->GetLeadDigits(iLeads); 519 m_pDataAcc->GetLeadDigits(iLeads);
520 FX_INT32 iFracs = 0; 520 int32_t iFracs = 0;
521 m_pDataAcc->GetFracDigits(iFracs); 521 m_pDataAcc->GetFracDigits(iFracs);
522 CFX_WideString wsFormat; 522 CFX_WideString wsFormat;
523 CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pDataAcc); 523 CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pDataAcc);
524 widgetValue.GetNumbericFormat(wsFormat, iLeads, iFracs); 524 widgetValue.GetNumbericFormat(wsFormat, iLeads, iFracs);
525 return widgetValue.ValidateNumericTemp(wsText, wsFormat, m_pDataAcc->GetLoca l()); 525 return widgetValue.ValidateNumericTemp(wsText, wsFormat, m_pDataAcc->GetLoca l());
526 } 526 }
527 CXFA_FFPasswordEdit::CXFA_FFPasswordEdit(CXFA_FFPageView* pPageView, CXFA_Widget Acc* pDataAcc) 527 CXFA_FFPasswordEdit::CXFA_FFPasswordEdit(CXFA_FFPageView* pPageView, CXFA_Widget Acc* pDataAcc)
528 : CXFA_FFTextEdit(pPageView, pDataAcc) 528 : CXFA_FFTextEdit(pPageView, pDataAcc)
529 { 529 {
530 } 530 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 { 654 {
655 CFWL_DateTimePicker* pWidget = (CFWL_DateTimePicker*)m_pNormalWidget; 655 CFWL_DateTimePicker* pWidget = (CFWL_DateTimePicker*)m_pNormalWidget;
656 if (!pWidget) { 656 if (!pWidget) {
657 return; 657 return;
658 } 658 }
659 FX_DWORD dwExtendedStyle = FWL_STYLEEXT_DTP_ShortDateFormat; 659 FX_DWORD dwExtendedStyle = FWL_STYLEEXT_DTP_ShortDateFormat;
660 dwExtendedStyle |= UpdateUIProperty(); 660 dwExtendedStyle |= UpdateUIProperty();
661 dwExtendedStyle |= GetAlignment(); 661 dwExtendedStyle |= GetAlignment();
662 m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); 662 m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
663 FX_DWORD dwEditStyles = FWL_STYLEEXT_EDT_LastLineHeight; 663 FX_DWORD dwEditStyles = FWL_STYLEEXT_EDT_LastLineHeight;
664 FX_INT32 iNumCells = m_pDataAcc->GetNumberOfCells(); 664 int32_t iNumCells = m_pDataAcc->GetNumberOfCells();
665 if (iNumCells > 0) { 665 if (iNumCells > 0) {
666 dwEditStyles |= FWL_STYLEEXT_EDT_CombText; 666 dwEditStyles |= FWL_STYLEEXT_EDT_CombText;
667 pWidget->SetEditLimit(iNumCells); 667 pWidget->SetEditLimit(iNumCells);
668 } 668 }
669 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || !m_pDataAcc->GetDoc ()->GetXFADoc()->IsInteractive()) { 669 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || !m_pDataAcc->GetDoc ()->GetXFADoc()->IsInteractive()) {
670 dwEditStyles |= FWL_STYLEEXT_EDT_ReadOnly; 670 dwEditStyles |= FWL_STYLEEXT_EDT_ReadOnly;
671 } 671 }
672 if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) { 672 if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) {
673 dwEditStyles |= FWL_STYLEEXT_EDT_AutoHScroll; 673 dwEditStyles |= FWL_STYLEEXT_EDT_AutoHScroll;
674 } 674 }
675 pWidget->ModifyEditStylesEx(dwEditStyles, 0xFFFFFFFF); 675 pWidget->ModifyEditStylesEx(dwEditStyles, 0xFFFFFFFF);
676 } 676 }
677 FX_DWORD CXFA_FFDateTimeEdit::GetAlignment() 677 FX_DWORD CXFA_FFDateTimeEdit::GetAlignment()
678 { 678 {
679 FX_DWORD dwExtendedStyle = 0; 679 FX_DWORD dwExtendedStyle = 0;
680 if (CXFA_Para para = m_pDataAcc->GetPara()) { 680 if (CXFA_Para para = m_pDataAcc->GetPara()) {
681 FX_INT32 iHorz = para.GetHorizontalAlign(); 681 int32_t iHorz = para.GetHorizontalAlign();
682 switch(iHorz) { 682 switch(iHorz) {
683 case XFA_ATTRIBUTEENUM_Center: 683 case XFA_ATTRIBUTEENUM_Center:
684 dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHCenter; 684 dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHCenter;
685 break; 685 break;
686 case XFA_ATTRIBUTEENUM_Justify: 686 case XFA_ATTRIBUTEENUM_Justify:
687 dwExtendedStyle |= FWL_STYLEEXT_DTP_EditJustified; 687 dwExtendedStyle |= FWL_STYLEEXT_DTP_EditJustified;
688 break; 688 break;
689 case XFA_ATTRIBUTEENUM_JustifyAll: 689 case XFA_ATTRIBUTEENUM_JustifyAll:
690 break; 690 break;
691 case XFA_ATTRIBUTEENUM_Radix: 691 case XFA_ATTRIBUTEENUM_Radix:
692 break; 692 break;
693 case XFA_ATTRIBUTEENUM_Right: 693 case XFA_ATTRIBUTEENUM_Right:
694 dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHFar; 694 dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHFar;
695 break; 695 break;
696 default: 696 default:
697 dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHNear; 697 dwExtendedStyle |= FWL_STYLEEXT_DTP_EditHNear;
698 break; 698 break;
699 } 699 }
700 FX_INT32 iVert = para.GetVerticalAlign(); 700 int32_t iVert = para.GetVerticalAlign();
701 switch(iVert) { 701 switch(iVert) {
702 case XFA_ATTRIBUTEENUM_Middle: 702 case XFA_ATTRIBUTEENUM_Middle:
703 dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVCenter; 703 dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVCenter;
704 break; 704 break;
705 case XFA_ATTRIBUTEENUM_Bottom: 705 case XFA_ATTRIBUTEENUM_Bottom:
706 dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVFar; 706 dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVFar;
707 break; 707 break;
708 default: 708 default:
709 dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVNear; 709 dwExtendedStyle |= FWL_STYLEEXT_DTP_EditVNear;
710 break; 710 break;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 return ((CFWL_DateTimePicker*)m_pNormalWidget)->SelectAll(); 809 return ((CFWL_DateTimePicker*)m_pNormalWidget)->SelectAll();
810 } 810 }
811 FX_BOOL CXFA_FFDateTimeEdit::Delete() 811 FX_BOOL CXFA_FFDateTimeEdit::Delete()
812 { 812 {
813 return ((CFWL_DateTimePicker*)m_pNormalWidget)->Delete(); 813 return ((CFWL_DateTimePicker*)m_pNormalWidget)->Delete();
814 } 814 }
815 FX_BOOL CXFA_FFDateTimeEdit::DeSelect() 815 FX_BOOL CXFA_FFDateTimeEdit::DeSelect()
816 { 816 {
817 return ((CFWL_DateTimePicker*)m_pNormalWidget)->DeSelect(); 817 return ((CFWL_DateTimePicker*)m_pNormalWidget)->DeSelect();
818 } 818 }
819 void CXFA_FFDateTimeEdit::OnSelectChanged(IFWL_Widget *pWidget, FX_INT32 iYear, FX_INT32 iMonth, FX_INT32 iDay) 819 void CXFA_FFDateTimeEdit::OnSelectChanged(IFWL_Widget *pWidget, int32_t iYear, i nt32_t iMonth, int32_t iDay)
820 { 820 {
821 CFX_WideString wsPicture; 821 CFX_WideString wsPicture;
822 m_pDataAcc->GetPictureContent(wsPicture, XFA_VALUEPICTURE_Edit); 822 m_pDataAcc->GetPictureContent(wsPicture, XFA_VALUEPICTURE_Edit);
823 CXFA_LocaleValue date(XFA_VT_DATE, this->GetDoc()->GetXFADoc()->GetLocalMgr( )); 823 CXFA_LocaleValue date(XFA_VT_DATE, this->GetDoc()->GetXFADoc()->GetLocalMgr( ));
824 CFX_Unitime dt; 824 CFX_Unitime dt;
825 dt.Set(iYear, iMonth, iDay); 825 dt.Set(iYear, iMonth, iDay);
826 date.SetDate(dt); 826 date.SetDate(dt);
827 CFX_WideString wsDate; 827 CFX_WideString wsDate;
828 date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(), XFA_VALUEPICT URE_Edit); 828 date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(), XFA_VALUEPICT URE_Edit);
829 CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)m_pNormalWidget; 829 CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)m_pNormalWidget;
(...skipping 10 matching lines...) Expand all
840 { 840 {
841 FX_DWORD dwEventID = pEvent->GetClassID(); 841 FX_DWORD dwEventID = pEvent->GetClassID();
842 if (dwEventID == FWL_EVTHASH_DTP_SelectChanged) { 842 if (dwEventID == FWL_EVTHASH_DTP_SelectChanged) {
843 CFWL_Event_DtpSelectChanged *event = (CFWL_Event_DtpSelectChanged*)pEven t; 843 CFWL_Event_DtpSelectChanged *event = (CFWL_Event_DtpSelectChanged*)pEven t;
844 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMont h, event->iDay); 844 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMont h, event->iDay);
845 return TRUE; 845 return TRUE;
846 } else { 846 } else {
847 return CXFA_FFTextEdit::OnProcessEvent(pEvent); 847 return CXFA_FFTextEdit::OnProcessEvent(pEvent);
848 } 848 }
849 } 849 }
OLDNEW
« no previous file with comments | « xfa/src/fxfa/src/app/xfa_fftextedit.h ('k') | xfa/src/fxfa/src/app/xfa_ffwidget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698