1 /* Fo
2  * fo-doc.h: Wrapper for libfo output document
3  *
4  * Copyright (C) 2001 Sun Microsystems
5  * Copyright (C) 2007-2009 Menteith Consulting Ltd
6  *
7  * See COPYING for the status of this software.
8  */
9 
10 #ifndef __FO_DOC_H__
11 #define __FO_DOC_H__
12 
13 #include <libfo/fo-utils.h>
14 #include <libfo/fo-libfo-context.h>
15 
16 typedef struct _FoDoc      FoDoc;
17 typedef struct _FoDocClass FoDocClass;
18 
19 #include <libfo/fo-layout.h>
20 
21 G_BEGIN_DECLS
22 
23 #define FO_DOC_ERROR fo_doc_error_quark ()
24 GQuark fo_doc_error_quark (void);
25 
26 typedef enum
27 {
28   FO_DOC_ERROR_FAILED,
29   FO_DOC_ERROR_OPEN_FAILED,	     /* Cannot open output document */
30   FO_DOC_ERROR_UNSUPPORTED_FORMAT,   /* Unsupported document format */
31   FO_DOC_ERROR_LAST
32 } FoDocError;
33 
34 extern const char *fo_doc_error_messages[FO_DOC_ERROR_LAST];
35 
36 typedef enum
37 {
38   FO_DOC_LINE_CAP_INVALID,
39   FO_DOC_LINE_CAP_BUTT,
40   FO_DOC_LINE_CAP_ROUND,
41   FO_DOC_LINE_CAP_SQUARE,
42   FO_DOC_LINE_CAP_LIMIT
43 } FoDocLineCap;
44 
45 typedef enum
46 {
47   FO_DOC_LINE_JOIN_INVALID,
48   FO_DOC_LINE_JOIN_MITER,
49   FO_DOC_LINE_JOIN_ROUND,
50   FO_DOC_LINE_JOIN_BEVEL,
51   FO_DOC_LINE_JOIN_LIMIT
52 } FoDocLineJoin;
53 
54 #define FO_TYPE_DOC              (fo_doc_get_type ())
55 #define FO_DOC(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), FO_TYPE_DOC, FoDoc))
56 #define FO_DOC_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), FO_TYPE_DOC, FoDocClass))
57 #define FO_IS_DOC(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), FO_TYPE_DOC))
58 #define FO_IS_DOC_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), FO_TYPE_DOC))
59 #define FO_DOC_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), FO_TYPE_DOC, FoDocClass))
60 
61 
62 GType         fo_doc_get_type (void);
63 FoDoc *       fo_doc_new (void);
64 FoDoc *       fo_doc_new_from_type (const gchar *type);
65 FoFlagsFormat fo_doc_formats_from_name (const gchar *name);
66 
67 void          fo_doc_open_file (FoDoc          *fo_doc,
68 				const gchar    *filename,
69 				FoLibfoContext *libfo_context,
70 				GError        **error);
71 
72 FoLayout *    fo_doc_get_new_layout (FoDoc *fo_doc);
73 
74 const gchar * fo_doc_get_language (FoDoc *fo_doc);
75 void          fo_doc_set_language (FoDoc *fo_doc,
76 				   const gchar    *language);
77 FoEnumAreaDirection fo_doc_get_base_dir (FoDoc      *fo_doc);
78 void                fo_doc_set_base_dir (FoDoc      *fo_doc,
79 					 FoEnumAreaDirection  base_dir);
80 
81 G_END_DECLS
82 
83 #endif /* !__FO_DOC_H__ */
84