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

Side by Side Diff: fpdfsdk/javascript/Field.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 | « fpdfsdk/include/cpdfsdk_widget.h ('k') | no next file » | 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 "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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 int nFieldType = pFormField->GetFieldType(); 269 int nFieldType = pFormField->GetFieldType();
270 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) { 270 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) {
271 for (CPDFSDK_Annot* pAnnot : widgets) { 271 for (CPDFSDK_Annot* pAnnot : widgets) {
272 FX_BOOL bFormatted = FALSE; 272 FX_BOOL bFormatted = FALSE;
273 CPDFSDK_Annot::Observer observer(&pAnnot); 273 CPDFSDK_Annot::Observer observer(&pAnnot);
274 CFX_WideString sValue = 274 CFX_WideString sValue =
275 static_cast<CPDFSDK_Widget*>(pAnnot)->OnFormat(bFormatted); 275 static_cast<CPDFSDK_Widget*>(pAnnot)->OnFormat(bFormatted);
276 if (pAnnot) { 276 if (pAnnot) {
277 static_cast<CPDFSDK_Widget*>(pAnnot)->ResetAppearance( 277 static_cast<CPDFSDK_Widget*>(pAnnot)->ResetAppearance(
278 bFormatted ? sValue.c_str() : nullptr, FALSE); 278 bFormatted ? &sValue : nullptr, FALSE);
279 } 279 }
280 } 280 }
281 } else { 281 } else {
282 for (CPDFSDK_Widget* pWidget : widgets) { 282 for (CPDFSDK_Widget* pWidget : widgets) {
283 pWidget->ResetAppearance(nullptr, FALSE); 283 pWidget->ResetAppearance(nullptr, FALSE);
284 } 284 }
285 } 285 }
286 } 286 }
287 287
288 if (bRefresh) { 288 if (bRefresh) {
(...skipping 23 matching lines...) Expand all
312 CPDFSDK_InterForm* pForm = pDocument->GetInterForm(); 312 CPDFSDK_InterForm* pForm = pDocument->GetInterForm();
313 CPDFSDK_Widget* pWidget = pForm->GetWidget(pFormControl, false); 313 CPDFSDK_Widget* pWidget = pForm->GetWidget(pFormControl, false);
314 314
315 if (pWidget) { 315 if (pWidget) {
316 if (bResetAP) { 316 if (bResetAP) {
317 int nFieldType = pWidget->GetFieldType(); 317 int nFieldType = pWidget->GetFieldType();
318 if (nFieldType == FIELDTYPE_COMBOBOX || 318 if (nFieldType == FIELDTYPE_COMBOBOX ||
319 nFieldType == FIELDTYPE_TEXTFIELD) { 319 nFieldType == FIELDTYPE_TEXTFIELD) {
320 FX_BOOL bFormatted = FALSE; 320 FX_BOOL bFormatted = FALSE;
321 CFX_WideString sValue = pWidget->OnFormat(bFormatted); 321 CFX_WideString sValue = pWidget->OnFormat(bFormatted);
322 if (bFormatted) 322 pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, FALSE);
323 pWidget->ResetAppearance(sValue.c_str(), FALSE);
324 else
325 pWidget->ResetAppearance(nullptr, FALSE);
326 } else { 323 } else {
327 pWidget->ResetAppearance(nullptr, FALSE); 324 pWidget->ResetAppearance(nullptr, FALSE);
328 } 325 }
329 } 326 }
330 327
331 if (bRefresh) { 328 if (bRefresh) {
332 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); 329 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm();
333 CPDFSDK_Document* pDoc = pInterForm->GetDocument(); 330 CPDFSDK_Document* pDoc = pInterForm->GetDocument();
334 pDoc->UpdateAllViews(nullptr, pWidget); 331 pDoc->UpdateAllViews(nullptr, pWidget);
335 } 332 }
(...skipping 3142 matching lines...) Expand 10 before | Expand all | Expand 10 after
3478 } 3475 }
3479 } 3476 }
3480 3477
3481 void Field::AddField(CPDFSDK_Document* pDocument, 3478 void Field::AddField(CPDFSDK_Document* pDocument,
3482 int nPageIndex, 3479 int nPageIndex,
3483 int nFieldType, 3480 int nFieldType,
3484 const CFX_WideString& sName, 3481 const CFX_WideString& sName,
3485 const CFX_FloatRect& rcCoords) { 3482 const CFX_FloatRect& rcCoords) {
3486 // Not supported. 3483 // Not supported.
3487 } 3484 }
OLDNEW
« no previous file with comments | « fpdfsdk/include/cpdfsdk_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698