Changeset View
Changeset View
Standalone View
Standalone View
ui/pageview.h
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | |||||
44 | 44 | | |||
45 | class PageViewPrivate; | 45 | class PageViewPrivate; | ||
46 | 46 | | |||
47 | 47 | | |||
48 | class QGestureEvent; | 48 | class QGestureEvent; | ||
49 | 49 | | |||
50 | /** | 50 | /** | ||
51 | * @short The main view. Handles zoom and continuous mode.. oh, and page | 51 | * @short The main view. Handles zoom and continuous mode.. oh, and page | ||
52 | * @short display of course :-) | 52 | * display of course :-) | ||
53 | * ... | 53 | * | ||
54 | * @par Coordinate Systems | ||||
55 | * @parblock | ||||
56 | * This is a scroll area, so it uses two straightforward coordinate systems: | ||||
aacid: i kind of know how this works, and i don't understand what "shown pages" is supposed to mean. | |||||
Made the item “Content area” more general, to explain its purpose not before the item “Viewport area”. davidhurka: Made the item “Content area” more general, to explain its purpose not before the item “Viewport… | |||||
57 | * * Content area: An area on which PageViewItems are positioned. | ||||
58 | * * Viewport area: The subarea of the contents area which is currently | ||||
59 | * visible in the viewport. | ||||
60 | * | ||||
61 | * When scrolling, the content area does not change, | ||||
62 | * but the content area coordinates of the viewport change. | ||||
63 | * Points on the viewport area can be mapped to the content area, | ||||
64 | * using the current scrollbar positions. | ||||
65 | * @endparblock | ||||
66 | * | ||||
67 | * @par Zoom | ||||
68 | * The viewport area is always a subarea of the content area. | ||||
69 | * When zooming out, the viewport area keeps its size, so the content area can't get smaller. | ||||
70 | * Instead, the size of the pages within the content area is changed. | ||||
71 | * | ||||
72 | * @par Layout | ||||
73 | * @parblock | ||||
74 | * The layout controls how pages are arranged in the content area. | ||||
75 | * slotRelayoutPages() calculates the layout, | ||||
76 | * and sets size and position of the PageViewItem objects. | ||||
77 | * | ||||
78 | * The cropped geometry of a PageViewItem determines | ||||
79 | * how the visible part of the page is placed in the content area. | ||||
80 | * For more information about page and layout geometry, see PageViewItem. | ||||
81 | * @endparblock | ||||
82 | * | ||||
83 | * @see PageViewItem | ||||
54 | */ | 84 | */ | ||
55 | class PageView : public QAbstractScrollArea, public Okular::DocumentObserver, public Okular::View | 85 | class PageView : public QAbstractScrollArea, public Okular::DocumentObserver, public Okular::View | ||
56 | { | 86 | { | ||
57 | Q_OBJECT | 87 | Q_OBJECT | ||
58 | 88 | | |||
59 | public: | 89 | public: | ||
60 | PageView( QWidget *parent, Okular::Document *document ); | 90 | PageView( QWidget *parent, Okular::Document *document ); | ||
61 | ~PageView(); | 91 | ~PageView(); | ||
62 | 92 | | |||
63 | // Zoom mode ( last 4 are internally used only! ) | 93 | // Zoom mode ( last 4 are internally used only! ) | ||
64 | enum ZoomMode { ZoomFixed = 0, ZoomFitWidth = 1, ZoomFitPage = 2, ZoomFitAuto = 3, | 94 | enum ZoomMode { ZoomFixed = 0, ZoomFitWidth = 1, ZoomFitPage = 2, ZoomFitAuto = 3, | ||
65 | ZoomIn, ZoomOut, ZoomRefreshCurrent, ZoomActual }; | 95 | ZoomIn, ZoomOut, ZoomRefreshCurrent, ZoomActual }; | ||
66 | 96 | | |||
67 | enum ClearMode { ClearAllSelection, ClearOnlyDividers }; | 97 | enum ClearMode { ClearAllSelection, ClearOnlyDividers }; | ||
68 | 98 | | |||
69 | // create actions that interact with this widget | 99 | /** | ||
100 | * Setup actions which do not change the visual representation of pages, | ||||
101 | * i. e. actions which are save for PrintPreviewMode. | ||||
102 | * | ||||
103 | * This method is called in all EmbedModes. | ||||
104 | */ | ||||
70 | void setupBaseActions( KActionCollection * collection ); | 105 | void setupBaseActions( KActionCollection * collection ); | ||
106 | | ||||
107 | /** | ||||
108 | * Setup actions which can modify the view, | ||||
109 | * but don't enable editing the document. | ||||
110 | * | ||||
111 | * This method is not called in PrintPreviewMode, | ||||
112 | * where the view shall be as close to the printout as possible. | ||||
113 | * | ||||
114 | * @warning setupBaseActions() must have been called before this method. | ||||
115 | */ | ||||
71 | void setupViewerActions( KActionCollection * collection ); | 116 | void setupViewerActions( KActionCollection * collection ); | ||
117 | | ||||
118 | /** | ||||
119 | * Setup editing-like actions. | ||||
120 | * | ||||
121 | * This method is not called in non-editing modes | ||||
122 | * (PrintPreviewMode, ViewerWidgetMode). | ||||
123 | * | ||||
124 | * @warning setupViewerActions() must have been called before this method. | ||||
125 | */ | ||||
72 | void setupActions( KActionCollection * collection ); | 126 | void setupActions( KActionCollection * collection ); | ||
73 | void updateActionState( bool docHasPages, bool docChanged, bool docHasFormWidgets ); | 127 | void updateActionState( bool docHasPages, bool docChanged, bool docHasFormWidgets ); | ||
74 | 128 | | |||
75 | // misc methods (from RMB menu/children) | 129 | /** | ||
130 | * Returns true when calling fitPageWidth() will modify the page layout. | ||||
aacid: what does "can modify the viewport" mean for you? | |||||
Didn’t make sense. fitPageWidth() relayouts the pages, so mentioning that instead. davidhurka: Didn’t make sense. fitPageWidth() relayouts the pages, so mentioning that instead. | |||||
131 | */ | ||||
76 | bool canFitPageWidth() const; | 132 | bool canFitPageWidth() const; | ||
133 | | ||||
134 | /** | ||||
135 | * Sets view mode to Single Page, zoom mode to Fit Width, | ||||
136 | * and moves the viewport to page @p page. | ||||
137 | */ | ||||
77 | void fitPageWidth( int page ); | 138 | void fitPageWidth( int page ); | ||
78 | // keep in sync with pageviewutils | 139 | // keep in sync with pageviewutils | ||
79 | void displayMessage( const QString & message, const QString & details = QString(), PageViewMessage::Icon icon=PageViewMessage::Info, int duration=-1 ); | 140 | void displayMessage( const QString & message, const QString & details = QString(), PageViewMessage::Icon icon=PageViewMessage::Info, int duration=-1 ); | ||
80 | 141 | | |||
81 | // inherited from DocumentObserver | 142 | // inherited from DocumentObserver | ||
82 | void notifySetup( const QVector< Okular::Page * > & pages, int setupFlags ) override; | 143 | void notifySetup( const QVector< Okular::Page * > & pages, int setupFlags ) override; | ||
83 | void notifyViewportChanged( bool smoothMove ) override; | 144 | void notifyViewportChanged( bool smoothMove ) override; | ||
84 | void notifyPageChanged( int pageNumber, int changedFlags ) override; | 145 | void notifyPageChanged( int pageNumber, int changedFlags ) override; | ||
85 | void notifyContentsCleared( int changedFlags ) override; | 146 | void notifyContentsCleared( int changedFlags ) override; | ||
86 | void notifyZoom(int factor) override; | 147 | void notifyZoom(int factor) override; | ||
87 | bool canUnloadPixmap( int pageNum ) const override; | 148 | bool canUnloadPixmap( int pageNum ) const override; | ||
88 | void notifyCurrentPageChanged( int previous, int current ) override; | 149 | void notifyCurrentPageChanged( int previous, int current ) override; | ||
89 | 150 | | |||
90 | // inherited from View | 151 | // inherited from View | ||
91 | bool supportsCapability( ViewCapability capability ) const override; | 152 | bool supportsCapability( ViewCapability capability ) const override; | ||
92 | CapabilityFlags capabilityFlags( ViewCapability capability ) const override; | 153 | CapabilityFlags capabilityFlags( ViewCapability capability ) const override; | ||
93 | QVariant capability( ViewCapability capability ) const override; | 154 | QVariant capability( ViewCapability capability ) const override; | ||
94 | void setCapability( ViewCapability capability, const QVariant &option ) override; | 155 | void setCapability( ViewCapability capability, const QVariant &option ) override; | ||
95 | 156 | | |||
157 | /** | ||||
158 | * Returns one selection area per page, using text-style selection. | ||||
159 | * | ||||
160 | * @param start Where to start the selection, in content area coordinates. | ||||
161 | * @param end Where to end the selection, in content area coordinates. | ||||
162 | * @param[out] firstpage The index of the first page, for which an area is returned. | ||||
163 | */ | ||||
96 | QList< Okular::RegularAreaRect * > textSelections( const QPoint& start, const QPoint& end, int& firstpage ); | 164 | QList< Okular::RegularAreaRect * > textSelections( const QPoint& start, const QPoint& end, int& firstpage ); | ||
165 | | ||||
aacid: it actually returns more than one area, it returns a list of areas | |||||
166 | /** | ||||
167 | * Returns a text selection area, using text-style selection. | ||||
168 | * | ||||
169 | * @param item The page on which to select. | ||||
170 | * @param startPoint Where to start the selection, in uncropped geometry coordinates of the PageViewItem. | ||||
171 | * @param endPoint Where to end the selection, in uncropped geometry coordinates of the PageViewItem. | ||||
aacid: please don't rename the variable? | |||||
Ok. I thought there was a convention to use out_ for output parameters. davidhurka: Ok.
I thought there was a convention to use out_ for output parameters. | |||||
172 | * | ||||
173 | * @see PageViewItem | ||||
174 | */ | ||||
97 | Okular::RegularAreaRect * textSelectionForItem( const PageViewItem * item, const QPoint & startPoint = QPoint(), const QPoint & endPoint = QPoint() ); | 175 | Okular::RegularAreaRect * textSelectionForItem( const PageViewItem * item, const QPoint & startPoint = QPoint(), const QPoint & endPoint = QPoint() ); | ||
98 | 176 | | |||
99 | void reparseConfig(); | 177 | void reparseConfig(); | ||
aacid: what do you mean by uncropped geometry? | |||||
That’s a coordinate system of PageViewItem. Uncropped geometry is now explained in the Detailed Description of PageViewItem. Do you think this is unclear, or didn’t you read so far yet? davidhurka: That’s a coordinate system of PageViewItem. Uncropped geometry is now explained in the Detailed… | |||||
100 | 178 | | |||
101 | KActionCollection *actionCollection() const; | 179 | KActionCollection *actionCollection() const; | ||
102 | QAction *toggleFormsAction() const; | 180 | QAction *toggleFormsAction() const; | ||
103 | 181 | | |||
104 | int contentAreaWidth() const; | 182 | int contentAreaWidth() const; | ||
105 | int contentAreaHeight() const; | 183 | int contentAreaHeight() const; | ||
184 | | ||||
185 | /** | ||||
186 | * Returns the current position of the viewport area (top left corner) | ||||
187 | * in the content area. | ||||
188 | */ | ||||
106 | QPoint contentAreaPosition() const; | 189 | QPoint contentAreaPosition() const; | ||
190 | | ||||
191 | /** | ||||
192 | * Maps a point @p pos from viewport area coordinates to content area coordinates. | ||||
193 | */ | ||||
107 | QPoint contentAreaPoint( const QPoint & pos ) const; | 194 | QPoint contentAreaPoint( const QPoint & pos ) const; | ||
195 | | ||||
196 | /** | ||||
197 | * Maps a point @p pos from viewport area coordinates to content area coordinates. | ||||
198 | */ | ||||
108 | QPointF contentAreaPoint( const QPointF & pos ) const; | 199 | QPointF contentAreaPoint( const QPointF & pos ) const; | ||
109 | 200 | | |||
110 | bool areSourceLocationsShownGraphically() const; | 201 | bool areSourceLocationsShownGraphically() const; | ||
111 | void setShowSourceLocationsGraphically(bool show); | 202 | void setShowSourceLocationsGraphically(bool show); | ||
112 | 203 | | |||
113 | void setLastSourceLocationViewport( const Okular::DocumentViewport& vp ); | 204 | void setLastSourceLocationViewport( const Okular::DocumentViewport& vp ); | ||
114 | void clearLastSourceLocationViewport(); | 205 | void clearLastSourceLocationViewport(); | ||
115 | 206 | | |||
207 | /** | ||||
208 | * Updates the cursor shape according to the mouse mode and what is under the cursor. | ||||
209 | */ | ||||
116 | void updateCursor(); | 210 | void updateCursor(); | ||
117 | 211 | | |||
118 | void highlightSignatureFormWidget( const Okular::FormFieldSignature *form ); | 212 | void highlightSignatureFormWidget( const Okular::FormFieldSignature *form ); | ||
119 | 213 | | |||
120 | public Q_SLOTS: | 214 | public Q_SLOTS: | ||
215 | /** | ||||
216 | * Copies all currently selected text to the clipboard. | ||||
217 | */ | ||||
121 | void copyTextSelection() const; | 218 | void copyTextSelection() const; | ||
219 | | ||||
220 | /** | ||||
221 | * Selects all text on all pages, and sets the selection highlight area. | ||||
222 | */ | ||||
122 | void selectAll(); | 223 | void selectAll(); | ||
123 | 224 | | |||
225 | /** | ||||
226 | * Creates or rises an AnnotWindow to edit the | ||||
227 | * annotation @p annotation on page @p pageNumber. | ||||
228 | */ | ||||
124 | void openAnnotationWindow( Okular::Annotation *annotation, int pageNumber ); | 229 | void openAnnotationWindow( Okular::Annotation *annotation, int pageNumber ); | ||
230 | | ||||
231 | /** | ||||
232 | * Updates all form widgets on all PageViewItems. | ||||
233 | */ | ||||
125 | void reloadForms(); | 234 | void reloadForms(); | ||
126 | 235 | | |||
236 | /** | ||||
237 | * Toggles the enabled state of the change colors feature. | ||||
aacid: toggles is the verb you're looking for | |||||
238 | */ | ||||
127 | void slotToggleChangeColors(); | 239 | void slotToggleChangeColors(); | ||
240 | | ||||
241 | /** | ||||
242 | * Enables or disables the change colors feature. | ||||
243 | */ | ||||
128 | void slotSetChangeColors(bool active); | 244 | void slotSetChangeColors(bool active); | ||
129 | 245 | | |||
246 | /** | ||||
247 | * Clears existing text selections and selects all text on the current page. | ||||
248 | */ | ||||
130 | void slotSelectPage(); | 249 | void slotSelectPage(); | ||
131 | 250 | | |||
132 | Q_SIGNALS: | 251 | Q_SIGNALS: | ||
133 | void rightClick( const Okular::Page *, const QPoint & ); | 252 | /** | ||
253 | * Emitted after a right click event. | ||||
254 | * | ||||
255 | * @param page The page on which the right click happened, nullptr if not on a page. | ||||
you don't document what signals will be used for, signals can be used for whatever the person connecting to the signal wants. aacid: you don't document what signals will be used for, signals can be used for whatever the person… | |||||
256 | * @param point The global cursor position. | ||||
257 | */ | ||||
258 | void rightClick( const Okular::Page *page, const QPoint &point ); | ||||
259 | | ||||
260 | /** | ||||
261 | * Emitted when the 'Back' button on the mouse is clicked. | ||||
262 | */ | ||||
134 | void mouseBackButtonClick(); | 263 | void mouseBackButtonClick(); | ||
264 | | ||||
265 | /** | ||||
266 | * Emitted when the 'Forward' button on the mouse is clicked. | ||||
267 | */ | ||||
135 | void mouseForwardButtonClick(); | 268 | void mouseForwardButtonClick(); | ||
269 | | ||||
136 | void escPressed(); | 270 | void escPressed(); | ||
271 | | ||||
272 | /** | ||||
273 | * This is emitted when Fit Window to Page is triggered. | ||||
274 | * | ||||
275 | * @param pageViewPortSize The current size of the viewport, including scrollbars. | ||||
276 | * @param pageSize The requested size of the new viewport, to fit the page. | ||||
277 | */ | ||||
137 | void fitWindowToPage( const QSize& pageViewPortSize, const QSize& pageSize ); | 278 | void fitWindowToPage( const QSize& pageViewPortSize, const QSize& pageSize ); | ||
138 | 279 | | |||
139 | protected: | 280 | protected: | ||
140 | bool event( QEvent * event ) override; | 281 | bool event( QEvent * event ) override; | ||
141 | 282 | | |||
142 | void resizeEvent( QResizeEvent* ) override; | 283 | void resizeEvent( QResizeEvent* ) override; | ||
284 | | ||||
285 | /** | ||||
286 | * Handles pinch zoom and rotation. | ||||
aacid: enables is not the verb you want, handles is better | |||||
287 | */ | ||||
143 | bool gestureEvent( QGestureEvent * e ); | 288 | bool gestureEvent( QGestureEvent * e ); | ||
144 | 289 | | |||
145 | // mouse / keyboard events | 290 | // mouse / keyboard events | ||
146 | void keyPressEvent( QKeyEvent* ) override; | 291 | void keyPressEvent( QKeyEvent* ) override; | ||
147 | void keyReleaseEvent( QKeyEvent* ) override; | 292 | void keyReleaseEvent( QKeyEvent* ) override; | ||
148 | void inputMethodEvent( QInputMethodEvent * ) override; | 293 | void inputMethodEvent( QInputMethodEvent * ) override; | ||
149 | void wheelEvent( QWheelEvent* ) override; | 294 | void wheelEvent( QWheelEvent* ) override; | ||
150 | 295 | | |||
151 | void paintEvent( QPaintEvent *e ) override; | 296 | void paintEvent( QPaintEvent *e ) override; | ||
152 | void tabletEvent (QTabletEvent *e ) override; | 297 | void tabletEvent (QTabletEvent *e ) override; | ||
153 | void mouseMoveEvent( QMouseEvent *e ) override; | 298 | void mouseMoveEvent( QMouseEvent *e ) override; | ||
154 | void mousePressEvent( QMouseEvent *e ) override; | 299 | void mousePressEvent( QMouseEvent *e ) override; | ||
155 | void mouseReleaseEvent( QMouseEvent *e ) override; | 300 | void mouseReleaseEvent( QMouseEvent *e ) override; | ||
156 | void mouseDoubleClickEvent( QMouseEvent *e ) override; | 301 | void mouseDoubleClickEvent( QMouseEvent *e ) override; | ||
157 | 302 | | |||
158 | bool viewportEvent( QEvent *e ) override; | 303 | bool viewportEvent( QEvent *e ) override; | ||
159 | 304 | | |||
160 | void scrollContentsBy( int dx, int dy ) override; | 305 | void scrollContentsBy( int dx, int dy ) override; | ||
161 | 306 | | |||
162 | private: | 307 | private: | ||
163 | // draw background and items on the opened qpainter | 308 | /** | ||
164 | void drawDocumentOnPainter( const QRect & pageViewRect, QPainter * p ); | 309 | * Draws parts of the PageViewItems, which are in @p pageViewRect, on @p painter. | ||
165 | // update item width and height using current zoom parameters | 310 | * Background is filled with view background color. | ||
311 | * | ||||
312 | * Top left corner of @p pageViewRect will be painted on (0, 0) of @p painter. | ||||
313 | * | ||||
314 | * @param pageViewRect The section of the content area, which shall be painted. | ||||
315 | * @param painter The painter on which to paint. | ||||
316 | */ | ||||
317 | void drawDocumentOnPainter( const QRect & pageViewRect, QPainter * painter ); | ||||
318 | | ||||
319 | /** | ||||
320 | * Updates size and cropping of @item, | ||||
321 | * according to zoom and trim margins modes, | ||||
322 | * and respecting layout size for zoomFit* modes. | ||||
323 | * | ||||
324 | * @param item The item to update. | ||||
325 | * @param columnWidth Needed for zoomFit* modes. | ||||
326 | * @param rowHeight Needed for zoomFit* modes. | ||||
327 | */ | ||||
166 | void updateItemSize( PageViewItem * item, int columnWidth, int rowHeight ); | 328 | void updateItemSize( PageViewItem * item, int columnWidth, int rowHeight ); | ||
167 | // return the widget placed on a certain point or 0 if clicking on empty space | 329 | | ||
330 | /** | ||||
331 | * Returns the PageViewItem under the point (@p x, @p y) in content area coordinates, | ||||
332 | * or nullptr if there is no item under the point. | ||||
333 | */ | ||||
168 | PageViewItem * pickItemOnPoint( int x, int y ); | 334 | PageViewItem * pickItemOnPoint( int x, int y ); | ||
169 | // start / modify / clear selection rectangle | 335 | // start / modify / clear selection rectangle | ||
170 | void selectionStart( const QPoint & pos, const QColor & color, bool aboveAll = false ); | 336 | void selectionStart( const QPoint & pos, const QColor & color, bool aboveAll = false ); | ||
171 | void selectionClear( const ClearMode mode = ClearAllSelection ); | 337 | void selectionClear( const ClearMode mode = ClearAllSelection ); | ||
172 | void drawTableDividers(QPainter * screenPainter); | 338 | void drawTableDividers(QPainter * screenPainter); | ||
173 | void guessTableDividers(); | 339 | void guessTableDividers(); | ||
174 | // update either text or rectangle selection | 340 | // update either text or rectangle selection | ||
175 | void updateSelection( const QPoint & pos ); | 341 | void updateSelection( const QPoint & pos ); | ||
176 | // compute the zoom factor value for FitWidth and FitPage mode | 342 | | ||
343 | /** | ||||
344 | * Calculates which zoom factor @p mode would apply on the current page. | ||||
345 | * | ||||
346 | * @param mode ZoomFitWidth or ZoomFitPage. | ||||
347 | * | ||||
348 | * @return Zoom factor or 0 if not calculateable. | ||||
349 | */ | ||||
177 | double zoomFactorFitMode( ZoomMode mode ); | 350 | double zoomFactorFitMode( ZoomMode mode ); | ||
178 | // update internal zoom values and end in a slotRelayoutPages(); | 351 | | ||
179 | void updateZoom( ZoomMode newZm ); | 352 | /** | ||
180 | // update the text on the label using global zoom value or current page's one | 353 | * Calculates a new zoom factor and mode using @p newZoomMode, | ||
354 | * and relayouts the pages. | ||||
355 | * | ||||
356 | * @param newZoomMode If ZoomFixed, will use the current selection | ||||
357 | * of the zoom selection action. | ||||
358 | */ | ||||
359 | void updateZoom( ZoomMode newZoomMode ); | ||||
360 | | ||||
361 | /** | ||||
362 | * Rebuild the zoom factor items of the zoom select action and select | ||||
363 | * the item of the current zoom. | ||||
364 | * | ||||
365 | * Call this when the zoom factor has changed. | ||||
366 | */ | ||||
181 | void updateZoomText(); | 367 | void updateZoomText(); | ||
368 | | ||||
369 | /** | ||||
370 | * Clears the text selection highlight areas on all pages of the document. | ||||
371 | */ | ||||
182 | void textSelectionClear(); | 372 | void textSelectionClear(); | ||
183 | // updates cursor | | |||
184 | void updateCursor( const QPoint &p ); | | |||
185 | 373 | | |||
374 | /** | ||||
375 | * Updates the cursor shape according to the mouse mode and what is under the cursor. | ||||
376 | * | ||||
377 | * @param position The cursor position in content area coordinates. | ||||
378 | */ | ||||
379 | void updateCursor( const QPoint &position ); | ||||
380 | | ||||
381 | /** | ||||
382 | * Move the magnifier widget to be centered on @p. | ||||
383 | * If moved against the viewport edges, | ||||
384 | * it will auto-scroll the content area in that direction. | ||||
385 | * | ||||
386 | * Call this when the cursor has moved while the magnifier is activated. | ||||
387 | * | ||||
388 | * @param position The cursor position in viewport area coordinates. | ||||
389 | */ | ||||
186 | void moveMagnifier( const QPoint &p ); | 390 | void moveMagnifier( const QPoint &p ); | ||
187 | void updateMagnifier( const QPoint &p ); | | |||
188 | 391 | | |||
392 | /** | ||||
393 | * Update the position which the magnifier shall magnify. | ||||
394 | * | ||||
395 | * Call this when the cursor has moved while the magnifier is activated. | ||||
396 | * | ||||
397 | * @param position The cursor position in content area coordinates. | ||||
398 | */ | ||||
399 | void updateMagnifier( const QPoint &position ); | ||||
400 | | ||||
401 | /** | ||||
402 | * Returns the theoretical number of columns of the current view mode. | ||||
403 | * Might not always be accurate. | ||||
404 | */ | ||||
189 | int viewColumns() const; | 405 | int viewColumns() const; | ||
190 | 406 | | |||
407 | /** | ||||
408 | * Centers the viewport on content area coordinate (@p cx, @p cy). | ||||
409 | * | ||||
410 | * @see scrollTo() | ||||
411 | */ | ||||
191 | void center(int cx, int cy); | 412 | void center(int cx, int cy); | ||
413 | | ||||
414 | /** | ||||
415 | * Moves the viewport top left corner to content area coordinate (@p x, @p y). | ||||
416 | * | ||||
417 | * @see center() | ||||
418 | */ | ||||
192 | void scrollTo( int x, int y ); | 419 | void scrollTo( int x, int y ); | ||
193 | 420 | | |||
421 | /** | ||||
422 | * Sets visibility for all form widgets on all PageViewItems. | ||||
423 | * If this hides a form widget with focus, this PageView gets focused. | ||||
424 | */ | ||||
194 | void toggleFormWidgets( bool on ); | 425 | void toggleFormWidgets( bool on ); | ||
195 | 426 | | |||
427 | /** | ||||
428 | * Resizes the content area to @p newSize and updates the scrollbars. | ||||
429 | */ | ||||
196 | void resizeContentArea( const QSize & newSize ); | 430 | void resizeContentArea( const QSize & newSize ); | ||
431 | | ||||
432 | /** | ||||
433 | * Adjusts the page steps of the scrollbars to the viewport size. | ||||
434 | */ | ||||
197 | void updatePageStep(); | 435 | void updatePageStep(); | ||
198 | 436 | | |||
437 | /** | ||||
438 | * Adds a submenu to @p menu, | ||||
439 | * with actions to use the prefered web shortcuts for @p text. | ||||
440 | */ | ||||
199 | void addWebShortcutsMenu( QMenu * menu, const QString & text ); | 441 | void addWebShortcutsMenu( QMenu * menu, const QString & text ); | ||
442 | | ||||
443 | /** | ||||
444 | * Returns a context menu for the ObjectRect, to which @p eventPos points. | ||||
445 | * If there is no ObjectRect under @p eventPos, returns nullptr. | ||||
446 | * | ||||
447 | * @param item The page on which the ObjectRect is expected. | ||||
448 | * @param eventPos The position of the ObjectRect, in content area coordinates. | ||||
449 | */ | ||||
200 | QMenu* createProcessLinkMenu( PageViewItem *item, const QPoint & eventPos ); | 450 | QMenu* createProcessLinkMenu( PageViewItem *item, const QPoint & eventPos ); | ||
201 | // used when selecting stuff, makes the view scroll as necessary to keep the mouse inside the view | 451 | | ||
452 | /** | ||||
453 | * Starts auto-scrolling if @p pos is outside the viewport area. | ||||
454 | * | ||||
455 | * Use this when the user drags from inside the viewport area beyond its borders. | ||||
456 | * | ||||
457 | * @param pos A point in content area coordinates, that shall become visible. | ||||
458 | */ | ||||
202 | void scrollPosIntoView( const QPoint & pos ); | 459 | void scrollPosIntoView( const QPoint & pos ); | ||
460 | | ||||
461 | /** | ||||
462 | * Returns the middle of viewport &p vp in content area coordinates. | ||||
463 | * | ||||
464 | * Undefined behaviour if @p vp does not point to a page in the current layout. | ||||
465 | */ | ||||
203 | QPoint viewportToContentArea( const Okular::DocumentViewport & vp ) const; | 466 | QPoint viewportToContentArea( const Okular::DocumentViewport & vp ) const; | ||
204 | 467 | | |||
205 | // called from slots to turn off trim modes mutually exclusive to id | 468 | // called from slots to turn off trim modes mutually exclusive to id | ||
206 | void updateTrimMode( int except_id ); | 469 | void updateTrimMode( int except_id ); | ||
207 | 470 | | |||
208 | // handle link clicked | 471 | // handle link clicked | ||
209 | bool mouseReleaseOverLink( const Okular::ObjectRect * rect ) const; | 472 | bool mouseReleaseOverLink( const Okular::ObjectRect * rect ) const; | ||
210 | 473 | | |||
211 | void createAnnotationsVideoWidgets(PageViewItem *item, const QLinkedList< Okular::Annotation * > &annotations); | 474 | void createAnnotationsVideoWidgets(PageViewItem *item, const QLinkedList< Okular::Annotation * > &annotations); | ||
212 | 475 | | |||
213 | // don't want to expose classes in here | 476 | // don't want to expose classes in here | ||
214 | class PageViewPrivate * d; | 477 | class PageViewPrivate * d; | ||
215 | 478 | | |||
216 | private Q_SLOTS: | 479 | private Q_SLOTS: | ||
217 | // used to decouple the notifyViewportChanged calle | 480 | /** | ||
481 | * Updates the view when the document got a new viewport. | ||||
482 | * | ||||
483 | * Called trough DocumentObserver::notifyViewportChanged(). | ||||
484 | * | ||||
485 | * @param smoothMove Whether to animate the viewport change. | ||||
486 | */ | ||||
218 | void slotRealNotifyViewportChanged(bool smoothMove); | 487 | void slotRealNotifyViewportChanged(bool smoothMove); | ||
219 | // activated either directly or via queued connection on notifySetup | 488 | | ||
489 | /** | ||||
490 | * Recalculates the page layout. | ||||
491 | * | ||||
492 | * Calcuclates which pages will be in the layout | ||||
493 | * and moves them to their correct position in the layout. | ||||
494 | * | ||||
495 | * If Continuous view mode is enabled, all pages are in the layout. | ||||
496 | * Otherwise, only one row of pages is in the layout. | ||||
497 | * | ||||
498 | * Call this when the viewport is resized, | ||||
499 | * or when the page layout or zoom is changed. | ||||
500 | */ | ||||
220 | void slotRelayoutPages(); | 501 | void slotRelayoutPages(); | ||
221 | // activated by the resize event delay timer | 502 | // activated by the resize event delay timer | ||
222 | void delayedResizeEvent(); | 503 | void delayedResizeEvent(); | ||
223 | // activated either directly or via the contentsMoving(int,int) signal | 504 | // activated either directly or via the contentsMoving(int,int) signal | ||
224 | void slotRequestVisiblePixmaps( int newValue = -1 ); | 505 | void slotRequestVisiblePixmaps( int newValue = -1 ); | ||
225 | // activated by the viewport move timer | 506 | // activated by the viewport move timer | ||
226 | void slotMoveViewport(); | 507 | void slotMoveViewport(); | ||
227 | // activated by the autoscroll timer (Shift+Up/Down keys) | 508 | // activated by the autoscroll timer (Shift+Up/Down keys) | ||
228 | void slotAutoScroll(); | 509 | void slotAutoScroll(); | ||
229 | // activated by the dragScroll timer | 510 | // activated by the dragScroll timer | ||
230 | void slotDragScroll(); | 511 | void slotDragScroll(); | ||
231 | // show the welcome message | 512 | // show the welcome message | ||
232 | void slotShowWelcome(); | 513 | void slotShowWelcome(); | ||
233 | // activated by left click timer | 514 | // activated by left click timer | ||
234 | void slotShowSizeAllCursor(); | 515 | void slotShowSizeAllCursor(); | ||
235 | 516 | | |||
517 | /** | ||||
518 | * Connected to web shortcuts menu actions. | ||||
519 | * The connected action must have the URL from KUriFilterData set as data. | ||||
520 | */ | ||||
236 | void slotHandleWebShortcutAction(); | 521 | void slotHandleWebShortcutAction(); | ||
522 | | ||||
523 | /** | ||||
524 | * Shows the web shortcuts control module. | ||||
525 | */ | ||||
237 | void slotConfigureWebShortcuts(); | 526 | void slotConfigureWebShortcuts(); | ||
238 | 527 | | |||
239 | // connected to local actions (toolbar, menu, ..) | 528 | // connected to local actions (toolbar, menu, ..) | ||
240 | void slotZoom(); | 529 | void slotZoom(); | ||
241 | void slotZoomIn(); | 530 | void slotZoomIn(); | ||
242 | void slotZoomOut(); | 531 | void slotZoomOut(); | ||
243 | void slotZoomActual(); | 532 | void slotZoomActual(); | ||
244 | void slotFitToWidthToggled( bool ); | 533 | void slotFitToWidthToggled( bool ); | ||
Show All 23 Lines | |||||
268 | void slotRefreshPage(); | 557 | void slotRefreshPage(); | ||
269 | #ifdef HAVE_SPEECH | 558 | #ifdef HAVE_SPEECH | ||
270 | void slotSpeakDocument(); | 559 | void slotSpeakDocument(); | ||
271 | void slotSpeakCurrentPage(); | 560 | void slotSpeakCurrentPage(); | ||
272 | void slotStopSpeaks(); | 561 | void slotStopSpeaks(); | ||
273 | #endif | 562 | #endif | ||
274 | void slotAction( Okular::Action *action ); | 563 | void slotAction( Okular::Action *action ); | ||
275 | void externalKeyPressEvent( QKeyEvent *e ); | 564 | void externalKeyPressEvent( QKeyEvent *e ); | ||
565 | | ||||
566 | /** | ||||
567 | * Let this view forget about AnnotWindow @p window. | ||||
568 | * | ||||
569 | * Call this when the AnnotWindow is destroyed. | ||||
570 | */ | ||||
276 | void slotAnnotationWindowDestroyed( QObject *window ); | 571 | void slotAnnotationWindowDestroyed( QObject *window ); | ||
277 | void slotProcessMovieAction( const Okular::MovieAction *action ); | 572 | void slotProcessMovieAction( const Okular::MovieAction *action ); | ||
278 | void slotProcessRenditionAction( const Okular::RenditionAction *action ); | 573 | void slotProcessRenditionAction( const Okular::RenditionAction *action ); | ||
574 | | ||||
575 | /** | ||||
576 | * Emits fitWindowToPage, to tell the parent aplication to resize the window. | ||||
577 | */ | ||||
279 | void slotFitWindowToPage(); | 578 | void slotFitWindowToPage(); | ||
280 | }; | 579 | }; | ||
281 | 580 | | |||
282 | #endif | 581 | #endif | ||
283 | 582 | | |||
284 | /* kate: replace-tabs on; indent-width 4; */ | 583 | /* kate: replace-tabs on; indent-width 4; */ |
i kind of know how this works, and i don't understand what "shown pages" is supposed to mean.