2004-09-08 12:41:14 +00:00
|
|
|
/***************************************************************************
|
2005-02-20 16:04:40 +00:00
|
|
|
* Copyright (C) 2004-2005 by Enrico Ros <eros.kde@email.it> *
|
2005-01-15 01:08:35 +00:00
|
|
|
* Copyright (C) 2004-2005 by Albert Astals Cid <tsdgeos@terra.es> *
|
2004-09-08 12:41:14 +00:00
|
|
|
* *
|
|
|
|
* 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. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
#ifndef _OKULAR_DOCUMENT_H_
|
|
|
|
#define _OKULAR_DOCUMENT_H_
|
2004-09-08 12:41:14 +00:00
|
|
|
|
2006-05-08 20:12:04 +00:00
|
|
|
#include "okular_export.h"
|
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
#include <QtCore/QHash>
|
|
|
|
#include <QtCore/QObject>
|
|
|
|
#include <QtCore/QStringList>
|
|
|
|
#include <QtCore/QVector>
|
|
|
|
#include <QtXml/QDomDocument>
|
|
|
|
#include <QtXml/QDomElement>
|
|
|
|
|
2005-11-04 11:59:51 +00:00
|
|
|
#include <kmimetype.h>
|
2004-09-08 12:41:14 +00:00
|
|
|
|
2006-06-23 21:11:52 +00:00
|
|
|
#include "area.h"
|
|
|
|
|
2005-01-02 14:55:14 +00:00
|
|
|
class KPrinter;
|
2006-03-20 22:51:56 +00:00
|
|
|
class KUrl;
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
class KActionCollection;
|
|
|
|
class QToolBox;
|
2006-09-21 08:45:36 +00:00
|
|
|
|
|
|
|
namespace Okular {
|
|
|
|
|
|
|
|
class Annotation;
|
|
|
|
class DocumentFonts;
|
|
|
|
class DocumentInfo;
|
|
|
|
class DocumentObserver;
|
|
|
|
class DocumentSynopsis;
|
|
|
|
class DocumentViewport;
|
|
|
|
class EmbeddedFile;
|
2006-10-25 15:35:53 +00:00
|
|
|
class ExportFormat;
|
2006-09-21 08:45:36 +00:00
|
|
|
class Generator;
|
|
|
|
class Link;
|
|
|
|
class Page;
|
|
|
|
class PixmapRequest;
|
2006-11-17 22:15:15 +00:00
|
|
|
class SourceReference;
|
2006-06-23 21:11:52 +00:00
|
|
|
class VisiblePageRect;
|
2004-09-08 12:41:14 +00:00
|
|
|
|
2006-05-28 15:54:48 +00:00
|
|
|
/** IDs for seaches. Globally defined here. **/
|
|
|
|
#define PART_SEARCH_ID 1
|
|
|
|
#define PAGEVIEW_SEARCH_ID 2
|
|
|
|
#define SW_SEARCH_ID 3
|
|
|
|
|
|
|
|
|
2004-09-08 12:41:14 +00:00
|
|
|
/**
|
2004-12-11 17:25:03 +00:00
|
|
|
* @short The Document. Heart of everything. Actions take place here.
|
2004-09-08 12:41:14 +00:00
|
|
|
*
|
2006-09-21 08:45:36 +00:00
|
|
|
* The Document is the main object in Okular. All views query the Document to
|
2004-12-11 17:25:03 +00:00
|
|
|
* 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
|
|
|
|
* name it..) so whenever you want to get some data, it asks its internals
|
|
|
|
* generator to do the job and return results in a format-indepedent way.
|
|
|
|
*
|
|
|
|
* Apart from the generator (the currently running one) the document stores
|
2006-09-21 08:45:36 +00:00
|
|
|
* all the Pages ('Page' class) of the current document in a vector and
|
2004-12-11 17:25:03 +00:00
|
|
|
* notifies all the registered DocumentObservers when some content changes.
|
|
|
|
*
|
|
|
|
* For a better understanding of hieracies @see README.internals.png
|
2006-09-21 08:45:36 +00:00
|
|
|
* @see DocumentObserver, Page
|
2004-09-08 12:41:14 +00:00
|
|
|
*/
|
2006-09-21 08:45:36 +00:00
|
|
|
class OKULAR_EXPORT Document : public QObject
|
2004-09-08 12:41:14 +00:00
|
|
|
{
|
2004-12-22 18:21:36 +00:00
|
|
|
Q_OBJECT
|
2004-11-09 17:20:19 +00:00
|
|
|
public:
|
2006-09-21 08:45:36 +00:00
|
|
|
Document( QHash<QString, Generator*> * genList );
|
|
|
|
~Document();
|
2004-11-09 17:20:19 +00:00
|
|
|
|
2005-11-04 11:59:51 +00:00
|
|
|
// communication with the part
|
|
|
|
|
2004-11-09 17:20:19 +00:00
|
|
|
// document handling
|
2006-03-20 22:51:56 +00:00
|
|
|
bool openDocument( const QString & docFile, const KUrl & url, const KMimeType::Ptr &mime );
|
2004-11-09 17:20:19 +00:00
|
|
|
void closeDocument();
|
|
|
|
|
2005-11-04 11:59:51 +00:00
|
|
|
// observer stuff
|
2005-01-09 23:37:07 +00:00
|
|
|
void addObserver( DocumentObserver * pObserver );
|
|
|
|
void removeObserver( DocumentObserver * pObserver );
|
2004-11-09 17:20:19 +00:00
|
|
|
void reparseConfig();
|
|
|
|
|
2005-03-05 15:59:15 +00:00
|
|
|
// enum definitions
|
|
|
|
enum Permission { AllowModify = 1, AllowCopy = 2, AllowPrint = 4, AllowNotes = 8 };
|
|
|
|
|
2004-11-09 17:20:19 +00:00
|
|
|
// query methods (const ones)
|
2005-01-15 01:08:35 +00:00
|
|
|
bool isOpened() const;
|
2004-12-11 17:25:03 +00:00
|
|
|
const DocumentInfo * documentInfo() const;
|
|
|
|
const DocumentSynopsis * documentSynopsis() const;
|
2005-06-13 15:46:23 +00:00
|
|
|
const DocumentFonts * documentFonts() const;
|
2006-05-28 16:54:54 +00:00
|
|
|
const QList<EmbeddedFile*> *embeddedFiles() const;
|
2006-09-21 08:45:36 +00:00
|
|
|
const Page * page( int page ) const;
|
2005-01-09 23:37:07 +00:00
|
|
|
const DocumentViewport & viewport() const;
|
2006-06-23 21:11:52 +00:00
|
|
|
const QVector< VisiblePageRect * > & visiblePageRects() const;
|
|
|
|
void setVisiblePageRects( const QVector< VisiblePageRect * > & visiblePageRects, int excludeId = -1 );
|
2004-11-09 17:20:19 +00:00
|
|
|
uint currentPage() const;
|
|
|
|
uint pages() const;
|
2006-03-20 22:51:56 +00:00
|
|
|
KUrl currentDocument() const;
|
2005-03-05 15:59:15 +00:00
|
|
|
bool isAllowed( int /*Document::Permisison(s)*/ ) const;
|
2005-06-24 16:45:25 +00:00
|
|
|
bool supportsSearching() const;
|
2005-07-20 22:28:23 +00:00
|
|
|
bool supportsRotation() const;
|
- 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
|
|
|
bool supportsPaperSizes() const;
|
|
|
|
QStringList paperSizes() const;
|
2006-07-01 22:17:53 +00:00
|
|
|
bool canExportToText() const;
|
|
|
|
bool exportToText( const QString& fileName ) const;
|
2006-10-25 15:35:53 +00:00
|
|
|
QList<ExportFormat> exportFormats() const;
|
|
|
|
bool exportTo( const QString& fileName, const ExportFormat& format ) const;
|
2005-01-27 17:31:07 +00:00
|
|
|
bool historyAtBegin() const;
|
|
|
|
bool historyAtEnd() const;
|
2006-10-28 19:18:36 +00:00
|
|
|
QVariant getMetaData( const QString & key, const QVariant & option = QVariant() ) const;
|
2006-06-02 20:42:57 +00:00
|
|
|
int rotation() const;
|
2006-10-15 19:37:14 +00:00
|
|
|
QSizeF allPagesSize() const;
|
|
|
|
QString pageSizeString(int page) const;
|
2004-11-09 17:20:19 +00:00
|
|
|
|
2005-07-20 22:28:23 +00:00
|
|
|
// gui altering stuff
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
QString getXMLFile();
|
|
|
|
void setupGUI(KActionCollection * ac , QToolBox * tBox );
|
2005-07-20 22:28:23 +00:00
|
|
|
|
2004-11-09 17:20:19 +00:00
|
|
|
// perform actions on document / pages
|
2005-02-01 18:23:55 +00:00
|
|
|
void setViewportPage( int page, int excludeId = -1, bool smoothMove = false );
|
|
|
|
void setViewport( const DocumentViewport & viewport, int excludeId = -1, bool smoothMove = false );
|
2005-01-27 17:31:07 +00:00
|
|
|
void setPrevViewport();
|
|
|
|
void setNextViewport();
|
2006-09-15 21:08:48 +00:00
|
|
|
void setNextDocumentViewport( const DocumentViewport & viewport );
|
2006-03-20 22:40:11 +00:00
|
|
|
void requestPixmaps( const QLinkedList< PixmapRequest * > & requests );
|
2004-11-09 17:20:19 +00:00
|
|
|
void requestTextPage( uint page );
|
2005-02-18 18:24:45 +00:00
|
|
|
void addPageAnnotation( int page, Annotation * annotation );
|
2006-08-10 06:32:03 +00:00
|
|
|
void modifyPageAnnotation( int page, Annotation * newannotation );
|
|
|
|
void removePageAnnotation( int page, Annotation * annotation );
|
2006-11-01 15:17:22 +00:00
|
|
|
void removePageAnnotations( int page, QList< Annotation * > annotations );
|
2006-09-26 22:22:01 +00:00
|
|
|
|
|
|
|
void setPageTextSelection( int page, RegularAreaRect * rect, const QColor & color );
|
|
|
|
|
2005-02-20 16:04:40 +00:00
|
|
|
enum SearchType { NextMatch, PrevMatch, AllDoc, GoogleAll, GoogleAny };
|
2006-11-23 16:54:28 +00:00
|
|
|
bool searchText( int searchID, const QString & text, bool fromStart, Qt::CaseSensitivity caseSensitivity,
|
2005-02-02 18:18:26 +00:00
|
|
|
SearchType type, bool moveViewport, const QColor & color, bool noDialogs = false );
|
2005-02-01 18:26:56 +00:00
|
|
|
bool continueSearch( int searchID );
|
|
|
|
void resetSearch( int searchID );
|
2006-07-11 19:57:17 +00:00
|
|
|
bool continueLastSearch();
|
2005-02-02 18:18:26 +00:00
|
|
|
|
2004-11-09 17:20:19 +00:00
|
|
|
void toggleBookmark( int page );
|
2006-09-21 08:45:36 +00:00
|
|
|
void processLink( const Link * link );
|
2006-11-17 22:15:15 +00:00
|
|
|
void processSourceReference( const SourceReference * ref );
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
bool canConfigurePrinter() const;
|
2004-11-09 17:20:19 +00:00
|
|
|
bool print( KPrinter &printer );
|
2005-01-18 16:43:36 +00:00
|
|
|
// notifications sent by generator
|
|
|
|
void requestDone( PixmapRequest * request );
|
2005-11-04 11:59:51 +00:00
|
|
|
// inline pagesVector() { return pages_vector; };
|
2005-01-18 16:43:36 +00:00
|
|
|
|
2006-11-20 07:53:32 +00:00
|
|
|
public Q_SLOTS:
|
2006-06-02 20:42:57 +00:00
|
|
|
void slotRotation( int rotation );
|
- 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
|
|
|
void slotPaperSizes( int );
|
2005-07-20 22:28:23 +00:00
|
|
|
|
2006-11-20 07:53:32 +00:00
|
|
|
Q_SIGNALS:
|
2005-11-04 11:59:51 +00:00
|
|
|
void close();
|
|
|
|
void quit();
|
2005-01-01 21:50:34 +00:00
|
|
|
void linkFind();
|
|
|
|
void linkGoToPage();
|
2005-04-07 09:53:15 +00:00
|
|
|
void linkPresentation();
|
|
|
|
void linkEndPresentation();
|
2006-08-30 13:02:48 +00:00
|
|
|
void openUrl(const KUrl &url);
|
2006-06-10 12:59:09 +00:00
|
|
|
void error(const QString & string, int duration);
|
|
|
|
void warning(const QString & string, int duration);
|
|
|
|
void notice(const QString & string, int duration);
|
2005-01-01 21:50:34 +00:00
|
|
|
|
2006-11-20 07:53:32 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
void rotationFinished( int page );
|
|
|
|
|
2004-11-09 17:20:19 +00:00
|
|
|
private:
|
2006-10-15 19:37:14 +00:00
|
|
|
QString pagesSizeString() const;
|
|
|
|
QString localizedSize(const QSizeF &size) const;
|
2004-12-21 12:38:52 +00:00
|
|
|
// memory management related functions
|
2005-01-21 20:05:36 +00:00
|
|
|
void cleanupPixmapMemory( int bytesOffset = 0 );
|
2005-01-20 17:33:05 +00:00
|
|
|
int getTotalMemory();
|
|
|
|
int getFreeMemory();
|
2004-12-21 12:38:52 +00:00
|
|
|
// more private functions
|
2005-01-03 00:28:46 +00:00
|
|
|
void loadDocumentInfo();
|
2004-11-09 17:20:19 +00:00
|
|
|
QString giveAbsolutePath( const QString & fileName );
|
|
|
|
bool openRelativeFile( const QString & fileName );
|
2006-03-20 22:51:56 +00:00
|
|
|
QHash<QString, Generator*>* m_loadedGenerators ;
|
2004-12-10 16:04:45 +00:00
|
|
|
Generator * generator;
|
2005-08-31 18:13:59 +00:00
|
|
|
bool m_usingCachedGenerator;
|
2006-09-21 08:45:36 +00:00
|
|
|
QVector< Page * > pages_vector;
|
2006-06-23 21:11:52 +00:00
|
|
|
QVector< VisiblePageRect * > page_rects;
|
2006-09-21 08:45:36 +00:00
|
|
|
class DocumentPrivate * d;
|
2004-12-22 18:21:36 +00:00
|
|
|
|
|
|
|
private slots:
|
2005-01-03 00:28:46 +00:00
|
|
|
void saveDocumentInfo() const;
|
2005-01-21 20:05:36 +00:00
|
|
|
void slotTimedMemoryCheck();
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
void sendGeneratorRequest();
|
2004-09-08 12:41:14 +00:00
|
|
|
};
|
|
|
|
|
2005-01-07 13:07:29 +00:00
|
|
|
|
2005-01-03 15:51:05 +00:00
|
|
|
/**
|
2005-01-09 23:37:07 +00:00
|
|
|
* @short A view on the document.
|
2005-01-03 15:51:05 +00:00
|
|
|
*
|
2005-01-09 23:37:07 +00:00
|
|
|
* The Viewport structure is the 'current view' over the document. Contained
|
|
|
|
* data is broadcasted between observers to syncronize their viewports to get
|
|
|
|
* the 'I scroll one view and others scroll too' views.
|
2005-01-03 15:51:05 +00:00
|
|
|
*/
|
2006-05-08 20:12:04 +00:00
|
|
|
class OKULAR_EXPORT DocumentViewport
|
2005-01-03 15:51:05 +00:00
|
|
|
{
|
2005-01-09 23:37:07 +00:00
|
|
|
public:
|
|
|
|
/** data fields **/
|
|
|
|
// the page nearest the center of the viewport
|
|
|
|
int pageNumber;
|
|
|
|
|
2005-06-13 11:53:47 +00:00
|
|
|
// enum definitions
|
|
|
|
enum Position { Center = 1, TopLeft = 2};
|
|
|
|
|
2005-01-09 23:37:07 +00:00
|
|
|
// if reCenter.enabled, this contains the viewport center
|
|
|
|
struct {
|
|
|
|
bool enabled;
|
2005-06-13 11:53:47 +00:00
|
|
|
double normalizedX;
|
|
|
|
double normalizedY;
|
|
|
|
Position pos;
|
|
|
|
} rePos;
|
2005-01-09 23:37:07 +00:00
|
|
|
|
|
|
|
// if autoFit.enabled, page must be autofitted in the viewport
|
|
|
|
struct {
|
|
|
|
bool enabled;
|
|
|
|
bool width;
|
|
|
|
bool height;
|
|
|
|
} autoFit;
|
|
|
|
|
|
|
|
/** class methods **/
|
|
|
|
// allowed constructors, don't use others
|
|
|
|
DocumentViewport( int pageNumber = -1 );
|
|
|
|
DocumentViewport( const QString & xmlDesc );
|
|
|
|
QString toString() const;
|
|
|
|
bool operator==( const DocumentViewport & vp ) const;
|
2005-01-03 15:51:05 +00:00
|
|
|
};
|
|
|
|
|
2004-12-10 16:04:45 +00:00
|
|
|
/**
|
2005-06-13 15:46:23 +00:00
|
|
|
* @short A DOM tree containing informations about the document.
|
2004-12-11 17:25:03 +00:00
|
|
|
*
|
|
|
|
* The Info structure can be filled in by generators to display metadata
|
|
|
|
* about the currently opened file.
|
2004-12-10 16:04:45 +00:00
|
|
|
*/
|
2006-05-08 20:12:04 +00:00
|
|
|
class OKULAR_EXPORT DocumentInfo : public QDomDocument
|
2004-12-10 16:04:45 +00:00
|
|
|
{
|
2005-01-02 22:37:52 +00:00
|
|
|
public:
|
|
|
|
DocumentInfo();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets a value for a special key. The title should be an i18n'ed
|
|
|
|
* string, since it's used in the document information dialog.
|
|
|
|
*/
|
|
|
|
void set( const QString &key, const QString &value,
|
|
|
|
const QString &title = QString() );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the value for a given key or an empty string when the
|
|
|
|
* key doesn't exist.
|
|
|
|
*/
|
|
|
|
QString get( const QString &key ) const;
|
2004-12-10 16:04:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2005-06-13 15:46:23 +00:00
|
|
|
* @short A DOM tree that describes the Table of Contents.
|
2004-12-11 17:25:03 +00:00
|
|
|
*
|
|
|
|
* The Synopsis (TOC or Table Of Contents for friends) is represented via
|
2005-06-13 15:46:23 +00:00
|
|
|
* a dom tree where each node has an internal name (displayed in the listview)
|
2004-12-11 17:25:03 +00:00
|
|
|
* and one or more attributes.
|
|
|
|
*
|
2005-01-07 13:07:29 +00:00
|
|
|
* In the tree the tag name is the 'screen' name of the entry. A tag can have
|
|
|
|
* attributes. Here follows the list of tag attributes with meaning:
|
2005-08-31 18:13:59 +00:00
|
|
|
* - Icon: An icon to be set in the Lisview for the node
|
2005-01-09 23:37:07 +00:00
|
|
|
* - Viewport: A string description of the referred viewport
|
|
|
|
* - ViewportName: A 'named reference' to the viewport that must be converted
|
|
|
|
* using getMetaData( "NamedViewport", *viewport_name* )
|
2004-12-10 16:04:45 +00:00
|
|
|
*/
|
2006-05-08 20:12:04 +00:00
|
|
|
class OKULAR_EXPORT DocumentSynopsis : public QDomDocument
|
2004-12-10 16:04:45 +00:00
|
|
|
{
|
|
|
|
public:
|
2005-01-03 15:51:05 +00:00
|
|
|
DocumentSynopsis();
|
2006-09-20 11:44:58 +00:00
|
|
|
DocumentSynopsis( const QDomDocument &document );
|
2004-12-10 16:04:45 +00:00
|
|
|
};
|
|
|
|
|
2005-06-13 15:46:23 +00:00
|
|
|
/**
|
|
|
|
* @short A DOM thee describing fonts used in document.
|
|
|
|
*
|
|
|
|
* Root's childrend (if any) are font nodes with the following attributes:
|
|
|
|
* - Name
|
|
|
|
* - Type
|
|
|
|
* - Embedded (if font is shipped inside the document)
|
|
|
|
* - File (system's file that provides this font
|
|
|
|
*/
|
2006-05-08 20:12:04 +00:00
|
|
|
class OKULAR_EXPORT DocumentFonts : public QDomDocument
|
2005-06-13 15:46:23 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
DocumentFonts();
|
|
|
|
};
|
|
|
|
|
2006-05-28 16:54:54 +00:00
|
|
|
/**
|
|
|
|
* @short An embedded file into the document, has name, description, dates and the data
|
|
|
|
*/
|
|
|
|
|
|
|
|
class OKULAR_EXPORT EmbeddedFile
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EmbeddedFile();
|
|
|
|
virtual ~EmbeddedFile();
|
|
|
|
|
|
|
|
virtual QString name() const = 0;
|
|
|
|
virtual QString description() const = 0;
|
|
|
|
virtual QByteArray data() const = 0;
|
|
|
|
virtual QDateTime modificationDate() const = 0;
|
|
|
|
virtual QDateTime creationDate() const = 0;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2006-06-23 21:11:52 +00:00
|
|
|
/**
|
|
|
|
* @short An area of a specified page
|
|
|
|
*/
|
|
|
|
class VisiblePageRect
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VisiblePageRect( int _pageNumber = -1, const NormalizedRect & r = NormalizedRect() )
|
|
|
|
: pageNumber( _pageNumber ), rect( r ) {};
|
|
|
|
|
|
|
|
int pageNumber;
|
|
|
|
NormalizedRect rect;
|
|
|
|
};
|
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
}
|
|
|
|
|
2004-09-08 12:41:14 +00:00
|
|
|
#endif
|