[poppler] 2 commits - glib/Makefile.am glib/poppler-annot.cc glib/poppler-annot.h glib/poppler.h glib/poppler-page.cc glib/poppler-page.h glib/poppler-private.h poppler/Annot.cc poppler/Annot.h

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Tue Mar 11 14:09:38 PDT 2008


 glib/Makefile.am       |    2 
 glib/poppler-annot.cc  |  776 +++++++++++++++++++++++++++++++++++++++++++++++++
 glib/poppler-annot.h   |  181 +++++++++++
 glib/poppler-page.cc   |  166 ++++++++++
 glib/poppler-page.h    |   15 
 glib/poppler-private.h |    5 
 glib/poppler.h         |    7 
 poppler/Annot.cc       |    9 
 poppler/Annot.h        |   10 
 9 files changed, 1161 insertions(+), 10 deletions(-)

New commits:
commit 19f0e3b40bce4d8157d8c8bd04eaf6bacbef38b8
Author: Iñigo Martínez <inigomartinez at gmail.com>
Date:   Tue Mar 11 22:09:04 2008 +0100

    Add preliminary annotations support in the glib frontend

diff --git a/glib/Makefile.am b/glib/Makefile.am
index d77b3ae..f4df44d 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -63,6 +63,7 @@ poppler_glib_public_headers =			\
 	poppler-page.h				\
 	poppler-attachment.h			\
 	poppler-form-field.h			\
+	poppler-annot.h				\
 	poppler.h
 
 poppler_glib_includedir = $(includedir)/poppler/glib
@@ -80,6 +81,7 @@ libpoppler_glib_la_SOURCES =			\
 	poppler-page.cc				\
 	poppler-attachment.cc			\
 	poppler-form-field.cc			\
+	poppler-annot.cc			\
 	poppler.cc				\
 	poppler-private.h
 
