added poppler-qt5 for Qt5 build (only for windows)

This commit is contained in:
Luis Ángel San Martín 2013-11-21 08:14:14 +01:00
parent 65461bf72d
commit f8dff1390f
43 changed files with 5241 additions and 6 deletions

View File

@ -5,8 +5,18 @@ INCLUDEPATH += $$PWD/../common \
$$PWD/../custom_widgets
win32 {
INCLUDEPATH += $$PWD/../dependencies/poppler/include
LIBS += -L$$PWD/../dependencies/poppler/lib -lpoppler-qt4 -loleaut32 -lole32
LIBS += -L$$PWD/../dependencies/poppler/lib -loleaut32 -lole32
isEqual(QT_MAJOR_VERSION, 5) {
LIBS += -lpoppler-qt5
INCLUDEPATH += ../dependencies/poppler/include/qt5
}
else
{
LIBS += -lpoppler-qt4
INCLUDEPATH += ../dependencies/poppler/include/qt4
}
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
QMAKE_LFLAGS_RELEASE += /LTCG
CONFIG -= embed_manifest_exe

View File

@ -16,8 +16,19 @@ INCLUDEPATH += ../common \
DEFINES += SERVER_RELEASE NOMINMAX
win32 {
INCLUDEPATH += ../dependencies/poppler/include
LIBS += -L../dependencies/poppler/lib -lpoppler-qt4 -loleaut32 -lole32
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32
isEqual(QT_MAJOR_VERSION, 5) {
LIBS += -lpoppler-qt5
INCLUDEPATH += ../dependencies/poppler/include/qt5
}
else
{
LIBS += -lpoppler-qt4
INCLUDEPATH += ../dependencies/poppler/include/qt4
}
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
QMAKE_LFLAGS_RELEASE += /LTCG
CONFIG -= embed_manifest_exe

View File

@ -17,7 +17,11 @@
#include <algorithm>
using namespace std;
#include "poppler-qt4.h"
#if QT_VERSION >= 0x050000
#include "poppler-qt5.h"
#else
#include "poppler-qt4.h"
#endif
//--------------------------------------------------------------------------------
LibraryCreator::LibraryCreator()

View File

@ -10,7 +10,11 @@
#include "bookmarks.h"
#include "poppler-qt4.h"
#if QT_VERSION >= 0x050000
#include "poppler-qt5.h"
#else
#include "poppler-qt4.h"
#endif
class ComicDB;
//#define EXTENSIONS << "*.jpg" << "*.jpeg" << "*.png" << "*.gif" << "*.tiff" << "*.tif" << "*.bmp" Comic::getSupportedImageFormats()

BIN
dependencies/poppler/bin/poppler-qt5.dll vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,170 @@
//========================================================================
//
// ArthurOutputDev.h
//
// Copyright 2003 Glyph & Cog, LLC
//
//========================================================================
//========================================================================
//
// Modified under the Poppler project - http://poppler.freedesktop.org
//
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
// Copyright (C) 2005 Brad Hards <bradh@frogmouth.net>
// Copyright (C) 2005 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2009, 2011 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright (C) 2010 Pino Toscano <pino@kde.org>
// Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com>
// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
//
//========================================================================
#ifndef ARTHUROUTPUTDEV_H
#define ARTHUROUTPUTDEV_H
#ifdef USE_GCC_PRAGMAS
#pragma interface
#endif
#include "goo/gtypes.h"
#include "OutputDev.h"
#include "GfxState.h"
#include <QtGui/QPainter>
class GfxState;
class GfxPath;
class Gfx8BitFont;
struct GfxRGB;
class SplashFont;
class SplashFontEngine;
struct SplashGlyphBitmap;
//------------------------------------------------------------------------
// ArthurOutputDev - Qt 4 QPainter renderer
//------------------------------------------------------------------------
class ArthurOutputDev: public OutputDev {
public:
/**
* Describes how fonts are distorted (aka hinted) to fit the pixel grid.
* More hinting means sharper edges and less adherence to the true letter shapes.
*/
enum FontHinting {
NoHinting = 0, ///< Font shapes are left unchanged
SlightHinting, ///< Font shapes are distorted vertically only
FullHinting ///< Font shapes are distorted horizontally and vertically
};
// Constructor.
ArthurOutputDev(QPainter *painter );
// Destructor.
virtual ~ArthurOutputDev();
void setFontHinting(FontHinting hinting) { m_fontHinting = hinting; }
//----- get info about output device
// Does this device use upside-down coordinates?
// (Upside-down means (0,0) is the top left corner of the page.)
virtual GBool upsideDown() { return gTrue; }
// Does this device use drawChar() or drawString()?
virtual GBool useDrawChar() { return gTrue; }
// Does this device use beginType3Char/endType3Char? Otherwise,
// text in Type 3 fonts will be drawn with drawChar/drawString.
virtual GBool interpretType3Chars() { return gTrue; }
//----- initialization and control
// Start a page.
virtual void startPage(int pageNum, GfxState *state, XRef *xref);
// End a page.
virtual void endPage();
//----- save/restore graphics state
virtual void saveState(GfxState *state);
virtual void restoreState(GfxState *state);
//----- update graphics state
virtual void updateAll(GfxState *state);
virtual void updateCTM(GfxState *state, double m11, double m12,
double m21, double m22, double m31, double m32);
virtual void updateLineDash(GfxState *state);
virtual void updateFlatness(GfxState *state);
virtual void updateLineJoin(GfxState *state);
virtual void updateLineCap(GfxState *state);
virtual void updateMiterLimit(GfxState *state);
virtual void updateLineWidth(GfxState *state);
virtual void updateFillColor(GfxState *state);
virtual void updateStrokeColor(GfxState *state);
virtual void updateFillOpacity(GfxState *state);
virtual void updateStrokeOpacity(GfxState *state);
//----- update text state
virtual void updateFont(GfxState *state);
//----- path painting
virtual void stroke(GfxState *state);
virtual void fill(GfxState *state);
virtual void eoFill(GfxState *state);
//----- path clipping
virtual void clip(GfxState *state);
virtual void eoClip(GfxState *state);
//----- text drawing
// virtual void drawString(GfxState *state, GooString *s);
virtual void drawChar(GfxState *state, double x, double y,
double dx, double dy,
double originX, double originY,
CharCode code, int nBytes, Unicode *u, int uLen);
virtual GBool beginType3Char(GfxState *state, double x, double y,
double dx, double dy,
CharCode code, Unicode *u, int uLen);
virtual void endType3Char(GfxState *state);
virtual void endTextObject(GfxState *state);
//----- image drawing
virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
int width, int height, GBool invert,
GBool interpolate, GBool inlineImg);
virtual void drawImage(GfxState *state, Object *ref, Stream *str,
int width, int height, GfxImageColorMap *colorMap,
GBool interpolate, int *maskColors, GBool inlineImg);
//----- Type 3 font operators
virtual void type3D0(GfxState *state, double wx, double wy);
virtual void type3D1(GfxState *state, double wx, double wy,
double llx, double lly, double urx, double ury);
//----- special access
// Called to indicate that a new PDF document has been loaded.
void startDoc(XRef *xrefA);
GBool isReverseVideo() { return gFalse; }
private:
QPainter *m_painter;
FontHinting m_fontHinting;
QFont m_currentFont;
QPen m_currentPen;
QBrush m_currentBrush;
GBool m_needFontUpdate; // set when the font needs to be updated
SplashFontEngine *m_fontEngine;
SplashFont *m_font; // current font
XRef *xref; // xref table for current document
};
#endif

View File

@ -0,0 +1,198 @@
/* poppler-annotation-helper.h: qt interface to poppler
* Copyright (C) 2006, 2008, Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2008, Pino Toscano <pino@kde.org>
* Copyright (C) 2012, Fabio D'Urso <fabiodurso@hotmail.it>
* Adapting code from
* Copyright (C) 2004 by Enrico Ros <eros.kde@email.it>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <QtCore/QDebug>
#include <Object.h>
class QColor;
class AnnotColor;
namespace Poppler {
class XPDFReader
{
public:
// find named symbol and parse it
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 );
static inline void invTransform( double * M, const QPointF &p, double &x, double &y );
};
void XPDFReader::lookupName( Dict * dict, char * type, QString & dest )
{
Object nameObj;
dict->lookup( type, &nameObj );
if ( nameObj.isNull() )
return;
if ( nameObj.isName() )
dest = nameObj.getName();
else
qDebug() << type << " is not Name." << endl;
nameObj.free();
}
void XPDFReader::lookupString( Dict * dict, char * type, QString & dest )
{
Object stringObj;
dict->lookup( type, &stringObj );
if ( stringObj.isNull() )
return;
if ( stringObj.isString() )
dest = stringObj.getString()->getCString();
else
qDebug() << type << " is not String." << endl;
stringObj.free();
}
void XPDFReader::lookupBool( Dict * dict, char * type, bool & dest )
{
Object boolObj;
dict->lookup( type, &boolObj );
if ( boolObj.isNull() )
return;
if ( boolObj.isBool() )
dest = boolObj.getBool() == gTrue;
else
qDebug() << type << " is not Bool." << endl;
boolObj.free();
}
void XPDFReader::lookupInt( Dict * dict, char * type, int & dest )
{
Object intObj;
dict->lookup( type, &intObj );
if ( intObj.isNull() )
return;
if ( intObj.isInt() )
dest = intObj.getInt();
else
qDebug() << type << " is not Int." << endl;
intObj.free();
}
void XPDFReader::lookupNum( Dict * dict, char * type, double & dest )
{
Object numObj;
dict->lookup( type, &numObj );
if ( numObj.isNull() )
return;
if ( numObj.isNum() )
dest = numObj.getNum();
else
qDebug() << type << " is not Num." << endl;
numObj.free();
}
int XPDFReader::lookupNumArray( Dict * dict, char * type, double * dest, int len )
{
Object arrObj;
dict->lookup( type, &arrObj );
if ( arrObj.isNull() )
return 0;
Object numObj;
if ( arrObj.isArray() )
{
len = qMin( len, arrObj.arrayGetLength() );
for ( int i = 0; i < len; i++ )
{
dest[i] = arrObj.arrayGet( i, &numObj )->getNum();
numObj.free();
}
}
else
{
len = 0;
qDebug() << type << "is not Array." << endl;
}
arrObj.free();
return len;
}
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, char * type, int & dest )
{
Object refObj;
dict->lookupNF( type, &refObj );
if ( refObj.isNull() )
return;
if ( refObj.isRef() )
dest = refObj.getRefNum();
else
qDebug() << type << " is not Ref." << endl;
refObj.free();
}
void XPDFReader::lookupDate( Dict * dict, char * type, QDateTime & dest )
{
Object dateObj;
dict->lookup( type, &dateObj );
if ( dateObj.isNull() )
return;
if ( dateObj.isString() )
{
dest = convertDate( dateObj.getString()->getCString() );
}
else
qDebug() << type << " is not Date" << endl;
dateObj.free();
}
void XPDFReader::transform( double * M, double x, double y, QPointF &res )
{
res.setX( M[0] * x + M[2] * y + M[4] );
res.setY( M[1] * x + M[3] * y + M[5] );
}
void XPDFReader::invTransform( double * M, const QPointF &p, double &x, double &y )
{
const double det = M[0]*M[3] - M[1]*M[2];
Q_ASSERT(det != 0);
const double invM[4] = { M[3]/det, -M[1]/det, -M[2]/det, M[0]/det };
const double xt = p.x() - M[4];
const double yt = p.y() - M[5];
x = invM[0] * xt + invM[2] * yt;
y = invM[1] * xt + invM[3] * yt;
}
QColor convertAnnotColor( AnnotColor *color );
AnnotColor* convertQColor( const QColor &color );
}

View File

@ -0,0 +1,112 @@
/* poppler-annotation-private.h: qt interface to poppler
* Copyright (C) 2007, Pino Toscano <pino@kde.org>
* Copyright (C) 2012, Tobias Koenig <tokoe@kdab.com>
* Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it>
* Copyright (C) 2012, Albert Astals Cid <aacid@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _POPPLER_ANNOTATION_PRIVATE_H_
#define _POPPLER_ANNOTATION_PRIVATE_H_
#include <QtCore/QLinkedList>
#include <QtCore/QPointF>
#include <QtCore/QSharedDataPointer>
#include "poppler-annotation.h"
#include <Object.h>
class Annot;
class AnnotPath;
class Link;
class Page;
class PDFRectangle;
namespace Poppler
{
class DocumentData;
class AnnotationPrivate : public QSharedData
{
public:
AnnotationPrivate();
virtual ~AnnotationPrivate();
void addRevision(Annotation *ann, Annotation::RevScope scope, Annotation::RevType type);
/* Returns an Annotation of the right subclass whose d_ptr points to
* this AnnotationPrivate */
virtual Annotation * makeAlias() = 0;
/* properties: contents related */
QString author;
QString contents;
QString uniqueName;
QDateTime modDate; // before or equal to currentDateTime()
QDateTime creationDate; // before or equal to modifyDate
/* properties: look/interaction related */
int flags;
QRectF boundary;
/* style and popup */
Annotation::Style style;
Annotation::Popup popup;
/* revisions */
Annotation::RevScope revisionScope;
Annotation::RevType revisionType;
QList<Annotation*> revisions;
/* After this call, the Annotation object will behave like a wrapper for
* the specified Annot object. All cached values are discarded */
void tieToNativeAnnot(Annot *ann, ::Page *page, DocumentData *doc);
/* Creates a new Annot object on the specified page, flushes current
* values to that object and ties this Annotation to that object */
virtual Annot* createNativeAnnot(::Page *destPage, DocumentData *doc) = 0;
/* Inited to 0 (i.e. untied annotation) */
Annot *pdfAnnot;
::Page *pdfPage;
DocumentData * parentDoc;
/* The following helpers only work if pdfPage is set */
void flushBaseAnnotationProperties();
void fillNormalizationMTX(double MTX[6], int pageRotation) const;
void fillTransformationMTX(double MTX[6]) const;
QRectF fromPdfRectangle(const PDFRectangle &r) const;
PDFRectangle boundaryToPdfRectangle(const QRectF &r, int flags) const;
AnnotPath * toAnnotPath(const QLinkedList<QPointF> &l) const;
/* Scan page for annotations, parentId=0 searches for root annotations */
static QList<Annotation*> findAnnotations(::Page *pdfPage, DocumentData *doc, int parentId = 0);
/* Add given annotation to given page */
static void addAnnotationToPage(::Page *pdfPage, DocumentData *doc, const Annotation * ann);
/* Remove annotation from page and destroy ann */
static void removeAnnotationFromPage(::Page *pdfPage, const Annotation * ann);
Ref pdfObjectReference() const;
Link* additionalAction( Annotation::AdditionalActionType type ) const;
};
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,49 @@
/* poppler-converter-private.h: Qt interface to poppler
* Copyright (C) 2007, 2009, Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2008, Pino Toscano <pino@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef POPPLER_QT5_CONVERTER_PRIVATE_H
#define POPPLER_QT5_CONVERTER_PRIVATE_H
#include <QtCore/QString>
class QIODevice;
namespace Poppler {
class DocumentData;
class BaseConverterPrivate
{
public:
BaseConverterPrivate();
virtual ~BaseConverterPrivate();
QIODevice* openDevice();
void closeDevice();
DocumentData *document;
QString outputFileName;
QIODevice *iodev;
bool ownIodev : 1;
BaseConverter::Error lastError;
};
}
#endif

View File

@ -0,0 +1,42 @@
/* poppler-embeddedfile-private.h: Qt interface to poppler
* Copyright (C) 2005, 2008, 2009, 2012, Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2005, Brad Hards <bradh@frogmouth.net>
* Copyright (C) 2008, 2011, Pino Toscano <pino@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef POPPLER_EMBEDDEDFILE_PRIVATE_H
#define POPPLER_EMBEDDEDFILE_PRIVATE_H
class FileSpec;
namespace Poppler
{
class EmbeddedFileData
{
public:
EmbeddedFileData(FileSpec *fs);
~EmbeddedFileData();
EmbFile *embFile() const;
FileSpec *filespec;
};
}
#endif

View File

@ -0,0 +1,17 @@
/*
* This file is used to set the poppler_qt5_EXPORT macros right.
* This is needed for setting the visibility on windows, it will have no effect on other platforms.
*/
#if defined(_WIN32)
# define LIB_EXPORT __declspec(dllexport)
# define LIB_IMPORT __declspec(dllimport)
#else
# define LIB_EXPORT
# define LIB_IMPORT
#endif
#ifdef poppler_qt5_EXPORTS
# define POPPLER_QT5_EXPORT LIB_EXPORT
#else
# define POPPLER_QT5_EXPORT LIB_IMPORT
#endif

