From a3de9e878d7ce07b6cc145a1485f005d0dd1e856 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?I=C3=B1igo=20Mart=C3=ADnez?= <inigomartinez@gmail.com>
Date: Sat, 8 Dec 2007 22:58:57 +0100
Subject: [PATCH] AnnotPopup support.
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Iñigo Martínez <inigomartinez@gmail.com>
---
 poppler/Annot.cc |   31 +++++++++++++++++++++++++++++++
 poppler/Annot.h  |   21 +++++++++++++++++++++
 2 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 098267d..b623baf 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -1685,6 +1685,37 @@ void Annot::draw(Gfx *gfx, GBool printing) {
   obj.free();
 }
 
+//------------------------------------------------------------------------
+// AnnotPopup
+//------------------------------------------------------------------------
+
+AnnotPopup::AnnotPopup(XRef *xrefA, Dict *acroForm, Dict *dict, Catalog *catalog, Object *obj) :
+    Annot(xrefA, acroForm, dict, catalog, obj) {
+  initialize(xrefA, acroForm, dict, catalog);
+}
+
+AnnotPopup::~AnnotPopup() {
+  if (parent)
+    delete parent;
+}
+
+void AnnotPopup::initialize(XRef *xrefA, Dict *acroForm, Dict *dict, Catalog *catalog) {
+  Object obj1;
+
+  if(dict->lookup("Parent", &obj1)->isDict()) {
+    parent = NULL;
+  } else {
+    parent = NULL;
+  }
+  obj1.free();
+  
+  if(dict->lookup("Open", &obj1)->isBool()) {
+    open = obj1.getBool();
+  } else {
+    open = gFalse;
+  }
+  obj1.free();
+}
 
 //------------------------------------------------------------------------
 // Annots
diff --git a/poppler/Annot.h b/poppler/Annot.h
index 0a9b934..61c0c09 100644
--- a/poppler/Annot.h
+++ b/poppler/Annot.h
@@ -286,6 +286,27 @@ private:
 };
 
 //------------------------------------------------------------------------
+// AnnotPopup
+//------------------------------------------------------------------------
+
+class AnnotPopup: public Annot {
+public:
+
+  AnnotPopup(XRef *xrefA, Dict *acroForm, Dict *dict, Catalog *catalog, Object *obj);
+  virtual ~AnnotPopup();
+
+  Dict *getParent() { return parent; }
+  bool getOpen() { return open; }
+
+protected:
+
+  void initialize(XRef *xrefA, Dict *acroForm, Dict *dict, Catalog *catalog);
+  
+  Dict *parent; // Parent
+  bool open;    // Open
+};
+
+//------------------------------------------------------------------------
 // Annots
 //------------------------------------------------------------------------
 
-- 
1.5.2.5