diff --git a/glib/poppler-annot.cc b/glib/poppler-annot.cc
new file mode 100644
index 0000000..8d7ab49
--- /dev/null
+++ b/glib/poppler-annot.cc
@@ -0,0 +1,776 @@
+/* poppler-annot.cc: glib interface to poppler
+ *
+ * Copyright (C) 2007 Inigo Martinez <inigomartinez at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "poppler.h"
+#include "poppler-private.h"
+
+typedef struct _PopplerAnnotClass         PopplerAnnotClass;
+typedef struct _PopplerAnnotMarkupClass   PopplerAnnotMarkupClass;
+typedef struct _PopplerAnnotFreeTextClass PopplerAnnotFreeTextClass;
+typedef struct _PopplerAnnotTextClass     PopplerAnnotTextClass;
+
+struct _PopplerAnnot
+{
+  GObject  parent_instance;
+  Annot   *annot;
+};
+
+struct _PopplerAnnotClass
+{
+  GObjectClass parent_class;
+};
+
+struct _PopplerAnnotMarkup
+{
+  PopplerAnnot parent_instance;
+};
+
+struct _PopplerAnnotMarkupClass
+{
+  PopplerAnnotClass parent_class;
+};
+
+struct _PopplerAnnotText
+{
+  PopplerAnnotMarkup parent_instance;
+};
+
+struct _PopplerAnnotTextClass
+{
+  PopplerAnnotMarkupClass parent_class;
+};
+
+struct _PopplerAnnotFreeText
+{
+  PopplerAnnotMarkup parent_instance;
+};
+
+struct _PopplerAnnotFreeTextClass
+{
+  PopplerAnnotMarkupClass parent_class;
+};
+
+G_DEFINE_TYPE (PopplerAnnot, poppler_annot, G_TYPE_OBJECT);
+G_DEFINE_TYPE (PopplerAnnotMarkup, poppler_annot_markup, POPPLER_TYPE_ANNOT);
+G_DEFINE_TYPE (PopplerAnnotText, poppler_annot_text, POPPLER_TYPE_ANNOT_MARKUP);
+G_DEFINE_TYPE (PopplerAnnotFreeText, poppler_annot_free_text, POPPLER_TYPE_ANNOT_MARKUP);
+
+static void
+poppler_annot_finalize (GObject *object)
+{
+  PopplerAnnot *poppler_annot = POPPLER_ANNOT (object);
+
+  poppler_annot->annot = NULL;
+
+  G_OBJECT_CLASS (poppler_annot_parent_class)->finalize (object);
+}
+
+static void
+poppler_annot_init (PopplerAnnot *poppler_annot)
+{
+}
+
+static void
+poppler_annot_class_init (PopplerAnnotClass *klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+  gobject_class->finalize = poppler_annot_finalize;
+}
+
+PopplerAnnot *
+_poppler_annot_new (Annot *annot)
+{
+  PopplerAnnot *poppler_annot;
+
+  poppler_annot = POPPLER_ANNOT (g_object_new (POPPLER_TYPE_ANNOT, NULL));
+  poppler_annot->annot = annot;
+
+  return poppler_annot;
+}
+
+static void
+poppler_annot_markup_init (PopplerAnnotMarkup *poppler_annot)
+{
+}
+
+static void
+poppler_annot_markup_class_init (PopplerAnnotMarkupClass *klass)
+{
+}
+
+static void
+poppler_annot_text_init (PopplerAnnotText *poppler_annot)
+{
+}
+
+static void
+poppler_annot_text_class_init (PopplerAnnotTextClass *klass)
+{
+}
+
+PopplerAnnot *
+_poppler_annot_text_new (Annot *annot)
+{
+  PopplerAnnot *poppler_annot;
+
+  poppler_annot = POPPLER_ANNOT (g_object_new (POPPLER_TYPE_ANNOT_TEXT, NULL));
+  poppler_annot->annot = annot;
+
+  return poppler_annot;
+}
+
+static void
+poppler_annot_free_text_init (PopplerAnnotFreeText *poppler_annot)
+{
+}
+
+static void
+poppler_annot_free_text_class_init (PopplerAnnotFreeTextClass *klass)
+{
+}
+
+PopplerAnnot *
+_poppler_annot_free_text_new (Annot *annot)
+{
+  PopplerAnnot *poppler_annot;
+
+  poppler_annot = POPPLER_ANNOT (g_object_new (POPPLER_TYPE_ANNOT_FREE_TEXT, NULL));
+  poppler_annot->annot = annot;
+
+  return poppler_annot;
+}
+
+/* Public methods */
+/**
+ * poppler_annot_get_annot_type:
+ * @poppler_annot: a #PopplerAnnot
+ *
+ * Gets the type of @poppler_annot
+ *
+ * Return value: #PopplerAnnotType of @poppler_annot.
+ **/ 
+PopplerAnnotType
+poppler_annot_get_annot_type (PopplerAnnot *poppler_annot)
+{
+  g_return_val_if_fail (POPPLER_IS_ANNOT (poppler_annot), POPPLER_ANNOT_UNKNOWN);
+
+  switch (poppler_annot->annot->getType ())
+    {
+    case Annot::typeText:
+      return POPPLER_ANNOT_TEXT;
+    case Annot::typeLink:
+      return POPPLER_ANNOT_LINK;
+    case Annot::typeFreeText:
+      return POPPLER_ANNOT_FREE_TEXT;
+    case Annot::typeLine:
+      return POPPLER_ANNOT_LINE;
+    case Annot::typeSquare:
+      return POPPLER_ANNOT_SQUARE;
+    case Annot::typeCircle:
+      return POPPLER_ANNOT_CIRCLE;
+    case Annot::typePolygon:
+      return POPPLER_ANNOT_POLYGON;
+    case Annot::typePolyLine:
+      return POPPLER_ANNOT_POLY_LINE;
+    case Annot::typeHighlight:
+      return POPPLER_ANNOT_HIGHLIGHT;
+    case Annot::typeUnderline:
+      return POPPLER_ANNOT_UNDERLINE;
+    case Annot::typeSquiggly:
+      return POPPLER_ANNOT_SQUIGGLY;
+    case Annot::typeStrikeOut:
+      return POPPLER_ANNOT_STRIKE_OUT;
+    case Annot::typeStamp:
+      return POPPLER_ANNOT_STAMP;
+    case Annot::typeCaret:
+      return POPPLER_ANNOT_CARET;
+    case Annot::typeInk:
+      return POPPLER_ANNOT_INK;
+    case Annot::typePopup:
+      return POPPLER_ANNOT_POPUP;
+    case Annot::typeFileAttachment:
+      return POPPLER_ANNOT_FILE_ATTACHMENT;
+    case Annot::typeSound:
+      return POPPLER_ANNOT_SOUND;
+    case Annot::typeMovie:
+      return POPPLER_ANNOT_MOVIE;
+    case Annot::typeWidget:
+      return POPPLER_ANNOT_WIDGET;
+    case Annot::typeScreen:
+      return POPPLER_ANNOT_SCREEN;
+    case Annot::typePrinterMark:
+      return POPPLER_ANNOT_PRINTER_MARK;
+    case Annot::typeTrapNet:
+      return POPPLER_ANNOT_TRAP_NET;
+    case Annot::typeWatermark:
+      return POPPLER_ANNOT_WATERMARK;
+    case Annot::type3D:
+      return POPPLER_ANNOT_3D;
+    default:
+      g_warning ("Unsupported Annot Type");
+    }
+
+  return POPPLER_ANNOT_UNKNOWN;
+}
+
+/**
+ * poppler_annot_get_contents:
+ * @poppler_annot: a #PopplerAnnot
+ *
+ * Retrieves the contents of @poppler_annot.
+ *
+ * Return value: a new allocated string with the contents of @poppler_annot. It
+ *               must be freed with g_free() when done.
+ **/
+gchar *
+poppler_annot_get_contents (PopplerAnnot *poppler_annot)
+{
+  GooString *contents;
+
+  g_return_val_if_fail (POPPLER_IS_ANNOT (poppler_annot), NULL);
+
+  contents = poppler_annot->annot->getContents ();
+
+  return contents ? _poppler_goo_string_to_utf8 (contents) : NULL;
+}
+
+/**
+ * poppler_annot_get_name:
+ * @poppler_annot: a #PopplerAnnot
+ *
+ * Retrieves the name of @poppler_annot.
+ *
+ * Return value: a new allocated string with the name of @poppler_annot. It must
+ *               be freed with g_free() when done.
+ **/
+gchar *
+poppler_annot_get_name (PopplerAnnot *poppler_annot)
+{
+  GooString *name;
+
+  g_return_val_if_fail (POPPLER_IS_ANNOT (poppler_annot), NULL);
+
+  name = poppler_annot->annot->getName ();
+
+  return name ? _poppler_goo_string_to_utf8 (name) : NULL;
+}
+
+/**
+ * poppler_annot_get_modified:
+ * @poppler_annot: a #PopplerAnnot
+ *
+ * Retrieves the last modification data of @poppler_annot.
+ *
+ * Return value: a new allocated string with the last modification data of
+ *               @poppler_annot. It must be freed with g_free() when done.
+ **/
+gchar *
+poppler_annot_get_modified (PopplerAnnot *poppler_annot)
+{
+  GooString *text;
+
+  g_return_val_if_fail (POPPLER_IS_ANNOT (poppler_annot), NULL);
+
+  text = poppler_annot->annot->getModified ();
+
+  return text ? _poppler_goo_string_to_utf8 (text) : NULL;
+}
+
+/**
+ * poppler_annot_get_flags
+ * @poppler_annot: a #PopplerAnnot
+ *
+ * Retrieves the flag field specifying various characteristics of the
+ * @poppler_annot.
+ *
+ * Return value: the flag field of @poppler_annot.
+ **/
+PopplerAnnotFlag
+poppler_annot_get_flags (PopplerAnnot *poppler_annot)
+{
+  g_return_val_if_fail (POPPLER_IS_ANNOT (poppler_annot), (PopplerAnnotFlag) 0);
+
+  return (PopplerAnnotFlag) poppler_annot->annot->getFlags ();
+}
+
+/**
+ * poppler_annot_get_color:
+ * @poppler_annot: a #PopplerAnnot
+ *
+ * Retrieves the color of @poppler_annot.
+ *
+ * Return value: a new allocated #GdkColor with the color values of
+ *               @poppler_annot. It must be freed with g_free() when done.
+ **/
+GdkColor *
+poppler_annot_get_color (PopplerAnnot *poppler_annot)
+{
+  AnnotColor *color;
+
+  g_return_val_if_fail (POPPLER_IS_ANNOT (poppler_annot), NULL);
+
+  if ((color = poppler_annot->annot->getColor ())) {
+    GdkColor *gdk_color;
+    double *values = color->getValues ();
+
+    switch (color->getSpace ())
+      {
+      case AnnotColor::colorGray:
+        gdk_color = g_new0 (GdkColor, 1);
+        gdk_color->red = (guint16) values[0];
+        gdk_color->green = (guint16) values[0];
+        gdk_color->blue = (guint16) values[0];
+        return gdk_color;
+      case AnnotColor::colorRGB:
+        gdk_color = g_new0 (GdkColor, 1);
+        gdk_color->red = (guint16) values[0];
+        gdk_color->green = (guint16) values[1];
+        gdk_color->blue = (guint16) values[2];
+        return gdk_color;
+      case AnnotColor::colorTransparent:
+      case AnnotColor::colorCMYK:
+      default:
+        g_warning ("Unsupported Annot Color");
+      }
+  }
+
+  return NULL;
+}
+
+/* PopplerAnnotMarkup */
+/**
+* poppler_annot_markup_get_label:
+* @poppler_annot: a #PopplerAnnotMarkup
+*
+* Retrieves the label text of @poppler_annot.
+*
+* Return value: the label text of @poppler_annot.
+*/
+gchar *
+poppler_annot_markup_get_label (PopplerAnnotMarkup *poppler_annot)
+{
+  AnnotMarkup *annot;
+  GooString *text;
+
+  g_return_val_if_fail (POPPLER_IS_ANNOT_MARKUP (poppler_annot), NULL);
+
+  annot = static_cast<AnnotMarkup *>(POPPLER_ANNOT (poppler_annot)->annot);
+
+  text = annot->getLabel ();
+
+  return text ? _poppler_goo_string_to_utf8 (text) : NULL;
+}
+
+/**
+ * poppler_annot_markup_get_popup_is_open:
+ * @poppler_annot: a #PopplerAnnotMarkup
+ *
+ * Retrieves the state of the popup annot related to @poppler_annot.
+ *
+ * Return value: the state of @poppler_annot. %TRUE if it's open, %FALSE in
+ *               other case.
+ **/
+gboolean
+poppler_annot_markup_get_popup_is_open (PopplerAnnotMarkup *poppler_annot)
+{
+  AnnotMarkup *annot;
+  AnnotPopup *annot_popup;
+
+  g_return_val_if_fail (POPPLER_IS_ANNOT_MARKUP (poppler_annot), FALSE);
+
+  annot = static_cast<AnnotMarkup *>(POPPLER_ANNOT (poppler_annot)->annot);
+
+  if ((annot_popup = annot->getPopup ()))
+    return annot_popup->getOpen ();
+
+  return FALSE;
+}
+
+/**
+* poppler_annot_markup_get_opacity:
+* @poppler_annot: a #PopplerAnnotMarkup
+*
+* Retrieves the opacity value of @poppler_annot.
+*
+* Return value: the opacity value of @poppler_annot.
+*/
+gdouble
+poppler_annot_markup_get_opacity (PopplerAnnotMarkup *poppler_annot)
+{
+  AnnotMarkup *annot;
+
+  g_return_val_if_fail (POPPLER_IS_ANNOT_MARKUP (poppler_annot), 0);
+
+  annot = static_cast<AnnotMarkup *>(POPPLER_ANNOT (poppler_annot)->annot);
+  
+  return annot->getOpacity ();
+}
+
+GDate *
+poppler_annot_markup_get_date (PopplerAnnotMarkup *poppler_annot)
+{
+  AnnotMarkup *annot;
+  GooString *annot_date;
+
+  g_return_val_if_fail (POPPLER_IS_ANNOT_MARKUP (poppler_annot), NULL);
+
+  annot = static_cast<AnnotMarkup *>(POPPLER_ANNOT (poppler_annot)->annot);
+
+  if ((annot_date = annot->getDate ())) {
+    GDateYear year = g_ascii_digit_value (annot_date->getChar(2)) * 1000 +
+                     g_ascii_digit_value (annot_date->getChar(3)) * 100 +
+                     g_ascii_digit_value (annot_date->getChar(4)) * 10 +
+                     g_ascii_digit_value (annot_date->getChar(5));
+    GDateMonth month = (GDateMonth) (g_ascii_digit_value (annot_date->getChar(6)) * 10 +
+                                     g_ascii_digit_value (annot_date->getChar(7)));
+    GDateDay day = g_ascii_digit_value (annot_date->getChar(8)) * 10 +
+                   g_ascii_digit_value (annot_date->getChar(9));
+
+    return g_date_new_dmy (day, month, year);
+  }
+
+  return NULL;
+}
+
+/**
+* poppler_annot_markup_get_subject:
+* @poppler_annot: a #PopplerAnnotMarkup
+*
+* Retrives the subject text of @poppler_annot.
+*
+* Return value: the subject text of @poppler_annot.
+*/
+gchar *
+poppler_annot_markup_get_subject (PopplerAnnotMarkup *poppler_annot)
+{
+  AnnotMarkup *annot;
+  GooString *text;
+
+  g_return_val_if_fail (POPPLER_IS_ANNOT_MARKUP (poppler_annot), NULL);
+
+  annot = static_cast<AnnotMarkup *>(POPPLER_ANNOT (poppler_annot)->annot);
+
+  text = annot->getSubject ();
+
+  return text ? _poppler_goo_string_to_utf8 (text) : NULL;
+}
+
+/**
+* poppler_annot_markup_get_reply_to:
+* @poppler_annot: a #PopplerAnnotMarkup
+*
+* Gets the reply type of @poppler_annot.
+*
+* Return value: #PopplerAnnotMarkupReplyType of @poppler_annot.
+*/
+PopplerAnnotMarkupReplyType
+poppler_annot_markup_get_reply_to (PopplerAnnotMarkup *poppler_annot)
+{
+  AnnotMarkup *annot;
+
+  g_return_val_if_fail (POPPLER_IS_ANNOT_MARKUP (poppler_annot), POPPLER_ANNOT_MARKUP_REPLY_TYPE_R);
+
+  annot = static_cast<AnnotMarkup *>(POPPLER_ANNOT (poppler_annot)->annot);
+  
+  switch (annot->getReplyTo ())
+  {
+    case AnnotMarkup::replyTypeR:
+      return POPPLER_ANNOT_MARKUP_REPLY_TYPE_R;
+    case AnnotMarkup::replyTypeGroup:
+      return POPPLER_ANNOT_MARKUP_REPLY_TYPE_GROUP;
+    default:
+      g_warning ("Unsupported Annot Markup Reply To Type");
+  }
+
+  return POPPLER_ANNOT_MARKUP_REPLY_TYPE_R;
+}
+
+/**
+* poppler_annot_markup_get_external_data:
+* @poppler_annot: a #PopplerAnnotMarkup
+*
+* Gets the external data type of @poppler_annot.
+*
+* Return value: #PopplerAnnotExternalDataType of @poppler_annot.
+*/
+PopplerAnnotExternalDataType
+poppler_annot_markup_get_external_data (PopplerAnnotMarkup *poppler_annot)
+{
+  AnnotMarkup *annot;
+
+  g_return_val_if_fail (POPPLER_IS_ANNOT_MARKUP (poppler_annot), POPPLER_ANNOT_EXTERNAL_DATA_MARKUP_UNKNOWN);
+
+  annot = static_cast<AnnotMarkup *>(POPPLER_ANNOT (poppler_annot)->annot);
+
+  switch (annot->getExData ())
+    {
+    case annotExternalDataMarkup3D:
+      return POPPLER_ANNOT_EXTERNAL_DATA_MARKUP_3D;
+    case annotExternalDataMarkupUnknown:
+      return POPPLER_ANNOT_EXTERNAL_DATA_MARKUP_UNKNOWN;
+    default:
+      g_warning ("Unsupported Annot Markup External Data");
+    }
+
+  return POPPLER_ANNOT_EXTERNAL_DATA_MARKUP_UNKNOWN;
+}
+
+/* PopplerAnnotText */
+/**
+ * poppler_annot_text_is_open:
+ * @poppler_annot: a #PopplerAnnotText
+ *
+ * Retrieves the state of @poppler_annot.
+ *
+ * Return value: the state of @poppler_annot. %TRUE if it's open, %FALSE in
+ *               other case.
+ **/
+gboolean
+poppler_annot_text_is_open (PopplerAnnotText *poppler_annot)
+{
+  AnnotText *annot;
+
+  g_return_val_if_fail (POPPLER_IS_ANNOT_TEXT (poppler_annot), FALSE);
+
+  annot = static_cast<AnnotText *>(POPPLER_ANNOT (poppler_annot)->annot);
+
+  return annot->getOpen ();
+}
+
+/**
+ * poppler_annot_text_get_icon:
+ * @poppler_annot: a #PopplerAnnotText
+ *
+ * Gets the icon type of @poppler_annot.
+ *
+ * Return value: #PopplerAnnotTextIcon of @poppler_annot.
+ **/ 
+PopplerAnnotTextIcon
+poppler_annot_text_get_icon (PopplerAnnotText *poppler_annot)
+{
+  AnnotText *annot;
+
+  g_return_val_if_fail (POPPLER_IS_ANNOT_TEXT (poppler_annot), POPPLER_ANNOT_TEXT_ICON_NOTE);
+
+  annot = static_cast<AnnotText *>(POPPLER_ANNOT (poppler_annot)->annot);
+
+  switch (annot->getIcon ())
+    {
+    case AnnotText::iconComment:
+      return POPPLER_ANNOT_TEXT_ICON_COMMENT;
+    case AnnotText::iconKey:
+      return POPPLER_ANNOT_TEXT_ICON_KEY;
+    case AnnotText::iconNote:
+      return POPPLER_ANNOT_TEXT_ICON_NOTE;
+    case AnnotText::iconHelp:
+      return POPPLER_ANNOT_TEXT_ICON_HELP;
+    case AnnotText::iconNewParagraph:
+      return POPPLER_ANNOT_TEXT_ICON_NEW_PARAGRAPH;
+    case AnnotText::iconParagraph:
+      return POPPLER_ANNOT_TEXT_ICON_PARAGRAPH;
+    case AnnotText::iconInsert:
+      return POPPLER_ANNOT_TEXT_ICON_INSERT;
+    default:
+      g_warning ("Unsupported Annot Text Icon");
+    }
+
+  return POPPLER_ANNOT_TEXT_ICON_NOTE;
+}
+
+/**
+ * poppler_annot_text_get_state:
+ * @poppler_annot: a #PopplerAnnotText
+ *
+ * Retrieves the state of @poppler_annot.
+ *
+ * Return value: #PopplerAnnotTextState of @poppler_annot.
+ **/ 
+PopplerAnnotTextState
+poppler_annot_text_get_state (PopplerAnnotText *poppler_annot)
+{
+  AnnotText *annot;
+
+  g_return_val_if_fail (POPPLER_IS_ANNOT_TEXT (poppler_annot), POPPLER_ANNOT_TEXT_STATE_UNKNOWN);
+
+  annot = static_cast<AnnotText *>(POPPLER_ANNOT (poppler_annot)->annot);
+
+  switch (annot->getState ())
+    {
+    case AnnotText::stateUnknown:
+      return POPPLER_ANNOT_TEXT_STATE_UNKNOWN;
+    case AnnotText::stateMarked:
+      return POPPLER_ANNOT_TEXT_STATE_MARKED;
+    case AnnotText::stateUnmarked:
+      return POPPLER_ANNOT_TEXT_STATE_UNMARKED;
+    case AnnotText::stateAccepted:
+      return POPPLER_ANNOT_TEXT_STATE_ACCEPTED;
+    case AnnotText::stateRejected:
+      return POPPLER_ANNOT_TEXT_STATE_REJECTED;
+    case AnnotText::stateCancelled:
+      return POPPLER_ANNOT_TEXT_STATE_CANCELLED;
+    case AnnotText::stateCompleted:
+      return POPPLER_ANNOT_TEXT_STATE_COMPLETED;
+    case AnnotText::stateNone:
+      return POPPLER_ANNOT_TEXT_STATE_NONE;
+    default:
+      g_warning ("Unsupported Annot Text State");
+    }
+
+  return POPPLER_ANNOT_TEXT_STATE_UNKNOWN;
+}
+
+/* PopplerAnnotFreeText */
+/**
+ * poppler_annot_free_text_get_quadding:
+ * @poppler_annot: a #PopplerAnnotFreeText
+ *
+ * Retrieves the justification of the text of @poppler_annot.
+ *
+ * Return value: #PopplerAnnotFreeTextQuadding of @poppler_annot.
+ **/ 
+PopplerAnnotFreeTextQuadding
+poppler_annot_free_text_get_quadding (PopplerAnnotFreeText *poppler_annot)
+{
+  AnnotFreeText *annot;
+
+  g_return_val_if_fail (POPPLER_IS_ANNOT_FREE_TEXT (poppler_annot), POPPLER_ANNOT_FREE_TEXT_QUADDING_LEFT_JUSTIFIED);
+
+  annot = static_cast<AnnotFreeText *>(POPPLER_ANNOT (poppler_annot)->annot);
+
+  switch (annot->getQuadding ())
+  {
+    case AnnotFreeText::quaddingLeftJustified:
+      return POPPLER_ANNOT_FREE_TEXT_QUADDING_LEFT_JUSTIFIED;
+    case AnnotFreeText::quaddingCentered:
+      return POPPLER_ANNOT_FREE_TEXT_QUADDING_CENTERED;
+    case AnnotFreeText::quaddingRightJustified:
+      return POPPLER_ANNOT_FREE_TEXT_QUADDING_RIGHT_JUSTIFIED;
+    default:
+      g_warning ("Unsupported Annot Free Text Quadding");
+  }
+
+  return POPPLER_ANNOT_FREE_TEXT_QUADDING_LEFT_JUSTIFIED;
+}
+
+/**
+ * poppler_annot_free_text_get_callout_line:
+ * @poppler_annot: a #PopplerAnnotFreeText
+ *
+ * Retrieves a #PopplerCalloutLine of four or six numbers specifying a callout
+ * line attached to the @poppler_annot.
+ *
+ * Return value: a new allocated #PopplerCalloutLine if the annot has a callout
+ *               line, NULL in other case. It must be freed with g_free() when
+ *               done.
+ **/
+PopplerAnnotCalloutLine *
+poppler_annot_free_text_get_callout_line (PopplerAnnotFreeText *poppler_annot)
+{
+  AnnotFreeText *annot;
+  AnnotCalloutLine *line;
+
+  g_return_val_if_fail (POPPLER_IS_ANNOT_FREE_TEXT (poppler_annot), NULL);
+
+  annot = static_cast<AnnotFreeText *>(POPPLER_ANNOT (poppler_annot)->annot);
+
+  if ((line = annot->getCalloutLine ())) {
+    AnnotCalloutMultiLine *multiline;
+    PopplerAnnotCalloutLine *callout = g_new0 (PopplerAnnotCalloutLine, 1);
+
+    callout->x1 = line->getX1();
+    callout->y1 = line->getY1();
+    callout->x2 = line->getX2();
+    callout->y2 = line->getY2();
+
+    if ((multiline = static_cast<AnnotCalloutMultiLine *>(line))) {
+      callout->multiline = TRUE;
+      callout->x3 = multiline->getX3();
+      callout->y3 = multiline->getY3();
+      return callout;
+    }
+
+    callout->multiline = FALSE;
+    return callout;
+  }
+
+  return NULL;
+}
+
+/* PopplerAnnotCalloutLine */
+GType
+poppler_annot_callout_line_get_type (void)
+{
+  static GType our_type = 0;
+
+  if (our_type == 0)
+    our_type = g_boxed_type_register_static ("PopplerAnnotCalloutLine",
+                                             (GBoxedCopyFunc) poppler_rectangle_copy,
+                                             (GBoxedFreeFunc) poppler_rectangle_free);
+
+  return our_type;
+}
+
+/**
+ * poppler_annot_callout_line_new:
+ *
+ * Creates a new empty #PopplerAnnotCalloutLine.
+ *
+ * Return value: a new allocated #PopplerAnnotCalloutLine, NULL in other case.
+ *               It must be freed when done.
+ **/
+PopplerAnnotCalloutLine *
+poppler_annot_callout_line_new (void)
+{
+  return g_new0 (PopplerAnnotCalloutLine, 1);
+}
+
+/**
+ * poppler_annot_callout_line_copy:
+ * @callout: the #PopplerAnnotCalloutline to be copied.
+ *
+ * It does copy @callout to a new #PopplerAnnotCalloutLine.
+ *
+ * Return value: a new allocated #PopplerAnnotCalloutLine as exact copy of
+ *               @callout, NULL in other case. It must be freed when done.
+ **/
+PopplerAnnotCalloutLine *
+poppler_annot_callout_line_copy (PopplerAnnotCalloutLine *callout)
+{
+  PopplerAnnotCalloutLine *new_callout;
+
+  g_return_val_if_fail (callout != NULL, NULL);
+  
+  new_callout = g_new0 (PopplerAnnotCalloutLine, 1);
+  *new_callout = *callout;
+
+  return new_callout;
+}
+
+/**
+ * poppler_annot_callout_line_free:
+ * @callout: a #PopplerAnnotCalloutLine
+ *
+ * Frees the memory used by #PopplerAnnotCalloutLine.
+ **/
+void
+poppler_annot_callout_line_free (PopplerAnnotCalloutLine *callout)
+{
+  g_free (callout);
+}
diff --git a/glib/poppler-annot.h b/glib/poppler-annot.h
new file mode 100644
index 0000000..006255e
--- /dev/null
+++ b/glib/poppler-annot.h
@@ -0,0 +1,181 @@
+/* poppler-annot.h: glib interface to poppler
+ *
+ * Copyright (C) 2007 Inigo Martinez <inigomartinez at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __POPPLER_ANNOT_H__
+#define __POPPLER_ANNOT_H__
+
+#include <glib-object.h>
+#include "poppler.h"
+
+G_BEGIN_DECLS
+
+#define POPPLER_TYPE_ANNOT                   (poppler_annot_get_type ())
+#define POPPLER_ANNOT(obj)                   (G_TYPE_CHECK_INSTANCE_CAST ((obj), POPPLER_TYPE_ANNOT, PopplerAnnot))
+#define POPPLER_IS_ANNOT(obj)                (G_TYPE_CHECK_INSTANCE_TYPE ((obj), POPPLER_TYPE_ANNOT))
+
+#define POPPLER_TYPE_ANNOT_MARKUP            (poppler_annot_markup_get_type ())
+#define POPPLER_ANNOT_MARKUP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), POPPLER_TYPE_ANNOT_MARKUP, PopplerAnnotMarkup))
+#define POPPLER_IS_ANNOT_MARKUP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), POPPLER_TYPE_ANNOT_MARKUP))
+
+#define POPPLER_TYPE_ANNOT_TEXT              (poppler_annot_text_get_type ())
+#define POPPLER_ANNOT_TEXT(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), POPPLER_TYPE_ANNOT_TEXT, PopplerAnnotText))
+#define POPPLER_IS_ANNOT_TEXT(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), POPPLER_TYPE_ANNOT_TEXT))
+
+#define POPPLER_TYPE_ANNOT_FREE_TEXT         (poppler_annot_free_text_get_type ())
+#define POPPLER_ANNOT_FREE_TEXT(obj)         (G_TYPE_CHECK_INSTANCE_CAST ((obj), POPPLER_TYPE_ANNOT_FREE_TEXT, PopplerAnnotFreeText))
+#define POPPLER_IS_ANNOT_FREE_TEXT(obj)      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), POPPLER_TYPE_ANNOT_FREE_TEXT))
+
+#define POPPLER_TYPE_ANNOT_CALLOUT_LINE      (poppler_annot_callout_line_get_type ())
+
+typedef enum
+{
+  POPPLER_ANNOT_UNKNOWN,
+  POPPLER_ANNOT_TEXT,
+  POPPLER_ANNOT_LINK,
+  POPPLER_ANNOT_FREE_TEXT,
+  POPPLER_ANNOT_LINE,
+  POPPLER_ANNOT_SQUARE,
+  POPPLER_ANNOT_CIRCLE,
+  POPPLER_ANNOT_POLYGON,
+  POPPLER_ANNOT_POLY_LINE,
+  POPPLER_ANNOT_HIGHLIGHT,
+  POPPLER_ANNOT_UNDERLINE,
+  POPPLER_ANNOT_SQUIGGLY,
+  POPPLER_ANNOT_STRIKE_OUT,
+  POPPLER_ANNOT_STAMP,
+  POPPLER_ANNOT_CARET,
+  POPPLER_ANNOT_INK,
+  POPPLER_ANNOT_POPUP,
+  POPPLER_ANNOT_FILE_ATTACHMENT,
+  POPPLER_ANNOT_SOUND,
+  POPPLER_ANNOT_MOVIE,
+  POPPLER_ANNOT_WIDGET,
+  POPPLER_ANNOT_SCREEN,
+  POPPLER_ANNOT_PRINTER_MARK,
+  POPPLER_ANNOT_TRAP_NET,
+  POPPLER_ANNOT_WATERMARK,
+  POPPLER_ANNOT_3D
+} PopplerAnnotType;
+
+typedef enum /*< flags >*/
+{
+  POPPLER_ANNOT_FLAG_UNKNOWN = 0,
+  POPPLER_ANNOT_FLAG_INVISIBLE = 1 << 0,
+  POPPLER_ANNOT_FLAG_HIDDEN = 1 << 1,
+  POPPLER_ANNOT_FLAG_PRINT = 1 << 2,
+  POPPLER_ANNOT_FLAG_NO_ZOOM = 1 << 3,
+  POPPLER_ANNOT_FLAG_NO_ROTATE = 1 << 4,
+  POPPLER_ANNOT_FLAG_NO_VIEW = 1 << 5,
+  POPPLER_ANNOT_FLAG_READ_ONLY = 1 << 6,
+  POPPLER_ANNOT_FLAG_LOCKED = 1 << 7,
+  POPPLER_ANNOT_FLAG_TOGGLE_NO_VIEW = 1 << 8,
+  POPPLER_ANNOT_FLAG_LOCKED_CONTENTS = 1 << 9
+} PopplerAnnotFlag;
+
+typedef enum
+{
+  POPPLER_ANNOT_MARKUP_REPLY_TYPE_R,
+  POPPLER_ANNOT_MARKUP_REPLY_TYPE_GROUP
+} PopplerAnnotMarkupReplyType;
+
+typedef enum
+{
+  POPPLER_ANNOT_EXTERNAL_DATA_MARKUP_3D,
+  POPPLER_ANNOT_EXTERNAL_DATA_MARKUP_UNKNOWN
+} PopplerAnnotExternalDataType;
+
+typedef enum
+{
+  POPPLER_ANNOT_TEXT_ICON_COMMENT,
+  POPPLER_ANNOT_TEXT_ICON_KEY,
+  POPPLER_ANNOT_TEXT_ICON_NOTE,
+  POPPLER_ANNOT_TEXT_ICON_HELP,
+  POPPLER_ANNOT_TEXT_ICON_NEW_PARAGRAPH,
+  POPPLER_ANNOT_TEXT_ICON_PARAGRAPH,
+  POPPLER_ANNOT_TEXT_ICON_INSERT
+} PopplerAnnotTextIcon;
+
+typedef enum
+{
+  POPPLER_ANNOT_TEXT_STATE_MARKED,
+  POPPLER_ANNOT_TEXT_STATE_UNMARKED,
+  POPPLER_ANNOT_TEXT_STATE_ACCEPTED,
+  POPPLER_ANNOT_TEXT_STATE_REJECTED,
+  POPPLER_ANNOT_TEXT_STATE_CANCELLED,
+  POPPLER_ANNOT_TEXT_STATE_COMPLETED,
+  POPPLER_ANNOT_TEXT_STATE_NONE,
+  POPPLER_ANNOT_TEXT_STATE_UNKNOWN
+} PopplerAnnotTextState;
+
+typedef enum
+{
+  POPPLER_ANNOT_FREE_TEXT_QUADDING_LEFT_JUSTIFIED,
+  POPPLER_ANNOT_FREE_TEXT_QUADDING_CENTERED,
+  POPPLER_ANNOT_FREE_TEXT_QUADDING_RIGHT_JUSTIFIED
+} PopplerAnnotFreeTextQuadding;
+
+struct _PopplerAnnotCalloutLine
+{
+  gboolean multiline;
+  gdouble  x1;
+  gdouble  y1;
+  gdouble  x2;
+  gdouble  y2;
+  gdouble  x3;
+  gdouble  y3;
+};
+
+GType                         poppler_annot_get_type                           (void) G_GNUC_CONST;
+PopplerAnnotType              poppler_annot_get_annot_type                     (PopplerAnnot *poppler_annot);
+gchar                        *poppler_annot_get_contents                       (PopplerAnnot *poppler_annot);
+gchar                        *poppler_annot_get_name                           (PopplerAnnot *poppler_annot);
+gchar                        *poppler_annot_get_modified                       (PopplerAnnot *poppler_annot);
+PopplerAnnotFlag              poppler_annot_get_flags                          (PopplerAnnot *poppler_annot);
+GdkColor                     *poppler_annot_get_color                          (PopplerAnnot *poppler_annot);
+
+/* PopplerAnnotMarkup */
+GType                         poppler_annot_markup_get_type                    (void) G_GNUC_CONST;
+gchar                        *poppler_annot_markup_get_label                   (PopplerAnnotMarkup *poppler_annot);
+gboolean                      poppler_annot_markup_get_popup_is_open           (PopplerAnnotMarkup *poppler_annot);
+gdouble                       poppler_annot_markup_get_opacity                 (PopplerAnnotMarkup *poppler_annot);
+GDate                        *poppler_annot_markup_get_date                    (PopplerAnnotMarkup *poppler_annot);
+gchar                        *poppler_annot_markup_get_subject                 (PopplerAnnotMarkup *poppler_annot);
+PopplerAnnotMarkupReplyType   poppler_annot_markup_get_reply_to                (PopplerAnnotMarkup *poppler_annot);
+PopplerAnnotExternalDataType  poppler_annot_markup_get_external_data           (PopplerAnnotMarkup *poppler_annot);
+
+/* PopplerAnnotText */
+GType                         poppler_annot_text_get_type                      (void) G_GNUC_CONST;
+gboolean                      poppler_annot_text_is_open                       (PopplerAnnotText *poppler_annot);
+PopplerAnnotTextIcon          poppler_annot_text_get_icon                      (PopplerAnnotText *poppler_annot);
+PopplerAnnotTextState         poppler_annot_text_get_state                     (PopplerAnnotText *poppler_annot);
+
+/* PopplerAnnotFreeText */
+GType                         poppler_annot_free_text_get_type                 (void) G_GNUC_CONST;
+PopplerAnnotFreeTextQuadding  poppler_annot_free_text_get_quadding             (PopplerAnnotFreeText *poppler_annot);
+PopplerAnnotCalloutLine      *poppler_annot_free_text_get_callout_line         (PopplerAnnotFreeText *poppler_annot);
+
+/* PopplerCalloutLine */
+GType                         poppler_annot_callout_line_get_type              (void) G_GNUC_CONST;
+PopplerAnnotCalloutLine      *poppler_annot_callout_line_new                   (void);
+PopplerAnnotCalloutLine      *poppler_annot_callout_line_copy                  (PopplerAnnotCalloutLine *callout);
+void                          poppler_annot_callout_line_free                  (PopplerAnnotCalloutLine *callout);
+
+G_END_DECLS
+
+#endif /* __POPPLER_ANNOT_H__ */
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 001bb25..3f7479d 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -69,6 +69,8 @@ poppler_page_finalize (GObject *object)
   g_object_unref (page->document);
   page->document = NULL;
 
