r20246 by fschmid - Added possibility to build the "Pages" importer with libetonyek. Currently commented out as this importer is far from being as good as our own one.

scribus-commit scribus-commit at lists.scribus.net
Sun Jul 12 07:56:05 UTC 2015


Author: fschmid
Date: Sun Jul 12 07:56:04 2015
New Revision: 20246

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20246
Log:
Added possibility to build the "Pages" importer with libetonyek. Currently commented out as this importer is far from being as good as our own one.

Modified:
    trunk/Scribus/scribus/plugins/import/pages/CMakeLists.txt
    trunk/Scribus/scribus/plugins/import/pages/importpages.cpp
    trunk/Scribus/scribus/plugins/import/pages/importpages.h
    trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
    trunk/Scribus/scribus/plugins/import/revenge/rawpainter.h

Modified: trunk/Scribus/scribus/plugins/import/pages/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20246&path=/trunk/Scribus/scribus/plugins/import/pages/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pages/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/plugins/import/pages/CMakeLists.txt Sun Jul 12 07:56:04 2015
@@ -1,3 +1,20 @@
+#INCLUDE(FindPkgConfig)
+#IF (HAVE_REVENGE)
+#	pkg_check_modules(LIBETONYEK libetonyek-0.1)
+#	IF (LIBETONYEK_FOUND)
+#		MESSAGE("Building Pages Importer with librevenge")
+#		INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/scribus ${LIBREVENGE_INCLUDE_DIRS} ${LIBREVENGE_GENERATORS_INCLUDE_DIRS} ${LIBREVENGE_STREAM_INCLUDE_DIRS} ${LIBETONYEK_INCLUDE_DIRS})
+#		SET(IMPORTPAGES_PLUGIN_MOC_CLASSES importpages.h importpagesplugin.h)
+#		SET(IMPORTPAGES_PLUGIN_SOURCES ../revenge/rawpainter.cpp importpages.cpp importpagesplugin.cpp)
+#		SET(IMPORTPAGES_PLUGIN "importpages")
+#		QT5_WRAP_CPP(IMPORTPAGES_PLUGIN_MOC_SOURCES ${IMPORTPAGES_PLUGIN_MOC_CLASSES})
+#		ADD_LIBRARY(${IMPORTPAGES_PLUGIN} MODULE ${IMPORTPAGES_PLUGIN_SOURCES} ${IMPORTPAGES_PLUGIN_MOC_SOURCES})
+#		TARGET_LINK_LIBRARIES(${IMPORTPAGES_PLUGIN} ${PLUGIN_LIBRARIES} ${LIBREVENGE_LDFLAGS} ${LIBREVENGE_GENERATORS_LDFLAGS} ${LIBREVENGE_STREAM_LDFLAGS} ${LIBETONYEK_LDFLAGS})
+#		INSTALL(TARGETS ${IMPORTPAGES_PLUGIN} LIBRARY DESTINATION ${PLUGINDIR} PERMISSIONS ${PLUGIN_PERMISSIONS})
+#		ADD_DEPENDENCIES(${IMPORTPAGES_PLUGIN} ${EXE_NAME})
+#	ENDIF (LIBETONYEK_FOUND)
+#ENDIF (HAVE_REVENGE)
+
 INCLUDE_DIRECTORIES(
 	${CMAKE_SOURCE_DIR}
 	${CMAKE_SOURCE_DIR}/scribus
@@ -31,4 +48,3 @@
 
 ADD_DEPENDENCIES(${SCRIBUS_IMPORTPAGES_PLUGIN} ${EXE_NAME})
 
-# SET_TARGET_PROPERTIES(${SCRIBUS_FONTPREVIEW_PLUGIN} PROPERTIES VERSION "0.0.0")

Modified: trunk/Scribus/scribus/plugins/import/pages/importpages.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20246&path=/trunk/Scribus/scribus/plugins/import/pages/importpages.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pages/importpages.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pages/importpages.cpp Sun Jul 12 07:56:04 2015
@@ -10,6 +10,391 @@
 	copyright            : (C) 2013 by Franz Schmid
 	email                : Franz.Schmid at altmuehlnet.de
  ***************************************************************************/
+
+
+#if 0
+#include <QByteArray>
+#include <QCursor>
+#include <QDrag>
+#include <QFile>
+#include <QList>
+#include <QMessageBox>
+#include <QMimeData>
+#include <QRegExp>
+#include <QStack>
+#include <QDebug>
+
+#include <cstdlib>
+#include "importpages.h"
+#include "../revenge/rawpainter.h"
+#include <libetonyek/libetonyek.h>
+#include <boost/shared_ptr.hpp>
+
+#include "commonstrings.h"
+#include "ui/customfdialog.h"
+#include "fileloader.h"
+#include "loadsaveplugin.h"
+#include "ui/missing.h"
+#include "ui/multiprogressdialog.h"
+#include "pagesize.h"
+#include "prefscontext.h"
+#include "prefsfile.h"
+#include "prefsmanager.h"
+#include "prefstable.h"
+#include "ui/propertiespalette.h"
+#include "rawimage.h"
+#include "scclocale.h"
+#include "sccolorengine.h"
+#include "scconfig.h"
+#include "scmimedata.h"
+#include "scpaths.h"
+#include "scpattern.h"
+#include "scribus.h"
+#include "scribusXml.h"
+#include "scribuscore.h"
+#include "scribusview.h"
+#include "sctextstream.h"
+#include "selection.h"
+#include "undomanager.h"
+#include "util.h"
+#include "util_formats.h"
+#include "util_math.h"
+
+extern SCRIBUS_API ScribusQApp * ScQApp;
+
+PagesPlug::PagesPlug(ScribusDoc* doc, int flags)
+{
+	tmpSel=new Selection(this, false);
+	m_Doc=doc;
+	importerFlags = flags;
+	interactive = (flags & LoadSavePlugin::lfInteractive);
+	progressDialog = NULL;
+}
+
+QImage PagesPlug::readThumbnail(QString fName)
+{
+	QFileInfo fi = QFileInfo(fName);
+	double b, h;
+	b = PrefsManager::instance()->appPrefs.docSetupPrefs.pageWidth;
+	h = PrefsManager::instance()->appPrefs.docSetupPrefs.pageHeight;
+	docWidth = b;
+	docHeight = h;
+	progressDialog = NULL;
+	m_Doc = new ScribusDoc();
+	m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
+	m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
+	m_Doc->addPage(0);
+	m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
+	baseX = m_Doc->currentPage()->xOffset();
+	baseY = m_Doc->currentPage()->yOffset();
+	Elements.clear();
+	m_Doc->setLoading(true);
+	m_Doc->DoDrawing = false;
+	m_Doc->scMW()->setScriptRunning(true);
+	QString CurDirP = QDir::currentPath();
+	QDir::setCurrent(fi.path());
+	if (convert(fName))
+	{
+		tmpSel->clear();
+		QDir::setCurrent(CurDirP);
+		if (Elements.count() > 1)
+			m_Doc->groupObjectsList(Elements);
+		m_Doc->DoDrawing = true;
+		m_Doc->m_Selection->delaySignalsOn();
+		QImage tmpImage;
+		if (Elements.count() > 0)
+		{
+			for (int dre=0; dre<Elements.count(); ++dre)
+			{
+				tmpSel->addItem(Elements.at(dre), true);
+			}
+			tmpSel->setGroupRect();
+			double xs = tmpSel->width();
+			double ys = tmpSel->height();
+			tmpImage = Elements.at(0)->DrawObj_toImage(500);
+			tmpImage.setText("XSize", QString("%1").arg(xs));
+			tmpImage.setText("YSize", QString("%1").arg(ys));
+		}
+		m_Doc->scMW()->setScriptRunning(false);
+		m_Doc->setLoading(false);
+		m_Doc->m_Selection->delaySignalsOff();
+		delete m_Doc;
+		return tmpImage;
+	}
+	else
+	{
+		QDir::setCurrent(CurDirP);
+		m_Doc->DoDrawing = true;
+		m_Doc->scMW()->setScriptRunning(false);
+		delete m_Doc;
+	}
+	return QImage();
+}
+
+bool PagesPlug::import(QString fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress)
+{
+	QString fName = fNameIn;
+	bool success = false;
+	interactive = (flags & LoadSavePlugin::lfInteractive);
+	importerFlags = flags;
+	cancel = false;
+	double b, h;
+	bool ret = false;
+	QFileInfo fi = QFileInfo(fName);
+	if ( !ScCore->usingGUI() )
+	{
+		interactive = false;
+		showProgress = false;
+	}
+	if ( showProgress )
+	{
+		ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+		progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
+		QStringList barNames, barTexts;
+		barNames << "GI";
+		barTexts << tr("Analyzing File:");
+		QList<bool> barsNumeric;
+		barsNumeric << false;
+		progressDialog->addExtraProgressBars(barNames, barTexts, barsNumeric);
+		progressDialog->setOverallTotalSteps(3);
+		progressDialog->setOverallProgress(0);
+		progressDialog->setProgress("GI", 0);
+		progressDialog->show();
+		connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelRequested()));
+		qApp->processEvents();
+	}
+	else
+		progressDialog = NULL;
+/* Set default Page to size defined in Preferences */
+	b = 0.0;
+	h = 0.0;
+	if (progressDialog)
+	{
+		progressDialog->setOverallProgress(1);
+		qApp->processEvents();
+	}
+	if (b == 0.0)
+		b = PrefsManager::instance()->appPrefs.docSetupPrefs.pageWidth;
+	if (h == 0.0)
+		h = PrefsManager::instance()->appPrefs.docSetupPrefs.pageHeight;
+	docWidth = b;
+	docHeight = h;
+	baseX = 0;
+	baseY = 0;
+	if (!interactive || (flags & LoadSavePlugin::lfInsertPage))
+	{
+		m_Doc->setPage(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false);
+		m_Doc->addPage(0);
+		m_Doc->view()->addPage(0, true);
+		baseX = 0;
+		baseY = 0;
+	}
+	else
+	{
+		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
+		{
+			m_Doc=ScCore->primaryMainWindow()->doFileNew(docWidth, docHeight, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
+			ScCore->primaryMainWindow()->HaveNewDoc();
+			ret = true;
+			baseX = 0;
+			baseY = 0;
+			baseX = m_Doc->currentPage()->xOffset();
+			baseY = m_Doc->currentPage()->yOffset();
+		}
+	}
+	if ((!ret) && (interactive))
+	{
+		baseX = m_Doc->currentPage()->xOffset();
+		baseY = m_Doc->currentPage()->yOffset();
+	}
+	if ((ret) || (!interactive))
+	{
+		if (docWidth > docHeight)
+			m_Doc->setPageOrientation(1);
+		else
+			m_Doc->setPageOrientation(0);
+		m_Doc->setPageSize("Custom");
+	}
+	if ((!(flags & LoadSavePlugin::lfLoadAsPattern)) && (m_Doc->view() != NULL))
+		m_Doc->view()->Deselect();
+	Elements.clear();
+	m_Doc->setLoading(true);
+	m_Doc->DoDrawing = false;
+	if ((!(flags & LoadSavePlugin::lfLoadAsPattern)) && (m_Doc->view() != NULL))
+		m_Doc->view()->updatesOn(false);
+	m_Doc->scMW()->setScriptRunning(true);
+	qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
+	QString CurDirP = QDir::currentPath();
+	QDir::setCurrent(fi.path());
+	if (convert(fName))
+	{
+		tmpSel->clear();
+		QDir::setCurrent(CurDirP);
+		if ((Elements.count() > 1) && (!(importerFlags & LoadSavePlugin::lfCreateDoc)))
+			m_Doc->groupObjectsList(Elements);
+		m_Doc->DoDrawing = true;
+		m_Doc->scMW()->setScriptRunning(false);
+		m_Doc->setLoading(false);
+		qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+		if ((Elements.count() > 0) && (!ret) && (interactive))
+		{
+			if (flags & LoadSavePlugin::lfScripted)
+			{
+				bool loadF = m_Doc->isLoading();
+				m_Doc->setLoading(false);
+				m_Doc->changed();
+				m_Doc->setLoading(loadF);
+				if (!(flags & LoadSavePlugin::lfLoadAsPattern))
+				{
+					m_Doc->m_Selection->delaySignalsOn();
+					for (int dre=0; dre<Elements.count(); ++dre)
+					{
+						m_Doc->m_Selection->addItem(Elements.at(dre), true);
+					}
+					m_Doc->m_Selection->delaySignalsOff();
+					m_Doc->m_Selection->setGroupRect();
+					if (m_Doc->view() != NULL)
+						m_Doc->view()->updatesOn(true);
+				}
+			}
+			else
+			{
+				m_Doc->DragP = true;
+				m_Doc->DraggedElem = 0;
+				m_Doc->DragElements.clear();
+				m_Doc->m_Selection->delaySignalsOn();
+				for (int dre=0; dre<Elements.count(); ++dre)
+				{
+					tmpSel->addItem(Elements.at(dre), true);
+				}
+				tmpSel->setGroupRect();
+				ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSel);
+				m_Doc->itemSelection_DeleteItem(tmpSel);
+				m_Doc->view()->updatesOn(true);
+				if (importedPatterns.count() != 0)
+				{
+					for (int cd = 0; cd < importedPatterns.count(); cd++)
+					{
+						m_Doc->docPatterns.remove(importedPatterns[cd]);
+					}
+				}
+				if (importedColors.count() != 0)
+				{
+					for (int cd = 0; cd < importedColors.count(); cd++)
+					{
+						m_Doc->PageColors.remove(importedColors[cd]);
+					}
+				}
+				m_Doc->m_Selection->delaySignalsOff();
+				// We must copy the TransationSettings object as it is owned
+				// by handleObjectImport method afterwards
+				TransactionSettings* transacSettings = new TransactionSettings(trSettings);
+				m_Doc->view()->handleObjectImport(md, transacSettings);
+				m_Doc->DragP = false;
+				m_Doc->DraggedElem = 0;
+				m_Doc->DragElements.clear();
+			}
+		}
+		else
+		{
+			m_Doc->changed();
+			m_Doc->reformPages();
+			if (!(flags & LoadSavePlugin::lfLoadAsPattern))
+				m_Doc->view()->updatesOn(true);
+		}
+		success = true;
+	}
+	else
+	{
+		QDir::setCurrent(CurDirP);
+		m_Doc->DoDrawing = true;
+		m_Doc->scMW()->setScriptRunning(false);
+		m_Doc->view()->updatesOn(true);
+		qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+	}
+	if (interactive)
+		m_Doc->setLoading(false);
+	//CB If we have a gui we must refresh it if we have used the progressbar
+	if (!(flags & LoadSavePlugin::lfLoadAsPattern))
+	{
+		if ((showProgress) && (!interactive))
+			m_Doc->view()->DrawNew();
+	}
+	qApp->restoreOverrideCursor();
+	return success;
+}
+
+PagesPlug::~PagesPlug()
+{
+	if (progressDialog)
+		delete progressDialog;
+	delete tmpSel;
+}
+
+using boost::shared_ptr;
+using libetonyek::EtonyekDocument;
+
+bool PagesPlug::convert(QString fn)
+{
+	importedColors.clear();
+	importedPatterns.clear();
+	QFile file(fn);
+	if ( !file.exists() )
+	{
+		qDebug() << "File " << QFile::encodeName(fn).data() << " does not exist" << endl;
+		return false;
+	}
+	shared_ptr<librevenge::RVNGInputStream> input;
+	if (librevenge::RVNGDirectoryStream::isDirectory(QFile::encodeName(fn).data()))
+		input.reset(new librevenge::RVNGDirectoryStream(QFile::encodeName(fn).data()));
+	else
+	input.reset(new librevenge::RVNGFileStream(QFile::encodeName(fn).data()));
+	EtonyekDocument::Type type = EtonyekDocument::TYPE_UNKNOWN;
+	const EtonyekDocument::Confidence confidence = EtonyekDocument::isSupported(input.get(), &type);
+	if ((EtonyekDocument::CONFIDENCE_NONE == confidence) || (EtonyekDocument::TYPE_PAGES != type))
+	{
+		qDebug() << "ERROR: Unsupported file format!";
+		return false;
+	}
+	if (EtonyekDocument::CONFIDENCE_SUPPORTED_PART == confidence)
+	  input.reset(librevenge::RVNGDirectoryStream::createForParent(QFile::encodeName(fn).data()));
+	RawPainterPres painter(m_Doc, baseX, baseY, docWidth, docHeight, importerFlags, &Elements, &importedColors, &importedPatterns, tmpSel, "pages");
+	if (!EtonyekDocument::parse(input.get(), &painter))
+	{
+		qDebug() << "ERROR: Import failed!";
+		if (progressDialog)
+			progressDialog->close();
+		if (importerFlags & LoadSavePlugin::lfCreateDoc)
+		{
+			ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
+			qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+			QMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org"), 1, 0, 0);
+			qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
+		}
+		return false;
+	}
+	if (Elements.count() == 0)
+	{
+		if (importedColors.count() != 0)
+		{
+			for (int cd = 0; cd < importedColors.count(); cd++)
+			{
+				m_Doc->PageColors.remove(importedColors[cd]);
+			}
+		}
+		if (importedPatterns.count() != 0)
+		{
+			for (int cd = 0; cd < importedPatterns.count(); cd++)
+			{
+				m_Doc->docPatterns.remove(importedPatterns[cd]);
+			}
+		}
+	}
+	if (progressDialog)
+		progressDialog->close();
+	return true;
+}
+#else
 
 #include <QByteArray>
 #include <QCursor>
