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>
|
2010-12-27 09:07:17 +01:00
|
|
|
#include <gtk/gtk.h>
|
2010-11-17 22:51:15 +01:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2011-10-23 17:01:15 +02:00
|
|
|
#include <girara/types.h>
|
2011-04-18 18:19:41 +02:00
|
|
|
#include "zathura.h"
|
2012-02-25 15:21:00 +01:00
|
|
|
#include "version.h"
|
2010-12-24 16:21:54 +01:00
|
|
|
|
2011-03-05 21:00:41 +01:00
|
|
|
#define PLUGIN_REGISTER_FUNCTION "plugin_register"
|
2012-02-25 15:21:00 +01:00
|
|
|
#define PLUGIN_API_VERSION_FUNCTION "plugin_api_version"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register a plugin.
|
|
|
|
*
|
|
|
|
* @param plugin_name the name of the plugin
|
|
|
|
* @param major the plugin's major version
|
|
|
|
* @param minor the plugin's minor version
|
|
|
|
* @param rev the plugin's revision
|
|
|
|
* @param plugin_open_function the plugin's open function
|
|
|
|
* @param mimetypes a char array of mime types supported by the plugin
|
|
|
|
*/
|
|
|
|
#define PLUGIN_REGISTER(plugin_name, major, minor, rev, plugin_open_function, mimetypes) \
|
|
|
|
unsigned int plugin_version_major() { return major; } \
|
|
|
|
unsigned int plugin_version_minor() { return minor; } \
|
|
|
|
unsigned int plugin_version_revision() { return rev; } \
|
|
|
|
unsigned int plugin_api_version() { return ZATHURA_API_VERSION; } \
|
|
|
|
\
|
|
|
|
void plugin_register(zathura_document_plugin_t* plugin) \
|
|
|
|
{ \
|
|
|
|
if (plugin == NULL) { \
|
|
|
|
return; \
|
|
|
|
} \
|
|
|
|
plugin->open_function = (plugin_open_function); \
|
|
|
|
static const char* mime_types[] = mimetypes; \
|
|
|
|
for (size_t s = 0; s != sizeof(mime_types) / sizeof(const char*); ++s) { \
|
|
|
|
girara_list_append(plugin->content_types, g_content_type_from_mime_type(mime_types[s])); \
|
|
|
|
} \
|
|
|
|
} \
|
2011-03-05 21:00:41 +01:00
|
|
|
|
2012-03-09 09:53:03 +01:00
|
|
|
#define PLUGIN_MIMETYPES(...) __VA_ARGS__
|
|
|
|
|
2012-02-07 21:01:54 +01:00
|
|
|
/**
|
|
|
|
* Error types for plugins
|
|
|
|
*/
|
|
|
|
typedef enum zathura_plugin_error_e
|
|
|
|
{
|
|
|
|
ZATHURA_PLUGIN_ERROR_OK, /**< No error occured */
|
|
|
|
ZATHURA_PLUGIN_ERROR_UNKNOWN, /**< An unknown error occured */
|
|
|
|
ZATHURA_PLUGIN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
|
|
|
|
ZATHURA_PLUGIN_ERROR_NOT_IMPLEMENTED, /**< The called function has not been implemented */
|
|
|
|
ZATHURA_PLUGIN_ERROR_INVALID_ARGUMENTS, /**< Invalid arguments have been passed */
|
|
|
|
ZATHURA_PLUGIN_ERROR_INVALID_PASSWORD /**< The provided password is invalid */
|
|
|
|
} zathura_plugin_error_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Document open function
|
|
|
|
*
|
|
|
|
* @param document The document
|
|
|
|
* @return true if no error occured otherwise false
|
|
|
|
*/
|
|
|
|
typedef zathura_plugin_error_t (*zathura_document_open_t)(zathura_document_t* document);
|
2010-11-18 02:35:33 +01:00
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Document plugin structure
|
|
|
|
*/
|
2010-11-18 02:35:33 +01:00
|
|
|
typedef struct zathura_document_plugin_s
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
girara_list_t* content_types; /**< List of supported content types */
|
|
|
|
zathura_document_open_t open_function; /**< Document open function */
|
|
|
|
void* handle; /**< DLL handle */
|
2010-11-18 02:35:33 +01:00
|
|
|
} zathura_document_plugin_t;
|
|
|
|
|
2012-02-07 20:13:39 +01:00
|
|
|
/**
|
|
|
|
* Plugin mapping
|
|
|
|
*/
|
2011-09-29 15:23:13 +02:00
|
|
|
typedef struct zathura_type_plugin_mapping_s
|
|
|
|
{
|
2012-02-07 20:13:39 +01:00
|
|
|
const gchar* type; /**< Plugin type */
|
|
|
|
zathura_document_plugin_t* plugin; /**< Mapped plugin */
|
2011-09-29 15:23:13 +02:00
|
|
|
} zathura_type_plugin_mapping_t;
|
|
|
|
|
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;
|
|
|
|
|
2012-02-08 23:21:27 +01:00
|
|
|
typedef struct zathura_password_dialog_info_s
|
|
|
|
{
|
|
|
|
char* path; /**< Path to the file */
|
|
|
|
zathura_t* zathura; /**< Zathura session */
|
|
|
|
} zathura_password_dialog_info_t;
|
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Function prototype that is called to register a document plugin
|
|
|
|
*
|
|
|
|
* @param The document plugin
|
|
|
|
*/
|
2011-03-06 09:14:36 +01:00
|
|
|
typedef void (*zathura_plugin_register_service_t)(zathura_document_plugin_t*);
|
2011-03-05 21:00:41 +01:00
|
|
|
|
2012-02-25 15:21:00 +01:00
|
|
|
/**
|
|
|
|
* Function prototype that is called to get the plugin's API version.
|
|
|
|
*
|
|
|
|
* @return plugin's API version
|
|
|
|
*/
|
|
|
|
typedef unsigned int (*zathura_plugin_api_version_t)();
|
|
|
|
|
2011-03-18 13:27:21 +01:00
|
|
|
/**
|
|
|
|
* Image buffer
|
|
|
|
*/
|
|
|
|
typedef struct zathura_image_buffer_s
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
unsigned char* data; /**< Image buffer data */
|
|
|
|
unsigned int height; /**< Height of the image */
|
|
|
|
unsigned int width; /**< Width of the image */
|
|
|
|
unsigned int rowstride; /**< Rowstride of the image */
|
2011-03-18 13:27:21 +01:00
|
|
|
} zathura_image_buffer_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates an image buffer
|
|
|
|
*
|
|
|
|
* @param width Width of the image stored in the buffer
|
|
|
|
* @param height Height of the image stored in the buffer
|
|
|
|
* @return Image buffer or NULL if an error occured
|
|
|
|
*/
|
|
|
|
zathura_image_buffer_t* zathura_image_buffer_create(unsigned int width, unsigned int height);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Frees the image buffer
|
|
|
|
*
|
2012-02-08 15:30:13 +01:00
|
|
|
* @param buffer The image buffer
|
2011-03-18 13:27:21 +01:00
|
|
|
*/
|
2012-02-08 15:30:13 +01:00
|
|
|
void zathura_image_buffer_free(zathura_image_buffer_t* buffer);
|
2011-03-18 13:27:21 +01:00
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
2012-02-07 21:45:32 +01:00
|
|
|
* Rectangle structure.
|
|
|
|
* The coordinate system has its origin in the left upper corner. The x axes
|
|
|
|
* goes to the right, the y access goes down.
|
2011-03-12 11:32:24 +01:00
|
|
|
*/
|
2010-11-17 22:51:15 +01:00
|
|
|
typedef struct zathura_rectangle_s
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
double x1; /**< X coordinate of point 1 */
|
|
|
|
double y1; /**< Y coordinate of point 1 */
|
|
|
|
double x2; /**< X coordinate of point 2 */
|
|
|
|
double y2; /**< Y coordinate of point 2 */
|
2010-11-17 22:51:15 +01:00
|
|
|
} zathura_rectangle_t;
|
|
|
|
|
2012-01-22 22:00:40 +01:00
|
|
|
/**
|
|
|
|
* Image structure
|
|
|
|
*/
|
|
|
|
typedef struct zathura_image_s
|
|
|
|
{
|
|
|
|
zathura_rectangle_t position; /**< Coordinates of the image */
|
|
|
|
void* data; /**< Custom data of the plugin */
|
|
|
|
} zathura_image_t;
|
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Possible link types
|
|
|
|
*/
|
2010-11-17 22:51:15 +01:00
|
|
|
typedef enum zathura_link_type_e
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
ZATHURA_LINK_TO_PAGE, /**< Links to a page */
|
|
|
|
ZATHURA_LINK_EXTERNAL, /**< Links to an external source */
|
2010-11-17 22:51:15 +01:00
|
|
|
} zathura_link_type_t;
|
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Link
|
|
|
|
*/
|
2010-11-17 22:51:15 +01:00
|
|
|
typedef struct zathura_link_s
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
zathura_rectangle_t position; /**< Position of the link */
|
|
|
|
zathura_link_type_t type; /**< Link type */
|
2010-11-17 22:51:15 +01:00
|
|
|
union
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
unsigned int page_number; /**< Page number */
|
|
|
|
char* value; /**< Value */
|
2010-11-17 22:51:15 +01:00
|
|
|
} target;
|
|
|
|
} zathura_link_t;
|
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Index element
|
|
|
|
*/
|
2010-12-25 00:47:52 +01:00
|
|
|
typedef struct zathura_index_element_s
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
char* title; /**< Title of the element */
|
|
|
|
zathura_link_type_t type; /**< Type */
|
2010-12-25 00:47:52 +01:00
|
|
|
union
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
unsigned int page_number; /**< Page number */
|
|
|
|
char* uri; /**< Uri */
|
2010-12-25 00:47:52 +01:00
|
|
|
} target;
|
|
|
|
} zathura_index_element_t;
|
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Form type
|
|
|
|
*/
|
2010-11-17 22:51:15 +01:00
|
|
|
typedef enum zathura_form_type_e
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
ZATHURA_FORM_CHECKBOX, /**< Checkbox */
|
|
|
|
ZATHURA_FORM_TEXTFIELD /**< Textfield */
|
2010-11-17 22:51:15 +01:00
|
|
|
} zathura_form_type_t;
|
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Form element
|
|
|
|
*/
|
2010-11-17 22:51:15 +01:00
|
|
|
typedef struct zathura_form_s
|
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
zathura_rectangle_t position; /**< Position */
|
|
|
|
zathura_form_type_t type; /**< Type */
|
2010-11-17 22:51:15 +01:00
|
|
|
} zathura_form_t;
|
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Page
|
|
|
|
*/
|
2011-04-18 18:19:41 +02:00
|
|
|
struct zathura_page_s
|
2010-11-17 22:51:15 +01:00
|
|
|
{
|
2012-01-22 21:57:18 +01:00
|
|
|
double height; /**< Page height */
|
|
|
|
double width; /**< Page width */
|
|
|
|
unsigned int number; /**< Page number */
|
|
|
|
zathura_document_t* document; /**< Document */
|
|
|
|
void* data; /**< Custom data */
|
|
|
|
bool visible; /**< Page is visible */
|
|
|
|
GtkWidget* drawing_area; /**< Drawing area */
|
2011-04-18 18:19:41 +02:00
|
|
|
};
|
2010-11-17 22:51:15 +01:00
|
|
|
|
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 */
|
|
|
|
int rotate; /**< Rotation */
|
|
|
|
void* data; /**< Custom data */
|
2011-04-19 17:46:44 +02:00
|
|
|
zathura_t* zathura; /** Zathura object */
|
2012-02-09 01:46:51 +01:00
|
|
|
int adjust_mode; /**< Adjust mode (best-fit, width) */
|
2010-11-17 22:51:15 +01:00
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Frees the document
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
zathura_plugin_error_t (*document_free)(zathura_document_t* document);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Generates the document index
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
girara_tree_node_t* (*document_index_generate)(zathura_document_t* document, zathura_plugin_error_t* error);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Save the document
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
zathura_plugin_error_t (*document_save_as)(zathura_document_t* document, const char* path);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get list of attachments
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
girara_list_t* (*document_attachments_get)(zathura_document_t* document, zathura_plugin_error_t* error);
|
2010-11-18 02:35:33 +01:00
|
|
|
|
2012-01-13 18:25:17 +01:00
|
|
|
/**
|
|
|
|
* Save attachment to a file
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
zathura_plugin_error_t (*document_attachment_save)(zathura_document_t* document, const char* attachment, const char* file);
|
2012-01-13 18:25:17 +01:00
|
|
|
|
2011-10-01 23:29:40 +02:00
|
|
|
/**
|
|
|
|
* Get document information
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
char* (*document_meta_get)(zathura_document_t* document, zathura_document_meta_t info, zathura_plugin_error_t* error);
|
2011-10-01 23:29:40 +02:00
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Gets the page object
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
zathura_page_t* (*page_get)(zathura_document_t* document, unsigned int page_id, zathura_plugin_error_t* error);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Search text
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
girara_list_t* (*page_search_text)(zathura_page_t* page, const char* text, zathura_plugin_error_t* error);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get links on a page
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
girara_list_t* (*page_links_get)(zathura_page_t* page, zathura_plugin_error_t* error);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get form fields
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
girara_list_t* (*page_form_fields_get)(zathura_page_t* page, zathura_plugin_error_t* error);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
2012-01-22 22:00:40 +01:00
|
|
|
/**
|
|
|
|
* Get list of images
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
girara_list_t* (*page_images_get)(zathura_page_t* page, zathura_plugin_error_t* error);
|
2012-01-22 22:00:40 +01:00
|
|
|
|
|
|
|
/**
|
2012-02-11 17:53:28 +01:00
|
|
|
* Get the image
|
2012-01-22 22:00:40 +01:00
|
|
|
*/
|
2012-02-11 17:53:28 +01:00
|
|
|
cairo_surface_t* (*page_image_get_cairo)(zathura_page_t* page, zathura_image_t* image, zathura_plugin_error_t* error);
|
2012-01-22 22:00:40 +01:00
|
|
|
|
2012-02-08 23:20:22 +01:00
|
|
|
/**
|
|
|
|
* Get text for selection
|
|
|
|
*/
|
|
|
|
char* (*page_get_text)(zathura_page_t* page, zathura_rectangle_t rectangle, zathura_plugin_error_t* error);
|
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Renders the page
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
zathura_image_buffer_t* (*page_render)(zathura_page_t* page, zathura_plugin_error_t* error);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
2011-09-29 12:07:07 +02:00
|
|
|
/**
|
|
|
|
* Renders the page
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
zathura_plugin_error_t (*page_render_cairo)(zathura_page_t* page, cairo_t* cairo, bool printing);
|
2011-09-29 12:07:07 +02:00
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Free page
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
zathura_plugin_error_t (*page_free)(zathura_page_t* page);
|
2010-11-17 22:51:15 +01:00
|
|
|
} functions;
|
2010-12-28 00:47:41 +01:00
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Document pages
|
|
|
|
*/
|
2010-12-28 00:47:41 +01:00
|
|
|
zathura_page_t** pages;
|
2010-11-17 22:51:15 +01:00
|
|
|
};
|
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Load all document plugins
|
2011-04-18 18:19:41 +02:00
|
|
|
*
|
|
|
|
* @param zathura the zathura session
|
2011-03-12 11:32:24 +01:00
|
|
|
*/
|
2011-04-18 18:19:41 +02:00
|
|
|
void zathura_document_plugins_load(zathura_t* zathura);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
|
|
|
/**
|
2011-09-29 15:23:13 +02:00
|
|
|
* Free a document plugin
|
2011-04-18 18:19:41 +02:00
|
|
|
*
|
2011-09-29 15:23:13 +02:00
|
|
|
* @param plugin The plugin
|
2011-03-12 11:32:24 +01:00
|
|
|
*/
|
2011-09-29 15:23:13 +02:00
|
|
|
void zathura_document_plugin_free(zathura_document_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-02-08 15:30:13 +01:00
|
|
|
* @return ZATHURA_PLUGIN_ERROR_OK when no error occured, otherwise see
|
|
|
|
* zathura_plugin_error_t
|
2011-03-12 11:32:24 +01:00
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
zathura_plugin_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-02-08 15:30:13 +01:00
|
|
|
* @return ZATHURA_PLUGIN_ERROR_OK when no error occured, otherwise see
|
|
|
|
* zathura_plugin_error_t
|
2011-03-12 11:32:24 +01:00
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
zathura_plugin_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-02-08 15:30:13 +01:00
|
|
|
* @param error Set to an error value (see \ref zathura_plugin_error_t) if an
|
|
|
|
* error occured
|
2011-03-12 11:32:24 +01:00
|
|
|
* @return Generated index
|
|
|
|
*/
|
|
|
|
|
2012-02-07 21:01:54 +01:00
|
|
|
girara_tree_node_t* zathura_document_index_generate(zathura_document_t* document, zathura_plugin_error_t* error);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get list of attachments
|
|
|
|
*
|
|
|
|
* @param document The document object
|
2012-02-08 15:30:13 +01:00
|
|
|
* @param error Set to an error value (see \ref zathura_plugin_error_t) if an
|
|
|
|
* error occured
|
2011-03-12 11:32:24 +01:00
|
|
|
* @return List of attachments
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
girara_list_t* zathura_document_attachments_get(zathura_document_t* document, zathura_plugin_error_t* error);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
|
|
|
/**
|
2012-01-22 22:00:40 +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-02-08 15:30:13 +01:00
|
|
|
* @return ZATHURA_PLUGIN_ERROR_OK when no error occured, otherwise see
|
|
|
|
* zathura_plugin_error_t
|
2011-03-12 11:32:24 +01:00
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
zathura_plugin_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-02-08 15:30:13 +01:00
|
|
|
* @param error Set to an error value (see \ref zathura_plugin_error_t) if an
|
|
|
|
* error occured
|
2011-10-01 23:29:40 +02:00
|
|
|
* @return String or NULL if information could not be retreived
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
char* zathura_document_meta_get(zathura_document_t* document, zathura_document_meta_t meta, zathura_plugin_error_t* error);
|
2011-10-01 23:29:40 +02:00
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Get the page object
|
|
|
|
*
|
|
|
|
* @param document The document
|
|
|
|
* @param page_id Page number
|
2012-02-08 15:30:13 +01:00
|
|
|
* @param error Set to an error value (see \ref zathura_plugin_error_t) if an
|
|
|
|
* error occured
|
2011-03-12 11:32:24 +01:00
|
|
|
* @return Page object or NULL if an error occured
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
zathura_page_t* zathura_page_get(zathura_document_t* document, unsigned int page_id, zathura_plugin_error_t* error);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Frees the page object
|
|
|
|
*
|
|
|
|
* @param page The page object
|
2012-02-08 15:30:13 +01:00
|
|
|
* @return ZATHURA_PLUGIN_ERROR_OK when no error occured, otherwise see
|
|
|
|
* zathura_plugin_error_t
|
2011-03-12 11:32:24 +01:00
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
zathura_plugin_error_t zathura_page_free(zathura_page_t* page);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Search page
|
|
|
|
*
|
|
|
|
* @param page The page object
|
|
|
|
* @param text Search item
|
2012-02-08 15:30:13 +01:00
|
|
|
* @param error Set to an error value (see \ref zathura_plugin_error_t) if an
|
|
|
|
* error occured
|
2011-03-12 11:32:24 +01:00
|
|
|
* @return List of results
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
girara_list_t* zathura_page_search_text(zathura_page_t* page, const char* text, zathura_plugin_error_t* error);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get page links
|
|
|
|
*
|
|
|
|
* @param page The page object
|
2012-02-08 15:30:13 +01:00
|
|
|
* @param error Set to an error value (see \ref zathura_plugin_error_t) if an
|
|
|
|
* error occured
|
2011-03-12 11:32:24 +01:00
|
|
|
* @return List of links
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
girara_list_t* zathura_page_links_get(zathura_page_t* page, zathura_plugin_error_t* error);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Free page links
|
|
|
|
*
|
|
|
|
* @param list List of links
|
2012-02-08 15:30:13 +01:00
|
|
|
* @return ZATHURA_PLUGIN_ERROR_OK when no error occured, otherwise see
|
|
|
|
* zathura_plugin_error_t
|
2011-03-12 11:32:24 +01:00
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
zathura_plugin_error_t zathura_page_links_free(girara_list_t* list);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get list of form fields
|
|
|
|
*
|
|
|
|
* @param page The page object
|
2012-02-08 15:30:13 +01:00
|
|
|
* @param error Set to an error value (see \ref zathura_plugin_error_t) if an
|
|
|
|
* error occured
|
2011-03-12 11:32:24 +01:00
|
|
|
* @return List of form fields
|
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
girara_list_t* zathura_page_form_fields_get(zathura_page_t* page, zathura_plugin_error_t* error);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Free list of form fields
|
|
|
|
*
|
|
|
|
* @param list List of form fields
|
2012-02-08 15:30:13 +01:00
|
|
|
* @return ZATHURA_PLUGIN_ERROR_OK when no error occured, otherwise see
|
|
|
|
* zathura_plugin_error_t
|
2011-03-12 11:32:24 +01:00
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
zathura_plugin_error_t zathura_page_form_fields_free(girara_list_t* list);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
2012-01-22 22:00:40 +01:00
|
|
|
/**
|
|
|
|
* Get list of images
|
|
|
|
*
|
|
|
|
* @param page Page
|
2012-02-08 15:30:13 +01:00
|
|
|
* @param error Set to an error value (see \ref zathura_plugin_error_t) if an
|
|
|
|
* error occured
|
2012-02-08 23:21:27 +01:00
|
|
|
* @return List of images or NULL if an error occured
|
2012-01-22 22:00:40 +01:00
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
girara_list_t* zathura_page_images_get(zathura_page_t* page, zathura_plugin_error_t* error);
|
2012-01-22 22:00:40 +01:00
|
|
|
|
|
|
|
/**
|
2012-02-11 17:53:28 +01:00
|
|
|
* Get image
|
2012-01-22 22:00:40 +01:00
|
|
|
*
|
|
|
|
* @param page Page
|
2012-02-11 17:53:28 +01:00
|
|
|
* @param image Image identifier
|
|
|
|
* @param error Set to an error value (see \ref zathura_plugin_error_t) if an
|
|
|
|
* error occured
|
|
|
|
* @return The cairo image surface or NULL if an error occured
|
2012-01-22 22:00:40 +01:00
|
|
|
*/
|
2012-02-11 17:53:28 +01:00
|
|
|
cairo_surface_t* zathura_page_image_get_cairo(zathura_page_t* page, zathura_image_t* image, zathura_plugin_error_t* error);
|
2012-01-22 22:00:40 +01:00
|
|
|
|
2012-02-08 23:20:22 +01:00
|
|
|
/**
|
|
|
|
* Get text for selection
|
|
|
|
* @param page Page
|
|
|
|
* @param rectangle Selection
|
2012-02-09 02:58:53 +01:00
|
|
|
* @param error Set to an error value (see \ref zathura_plugin_error_t) if an error
|
2012-02-08 23:20:22 +01:00
|
|
|
* occured
|
|
|
|
* @return The selected text (needs to be deallocated with g_free)
|
|
|
|
*/
|
|
|
|
char* zathura_page_get_text(zathura_page_t* page, zathura_rectangle_t rectangle, zathura_plugin_error_t* error);
|
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Render page
|
|
|
|
*
|
|
|
|
* @param page The page object
|
2011-09-29 12:35:52 +02:00
|
|
|
* @param cairo Cairo object
|
2012-02-07 15:10:58 +01:00
|
|
|
* @param printing render for printing
|
2012-02-08 15:30:13 +01:00
|
|
|
* @return ZATHURA_PLUGIN_ERROR_OK when no error occured, otherwise see
|
|
|
|
* zathura_plugin_error_t
|
2011-03-12 11:32:24 +01:00
|
|
|
*/
|
2012-02-07 21:01:54 +01:00
|
|
|
zathura_plugin_error_t zathura_page_render(zathura_page_t* page, cairo_t* cairo, bool printing);
|
2010-11-17 22:51:15 +01:00
|
|
|
|
2011-03-12 11:32:24 +01:00
|
|
|
/**
|
|
|
|
* Create new index element
|
|
|
|
*
|
|
|
|
* @param title Title of the index element
|
|
|
|
* @return Index element
|
|
|
|
*/
|
2010-12-25 00:47:52 +01:00
|
|
|
zathura_index_element_t* zathura_index_element_new(const char* title);
|
2011-03-12 11:32:24 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Free index element
|
|
|
|
*
|
|
|
|
* @param index The index element
|
|
|
|
*/
|
2010-12-25 00:47:52 +01:00
|
|
|
void zathura_index_element_free(zathura_index_element_t* index);
|
|
|
|
|
2012-02-07 17:44:19 +01:00
|
|
|
/**
|
|
|
|
* Free link
|
|
|
|
*
|
|
|
|
* @param link The link
|
|
|
|
*/
|
|
|
|
void zathura_link_free(zathura_link_t* link);
|
|
|
|
|
2011-09-29 15:23:13 +02:00
|
|
|
/**
|
|
|
|
* Add type -> plugin mapping
|
|
|
|
* @param zathura zathura instance
|
|
|
|
* @param type content type
|
|
|
|
* @param plugin plugin instance
|
|
|
|
* @return true on success, false if another plugin is already registered for
|
|
|
|
* that type
|
|
|
|
*/
|
|
|
|
bool zathura_type_plugin_mapping_new(zathura_t* zathura, const gchar* type, zathura_document_plugin_t* plugin);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Free type -> plugin mapping
|
|
|
|
* @param mapping To be freed
|
|
|
|
*/
|
|
|
|
void zathura_type_plugin_mapping_free(zathura_type_plugin_mapping_t* mapping);
|
|
|
|
|
2010-11-17 22:51:15 +01:00
|
|
|
#endif // DOCUMENT_H
|