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

Unified Diff: fpdfsdk/javascript/Field.cpp

Issue 2266193002: Implement Field::SetHidden using Field::SetDisplay. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/javascript/Field.cpp
diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp
index 3b69a5ac22db96b95dd23eee0f4a03e871d00cb3..5c279d6b53a9839a077efca1d18e66f045f9b531 100644
--- a/fpdfsdk/javascript/Field.cpp
+++ b/fpdfsdk/javascript/Field.cpp
@@ -1531,65 +1531,8 @@ void Field::SetHidden(CPDFSDK_Document* pDocument,
const CFX_WideString& swFieldName,
int nControlIndex,
bool b) {
- CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm();
- std::vector<CPDF_FormField*> FieldArray =
- GetFormFields(pDocument, swFieldName);
- for (CPDF_FormField* pFormField : FieldArray) {
- if (nControlIndex < 0) {
- FX_BOOL bSet = FALSE;
- for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) {
- if (CPDFSDK_Widget* pWidget =
- pInterForm->GetWidget(pFormField->GetControl(i), false)) {
- uint32_t dwFlags = pWidget->GetFlags();
-
- if (b) {
- dwFlags &= (~ANNOTFLAG_INVISIBLE);
- dwFlags &= (~ANNOTFLAG_NOVIEW);
- dwFlags |= (ANNOTFLAG_HIDDEN | ANNOTFLAG_PRINT);
- } else {
- dwFlags &= (~ANNOTFLAG_INVISIBLE);
- dwFlags &= (~ANNOTFLAG_HIDDEN);
- dwFlags &= (~ANNOTFLAG_NOVIEW);
- dwFlags |= ANNOTFLAG_PRINT;
- }
-
- if (dwFlags != pWidget->GetFlags()) {
- pWidget->SetFlags(dwFlags);
- bSet = TRUE;
- }
- }
- }
-
- if (bSet)
- UpdateFormField(pDocument, pFormField, TRUE, FALSE, TRUE);
- } else {
- if (nControlIndex >= pFormField->CountControls())
- return;
- if (CPDF_FormControl* pFormControl =
- pFormField->GetControl(nControlIndex)) {
- if (CPDFSDK_Widget* pWidget =
- pInterForm->GetWidget(pFormControl, false)) {
- uint32_t dwFlags = pWidget->GetFlags();
-
- if (b) {
- dwFlags &= (~ANNOTFLAG_INVISIBLE);
- dwFlags &= (~ANNOTFLAG_NOVIEW);
- dwFlags |= (ANNOTFLAG_HIDDEN | ANNOTFLAG_PRINT);
- } else {
- dwFlags &= (~ANNOTFLAG_INVISIBLE);
- dwFlags &= (~ANNOTFLAG_HIDDEN);
- dwFlags &= (~ANNOTFLAG_NOVIEW);
- dwFlags |= ANNOTFLAG_PRINT;
- }
-
- if (dwFlags != pWidget->GetFlags()) {
- pWidget->SetFlags(dwFlags);
- UpdateFormControl(pDocument, pFormControl, TRUE, FALSE, TRUE);
- }
- }
- }
- }
- }
+ int display = b ? 1 /*Hidden*/ : 0 /*Visible*/;
+ SetDisplay(pDocument, swFieldName, nControlIndex, display);
}
FX_BOOL Field::highlight(IJS_Context* cc,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698