View File

@ -0,0 +1,343 @@
/* poppler-form.h: qt interface to poppler
* Copyright (C) 2007-2008, Pino Toscano <pino@kde.org>
* Copyright (C) 2008, 2011, Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2012, Adam Reichold <adamreichold@myopera.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _POPPLER_QT5_FORM_H_
#define _POPPLER_QT5_FORM_H_
#include <QtCore/QRectF>
#include <QtCore/QStringList>
#include "poppler-export.h"
class Page;
class FormWidget;
class FormWidgetButton;
class FormWidgetText;
class FormWidgetChoice;
namespace Poppler {
class DocumentData;
class Link;
class FormFieldData;
/**
The base class representing a form field.
\since 0.6
*/
class POPPLER_QT5_EXPORT FormField {
public:
/**
The different types of form field.
*/
enum FormType {
FormButton, ///< A button field. See \ref Poppler::FormFieldButton::ButtonType "ButtonType"
FormText, ///< A text field. See \ref Poppler::FormFieldText::TextType "TextType"
FormChoice, ///< A single choice field. See \ref Poppler::FormFieldChoice::ChoiceType "ChoiceType"
FormSignature ///< A signature field.
};
virtual ~FormField();
/**
The type of the field.
*/
virtual FormType type() const = 0;
/**
\return The size of the field, in normalized coordinates, i.e.
[0..1] with regard to the dimensions (cropbox) of the page
*/
QRectF rect() const;
/**
The ID of the field.
*/
int id() const;
/**
The internal name of the field.
*/
QString name() const;
/**
The internal fully qualified name of the field.
\since 0.18
*/
QString fullyQualifiedName() const;
/**
The name of the field to be used in user interface (eg messages to
the user).
*/
QString uiName() const;
/**
Whether this form field is read-only.
*/
bool isReadOnly() const;
/**
Whether this form field is visible.
*/
bool isVisible() const;
/**
The activation action of this form field.
\note It may be null.
*/
Link* activationAction() const;
protected:
/// \cond PRIVATE
FormField(FormFieldData &dd);
FormFieldData *m_formData;
/// \endcond
private:
Q_DISABLE_COPY(FormField)
};
/**
A form field that represents a "button".
\since 0.8
*/
class POPPLER_QT5_EXPORT FormFieldButton : public FormField {
public:
/**
* The types of button field.
*/
enum ButtonType
{
Push, ///< A simple push button.
CheckBox, ///< A check box.
Radio ///< A radio button.
};
/// \cond PRIVATE
FormFieldButton(DocumentData *doc, ::Page *p, ::FormWidgetButton *w);
/// \endcond
virtual ~FormFieldButton();
virtual FormType type() const;
/**
The particular type of the button field.
*/
ButtonType buttonType() const;
/**
* The caption to be used for the button.
*/
QString caption() const;
/**
The state of the button.
*/
bool state() const;
/**
Sets the state of the button to the new \p state .
*/
void setState( bool state );
/**
The list with the IDs of siblings (ie, buttons belonging to the same
group as the current one.
Valid only for \ref Radio buttons, an empty list otherwise.
*/
QList<int> siblings() const;
private:
Q_DISABLE_COPY(FormFieldButton)
};
/**
A form field that represents a text input.
\since 0.6
*/
class POPPLER_QT5_EXPORT FormFieldText : public FormField {
public:
/**
The particular type of this text field.
*/
enum TextType {
Normal, ///< A simple singleline text field.
Multiline, ///< A multiline text field.
FileSelect ///< An input field to select the path of a file on disk.
};
/// \cond PRIVATE
FormFieldText(DocumentData *doc, ::Page *p, ::FormWidgetText *w);
/// \endcond
virtual ~FormFieldText();
virtual FormType type() const;
/**
The text type of the text field.
*/
TextType textType() const;
/**
The text associated with the text field.
*/
QString text() const;
/**
Sets the text associated with the text field to the specified
\p text.
*/
void setText( const QString& text );
/**
Whether this text field is a password input, eg its text \b must be
replaced with asterisks.
Always false for \ref FileSelect text fields.
*/
bool isPassword() const;
/**
Whether this text field should allow rich text.
*/
bool isRichText() const;
/**
The maximum length for the text of this field, or -1 if not set.
*/
int maximumLength() const;
/**
The horizontal alignment for the text of this text field.
*/
Qt::Alignment textAlignment() const;
/**
Whether the text inserted manually in the field (where possible)
can be spell-checked.
*/
bool canBeSpellChecked() const;
private:
Q_DISABLE_COPY(FormFieldText)
};
/**
A form field that represents a choice field.
\since 0.6
*/
class POPPLER_QT5_EXPORT FormFieldChoice : public FormField {
public:
/**
The particular type of this choice field.
*/
enum ChoiceType {
ComboBox, ///< A simple singleline text field.
ListBox ///< A multiline text field.
};
/// \cond PRIVATE
FormFieldChoice(DocumentData *doc, ::Page *p, ::FormWidgetChoice *w);
/// \endcond
virtual ~FormFieldChoice();
virtual FormType type() const;
/**
The choice type of the choice field.
*/
ChoiceType choiceType() const;
/**
The possible choices of the choice field.
*/
QStringList choices() const;
/**
Whether this FormFieldChoice::ComboBox is editable, i.e. the user
can type in a custom value.
Always false for the other types of choices.
*/
bool isEditable() const;
/**
Whether more than one choice of this FormFieldChoice::ListBox
can be selected at the same time.
Always false for the other types of choices.
*/
bool multiSelect() const;
/**
The currently selected choices.
*/
QList<int> currentChoices() const;
/**
Sets the selected choices to \p choice.
*/
void setCurrentChoices( const QList<int> &choice );
/**
The text entered into an editable combo box choice field. Otherwise a null string.
\since 0.22
*/
QString editChoice() const;
/**
Sets the text entered into an editable combo box choice field. Otherwise does nothing.
\since 0.22
*/
void setEditChoice(const QString& text);
/**
The horizontal alignment for the text of this text field.
*/
Qt::Alignment textAlignment() const;
/**
Whether the text inserted manually in the field (where possible)
can be spell-checked.
Returns false if the field is not an editable text field.
*/
bool canBeSpellChecked() const;
private:
Q_DISABLE_COPY(FormFieldChoice)
};
}
#endif

