1 | /* |
2 | * Copyright (C) 2009-2010, Pino Toscano <pino@kde.org> |
3 | * Copyright (C) 2011, 2021, 2022, Albert Astals Cid <aacid@kde.org> |
4 | * |
5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2, or (at your option) |
8 | * any later version. |
9 | * |
10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | /** |
21 | \file poppler-page-transition.h |
22 | */ |
23 | #include "poppler-page-transition.h" |
24 | |
25 | #include "PageTransition.h" |
26 | |
27 | using namespace poppler; |
28 | |
29 | class poppler::page_transition_private |
30 | { |
31 | public: |
32 | explicit page_transition_private(Object *trans) : pt(trans) { } |
33 | |
34 | PageTransition pt; |
35 | }; |
36 | |
37 | /** |
38 | \class poppler::page_transition poppler-page-transition.h "poppler/cpp/poppler-page-transition.h" |
39 | |
40 | A transition between two pages in a PDF %document. |
41 | |
42 | Usually shown in a presentation mode of a PDF viewer. |
43 | */ |
44 | |
45 | /** |
46 | \enum poppler::page_transition::type_enum |
47 | |
48 | The possible types of a %page transition. |
49 | */ |
50 | |
51 | /** |
52 | \enum poppler::page_transition::alignment_enum |
53 | |
54 | The alignment of a %page transition. |
55 | */ |
56 | |
57 | /** |
58 | \enum poppler::page_transition::direction_enum |
59 | |
60 | The direction of an animation in a %page transition. |
61 | */ |
62 | |
63 | page_transition::page_transition(Object *params) : d(new page_transition_private(params)) { } |
64 | |
65 | /** |
66 | Copy constructor. |
67 | */ |
68 | page_transition::page_transition(const page_transition &pt) : d(new page_transition_private(*pt.d)) { } |
69 | |
70 | /** |
71 | Destructor. |
72 | */ |
73 | page_transition::~page_transition() |
74 | { |
75 | delete d; |
76 | } |
77 | |
78 | page_transition::type_enum page_transition::type() const |
79 | { |
80 | return (page_transition::type_enum)d->pt.getType(); |
81 | } |
82 | |
83 | int page_transition::duration() const |
84 | { |
85 | return static_cast<int>(d->pt.getDuration()); |
86 | } |
87 | |
88 | double page_transition::durationReal() const |
89 | { |
90 | return d->pt.getDuration(); |
91 | } |
92 | |
93 | page_transition::alignment_enum page_transition::alignment() const |
94 | { |
95 | return (page_transition::alignment_enum)d->pt.getAlignment(); |
96 | } |
97 | |
98 | page_transition::direction_enum page_transition::direction() const |
99 | { |
100 | return (page_transition::direction_enum)d->pt.getDirection(); |
101 | } |
102 | |
103 | int page_transition::angle() const |
104 | { |
105 | return d->pt.getAngle(); |
106 | } |
107 | |
108 | double page_transition::scale() const |
109 | { |
110 | return d->pt.getScale(); |
111 | } |
112 | |
113 | bool page_transition::is_rectangular() const |
114 | { |
115 | return d->pt.isRectangular(); |
116 | } |
117 | |
118 | page_transition &page_transition::operator=(const page_transition &pt) |
119 | { |
120 | if (&pt != this) { |
121 | page_transition_private *new_d = new page_transition_private(*pt.d); |
122 | delete d; |
123 | d = new_d; |
124 | } |
125 | return *this; |
126 | } |
127 | |