1 | /* PageTransition.cc |
2 | * Copyright (C) 2005, Net Integration Technologies, Inc. |
3 | * Copyright (C) 2015, Arseniy Lartsev <arseniy@alumni.chalmers.se> |
4 | * Copyright (C) 2018, 2021 Albert Astals Cid <aacid@kde.org> |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2, or (at your option) |
9 | * any later version. |
10 | * |
11 | * This program is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU General Public License |
17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. |
19 | */ |
20 | |
21 | #include "PageTransition.h" |
22 | #include "poppler-page-transition.h" |
23 | #include "poppler-page-transition-private.h" |
24 | |
25 | namespace Poppler { |
26 | |
27 | class PageTransitionData |
28 | { |
29 | public: |
30 | explicit PageTransitionData(Object *trans) { pt = new ::PageTransition(trans); } |
31 | |
32 | PageTransitionData(const PageTransitionData &ptd) { pt = new ::PageTransition(*ptd.pt); } |
33 | |
34 | ~PageTransitionData() { delete pt; } |
35 | |
36 | PageTransitionData &operator=(const PageTransitionData &) = delete; |
37 | |
38 | ::PageTransition *pt; |
39 | }; |
40 | |
41 | PageTransition::PageTransition(const PageTransitionParams params) |
42 | { |
43 | data = new PageTransitionData(params.dictObj); |
44 | } |
45 | |
46 | PageTransition::PageTransition(const PageTransition &pt) |
47 | { |
48 | data = new PageTransitionData(*pt.data); |
49 | } |
50 | |
51 | PageTransition::~PageTransition() |
52 | { |
53 | delete data; |
54 | } |
55 | |
56 | PageTransition &PageTransition::operator=(const PageTransition &other) |
57 | { |
58 | if (this != &other) { |
59 | delete data; |
60 | data = new PageTransitionData(*other.data); |
61 | } |
62 | |
63 | return *this; |
64 | } |
65 | |
66 | PageTransition::Type PageTransition::type() const |
67 | { |
68 | return (Poppler::PageTransition::Type)data->pt->getType(); |
69 | } |
70 | |
71 | double PageTransition::durationReal() const |
72 | { |
73 | return data->pt->getDuration(); |
74 | } |
75 | |
76 | PageTransition::Alignment PageTransition::alignment() const |
77 | { |
78 | return (Poppler::PageTransition::Alignment)data->pt->getAlignment(); |
79 | } |
80 | |
81 | PageTransition::Direction PageTransition::direction() const |
82 | { |
83 | return (Poppler::PageTransition::Direction)data->pt->getDirection(); |
84 | } |
85 | |
86 | int PageTransition::angle() const |
87 | { |
88 | return data->pt->getAngle(); |
89 | } |
90 | |
91 | double PageTransition::scale() const |
92 | { |
93 | return data->pt->getScale(); |
94 | } |
95 | bool PageTransition::isRectangular() const |
96 | { |
97 | return data->pt->isRectangular(); |
98 | } |
99 | |
100 | } |
101 | |