Wed May 4 02:31:05 2005 Jonathan Blandford <jrb@redhat.com>

        * glib/poppler-document.cc:
        * glib/poppler-document.h:
        * glib/poppler-enums.c: (poppler_permissions_get_type):
        * glib/poppler-enums.h:
        * glib/poppler-page.cc:
        * glib/poppler-page.h:
        * glib/poppler.h:

        Register a bunch of boxed types to test introspection, and for
        LBs.  Also, remove unused 'popper_document_save()' (-:
parent 132647f8
Wed May 4 02:31:05 2005 Jonathan Blandford <jrb@redhat.com>
* glib/poppler-document.cc:
* glib/poppler-document.h:
* glib/poppler-enums.c: (poppler_permissions_get_type):
* glib/poppler-enums.h:
* glib/poppler-page.cc:
* glib/poppler-page.h:
* glib/poppler.h:
Register a bunch of boxed types to test introspection, and for
LBs. Also, remove unused 'popper_document_save()' (-:
2005-05-01 Kristian Høgsberg <krh@redhat.com>
* poppler/CairoFontEngine.cc:
......
......@@ -146,26 +146,6 @@ poppler_document_finalize (GObject *object)
delete document->doc;
}
static gboolean
popper_document_save (PopplerDocument *document,
const char *uri,
GError **error)
{
char *filename;
gboolean retval = FALSE;
g_return_val_if_fail (POPPLER_IS_DOCUMENT (document), FALSE);
filename = g_filename_from_uri (uri, NULL, error);
if (filename != NULL) {
GooString *filename_g = new GooString (filename);
retval = document->doc->saveAs (filename_g);
}
return retval;
}
int
poppler_document_get_n_pages (PopplerDocument *document)
{
......@@ -446,6 +426,34 @@ struct _PopplerIndexIter
int index;
};
GType
poppler_index_iter_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static ("PopplerIndexIter",
(GBoxedCopyFunc) poppler_index_iter_copy,
(GBoxedFreeFunc) poppler_index_iter_free);
return our_type;
}
PopplerIndexIter *
poppler_index_iter_copy (PopplerIndexIter *iter)
{
PopplerIndexIter *new_iter;
g_return_val_if_fail (iter != NULL, NULL);
new_iter = g_new0 (PopplerIndexIter, 1);
*new_iter = *iter;
new_iter->document = (PopplerDocument *) g_object_ref (new_iter->document);
return new_iter;
}
PopplerIndexIter *
poppler_index_iter_new (PopplerDocument *document)
{
......
......@@ -64,8 +64,20 @@ typedef enum /*< flags >*/
POPPLER_VIEWER_PREFERENCES_DIRECTION_RTL = 1 << 6,
} PopplerViewerPreferences;
typedef enum /*< flags >*/
{
POPPLER_PERMISSIONS_PRINT = 1 << 0,
POPPLER_PERMISSIONS_MODIFY = 1 << 1,
POPPLER_PERMISSIONS_COPY = 1 << 2,
POPPLER_PERMISSIONS_EXTRACT_TEXT = 1 << 3,
POPPLER_PERMISSIONS_ANNOTATIONS_AND_FORMS = 1 << 4,
POPPLER_PERMISSIONS_FORMS = 1 << 5,
POPPLER_PERMISSIONS_PRINT_LOW_QUALITY = 1 << 6,
} PopplerPermissions;
GType poppler_document_get_type (void) G_GNUC_CONST;
PopplerDocument *poppler_document_new_from_file (const char *uri,
const char *password,
GError **error);
......@@ -78,14 +90,16 @@ PopplerPage *poppler_document_get_page (PopplerDocument *document,
PopplerPage *poppler_document_get_page_by_label (PopplerDocument *document,
const char *label);
GType poppler_document_get_type (void) G_GNUC_CONST;
/* Interface for getting the Index of a poppler_document */
GType poppler_index_iter_get_type (void) G_GNUC_CONST;
PopplerIndexIter *poppler_index_iter_new (PopplerDocument *document);
PopplerIndexIter *poppler_index_iter_copy (PopplerIndexIter *iter);
void poppler_index_iter_free (PopplerIndexIter *iter);
PopplerIndexIter *poppler_index_iter_get_child (PopplerIndexIter *parent);
PopplerAction *poppler_index_iter_get_action (PopplerIndexIter *iter);
gboolean poppler_index_iter_next (PopplerIndexIter *iter);
void poppler_index_iter_free (PopplerIndexIter *iter);
/* Export to ps */
PopplerPSFile *poppler_ps_file_new (PopplerDocument *document,
......
......@@ -105,6 +105,25 @@ poppler_viewer_preferences_get_type (void)
}
return etype;
}
GType
poppler_permissions_get_type (void)
{
static GType etype = 0;
if (etype == 0) {
static const GFlagsValue values[] = {
{ POPPLER_PERMISSIONS_PRINT, "POPPLER_PERMISSIONS_PRINT", "print" },
{ POPPLER_PERMISSIONS_MODIFY, "POPPLER_PERMISSIONS_MODIFY", "modify" },
{ POPPLER_PERMISSIONS_COPY, "POPPLER_PERMISSIONS_COPY", "copy" },
{ POPPLER_PERMISSIONS_EXTRACT_TEXT, "POPPLER_PERMISSIONS_EXTRACT_TEXT", "extract-text" },
{ POPPLER_PERMISSIONS_ANNOTATIONS_AND_FORMS, "POPPLER_PERMISSIONS_ANNOTATIONS_AND_FORMS", "annotations-and-forms" },
{ POPPLER_PERMISSIONS_FORMS, "POPPLER_PERMISSIONS_FORMS", "forms" },
{ POPPLER_PERMISSIONS_PRINT_LOW_QUALITY, "POPPLER_PERMISSIONS_PRINT_LOW_QUALITY", "print-low-quality" },
{ 0, NULL, NULL }
};
etype = g_flags_register_static ("PopplerPermissions", values);
}
return etype;
}
/* enumerations from "poppler.h" */
GType
......
......@@ -19,6 +19,8 @@ GType poppler_page_mode_get_type (void) G_GNUC_CONST;
#define POPPLER_TYPE_PAGE_MODE (poppler_page_mode_get_type())
GType poppler_viewer_preferences_get_type (void) G_GNUC_CONST;
#define POPPLER_TYPE_VIEWER_PREFERENCES (poppler_viewer_preferences_get_type())
GType poppler_permissions_get_type (void) G_GNUC_CONST;
#define POPPLER_TYPE_PERMISSIONS (poppler_permissions_get_type())
/* enumerations from "poppler.h" */
GType poppler_error_get_type (void) G_GNUC_CONST;
#define POPPLER_TYPE_ERROR (poppler_error_get_type())
......
......@@ -636,3 +636,86 @@ poppler_page_set_orientation (PopplerPage *page,
page->orientation = orientation;
}
/* PopplerRectangle type */
GType
poppler_rectangle_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static ("PopplerRectangle",
(GBoxedCopyFunc) poppler_rectangle_copy,
(GBoxedFreeFunc) poppler_rectangle_free);
return our_type;
}
PopplerRectangle *
poppler_rectangle_new (void)
{
return g_new0 (PopplerRectangle, 1);
}
PopplerRectangle *
poppler_rectangle_copy (PopplerRectangle *rectangle)
{
PopplerRectangle *new_rectangle;
g_return_val_if_fail (rectangle != NULL, NULL);
new_rectangle = g_new0 (PopplerRectangle, 1);
*new_rectangle = *rectangle;
return new_rectangle;
}
void
poppler_rectangle_free (PopplerRectangle *rectangle)
{
g_free (rectangle);
}
/* PopplerLinkMapping type */
GType
poppler_link_mapping_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static ("PopplerLinkMapping",
(GBoxedCopyFunc) poppler_link_mapping_copy,
(GBoxedFreeFunc) poppler_link_mapping_free);
return our_type;
}
PopplerLinkMapping *
poppler_link_mapping_new (void)
{
return (PopplerLinkMapping *) g_new0 (PopplerLinkMapping, 1);
}
PopplerLinkMapping *
poppler_link_mapping_copy (PopplerLinkMapping *mapping)
{
PopplerLinkMapping *new_mapping;
new_mapping = poppler_link_mapping_new ();
*new_mapping = *mapping;
if (new_mapping->action)
new_mapping->action = poppler_action_copy (new_mapping->action);
return new_mapping;
}
void
poppler_link_mapping_free (PopplerLinkMapping *mapping)
{
if (mapping)
poppler_action_free (mapping->action);
g_free (mapping);
}
......@@ -26,6 +26,7 @@
G_BEGIN_DECLS
#define POPPLER_TYPE_PAGE (poppler_page_get_type ())
#define POPPLER_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), POPPLER_TYPE_PAGE, PopplerPage))
#define POPPLER_IS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), POPPLER_TYPE_PAGE))
......@@ -44,7 +45,7 @@ void poppler_page_render_to_pixbuf (PopplerPage *page,
void poppler_page_get_size (PopplerPage *page,
double *width,
double *height);
void poppler_page_set_orientation (PopplerPage *page,
void poppler_page_set_orientation (PopplerPage *page,
PopplerOrientation orientation);
int poppler_page_get_index (PopplerPage *page);
GdkPixbuf *poppler_page_get_thumbnail (PopplerPage *page);
......@@ -53,31 +54,44 @@ gboolean poppler_page_get_thumbnail_size (PopplerPage *page,
int *height);
GList *poppler_page_find_text (PopplerPage *page,
const char *text);
void poppler_page_render_to_ps (PopplerPage *page,
void poppler_page_render_to_ps (PopplerPage *page,
PopplerPSFile *ps_file);
char *poppler_page_get_text (PopplerPage *page,
PopplerRectangle *rect);
GList *poppler_page_get_link_mapping (PopplerPage *page);
void poppler_page_free_link_mapping (GList *list);
/* A rectangle on a page, with coordinates in PDF points. */
typedef struct
#define POPPLER_TYPE_RECTANGLE (poppler_rectangle_get_type ())
struct _PopplerRectangle
{
gdouble x1;
gdouble y1;
gdouble x2;
gdouble y2;
} PopplerRectangle;
};
GType poppler_rectangle_get_type (void) G_GNUC_CONST;
PopplerRectangle *poppler_rectangle_new (void);
PopplerRectangle *poppler_rectangle_copy (PopplerRectangle *rectangle);
void poppler_rectangle_free (PopplerRectangle *rectangle);
char *poppler_page_get_text (PopplerPage *page,
PopplerRectangle *rect);
/* Mapping between areas on the current page and PopplerActions */
typedef struct
#define POPPLER_TYPE_LINK_MAPPING (poppler_link_mapping_get_type ())
struct _PopplerLinkMapping
{
PopplerRectangle area;
PopplerAction *action;
} PopplerLinkMapping;
};
GList *poppler_page_get_link_mapping (PopplerPage *page);
void poppler_page_free_link_mapping (GList *list);
GType poppler_link_mapping_get_type (void) G_GNUC_CONST;
PopplerLinkMapping *poppler_link_mapping_new (void);
PopplerLinkMapping *poppler_link_mapping_copy (PopplerLinkMapping *mapping);
void poppler_link_mapping_free (PopplerLinkMapping *mapping);
G_END_DECLS
#endif /* __POPPLER_GLIB_H__ */
#endif /* __POPPLER_PAGE_H__ */
......@@ -43,11 +43,13 @@ typedef enum
POPPLER_ORIENTATION_SEASCAPE
} PopplerOrientation;
typedef struct _PopplerDocument PopplerDocument;
typedef struct _PopplerIndexIter PopplerIndexIter;
typedef struct _PopplerPage PopplerPage;
typedef struct _PopplerPSFile PopplerPSFile;
typedef union _PopplerAction PopplerAction;
typedef struct _PopplerDocument PopplerDocument;
typedef struct _PopplerIndexIter PopplerIndexIter;
typedef struct _PopplerRectangle PopplerRectangle;
typedef struct _PopplerLinkMapping PopplerLinkMapping;
typedef struct _PopplerPage PopplerPage;
typedef struct _PopplerPSFile PopplerPSFile;
typedef union _PopplerAction PopplerAction;
G_END_DECLS
......
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