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

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

Issue 2323493002: Pass CFX_WideString further down widget callers (Closed)
Patch Set: Null vs Empty string significant in places 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
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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 266
267 if (bResetAP) { 267 if (bResetAP) {
268 int nFieldType = pFormField->GetFieldType(); 268 int nFieldType = pFormField->GetFieldType();
269 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) { 269 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) {
270 for (CPDFSDK_Annot* pAnnot : widgets) { 270 for (CPDFSDK_Annot* pAnnot : widgets) {
271 FX_BOOL bFormatted = FALSE; 271 FX_BOOL bFormatted = FALSE;
272 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); 272 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot);
273 CPDFSDK_Widget::Observer observer(&pAnnot); 273 CPDFSDK_Widget::Observer observer(&pAnnot);
274 CFX_WideString sValue = pWidget->OnFormat(bFormatted); 274 CFX_WideString sValue = pWidget->OnFormat(bFormatted);
275 if (pAnnot) { 275 if (pAnnot) {
276 pWidget->ResetAppearance(bFormatted ? sValue.c_str() : nullptr, 276 pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, FALSE);
277 FALSE);
278 } 277 }
279 } 278 }
280 } else { 279 } else {
281 for (CPDFSDK_Widget* pWidget : widgets) { 280 for (CPDFSDK_Widget* pWidget : widgets) {
282 pWidget->ResetAppearance(nullptr, FALSE); 281 pWidget->ResetAppearance(nullptr, FALSE);
283 } 282 }
284 } 283 }
285 } 284 }
286 285
287 if (bRefresh) { 286 if (bRefresh) {
(...skipping 15 matching lines...) Expand all
303 ASSERT(pFormControl); 302 ASSERT(pFormControl);
304 303
305 CPDFSDK_InterForm* pForm = pDocument->GetInterForm(); 304 CPDFSDK_InterForm* pForm = pDocument->GetInterForm();
306 CPDFSDK_Widget* pWidget = pForm->GetWidget(pFormControl, false); 305 CPDFSDK_Widget* pWidget = pForm->GetWidget(pFormControl, false);
307 306
308 if (pWidget) { 307 if (pWidget) {
309 if (bResetAP) { 308 if (bResetAP) {
310 int nFieldType = pWidget->GetFieldType(); 309 int nFieldType = pWidget->GetFieldType();
311 if (nFieldType == FIELDTYPE_COMBOBOX || 310 if (nFieldType == FIELDTYPE_COMBOBOX ||
312 nFieldType == FIELDTYPE_TEXTFIELD) { 311 nFieldType == FIELDTYPE_TEXTFIELD) {
313 FX_BOOL bFormated = FALSE; 312 FX_BOOL bFormatted = FALSE;
314 CFX_WideString sValue = pWidget->OnFormat(bFormated); 313 CFX_WideString sValue = pWidget->OnFormat(bFormatted);
315 if (bFormated) 314 pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, FALSE);
316 pWidget->ResetAppearance(sValue.c_str(), FALSE);
317 else
318 pWidget->ResetAppearance(nullptr, FALSE);
319 } else { 315 } else {
320 pWidget->ResetAppearance(nullptr, FALSE); 316 pWidget->ResetAppearance(nullptr, FALSE);
321 } 317 }
322 } 318 }
323 319
324 if (bRefresh) { 320 if (bRefresh) {
325 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); 321 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm();
326 CPDFSDK_Document* pDoc = pInterForm->GetDocument(); 322 CPDFSDK_Document* pDoc = pInterForm->GetDocument();
327 pDoc->UpdateAllViews(nullptr, pWidget); 323 pDoc->UpdateAllViews(nullptr, pWidget);
328 } 324 }
(...skipping 3142 matching lines...) Expand 10 before | Expand all | Expand 10 after
3471 } 3467 }
3472 } 3468 }
3473 3469
3474 void Field::AddField(CPDFSDK_Document* pDocument, 3470 void Field::AddField(CPDFSDK_Document* pDocument,
3475 int nPageIndex, 3471 int nPageIndex,
3476 int nFieldType, 3472 int nFieldType,
3477 const CFX_WideString& sName, 3473 const CFX_WideString& sName,
3478 const CFX_FloatRect& rcCoords) { 3474 const CFX_FloatRect& rcCoords) {
3479 // Not supported. 3475 // Not supported.
3480 } 3476 }
OLDNEW
« fpdfsdk/fxedit/fxet_edit.cpp ('K') | « fpdfsdk/include/cpdfsdk_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698