From d1ddb30768854e2613e325a2e3c14cade1792ec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Poo-Caama=C3=B1o?= Date: Sun, 13 Jan 2013 19:59:40 -0800 Subject: [PATCH 4/8] glib: Add PopplerAnnotTextHighlight object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Germán Poo-Caamaño --- glib/poppler-annot.cc | 37 +++++++++++++++++++++++++++++++++++++ glib/poppler-annot.h | 8 ++++++++ glib/poppler-page.cc | 2 ++ glib/poppler-private.h | 1 + glib/poppler.h | 1 + 5 files changed, 49 insertions(+) diff --git a/glib/poppler-annot.cc b/glib/poppler-annot.cc index 1b6050b..86108c2 100644 --- a/glib/poppler-annot.cc +++ b/glib/poppler-annot.cc @@ -33,6 +33,7 @@ typedef struct _PopplerAnnotMarkupClass PopplerAnnotMarkupClass; typedef struct _PopplerAnnotFreeTextClass PopplerAnnotFreeTextClass; typedef struct _PopplerAnnotTextClass PopplerAnnotTextClass; typedef struct _PopplerAnnotTextMarkupClass PopplerAnnotTextMarkupClass; +typedef struct _PopplerAnnotTextHighlightClass PopplerAnnotTextHighlightClass; typedef struct _PopplerAnnotFileAttachmentClass PopplerAnnotFileAttachmentClass; typedef struct _PopplerAnnotMovieClass PopplerAnnotMovieClass; typedef struct _PopplerAnnotScreenClass PopplerAnnotScreenClass; @@ -72,6 +73,16 @@ struct _PopplerAnnotTextMarkupClass PopplerAnnotMarkupClass parent_class; }; +struct _PopplerAnnotTextHighlight +{ + PopplerAnnotMarkup parent_instance; +}; + +struct _PopplerAnnotTextHighlightClass +{ + PopplerAnnotMarkupClass parent_class; +}; + struct _PopplerAnnotFreeText { PopplerAnnotMarkup parent_instance; @@ -120,6 +131,7 @@ struct _PopplerAnnotScreenClass G_DEFINE_TYPE (PopplerAnnot, poppler_annot, G_TYPE_OBJECT) G_DEFINE_TYPE (PopplerAnnotMarkup, poppler_annot_markup, POPPLER_TYPE_ANNOT) G_DEFINE_TYPE (PopplerAnnotTextMarkup, poppler_annot_text_markup, POPPLER_TYPE_ANNOT_MARKUP) +G_DEFINE_TYPE (PopplerAnnotTextHighlight, poppler_annot_text_highlight, POPPLER_TYPE_ANNOT_TEXT_MARKUP) G_DEFINE_TYPE (PopplerAnnotText, poppler_annot_text, POPPLER_TYPE_ANNOT_MARKUP) G_DEFINE_TYPE (PopplerAnnotFreeText, poppler_annot_free_text, POPPLER_TYPE_ANNOT_MARKUP) G_DEFINE_TYPE (PopplerAnnotFileAttachment, poppler_annot_file_attachment, POPPLER_TYPE_ANNOT_MARKUP) @@ -289,6 +301,31 @@ poppler_annot_text_markup_class_init (PopplerAnnotTextMarkupClass *klass) { } +/** + * poppler_annot_text_highlight_new: + * + * Creates a new empty #PopplerAnnotTextHighligth. + * + * Return value: a newly #PopplerAnnotTextHighlight annotation + * + * Since: 0.24 + **/ +PopplerAnnot * +_poppler_annot_text_highlight_new (Annot *annot) +{ + return _poppler_create_annot (POPPLER_TYPE_ANNOT_TEXT_HIGHLIGHT, annot); +} + +static void +poppler_annot_text_highlight_init (PopplerAnnotTextHighlight *poppler_annot) +{ +} + +static void +poppler_annot_text_highlight_class_init (PopplerAnnotTextHighlightClass *klass) +{ +} + static void poppler_annot_free_text_init (PopplerAnnotFreeText *poppler_annot) { diff --git a/glib/poppler-annot.h b/glib/poppler-annot.h index d7917e0..9597596 100644 --- a/glib/poppler-annot.h +++ b/glib/poppler-annot.h @@ -42,6 +42,9 @@ G_BEGIN_DECLS #define POPPLER_ANNOT_TEXT_MARKUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), POPPLER_TYPE_ANNOT_TEXT_MARKUP, PopplerAnnotTextMarkup)) #define POPPLER_IS_ANNOT_TEXT_MARKUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), POPPLER_TYPE_ANNOT_TEXT_MARKUP)) +#define POPPLER_TYPE_ANNOT_TEXT_HIGHLIGHT (poppler_annot_text_highlight_get_type ()) +#define POPPLER_ANNOT_TEXT_HIGHLIGHT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), POPPLER_TYPE_ANNOT_TEXT_HIGHLIGHT, PopplerAnnotTextHighlight)) +#define POPPLER_IS_ANNOT_TEXT_HIGHLIGHT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), POPPLER_TYPE_ANNOT_TEXT_HIGHLIGHT)) #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)) @@ -257,6 +260,11 @@ void poppler_annot_text_markup_set_quadrilaterals ( gint *length_quads); PopplerAnnotQuadrilateral **poppler_annot_text_markup_get_quadrilaterals (PopplerAnnotTextMarkup *poppler_annot, gint *length_quads); +/* PopplerAnnotTextHighlight */ +GType poppler_annot_text_highlight_get_type (void) G_GNUC_CONST; +PopplerAnnot *poppler_annot_text_highlight_new (PopplerDocument *doc, + PopplerAnnotQuadrilateral *quads, + gint *length_quads); /* PopplerAnnotFreeText */ GType poppler_annot_free_text_get_type (void) G_GNUC_CONST; diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index 0d2b23a..c5a3468 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -1373,6 +1373,8 @@ poppler_page_get_annot_mapping (PopplerPage *page) mapping->annot = _poppler_annot_screen_new (annot); break; case Annot::typeHighlight: + mapping->annot = _poppler_annot_text_highlight_new (annot); + break; case Annot::typeUnderline: case Annot::typeSquiggly: case Annot::typeStrikeOut: diff --git a/glib/poppler-private.h b/glib/poppler-private.h index af56ae7..c742e14 100644 --- a/glib/poppler-private.h +++ b/glib/poppler-private.h @@ -118,6 +118,7 @@ PopplerAnnot *_poppler_annot_new (Annot *annot); PopplerAnnot *_poppler_annot_text_new (Annot *annot); PopplerAnnot *_poppler_annot_free_text_new (Annot *annot); PopplerAnnot *_poppler_annot_text_markup_new (Annot *annot); +PopplerAnnot *_poppler_annot_text_highlight_new (Annot *annot); PopplerAnnot *_poppler_annot_file_attachment_new (Annot *annot); PopplerAnnot *_poppler_annot_movie_new (Annot *annot); PopplerAnnot *_poppler_annot_screen_new (Annot *annot); diff --git a/glib/poppler.h b/glib/poppler.h index d0c0468..751e429 100644 --- a/glib/poppler.h +++ b/glib/poppler.h @@ -198,6 +198,7 @@ typedef struct _PopplerAnnot PopplerAnnot; typedef struct _PopplerAnnotMarkup PopplerAnnotMarkup; typedef struct _PopplerAnnotText PopplerAnnotText; typedef struct _PopplerAnnotTextMarkup PopplerAnnotTextMarkup; +typedef struct _PopplerAnnotTextHighlight PopplerAnnotTextHighlight; typedef struct _PopplerAnnotFreeText PopplerAnnotFreeText; typedef struct _PopplerAnnotFileAttachment PopplerAnnotFileAttachment; typedef struct _PopplerAnnotMovie PopplerAnnotMovie; -- 1.7.9.5