Commit df7d144c authored by Tobias Koenig's avatar Tobias Koenig

Moved all classes in core/ into the 'Okular' namespace and removed

nearly all references to kpdf (knewstuff still missing).

svn path=/trunk/playground/graphics/okular/; revision=586993
parent 46e28192
ClassName=KpdfSettings
ClassName=Settings
Namespace=Okular
File=okular.kcfg
Mutators=true
Singleton=true
......
......@@ -8,14 +8,15 @@
***************************************************************************/
// qt/kde includes
#include <qdom.h>
#include <qcolor.h>
#include <qapplication.h>
#include <QtGui/QApplication>
#include <QtGui/QColor>
#include <kdebug.h>
// local includes
#include "annotations.h"
using namespace Okular;
//BEGIN AnnotationUtils implementation
Annotation * AnnotationUtils::createAnnotation( const QDomElement & annElement )
......
......@@ -7,16 +7,20 @@
* (at your option) any later version. *
***************************************************************************/
#ifndef _KPDF_ANNOTATIONS_H_
#define _KPDF_ANNOTATIONS_H_
#include <qstring.h>
#include <qdatetime.h>
#include <qlinkedlist.h>
#include <qdom.h>
#include <qfont.h>
#ifndef _OKULAR_ANNOTATIONS_H_
#define _OKULAR_ANNOTATIONS_H_
#include <QtCore/QString>
#include <QtCore/QDateTime>
#include <QtCore/QLinkedList>
#include <QtGui/QFont>
#include <QtXml/QDomDocument>
#include <QtXml/QDomElement>
#include "page.h"
namespace Okular {
class Annotation;
/**
......@@ -50,7 +54,7 @@ class AnnotationUtils
* @short Annotation struct holds properties shared by all annotations.
*
* An Annotation is an object (text note, highlight, sound, popup window, ..)
* contained by a KPDFPage in the document.
* contained by a Page in the document.
*
* For current state in relations to pdf embedded annotations:
* @see generator_pdf/README.Annotations
......@@ -129,7 +133,7 @@ struct OKULAR_EXPORT Annotation
// methods: query annotation's type for runtime type identification
virtual SubType subType() const { return A_BASE; }
//QRect geometry( int scaledWidth, int scaledHeight, KPDFPage * page );
//QRect geometry( int scaledWidth, int scaledHeight, Page * page );
// methods: storage/retrieval from xml nodes
Annotation( const QDomNode & node );
......@@ -241,4 +245,6 @@ struct OKULAR_EXPORT InkAnnotation : public Annotation
QList< QLinkedList<NormalizedPoint> > inkPaths;
};
}
#endif
......@@ -7,13 +7,15 @@
* (at your option) any later version. *
***************************************************************************/
#include <qrect.h>
#include <kdebug.h>
#include "link.h"
#include <QtCore/QRect>
#include <math.h>
#include "annotations.h"
#include "area.h"
#include "link.h"
#include <math.h>
using namespace Okular;
/** class NormalizedPoint **/
NormalizedPoint::NormalizedPoint()
......@@ -170,7 +172,7 @@ ObjectRect::~ObjectRect()
return;
if ( m_objectType == Link )
delete static_cast<KPDFLink*>( m_pointer );
delete static_cast<Okular::Link*>( m_pointer );
else
kDebug() << "Object deletion not implemented for type '" << m_objectType << "' ." << endl;
}
......@@ -198,7 +200,7 @@ bool AnnotationObjectRect::contains( double x, double y, double xScale, double y
AnnotationObjectRect::~AnnotationObjectRect()
{
// the annotation pointer is kept elsewehere (in KPDFPage, most probably),
// the annotation pointer is kept elsewehere (in Page, most probably),
// so just release its pointer
m_pointer = 0;
}
......
......@@ -7,19 +7,24 @@
* (at your option) any later version. *
***************************************************************************/
#ifndef _KPDF_AREA_H_
#define _KPDF_AREA_H_
#include "okular_export.h"
#include <qlist.h>
#include <qcolor.h>
#include <qpolygon.h>
#include <qpainterpath.h>
#ifndef _OKULAR_AREA_H_
#define _OKULAR_AREA_H_
#include <QtCore/QList>
#include <QtGui/QColor>
#include <QtGui/QPainterPath>
#include <QtGui/QPolygon>
#include <kdebug.h>
#include "okular_export.h"
class QRect;
class Annotation;
class KPDFLink;
namespace Okular {
class Annotation;
class Link;
class NormalizedShape;
/**
......@@ -53,8 +58,8 @@ class OKULAR_EXPORT NormalizedRect
bool intersects( double l, double t, double r, double b ) const;
bool intersects( const NormalizedRect * r ) const;
QRect geometry( int xScale, int yScale ) const;
NormalizedRect operator| (const NormalizedRect & r) const;
NormalizedRect& operator|= (const NormalizedRect & r);
NormalizedRect operator| (const NormalizedRect & r) const;
NormalizedRect& operator|= (const NormalizedRect & r);
NormalizedRect& operator=( const NormalizedRect & r );
bool operator==( const NormalizedRect & r ) const;
};
......@@ -70,8 +75,8 @@ class OKULAR_EXPORT NormalizedRect
* are reparented to this class.
*
* Type / Class correspondency tab:
* - Link : class KPDFLink : description of a link
* - Image : class KPDFImage : description of an image (n/a)
* - Link : class Link : description of a link
* - Image : class Image : description of an image (n/a)
* - Annotation: class Annotation: description of an annotation
*/
class OKULAR_EXPORT ObjectRect
......@@ -305,4 +310,6 @@ class HighlightAreaRect : public RegularAreaRect {
QColor color;
};
}
#endif
......@@ -7,8 +7,9 @@
* (at your option) any later version. *
***************************************************************************/
#include <qcombobox.h>
#include <qlabel.h>
#include <QtGui/QComboBox>
#include <QtGui/QLabel>
#include <klocale.h>
#include "ui_chooseenginewidget.h"
......
......@@ -10,7 +10,7 @@
#ifndef _CHOOSEENGINEDIALOG_H
#define _CHOOSEENGINEDIALOG_H
#include <qstringlist.h>
#include <QtCore/QStringList>
#include <kdialog.h>
#include <kmimetype.h>
......
This diff is collapsed.
......@@ -8,39 +8,43 @@
* (at your option) any later version. *
***************************************************************************/
#ifndef _KPDF_DOCUMENT_H_
#define _KPDF_DOCUMENT_H_
#ifndef _OKULAR_DOCUMENT_H_
#define _OKULAR_DOCUMENT_H_
#include "okular_export.h"
#include <qobject.h>
#include <qvector.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qdom.h>
#include <qhash.h>
#include <QtCore/QHash>
#include <QtCore/QObject>
#include <QtCore/QStringList>
#include <QtCore/QVector>
#include <QtXml/QDomDocument>
#include <QtXml/QDomElement>
#include <kmimetype.h>
#include "area.h"
class KPDFPage;
class KPDFLink;
class DocumentObserver;
class DocumentViewport;
class DocumentInfo;
class DocumentSynopsis;
class DocumentFonts;
class EmbeddedFile;
class Generator;
class PixmapRequest;
class Annotation;
class KPrinter;
class KUrl;
class KActionCollection;
class QToolBox;
namespace Okular {
class Annotation;
class DocumentFonts;
class DocumentInfo;
class DocumentObserver;
class DocumentSynopsis;
class DocumentViewport;
class EmbeddedFile;
class ExportEntry;
class Generator;
class Link;
class NotifyRequest;
class Page;
class PixmapRequest;
class VisiblePageRect;
class ExportEntry;
/** IDs for seaches. Globally defined here. **/
#define PART_SEARCH_ID 1
......@@ -51,7 +55,7 @@ class ExportEntry;
/**
* @short The Document. Heart of everything. Actions take place here.
*
* The Document is the main object in KPDF. All views query the Document to
* The Document is the main object in Okular. All views query the Document to
* get data/properties or even for accessing pages (in a 'const' way).
*
* It is designed to keep it detached from the document type (pdf, ps, you
......@@ -59,18 +63,18 @@ class ExportEntry;
* generator to do the job and return results in a format-indepedent way.
*
* Apart from the generator (the currently running one) the document stores
* all the Pages ('KPDFPage' class) of the current document in a vector and
* all the Pages ('Page' class) of the current document in a vector and
* notifies all the registered DocumentObservers when some content changes.
*
* For a better understanding of hieracies @see README.internals.png
* @see DocumentObserver, KPDFPage
* @see DocumentObserver, Page
*/
class OKULAR_EXPORT KPDFDocument : public QObject
class OKULAR_EXPORT Document : public QObject
{
Q_OBJECT
public:
KPDFDocument( QHash<QString, Generator*> * genList );
~KPDFDocument();
Document( QHash<QString, Generator*> * genList );
~Document();
// communication with the part
......@@ -93,7 +97,7 @@ class OKULAR_EXPORT KPDFDocument : public QObject
const DocumentSynopsis * documentSynopsis() const;
const DocumentFonts * documentFonts() const;
const QList<EmbeddedFile*> *embeddedFiles() const;
const KPDFPage * page( int page ) const;
const Page * page( int page ) const;
const DocumentViewport & viewport() const;
const QVector< VisiblePageRect * > & visiblePageRects() const;
void setVisiblePageRects( const QVector< VisiblePageRect * > & visiblePageRects, int excludeId = -1 );
......@@ -140,7 +144,7 @@ class OKULAR_EXPORT KPDFDocument : public QObject
bool continueLastSearch();
void toggleBookmark( int page );
void processLink( const KPDFLink * link );
void processLink( const Link * link );
bool canConfigurePrinter() const;
bool print( KPrinter &printer );
bool handleEvent (QEvent * event);
......@@ -176,9 +180,9 @@ class OKULAR_EXPORT KPDFDocument : public QObject
QHash<QString, Generator*>* m_loadedGenerators ;
Generator * generator;
bool m_usingCachedGenerator;
QVector< KPDFPage * > pages_vector;
QVector< Page * > pages_vector;
QVector< VisiblePageRect * > page_rects;
class KPDFDocumentPrivate * d;
class DocumentPrivate * d;
private slots:
void saveDocumentInfo() const;
......@@ -319,4 +323,6 @@ class VisiblePageRect
NormalizedRect rect;
};
}
#endif
......@@ -11,6 +11,8 @@
#include "generator.h"
using namespace Okular;
QTextStream& operator<< (QTextStream& str, const PixmapRequest *req)
{
QString s;
......
......@@ -8,31 +8,36 @@
* (at your option) any later version. *
***************************************************************************/
#ifndef _KPDF_GENERATOR_H_
#define _KPDF_GENERATOR_H_
#ifndef _OKULAR_GENERATOR_H_
#define _OKULAR_GENERATOR_H_
#include "okular_export.h"
#define OKULAR_EXPORT_PLUGIN( classname ) \
extern "C" { \
OKULAR_EXPORT Generator* create_plugin(KPDFDocument* doc) { return new classname(doc); } \
OKULAR_EXPORT Okular::Generator* create_plugin(Okular::Document* doc) { return new classname(doc); } \
}
#include <qobject.h>
#include <qvector.h>
#include <qlist.h>
#include <qstring.h>
#include <ostream>
#include <QtCore/QList>
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QVector>
#include <kmimetype.h>
#include "document.h"
#include "textpage.h"
class KPrinter;
class KPDFPage;
class KPDFLink;
class PixmapRequest;
class KConfigDialog;
class KPrinter;
namespace Okular {
class ExportEntry;
class Link;
class Page;
class PixmapRequest;
/* Note: on contents generation and asyncronous queries.
* Many observers may want to request data syncronously or asyncronously.
......@@ -40,7 +45,7 @@ class ExportEntry;
* - Async request must be done in real background. That usually means a
* thread, such as QThread derived classes.
* Once contents are available, they must be immediately stored in the
* KPDFPage they refer to, and a signal is emitted as soon as storing
* Page they refer to, and a signal is emitted as soon as storing
* (even for sync or async queries) has been done.
*/
......@@ -50,8 +55,8 @@ class ExportEntry;
* Most of class members are pure virtuals and they must be implemented to
* provide a class that builds contents (graphics and text).
*
* Generation/query is requested by the 'KPDFDocument' class only, and that
* class stores the resulting data into 'KPDFPage's. The data will then be
* Generation/query is requested by the 'Document' class only, and that
* class stores the resulting data into 'Page's. The data will then be
* displayed by the GUI components (pageView, thumbnailList, etc..).
*/
class OKULAR_EXPORT Generator : public QObject
......@@ -60,11 +65,11 @@ class OKULAR_EXPORT Generator : public QObject
public:
/** constructor: takes the Document as a parameter **/
Generator( KPDFDocument * doc ) : m_document( doc ) {};
Generator( Document * doc ) : m_document( doc ) {};
/** virtual methods to reimplement **/
// load a document and fill up the pagesVector
virtual bool loadDocument( const QString & fileName, QVector< KPDFPage * > & pagesVector ) = 0;
virtual bool loadDocument( const QString & fileName, QVector< Page * > & pagesVector ) = 0;
// the current document is no more useful, close it
virtual bool closeDocument() = 0;
......@@ -72,9 +77,9 @@ class OKULAR_EXPORT Generator : public QObject
virtual bool canGeneratePixmap( bool async ) = 0;
virtual void generatePixmap( PixmapRequest * request ) = 0;
// can generate a KPDFTextPage
// can generate a TextPage
virtual bool canGenerateTextPage() { return false; };
virtual void generateSyncTextPage( KPDFPage * /*page*/ ) {;};
virtual void generateSyncTextPage( Page * /*page*/ ) {;};
// Document description and Table of contents
virtual const DocumentInfo * generateDocumentInfo() { return 0L; }
......@@ -94,17 +99,17 @@ class OKULAR_EXPORT Generator : public QObject
virtual bool supportsSearching() { return false; };
virtual bool prefersInternalSearching() { return false; };
virtual RegularAreaRect * findText( const QString & /*text*/, SearchDir /*dir*/, const bool /*strictCase*/,
const RegularAreaRect * /*lastRect*/, KPDFPage * /*page*/) { return 0L; };
virtual QString getText( const RegularAreaRect * /*area*/, KPDFPage * /*page*/ ) { return QString(); }
const RegularAreaRect * /*lastRect*/, Page * /*page*/) { return 0L; };
virtual QString getText( const RegularAreaRect * /*area*/, Page * /*page*/ ) { return QString(); }
// rotation
virtual bool supportsRotation() { return false; };
virtual void setOrientation(QVector<KPDFPage*> & /*pagesVector*/, int /*orientation*/) { ; };
virtual void setOrientation(QVector<Page*> & /*pagesVector*/, int /*orientation*/) { ; };
// paper size
virtual bool supportsPaperSizes () { return false; }
virtual QStringList paperSizes () { return QStringList(); }
virtual void setPaperSize (QVector<KPDFPage*> & /*pagesVector*/, int /*newsize*/) { ; }
virtual void setPaperSize (QVector<Page*> & /*pagesVector*/, int /*newsize*/) { ; }
// may come useful later
//virtual bool hasFonts() const = 0;
......@@ -134,7 +139,7 @@ class OKULAR_EXPORT Generator : public QObject
// in the pageview after your handling (use with caution)
virtual bool handleEvent (QEvent * /*event*/ ) { return true; } ;
void setDocument( KPDFDocument * doc ) { m_document=doc; };
void setDocument( Document * doc ) { m_document=doc; };
signals:
void error(const QString & string, int duration);
......@@ -142,11 +147,11 @@ class OKULAR_EXPORT Generator : public QObject
void notice(const QString & string, int duration);
protected:
/** 'signals' to send events the KPDFDocument **/
/** 'signals' to send events the Document **/
// tell the document that the job has been completed
void signalRequestDone( PixmapRequest * request ) { m_document->requestDone( request ); }
KPDFDocument * m_document;
Document * m_document;
};
/**
......@@ -174,7 +179,7 @@ struct OKULAR_EXPORT PixmapRequest
// these fields are set by the Document prior passing the
// request to the generator
int documentRotation;
KPDFPage * page;
Page * page;
};
......@@ -199,4 +204,6 @@ struct OKULAR_EXPORT ExportEntry
QString icon;
};
}
#endif
/***************************************************************************
* Copyright (C) 2005 by Piotr Szymanski <niedakh@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 of the License, or *
* (at your option) any later version. *
***************************************************************************/
/**
* @short The source of information about the Generator
*
* The goal of this class is to provide per Generator settings,
* about data and other stuff not related with generating okular
* content, but still needed for a full-featured plugin system.
*
*/
class Informator
{
virtual QString iconName() = 0;
virtual void addConfigurationPages ( KConfigDialog* cfg ) = 0;
virtual KAboutData about();
virtual QStringList mimetypes() = 0;
}
......@@ -13,32 +13,34 @@
// local includes
#include "link.h"
KPDFLink::~KPDFLink()
using namespace Okular;
Link::~Link()
{
}
QString KPDFLink::linkTip() const
QString Link::linkTip() const
{
return "";
}
// Link Tips
QString KPDFLinkGoto::linkTip() const
QString LinkGoto::linkTip() const
{
return m_extFileName.isEmpty() ? "" : i18n("Open external file");
}
QString KPDFLinkExecute::linkTip() const
QString LinkExecute::linkTip() const
{
return i18n( "Execute '%1'...", m_fileName );
}
QString KPDFLinkBrowse::linkTip() const
QString LinkBrowse::linkTip() const
{
return m_url;
}
QString KPDFLinkAction::linkTip() const
QString LinkAction::linkTip() const
{
switch ( m_type )
{
......
......@@ -7,15 +7,18 @@
* (at your option) any later version. *
***************************************************************************/
#ifndef _KPDF_LINK_H_
#define _KPDF_LINK_H_
#ifndef _OKULAR_LINK_H_
#define _OKULAR_LINK_H_
#include "okular_export.h"
#include <qstring.h>
#include <qrect.h>
#include <QtCore/QRect>
#include <QtCore/QString>
#include "document.h" // for DocumentViewport
namespace Okular {
/**
* @short Encapsulates data that describes a link.
*
......@@ -23,7 +26,7 @@
* widgets to reimplement the 'linkType' method and return the type of
* the link described by the reimplemented class.
*/
class OKULAR_EXPORT KPDFLink
class OKULAR_EXPORT Link
{
public:
// get link type (inherited classes mustreturn an unique identifier)
......@@ -32,12 +35,12 @@ class OKULAR_EXPORT KPDFLink
virtual QString linkTip() const;
// virtual destructor (remove warnings)
virtual ~KPDFLink();
virtual ~Link();
};
/** Goto: a viewport and maybe a reference to an external filename **/
class OKULAR_EXPORT KPDFLinkGoto : public KPDFLink
class OKULAR_EXPORT LinkGoto : public Link
{
public:
// query for goto parameters
......@@ -45,8 +48,8 @@ class OKULAR_EXPORT KPDFLinkGoto : public KPDFLink
const QString & fileName() const { return m_extFileName; }
const DocumentViewport & destViewport() const { return m_vp; }
// create a KPDFLink_Goto
KPDFLinkGoto( QString extFileName, const DocumentViewport & vp ) { m_extFileName = extFileName; m_vp = vp; }
// create a Link_Goto
LinkGoto( QString extFileName, const DocumentViewport & vp ) { m_extFileName = extFileName; m_vp = vp; }
LinkType linkType() const { return Goto; }
QString linkTip() const;
......@@ -56,15 +59,15 @@ class OKULAR_EXPORT KPDFLinkGoto : public KPDFLink
};
/** Execute: filename and parameters to execute **/
class OKULAR_EXPORT KPDFLinkExecute : public KPDFLink
class OKULAR_EXPORT LinkExecute : public Link
{
public:
// query for filename / parameters
const QString & fileName() const { return m_fileName; }
const QString & parameters() const { return m_parameters; }
// create a KPDFLink_Execute
KPDFLinkExecute( const QString & file, const QString & params ) { m_fileName = file; m_parameters = params; }
// create a Link_Execute
LinkExecute( const QString & file, const QString & params ) { m_fileName = file; m_parameters = params; }
LinkType linkType() const { return Execute; }
QString linkTip() const;
......@@ -74,14 +77,14 @@ class OKULAR_EXPORT KPDFLinkExecute : public KPDFLink
};
/** Browse: an URL to open, ranging from 'http://' to 'mailto:' etc.. **/
class OKULAR_EXPORT KPDFLinkBrowse : public KPDFLink
class OKULAR_EXPORT LinkBrowse : public Link
{
public:
// query for URL
const QString & url() const { return m_url; }