View File

@ -0,0 +1,57 @@
/* poppler-link-extractor_p.h: qt interface to poppler
* Copyright (C) 2007, 2008, 2011, Pino Toscano <pino@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _POPPLER_LINK_EXTRACTOR_H_
#define _POPPLER_LINK_EXTRACTOR_H_
#include <Object.h>
#include <OutputDev.h>
#include <QtCore/QList>
namespace Poppler
{
class Link;
class PageData;
class LinkExtractorOutputDev : public OutputDev
{
public:
LinkExtractorOutputDev(PageData *data);
virtual ~LinkExtractorOutputDev();
// inherited from OutputDev
virtual GBool upsideDown() { return gFalse; }
virtual GBool useDrawChar() { return gFalse; }
virtual GBool interpretType3Chars() { return gFalse; }
virtual void processLink(::AnnotLink *link);
// our stuff
QList< Link* > links();
private:
PageData *m_data;
double m_pageCropWidth;
double m_pageCropHeight;
QList< Link* > m_links;
};
}
#endif

View File

@ -0,0 +1,602 @@
/* poppler-link.h: qt interface to poppler
* Copyright (C) 2006, 2013, Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2007-2008, 2010, Pino Toscano <pino@kde.org>
* Copyright (C) 2010, 2012, Guillermo Amaral <gamaral@kdab.com>
* Copyright (C) 2012, Tobias Koenig <tokoe@kdab.com>
* Copyright (C) 2013, Anthony Granger <grangeranthony@gmail.com>
* Adapting code from
* Copyright (C) 2004 by Enrico Ros <eros.kde@email.it>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _POPPLER_LINK_H_
#define _POPPLER_LINK_H_
#include <QtCore/QString>
#include <QtCore/QRectF>
#include <QtCore/QSharedDataPointer>
#include "poppler-export.h"
struct Ref;
class MediaRendition;
namespace Poppler {
class LinkPrivate;
class LinkGotoPrivate;
class LinkExecutePrivate;
class LinkBrowsePrivate;
class LinkActionPrivate;
class LinkSoundPrivate;
class LinkJavaScriptPrivate;
class LinkMoviePrivate;
class LinkDestinationData;
class LinkDestinationPrivate;
class LinkRenditionPrivate;
class MediaRendition;
class SoundObject;
/**
* \short A destination.
*
* The LinkDestination class represent a "destination" (in terms of visual
* viewport to be displayed) for \link Poppler::LinkGoto GoTo\endlink links,
* and items in the table of contents (TOC) of a document.
*
* Coordinates are in 0..1 range
*/
class POPPLER_QT5_EXPORT LinkDestination
{
public:
/**
* The possible kind of "viewport destination".
*/
enum Kind
{
/**
* The new viewport is specified in terms of:
* - possibile new left coordinate (see isChangeLeft() )
* - possibile new top coordinate (see isChangeTop() )
* - possibile new zoom level (see isChangeZoom() )
*/
destXYZ = 1,
destFit = 2,
destFitH = 3,
destFitV = 4,
destFitR = 5,
destFitB = 6,
destFitBH = 7,
destFitBV = 8
};
/// \cond PRIVATE
LinkDestination(const LinkDestinationData &data);
LinkDestination(const QString &description);
/// \endcond
/**
* Copy constructor.
*/
LinkDestination(const LinkDestination &other);
/**
* Destructor.
*/
~LinkDestination();
// Accessors.
/**
* The kind of destination.
*/
Kind kind() const;
/**
* Which page is the target of this destination.
*
* \note this number is 1-based, so for a 5 pages document the
* valid page numbers go from 1 to 5 (both included).
*/
int pageNumber() const;
/**
* The new left for the viewport of the target page, in case
* it is specified to be changed (see isChangeLeft() )
*/
double left() const;
double bottom() const;
double right() const;
/**
* The new top for the viewport of the target page, in case
* it is specified to be changed (see isChangeTop() )
*/
double top() const;
double zoom() const;
/**
* Whether the left of the viewport on the target page should
* be changed.
*
* \see left()
*/
bool isChangeLeft() const;
/**
* Whether the top of the viewport on the target page should
* be changed.
*
* \see top()
*/
bool isChangeTop() const;
/**
* Whether the zoom level should be changed.
*
* \see zoom()
*/
bool isChangeZoom() const;
/**
* Return a string repesentation of this destination.
*/
QString toString() const;
/**
* Return the name of this destination.
*
* \since 0.12
*/
QString destinationName() const;
/**
* Assignment operator.
*/
LinkDestination& operator=(const LinkDestination &other);
private:
QSharedDataPointer< LinkDestinationPrivate > d;
};
/**
* \short Encapsulates data that describes a link.
*
* This is the base class for links. It makes mandatory for inherited
* kind of links to reimplement the linkType() method and return the type of
* the link described by the reimplemented class.
*/
class POPPLER_QT5_EXPORT Link
{
public:
/// \cond PRIVATE
Link( const QRectF &linkArea );
/// \endcond
/**
* The possible kinds of link.
*
* Inherited classes must return an unique identifier
*/
enum LinkType
{
None, ///< Unknown link
Goto, ///< A "Go To" link
Execute, ///< A command to be executed
Browse, ///< An URL to be browsed (eg "http://poppler.freedesktop.org")
Action, ///< A "standard" action to be executed in the viewer
Sound, ///< A link representing a sound to be played
Movie, ///< An action to be executed on a movie
Rendition, ///< A rendition link \since 0.20
JavaScript ///< A JavaScript code to be interpreted \since 0.10
};
/**
* The type of this link.
*/
virtual LinkType linkType() const;
/**
* Destructor.
*/
virtual ~Link();
/**
* The area of a Page where the link should be active.
*
* \note this can be a null rect, in this case the link represents
* a general action. The area is given in 0..1 range
*/
QRectF linkArea() const;
protected:
/// \cond PRIVATE
Link( LinkPrivate &dd );
Q_DECLARE_PRIVATE( Link )
LinkPrivate *d_ptr;
/// \endcond
private:
Q_DISABLE_COPY( Link )
};
/**
* \brief Viewport reaching request.
*
* With a LinkGoto link, the document requests the specified viewport to be
* reached (aka, displayed in a viewer). Furthermore, if a file name is specified,
* then the destination refers to that document (and not to the document the
* current LinkGoto belongs to).
*/
class POPPLER_QT5_EXPORT LinkGoto : public Link
{
public:
/**
* Create a new Goto link.
*
* \param linkArea the active area of the link
* \param extFileName if not empty, the file name to be open
* \param destination the destination to be reached
*/
LinkGoto( const QRectF &linkArea, QString extFileName, const LinkDestination & destination );
/**
* Destructor.
*/
~LinkGoto();
/**
* Whether the destination is in an external document
* (i.e. not the current document)
*/
bool isExternal() const;
// query for goto parameters
/**
* The file name of the document the destination() refers to,
* or an empty string in case it refers to the current document.
*/
QString fileName() const;
/**
* The destination to reach.
*/
LinkDestination destination() const;
LinkType linkType() const;
private:
Q_DECLARE_PRIVATE( LinkGoto )
Q_DISABLE_COPY( LinkGoto )
};
/**
* \brief Generic execution request.
*
* The LinkExecute link represent a "file name" execution request. The result
* depends on the \link fileName() file name\endlink:
* - if it is a document, then it is requested to be open
* - otherwise, it represents an executable to be run with the specified parameters
*/
class POPPLER_QT5_EXPORT LinkExecute : public Link
{
public:
/**
* The file name to be executed
*/
QString fileName() const;
/**
* The parameters for the command.
*/
QString parameters() const;
/**
* Create a new Execute link.
*
* \param linkArea the active area of the link
* \param file the file name to be open, or the program to be execute
* \param params the parameters for the program to execute
*/
LinkExecute( const QRectF &linkArea, const QString & file, const QString & params );
/**
* Destructor.
*/
~LinkExecute();
LinkType linkType() const;
private:
Q_DECLARE_PRIVATE( LinkExecute )
Q_DISABLE_COPY( LinkExecute )
};
/**
* \brief An URL to browse.
*
* The LinkBrowse link holds a URL (eg 'http://poppler.freedesktop.org',
* 'mailto:john@some.org', etc) to be open.
*
* The format of the URL is specified by RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt)
*/
class POPPLER_QT5_EXPORT LinkBrowse : public Link
{
public:
/**
* The URL to open
*/
QString url() const;
/**
* Create a new browse link.
*
* \param linkArea the active area of the link
* \param url the URL to be open
*/
LinkBrowse( const QRectF &linkArea, const QString &url );
/**
* Destructor.
*/
~LinkBrowse();
LinkType linkType() const;
private:
Q_DECLARE_PRIVATE( LinkBrowse )
Q_DISABLE_COPY( LinkBrowse )
};
/**
* \brief "Standard" action request.
*
* The LinkAction class represents a link that request a "standard" action
* to be performed by the viewer on the displayed document.
*/
class POPPLER_QT5_EXPORT LinkAction : public Link
{
public:
/**
* The possible types of actions
*/
enum ActionType { PageFirst = 1,
PagePrev = 2,
PageNext = 3,
PageLast = 4,
HistoryBack = 5,
HistoryForward = 6,
Quit = 7,
Presentation = 8,
EndPresentation = 9,
Find = 10,
GoToPage = 11,
Close = 12,
Print = 13 ///< \since 0.16
};
/**
* The action of the current LinkAction
*/
ActionType actionType() const;
/**
* Create a new Action link, that executes a specified action
* on the document.
*
* \param linkArea the active area of the link
* \param actionType which action should be executed
*/
LinkAction( const QRectF &linkArea, ActionType actionType );
/**
* Destructor.
*/
~LinkAction();
LinkType linkType() const;
private:
Q_DECLARE_PRIVATE( LinkAction )
Q_DISABLE_COPY( LinkAction )
};
/**
* Sound: a sound to be played.
*
* \since 0.6
*/
class POPPLER_QT5_EXPORT LinkSound : public Link
{
public:
// create a Link_Sound
LinkSound( const QRectF &linkArea, double volume, bool sync, bool repeat, bool mix, SoundObject *sound );
/**
* Destructor.
*/
virtual ~LinkSound();
LinkType linkType() const;
/**
* The volume to be used when playing the sound.
*
* The volume is in the range [ -1, 1 ], where:
* - a negative number: no volume (mute)
* - 1: full volume
*/
double volume() const;
/**
* Whether the playback of the sound should be synchronous
* (thus blocking, waiting for the end of the sound playback).
*/
bool synchronous() const;
/**
* Whether the sound should be played continuously (that is,
* started again when it ends)
*/
bool repeat() const;
/**
* Whether the playback of this sound can be mixed with
* playbacks with other sounds of the same document.
*
* \note When false, any other playback must be stopped before
* playing the sound.
*/
bool mix() const;
/**
* The sound object to be played
*/
SoundObject *sound() const;
private:
Q_DECLARE_PRIVATE( LinkSound )
Q_DISABLE_COPY( LinkSound )
};
/**
* Rendition: Rendition link.
*
* \since 0.20
*/
class POPPLER_QT5_EXPORT LinkRendition : public Link
{
public:
/**
* Describes the possible rendition actions.
*
* \since 0.22
*/
enum RenditionAction {
NoRendition,
PlayRendition,
StopRendition,
PauseRendition,
ResumeRendition
};
/**
* Create a new rendition link.
*
* \param linkArea the active area of the link
* \param rendition the media rendition object. Ownership is taken
* \param operation the numeric operation (action) (@see ::LinkRendition::RenditionOperation)
* \param script the java script code
* \param annotationReference the object reference of the screen annotation associated with this rendition action
* \since 0.22
*/
LinkRendition( const QRectF &linkArea, ::MediaRendition *rendition, int operation, const QString &script, const Ref &annotationReference );
/**
* Destructor.
*/
virtual ~LinkRendition();
LinkType linkType() const;
/**
* Returns the media rendition object if the redition provides one, @c 0 otherwise
*/
MediaRendition *rendition() const;
/**
* Returns the action that should be executed if a rendition object is provided.
*
* \since 0.22
*/
RenditionAction action() const;
/**
* The JS code that shall be executed or an empty string.
*
* \since 0.22
*/
QString script() const;
/**
* Returns whether the given @p annotation is the referenced screen annotation for this rendition @p link.
*
* \since 0.22
*/
bool isReferencedAnnotation( const ScreenAnnotation *annotation ) const;
private:
Q_DECLARE_PRIVATE( LinkRendition )
Q_DISABLE_COPY( LinkRendition )
};
/**
* JavaScript: a JavaScript code to be interpreted.
*
* \since 0.10
*/
class POPPLER_QT5_EXPORT LinkJavaScript : public Link
{
public:
/**
* Create a new JavaScript link.
*
* \param linkArea the active area of the link
* \param js the JS code to be interpreted
*/
LinkJavaScript( const QRectF &linkArea, const QString &js );
/**
* Destructor.
*/
virtual ~LinkJavaScript();
LinkType linkType() const;
/**
* The JS code
*/
QString script() const;
private:
Q_DECLARE_PRIVATE( LinkJavaScript )
Q_DISABLE_COPY( LinkJavaScript )
};
/**
* Movie: a movie to be played.
*
* \since 0.20
*/
class POPPLER_QT5_EXPORT LinkMovie : public Link
{
public:
/**
* Describes the operation to be performed on the movie.
*/
enum Operation { Play,
Stop,
Pause,
Resume
};
/**
* Create a new Movie link.
*
* \param linkArea the active area of the link
* \param operation the operation to be performed on the movie
* \param annotationTitle the title of the movie annotation identifying the movie to be played
* \param annotationReference the object reference of the movie annotation identifying the movie to be played
*
* Note: This constructor is supposed to be used by Poppler::Page only.
*/
LinkMovie( const QRectF &linkArea, Operation operation, const QString &annotationTitle, const Ref &annotationReference );
/**
* Destructor.
*/
~LinkMovie();
LinkType linkType() const;
/**
* Returns the operation to be performed on the movie.
*/
Operation operation() const;
/**
* Returns whether the given @p annotation is the referenced movie annotation for this movie @p link.
*/
bool isReferencedAnnotation( const MovieAnnotation *annotation ) const;
private:
Q_DECLARE_PRIVATE( LinkMovie )
Q_DISABLE_COPY( LinkMovie )
};
}
#endif

