~ubuntu-branches/ubuntu/saucy/emscripten/saucy-proposed

« back to all changes in this revision

Viewing changes to tests/poppler/poppler/PageTransition.cc

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* PageTransition.cc
 
2
 * Copyright (C) 2005, Net Integration Technologies, Inc.
 
3
 * Copyright (C) 2010, 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
#ifdef USE_GCC_PRAGMAS
 
21
#pragma implementation
 
22
#endif
 
23
 
 
24
#include "PageTransition.h"
 
25
 
 
26
//------------------------------------------------------------------------
 
27
// PageTransition
 
28
//------------------------------------------------------------------------
 
29
 
 
30
PageTransition::PageTransition (Object *trans) {
 
31
  Object obj;
 
32
  Dict *dict;
 
33
 
 
34
  type = transitionReplace;
 
35
  duration = 1;
 
36
  alignment = transitionHorizontal;
 
37
  direction = transitionInward;
 
38
  angle = 0;
 
39
  scale = 1.0;
 
40
  rectangular = gFalse;
 
41
  ok = gTrue;
 
42
 
 
43
  if (!trans || !trans->isDict ()) {
 
44
    ok = gFalse;
 
45
    return;
 
46
  }
 
47
 
 
48
  dict = trans->getDict();
 
49
 
 
50
  // get type
 
51
  if (dict->lookup("S", &obj)->isName()) {
 
52
    const char *s = obj.getName();
 
53
    
 
54
    if (strcmp("R", s) == 0)
 
55
      type = transitionReplace;
 
56
    else if (strcmp("Split", s) == 0)
 
57
      type = transitionSplit;
 
58
    else if (strcmp("Blinds", s) == 0)
 
59
      type = transitionBlinds;
 
60
    else if (strcmp("Box", s) == 0)
 
61
      type = transitionBox;
 
62
    else if (strcmp("Wipe", s) == 0)
 
63
      type = transitionWipe;
 
64
    else if (strcmp("Dissolve", s) == 0)
 
65
      type = transitionDissolve;
 
66
    else if (strcmp("Glitter", s) == 0)
 
67
      type = transitionGlitter;
 
68
    else if (strcmp("Fly", s) == 0)
 
69
      type = transitionFly;
 
70
    else if (strcmp("Push", s) == 0)
 
71
      type = transitionPush;
 
72
    else if (strcmp("Cover", s) == 0)
 
73
      type = transitionCover;
 
74
    else if (strcmp("Uncover", s) == 0)
 
75
      type = transitionUncover;
 
76
    else if (strcmp("Fade", s) == 0)
 
77
      type = transitionFade;
 
78
  }
 
79
  obj.free();
 
80
 
 
81
  // get duration
 
82
  if (dict->lookup("D", &obj)->isInt()) {
 
83
    duration = obj.getInt();
 
84
  }
 
85
  obj.free();
 
86
 
 
87
  // get alignment
 
88
  if (dict->lookup("Dm", &obj)->isName()) {
 
89
    const char *dm = obj.getName();
 
90
    
 
91
    if (strcmp("H", dm) == 0)
 
92
      alignment = transitionHorizontal;
 
93
    else if (strcmp("V", dm) == 0)
 
94
      alignment = transitionVertical;
 
95
  }
 
96
  obj.free();
 
97
 
 
98
  // get direction
 
99
  if (dict->lookup("M", &obj)->isName()) {
 
100
    const char *m = obj.getName();
 
101
    
 
102
    if (strcmp("I", m) == 0)
 
103
      direction = transitionInward;
 
104
    else if (strcmp("O", m) == 0)
 
105
      direction = transitionOutward;
 
106
  }
 
107
  obj.free();
 
108
 
 
109
  // get angle
 
110
  if (dict->lookup("Di", &obj)->isInt()) {
 
111
    angle = obj.getInt();
 
112
  }
 
113
  obj.free();
 
114
 
 
115
  if (dict->lookup("Di", &obj)->isName()) {
 
116
    if (strcmp("None", obj.getName()) == 0)
 
117
      angle = 0;
 
118
  }
 
119
  obj.free();
 
120
 
 
121
  // get sacle
 
122
  if (dict->lookup("SS", &obj)->isReal()) {
 
123
    scale = obj.getReal();
 
124
  }
 
125
  obj.free();
 
126
 
 
127
  // get rectangular
 
128
  if (dict->lookup("B", &obj)->isBool()) {
 
129
    rectangular = obj.getBool();
 
130
  }
 
131
  obj.free();
 
132
}
 
133
 
 
134
PageTransition::~PageTransition()
 
135
{
 
136
}
 
137