[poppler] poppler/glib: poppler-document.cc, 1.15, 1.16 poppler-document.h, 1.10, 1.11

Jonathan Blandford jrb at freedesktop.org
Sun May 22 21:23:55 PDT 2005


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

Modified Files:
	poppler-document.cc poppler-document.h 
Log Message:
Mon May 23 00:22:41 2005  Jonathan Blandford  <jrb at redhat.com>

        * glib/poppler-document.h: Add a permissions flag to the glib
        bindings.




Index: poppler-document.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-document.cc,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- poppler-document.cc	21 May 2005 21:33:07 -0000	1.15
+++ poppler-document.cc	23 May 2005 04:23:53 -0000	1.16
@@ -41,6 +41,7 @@
 	PROP_PAGE_LAYOUT,
 	PROP_PAGE_MODE,
 	PROP_VIEWER_PREFERENCES,
+	PROP_PERMISSIONS,
 };
 
 typedef struct _PopplerDocumentClass PopplerDocumentClass;
@@ -274,6 +275,7 @@
   Object obj;
   Catalog *catalog;
   gchar *str;
+  guint flag;
 
   switch (prop_id)
     {
@@ -323,6 +325,18 @@
       /* FIXME: write... */
       g_value_set_flags (value, POPPLER_VIEWER_PREFERENCES_UNSET);
       break;
+    case PROP_PERMISSIONS:
+      flag = 0;
+      if (document->doc->okToPrint ())
+	flag |= POPPLER_PERMISSIONS_OK_TO_PRINT;
+      if (document->doc->okToChange ())
+	flag |= POPPLER_PERMISSIONS_OK_TO_MODIFY;
+      if (document->doc->okToCopy ())
+	flag |= POPPLER_PERMISSIONS_OK_TO_COPY;
+      if (document->doc->okToAddNotes ())
+	flag |= POPPLER_PERMISSIONS_OK_TO_ADD_NOTES;
+      g_value_set_flags (value, flag);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -410,6 +424,16 @@
 			       POPPLER_TYPE_VIEWER_PREFERENCES,
 			       POPPLER_VIEWER_PREFERENCES_UNSET,
 			       G_PARAM_READABLE));
+
+  g_object_class_install_property
+	  (G_OBJECT_CLASS (klass),
+	   PROP_PERMISSIONS,
+	   g_param_spec_flags ("permissions",
+			       "Permissions",
+			       "Permissions",
+			       POPPLER_TYPE_PERMISSIONS,
+			       POPPLER_PERMISSIONS_FULL,
+			       G_PARAM_READABLE));
 }
 
 static void

Index: poppler-document.h
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-document.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- poppler-document.h	18 May 2005 17:39:59 -0000	1.10
+++ poppler-document.h	23 May 2005 04:23:53 -0000	1.11
@@ -66,13 +66,15 @@
 
 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,
+  POPPLER_PERMISSIONS_OK_TO_PRINT = 1 << 0,
+  POPPLER_PERMISSIONS_OK_TO_MODIFY = 1 << 1,
+  POPPLER_PERMISSIONS_OK_TO_COPY = 1 << 2,
+  POPPLER_PERMISSIONS_OK_TO_ADD_NOTES = 1 << 3,
+  POPPLER_PERMISSIONS_FULL = (POPPLER_PERMISSIONS_OK_TO_PRINT
+			      | POPPLER_PERMISSIONS_OK_TO_MODIFY
+			      | POPPLER_PERMISSIONS_OK_TO_COPY
+			      | POPPLER_PERMISSIONS_OK_TO_ADD_NOTES),
+
 } PopplerPermissions;
 
 



More information about the poppler mailing list