zathura/document.h

130 lines
3.6 KiB
C
Raw Normal View History

2010-11-17 22:51:15 +01:00
/* See LICENSE file for license and copyright information */
#ifndef DOCUMENT_H
#define DOCUMENT_H
2011-09-29 12:07:07 +02:00
#include <cairo.h>
#include <gtk/gtk.h>
2010-11-17 22:51:15 +01:00
#include <stdbool.h>
#include <girara/types.h>
2012-03-27 13:30:04 +02:00
2011-04-18 18:19:41 +02:00
#include "zathura.h"
2012-03-27 11:19:39 +02:00
#include "types.h"
2012-02-07 20:13:39 +01:00
/**
* Meta data entries
*/
2011-10-01 23:29:40 +02:00
typedef enum zathura_document_meta_e
{
2012-02-07 20:13:39 +01:00
ZATHURA_DOCUMENT_TITLE, /**< Title of the document */
ZATHURA_DOCUMENT_AUTHOR, /**< Author of the document */
ZATHURA_DOCUMENT_SUBJECT, /**< Subject of the document */
ZATHURA_DOCUMENT_KEYWORDS, /**< Keywords of the document */
ZATHURA_DOCUMENT_CREATOR, /**< Creator of the document */
ZATHURA_DOCUMENT_PRODUCER, /**< Producer of the document */
ZATHURA_DOCUMENT_CREATION_DATE, /**< Creation data */
ZATHURA_DOCUMENT_MODIFICATION_DATE /**< Modification data */
2011-10-01 23:29:40 +02:00
} zathura_document_meta_t;
2011-03-12 11:32:24 +01:00
/**
* Document
*/
2010-11-17 22:51:15 +01:00
struct zathura_document_s
{
2012-01-22 21:57:18 +01:00
char* file_path; /**< File path of the document */
const char* password; /**< Password of the document */
unsigned int current_page_number; /**< Current page number */
unsigned int number_of_pages; /**< Number of pages */
double scale; /**< Scale value */
unsigned int rotate; /**< Rotation */
2012-01-22 21:57:18 +01:00
void* data; /**< Custom data */
zathura_t* zathura; /** Zathura object */
2012-02-09 01:46:51 +01:00
int adjust_mode; /**< Adjust mode (best-fit, width) */
unsigned int page_offset; /**< Page offset */
2010-11-17 22:51:15 +01:00
2011-03-12 11:32:24 +01:00
/**
* Document pages
*/
2010-12-28 00:47:41 +01:00
zathura_page_t** pages;
2011-03-12 11:32:24 +01:00
2012-03-27 13:30:04 +02:00
/**
* Used plugin
*/
zathura_plugin_t* plugin;
};
2011-03-12 11:32:24 +01:00
/**
* Open the document
*
2012-02-08 15:30:13 +01:00
* @param zathura Zathura object
2011-03-12 11:32:24 +01:00
* @param path Path to the document
* @param password Password of the document or NULL
* @return The document object
*/
2012-02-07 21:01:54 +01:00
zathura_document_t* zathura_document_open(zathura_t* zathura, const char* path,
const char* password);
2011-03-12 11:32:24 +01:00
/**
* Free the document
*
* @param document
2012-03-27 13:30:04 +02:00
* @return ZATHURA_ERROR_OK when no error occured, otherwise see
* zathura_error_t
2011-03-12 11:32:24 +01:00
*/
2012-03-27 13:30:04 +02:00
zathura_error_t zathura_document_free(zathura_document_t* document);
2011-03-12 11:32:24 +01:00
/**
* Save the document
*
* @param document The document object
* @param path Path for the saved file
2012-03-27 13:30:04 +02:00
* @return ZATHURA_ERROR_OK when no error occured, otherwise see
* zathura_error_t
2011-03-12 11:32:24 +01:00
*/
2012-03-27 13:30:04 +02:00
zathura_error_t zathura_document_save_as(zathura_document_t* document, const char* path);
2011-03-12 11:32:24 +01:00
/**
* Generate the document index
*
* @param document The document object
2012-03-27 13:30:04 +02:00
* @param error Set to an error value (see \ref zathura_error_t) if an
2012-02-08 15:30:13 +01:00
* error occured
2011-03-12 11:32:24 +01:00
* @return Generated index
*/
2012-03-27 13:30:04 +02:00
girara_tree_node_t* zathura_document_index_generate(zathura_document_t* document, zathura_error_t* error);
2011-03-12 11:32:24 +01:00
/**
* Get list of attachments
*
* @param document The document object
2012-03-27 13:30:04 +02:00
* @param error Set to an error value (see \ref zathura_error_t) if an
2012-02-08 15:30:13 +01:00
* error occured
2011-03-12 11:32:24 +01:00
* @return List of attachments
*/
2012-03-27 13:30:04 +02:00
girara_list_t* zathura_document_attachments_get(zathura_document_t* document, zathura_error_t* error);
2011-03-12 11:32:24 +01:00
/**
* Save document attachment
2011-03-12 11:32:24 +01:00
*
2012-01-13 18:25:17 +01:00
* @param document The document objects
* @param attachment name of the attachment
* @param file the target filename
2012-03-27 13:30:04 +02:00
* @return ZATHURA_ERROR_OK when no error occured, otherwise see
* zathura_error_t
2011-03-12 11:32:24 +01:00
*/
2012-03-27 13:30:04 +02:00
zathura_error_t zathura_document_attachment_save(zathura_document_t* document, const char* attachment, const char* file);
2010-11-17 23:15:08 +01:00
2011-10-01 23:29:40 +02:00
/**
* Returns a string of the requested information
*
* @param document The zathura document
* @param meta The information field
2012-03-27 13:30:04 +02:00
* @param error Set to an error value (see \ref zathura_error_t) if an
2012-02-08 15:30:13 +01:00
* error occured
2011-10-01 23:29:40 +02:00
* @return String or NULL if information could not be retreived
*/
2012-03-27 13:30:04 +02:00
char* zathura_document_meta_get(zathura_document_t* document, zathura_document_meta_t meta, zathura_error_t* error);
2011-09-29 15:23:13 +02:00
2010-11-17 22:51:15 +01:00
#endif // DOCUMENT_H