From 5f63c45b41f5207c864915dd2c42b9a484fb3592 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 25 Jul 2018 17:32:07 +0200 Subject: Use proper name space for form field flag constants. --- source/pdf/pdf-appearance.c | 4 ++-- source/pdf/pdf-field.c | 18 +++++++++--------- source/pdf/pdf-form.c | 11 ++++++----- 3 files changed, 17 insertions(+), 16 deletions(-) (limited to 'source') diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c index fb5b8343..84c899cd 100644 --- a/source/pdf/pdf-appearance.c +++ b/source/pdf/pdf-appearance.c @@ -1045,12 +1045,12 @@ pdf_write_tx_widget_appearance(fz_context *ctx, pdf_annot *annot, fz_buffer *buf b = 0; } - if (ff & Ff_Comb) + if (ff & PDF_TX_FIELD_IS_COMB) { int maxlen = pdf_to_int(ctx, pdf_dict_get_inheritable(ctx, annot->obj, PDF_NAME(MaxLen))); write_variable_text(ctx, annot, buf, res, text, font, size, color, q, w, h, 0, 0, 0, maxlen); } - else if (ff & Ff_Multiline) + else if (ff & PDF_TX_FIELD_IS_MULTILINE) write_variable_text(ctx, annot, buf, res, text, font, size, color, q, w, h, b*2+2, b*2, 1, 0); else write_variable_text(ctx, annot, buf, res, text, font, size, color, q, w, h, b*2+2, b*2, 0, 0); diff --git a/source/pdf/pdf-field.c b/source/pdf/pdf-field.c index 3bb0acc3..cc5ebf40 100644 --- a/source/pdf/pdf-field.c +++ b/source/pdf/pdf-field.c @@ -25,9 +25,9 @@ int pdf_field_type(fz_context *ctx, pdf_document *doc, pdf_obj *obj) if (pdf_name_eq(ctx, type, PDF_NAME(Btn))) { - if (flags & Ff_Pushbutton) + if (flags & PDF_BTN_FIELD_IS_PUSHBUTTON) return PDF_WIDGET_TYPE_PUSHBUTTON; - else if (flags & Ff_Radio) + else if (flags & PDF_BTN_FIELD_IS_RADIO) return PDF_WIDGET_TYPE_RADIOBUTTON; else return PDF_WIDGET_TYPE_CHECKBOX; @@ -36,7 +36,7 @@ int pdf_field_type(fz_context *ctx, pdf_document *doc, pdf_obj *obj) return PDF_WIDGET_TYPE_TEXT; else if (pdf_name_eq(ctx, type, PDF_NAME(Ch))) { - if (flags & Ff_Combo) + if (flags & PDF_CH_FIELD_IS_COMBO) return PDF_WIDGET_TYPE_COMBOBOX; else return PDF_WIDGET_TYPE_LISTBOX; @@ -57,27 +57,27 @@ void pdf_set_field_type(fz_context *ctx, pdf_document *doc, pdf_obj *obj, int ty { case PDF_WIDGET_TYPE_PUSHBUTTON: typename = PDF_NAME(Btn); - setbits = Ff_Pushbutton; + setbits = PDF_BTN_FIELD_IS_PUSHBUTTON; break; case PDF_WIDGET_TYPE_CHECKBOX: typename = PDF_NAME(Btn); - clearbits = Ff_Pushbutton; - setbits = Ff_Radio; + clearbits = PDF_BTN_FIELD_IS_PUSHBUTTON; + setbits = PDF_BTN_FIELD_IS_RADIO; break; case PDF_WIDGET_TYPE_RADIOBUTTON: typename = PDF_NAME(Btn); - clearbits = (Ff_Pushbutton|Ff_Radio); + clearbits = (PDF_BTN_FIELD_IS_PUSHBUTTON|PDF_BTN_FIELD_IS_RADIO); break; case PDF_WIDGET_TYPE_TEXT: typename = PDF_NAME(Tx); break; case PDF_WIDGET_TYPE_LISTBOX: typename = PDF_NAME(Ch); - clearbits = Ff_Combo; + clearbits = PDF_CH_FIELD_IS_COMBO; break; case PDF_WIDGET_TYPE_COMBOBOX: typename = PDF_NAME(Ch); - setbits = Ff_Combo; + setbits = PDF_CH_FIELD_IS_COMBO; break; case PDF_WIDGET_TYPE_SIGNATURE: typename = PDF_NAME(Sig); diff --git a/source/pdf/pdf-form.c b/source/pdf/pdf-form.c index 8797e780..224e8017 100644 --- a/source/pdf/pdf-form.c +++ b/source/pdf/pdf-form.c @@ -21,8 +21,8 @@ enum static int pdf_field_dirties_document(fz_context *ctx, pdf_document *doc, pdf_obj *field) { int ff = pdf_get_field_flags(ctx, doc, field); - if (ff & Ff_NoExport) return 0; - if (ff & Ff_ReadOnly) return 0; + if (ff & PDF_FIELD_IS_NO_EXPORT) return 0; + if (ff & PDF_FIELD_IS_READ_ONLY) return 0; return 1; } @@ -454,7 +454,8 @@ static void toggle_check_box(fz_context *ctx, pdf_document *doc, pdf_obj *obj) { pdf_obj *as = pdf_dict_get(ctx, obj, PDF_NAME(AS)); int ff = pdf_get_field_flags(ctx, doc, obj); - int radio = ((ff & (Ff_Pushbutton|Ff_Radio)) == Ff_Radio); + int button_mask = PDF_BTN_FIELD_IS_RADIO | PDF_BTN_FIELD_IS_PUSHBUTTON; + int radio = ((ff & button_mask) == PDF_BTN_FIELD_IS_RADIO); char *val = NULL; pdf_obj *grp = radio ? pdf_dict_get(ctx, obj, PDF_NAME(Parent)) : find_head_of_field_group(ctx, obj); @@ -465,7 +466,7 @@ static void toggle_check_box(fz_context *ctx, pdf_document *doc, pdf_obj *obj) { /* "as" neither missing nor set to Off. Set it to Off, unless * this is a non-toggle-off radio button. */ - if ((ff & (Ff_Pushbutton|Ff_NoToggleToOff|Ff_Radio)) != (Ff_NoToggleToOff|Ff_Radio)) + if (radio && !(ff & PDF_BTN_FIELD_IS_NO_TOGGLE_TO_OFF)) { check_off(ctx, doc, obj); val = "Off"; @@ -1138,7 +1139,7 @@ int pdf_choice_widget_is_multiselect(fz_context *ctx, pdf_document *doc, pdf_wid { case PDF_WIDGET_TYPE_LISTBOX: case PDF_WIDGET_TYPE_COMBOBOX: - return (pdf_get_field_flags(ctx, doc, annot->obj) & Ff_MultiSelect) != 0; + return (pdf_get_field_flags(ctx, doc, annot->obj) & PDF_CH_FIELD_IS_MULTI_SELECT) != 0; default: return 0; } -- cgit v1.2.3