View File

@ -0,0 +1,100 @@
/* poppler-media.h: qt interface to poppler
* Copyright (C) 2012 Guillermo A. Amaral B. <gamaral@kde.org>
* Copyright (C) 2012, 2013 Albert Astals Cid <aacid@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __POPPLER_MEDIARENDITION_H__
#define __POPPLER_MEDIARENDITION_H__
#include "poppler-export.h"
#include <QtCore/QSize>
#include <QtCore/QString>
class MediaRendition;
class QIODevice;
namespace Poppler
{
class MediaRenditionPrivate;
/**
Qt wrapper for MediaRendition.
\since 0.20
*/
class POPPLER_QT5_EXPORT MediaRendition {
public:
/**
Constructs a MediaRendition. Takes ownership of the passed rendition
*/
MediaRendition(::MediaRendition *rendition);
~MediaRendition();
/**
Check if wrapper is holding a valid rendition object.
*/
bool isValid() const;
/**
Returns content type.
*/
QString contentType() const;
/**
Returns file name.
*/
QString fileName() const;
/**
Returns true if media is embedded.
*/
bool isEmbedded() const;
/**
Returns data buffer.
*/
QByteArray data() const;
/**
Convenience accessor for auto-play parameter.
*/
bool autoPlay() const;
/**
Convenience accessor for show controls parameter.
*/
bool showControls() const;
/**
Convenience accessor for repeat count parameter.
*/
float repeatCount() const;
/**
Convenience accessor for size parameter.
*/
QSize size() const;
private:
Q_DECLARE_PRIVATE( MediaRendition )
MediaRenditionPrivate *d_ptr;
Q_DISABLE_COPY( MediaRendition )
};
}
#endif /* __POPPLER_MEDIARENDITION_H__ */

