[poppler] poppler/glib: poppler-document.cc, 1.12, 1.13 poppler-document.h, 1.8, 1.9 poppler-enums.c, 1.1, 1.2 poppler-enums.h, 1.1, 1.2 poppler-page.cc, 1.16, 1.17 poppler-page.h, 1.12, 1.13 poppler.h, 1.5, 1.6

Jonathan Blandford jrb at freedesktop.org
Tue May 3 23:32:40 PDT 2005


Update of /cvs/poppler/poppler/glib
In directory gabe:/tmp/cvs-serv30394/glib

Modified Files:
	poppler-document.cc poppler-document.h poppler-enums.c 
	poppler-enums.h poppler-page.cc poppler-page.h poppler.h 
Log Message:
Wed May  4 02:31:05 2005  Jonathan Blandford  <jrb at 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()' (-:



Index: poppler-document.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-document.cc,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- poppler-document.cc	29 Apr 2005 19:37:07 -0000	1.12
+++ poppler-document.cc	4 May 2005 06:32:38 -0000	1.13
@@ -146,26 +146,6 @@
   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 @@
 	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)
 {

Index: poppler-document.h
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-document.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- poppler-document.h	16 Apr 2005 18:57:44 -0000	1.8
+++ poppler-document.h	4 May 2005 06:32:38 -0000	1.9
@@ -64,8 +64,20 @@
   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_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,

Index: poppler-enums.c
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-enums.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- poppler-enums.c	16 Apr 2005 18:57:44 -0000	1.1
+++ poppler-enums.c	4 May 2005 06:32:38 -0000	1.2
@@ -105,6 +105,25 @@
   }
   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

Index: poppler-enums.h
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-enums.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- poppler-enums.h	16 Apr 2005 18:57:44 -0000	1.1
+++ poppler-enums.h	4 May 2005 06:32:38 -0000	1.2
@@ -19,6 +19,8 @@
 #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())

Index: poppler-page.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-page.cc,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- poppler-page.cc	21 Apr 2005 05:20:25 -0000	1.16
+++ poppler-page.cc	4 May 2005 06:32:38 -0000	1.17
@@ -636,3 +636,86 @@
 
   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);
+}

Index: poppler-page.h
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-page.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- poppler-page.h	16 Apr 2005 18:57:44 -0000	1.12
+++ poppler-page.h	4 May 2005 06:32:38 -0000	1.13
@@ -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_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 @@
 					    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__ */

Index: poppler.h
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- poppler.h	16 Apr 2005 18:57:44 -0000	1.5
+++ poppler.h	4 May 2005 06:32:38 -0000	1.6
@@ -43,11 +43,13 @@
 	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
 



More information about the poppler mailing list