@@ -1867,3 +2252,4 @@
 		item->setDashes(pattern);
 	}*/
 }
+#endif

Modified: trunk/Scribus/scribus/plugins/import/pages/importpages.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20246&path=/trunk/Scribus/scribus/plugins/import/pages/importpages.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pages/importpages.h (original)
+++ trunk/Scribus/scribus/plugins/import/pages/importpages.h Sun Jul 12 07:56:04 2015
@@ -12,6 +12,80 @@
  ***************************************************************************/
 #ifndef IMPORTPAGES_H
 #define IMPORTPAGES_H
+
+#if 0
+
+#include <QObject>
+#include <QString>
+
+#include "pluginapi.h"
+#include "pageitem.h"
+#include "sccolor.h"
+#include "fpointarray.h"
+#include "vgradient.h"
+#include <QList>
+#include <QTransform>
+#include <QMultiMap>
+#include <QVector>
+
+class MultiProgressDialog;
+class ScribusDoc;
+class Selection;
+class TransactionSettings;
+
+//! \brief FH importer plugin
+class PagesPlug : public QObject
+{
+	Q_OBJECT
+
+public:
+	/*!
+	\author Franz Schmid
+	\date
+	\brief Create the Fh importer window.
+	\param fName QString
+	\param flags combination of loadFlags
+	\param showProgress if progress must be displayed
+	\retval EPSPlug plugin
+	*/
+	PagesPlug( ScribusDoc* doc, int flags );
+	~PagesPlug();
+
+	/*!
+	\author Franz Schmid
+	\date
+	\brief Perform import.
+	\param fn QString
+	\param trSettings undo transaction settings
+	\param flags combination of loadFlags
+	\param showProgress if progress must be displayed
+	\retval bool true if import was ok
+	 */
+	bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
+	QImage readThumbnail(QString fn);
+
+private:
+	bool convert(QString fn);
+
+	QList<PageItem*> Elements;
+	double baseX, baseY;
+	double docWidth;
+	double docHeight;
+
+	QStringList importedColors;
+	QStringList importedPatterns;
+
+	bool interactive;
+	MultiProgressDialog * progressDialog;
+	bool cancel;
+	ScribusDoc* m_Doc;
+	Selection* tmpSel;
+	int importerFlags;
+
+public slots:
+	void cancelRequested() { cancel = true; }
+};
+#else
 
 #include "pluginapi.h"
 #include "pageitem.h"
