r17849 by fschmid - PDF Import: added import of Combo- und Listboxes.

scribus-commit scribus-commit at lists.scribus.net
Fri Nov 2 18:31:33 UTC 2012


Author: fschmid
Date: Fri Nov  2 18:31:33 2012
New Revision: 17849

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17849
Log:
PDF Import: added import of Combo- und Listboxes.

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

Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17849&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 Fri Nov  2 18:31:33 2012
@@ -16,6 +16,7 @@
 #include <QDebug>
 #include "slaoutput.h"
 #include <GlobalParams.h>
+#include <ViewerPreferences.h>
 #include <poppler-config.h>
 
 #include "importpdf.h"
@@ -25,6 +26,7 @@
 #include "commonstrings.h"
 #include "loadsaveplugin.h"
 #include "pagesize.h"
+#include "pdfoptions.h"
 #include "prefscontext.h"
 #include "prefsfile.h"
 #include "prefsmanager.h"
@@ -519,6 +521,29 @@
 							catDict.free();
 							delete jsNameTreeP;
 						}
+						m_Doc->pdfOptions().Version = (PDFOptions::PDFVersion)qMin(15, qMax(13, pdfDoc->getPDFMajorVersion() * 10 + pdfDoc->getPDFMinorVersion()));
+						ViewerPreferences *viewPrefs = pdfDoc->getCatalog()->getViewerPreferences();
+						if (viewPrefs)
+						{
+							m_Doc->pdfOptions().Binding = viewPrefs->getDirection() == ViewerPreferences::directionL2R ? 0 : 1;
+							m_Doc->pdfOptions().hideMenuBar = viewPrefs->getHideMenubar();
+							m_Doc->pdfOptions().hideToolBar = viewPrefs->getHideToolbar();
+							m_Doc->pdfOptions().fitWindow = viewPrefs->getFitWindow();
+						}
+						Catalog::PageMode pgm = pdfDoc->getCatalog()->getPageMode();
+						m_Doc->pdfOptions().displayFullscreen = (pgm == Catalog::pageModeFullScreen);
+						m_Doc->pdfOptions().displayThumbs = (pgm == Catalog::pageModeThumbs);
+						m_Doc->pdfOptions().displayBookmarks = (pgm == Catalog::pageModeOutlines);
+						m_Doc->pdfOptions().displayLayers = (pgm == Catalog::pageModeOC);
+						Catalog::PageLayout pgl = pdfDoc->getCatalog()->getPageLayout();
+						if (pgl == Catalog::pageLayoutSinglePage)
+							m_Doc->pdfOptions().PageLayout = PDFOptions::SinglePage;
+						else if (pgl == Catalog::pageLayoutOneColumn)
+							m_Doc->pdfOptions().PageLayout = PDFOptions::OneColumn;
+						else if (pgl == Catalog::pageLayoutTwoColumnLeft)
+							m_Doc->pdfOptions().PageLayout = PDFOptions::TwoColumnLeft;
+						else if (pgl == Catalog::pageLayoutTwoColumnRight)
+							m_Doc->pdfOptions().PageLayout = PDFOptions::TwoColumnRight;
 					}
 					else
 					{

Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17849&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 Fri Nov  2 18:31:33 2012
@@ -542,14 +542,27 @@
 								handleActions(ite, ano);
 							}
 						}
-						else if (wtyp == 5) // Combobox
+						else if ((wtyp == 5) || (wtyp == 6)) // Combobox + Listbox
 						{
-							ite->annotation().addToFlag(131072);
-							handleActions(ite, ano);
-						}
-						else if (wtyp == 6) // Listbox
-						{
-							handleActions(ite, ano);
+							FormWidgetChoice *btn = (FormWidgetChoice*)fm;
+							if (btn)
+							{
+								if (wtyp == 5)
+									ite->annotation().addToFlag(131072);
+								int co = btn->getNumChoices();
+								if (co > 0)
+								{
+									QString inh = UnicodeParsedString(btn->getChoice(0));
+									for (int a = 1; a < co; a++)
+									{
+										inh += "\n" + UnicodeParsedString(btn->getChoice(a));
+									}
+									ite->itemText.insertChars(inh);
+								}
+								if (!btn->isReadOnly())
+									ite->annotation().addToFlag(262144);
+								handleActions(ite, ano);
+							}
 						}
 					}
 					break;




More information about the scribus-commit mailing list