summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-form.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2014-04-11 15:58:51 +0200
committerTor Andersson <tor.andersson@artifex.com>2014-04-11 16:42:33 +0200
commitad0fa16fd4e3102ae01b0c84de1f1d52242f99a4 (patch)
treedd9e6ab3f8cc5195921ab5117da1f2f894f19a73 /source/pdf/pdf-form.c
parentef1e93e6442b06890fffb70419a93e47e666f013 (diff)
downloadmupdf-ad0fa16fd4e3102ae01b0c84de1f1d52242f99a4.tar.xz
Add all form field flags. Check flags before marking fields dirty.
NoExport (and ReadOnly) fields shouldn't mark the document for saving.
Diffstat (limited to 'source/pdf/pdf-form.c')
-rw-r--r--source/pdf/pdf-form.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/source/pdf/pdf-form.c b/source/pdf/pdf-form.c
index ab5a808c..c5e2ef78 100644
--- a/source/pdf/pdf-form.c
+++ b/source/pdf/pdf-form.c
@@ -15,6 +15,14 @@ enum
SigFlag_AppendOnly = 2
};
+static int pdf_field_dirties_document(pdf_document *doc, pdf_obj *field)
+{
+ int ff = pdf_get_field_flags(doc, field);
+ if (ff & Ff_NoExport) return 0;
+ if (ff & Ff_ReadOnly) return 0;
+ return 1;
+}
+
/* Find the point in a field hierarchy where all descendents
* share the same name */
static pdf_obj *find_head_of_field_group(pdf_obj *obj)
@@ -178,7 +186,8 @@ static void reset_field(pdf_document *doc, pdf_obj *field)
}
}
- doc->dirty = 1;
+ if (pdf_field_dirties_document(doc, field))
+ doc->dirty = 1;
}
void pdf_field_reset(pdf_document *doc, pdf_obj *field)
@@ -870,7 +879,8 @@ static int set_text_field_value(pdf_document *doc, pdf_obj *field, char *text)
text = pdf_js_get_event(doc->js)->value;
}
- doc->dirty = 1;
+ if (pdf_field_dirties_document(doc, field))
+ doc->dirty = 1;
update_field_value(doc, field, text);
return 1;
@@ -1434,7 +1444,8 @@ void pdf_choice_widget_set_value(pdf_document *doc, pdf_widget *tw, int n, char
pdf_dict_dels(annot->obj, "I");
pdf_field_mark_dirty(doc, annot->obj);
- doc->dirty = 1;
+ if (pdf_field_dirties_document(doc, annot->obj))
+ doc->dirty = 1;
}
fz_catch(ctx)
{