@@ -199,5 +273,5 @@
 public slots:
 	void cancelRequested() { cancel = true; }
 };
-
 #endif
+#endif

Modified: trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20246&path=/trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp Sun Jul 12 07:56:04 2015
@@ -52,6 +52,375 @@
 extern SCRIBUS_API ScribusQApp * ScQApp;
 
 #if HAVE_REVENGE
+
+RawPainterPres::RawPainterPres(ScribusDoc* Doc, double x, double y, double w, double h, int iflags, QList<PageItem*> *Elem, QStringList *iColors, QStringList *iPatterns, Selection* tSel, QString fTyp) : librevenge::RVNGRawTextGenerator(false)
+{
+	painter = new RawPainter(Doc, x, y, w, h, iflags, Elem, iColors, iPatterns, tSel, fTyp);
+	mElements = Elem;
+	mDoc = Doc;
+}
+
+RawPainterPres::~RawPainterPres()
+{
+	delete painter;
+}
+
+void RawPainterPres::startDocument(const librevenge::RVNGPropertyList &propList)
+{
+	painter->startDocument(propList);
+}
+
+void RawPainterPres::endDocument()
+{
+	painter->endDocument();
+	if (pageElements.count() > 1)
+	{
+		for (int a = 1; a < pageElements.count(); ++a)
+		{
+			if (a < mDoc->Pages->count())
+			{
+				double bX = mDoc->Pages->at(a)->xOffset();
+				double bY = mDoc->Pages->at(a)->yOffset();
+				for (int b = 0; b < pageElements[a].count(); ++b)
+				{
+					PageItem *item = pageElements[a][b];
+					item->setXYPos(item->xPos() + bX, item->yPos() + bY, true);
+					if (item->isGroup())
+						mDoc->GroupOnPage(item);
+					else
+						item->OwnPage = mDoc->OnPage(item);
+					item->setRedrawBounding();
+				}
+			}
+		}
+	}
+}
+
+void RawPainterPres::setDocumentMetaData(const librevenge::RVNGPropertyList &propList)
+{
+	painter->setDocumentMetaData(propList);
+}
+
+void RawPainterPres::defineEmbeddedFont(const librevenge::RVNGPropertyList &propList)
+{
+	painter->defineEmbeddedFont(propList);
+}
+
+void RawPainterPres::definePageStyle(const librevenge::RVNGPropertyList &propList)
+{
+}
+
+void RawPainterPres::openPageSpan(const librevenge::RVNGPropertyList &propList)
+{
+	painter->startPage(propList);
+}
+
+void RawPainterPres::closePageSpan()
+{
+	painter->endPage();
+}
+
+void RawPainterPres::openHeader(const librevenge::RVNGPropertyList &propList)
+{
+}
+
+void RawPainterPres::closeHeader()
+{
+}
+
+void RawPainterPres::openFooter(const librevenge::RVNGPropertyList &propList)
+{
+}
+
+void RawPainterPres::closeFooter()
+{
+}
+
+void RawPainterPres::defineParagraphStyle(const librevenge::RVNGPropertyList &propList)
+{
+	painter->defineParagraphStyle(propList);
+}
+
+void RawPainterPres::openParagraph(const librevenge::RVNGPropertyList &propList)
+{
+	painter->openParagraph(propList);
+}
+
+void RawPainterPres::closeParagraph()
+{
+	painter->closeParagraph();
+}
+
+void RawPainterPres::defineCharacterStyle(const librevenge::RVNGPropertyList &propList)
+{
+	painter->defineCharacterStyle(propList);
+}
+
+void RawPainterPres::openSpan(const librevenge::RVNGPropertyList &propList)
+{
+	painter->openSpan(propList);
+}
+
+void RawPainterPres::closeSpan()
+{
+	painter->closeSpan();
+}
+
+void RawPainterPres::openLink(const librevenge::RVNGPropertyList &propList)
+{
+	painter->openLink(propList);
+}
+
+void RawPainterPres::closeLink()
+{
+	painter->closeLink();
+}
+
+void RawPainterPres::defineSectionStyle(const librevenge::RVNGPropertyList &propList)
+{
+}
+
+void RawPainterPres::openSection(const librevenge::RVNGPropertyList &propList)
+{
+}
+
+void RawPainterPres::closeSection()
+{
+}
+
+void RawPainterPres::insertTab()
+{
+	painter->insertTab();
+}
+
+void RawPainterPres::insertSpace()
+{
+	painter->insertSpace();
+}
+
+void RawPainterPres::insertText(const librevenge::RVNGString &text)
+{
+	painter->insertText(text);
+}
+
+void RawPainterPres::insertLineBreak()
+{
+	painter->insertLineBreak();
+}
+
+void RawPainterPres::insertField(const librevenge::RVNGPropertyList &propList)
+{
+	painter->insertField(propList);
+}
+
+void RawPainterPres::openOrderedListLevel(const librevenge::RVNGPropertyList &propList)
+{
+	painter->openOrderedListLevel(propList);
+}
+
+void RawPainterPres::openUnorderedListLevel(const librevenge::RVNGPropertyList &propList)
+{
+	painter->openUnorderedListLevel(propList);
+}
+
+void RawPainterPres::closeOrderedListLevel()
+{
+	painter->closeOrderedListLevel();
+}
+
+void RawPainterPres::closeUnorderedListLevel()
+{
+	painter->closeUnorderedListLevel();
+}
+
+void RawPainterPres::openListElement(const librevenge::RVNGPropertyList &propList)
+{
+	painter->openListElement(propList);
+}
+
+void RawPainterPres::closeListElement()
+{
+	painter->closeListElement();
+}
+
+void RawPainterPres::openFootnote(const librevenge::RVNGPropertyList &propList)
+{
+}
+
+void RawPainterPres::closeFootnote()
+{
+}
+
+void RawPainterPres::openEndnote(const librevenge::RVNGPropertyList &propList)
+{
+}
+
+void RawPainterPres::closeEndnote()
+{
+}
+
+void RawPainterPres::openComment(const librevenge::RVNGPropertyList &propList)
+{
+}
+
+void RawPainterPres::closeComment()
+{
+}
+
+void RawPainterPres::openTextBox(const librevenge::RVNGPropertyList &propList)
+{
+	painter->startTextObject(propList);
+}
+
+void RawPainterPres::closeTextBox()
+{
+	painter->endTextObject();
+}
+
+void RawPainterPres::openTableRow(const librevenge::RVNGPropertyList &propList)
+{
+	painter->openTableRow(propList);
+}
+
+void RawPainterPres::closeTableRow()
+{
+	painter->closeTableRow();
+}
+
+void RawPainterPres::openTableCell(const librevenge::RVNGPropertyList &propList)
+{
+	painter->openTableCell(propList);
+}
+
+void RawPainterPres::closeTableCell()
+{
+	painter->closeTableCell();
+}
+
+void RawPainterPres::openTable(const librevenge::RVNGPropertyList &propList)
+{
+}
+
+void RawPainterPres::insertCoveredTableCell(const librevenge::RVNGPropertyList &propList)
+{
+}
+
+void RawPainterPres::closeTable()
+{
+}
+
+void RawPainterPres::openFrame(const librevenge::RVNGPropertyList &propList)
+{
+}
+
+void RawPainterPres::closeFrame()
+{
+}
+
+void RawPainterPres::openGroup(const librevenge::RVNGPropertyList &propList)
+{
+	painter->openGroup(propList);
+}
+
+void RawPainterPres::closeGroup()
+{
+	painter->closeGroup();
+}
+
+void RawPainterPres::defineGraphicStyle(const librevenge::RVNGPropertyList &propList)
+{
+	painter->setStyle(propList);
+}
+
+void RawPainterPres::drawRectangle(const librevenge::RVNGPropertyList &propList)
+{
+	painter->drawRectangle(propList);
+	if (propList["text:anchor-page-number"])
+	{
+		int pgNum = propList["text:anchor-page-number"]->getInt() - 1;
+		if (pgNum >= pageElements.count())
+		{
+			QList<PageItem*> tmpElements;
+			pageElements.append(tmpElements);
+		}
+		pageElements[pgNum].append(mElements->last());
+	}
+}
+
+void RawPainterPres::drawEllipse(const librevenge::RVNGPropertyList &propList)
+{
+	painter->drawEllipse(propList);
+	if (propList["text:anchor-page-number"])
+	{
+		int pgNum = propList["text:anchor-page-number"]->getInt() - 1;
+		if (pgNum >= pageElements.count())
+		{
+			QList<PageItem*> tmpElements;
+			pageElements.append(tmpElements);
+		}
+		pageElements[pgNum].append(mElements->last());
+	}
+}
+
+void RawPainterPres::drawPolygon(const librevenge::RVNGPropertyList &propList)
+{
+	painter->drawPolygon(propList);
+	if (propList["text:anchor-page-number"])
+	{
+		int pgNum = propList["text:anchor-page-number"]->getInt() - 1;
+		if (pgNum >= pageElements.count())
+		{
+			QList<PageItem*> tmpElements;
+			pageElements.append(tmpElements);
+		}
+		pageElements[pgNum].append(mElements->last());
+	}
+}
+
+void RawPainterPres::drawPolyline(const librevenge::RVNGPropertyList &propList)
+{
+	painter->drawPolyline(propList);
+	if (propList["text:anchor-page-number"])
+	{
+		int pgNum = propList["text:anchor-page-number"]->getInt() - 1;
+		if (pgNum >= pageElements.count())
+		{
+			QList<PageItem*> tmpElements;
+			pageElements.append(tmpElements);
+		}
+		pageElements[pgNum].append(mElements->last());
+	}
+}
+
+void RawPainterPres::drawPath(const librevenge::RVNGPropertyList &propList)
+{
+	painter->drawPath(propList);
+	if (propList["text:anchor-page-number"])
+	{
+		int pgNum = propList["text:anchor-page-number"]->getInt() - 1;
+		if (pgNum >= pageElements.count())
+		{
+			QList<PageItem*> tmpElements;
+			pageElements.append(tmpElements);
+		}
+		pageElements[pgNum].append(mElements->last());
+	}
+}
+
+void RawPainterPres::drawConnector(const librevenge::RVNGPropertyList &propList)
+{
+	painter->drawConnector(propList);
+}
+
+void RawPainterPres::insertBinaryObject(const librevenge::RVNGPropertyList &propList)
+{
+	painter->startEmbeddedGraphics(propList);
+}
+
+void RawPainterPres::insertEquation(const librevenge::RVNGPropertyList &propList)
+{
+}
+
 
 struct RawPainterPrivate
 {

Modified: trunk/Scribus/scribus/plugins/import/revenge/rawpainter.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20246&path=/trunk/Scribus/scribus/plugins/import/revenge/rawpainter.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/revenge/rawpainter.h (original)
+++ trunk/Scribus/scribus/plugins/import/revenge/rawpainter.h Sun Jul 12 07:56:04 2015
@@ -161,6 +161,79 @@
 	QString fileType;
 };
 
