Okular

action.h
1 /***************************************************************************
2  * Copyright (C) 2004 by Enrico Ros <[email protected]> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  ***************************************************************************/
9 
10 #ifndef _OKULAR_ACTION_H_
11 #define _OKULAR_ACTION_H_
12 
13 #include "global.h"
14 #include "okularcore_export.h"
15 
16 #include <QString>
17 #include <QVariant>
18 
19 namespace Okular {
20 
21 class ActionPrivate;
22 class GotoActionPrivate;
23 class ExecuteActionPrivate;
24 class BrowseActionPrivate;
25 class DocumentActionPrivate;
26 class SoundActionPrivate;
27 class ScriptActionPrivate;
28 class MovieActionPrivate;
29 class RenditionActionPrivate;
30 class MovieAnnotation;
31 class ScreenAnnotation;
32 class Movie;
33 class Sound;
34 class DocumentViewport;
35 
43 class OKULARCORE_EXPORT Action
44 {
45  public:
49  enum ActionType {
50  Goto,
58  BackendOpaque
59  };
60 
64  virtual ~Action();
65 
72  virtual ActionType actionType() const = 0;
73 
78  virtual QString actionTip() const;
79 
91  void setNativeId( const QVariant &id );
92 
98  QVariant nativeId() const;
99 
105  QVector< Action * > nextActions() const;
106 
113  void setNextActions( const QVector< Action * > &actions );
114 
115  protected:
117  Action( ActionPrivate &dd );
118  Q_DECLARE_PRIVATE( Action )
119  ActionPrivate *d_ptr;
121 
122  private:
123  Q_DISABLE_COPY( Action )
124 };
125 
126 
131 class OKULARCORE_EXPORT GotoAction : public Action
132 {
133  public:
140  GotoAction( const QString& fileName, const DocumentViewport & viewport );
141 
150  GotoAction( const QString& fileName, const QString& namedDestination );
151 
155  ~GotoAction() override;
156 
160  ActionType actionType() const override;
161 
165  QString actionTip() const override;
166 
170  bool isExternal() const;
171 
175  QString fileName() const;
176 
180  DocumentViewport destViewport() const;
181 
187  QString destinationName() const;
188 
189  private:
190  Q_DECLARE_PRIVATE( GotoAction )
191  Q_DISABLE_COPY( GotoAction )
192 };
193 
197 class OKULARCORE_EXPORT ExecuteAction : public Action
198 {
199  public:
206  ExecuteAction( const QString &fileName, const QString &parameters );
207 
211  ~ExecuteAction() override;
212 
216  ActionType actionType() const override;
217 
221  QString actionTip() const override;
222 
226  QString fileName() const;
227 
231  QString parameters() const;
232 
233  private:
234  Q_DECLARE_PRIVATE( ExecuteAction )
235  Q_DISABLE_COPY( ExecuteAction )
236 };
237 
242 class OKULARCORE_EXPORT BrowseAction : public Action
243 {
244  public:
250  explicit BrowseAction( const QUrl &url );
251 
255  ~BrowseAction() override;
256 
260  ActionType actionType() const override;
261 
265  QString actionTip() const override;
266 
270  QUrl url() const;
271 
272  private:
273  Q_DECLARE_PRIVATE( BrowseAction )
274  Q_DISABLE_COPY( BrowseAction )
275 };
276 
281 class OKULARCORE_EXPORT DocumentAction : public Action
282 {
283  public:
290  PageFirst = 1,
291  PagePrev = 2,
292  PageNext = 3,
293  PageLast = 4,
294  HistoryBack = 5,
295  HistoryForward = 6,
296  Quit = 7,
297  Presentation = 8,
298  EndPresentation = 9,
299  Find = 10,
300  GoToPage = 11,
301  Close = 12
302  };
303 
309  explicit DocumentAction( enum DocumentActionType documentActionType );
310 
314  ~DocumentAction() override;
315 
319  ActionType actionType() const override;
320 
324  QString actionTip() const override;
325 
329  DocumentActionType documentActionType() const;
330 
331  private:
332  Q_DECLARE_PRIVATE( DocumentAction )
333  Q_DISABLE_COPY( DocumentAction )
334 };
335 
339 class OKULARCORE_EXPORT SoundAction : public Action
340 {
341  public:
351  SoundAction( double volume, bool synchronous, bool repeat, bool mix, Okular::Sound *sound );
352 
356  ~SoundAction() override;
357 
361  ActionType actionType() const override;
362 
366  QString actionTip() const override;
367 
371  double volume() const;
372 
376  bool synchronous() const;
377 
381  bool repeat() const;
382 
386  bool mix() const;
387 
391  Okular::Sound *sound() const;
392 
393  private:
394  Q_DECLARE_PRIVATE( SoundAction )
395  Q_DISABLE_COPY( SoundAction )
396 };
397 
403 class OKULARCORE_EXPORT ScriptAction : public Action
404 {
405  public:
412  ScriptAction( enum ScriptType type, const QString &script );
413 
417  ~ScriptAction() override;
418 
422  ActionType actionType() const override;
423 
427  QString actionTip() const override;
428 
432  ScriptType scriptType() const;
433 
437  QString script() const;
438 
439  private:
440  Q_DECLARE_PRIVATE( ScriptAction )
441  Q_DISABLE_COPY( ScriptAction )
442 };
443 
449 class OKULARCORE_EXPORT MovieAction : public Action
450 {
451  public:
456  Play,
457  Stop,
458  Pause,
459  Resume
460  };
461 
465  explicit MovieAction( OperationType operation );
466 
470  ~MovieAction() override;
471 
475  ActionType actionType() const override;
476 
480  QString actionTip() const override;
481 
485  OperationType operation() const;
486 
490  void setAnnotation( MovieAnnotation *annotation );
491 
495  MovieAnnotation* annotation() const;
496 
497  private:
498  Q_DECLARE_PRIVATE( MovieAction )
499  Q_DISABLE_COPY( MovieAction )
500 };
501 
508 class OKULARCORE_EXPORT RenditionAction : public Action
509 {
510  public:
519  Resume
520  };
521 
530  RenditionAction( OperationType operation, Okular::Movie *movie, enum ScriptType scriptType, const QString &script );
531 
535  ~RenditionAction() override;
536 
540  ActionType actionType() const override;
541 
545  QString actionTip() const override;
546 
550  OperationType operation() const;
551 
555  Okular::Movie* movie() const;
556 
560  ScriptType scriptType() const;
561 
565  QString script() const;
566 
570  void setAnnotation( ScreenAnnotation *annotation );
571 
575  ScreenAnnotation* annotation() const;
576 
577  private:
578  Q_DECLARE_PRIVATE( RenditionAction )
579  Q_DISABLE_COPY( RenditionAction )
580 };
581 
582 class OKULARCORE_EXPORT BackendOpaqueAction : public Action
583 {
584  public:
585  BackendOpaqueAction();
586 
590  ActionType actionType() const override;
591 
592  private:
593  Q_DISABLE_COPY( BackendOpaqueAction )
594 };
595 
596 }
597 
598 #endif
Start a custom action.
Definition: action.h:53
Pause the video.
Definition: action.h:518
Execute only the JavaScript.
Definition: action.h:515
OperationType
Describes the possible operation types.
Definition: action.h:455
The Script action executes a Script code.
Definition: action.h:403
global.h
Definition: action.h:19
The Execute action executes an external application.
Definition: action.h:197
The Movie action executes an operation on a video on activation.
Definition: action.h:449
ScriptType
Describes the possible script types.
Definition: global.h:82
The Goto action changes the viewport to another page or loads an external document.
Definition: action.h:131
Contains information about a sound object.
Definition: sound.h:26
Goto a given page or external document.
Definition: action.h:50
OperationType
Describes the possible operation types.
Definition: action.h:514
Encapsulates data that describes an action.
Definition: action.h:43
DocumentActionType
Describes the possible action types.
Definition: action.h:289
Play a movie.
Definition: action.h:55
Movie annotation.
Definition: annotations.h:1543
Executes a Script code.
Definition: action.h:56
Play a movie and/or execute a Script code.
Definition: action.h:57
The Browse action browses an url by opening a web browser or email client, depending on the url proto...
Definition: action.h:242
The DocumentAction action contains an action that is performed on the current document.
Definition: action.h:281
Start playing the video.
Definition: action.h:516
ActionType
Describes the type of action.
Definition: action.h:49
A view on the document.
Definition: document.h:1294
The Rendition action executes an operation on a video or executes some JavaScript code on activation...
Definition: action.h:508
Browse a given website.
Definition: action.h:52
Stop playing the video.
Definition: action.h:517
Screen annotation.
Definition: annotations.h:1589
Play a sound.
Definition: action.h:54
The Sound action plays a sound on activation.
Definition: action.h:339
Execute a command or external application.
Definition: action.h:51
Contains information about a movie object.
Definition: movie.h:28
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Jul 8 2020 22:34:48 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.