View File

@ -0,0 +1,121 @@
/* poppler-optcontent-private.h: qt interface to poppler
*
* Copyright (C) 2007, Brad Hards <bradh@kde.org>
* Copyright (C) 2008, Pino Toscano <pino@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef POPPLER_OPTCONTENT_PRIVATE_H
#define POPPLER_OPTCONTENT_PRIVATE_H
#include <QtCore/QMap>
#include <QtCore/QSet>
#include <QtCore/QString>
class Array;
class OCGs;
class OptionalContentGroup;
class QModelIndex;
namespace Poppler
{
class OptContentItem;
class OptContentModel;
class OptContentModelPrivate;
class RadioButtonGroup
{
public:
RadioButtonGroup( OptContentModelPrivate *ocModel, Array *rbarray);
~RadioButtonGroup();
QSet<OptContentItem *> setItemOn( OptContentItem *itemToSetOn );
private:
QList<OptContentItem*> itemsInGroup;
};
class OptContentItem
{
public:
enum ItemState { On, Off, HeadingOnly };
OptContentItem( OptionalContentGroup *group );
OptContentItem( const QString &label );
OptContentItem();
~OptContentItem();
QString name() const { return m_name; }
ItemState state() const { return m_stateBackup; }
bool setState(ItemState state, QSet<OptContentItem *> &changedItems);
QList<OptContentItem*> childList() { return m_children; }
void setParent( OptContentItem* parent) { m_parent = parent; }
OptContentItem* parent() { return m_parent; }
void addChild( OptContentItem *child );
void appendRBGroup( RadioButtonGroup *rbgroup );
bool isEnabled() const { return m_enabled; }
QSet<OptContentItem*> recurseListChildren(bool includeMe = false) const;
private:
OptionalContentGroup *m_group;
QString m_name;
ItemState m_state; // true for ON, false for OFF
ItemState m_stateBackup;
QList<OptContentItem*> m_children;
OptContentItem *m_parent;
QList<RadioButtonGroup*> m_rbGroups;
bool m_enabled;
};
class OptContentModelPrivate
{
public:
OptContentModelPrivate( OptContentModel *qq, OCGs *optContent );
~OptContentModelPrivate();
void parseRBGroupsArray( Array *rBGroupArray );
OptContentItem *nodeFromIndex(const QModelIndex &index, bool canBeNull = false) const;
QModelIndex indexFromItem(OptContentItem *node, int column) const;
/**
Get the OptContentItem corresponding to a given reference value.
\param ref the reference number (e.g. from Object.getRefNum()) to look up
\return the matching optional content item, or null if the reference wasn't found
*/
OptContentItem *itemFromRef( const QString &ref ) const;
void setRootNode(OptContentItem *node);
OptContentModel *q;
QMap<QString, OptContentItem*> m_optContentItems;
QList<RadioButtonGroup*> m_rbgroups;
OptContentItem *m_rootNode;
private:
void addChild( OptContentItem *parent, OptContentItem *child);
void parseOrderArray( OptContentItem *parentNode, Array *orderArray );
};
}
#endif

