1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
3 * Copyright (C) 2004 Marco Pesenti Gritti
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #include "ev-document.h"
24 #include "ev-backend-marshalers.h"
26 static void ev_document_class_init (gpointer g_class);
35 static guint signals[LAST_SIGNAL] = { 0 };
38 ev_document_get_type (void)
40 static GType type = 0;
42 if (G_UNLIKELY (type == 0))
44 static const GTypeInfo our_info =
46 sizeof (EvDocumentIface),
49 (GClassInitFunc)ev_document_class_init
52 type = g_type_register_static (G_TYPE_INTERFACE,
54 &our_info, (GTypeFlags)0);
61 ev_document_error_quark (void)
65 q = g_quark_from_static_string ("ev-document-error-quark");
71 ev_document_class_init (gpointer g_class)
73 signals[PAGE_CHANGED] =
74 g_signal_new ("page_changed",
77 G_STRUCT_OFFSET (EvDocumentIface, page_changed),
79 g_cclosure_marshal_VOID__VOID,
83 signals[SCALE_CHANGED] =
84 g_signal_new ("scale_changed",
87 G_STRUCT_OFFSET (EvDocumentIface, scale_changed),
89 g_cclosure_marshal_VOID__VOID,
93 g_object_interface_install_property (g_class,
94 g_param_spec_string ("title",
96 "The title of the document",
102 ev_document_load (EvDocument *document,
106 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
107 return iface->load (document, uri, error);
111 ev_document_save (EvDocument *document,
115 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
116 return iface->save (document, uri, error);
120 ev_document_get_title (EvDocument *document)
124 g_object_get (document, "title", &title, NULL);
130 ev_document_get_n_pages (EvDocument *document)
132 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
133 return iface->get_n_pages (document);
137 ev_document_set_page (EvDocument *document,
140 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
141 iface->set_page (document, page);
145 ev_document_get_page (EvDocument *document)
147 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
148 return iface->get_page (document);
152 ev_document_set_target (EvDocument *document,
155 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
156 iface->set_target (document, target);
160 ev_document_set_scale (EvDocument *document,
163 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
164 iface->set_scale (document, scale);
168 ev_document_set_page_offset (EvDocument *document,
172 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
173 iface->set_page_offset (document, x, y);
177 ev_document_get_page_size (EvDocument *document,
182 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
183 iface->get_page_size (document, page, width, height);
187 ev_document_get_text (EvDocument *document,
190 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
191 return iface->get_text (document, rect);
195 ev_document_get_link (EvDocument *document,
199 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
200 return iface->get_link (document, x, y);
204 ev_document_render (EvDocument *document,
210 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
211 iface->render (document, clip_x, clip_y, clip_width, clip_height);
215 ev_document_page_changed (EvDocument *document)
217 g_signal_emit (G_OBJECT (document), signals[PAGE_CHANGED], 0);
221 ev_document_scale_changed (EvDocument *document)
223 g_signal_emit (G_OBJECT (document), signals[SCALE_CHANGED], 0);