"Initial commit to Gerrit"
[profile/ivi/libgsf.git] / gsf / gsf-open-pkg-utils.h
1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * gsf-open-pkg-utils.h: Utilities for handling Open Package zip files
4  *                      from MS Office 2007 or XPS.
5  *
6  * Copyright (C) 2006-2008 Jody Goldberg (jody@gnome.org)
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of version 2.1 of the GNU Lesser General Public
10  * License as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
20  * USA
21  */
22
23 #ifndef GSF_OPEN_PKG_UTILS_H
24 #define GSF_OPEN_PKG_UTILS_H
25
26 #include <gsf/gsf.h>
27 #include <gsf/gsf-libxml.h>
28
29 G_BEGIN_DECLS
30
31 typedef struct _GsfOpenPkgRel   GsfOpenPkgRel;
32 typedef struct _GsfOpenPkgRels  GsfOpenPkgRels;
33 typedef void   (*GsfOpenPkgIter)(GsfInput *opkg,
34                                  GsfOpenPkgRel const *rel,
35                                  gpointer    user_data);
36
37 gboolean      gsf_open_pkg_rel_is_extern        (GsfOpenPkgRel const *rel);
38 char const   *gsf_open_pkg_rel_get_target       (GsfOpenPkgRel const *rel);
39 char const   *gsf_open_pkg_rel_get_type         (GsfOpenPkgRel const *rel);
40
41 GsfOpenPkgRel *gsf_open_pkg_lookup_rel_by_type (GsfInput *opkg, char const *type);
42 GsfOpenPkgRel *gsf_open_pkg_lookup_rel_by_id   (GsfInput *opkg, char const *id);
43 void           gsf_open_pkg_foreach_rel        (GsfInput *opkg,
44                                                 GsfOpenPkgIter func,
45                                                 gpointer       user_data);
46 GsfInput      *gsf_open_pkg_open_rel           (GsfInput *opkg, GsfOpenPkgRel const *rel,
47                                                 GError **err);
48
49 GsfInput      *gsf_open_pkg_open_rel_by_type   (GsfInput *opkg, char const *type,
50                                                 GError **err);
51 GsfInput      *gsf_open_pkg_open_rel_by_id     (GsfInput *opkg, char const *id,
52                                                 GError **err);
53 GError        *gsf_open_pkg_parse_rel_by_id    (GsfXMLIn *xin, char const *id,
54                                                 GsfXMLInNode const *dtd,
55                                                 GsfXMLInNS const *ns);
56
57 /* DEPRECATED in 1.14.6 */
58 GsfInput      *gsf_open_pkg_get_rel_by_type    (GsfInput *opkg, char const *type);
59 GsfInput      *gsf_open_pkg_get_rel_by_id      (GsfInput *opkg, char const *id);
60
61 typedef struct _GsfOutfileOpenPkg GsfOutfileOpenPkg;
62
63 #define GSF_OUTFILE_OPEN_PKG_TYPE       (gsf_outfile_open_pkg_get_type ())
64 #define GSF_OUTFILE_OPEN_PKG(o)         (G_TYPE_CHECK_INSTANCE_CAST ((o), GSF_OUTFILE_OPEN_PKG_TYPE, GsfOutfileOpenPkg))
65 #define GSF_IS_OUTFILE_OPEN_PKG(o)      (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSF_OUTFILE_OPEN_PKG_TYPE))
66
67 GType       gsf_outfile_open_pkg_get_type       (void) G_GNUC_CONST;
68 /* void     gsf_outfile_open_pkg_register_type  (GTypeModule *module); glib dynamic types are not thread safe */
69
70 GsfOutfile *gsf_outfile_open_pkg_new              (GsfOutfile *sink);
71 void        gsf_outfile_open_pkg_set_sink         (GsfOutfileOpenPkg *open_pkg,
72                                                    GsfOutput *sink);
73 void        gsf_outfile_open_pkg_set_content_type (GsfOutfileOpenPkg *open_pkg,
74                                                    char const *content_type);
75
76 char const *gsf_outfile_open_pkg_relate           (GsfOutfileOpenPkg *child,
77                                                    GsfOutfileOpenPkg *parent,
78                                                    char const *type);
79 GsfOutput  *gsf_outfile_open_pkg_add_rel          (GsfOutfile *dir,
80                                                    char const *name,
81                                                    char const *content_type,
82                                                    GsfOutfile *parent,
83                                                    char const *type);
84 char const *gsf_outfile_open_pkg_add_extern_rel   (GsfOutfileOpenPkg *parent,
85                                                    char const *target,
86                                                    char const *content_type);
87
88 gint gsf_open_pkg_error_id (void);
89
90 G_END_DECLS
91
92 #endif /* GSF_OPEN_PKG_UTILS_H */