Poppler Qt5  0.74.0
poppler-link.h
1 /* poppler-link.h: qt interface to poppler
2  * Copyright (C) 2006, 2013, 2016, 2018, Albert Astals Cid <aacid@kde.org>
3  * Copyright (C) 2007-2008, 2010, Pino Toscano <pino@kde.org>
4  * Copyright (C) 2010, 2012, Guillermo Amaral <gamaral@kdab.com>
5  * Copyright (C) 2012, Tobias Koenig <tokoe@kdab.com>
6  * Copyright (C) 2013, Anthony Granger <grangeranthony@gmail.com>
7  * Copyright (C) 2018 Intevation GmbH <intevation@intevation.de>
8  * Adapting code from
9  * Copyright (C) 2004 by Enrico Ros <eros.kde@email.it>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2, or (at your option)
14  * any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
24  */
25 
26 #ifndef _POPPLER_LINK_H_
27 #define _POPPLER_LINK_H_
28 
29 #include <QtCore/QString>
30 #include <QtCore/QRectF>
31 #include <QtCore/QSharedDataPointer>
32 #include <QtCore/QVector>
33 #include "poppler-export.h"
34 
35 struct Ref;
36 class MediaRendition;
37 class MovieAnnotation;
38 class ScreenAnnotation;
39 
40 namespace Poppler {
41 
42 class LinkPrivate;
43 class LinkGotoPrivate;
44 class LinkExecutePrivate;
45 class LinkBrowsePrivate;
46 class LinkActionPrivate;
47 class LinkSoundPrivate;
48 class LinkJavaScriptPrivate;
49 class LinkMoviePrivate;
50 class LinkDestinationData;
51 class LinkDestinationPrivate;
52 class LinkRenditionPrivate;
53 class LinkOCGStatePrivate;
54 class LinkHidePrivate;
55 class MediaRendition;
56 class SoundObject;
57 
67 class POPPLER_QT5_EXPORT LinkDestination
68 {
69  public:
73  enum Kind
74  {
81  destXYZ = 1,
82  destFit = 2,
83  destFitH = 3,
84  destFitV = 4,
85  destFitR = 5,
86  destFitB = 6,
87  destFitBH = 7,
88  destFitBV = 8
89  };
90 
92  LinkDestination(const LinkDestinationData &data);
93  LinkDestination(const QString &description);
95 
98  LinkDestination(const LinkDestination &other);
102  ~LinkDestination();
103 
104  // Accessors.
108  Kind kind() const;
115  int pageNumber() const;
120  double left() const;
121  double bottom() const;
122  double right() const;
127  double top() const;
128  double zoom() const;
135  bool isChangeLeft() const;
142  bool isChangeTop() const;
148  bool isChangeZoom() const;
149 
153  QString toString() const;
154 
160  QString destinationName() const;
161 
165  LinkDestination& operator=(const LinkDestination &other);
166 
167  private:
168  QSharedDataPointer< LinkDestinationPrivate > d;
169 };
170 
178 class POPPLER_QT5_EXPORT Link
179 {
180  friend class OptContentModel;
181 
182  public:
184  Link( const QRectF &linkArea );
186 
192  enum LinkType
193  {
205  };
206 
210  virtual LinkType linkType() const;
211 
215  virtual ~Link();
216 
223  QRectF linkArea() const;
224 
230  QVector<Link *> nextLinks() const;
231 
232  protected:
234  Link( LinkPrivate &dd );
235  Q_DECLARE_PRIVATE( Link )
236  LinkPrivate *d_ptr;
238 
239  private:
240  Q_DISABLE_COPY( Link )
241 };
242 
243 
252 class POPPLER_QT5_EXPORT LinkGoto : public Link
253 {
254  public:
262  // TODO Next ABI break, make extFileName const &
263  LinkGoto( const QRectF &linkArea, QString extFileName, const LinkDestination & destination );
267  ~LinkGoto();
268 
273  bool isExternal() const;
274  // query for goto parameters
279  QString fileName() const;
283  LinkDestination destination() const;
284  LinkType linkType() const override;
285 
286  private:
287  Q_DECLARE_PRIVATE( LinkGoto )
288  Q_DISABLE_COPY( LinkGoto )
289 };
290 
299 class POPPLER_QT5_EXPORT LinkExecute : public Link
300 {
301  public:
305  QString fileName() const;
309  QString parameters() const;
310 
318  LinkExecute( const QRectF &linkArea, const QString & file, const QString & params );
322  ~LinkExecute();
323  LinkType linkType() const override;
324 
325  private:
326  Q_DECLARE_PRIVATE( LinkExecute )
327  Q_DISABLE_COPY( LinkExecute )
328 };
329 
338 class POPPLER_QT5_EXPORT LinkBrowse : public Link
339 {
340  public:
344  QString url() const;
345 
352  LinkBrowse( const QRectF &linkArea, const QString &url );
356  ~LinkBrowse();
357  LinkType linkType() const override;
358 
359  private:
360  Q_DECLARE_PRIVATE( LinkBrowse )
361  Q_DISABLE_COPY( LinkBrowse )
362 };
363 
370 class POPPLER_QT5_EXPORT LinkAction : public Link
371 {
372  public:
376  enum ActionType { PageFirst = 1,
377  PagePrev = 2,
378  PageNext = 3,
379  PageLast = 4,
380  HistoryBack = 5,
381  HistoryForward = 6,
382  Quit = 7,
383  Presentation = 8,
384  EndPresentation = 9,
385  Find = 10,
386  GoToPage = 11,
387  Close = 12,
388  Print = 13
389  };
390 
394  ActionType actionType() const;
395 
403  LinkAction( const QRectF &linkArea, ActionType actionType );
407  ~LinkAction();
408  LinkType linkType() const override;
409 
410  private:
411  Q_DECLARE_PRIVATE( LinkAction )
412  Q_DISABLE_COPY( LinkAction )
413 };
414 
420 class POPPLER_QT5_EXPORT LinkSound : public Link
421 {
422  public:
423  // create a Link_Sound
424  LinkSound( const QRectF &linkArea, double volume, bool sync, bool repeat, bool mix, SoundObject *sound );
428  ~LinkSound();
429 
430  LinkType linkType() const override;
431 
439  double volume() const;
444  bool synchronous() const;
449  bool repeat() const;
457  bool mix() const;
461  SoundObject *sound() const;
462 
463  private:
464  Q_DECLARE_PRIVATE( LinkSound )
465  Q_DISABLE_COPY( LinkSound )
466 };
467 
473 class POPPLER_QT5_EXPORT LinkRendition : public Link
474 {
475  public:
482  NoRendition,
483  PlayRendition,
484  StopRendition,
485  PauseRendition,
486  ResumeRendition
487  };
488 
499  // TODO Next ABI break, remove & from annotationReference
500  LinkRendition( const QRectF &linkArea, ::MediaRendition *rendition, int operation, const QString &script, const Ref &annotationReference );
501 
505  ~LinkRendition();
506 
507  LinkType linkType() const override;
508 
512  MediaRendition *rendition() const;
513 
519  RenditionAction action() const;
520 
526  QString script() const;
527 
533  bool isReferencedAnnotation( const ScreenAnnotation *annotation ) const;
534 
535  private:
536  Q_DECLARE_PRIVATE( LinkRendition )
537  Q_DISABLE_COPY( LinkRendition )
538 };
539 
545 class POPPLER_QT5_EXPORT LinkJavaScript : public Link
546 {
547  public:
554  LinkJavaScript( const QRectF &linkArea, const QString &js );
558  ~LinkJavaScript();
559 
560  LinkType linkType() const override;
561 
565  QString script() const;
566 
567  private:
568  Q_DECLARE_PRIVATE( LinkJavaScript )
569  Q_DISABLE_COPY( LinkJavaScript )
570 };
571 
577 class POPPLER_QT5_EXPORT LinkMovie : public Link
578 {
579  public:
583  enum Operation { Play,
584  Stop,
585  Pause,
586  Resume
587  };
588 
599  // TODO Next ABI break, remove & from annotationReference
600  LinkMovie( const QRectF &linkArea, Operation operation, const QString &annotationTitle, const Ref &annotationReference );
604  ~LinkMovie();
605  LinkType linkType() const override;
609  Operation operation() const;
613  bool isReferencedAnnotation( const MovieAnnotation *annotation ) const;
614 
615  private:
616  Q_DECLARE_PRIVATE( LinkMovie )
617  Q_DISABLE_COPY( LinkMovie )
618 };
619 
625 class POPPLER_QT5_EXPORT LinkOCGState : public Link
626 {
627  public:
631  LinkOCGState( LinkOCGStatePrivate *ocgp );
635  ~LinkOCGState();
636 
637  LinkType linkType() const override;
638 
639  private:
640  Q_DECLARE_PRIVATE( LinkOCGState )
641  Q_DISABLE_COPY( LinkOCGState )
642 };
643 
649 class POPPLER_QT5_EXPORT LinkHide: public Link
650 {
651  public:
655  LinkHide( LinkHidePrivate *lhidep );
659  ~LinkHide();
660 
661  LinkType linkType() const override;
662 
666  QVector< QString > targets() const;
667 
671  bool isShowAction() const;
672 
673  private:
674  Q_DECLARE_PRIVATE( LinkHide )
675  Q_DISABLE_COPY( LinkHide )
676 };
677 
678 }
679 
680 #endif
Rendition: Rendition link.
Definition: poppler-link.h:473
Movie: a movie to be played.
Definition: poppler-link.h:577
A destination.
Definition: poppler-link.h:67
Movie annotation.
Definition: poppler-annotation.h:911
RenditionAction
Describes the possible rendition actions.
Definition: poppler-link.h:481
Sound: a sound to be played.
Definition: poppler-link.h:420
ActionType
The possible types of actions.
Definition: poppler-link.h:376
Viewport reaching request.
Definition: poppler-link.h:252
Container class for a sound file in a PDF document.
Definition: poppler-qt5.h:2101
An URL to browse.
Definition: poppler-link.h:338
Kind
The possible kind of "viewport destination".
Definition: poppler-link.h:73
Model for optional content.
Definition: poppler-optcontent.h:49
Screen annotation.
Definition: poppler-annotation.h:955
OCGState: an optional content group state change.
Definition: poppler-link.h:625
Generic execution request.
Definition: poppler-link.h:299
Hide: an action to show / hide a field.
Definition: poppler-link.h:649
The Poppler Qt5 binding.
Definition: poppler-annotation.h:45
JavaScript: a JavaScript code to be interpreted.
Definition: poppler-link.h:545
Operation
Describes the operation to be performed on the movie.
Definition: poppler-link.h:583
"Standard" action request.
Definition: poppler-link.h:370