source: trunk/poppler/mypoppler/poppler/PageTransition.cc @ 257

Last change on this file since 257 was 250, checked in by Eugene Romanenko, 13 years ago

PDF plugin: poppler library updated to version 0.8.3

File size: 3.4 KB
Line 
1/* PageTransition.cc
2 * Copyright (C) 2005, Net Integration Technologies, Inc.
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, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#ifdef USE_GCC_PRAGMAS
20#pragma implementation
21#endif
22
23#include "PageTransition.h"
24
25//------------------------------------------------------------------------
26// PageTransition
27//------------------------------------------------------------------------
28
29PageTransition::PageTransition (Object *trans) {
30  Object obj;
31  Dict *dict;
32
33  type = transitionReplace;
34  duration = 1;
35  alignment = transitionHorizontal;
36  direction = transitionInward;
37  angle = 0;
38  scale = 1.0;
39  rectangular = gFalse;
40  ok = gTrue;
41
42  if (!trans || !trans->isDict ()) {
43    ok = gFalse;
44    return;
45  }
46
47  dict = trans->getDict();
48
49  // get type
50  if (dict->lookup("S", &obj)->isName()) {
51    const char *s = obj.getName();
52   
53    if (strcmp("R", s) == 0)
54      type = transitionReplace;
55    else if (strcmp("Split", s) == 0)
56      type = transitionSplit;
57    else if (strcmp("Blinds", s) == 0)
58      type = transitionBlinds;
59    else if (strcmp("Box", s) == 0)
60      type = transitionBox;
61    else if (strcmp("Wipe", s) == 0)
62      type = transitionWipe;
63    else if (strcmp("Dissolve", s) == 0)
64      type = transitionDissolve;
65    else if (strcmp("Glitter", s) == 0)
66      type = transitionGlitter;
67    else if (strcmp("Fly", s) == 0)
68      type = transitionFly;
69    else if (strcmp("Push", s) == 0)
70      type = transitionPush;
71    else if (strcmp("Cover", s) == 0)
72      type = transitionCover;
73    else if (strcmp("Uncover", s) == 0)
74      type = transitionPush;
75    else if (strcmp("Fade", s) == 0)
76      type = transitionCover;
77  }
78  obj.free();
79
80  // get duration
81  if (dict->lookup("D", &obj)->isInt()) {
82    duration = obj.getInt();
83  }
84  obj.free();
85
86  // get alignment
87  if (dict->lookup("Dm", &obj)->isName()) {
88    const char *dm = obj.getName();
89   
90    if (strcmp("H", dm) == 0)
91      alignment = transitionHorizontal;
92    else if (strcmp("V", dm) == 0)
93      alignment = transitionVertical;
94  }
95  obj.free();
96
97  // get direction
98  if (dict->lookup("M", &obj)->isName()) {
99    const char *m = obj.getName();
100   
101    if (strcmp("I", m) == 0)
102      direction = transitionInward;
103    else if (strcmp("O", m) == 0)
104      direction = transitionOutward;
105  }
106  obj.free();
107
108  // get angle
109  if (dict->lookup("Di", &obj)->isInt()) {
110    angle = obj.getInt();
111  }
112  obj.free();
113
114  if (dict->lookup("Di", &obj)->isName()) {
115    if (strcmp("None", obj.getName()) == 0)
116      angle = 0;
117  }
118  obj.free();
119
120  // get sacle
121  if (dict->lookup("SS", &obj)->isReal()) {
122    scale = obj.getReal();
123  }
124  obj.free();
125
126  // get rectangular
127  if (dict->lookup("B", &obj)->isBool()) {
128    rectangular = obj.getBool();
129  }
130  obj.free();
131}
132
133PageTransition::~PageTransition()
134{
135}
136
Note: See TracBrowser for help on using the repository browser.