1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
2 /*
3  *  Copyright (C) 2010 Yaco Sistemas, Daniel Garcia <danigm@yaco.es>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  *  $Id$
20  */
21 
22 #include "config.h"
23 
24 #include "ev-document-text.h"
25 
26 G_DEFINE_INTERFACE (EvDocumentText, ev_document_text, 0)
27 
28 static void
ev_document_text_default_init(EvDocumentTextInterface * klass)29 ev_document_text_default_init (EvDocumentTextInterface *klass)
30 {
31 }
32 
33 gchar *
ev_document_text_get_text(EvDocumentText * document_text,EvPage * page)34 ev_document_text_get_text (EvDocumentText   *document_text,
35 			   EvPage           *page)
36 {
37 	EvDocumentTextInterface *iface = EV_DOCUMENT_TEXT_GET_IFACE (document_text);
38 
39 	if (!iface->get_text)
40 		return NULL;
41 
42 	return iface->get_text (document_text, page);
43 }
44 
45 
46 gboolean
ev_document_text_get_text_layout(EvDocumentText * document_text,EvPage * page,EvRectangle ** areas,guint * n_areas)47 ev_document_text_get_text_layout (EvDocumentText   *document_text,
48 				  EvPage           *page,
49 				  EvRectangle     **areas,
50 				  guint            *n_areas)
51 {
52 	EvDocumentTextInterface *iface = EV_DOCUMENT_TEXT_GET_IFACE (document_text);
53 
54 	if (!iface->get_text_layout)
55 		return FALSE;
56 
57 	return iface->get_text_layout (document_text, page, areas, n_areas);
58 }
59 
60 cairo_region_t *
ev_document_text_get_text_mapping(EvDocumentText * document_text,EvPage * page)61 ev_document_text_get_text_mapping (EvDocumentText *document_text,
62 				   EvPage         *page)
63 {
64 	EvDocumentTextInterface *iface = EV_DOCUMENT_TEXT_GET_IFACE (document_text);
65 
66 	if (!iface->get_text_mapping)
67 		return NULL;
68 
69 	return iface->get_text_mapping (document_text, page);
70 }
71 
72 PangoAttrList *
ev_document_text_get_text_attrs(EvDocumentText * document_text,EvPage * page)73 ev_document_text_get_text_attrs (EvDocumentText *document_text,
74                                  EvPage         *page)
75 {
76 	EvDocumentTextInterface *iface = EV_DOCUMENT_TEXT_GET_IFACE (document_text);
77 
78 	if (!iface->get_text_attrs)
79 		return NULL;
80 
81 	return iface->get_text_attrs (document_text, page);
82 }
83