[poppler] poppler/poppler: Annot.cc, 1.9.2.1, 1.9.2.2 Annot.h, 1.5.2.1, 1.5.2.2 Form.cc, 1.3.2.1, 1.3.2.2 Form.h, 1.2, 1.2.2.1 Page.cc, 1.17.2.1, 1.17.2.2

Albert Astals Cid aacid at kemper.freedesktop.org
Sat Apr 14 12:18:21 PDT 2007


Update of /cvs/poppler/poppler/poppler
In directory kemper:/tmp/cvs-serv28173/poppler

Modified Files:
      Tag: xpdf302merge
	Annot.cc Annot.h Form.cc Form.h Page.cc 
Log Message:
Commit Julien work on the 3.02 branch, it may still have problems but it IS an advance, so get it in.


Index: Annot.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/Annot.cc,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -u -d -r1.9.2.1 -r1.9.2.2
--- Annot.cc	6 Apr 2007 14:22:23 -0000	1.9.2.1
+++ Annot.cc	14 Apr 2007 19:18:19 -0000	1.9.2.2
@@ -13,7 +13,10 @@
 #endif
 
 #include <stdlib.h>
+#include <math.h>
 #include "goo/gmem.h"
+#include "GooList.h"
+#include "Error.h"
 #include "Object.h"
 #include "Catalog.h"
 #include "Gfx.h"
@@ -24,6 +27,60 @@
[...1779 lines suppressed...]
+    }
+    obj1.free();
+  }
+}
+
+Annot *Annots::findAnnot(Ref *ref) {
+  int i;
+
+  for (i = 0; i < nAnnots; ++i) {
+    if (annots[i]->match(ref)) {
+      return annots[i];
+    }
+  }
+  return NULL;
+}
+
+
 Annots::~Annots() {
   int i;
 

Index: Annot.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/Annot.h,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -u -d -r1.5.2.1 -r1.5.2.2
--- Annot.h	6 Apr 2007 14:22:23 -0000	1.5.2.1
+++ Annot.h	14 Apr 2007 19:18:19 -0000	1.5.2.2
@@ -18,7 +18,7 @@
 class Catalog;
 class CharCodeToUnicode;
 class GfxFont;
-class FormWidget;
+class GfxFontDict;
 
 //------------------------------------------------------------------------
 // AnnotBorderStyle
@@ -68,30 +68,57 @@
   ~Annot();
   GBool isOk() { return ok; }
 
-  void draw(Gfx *gfx);
+  void draw(Gfx *gfx, GBool printing);
 
   // Get appearance object.
   Object *getAppearance(Object *obj) { return appearance.fetch(xref, obj); }
   GBool textField() { return isTextField; }
 
+  AnnotBorderStyle *getBorderStyle () { return borderStyle; }
+
+  GBool match(Ref *refA)
+    { return ref.num == refA->num && ref.gen == refA->gen; }
+
+  void generateFieldAppearance(Dict *field, Dict *annot, Dict *acroForm);
+
   double getXMin() { return xMin; }
   double getYMin() { return yMin; }
 
   double getFontSize() { return fontSize; }
 
 private:
-  void writeTextString (GooString* vStr, CharCodeToUnicode* ccToUnicode, GooString* appearBuf, GfxFont* font);
-  void generateAppearance(Dict *acroForm, Dict *dict);
+//  void writeTextString (GooString* vStr, CharCodeToUnicode* ccToUnicode, GooString* appearBuf, GfxFont* font);
+//  void generateAppearance(Dict *acroForm, Dict *dict);
+  void setColor(Array *a, GBool fill, int adjust);
+  void drawText(GooString *text, GooString *da, GfxFontDict *fontDict,
+		GBool multiline, int comb, int quadding,
+		GBool txField, GBool forceZapfDingbats);
+  void drawListBox(GooString **text, GBool *selection,
+		   int nOptions, int topIdx,
+		   GooString *da, GfxFontDict *fontDict, GBool quadding);
+  void getNextLine(GooString *text, int start,
+		   GfxFont *font, double fontSize, double wMax,
+		   int *end, double *width, int *next);
+  void drawCircle(double cx, double cy, double r, GBool fill);
+  void drawCircleTopLeft(double cx, double cy, double r);
+  void drawCircleBottomRight(double cx, double cy, double r);
+  Object *fieldLookup(Dict *field, char *key, Object *obj);
   void readArrayNum(Object *pdfArray, int key, double *value);
+  // write vStr[i:j[ in appearBuf
+  void writeTextString (GooString *text, GooString *appearBuf, int *i, int j, CharCodeToUnicode *ccToUnicode); 
 
   void initialize (XRef *xrefA, Dict *acroForm, Dict *dict, Catalog *catalog);
 
   XRef *xref;			// the xref table for this PDF file
+  Ref ref; // object ref identifying this annotation
+  GooString *type; // annotation type
   Object appearance;		// a reference to the Form XObject stream
 				//   for the normal appearance
   GooString *appearBuf;
+  Guint flags;
   double xMin, yMin,		// annotation rectangle
          xMax, yMax;
+  AnnotBorderStyle *borderStyle;
   double fontSize; 
   GBool ok;
   GBool regen, isTextField;
@@ -99,8 +126,6 @@
   
   bool hasRef;
   bool hidden;
-  Ref ref;
-  FormWidget* widget;
 };
 
 //------------------------------------------------------------------------
