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

Side by Side Diff: fpdfsdk/cpdfsdk_interform.cpp

Issue 2323493002: Pass CFX_WideString further down widget callers (Closed)
Patch Set: Fix comments Created 4 years, 3 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 | « no previous file | fpdfsdk/cpdfsdk_widget.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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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/include/cpdfsdk_interform.h" 7 #include "fpdfsdk/include/cpdfsdk_interform.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 bFormatted = TRUE; 316 bFormatted = TRUE;
317 } 317 }
318 } 318 }
319 } 319 }
320 } 320 }
321 321
322 return sValue; 322 return sValue;
323 } 323 }
324 324
325 void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField, 325 void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField,
326 const FX_WCHAR* sValue, 326 const CFX_WideString* sValue,
327 FX_BOOL bValueChanged) { 327 FX_BOOL bValueChanged) {
328 for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) { 328 for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) {
329 CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); 329 CPDF_FormControl* pFormCtrl = pFormField->GetControl(i);
330 ASSERT(pFormCtrl); 330 ASSERT(pFormCtrl);
331 if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl, false)) 331 if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl, false))
332 pWidget->ResetAppearance(sValue, bValueChanged); 332 pWidget->ResetAppearance(sValue, bValueChanged);
333 } 333 }
334 } 334 }
335 335
336 void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) { 336 void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) {
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 627
628 void CPDFSDK_InterForm::AfterValueChange(CPDF_FormField* pField) { 628 void CPDFSDK_InterForm::AfterValueChange(CPDF_FormField* pField) {
629 #ifdef PDF_ENABLE_XFA 629 #ifdef PDF_ENABLE_XFA
630 SynchronizeField(pField, FALSE); 630 SynchronizeField(pField, FALSE);
631 #endif // PDF_ENABLE_XFA 631 #endif // PDF_ENABLE_XFA
632 int nType = pField->GetFieldType(); 632 int nType = pField->GetFieldType();
633 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) { 633 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) {
634 OnCalculate(pField); 634 OnCalculate(pField);
635 FX_BOOL bFormatted = FALSE; 635 FX_BOOL bFormatted = FALSE;
636 CFX_WideString sValue = OnFormat(pField, bFormatted); 636 CFX_WideString sValue = OnFormat(pField, bFormatted);
637 ResetFieldAppearance(pField, bFormatted ? sValue.c_str() : nullptr, TRUE); 637 ResetFieldAppearance(pField, bFormatted ? &sValue : nullptr, TRUE);
638 UpdateField(pField); 638 UpdateField(pField);
639 } 639 }
640 } 640 }
641 641
642 int CPDFSDK_InterForm::BeforeSelectionChange(CPDF_FormField* pField, 642 int CPDFSDK_InterForm::BeforeSelectionChange(CPDF_FormField* pField,
643 const CFX_WideString& csValue) { 643 const CFX_WideString& csValue) {
644 if (pField->GetFieldType() != FIELDTYPE_LISTBOX) 644 if (pField->GetFieldType() != FIELDTYPE_LISTBOX)
645 return 0; 645 return 0;
646 646
647 if (!OnKeyStrokeCommit(pField, csValue)) 647 if (!OnKeyStrokeCommit(pField, csValue))
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 } 717 }
718 } 718 }
719 719
720 FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType) { 720 FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType) {
721 if (nFieldType < 0 || nFieldType > kNumFieldTypes) 721 if (nFieldType < 0 || nFieldType > kNumFieldTypes)
722 return FXSYS_RGB(255, 255, 255); 722 return FXSYS_RGB(255, 255, 255);
723 if (nFieldType == 0) 723 if (nFieldType == 0)
724 return m_aHighlightColor[0]; 724 return m_aHighlightColor[0];
725 return m_aHighlightColor[nFieldType - 1]; 725 return m_aHighlightColor[nFieldType - 1];
726 } 726 }
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/cpdfsdk_widget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698