File: pps-document-text.c

package info (click to toggle)
papers 49.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 21,044 kB
  • sloc: ansic: 37,728; sh: 197; xml: 127; makefile: 113
file content (106 lines) | stat: -rw-r--r-- 2,854 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Copyright (C) 2010 Yaco Sistemas, Daniel Garcia <danigm@yaco.es>
 */

#include "config.h"

#include "pps-document-text.h"

G_DEFINE_INTERFACE (PpsDocumentText, pps_document_text, 0)

static void
pps_document_text_default_init (PpsDocumentTextInterface *klass)
{
}

gchar *
pps_document_text_get_text (PpsDocumentText *document_text,
                            PpsPage *page)
{
	PpsDocumentTextInterface *iface = PPS_DOCUMENT_TEXT_GET_IFACE (document_text);

	if (!iface->get_text)
		return NULL;

	return iface->get_text (document_text, page);
}

/**
 * pps_document_text_get_text_layout:
 * @document_text: a #PpsDocumentText
 * @page: a #PpsPage
 * @areas: (optional) (out) (array length=n_areas) (transfer container): the text areas of the layout
 * @n_areas: (out): the number of text areas in the layout
 *
 * Returns: whether the text layout is empty, i.e. there is text on the page
 */
gboolean
pps_document_text_get_text_layout (PpsDocumentText *document_text,
                                   PpsPage *page,
                                   PpsRectangle **areas,
                                   guint *n_areas)
{
	PpsDocumentTextInterface *iface = PPS_DOCUMENT_TEXT_GET_IFACE (document_text);

	if (!iface->get_text_layout)
		return FALSE;

	return iface->get_text_layout (document_text, page, areas, n_areas);
}

/**
 * pps_document_text_get_text_in_area:
 * @document_text: a #PpsDocumentText
 * @page: a #PpsPage of that document
 * @area: a #PpsRectangle on that page
 *
 * Returns: (transfer full) (nullable): the text inside the area of the specified page or %NULL
 *
 * Since: 47
 */
gchar *
pps_document_text_get_text_in_area (PpsDocumentText *document_text,
                                    PpsPage *page,
                                    PpsRectangle *area)
{
	PpsDocumentTextInterface *iface = PPS_DOCUMENT_TEXT_GET_IFACE (document_text);

	if (!iface->get_text_in_area)
		return NULL;

	return iface->get_text_in_area (document_text, page, area);
}

cairo_region_t *
pps_document_text_get_text_mapping (PpsDocumentText *document_text,
                                    PpsPage *page)
{
	PpsDocumentTextInterface *iface = PPS_DOCUMENT_TEXT_GET_IFACE (document_text);

	if (!iface->get_text_mapping)
		return NULL;

	return iface->get_text_mapping (document_text, page);
}

/**
 * pps_document_text_get_text_attrs:
 * @document_text: a #PpsDocumentText
 * @page: a #PpsPage
 *
 * FIXME
 *
 * Returns: (transfer full): a newly created #PangoAttrList
 */
PangoAttrList *
pps_document_text_get_text_attrs (PpsDocumentText *document_text,
                                  PpsPage *page)
{
	PpsDocumentTextInterface *iface = PPS_DOCUMENT_TEXT_GET_IFACE (document_text);

	if (!iface->get_text_attrs)
		return NULL;

	return iface->get_text_attrs (document_text, page);
}