diff options
author | Carlos Garcia Campos <carlosgc@gnome.org> | 2009-06-02 11:26:40 +0200 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2009-06-16 16:34:16 +0200 |
commit | 287feffc1c1c0aa42a398fc071b489acef9ef22e (patch) | |
tree | b8c3b45d6175ac137626c65e0fa3dc45c97043d2 | |
parent | 2a938af5624fbc79316dd6bee5e550f2b4270a76 (diff) |
Add setLabel() and setPopup() to AnnotMarkup
-rw-r--r-- | poppler/Annot.cc | 36 | ||||
-rw-r--r-- | poppler/Annot.h | 4 |
2 files changed, 40 insertions, 0 deletions
diff --git a/poppler/Annot.cc b/poppler/Annot.cc index 78b4f111..b8f9b18d 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -1440,6 +1440,42 @@ void AnnotMarkup::initialize(XRef *xrefA, Dict *dict, Catalog *catalog, Object * obj1.free(); } +void AnnotMarkup::setLabel(GooString *new_label) { + delete label; + + if (new_label) { + label = new GooString(new_label); + //append the unicode marker <FE FF> if needed + if (!label->hasUnicodeMarker()) { + label->insert(0, 0xff); + label->insert(0, 0xfe); + } + } else { + label = new GooString(); + } + + Object obj1; + obj1.initString(label->copy()); + update ("T", &obj1); +} + +void AnnotMarkup::setPopup(AnnotPopup *new_popup) { + delete popup; + + if (new_popup) { + Object obj1; + Ref popupRef = new_popup->getRef(); + + obj1.initRef (popupRef.num, popupRef.gen); + update ("Popup", &obj1); + + new_popup->setParent(this); + popup = new_popup; + } else { + popup = NULL; + } +} + //------------------------------------------------------------------------ // AnnotText //------------------------------------------------------------------------ diff --git a/poppler/Annot.h b/poppler/Annot.h index 9c55aeea..ab45daf0 100644 --- a/poppler/Annot.h +++ b/poppler/Annot.h @@ -625,6 +625,10 @@ public: AnnotMarkupReplyType getReplyTo() const { return replyTo; } AnnotExternalDataType getExData() const { return exData; } + // The annotation takes the ownership of new_popup + void setPopup(AnnotPopup *new_popup); + void setLabel(GooString *new_label); + protected: GooString *label; // T (Default autor) AnnotPopup *popup; // Popup |