## ev-document

ev-document

## Synopsis

    #define             EV_DOCUMENT_IFACE                   (k)
    #define             EV_IS_DOCUMENT_IFACE                (k)
                        EvDocument;
                        EvDocumentIface;
                        EvPageCache;
                        EvPageCacheClass;
    #define             EV_DOCUMENT_ERROR
    #define             EV_DOC_MUTEX_LOCK
    #define             EV_DOC_MUTEX_UNLOCK
    enum                EvDocumentError;
                        EvPoint;
                        EvRectangle;
    GQuark              ev_document_error_quark             (void);
    GMutex*             ev_document_get_doc_mutex           (void);
    void                ev_document_doc_mutex_lock          (void);
    void                ev_document_doc_mutex_unlock        (void);
    gboolean            ev_document_doc_mutex_trylock       (void);
    GMutex*             ev_document_get_fc_mutex            (void);
    void                ev_document_fc_mutex_lock           (void);
    void                ev_document_fc_mutex_unlock         (void);
    gboolean            ev_document_fc_mutex_trylock        (void);
    EvDocumentInfo*     ev_document_get_info                (EvDocument *document);
    gboolean            ev_document_load                    (EvDocument *document,
                                                             const char *uri,
                                                             GError **error);
    gboolean            ev_document_save                    (EvDocument *document,
                                                             const char *uri,
                                                             GError **error);
    int                 ev_document_get_n_pages             (EvDocument *document);
    EvPage*             ev_document_get_page                (EvDocument *document,
                                                             gint index);
    void                ev_document_get_page_size           (EvDocument *document,
                                                             EvPage *page,
                                                             double *width,
                                                             double *height);
    char*               ev_document_get_page_label          (EvDocument *document,
                                                             EvPage *page);
    gboolean            ev_document_has_attachments         (EvDocument *document);
    GList*              ev_document_get_attachments         (EvDocument *document);
    cairo_surface_t*    ev_document_render                  (EvDocument *document,
                                                             EvRenderContext *rc);
    gint                ev_rect_cmp                         (EvRectangle *a,
                                                             EvRectangle *b);
    #define             EV_BACKEND_IMPLEMENT_INTERFACE      (TYPE_IFACE, iface_init)
    #define             EV_BACKEND_REGISTER_WITH_CODE       (BackendName, backend_name, CODE)
    #define             EV_BACKEND_REGISTER                 (BackendName, backend_name)
    #define             EV_DEFINE_BOXED_TYPE                (TypeName, type_name, copy_func, free_func)
    #define             EV_DEFINE_INTERFACE                 (TypeName, type_name, TYPE_PREREQ)

## Object Hierarchy

      GInterface
       +----EvDocument

## Prerequisites

EvDocument requires GObject.

## Description

## Details

### EV_DOCUMENT_IFACE()

    #define EV_DOCUMENT_IFACE(k)        (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT, EvDocumentIface))

`k` : |

### EV_IS_DOCUMENT_IFACE()

    #define EV_IS_DOCUMENT_IFACE(k)     (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_DOCUMENT))

`k` : |

### EvDocument

    typedef struct _EvDocument EvDocument;

### EvDocumentIface

    typedef struct {
            GTypeInterface base_iface;

            /* Methods  */
            gboolean          (* load)            (EvDocument      *document,
                                                   const char      *uri,
                                                   GError         **error);
            gboolean          (* save)            (EvDocument      *document,
                                                   const char      *uri,
                                                   GError         **error);
            int               (* get_n_pages)     (EvDocument      *document);
    	EvPage          * (* get_page)        (EvDocument      *document,
    					       gint             index);
            void              (* get_page_size)   (EvDocument      *document,
                                                   EvPage          *page,
                                                   double          *width,
                                                   double          *height);
            char            * (* get_page_label)  (EvDocument      *document,
                                                   EvPage          *page);
            gboolean          (* has_attachments) (EvDocument      *document);
            GList           * (* get_attachments) (EvDocument      *document);
            cairo_surface_t * (* render)          (EvDocument      *document,
                                                   EvRenderContext *rc);
            EvDocumentInfo *  (* get_info)        (EvDocument      *document);
    } EvDocumentIface;

### EvPageCache

    typedef struct _EvPageCache EvPageCache;

### EvPageCacheClass

    typedef struct _EvPageCacheClass EvPageCacheClass;

### EV_DOCUMENT_ERROR

    #define EV_DOCUMENT_ERROR ev_document_error_quark ()

### EV_DOC_MUTEX_LOCK

    #define EV_DOC_MUTEX_LOCK (ev_document_doc_mutex_lock ())

### EV_DOC_MUTEX_UNLOCK

    #define EV_DOC_MUTEX_UNLOCK (ev_document_doc_mutex_unlock ())