View File

@ -0,0 +1,77 @@
/* poppler-optcontent.h: qt interface to poppler
*
* Copyright (C) 2007, Brad Hards <bradh@kde.org>
* Copyright (C) 2008, Pino Toscano <pino@kde.org>
* Copyright (C) 2013, Anthony Granger <grangeranthony@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef POPPLER_OPTCONTENT_H
#define POPPLER_OPTCONTENT_H
#include <QtCore/QAbstractListModel>
#include "poppler-export.h"
class OCGs;
namespace Poppler
{
class Document;
class OptContentModelPrivate;
/**
* \brief Model for optional content
*
* OptContentModel is an item model representing the optional content items
* that can be found in PDF documents.
*
* The model offers a mostly read-only display of the data, allowing to
* enable/disable some contents setting the Qt::CheckStateRole data role.
*
* \since 0.8
*/
class POPPLER_QT5_EXPORT OptContentModel : public QAbstractItemModel
{
friend class Document;
Q_OBJECT
public:
virtual ~OptContentModel();
QModelIndex index(int row, int column, const QModelIndex &parent) const;
QModelIndex parent(const QModelIndex &child) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
virtual bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole );
Qt::ItemFlags flags ( const QModelIndex & index ) const;
virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
private:
OptContentModel( OCGs *optContent, QObject *parent = 0);
friend class OptContentModelPrivate;
OptContentModelPrivate *d;
};
}
#endif

