Commit 40ec62ce authored by Marek Kasik's avatar Marek Kasik

glib: Add PopplerPageRange type

This type will be used for getting of suggested page ranges from
opened document if it contains PrintPageRange viewer preference.

poppler/poppler#290
parent a3394adb
......@@ -1728,6 +1728,53 @@ poppler_document_get_print_n_copies (PopplerDocument *document)
return retval;
}
/* PopplerPageRange */
POPPLER_DEFINE_BOXED_TYPE (PopplerPageRange, poppler_page_range,
poppler_page_range_copy,
poppler_page_range_free)
/**
* poppler_page_range_new:
*
* Creates a new #PopplerPageRange
*
* Returns: a new #PopplerPageRange, use poppler_page_range_free() to free it
*/
PopplerPageRange *
poppler_page_range_new (void)
{
return g_slice_new0 (PopplerPageRange);
}
/**
* poppler_page_range_copy:
* @range: a #PopplerPageRange to copy
*
* Creates a copy of @range
*
* Returns: a new allocated copy of @range
*/
PopplerPageRange *
poppler_page_range_copy (PopplerPageRange *range)
{
g_return_val_if_fail (range != nullptr, NULL);
return g_slice_dup (PopplerPageRange, range);
}
/**
* poppler_page_range_free:
* @range: a #PopplerPageRange
*
* Frees the given #PopplerPageRange
*/
void
poppler_page_range_free (PopplerPageRange *range)
{
g_slice_free (PopplerPageRange, range);
}
/**
* poppler_document_get_permissions:
* @document: A #PopplerDocument
......
......@@ -521,6 +521,30 @@ void poppler_ps_file_set_duplex (PopplerPSFile *ps_file,
POPPLER_PUBLIC
void poppler_ps_file_free (PopplerPSFile *ps_file);
/**
* PopplerPageRange:
* @start_page: first page in the range of pages
* @end_page: last page in the range of pages
*
* A #PopplerPageRange is used to specify a range of pages.
*
* Since: 0.78
*/
#define POPPLER_TYPE_PAGE_RANGE (poppler_page_range_get_type ())
struct _PopplerPageRange
{
gint start_page;
gint end_page;
};
POPPLER_PUBLIC
GType poppler_page_range_get_type (void) G_GNUC_CONST;
POPPLER_PUBLIC
PopplerPageRange *poppler_page_range_new ();
POPPLER_PUBLIC
PopplerPageRange *poppler_page_range_copy (PopplerPageRange *range);
POPPLER_PUBLIC
void poppler_page_range_free (PopplerPageRange *range);
G_END_DECLS
......
......@@ -211,6 +211,7 @@ typedef struct _PopplerQuadrilateral PopplerQuadrilateral;
typedef struct _PopplerStructureElement PopplerStructureElement;
typedef struct _PopplerStructureElementIter PopplerStructureElementIter;
typedef struct _PopplerTextSpan PopplerTextSpan;
typedef struct _PopplerPageRange PopplerPageRange;
/**
* PopplerBackend:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment