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

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

Issue 2397723005: Convert CPDFSDK_InterForm to take a CPDFSDK_FormFillEnvironment (Closed)
Patch Set: Rebase to master Created 4 years, 2 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/cpdfsdk_widget.cpp ('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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 288 }
289 } 289 }
290 290
291 if (bRefresh) { 291 if (bRefresh) {
292 // Refresh the widget list. The calls in |bResetAP| may have caused widgets 292 // Refresh the widget list. The calls in |bResetAP| may have caused widgets
293 // to be removed from the list. We need to call |GetWidgets| again to be 293 // to be removed from the list. We need to call |GetWidgets| again to be
294 // sure none of the widgets have been deleted. 294 // sure none of the widgets have been deleted.
295 std::vector<CPDFSDK_Widget*> widgets; 295 std::vector<CPDFSDK_Widget*> widgets;
296 pInterForm->GetWidgets(pFormField, &widgets); 296 pInterForm->GetWidgets(pFormField, &widgets);
297 297
298 // TODO(dsinclair): Determine if all widgets share the same
299 // CPDFSDK_InterForm. If that's the case, we can move the code to
300 // |GetSDKDocument| out of the loop.
298 for (CPDFSDK_Widget* pWidget : widgets) { 301 for (CPDFSDK_Widget* pWidget : widgets) {
299 CPDFSDK_Document* pDoc = pWidget->GetInterForm()->GetDocument(); 302 pWidget->GetInterForm()
300 pDoc->UpdateAllViews(nullptr, pWidget); 303 ->GetFormFillEnv()
304 ->GetSDKDocument()
305 ->UpdateAllViews(nullptr, pWidget);
301 } 306 }
302 } 307 }
303 308
304 if (bChangeMark) 309 if (bChangeMark)
305 pDocument->SetChangeMark(); 310 pDocument->SetChangeMark();
306 } 311 }
307 312
308 void Field::UpdateFormControl(CPDFSDK_Document* pDocument, 313 void Field::UpdateFormControl(CPDFSDK_Document* pDocument,
309 CPDF_FormControl* pFormControl, 314 CPDF_FormControl* pFormControl,
310 FX_BOOL bChangeMark, 315 FX_BOOL bChangeMark,
(...skipping 12 matching lines...) Expand all
323 FX_BOOL bFormatted = FALSE; 328 FX_BOOL bFormatted = FALSE;
324 CFX_WideString sValue = pWidget->OnFormat(bFormatted); 329 CFX_WideString sValue = pWidget->OnFormat(bFormatted);
325 pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, FALSE); 330 pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, FALSE);
326 } else { 331 } else {
327 pWidget->ResetAppearance(nullptr, FALSE); 332 pWidget->ResetAppearance(nullptr, FALSE);
328 } 333 }
329 } 334 }
330 335
331 if (bRefresh) { 336 if (bRefresh) {
332 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); 337 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm();
333 CPDFSDK_Document* pDoc = pInterForm->GetDocument(); 338 pInterForm->GetFormFillEnv()->GetSDKDocument()->UpdateAllViews(nullptr,
334 pDoc->UpdateAllViews(nullptr, pWidget); 339 pWidget);
335 } 340 }
336 } 341 }
337 342
338 if (bChangeMark) 343 if (bChangeMark)
339 pDocument->SetChangeMark(); 344 pDocument->SetChangeMark();
340 } 345 }
341 346
342 CPDFSDK_Widget* Field::GetWidget(CPDFSDK_Document* pDocument, 347 CPDFSDK_Widget* Field::GetWidget(CPDFSDK_Document* pDocument,
343 CPDF_FormControl* pFormControl, 348 CPDF_FormControl* pFormControl,
344 bool createIfNeeded) { 349 bool createIfNeeded) {
(...skipping 3147 matching lines...) Expand 10 before | Expand all | Expand 10 after
3492 } 3497 }
3493 } 3498 }
3494 3499
3495 void Field::AddField(CPDFSDK_Document* pDocument, 3500 void Field::AddField(CPDFSDK_Document* pDocument,
3496 int nPageIndex, 3501 int nPageIndex,
3497 int nFieldType, 3502 int nFieldType,
3498 const CFX_WideString& sName, 3503 const CFX_WideString& sName,
3499 const CFX_FloatRect& rcCoords) { 3504 const CFX_FloatRect& rcCoords) {
3500 // Not supported. 3505 // Not supported.
3501 } 3506 }
OLDNEW
« no previous file with comments | « fpdfsdk/cpdfsdk_widget.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698