View File

@ -0,0 +1,54 @@
/* poppler-page.cc: qt interface to poppler
* Copyright (C) 2005, Net Integration Technologies, Inc.
* Copyright (C) 2007, 2012, Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2008, Pino Toscano <pino@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _POPPLER_PAGE_PRIVATE_H_
#define _POPPLER_PAGE_PRIVATE_H_
#include "CharTypes.h"
class QRectF;
class LinkAction;
class Page;
class TextPage;
namespace Poppler
{
class DocumentData;
class PageTransition;
class PageData {
public:
Link* convertLinkActionToLink(::LinkAction * a, const QRectF &linkArea);
DocumentData *parentDoc;
::Page *page;
int index;
PageTransition *transition;
static Link* convertLinkActionToLink(::LinkAction * a, DocumentData *parentDoc, const QRectF &linkArea);
TextPage *prepareTextSearch(const QString &text, Page::SearchMode caseSensitive, Page::Rotation rotate, GBool *sCase, QVector<Unicode> *u);
};
}
#endif

View File

@ -0,0 +1,28 @@
/*
* Copyright (C) 2005, Albert Astals Cid
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Object;
namespace Poppler {
class PageTransitionParams {
public:
Object *dictObj;
};
}

View File

@ -0,0 +1,148 @@
/* PageTransition.h
* Copyright (C) 2005, Net Integration Technologies, Inc.
* Copyright (C) 2005, Brad Hards <bradh@frogmouth.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __PAGETRANSITION_X_H__
#define __PAGETRANSITION_X_H__
#include "poppler-export.h"
namespace Poppler {
class PageTransitionParams;
class PageTransitionData;
/**
\brief Describes how a PDF file viewer shall perform the transition
from one page to another
In PDF files there is a way to specify if the viewer shall use
certain effects to perform the transition from one page to
another. This feature can be used, e.g., in a PDF-based beamer
presentation.
This utility class represents the transition effect, and can be
used to extract the information from a PDF object.
*/
class POPPLER_QT5_EXPORT PageTransition {
public:
/** \brief transition effect that shall be used
*/
// if changed remember to keep in sync with PageTransition.h enum
enum Type {
Replace = 0,
Split,
Blinds,
Box,
Wipe,
Dissolve,
Glitter,
Fly,
Push,
Cover,
Uncover,
Fade
};
/** \brief alignment of the transition effect that shall be used
*/
// if changed remember to keep in sync with PageTransition.h enum
enum Alignment {
Horizontal = 0,
Vertical
};
/** \brief direction of the transition effect that shall be used
*/
// if changed remember to keep in sync with PageTransition.h enum
enum Direction {
Inward = 0,
Outward
};
/** \brief Construct a new PageTransition object from a page dictionary.
Users of the library will rarely need to construct a
PageTransition object themselves. Instead, the method
Poppler::Page::transition() can be used to find out if a certain
transition effect is specified.
@warning In case or error, this method will print an error message to stderr,
and construct a default object.
@param params an object whose dictionary will be read and
parsed. This must be a valid object, whose dictionaries are
accessed by the constructor. The object is only accessed by this
constructor, and may be deleted after the constructor returns.
*/
PageTransition(const PageTransitionParams &params);
/** \brief copy constructor */
PageTransition(const PageTransition &pt);
/**
Destructor
*/
~PageTransition();
/**
\brief Get type of the transition.
*/
Type type() const;
/**
\brief Get duration of the transition in seconds.
*/
int duration() const;
/**
\brief Get dimension in which the transition effect occurs.
*/
Alignment alignment() const;
/**
\brief Get direction of motion of the transition effect.
*/
Direction direction() const;
/**
\brief Get direction in which the transition effect moves.
*/
int angle() const;
/**
\brief Get starting or ending scale.
*/
double scale() const;
/**
\brief Returns true if the area to be flown is rectangular and
opaque.
*/
bool isRectangular() const;
private:
PageTransitionData *data;
};
}
#endif