### enum EvDocumentError

    typedef enum
    {
            EV_DOCUMENT_ERROR_INVALID,
            EV_DOCUMENT_ERROR_ENCRYPTED
    } EvDocumentError;

### EvPoint

    typedef struct {
            double x;
            double y;
    } EvPoint;

### EvRectangle

    typedef struct {
            double x1;
            double y1;
            double x2;
            double y2;
    } EvRectangle;

### ev_document_error_quark ()

    GQuark              ev_document_error_quark             (void);

Returns : |

### ev_document_get_doc_mutex ()

    GMutex*             ev_document_get_doc_mutex           (void);

Returns : |

### ev_document_doc_mutex_lock ()

    void                ev_document_doc_mutex_lock          (void);

### ev_document_doc_mutex_unlock ()

    void                ev_document_doc_mutex_unlock        (void);

### ev_document_doc_mutex_trylock ()

    gboolean            ev_document_doc_mutex_trylock       (void);

Returns : |

### ev_document_get_fc_mutex ()

    GMutex*             ev_document_get_fc_mutex            (void);

Returns : |

### ev_document_fc_mutex_lock ()

    void                ev_document_fc_mutex_lock           (void);

### ev_document_fc_mutex_unlock ()

    void                ev_document_fc_mutex_unlock         (void);

### ev_document_fc_mutex_trylock ()

    gboolean            ev_document_fc_mutex_trylock        (void);

Returns : |

### ev_document_get_info ()

    EvDocumentInfo*     ev_document_get_info                (EvDocument *document);

`document` : |
Returns : |

### ev_document_load ()

    gboolean            ev_document_load                    (EvDocument *document,
                                                             const char *uri,
                                                             GError **error);

Loads `document` from `uri`.

On failure, `FALSE` is returned and `error` is filled in. If the document is encrypted, EV_DEFINE_ERROR_ENCRYPTED is returned. If the backend cannot load the specific document, EV_DOCUMENT_ERROR_INVALID is returned. Other errors are possible too, depending on the backend used to load the document and the URI, e.g. GIOError, GFileError, and GConvertError.

`document` : | a EvDocument
`uri` : | the document's URI
`error` : | a GError location to store an error, or `NULL`
Returns : | `TRUE` on success, or `FALSE` on failure.

### ev_document_save ()

    gboolean            ev_document_save                    (EvDocument *document,
                                                             const char *uri,
                                                             GError **error);

Saves `document` to `uri`.

`document` : |
`uri` : | the target URI
`error` : | a GError location to store an error, or `NULL`
Returns : | `TRUE` on success, or `FALSE` on error with `error` filled in

### ev_document_get_n_pages ()

    int                 ev_document_get_n_pages             (EvDocument *document);

`document` : |
Returns : |

### ev_document_get_page ()

    EvPage*             ev_document_get_page                (EvDocument *document,
                                                             gint index);

`document` : |
`index` : |
Returns : |

### ev_document_get_page_size ()

    void                ev_document_get_page_size           (EvDocument *document,
                                                             EvPage *page,
                                                             double *width,
                                                             double *height);

`document` : |
`page` : |
`width` : |
`height` : |

### ev_document_get_page_label ()

    char*               ev_document_get_page_label          (EvDocument *document,
                                                             EvPage *page);

`document` : |
`page` : |
Returns : |

### ev_document_has_attachments ()

    gboolean            ev_document_has_attachments         (EvDocument *document);

`document` : |
Returns : |

### ev_document_get_attachments ()

    GList*              ev_document_get_attachments         (EvDocument *document);

`document` : |
Returns : |

### ev_document_render ()

    cairo_surface_t*    ev_document_render                  (EvDocument *document,
                                                             EvRenderContext *rc);

`document` : |
`rc` : |
Returns : |

### ev_rect_cmp ()

    gint                ev_rect_cmp                         (EvRectangle *a,
                                                             EvRectangle *b);

`a` : |
`b` : |
Returns : |

### EV_BACKEND_IMPLEMENT_INTERFACE()

    #define             EV_BACKEND_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init)

`TYPE_IFACE` : |
`iface_init` : |

### EV_BACKEND_REGISTER_WITH_CODE()

    #define             EV_BACKEND_REGISTER_WITH_CODE(BackendName, backend_name, CODE)

`BackendName` : |
`backend_name` : |
`CODE` : |

### EV_BACKEND_REGISTER()

    #define             EV_BACKEND_REGISTER(BackendName, backend_name)

`BackendName` : |
`backend_name` : |

### EV_DEFINE_BOXED_TYPE()

    #define             EV_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func)

`TypeName` : |
`type_name` : |
`copy_func` : |
`free_func` : |

### EV_DEFINE_INTERFACE()

    #define             EV_DEFINE_INTERFACE(TypeName, type_name, TYPE_PREREQ)

`TypeName` : |
`type_name` : |
`TYPE_PREREQ` : |