OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |