summaryrefslogtreecommitdiff
path: root/backend/pdf/ev-poppler.cc
diff options
context:
space:
mode:
authorGiselle Machado <[email protected]>2014-07-24 10:38:59 +0200
committerraveit65 <[email protected]>2017-08-28 16:04:00 +0200
commitd933e02e8bf0594627c975d5c73a46fb8b593020 (patch)
tree11d6061fd5e75e4a28ba4fd50e34c34ae5a8e503 /backend/pdf/ev-poppler.cc
parentff45d7270749a05814799a56b1626516433ece49 (diff)
downloadatril-d933e02e8bf0594627c975d5c73a46fb8b593020.tar.bz2
atril-d933e02e8bf0594627c975d5c73a46fb8b593020.tar.xz
pdf: Add support for adding other types of annotations
Implementing switch/case to support new annotations as they are implemented. origin commit: https://git.gnome.org/browse/evince/commit/?id=320d10f
Diffstat (limited to 'backend/pdf/ev-poppler.cc')
-rw-r--r--backend/pdf/ev-poppler.cc25
1 files changed, 16 insertions, 9 deletions
diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc
index 3e999111..bc8b99ad 100644
--- a/backend/pdf/ev-poppler.cc
+++ b/backend/pdf/ev-poppler.cc
@@ -2845,7 +2845,22 @@ pdf_document_annotations_add_annotation (EvDocumentAnnotations *document_annotat
poppler_rect.x2 = rect->x2;
poppler_rect.y1 = height - rect->y2;
poppler_rect.y2 = height - rect->y1;
- poppler_annot = poppler_annot_text_new (pdf_document->document, &poppler_rect);
+
+ switch (ev_annotation_get_annotation_type (annot)) {
+ case EV_ANNOTATION_TYPE_TEXT: {
+ EvAnnotationText *text = EV_ANNOTATION_TEXT (annot);
+ EvAnnotationTextIcon icon;
+
+ poppler_annot = poppler_annot_text_new (pdf_document->document, &poppler_rect);
+
+ icon = ev_annotation_text_get_icon (text);
+ poppler_annot_text_set_icon (POPPLER_ANNOT_TEXT (poppler_annot),
+ get_poppler_annot_text_icon (icon));
+ }
+ break;
+ default:
+ g_assert_not_reached ();
+ }
ev_annotation_get_color (annot, &color);
poppler_color.red = color.red;
@@ -2875,14 +2890,6 @@ pdf_document_annotations_add_annotation (EvDocumentAnnotations *document_annotat
poppler_annot_markup_set_label (POPPLER_ANNOT_MARKUP (poppler_annot), label);
}
- if (EV_IS_ANNOTATION_TEXT (annot)) {
- EvAnnotationText *text = EV_ANNOTATION_TEXT (annot);
- EvAnnotationTextIcon icon;
-
- icon = ev_annotation_text_get_icon (text);
- poppler_annot_text_set_icon (POPPLER_ANNOT_TEXT (poppler_annot),
- get_poppler_annot_text_icon (icon));
- }
poppler_page_add_annot (poppler_page, poppler_annot);
annot_mapping = g_new (EvMapping, 1);