+  if (page->annots != NULL)
+    delete page->annots;
   if (page->gfx != NULL)
     delete page->gfx;
   if (page->text_dev != NULL)
@@ -1497,6 +1499,124 @@ poppler_page_free_form_field_mapping (GList *list)
   g_list_free (list);
 }
 
+/**
+ * poppler_page_get_annot_mapping:
+ * @page: A #PopplerPage
+ *
+ * Returns a list of #PopplerAnnotMapping items that map from a location on
+ * @page to a #PopplerAnnot.  This list must be freed with
+ * poppler_page_free_annot_mapping() when done.
+ *
+ * Return value: A #GList of #PopplerAnnotMapping
+ **/
+GList *
+poppler_page_get_annot_mapping (PopplerPage *page)
+{
+  GList *map_list = NULL;
+  double width, height;
+  gint i;
+
+  g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL);
+
+  if (!page->annots)
+    page->annots = page->page->getAnnots (document->doc->getCatalog ());
+  
+  if (!page->annots)
+    return NULL;
+
+  poppler_page_get_size (page, &width, &height);
+
+  for (i = 0; i < page->annots->getNumAnnots (); i++) {
+    PopplerAnnotMapping *mapping;
+    PopplerRectangle rect;
+    Annot *annot;
+    PDFRectangle *annot_rect;
+    gint rotation = 0;
+
+    annot = page->annots->getAnnot (i);
+
+    /* Create the mapping */
+    mapping = poppler_annot_mapping_new ();
+
+    switch (annot->getType ())
+      {
+      case Annot::typeText:
+        mapping->annot = poppler_annot_text_new (annot);
+	break;
+      case Annot::typeFreeText:
+        mapping->annot = poppler_annot_free_text_new (annot);
+	break;
+      default:
+        mapping->annot = _poppler_annot_new (annot);
+	break;
+      }
+
+    annot_rect = annot->getRect ();
+    rect.x1 = annot_rect->x1;
+    rect.y1 = annot_rect->y1;
+    rect.x2 = annot_rect->x2;
+    rect.y2 = annot_rect->y2;
+
+    if (! (annot->getFlags () & Annot::flagNoRotate))
+      rotation = page->page->getRotate ();
+
+    switch (rotation)
+      {
+      case 90:
+        mapping->area.x1 = rect.y1;
+        mapping->area.y1 = height - rect.x2;
+        mapping->area.x2 = mapping->area.x1 + (rect.y2 - rect.y1);
+        mapping->area.y2 = mapping->area.y1 + (rect.x2 - rect.x1);
+        break;
+      case 180:
+        mapping->area.x1 = width - rect.x2;
+        mapping->area.y1 = height - rect.y2;
+        mapping->area.x2 = mapping->area.x1 + (rect.x2 - rect.x1);
+        mapping->area.y2 = mapping->area.y1 + (rect.y2 - rect.y1);
+        break;
+      case 270:
+        mapping->area.x1 = width - rect.y2;
+        mapping->area.y1 = rect.x1;
+        mapping->area.x2 = mapping->area.x1 + (rect.y2 - rect.y1);
+        mapping->area.y2 = mapping->area.y1 + (rect.x2 - rect.x1);
+        break;
+      default:
+        mapping->area.x1 = rect.x1;
+        mapping->area.y1 = rect.y1;
+        mapping->area.x2 = rect.x2;
+        mapping->area.y2 = rect.y2;
+      }
+
+    mapping->area.x1 -= page->page->getCropBox()->x1;
+    mapping->area.x2 -= page->page->getCropBox()->x1;
+    mapping->area.y1 -= page->page->getCropBox()->y1;
+    mapping->area.y2 -= page->page->getCropBox()->y1;
+
+    map_list = g_list_prepend (map_list, mapping);
+  }
+
+  return g_list_reverse (map_list);
+}
+
+/**
+ * poppler_page_free_annot_mapping:
+ * @list: A list of #PopplerAnnotMapping<!-- -->s
+ *
+ * Frees a list of #PopplerAnnotMapping<!-- -->s allocated by
+ * poppler_page_get_annot_mapping().  It also frees the #PopplerAnnot<!-- -->s
+ * that each mapping contains, so if you want to keep them around, you need to
+ * copy them with poppler_annot_copy().
+ **/
+void
+poppler_page_free_annot_mapping (GList *list)
+{
+  if (!list)
+    return;
+
+  g_list_foreach (list, (GFunc)poppler_annot_mapping_free, NULL);
+  g_list_free (list);
+}
+
 /* PopplerRectangle type */
 
 GType
