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

Side by Side Diff: fpdfsdk/src/javascript/Field.cpp

Issue 726143002: Remove FX_LPCWSTR cast to wchar_t* literals (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 1 month 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 | « fpdfsdk/src/javascript/Document.cpp ('k') | fpdfsdk/src/javascript/JS_Context.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/javascript/JavaScript.h" 7 #include "../../include/javascript/JavaScript.h"
8 #include "../../include/javascript/IJavaScript.h" 8 #include "../../include/javascript/IJavaScript.h"
9 #include "../../include/javascript/JS_Define.h" 9 #include "../../include/javascript/JS_Define.h"
10 #include "../../include/javascript/JS_Object.h" 10 #include "../../include/javascript/JS_Object.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || 181 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) ||
182 m_pDocument->GetPermissions(FPDFPERM_MODIFY); 182 m_pDocument->GetPermissions(FPDFPERM_MODIFY);
183 183
184 CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm(); 184 CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm();
185 ASSERT(pRDInterForm != NULL); 185 ASSERT(pRDInterForm != NULL);
186 186
187 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); 187 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm();
188 ASSERT(pInterForm != NULL); 188 ASSERT(pInterForm != NULL);
189 189
190 CFX_WideString swFieldNameTemp = csFieldName; 190 CFX_WideString swFieldNameTemp = csFieldName;
191 » swFieldNameTemp.Replace((FX_LPCWSTR)L"..", (FX_LPCWSTR)L"."); 191 » swFieldNameTemp.Replace(L"..", L".");
192 192
193 if (pInterForm->CountFields(swFieldNameTemp) <= 0) 193 if (pInterForm->CountFields(swFieldNameTemp) <= 0)
194 { 194 {
195 std::wstring strFieldName; 195 std::wstring strFieldName;
196 int iControlNo = -1; 196 int iControlNo = -1;
197 ParseFieldName((wchar_t*)(FX_LPCWSTR)swFieldNameTemp, strFieldNa me, iControlNo); 197 ParseFieldName((wchar_t*)(FX_LPCWSTR)swFieldNameTemp, strFieldNa me, iControlNo);
198 if (iControlNo == -1) return FALSE; 198 if (iControlNo == -1) return FALSE;
199 199
200 m_FieldName = strFieldName.c_str(); 200 m_FieldName = strFieldName.c_str();
201 m_nFormControlIndex = iControlNo; 201 m_nFormControlIndex = iControlNo;
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 408
409 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) 409 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
410 return FALSE; 410 return FALSE;
411 411
412 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField ); 412 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField );
413 if (!pFormControl)return FALSE; 413 if (!pFormControl)return FALSE;
414 414
415 switch (pFormControl->GetControlAlignment()) 415 switch (pFormControl->GetControlAlignment())
416 { 416 {
417 case 1: 417 case 1:
418 » » » » vp << (FX_LPCWSTR)L"center"; 418 » » » » vp << L"center";
419 break; 419 break;
420 case 0: 420 case 0:
421 » » » » vp << (FX_LPCWSTR)L"left"; 421 » » » » vp << L"left";
422 break; 422 break;
423 case 2: 423 case 2:
424 » » » » vp << (FX_LPCWSTR)L"right"; 424 » » » » vp << L"right";
425 break; 425 break;
426 default: 426 default:
427 » » » » vp << (FX_LPCWSTR)L""; 427 » » » » vp << L"";
428 } 428 }
429 } 429 }
430 430
431 return TRUE; 431 return TRUE;
432 } 432 }
433 433
434 void Field::SetAlignment(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex, 434 void Field::SetAlignment(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex,
435 const CFX_ByteString& string) 435 const CFX_ByteString& string)
436 { 436 {
437 //Not supported. 437 //Not supported.
(...skipping 29 matching lines...) Expand all
467 if (!pFormField) return FALSE; 467 if (!pFormField) return FALSE;
468 468
469 CPDFSDK_Widget* pWidget = GetWidget(m_pDocument, GetSmartFieldCo ntrol(pFormField)); 469 CPDFSDK_Widget* pWidget = GetWidget(m_pDocument, GetSmartFieldCo ntrol(pFormField));
470 if (!pWidget) return FALSE; 470 if (!pWidget) return FALSE;
471 471
472 int nBorderstyle = pWidget->GetBorderStyle(); 472 int nBorderstyle = pWidget->GetBorderStyle();
473 473
474 switch (nBorderstyle) 474 switch (nBorderstyle)
475 { 475 {
476 case BBS_SOLID: 476 case BBS_SOLID:
477 » » » » vp << (FX_LPCWSTR)L"solid"; 477 » » » » vp << L"solid";
478 break; 478 break;
479 case BBS_DASH: 479 case BBS_DASH:
480 » » » » vp << (FX_LPCWSTR)L"dashed"; 480 » » » » vp << L"dashed";
481 break; 481 break;
482 case BBS_BEVELED: 482 case BBS_BEVELED:
483 » » » » vp << (FX_LPCWSTR)L"beveled"; 483 » » » » vp << L"beveled";
484 break; 484 break;
485 case BBS_INSET: 485 case BBS_INSET:
486 » » » » vp << (FX_LPCWSTR)L"inset"; 486 » » » » vp << L"inset";
487 break; 487 break;
488 case BBS_UNDERLINE: 488 case BBS_UNDERLINE:
489 » » » » vp << (FX_LPCWSTR)L"underline"; 489 » » » » vp << L"underline";
490 break; 490 break;
491 default: 491 default:
492 » » » » vp << (FX_LPCWSTR)L""; 492 » » » » vp << L"";
493 break; 493 break;
494 } 494 }
495 } 495 }
496 496
497 return TRUE; 497 return TRUE;
498 } 498 }
499 499
500 void Field::SetBorderStyle(CPDFSDK_Document* pDocument, const CFX_WideString& sw FieldName, int nControlIndex, 500 void Field::SetBorderStyle(CPDFSDK_Document* pDocument, const CFX_WideString& sw FieldName, int nControlIndex,
501 const CFX_ByteString& string) 501 const CFX_ByteString& string)
502 { 502 {
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 1865 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
1866 return FALSE; 1866 return FALSE;
1867 1867
1868 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField ); 1868 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField );
1869 if (!pFormControl) return FALSE; 1869 if (!pFormControl) return FALSE;
1870 1870
1871 int eHM = pFormControl->GetHighlightingMode(); 1871 int eHM = pFormControl->GetHighlightingMode();
1872 switch (eHM) 1872 switch (eHM)
1873 { 1873 {
1874 case CPDF_FormControl::None: 1874 case CPDF_FormControl::None:
1875 » » » vp << (FX_LPCWSTR)L"none"; 1875 » » » vp << L"none";
1876 break; 1876 break;
1877 case CPDF_FormControl::Push: 1877 case CPDF_FormControl::Push:
1878 » » » vp << (FX_LPCWSTR)L"push"; 1878 » » » vp << L"push";
1879 break; 1879 break;
1880 case CPDF_FormControl::Invert: 1880 case CPDF_FormControl::Invert:
1881 » » » vp << (FX_LPCWSTR)L"invert"; 1881 » » » vp << L"invert";
1882 break; 1882 break;
1883 case CPDF_FormControl::Outline: 1883 case CPDF_FormControl::Outline:
1884 » » » vp << (FX_LPCWSTR)L"outline"; 1884 » » » vp << L"outline";
1885 break; 1885 break;
1886 case CPDF_FormControl::Toggle: 1886 case CPDF_FormControl::Toggle:
1887 » » » vp << (FX_LPCWSTR)L"toggle"; 1887 » » » vp << L"toggle";
1888 break; 1888 break;
1889 } 1889 }
1890 } 1890 }
1891 1891
1892 return TRUE; 1892 return TRUE;
1893 } 1893 }
1894 1894
1895 void Field::SetHighlight(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex, const CFX_ByteString& string) 1895 void Field::SetHighlight(CPDFSDK_Document* pDocument, const CFX_WideString& swFi eldName, int nControlIndex, const CFX_ByteString& string)
1896 { 1896 {
1897 //Not supported. 1897 //Not supported.
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
2993 CFX_PtrArray FieldArray; 2993 CFX_PtrArray FieldArray;
2994 GetFormFields(m_FieldName,FieldArray); 2994 GetFormFields(m_FieldName,FieldArray);
2995 if (FieldArray.GetSize() <= 0) return FALSE; 2995 if (FieldArray.GetSize() <= 0) return FALSE;
2996 2996
2997 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 2997 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
2998 ASSERT(pFormField != NULL); 2998 ASSERT(pFormField != NULL);
2999 2999
3000 switch (pFormField->GetFieldType()) 3000 switch (pFormField->GetFieldType())
3001 { 3001 {
3002 case FIELDTYPE_UNKNOWN: 3002 case FIELDTYPE_UNKNOWN:
3003 » » » vp << (FX_LPCWSTR)L"unknown"; 3003 » » » vp << L"unknown";
3004 break; 3004 break;
3005 case FIELDTYPE_PUSHBUTTON: 3005 case FIELDTYPE_PUSHBUTTON:
3006 » » » vp << (FX_LPCWSTR)L"button"; 3006 » » » vp << L"button";
3007 break; 3007 break;
3008 case FIELDTYPE_CHECKBOX: 3008 case FIELDTYPE_CHECKBOX:
3009 » » » vp << (FX_LPCWSTR)L"checkbox"; 3009 » » » vp << L"checkbox";
3010 break; 3010 break;
3011 case FIELDTYPE_RADIOBUTTON: 3011 case FIELDTYPE_RADIOBUTTON:
3012 » » » vp << (FX_LPCWSTR)L"radiobutton"; 3012 » » » vp << L"radiobutton";
3013 break; 3013 break;
3014 case FIELDTYPE_COMBOBOX: 3014 case FIELDTYPE_COMBOBOX:
3015 » » » vp << (FX_LPCWSTR)L"combobox"; 3015 » » » vp << L"combobox";
3016 break; 3016 break;
3017 case FIELDTYPE_LISTBOX: 3017 case FIELDTYPE_LISTBOX:
3018 » » » vp << (FX_LPCWSTR)L"listbox"; 3018 » » » vp << L"listbox";
3019 break; 3019 break;
3020 case FIELDTYPE_TEXTFIELD: 3020 case FIELDTYPE_TEXTFIELD:
3021 » » » vp << (FX_LPCWSTR)L"text"; 3021 » » » vp << L"text";
3022 break; 3022 break;
3023 case FIELDTYPE_SIGNATURE: 3023 case FIELDTYPE_SIGNATURE:
3024 » » » vp << (FX_LPCWSTR)L"signature"; 3024 » » » vp << L"signature";
3025 break; 3025 break;
3026 default : 3026 default :
3027 » » » vp << (FX_LPCWSTR)L"unknown"; 3027 » » » vp << L"unknown";
3028 break; 3028 break;
3029 } 3029 }
3030 3030
3031 return TRUE; 3031 return TRUE;
3032 } 3032 }
3033 3033
3034 FX_BOOL Field::userName(OBJ_PROP_PARAMS) 3034 FX_BOOL Field::userName(OBJ_PROP_PARAMS)
3035 { 3035 {
3036 ASSERT(m_pDocument != NULL); 3036 ASSERT(m_pDocument != NULL);
3037 3037
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
3199 else 3199 else
3200 vp << swValue; 3200 vp << swValue;
3201 3201
3202 bFind = TRUE; 3202 bFind = TRUE;
3203 break; 3203 break;
3204 } 3204 }
3205 else 3205 else
3206 continue; 3206 continue;
3207 } 3207 }
3208 if (!bFind) 3208 if (!bFind)
3209 » » » » » vp << (FX_LPCWSTR)L"Off";» » » » » 3209 » » » » » vp << L"Off";» » » » »
3210 } 3210 }
3211 break; 3211 break;
3212 default: 3212 default:
3213 vp << pFormField->GetValue(); 3213 vp << pFormField->GetValue();
3214 break; 3214 break;
3215 } 3215 }
3216 } 3216 }
3217 3217
3218 return TRUE; 3218 return TRUE;
3219 } 3219 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
3305 ASSERT(pFormField != NULL); 3305 ASSERT(pFormField != NULL);
3306 3306
3307 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON) 3307 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON)
3308 return FALSE; 3308 return FALSE;
3309 3309
3310 if (pFormField->GetFieldType() == FIELDTYPE_CHECKBOX) 3310 if (pFormField->GetFieldType() == FIELDTYPE_CHECKBOX)
3311 { 3311 {
3312 if(!pFormField->CountControls()) return FALSE; 3312 if(!pFormField->CountControls()) return FALSE;
3313 3313
3314 if (pFormField->GetControl(0)->IsChecked()) 3314 if (pFormField->GetControl(0)->IsChecked())
3315 » » » vp << (FX_LPCWSTR)L"Yes"; 3315 » » » vp << L"Yes";
3316 else 3316 else
3317 » » » vp << (FX_LPCWSTR)L"Off"; 3317 » » » vp << L"Off";
3318 } 3318 }
3319 else if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON && !(pFormF ield->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON)) 3319 else if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON && !(pFormF ield->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON))
3320 { 3320 {
3321 for (int i=0, sz=pFormField->CountControls(); i<sz; i++) 3321 for (int i=0, sz=pFormField->CountControls(); i<sz; i++)
3322 { 3322 {
3323 if (pFormField->GetControl(i)->IsChecked()) 3323 if (pFormField->GetControl(i)->IsChecked())
3324 { 3324 {
3325 vp << (FX_LPCWSTR)pFormField->GetControl(i)->Get ExportValue(); 3325 vp << (FX_LPCWSTR)pFormField->GetControl(i)->Get ExportValue();
3326 break; 3326 break;
3327 } 3327 }
3328 else 3328 else
3329 » » » » vp << (FX_LPCWSTR)L"Off"; 3329 » » » » vp << L"Off";
3330 } 3330 }
3331 } 3331 }
3332 else if (pFormField->GetFieldType() == FIELDTYPE_LISTBOX && (pFormField- >CountSelectedItems() > 1)) 3332 else if (pFormField->GetFieldType() == FIELDTYPE_LISTBOX && (pFormField- >CountSelectedItems() > 1))
3333 { 3333 {
3334 » » vp << (FX_LPCWSTR)L""; 3334 » » vp << L"";
3335 } 3335 }
3336 else 3336 else
3337 vp << (FX_LPCWSTR)pFormField->GetValue(); 3337 vp << (FX_LPCWSTR)pFormField->GetValue();
3338 3338
3339 return TRUE; 3339 return TRUE;
3340 } 3340 }
3341 3341
3342 /* --------------------------------- methods --------------------------------- * / 3342 /* --------------------------------- methods --------------------------------- * /
3343 3343
3344 FX_BOOL Field::browseForFileToSubmit(OBJ_METHOD_PARAMS) 3344 FX_BOOL Field::browseForFileToSubmit(OBJ_METHOD_PARAMS)
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
4119 4119
4120 #define JS_FIELD_MINWIDTH 1 4120 #define JS_FIELD_MINWIDTH 1
4121 #define JS_FIELD_MINHEIGHT 1 4121 #define JS_FIELD_MINHEIGHT 1
4122 4122
4123 void Field::AddField(CPDFSDK_Document* pDocument, int nPageIndex, int nFieldType , 4123 void Field::AddField(CPDFSDK_Document* pDocument, int nPageIndex, int nFieldType ,
4124 const CFX_WideString& sN ame, const CPDF_Rect& rcCoords) 4124 const CFX_WideString& sN ame, const CPDF_Rect& rcCoords)
4125 { 4125 {
4126 //Not supported. 4126 //Not supported.
4127 } 4127 }
4128 4128
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/Document.cpp ('k') | fpdfsdk/src/javascript/JS_Context.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698