1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
3 * Copyright (C) 2000-2003 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.
25 #include <glib-object.h>
30 #include "ev-document-info.h"
31 #include "ev-render-context.h"
35 #define EV_TYPE_DOCUMENT (ev_document_get_type ())
36 #define EV_DOCUMENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_DOCUMENT, EvDocument))
37 #define EV_DOCUMENT_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT, EvDocumentIface))
38 #define EV_IS_DOCUMENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_DOCUMENT))
39 #define EV_IS_DOCUMENT_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_DOCUMENT))
40 #define EV_DOCUMENT_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_DOCUMENT, EvDocumentIface))
42 typedef struct _EvDocument EvDocument;
43 typedef struct _EvDocumentIface EvDocumentIface;
44 typedef struct _EvPageCache EvPageCache;
45 typedef struct _EvPageCacheClass EvPageCacheClass;
49 #define EV_DOCUMENT_ERROR ev_document_error_quark ()
50 #define EV_DOC_MUTEX_LOCK (ev_document_doc_mutex_lock ())
51 #define EV_DOC_MUTEX_UNLOCK (ev_document_doc_mutex_unlock ())
55 EV_DOCUMENT_ERROR_INVALID,
56 EV_DOCUMENT_ERROR_ENCRYPTED
71 struct _EvDocumentIface
73 GTypeInterface base_iface;
76 gboolean (* load) (EvDocument *document,
79 gboolean (* save) (EvDocument *document,
82 int (* get_n_pages) (EvDocument *document);
83 void (* get_page_size) (EvDocument *document,
87 char * (* get_page_label) (EvDocument *document,
89 gboolean (* can_get_text) (EvDocument *document);
90 char * (* get_text) (EvDocument *document,
93 GList * (* get_links) (EvDocument *document,
95 GdkPixbuf * (* render_pixbuf) (EvDocument *document,
97 EvDocumentInfo * (* get_info) (EvDocument *document);
100 GType ev_document_get_type (void);
101 GQuark ev_document_error_quark (void);
102 GMutex *ev_document_get_doc_mutex (void);
103 void ev_document_doc_mutex_lock (void);
104 void ev_document_doc_mutex_unlock (void);
106 EvDocumentInfo *ev_document_get_info (EvDocument *document);
107 gboolean ev_document_load (EvDocument *document,
110 gboolean ev_document_save (EvDocument *document,
113 int ev_document_get_n_pages (EvDocument *document);
114 void ev_document_get_page_size (EvDocument *document,
118 char *ev_document_get_page_label (EvDocument *document,
120 gboolean ev_document_can_get_text (EvDocument *document);
121 char *ev_document_get_text (EvDocument *document,
124 GList *ev_document_get_links (EvDocument *document,
126 GdkPixbuf *ev_document_render_pixbuf (EvDocument *document,
127 EvRenderContext *rc);
129 gint ev_rect_cmp (EvRectangle *a,