@@ -1697,6 +1817,52 @@ poppler_form_field_mapping_free (PopplerFormFieldMapping *mapping)
   g_free (mapping);
 }
 
+/* PopplerAnnot Mapping Type */
+GType
+poppler_annot_mapping_get_type (void)
+{
+  static GType our_type = 0;
+
+  if (our_type == 0)
+    our_type = g_boxed_type_register_static ("PopplerAnnotMapping",
+					     (GBoxedCopyFunc) poppler_annot_mapping_copy,
+					     (GBoxedFreeFunc) poppler_annot_mapping_free);
+
+  return our_type;
+}
+
+PopplerAnnotMapping *
+poppler_annot_mapping_new (void)
+{
+  return (PopplerAnnotMapping *) g_new0 (PopplerAnnotMapping, 1);
+}
+
+PopplerAnnotMapping *
+poppler_annot_mapping_copy (PopplerAnnotMapping *mapping)
+{
+  PopplerAnnotMapping *new_mapping;
+
+  new_mapping = poppler_annot_mapping_new ();
+
+  *new_mapping = *mapping;
+  if (mapping->annot)
+    new_mapping->annot = (PopplerAnnot *) g_object_ref (mapping->annot);
+
+  return new_mapping;
+}
+
+void
+poppler_annot_mapping_free (PopplerAnnotMapping *mapping)
+{
+  if (!mapping)
+    return;
+
+  if (mapping->annot)
+    g_object_unref (mapping->annot);
+
+  g_free (mapping);
+}
+
 void 
 poppler_page_get_crop_box (PopplerPage *page, PopplerRectangle *rect)
 {
diff --git a/glib/poppler-page.h b/glib/poppler-page.h
index f8de186..5304d0b 100644
--- a/glib/poppler-page.h
+++ b/glib/poppler-page.h
@@ -90,6 +90,8 @@ cairo_surface_t       *poppler_page_get_image            (PopplerPage        *pa
 #endif
 GList              *poppler_page_get_form_field_mapping  (PopplerPage        *page);
 void                poppler_page_free_form_field_mapping (GList              *list);
+GList                 *poppler_page_get_annot_mapping    (PopplerPage        *page);
+void                   poppler_page_free_annot_mapping   (GList              *list);
 GdkRegion             *poppler_page_get_selection_region (PopplerPage        *page,
 							  gdouble             scale,
 							  PopplerSelectionStyle style,
@@ -192,6 +194,19 @@ PopplerFormFieldMapping *poppler_form_field_mapping_new      (void);
 PopplerFormFieldMapping *poppler_form_field_mapping_copy     (PopplerFormFieldMapping *mapping);
 void                     poppler_form_field_mapping_free     (PopplerFormFieldMapping *mapping);
 
+/* Mapping between areas on the current page and annots */
+#define POPPLER_TYPE_ANNOT_MAPPING                  (poppler_annot_mapping_get_type ())
+struct _PopplerAnnotMapping
+{
+  PopplerRectangle area;
+  PopplerAnnot *annot;
+};
+
+GType                poppler_annot_mapping_get_type (void) G_GNUC_CONST;
+PopplerAnnotMapping *poppler_annot_mapping_new      (void);
+PopplerAnnotMapping *poppler_annot_mapping_copy     (PopplerAnnotMapping *mapping);
+void                 poppler_annot_mapping_free     (PopplerAnnotMapping *mapping);
+
 G_END_DECLS
 
 #endif /* __POPPLER_PAGE_H__ */
diff --git a/glib/poppler-private.h b/glib/poppler-private.h
index 74601a3..2d21285 100644
--- a/glib/poppler-private.h
+++ b/glib/poppler-private.h
@@ -58,6 +58,7 @@ struct _PopplerPage
   int index;
   TextOutputDev *text_dev;
   Gfx *gfx;
+  Annots *annots;
 #if defined (HAVE_CAIRO)
   CairoImageOutputDev *image_dev;
 #endif
@@ -70,7 +71,6 @@ struct _PopplerFormField
   FormWidget *widget;
 };
 
-
 PopplerPage   *_poppler_page_new   (PopplerDocument *document,
 				    Page            *page,
 				    int              index);
@@ -83,6 +83,9 @@ PopplerFormField *_poppler_form_field_new (PopplerDocument *document,
 					   FormWidget      *field);
 PopplerAttachment *_poppler_attachment_new (PopplerDocument *document,
 					    EmbFile         *file);
+PopplerAnnot      *_poppler_annot_new           (Annot *annot);
+PopplerAnnot      *_poppler_annot_text_new      (Annot *annot);
+PopplerAnnot      *_poppler_annot_free_text_new (Annot *annot);
 
 char *_poppler_goo_string_to_utf8(GooString *s);
 gboolean _poppler_convert_pdf_date_to_gtime (GooString *date,
diff --git a/glib/poppler.h b/glib/poppler.h
index 8a94198..07ef09a 100644
--- a/glib/poppler.h
+++ b/glib/poppler.h
@@ -85,6 +85,7 @@ typedef struct _PopplerLinkMapping      PopplerLinkMapping;
 typedef struct _PopplerPageTransition   PopplerPageTransition;
 typedef struct _PopplerImageMapping     PopplerImageMapping;
 typedef struct _PopplerFormFieldMapping PopplerFormFieldMapping;
+typedef struct _PopplerAnnotMapping     PopplerAnnotMapping;
 typedef struct _PopplerPage             PopplerPage;
 typedef struct _PopplerFontInfo         PopplerFontInfo;
 typedef struct _PopplerPSFile           PopplerPSFile;
@@ -92,6 +93,11 @@ typedef union  _PopplerAction           PopplerAction;
 typedef struct _PopplerDest             PopplerDest;
 typedef struct _PopplerFormField        PopplerFormField;
 typedef struct _PopplerAttachment       PopplerAttachment;
+typedef struct _PopplerAnnot            PopplerAnnot;
+typedef struct _PopplerAnnotMarkup      PopplerAnnotMarkup;
+typedef struct _PopplerAnnotText        PopplerAnnotText;
+typedef struct _PopplerAnnotFreeText    PopplerAnnotFreeText;
+typedef struct _PopplerAnnotCalloutLine PopplerAnnotCalloutLine;
 
 typedef enum
 {
@@ -112,5 +118,6 @@ G_END_DECLS
 #include "poppler-form-field.h"
 #include "poppler-enums.h"
 #include "poppler-attachment.h"
+#include "poppler-annot.h"
 
 #endif /* __POPPLER_GLIB_H__ */
commit 6fa3ab20fee311b4aff92be18870fd0e1730a81f
Author: Iñigo Martínez <inigomartinez at gmail.com>
Date:   Tue Mar 11 18:44:27 2008 +0100

    Changed AnnotMarkup inheritance

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 2f7d8fc..7546ab4 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -1076,7 +1076,8 @@ void AnnotPopup::initialize(XRef *xrefA, Dict *dict, Catalog *catalog) {
 // AnnotMarkup
 //------------------------------------------------------------------------
  
-AnnotMarkup::AnnotMarkup(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) {
+AnnotMarkup::AnnotMarkup(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
+    Annot(xrefA, dict, catalog, obj) {
   initialize(xrefA, dict, catalog, obj);
 }
 
@@ -1171,7 +1172,7 @@ void AnnotMarkup::initialize(XRef *xrefA, Dict *dict, Catalog *catalog, Object *
 //------------------------------------------------------------------------
 
 AnnotText::AnnotText(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
-    Annot(xrefA, dict, catalog, obj), AnnotMarkup(xref, dict, catalog, obj) {
+    AnnotMarkup(xrefA, dict, catalog, obj) {
 
   type = typeText;
   flags |= flagNoZoom | flagNoRotate;
@@ -1377,7 +1378,7 @@ void AnnotLink::draw(Gfx *gfx, GBool printing) {
 //------------------------------------------------------------------------
 
 AnnotFreeText::AnnotFreeText(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
-    Annot(xrefA, dict, catalog, obj), AnnotMarkup(xref, dict, catalog, obj) {
+    AnnotMarkup(xrefA, dict, catalog, obj) {
   type = typeFreeText;
   initialize(xrefA, catalog, dict);
 }
@@ -1530,7 +1531,7 @@ void AnnotFreeText::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) {
 //------------------------------------------------------------------------
 
 AnnotLine::AnnotLine(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
-    Annot(xrefA, dict, catalog, obj), AnnotMarkup(xref, dict, catalog, obj) {
+    AnnotMarkup(xrefA, dict, catalog, obj) {
   type = typeLine;
   initialize(xrefA, catalog, dict);
 }
diff --git a/poppler/Annot.h b/poppler/Annot.h
index 3098502..e43dcb0 100644
--- a/poppler/Annot.h
+++ b/poppler/Annot.h
@@ -534,7 +534,7 @@ protected:
 // AnnotMarkup
 //------------------------------------------------------------------------
 
-class AnnotMarkup {
+class AnnotMarkup: public Annot {
 public:
   enum  AnnotMarkupReplyType {
     replyTypeR,     // R
@@ -577,7 +577,7 @@ private:
 // AnnotText
 //------------------------------------------------------------------------
 
-class AnnotText: public Annot, public AnnotMarkup {
+class AnnotText: public AnnotMarkup {
 public:
   enum AnnotTextIcon {
     iconComment,      // Comment
@@ -665,7 +665,7 @@ protected:
 // AnnotFreeText
 //------------------------------------------------------------------------
 
-class AnnotFreeText: public Annot, public AnnotMarkup {
+class AnnotFreeText: public AnnotMarkup {
 public:
 
   enum AnnotFreeTextQuadding {
@@ -718,7 +718,7 @@ protected:
 // AnnotLine
 //------------------------------------------------------------------------
 
-class AnnotLine: public Annot, public AnnotMarkup {
+class AnnotLine: public AnnotMarkup {
 public:
 
   enum AnnotLineIntent {
@@ -776,7 +776,7 @@ protected:
 // AnnotTextMarkup
 //------------------------------------------------------------------------
 
-class AnnotTextMarkup: public Annot, public AnnotMarkup {
+class AnnotTextMarkup: public AnnotMarkup {
 public:
 
   AnnotTextMarkup(XRef *xrefA, Catalog *catalog, Dict *dict);


More information about the poppler mailing list