Commit 8757c577 authored by Inigo Martínez's avatar Inigo Martínez

AnnotFileAttachment support.

Signed-off-by: Inigo Martínez's avatarIñigo Martínez <inigomartinez@gmail.com>
parent 36989658
......@@ -3518,6 +3518,40 @@ AnnotPath *AnnotInk::parsePathArray(Array *array) {
return (new AnnotPath(coords, coordsLength));
}
//------------------------------------------------------------------------
// AnnotFileAttachment
//------------------------------------------------------------------------
AnnotFileAttachment::AnnotFileAttachment(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
AnnotMarkup(xrefA, dict, catalog, obj) {
type = typeFileAttachment;
initialize(xrefA, catalog, dict);
}
AnnotFileAttachment::~AnnotFileAttachment() {
file.free();
if (name)
delete name;
}
void AnnotFileAttachment::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) {
Object obj1;
if (dict->lookup("FS", &obj1)->isRef()) {
obj1.copy(&file);
} else {
error(-1, "Bad Annot File Attachment");
}
if (dict->lookup("Name", &obj1)->isName()) {
name = new GooString(obj1.getName());
} else {
name = new GooString("PushPin");
}
obj1.free();
}
//------------------------------------------------------------------------
// Annots
//------------------------------------------------------------------------
......@@ -3593,9 +3627,9 @@ Annot *Annots::createAnnot(XRef *xref, Dict* dict, Catalog *catalog, Object *obj
} else if (!typeName->cmp("Caret")) {
annot = new AnnotCaret(xref, dict, catalog, obj);
} else if (!typeName->cmp("Ink")) {
annot = new Annot(xref, dict, catalog, obj);
annot = new AnnotInk(xref, dict, catalog, obj);
} else if (!typeName->cmp("FileAttachment")) {
annot = new Annot(xref, dict, catalog, obj);
annot = new AnnotFileAttachment(xref, dict, catalog, obj);
} else if (!typeName->cmp("Sound")) {
annot = new Annot(xref, dict, catalog, obj);
} else if(!typeName->cmp("Movie")) {
......
......@@ -1022,6 +1022,31 @@ private:
// AnnotBorderBS border; // BS
};
//------------------------------------------------------------------------
// AnnotFileAttachment
//------------------------------------------------------------------------
class AnnotFileAttachment: public AnnotMarkup {
public:
AnnotFileAttachment(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj);
~AnnotFileAttachment();
// getters
virtual Object *getFile(Object *obj) { return file.fetch(xref, obj); }
virtual GooString *getName() const { return name; }
private:
void initialize(XRef *xrefA, Catalog *catalog, Dict *dict);
// required
Object file; // FS
// optional
GooString *name; // Name
};
//------------------------------------------------------------------------
// AnnotWidget
//------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment