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 
130 class OKULARCORE_EXPORT GotoAction : public Action
131 {
132 public:
139  GotoAction(const QString &fileName, const DocumentViewport &viewport);
140 
149  GotoAction(const QString &fileName, const QString &namedDestination);
150 
154  ~GotoAction() override;
155 
159  ActionType actionType() const override;
160 
164  QString actionTip() const override;
165 
169  bool isExternal() const;
170 
174  QString fileName() const;
175 
179  DocumentViewport destViewport() const;
180 
186  QString destinationName() const;
187 
188 private:
189  Q_DECLARE_PRIVATE(GotoAction)
190  Q_DISABLE_COPY(GotoAction)
191 };
192 
196 class OKULARCORE_EXPORT ExecuteAction : public Action
197 {
198 public:
205  ExecuteAction(const QString &fileName, const QString &parameters);
206 
210  ~ExecuteAction() override;
211 
215  ActionType actionType() const override;
216 
220  QString actionTip() const override;
221 
225  QString fileName() const;
226 
230  QString parameters() const;
231 
232 private:
233  Q_DECLARE_PRIVATE(ExecuteAction)
234  Q_DISABLE_COPY(ExecuteAction)
235 };
236 
241 class OKULARCORE_EXPORT BrowseAction : public Action
242 {
243 public:
249  explicit BrowseAction(const QUrl &url);
250 
254  ~BrowseAction() override;
255 
259  ActionType actionType() const override;
260 
264  QString actionTip() const override;
265 
269  QUrl url() const;
270 
271 private:
272  Q_DECLARE_PRIVATE(BrowseAction)
273  Q_DISABLE_COPY(BrowseAction)
274 };
275 
280 class OKULARCORE_EXPORT DocumentAction : public Action
281 {
282 public:
289  PageFirst = 1,
290  PagePrev = 2,
291  PageNext = 3,
292  PageLast = 4,
293  HistoryBack = 5,
294  HistoryForward = 6,
295  Quit = 7,
296  Presentation = 8,
297  EndPresentation = 9,
298  Find = 10,
299  GoToPage = 11,
300  Close = 12
301  };
302 
308  explicit DocumentAction(enum DocumentActionType documentActionType);
309 
313  ~DocumentAction() override;
314 
318  ActionType actionType() const override;
319 
323  QString actionTip() const override;
324 
328  DocumentActionType documentActionType() const;
329 
330 private:
331  Q_DECLARE_PRIVATE(DocumentAction)
332  Q_DISABLE_COPY(DocumentAction)
333 };
334 
338 class OKULARCORE_EXPORT SoundAction : public Action
339 {
340 public:
350  SoundAction(double volume, bool synchronous, bool repeat, bool mix, Okular::Sound *sound);
351 
355  ~SoundAction() override;
356 
360  ActionType actionType() const override;
361 
365  QString actionTip() const override;
366 
370  double volume() const;
371 
375  bool synchronous() const;
376 
380  bool repeat() const;
381 
385  bool mix() const;
386 
390  Okular::Sound *sound() const;
391 
392 private:
393  Q_DECLARE_PRIVATE(SoundAction)
394  Q_DISABLE_COPY(SoundAction)
395 };
396 
402 class OKULARCORE_EXPORT ScriptAction : public Action
403 {
404 public:
411  ScriptAction(enum ScriptType type, const QString &script);
412 
416  ~ScriptAction() override;
417 
421  ActionType actionType() const override;
422 
426  QString actionTip() const override;
427 
431  ScriptType scriptType() const;
432 
436  QString script() const;
437 
438 private:
439  Q_DECLARE_PRIVATE(ScriptAction)
440  Q_DISABLE_COPY(ScriptAction)
441 };
442 
448 class OKULARCORE_EXPORT MovieAction : public Action
449 {
450 public:
454  enum OperationType { Play, Stop, Pause, Resume };
455 
459  explicit MovieAction(OperationType operation);
460 
464  ~MovieAction() override;
465 
469  ActionType actionType() const override;
470 
474  QString actionTip() const override;
475 
479  OperationType operation() const;
480 
484  void setAnnotation(MovieAnnotation *annotation);
485 
489  MovieAnnotation *annotation() const;
490 
491 private:
492  Q_DECLARE_PRIVATE(MovieAction)
493  Q_DISABLE_COPY(MovieAction)
494 };
495 
502 class OKULARCORE_EXPORT RenditionAction : public Action
503 {
504 public:
513  Resume
514  };
515 
524  RenditionAction(OperationType operation, Okular::Movie *movie, enum ScriptType scriptType, const QString &script);
525 
529  ~RenditionAction() override;
530 
534  ActionType actionType() const override;
535 
539  QString actionTip() const override;
540 
544  OperationType operation() const;
545 
549  Okular::Movie *movie() const;
550 
554  ScriptType scriptType() const;
555 
559  QString script() const;
560 
564  void setAnnotation(ScreenAnnotation *annotation);
565 
569  ScreenAnnotation *annotation() const;
570 
571 private:
572  Q_DECLARE_PRIVATE(RenditionAction)
573  Q_DISABLE_COPY(RenditionAction)
574 };
575 
576 class OKULARCORE_EXPORT BackendOpaqueAction : public Action
577 {
578 public:
579  BackendOpaqueAction();
580 
584  ActionType actionType() const override;
585 
586 private:
587  Q_DISABLE_COPY(BackendOpaqueAction)
588 };
589 
590 }
591 
592 #endif
Start a custom action.
Definition: action.h:53
Pause the video.
Definition: action.h:512
Execute only the JavaScript.
Definition: action.h:509
OperationType
Describes the possible operation types.
Definition: action.h:454
The Script action executes a Script code.
Definition: action.h:402
global.h
Definition: action.h:19
The Execute action executes an external application.
Definition: action.h:196
The Movie action executes an operation on a video on activation.
Definition: action.h:448
ScriptType
Describes the possible script types.
Definition: global.h:77
The Goto action changes the viewport to another page or loads an external document.
Definition: action.h:130
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:508
Encapsulates data that describes an action.
Definition: action.h:43
DocumentActionType
Describes the possible action types.
Definition: action.h:288
Play a movie.
Definition: action.h:55
Movie annotation.
Definition: annotations.h:1527
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:241
The DocumentAction action contains an action that is performed on the current document.
Definition: action.h:280
Start playing the video.
Definition: action.h:510
ActionType
Describes the type of action.
Definition: action.h:49
A view on the document.
Definition: document.h:1280
The Rendition action executes an operation on a video or executes some JavaScript code on activation...
Definition: action.h:502
Browse a given website.
Definition: action.h:52
Stop playing the video.
Definition: action.h:511
Screen annotation.
Definition: annotations.h:1573
Play a sound.
Definition: action.h:54
The Sound action plays a sound on activation.
Definition: action.h:338
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 Thu Oct 22 2020 22:40:27 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.