r17857 by fschmid - PDF-Importer: read back our own OpenAction settings if any.

scribus-commit scribus-commit at lists.scribus.net
Tue Nov 6 20:26:09 UTC 2012


Author: fschmid
Date: Tue Nov  6 20:26:08 2012
New Revision: 17857

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17857
Log:
PDF-Importer: read back our own OpenAction settings if any.

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

Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17857&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 Tue Nov  6 20:26:08 2012
@@ -530,11 +530,11 @@
 						if (numjs > 0)
 						{
 							NameTree *jsNameTreeP = new NameTree();
-							Object names;
 							Object catDict;
 							pdfDoc->getXRef()->getCatalog(&catDict);
 							if (catDict.isDict())
 							{
+								Object names;
 								catDict.dictLookup("Names", &names);
 								if (names.isDict())
 								{
@@ -546,6 +546,28 @@
 								for (int a = 0; a < numjs; a++)
 								{
 									m_Doc->JavaScripts.insert(UnicodeParsedString(jsNameTreeP->getName(a)), UnicodeParsedString(pdfDoc->getCatalog()->getJS(a)));
+								}
+								names.free();
+								catDict.dictLookup("OpenAction", &names);
+								if (names.isDict())
+								{
+									LinkAction *linkAction = NULL;
+									linkAction = LinkAction::parseAction(&names, pdfDoc->getCatalog()->getBaseURI());
+									if (linkAction)
+									{
+										LinkJavaScript *jsa = (LinkJavaScript*)linkAction;
+										if (jsa->isOk())
+										{
+											QString script = UnicodeParsedString(jsa->getScript());
+											if (script.startsWith("this."))
+											{
+												script.remove(0, 5);
+												script.remove("()");
+												if (m_Doc->JavaScripts.contains(script))
+													m_Doc->pdfOptions().openAction = script;
+											}
+										}
+									}
 								}
 								names.free();
 							}




More information about the scribus-commit mailing list