[poppler]
poppler/poppler: Makefile.am, 1.31, 1.32 PageTransition.cc,
1.2, 1.3 PageTransition.h, 1.2, 1.3
Albert Astals Cid
aacid at kemper.freedesktop.org
Fri Apr 27 15:26:11 PDT 2007
Update of /cvs/poppler/poppler/poppler
In directory kemper:/tmp/cvs-serv13199/poppler
Modified Files:
Makefile.am PageTransition.cc
Added Files:
PageTransition.h
Log Message:
2007-04-28 Carlos Garcia Campos <carlosgc at gnome.org>
reviewed and some code by: Albert Astals Cid <aacid at kde.org>
* glib/poppler-page.cc:
* glib/poppler-page.h:
* glib/poppler.h:
* glib/test-poppler-glib.c:
* poppler/Makefile.am:
* poppler/PageTransition.cc:
* poppler/PageTransition.h:
* qt/poppler-page-transition.cc:
* qt/poppler-page-transition.h: Move Page Transition parsing from qt
frontends to poppler core. Expose Page transitions on the glib
frontend.
Index: Makefile.am
===================================================================
RCS file: /cvs/poppler/poppler/poppler/Makefile.am,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- Makefile.am 25 Apr 2007 19:59:10 -0000 1.31
+++ Makefile.am 27 Apr 2007 22:26:09 -0000 1.32
@@ -150,6 +150,7 @@
Outline.h \
OutputDev.h \
Page.h \
+ PageTransition.h \
Parser.h \
PDFDoc.h \
PDFDocEncoding.h \
@@ -214,6 +215,7 @@
Outline.cc \
OutputDev.cc \
Page.cc \
+ PageTransition.cc \
Parser.cc \
PDFDoc.cc \
PDFDocEncoding.cc \
Index: PageTransition.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/PageTransition.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- PageTransition.cc 2 Jan 2006 14:24:31 -0000 1.2
+++ PageTransition.cc 27 Apr 2007 22:26:09 -0000 1.3
@@ -16,174 +16,121 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <iostream>
+#ifdef USE_GCC_PRAGMAS
+#pragma implementation
+#endif
-#include "Error.h"
-#include "Object.h"
#include "PageTransition.h"
-#include "Private.h"
-namespace Poppler {
+//------------------------------------------------------------------------
+// PageTransition
+//------------------------------------------------------------------------
-class PageTransitionData
-{
- public:
- PageTransition::Type type;
- int duration;
- PageTransition::Alignment alignment;
- PageTransition::Direction direction;
- int angle;
- double scale;
- bool rectangular;
-};
+PageTransition::PageTransition (Object *trans) {
+ Object obj;
+ Dict *dict;
-PageTransition::PageTransition(const PageTransitionParams ¶ms)
-{
- data = new PageTransitionData();
- data->type = Replace;
- data->duration = 1;
- data->alignment = Horizontal;
- data->direction = Inward;
- data->angle = 0;
- data->scale = 1.0;
- data->rectangular = false;
+ type = transitionReplace;
+ duration = 1;
+ alignment = transitionHorizontal;
+ direction = transitionInward;
+ angle = 0;
+ scale = 1.0;
+ rectangular = gFalse;
+ ok = gTrue;
- // Paranoid safety checks
- if (params.dictObj == 0) {
- error(-1, "PageTransition::PageTransition() called with params.dictObj==0");
- return;
- }
- if (params.dictObj->isDict() == false) {
- error(-1, "PageTransition::PageTransition() called with params.dictObj->isDict()==false");
+ if (!trans || !trans->isDict ()) {
+ ok = gFalse;
return;
}
- // Obtain a pointer to the dictionary and start parsing.
- Dict *transDict = params.dictObj->getDict();
- Object obj;
+ dict = trans->getDict();
- if (transDict->lookup("S", &obj)->isName()) {
+ // get type
+ if (dict->lookup("S", &obj)->isName()) {
const char *s = obj.getName();
+
if (strcmp("R", s) == 0)
- data->type = Replace;
+ type = transitionReplace;
else if (strcmp("Split", s) == 0)
- data->type = Split;
+ type = transitionSplit;
else if (strcmp("Blinds", s) == 0)
- data->type = Blinds;
+ type = transitionBlinds;
else if (strcmp("Box", s) == 0)
- data->type = Box;
+ type = transitionBox;
else if (strcmp("Wipe", s) == 0)
- data->type = Wipe;
+ type = transitionWipe;
else if (strcmp("Dissolve", s) == 0)
- data->type = Dissolve;
+ type = transitionDissolve;
else if (strcmp("Glitter", s) == 0)
- data->type = Glitter;
+ type = transitionGlitter;
else if (strcmp("Fly", s) == 0)
- data->type = Fly;
+ type = transitionFly;
else if (strcmp("Push", s) == 0)
- data->type = Push;
+ type = transitionPush;
else if (strcmp("Cover", s) == 0)
- data->type = Cover;
+ type = transitionCover;
else if (strcmp("Uncover", s) == 0)
- data->type = Push;
+ type = transitionPush;
else if (strcmp("Fade", s) == 0)
- data->type = Cover;
+ type = transitionCover;
}
obj.free();
-
- if (transDict->lookup("D", &obj)->isInt()) {
- data->duration = obj.getInt();
+
+ // get duration
+ if (dict->lookup("D", &obj)->isInt()) {
+ duration = obj.getInt();
}
obj.free();
- if (transDict->lookup("Dm", &obj)->isName()) {
+ // get alignment
+ if (dict->lookup("Dm", &obj)->isName()) {
const char *dm = obj.getName();
- if ( strcmp( "H", dm ) == 0 )
- data->alignment = Horizontal;
- else if ( strcmp( "V", dm ) == 0 )
- data->alignment = Vertical;
+
+ if (strcmp("H", dm) == 0)
+ alignment = transitionHorizontal;
+ else if (strcmp("V", dm) == 0)
+ alignment = transitionVertical;
}
obj.free();
-
- if (transDict->lookup("M", &obj)->isName()) {
+
+ // get direction
+ if (dict->lookup("M", &obj)->isName()) {
const char *m = obj.getName();
- if ( strcmp( "I", m ) == 0 )
- data->direction = Inward;
- else if ( strcmp( "O", m ) == 0 )
- data->direction = Outward;
+
+ if (strcmp("I", m) == 0)
+ direction = transitionInward;
+ else if (strcmp("O", m) == 0)
+ direction = transitionOutward;
}
obj.free();
-
- if (transDict->lookup("Di", &obj)->isInt()) {
- data->angle = obj.getInt();
+
+ // get angle
+ if (dict->lookup("Di", &obj)->isInt()) {
+ angle = obj.getInt();
}
obj.free();
-
- if (transDict->lookup("Di", &obj)->isName()) {
- if ( strcmp( "None", obj.getName() ) == 0 )
- data->angle = 0;
+
+ if (dict->lookup("Di", &obj)->isName()) {
+ if (strcmp("None", obj.getName()) == 0)
+ angle = 0;
}
obj.free();
-
- if (transDict->lookup("SS", &obj)->isReal()) {
- data->scale = obj.getReal();
+
+ // get sacle
+ if (dict->lookup("SS", &obj)->isReal()) {
+ scale = obj.getReal();
}
obj.free();
-
- if (transDict->lookup("B", &obj)->isBool()) {
- data->rectangular = obj.getBool();
+
+ // get rectangular
+ if (dict->lookup("B", &obj)->isBool()) {
+ rectangular = obj.getBool();
}
obj.free();
}
-PageTransition::PageTransition(const PageTransition &pt)
-{
- data = new PageTransitionData();
- data->type = pt.data->type;
- data->duration = pt.data->duration;
- data->alignment = pt.data->alignment;
- data->direction = pt.data->direction;
- data->angle = pt.data->angle;
- data->scale = pt.data->scale;
- data->rectangular = pt.data->rectangular;
-}
-
PageTransition::~PageTransition()
{
}
-PageTransition::Type PageTransition::type() const
-{
- return data->type;
-}
-
-int PageTransition::duration() const
-{
- return data->duration;
-}
-
-PageTransition::Alignment PageTransition::alignment() const
-{
- return data->alignment;
-}
-
-PageTransition::Direction PageTransition::direction() const
-{
- return data->direction;
-}
-
-int PageTransition::angle() const
-{
- return data->angle;
-}
-
-double PageTransition::scale() const
-{
- return data->scale;
-}
-bool PageTransition::isRectangular() const
-{
- return data->rectangular;
-}
-
-}
More information about the poppler
mailing list