X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=backend%2Fxps%2Fxps-document.c;h=6e34f077d9f1ab7f9c001b4ed61edb0da5994cfe;hb=ed5fc60d286963b4f455327b2b59735a384eb557;hp=544742e08969886b2e179daae8c5b4c82f122341;hpb=a94a0aa428f689cbcc272c71762b7d5a4b1275de;p=evince.git diff --git a/backend/xps/xps-document.c b/backend/xps/xps-document.c index 544742e0..6e34f077 100644 --- a/backend/xps/xps-document.c +++ b/backend/xps/xps-document.c @@ -24,6 +24,7 @@ #include "xps-document.h" #include "ev-document-links.h" +#include "ev-document-print.h" #include "ev-document-misc.h" struct _XPSDocument { @@ -39,11 +40,14 @@ struct _XPSDocumentClass { }; static void xps_document_document_links_iface_init (EvDocumentLinksInterface *iface); +static void xps_document_document_print_iface_init (EvDocumentPrintInterface *iface); EV_BACKEND_REGISTER_WITH_CODE (XPSDocument, xps_document, { EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_LINKS, xps_document_document_links_iface_init); + EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_PRINT, + xps_document_document_print_iface_init); }) /* XPSDocument */ @@ -315,6 +319,13 @@ ev_link_from_target (XPSDocument *xps_document, dest = ev_link_dest_new_named (anchor); ev_action = ev_link_action_new_dest (dest); + } else if (doc == -1 && anchor && + gxps_document_get_page_for_anchor (xps_document->doc, anchor) >= 0) { + /* Internal, but source is not a doc, + * let's try with doc = 0 + */ + dest = ev_link_dest_new_named (anchor); + ev_action = ev_link_action_new_dest (dest); } else { gchar *filename; @@ -478,3 +489,25 @@ xps_document_document_links_iface_init (EvDocumentLinksInterface *iface) iface->find_link_dest = xps_document_links_find_link_dest; iface->find_link_page = xps_document_links_find_link_page; } + +/* EvDocumentPrint */ +static void +xps_document_print_print_page (EvDocumentPrint *document, + EvPage *page, + cairo_t *cr) +{ + GError *error = NULL; + + gxps_page_render (GXPS_PAGE (page->backend_page), cr, &error); + if (error) { + g_warning ("Error rendering page %d for printing: %s\n", + page->index, error->message); + g_error_free (error); + } +} + +static void +xps_document_document_print_iface_init (EvDocumentPrintInterface *iface) +{ + iface->print_page = xps_document_print_print_page; +}