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

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

Issue 1980973002: Convert border style defines to an enum class. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 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 "fpdfsdk/javascript/Field.h" 7 #include "fpdfsdk/javascript/Field.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 388
389 CPDF_FormField* pFormField = FieldArray[0]; 389 CPDF_FormField* pFormField = FieldArray[0];
390 if (!pFormField) 390 if (!pFormField)
391 return FALSE; 391 return FALSE;
392 392
393 CPDFSDK_Widget* pWidget = 393 CPDFSDK_Widget* pWidget =
394 GetWidget(m_pDocument, GetSmartFieldControl(pFormField)); 394 GetWidget(m_pDocument, GetSmartFieldControl(pFormField));
395 if (!pWidget) 395 if (!pWidget)
396 return FALSE; 396 return FALSE;
397 397
398 int nBorderstyle = pWidget->GetBorderStyle(); 398 switch (pWidget->GetBorderStyle()) {
399 399 case BorderStyle::SOLID:
400 switch (nBorderstyle) {
401 case BBS_SOLID:
402 vp << L"solid"; 400 vp << L"solid";
403 break; 401 break;
404 case BBS_DASH: 402 case BorderStyle::DASH:
405 vp << L"dashed"; 403 vp << L"dashed";
406 break; 404 break;
407 case BBS_BEVELED: 405 case BorderStyle::BEVELED:
408 vp << L"beveled"; 406 vp << L"beveled";
409 break; 407 break;
410 case BBS_INSET: 408 case BorderStyle::INSET:
411 vp << L"inset"; 409 vp << L"inset";
412 break; 410 break;
413 case BBS_UNDERLINE: 411 case BorderStyle::UNDERLINE:
414 vp << L"underline"; 412 vp << L"underline";
415 break; 413 break;
416 default: 414 default:
417 vp << L""; 415 vp << L"";
418 break; 416 break;
419 } 417 }
420 } 418 }
421 419
422 return TRUE; 420 return TRUE;
423 } 421 }
424 422
425 void Field::SetBorderStyle(CPDFSDK_Document* pDocument, 423 void Field::SetBorderStyle(CPDFSDK_Document* pDocument,
426 const CFX_WideString& swFieldName, 424 const CFX_WideString& swFieldName,
427 int nControlIndex, 425 int nControlIndex,
428 const CFX_ByteString& string) { 426 const CFX_ByteString& string) {
429 ASSERT(pDocument); 427 ASSERT(pDocument);
430 428
431 int nBorderStyle = 0; 429 BorderStyle nBorderStyle = BorderStyle::SOLID;
432
433 if (string == "solid") 430 if (string == "solid")
434 nBorderStyle = BBS_SOLID; 431 nBorderStyle = BorderStyle::SOLID;
435 else if (string == "beveled") 432 else if (string == "beveled")
436 nBorderStyle = BBS_BEVELED; 433 nBorderStyle = BorderStyle::BEVELED;
437 else if (string == "dashed") 434 else if (string == "dashed")
438 nBorderStyle = BBS_DASH; 435 nBorderStyle = BorderStyle::DASH;
439 else if (string == "inset") 436 else if (string == "inset")
440 nBorderStyle = BBS_INSET; 437 nBorderStyle = BorderStyle::INSET;
441 else if (string == "underline") 438 else if (string == "underline")
442 nBorderStyle = BBS_UNDERLINE; 439 nBorderStyle = BorderStyle::UNDERLINE;
443 else 440 else
444 return; 441 return;
445 442
446 std::vector<CPDF_FormField*> FieldArray = 443 std::vector<CPDF_FormField*> FieldArray =
447 GetFormFields(pDocument, swFieldName); 444 GetFormFields(pDocument, swFieldName);
448 for (CPDF_FormField* pFormField : FieldArray) { 445 for (CPDF_FormField* pFormField : FieldArray) {
449 if (nControlIndex < 0) { 446 if (nControlIndex < 0) {
450 FX_BOOL bSet = FALSE; 447 FX_BOOL bSet = FALSE;
451 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { 448 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) {
452 if (CPDFSDK_Widget* pWidget = 449 if (CPDFSDK_Widget* pWidget =
(...skipping 3098 matching lines...) Expand 10 before | Expand all | Expand 10 after
3551 } 3548 }
3552 } 3549 }
3553 3550
3554 void Field::AddField(CPDFSDK_Document* pDocument, 3551 void Field::AddField(CPDFSDK_Document* pDocument,
3555 int nPageIndex, 3552 int nPageIndex,
3556 int nFieldType, 3553 int nFieldType,
3557 const CFX_WideString& sName, 3554 const CFX_WideString& sName,
3558 const CFX_FloatRect& rcCoords) { 3555 const CFX_FloatRect& rcCoords) {
3559 // Not supported. 3556 // Not supported.
3560 } 3557 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698