summaryrefslogtreecommitdiff
path: root/backend/pdf
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-12-09 11:51:02 +0100
committerinfirit <[email protected]>2014-12-09 23:02:27 +0100
commitee955d1c853cab401b29e8c43f1be7165bc27425 (patch)
treea18f802faceddbce2781beed55b5528f412672c0 /backend/pdf
parent125dc8050524cecad32af8db8f4dfdea80ca65af (diff)
downloadatril-ee955d1c853cab401b29e8c43f1be7165bc27425.tar.bz2
atril-ee955d1c853cab401b29e8c43f1be7165bc27425.tar.xz
[pdf] Add support for OCG State actions
Based on evince commit: e39bde3f3b8ce3c111c27f7aa6b384c7a5f98672 From: Carlos Garcia Campos <[email protected]>
Diffstat (limited to 'backend/pdf')
-rw-r--r--backend/pdf/ev-poppler.cc43
1 files changed, 41 insertions, 2 deletions
diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc
index 72d7ac92..74c6c48e 100644
--- a/backend/pdf/ev-poppler.cc
+++ b/backend/pdf/ev-poppler.cc
@@ -1123,8 +1123,47 @@ ev_link_from_action (PdfDocument *pdf_document,
case POPPLER_ACTION_RENDITION:
unimplemented_action = "POPPLER_ACTION_RENDITION";
break;
- case POPPLER_ACTION_OCG_STATE:
- unimplemented_action = "POPPLER_ACTION_OCG_STATE";
+ case POPPLER_ACTION_OCG_STATE: {
+ GList *on_list = NULL;
+ GList *off_list = NULL;
+ GList *toggle_list = NULL;
+ GList *l, *m;
+
+ for (l = action->ocg_state.state_list; l; l = g_list_next (l)) {
+ PopplerActionLayer *action_layer = (PopplerActionLayer *)l->data;
+
+ for (m = action_layer->layers; m; m = g_list_next (m)) {
+ PopplerLayer *layer = (PopplerLayer *)m->data;
+ EvLayer *ev_layer;
+
+ ev_layer = ev_layer_new (poppler_layer_is_parent (layer),
+ poppler_layer_get_radio_button_group_id (layer));
+ g_object_set_data_full (G_OBJECT (ev_layer),
+ "poppler-layer",
+ g_object_ref (layer),
+ (GDestroyNotify)g_object_unref);
+
+ switch (action_layer->action) {
+ case POPPLER_ACTION_LAYER_ON:
+ on_list = g_list_prepend (on_list, ev_layer);
+ break;
+ case POPPLER_ACTION_LAYER_OFF:
+ off_list = g_list_prepend (off_list, ev_layer);
+ break;
+ case POPPLER_ACTION_LAYER_TOGGLE:
+ toggle_list = g_list_prepend (toggle_list, ev_layer);
+ break;
+ }
+ }
+ }
+
+ /* The action takes the ownership of the lists */
+ ev_action = ev_link_action_new_layers_state (g_list_reverse (on_list),
+ g_list_reverse (off_list),
+ g_list_reverse (toggle_list));
+
+
+ }
break;
#endif
case POPPLER_ACTION_UNKNOWN: