]> www.fi.muni.cz Git - evince.git/blob - backend/ev-document.h
da38283263abb8b8a3ee00429037d517c12c7803
[evince.git] / backend / ev-document.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
2 /*
3  *  Copyright (C) 2000-2003 Marco Pesenti Gritti
4  *
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)
8  *  any later version.
9  *
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.
14  *
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.
18  *
19  *  $Id$
20  */
21
22 #ifndef EV_DOCUMENT_H
23 #define EV_DOCUMENT_H
24
25 #include <glib-object.h>
26 #include <glib.h>
27 #include <gdk/gdk.h>
28
29 #include "ev-link.h"
30 #include "ev-document-info.h"
31
32 G_BEGIN_DECLS
33
34 #define EV_TYPE_DOCUMENT            (ev_document_get_type ())
35 #define EV_DOCUMENT(o)              (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_DOCUMENT, EvDocument))
36 #define EV_DOCUMENT_IFACE(k)        (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT, EvDocumentIface))
37 #define EV_IS_DOCUMENT(o)           (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_DOCUMENT))
38 #define EV_IS_DOCUMENT_IFACE(k)     (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_DOCUMENT))
39 #define EV_DOCUMENT_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_DOCUMENT, EvDocumentIface))
40
41 typedef struct _EvDocument        EvDocument;
42 typedef struct _EvDocumentIface   EvDocumentIface;
43 typedef struct _EvPageCache       EvPageCache;
44 typedef struct _EvPageCacheClass  EvPageCacheClass;
45
46 #include "ev-page-cache.h"
47
48
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 ())
52
53 typedef enum
54 {
55         EV_DOCUMENT_ERROR_INVALID,
56         EV_DOCUMENT_ERROR_ENCRYPTED
57 } EvDocumentError;
58
59 typedef struct {
60         double x1;
61         double y1;
62         double x2;
63         double y2;
64 } EvRectangle;
65
66 struct _EvDocumentIface
67 {
68         GTypeInterface base_iface;
69
70         /* Methods  */
71         gboolean    (* load)            (EvDocument   *document,
72                                          const char   *uri,
73                                          GError      **error);
74         gboolean    (* save)            (EvDocument   *document,
75                                          const char   *uri,
76                                          GError      **error);
77         int         (* get_n_pages)     (EvDocument   *document);
78         void        (* get_page_size)   (EvDocument   *document,
79                                          int           page,
80                                          double       *width,
81                                          double       *height);
82         char      * (* get_page_label)  (EvDocument   *document,
83                                          int           page);
84         gboolean    (* can_get_text)    (EvDocument   *document);
85         char      * (* get_text)        (EvDocument   *document,
86                                          int           page,
87                                          EvRectangle  *rect);
88         GList     * (* get_links)       (EvDocument   *document,
89                                          int           page);
90         GdkPixbuf * (* render_pixbuf)   (EvDocument   *document,
91                                          int           page,
92                                          double        scale);
93         EvDocumentInfo *(* get_info)    (EvDocument   *document);
94 };
95
96 GType           ev_document_get_type       (void);
97 GQuark          ev_document_error_quark    (void);
98 EvPageCache    *ev_document_get_page_cache (EvDocument     *document);
99 GMutex         *ev_document_get_doc_mutex  (void);
100 void            ev_document_doc_mutex_lock (void);
101 void            ev_document_doc_mutex_unlock (void);
102 EvDocumentInfo *ev_document_get_info       (EvDocument     *document);
103 gboolean        ev_document_load           (EvDocument     *document,
104                                             const char     *uri,
105                                             GError        **error);
106 gboolean        ev_document_save           (EvDocument     *document,
107                                             const char     *uri,
108                                             GError        **error);
109 int             ev_document_get_n_pages    (EvDocument     *document);
110 void            ev_document_get_page_size  (EvDocument     *document,
111                                             int             page,
112                                             double         *width,
113                                             double         *height);
114 char           *ev_document_get_page_label (EvDocument     *document,
115                                             int             page);
116 gboolean        ev_document_can_get_text   (EvDocument     *document);
117 char           *ev_document_get_text       (EvDocument     *document,
118                                             int             page,
119                                             EvRectangle    *rect);
120 GList          *ev_document_get_links      (EvDocument     *document,
121                                             int             page);
122 GdkPixbuf      *ev_document_render_pixbuf  (EvDocument     *document,
123                                             int             page,
124                                             double          scale);
125
126 G_END_DECLS
127
128 #endif