[poppler] poppler/qt4/src: poppler-annotation-helper.h, 1.2,
1.3 poppler-document.cc, 1.32, 1.33 poppler-embeddedfile.cc,
1.4, 1.5 poppler-form.cc, 1.1, 1.2 poppler-page.cc, 1.37,
1.38 poppler-private.h, 1.23, 1.24
Albert Astals Cid
aacid at kemper.freedesktop.org
Wed Apr 25 12:59:13 PDT 2007
- Previous message: [poppler] poppler/glib: poppler-action.cc, 1.10,
1.11 poppler-document.cc, 1.41, 1.42 poppler-page.cc, 1.54, 1.55
- Next message: [poppler]
poppler/utils: HtmlOutputDev.cc, 1.5, 1.6 HtmlOutputDev.h,
1.2, 1.3 pdffonts.cc, 1.5, 1.6 pdfinfo.cc, 1.5,
1.6 pdftoabw.cc, 1.3, 1.4 pdftohtml.cc, 1.6, 1.7 pdftoppm.cc,
1.4, 1.5 pdftops.cc, 1.5, 1.6 pdftotext.cc, 1.5, 1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/poppler/poppler/qt4/src
In directory kemper:/tmp/cvs-serv1447/qt4/src
Modified Files:
poppler-annotation-helper.h poppler-document.cc
poppler-embeddedfile.cc poppler-form.cc poppler-page.cc
poppler-private.h
Log Message:
Merge xpdf302branch in HEAD as noone vetoed it.
Testing more than welcome
Index: poppler-annotation-helper.h
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-annotation-helper.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- poppler-annotation-helper.h 24 Feb 2007 23:58:31 -0000 1.2
+++ poppler-annotation-helper.h 25 Apr 2007 19:59:10 -0000 1.3
@@ -26,20 +26,20 @@
{
public:
// find named symbol and parse it
- 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 );
+ static inline void lookupName( Dict *, char *, QString & dest );
+ static inline void lookupString( Dict *, char *, QString & dest );
+ static inline void lookupBool( Dict *, char *, bool & dest );
+ static inline void lookupInt( Dict *, char *, int & dest );
+ static inline void lookupNum( Dict *, char *, double & dest );
+ static inline int lookupNumArray( Dict *, char *, double * dest, int len );
+ static inline void lookupColor( Dict *, char *, QColor & color );
+ static inline void lookupIntRef( Dict *, char *, int & dest );
+ static inline void lookupDate( Dict *, 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 );
};
-void XPDFReader::lookupName( Dict * dict, const char * type, QString & dest )
+void XPDFReader::lookupName( Dict * dict, char * type, QString & dest )
{
Object nameObj;
dict->lookup( type, &nameObj );
@@ -52,7 +52,7 @@
nameObj.free();
}
-void XPDFReader::lookupString( Dict * dict, const char * type, QString & dest )
+void XPDFReader::lookupString( Dict * dict, char * type, QString & dest )
{
Object stringObj;
dict->lookup( type, &stringObj );
@@ -65,7 +65,7 @@
stringObj.free();
}
-void XPDFReader::lookupBool( Dict * dict, const char * type, bool & dest )
+void XPDFReader::lookupBool( Dict * dict, char * type, bool & dest )
{
Object boolObj;
dict->lookup( type, &boolObj );
@@ -78,7 +78,7 @@
boolObj.free();
}
-void XPDFReader::lookupInt( Dict * dict, const char * type, int & dest )
+void XPDFReader::lookupInt( Dict * dict, char * type, int & dest )
{
Object intObj;
dict->lookup( type, &intObj );
@@ -91,7 +91,7 @@
intObj.free();
}
-void XPDFReader::lookupNum( Dict * dict, const char * type, double & dest )
+void XPDFReader::lookupNum( Dict * dict, char * type, double & dest )
{
Object numObj;
dict->lookup( type, &numObj );
@@ -104,7 +104,7 @@
numObj.free();
}
-int XPDFReader::lookupNumArray( Dict * dict, const char * type, double * dest, int len )
+int XPDFReader::lookupNumArray( Dict * dict, char * type, double * dest, int len )
{
Object arrObj;
dict->lookup( type, &arrObj );
@@ -129,14 +129,14 @@
return len;
}
-void XPDFReader::lookupColor( Dict * dict, const char * type, QColor & dest )
+void XPDFReader::lookupColor( Dict * dict, char * type, QColor & dest )
{
double c[3];
if ( XPDFReader::lookupNumArray( dict, type, c, 3 ) == 3 )
dest = QColor( (int)(c[0]*255.0), (int)(c[1]*255.0), (int)(c[2]*255.0));
}
-void XPDFReader::lookupIntRef( Dict * dict, const char * type, int & dest )
+void XPDFReader::lookupIntRef( Dict * dict, char * type, int & dest )
{
Object refObj;
dict->lookupNF( type, &refObj );
@@ -149,7 +149,7 @@
refObj.free();
}
-void XPDFReader::lookupDate( Dict * dict, const char * type, QDateTime & dest )
+void XPDFReader::lookupDate( Dict * dict, char * type, QDateTime & dest )
{
Object dateObj;
dict->lookup( type, &dateObj );
@@ -157,7 +157,7 @@
return;
if ( dateObj.isString() )
{
- const char * s = dateObj.getString()->getCString();
+ char * s = dateObj.getString()->getCString();
if ( s[0] == 'D' && s[1] == ':' )
s += 2;
int year, mon, day, hour, min, sec;
Index: poppler-document.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-document.cc,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- poppler-document.cc 24 Feb 2007 23:43:35 -0000 1.32
+++ poppler-document.cc 25 Apr 2007 19:59:10 -0000 1.33
@@ -28,7 +28,6 @@
#include <PDFDoc.h>
#include <PSOutputDev.h>
#include <Stream.h>
-#include <UGooString.h>
#include <Catalog.h>
#include <QtCore/QDebug>
@@ -273,7 +272,7 @@
Dict *infoDict = info.getDict();
// somehow iterate over keys in infoDict
for( int i=0; i < infoDict->getLength(); ++i ) {
- const char *aux = infoDict->getKey(i)->getCString();
+ const char *aux = infoDict->getKey(i);
keys.append( QString::fromAscii(aux) );
delete[] aux;
}
@@ -302,7 +301,7 @@
if ( infoDict->lookup( type.toLatin1().data(), &obj )->isString() )
{
- char *aux = UGooString(*obj.getString()).getCString();
+ char *aux = obj.getString()->getCString();
result = Poppler::convertDate(aux);
delete[] aux;
}
@@ -409,7 +408,7 @@
if ( m_doc->getOutputDev() == NULL )
return NULL;
- UGooString * namedDest = QStringToUGooString( name );
+ GooString * namedDest = QStringToGooString( name );
LinkDestinationData ldd(NULL, namedDest, m_doc);
LinkDestination *ld = new LinkDestination(ldd);
delete namedDest;
Index: poppler-embeddedfile.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-embeddedfile.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- poppler-embeddedfile.cc 14 Apr 2007 07:29:04 -0000 1.4
+++ poppler-embeddedfile.cc 25 Apr 2007 19:59:10 -0000 1.5
@@ -25,9 +25,9 @@
#include "Object.h"
#include "Stream.h"
#include "Catalog.h"
-#include "UGooString.h"
#include "poppler-qt4.h"
+#include "poppler-private.h"
namespace Poppler
{
@@ -46,9 +46,7 @@
{
m_embeddedFile = new EmbeddedFileData();
m_embeddedFile->m_label = QString(embfile->name()->getCString());
- const char *aux = UGooString(*embfile->description()).getCString();
- m_embeddedFile->m_description = QString(aux);
- delete[] aux;
+ m_embeddedFile->m_description = UnicodeParsedString(embfile->description());
m_embeddedFile->m_modDate = convertDate(embfile->modDate()->getCString());
m_embeddedFile->m_createDate = convertDate(embfile->createDate()->getCString());
embfile->streamObject().copy(&m_embeddedFile->m_streamObject);
Index: poppler-form.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-form.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- poppler-form.cc 25 Feb 2007 00:00:20 -0000 1.1
+++ poppler-form.cc 25 Apr 2007 19:59:10 -0000 1.2
@@ -152,18 +152,14 @@
QString FormFieldText::text() const
{
GooString *goo = static_cast<FormWidgetText*>(m_formData->fm)->getContent();
- return GooStringToQString(goo);
+ return UnicodeParsedString(goo);
}
void FormFieldText::setText( const QString& text )
{
FormWidgetText* fwt = static_cast<FormWidgetText*>(m_formData->fm);
- UGooString * ugoo = QStringToUGooString( text );
- char *str = ugoo->getCString();
- GooString goo(str);
- gfree( str );
- delete ugoo;
- fwt->setContent( &goo );
+ GooString * goo = QStringToGooString( text );
+ fwt->setContent( goo );
}
bool FormFieldText::isPassword() const
@@ -233,7 +229,7 @@
int num = fwc->getNumChoices();
for (int i = 0; i < num; ++i)
{
- ret.append(GooStringToQString(fwc->getChoice(i)));
+ ret.append(UnicodeParsedString(fwc->getChoice(i)));
}
return ret;
}
Index: poppler-page.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-page.cc,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- poppler-page.cc 24 Feb 2007 23:58:31 -0000 1.37
+++ poppler-page.cc 25 Apr 2007 19:59:10 -0000 1.38
@@ -405,7 +405,7 @@
Dict *dict = o.getDict();
Object o2;
const char *key = act == Page::Opening ? "O" : "C";
- dict->lookup(key, &o2);
+ dict->lookup((char*)key, &o2);
::LinkAction *act = ::LinkAction::parseAction(&o2, m_page->parentDoc->m_doc->doc->getCatalog()->getBaseURI() );
o2.free();
o.free();
@@ -459,7 +459,7 @@
{
::Page *p;
p = m_page->parentDoc->m_doc->doc->getCatalog()->getPage(m_page->index + 1);
- p->getDefaultCTM(CTM, dpiX, dpiY, rotate, upsideDown);
+ p->getDefaultCTM(CTM, dpiX, dpiY, rotate, gFalse, upsideDown);
}
QList<Link*> Page::links() const
@@ -469,7 +469,7 @@
if (output_dev == NULL)
return popplerLinks;
- Links *xpdfLinks = m_page->parentDoc->m_doc->doc->takeLinks();
+ Links *xpdfLinks = m_page->parentDoc->m_doc->doc->getLinks(m_page->index + 1);
for (int i = 0; i < xpdfLinks->getNumLinks(); ++i)
{
::Link *xpdfLink = xpdfLinks->getLink(i);
@@ -628,7 +628,7 @@
// -> linePoints
double c[100];
- int num = XPDFReader::lookupNumArray( annotDict, (subType == "Line") ? "L" : "Vertices", c, 100 );
+ int num = XPDFReader::lookupNumArray( annotDict, (char*)((subType == "Line") ? "L" : "Vertices"), c, 100 );
if ( num < 4 || (num % 2) != 0 )
{
qDebug() << "L/Vertices wrong fol Line/Poly." << endl;
Index: poppler-private.h
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-private.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- poppler-private.h 16 Apr 2007 21:25:46 -0000 1.23
+++ poppler-private.h 25 Apr 2007 19:59:10 -0000 1.24
@@ -27,7 +27,6 @@
#include <Outline.h>
#include <PDFDoc.h>
#include <FontInfo.h>
-#include <UGooString.h>
#include <OutputDev.h>
#if defined(HAVE_SPLASH)
#include <SplashOutputDev.h>
@@ -40,40 +39,64 @@
/* borrowed from kpdf */
static QString unicodeToQString(Unicode* u, int len) {
- QString ret;
- ret.resize(len);
- QChar* qch = (QChar*) ret.unicode();
- for (;len;--len)
- *qch++ = (QChar) *u++;
- return ret;
+ QString ret;
+ ret.resize(len);
+ QChar* qch = (QChar*) ret.unicode();
+ for (;len;--len)
+ *qch++ = (QChar) *u++;
+ return ret;
}
- static UGooString *QStringToUGooString(const QString &s) {
- int len = s.length();
- Unicode *u = new Unicode[s.length()];
- for (int i = 0; i < len; ++i)
- u[i] = s.at(i).unicode();
- return new UGooString(u, len);
+ static GooString *QStringToGooString(const QString &s) {
+ int len = s.length();
+ char *cstring = (char *)gmallocn(s.length(), sizeof(char));
+ for (int i = 0; i < len; ++i)
+ cstring[i] = s.at(i).unicode();
+ return new GooString(cstring, len);
}
- static QString GooStringToQString(GooString* goo) {
- if (!goo)
- return QString();
- const char *aux = UGooString(*goo).getCString();
- QString res(aux);
- delete[] aux;
- return res;
+ static QString UnicodeParsedString(GooString *s1) {
+ GBool isUnicode;
+ int i;
+ Unicode u;
+ QString result;
+ if ( ( s1->getChar(0) & 0xff ) == 0xfe && ( s1->getChar(1) & 0xff ) == 0xff )
+ {
+ isUnicode = gTrue;
+ i = 2;
+ }
+ else
+ {
+ isUnicode = gFalse;
+ i = 0;
+ }
+ while ( i < s1->getLength() )
+ {
+ if ( isUnicode )
+ {
+ u = ( ( s1->getChar(i) & 0xff ) << 8 ) | ( s1->getChar(i+1) & 0xff );
+ i += 2;
+ }
+ else
+ {
+ u = s1->getChar(i) & 0xff;
+ ++i;
+ }
+ result += unicodeToQString( &u, 1 );
+ }
+ return result;
}
+
class LinkDestinationData
{
public:
- LinkDestinationData( LinkDest *l, UGooString *nd, Poppler::DocumentData *pdfdoc ) : ld(l), namedDest(nd), doc(pdfdoc)
+ LinkDestinationData( LinkDest *l, GooString *nd, Poppler::DocumentData *pdfdoc ) : ld(l), namedDest(nd), doc(pdfdoc)
{
}
LinkDest *ld;
- UGooString *namedDest;
+ GooString *namedDest;
Poppler::DocumentData *doc;
};
@@ -136,7 +159,7 @@
bgColor[1] = paperColor.green();
bgColor[2] = paperColor.blue();
GBool AA = m_hints & Document::TextAntialiasing ? gTrue : gFalse;
- SplashOutputDev * splashOutputDev = new SplashOutputDev(splashModeRGB8Qt, 4, gFalse, bgColor, gTrue, AA);
+ SplashOutputDev * splashOutputDev = new SplashOutputDev(splashModeRGBX8, 4, gFalse, bgColor, gTrue, AA);
splashOutputDev->startDoc(doc->getXRef());
m_outputDev = splashOutputDev;
#endif
@@ -178,9 +201,12 @@
// no 'destination' but an internal 'named reference'. we could
// get the destination for the page now, but it's VERY time consuming,
// so better storing the reference and provide the viewport on demand
- UGooString *s = g->getNamedDest();
- QString aux = unicodeToQString( s->unicode(), s->getLength() );
+ GooString *s = g->getNamedDest();
+ QChar *charArray = new QChar[s->getLength()];
+ for (int i = 0; i < s->getLength(); ++i) charArray[i] = QChar(s->getCString()[i]);
+ QString aux(charArray, s->getLength());
item.setAttribute( "DestinationName", aux );
+ delete[] charArray;
}
else if ( destination && destination->isOk() )
{
- Previous message: [poppler] poppler/glib: poppler-action.cc, 1.10,
1.11 poppler-document.cc, 1.41, 1.42 poppler-page.cc, 1.54, 1.55
- Next message: [poppler]
poppler/utils: HtmlOutputDev.cc, 1.5, 1.6 HtmlOutputDev.h,
1.2, 1.3 pdffonts.cc, 1.5, 1.6 pdfinfo.cc, 1.5,
1.6 pdftoabw.cc, 1.3, 1.4 pdftohtml.cc, 1.6, 1.7 pdftoppm.cc,
1.4, 1.5 pdftops.cc, 1.5, 1.6 pdftotext.cc, 1.5, 1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the poppler
mailing list