+class RawPainterPres : public librevenge::RVNGRawTextGenerator
+{
+public:
+	RawPainterPres(ScribusDoc* Doc, double x, double y, double w, double h, int iflags, QList<PageItem*> *Elem, QStringList *iColors, QStringList *iPatterns, Selection* tSel, QString fTyp);
+	~RawPainterPres();
+	void startDocument(const librevenge::RVNGPropertyList &propList);
+	void endDocument();
+	void setDocumentMetaData(const librevenge::RVNGPropertyList &propList);
+	void defineEmbeddedFont(const librevenge::RVNGPropertyList &propList);
+	void definePageStyle(const librevenge::RVNGPropertyList &propList);
+	void openPageSpan(const librevenge::RVNGPropertyList &propList);
+	void closePageSpan();
+	void openHeader(const librevenge::RVNGPropertyList &propList);
+	void closeHeader();
+	void openFooter(const librevenge::RVNGPropertyList &propList);
+	void closeFooter();
+	void defineParagraphStyle(const librevenge::RVNGPropertyList &propList);
+	void openParagraph(const librevenge::RVNGPropertyList &propList);
+	void closeParagraph();
+	void defineCharacterStyle(const librevenge::RVNGPropertyList &propList);
+	void openSpan(const librevenge::RVNGPropertyList &propList);
+	void closeSpan();
+	void openLink(const librevenge::RVNGPropertyList &propList);
+	void closeLink();
+	void defineSectionStyle(const librevenge::RVNGPropertyList &propList);
+	void openSection(const librevenge::RVNGPropertyList &propList);
+	void closeSection();
+	void insertTab();
+	void insertSpace();
+	void insertText(const librevenge::RVNGString &text);
+	void insertLineBreak();
+	void insertField(const librevenge::RVNGPropertyList &propList);
+	void openOrderedListLevel(const librevenge::RVNGPropertyList &propList);
+	void openUnorderedListLevel(const librevenge::RVNGPropertyList &propList);
+	void closeOrderedListLevel();
+	void closeUnorderedListLevel();
+	void openListElement(const librevenge::RVNGPropertyList &propList);
+	void closeListElement();
+	void openFootnote(const librevenge::RVNGPropertyList &propList);
+	void closeFootnote();
+	void openEndnote(const librevenge::RVNGPropertyList &propList);
+	void closeEndnote();
+	void openComment(const librevenge::RVNGPropertyList &propList);
+	void closeComment();
+	void openTextBox(const librevenge::RVNGPropertyList &propList);
+	void closeTextBox();
+	void openTable(const librevenge::RVNGPropertyList &propList);
+	void openTableRow(const librevenge::RVNGPropertyList &propList);
+	void closeTableRow();
+	void openTableCell(const librevenge::RVNGPropertyList &propList);
+	void closeTableCell();
+	void insertCoveredTableCell(const librevenge::RVNGPropertyList &propList);
+	void closeTable();
+	void openFrame(const librevenge::RVNGPropertyList &propList);
+	void closeFrame();
+	void openGroup(const librevenge::RVNGPropertyList &propList);
+	void closeGroup();
+	void defineGraphicStyle(const librevenge::RVNGPropertyList &propList);
+	void drawRectangle(const librevenge::RVNGPropertyList &propList);
+	void drawEllipse(const librevenge::RVNGPropertyList &propList);
+	void drawPolygon(const librevenge::RVNGPropertyList &propList);
+	void drawPolyline(const librevenge::RVNGPropertyList &propList);
+	void drawPath(const librevenge::RVNGPropertyList &propList);
+	void drawConnector(const librevenge::RVNGPropertyList &propList);
+	void insertBinaryObject(const librevenge::RVNGPropertyList &propList);
+	void insertEquation(const librevenge::RVNGPropertyList &propList);
+private:
+	QList<PageItem*> *mElements;
+	RawPainter *painter;
+	QList<QList<PageItem*> > pageElements;
+	ScribusDoc* mDoc;
+};
+
 #else
 	#include <libwpd-stream/libwpd-stream.h>
 	#include <libwpd/libwpd.h>




More information about the scribus-commit mailing list