2004-08-26 21:17:24 +00:00
|
|
|
/***************************************************************************
|
2004-09-27 21:36:25 +00:00
|
|
|
* Copyright (C) 2004 by Enrico Ros <eros.kde@email.it> *
|
2004-08-26 21:17:24 +00:00
|
|
|
* Copyright (C) 2004 by Albert Astals Cid <tsdgeos@terra.es> *
|
|
|
|
* *
|
2005-01-02 14:29:37 +00:00
|
|
|
* With portions of code from kpdf/kpdf_pagewidget.h by: *
|
2004-09-27 21:36:25 +00:00
|
|
|
* Copyright (C) 2002 by Wilco Greven <greven@kde.org> *
|
|
|
|
* Copyright (C) 2003 by Christophe Devriese *
|
|
|
|
* <Christophe.Devriese@student.kuleuven.ac.be> *
|
|
|
|
* Copyright (C) 2003 by Laurent Montel <montel@kde.org> *
|
|
|
|
* Copyright (C) 2003 by Kurt Pfeifle <kpfeifle@danka.de> *
|
|
|
|
* *
|
2004-08-26 21:17:24 +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. *
|
|
|
|
***************************************************************************/
|
2004-10-29 21:52:06 +00:00
|
|
|
// This file follows coding style described in kdebase/kicker/HACKING
|
2004-08-26 21:17:24 +00:00
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
#ifndef _OKULAR_PAGEVIEW_H_
|
|
|
|
#define _OKULAR_PAGEVIEW_H_
|
2002-08-30 09:14:01 +00:00
|
|
|
|
2009-06-29 20:55:50 +00:00
|
|
|
#include <qabstractscrollarea.h>
|
2006-10-03 17:13:42 +00:00
|
|
|
#include <qlist.h>
|
2006-03-23 20:43:38 +00:00
|
|
|
#include <qvector.h>
|
- 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
|
|
|
#include "ui/pageviewutils.h"
|
2006-10-03 17:13:42 +00:00
|
|
|
#include "core/area.h"
|
2005-01-02 14:55:14 +00:00
|
|
|
#include "core/observer.h"
|
2008-04-27 11:17:05 +00:00
|
|
|
#include "core/view.h"
|
2004-08-28 09:27:38 +00:00
|
|
|
|
2007-02-25 00:07:59 +00:00
|
|
|
class KAction;
|
2004-09-11 15:59:32 +00:00
|
|
|
class KActionCollection;
|
2010-09-11 13:34:22 +00:00
|
|
|
class KMenu;
|
2007-05-05 13:50:44 +00:00
|
|
|
class KUrl;
|
2004-09-04 22:28:14 +00:00
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
namespace Okular {
|
2008-03-20 17:45:37 +00:00
|
|
|
class Action;
|
2006-09-21 08:45:36 +00:00
|
|
|
class Document;
|
2007-03-18 17:14:36 +00:00
|
|
|
class Annotation;
|
2011-08-25 00:25:43 +00:00
|
|
|
class FormField;
|
2006-09-21 08:45:36 +00:00
|
|
|
}
|
|
|
|
|
2007-10-18 22:09:49 +00:00
|
|
|
class FormWidgetIface;
|
2006-09-21 08:45:36 +00:00
|
|
|
class PageViewPrivate;
|
2003-09-14 14:32:05 +00:00
|
|
|
|
2004-09-26 23:39:39 +00:00
|
|
|
/**
|
2005-03-05 15:59:15 +00:00
|
|
|
* @short The main view. Handles zoom and continuous mode.. oh, and page
|
2004-10-20 16:41:13 +00:00
|
|
|
* @short display of course :-)
|
2004-10-29 21:52:06 +00:00
|
|
|
* ...
|
2004-09-26 23:39:39 +00:00
|
|
|
*/
|
2009-06-29 20:55:50 +00:00
|
|
|
class PageView : public QAbstractScrollArea, public Okular::DocumentObserver, public Okular::View
|
2004-09-12 23:19:03 +00:00
|
|
|
{
|
2006-10-07 14:40:32 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
public:
|
2006-09-21 08:45:36 +00:00
|
|
|
PageView( QWidget *parent, Okular::Document *document );
|
2004-10-29 21:52:06 +00:00
|
|
|
~PageView();
|
|
|
|
|
|
|
|
// Zoom mode ( last 4 are internally used only! )
|
2005-06-24 16:43:19 +00:00
|
|
|
enum ZoomMode { ZoomFixed = 0, ZoomFitWidth = 1, ZoomFitPage = 2, ZoomFitText,
|
2004-11-03 17:35:48 +00:00
|
|
|
ZoomIn, ZoomOut, ZoomRefreshCurrent };
|
2007-09-14 10:02:33 +00:00
|
|
|
enum MouseMode { MouseNormal, MouseZoom, MouseSelect, MouseImageSelect, MouseTextSelect };
|
2004-10-29 21:52:06 +00:00
|
|
|
|
|
|
|
// create actions that interact with this widget
|
2007-07-14 12:31:26 +00:00
|
|
|
void setupBaseActions( KActionCollection * collection );
|
2004-10-29 21:52:06 +00:00
|
|
|
void setupActions( KActionCollection * collection );
|
|
|
|
|
2005-03-04 23:06:24 +00:00
|
|
|
// misc methods (from RMB menu/children)
|
2006-11-19 13:50:41 +00:00
|
|
|
bool canFitPageWidth() const;
|
2005-01-09 23:37:07 +00:00
|
|
|
void fitPageWidth( int page );
|
- 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
|
|
|
// keep in sync with pageviewutils
|
2010-08-21 15:47:33 +00:00
|
|
|
void displayMessage( const QString & message, const QString & details = QString(), PageViewMessage::Icon icon=PageViewMessage::Info, int duration=-1 );
|
2004-12-04 23:23:18 +00:00
|
|
|
|
2005-01-09 23:37:07 +00:00
|
|
|
// inherited from DocumentObserver
|
2004-10-29 21:52:06 +00:00
|
|
|
uint observerId() const { return PAGEVIEW_ID; }
|
2007-09-09 10:50:36 +00:00
|
|
|
void notifySetup( const QVector< Okular::Page * > & pages, int setupFlags );
|
2005-02-01 18:23:55 +00:00
|
|
|
void notifyViewportChanged( bool smoothMove );
|
2005-01-09 23:37:07 +00:00
|
|
|
void notifyPageChanged( int pageNumber, int changedFlags );
|
|
|
|
void notifyContentsCleared( int changedFlags );
|
2007-07-08 14:25:08 +00:00
|
|
|
void notifyZoom(int factor);
|
2006-11-20 20:10:42 +00:00
|
|
|
bool canUnloadPixmap( int pageNum ) const;
|
2004-10-29 21:52:06 +00:00
|
|
|
|
2008-04-27 11:17:05 +00:00
|
|
|
// inherited from View
|
2008-04-27 14:30:26 +00:00
|
|
|
uint viewId() const { return observerId(); }
|
2008-04-27 11:17:05 +00:00
|
|
|
bool supportsCapability( ViewCapability capability ) const;
|
|
|
|
CapabilityFlags capabilityFlags( ViewCapability capability ) const;
|
|
|
|
QVariant capability( ViewCapability capability ) const;
|
|
|
|
void setCapability( ViewCapability capability, const QVariant &option );
|
|
|
|
|
2006-10-03 17:13:42 +00:00
|
|
|
QList< Okular::RegularAreaRect * > textSelections( const QPoint& start, const QPoint& end, int& firstpage );
|
2006-10-22 20:53:56 +00:00
|
|
|
Okular::RegularAreaRect * textSelectionForItem( PageViewItem * item, const QPoint & startPoint = QPoint(), const QPoint & endPoint = QPoint() );
|
2006-10-03 17:13:42 +00:00
|
|
|
|
2006-10-28 22:58:05 +00:00
|
|
|
void reparseConfig();
|
|
|
|
|
2007-02-25 00:07:59 +00:00
|
|
|
KAction *toggleFormsAction() const;
|
|
|
|
|
2009-06-29 20:55:50 +00:00
|
|
|
int contentAreaWidth() const;
|
|
|
|
int contentAreaHeight() const;
|
|
|
|
QPoint contentAreaPosition() const;
|
|
|
|
QPoint contentAreaPoint( const QPoint & pos ) const;
|
|
|
|
|
- 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
|
|
|
public slots:
|
2008-08-23 11:07:45 +00:00
|
|
|
void errorMessage( const QString & message, int duration = -1 )
|
- 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
|
|
|
{
|
2010-08-21 15:47:33 +00:00
|
|
|
displayMessage( message, QString(), PageViewMessage::Error, duration );
|
- 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
|
|
|
}
|
|
|
|
|
2008-08-23 11:07:45 +00:00
|
|
|
void noticeMessage( const QString & message, int duration = -1 )
|
- 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
|
|
|
{
|
2010-08-21 15:47:33 +00:00
|
|
|
displayMessage( message, QString(), PageViewMessage::Info, duration );
|
- 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
|
|
|
}
|
|
|
|
|
2008-08-23 11:07:45 +00:00
|
|
|
void warningMessage( const QString & message, int duration = -1 )
|
- 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
|
|
|
{
|
2010-08-21 15:47:33 +00:00
|
|
|
displayMessage( message, QString(), PageViewMessage::Warning, duration );
|
- 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
|
|
|
}
|
|
|
|
|
2006-11-24 21:02:38 +00:00
|
|
|
void copyTextSelection() const;
|
2007-09-03 21:35:05 +00:00
|
|
|
void selectAll();
|
2006-11-24 21:02:38 +00:00
|
|
|
|
2006-12-30 12:40:54 +00:00
|
|
|
void setAnnotationWindow( Okular::Annotation *annotation );
|
|
|
|
|
|
|
|
void removeAnnotationWindow( Okular::Annotation *annotation );
|
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
signals:
|
2006-03-24 20:40:02 +00:00
|
|
|
void urlDropped( const KUrl& );
|
2006-09-21 08:45:36 +00:00
|
|
|
void rightClick( const Okular::Page *, const QPoint & );
|
2004-10-29 21:52:06 +00:00
|
|
|
|
|
|
|
protected:
|
2006-10-07 14:40:32 +00:00
|
|
|
void resizeEvent( QResizeEvent* );
|
2004-10-29 21:52:06 +00:00
|
|
|
|
|
|
|
// mouse / keyboard events
|
|
|
|
void keyPressEvent( QKeyEvent* );
|
2007-09-23 17:45:36 +00:00
|
|
|
void keyReleaseEvent( QKeyEvent* );
|
2006-08-14 15:03:12 +00:00
|
|
|
void inputMethodEvent( QInputMethodEvent * );
|
2004-10-29 21:52:06 +00:00
|
|
|
void wheelEvent( QWheelEvent* );
|
|
|
|
|
|
|
|
// drag and drop related events
|
|
|
|
void dragEnterEvent( QDragEnterEvent* );
|
2006-09-26 22:22:01 +00:00
|
|
|
void dragMoveEvent( QDragMoveEvent* );
|
2004-10-29 21:52:06 +00:00
|
|
|
void dropEvent( QDropEvent* );
|
|
|
|
|
2009-06-29 20:55:50 +00:00
|
|
|
void paintEvent( QPaintEvent *e );
|
|
|
|
void mouseMoveEvent( QMouseEvent *e );
|
|
|
|
void mousePressEvent( QMouseEvent *e );
|
|
|
|
void mouseReleaseEvent( QMouseEvent *e );
|
2010-03-23 20:21:42 +00:00
|
|
|
void mouseDoubleClickEvent( QMouseEvent *e );
|
2006-10-07 14:40:32 +00:00
|
|
|
|
2009-06-29 20:55:50 +00:00
|
|
|
bool viewportEvent( QEvent *e );
|
|
|
|
|
2009-07-07 16:53:33 +00:00
|
|
|
void scrollContentsBy( int dx, int dy );
|
|
|
|
|
2009-06-29 20:55:50 +00:00
|
|
|
private:
|
2005-04-01 16:24:11 +00:00
|
|
|
// draw background and items on the opened qpainter
|
|
|
|
void drawDocumentOnPainter( const QRect & pageViewRect, QPainter * p );
|
2004-10-30 20:54:48 +00:00
|
|
|
// update item width and height using current zoom parameters
|
|
|
|
void updateItemSize( PageViewItem * item, int columnWidth, int rowHeight );
|
|
|
|
// return the widget placed on a certain point or 0 if clicking on empty space
|
|
|
|
PageViewItem * pickItemOnPoint( int x, int y );
|
2004-11-03 17:35:48 +00:00
|
|
|
// start / modify / clear selection rectangle
|
2006-09-26 22:22:01 +00:00
|
|
|
void selectionStart( const QPoint & pos, const QColor & color, bool aboveAll = false );
|
|
|
|
void selectionEndPoint( const QPoint & pos );
|
2004-11-03 17:35:48 +00:00
|
|
|
void selectionClear();
|
2004-10-29 21:52:06 +00:00
|
|
|
// update internal zoom values and end in a slotRelayoutPages();
|
|
|
|
void updateZoom( ZoomMode newZm );
|
|
|
|
// update the text on the label using global zoom value or current page's one
|
|
|
|
void updateZoomText();
|
2006-10-07 14:40:32 +00:00
|
|
|
void textSelectionClear();
|
2004-12-26 21:20:17 +00:00
|
|
|
// updates cursor
|
|
|
|
void updateCursor( const QPoint &p );
|
2006-08-14 15:03:12 +00:00
|
|
|
|
2006-10-16 19:47:20 +00:00
|
|
|
int viewColumns() const;
|
2006-10-07 14:40:32 +00:00
|
|
|
|
|
|
|
void center(int cx, int cy);
|
2005-01-28 17:21:28 +00:00
|
|
|
|
2007-02-25 00:07:59 +00:00
|
|
|
void toggleFormWidgets( bool on );
|
|
|
|
|
2009-06-29 20:55:50 +00:00
|
|
|
void resizeContentArea( const QSize & newSize );
|
2011-09-07 22:43:30 +00:00
|
|
|
void updatePageStep();
|
2009-06-29 20:55:50 +00:00
|
|
|
|
2010-09-11 13:34:22 +00:00
|
|
|
void addWebShortcutsMenu( KMenu * menu, const QString & text );
|
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
// don't want to expose classes in here
|
|
|
|
class PageViewPrivate * d;
|
|
|
|
|
|
|
|
private slots:
|
2011-03-17 15:24:44 +00:00
|
|
|
// activated either directly or via queued connection on notifySetup
|
2004-10-29 21:52:06 +00:00
|
|
|
void slotRelayoutPages();
|
2011-03-17 15:24:44 +00:00
|
|
|
// activated by the resize event delay timer
|
|
|
|
void delayedResizeEvent();
|
2004-10-29 21:52:06 +00:00
|
|
|
// activated either directly or via the contentsMoving(int,int) signal
|
2008-04-16 11:04:59 +00:00
|
|
|
void slotRequestVisiblePixmaps( int newValue = -1 );
|
2005-02-01 18:24:16 +00:00
|
|
|
// activated by the viewport move timer
|
|
|
|
void slotMoveViewport();
|
2004-10-29 21:52:06 +00:00
|
|
|
// activated by the autoscroll timer (Shift+Up/Down keys)
|
|
|
|
void slotAutoScoll();
|
2006-11-22 21:32:21 +00:00
|
|
|
// activated by the dragScroll timer
|
|
|
|
void slotDragScroll();
|
|
|
|
// show the welcome message
|
2006-09-20 13:58:28 +00:00
|
|
|
void slotShowWelcome();
|
2010-03-25 20:59:16 +00:00
|
|
|
// activated by left click timer
|
|
|
|
void slotShowSizeAllCursor();
|
2005-01-28 17:21:28 +00:00
|
|
|
|
2010-09-11 13:34:22 +00:00
|
|
|
void slotHandleWebShortcutAction();
|
|
|
|
void slotConfigureWebShortcuts();
|
|
|
|
|
2005-02-01 18:24:16 +00:00
|
|
|
// connected to local actions (toolbar, menu, ..)
|
2004-10-29 21:52:06 +00:00
|
|
|
void slotZoom();
|
|
|
|
void slotZoomIn();
|
|
|
|
void slotZoomOut();
|
|
|
|
void slotFitToWidthToggled( bool );
|
|
|
|
void slotFitToPageToggled( bool );
|
|
|
|
void slotFitToTextToggled( bool );
|
2008-10-12 16:36:14 +00:00
|
|
|
void slotViewMode( QAction *action );
|
2005-03-05 15:59:15 +00:00
|
|
|
void slotContinuousToggled( bool );
|
2004-10-29 21:52:06 +00:00
|
|
|
void slotSetMouseNormal();
|
2004-11-03 17:35:48 +00:00
|
|
|
void slotSetMouseZoom();
|
2004-11-16 17:36:02 +00:00
|
|
|
void slotSetMouseSelect();
|
2006-09-26 22:22:01 +00:00
|
|
|
void slotSetMouseTextSelect();
|
2005-03-04 23:06:24 +00:00
|
|
|
void slotToggleAnnotator( bool );
|
2004-10-29 21:52:06 +00:00
|
|
|
void slotScrollUp();
|
|
|
|
void slotScrollDown();
|
2007-01-19 21:43:53 +00:00
|
|
|
void slotRotateClockwise();
|
|
|
|
void slotRotateCounterClockwise();
|
|
|
|
void slotRotateOriginal();
|
2007-05-01 23:21:29 +00:00
|
|
|
void slotPageSizes( int );
|
2008-05-27 14:00:59 +00:00
|
|
|
void slotTrimMarginsToggled( bool );
|
2007-02-25 00:07:59 +00:00
|
|
|
void slotToggleForms();
|
2007-10-18 22:09:49 +00:00
|
|
|
void slotFormWidgetChanged( FormWidgetIface *w );
|
2008-03-07 16:09:08 +00:00
|
|
|
void slotRefreshPage();
|
2008-03-05 11:06:55 +00:00
|
|
|
void slotSpeakDocument();
|
|
|
|
void slotSpeakCurrentPage();
|
2008-03-05 12:05:48 +00:00
|
|
|
void slotStopSpeaks();
|
2008-03-20 17:45:37 +00:00
|
|
|
void slotAction( Okular::Action *action );
|
2011-08-25 00:25:43 +00:00
|
|
|
void slotFormFieldChanged( Okular::FormField *formField );
|
2011-06-08 05:47:57 +00:00
|
|
|
void externalKeyPressEvent( QKeyEvent *e );
|
2004-09-12 23:19:03 +00:00
|
|
|
};
|
2004-08-26 23:25:52 +00:00
|
|
|
|
2002-08-30 09:14:01 +00:00
|
|
|
#endif
|