]> www.fi.muni.cz Git - evince.git/blob - backend/ev-document.h
Fix the crash when trying to copy in backends that doesnt support it. We
[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
31 G_BEGIN_DECLS
32
33 #define EV_TYPE_DOCUMENT            (ev_document_get_type ())
34 #define EV_DOCUMENT(o)              (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_DOCUMENT, EvDocument))
35 #define EV_DOCUMENT_IFACE(k)        (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT, EvDocumentIface))
36 #define EV_IS_DOCUMENT(o)           (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_DOCUMENT))
37 #define EV_IS_DOCUMENT_IFACE(k)     (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_DOCUMENT))
38 #define EV_DOCUMENT_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_DOCUMENT, EvDocumentIface))
39
40 typedef struct _EvDocument        EvDocument;
41 typedef struct _EvDocumentIface   EvDocumentIface;
42 typedef struct _EvPageCache       EvPageCache;
43 typedef struct _EvPageCacheClass  EvPageCacheClass;
44
45 #include "ev-page-cache.h"
46
47
48 #define EV_DOCUMENT_ERROR ev_document_error_quark ()
49 #define EV_DOC_MUTEX (ev_document_get_doc_mutex ())
50
51 typedef enum
52 {
53         EV_DOCUMENT_ERROR_INVALID,
54         EV_DOCUMENT_ERROR_ENCRYPTED
55 } EvDocumentError;
56
57 typedef struct {
58         double x1;
59         double y1;
60         double x2;
61         double y2;
62 } EvRectangle;
63
64 struct _EvDocumentIface
65 {
66         GTypeInterface base_iface;
67
68         /* Methods  */
69         gboolean    (* load)            (EvDocument   *document,
70                                          const char   *uri,
71                                          GError      **error);
72         gboolean    (* save)            (EvDocument   *document,
73                                          const char   *uri,
74                                          GError      **error);
75         int         (* get_n_pages)     (EvDocument   *document);
76         void        (* get_page_size)   (EvDocument   *document,
77                                          int           page,
78                                          double       *width,
79                                          double       *height);
80         char      * (* get_page_label)  (EvDocument   *document,
81                                          int           page);
82         gboolean    (* can_get_text)    (EvDocument   *document);
83         char      * (* get_text)        (EvDocument   *document,
84                                          int           page,
85                                          EvRectangle  *rect);
86         GList     * (* get_links)       (EvDocument   *document,
87                                          int           page);
88         GdkPixbuf * (* render_pixbuf)   (EvDocument   *document,
89                                          int           page,
90                                          double        scale);
91 };
92
93 GType        ev_document_get_type       (void);
94 GQuark       ev_document_error_quark    (void);
95 EvPageCache *ev_document_get_page_cache (EvDocument *document);
96 GMutex      *ev_document_get_doc_mutex  (void);
97
98
99 gboolean   ev_document_load          (EvDocument    *document,
100                                       const char    *uri,
101                                       GError       **error);
102 gboolean   ev_document_save          (EvDocument    *document,
103                                       const char    *uri,
104                                       GError       **error);
105 char      *ev_document_get_title     (EvDocument    *document);
106 int        ev_document_get_n_pages   (EvDocument    *document);
107 void       ev_document_get_page_size (EvDocument    *document,
108                                       int            page,
109                                       double        *width,
110                                       double        *height);
111 char      *ev_document_get_page_label(EvDocument    *document,
112                                       int            page);
113 gboolean   ev_document_can_get_text  (EvDocument    *document);
114 char      *ev_document_get_text      (EvDocument    *document,
115                                       int            page,
116                                       EvRectangle   *rect);
117 GList     *ev_document_get_links     (EvDocument    *document,
118                                       int            page);
119 GdkPixbuf *ev_document_render_pixbuf (EvDocument    *document,
120                                       int            page,
121                                       double         scale);
122
123
124 G_END_DECLS
125
126 #endif