Alle sabato 25 agosto 2007, Albert Astals Cid ha scritto: > I vote from 3rd september.
+1 > I know Carlos wanted to introduce changes to glib and Pino to qt. Send them > NOW! Here you have it. (Let's see what I can do for the annotations stuff.) > *** "unwrapping" of ff,fi, etc ligatures *** > I don't want to do it, but that's only me, there seems to be lots of votes > on the other direction, what do you, Carlos, Jeff, Pino, krh say? And any > of the yes voters will send a patch? ;-) I think the responsibility for "unwrapping" the ligatures should be on the clients (== users of poppler == applications, mostly), because they can really know whether they can handle ligatures or not. If they can, good for them - if not, they will need to "unwrap" them at once. > *** beign more lax about ending %%EOF *** > Lately there seem to be some pdf around that do not end with %%EOF. That > sucks as they break the check i introduced for %%EOF beign present and are > not REAL pdf. > [...] > So i introduced the %%EOF check to avoid that. > But it seems that is hurting us now, so we can remove the %%EOF check and > try to improve poppler not to crash on incomplete documents or leave it > that way and keep repeating our users that if it does not have an %%EOF > it's not a PDF and that they should bug the producer not the consumer of > the pdf file. Or any other suggestion? +1 on removing the check, as other than exisiting documents without it, there are documents with a bogus EOF marker (like "%EO" or sort of, see [1]). [1] http://bugs.kde.org/show_bug.cgi?id=142140 -- Pino Toscano
Index: ChangeLog
===================================================================
RCS file: /cvs/poppler/poppler/ChangeLog,v
retrieving revision 1.602
diff -u -p -r1.602 ChangeLog
--- ChangeLog 23 Aug 2007 20:39:31 -0000 1.602
+++ ChangeLog 26 Aug 2007 00:05:56 -0000
@@ -1,3 +1,22 @@
+2007-08-26 Pino Toscano <[EMAIL PROTECTED]>
+
+ * qt4/src/poppler-document.cc:
+ * qt4/src/poppler-embeddedfile.cc:
+ * qt4/src/poppler-fontinfo.cc:
+ * qt4/src/poppler-form.cc:
+ * qt4/src/poppler-form.h:
+ * qt4/src/poppler-qt4.h:
+ * qt4/src/poppler-sound.cc:
+ * qt4/src/poppler-textbox.cc:
+ API work: remove 'const' and 'const&' from return values with Qt
+ classes; make the non-copiable classes really non-copiable;
+ uninline a Document::page() method; other related small changes.
+ * qt4/src/poppler-link.cc:
+ * qt4/src/poppler-link.h:
+ Make LinkDestination an implicitely shared class, with all the private
+ members into the private class; move all the private members of the
+ Link* classes into a common shared private.
+
2007-08-23 Carlos Garcia Campos <[EMAIL PROTECTED]>
* glib/poppler-page.cc: Add missing comma.
Index: qt4/src/poppler-document.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-document.cc,v
retrieving revision 1.39
diff -u -p -r1.39 poppler-document.cc
--- qt4/src/poppler-document.cc 20 Jun 2007 20:07:15 -0000 1.39
+++ qt4/src/poppler-document.cc 26 Aug 2007 00:05:57 -0000
@@ -89,6 +89,11 @@ namespace Poppler {
delete m_doc;
}
+ Page *Document::page(int index) const
+ {
+ return new Page(this, index);
+ }
+
bool Document::isLocked() const
{
return m_doc->locked;
@@ -178,7 +183,7 @@ namespace Poppler {
return ourList;
}
- const QList<EmbeddedFile*> &Document::embeddedFiles() const
+ QList<EmbeddedFile*> Document::embeddedFiles() const
{
return m_doc->m_embeddedFiles;
}
Index: qt4/src/poppler-embeddedfile.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-embeddedfile.cc,v
retrieving revision 1.7
diff -u -p -r1.7 poppler-embeddedfile.cc
--- qt4/src/poppler-embeddedfile.cc 3 Jul 2007 13:22:54 -0000 1.7
+++ qt4/src/poppler-embeddedfile.cc 26 Aug 2007 00:05:57 -0000
@@ -54,18 +54,6 @@ EmbeddedFile::EmbeddedFile(EmbFile *embf
embfile->streamObject().copy(&m_embeddedFile->m_streamObject);
}
-EmbeddedFile::EmbeddedFile(const EmbeddedFile &ef)
-{
- m_embeddedFile = new EmbeddedFileData();
- m_embeddedFile->m_label = ef.m_embeddedFile->m_label;
- m_embeddedFile->m_description = ef.m_embeddedFile->m_description;
- m_embeddedFile->m_size = ef.m_embeddedFile->m_size;
- m_embeddedFile->m_modDate = ef.m_embeddedFile->m_modDate;
- m_embeddedFile->m_createDate = ef.m_embeddedFile->m_createDate;
- m_embeddedFile->m_checksum = ef.m_embeddedFile->m_checksum;
- ef.m_embeddedFile->m_streamObject.copy(&m_embeddedFile->m_streamObject);
-}
-
EmbeddedFile::~EmbeddedFile()
{
delete m_embeddedFile;
Index: qt4/src/poppler-fontinfo.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-fontinfo.cc,v
retrieving revision 1.5
diff -u -p -r1.5 poppler-fontinfo.cc
--- qt4/src/poppler-fontinfo.cc 27 Apr 2007 22:41:10 -0000 1.5
+++ qt4/src/poppler-fontinfo.cc 26 Aug 2007 00:05:57 -0000
@@ -37,12 +37,12 @@ FontInfo::~FontInfo()
delete m_data;
}
-const QString &FontInfo::name() const
+QString FontInfo::name() const
{
return m_data->fontName;
}
-const QString &FontInfo::file() const
+QString FontInfo::file() const
{
return m_data->fontFile;
}
@@ -62,7 +62,7 @@ FontInfo::Type FontInfo::type() const
return m_data->type;
}
-const QString FontInfo::typeName() const
+QString FontInfo::typeName() const
{
switch (type()) {
case unknown:
@@ -86,4 +86,10 @@ const QString FontInfo::typeName() const
}
}
+FontInfo& FontInfo::operator=( const FontInfo &fi )
+{
+ *m_data = *fi.m_data;
+ return *this;
+}
+
}
Index: qt4/src/poppler-form.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-form.cc,v
retrieving revision 1.4
diff -u -p -r1.4 poppler-form.cc
--- qt4/src/poppler-form.cc 4 Jul 2007 13:57:31 -0000 1.4
+++ qt4/src/poppler-form.cc 26 Aug 2007 00:05:57 -0000
@@ -29,20 +29,20 @@
namespace Poppler {
-FormField::FormField(DocumentData *doc, ::Page *p, ::FormWidget *w)
- : m_formData(new FormFieldData(doc, p, w))
+FormField::FormField(FormFieldData &dd)
+ : m_formData(&dd)
{
// reading the coords
double left, top, right, bottom;
- w->getRect(&left, &bottom, &right, &top);
+ m_formData->fm->getRect(&left, &bottom, &right, &top);
// build a normalized transform matrix for this page at 100% scale
- GfxState gfxState( 72.0, 72.0, p->getMediaBox(), p->getRotate(), gTrue );
+ GfxState gfxState( 72.0, 72.0, m_formData->page->getMediaBox(), m_formData->page->getRotate(), gTrue );
double * gfxCTM = gfxState.getCTM();
double MTX[6];
for ( int i = 0; i < 6; i+=2 )
{
- MTX[i] = gfxCTM[i] / p->getCropWidth();
- MTX[i+1] = gfxCTM[i+1] / p->getCropHeight();
+ MTX[i] = gfxCTM[i] / m_formData->page->getCropWidth();
+ MTX[i+1] = gfxCTM[i+1] / m_formData->page->getCropHeight();
}
QPointF topLeft;
XPDFReader::transform( MTX, qMin( left, right ), qMax( top, bottom ), topLeft );
@@ -125,7 +125,7 @@ bool FormField::isVisible() const
FormFieldText::FormFieldText(DocumentData *doc, ::Page *p, ::FormWidgetText *w)
- : FormField(doc, p, w)
+ : FormField(*new FormFieldData(doc, p, w))
{
}
@@ -200,7 +200,7 @@ bool FormFieldText::canBeSpellChecked()
FormFieldChoice::FormFieldChoice(DocumentData *doc, ::Page *p, ::FormWidgetChoice *w)
- : FormField(doc, p, w)
+ : FormField(*new FormFieldData(doc, p, w))
{
}
Index: qt4/src/poppler-form.h
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-form.h,v
retrieving revision 1.1
diff -u -p -r1.1 poppler-form.h
--- qt4/src/poppler-form.h 25 Feb 2007 00:00:20 -0000 1.1
+++ qt4/src/poppler-form.h 26 Aug 2007 00:05:57 -0000
@@ -89,16 +89,12 @@ namespace Poppler {
bool isVisible() const;
protected:
- /**
- \internal
- */
- FormField(DocumentData *doc, ::Page *p, ::FormWidget *w);
+ FormField(FormFieldData &dd);
FormFieldData *m_formData;
private:
- FormField(const FormField&);
- FormField& operator=(const FormField&);
+ Q_DISABLE_COPY(FormField)
};
/**
@@ -168,6 +164,9 @@ namespace Poppler {
can be spell-checked.
*/
bool canBeSpellChecked() const;
+
+ private:
+ Q_DISABLE_COPY(FormFieldText)
};
/**
@@ -240,6 +239,9 @@ namespace Poppler {
Returns false if the field is not an editable text field.
*/
bool canBeSpellChecked() const;
+
+ private:
+ Q_DISABLE_COPY(FormFieldChoice)
};
}
Index: qt4/src/poppler-link.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-link.cc,v
retrieving revision 1.14
diff -u -p -r1.14 poppler-link.cc
--- qt4/src/poppler-link.cc 25 May 2007 23:17:58 -0000 1.14
+++ qt4/src/poppler-link.cc 26 Aug 2007 00:05:57 -0000
@@ -27,6 +27,141 @@
namespace Poppler {
+class LinkDestinationPrivate : public QSharedData
+{
+ public:
+ LinkDestinationPrivate();
+
+ LinkDestination::Kind kind; // destination type
+ int pageNum; // page number
+ double left, bottom; // position
+ double right, top;
+ double zoom; // zoom factor
+ bool changeLeft, changeTop; // for destXYZ links, which position
+ bool changeZoom; // components to change
+};
+
+ LinkDestinationPrivate::LinkDestinationPrivate()
+ {
+ // sane defaults
+ kind = LinkDestination::destXYZ;
+ pageNum = 0;
+ left = 0;
+ bottom = 0;
+ right = 0;
+ top = 0;
+ zoom = 1;
+ changeLeft = true;
+ changeTop = true;
+ changeZoom = false;
+ }
+
+class LinkPrivate
+{
+ public:
+ LinkPrivate( const QRectF &area );
+ virtual ~LinkPrivate();
+
+ QRectF linkArea;
+};
+
+ LinkPrivate::LinkPrivate( const QRectF &area )
+ : linkArea( area )
+ {
+ }
+
+ LinkPrivate::~LinkPrivate()
+ {
+ }
+
+class LinkGotoPrivate : public LinkPrivate
+{
+ public:
+ LinkGotoPrivate( const QRectF &area, const LinkDestination &dest );
+
+ QString extFileName;
+ LinkDestination destination;
+};
+
+ LinkGotoPrivate::LinkGotoPrivate( const QRectF &area, const LinkDestination &dest )
+ : LinkPrivate( area ), destination( dest )
+ {
+ }
+
+class LinkExecutePrivate : public LinkPrivate
+{
+ public:
+ LinkExecutePrivate( const QRectF &area );
+
+ QString fileName;
+ QString parameters;
+};
+
+ LinkExecutePrivate::LinkExecutePrivate( const QRectF &area )
+ : LinkPrivate( area )
+ {
+ }
+
+class LinkBrowsePrivate : public LinkPrivate
+{
+ public:
+ LinkBrowsePrivate( const QRectF &area );
+
+ QString url;
+};
+
+ LinkBrowsePrivate::LinkBrowsePrivate( const QRectF &area )
+ : LinkPrivate( area )
+ {
+ }
+
+class LinkActionPrivate : public LinkPrivate
+{
+ public:
+ LinkActionPrivate( const QRectF &area );
+
+ LinkAction::ActionType type;
+};
+
+ LinkActionPrivate::LinkActionPrivate( const QRectF &area )
+ : LinkPrivate( area )
+ {
+ }
+
+class LinkSoundPrivate : public LinkPrivate
+{
+ public:
+ LinkSoundPrivate( const QRectF &area );
+ ~LinkSoundPrivate();
+
+ double volume;
+ bool sync;
+ bool repeat;
+ bool mix;
+ SoundObject *sound;
+};
+
+ LinkSoundPrivate::LinkSoundPrivate( const QRectF &area )
+ : LinkPrivate( area ), sound( 0 )
+ {
+ }
+
+ LinkSoundPrivate::~LinkSoundPrivate()
+ {
+ delete sound;
+ }
+
+class LinkMoviePrivate : public LinkPrivate
+{
+ public:
+ LinkMoviePrivate( const QRectF &area );
+};
+
+ LinkMoviePrivate::LinkMoviePrivate( const QRectF &area )
+ : LinkPrivate( area )
+ {
+ }
+
static void cvtUserToDev(::Page *page, double xu, double yu, int *xd, int *yd) {
double ctm[6];
@@ -36,19 +171,8 @@ namespace Poppler {
}
LinkDestination::LinkDestination(const LinkDestinationData &data)
+ : d( new LinkDestinationPrivate )
{
- // sane defaults
- m_kind = destXYZ;
- m_pageNum = 0;
- m_left = 0;
- m_bottom = 0;
- m_right = 0;
- m_top = 0;
- m_zoom = 1;
- m_changeLeft = true;
- m_changeTop = true;
- m_changeZoom = false;
-
bool deleteDest = false;
LinkDest *ld = data.ld;
@@ -60,133 +184,159 @@ namespace Poppler {
if (!ld) return;
- if (ld->getKind() == ::destXYZ) m_kind = destXYZ;
- else if (ld->getKind() == ::destFit) m_kind = destFit;
- else if (ld->getKind() == ::destFitH) m_kind = destFitH;
- else if (ld->getKind() == ::destFitV) m_kind = destFitV;
- else if (ld->getKind() == ::destFitR) m_kind = destFitR;
- else if (ld->getKind() == ::destFitB) m_kind = destFitB;
- else if (ld->getKind() == ::destFitBH) m_kind = destFitBH;
- else if (ld->getKind() == ::destFitBV) m_kind = destFitBV;
+ if (ld->getKind() == ::destXYZ) d->kind = destXYZ;
+ else if (ld->getKind() == ::destFit) d->kind = destFit;
+ else if (ld->getKind() == ::destFitH) d->kind = destFitH;
+ else if (ld->getKind() == ::destFitV) d->kind = destFitV;
+ else if (ld->getKind() == ::destFitR) d->kind = destFitR;
+ else if (ld->getKind() == ::destFitB) d->kind = destFitB;
+ else if (ld->getKind() == ::destFitBH) d->kind = destFitBH;
+ else if (ld->getKind() == ::destFitBV) d->kind = destFitBV;
- if ( !ld->isPageRef() ) m_pageNum = ld->getPageNum();
+ if ( !ld->isPageRef() ) d->pageNum = ld->getPageNum();
else
{
Ref ref = ld->getPageRef();
- m_pageNum = data.doc->doc->findPage( ref.num, ref.gen );
+ d->pageNum = data.doc->doc->findPage( ref.num, ref.gen );
}
double left = ld->getLeft();
double bottom = ld->getBottom();
double right = ld->getRight();
double top = ld->getTop();
- m_zoom = ld->getZoom();
- m_changeLeft = ld->getChangeLeft();
- m_changeTop = ld->getChangeTop();
- m_changeZoom = ld->getChangeZoom();
+ d->zoom = ld->getZoom();
+ d->changeLeft = ld->getChangeLeft();
+ d->changeTop = ld->getChangeTop();
+ d->changeZoom = ld->getChangeZoom();
int leftAux = 0, topAux = 0, rightAux = 0, bottomAux = 0;
- ::Page *page = data.doc->doc->getCatalog()->getPage(m_pageNum);
+ ::Page *page = data.doc->doc->getCatalog()->getPage( d->pageNum );
cvtUserToDev( page, left, top, &leftAux, &topAux );
cvtUserToDev( page, right, bottom, &rightAux, &bottomAux );
- m_left = leftAux / (double)page->getCropWidth();
- m_top = topAux / (double)page->getCropHeight();
- m_right = rightAux/ (double)page->getCropWidth();
- m_bottom = bottomAux / (double)page->getCropHeight();
+ d->left = leftAux / (double)page->getCropWidth();
+ d->top = topAux / (double)page->getCropHeight();
+ d->right = rightAux/ (double)page->getCropWidth();
+ d->bottom = bottomAux / (double)page->getCropHeight();
if (deleteDest) delete ld;
}
LinkDestination::LinkDestination(const QString &description)
+ : d( new LinkDestinationPrivate )
{
QStringList tokens = description.split( ';' );
- m_kind = static_cast<Kind>(tokens.at(0).toInt());
- m_pageNum = tokens.at(1).toInt();
- m_left = tokens.at(2).toDouble();
- m_bottom = tokens.at(3).toDouble();
- m_top = tokens.at(4).toDouble();
- m_zoom = tokens.at(5).toDouble();
- m_changeLeft = static_cast<bool>(tokens.at(6).toInt());
- m_changeTop = static_cast<bool>(tokens.at(7).toInt());
- m_changeZoom = static_cast<bool>(tokens.at(8).toInt());
+ d->kind = static_cast<Kind>(tokens.at(0).toInt());
+ d->pageNum = tokens.at(1).toInt();
+ d->left = tokens.at(2).toDouble();
+ d->bottom = tokens.at(3).toDouble();
+ d->top = tokens.at(4).toDouble();
+ d->zoom = tokens.at(5).toDouble();
+ d->changeLeft = static_cast<bool>(tokens.at(6).toInt());
+ d->changeTop = static_cast<bool>(tokens.at(7).toInt());
+ d->changeZoom = static_cast<bool>(tokens.at(8).toInt());
+ }
+
+ LinkDestination::LinkDestination(const LinkDestination &other)
+ : d( other.d )
+ {
+ }
+
+ LinkDestination::~LinkDestination()
+ {
}
LinkDestination::Kind LinkDestination::kind() const
{
- return m_kind;
+ return d->kind;
}
int LinkDestination::pageNumber() const
{
- return m_pageNum;
+ return d->pageNum;
}
double LinkDestination::left() const
{
- return m_left;
+ return d->left;
}
double LinkDestination::bottom() const
{
- return m_bottom;
+ return d->bottom;
}
double LinkDestination::right() const
{
- return m_right;
+ return d->right;
}
double LinkDestination::top() const
{
- return m_top;
+ return d->top;
}
double LinkDestination::zoom() const
{
- return m_zoom;
+ return d->zoom;
}
bool LinkDestination::isChangeLeft() const
{
- return m_changeLeft;
+ return d->changeLeft;
}
bool LinkDestination::isChangeTop() const
{
- return m_changeTop;
+ return d->changeTop;
}
bool LinkDestination::isChangeZoom() const
{
- return m_changeZoom;
+ return d->changeZoom;
}
QString LinkDestination::toString() const
{
- QString s = QString::number( (qint8)m_kind );
- s += ";" + QString::number( m_pageNum );
- s += ";" + QString::number( m_left );
- s += ";" + QString::number( m_bottom );
- s += ";" + QString::number( m_right );
- s += ";" + QString::number( m_top );
- s += ";" + QString::number( m_zoom );
- s += ";" + QString::number( (qint8)m_changeLeft );
- s += ";" + QString::number( (qint8)m_changeTop );
- s += ";" + QString::number( (qint8)m_changeZoom );
+ QString s = QString::number( (qint8)d->kind );
+ s += ";" + QString::number( d->pageNum );
+ s += ";" + QString::number( d->left );
+ s += ";" + QString::number( d->bottom );
+ s += ";" + QString::number( d->right );
+ s += ";" + QString::number( d->top );
+ s += ";" + QString::number( d->zoom );
+ s += ";" + QString::number( (qint8)d->changeLeft );
+ s += ";" + QString::number( (qint8)d->changeTop );
+ s += ";" + QString::number( (qint8)d->changeZoom );
return s;
}
+ LinkDestination& LinkDestination::operator=(const LinkDestination &other)
+ {
+ if ( this == &other )
+ return *this;
+
+ d = other.d;
+ return *this;
+ }
+
// Link
Link::~Link()
{
+ delete d_ptr;
}
- Link::Link(const QRectF &linkArea) : m_linkArea(linkArea)
+ Link::Link(const QRectF &linkArea)
+ : d_ptr( new LinkPrivate( linkArea ) )
{
}
+ Link::Link( LinkPrivate &dd )
+ : d_ptr( &dd )
+ {
+ }
+
Link::LinkType Link::linkType() const
{
return None;
@@ -194,27 +344,38 @@ namespace Poppler {
QRectF Link::linkArea() const
{
- return m_linkArea;
+ Q_D( const Link );
+ return d->linkArea;
}
// LinkGoto
- LinkGoto::LinkGoto( const QRectF &linkArea, QString extFileName, const LinkDestination & destination ) : Link(linkArea), m_extFileName(extFileName), m_destination(destination)
+ LinkGoto::LinkGoto( const QRectF &linkArea, QString extFileName, const LinkDestination & destination )
+ : Link( *new LinkGotoPrivate( linkArea, destination ) )
+ {
+ Q_D( LinkGoto );
+ d->extFileName = extFileName;
+ }
+
+ LinkGoto::~LinkGoto()
{
}
bool LinkGoto::isExternal() const
{
- return !m_extFileName.isEmpty();
+ Q_D( const LinkGoto );
+ return !d->extFileName.isEmpty();
}
- const QString &LinkGoto::fileName() const
+ QString LinkGoto::fileName() const
{
- return m_extFileName;
+ Q_D( const LinkGoto );
+ return d->extFileName;
}
- const LinkDestination &LinkGoto::destination() const
+ LinkDestination LinkGoto::destination() const
{
- return m_destination;
+ Q_D( const LinkGoto );
+ return d->destination;
}
Link::LinkType LinkGoto::linkType() const
@@ -223,17 +384,27 @@ namespace Poppler {
}
// LinkExecute
- LinkExecute::LinkExecute( const QRectF &linkArea, const QString & file, const QString & params ) : Link(linkArea), m_fileName(file), m_parameters(params)
+ LinkExecute::LinkExecute( const QRectF &linkArea, const QString & file, const QString & params )
+ : Link( *new LinkExecutePrivate( linkArea ) )
{
+ Q_D( LinkExecute );
+ d->fileName = file;
+ d->parameters = params;
}
- const QString & LinkExecute::fileName() const
+ LinkExecute::~LinkExecute()
{
- return m_fileName;
}
- const QString & LinkExecute::parameters() const
+
+ QString LinkExecute::fileName() const
+ {
+ Q_D( const LinkExecute );
+ return d->fileName;
+ }
+ QString LinkExecute::parameters() const
{
- return m_parameters;
+ Q_D( const LinkExecute );
+ return d->parameters;
}
Link::LinkType LinkExecute::linkType() const
@@ -242,13 +413,21 @@ namespace Poppler {
}
// LinkBrowse
- LinkBrowse::LinkBrowse( const QRectF &linkArea, const QString &url ) : Link(linkArea), m_url(url)
+ LinkBrowse::LinkBrowse( const QRectF &linkArea, const QString &url )
+ : Link( *new LinkBrowsePrivate( linkArea ) )
{
+ Q_D( LinkBrowse );
+ d->url = url;
}
- const QString & LinkBrowse::url() const
+ LinkBrowse::~LinkBrowse()
{
- return m_url;
+ }
+
+ QString LinkBrowse::url() const
+ {
+ Q_D( const LinkBrowse );
+ return d->url;
}
Link::LinkType LinkBrowse::linkType() const
@@ -257,13 +436,17 @@ namespace Poppler {
}
// LinkAction
- LinkAction::LinkAction( const QRectF &linkArea, ActionType actionType ) : Link(linkArea), m_type(actionType)
+ LinkAction::LinkAction( const QRectF &linkArea, ActionType actionType )
+ : Link( *new LinkBrowsePrivate( linkArea ) )
{
+ Q_D( LinkAction );
+ d->type = actionType;
}
LinkAction::ActionType LinkAction::actionType() const
{
- return m_type;
+ Q_D( const LinkAction );
+ return d->type;
}
Link::LinkType LinkAction::linkType() const
@@ -272,13 +455,19 @@ namespace Poppler {
}
// LinkSound
- LinkSound::LinkSound( const QRectF &linkArea, double volume, bool sync, bool repeat, bool mix, SoundObject *sound ) : Link(linkArea), m_volume(volume), m_sync(sync), m_repeat(repeat), m_mix(mix), m_sound(sound)
+ LinkSound::LinkSound( const QRectF &linkArea, double volume, bool sync, bool repeat, bool mix, SoundObject *sound )
+ : Link( *new LinkSoundPrivate( linkArea ) )
{
+ Q_D( LinkSound );
+ d->volume = volume;
+ d->sync = sync;
+ d->repeat = repeat;
+ d->mix = mix;
+ d->sound = sound;
}
LinkSound::~LinkSound()
{
- delete m_sound;
}
Link::LinkType LinkSound::linkType() const
@@ -288,31 +477,41 @@ namespace Poppler {
double LinkSound::volume() const
{
- return m_volume;
+ Q_D( const LinkSound );
+ return d->volume;
}
bool LinkSound::synchronous() const
{
- return m_sync;
+ Q_D( const LinkSound );
+ return d->sync;
}
bool LinkSound::repeat() const
{
- return m_repeat;
+ Q_D( const LinkSound );
+ return d->repeat;
}
bool LinkSound::mix() const
{
- return m_mix;
+ Q_D( const LinkSound );
+ return d->mix;
}
SoundObject *LinkSound::sound() const
{
- return m_sound;
+ Q_D( const LinkSound );
+ return d->sound;
}
// LinkMovie
- LinkMovie::LinkMovie( const QRectF &linkArea ) : Link(linkArea)
+ LinkMovie::LinkMovie( const QRectF &linkArea )
+ : Link( *new LinkSoundPrivate( linkArea ) )
+ {
+ }
+
+ LinkMovie::~LinkMovie()
{
}
Index: qt4/src/poppler-link.h
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-link.h,v
retrieving revision 1.8
diff -u -p -r1.8 poppler-link.h
--- qt4/src/poppler-link.h 25 May 2007 23:17:58 -0000 1.8
+++ qt4/src/poppler-link.h 26 Aug 2007 00:05:57 -0000
@@ -23,10 +23,19 @@
#include <QtCore/QString>
#include <QtCore/QRectF>
+#include <QtCore/QSharedDataPointer>
namespace Poppler {
+class LinkPrivate;
+class LinkGotoPrivate;
+class LinkExecutePrivate;
+class LinkBrowsePrivate;
+class LinkActionPrivate;
+class LinkSoundPrivate;
+class LinkMoviePrivate;
class LinkDestinationData;
+class LinkDestinationPrivate;
class SoundObject;
/**
@@ -51,6 +60,8 @@ class LinkDestination
LinkDestination(const LinkDestinationData &data);
LinkDestination(const QString &description);
+ LinkDestination(const LinkDestination &other);
+ ~LinkDestination();
// Accessors.
Kind kind() const;
@@ -66,14 +77,10 @@ class LinkDestination
QString toString() const;
+ LinkDestination& operator=(const LinkDestination &other);
+
private:
- Kind m_kind; // destination type
- int m_pageNum; // page number
- double m_left, m_bottom; // position
- double m_right, m_top;
- double m_zoom; // zoom factor
- bool m_changeLeft, m_changeTop; // for destXYZ links, which position
- bool m_changeZoom; // components to change
+ QSharedDataPointer< LinkDestinationPrivate > d;
};
/**
@@ -121,8 +128,13 @@ class Link
*/
QRectF linkArea() const;
+ protected:
+ Link( LinkPrivate &dd );
+ Q_DECLARE_PRIVATE( Link )
+ LinkPrivate *d_ptr;
+
private:
- QRectF m_linkArea;
+ Q_DISABLE_COPY( Link )
};
@@ -131,6 +143,7 @@ class LinkGoto : public Link
{
public:
LinkGoto( const QRectF &linkArea, QString extFileName, const LinkDestination & destination );
+ ~LinkGoto();
/**
* Whether the destination is in an external document
@@ -138,13 +151,13 @@ class LinkGoto : public Link
*/
bool isExternal() const;
// query for goto parameters
- const QString & fileName() const;
- const LinkDestination & destination() const;
+ QString fileName() const;
+ LinkDestination destination() const;
LinkType linkType() const;
private:
- QString m_extFileName;
- LinkDestination m_destination;
+ Q_DECLARE_PRIVATE( LinkGoto )
+ Q_DISABLE_COPY( LinkGoto )
};
/** Execute: filename and parameters to execute **/
@@ -154,16 +167,17 @@ class LinkExecute : public Link
/**
* The file name to be executed
*/
- const QString & fileName() const;
- const QString & parameters() const;
+ QString fileName() const;
+ QString parameters() const;
// create a Link_Execute
LinkExecute( const QRectF &linkArea, const QString & file, const QString & params );
+ ~LinkExecute();
LinkType linkType() const;
private:
- QString m_fileName;
- QString m_parameters;
+ Q_DECLARE_PRIVATE( LinkExecute )
+ Q_DISABLE_COPY( LinkExecute )
};
/** Browse: an URL to open, ranging from 'http://' to 'mailto:', etc. **/
@@ -173,14 +187,16 @@ class LinkBrowse : public Link
/**
* The URL to open
*/
- const QString & url() const;
+ QString url() const;
// create a Link_Browse
LinkBrowse( const QRectF &linkArea, const QString &url );
+ ~LinkBrowse();
LinkType linkType() const;
private:
- QString m_url;
+ Q_DECLARE_PRIVATE( LinkBrowse )
+ Q_DISABLE_COPY( LinkBrowse )
};
/** Action: contains an action to perform on document / viewer **/
@@ -213,7 +229,8 @@ class LinkAction : public Link
LinkType linkType() const;
private:
- ActionType m_type;
+ Q_DECLARE_PRIVATE( LinkAction )
+ Q_DISABLE_COPY( LinkAction )
};
/** Sound: a sound to be played **/
@@ -247,11 +264,8 @@ class LinkSound : public Link
SoundObject *sound() const;
private:
- double m_volume;
- bool m_sync;
- bool m_repeat;
- bool m_mix;
- SoundObject *m_sound;
+ Q_DECLARE_PRIVATE( LinkSound )
+ Q_DISABLE_COPY( LinkSound )
};
/** Movie: Not yet defined -> think renaming to 'Media' link **/
@@ -260,7 +274,12 @@ class LinkMovie : public Link
{
public:
LinkMovie( const QRectF &linkArea );
+ ~LinkMovie();
LinkType linkType() const;
+
+ private:
+ Q_DECLARE_PRIVATE( LinkMovie )
+ Q_DISABLE_COPY( LinkMovie )
};
}
Index: qt4/src/poppler-qt4.h
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-qt4.h,v
retrieving revision 1.56
diff -u -p -r1.56 poppler-qt4.h
--- qt4/src/poppler-qt4.h 3 Jul 2007 13:22:54 -0000 1.56
+++ qt4/src/poppler-qt4.h 26 Aug 2007 00:05:57 -0000
@@ -72,13 +72,13 @@ namespace Poppler {
/**
Returns the text of this text box
*/
- const QString &text() const;
+ QString text() const;
/**
Returns the position of the text, in point, i.e., 1/72 of
an inch
*/
- const QRectF &boundingBox() const;
+ QRectF boundingBox() const;
TextBox *nextWord() const;
@@ -87,6 +87,8 @@ namespace Poppler {
bool hasSpaceAfter() const;
private:
+ Q_DISABLE_COPY(TextBox)
+
TextBoxData *m_data;
};
@@ -125,13 +127,13 @@ namespace Poppler {
/**
The name of the font. Can be QString::null if the font has no name
*/
- const QString &name() const;
+ QString name() const;
/**
The path of the font file used to represent this font on this system,
or a null string is the font is embedded
*/
- const QString &file() const;
+ QString file() const;
/**
Whether the font is embedded in the file, or not
@@ -165,7 +167,9 @@ namespace Poppler {
\sa type for a enumeration version
*/
- const QString typeName() const;
+ QString typeName() const;
+
+ FontInfo& operator=( const FontInfo &fi );
private:
FontInfoData *m_data;
@@ -185,8 +189,6 @@ namespace Poppler {
*/
EmbeddedFile(EmbFile *embfile);
- EmbeddedFile(const EmbeddedFile &ef);
-
~EmbeddedFile();
/**
@@ -236,6 +238,8 @@ namespace Poppler {
//QDataStream dataStream() const;
private:
+ Q_DISABLE_COPY(EmbeddedFile)
+
EmbeddedFileData *m_embeddedFile;
};
@@ -413,6 +417,8 @@ namespace Poppler {
QString label() const;
private:
+ Q_DISABLE_COPY(Page)
+
Page(const Document *doc, int index);
PageData *m_page;
};
@@ -508,7 +514,7 @@ namespace Poppler {
\param index the page number index
*/
- Page *page(int index) const{ return new Page(this, index); }
+ Page *page(int index) const;
/**
\overload
@@ -707,7 +713,7 @@ QString subject = m_doc->info("Subject")
\note there are two types of embedded document - this call
only accesses documents that are embedded at the document level.
*/
- const QList<EmbeddedFile*> &embeddedFiles() const;
+ QList<EmbeddedFile*> embeddedFiles() const;
/**
Whether there are any documents embedded in this PDF document.
@@ -795,6 +801,8 @@ QString subject = m_doc->info("Subject")
~Document();
private:
+ Q_DISABLE_COPY(Document)
+
DocumentData *m_doc;
Document(DocumentData *dataA);
@@ -898,6 +906,8 @@ height = dummy.height();
bool convert();
private:
+ Q_DISABLE_COPY(PSConverter)
+
PSConverter(DocumentData *document);
PSConverterData *m_data;
@@ -941,8 +951,6 @@ height = dummy.height();
*/
SoundObject(Sound *popplersound);
- SoundObject(const SoundObject &s);
-
~SoundObject();
/**
@@ -981,6 +989,8 @@ height = dummy.height();
SoundEncoding soundEncoding() const;
private:
+ Q_DISABLE_COPY(SoundObject)
+
SoundData *m_soundData;
};
Index: qt4/src/poppler-sound.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-sound.cc,v
retrieving revision 1.4
diff -u -p -r1.4 poppler-sound.cc
--- qt4/src/poppler-sound.cc 27 Apr 2007 22:41:10 -0000 1.4
+++ qt4/src/poppler-sound.cc 26 Aug 2007 00:05:57 -0000
@@ -59,13 +59,6 @@ SoundObject::SoundObject(Sound *popplers
m_soundData->m_soundObj = popplersound->copy();
}
-SoundObject::SoundObject(const SoundObject &s)
-{
- m_soundData = new SoundData();
- m_soundData->m_type = s.m_soundData->m_type;
- m_soundData->m_soundObj = s.m_soundData->m_soundObj->copy();
-}
-
SoundObject::~SoundObject()
{
delete m_soundData;
Index: qt4/src/poppler-textbox.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-textbox.cc,v
retrieving revision 1.4
diff -u -p -r1.4 poppler-textbox.cc
--- qt4/src/poppler-textbox.cc 27 Apr 2007 22:41:10 -0000 1.4
+++ qt4/src/poppler-textbox.cc 26 Aug 2007 00:05:57 -0000
@@ -33,12 +33,12 @@ TextBox::~TextBox()
delete m_data;
}
-const QString &TextBox::text() const
+QString TextBox::text() const
{
return m_data->text;
}
-const QRectF &TextBox::boundingBox() const
+QRectF TextBox::boundingBox() const
{
return m_data->bBox;
};
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
