## EvDocument

EvDocument

## Synopsis

                        EvDocument;
                        EvDocumentClass;
                        EvDocumentPrivate;
    #define             EV_DOCUMENT_ERROR
    #define             EV_DOC_MUTEX_LOCK
    #define             EV_DOC_MUTEX_UNLOCK
    enum                EvDocumentError;
                        EvPoint;
                        EvRectangle;
                        EvDocumentBackendInfo;
    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_get_backend_info        (EvDocument *document,
                                                             EvDocumentBackendInfo *info);
    gboolean            ev_document_load                    (EvDocument *document,
                                                             const char *uri,
                                                             GError **error);
    gboolean            ev_document_save                    (EvDocument *document,
                                                             const char *uri,
                                                             GError **error);
    gint                ev_document_get_n_pages             (EvDocument *document);
    EvPage *            ev_document_get_page                (EvDocument *document,
                                                             gint index);
    void                ev_document_get_page_size           (EvDocument *document,
                                                             gint page_index,
                                                             double *width,
                                                             double *height);
    gchar *             ev_document_get_page_label          (EvDocument *document,
                                                             gint page_index);
    cairo_surface_t *   ev_document_render                  (EvDocument *document,
                                                             EvRenderContext *rc);
    const gchar *       ev_document_get_uri                 (EvDocument *document);
    const gchar *       ev_document_get_title               (EvDocument *document);
    gboolean            ev_document_is_page_size_uniform    (EvDocument *document);
    void                ev_document_get_max_page_size       (EvDocument *document,
                                                             gdouble *width,
                                                             gdouble *height);
    gboolean            ev_document_check_dimensions        (EvDocument *document);
    gint                ev_document_get_max_label_len       (EvDocument *document);
    gboolean            ev_document_has_text_page_labels    (EvDocument *document);
    gboolean            ev_document_find_page_by_label      (EvDocument *document,
                                                             const gchar *page_label,
                                                             gint *page_index);
    gint                ev_rect_cmp                         (EvRectangle *a,
                                                             EvRectangle *b);
    #define             EV_TYPE_RECTANGLE
    GType               ev_rectangle_get_type               (void);
    EvRectangle *       ev_rectangle_new                    (void);
    EvRectangle *       ev_rectangle_copy                   (EvRectangle *ev_rect);
    void                ev_rectangle_free                   (EvRectangle *ev_rect);
    #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

      GObject
       +----EvDocument

## Description

## Details

### EvDocument

    typedef struct _EvDocument EvDocument;

### EvDocumentClass

    typedef struct {
            GObjectClass base_class;

            /* Virtual Methods  */
            gboolean          (* load)            (EvDocument      *document,
                                                   const char      *uri,
                                                   GError         **error);
            gboolean          (* save)            (EvDocument      *document,
                                                   const char      *uri,
                                                   GError         **error);
            gint              (* get_n_pages)     (EvDocument      *document);
    	EvPage          * (* get_page)        (EvDocument      *document,
    					       gint             index);
            void              (* get_page_size)   (EvDocument      *document,
                                                   EvPage          *page,
                                                   double          *width,
                                                   double          *height);
            gchar           * (* get_page_label)  (EvDocument      *document,
                                                   EvPage          *page);
            cairo_surface_t * (* render)          (EvDocument      *document,
                                                   EvRenderContext *rc);
            EvDocumentInfo  * (* get_info)        (EvDocument      *document);
            gboolean          (* get_backend_info)(EvDocument      *document,
                                                   EvDocumentBackendInfo *info);
    } EvDocumentClass;

### EvDocumentPrivate

    typedef struct _EvDocumentPrivate EvDocumentPrivate;

### 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 {
    	gdouble x1;
    	gdouble y1;
    	gdouble x2;
    	gdouble y2;
    } EvRectangle;

### EvDocumentBackendInfo

    typedef struct {
    	const gchar *name;
    	const gchar *version;
    } EvDocumentBackendInfo;

### 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_get_backend_info ()

    gboolean            ev_document_get_backend_info        (EvDocument *document,
                                                             EvDocumentBackendInfo *info);

### 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`.

`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 ()

    gint                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,
                                                             gint page_index,
                                                             double *width,
                                                             double *height);

`document` : |
`page_index` : |
`width` : |
`height` : |

### ev_document_get_page_label ()

    gchar *             ev_document_get_page_label          (EvDocument *document,
                                                             gint page_index);

`document` : |
`page_index` : |
Returns : |

### ev_document_render ()

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

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

### ev_document_get_uri ()

    const gchar *       ev_document_get_uri                 (EvDocument *document);

### ev_document_get_title ()

    const gchar *       ev_document_get_title               (EvDocument *document);

### ev_document_is_page_size_uniform ()

    gboolean            ev_document_is_page_size_uniform    (EvDocument *document);

### ev_document_get_max_page_size ()

    void                ev_document_get_max_page_size       (EvDocument *document,
                                                             gdouble *width,
                                                             gdouble *height);

### ev_document_check_dimensions ()

    gboolean            ev_document_check_dimensions        (EvDocument *document);

### ev_document_get_max_label_len ()

    gint                ev_document_get_max_label_len       (EvDocument *document);

### ev_document_has_text_page_labels ()

    gboolean            ev_document_has_text_page_labels    (EvDocument *document);

### ev_document_find_page_by_label ()

    gboolean            ev_document_find_page_by_label      (EvDocument *document,
                                                             const gchar *page_label,
                                                             gint *page_index);

### ev_rect_cmp ()

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

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

### EV_TYPE_RECTANGLE

    #define EV_TYPE_RECTANGLE (ev_rectangle_get_type ())

### ev_rectangle_get_type ()

    GType               ev_rectangle_get_type               (void);

Returns : |

### ev_rectangle_new ()

    EvRectangle *       ev_rectangle_new                    (void);

Returns : |

### ev_rectangle_copy ()

    EvRectangle *       ev_rectangle_copy                   (EvRectangle *ev_rect);

`ev_rect` : |
Returns : |

### ev_rectangle_free ()

    void                ev_rectangle_free                   (EvRectangle *ev_rect);

`ev_rect` : |

### 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` : |