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);
34 static guint signals[LAST_SIGNAL] = { 0 };
37 ev_document_get_type (void)
39 static GType type = 0;
41 if (G_UNLIKELY (type == 0))
43 static const GTypeInfo our_info =
45 sizeof (EvDocumentIface),
48 (GClassInitFunc)ev_document_class_init
51 type = g_type_register_static (G_TYPE_INTERFACE,
53 &our_info, (GTypeFlags)0);
60 ev_document_error_quark (void)
64 q = g_quark_from_static_string ("ev-document-error-quark");
70 ev_document_class_init (gpointer g_class)
73 g_signal_new ("changed",
76 G_STRUCT_OFFSET (EvDocumentIface, changed),
78 g_cclosure_marshal_VOID__VOID,
82 g_object_interface_install_property (g_class,
83 g_param_spec_string ("title",
85 "The title of the document",
91 ev_document_load (EvDocument *document,
95 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
96 return iface->load (document, uri, error);
100 ev_document_save (EvDocument *document,
104 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
105 return iface->save (document, uri, error);
109 ev_document_get_title (EvDocument *document)
113 g_object_get (document, "title", &title, NULL);
119 ev_document_get_n_pages (EvDocument *document)
121 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
122 return iface->get_n_pages (document);
126 ev_document_set_page (EvDocument *document,
129 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
130 iface->set_page (document, page);
134 ev_document_get_page (EvDocument *document)
136 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
137 return iface->get_page (document);
141 ev_document_set_target (EvDocument *document,
144 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
145 iface->set_target (document, target);
149 ev_document_set_scale (EvDocument *document,
152 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
153 iface->set_scale (document, scale);
157 ev_document_set_page_offset (EvDocument *document,
161 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
162 iface->set_page_offset (document, x, y);
166 ev_document_get_page_size (EvDocument *document,
170 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
171 iface->get_page_size (document, width, height);
175 ev_document_get_text (EvDocument *document,
178 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
179 return iface->get_text (document, rect);
183 ev_document_get_link (EvDocument *document,
187 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
188 return iface->get_link (document, x, y);
192 ev_document_render (EvDocument *document,
198 EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
199 iface->render (document, clip_x, clip_y, clip_width, clip_height);
203 ev_document_changed (EvDocument *document)
205 g_signal_emit (G_OBJECT (document), signals[CHANGED], 0);