1 /* PageTransition.h
2  * Copyright (C) 2005, Net Integration Technologies, Inc.
3  * Copyright (C) 2005, Brad Hards <bradh@frogmouth.net>
4  * Copyright (C) 2015, Arseniy Lartsev <arseniy@alumni.chalmers.se>
5  * Copyright (C) 2018, 2021 Albert Astals Cid <aacid@kde.org>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef __PAGETRANSITION_X_H__
23 #define __PAGETRANSITION_X_H__
24 
25 #include "poppler-export.h"
26 
27 #include <QtCore/qglobal.h>
28 
29 namespace Poppler {
30 
31 class PageTransitionParams;
32 class PageTransitionData;
33 
34 /**
35    \brief Describes how a PDF file viewer shall perform the transition
36    from one page to another
37 
38    In PDF files there is a way to specify if the viewer shall use
39    certain effects to perform the transition from one page to
40    another. This feature can be used, e.g., in a PDF-based beamer
41    presentation.
42 
43    This utility class represents the transition effect, and can be
44    used to extract the information from a PDF object.
45 */
46 
47 class POPPLER_QT5_EXPORT PageTransition
48 {
49 public:
50     /** \brief transition effect that shall be used
51      */
52     // if changed remember to keep in sync with PageTransition.h enum
53     enum Type
54     {
55         Replace = 0,
56         Split,
57         Blinds,
58         Box,
59         Wipe,
60         Dissolve,
61         Glitter,
62         Fly,
63         Push,
64         Cover,
65         Uncover,
66         Fade
67     };
68 
69     /** \brief alignment of the transition effect that shall be used
70      */
71     // if changed remember to keep in sync with PageTransition.h enum
72     enum Alignment
73     {
74         Horizontal = 0,
75         Vertical
76     };
77 
78     /** \brief direction of the transition effect that shall be used
79      */
80     // if changed remember to keep in sync with PageTransition.h enum
81     enum Direction
82     {
83         Inward = 0,
84         Outward
85     };
86 
87     /** \brief Construct a new PageTransition object from a page dictionary.
88 
89     Users of the library will rarely need to construct a
90     PageTransition object themselves. Instead, the method
91     Poppler::Page::transition() can be used to find out if a certain
92     transition effect is specified.
93 
94     @warning In case or error, this method will print an error message to stderr,
95     and construct a default object.
96 
97     @param params an object whose dictionary will be read and
98      parsed. This must be a valid object, whose dictionaries are
99      accessed by the constructor. The object is only accessed by this
100      constructor, and may be deleted after the constructor returns.
101     */
102     // TODO Next ABI break, make this private and remove reference
103     explicit PageTransition(const PageTransitionParams &params);
104 
105     /** \brief copy constructor */
106     PageTransition(const PageTransition &pt);
107 
108     /** \brief assignment operator \since 0.63 */
109     PageTransition &operator=(const PageTransition &other);
110 
111     /**
112        Destructor
113     */
114     ~PageTransition();
115 
116     /**
117        \brief Get type of the transition.
118     */
119     Type type() const;
120 
121     /**
122        \brief Get duration of the transition in seconds as integer
123 
124        \deprecated This function is left for backward compatibility, use durationReal() instead.
125     */
126     Q_DECL_DEPRECATED int duration() const;
127 
128     /**
129        \brief Get duration of the transition in seconds
130     */
131     double durationReal() const;
132 
133     /**
134        \brief Get dimension in which the transition effect occurs.
135     */
136     Alignment alignment() const;
137 
138     /**
139        \brief Get direction of motion of the transition effect.
140     */
141     Direction direction() const;
142 
143     /**
144        \brief Get direction in which the transition effect moves.
145     */
146     int angle() const;
147 
148     /**
149        \brief Get starting or ending scale.
150     */
151     double scale() const;
152 
153     /**
154        \brief Returns true if the area to be flown is rectangular and
155        opaque.
156     */
157     bool isRectangular() const;
158 
159 private:
160     PageTransitionData *data;
161 };
162 
163 }
164 
165 #endif
166