File: pps-document-annotations.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 (90 lines) | stat: -rw-r--r-- 2,953 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
// SPDX-License-Identifier: GPL-2.0-or-later
/* pps-document-annotations.c
 *  this file is part of papers, a gnome document viewer
 *
 * Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
 * Copyright (C) 2007 IƱigo Martinez <inigomartinez@gmail.com>
 */

#include "pps-document-annotations.h"

G_DEFINE_INTERFACE (PpsDocumentAnnotations, pps_document_annotations, 0)

static void
pps_document_annotations_default_init (PpsDocumentAnnotationsInterface *klass)
{
}

/**
 * pps_document_annotations_get_annotations:
 * @document_annots: a #PpsDocumentAnnotations
 * @page: the page from where to get the annotations
 *
 * Returns: (nullable) (transfer none) (element-type PpsAnnotation):
 */
GList *
pps_document_annotations_get_annotations (PpsDocumentAnnotations *document_annots,
                                          PpsPage *page)
{
	PpsDocumentAnnotationsInterface *iface = PPS_DOCUMENT_ANNOTATIONS_GET_IFACE (document_annots);

	return iface->get_annotations (document_annots, page);
}

gboolean
pps_document_annotations_document_is_modified (PpsDocumentAnnotations *document_annots)
{
	PpsDocumentAnnotationsInterface *iface = PPS_DOCUMENT_ANNOTATIONS_GET_IFACE (document_annots);

	return (iface->document_is_modified) ? iface->document_is_modified (document_annots) : FALSE;
}

void
pps_document_annotations_add_annotation (PpsDocumentAnnotations *document_annots,
                                         PpsAnnotation *annot)
{
	PpsDocumentAnnotationsInterface *iface = PPS_DOCUMENT_ANNOTATIONS_GET_IFACE (document_annots);

	if (iface->add_annotation)
		iface->add_annotation (document_annots, annot);
}

gboolean
pps_document_annotations_can_add_annotation (PpsDocumentAnnotations *document_annots)
{
	PpsDocumentAnnotationsInterface *iface = PPS_DOCUMENT_ANNOTATIONS_GET_IFACE (document_annots);

	return iface->add_annotation != NULL;
}

void
pps_document_annotations_remove_annotation (PpsDocumentAnnotations *document_annots,
                                            PpsAnnotation *annot)
{
	PpsDocumentAnnotationsInterface *iface = PPS_DOCUMENT_ANNOTATIONS_GET_IFACE (document_annots);

	if (iface->remove_annotation)
		iface->remove_annotation (document_annots, annot);
}

gboolean
pps_document_annotations_can_remove_annotation (PpsDocumentAnnotations *document_annots)
{
	PpsDocumentAnnotationsInterface *iface = PPS_DOCUMENT_ANNOTATIONS_GET_IFACE (document_annots);

	return iface->remove_annotation != NULL;
}

PpsAnnotationsOverMarkup
pps_document_annotations_over_markup (PpsDocumentAnnotations *document_annots,
                                      PpsAnnotation *annot,
                                      gdouble x,
                                      gdouble y)
{
	PpsDocumentAnnotationsInterface *iface = PPS_DOCUMENT_ANNOTATIONS_GET_IFACE (document_annots);

	if (iface->over_markup)
		return iface->over_markup (document_annots, annot, x, y);

	return PPS_ANNOTATION_OVER_MARKUP_NOT_IMPLEMENTED;
}