[poppler] poppler/qt4/src: Doxyfile, 1.7, 1.8 Makefile.am, 1.16,
1.17 poppler-annotation-helper.h, 1.1, 1.2 poppler-page.cc,
1.36, 1.37 poppler-private.h, 1.21, 1.22 poppler-qt4.h, 1.46, 1.47
Albert Astals Cid
aacid at kemper.freedesktop.org
Sat Feb 24 15:58:33 PST 2007
Update of /cvs/poppler/poppler/qt4/src
In directory kemper:/tmp/cvs-serv6790/qt4/src
Modified Files:
Doxyfile Makefile.am poppler-annotation-helper.h
poppler-page.cc poppler-private.h poppler-qt4.h
Log Message:
2007-02-25 Pino Toscano <pino at kde.org>
reviewed by: Albert Astals Cid <aacid at kde.org>
* qt4/src/Doxyfile:
* qt4/src/Makefile.am:
* qt4/src/poppler-annotation-helper.h:
* qt4/src/poppler-form.cc:
* qt4/src/poppler-form.h:
* qt4/src/poppler-page.cc:
* qt4/src/poppler-private.h:
* qt4/src/poppler-qt4.h:
Beginning of interactive forms support, first implementation in the
Qt4 frontend. It supports text and choice fields in a basic way.
Index: Doxyfile
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/Doxyfile,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Doxyfile 16 Nov 2006 21:03:27 -0000 1.7
+++ Doxyfile 24 Feb 2007 23:58:31 -0000 1.8
@@ -447,6 +447,7 @@
INPUT = \
Mainpage.dox \
poppler-annotation.h \
+ poppler-form.h \
poppler-link.h \
poppler-qt4.h \
../../qt/poppler-page-transition.h
Index: Makefile.am
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/Makefile.am,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- Makefile.am 13 Jan 2007 18:29:39 -0000 1.16
+++ Makefile.am 24 Feb 2007 23:58:31 -0000 1.17
@@ -12,6 +12,7 @@
poppler-qt4.h \
poppler-link.h \
poppler-annotation.h \
+ poppler-form.h \
../../qt/poppler-page-transition.h
lib_LTLIBRARIES = libpoppler-qt4.la
@@ -26,6 +27,7 @@
poppler-annotation.cc \
../../qt/poppler-page-transition.cc \
poppler-sound.cc \
+ poppler-form.cc \
poppler-annotation-helper.h \
poppler-private.h
Index: poppler-annotation-helper.h
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-annotation-helper.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- poppler-annotation-helper.h 12 May 2006 20:40:05 -0000 1.1
+++ poppler-annotation-helper.h 24 Feb 2007 23:58:31 -0000 1.2
@@ -26,15 +26,15 @@
{
public:
// find named symbol and parse it
- static void lookupName( Dict *, const char *, QString & dest );
- static void lookupString( Dict *, const char *, QString & dest );
- static void lookupBool( Dict *, const char *, bool & dest );
- static void lookupInt( Dict *, const char *, int & dest );
- static void lookupNum( Dict *, const char *, double & dest );
- static int lookupNumArray( Dict *, const char *, double * dest, int len );
- static void lookupColor( Dict *, const char *, QColor & color );
- static void lookupIntRef( Dict *, const char *, int & dest );
- static void lookupDate( Dict *, const char *, QDateTime & dest );
+ static inline void lookupName( Dict *, const char *, QString & dest );
+ static inline void lookupString( Dict *, const char *, QString & dest );
+ static inline void lookupBool( Dict *, const char *, bool & dest );
+ static inline void lookupInt( Dict *, const char *, int & dest );
+ static inline void lookupNum( Dict *, const char *, double & dest );
+ static inline int lookupNumArray( Dict *, const char *, double * dest, int len );
+ static inline void lookupColor( Dict *, const char *, QColor & color );
+ static inline void lookupIntRef( Dict *, const char *, int & dest );
+ static inline void lookupDate( Dict *, const char *, QDateTime & dest );
// transform from user coords to normalized ones using the matrix M
static inline void transform( double * M, double x, double y, QPointF &res );
};
Index: poppler-page.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-page.cc,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- poppler-page.cc 31 Jan 2007 22:05:09 -0000 1.36
+++ poppler-page.cc 24 Feb 2007 23:58:31 -0000 1.37
@@ -26,6 +26,7 @@
#include <GlobalParams.h>
#include <PDFDoc.h>
#include <Catalog.h>
+#include <Form.h>
#include <ErrorCodes.h>
#include <TextOutputDev.h>
#if defined(HAVE_SPLASH)
@@ -37,6 +38,7 @@
#include "poppler-private.h"
#include "poppler-page-transition-private.h"
#include "poppler-annotation-helper.h"
+#include "poppler-form.h"
namespace Poppler {
@@ -1235,6 +1237,40 @@
return annotationsMap.values();
}
+QList<FormField*> Page::formFields() const
+{
+ QList<FormField*> fields;
+ ::Page *p = m_page->parentDoc->m_doc->doc->getCatalog()->getPage(m_page->index + 1);
+ ::FormPageWidgets * form = p->getPageWidgets();
+ int formcount = form->getNumWidgets();
+ for (int i = 0; i < formcount; ++i)
+ {
+ ::FormWidget *fm = form->getWidget(i);
+ FormField * ff = NULL;
+ switch (fm->getType())
+ {
+ case formText:
+ {
+ ff = new FormFieldText(m_page->parentDoc->m_doc, p, static_cast<FormWidgetText*>(fm));
+ }
+ break;
+
+ case formChoice:
+ {
+ ff = new FormFieldChoice(m_page->parentDoc->m_doc, p, static_cast<FormWidgetChoice*>(fm));
+ }
+ break;
+
+ default: ;
+ }
+
+ if (ff)
+ fields.append(ff);
+ }
+
+ return fields;
+}
+
double Page::duration() const
{
::Page *p;
Index: poppler-private.h
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-private.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- poppler-private.h 24 Feb 2007 23:43:35 -0000 1.21
+++ poppler-private.h 24 Feb 2007 23:58:31 -0000 1.22
@@ -33,7 +33,7 @@
#include <SplashOutputDev.h>
#endif
-
+class FormWidget;
namespace Poppler {
@@ -55,6 +55,15 @@
return new UGooString(u, len);
}
+ static QString GooStringToQString(GooString* goo) {
+ if (!goo)
+ return QString();
+ const char *aux = UGooString(*goo).getCString();
+ QString res(aux);
+ delete[] aux;
+ return res;
+ }
+
class LinkDestinationData
{
public:
@@ -284,6 +293,47 @@
bool hasSpaceAfter;
};
+ class FormFieldData
+ {
+ public:
+ FormFieldData(DocumentData *_doc, ::Page *p, ::FormWidget *w) :
+ doc(_doc), page(p), fm(w), flags(0), annoflags(0)
+ {
+ }
+
+ Qt::Alignment textAlignment(Object *obj) const
+ {
+ Object tmp;
+ int align = 0;
+ if (obj->dictLookup("Q", &tmp)->isInt())
+ {
+ align = tmp.getInt();
+ }
+ tmp.free();
+ Qt::Alignment qtalign;
+ switch ( align )
+ {
+ case 1:
+ qtalign = Qt::AlignHCenter;
+ break;
+ case 2:
+ qtalign = Qt::AlignRight;
+ break;
+ case 0:
+ default:
+ qtalign = Qt::AlignLeft;
+ }
+ return qtalign;
+ }
+
+ DocumentData *doc;
+ ::Page *page;
+ ::FormWidget *fm;
+ QRectF box;
+ int flags;
+ int annoflags;
+ };
+
}
Index: poppler-qt4.h
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-qt4.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- poppler-qt4.h 24 Feb 2007 23:43:35 -0000 1.46
+++ poppler-qt4.h 24 Feb 2007 23:58:31 -0000 1.47
@@ -45,6 +45,8 @@
class PageData;
+ class FormField;
+
class TextBoxData;
/**
@@ -376,6 +378,11 @@
QList<Annotation*> annotations() const;
/**
+ Returns the form fields on the page
+ */
+ QList<FormField*> formFields() const;
+
+ /**
Returns the page duration. That is the time, in seconds, that the page
should be displayed before the presentation automatically advances to the next page.
Returns < 0 if duration is not set.
More information about the poppler
mailing list