@@ -110,7 +135,7 @@
 class Annots {
 public:
 
-  // Extract non-link annotations from array of annotations.
+  // Build a list of Annot objects.
   Annots(XRef *xref, Catalog *catalog, Object *annotsObj);
 
   ~Annots();
@@ -119,7 +144,15 @@
   int getNumAnnots() { return nAnnots; }
   Annot *getAnnot(int i) { return annots[i]; }
 
+  // (Re)generate the appearance streams for all annotations belonging
+  // to a form field.
+  void generateAppearances(Dict *acroForm);
+
+
 private:
+  void scanFieldAppearances(Dict *node, Ref *ref, Dict *parent,
+			    Dict *acroForm);
+  Annot *findAnnot(Ref *ref);
 
   Annot **annots;
   int nAnnots;

Index: Form.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/Form.cc,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -u -d -r1.3.2.1 -r1.3.2.2
--- Form.cc	6 Apr 2007 14:22:23 -0000	1.3.2.1
+++ Form.cc	14 Apr 2007 19:18:19 -0000	1.3.2.2
@@ -1065,7 +1065,7 @@
     oref.free();
   }
 
-  checkForNeedAppearances(); 
+  checkForNeedAppearances(acroForm); 
 }
 
 Form::~Form() {
@@ -1075,21 +1075,19 @@
   delete [] rootFields;
 }
 
-void Form::checkForNeedAppearances ()
+void Form::checkForNeedAppearances (Object *acroForm)
 {
   //NeedAppearances needs to be set to 'true' in the AcroForm entry of the Catalog to enable dynamic appearance generation
   Object* catalog = new Object();
-  Object acroForm;
   Ref catRef;
   catRef.gen = xref->getRootGen();
   catRef.num = xref->getRootNum();
   catalog = xref->getCatalog(catalog);
-  catalog->dictLookup("AcroForm", &acroForm);
+  catalog->dictLookup("AcroForm", acroForm);
   Object obj1;
   obj1.initBool(true);
-  acroForm.dictSet("NeedAppearances", &obj1);
-  obj1.free();
-  catalog->dictSet("AcroForm", &acroForm);
+  acroForm->dictSet("NeedAppearances", &obj1);
+  catalog->dictSet("AcroForm", acroForm);
   xref->setModifiedObject(catalog, catRef);
 }
 

Index: Form.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/Form.h,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- Form.h	25 Feb 2007 00:34:21 -0000	1.2
+++ Form.h	14 Apr 2007 19:18:19 -0000	1.2.2.1
@@ -436,7 +436,7 @@
   void createFieldFromDict (Object* obj, FormField** ptr, XRef *xref, const Ref& aref);
 
   void postWidgetsLoad();
-  void checkForNeedAppearances ();
+  void checkForNeedAppearances (Object *acroForm);
 private:
   FormField** rootFields;
   int numFields;

Index: Page.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/Page.cc,v
retrieving revision 1.17.2.1
retrieving revision 1.17.2.2
diff -u -d -r1.17.2.1 -r1.17.2.2
--- Page.cc	6 Apr 2007 14:22:23 -0000	1.17.2.1
+++ Page.cc	14 Apr 2007 19:18:19 -0000	1.17.2.2
@@ -416,8 +416,7 @@
   if (acroForm) {
     if (acroForm->lookup("NeedAppearances", &obj)) {
       if (obj.isBool() && obj.getBool()) {
-#warning Annot is broken FIXME!
-//	annotList->generateAppearances(acroForm);
+      	annotList->generateAppearances(acroForm);
       }
     }
     obj.free();
@@ -431,8 +430,7 @@
         if ((annotDisplayDecideCbk &&
              (*annotDisplayDecideCbk)(annot, annotDisplayDecideCbkData)) || 
             !annotDisplayDecideCbk) {
-#warning Annot is broken FIXME!
-//           annotList->getAnnot(i)->draw(gfx, printing);
+             annotList->getAnnot(i)->draw(gfx, printing);
     }
     }
     out->dump();



More information about the poppler mailing list