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> *
|
2013-03-14 22:09:07 +00:00
|
|
|
* Copyright (C) 2004 by Albert Astals Cid <aacid@kde.org> *
|
2017-11-16 08:57:58 +00:00
|
|
|
* Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group *
|
|
|
|
* company, info@kdab.com. Work sponsored by the *
|
|
|
|
* LiMux project of the city of Munich *
|
2004-08-26 21:17:24 +00:00
|
|
|
* *
|
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
|
|
|
|
2004-09-11 15:59:32 +00:00
|
|
|
class KActionCollection;
|
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;
|
2011-11-01 21:13:20 +00:00
|
|
|
class DocumentViewport;
|
2019-01-05 22:30:25 +00:00
|
|
|
class FormFieldSignature;
|
2007-03-18 17:14:36 +00:00
|
|
|
class Annotation;
|
2012-04-03 12:18:10 +00:00
|
|
|
class MovieAction;
|
2012-09-27 12:15:58 +00:00
|
|
|
class RenditionAction;
|
2006-09-21 08:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class PageViewPrivate;
|
2003-09-14 14:32:05 +00:00
|
|
|
|
2014-02-24 22:42:10 +00:00
|
|
|
|
2016-10-15 13:22:35 +00:00
|
|
|
class QGestureEvent;
|
|
|
|
|
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 );
|
2019-12-18 11:51:13 +00:00
|
|
|
~PageView() override;
|
2004-10-29 21:52:06 +00:00
|
|
|
|
Create new "Zoom to 100%" action
Summary:
This patch implements a "Zoom to 100%" action and sticks it in the {nav View} menu. Since it's a `KStandardAction` with a `KStandardShortcut`, we automatically get the correct icon and keyboard shortcut, but we do override the name to be "Zoom to 100%" since that's clearer for Okular's use case.
FEATURE: 400048
FIXED-IN: 18.12.0
Test Plan:
- Action works to zoom the document to 100% scale when invoked
- Action is disabled when document is opened at 100% scale or is manually zoomed to 100% scale after being opened
- All other zoom modes and action still work
{F6341045}
Reviewers: #okular, #vdg, abetts
Reviewed By: #vdg, abetts
Subscribers: davidhurka, sander, tobiasdeiminger, veqz, abetts, aacid, okular-devel
Tags: #okular
Differential Revision: https://phabricator.kde.org/D16345
2018-10-21 03:54:49 +00:00
|
|
|
// Zoom mode ( last 4 are internally used only! )
|
2013-08-18 15:19:20 +00:00
|
|
|
enum ZoomMode { ZoomFixed = 0, ZoomFitWidth = 1, ZoomFitPage = 2, ZoomFitAuto = 3,
|
Create new "Zoom to 100%" action
Summary:
This patch implements a "Zoom to 100%" action and sticks it in the {nav View} menu. Since it's a `KStandardAction` with a `KStandardShortcut`, we automatically get the correct icon and keyboard shortcut, but we do override the name to be "Zoom to 100%" since that's clearer for Okular's use case.
FEATURE: 400048
FIXED-IN: 18.12.0
Test Plan:
- Action works to zoom the document to 100% scale when invoked
- Action is disabled when document is opened at 100% scale or is manually zoomed to 100% scale after being opened
- All other zoom modes and action still work
{F6341045}
Reviewers: #okular, #vdg, abetts
Reviewed By: #vdg, abetts
Subscribers: davidhurka, sander, tobiasdeiminger, veqz, abetts, aacid, okular-devel
Tags: #okular
Differential Revision: https://phabricator.kde.org/D16345
2018-10-21 03:54:49 +00:00
|
|
|
ZoomIn, ZoomOut, ZoomRefreshCurrent, ZoomActual };
|
2004-10-29 21:52:06 +00:00
|
|
|
|
2011-10-31 15:33:03 +00:00
|
|
|
enum ClearMode { ClearAllSelection, ClearOnlyDividers };
|
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
// create actions that interact with this widget
|
2019-12-20 15:40:59 +00:00
|
|
|
void setupBaseActions( KActionCollection * ac );
|
|
|
|
void setupViewerActions( KActionCollection * ac );
|
|
|
|
void setupActions( KActionCollection * ac );
|
|
|
|
void updateActionState( bool docHasPages, bool documentChanged, bool docHasFormWidgets );
|
2004-10-29 21:52:06 +00:00
|
|
|
|
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
|
2017-03-02 19:39:24 +00:00
|
|
|
void notifySetup( const QVector< Okular::Page * > & pages, int setupFlags ) override;
|
|
|
|
void notifyViewportChanged( bool smoothMove ) override;
|
|
|
|
void notifyPageChanged( int pageNumber, int changedFlags ) override;
|
|
|
|
void notifyContentsCleared( int changedFlags ) override;
|
|
|
|
void notifyZoom(int factor) override;
|
|
|
|
bool canUnloadPixmap( int pageNum ) const override;
|
|
|
|
void notifyCurrentPageChanged( int previous, int current ) override;
|
2004-10-29 21:52:06 +00:00
|
|
|
|
2008-04-27 11:17:05 +00:00
|
|
|
// inherited from View
|
2017-03-02 19:39:24 +00:00
|
|
|
bool supportsCapability( ViewCapability capability ) const override;
|
|
|
|
CapabilityFlags capabilityFlags( ViewCapability capability ) const override;
|
|
|
|
QVariant capability( ViewCapability capability ) const override;
|
|
|
|
void setCapability( ViewCapability capability, const QVariant &option ) override;
|
2008-04-27 11:17:05 +00:00
|
|
|
|
2006-10-03 17:13:42 +00:00
|
|
|
QList< Okular::RegularAreaRect * > textSelections( const QPoint& start, const QPoint& end, int& firstpage );
|
2019-03-26 22:37:30 +00:00
|
|
|
Okular::RegularAreaRect * textSelectionForItem( const 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();
|
|
|
|
|
2013-05-28 21:55:10 +00:00
|
|
|
KActionCollection *actionCollection() const;
|
2014-08-13 10:45:40 +00:00
|
|
|
QAction *toggleFormsAction() const;
|
2007-02-25 00:07:59 +00:00
|
|
|
|
2009-06-29 20:55:50 +00:00
|
|
|
int contentAreaWidth() const;
|
|
|
|
int contentAreaHeight() const;
|
|
|
|
QPoint contentAreaPosition() const;
|
|
|
|
QPoint contentAreaPoint( const QPoint & pos ) const;
|
2012-10-15 18:21:43 +00:00
|
|
|
QPointF contentAreaPoint( const QPointF & pos ) const;
|
2009-06-29 20:55:50 +00:00
|
|
|
|
2011-11-07 21:07:10 +00:00
|
|
|
bool areSourceLocationsShownGraphically() const;
|
|
|
|
void setShowSourceLocationsGraphically(bool show);
|
|
|
|
|
2011-11-01 21:13:20 +00:00
|
|
|
void setLastSourceLocationViewport( const Okular::DocumentViewport& vp );
|
2011-11-05 09:18:08 +00:00
|
|
|
void clearLastSourceLocationViewport();
|
2013-06-23 18:42:19 +00:00
|
|
|
|
|
|
|
void updateCursor();
|
|
|
|
|
2019-01-05 22:30:25 +00:00
|
|
|
void highlightSignatureFormWidget( const Okular::FormFieldSignature *form );
|
|
|
|
|
2016-07-11 17:30:31 +00:00
|
|
|
public Q_SLOTS:
|
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
|
|
|
|
2012-01-17 22:46:37 +00:00
|
|
|
void openAnnotationWindow( Okular::Annotation *annotation, int pageNumber );
|
2015-07-20 16:55:35 +00:00
|
|
|
void reloadForms();
|
2006-12-30 12:40:54 +00:00
|
|
|
|
2018-06-26 11:05:25 +00:00
|
|
|
void slotToggleChangeColors();
|
|
|
|
void slotSetChangeColors(bool active);
|
|
|
|
|
Add action in Edit menu to select the text on current page
BUG: 358868
Test Plan: Click on "Select All Text on Current Page" entry in Edit menu to select the entire page. The selected text can then be copied via Edit menu item "Copy"
Reviewers: aacid, #vdg, ngraham
Reviewed By: #vdg, ngraham
Subscribers: yurchor, michaelweghorn, kde-doc-english, davidhurka, abetts, loh.tar, alexde, ngraham, okular-devel
Tags: #okular, #documentation
Differential Revision: https://phabricator.kde.org/D18744
2019-04-21 23:06:54 +00:00
|
|
|
void slotSelectPage();
|
|
|
|
|
2016-07-11 17:30:31 +00:00
|
|
|
Q_SIGNALS:
|
2006-09-21 08:45:36 +00:00
|
|
|
void rightClick( const Okular::Page *, const QPoint & );
|
2012-07-10 16:45:23 +00:00
|
|
|
void mouseBackButtonClick();
|
|
|
|
void mouseForwardButtonClick();
|
2012-07-12 18:46:24 +00:00
|
|
|
void escPressed();
|
2015-03-16 23:20:11 +00:00
|
|
|
void fitWindowToPage( const QSize& pageViewPortSize, const QSize& pageSize );
|
2019-08-25 10:19:43 +00:00
|
|
|
void triggerSearch( const QString& text );
|
2004-10-29 21:52:06 +00:00
|
|
|
|
|
|
|
protected:
|
2017-03-02 19:39:24 +00:00
|
|
|
bool event( QEvent * event ) override;
|
2016-10-15 13:22:35 +00:00
|
|
|
|
2017-03-02 19:39:24 +00:00
|
|
|
void resizeEvent( QResizeEvent* ) override;
|
2016-10-15 13:22:35 +00:00
|
|
|
bool gestureEvent( QGestureEvent * e );
|
2004-10-29 21:52:06 +00:00
|
|
|
|
|
|
|
// mouse / keyboard events
|
2017-03-02 19:39:24 +00:00
|
|
|
void keyPressEvent( QKeyEvent* ) override;
|
|
|
|
void keyReleaseEvent( QKeyEvent* ) override;
|
|
|
|
void inputMethodEvent( QInputMethodEvent * ) override;
|
|
|
|
void wheelEvent( QWheelEvent* ) override;
|
2004-10-29 21:52:06 +00:00
|
|
|
|
2017-03-02 19:39:24 +00:00
|
|
|
void paintEvent( QPaintEvent *e ) override;
|
|
|
|
void tabletEvent (QTabletEvent *e ) override;
|
|
|
|
void mouseMoveEvent( QMouseEvent *e ) override;
|
|
|
|
void mousePressEvent( QMouseEvent *e ) override;
|
|
|
|
void mouseReleaseEvent( QMouseEvent *e ) override;
|
|
|
|
void mouseDoubleClickEvent( QMouseEvent *e ) override;
|
2006-10-07 14:40:32 +00:00
|
|
|
|
2017-03-02 19:39:24 +00:00
|
|
|
bool viewportEvent( QEvent *e ) override;
|
2009-06-29 20:55:50 +00:00
|
|
|
|
2017-03-02 19:39:24 +00:00
|
|
|
void scrollContentsBy( int dx, int dy ) override;
|
2009-07-07 16:53:33 +00:00
|
|
|
|
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
|
2019-12-20 15:40:59 +00:00
|
|
|
void drawDocumentOnPainter( const QRect & contentsRect, QPainter * p );
|
2004-10-30 20:54:48 +00:00
|
|
|
// update item width and height using current zoom parameters
|
2019-12-20 15:40:59 +00:00
|
|
|
void updateItemSize( PageViewItem * item, int colWidth, int rowHeight );
|
2004-10-30 20:54:48 +00:00
|
|
|
// 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 );
|
2011-10-31 15:33:03 +00:00
|
|
|
void selectionClear( const ClearMode mode = ClearAllSelection );
|
2011-10-12 13:50:56 +00:00
|
|
|
void drawTableDividers(QPainter * screenPainter);
|
2011-10-31 15:33:03 +00:00
|
|
|
void guessTableDividers();
|
2012-09-28 15:57:03 +00:00
|
|
|
// update either text or rectangle selection
|
|
|
|
void updateSelection( const QPoint & pos );
|
2014-05-05 22:43:40 +00:00
|
|
|
// compute the zoom factor value for FitWidth and FitPage mode
|
|
|
|
double zoomFactorFitMode( ZoomMode mode );
|
2004-10-29 21:52:06 +00:00
|
|
|
// update internal zoom values and end in a slotRelayoutPages();
|
2019-12-20 15:40:59 +00:00
|
|
|
void updateZoom( ZoomMode newZoomMode );
|
2004-10-29 21:52:06 +00:00
|
|
|
// update the text on the label using global zoom value or current page's one
|
|
|
|
void updateZoomText();
|
2019-09-18 07:40:06 +00:00
|
|
|
// update view mode (single, facing...)
|
|
|
|
void updateViewMode ( const int nr );
|
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
|
|
|
|
2014-02-24 22:42:10 +00:00
|
|
|
void moveMagnifier( const QPoint &p );
|
|
|
|
void updateMagnifier( const QPoint &p );
|
|
|
|
|
2006-10-16 19:47:20 +00:00
|
|
|
int viewColumns() const;
|
2006-10-07 14:40:32 +00:00
|
|
|
|
2019-11-15 16:08:25 +00:00
|
|
|
void center(int cx, int cy, bool smoothMove = false);
|
|
|
|
void scrollTo( int x, int y, bool smoothMove = false);
|
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
|
|
|
|
2019-08-25 10:19:43 +00:00
|
|
|
void addSearchWithinDocumentAction(QMenu * menu, const QString & searchText );
|
2014-08-13 10:45:40 +00:00
|
|
|
void addWebShortcutsMenu( QMenu * menu, const QString & text );
|
2017-09-21 20:16:31 +00:00
|
|
|
QMenu* createProcessLinkMenu( PageViewItem *item, const QPoint & eventPos );
|
2012-09-28 15:57:03 +00:00
|
|
|
// used when selecting stuff, makes the view scroll as necessary to keep the mouse inside the view
|
|
|
|
void scrollPosIntoView( const QPoint & pos );
|
Fix inconsistent viewport positioning in PageView
Summary:
This diff unifies the calculation of the viewport position from a given DocumentViewport. PageView::notifyViewportChanged and PageView::slotRelayoutPages used to handle it differntly, which resulted in viewport jumps for no reason.
It happened in various situations, e.g. when jumping to a page using the footer page navigation, or when reloading the document after presentation mode left, or when resizing the main window after presentation mode left.
The diff selects the notifyViewportChanged way (align viewport top border with page top margin) as golden behavior in case of rePos.enabled == false.
BUGS: 357958
CCBUG: 341939
CCBUG: 400890
341939 and 400890 are fixed partially. These two still suffer from a minor displacement that happens when finished signal arrives from pixmap generation thread.
Test Plan:
- When using the footer page navigation to jump to different pages, new page top is always algined with viewport top.
- After changing page with footer page navigation, press F5 to reload. Page top stays aligned with viewport top.
- When exiting presentation mode, and touching the file, page top stays aligned with viewport top.
- When exiting presentation mode, and changing main window size, page top stays aligned with viewport top.
Reviewers: #okular, sander
Reviewed By: sander
Subscribers: ngraham, sander, aacid, okular-devel
Tags: #okular
Differential Revision: https://phabricator.kde.org/D16941
2018-11-22 17:50:14 +00:00
|
|
|
QPoint viewportToContentArea( const Okular::DocumentViewport & vp ) const;
|
2010-09-11 13:34:22 +00:00
|
|
|
|
2015-08-27 20:09:02 +00:00
|
|
|
// called from slots to turn off trim modes mutually exclusive to id
|
|
|
|
void updateTrimMode( int except_id );
|
|
|
|
|
2017-09-21 20:16:31 +00:00
|
|
|
// handle link clicked
|
|
|
|
bool mouseReleaseOverLink( const Okular::ObjectRect * rect ) const;
|
|
|
|
|
2017-10-26 07:47:18 +00:00
|
|
|
void createAnnotationsVideoWidgets(PageViewItem *item, const QLinkedList< Okular::Annotation * > &annotations);
|
|
|
|
|
2004-10-29 21:52:06 +00:00
|
|
|
// don't want to expose classes in here
|
|
|
|
class PageViewPrivate * d;
|
|
|
|
|
2016-07-11 17:30:31 +00:00
|
|
|
private Q_SLOTS:
|
2011-11-02 21:46:23 +00:00
|
|
|
// used to decouple the notifyViewportChanged calle
|
|
|
|
void slotRealNotifyViewportChanged(bool smoothMove);
|
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 );
|
2004-10-29 21:52:06 +00:00
|
|
|
// activated by the autoscroll timer (Shift+Up/Down keys)
|
2016-10-01 10:52:30 +00:00
|
|
|
void slotAutoScroll();
|
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();
|
Create new "Zoom to 100%" action
Summary:
This patch implements a "Zoom to 100%" action and sticks it in the {nav View} menu. Since it's a `KStandardAction` with a `KStandardShortcut`, we automatically get the correct icon and keyboard shortcut, but we do override the name to be "Zoom to 100%" since that's clearer for Okular's use case.
FEATURE: 400048
FIXED-IN: 18.12.0
Test Plan:
- Action works to zoom the document to 100% scale when invoked
- Action is disabled when document is opened at 100% scale or is manually zoomed to 100% scale after being opened
- All other zoom modes and action still work
{F6341045}
Reviewers: #okular, #vdg, abetts
Reviewed By: #vdg, abetts
Subscribers: davidhurka, sander, tobiasdeiminger, veqz, abetts, aacid, okular-devel
Tags: #okular
Differential Revision: https://phabricator.kde.org/D16345
2018-10-21 03:54:49 +00:00
|
|
|
void slotZoomActual();
|
2004-10-29 21:52:06 +00:00
|
|
|
void slotFitToWidthToggled( bool );
|
|
|
|
void slotFitToPageToggled( bool );
|
2013-08-18 15:19:20 +00:00
|
|
|
void slotAutoFitToggled( 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();
|
2014-02-24 22:42:10 +00:00
|
|
|
void slotSetMouseMagnifier();
|
2004-11-16 17:36:02 +00:00
|
|
|
void slotSetMouseSelect();
|
2006-09-26 22:22:01 +00:00
|
|
|
void slotSetMouseTextSelect();
|
2011-10-12 13:50:56 +00:00
|
|
|
void slotSetMouseTableSelect();
|
2005-03-04 23:06:24 +00:00
|
|
|
void slotToggleAnnotator( bool );
|
2012-09-05 20:12:11 +00:00
|
|
|
void slotAutoScrollUp();
|
|
|
|
void slotAutoScrollDown();
|
2019-11-15 16:08:25 +00:00
|
|
|
void slotScrollUp( int nSteps = 0 );
|
|
|
|
void slotScrollDown(int nSteps = 0 );
|
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 );
|
2015-08-27 20:09:02 +00:00
|
|
|
void slotTrimToSelectionToggled( bool );
|
2007-02-25 00:07:59 +00:00
|
|
|
void slotToggleForms();
|
2013-06-03 20:46:41 +00:00
|
|
|
void slotFormChanged( int pageNumber );
|
2008-03-07 16:09:08 +00:00
|
|
|
void slotRefreshPage();
|
2014-11-08 04:33:23 +00:00
|
|
|
#ifdef HAVE_SPEECH
|
2008-03-05 11:06:55 +00:00
|
|
|
void slotSpeakDocument();
|
|
|
|
void slotSpeakCurrentPage();
|
2008-03-05 12:05:48 +00:00
|
|
|
void slotStopSpeaks();
|
2019-09-19 19:50:58 +00:00
|
|
|
void slotPauseResumeSpeech();
|
2014-11-08 04:33:23 +00:00
|
|
|
#endif
|
2008-03-20 17:45:37 +00:00
|
|
|
void slotAction( Okular::Action *action );
|
2011-06-08 05:47:57 +00:00
|
|
|
void externalKeyPressEvent( QKeyEvent *e );
|
2012-01-17 22:46:37 +00:00
|
|
|
void slotAnnotationWindowDestroyed( QObject *window );
|
2012-04-03 12:18:10 +00:00
|
|
|
void slotProcessMovieAction( const Okular::MovieAction *action );
|
2012-09-27 12:15:58 +00:00
|
|
|
void slotProcessRenditionAction( const Okular::RenditionAction *action );
|
2015-03-16 23:20:11 +00:00
|
|
|
void slotFitWindowToPage();
|
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
|
2012-10-15 18:21:43 +00:00
|
|
|
|
|
|
|
/* kate: replace-tabs on; indent-width 4; */
|