r17859 by fschmid - PDF-Importer: added reading of page transition parameters.

scribus-commit scribus-commit at lists.scribus.net
Wed Nov 7 21:55:39 UTC 2012


Author: fschmid
Date: Wed Nov  7 21:55:39 2012
New Revision: 17859

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17859
Log:
PDF-Importer: added reading of page transition parameters.

Modified:
    trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
    trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
    trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h

Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17859&path=/trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp Wed Nov  7 21:55:39 2012
@@ -18,6 +18,7 @@
 #include "slaoutput.h"
 #include <ErrorCodes.h>
 #include <GlobalParams.h>
+#include <PageTransition.h>
 #include <ViewerPreferences.h>
 #include <poppler-config.h>
 
@@ -496,6 +497,7 @@
 						m_Doc->setPageHeight(pdfDoc->getPageMediaHeight(1));
 						m_Doc->setPageWidth(pdfDoc->getPageMediaWidth(1));
 						m_Doc->setPageSize("Custom");
+						m_Doc->pdfOptions().PresentVals.clear();
 						for (int pp = 0; pp < lastPage; pp++)
 						{
 							m_Doc->setActiveLayer(baseLayer);
@@ -525,6 +527,56 @@
 							}
 							else
 								pdfDoc->displayPage(dev, pp + 1, hDPI, vDPI, rotate, useMediaBox, crop, printing, NULL, NULL, dev->annotations_callback, dev);
+							PDFPresentationData ef;
+							Object trans;
+							Object *transi = pdfDoc->getPage(pp + 1)->getTrans(&trans);
+							if (transi->isDict())
+							{
+								m_Doc->pdfOptions().PresentMode = true;
+								PageTransition *pgTrans = new PageTransition(transi);
+								ef.pageViewDuration = pdfDoc->getPage(pp + 1)->getDuration();
+								ef.pageEffectDuration = pgTrans->getDuration();
+								ef.Dm = pgTrans->getAlignment() == transitionHorizontal ? 0 : 1;
+								ef.M = pgTrans->getDirection() == transitionInward ? 0 : 1;
+								int ang = pgTrans->getAngle();
+								if (ang == 0)
+									ef.Di = 0;
+								else if (ang == 270)
+									ef.Di = 1;
+								else if (ang == 90)
+									ef.Di = 2;
+								else if (ang == 180)
+									ef.Di = 3;
+								else if (ang == 315)
+									ef.Di = 4;
+								PageTransitionType trType = pgTrans->getType();
+								if (trType == transitionReplace)
+									ef.effectType = 0;
+								else if (trType == transitionBlinds)
+									ef.effectType = 1;
+								else if (trType == transitionBox)
+									ef.effectType = 2;
+								else if (trType == transitionDissolve)
+									ef.effectType = 3;
+								else if (trType == transitionGlitter)
+									ef.effectType = 4;
+								else if (trType == transitionSplit)
+									ef.effectType = 5;
+								else if (trType == transitionWipe)
+									ef.effectType = 6;
+								else if (trType == transitionPush)
+									ef.effectType = 7;
+								else if (trType == transitionCover)
+									ef.effectType = 8;
+								else if (trType == transitionUncover)
+									ef.effectType = 9;
+								else if (trType == transitionFade)
+									ef.effectType = 10;
+								delete pgTrans;
+							}
+							m_Doc->pdfOptions().PresentVals.append(ef);
+							trans.free();
+							transi->free();
 						}
 						int numjs = pdfDoc->getCatalog()->numJS();
 						if (numjs > 0)

Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17859&path=/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp Wed Nov  7 21:55:39 2012
@@ -1,7 +1,6 @@
 #include "slaoutput.h"
 #include <GlobalParams.h>
 #include <poppler-config.h>
-#include <Form.h>
 #include <FileSpec.h>
 #include <QApplication>
 #include <QFile>

Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17859&path=/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/slaoutput.h Wed Nov  7 21:55:39 2012
@@ -36,6 +36,7 @@
 #include <Link.h>
 #include <PDFDoc.h>
 #include <Error.h>
+#include <Form.h>
 #include <Page.h>
 #include <Catalog.h>
 #include <CharCodeToUnicode.h>




More information about the scribus-commit mailing list