2005-08-10 19:44:28 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* 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. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _KPDF_GSGENERATOR_H_
|
|
|
|
#define _KPDF_GSGENERATOR_H_
|
|
|
|
|
|
|
|
#include "core/generator.h"
|
|
|
|
|
|
|
|
class GSInterpreterCMD;
|
|
|
|
class GSLogWindow;
|
|
|
|
class GSInterpreterLib;
|
|
|
|
class GSInternalDocument;
|
|
|
|
class KTempFile;
|
2005-11-04 11:59:51 +00:00
|
|
|
class KActionCollection;
|
2005-08-10 19:44:28 +00:00
|
|
|
|
|
|
|
class GSGenerator : public Generator
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/** virtual methods to reimplement **/
|
|
|
|
// load a document and fill up the pagesVector
|
2006-05-29 08:24:13 +00:00
|
|
|
bool loadDocument( const QString & fileName, QVector< KPDFPage * > & pagesVector );
|
2006-07-14 10:54:29 +00:00
|
|
|
bool closeDocument();
|
2005-08-10 19:44:28 +00:00
|
|
|
|
|
|
|
// Document description and Table of contents
|
|
|
|
const DocumentInfo * generateDocumentInfo();
|
|
|
|
const DocumentSynopsis * generateDocumentSynopsis() { return 0L; }
|
|
|
|
const DocumentFonts * generateDocumentFonts() { return 0L; }
|
|
|
|
|
|
|
|
// page contents generation
|
|
|
|
bool canGeneratePixmap( bool async ) ;
|
|
|
|
void generatePixmap( PixmapRequest * request ) ;
|
|
|
|
|
|
|
|
// can generate a KPDFText Page
|
|
|
|
bool canGenerateTextPage() { return false; } ;
|
|
|
|
void generateSyncTextPage( KPDFPage * /*page*/ ) { ; } ;
|
|
|
|
|
|
|
|
bool supportsRotation() { return true; } ;
|
2006-05-29 08:24:13 +00:00
|
|
|
void setOrientation(QVector<KPDFPage*>&, int);
|
2005-08-10 19:44:28 +00:00
|
|
|
|
2006-05-29 22:30:50 +00:00
|
|
|
// paper size managment
|
|
|
|
bool supportsPaperSizes();
|
|
|
|
QStringList paperSizes();
|
|
|
|
void setPaperSize( QVector<KPDFPage*> & pagesVector, int newsize );
|
|
|
|
|
2005-08-10 19:44:28 +00:00
|
|
|
QString getXMLFile() { return QString::null; };
|
|
|
|
void setupGUI(KActionCollection * /*ac*/ , QToolBox * /* tBox */) ;
|
2005-08-31 18:13:59 +00:00
|
|
|
void freeGUI() ;
|
2005-08-10 19:44:28 +00:00
|
|
|
// internal search and gettext
|
|
|
|
RegularAreaRect * findText( const QString & /* text*/, SearchDir /* dir*/, const bool /* strictCase*/,
|
|
|
|
const RegularAreaRect * /*lastRect*/, KPDFPage * /* page*/) { return 0L;} ;
|
2006-06-10 12:14:23 +00:00
|
|
|
QString getText( const RegularAreaRect * /*area*/, KPDFPage * /*page */) { return QString(); };
|
2005-08-10 19:44:28 +00:00
|
|
|
// may come useful later
|
|
|
|
//virtual bool hasFonts() const ;
|
|
|
|
|
|
|
|
// print document using already configured kprinter
|
|
|
|
bool print( KPrinter& /*printer*/ );
|
|
|
|
// access meta data of the generator
|
|
|
|
QString getMetaData( const QString &/*key*/, const QString &/*option*/ ) { return QString(); }
|
|
|
|
// tell generator to re-parse configuration and return true if something changed
|
|
|
|
bool reparseConfig() { return false; }
|
|
|
|
QString fileName();
|
|
|
|
|
|
|
|
void addPages( KConfigDialog* dlg );
|
|
|
|
/** constructor: takes the Document as a parameter **/
|
|
|
|
GSGenerator( KPDFDocument * doc );
|
|
|
|
~GSGenerator();
|
|
|
|
|
|
|
|
public slots:
|
2005-11-18 20:48:01 +00:00
|
|
|
void slotPixmapGenerated(const QImage* img);
|
|
|
|
void slotAsyncPixmapGenerated(QPixmap * img);
|
2005-08-10 19:44:28 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// conversion handling
|
|
|
|
bool m_converted;
|
|
|
|
KTempFile * dscForPDF;
|
|
|
|
QMutex convertLock;
|
|
|
|
GSInterpreterLib* m_convert;
|
2006-05-29 08:24:13 +00:00
|
|
|
// QVector<KPDFPage*> m_pages;
|
2005-08-10 19:44:28 +00:00
|
|
|
|
2006-06-05 10:36:38 +00:00
|
|
|
bool loadDocumentWithDSC( const QString & name, QVector< KPDFPage * > & pagesVector , bool ps );
|
2006-05-29 08:24:13 +00:00
|
|
|
bool loadPages( QVector< KPDFPage * > & pagesVector );
|
2005-08-10 19:44:28 +00:00
|
|
|
bool initInterpreter();
|
|
|
|
int rotation( CDSC_ORIENTATION_ENUM orientation );
|
|
|
|
int angle( CDSC_ORIENTATION_ENUM orientation );
|
|
|
|
CDSC_ORIENTATION_ENUM orientation( int rot );
|
|
|
|
QMutex docLock;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
QMutex syncLock;
|
2005-11-04 11:59:51 +00:00
|
|
|
bool m_asyncBusy;
|
2005-08-10 19:44:28 +00:00
|
|
|
|
2005-11-18 20:48:01 +00:00
|
|
|
// pixmap requests
|
|
|
|
PixmapRequest* m_asRequest;
|
|
|
|
PixmapRequest* m_sRequest;
|
|
|
|
|
2005-08-10 19:44:28 +00:00
|
|
|
// backendish stuff
|
2006-06-12 18:25:18 +00:00
|
|
|
GSInterpreterLib* pixGenerator;
|
2005-08-10 19:44:28 +00:00
|
|
|
GSInterpreterCMD* asyncGenerator;
|
|
|
|
GSInternalDocument* internalDoc;
|
2005-11-04 11:59:51 +00:00
|
|
|
|
|
|
|
// gui stuff
|
2005-08-10 19:44:28 +00:00
|
|
|
GSLogWindow * m_logWindow ;
|
2005-11-04 11:59:51 +00:00
|
|
|
KActionCollection* m_actionCollection;
|
2005-08-10 19:44:28 +00:00
|
|
|
QToolBox * m_box;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|