View File

@ -0,0 +1,240 @@
/* poppler-private.h: qt interface to poppler
* Copyright (C) 2005, Net Integration Technologies, Inc.
* Copyright (C) 2005, 2008, Brad Hards <bradh@frogmouth.net>
* Copyright (C) 2006-2009, 2011, 2012 by Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2007-2009, 2011 by Pino Toscano <pino@kde.org>
* Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com>
* Copyright (C) 2011 Hib Eris <hib@hiberis.nl>
* Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
* Copyright (C) 2013 Anthony Granger <grangeranthony@gmail.com>
* Inspired on code by
* Copyright (C) 2004 by Albert Astals Cid <tsdgeos@terra.es>
* Copyright (C) 2004 by Enrico Ros <eros.kde@email.it>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _POPPLER_PRIVATE_H_
#define _POPPLER_PRIVATE_H_
#include <QtCore/QFile>
#include <QtCore/QPointer>
#include <QtCore/QVector>
#include <config.h>
#include <GfxState.h>
#include <GlobalParams.h>
#include <PDFDoc.h>
#include <FontInfo.h>
#include <OutputDev.h>
#include <Error.h>
#if defined(HAVE_SPLASH)
#include <SplashOutputDev.h>
#endif
#include "poppler-qt5.h"
#include "poppler-embeddedfile-private.h"
class LinkDest;
class FormWidget;
namespace Poppler {
/* borrowed from kpdf */
QString unicodeToQString(Unicode* u, int len);
QString UnicodeParsedString(GooString *s1);
GooString *QStringToUnicodeGooString(const QString &s);
GooString *QStringToGooString(const QString &s);
void qt5ErrorFunction(int pos, char *msg, va_list args);
class LinkDestinationData
{
public:
LinkDestinationData( LinkDest *l, GooString *nd, Poppler::DocumentData *pdfdoc, bool external )
: ld(l), namedDest(nd), doc(pdfdoc), externalDest(external)
{
}
LinkDest *ld;
GooString *namedDest;
Poppler::DocumentData *doc;
bool externalDest;
};
class DocumentData {
public:
DocumentData(const QString &filePath, GooString *ownerPassword, GooString *userPassword)
{
init();
m_filePath = filePath;
#if defined(_WIN32)
wchar_t *fileName = new WCHAR[filePath.length()];
int length = filePath.toWCharArray(fileName);
doc = new PDFDoc(fileName, length, ownerPassword, userPassword);
delete[] fileName;
#else
GooString *fileName = new GooString(QFile::encodeName(filePath));
doc = new PDFDoc(fileName, ownerPassword, userPassword);
#endif
delete ownerPassword;
delete userPassword;
}
DocumentData(const QByteArray &data, GooString *ownerPassword, GooString *userPassword)
{
Object obj;
fileContents = data;
obj.initNull();
MemStream *str = new MemStream((char*)fileContents.data(), 0, fileContents.length(), &obj);
init();
doc = new PDFDoc(str, ownerPassword, userPassword);
delete ownerPassword;
delete userPassword;
}
void init();
~DocumentData();
void addTocChildren( QDomDocument * docSyn, QDomNode * parent, GooList * items );
void setPaperColor(const QColor &color)
{
paperColor = color;
}
void fillMembers()
{
m_fontInfoIterator = new FontIterator(0, this);
int numEmb = doc->getCatalog()->numEmbeddedFiles();
if (!(0 == numEmb)) {
// we have some embedded documents, build the list
for (int yalv = 0; yalv < numEmb; ++yalv) {
FileSpec *fs = doc->getCatalog()->embeddedFile(yalv);
m_embeddedFiles.append(new EmbeddedFile(*new EmbeddedFileData(fs)));
}
}
}
static Document *checkDocument(DocumentData *doc);
PDFDoc *doc;
QString m_filePath;
QByteArray fileContents;
bool locked;
FontIterator *m_fontInfoIterator;
Document::RenderBackend m_backend;
QList<EmbeddedFile*> m_embeddedFiles;
QPointer<OptContentModel> m_optContentModel;
QColor paperColor;
int m_hints;
static int count;
};
class FontInfoData
{
public:
FontInfoData()
{
isEmbedded = false;
isSubset = false;
type = FontInfo::unknown;
}
FontInfoData( const FontInfoData &fid )
{
fontName = fid.fontName;
fontFile = fid.fontFile;
isEmbedded = fid.isEmbedded;
isSubset = fid.isSubset;
type = fid.type;
embRef = fid.embRef;
}
FontInfoData( ::FontInfo* fi )
{
if (fi->getName()) fontName = fi->getName()->getCString();
if (fi->getFile()) fontFile = fi->getFile()->getCString();
isEmbedded = fi->getEmbedded();
isSubset = fi->getSubset();
type = (Poppler::FontInfo::Type)fi->getType();
embRef = fi->getEmbRef();
}
QString fontName;
QString fontFile;
bool isEmbedded : 1;
bool isSubset : 1;
FontInfo::Type type;
Ref embRef;
};
class FontIteratorData
{
public:
FontIteratorData( int startPage, DocumentData *dd )
: fontInfoScanner( dd->doc, startPage )
, totalPages( dd->doc->getNumPages() )
, currentPage( qMax( startPage, 0 ) - 1 )
{
}
~FontIteratorData()
{
}
FontInfoScanner fontInfoScanner;
int totalPages;
int currentPage;
};
class TextBoxData
{
public:
TextBoxData()
: nextWord(0), hasSpaceAfter(false)
{
}
QString text;
QRectF bBox;
TextBox *nextWord;
QVector<QRectF> charBBoxes; // the boundingRect of each character
bool hasSpaceAfter;
};
class FormFieldData
{
public:
FormFieldData(DocumentData *_doc, ::Page *p, ::FormWidget *w) :
doc(_doc), page(p), fm(w)
{
}
DocumentData *doc;
::Page *page;
::FormWidget *fm;
QRectF box;
};
}
#endif

View File

@ -0,0 +1,47 @@
/* poppler-qiodevicestream-private.h: Qt5 interface to poppler
* Copyright (C) 2008, Pino Toscano <pino@kde.org>
* Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef POPPLER_QIODEVICESTREAM_PRIVATE_H
#define POPPLER_QIODEVICESTREAM_PRIVATE_H
#include "Object.h"
#include "Stream.h"
class QIODevice;
namespace Poppler {
class QIODeviceOutStream : public OutStream
{
public:
QIODeviceOutStream(QIODevice* device);
virtual ~QIODeviceOutStream();
virtual void close();
virtual Goffset getPos();
virtual void put(char c);
virtual void printf(const char *format, ...);
private:
QIODevice *m_device;
};
}
#endif

File diff suppressed because it is too large Load Diff

BIN
dependencies/poppler/lib/poppler-qt5.lib vendored Normal file

Binary file not shown.