r19235 by fschmid - Bug #12327: Update the relevant plug-in interfaces and the plug-ins to use librevenge

scribus-commit scribus-commit at lists.scribus.net
Sun Jun 15 09:41:06 UTC 2014


Author: fschmid
Date: Sun Jun 15 09:41:06 2014
New Revision: 19235

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19235
Log:
Bug #12327: Update the relevant plug-in interfaces and the plug-ins to use librevenge
Part 2: ported the MS Visio import plugin
Make all the plugins using Document liberation libs using one unified importer class.

Added:
    trunk/Scribus/scribus/plugins/import/revenge/
    trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
    trunk/Scribus/scribus/plugins/import/revenge/rawpainter.h
Modified:
    trunk/Scribus/scribus/plugins/import/pub/CMakeLists.txt
    trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
    trunk/Scribus/scribus/plugins/import/pub/importpub.h
    trunk/Scribus/scribus/plugins/import/vsd/CMakeLists.txt
    trunk/Scribus/scribus/plugins/import/vsd/importvsd.cpp
    trunk/Scribus/scribus/plugins/import/vsd/importvsd.h

Modified: trunk/Scribus/scribus/plugins/import/pub/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19235&path=/trunk/Scribus/scribus/plugins/import/pub/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pub/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/plugins/import/pub/CMakeLists.txt Sun Jun 15 09:41:06 2014
@@ -5,7 +5,7 @@
 		MESSAGE("Building MS-Publisher Importer with librevenge")
 		INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/scribus ${LIBREVENGE_INCLUDE_DIRS} ${LIBREVENGE_GENERATORS_INCLUDE_DIRS} ${LIBREVENGE_STREAM_INCLUDE_DIRS} ${LIBMSPUB_INCLUDE_DIRS})
 		SET(IMPORTPUB_PLUGIN_MOC_CLASSES importpub.h importpubplugin.h)
-		SET(IMPORTPUB_PLUGIN_SOURCES importpub.cpp importpubplugin.cpp)
+		SET(IMPORTPUB_PLUGIN_SOURCES ../revenge/rawpainter.cpp importpub.cpp importpubplugin.cpp)
 		SET(SCRIBUS_IMPORTPUB_PLUGIN "importpub")
 		QT5_WRAP_CPP(IMPORTPUB_PLUGIN_MOC_SOURCES ${IMPORTPUB_PLUGIN_MOC_CLASSES})
 		ADD_LIBRARY(${SCRIBUS_IMPORTPUB_PLUGIN} MODULE ${IMPORTPUB_PLUGIN_SOURCES} ${IMPORTPUB_PLUGIN_MOC_SOURCES})
@@ -25,7 +25,7 @@
 					MESSAGE("Building MS-Publisher Importer without librevenge")
 					INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/scribus ${LIBWPG_INCLUDE_DIRS} ${LIBWPD_INCLUDE_DIRS} ${LIBWPD_STREAM_INCLUDE_DIRS} ${LIBMSPUB_INCLUDE_DIRS})
 					SET(IMPORTPUB_PLUGIN_MOC_CLASSES importpub.h importpubplugin.h)
-					SET(IMPORTPUB_PLUGIN_SOURCES importpub.cpp importpubplugin.cpp)
+					SET(IMPORTPUB_PLUGIN_SOURCES ../revenge/rawpainter.cpp importpub.cpp importpubplugin.cpp)
 					SET(SCRIBUS_IMPORTPUB_PLUGIN "importpub")
 					QT5_WRAP_CPP(IMPORTPUB_PLUGIN_MOC_SOURCES ${IMPORTPUB_PLUGIN_MOC_CLASSES})
 					ADD_LIBRARY(${SCRIBUS_IMPORTPUB_PLUGIN} MODULE ${IMPORTPUB_PLUGIN_SOURCES} ${IMPORTPUB_PLUGIN_MOC_SOURCES})

Modified: trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19235&path=/trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pub/importpub.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pub/importpub.cpp Sun Jun 15 09:41:06 2014
@@ -19,8 +19,9 @@
 #include <cstdlib>
 
 #include "importpub.h"
-
-#include "color.h"
+#include "../revenge/rawpainter.h"
+#include <libmspub/libmspub.h>
+
 #include "commonstrings.h"
 #include "fileloader.h"
 #include "loadsaveplugin.h"
@@ -55,2901 +56,6 @@
 
 
 extern SCRIBUS_API ScribusQApp * ScQApp;
-
-#if HAVE_REVENGE
-
-struct RawPainterPrivate
-{
-	RawPainterPrivate();
-};
-
-RawPainterPrivate::RawPainterPrivate()
-{
-}
-
-RawPainter::RawPainter(ScribusDoc* Doc, double x, double y, double w, double h, int iflags, QList<PageItem*> *Elem, QStringList *iColors, QStringList *iPatterns, Selection* tSel) : m_pImpl(new RawPainterPrivate())
-{
-	m_Doc = Doc;
-	baseX = x;
-	baseY = y;
-	docWidth = w;
-	docHeight = h;
-	importerFlags = iflags;
-	Elements = Elem;
-	importedColors = iColors;
-	importedPatterns = iPatterns;
-	tmpSel = tSel;
-	doProcessing = true;
-	CurrColorFill = "Black";
-	CurrFillShade = 100.0;
-	CurrColorStroke = "Black";
-	CurrStrokeShade = 100.0;
-	CurrStrokeTrans = 0.0;
-	CurrFillTrans = 0.0;
-	Coords.resize(0);
-	Coords.svgInit();
-	LineW = 1.0;
-	lineJoin = Qt::MiterJoin;
-	lineEnd = Qt::FlatCap;
-	fillrule = true;
-	gradientAngle = 0.0;
-	isGradient = false;
-	lineSpSet = false;
-	currentGradient = VGradient(VGradient::linear);
-	currentGradient.clearStops();
-	currentGradient.setRepeatMethod( VGradient::none );
-	dashArray.clear();
-	firstPage = true;
-	actPage = 0;
-	actTextItem = NULL;
-}
-
-RawPainter::~RawPainter()
-{
-	delete m_pImpl;
-}
-
-void RawPainter::startDocument(const librevenge::RVNGPropertyList &propList)
-{
-}
-
-void RawPainter::endDocument()
-{
-}
-
-void RawPainter::setDocumentMetaData(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "setDocumentMetaData";
-}
-
-void RawPainter::defineEmbeddedFont(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "defineEmbeddedFont";
-}
-
-void RawPainter::startPage(const librevenge::RVNGPropertyList &propList)
-{
-	if (propList["svg:width"])
-		docWidth = valueAsPoint(propList["svg:width"]);
-	if (propList["svg:height"])
-		docHeight = valueAsPoint(propList["svg:height"]);
-	if (importerFlags & LoadSavePlugin::lfCreateDoc)
-	{
-		if (!firstPage)
-		{
-			m_Doc->addPage(actPage);
-			m_Doc->setActiveLayer(baseLayer);
-		}
-		else
-			baseLayer = m_Doc->activeLayerName();
-		m_Doc->setPageSize("Custom");
-		m_Doc->currentPage()->setInitialWidth(docWidth);
-		m_Doc->currentPage()->setInitialHeight(docHeight);
-		m_Doc->currentPage()->setWidth(docWidth);
-		m_Doc->currentPage()->setHeight(docHeight);
-		m_Doc->currentPage()->MPageNam = CommonStrings::trMasterPageNormal;
-		m_Doc->currentPage()->m_pageSize = "Custom";
-		m_Doc->reformPages(true);
-		baseX = m_Doc->currentPage()->xOffset();
-		baseY = m_Doc->currentPage()->yOffset();
-	}
-	firstPage = false;
-	actPage++;
-}
-
-void RawPainter::endPage()
-{
-	if (importerFlags & LoadSavePlugin::lfCreateThumbnail)
-		doProcessing = false;
-}
-
-void RawPainter::startMasterPage(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "startMasterPage";
-}
-
-void RawPainter::endMasterPage()
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "endMasterPage";
-}
-
-void RawPainter::startLayer(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	FPointArray clip;
-	if (propList["svg:clip-path"])
-	{
-		QString svgString = QString(propList["svg:clip-path"]->getStr().cstr());
-		clip.resize(0);
-		clip.svgInit();
-		svgString.replace(",", ".");
-		clip.parseSVG(svgString);
-		QTransform m;
-		m.scale(72.0, 72.0);
-		clip.map(m);
-	}
-	QList<PageItem*> gElements;
-	groupEntry gr;
-	gr.clip = clip.copy();
-	gr.Items = gElements;
-	groupStack.push(gr);
-}
-
-void RawPainter::endLayer()
-{
-	if (!doProcessing)
-		return;
-	if (groupStack.count() != 0)
-	{
-		PageItem *ite;
-		groupEntry gr = groupStack.pop();
-		QList<PageItem*> gElements = gr.Items;
-		tmpSel->clear();
-		if (gElements.count() > 0)
-		{
-			bool groupClip = true;
-			for (int dre = 0; dre < gElements.count(); ++dre)
-			{
-				tmpSel->addItem(gElements.at(dre), true);
-				Elements->removeAll(gElements.at(dre));
-				if (gElements.at(dre)->hasSoftShadow())
-					groupClip = false;
-			}
-			ite = m_Doc->groupObjectsSelection(tmpSel);
-			ite->setGroupClipping(groupClip);
-			ite->setTextFlowMode(PageItem::TextFlowUsesBoundingBox);
-			if (!gr.clip.isEmpty())
-			{
-				double oldX = ite->xPos();
-				double oldY = ite->yPos();
-				double oldW = ite->width();
-				double oldH = ite->height();
-				double oldgW = ite->groupWidth;
-				double oldgH = ite->groupHeight;
-				ite->PoLine = gr.clip.copy();
-				ite->PoLine.translate(baseX, baseY);
-				FPoint xy = getMinClipF(&ite->PoLine);
-				ite->setXYPos(xy.x(), xy.y(), true);
-				ite->PoLine.translate(-xy.x(), -xy.y());
-				FPoint wh = getMaxClipF(&ite->PoLine);
-				ite->setWidthHeight(wh.x(),wh.y());
-				ite->groupWidth = oldgW * (ite->width() / oldW);
-				ite->groupHeight = oldgH * (ite->height() / oldH);
-				double dx = (ite->xPos() - oldX) / (ite->width() / ite->groupWidth);
-				double dy = (ite->yPos() - oldY) / (ite->height() / ite->groupHeight);
-				for (int em = 0; em < ite->groupItemList.count(); ++em)
-				{
-					PageItem* embedded = ite->groupItemList.at(em);
-					embedded->moveBy(-dx, -dy, true);
-					m_Doc->setRedrawBounding(embedded);
-					embedded->OwnPage = m_Doc->OnPage(embedded);
-				}
-				ite->ClipEdited = true;
-				ite->OldB2 = ite->width();
-				ite->OldH2 = ite->height();
-				ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
-				ite->updateGradientVectors();
-			}
-			Elements->append(ite);
-			if (groupStack.count() != 0)
-				groupStack.top().Items.append(ite);
-		}
-		tmpSel->clear();
-	}
-}
-
-void RawPainter::startEmbeddedGraphics(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "startEmbeddedGraphics";
-}
-
-void RawPainter::endEmbeddedGraphics()
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "endEmbeddedGraphics";
-}
-
-void RawPainter::openGroup(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "openGroup";
-}
-
-void RawPainter::closeGroup()
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "closeGroup";
-}
-
-void RawPainter::setStyle(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	m_style.clear();
-	m_style = propList;
-	isGradient = false;
-	if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "none")
-		CurrColorFill = CommonStrings::None;
-	else if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "solid")
-	{
-		if (propList["draw:fill-color"])
-		{
-			CurrColorFill = parseColor(QString(propList["draw:fill-color"]->getStr().cstr()));
-			if(propList["draw:opacity"])
-				CurrFillTrans = 1.0 - qMin(1.0, qMax(fromPercentage(QString(propList["draw:opacity"]->getStr().cstr())), 0.0));
-		}
-	}
-	if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "gradient")
-	{
-		double angle = 0;
-		if (propList["draw:angle"])
-			angle = propList["draw:angle"]->getDouble();
-		double opacity = 1.0;
-		librevenge::RVNGPropertyListVector gradient;
-		if (propList.child("svg:linearGradient"))
-		{
-			currentGradient = VGradient(VGradient::linear);
-			gradient = *propList.child("svg:linearGradient");
-		}
-		else if (propList.child("svg:radialGradient"))
-		{
-			currentGradient = VGradient(VGradient::radial);
-			gradient = *propList.child("svg:radialGradient");
-		}
-		if (gradient.count() > 1)
-		{
-			currentGradient.clearStops();
-			currentGradient.setRepeatMethod( VGradient::pad );
-			double dr = 1.0 / static_cast<double>(gradient.count());
-			for (unsigned c = 0; c < gradient.count(); c++)
-			{
-				librevenge::RVNGPropertyList grad = gradient[c];
-				if (grad["svg:stop-color"])
-				{
-					QString stopName = parseColor(QString(grad["svg:stop-color"]->getStr().cstr()));
-					double rampPoint = dr * c;
-					if(grad["svg:offset"])
-						rampPoint = fromPercentage(QString(grad["svg:offset"]->getStr().cstr()));
-					const ScColor& gradC = m_Doc->PageColors[stopName];
-					if(grad["svg:stop-opacity"])
-						opacity = qMin(1.0, qMax(fromPercentage(QString(grad["svg:stop-opacity"]->getStr().cstr())), 0.0));
-					currentGradient.addStop( ScColorEngine::getRGBColor(gradC, m_Doc), rampPoint, 0.5, opacity, stopName, 100 );
-					if (c == 0)
-					{
-						gradColor1Str = stopName;
-						gradColor1 = ScColorEngine::getRGBColor(gradC, m_Doc);
-						gradColor1Trans = opacity;
-					}
-					else
-					{
-						gradColor2Str = stopName;
-						gradColor2 = ScColorEngine::getRGBColor(gradC, m_Doc);
-						gradColor2Trans = opacity;
-					}
-				}
-			}
-			if (currentGradient.Stops() > 1)
-				isGradient = true;
-		}
-	}
-	if(propList["svg:fill-rule"])
-	{
-		if (QString(propList["svg:fill-rule"]->getStr().cstr()) == "nonzero")
-			fillrule = false;
-		else
-			fillrule = true;
-	}
-	if (propList["svg:stroke-width"])
-		LineW = valueAsPoint(propList["svg:stroke-width"]);
-	if (propList["draw:stroke"])
-	{
-		if (propList["draw:stroke"]->getStr() == "none")
-			CurrColorStroke = CommonStrings::None;
-		else if ((propList["draw:stroke"]->getStr() == "solid") || (propList["draw:stroke"]->getStr() == "dash"))
-		{
-			if (propList["svg:stroke-color"])
-			{
-				CurrColorStroke = parseColor(QString(propList["svg:stroke-color"]->getStr().cstr()));
-				if(propList["svg:stroke-opacity"])
-					CurrStrokeTrans = 1.0 - qMin(1.0, qMax(fromPercentage(QString(propList["svg:stroke-opacity"]->getStr().cstr())), 0.0));
-			}
-			if (propList["draw:stroke"]->getStr() == "dash")
-			{
-				dashArray.clear();
-				double gap = LineW;
-				if (propList["draw:distance"])
-					gap = valueAsPoint(propList["draw:distance"]);
-				int dots1 = 0;
-				if (propList["draw:dots1"])
-					dots1 = propList["draw:dots1"]->getInt();
-				double dots1len = LineW;
-				if (propList["draw:dots1-length"])
-					dots1len = valueAsPoint(propList["draw:dots1-length"]);
-				int dots2 = 0;
-				if (propList["draw:dots2"])
-					dots2 = propList["draw:dots2"]->getInt();
-				double dots2len = LineW;
-				if (propList["draw:dots2-length"])
-					dots2len = valueAsPoint(propList["draw:dots2-length"]);
-				for (int i = 0; i < dots1; i++)
-				{
-					dashArray << qMax(dots1len, 0.1) << qMax(gap, 0.1);
-				}
-				for (int j = 0; j < dots2; j++)
-				{
-					dashArray << qMax(dots2len, 0.1) << qMax(gap, 0.1);
-				}
-			}
-			else
-				dashArray.clear();
-		}
-	}
-	if (propList["svg:stroke-linecap"])
-	{
-		QString params = QString(propList["svg:stroke-linecap"]->getStr().cstr());
-		if( params == "butt" )
-			lineEnd = Qt::FlatCap;
-		else if( params == "round" )
-			lineEnd = Qt::RoundCap;
-		else if( params == "square" )
-			lineEnd = Qt::SquareCap;
-		else
-			lineEnd = Qt::FlatCap;
-	}
-	if (propList["svg:stroke-linejoin"])
-	{
-		QString params = QString(propList["svg:stroke-linejoin"]->getStr().cstr());
-		if( params == "miter" )
-			lineJoin = Qt::MiterJoin;
-		else if( params == "round" )
-			lineJoin = Qt::RoundJoin;
-		else if( params == "bevel" )
-			lineJoin = Qt::BevelJoin;
-		else
-			lineJoin = Qt::MiterJoin;
-	}
-}
-
-void RawPainter::drawRectangle(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
-	{
-		double x = valueAsPoint(propList["svg:x"]);
-		double y = valueAsPoint(propList["svg:y"]);
-		double w = valueAsPoint(propList["svg:width"]);
-		double h = valueAsPoint(propList["svg:height"]);
-		int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX + x, baseY + y, w, h, LineW, CurrColorFill, CurrColorStroke, true);
-		PageItem *ite = m_Doc->Items->at(z);
-		finishItem(ite);
-		applyFill(ite);
-		if (CurrColorFill != CommonStrings::None)
-			applyShadow(ite);
-	}
-}
-
-void RawPainter::drawEllipse(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
-	{
-		double x = valueAsPoint(propList["svg:x"]);
-		double y = valueAsPoint(propList["svg:y"]);
-		double w = valueAsPoint(propList["svg:width"]);
-		double h = valueAsPoint(propList["svg:height"]);
-		int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Ellipse, baseX + x, baseY + y, w, h, LineW, CurrColorFill, CurrColorStroke, true);
-		PageItem *ite = m_Doc->Items->at(z);
-		finishItem(ite);
-		applyFill(ite);
-		if (CurrColorFill != CommonStrings::None)
-			applyShadow(ite);
-	}
-}
-
-void RawPainter::drawPolyline(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	librevenge::RVNGPropertyListVector vertices = *propList.child("svg:points");
-	if(vertices.count() < 2)
-		return;
-	Coords.resize(0);
-	Coords.svgInit();
-	PageItem *ite;
-	Coords.svgMoveTo(valueAsPoint(vertices[0]["svg:x"]), valueAsPoint(vertices[0]["svg:y"]));
-	for(unsigned i = 1; i < vertices.count(); i++)
-	{
-		Coords.svgLineTo(valueAsPoint(vertices[i]["svg:x"]), valueAsPoint(vertices[i]["svg:y"]));
-	}
-	if (Coords.size() > 0)
-	{
-		int z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CommonStrings::None, CurrColorStroke, true);
-		ite = m_Doc->Items->at(z);
-		ite->PoLine = Coords.copy();
-		finishItem(ite);
-	}
-}
-
-void RawPainter::drawPolygon(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	librevenge::RVNGPropertyListVector vertices = *propList.child("svg:points");
-	if(vertices.count() < 2)
-		return;
-	Coords.resize(0);
-	Coords.svgInit();
-	PageItem *ite;
-	int z;
-	Coords.svgMoveTo(valueAsPoint(vertices[0]["svg:x"]), valueAsPoint(vertices[0]["svg:y"]));
-	for(unsigned i = 1; i < vertices.count(); i++)
-	{
-		Coords.svgLineTo(valueAsPoint(vertices[i]["svg:x"]), valueAsPoint(vertices[i]["svg:y"]));
-	}
-	Coords.svgClosePath();
-	if (Coords.size() > 0)
-	{
-		if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "bitmap" && m_style["style:repeat"] && m_style["style:repeat"]->getStr() == "stretch")
-		{
-		  if (m_style["draw:fill-image"] && m_style["librevenge:mime-type"])
-		  {
-			  QByteArray ba(m_style["draw:fill-image"]->getStr().cstr());
-			  QByteArray imageData = QByteArray::fromBase64(ba);
-			  QString imgExt = "";
-			  if (m_style["librevenge:mime-type"]->getStr() == "image/png")
-				  imgExt = "png";
-			  else if (m_style["librevenge:mime-type"]->getStr() == "image/jpeg")
-				  imgExt = "jpg";
-			  else if (m_style["librevenge:mime-type"]->getStr() == "image/bmp")
-				  imgExt = "bmp";
-			  else if (m_style["librevenge:mime-type"]->getStr() == "image/pict")
-				  imgExt = "pict";
-			  else if (m_style["librevenge:mime-type"]->getStr() == "image/tiff")
-				  imgExt = "tif";
-			  if (!imgExt.isEmpty())
-			  {
-				  z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColorFill, CurrColorStroke, true);
-				  ite = m_Doc->Items->at(z);
-				  ite->PoLine = Coords.copy();
-				  finishItem(ite);
-				  insertImage(ite, imgExt, imageData);
-			  }
-			  else if (m_style["librevenge:mime-type"]->getStr() == "image/wmf")
-			  {
-				  imgExt = "wmf";
-				  QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_pub_XXXXXX." + imgExt);
-				  if (tempFile->open())
-				  {
-					  tempFile->write(imageData);
-					  QString fileName = getLongPathName(tempFile->fileName());
-					  tempFile->close();
-					  FileLoader *fileLoader = new FileLoader(fileName);
-					  int testResult = fileLoader->testFile();
-					  delete fileLoader;
-					  if (testResult != -1)
-					  {
-						  const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
-						  if( fmt )
-						  {
-							  fmt->setupTargets(m_Doc, 0, 0, 0, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
-							  fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
-							  if (m_Doc->m_Selection->count() > 0)
-							  {
-								  ite = m_Doc->groupObjectsSelection();
-								  double rot = 0;
-								  if (m_style["librevenge:rotate"])
-									  rot = m_style["librevenge:rotate"]->getDouble();
-								  QPainterPath ba = Coords.toQPainterPath(true);
-								  QRectF baR = ba.boundingRect();
-								  if (rot != 0)
-								  {
-									  QTransform mm;
-									  mm.translate(baR.x(), baR.y());
-									  mm.translate(baR.width() / 2.0, baR.height() / 2.0);
-									  mm.rotate(rot);
-									  mm.translate(-baR.width() / 2.0, -baR.height() / 2.0);
-									  mm.translate(-baR.x(), -baR.y());
-									  ba = mm.map(ba);
-									  baR = ba.boundingRect();
-									  ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
-									  ite->setWidthHeight(baR.width(), baR.height(), true);
-									  Coords.fromQPainterPath(ba, true);
-									  FPoint tp2(getMinClipF(&Coords));
-									  Coords.translate(-tp2.x(), -tp2.y());
-									  ite->PoLine = Coords.copy();
-									  int rm = m_Doc->RotMode();
-									  m_Doc->RotMode(2);
-									  m_Doc->RotateItem(-rot, ite);
-									  m_Doc->RotMode(rm);
-								  }
-								  else
-								  {
-									  ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
-									  ite->setWidthHeight(baR.width(), baR.height(), true);
-									  FPoint tp2(getMinClipF(&Coords));
-									  Coords.translate(-tp2.x(), -tp2.y());
-									  ite->PoLine = Coords.copy();
-								  }
-								  finishItem(ite);
-								  if (m_style["draw:red"] && m_style["draw:green"] && m_style["draw:blue"])
-								  {
-									  int r = qRound(m_style["draw:red"]->getDouble() * 255);
-									  int g = qRound(m_style["draw:green"]->getDouble() * 255);
-									  int b = qRound(m_style["draw:blue"]->getDouble() * 255);
-									  QString colVal = QString("#%1%2%3").arg(r, 2, 16, QLatin1Char('0')).arg(g, 2, 16, QLatin1Char('0')).arg(b, 2, 16, QLatin1Char('0'));
-									  QString efVal = parseColor(colVal);
-									  recolorItem(ite, efVal);
-								  }
-							  }
-						  }
-					  }
-				  }
-				  delete tempFile;
-			  }
-		  }
-		}
-		else
-		{
-			z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColorFill, CurrColorStroke, true);
-			ite = m_Doc->Items->at(z);
-			ite->PoLine = Coords.copy();
-			finishItem(ite);
-			applyFill(ite);
-		}
-		applyFlip(ite);
-		if (CurrColorFill != CommonStrings::None)
-			applyShadow(ite);
-	}
-}
-
-void RawPainter::drawPath(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	librevenge::RVNGPropertyListVector path = *propList.child("svg:d");
-	bool isClosed = false;
-	QString svgString = "";
-	for(unsigned i=0; i < path.count(); i++)
-	{
-		librevenge::RVNGPropertyList pList = path[i];
-		if (pList["librevenge:path-action"] && pList["librevenge:path-action"]->getStr() == "M")
-			svgString += QString("M %1 %2 ").arg(valueAsPoint(pList["svg:x"])).arg(valueAsPoint(pList["svg:y"]));
-		else if (pList["librevenge:path-action"] && pList["librevenge:path-action"]->getStr() == "L")
-			svgString += QString("L %1 %2 ").arg(valueAsPoint(pList["svg:x"])).arg(valueAsPoint(pList["svg:y"]));
-		else if (pList["librevenge:path-action"] && pList["librevenge:path-action"]->getStr() == "C")
-			svgString += QString("C %1 %2 %3 %4 %5 %6 ").arg(valueAsPoint(pList["svg:x1"])).arg(valueAsPoint(pList["svg:y1"])).arg(valueAsPoint(pList["svg:x2"])).arg(valueAsPoint(pList["svg:y2"])).arg(valueAsPoint(pList["svg:x"])).arg(valueAsPoint(pList["svg:y"]));
-		else if (propList["librevenge:path-action"] && propList["librevenge:path-action"]->getStr() == "Q")
-			svgString += QString("Q %1 %2 %3 %4 ").arg(valueAsPoint(pList["svg:x1"])).arg(valueAsPoint(pList["svg:y1"])).arg(valueAsPoint(pList["svg:x"])).arg(valueAsPoint(pList["svg:y"]));
-		else if (pList["librevenge:path-action"] && pList["librevenge:path-action"]->getStr() == "A")
-			svgString += QString("A %1 %2 %3 %4 %5 %6 %7") .arg(valueAsPoint(pList["svg:rx"])) .arg(valueAsPoint(pList["svg:ry"])).arg(pList["librevenge:rotate"] ? pList["librevenge:rotate"]->getDouble() : 0).arg(pList["librevenge:large-arc"] ? pList["librevenge:large-arc"]->getInt() : 1).arg(pList["librevenge:sweep"] ? pList["librevenge:sweep"]->getInt() : 1).arg(valueAsPoint(pList["svg:x"])).arg(valueAsPoint(pList["svg:y"]));
-		else if ((i >= path.count()-1 && i > 2) && pList["librevenge:path-action"] && pList["librevenge:path-action"]->getStr() == "Z" )
-		{
-			isClosed = true;
-			svgString += "Z";
-		}
-	}
-	Coords.resize(0);
-	Coords.svgInit();
-	Coords.parseSVG(svgString);
-	PageItem *ite;
-	int z;
-	if (isClosed)
-	{
-		if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "bitmap" && m_style["style:repeat"] && m_style["style:repeat"]->getStr() == "stretch")
-		{
-		  if (m_style["draw:fill-image"] && m_style["librevenge:mime-type"])
-		  {
-			  QByteArray ba(m_style["draw:fill-image"]->getStr().cstr());
-			  QByteArray imageData = QByteArray::fromBase64(ba);
-			  QString imgExt = "";
-			  if (m_style["librevenge:mime-type"]->getStr() == "image/png")
-				  imgExt = "png";
-			  else if (m_style["librevenge:mime-type"]->getStr() == "image/jpeg")
-				  imgExt = "jpg";
-			  else if (m_style["librevenge:mime-type"]->getStr() == "image/bmp")
-				  imgExt = "bmp";
-			  else if (m_style["librevenge:mime-type"]->getStr() == "image/pict")
-				  imgExt = "pict";
-			  else if (m_style["librevenge:mime-type"]->getStr() == "image/tiff")
-				  imgExt = "tif";
-			  if (!imgExt.isEmpty())
-			  {
-				  z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColorFill, CurrColorStroke, true);
-				  ite = m_Doc->Items->at(z);
-				  ite->PoLine = Coords.copy();
-				  finishItem(ite);
-				  insertImage(ite, imgExt, imageData);
-			  }
-			  else if (m_style["librevenge:mime-type"]->getStr() == "image/wmf")
-			  {
-				  imgExt = "wmf";
-				  QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_pub_XXXXXX." + imgExt);
-				  if (tempFile->open())
-				  {
-					  tempFile->write(imageData);
-					  QString fileName = getLongPathName(tempFile->fileName());
-					  tempFile->close();
-					  FileLoader *fileLoader = new FileLoader(fileName);
-					  int testResult = fileLoader->testFile();
-					  delete fileLoader;
-					  if (testResult != -1)
-					  {
-						  const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
-						  if( fmt )
-						  {
-							  fmt->setupTargets(m_Doc, 0, 0, 0, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
-							  fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
-							  if (m_Doc->m_Selection->count() > 0)
-							  {
-								  ite = m_Doc->groupObjectsSelection();
-								  double rot = 0;
-								  if (m_style["librevenge:rotate"])
-									  rot = m_style["librevenge:rotate"]->getDouble();
-								  QPainterPath ba = Coords.toQPainterPath(true);
-								  QRectF baR = ba.boundingRect();
-								  if (rot != 0)
-								  {
-									  QTransform mm;
-									  mm.translate(baR.x(), baR.y());
-									  mm.translate(baR.width() / 2.0, baR.height() / 2.0);
-									  mm.rotate(rot);
-									  mm.translate(-baR.width() / 2.0, -baR.height() / 2.0);
-									  mm.translate(-baR.x(), -baR.y());
-									  ba = mm.map(ba);
-									  baR = ba.boundingRect();
-									  ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
-									  ite->setWidthHeight(baR.width(), baR.height(), true);
-									  Coords.fromQPainterPath(ba, true);
-									  FPoint tp2(getMinClipF(&Coords));
-									  Coords.translate(-tp2.x(), -tp2.y());
-									  ite->PoLine = Coords.copy();
-									  int rm = m_Doc->RotMode();
-									  m_Doc->RotMode(2);
-									  m_Doc->RotateItem(-rot, ite);
-									  m_Doc->RotMode(rm);
-								  }
-								  else
-								  {
-									  ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
-									  ite->setWidthHeight(baR.width(), baR.height(), true);
-									  FPoint tp2(getMinClipF(&Coords));
-									  Coords.translate(-tp2.x(), -tp2.y());
-									  ite->PoLine = Coords.copy();
-								  }
-								  finishItem(ite);
-								  if (m_style["draw:red"] && m_style["draw:green"] && m_style["draw:blue"])
-								  {
-									  int r = qRound(m_style["draw:red"]->getDouble() * 255);
-									  int g = qRound(m_style["draw:green"]->getDouble() * 255);
-									  int b = qRound(m_style["draw:blue"]->getDouble() * 255);
-									  QString colVal = QString("#%1%2%3").arg(r, 2, 16, QLatin1Char('0')).arg(g, 2, 16, QLatin1Char('0')).arg(b, 2, 16, QLatin1Char('0'));
-									  QString efVal = parseColor(colVal);
-									  recolorItem(ite, efVal);
-								  }
-							  }
-						  }
-					  }
-				  }
-				  delete tempFile;
-			  }
-		  }
-		}
-		else
-		{
-			z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColorFill, CurrColorStroke, true);
-			ite = m_Doc->Items->at(z);
-			ite->PoLine = Coords.copy();
-			finishItem(ite);
-			applyFill(ite);
-		}
-		applyFlip(ite);
-		if (CurrColorFill != CommonStrings::None)
-			applyShadow(ite);
-	}
-	else
-	{
-		z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CommonStrings::None, CurrColorStroke, true);
-		ite = m_Doc->Items->at(z);
-		ite->PoLine = Coords.copy();
-		finishItem(ite);
-	}
-}
-
-void RawPainter::drawGraphicObject(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	if (!propList["librevenge:mime-type"] || propList["librevenge:mime-type"]->getStr().len() <= 0)
-		return;
-	if (!propList["office:binary-data"])
-		return;
-	if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
-	{
-		PageItem *ite;
-		double x = valueAsPoint(propList["svg:x"]);
-		double y = valueAsPoint(propList["svg:y"]);
-		double w = valueAsPoint(propList["svg:width"]);
-		double h = valueAsPoint(propList["svg:height"]);
-		QByteArray ba(propList["office:binary-data"]->getStr().cstr());
-		QByteArray imageData = QByteArray::fromBase64(ba);
-		QString imgExt = "";
-		if (propList["librevenge:mime-type"]->getStr() == "image/png")
-			imgExt = "png";
-		else if (propList["librevenge:mime-type"]->getStr() == "image/jpeg")
-			imgExt = "jpg";
-		else if (propList["librevenge:mime-type"]->getStr() == "image/bmp")
-			imgExt = "bmp";
-		else if (propList["librevenge:mime-type"]->getStr() == "image/pict")
-			imgExt = "pict";
-		else if (propList["librevenge:mime-type"]->getStr() == "image/tiff")
-			imgExt = "tif";
-		if (!imgExt.isEmpty())
-		{
-			int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Rectangle, baseX + x, baseY + y, w, h, 0, CurrColorFill, CurrColorStroke, true);
-			ite = m_Doc->Items->at(z);
-			finishItem(ite);
-			insertImage(ite, imgExt, imageData);
-		}
-		else
-		{
-			if (propList["librevenge:mime-type"]->getStr() == "image/wmf")
-			{
-				imgExt = "wmf";
-				QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_pub_XXXXXX." + imgExt);
-				if (tempFile->open())
-				{
-					tempFile->write(imageData);
-					QString fileName = getLongPathName(tempFile->fileName());
-					tempFile->close();
-					FileLoader *fileLoader = new FileLoader(fileName);
-					int testResult = fileLoader->testFile();
-					delete fileLoader;
-					if (testResult != -1)
-					{
-						const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
-						if( fmt )
-						{
-							fmt->setupTargets(m_Doc, 0, 0, 0, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
-							fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
-							if (m_Doc->m_Selection->count() > 0)
-							{
-								ite = m_Doc->groupObjectsSelection();
-								double rot = 0;
-								if (m_style["librevenge:rotate"])
-									rot = m_style["librevenge:rotate"]->getDouble();
-								QPainterPath ba;
-								ba.addRect(QRectF(x, y, w, h));
-								QRectF baR = QRectF(x, y, w, h);
-								if (rot != 0)
-								{
-									QTransform mm;
-									mm.translate(baR.x(), baR.y());
-									mm.translate(baR.width() / 2.0, baR.height() / 2.0);
-									mm.rotate(rot);
-									mm.translate(-baR.width() / 2.0, -baR.height() / 2.0);
-									mm.translate(-baR.x(), -baR.y());
-									ba = mm.map(ba);
-									baR = ba.boundingRect();
-									ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
-									ite->setWidthHeight(baR.width(), baR.height(), true);
-									ite->updateClip();
-									int rm = m_Doc->RotMode();
-									m_Doc->RotMode(2);
-									m_Doc->RotateItem(-rot, ite);
-									m_Doc->RotMode(rm);
-								}
-								else
-								{
-									ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
-									ite->setWidthHeight(baR.width(), baR.height(), true);
-									ite->updateClip();
-								}
-								finishItem(ite);
-								if (m_style["draw:red"] && m_style["draw:green"] && m_style["draw:blue"])
-								{
-									int r = qRound(m_style["draw:red"]->getDouble() * 255);
-									int g = qRound(m_style["draw:green"]->getDouble() * 255);
-									int b = qRound(m_style["draw:blue"]->getDouble() * 255);
-									QString colVal = QString("#%1%2%3").arg(r, 2, 16, QLatin1Char('0')).arg(g, 2, 16, QLatin1Char('0')).arg(b, 2, 16, QLatin1Char('0'));
-									QString efVal = parseColor(colVal);
-									recolorItem(ite, efVal);
-								}
-							}
-						}
-					}
-				}
-				delete tempFile;
-			}
-		}
-		applyFlip(ite);
-		if (CurrColorFill != CommonStrings::None)
-			applyShadow(ite);
-	}
-}
-
-void RawPainter::drawConnector(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "drawConnector";
-}
-
-void RawPainter::startTextObject(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	if (!doProcessing)
-		return;
-	actTextItem = NULL;
-	lineSpSet = false;
-	lineSpIsPT = false;
-	if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
-	{
-		double x = valueAsPoint(propList["svg:x"]);
-		double y = valueAsPoint(propList["svg:y"]);
-		double w = valueAsPoint(propList["svg:width"]);
-		double h = valueAsPoint(propList["svg:height"]);
-		double rot = 0;
-		if (propList["librevenge:rotate"])
-			rot = propList["librevenge:rotate"]->getDouble();
-		int z = m_Doc->itemAdd(PageItem::TextFrame, PageItem::Rectangle, baseX + x, baseY + y, w, h, 0, CurrColorFill, CurrColorStroke, true);
-		PageItem *ite = m_Doc->Items->at(z);
-		finishItem(ite);
-		applyShadow(ite);
-		if (rot != 0)
-		{
-			int rm = m_Doc->RotMode();
-			m_Doc->RotMode(2);
-			m_Doc->RotateItem(rot, ite);
-			m_Doc->RotMode(rm);
-		}
-		if (propList["draw-mirror-horizontal"])
-			ite->flipImageH();
-		if (propList["draw-mirror-vertical"])
-			ite->flipImageV();
-		if (propList["fo:padding-left"])
-			ite->setTextToFrameDistLeft(valueAsPoint(propList["fo:padding-left"]));
-		if (propList["fo:padding-right"])
-			ite->setTextToFrameDistRight(valueAsPoint(propList["fo:padding-right"]));
-		if (propList["fo:padding-top"])
-			ite->setTextToFrameDistTop(valueAsPoint(propList["fo:padding-top"]));
-		if (propList["fo:padding-bottom"])
-			ite->setTextToFrameDistBottom(valueAsPoint(propList["fo:padding-bottom"]));
-		if (propList["fo:column-count"])
-			ite->setColumns(propList["fo:column-count"]->getInt());
-		if (propList["fo:column-gap"])
-			ite->setColumnGap(valueAsPoint(propList["fo:column-gap"]));
-		ite->setFirstLineOffset(FLOPFontAscent);
-		actTextItem = ite;
-		QString pStyle = CommonStrings::DefaultParagraphStyle;
-		ParagraphStyle newStyle;
-		newStyle.setParent(pStyle);
-		textStyle = newStyle;
-	}
-}
-
-void RawPainter::endTextObject()
-{
-	if (!doProcessing)
-		return;
-	if (actTextItem)
-		actTextItem->itemText.trim();
-	actTextItem = NULL;
-	lineSpSet = false;
-	lineSpIsPT = false;
-}
-
-void RawPainter::startTableObject(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "startTableObject";
-}
-
-void RawPainter::openTableRow(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "openTableRow";
-}
-
-void RawPainter::closeTableRow()
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "closeTableRow";
-}
-
-void RawPainter::openTableCell(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "openTableCell";
-}
-
-void RawPainter::closeTableCell()
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "closeTableCell";
-}
-
-void RawPainter::insertCoveredTableCell(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "insertCoveredTableCell";
-}
-
-void RawPainter::endTableObject()
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "endTableObject";
-}
-
-void RawPainter::openOrderedListLevel(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "openOrderedListLevel";
-}
-
-void RawPainter::closeOrderedListLevel()
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "closeOrderedListLevel";
-}
-
-void RawPainter::openUnorderedListLevel(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "openUnorderedListLevel";
-}
-
-void RawPainter::closeUnorderedListLevel()
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "closeUnorderedListLevel";
-}
-
-void RawPainter::openListElement(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "openListElement";
-}
-
-void RawPainter::closeListElement()
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "closeListElement";
-}
-
-void RawPainter::defineParagraphStyle(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "defineParagraphStyle";
-}
-
-void RawPainter::openParagraph(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	QString pStyle = CommonStrings::DefaultParagraphStyle;
-	ParagraphStyle newStyle;
-	newStyle.setParent(pStyle);
-	textStyle = newStyle;
-	if (propList["fo:text-align"])
-	{
-		QString align = QString(propList["fo:text-align"]->getStr().cstr());
-		if (align == "left")
-			textStyle.setAlignment(ParagraphStyle::Leftaligned);
-		else if (align == "center")
-			textStyle.setAlignment(ParagraphStyle::Centered);
-		else if (align == "right")
-			textStyle.setAlignment(ParagraphStyle::Rightaligned);
-		else if (align == "justify")
-			textStyle.setAlignment(ParagraphStyle::Justified);
-	}
-	if (propList["fo:margin-left"])
-		textStyle.setLeftMargin(valueAsPoint(propList["fo:margin-left"]));
-	if (propList["fo:margin-right"])
-		textStyle.setRightMargin(valueAsPoint(propList["fo:margin-right"]));
-	if (propList["fo:text-indent"])
-		textStyle.setFirstIndent(valueAsPoint(propList["fo:text-indent"]));
-	if (propList["style:drop-cap"])
-	{
-		textStyle.setDropCapLines(propList["style:drop-cap"]->getInt());
-		textStyle.setHasDropCap(true);
-	}
-	if (propList["fo:margin-bottom"])
-		textStyle.setGapAfter(valueAsPoint(propList["fo:margin-bottom"]));
-	if (propList["fo:margin-top"])
-		textStyle.setGapBefore(valueAsPoint(propList["fo:margin-top"]));
-//	m_maxFontSize = textStyle.charStyle().fontSize() / 10.0;
-	m_maxFontSize = 1.0;
-	if (propList["fo:line-height"])
-	{
-		m_linespace = propList["fo:line-height"]->getDouble();
-		QString lsp = QString(propList["fo:line-height"]->getStr().cstr());
-		lineSpIsPT = lsp.endsWith("pt");
-		lineSpSet = true;
-	}
-}
-
-void RawPainter::closeParagraph()
-{
-	if (!doProcessing)
-		return;
-	int posT = actTextItem->itemText.length();
-	if (posT > 0)
-	{
-		if ((actTextItem->itemText.text(posT - 1) != SpecialChars::PARSEP))
-		{
-			actTextItem->itemText.insertChars(posT, SpecialChars::PARSEP);
-			actTextItem->itemText.applyStyle(posT, textStyle);
-		}
-	}
-}
-
-void RawPainter::defineCharacterStyle(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "defineCharacterStyle";
-}
-
-void RawPainter::openSpan(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	textCharStyle = textStyle.charStyle();
-	if (propList["fo:font-size"])
-	{
-		textCharStyle.setFontSize(valueAsPoint(propList["fo:font-size"]) * 10.0);
-		m_maxFontSize = qMax(m_maxFontSize, valueAsPoint(propList["fo:font-size"]));
-	}
-	if (propList["fo:color"])
-		textCharStyle.setFillColor(parseColor(QString(propList["fo:color"]->getStr().cstr())));
-	if (propList["style:font-name"])
-	{
-		QString fontVari = "";
-		if (propList["fo:font-weight"])
-			fontVari = QString(propList["fo:font-weight"]->getStr().cstr());
-		QString fontName = QString(propList["style:font-name"]->getStr().cstr());
-		QString realFontName = constructFontName(fontName, fontVari);
-		textCharStyle.setFont((*m_Doc->AllFonts)[realFontName]);
-	}
-	StyleFlag styleEffects = textCharStyle.effects();
-	if (propList["style:text-underline-type"])
-		styleEffects |= ScStyle_Underline;
-	if (propList["style:text-position"])
-	{
-		if (propList["style:text-position"]->getStr() == "50% 67%")
-			styleEffects |= ScStyle_Superscript;
-		else
-			styleEffects |= ScStyle_Subscript;
-	}
-	textCharStyle.setFeatures(styleEffects.featureList());
-}
-
-void RawPainter::closeSpan()
-{
-}
-
-void RawPainter::openLink(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "openLink";
-}
-
-void RawPainter::closeLink()
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "closeLink";
-}
-
-void RawPainter::insertTab()
-{
-	if (!doProcessing)
-		return;
-	int posT = actTextItem->itemText.length();
-	actTextItem->itemText.insertChars(posT, SpecialChars::TAB);
-	actTextItem->itemText.applyStyle(posT, textStyle);
-}
-
-void RawPainter::insertSpace()
-{
-	if (!doProcessing)
-		return;
-	int posT = actTextItem->itemText.length();
-	actTextItem->itemText.insertChars(posT, SpecialChars::BLANK);
-	actTextItem->itemText.applyStyle(posT, textStyle);
-}
-
-void RawPainter::insertText(const librevenge::RVNGString &text)
-{
-	if (!doProcessing)
-		return;
-	if (lineSpSet)
-	{
-		textStyle.setLineSpacingMode(ParagraphStyle::FixedLineSpacing);
-		if (lineSpIsPT)
-			textStyle.setLineSpacing(m_linespace);
-		else
-			textStyle.setLineSpacing(m_maxFontSize * m_linespace);
-	}
-	else
-		textStyle.setLineSpacingMode(ParagraphStyle::AutomaticLineSpacing);
-	librevenge::RVNGString tempUTF8(text);
-	QString actText = QString(tempUTF8.cstr());
-	if (actTextItem)
-	{
-		int posC = actTextItem->itemText.length();
-		if (actText.count() > 0)
-		{
-			actText.replace(QChar(10), SpecialChars::LINEBREAK);
-			actText.replace(QChar(12), SpecialChars::FRAMEBREAK);
-			actText.replace(QChar(30), SpecialChars::NBHYPHEN);
-			actText.replace(QChar(160), SpecialChars::NBSPACE);
-			QTextDocument texDoc;
-			texDoc.setHtml(actText);
-			actText = texDoc.toPlainText();
-			actText = actText.trimmed();
-			actTextItem->itemText.insertChars(posC, actText);
-			actTextItem->itemText.applyStyle(posC, textStyle);
-			actTextItem->itemText.applyCharStyle(posC, actText.length(), textCharStyle);
-		}
-	}
-}
-
-void RawPainter::insertLineBreak()
-{
-	if (!doProcessing)
-		return;
-	int posT = actTextItem->itemText.length();
-	actTextItem->itemText.insertChars(posT, SpecialChars::LINEBREAK);
-	actTextItem->itemText.applyStyle(posT, textStyle);
-}
-
-void RawPainter::insertField(const librevenge::RVNGPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "insertField";
-}
-
-double RawPainter::valueAsPoint(const librevenge::RVNGProperty *prop)
-{
-	double value = 0.0;
-	QString str = QString(prop->getStr().cstr()).toLower();
-	if (str.endsWith("in"))
-		value = prop->getDouble() * 72.0;
-	else
-		value = prop->getDouble();
-	return value;
-}
-
-void RawPainter::applyFill(PageItem* ite)
-{
-	if(isGradient)
-	{
-		QString gradMode = "normal";
-		if (m_style["libmspub:shade"])
-			gradMode = QString(m_style["libmspub:shade"]->getStr().cstr());
-		else if (m_style["draw:style"])
-			gradMode = QString(m_style["draw:style"]->getStr().cstr());
-		if ((gradMode == "normal") || (gradMode == "linear"))
-		{
-			int angle = 0;
-			if (m_style["draw:angle"])
-				angle = qRound(m_style["draw:angle"]->getDouble());
-			double h = ite->height();
-			double w = ite->width();
-			if (angle == 0)
-				ite->setGradientVector(w / 2.0, h, w / 2.0, 0, 0, 0, 1, 0);
-			else if (angle == -225)
-				ite->setGradientVector(w, 0, 0, h, 0, 0, 1, 0);
-			else if (angle == 45)
-				ite->setGradientVector(w, h, 0, 0, 0, 0, 1, 0);
-			else if (angle == 90)
-				ite->setGradientVector(w, h / 2.0, 0, h / 2.0, 0, 0, 1, 0);
-			else if (angle == 180)
-				ite->setGradientVector(w / 2.0, 0, w / 2.0, h, 0, 0, 1, 0);
-			else if (angle == 270)
-				ite->setGradientVector(0, h / 2.0, w, h / 2.0, 0, 0, 1, 0);
-			ite->fill_gradient = currentGradient;
-			ite->GrType = 6;
-		}
-		else if (gradMode == "radial")
-		{
-			double h = ite->height();
-			double w = ite->width();
-			double cx = 0.0;
-			double cy = 0.0;
-			if (m_style["svg:cx"])
-				cx = m_style["svg:cx"]->getDouble();
-			if (m_style["svg:cy"])
-				cy = m_style["svg:cy"]->getDouble();
-			ite->setGradientVector(cx, cy, w, h / 2.0, cx, cy, 1, 0);
-			ite->fill_gradient = currentGradient;
-			ite->GrType = 7;
-		}
-		else if (gradMode == "square")
-		{
-			double cx = 0.0;
-			double cy = 0.0;
-			if (m_style["svg:cx"])
-				cx = m_style["svg:cx"]->getDouble();
-			if (m_style["svg:cy"])
-				cy = m_style["svg:cy"]->getDouble();
-			FPoint cp = FPoint(cx, cy);
-			ite->setDiamondGeometry(FPoint(0, 0), FPoint(ite->width(), 0), FPoint(ite->width(), ite->height()), FPoint(0, ite->height()), cp);
-			ite->fill_gradient.clearStops();
-			QList<VColorStop*> colorStops = currentGradient.colorStops();
-			for( int a = 0; a < colorStops.count() ; a++ )
-			{
-				ite->fill_gradient.addStop(colorStops[a]->color, 1.0 - colorStops[a]->rampPoint, colorStops[a]->midPoint, colorStops[a]->opacity, colorStops[a]->name, colorStops[a]->shade);
-			}
-			ite->GrType = 10;
-		}
-		else if (gradMode == "center")
-		{
-			QString center = "top-left";
-			FPoint cp = FPoint(0, 0);
-			if (m_style["libmspub:shade-ref-point"])
-				center = QString(m_style["libmspub:shade-ref-point"]->getStr().cstr());
-			if (center == "top-left")
-				cp = FPoint(0, 0);
-			else if (center == "top-right")
-				cp = FPoint(ite->width(), 0);
-			else if (center == "bottom-left")
-				cp = FPoint(0, ite->height());
-			else if (center == "bottom-right")
-				cp = FPoint(ite->width(), ite->height());
-			ite->setDiamondGeometry(FPoint(0, 0), FPoint(ite->width(), 0), FPoint(ite->width(), ite->height()), FPoint(0, ite->height()), cp);
-			ite->fill_gradient.clearStops();
-			QList<VColorStop*> colorStops = currentGradient.colorStops();
-			for( int a = 0; a < colorStops.count() ; a++ )
-			{
-				ite->fill_gradient.addStop(colorStops[a]->color, 1.0 - colorStops[a]->rampPoint, colorStops[a]->midPoint, colorStops[a]->opacity, colorStops[a]->name, colorStops[a]->shade);
-			}
-			ite->GrType = 10;
-		}
-		else if (gradMode == "shape")
-		{
-			ite->meshGradientPatches.clear();
-			FPoint center = FPoint(ite->width() / 2.0, ite->height() / 2.0);
-			meshPoint cP;
-			cP.resetTo(center);
-			cP.transparency = gradColor2Trans;
-			cP.shade = 100;
-			cP.colorName = gradColor2Str;
-			cP.color = gradColor2;
-			for (int poi = 0; poi < ite->PoLine.size()-3; poi += 4)
-			{
-				meshGradientPatch patch;
-				patch.BL = cP;
-				patch.BR = cP;
-				if (ite->PoLine.isMarker(poi))
-					continue;
-				meshPoint tL;
-				tL.resetTo(ite->PoLine.point(poi));
-				tL.controlRight = ite->PoLine.point(poi + 1);
-				tL.transparency = gradColor1Trans;
-				tL.shade = 100;
-				tL.colorName = gradColor1Str;
-				tL.color = gradColor1;
-				meshPoint tR;
-				tR.resetTo(ite->PoLine.point(poi + 2));
-				tR.controlLeft = ite->PoLine.point(poi + 3);
-				tR.transparency = gradColor1Trans;
-				tR.shade = 100;
-				tR.colorName = gradColor1Str;
-				tR.color = gradColor1;
-				patch.TL = tL;
-				patch.TR = tR;
-				ite->meshGradientPatches.append(patch);
-			}
-			ite->GrType = 12;
-		}
-	}
-	if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "bitmap")
-	{
-		QByteArray ba(m_style["draw:fill-image"]->getStr().cstr());
-		QByteArray imageData = QByteArray::fromBase64(ba);
-		QString imgExt = "";
-		if (m_style["librevenge:mime-type"]->getStr() == "image/png")
-			imgExt = "png";
-		else if (m_style["librevenge:mime-type"]->getStr() == "image/jpeg")
-			imgExt = "jpg";
-		else if (m_style["librevenge:mime-type"]->getStr() == "image/bmp")
-			imgExt = "bmp";
-		else if (m_style["librevenge:mime-type"]->getStr() == "image/pict")
-			imgExt = "pict";
-		else if (m_style["librevenge:mime-type"]->getStr() == "image/tiff")
-			imgExt = "tif";
-		if (!imgExt.isEmpty())
-		{
-			QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_pub_XXXXXX." + imgExt);
-			tempFile->setAutoRemove(false);
-			if (tempFile->open())
-			{
-				tempFile->write(imageData);
-				QString fileName = getLongPathName(tempFile->fileName());
-				tempFile->close();
-				ScPattern pat = ScPattern();
-				pat.setDoc(m_Doc);
-				int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None, true);
-				PageItem* newItem = m_Doc->Items->at(z);
-				if (m_style["draw:red"] && m_style["draw:green"] && m_style["draw:blue"])
-				{
-					int r = qRound(m_style["draw:red"]->getDouble() * 255);
-					int g = qRound(m_style["draw:green"]->getDouble() * 255);
-					int b = qRound(m_style["draw:blue"]->getDouble() * 255);
-					QString colVal = QString("#%1%2%3").arg(r, 2, 16, QLatin1Char('0')).arg(g, 2, 16, QLatin1Char('0')).arg(b, 2, 16, QLatin1Char('0'));
-					QString efVal = parseColor(colVal);
-					efVal += "\n";
-					struct ImageEffect ef;
-					efVal += "100";
-					ef.effectCode = ScImage::EF_COLORIZE;
-					ef.effectParameters = efVal;
-					ite->effectsInUse.append(ef);
-				}
-				m_Doc->loadPict(fileName, newItem);
-				m_Doc->Items->takeAt(z);
-				newItem->isInlineImage = true;
-				newItem->isTempFile = true;
-				pat.width = newItem->pixm.qImage().width();
-				pat.height = newItem->pixm.qImage().height();
-				pat.scaleX = (72.0 / newItem->pixm.imgInfo.xres) * newItem->pixm.imgInfo.lowResScale;
-				pat.scaleY = (72.0 / newItem->pixm.imgInfo.xres) * newItem->pixm.imgInfo.lowResScale;
-				pat.pattern = newItem->pixm.qImage().copy();
-				newItem->setWidth(pat.pattern.width());
-				newItem->setHeight(pat.pattern.height());
-				newItem->SetRectFrame();
-				newItem->gXpos = 0.0;
-				newItem->gYpos = 0.0;
-				newItem->gWidth = pat.pattern.width();
-				newItem->gHeight = pat.pattern.height();
-				pat.items.append(newItem);
-				QString patternName = "Pattern_"+ite->itemName();
-				patternName = patternName.trimmed().simplified().replace(" ", "_");
-				m_Doc->addPattern(patternName, pat);
-				importedPatterns->append(patternName);
-				ite->setPattern(patternName);
-				ite->GrType = 8;
-			}
-			delete tempFile;
-		}
-	}
-}
-
-#else
-RawPainter::RawPainter(ScribusDoc* Doc, double x, double y, double w, double h, int iflags, QList<PageItem*> *Elem, QStringList *iColors, QStringList *iPatterns, Selection* tSel): libwpg::WPGPaintInterface()
-{
-	m_Doc = Doc;
-	baseX = x;
-	baseY = y;
-	docWidth = w;
-	docHeight = h;
-	importerFlags = iflags;
-	Elements = Elem;
-	importedColors = iColors;
-	importedPatterns = iPatterns;
-	tmpSel = tSel;
-	CurrColorFill = "Black";
-	CurrFillShade = 100.0;
-	CurrColorStroke = "Black";
-	CurrStrokeShade = 100.0;
-	CurrStrokeTrans = 0.0;
-	CurrFillTrans = 0.0;
-	Coords.resize(0);
-	Coords.svgInit();
-	LineW = 1.0;
-	lineJoin = Qt::MiterJoin;
-	lineEnd = Qt::FlatCap;
-	fillrule = true;
-	gradientAngle = 0.0;
-	isGradient = false;
-	lineSpSet = false;
-	currentGradient = VGradient(VGradient::linear);
-	currentGradient.clearStops();
-	currentGradient.setRepeatMethod( VGradient::none );
-	dashArray.clear();
-	firstPage = true;
-	actPage = 0;
-	actTextItem = NULL;
-	doProcessing = true;
-}
-
-void RawPainter::startGraphics(const ::WPXPropertyList &propList)
-{
-	if (propList["svg:width"])
-		docWidth = valueAsPoint(propList["svg:width"]);
-	if (propList["svg:height"])
-		docHeight = valueAsPoint(propList["svg:height"]);
-	if (importerFlags & LoadSavePlugin::lfCreateDoc)
-	{
-		if (!firstPage)
-		{
-			m_Doc->addPage(actPage);
-			m_Doc->setActiveLayer(baseLayer);
-		}
-		else
-			baseLayer = m_Doc->activeLayerName();
-		m_Doc->setPageSize("Custom");
-		m_Doc->currentPage()->setInitialWidth(docWidth);
-		m_Doc->currentPage()->setInitialHeight(docHeight);
-		m_Doc->currentPage()->setWidth(docWidth);
-		m_Doc->currentPage()->setHeight(docHeight);
-		m_Doc->currentPage()->MPageNam = CommonStrings::trMasterPageNormal;
-		m_Doc->currentPage()->m_pageSize = "Custom";
-		m_Doc->reformPages(true);
-		baseX = m_Doc->currentPage()->xOffset();
-		baseY = m_Doc->currentPage()->yOffset();
-	}
-	firstPage = false;
-	actPage++;
-}
-
-void RawPainter::endGraphics()
-{
-	if (importerFlags & LoadSavePlugin::lfCreateThumbnail)
-		doProcessing = false;
-//	qDebug() << "endGraphics";
-//  printf("RawPainter::endGraphics\n");
-}
-
-void RawPainter::startLayer(const ::WPXPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	FPointArray clip;
-	if (propList["svg:clip-path"])
-	{
-		QString svgString = QString(propList["svg:clip-path"]->getStr().cstr());
-		clip.resize(0);
-		clip.svgInit();
-		svgString.replace(",", ".");
-		clip.parseSVG(svgString);
-		QTransform m;
-		m.scale(72.0, 72.0);
-		clip.map(m);
-	}
-	QList<PageItem*> gElements;
-	groupEntry gr;
-	gr.clip = clip.copy();
-	gr.Items = gElements;
-	groupStack.push(gr);
-}
-
-void RawPainter::endLayer()
-{
-	if (!doProcessing)
-		return;
-	if (groupStack.count() != 0)
-	{
-		PageItem *ite;
-		groupEntry gr = groupStack.pop();
-		QList<PageItem*> gElements = gr.Items;
-		tmpSel->clear();
-		if (gElements.count() > 0)
-		{
-			bool groupClip = true;
-			for (int dre = 0; dre < gElements.count(); ++dre)
-			{
-				tmpSel->addItem(gElements.at(dre), true);
-				Elements->removeAll(gElements.at(dre));
-				if (gElements.at(dre)->hasSoftShadow())
-					groupClip = false;
-			}
-			ite = m_Doc->groupObjectsSelection(tmpSel);
-			ite->setGroupClipping(groupClip);
-			ite->setTextFlowMode(PageItem::TextFlowUsesBoundingBox);
-			if (!gr.clip.isEmpty())
-			{
-				double oldX = ite->xPos();
-				double oldY = ite->yPos();
-				double oldW = ite->width();
-				double oldH = ite->height();
-				double oldgW = ite->groupWidth;
-				double oldgH = ite->groupHeight;
-				ite->PoLine = gr.clip.copy();
-				ite->PoLine.translate(baseX, baseY);
-				FPoint xy = getMinClipF(&ite->PoLine);
-				ite->setXYPos(xy.x(), xy.y(), true);
-				ite->PoLine.translate(-xy.x(), -xy.y());
-				FPoint wh = getMaxClipF(&ite->PoLine);
-				ite->setWidthHeight(wh.x(),wh.y());
-				ite->groupWidth = oldgW * (ite->width() / oldW);
-				ite->groupHeight = oldgH * (ite->height() / oldH);
-				double dx = (ite->xPos() - oldX) / (ite->width() / ite->groupWidth);
-				double dy = (ite->yPos() - oldY) / (ite->height() / ite->groupHeight);
-				for (int em = 0; em < ite->groupItemList.count(); ++em)
-				{
-					PageItem* embedded = ite->groupItemList.at(em);
-					embedded->moveBy(-dx, -dy, true);
-					m_Doc->setRedrawBounding(embedded);
-					embedded->OwnPage = m_Doc->OnPage(embedded);
-				}
-				ite->ClipEdited = true;
-				ite->OldB2 = ite->width();
-				ite->OldH2 = ite->height();
-				ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
-				ite->updateGradientVectors();
-			}
-			Elements->append(ite);
-			if (groupStack.count() != 0)
-				groupStack.top().Items.append(ite);
-		}
-		tmpSel->clear();
-	}
-}
-
-void RawPainter::startEmbeddedGraphics(const ::WPXPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "startEmbeddedGraphics";
-//  printf("RawPainter::startEmbeddedGraphics (%s)\n", getPropString(propList).cstr());
-}
-
-void RawPainter::endEmbeddedGraphics()
-{
-	if (!doProcessing)
-		return;
-//	qDebug() << "endEmbeddedGraphics";
-//  printf("RawPainter::endEmbeddedGraphics \n");
-}
-
-void RawPainter::setStyle(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &gradient)
-{
-	if (!doProcessing)
-		return;
-	m_style.clear();
-	m_style = propList;
-	isGradient = false;
-	if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "none")
-		CurrColorFill = CommonStrings::None;
-	else if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "solid")
-	{
-		if (propList["draw:fill-color"])
-		{
-			CurrColorFill = parseColor(QString(propList["draw:fill-color"]->getStr().cstr()));
-			if(propList["draw:opacity"])
-				CurrFillTrans = 1.0 - qMin(1.0, qMax(fromPercentage(QString(propList["draw:opacity"]->getStr().cstr())), 0.0));
-		}
-	}
-	if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "gradient")
-	{
-		double angle = 0;
-		if (propList["draw:angle"])
-			angle = propList["draw:angle"]->getDouble();
-		if (gradient.count() > 1)
-		{
-			double opacity = 1.0;
-			currentGradient = VGradient(VGradient::linear);
-			currentGradient.clearStops();
-			currentGradient.setRepeatMethod( VGradient::none );
-			double dr = 1.0 / static_cast<double>(gradient.count());
-			for (unsigned c = 0; c < gradient.count(); c++)
-			{
-				WPXPropertyList grad = gradient[c];
-				if (grad["svg:stop-color"])
-				{
-					QString stopName = parseColor(QString(grad["svg:stop-color"]->getStr().cstr()));
-					double rampPoint = dr * c;
-					if(grad["svg:offset"])
-						rampPoint = fromPercentage(QString(grad["svg:offset"]->getStr().cstr()));
-					const ScColor& gradC = m_Doc->PageColors[stopName];
-					if(grad["svg:stop-opacity"])
-						opacity = qMin(1.0, qMax(fromPercentage(QString(grad["svg:stop-opacity"]->getStr().cstr())), 0.0));
-					currentGradient.addStop( ScColorEngine::getRGBColor(gradC, m_Doc), rampPoint, 0.5, opacity, stopName, 100 );
-					if (c == 0)
-					{
-						gradColor1Str = stopName;
-						gradColor1 = ScColorEngine::getRGBColor(gradC, m_Doc);
-						gradColor1Trans = opacity;
-					}
-					else
-					{
-						gradColor2Str = stopName;
-						gradColor2 = ScColorEngine::getRGBColor(gradC, m_Doc);
-						gradColor2Trans = opacity;
-					}
-				}
-			}
-			if (currentGradient.Stops() > 1)
-				isGradient = true;
-		}
-	}
-	if(propList["svg:fill-rule"])
-	{
-		if (QString(propList["svg:fill-rule"]->getStr().cstr()) == "nonzero")
-			fillrule = false;
-		else
-			fillrule = true;
-	}
-	if (propList["svg:stroke-width"])
-		LineW = valueAsPoint(propList["svg:stroke-width"]);
-	if (propList["draw:stroke"])
-	{
-		if (propList["draw:stroke"]->getStr() == "none")
-			CurrColorStroke = CommonStrings::None;
-		else if ((propList["draw:stroke"]->getStr() == "solid") || (propList["draw:stroke"]->getStr() == "dash"))
-		{
-			if (propList["svg:stroke-color"])
-			{
-				CurrColorStroke = parseColor(QString(propList["svg:stroke-color"]->getStr().cstr()));
-				if(propList["svg:stroke-opacity"])
-					CurrStrokeTrans = 1.0 - qMin(1.0, qMax(fromPercentage(QString(propList["svg:stroke-opacity"]->getStr().cstr())), 0.0));
-			}
-			if (propList["draw:stroke"]->getStr() == "dash")
-			{
-				dashArray.clear();
-				double gap = LineW;
-				if (propList["draw:distance"])
-					gap = valueAsPoint(propList["draw:distance"]);
-				int dots1 = 0;
-				if (propList["draw:dots1"])
-					dots1 = propList["draw:dots1"]->getInt();
-				double dots1len = LineW;
-				if (propList["draw:dots1-length"])
-					dots1len = valueAsPoint(propList["draw:dots1-length"]);
-				int dots2 = 0;
-				if (propList["draw:dots2"])
-					dots2 = propList["draw:dots2"]->getInt();
-				double dots2len = LineW;
-				if (propList["draw:dots2-length"])
-					dots2len = valueAsPoint(propList["draw:dots2-length"]);
-				for (int i = 0; i < dots1; i++)
-				{
-					dashArray << qMax(dots1len, 0.1) << qMax(gap, 0.1);
-				}
-				for (int j = 0; j < dots2; j++)
-				{
-					dashArray << qMax(dots2len, 0.1) << qMax(gap, 0.1);
-				}
-			}
-			else
-				dashArray.clear();
-		}
-	}
-	if (propList["svg:stroke-linecap"])
-	{
-		QString params = QString(propList["svg:stroke-linecap"]->getStr().cstr());
-		if( params == "butt" )
-			lineEnd = Qt::FlatCap;
-		else if( params == "round" )
-			lineEnd = Qt::RoundCap;
-		else if( params == "square" )
-			lineEnd = Qt::SquareCap;
-		else
-			lineEnd = Qt::FlatCap;
-	}
-	if (propList["svg:stroke-linejoin"])
-	{
-		QString params = QString(propList["svg:stroke-linejoin"]->getStr().cstr());
-		if( params == "miter" )
-			lineJoin = Qt::MiterJoin;
-		else if( params == "round" )
-			lineJoin = Qt::RoundJoin;
-		else if( params == "bevel" )
-			lineJoin = Qt::BevelJoin;
-		else
-			lineJoin = Qt::MiterJoin;
-	}
-//	qDebug() << "setStyle";
-//  printf("RawPainter::setStyle(%s, gradient: (%s))\n", getPropString(propList).cstr(), getPropString(gradient).cstr());
-}
-
-void RawPainter::drawRectangle(const ::WPXPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
-	{
-		double x = valueAsPoint(propList["svg:x"]);
-		double y = valueAsPoint(propList["svg:y"]);
-		double w = valueAsPoint(propList["svg:width"]);
-		double h = valueAsPoint(propList["svg:height"]);
-		int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX + x, baseY + y, w, h, LineW, CurrColorFill, CurrColorStroke, true);
-		PageItem *ite = m_Doc->Items->at(z);
-		finishItem(ite);
-		applyFill(ite);
-		if (CurrColorFill != CommonStrings::None)
-			applyShadow(ite);
-	}
-//	qDebug() << "drawRectangle";
-//  printf("RawPainter::drawRectangle (%s)\n", getPropString(propList).cstr());
-}
-
-void RawPainter::drawEllipse(const ::WPXPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
-	{
-		double x = valueAsPoint(propList["svg:x"]);
-		double y = valueAsPoint(propList["svg:y"]);
-		double w = valueAsPoint(propList["svg:width"]);
-		double h = valueAsPoint(propList["svg:height"]);
-		int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Ellipse, baseX + x, baseY + y, w, h, LineW, CurrColorFill, CurrColorStroke, true);
-		PageItem *ite = m_Doc->Items->at(z);
-		finishItem(ite);
-		applyFill(ite);
-		if (CurrColorFill != CommonStrings::None)
-			applyShadow(ite);
-	}
-//	qDebug() << "drawEllipse";
-//  printf("RawPainter::drawEllipse (%s)\n", getPropString(propList).cstr());
-}
-
-void RawPainter::drawPolyline(const ::WPXPropertyListVector &vertices)
-{
-	if (!doProcessing)
-		return;
-	Coords.resize(0);
-	Coords.svgInit();
-	PageItem *ite;
-	Coords.svgMoveTo(valueAsPoint(vertices[0]["svg:x"]), valueAsPoint(vertices[0]["svg:y"]));
-	for(unsigned i = 1; i < vertices.count(); i++)
-	{
-		Coords.svgLineTo(valueAsPoint(vertices[i]["svg:x"]), valueAsPoint(vertices[i]["svg:y"]));
-	}
-	if (Coords.size() > 0)
-	{
-		int z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CommonStrings::None, CurrColorStroke, true);
-		ite = m_Doc->Items->at(z);
-		ite->PoLine = Coords.copy();
-		finishItem(ite);
-	}
-}
-
-void RawPainter::drawPolygon(const ::WPXPropertyListVector &vertices)
-{
-	if (!doProcessing)
-		return;
-	if(vertices.count() < 2)
-		return;
-	Coords.resize(0);
-	Coords.svgInit();
-	PageItem *ite;
-	int z;
-	Coords.svgMoveTo(valueAsPoint(vertices[0]["svg:x"]), valueAsPoint(vertices[0]["svg:y"]));
-	for(unsigned i = 1; i < vertices.count(); i++)
-	{
-		Coords.svgLineTo(valueAsPoint(vertices[i]["svg:x"]), valueAsPoint(vertices[i]["svg:y"]));
-	}
-	Coords.svgClosePath();
-	if (Coords.size() > 0)
-	{
-		if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "bitmap" && m_style["style:repeat"] && m_style["style:repeat"]->getStr() == "stretch")
-		{
-		  if (m_style["draw:fill-image"] && m_style["libwpg:mime-type"])
-		  {
-			  QByteArray ba(m_style["draw:fill-image"]->getStr().cstr());
-			  QByteArray imageData = QByteArray::fromBase64(ba);
-			  QString imgExt = "";
-			  if (m_style["libwpg:mime-type"]->getStr() == "image/png")
-				  imgExt = "png";
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/jpeg")
-				  imgExt = "jpg";
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/bmp")
-				  imgExt = "bmp";
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/pict")
-				  imgExt = "pict";
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/tiff")
-				  imgExt = "tif";
-			  if (!imgExt.isEmpty())
-			  {
-				  z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColorFill, CurrColorStroke, true);
-				  ite = m_Doc->Items->at(z);
-				  ite->PoLine = Coords.copy();
-				  finishItem(ite);
-				  insertImage(ite, imgExt, imageData);
-			  }
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/wmf")
-			  {
-				  imgExt = "wmf";
-				  QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_pub_XXXXXX." + imgExt);
-				  if (tempFile->open())
-				  {
-					  tempFile->write(imageData);
-					  QString fileName = getLongPathName(tempFile->fileName());
-					  tempFile->close();
-					  FileLoader *fileLoader = new FileLoader(fileName);
-					  int testResult = fileLoader->testFile();
-					  delete fileLoader;
-					  if (testResult != -1)
-					  {
-						  const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
-						  if( fmt )
-						  {
-							  fmt->setupTargets(m_Doc, 0, 0, 0, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
-							  fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
-							  if (m_Doc->m_Selection->count() > 0)
-							  {
-								  ite = m_Doc->groupObjectsSelection();
-								  double rot = 0;
-								  if (m_style["libwpg:rotate"])
-									  rot = m_style["libwpg:rotate"]->getDouble();
-								  QPainterPath ba = Coords.toQPainterPath(true);
-								  QRectF baR = ba.boundingRect();
-								  if (rot != 0)
-								  {
-									  QTransform mm;
-									  mm.translate(baR.x(), baR.y());
-									  mm.translate(baR.width() / 2.0, baR.height() / 2.0);
-									  mm.rotate(rot);
-									  mm.translate(-baR.width() / 2.0, -baR.height() / 2.0);
-									  mm.translate(-baR.x(), -baR.y());
-									  ba = mm.map(ba);
-									  baR = ba.boundingRect();
-									  ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
-									  ite->setWidthHeight(baR.width(), baR.height(), true);
-									  Coords.fromQPainterPath(ba, true);
-									  FPoint tp2(getMinClipF(&Coords));
-									  Coords.translate(-tp2.x(), -tp2.y());
-									  ite->PoLine = Coords.copy();
-									  int rm = m_Doc->RotMode();
-									  m_Doc->RotMode(2);
-									  m_Doc->RotateItem(-rot, ite);
-									  m_Doc->RotMode(rm);
-								  }
-								  else
-								  {
-									  ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
-									  ite->setWidthHeight(baR.width(), baR.height(), true);
-									  FPoint tp2(getMinClipF(&Coords));
-									  Coords.translate(-tp2.x(), -tp2.y());
-									  ite->PoLine = Coords.copy();
-								  }
-								  finishItem(ite);
-								  if (m_style["draw:red"] && m_style["draw:green"] && m_style["draw:blue"])
-								  {
-									  int r = qRound(m_style["draw:red"]->getDouble() * 255);
-									  int g = qRound(m_style["draw:green"]->getDouble() * 255);
-									  int b = qRound(m_style["draw:blue"]->getDouble() * 255);
-									  QString colVal = QString("#%1%2%3").arg(r, 2, 16, QLatin1Char('0')).arg(g, 2, 16, QLatin1Char('0')).arg(b, 2, 16, QLatin1Char('0'));
-									  QString efVal = parseColor(colVal);
-									  recolorItem(ite, efVal);
-								  }
-							  }
-						  }
-					  }
-				  }
-				  delete tempFile;
-			  }
-		  }
-		}
-		else
-		{
-			z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColorFill, CurrColorStroke, true);
-			ite = m_Doc->Items->at(z);
-			ite->PoLine = Coords.copy();
-			finishItem(ite);
-			applyFill(ite);
-		}
-		applyFlip(ite);
-		if (CurrColorFill != CommonStrings::None)
-			applyShadow(ite);
-	}
-}
-
-void RawPainter::drawPath(const ::WPXPropertyListVector &path)
-{
-	if (!doProcessing)
-		return;
-	bool isClosed = false;
-	QString svgString = "";
-	for(unsigned i=0; i < path.count(); i++)
-	{
-		WPXPropertyList propList = path[i];
-		if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "M")
-			svgString += QString("M %1 %2 ").arg(valueAsPoint(propList["svg:x"])).arg(valueAsPoint(propList["svg:y"]));
-		else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "L")
-			svgString += QString("L %1 %2 ").arg(valueAsPoint(propList["svg:x"])).arg(valueAsPoint(propList["svg:y"]));
-		else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "C")
-			svgString += QString("C %1 %2 %3 %4 %5 %6 ").arg(valueAsPoint(propList["svg:x1"])).arg(valueAsPoint(propList["svg:y1"])).arg(valueAsPoint(propList["svg:x2"])).arg(valueAsPoint(propList["svg:y2"])).arg(valueAsPoint(propList["svg:x"])).arg(valueAsPoint(propList["svg:y"]));
-		else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "Q")
-			svgString += QString("Q %1 %2 %3 %4 ").arg(valueAsPoint(propList["svg:x1"])).arg(valueAsPoint(propList["svg:y1"])).arg(valueAsPoint(propList["svg:x"])).arg(valueAsPoint(propList["svg:y"]));
-		else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "A")
-			svgString += QString("A %1 %2 %3 %4 %5 %6 %7") .arg(valueAsPoint(propList["svg:rx"])) .arg(valueAsPoint(propList["svg:ry"])).arg(propList["libwpg:rotate"] ? propList["libwpg:rotate"]->getDouble() : 0).arg(propList["libwpg:large-arc"] ? propList["libwpg:large-arc"]->getInt() : 1).arg(propList["libwpg:sweep"] ? propList["libwpg:sweep"]->getInt() : 1).arg(valueAsPoint(propList["svg:x"])).arg(valueAsPoint(propList["svg:y"]));
-		else if ((i >= path.count()-1 && i > 2) && propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "Z" )
-		{
-			isClosed = true;
-			svgString += "Z";
-		}
-	}
-	Coords.resize(0);
-	Coords.svgInit();
-	Coords.parseSVG(svgString);
-	PageItem *ite;
-	int z;
-	if (isClosed)
-	{
-		if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "bitmap" && m_style["style:repeat"] && m_style["style:repeat"]->getStr() == "stretch")
-		{
-		  if (m_style["draw:fill-image"] && m_style["libwpg:mime-type"])
-		  {
-			  QByteArray ba(m_style["draw:fill-image"]->getStr().cstr());
-			  QByteArray imageData = QByteArray::fromBase64(ba);
-			  QString imgExt = "";
-			  if (m_style["libwpg:mime-type"]->getStr() == "image/png")
-				  imgExt = "png";
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/jpeg")
-				  imgExt = "jpg";
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/bmp")
-				  imgExt = "bmp";
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/pict")
-				  imgExt = "pict";
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/tiff")
-				  imgExt = "tif";
-			  if (!imgExt.isEmpty())
-			  {
-				  z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColorFill, CurrColorStroke, true);
-				  ite = m_Doc->Items->at(z);
-				  ite->PoLine = Coords.copy();
-				  finishItem(ite);
-				  insertImage(ite, imgExt, imageData);
-			  }
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/wmf")
-			  {
-				  imgExt = "wmf";
-				  QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_pub_XXXXXX." + imgExt);
-				  if (tempFile->open())
-				  {
-					  tempFile->write(imageData);
-					  QString fileName = getLongPathName(tempFile->fileName());
-					  tempFile->close();
-					  FileLoader *fileLoader = new FileLoader(fileName);
-					  int testResult = fileLoader->testFile();
-					  delete fileLoader;
-					  if (testResult != -1)
-					  {
-						  const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
-						  if( fmt )
-						  {
-							  fmt->setupTargets(m_Doc, 0, 0, 0, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
-							  fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
-							  if (m_Doc->m_Selection->count() > 0)
-							  {
-								  ite = m_Doc->groupObjectsSelection();
-								  double rot = 0;
-								  if (m_style["libwpg:rotate"])
-									  rot = m_style["libwpg:rotate"]->getDouble();
-								  QPainterPath ba = Coords.toQPainterPath(true);
-								  QRectF baR = ba.boundingRect();
-								  if (rot != 0)
-								  {
-									  QTransform mm;
-									  mm.translate(baR.x(), baR.y());
-									  mm.translate(baR.width() / 2.0, baR.height() / 2.0);
-									  mm.rotate(rot);
-									  mm.translate(-baR.width() / 2.0, -baR.height() / 2.0);
-									  mm.translate(-baR.x(), -baR.y());
-									  ba = mm.map(ba);
-									  baR = ba.boundingRect();
-									  ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
-									  ite->setWidthHeight(baR.width(), baR.height(), true);
-									  Coords.fromQPainterPath(ba, true);
-									  FPoint tp2(getMinClipF(&Coords));
-									  Coords.translate(-tp2.x(), -tp2.y());
-									  ite->PoLine = Coords.copy();
-									  int rm = m_Doc->RotMode();
-									  m_Doc->RotMode(2);
-									  m_Doc->RotateItem(-rot, ite);
-									  m_Doc->RotMode(rm);
-								  }
-								  else
-								  {
-									  ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
-									  ite->setWidthHeight(baR.width(), baR.height(), true);
-									  FPoint tp2(getMinClipF(&Coords));
-									  Coords.translate(-tp2.x(), -tp2.y());
-									  ite->PoLine = Coords.copy();
-								  }
-								  finishItem(ite);
-								  if (m_style["draw:red"] && m_style["draw:green"] && m_style["draw:blue"])
-								  {
-									  int r = qRound(m_style["draw:red"]->getDouble() * 255);
-									  int g = qRound(m_style["draw:green"]->getDouble() * 255);
-									  int b = qRound(m_style["draw:blue"]->getDouble() * 255);
-									  QString colVal = QString("#%1%2%3").arg(r, 2, 16, QLatin1Char('0')).arg(g, 2, 16, QLatin1Char('0')).arg(b, 2, 16, QLatin1Char('0'));
-									  QString efVal = parseColor(colVal);
-									  recolorItem(ite, efVal);
-								  }
-							  }
-						  }
-					  }
-				  }
-				  delete tempFile;
-			  }
-		  }
-		}
-		else
-		{
-			z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColorFill, CurrColorStroke, true);
-			ite = m_Doc->Items->at(z);
-			ite->PoLine = Coords.copy();
-			finishItem(ite);
-			applyFill(ite);
-		}
-		applyFlip(ite);
-		if (CurrColorFill != CommonStrings::None)
-			applyShadow(ite);
-	}
-	else
-	{
-		z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CommonStrings::None, CurrColorStroke, true);
-		ite = m_Doc->Items->at(z);
-		ite->PoLine = Coords.copy();
-		finishItem(ite);
-	}
-}
-
-void RawPainter::drawGraphicObject(const ::WPXPropertyList &propList, const ::WPXBinaryData &binaryData)
-{
-	if (!doProcessing)
-		return;
-	if (!propList["libwpg:mime-type"] || propList["libwpg:mime-type"]->getStr().len() <= 0)
-		return;
-	WPXString base64 = binaryData.getBase64Data();
-	if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
-	{
-		PageItem *ite;
-		double x = valueAsPoint(propList["svg:x"]);
-		double y = valueAsPoint(propList["svg:y"]);
-		double w = valueAsPoint(propList["svg:width"]);
-		double h = valueAsPoint(propList["svg:height"]);
-		QByteArray ba(base64.cstr());
-		QByteArray imageData = QByteArray::fromBase64(ba);
-		QString imgExt = "";
-		if (propList["libwpg:mime-type"]->getStr() == "image/png")
-			imgExt = "png";
-		else if (propList["libwpg:mime-type"]->getStr() == "image/jpeg")
-			imgExt = "jpg";
-		else if (propList["libwpg:mime-type"]->getStr() == "image/bmp")
-			imgExt = "bmp";
-		else if (propList["libwpg:mime-type"]->getStr() == "image/pict")
-			imgExt = "pict";
-		else if (propList["libwpg:mime-type"]->getStr() == "image/tiff")
-			imgExt = "tif";
-		if (!imgExt.isEmpty())
-		{
-			int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Rectangle, baseX + x, baseY + y, w, h, 0, CurrColorFill, CurrColorStroke, true);
-			ite = m_Doc->Items->at(z);
-			finishItem(ite);
-			insertImage(ite, imgExt, imageData);
-		}
-		else
-		{
-			if (propList["libwpg:mime-type"]->getStr() == "image/wmf")
-			{
-				imgExt = "wmf";
-				QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_pub_XXXXXX." + imgExt);
-				if (tempFile->open())
-				{
-					tempFile->write(imageData);
-					QString fileName = getLongPathName(tempFile->fileName());
-					tempFile->close();
-					FileLoader *fileLoader = new FileLoader(fileName);
-					int testResult = fileLoader->testFile();
-					delete fileLoader;
-					if (testResult != -1)
-					{
-						const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
-						if( fmt )
-						{
-							fmt->setupTargets(m_Doc, 0, 0, 0, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
-							fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
-							if (m_Doc->m_Selection->count() > 0)
-							{
-								ite = m_Doc->groupObjectsSelection();
-								double rot = 0;
-								if (m_style["libwpg:rotate"])
-									rot = m_style["libwpg:rotate"]->getDouble();
-								QPainterPath ba = Coords.toQPainterPath(true);
-								QRectF baR = ba.boundingRect();
-								if (rot != 0)
-								{
-									QTransform mm;
-									mm.translate(baR.x(), baR.y());
-									mm.translate(baR.width() / 2.0, baR.height() / 2.0);
-									mm.rotate(rot);
-									mm.translate(-baR.width() / 2.0, -baR.height() / 2.0);
-									mm.translate(-baR.x(), -baR.y());
-									ba = mm.map(ba);
-									baR = ba.boundingRect();
-									ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
-									ite->setWidthHeight(baR.width(), baR.height(), true);
-									Coords.fromQPainterPath(ba, true);
-									FPoint tp2(getMinClipF(&Coords));
-									Coords.translate(-tp2.x(), -tp2.y());
-									ite->PoLine = Coords.copy();
-									int rm = m_Doc->RotMode();
-									m_Doc->RotMode(2);
-									m_Doc->RotateItem(-rot, ite);
-									m_Doc->RotMode(rm);
-								}
-								else
-								{
-									ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
-									ite->setWidthHeight(baR.width(), baR.height(), true);
-									FPoint tp2(getMinClipF(&Coords));
-									Coords.translate(-tp2.x(), -tp2.y());
-									ite->PoLine = Coords.copy();
-								}
-								finishItem(ite);
-								if (m_style["draw:red"] && m_style["draw:green"] && m_style["draw:blue"])
-								{
-									int r = qRound(m_style["draw:red"]->getDouble() * 255);
-									int g = qRound(m_style["draw:green"]->getDouble() * 255);
-									int b = qRound(m_style["draw:blue"]->getDouble() * 255);
-									QString colVal = QString("#%1%2%3").arg(r, 2, 16, QLatin1Char('0')).arg(g, 2, 16, QLatin1Char('0')).arg(b, 2, 16, QLatin1Char('0'));
-									QString efVal = parseColor(colVal);
-									recolorItem(ite, efVal);
-								}
-							}
-						}
-					}
-				}
-				delete tempFile;
-			}
-		}
-		applyFlip(ite);
-		if (CurrColorFill != CommonStrings::None)
-			applyShadow(ite);
-	}
-//	qDebug() << "drawGraphicObject";
-//  printf("RawPainter::drawGraphicObject (%s)\n", getPropString(propList).cstr());
-}
-
-void RawPainter::startTextObject(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &path)
-{
-	if (!doProcessing)
-		return;
-	actTextItem = NULL;
-	lineSpSet = false;
-	lineSpIsPT = false;
-	if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
-	{
-		double x = valueAsPoint(propList["svg:x"]);
-		double y = valueAsPoint(propList["svg:y"]);
-		double w = valueAsPoint(propList["svg:width"]);
-		double h = valueAsPoint(propList["svg:height"]);
-		double rot = 0;
-		if (propList["libwpg:rotate"])
-			rot = propList["libwpg:rotate"]->getDouble();
-		int z = m_Doc->itemAdd(PageItem::TextFrame, PageItem::Rectangle, baseX + x, baseY + y, w, h, 0, CurrColorFill, CurrColorStroke, true);
-		PageItem *ite = m_Doc->Items->at(z);
-		finishItem(ite);
-		applyShadow(ite);
-		if (rot != 0)
-		{
-			int rm = m_Doc->RotMode();
-			m_Doc->RotMode(2);
-			m_Doc->RotateItem(rot, ite);
-			m_Doc->RotMode(rm);
-		}
-		if (propList["draw-mirror-horizontal"])
-			ite->flipImageH();
-		if (propList["draw-mirror-vertical"])
-			ite->flipImageV();
-		if (propList["fo:padding-left"])
-			ite->setTextToFrameDistLeft(valueAsPoint(propList["fo:padding-left"]));
-		if (propList["fo:padding-right"])
-			ite->setTextToFrameDistRight(valueAsPoint(propList["fo:padding-right"]));
-		if (propList["fo:padding-top"])
-			ite->setTextToFrameDistTop(valueAsPoint(propList["fo:padding-top"]));
-		if (propList["fo:padding-bottom"])
-			ite->setTextToFrameDistBottom(valueAsPoint(propList["fo:padding-bottom"]));
-		if (propList["fo:column-count"])
-			ite->setColumns(propList["fo:column-count"]->getInt());
-		if (propList["fo:column-gap"])
-			ite->setColumnGap(valueAsPoint(propList["fo:column-gap"]));
-		ite->setFirstLineOffset(FLOPFontAscent);
-		actTextItem = ite;
-		QString pStyle = CommonStrings::DefaultParagraphStyle;
-		ParagraphStyle newStyle;
-		newStyle.setParent(pStyle);
-		textStyle = newStyle;
-	}
-}
-
-void RawPainter::endTextObject()
-{
-	if (!doProcessing)
-		return;
-	if (actTextItem)
-		actTextItem->itemText.trim();
-	actTextItem = NULL;
-	lineSpSet = false;
-	lineSpIsPT = false;
-}
-
-void RawPainter::startTextLine(const ::WPXPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	QString pStyle = CommonStrings::DefaultParagraphStyle;
-	ParagraphStyle newStyle;
-	newStyle.setParent(pStyle);
-	textStyle = newStyle;
-	if (propList["fo:text-align"])
-	{
-		QString align = QString(propList["fo:text-align"]->getStr().cstr());
-		if (align == "left")
-			textStyle.setAlignment(ParagraphStyle::Leftaligned);
-		else if (align == "center")
-			textStyle.setAlignment(ParagraphStyle::Centered);
-		else if (align == "right")
-			textStyle.setAlignment(ParagraphStyle::Rightaligned);
-		else if (align == "justify")
-			textStyle.setAlignment(ParagraphStyle::Justified);
-	}
-	if (propList["fo:margin-left"])
-		textStyle.setLeftMargin(valueAsPoint(propList["fo:margin-left"]));
-	if (propList["fo:margin-right"])
-		textStyle.setRightMargin(valueAsPoint(propList["fo:margin-right"]));
-	if (propList["fo:text-indent"])
-		textStyle.setFirstIndent(valueAsPoint(propList["fo:text-indent"]));
-	if (propList["style:drop-cap"])
-	{
-		textStyle.setDropCapLines(propList["style:drop-cap"]->getInt());
-		textStyle.setHasDropCap(true);
-	}
-	if (propList["fo:margin-bottom"])
-		textStyle.setGapAfter(valueAsPoint(propList["fo:margin-bottom"]));
-	if (propList["fo:margin-top"])
-		textStyle.setGapBefore(valueAsPoint(propList["fo:margin-top"]));
-//	m_maxFontSize = textStyle.charStyle().fontSize() / 10.0;
-	m_maxFontSize = 1.0;
-	if (propList["fo:line-height"])
-	{
-		m_linespace = propList["fo:line-height"]->getDouble();
-		QString lsp = QString(propList["fo:line-height"]->getStr().cstr());
-		lineSpIsPT = lsp.endsWith("pt");
-		lineSpSet = true;
-	}
-}
-
-void RawPainter::endTextLine()
-{
-	if (!doProcessing)
-		return;
-	int posT = actTextItem->itemText.length();
-	if (posT > 0)
-	{
-		if ((actTextItem->itemText.text(posT - 1) != SpecialChars::PARSEP))
-		{
-			actTextItem->itemText.insertChars(posT, SpecialChars::PARSEP);
-			actTextItem->itemText.applyStyle(posT, textStyle);
-		}
-	}
-}
-
-void RawPainter::startTextSpan(const ::WPXPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	textCharStyle = textStyle.charStyle();
-	if (propList["fo:font-size"])
-	{
-		textCharStyle.setFontSize(valueAsPoint(propList["fo:font-size"]) * 10.0);
-		m_maxFontSize = qMax(m_maxFontSize, valueAsPoint(propList["fo:font-size"]));
-	}
-	if (propList["fo:color"])
-		textCharStyle.setFillColor(parseColor(QString(propList["fo:color"]->getStr().cstr())));
-	if (propList["style:font-name"])
-	{
-		QString fontVari = "";
-		if (propList["fo:font-weight"])
-			fontVari = QString(propList["fo:font-weight"]->getStr().cstr());
-		QString fontName = QString(propList["style:font-name"]->getStr().cstr());
-		QString realFontName = constructFontName(fontName, fontVari);
-		textCharStyle.setFont((*m_Doc->AllFonts)[realFontName]);
-	}
-	StyleFlag styleEffects = textCharStyle.effects();
-	if (propList["style:text-underline-type"])
-		styleEffects |= ScStyle_Underline;
-	if (propList["style:text-position"])
-	{
-		if (propList["style:text-position"]->getStr() == "50% 67%")
-			styleEffects |= ScStyle_Superscript;
-		else
-			styleEffects |= ScStyle_Subscript;
-	}
-	textCharStyle.setFeatures(styleEffects.featureList());
-}
-
-void RawPainter::endTextSpan()
-{
-}
-
-void RawPainter::insertText(const ::WPXString &str)
-{
-	if (!doProcessing)
-		return;
-	if (lineSpSet)
-	{
-		textStyle.setLineSpacingMode(ParagraphStyle::FixedLineSpacing);
-		if (lineSpIsPT)
-			textStyle.setLineSpacing(m_linespace);
-		else
-			textStyle.setLineSpacing(m_maxFontSize * m_linespace);
-	}
-	else
-		textStyle.setLineSpacingMode(ParagraphStyle::AutomaticLineSpacing);
-	WPXString tempUTF8(str, true);
-	QString actText = QString(tempUTF8.cstr());
-	if (actTextItem)
-	{
-		int posC = actTextItem->itemText.length();
-		if (actText.count() > 0)
-		{
-			actText.replace(QChar(10), SpecialChars::LINEBREAK);
-			actText.replace(QChar(12), SpecialChars::FRAMEBREAK);
-			actText.replace(QChar(30), SpecialChars::NBHYPHEN);
-			actText.replace(QChar(160), SpecialChars::NBSPACE);
-			QTextDocument texDoc;
-			texDoc.setHtml(actText);
-			actText = texDoc.toPlainText();
-			actText = actText.trimmed();
-			actTextItem->itemText.insertChars(posC, actText);
-			actTextItem->itemText.applyStyle(posC, textStyle);
-			actTextItem->itemText.applyCharStyle(posC, actText.length(), textCharStyle);
-		}
-	}
-}
-
-double RawPainter::valueAsPoint(const WPXProperty *prop)
-{
-	double value = 0.0;
-	QString str = QString(prop->getStr().cstr()).toLower();
-	if (str.endsWith("in"))
-		value = prop->getDouble() * 72.0;
-	else
-		value = prop->getDouble();
-	return value;
-}
-
-void RawPainter::applyFill(PageItem* ite)
-{
-	if(isGradient)
-	{
-		QString gradMode = "normal";
-		if (m_style["libmspub:shade"])
-			gradMode = QString(m_style["libmspub:shade"]->getStr().cstr());
-		else if (m_style["draw:style"])
-			gradMode = QString(m_style["draw:style"]->getStr().cstr());
-		if ((gradMode == "normal") || (gradMode == "linear"))
-		{
-			int angle = 0;
-			if (m_style["draw:angle"])
-				angle = qRound(m_style["draw:angle"]->getDouble());
-			double h = ite->height();
-			double w = ite->width();
-			if (angle == 0)
-				ite->setGradientVector(w / 2.0, h, w / 2.0, 0, 0, 0, 1, 0);
-			else if (angle == -225)
-				ite->setGradientVector(w, 0, 0, h, 0, 0, 1, 0);
-			else if (angle == 45)
-				ite->setGradientVector(w, h, 0, 0, 0, 0, 1, 0);
-			else if (angle == 90)
-				ite->setGradientVector(w, h / 2.0, 0, h / 2.0, 0, 0, 1, 0);
-			else if (angle == 180)
-				ite->setGradientVector(w / 2.0, 0, w / 2.0, h, 0, 0, 1, 0);
-			else if (angle == 270)
-				ite->setGradientVector(0, h / 2.0, w, h / 2.0, 0, 0, 1, 0);
-			ite->fill_gradient = currentGradient;
-			ite->GrType = 6;
-		}
-		else if (gradMode == "radial")
-		{
-			double h = ite->height();
-			double w = ite->width();
-			double cx = 0.0;
-			double cy = 0.0;
-			if (m_style["svg:cx"])
-				cx = m_style["svg:cx"]->getDouble();
-			if (m_style["svg:cy"])
-				cy = m_style["svg:cy"]->getDouble();
-			ite->setGradientVector(cx, cy, w, h / 2.0, cx, cy, 1, 0);
-			ite->fill_gradient = currentGradient;
-			ite->GrType = 7;
-		}
-		else if (gradMode == "square")
-		{
-			double cx = 0.0;
-			double cy = 0.0;
-			if (m_style["svg:cx"])
-				cx = m_style["svg:cx"]->getDouble();
-			if (m_style["svg:cy"])
-				cy = m_style["svg:cy"]->getDouble();
-			FPoint cp = FPoint(cx, cy);
-			ite->setDiamondGeometry(FPoint(0, 0), FPoint(ite->width(), 0), FPoint(ite->width(), ite->height()), FPoint(0, ite->height()), cp);
-			ite->fill_gradient.clearStops();
-			QList<VColorStop*> colorStops = currentGradient.colorStops();
-			for( int a = 0; a < colorStops.count() ; a++ )
-			{
-				ite->fill_gradient.addStop(colorStops[a]->color, 1.0 - colorStops[a]->rampPoint, colorStops[a]->midPoint, colorStops[a]->opacity, colorStops[a]->name, colorStops[a]->shade);
-			}
-			ite->GrType = 10;
-		}
-		else if (gradMode == "center")
-		{
-			QString center = "top-left";
-			FPoint cp = FPoint(0, 0);
-			if (m_style["libmspub:shade-ref-point"])
-				center = QString(m_style["libmspub:shade-ref-point"]->getStr().cstr());
-			if (center == "top-left")
-				cp = FPoint(0, 0);
-			else if (center == "top-right")
-				cp = FPoint(ite->width(), 0);
-			else if (center == "bottom-left")
-				cp = FPoint(0, ite->height());
-			else if (center == "bottom-right")
-				cp = FPoint(ite->width(), ite->height());
-			ite->setDiamondGeometry(FPoint(0, 0), FPoint(ite->width(), 0), FPoint(ite->width(), ite->height()), FPoint(0, ite->height()), cp);
-			ite->fill_gradient.clearStops();
-			QList<VColorStop*> colorStops = currentGradient.colorStops();
-			for( int a = 0; a < colorStops.count() ; a++ )
-			{
-				ite->fill_gradient.addStop(colorStops[a]->color, 1.0 - colorStops[a]->rampPoint, colorStops[a]->midPoint, colorStops[a]->opacity, colorStops[a]->name, colorStops[a]->shade);
-			}
-			ite->GrType = 10;
-		}
-		else if (gradMode == "shape")
-		{
-			ite->meshGradientPatches.clear();
-			FPoint center = FPoint(ite->width() / 2.0, ite->height() / 2.0);
-			meshPoint cP;
-			cP.resetTo(center);
-			cP.transparency = gradColor2Trans;
-			cP.shade = 100;
-			cP.colorName = gradColor2Str;
-			cP.color = gradColor2;
-			for (int poi = 0; poi < ite->PoLine.size()-3; poi += 4)
-			{
-				meshGradientPatch patch;
-				patch.BL = cP;
-				patch.BR = cP;
-				if (ite->PoLine.isMarker(poi))
-					continue;
-				meshPoint tL;
-				tL.resetTo(ite->PoLine.point(poi));
-				tL.controlRight = ite->PoLine.point(poi + 1);
-				tL.transparency = gradColor1Trans;
-				tL.shade = 100;
-				tL.colorName = gradColor1Str;
-				tL.color = gradColor1;
-				meshPoint tR;
-				tR.resetTo(ite->PoLine.point(poi + 2));
-				tR.controlLeft = ite->PoLine.point(poi + 3);
-				tR.transparency = gradColor1Trans;
-				tR.shade = 100;
-				tR.colorName = gradColor1Str;
-				tR.color = gradColor1;
-				patch.TL = tL;
-				patch.TR = tR;
-				ite->meshGradientPatches.append(patch);
-			}
-			ite->GrType = 12;
-		}
-	}
-	if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "bitmap")
-	{
-		QByteArray ba(m_style["draw:fill-image"]->getStr().cstr());
-		QByteArray imageData = QByteArray::fromBase64(ba);
-		QString imgExt = "";
-		if (m_style["libwpg:mime-type"]->getStr() == "image/png")
-			imgExt = "png";
-		else if (m_style["libwpg:mime-type"]->getStr() == "image/jpeg")
-			imgExt = "jpg";
-		else if (m_style["libwpg:mime-type"]->getStr() == "image/bmp")
-			imgExt = "bmp";
-		else if (m_style["libwpg:mime-type"]->getStr() == "image/pict")
-			imgExt = "pict";
-		else if (m_style["libwpg:mime-type"]->getStr() == "image/tiff")
-			imgExt = "tif";
-		if (!imgExt.isEmpty())
-		{
-			QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_pub_XXXXXX." + imgExt);
-			tempFile->setAutoRemove(false);
-			if (tempFile->open())
-			{
-				tempFile->write(imageData);
-				QString fileName = getLongPathName(tempFile->fileName());
-				tempFile->close();
-				ScPattern pat = ScPattern();
-				pat.setDoc(m_Doc);
-				int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None, true);
-				PageItem* newItem = m_Doc->Items->at(z);
-				if (m_style["draw:red"] && m_style["draw:green"] && m_style["draw:blue"])
-				{
-					int r = qRound(m_style["draw:red"]->getDouble() * 255);
-					int g = qRound(m_style["draw:green"]->getDouble() * 255);
-					int b = qRound(m_style["draw:blue"]->getDouble() * 255);
-					QString colVal = QString("#%1%2%3").arg(r, 2, 16, QLatin1Char('0')).arg(g, 2, 16, QLatin1Char('0')).arg(b, 2, 16, QLatin1Char('0'));
-					QString efVal = parseColor(colVal);
-					efVal += "\n";
-					struct ImageEffect ef;
-					efVal += "100";
-					ef.effectCode = ScImage::EF_COLORIZE;
-					ef.effectParameters = efVal;
-					ite->effectsInUse.append(ef);
-				}
-				m_Doc->loadPict(fileName, newItem);
-				m_Doc->Items->takeAt(z);
-				newItem->isInlineImage = true;
-				newItem->isTempFile = true;
-				pat.width = newItem->pixm.qImage().width();
-				pat.height = newItem->pixm.qImage().height();
-				pat.scaleX = (72.0 / newItem->pixm.imgInfo.xres) * newItem->pixm.imgInfo.lowResScale;
-				pat.scaleY = (72.0 / newItem->pixm.imgInfo.xres) * newItem->pixm.imgInfo.lowResScale;
-				pat.pattern = newItem->pixm.qImage().copy();
-				newItem->setWidth(pat.pattern.width());
-				newItem->setHeight(pat.pattern.height());
-				newItem->SetRectFrame();
-				newItem->gXpos = 0.0;
-				newItem->gYpos = 0.0;
-				newItem->gWidth = pat.pattern.width();
-				newItem->gHeight = pat.pattern.height();
-				pat.items.append(newItem);
-				QString patternName = "Pattern_"+ite->itemName();
-				patternName = patternName.trimmed().simplified().replace(" ", "_");
-				m_Doc->addPattern(patternName, pat);
-				importedPatterns->append(patternName);
-				ite->setPattern(patternName);
-				ite->GrType = 8;
-			}
-			delete tempFile;
-		}
-	}
-}
-#endif
-
-QString RawPainter::constructFontName(QString fontBaseName, QString fontStyle)
-{
-	QString fontName = "";
-	bool found = false;
-	SCFontsIterator it(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts);
-	for ( ; it.hasNext(); it.next())
-	{
-		if (fontBaseName.toLower() == it.current().family().toLower())
-		{
-			// found the font family, now go for the style
-			QStringList slist = PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts.fontMap[it.current().family()];
-			slist.sort();
-			if (slist.count() > 0)
-			{
-				for (int a = 0; a < slist.count(); a++)
-				{
-					if (fontStyle.toLower() == slist[a].toLower())
-					{
-						found = true;
-						fontName = it.current().family() + " " + slist[a];
-						break;
-					}
-				}
-				if (!found)
-				{
-					int reInd = slist.indexOf("Regular");
-					if (reInd < 0)
-						fontName = it.current().family() + " " + slist[0];
-					else
-						fontName = it.current().family() + " " + slist[reInd];
-					found = true;
-				}
-			}
-			else
-			{
-				fontName = it.current().family();
-				found = true;
-			}
-			break;
-		}
-	}
-	if (!found)
-	{
-		if (importerFlags & LoadSavePlugin::lfCreateThumbnail)
-			fontName = PrefsManager::instance()->appPrefs.itemToolPrefs.textFont;
-		else
-		{
-			QString family = fontBaseName;
-			if (!fontStyle.isEmpty())
-				family += " " + fontStyle;
-			if (!PrefsManager::instance()->appPrefs.fontPrefs.GFontSub.contains(family))
-			{
-				qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
-				MissingFont *dia = new MissingFont(0, family, m_Doc);
-				dia->exec();
-				fontName = dia->getReplacementFont();
-				delete dia;
-				qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
-				PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[family] = fontName;
-			}
-			else
-				fontName = PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[family];
-		}
-	}
-	return fontName;
-}
-
-double RawPainter::fromPercentage( const QString &s )
-{
-	QString s1 = s;
-	if (s1.endsWith( ";" ))
-		s1.chop(1);
-	if (s1.endsWith( "%" ))
-	{
-		s1.chop(1);
-		return ScCLocale::toDoubleC(s1) / 100.0;
-	}
-	else
-		return ScCLocale::toDoubleC(s1);
-}
-
-QColor RawPainter::parseColorN( const QString &rgbColor )
-{
-	int r, g, b;
-	keywordToRGB( rgbColor.toLower(), r, g, b );
-	return QColor( r, g, b );
-}
-
-QString RawPainter::parseColor( const QString &s )
-{
-	QColor c;
-	QString ret = CommonStrings::None;
-	if (s.startsWith( "rgb(" ) )
-	{
-		QString parse = s.trimmed();
-		QStringList colors = parse.split(',', QString::SkipEmptyParts);
-		QString r = colors[0].right( ( colors[0].length() - 4 ) );
-		QString g = colors[1];
-		QString b = colors[2].left( ( colors[2].length() - 1 ) );
-		if (r.contains( "%" ))
-		{
-			r.chop(1);
-			r = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(r) ) / 100.0 ) ) );
-		}
-		if (g.contains( "%" ))
-		{
-			g.chop(1);
-			g = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(g) ) / 100.0 ) ) );
-		}
-		if (b.contains( "%" ))
-		{
-			b.chop(1);
-			b = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(b) ) / 100.0 ) ) );
-		}
-		c = QColor(r.toInt(), g.toInt(), b.toInt());
-	}
-	else
-	{
-		QString rgbColor = s.trimmed();
-		if (rgbColor.startsWith( "#" ))
-		{
-			rgbColor = rgbColor.left(7);
-			c.setNamedColor( rgbColor );
-		}
-		else
-			c = parseColorN( rgbColor );
-	}
-	ScColor tmp;
-	tmp.fromQColor(c);
-	tmp.setSpotColor(false);
-	tmp.setRegistrationColor(false);
-	QString newColorName = "FromPUB"+c.name();
-	QString fNam = m_Doc->PageColors.tryAddColor(newColorName, tmp);
-	if (fNam == newColorName)
-		importedColors->append(newColorName);
-	ret = fNam;
-	return ret;
-}
-
-void RawPainter::insertImage(PageItem* ite, QString imgExt, QByteArray &imageData)
-{
-	QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_pub_XXXXXX." + imgExt);
-	tempFile->setAutoRemove(false);
-	if (tempFile->open())
-	{
-		tempFile->write(imageData);
-		QString fileName = getLongPathName(tempFile->fileName());
-		tempFile->close();
-		ite->isTempFile = true;
-		ite->isInlineImage = true;
-		if (m_style["draw:red"] && m_style["draw:green"] && m_style["draw:blue"])
-		{
-			int r = qRound(m_style["draw:red"]->getDouble() * 255);
-			int g = qRound(m_style["draw:green"]->getDouble() * 255);
-			int b = qRound(m_style["draw:blue"]->getDouble() * 255);
-			QString colVal = QString("#%1%2%3").arg(r, 2, 16, QLatin1Char('0')).arg(g, 2, 16, QLatin1Char('0')).arg(b, 2, 16, QLatin1Char('0'));
-			QString efVal = parseColor(colVal);
-			efVal += "\n";
-			struct ImageEffect ef;
-			efVal += "100";
-			ef.effectCode = ScImage::EF_COLORIZE;
-			ef.effectParameters = efVal;
-			ite->effectsInUse.append(ef);
-		}
-		if (m_style["draw:luminance"])
-		{
-			double per = m_style["draw:luminance"]->getDouble();
-			struct ImageEffect ef;
-			ef.effectCode = ScImage::EF_BRIGHTNESS;
-			ef.effectParameters = QString("%1").arg(qRound((per - 0.5) * 255));
-			ite->effectsInUse.append(ef);
-		}
-		m_Doc->loadPict(fileName, ite);
-#if HAVE_REVENGE
-		if (m_style["librevenge:rotate"])
-		{
-			int rot = QString(m_style["librevenge:rotate"]->getStr().cstr()).toInt();
-			ite->setImageRotation(rot);
-			ite->AdjustPictScale();
-		}
-#else
-		if (m_style["libwpg:rotate"])
-		{
-			int rot = QString(m_style["libwpg:rotate"]->getStr().cstr()).toInt();
-			ite->setImageRotation(rot);
-			ite->AdjustPictScale();
-		}
-#endif
-	}
-	delete tempFile;
-}
-
-void RawPainter::applyShadow(PageItem* ite)
-{
-	if (ite == NULL)
-		return;
-	if(m_style["draw:shadow"] && m_style["draw:shadow"]->getStr() == "visible")
-	{
-		double xof = 0.0;
-		double yof = 0.0;
-		if (m_style["draw:shadow-offset-x"])
-			xof = valueAsPoint(m_style["draw:shadow-offset-x"]);
-		if (m_style["draw:shadow-offset-y"])
-			yof = valueAsPoint(m_style["draw:shadow-offset-y"]);
-		QString shadowColor = CurrColorFill;
-		double shadowTrans = 1.0;
-		if (m_style["draw:shadow-color"])
-		{
-			shadowColor = parseColor(QString(m_style["draw:shadow-color"]->getStr().cstr()));
-			if(m_style["draw:shadow-opacity"])
-				shadowTrans = 1.0 - qMin(1.0, qMax(fromPercentage(QString(m_style["draw:shadow-opacity"]->getStr().cstr())), 0.0));
-		}
-		ite->setHasSoftShadow(true);
-		ite->setSoftShadowColor(shadowColor);
-		ite->setSoftShadowXOffset(xof);
-		ite->setSoftShadowYOffset(yof);
-		ite->setSoftShadowBlurRadius(5);
-		ite->setSoftShadowShade(100);
-		ite->setSoftShadowOpacity(shadowTrans);
-		ite->setSoftShadowBlendMode(0);
-
-	}
-}
-
-void RawPainter::applyFlip(PageItem* ite)
-{
-	if (m_style["draw:mirror-horizontal"])
-	{
-		ite->setImageFlippedH(true);
-	}
-	if (m_style["draw:mirror-vertical"])
-	{
-		ite->setImageFlippedV(true);
-	}
-}
-
-void RawPainter::recolorItem(PageItem* ite, QString efVal)
-{
-	if (ite->itemType() != PageItem::Group)
-	{
-		if (ite->fillColor() != CommonStrings::None)
-		{
-			QColor fill = ScColorEngine::getShadeColorProof(m_Doc->PageColors[ite->fillColor()], m_Doc, ite->fillShade());
-			double k = 100.0 - qMin((0.3 * fill.redF() + 0.59 * fill.greenF() + 0.11 * fill.blueF()) * 100.0, 100.0);
-			ite->setFillColor(efVal);
-			ite->setFillShade(k);
-		}
-		if (ite->lineColor() != CommonStrings::None)
-		{
-			QColor line = ScColorEngine::getShadeColorProof(m_Doc->PageColors[ite->lineColor()], m_Doc, ite->lineShade());
-			double k2 = 100.0 - qMin((0.3 * line.redF() + 0.59 * line.greenF() + 0.11 * line.blueF()) * 100.0, 100.0);
-			ite->setLineColor(efVal);
-			ite->setLineShade(k2);
-		}
-	}
-	else
-	{
-		PageItem* grItem = ite->asGroupFrame();
-		for (int a = 0; a < grItem->groupItemList.count(); a++)
-		{
-			ite = grItem->groupItemList[a];
-			recolorItem(ite, efVal);
-		}
-	}
-}
-
-void RawPainter::finishItem(PageItem* ite)
-{
-	ite->ClipEdited = true;
-	ite->FrameType = 3;
-	ite->setFillShade(CurrFillShade);
-	ite->setFillEvenOdd(fillrule);
-	ite->setLineShade(CurrStrokeShade);
-	ite->setLineJoin(lineJoin);
-	ite->setLineEnd(lineEnd);
-	if (dashArray.count() > 0)
-	{
-		ite->DashValues = dashArray;
-	}
-	FPoint wh = getMaxClipF(&ite->PoLine);
-	ite->setWidthHeight(wh.x(),wh.y(), true);
-	ite->setTextFlowMode(PageItem::TextFlowUsesBoundingBox);
-	m_Doc->AdjustItemSize(ite);
-	ite->OldB2 = ite->width();
-	ite->OldH2 = ite->height();
-	ite->setFillTransparency(CurrFillTrans);
-	ite->setLineTransparency(CurrStrokeTrans);
-	ite->updateClip();
-	Elements->append(ite);
-	if (groupStack.count() != 0)
-		groupStack.top().Items.append(ite);
-	Coords.resize(0);
-	Coords.svgInit();
-}
 
 PubPlug::PubPlug(ScribusDoc* doc, int flags)
 {
@@ -3240,8 +346,12 @@
 		qDebug() << "ERROR: Unsupported file format!";
 		return false;
 	}
-	RawPainter painter(m_Doc, baseX, baseY, docWidth, docHeight, importerFlags, &Elements, &importedColors, &importedPatterns, tmpSel);
-	libmspub::MSPUBDocument::parse(&input, &painter);
+	RawPainter painter(m_Doc, baseX, baseY, docWidth, docHeight, importerFlags, &Elements, &importedColors, &importedPatterns, tmpSel, "pub");
+	if (!libmspub::MSPUBDocument::parse(&input, &painter))
+	{
+		qDebug() << "ERROR: Parsing failed!";
+		return false;
+	}
 	if (Elements.count() == 0)
 	{
 		if (importedColors.count() != 0)

Modified: trunk/Scribus/scribus/plugins/import/pub/importpub.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19235&path=/trunk/Scribus/scribus/plugins/import/pub/importpub.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pub/importpub.h (original)
+++ trunk/Scribus/scribus/plugins/import/pub/importpub.h Sun Jun 15 09:41:06 2014
@@ -4,8 +4,8 @@
 a copyright and/or license notice that predates the release of Scribus 1.3.2
 for which a new license (GPL+exception) is in place.
 */
-#ifndef IMPORTWPG_H
-#define IMPORTWPG_H
+#ifndef IMPORTPUB_H
+#define IMPORTPUB_H
 
 #include <QObject>
 #include <QString>
@@ -24,238 +24,6 @@
 class ScribusDoc;
 class Selection;
 class TransactionSettings;
-
-#if HAVE_REVENGE
-	#include <librevenge/librevenge.h>
-	#include <librevenge-stream/librevenge-stream.h>
-	#include <librevenge-generators/librevenge-generators.h>
-	#include <libmspub/libmspub.h>
-
-struct RawPainterPrivate;
-
-class RawPainter : public librevenge::RVNGDrawingInterface
-{
-public:
-	RawPainter(ScribusDoc* Doc, double x, double y, double w, double h, int iflags, QList<PageItem*> *Elem, QStringList *iColors, QStringList *iPatterns, Selection* tSel);
-	~RawPainter();
-
-	void startDocument(const librevenge::RVNGPropertyList &propList);
-	void endDocument();
-	void setDocumentMetaData(const librevenge::RVNGPropertyList &propList);
-	void defineEmbeddedFont(const librevenge::RVNGPropertyList &propList);
-	void startPage(const librevenge::RVNGPropertyList &propList);
-	void endPage();
-	void startMasterPage(const librevenge::RVNGPropertyList &propList);
-	void endMasterPage();
-	void startLayer(const librevenge::RVNGPropertyList &propList);
-	void endLayer();
-	void startEmbeddedGraphics(const librevenge::RVNGPropertyList &propList);
-	void endEmbeddedGraphics();
-
-	void openGroup(const librevenge::RVNGPropertyList &propList);
-	void closeGroup();
-
-	void setStyle(const librevenge::RVNGPropertyList &propList);
-
-	void drawRectangle(const librevenge::RVNGPropertyList &propList);
-	void drawEllipse(const librevenge::RVNGPropertyList &propList);
-	void drawPolyline(const librevenge::RVNGPropertyList &propList);
-	void drawPolygon(const librevenge::RVNGPropertyList &propList);
-	void drawPath(const librevenge::RVNGPropertyList &propList);
-	void drawGraphicObject(const librevenge::RVNGPropertyList &propList);
-	void drawConnector(const librevenge::RVNGPropertyList &propList);
-	void startTextObject(const librevenge::RVNGPropertyList &propList);
-	void endTextObject();
-
-	void startTableObject(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 endTableObject();
-
-	void openOrderedListLevel(const librevenge::RVNGPropertyList &propList);
-	void closeOrderedListLevel();
-
-	void openUnorderedListLevel(const librevenge::RVNGPropertyList &propList);
-	void closeUnorderedListLevel();
-	void openListElement(const librevenge::RVNGPropertyList &propList);
-	void closeListElement();
-
-	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 insertTab();
-	void insertSpace();
-	void insertText(const librevenge::RVNGString &text);
-	void insertLineBreak();
-	void insertField(const librevenge::RVNGPropertyList &propList);
-	double valueAsPoint(const librevenge::RVNGProperty *prop);
-	QString constructFontName(QString fontBaseName, QString fontStyle);
-	double fromPercentage(const QString &s );
-	QColor  parseColorN( const QString &rgbColor );
-	QString parseColor( const QString &s );
-	void insertImage(PageItem* ite, QString imgExt, QByteArray &imageData);
-	void applyFill(PageItem* ite);
-	void applyShadow(PageItem* ite);
-	void applyFlip(PageItem* ite);
-	void recolorItem(PageItem* ite, QString efVal);
-	void finishItem(PageItem* ite);
-private:
-	RawPainterPrivate *m_pImpl;
-	ScribusDoc* m_Doc;
-	double baseX, baseY;
-	double docWidth;
-	double docHeight;
-	QList<PageItem*> *Elements;
-	QStringList *importedColors;
-	QStringList *importedPatterns;
-	Selection* tmpSel;
-	struct groupEntry
-	{
-		QList<PageItem*> Items;
-		FPointArray clip;
-	};
-	QStack<groupEntry> groupStack;
-	double LineW;
-	QString CurrColorFill;
-	QString CurrColorStroke;
-	double CurrStrokeShade;
-	double CurrFillShade;
-	double CurrStrokeTrans;
-	double CurrFillTrans;
-	FPointArray Coords;
-	bool fillrule;
-	double gradientAngle;
-	bool isGradient;
-	VGradient currentGradient;
-	QString gradColor1Str;
-	QColor gradColor1;
-	double gradColor1Trans;
-	QString gradColor2Str;
-	QColor gradColor2;
-	double gradColor2Trans;
-	QVector<double> dashArray;
-	Qt::PenJoinStyle lineJoin;
-	Qt::PenCapStyle lineEnd;
-	bool firstPage;
-	QString baseLayer;
-	int actPage;
-	librevenge::RVNGPropertyList m_style;
-	PageItem *actTextItem;
-	ParagraphStyle textStyle;
-	CharStyle textCharStyle;
-	double m_linespace;
-	double m_maxFontSize;
-	bool lineSpSet;
-	bool lineSpIsPT;
-	int importerFlags;
-	bool doProcessing;
-
-};
-
-#else
-	#include <libwpd-stream/libwpd-stream.h>
-	#include <libwpd/libwpd.h>
-	#include <libwpg/libwpg.h>
-	#include <libmspub/libmspub.h>
-
-
-class RawPainter : public libwpg::WPGPaintInterface
-{
-public:
-	RawPainter(ScribusDoc* Doc, double x, double y, double w, double h, int iflags, QList<PageItem*> *Elem, QStringList *iColors, QStringList *iPatterns, Selection* tSel);
-	void startGraphics(const ::WPXPropertyList &propList);
-	void endGraphics();
-	void startLayer(const ::WPXPropertyList &propList);
-	void endLayer();
-	void startEmbeddedGraphics(const ::WPXPropertyList &propList);
-	void endEmbeddedGraphics();
-	void setStyle(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &gradient);
-	void drawRectangle(const ::WPXPropertyList &propList);
-	void drawEllipse(const ::WPXPropertyList &propList);
-	void drawPolyline(const ::WPXPropertyListVector &vertices);
-	void drawPolygon(const ::WPXPropertyListVector &vertices);
-	void drawPath(const ::WPXPropertyListVector &path);
-	void drawGraphicObject(const ::WPXPropertyList &propList, const ::WPXBinaryData &binaryData);
-	void startTextObject(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &path);
-	void endTextObject();
-	void startTextLine(const ::WPXPropertyList &propList);
-	void endTextLine();
-	void startTextSpan(const ::WPXPropertyList &propList);
-	void endTextSpan();
-	void insertText(const ::WPXString &str);
-	QString constructFontName(QString fontBaseName, QString fontStyle);
-	double valueAsPoint(const WPXProperty *prop);
-	double fromPercentage(const QString &s );
-	QColor  parseColorN( const QString &rgbColor );
-	QString parseColor( const QString &s );
-	void insertImage(PageItem* ite, QString imgExt, QByteArray &imageData);
-	void applyFill(PageItem* ite);
-	void applyShadow(PageItem* ite);
-	void applyFlip(PageItem* ite);
-	void recolorItem(PageItem* ite, QString efVal);
-	void finishItem(PageItem* ite);
-
-	ScribusDoc* m_Doc;
-	Selection* tmpSel;
-	QList<PageItem*> *Elements;
-	struct groupEntry
-	{
-		QList<PageItem*> Items;
-		FPointArray clip;
-	};
-	QStack<groupEntry> groupStack;
-	QStringList *importedColors;
-	QStringList *importedPatterns;
-	double LineW;
-	QString CurrColorFill;
-	QString CurrColorStroke;
-	double CurrStrokeShade;
-	double CurrFillShade;
-	double CurrStrokeTrans;
-	double CurrFillTrans;
-	FPointArray Coords;
-	bool fillrule;
-	double gradientAngle;
-	bool isGradient;
-	VGradient currentGradient;
-	QString gradColor1Str;
-	QColor gradColor1;
-	double gradColor1Trans;
-	QString gradColor2Str;
-	QColor gradColor2;
-	double gradColor2Trans;
-	QVector<double> dashArray;
-	Qt::PenJoinStyle lineJoin;
-	Qt::PenCapStyle lineEnd;
-	double baseX, baseY;
-	double docWidth;
-	double docHeight;
-	int importerFlags;
-	bool firstPage;
-	QString baseLayer;
-	int actPage;
-	WPXPropertyList m_style;
-	PageItem *actTextItem;
-	ParagraphStyle textStyle;
-	CharStyle textCharStyle;
-	double m_linespace;
-	double m_maxFontSize;
-	bool lineSpSet;
-	bool lineSpIsPT;
-	bool doProcessing;
-};
-#endif
 
 //! \brief PUB importer plugin
 class PubPlug : public QObject

Modified: trunk/Scribus/scribus/plugins/import/vsd/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19235&path=/trunk/Scribus/scribus/plugins/import/vsd/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/plugins/import/vsd/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/plugins/import/vsd/CMakeLists.txt Sun Jun 15 09:41:06 2014
@@ -1,22 +1,38 @@
 INCLUDE(FindPkgConfig)
-pkg_check_modules(LIBWPG libwpg-0.2)
-IF (LIBWPG_FOUND)
-	pkg_check_modules(LIBWPD libwpd-0.9)
-	IF (LIBWPD_FOUND)
-		pkg_check_modules(LIBWPD_STREAM libwpd-stream-0.9)
-		IF (LIBWPD_STREAM_FOUND)
-			pkg_check_modules(LIBVISIO libvisio-0.0)
-			IF (LIBVISIO_FOUND)
-				INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/scribus ${LIBWPG_INCLUDE_DIRS} ${LIBWPD_INCLUDE_DIRS} ${LIBWPD_STREAM_INCLUDE_DIRS} ${LIBVISIO_INCLUDE_DIRS})
-				SET(IMPORTVSD_PLUGIN_MOC_CLASSES importvsd.h importvsdplugin.h)
-				SET(IMPORTVSD_PLUGIN_SOURCES importvsd.cpp importvsdplugin.cpp)
-				SET(SCRIBUS_IMPORTVSD_PLUGIN "importvsd")
-				QT5_WRAP_CPP(IMPORTVSD_PLUGIN_MOC_SOURCES ${IMPORTVSD_PLUGIN_MOC_CLASSES})
-				ADD_LIBRARY(${SCRIBUS_IMPORTVSD_PLUGIN} MODULE ${IMPORTVSD_PLUGIN_SOURCES} ${IMPORTVSD_PLUGIN_MOC_SOURCES})
-				TARGET_LINK_LIBRARIES(${SCRIBUS_IMPORTVSD_PLUGIN} ${PLUGIN_LIBRARIES} ${LIBWPG_LDFLAGS} ${LIBWPD_LDFLAGS} ${LIBWPD_STREAM_LDFLAGS} ${LIBVISIO_LDFLAGS})
-				INSTALL(TARGETS ${SCRIBUS_IMPORTVSD_PLUGIN} LIBRARY DESTINATION ${PLUGINDIR} PERMISSIONS ${PLUGIN_PERMISSIONS})
-				ADD_DEPENDENCIES(${SCRIBUS_IMPORTVSD_PLUGIN} ${EXE_NAME})
-			ENDIF (LIBVISIO_FOUND)
-		ENDIF (LIBWPD_STREAM_FOUND)
-	ENDIF (LIBWPD_FOUND)
-ENDIF (LIBWPG_FOUND)
+IF (HAVE_REVENGE)
+	pkg_check_modules(LIBVISIO libvisio-0.1)
+	IF (LIBVISIO_FOUND)
+		MESSAGE("Building MS-Visio Importer with librevenge")
+		INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/scribus ${LIBREVENGE_INCLUDE_DIRS} ${LIBREVENGE_GENERATORS_INCLUDE_DIRS} ${LIBREVENGE_STREAM_INCLUDE_DIRS} ${LIBVISIO_INCLUDE_DIRS})
+		SET(IMPORTVSD_PLUGIN_MOC_CLASSES importvsd.h importvsdplugin.h)
+		SET(IMPORTVSD_PLUGIN_SOURCES ../revenge/rawpainter.cpp importvsd.cpp importvsdplugin.cpp)
+		SET(SCRIBUS_IMPORTVSD_PLUGIN "importvsd")
+		QT5_WRAP_CPP(IMPORTVSD_PLUGIN_MOC_SOURCES ${IMPORTVSD_PLUGIN_MOC_CLASSES})
+		ADD_LIBRARY(${SCRIBUS_IMPORTVSD_PLUGIN} MODULE ${IMPORTVSD_PLUGIN_SOURCES} ${IMPORTVSD_PLUGIN_MOC_SOURCES})
+		TARGET_LINK_LIBRARIES(${SCRIBUS_IMPORTVSD_PLUGIN} ${PLUGIN_LIBRARIES} ${LIBREVENGE_LDFLAGS} ${LIBREVENGE_GENERATORS_LDFLAGS} ${LIBREVENGE_STREAM_LDFLAGS} ${LIBVISIO_LDFLAGS})
+		INSTALL(TARGETS ${SCRIBUS_IMPORTVSD_PLUGIN} LIBRARY DESTINATION ${PLUGINDIR} PERMISSIONS ${PLUGIN_PERMISSIONS})
+		ADD_DEPENDENCIES(${SCRIBUS_IMPORTVSD_PLUGIN} ${EXE_NAME})
+	ENDIF (LIBVISIO_FOUND)
+ELSE (HAVE_REVENGE)
+	pkg_check_modules(LIBWPG libwpg-0.2)
+	IF (LIBWPG_FOUND)
+		pkg_check_modules(LIBWPD libwpd-0.9)
+		IF (LIBWPD_FOUND)
+			pkg_check_modules(LIBWPD_STREAM libwpd-stream-0.9)
+			IF (LIBWPD_STREAM_FOUND)
+				pkg_check_modules(LIBVISIO libvisio-0.0)
+				IF (LIBVISIO_FOUND)
+					INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/scribus ${LIBWPG_INCLUDE_DIRS} ${LIBWPD_INCLUDE_DIRS} ${LIBWPD_STREAM_INCLUDE_DIRS} ${LIBVISIO_INCLUDE_DIRS})
+					SET(IMPORTVSD_PLUGIN_MOC_CLASSES importvsd.h importvsdplugin.h)
+					SET(IMPORTVSD_PLUGIN_SOURCES ../revenge/rawpainter.cpp importvsd.cpp importvsdplugin.cpp)
+					SET(SCRIBUS_IMPORTVSD_PLUGIN "importvsd")
+					QT5_WRAP_CPP(IMPORTVSD_PLUGIN_MOC_SOURCES ${IMPORTVSD_PLUGIN_MOC_CLASSES})
+					ADD_LIBRARY(${SCRIBUS_IMPORTVSD_PLUGIN} MODULE ${IMPORTVSD_PLUGIN_SOURCES} ${IMPORTVSD_PLUGIN_MOC_SOURCES})
+					TARGET_LINK_LIBRARIES(${SCRIBUS_IMPORTVSD_PLUGIN} ${PLUGIN_LIBRARIES} ${LIBWPG_LDFLAGS} ${LIBWPD_LDFLAGS} ${LIBWPD_STREAM_LDFLAGS} ${LIBVISIO_LDFLAGS})
+					INSTALL(TARGETS ${SCRIBUS_IMPORTVSD_PLUGIN} LIBRARY DESTINATION ${PLUGINDIR} PERMISSIONS ${PLUGIN_PERMISSIONS})
+					ADD_DEPENDENCIES(${SCRIBUS_IMPORTVSD_PLUGIN} ${EXE_NAME})
+				ENDIF (LIBVISIO_FOUND)
+			ENDIF (LIBWPD_STREAM_FOUND)
+		ENDIF (LIBWPD_FOUND)
+	ENDIF (LIBWPG_FOUND)
+ENDIF (HAVE_REVENGE)

Modified: trunk/Scribus/scribus/plugins/import/vsd/importvsd.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19235&path=/trunk/Scribus/scribus/plugins/import/vsd/importvsd.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/vsd/importvsd.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/vsd/importvsd.cpp Sun Jun 15 09:41:06 2014
@@ -19,8 +19,9 @@
 #include <cstdlib>
 
 #include "importvsd.h"
-
-#include "color.h"
+#include "../revenge/rawpainter.h"
+#include <libvisio/libvisio.h>
+
 #include "commonstrings.h"
 #include "fileloader.h"
 #include "loadsaveplugin.h"
@@ -55,1401 +56,6 @@
 
 
 extern SCRIBUS_API ScribusQApp * ScQApp;
-
-RawVsdPainter::RawVsdPainter(): libwpg::WPGPaintInterface()
-{
-	CurrColorFill = "Black";
-	CurrFillShade = 100.0;
-	CurrColorStroke = "Black";
-	CurrStrokeShade = 100.0;
-	CurrStrokeTrans = 0.0;
-	CurrFillTrans = 0.0;
-	Coords.resize(0);
-	Coords.svgInit();
-	LineW = 1.0;
-	lineJoin = Qt::MiterJoin;
-	lineEnd = Qt::FlatCap;
-	fillrule = true;
-	gradientAngle = 0.0;
-	isGradient = false;
-	lineSpSet = false;
-	currentGradient = VGradient(VGradient::linear);
-	currentGradient.clearStops();
-	currentGradient.setRepeatMethod( VGradient::none );
-	dashArray.clear();
-	firstPage = true;
-	actPage = 0;
-	actTextItem = NULL;
-	doProcessing = true;
-}
-
-void RawVsdPainter::startGraphics(const ::WPXPropertyList &propList)
-{
-	if (propList["svg:width"])
-		docWidth = valueAsPoint(propList["svg:width"]);
-	if (propList["svg:height"])
-		docHeight = valueAsPoint(propList["svg:height"]);
-	if (importerFlags & LoadSavePlugin::lfCreateDoc)
-	{
-		if (!firstPage)
-		{
-			m_Doc->addPage(actPage);
-			m_Doc->setActiveLayer(baseLayer);
-		}
-		else
-			baseLayer = m_Doc->activeLayerName();
-		m_Doc->setPageSize("Custom");
-		m_Doc->currentPage()->setInitialWidth(docWidth);
-		m_Doc->currentPage()->setInitialHeight(docHeight);
-		m_Doc->currentPage()->setWidth(docWidth);
-		m_Doc->currentPage()->setHeight(docHeight);
-		m_Doc->currentPage()->MPageNam = CommonStrings::trMasterPageNormal;
-		m_Doc->currentPage()->m_pageSize = "Custom";
-		m_Doc->reformPages(true);
-		baseX = m_Doc->currentPage()->xOffset();
-		baseY = m_Doc->currentPage()->yOffset();
-	}
-	firstPage = false;
-	actPage++;
-}
-
-void RawVsdPainter::endGraphics()
-{
-	if (importerFlags & LoadSavePlugin::lfCreateThumbnail)
-		doProcessing = false;
-//	qDebug() << "endGraphics";
-//  printf("RawPainter::endGraphics\n");
-}
-
-void RawVsdPainter::startLayer(const ::WPXPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	FPointArray clip;
-	if (propList["svg:clip-path"])
-	{
-		QString svgString = QString(propList["svg:clip-path"]->getStr().cstr());
-		clip.resize(0);
-		clip.svgInit();
-		svgString.replace(",", ".");
-		clip.parseSVG(svgString);
-		QTransform m;
-		m.scale(72.0, 72.0);
-		clip.map(m);
-	}
-	QList<PageItem*> gElements;
-	groupEntry gr;
-	gr.clip = clip.copy();
-	gr.Items = gElements;
-	groupStack.push(gr);
-}
-
-void RawVsdPainter::endLayer()
-{
-	if (!doProcessing)
-		return;
-	if (groupStack.count() != 0)
-	{
-		PageItem *ite;
-		groupEntry gr = groupStack.pop();
-		QList<PageItem*> gElements = gr.Items;
-		tmpSel->clear();
-		if (gElements.count() > 0)
-		{
-			for (int dre = 0; dre < gElements.count(); ++dre)
-			{
-				tmpSel->addItem(gElements.at(dre), true);
-				Elements->removeAll(gElements.at(dre));
-			}
-			ite = m_Doc->groupObjectsSelection(tmpSel);
-			ite->setTextFlowMode(PageItem::TextFlowUsesBoundingBox);
-			if (!gr.clip.isEmpty())
-			{
-				double oldX = ite->xPos();
-				double oldY = ite->yPos();
-				double oldW = ite->width();
-				double oldH = ite->height();
-				double oldgW = ite->groupWidth;
-				double oldgH = ite->groupHeight;
-				ite->PoLine = gr.clip.copy();
-				ite->PoLine.translate(baseX, baseY);
-				FPoint xy = getMinClipF(&ite->PoLine);
-				ite->setXYPos(xy.x(), xy.y(), true);
-				ite->PoLine.translate(-xy.x(), -xy.y());
-				FPoint wh = getMaxClipF(&ite->PoLine);
-				ite->setWidthHeight(wh.x(),wh.y());
-				ite->groupWidth = oldgW * (ite->width() / oldW);
-				ite->groupHeight = oldgH * (ite->height() / oldH);
-				double dx = (ite->xPos() - oldX) / (ite->width() / ite->groupWidth);
-				double dy = (ite->yPos() - oldY) / (ite->height() / ite->groupHeight);
-				for (int em = 0; em < ite->groupItemList.count(); ++em)
-				{
-					PageItem* embedded = ite->groupItemList.at(em);
-					embedded->moveBy(-dx, -dy, true);
-					m_Doc->setRedrawBounding(embedded);
-					embedded->OwnPage = m_Doc->OnPage(embedded);
-				}
-				ite->ClipEdited = true;
-				ite->OldB2 = ite->width();
-				ite->OldH2 = ite->height();
-				ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
-				ite->updateGradientVectors();
-			}
-			Elements->append(ite);
-			if (groupStack.count() != 0)
-				groupStack.top().Items.append(ite);
-		}
-		tmpSel->clear();
-	}
-}
-
-void RawVsdPainter::startEmbeddedGraphics(const ::WPXPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	qDebug() << "startEmbeddedGraphics";
-//  printf("RawPainter::startEmbeddedGraphics (%s)\n", getPropString(propList).cstr());
-}
-
-void RawVsdPainter::endEmbeddedGraphics()
-{
-	if (!doProcessing)
-		return;
-//	qDebug() << "endEmbeddedGraphics";
-//  printf("RawPainter::endEmbeddedGraphics \n");
-}
-
-void RawVsdPainter::setStyle(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &gradient)
-{
-	if (!doProcessing)
-		return;
-	m_style.clear();
-	m_style = propList;
-	isGradient = false;
-	if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "none")
-		CurrColorFill = CommonStrings::None;
-	else if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "solid")
-	{
-		if (propList["draw:fill-color"])
-		{
-			CurrColorFill = parseColor(QString(propList["draw:fill-color"]->getStr().cstr()));
-			if(propList["draw:opacity"])
-				CurrFillTrans = 1.0 - qMin(1.0, qMax(fromPercentage(QString(propList["draw:opacity"]->getStr().cstr())), 0.0));
-		}
-	}
-	if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "gradient")
-	{
-		double angle = 0;
-		if (propList["draw:angle"])
-			angle = propList["draw:angle"]->getDouble();
-		if (gradient.count() > 1)
-		{
-			double opacity = 1.0;
-			currentGradient = VGradient(VGradient::linear);
-			currentGradient.clearStops();
-			currentGradient.setRepeatMethod( VGradient::none );
-			double dr = 1.0 / static_cast<double>(gradient.count());
-			for (unsigned c = 0; c < gradient.count(); c++)
-			{
-				WPXPropertyList grad = gradient[c];
-				if (grad["svg:stop-color"])
-				{
-					QString stopName = parseColor(QString(grad["svg:stop-color"]->getStr().cstr()));
-					double rampPoint = dr * c;
-					if(grad["svg:offset"])
-						rampPoint = fromPercentage(QString(grad["svg:offset"]->getStr().cstr()));
-					const ScColor& gradC = m_Doc->PageColors[stopName];
-					if(grad["svg:stop-opacity"])
-						opacity = qMin(1.0, qMax(fromPercentage(QString(grad["svg:stop-opacity"]->getStr().cstr())), 0.0));
-					currentGradient.addStop( ScColorEngine::getRGBColor(gradC, m_Doc), rampPoint, 0.5, opacity, stopName, 100 );
-					if (c == 0)
-					{
-						gradColor1Str = stopName;
-						gradColor1 = ScColorEngine::getRGBColor(gradC, m_Doc);
-						gradColor1Trans = opacity;
-					}
-					else
-					{
-						gradColor2Str = stopName;
-						gradColor2 = ScColorEngine::getRGBColor(gradC, m_Doc);
-						gradColor2Trans = opacity;
-					}
-				}
-			}
-			if (currentGradient.Stops() > 1)
-				isGradient = true;
-		}
-		else
-		{
-			gradColor1Str = "Black";
-			gradColor2Str = "Black";
-			if (propList["draw:start-color"])
-				gradColor2Str = parseColor(QString(propList["draw:start-color"]->getStr().cstr()));
-			if (propList["draw:end-color"])
-				gradColor1Str = parseColor(QString(propList["draw:end-color"]->getStr().cstr()));
-			double opacity = 1.0;
-			currentGradient = VGradient(VGradient::linear);
-			currentGradient.clearStops();
-			currentGradient.setRepeatMethod( VGradient::none );
-
-			if (propList["draw:style"])
-			{
-				if (QString(propList["draw:style"]->getStr().cstr()) == "axial")
-				{
-					currentGradient.addStop( ScColorEngine::getRGBColor(m_Doc->PageColors[gradColor1Str], m_Doc), 0.0, 0.5, opacity, gradColor1Str, 100 );
-					currentGradient.addStop( ScColorEngine::getRGBColor(m_Doc->PageColors[gradColor2Str], m_Doc), 0.5, 0.5, opacity, gradColor2Str, 100 );
-					currentGradient.addStop( ScColorEngine::getRGBColor(m_Doc->PageColors[gradColor1Str], m_Doc), 1.0, 0.5, opacity, gradColor1Str, 100 );
-				}
-				else
-				{
-					currentGradient.addStop( ScColorEngine::getRGBColor(m_Doc->PageColors[gradColor1Str], m_Doc), 0.0, 0.5, opacity, gradColor1Str, 100 );
-					currentGradient.addStop( ScColorEngine::getRGBColor(m_Doc->PageColors[gradColor2Str], m_Doc), 1.0, 0.5, opacity, gradColor2Str, 100 );
-				}
-				isGradient = true;
-			}
-		}
-	}
-	if(propList["svg:fill-rule"])
-	{
-		if (QString(propList["svg:fill-rule"]->getStr().cstr()) == "nonzero")
-			fillrule = false;
-		else
-			fillrule = true;
-	}
-	if (propList["svg:stroke-width"])
-		LineW = valueAsPoint(propList["svg:stroke-width"]);
-	if (propList["draw:stroke"])
-	{
-		if (propList["draw:stroke"]->getStr() == "none")
-			CurrColorStroke = CommonStrings::None;
-		else if ((propList["draw:stroke"]->getStr() == "solid") || (propList["draw:stroke"]->getStr() == "dash"))
-		{
-			if (propList["svg:stroke-color"])
-			{
-				CurrColorStroke = parseColor(QString(propList["svg:stroke-color"]->getStr().cstr()));
-				if(propList["svg:stroke-opacity"])
-					CurrStrokeTrans = 1.0 - qMin(1.0, qMax(fromPercentage(QString(propList["svg:stroke-opacity"]->getStr().cstr())), 0.0));
-			}
-			if (propList["draw:stroke"]->getStr() == "dash")
-			{
-				dashArray.clear();
-				double gap = LineW;
-				if (propList["draw:distance"])
-					gap = valueAsPoint(propList["draw:distance"]);
-				int dots1 = 0;
-				if (propList["draw:dots1"])
-					dots1 = propList["draw:dots1"]->getInt();
-				double dots1len = LineW;
-				if (propList["draw:dots1-length"])
-					dots1len = valueAsPoint(propList["draw:dots1-length"]);
-				int dots2 = 0;
-				if (propList["draw:dots2"])
-					dots2 = propList["draw:dots2"]->getInt();
-				double dots2len = LineW;
-				if (propList["draw:dots2-length"])
-					dots2len = valueAsPoint(propList["draw:dots2-length"]);
-				for (int i = 0; i < dots1; i++)
-				{
-					dashArray << qMax(dots1len, 0.1) << qMax(gap, 0.1);
-				}
-				for (int j = 0; j < dots2; j++)
-				{
-					dashArray << qMax(dots2len, 0.1) << qMax(gap, 0.1);
-				}
-			}
-			else
-				dashArray.clear();
-		}
-	}
-	if (propList["svg:stroke-linecap"])
-	{
-		QString params = QString(propList["svg:stroke-linecap"]->getStr().cstr());
-		if( params == "butt" )
-			lineEnd = Qt::FlatCap;
-		else if( params == "round" )
-			lineEnd = Qt::RoundCap;
-		else if( params == "square" )
-			lineEnd = Qt::SquareCap;
-		else
-			lineEnd = Qt::FlatCap;
-	}
-	if (propList["svg:stroke-linejoin"])
-	{
-		QString params = QString(propList["svg:stroke-linejoin"]->getStr().cstr());
-		if( params == "miter" )
-			lineJoin = Qt::MiterJoin;
-		else if( params == "round" )
-			lineJoin = Qt::RoundJoin;
-		else if( params == "bevel" )
-			lineJoin = Qt::BevelJoin;
-		else
-			lineJoin = Qt::MiterJoin;
-	}
-//	qDebug() << "setStyle";
-//  printf("RawPainter::setStyle(%s, gradient: (%s))\n", getPropString(propList).cstr(), getPropString(gradient).cstr());
-}
-
-void RawVsdPainter::drawRectangle(const ::WPXPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
-	{
-		double x = valueAsPoint(propList["svg:x"]);
-		double y = valueAsPoint(propList["svg:y"]);
-		double w = valueAsPoint(propList["svg:width"]);
-		double h = valueAsPoint(propList["svg:height"]);
-		int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX + x, baseY + y, w, h, LineW, CurrColorFill, CurrColorStroke, true);
-		PageItem *ite = m_Doc->Items->at(z);
-		finishItem(ite);
-		applyFill(ite);
-		if (CurrColorFill != CommonStrings::None)
-			applyShadow(ite);
-	}
-//	qDebug() << "drawRectangle";
-//  printf("RawPainter::drawRectangle (%s)\n", getPropString(propList).cstr());
-}
-
-void RawVsdPainter::drawEllipse(const ::WPXPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
-	{
-		double x = valueAsPoint(propList["svg:x"]);
-		double y = valueAsPoint(propList["svg:y"]);
-		double w = valueAsPoint(propList["svg:width"]);
-		double h = valueAsPoint(propList["svg:height"]);
-		int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Ellipse, baseX + x, baseY + y, w, h, LineW, CurrColorFill, CurrColorStroke, true);
-		PageItem *ite = m_Doc->Items->at(z);
-		finishItem(ite);
-		applyFill(ite);
-		if (CurrColorFill != CommonStrings::None)
-			applyShadow(ite);
-	}
-//	qDebug() << "drawEllipse";
-//  printf("RawPainter::drawEllipse (%s)\n", getPropString(propList).cstr());
-}
-
-void RawVsdPainter::drawPolyline(const ::WPXPropertyListVector &vertices)
-{
-	if (!doProcessing)
-		return;
-	Coords.resize(0);
-	Coords.svgInit();
-	PageItem *ite;
-	Coords.svgMoveTo(valueAsPoint(vertices[0]["svg:x"]), valueAsPoint(vertices[0]["svg:y"]));
-	for(unsigned i = 1; i < vertices.count(); i++)
-	{
-		Coords.svgLineTo(valueAsPoint(vertices[i]["svg:x"]), valueAsPoint(vertices[i]["svg:y"]));
-	}
-	if (Coords.size() > 0)
-	{
-		int z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CommonStrings::None, CurrColorStroke, true);
-		ite = m_Doc->Items->at(z);
-		ite->PoLine = Coords.copy();
-		finishItem(ite);
-		applyArrows(ite);
-	}
-}
-
-void RawVsdPainter::drawPolygon(const ::WPXPropertyListVector &vertices)
-{
-	if (!doProcessing)
-		return;
-	if(vertices.count() < 2)
-		return;
-	Coords.resize(0);
-	Coords.svgInit();
-	PageItem *ite;
-	int z;
-	Coords.svgMoveTo(valueAsPoint(vertices[0]["svg:x"]), valueAsPoint(vertices[0]["svg:y"]));
-	for(unsigned i = 1; i < vertices.count(); i++)
-	{
-		Coords.svgLineTo(valueAsPoint(vertices[i]["svg:x"]), valueAsPoint(vertices[i]["svg:y"]));
-	}
-	Coords.svgClosePath();
-	if (Coords.size() > 0)
-	{
-		if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "bitmap" && m_style["style:repeat"] && m_style["style:repeat"]->getStr() == "stretch")
-		{
-		  if (m_style["draw:fill-image"] && m_style["libwpg:mime-type"])
-		  {
-			  QByteArray ba(m_style["draw:fill-image"]->getStr().cstr());
-			  QByteArray imageData = QByteArray::fromBase64(ba);
-			  QString imgExt = "";
-			  if (m_style["libwpg:mime-type"]->getStr() == "image/png")
-				  imgExt = "png";
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/jpeg")
-				  imgExt = "jpg";
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/bmp")
-				  imgExt = "bmp";
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/pict")
-				  imgExt = "pict";
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/tiff")
-				  imgExt = "tif";
-			  if (!imgExt.isEmpty())
-			  {
-				  z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColorFill, CurrColorStroke, true);
-				  ite = m_Doc->Items->at(z);
-				  ite->PoLine = Coords.copy();
-				  finishItem(ite);
-				  insertImage(ite, imgExt, imageData);
-			  }
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/wmf")
-			  {
-				  imgExt = "wmf";
-				  QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_vsd_XXXXXX." + imgExt);
-				  if (tempFile->open())
-				  {
-					  tempFile->write(imageData);
-					  QString fileName = getLongPathName(tempFile->fileName());
-					  tempFile->close();
-					  FileLoader *fileLoader = new FileLoader(fileName);
-					  int testResult = fileLoader->testFile();
-					  delete fileLoader;
-					  if (testResult != -1)
-					  {
-						  const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
-						  if( fmt )
-						  {
-							fmt->setupTargets(m_Doc, 0, 0, 0, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
-							fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
-							if (m_Doc->m_Selection->count() > 0)
-							{
-								ite = m_Doc->groupObjectsSelection();
-								QPainterPath ba = Coords.toQPainterPath(true);
-								QRectF baR = ba.boundingRect();
-								ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
-								ite->setWidthHeight(baR.width(), baR.height(), true);
-								FPoint tp2(getMinClipF(&Coords));
-								Coords.translate(-tp2.x(), -tp2.y());
-								ite->PoLine = Coords.copy();
-								finishItem(ite);
-							}
-						  }
-					  }
-				  }
-				  delete tempFile;
-			  }
-		  }
-		}
-		else
-		{
-			z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColorFill, CurrColorStroke, true);
-			ite = m_Doc->Items->at(z);
-			ite->PoLine = Coords.copy();
-			finishItem(ite);
-			applyFill(ite);
-		}
-		if (CurrColorFill != CommonStrings::None)
-			applyShadow(ite);
-	}
-}
-
-void RawVsdPainter::drawPath(const ::WPXPropertyListVector &path)
-{
-	if (!doProcessing)
-		return;
-	bool isClosed = false;
-	QString svgString = "";
-	for(unsigned i=0; i < path.count(); i++)
-	{
-		WPXPropertyList propList = path[i];
-		if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "M")
-			svgString += QString("M %1 %2 ").arg(valueAsPoint(propList["svg:x"])).arg(valueAsPoint(propList["svg:y"]));
-		else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "L")
-			svgString += QString("L %1 %2 ").arg(valueAsPoint(propList["svg:x"])).arg(valueAsPoint(propList["svg:y"]));
-		else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "C")
-			svgString += QString("C %1 %2 %3 %4 %5 %6 ").arg(valueAsPoint(propList["svg:x1"])).arg(valueAsPoint(propList["svg:y1"])).arg(valueAsPoint(propList["svg:x2"])).arg(valueAsPoint(propList["svg:y2"])).arg(valueAsPoint(propList["svg:x"])).arg(valueAsPoint(propList["svg:y"]));
-		else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "Q")
-			svgString += QString("Q %1 %2 %3 %4 ").arg(valueAsPoint(propList["svg:x1"])).arg(valueAsPoint(propList["svg:y1"])).arg(valueAsPoint(propList["svg:x"])).arg(valueAsPoint(propList["svg:y"]));
-		else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "A")
-			svgString += QString("A %1 %2 %3 %4 %5 %6 %7") .arg(valueAsPoint(propList["svg:rx"])) .arg(valueAsPoint(propList["svg:ry"])).arg(propList["libwpg:rotate"] ? propList["libwpg:rotate"]->getDouble() : 0).arg(propList["libwpg:large-arc"] ? propList["libwpg:large-arc"]->getInt() : 1).arg(propList["libwpg:sweep"] ? propList["libwpg:sweep"]->getInt() : 1).arg(valueAsPoint(propList["svg:x"])).arg(valueAsPoint(propList["svg:y"]));
-		else if ((i >= path.count()-1 && i > 2) && propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "Z" )
-		{
-			isClosed = true;
-			svgString += "Z";
-		}
-	}
-	Coords.resize(0);
-	Coords.svgInit();
-	Coords.parseSVG(svgString);
-	PageItem *ite;
-	int z;
-	if (isClosed)
-	{
-		if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "bitmap" && m_style["style:repeat"] && m_style["style:repeat"]->getStr() == "stretch")
-		{
-		  if (m_style["draw:fill-image"] && m_style["libwpg:mime-type"])
-		  {
-			  QByteArray ba(m_style["draw:fill-image"]->getStr().cstr());
-			  QByteArray imageData = QByteArray::fromBase64(ba);
-			  QString imgExt = "";
-			  if (m_style["libwpg:mime-type"]->getStr() == "image/png")
-				  imgExt = "png";
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/jpeg")
-				  imgExt = "jpg";
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/bmp")
-				  imgExt = "bmp";
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/pict")
-				  imgExt = "pict";
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/tiff")
-				  imgExt = "tif";
-			  if (!imgExt.isEmpty())
-			  {
-				  z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColorFill, CurrColorStroke, true);
-				  ite = m_Doc->Items->at(z);
-				  ite->PoLine = Coords.copy();
-				  finishItem(ite);
-				  insertImage(ite, imgExt, imageData);
-			  }
-			  else if (m_style["libwpg:mime-type"]->getStr() == "image/wmf")
-			  {
-				  imgExt = "wmf";
-				  QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_vsd_XXXXXX." + imgExt);
-				  tempFile->setAutoRemove(false);
-				  if (tempFile->open())
-				  {
-					  tempFile->write(imageData);
-					  QString fileName = getLongPathName(tempFile->fileName());
-					  tempFile->close();
-					  FileLoader *fileLoader = new FileLoader(fileName);
-					  int testResult = fileLoader->testFile();
-					  delete fileLoader;
-					  if (testResult != -1)
-					  {
-						  const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
-						  if( fmt )
-						  {
-							  fmt->setupTargets(m_Doc, 0, 0, 0, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
-							  fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
-							  if (m_Doc->m_Selection->count() > 0)
-							  {
-								ite = m_Doc->groupObjectsSelection();
-								QPainterPath ba = Coords.toQPainterPath(true);
-								QRectF baR = ba.boundingRect();
-								ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
-								ite->setWidthHeight(baR.width(), baR.height(), true);
-								FPoint tp2(getMinClipF(&Coords));
-								Coords.translate(-tp2.x(), -tp2.y());
-								ite->PoLine = Coords.copy();
-								finishItem(ite);
-							  }
-						  }
-					  }
-				  }
-				  delete tempFile;
-			  }
-		  }
-		}
-		else
-		{
-			z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CurrColorFill, CurrColorStroke, true);
-			ite = m_Doc->Items->at(z);
-			ite->PoLine = Coords.copy();
-			finishItem(ite);
-			applyFill(ite);
-		}
-		if (CurrColorFill != CommonStrings::None)
-			applyShadow(ite);
-	}
-	else
-	{
-		z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, baseX, baseY, 10, 10, LineW, CommonStrings::None, CurrColorStroke, true);
-		ite = m_Doc->Items->at(z);
-		ite->PoLine = Coords.copy();
-		finishItem(ite);
-		applyArrows(ite);
-	}
-}
-
-void RawVsdPainter::drawGraphicObject(const ::WPXPropertyList &propList, const ::WPXBinaryData &binaryData)
-{
-	if (!doProcessing)
-		return;
-	if (!propList["libwpg:mime-type"] || propList["libwpg:mime-type"]->getStr().len() <= 0)
-		return;
-	WPXString base64 = binaryData.getBase64Data();
-	if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
-	{
-		PageItem *ite;
-		double x = valueAsPoint(propList["svg:x"]);
-		double y = valueAsPoint(propList["svg:y"]);
-		double w = valueAsPoint(propList["svg:width"]);
-		double h = valueAsPoint(propList["svg:height"]);
-		QByteArray ba(base64.cstr());
-		QByteArray imageData = QByteArray::fromBase64(ba);
-		QString imgExt = "";
-		if (propList["libwpg:mime-type"]->getStr() == "image/png")
-			imgExt = "png";
-		else if (propList["libwpg:mime-type"]->getStr() == "image/jpeg")
-			imgExt = "jpg";
-		else if (propList["libwpg:mime-type"]->getStr() == "image/bmp")
-			imgExt = "bmp";
-		else if (propList["libwpg:mime-type"]->getStr() == "image/pict")
-			imgExt = "pict";
-		else if (propList["libwpg:mime-type"]->getStr() == "image/tiff")
-			imgExt = "tif";
-		if (!imgExt.isEmpty())
-		{
-			int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Rectangle, baseX + x, baseY + y, w, h, 0, CurrColorFill, CurrColorStroke, true);
-			ite = m_Doc->Items->at(z);
-			finishItem(ite);
-			insertImage(ite, imgExt, imageData);
-		}
-		else
-		{
-			if (propList["libwpg:mime-type"]->getStr() == "image/wmf")
-			{
-				imgExt = "wmf";
-				QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_vsd_XXXXXX." + imgExt);
-				if (tempFile->open())
-				{
-					tempFile->write(imageData);
-					QString fileName = getLongPathName(tempFile->fileName());
-					tempFile->close();
-					FileLoader *fileLoader = new FileLoader(fileName);
-					int testResult = fileLoader->testFile();
-					delete fileLoader;
-					if (testResult != -1)
-					{
-						const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
-						if( fmt )
-						{
-							fmt->setupTargets(m_Doc, 0, 0, 0, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
-							fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
-							if (m_Doc->m_Selection->count() > 0)
-							{
-								ite = m_Doc->groupObjectsSelection();
-								ite->setTextFlowMode(PageItem::TextFlowUsesBoundingBox);
-								Elements->append(ite);
-								ite->setXYPos(baseX + x, baseY + y, true);
-								ite->setWidthHeight(w, h, true);
-								ite->updateClip();
-							}
-						}
-					}
-				}
-				delete tempFile;
-			}
-		}
-		applyShadow(ite);
-	}
-//	qDebug() << "drawGraphicObject";
-//  printf("RawPainter::drawGraphicObject (%s)\n", getPropString(propList).cstr());
-}
-
-void RawVsdPainter::startTextObject(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &path)
-{
-	if (!doProcessing)
-		return;
-	actTextItem = NULL;
-	lineSpSet = false;
-	lineSpIsPT = false;
-	if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
-	{
-		double x = valueAsPoint(propList["svg:x"]);
-		double y = valueAsPoint(propList["svg:y"]);
-		double w = valueAsPoint(propList["svg:width"]);
-		double h = valueAsPoint(propList["svg:height"]);
-		double rot = 0;
-		if (propList["libwpg:rotate"])
-			rot = propList["libwpg:rotate"]->getDouble();
-		if ((w != 0) && (h != 0))
-		{
-			int z = m_Doc->itemAdd(PageItem::TextFrame, PageItem::Rectangle, baseX + x, baseY + y, w, h, 0, CurrColorFill, CurrColorStroke, true);
-			PageItem *ite = m_Doc->Items->at(z);
-			CurrFillTrans = 0;
-			CurrStrokeTrans = 0;
-			finishItem(ite);
-			applyShadow(ite);
-			if (rot != 0)
-			{
-				int rm = m_Doc->RotMode();
-				m_Doc->RotMode(2);
-				m_Doc->RotateItem(rot, ite);
-				m_Doc->RotMode(rm);
-			}
-			if (propList["fo:padding-left"])
-				ite->setTextToFrameDistLeft(valueAsPoint(propList["fo:padding-left"]));
-			if (propList["fo:padding-right"])
-				ite->setTextToFrameDistRight(valueAsPoint(propList["fo:padding-right"]));
-			if (propList["fo:padding-top"])
-				ite->setTextToFrameDistTop(valueAsPoint(propList["fo:padding-top"]));
-			if (propList["fo:padding-bottom"])
-				ite->setTextToFrameDistBottom(valueAsPoint(propList["fo:padding-bottom"]));
-			if (propList["fo:column-count"])
-				ite->setColumns(propList["fo:column-count"]->getInt());
-			if (propList["fo:column-gap"])
-				ite->setColumnGap(valueAsPoint(propList["fo:column-gap"]));
-			ite->setFirstLineOffset(FLOPFontAscent);
-			actTextItem = ite;
-			QString pStyle = CommonStrings::DefaultParagraphStyle;
-			ParagraphStyle newStyle;
-			newStyle.setParent(pStyle);
-			textStyle = newStyle;
-		}
-	}
-}
-
-void RawVsdPainter::endTextObject()
-{
-	if (!doProcessing)
-		return;
-	if (actTextItem)
-		actTextItem->itemText.trim();
-	actTextItem = NULL;
-	lineSpSet = false;
-	lineSpIsPT = false;
-}
-
-void RawVsdPainter::startTextLine(const ::WPXPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	QString pStyle = CommonStrings::DefaultParagraphStyle;
-	ParagraphStyle newStyle;
-	newStyle.setParent(pStyle);
-	textStyle = newStyle;
-	if (propList["fo:text-align"])
-	{
-		QString align = QString(propList["fo:text-align"]->getStr().cstr());
-		if (align == "left")
-			textStyle.setAlignment(ParagraphStyle::Leftaligned);
-		else if (align == "center")
-			textStyle.setAlignment(ParagraphStyle::Centered);
-		else if (align == "right")
-			textStyle.setAlignment(ParagraphStyle::Rightaligned);
-		else if (align == "justify")
-			textStyle.setAlignment(ParagraphStyle::Justified);
-	}
-	if (propList["fo:margin-left"])
-		textStyle.setLeftMargin(valueAsPoint(propList["fo:margin-left"]));
-	if (propList["fo:margin-right"])
-		textStyle.setRightMargin(valueAsPoint(propList["fo:margin-right"]));
-	if (propList["fo:text-indent"])
-		textStyle.setFirstIndent(valueAsPoint(propList["fo:text-indent"]));
-	if (propList["style:drop-cap"])
-	{
-		textStyle.setDropCapLines(propList["style:drop-cap"]->getInt());
-		textStyle.setHasDropCap(true);
-	}
-	if (propList["fo:margin-bottom"])
-		textStyle.setGapAfter(valueAsPoint(propList["fo:margin-bottom"]));
-	if (propList["fo:margin-top"])
-		textStyle.setGapBefore(valueAsPoint(propList["fo:margin-top"]));
-//	m_maxFontSize = textStyle.charStyle().fontSize() / 10.0;
-	m_maxFontSize = 1.0;
-	if (propList["fo:line-height"])
-	{
-		m_linespace = propList["fo:line-height"]->getDouble();
-		QString lsp = QString(propList["fo:line-height"]->getStr().cstr());
-		lineSpIsPT = lsp.endsWith("pt");
-		lineSpSet = true;
-	}
-}
-
-void RawVsdPainter::endTextLine()
-{
-	if (!doProcessing)
-		return;
-	if (actTextItem == NULL)
-		return;
-	int posT = actTextItem->itemText.length();
-	if (posT > 0)
-	{
-		if ((actTextItem->itemText.text(posT - 1) != SpecialChars::PARSEP))
-		{
-			actTextItem->itemText.insertChars(posT, SpecialChars::PARSEP);
-			actTextItem->itemText.applyStyle(posT, textStyle);
-		}
-	}
-}
-
-void RawVsdPainter::startTextSpan(const ::WPXPropertyList &propList)
-{
-	if (!doProcessing)
-		return;
-	if (actTextItem == NULL)
-		return;
-	textCharStyle = textStyle.charStyle();
-	if (propList["fo:font-size"])
-	{
-		textCharStyle.setFontSize(valueAsPoint(propList["fo:font-size"]) * 10.0);
-		m_maxFontSize = qMax(m_maxFontSize, valueAsPoint(propList["fo:font-size"]));
-	}
-	if (propList["fo:color"])
-		textCharStyle.setFillColor(parseColor(QString(propList["fo:color"]->getStr().cstr())));
-	if (propList["style:font-name"])
-	{
-		QString fontVari = "";
-		if (propList["fo:font-weight"])
-			fontVari = QString(propList["fo:font-weight"]->getStr().cstr());
-		QString fontName = QString(propList["style:font-name"]->getStr().cstr());
-		QString realFontName = constructFontName(fontName, fontVari);
-		textCharStyle.setFont((*m_Doc->AllFonts)[realFontName]);
-	}
-	StyleFlag styleEffects = textCharStyle.effects();
-	if (propList["style:text-underline-type"])
-		styleEffects |= ScStyle_Underline;
-	if (propList["style:text-position"])
-	{
-		if (propList["style:text-position"]->getStr() == "50% 67%")
-			styleEffects |= ScStyle_Superscript;
-		else
-			styleEffects |= ScStyle_Subscript;
-	}
-	textCharStyle.setFeatures(styleEffects.featureList());
-}
-
-void RawVsdPainter::endTextSpan()
-{
-}
-
-void RawVsdPainter::insertText(const ::WPXString &str)
-{
-	if (!doProcessing)
-		return;
-	if (lineSpSet)
-	{
-		textStyle.setLineSpacingMode(ParagraphStyle::FixedLineSpacing);
-		if (lineSpIsPT)
-			textStyle.setLineSpacing(m_linespace);
-		else
-			textStyle.setLineSpacing(m_maxFontSize * m_linespace);
-	}
-	else
-		textStyle.setLineSpacingMode(ParagraphStyle::AutomaticLineSpacing);
-	WPXString tempUTF8(str, true);
-	QString actText = QString(tempUTF8.cstr());
-	if (actTextItem)
-	{
-		int posC = actTextItem->itemText.length();
-		if (actText.count() > 0)
-		{
-			actText.replace(QChar(10), SpecialChars::LINEBREAK);
-			actText.replace(QChar(12), SpecialChars::FRAMEBREAK);
-			actText.replace(QChar(30), SpecialChars::NBHYPHEN);
-			actText.replace(QChar(160), SpecialChars::NBSPACE);
-			QTextDocument texDoc;
-			texDoc.setHtml(actText);
-			actText = texDoc.toPlainText();
-			actText = actText.trimmed();
-			actTextItem->itemText.insertChars(posC, actText);
-			actTextItem->itemText.applyStyle(posC, textStyle);
-			actTextItem->itemText.applyCharStyle(posC, actText.length(), textCharStyle);
-		}
-	}
-}
-
-QString RawVsdPainter::constructFontName(QString fontBaseName, QString fontStyle)
-{
-	QString fontName = "";
-	bool found = false;
-	SCFontsIterator it(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts);
-	for ( ; it.hasNext(); it.next())
-	{
-		if (fontBaseName.toLower() == it.current().family().toLower())
-		{
-			// found the font family, now go for the style
-			QStringList slist = PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts.fontMap[it.current().family()];
-			slist.sort();
-			if (slist.count() > 0)
-			{
-				for (int a = 0; a < slist.count(); a++)
-				{
-					if (fontStyle.toLower() == slist[a].toLower())
-					{
-						found = true;
-						fontName = it.current().family() + " " + slist[a];
-						break;
-					}
-				}
-				if (!found)
-				{
-					int reInd = slist.indexOf("Regular");
-					if (reInd < 0)
-						fontName = it.current().family() + " " + slist[0];
-					else
-						fontName = it.current().family() + " " + slist[reInd];
-					found = true;
-				}
-			}
-			else
-			{
-				fontName = it.current().family();
-				found = true;
-			}
-			break;
-		}
-	}
-	if (!found)
-	{
-		if (importerFlags & LoadSavePlugin::lfCreateThumbnail)
-			fontName = PrefsManager::instance()->appPrefs.itemToolPrefs.textFont;
-		else
-		{
-			QString family = fontBaseName;
-			if (!fontStyle.isEmpty())
-				family += " " + fontStyle;
-			if (!PrefsManager::instance()->appPrefs.fontPrefs.GFontSub.contains(family))
-			{
-				qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
-				MissingFont *dia = new MissingFont(0, family, m_Doc);
-				dia->exec();
-				fontName = dia->getReplacementFont();
-				delete dia;
-				qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
-				PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[family] = fontName;
-			}
-			else
-				fontName = PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[family];
-		}
-	}
-	return fontName;
-}
-
-double RawVsdPainter::valueAsPoint(const WPXProperty *prop)
-{
-	double value = 0.0;
-	QString str = QString(prop->getStr().cstr()).toLower();
-	if (str.endsWith("in"))
-		value = prop->getDouble() * 72.0;
-	else
-		value = prop->getDouble();
-	return value;
-}
-
-double RawVsdPainter::fromPercentage( const QString &s )
-{
-	QString s1 = s;
-	if (s1.endsWith( ";" ))
-		s1.chop(1);
-	if (s1.endsWith( "%" ))
-	{
-		s1.chop(1);
-		return ScCLocale::toDoubleC(s1) / 100.0;
-	}
-	else
-		return ScCLocale::toDoubleC(s1);
-}
-
-QColor RawVsdPainter::parseColorN( const QString &rgbColor )
-{
-	int r, g, b;
-	keywordToRGB( rgbColor.toLower(), r, g, b );
-	return QColor( r, g, b );
-}
-
-QString RawVsdPainter::parseColor( const QString &s )
-{
-	QColor c;
-	QString ret = CommonStrings::None;
-	if (s.startsWith( "rgb(" ) )
-	{
-		QString parse = s.trimmed();
-		QStringList colors = parse.split(',', QString::SkipEmptyParts);
-		QString r = colors[0].right( ( colors[0].length() - 4 ) );
-		QString g = colors[1];
-		QString b = colors[2].left( ( colors[2].length() - 1 ) );
-		if (r.contains( "%" ))
-		{
-			r.chop(1);
-			r = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(r) ) / 100.0 ) ) );
-		}
-		if (g.contains( "%" ))
-		{
-			g.chop(1);
-			g = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(g) ) / 100.0 ) ) );
-		}
-		if (b.contains( "%" ))
-		{
-			b.chop(1);
-			b = QString::number( static_cast<int>( ( static_cast<double>( 255 * ScCLocale::toDoubleC(b) ) / 100.0 ) ) );
-		}
-		c = QColor(r.toInt(), g.toInt(), b.toInt());
-	}
-	else
-	{
-		QString rgbColor = s.trimmed();
-		if (rgbColor.startsWith( "#" ))
-		{
-			rgbColor = rgbColor.left(7);
-			c.setNamedColor( rgbColor );
-		}
-		else
-			c = parseColorN( rgbColor );
-	}
-	ScColor tmp;
-	tmp.fromQColor(c);
-	tmp.setSpotColor(false);
-	tmp.setRegistrationColor(false);
-	QString newColorName = "FromVSD"+c.name();
-	QString fNam = m_Doc->PageColors.tryAddColor(newColorName, tmp);
-	if (fNam == newColorName)
-		importedColors->append(newColorName);
-	ret = fNam;
-	return ret;
-}
-
-void RawVsdPainter::insertImage(PageItem* ite, QString imgExt, QByteArray &imageData)
-{
-	QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_vsd_XXXXXX." + imgExt);
-	tempFile->setAutoRemove(false);
-	if (tempFile->open())
-	{
-		tempFile->write(imageData);
-		QString fileName = getLongPathName(tempFile->fileName());
-		tempFile->close();
-		ite->isTempFile = true;
-		ite->isInlineImage = true;
-		if (m_style["draw:red"] && m_style["draw:green"] && m_style["draw:blue"])
-		{
-			int r = qRound(m_style["draw:red"]->getDouble() * 255);
-			int g = qRound(m_style["draw:green"]->getDouble() * 255);
-			int b = qRound(m_style["draw:blue"]->getDouble() * 255);
-			QString colVal = QString("#%1%2%3").arg(r, 2, 16, QLatin1Char('0')).arg(g, 2, 16, QLatin1Char('0')).arg(b, 2, 16, QLatin1Char('0'));
-			QString efVal = parseColor(colVal);
-			efVal += "\n";
-			struct ImageEffect ef;
-			efVal += "100";
-			ef.effectCode = ScImage::EF_COLORIZE;
-			ef.effectParameters = efVal;
-			ite->effectsInUse.append(ef);
-		}
-		if (m_style["draw:luminance"])
-		{
-			double per = m_style["draw:luminance"]->getDouble();
-			struct ImageEffect ef;
-			ef.effectCode = ScImage::EF_BRIGHTNESS;
-			ef.effectParameters = QString("%1").arg(qRound((per - 0.5) * 255));
-			ite->effectsInUse.append(ef);
-		}
-		m_Doc->loadPict(fileName, ite);
-		if (m_style["libwpg:rotate"])
-		{
-			int rot = QString(m_style["libwpg:rotate"]->getStr().cstr()).toInt();
-			ite->setImageRotation(rot);
-			ite->AdjustPictScale();
-		}
-	}
-	delete tempFile;
-}
-
-void RawVsdPainter::applyFill(PageItem* ite)
-{
-	if(isGradient)
-	{
-		QString gradMode = "linear";
-		if (m_style["draw:style"])
-			gradMode = QString(m_style["draw:style"]->getStr().cstr());
-		if ((gradMode == "linear") || (gradMode == "axial"))
-		{
-			int angle = 0;
-			if (m_style["draw:angle"])
-				angle = qRound(m_style["draw:angle"]->getDouble());
-			double h = ite->height();
-			double w = ite->width();
-			if (angle == 0)
-				ite->setGradientVector(w / 2.0, h, w / 2.0, 0, 0, 0, 1, 0);
-			else if (angle == -225)
-				ite->setGradientVector(w, 0, 0, h, 0, 0, 1, 0);
-			else if (angle == 45)
-				ite->setGradientVector(w, h, 0, 0, 0, 0, 1, 0);
-			else if (angle == 90)
-				ite->setGradientVector(w, h / 2.0, 0, h / 2.0, 0, 0, 1, 0);
-			else if (angle == 180)
-				ite->setGradientVector(w / 2.0, 0, w / 2.0, h, 0, 0, 1, 0);
-			else if (angle == 270)
-				ite->setGradientVector(0, h / 2.0, w, h / 2.0, 0, 0, 1, 0);
-			ite->fill_gradient = currentGradient;
-			ite->GrType = 6;
-		}
-		else if (gradMode == "radial")
-		{
-			double h = ite->height();
-			double w = ite->width();
-			double cx = 0.0;
-			double cy = 0.0;
-			if (m_style["svg:cx"])
-				cx = m_style["svg:cx"]->getDouble() * w;
-			if (m_style["svg:cy"])
-				cy = m_style["svg:cy"]->getDouble() * h;
-			ite->setGradientVector(cx, cy, w, h / 2.0, cx, cy, 1, 0);
-			ite->fill_gradient = currentGradient;
-			ite->GrType = 7;
-		}
-		else if (gradMode == "square")
-		{
-			double cx = 0.0;
-			double cy = 0.0;
-			if (m_style["svg:cx"])
-				cx = m_style["svg:cx"]->getDouble() * ite->width();
-			if (m_style["svg:cy"])
-				cy = m_style["svg:cy"]->getDouble() * ite->height();
-			FPoint cp = FPoint(cx, cy);
-			ite->setDiamondGeometry(FPoint(0, 0), FPoint(ite->width(), 0), FPoint(ite->width(), ite->height()), FPoint(0, ite->height()), cp);
-			ite->fill_gradient.clearStops();
-			QList<VColorStop*> colorStops = currentGradient.colorStops();
-			for( int a = 0; a < colorStops.count() ; a++ )
-			{
-				ite->fill_gradient.addStop(colorStops[a]->color, 1.0 - colorStops[a]->rampPoint, colorStops[a]->midPoint, colorStops[a]->opacity, colorStops[a]->name, colorStops[a]->shade);
-			}
-			ite->GrType = 10;
-		}
-	}
-	if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "bitmap")
-	{
-		QByteArray ba(m_style["draw:fill-image"]->getStr().cstr());
-		QByteArray imageData = QByteArray::fromBase64(ba);
-		QString imgExt = "";
-		if (m_style["libwpg:mime-type"]->getStr() == "image/png")
-			imgExt = "png";
-		else if (m_style["libwpg:mime-type"]->getStr() == "image/jpeg")
-			imgExt = "jpg";
-		else if (m_style["libwpg:mime-type"]->getStr() == "image/bmp")
-			imgExt = "bmp";
-		else if (m_style["libwpg:mime-type"]->getStr() == "image/pict")
-			imgExt = "pict";
-		else if (m_style["libwpg:mime-type"]->getStr() == "image/tiff")
-			imgExt = "tif";
-		if (!imgExt.isEmpty())
-		{
-			QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_vsd_XXXXXX." + imgExt);
-			tempFile->setAutoRemove(false);
-			if (tempFile->open())
-			{
-				tempFile->write(imageData);
-				QString fileName = getLongPathName(tempFile->fileName());
-				tempFile->close();
-				ScPattern pat = ScPattern();
-				pat.setDoc(m_Doc);
-				int z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None, true);
-				PageItem* newItem = m_Doc->Items->at(z);
-				if (m_style["draw:red"] && m_style["draw:green"] && m_style["draw:blue"])
-				{
-					int r = qRound(m_style["draw:red"]->getDouble() * 255);
-					int g = qRound(m_style["draw:green"]->getDouble() * 255);
-					int b = qRound(m_style["draw:blue"]->getDouble() * 255);
-					QString colVal = QString("#%1%2%3").arg(r, 2, 16, QLatin1Char('0')).arg(g, 2, 16, QLatin1Char('0')).arg(b, 2, 16, QLatin1Char('0'));
-					QString efVal = parseColor(colVal);
-					efVal += "\n";
-					struct ImageEffect ef;
-					efVal += "100";
-					ef.effectCode = ScImage::EF_COLORIZE;
-					ef.effectParameters = efVal;
-					ite->effectsInUse.append(ef);
-				}
-				m_Doc->loadPict(fileName, newItem);
-				m_Doc->Items->takeAt(z);
-				newItem->isInlineImage = true;
-				newItem->isTempFile = true;
-				pat.width = newItem->pixm.qImage().width();
-				pat.height = newItem->pixm.qImage().height();
-				pat.scaleX = (72.0 / newItem->pixm.imgInfo.xres) * newItem->pixm.imgInfo.lowResScale;
-				pat.scaleY = (72.0 / newItem->pixm.imgInfo.xres) * newItem->pixm.imgInfo.lowResScale;
-				pat.pattern = newItem->pixm.qImage().copy();
-				newItem->setWidth(pat.pattern.width());
-				newItem->setHeight(pat.pattern.height());
-				newItem->SetRectFrame();
-				newItem->gXpos = 0.0;
-				newItem->gYpos = 0.0;
-				newItem->gWidth = pat.pattern.width();
-				newItem->gHeight = pat.pattern.height();
-				pat.items.append(newItem);
-				QString patternName = "Pattern_"+ite->itemName();
-				patternName = patternName.trimmed().simplified().replace(" ", "_");
-				m_Doc->addPattern(patternName, pat);
-				importedPatterns->append(patternName);
-				ite->setPattern(patternName);
-				ite->GrType = 8;
-			}
-			delete tempFile;
-		}
-	}
-}
-
-void RawVsdPainter::applyShadow(PageItem* ite)
-{
-	if (ite == NULL)
-		return;
-	if(m_style["draw:shadow"] && m_style["draw:shadow"]->getStr() == "visible")
-	{
-		double xp = ite->xPos();
-		double yp = ite->yPos();
-		double xof = 0.0;
-		double yof = 0.0;
-		if (m_style["draw:shadow-offset-x"])
-			xof = valueAsPoint(m_style["draw:shadow-offset-x"]);
-		if (m_style["draw:shadow-offset-y"])
-			yof = valueAsPoint(m_style["draw:shadow-offset-y"]);
-		xp += xof;
-		yp += yof;
-		QString shadowColor = CurrColorFill;
-		double shadowTrans = 1.0;
-		if (m_style["draw:shadow-color"])
-		{
-			shadowColor = parseColor(QString(m_style["draw:shadow-color"]->getStr().cstr()));
-			if(m_style["draw:shadow-opacity"])
-				shadowTrans = 1.0 - qMin(1.0, qMax(fromPercentage(QString(m_style["draw:shadow-opacity"]->getStr().cstr())), 0.0));
-		}
-		int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, xp, yp, ite->width(), ite->height(), 0, shadowColor, CommonStrings::None, true);
-		PageItem *nite = m_Doc->Items->takeAt(z);
-		nite->PoLine = ite->PoLine.copy();
-		nite->updateClip();
-		nite->setFillTransparency(shadowTrans);
-		nite->ClipEdited = true;
-		nite->FrameType = 3;
-		m_Doc->Items->takeAt(z-1);
-		Elements->takeAt(z-1);
-		m_Doc->Items->append(nite);
-		m_Doc->Items->append(ite);
-		Elements->append(nite);
-		Elements->append(ite);
-		if (groupStack.count() != 0)
-		{
-			groupStack.top().Items.takeLast();
-			groupStack.top().Items.append(nite);
-			groupStack.top().Items.append(ite);
-		}
-	}
-}
-
-void RawVsdPainter::applyArrows(PageItem* ite)
-{
-	if (m_style["draw:marker-end-path"])
-	{
-		FPointArray EndArrow;
-		double EndArrowWidth;
-		QString params = QString(m_style["draw:marker-end-path"]->getStr().cstr());
-		EndArrowWidth = LineW;
-		EndArrow.resize(0);
-		EndArrow.svgInit();
-		EndArrow.parseSVG(params);
-		QPainterPath pa = EndArrow.toQPainterPath(true);
-		QRectF br = pa.boundingRect();
-		if (m_style["draw:marker-end-width"])
-			EndArrowWidth = valueAsPoint(m_style["draw:marker-end-width"]);
-		if (EndArrowWidth > 0)
-		{
-			FPoint End = ite->PoLine.point(ite->PoLine.size()-2);
-			for (uint xx = ite->PoLine.size()-1; xx > 0; xx -= 2)
-			{
-				FPoint Vector = ite->PoLine.point(xx);
-				if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
-				{
-					double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
-					QPointF refP = QPointF(br.width() / 2.0, 0);
-					QTransform m;
-					m.translate(br.width() / 2.0, br.height() / 2.0);
-					m.rotate(r + 90);
-					m.translate(-br.width() / 2.0, -br.height() / 2.0);
-					m.scale(EndArrowWidth / br.width(), EndArrowWidth / br.width());
-					EndArrow.map(m);
-					refP = m.map(refP);
-					QPainterPath pa2 = EndArrow.toQPainterPath(true);
-					QRectF br2 = pa2.boundingRect();
-					QTransform m2;
-					FPoint grOffset2(getMinClipF(&EndArrow));
-					m2.translate(-grOffset2.x(), -grOffset2.y());
-					EndArrow.map(m2);
-					refP = m2.map(refP);
-					EndArrow.translate(-refP.x(), -refP.y());
-					QTransform arrowTrans;
-					arrowTrans.translate(-m_Doc->currentPage()->xOffset(), -m_Doc->currentPage()->yOffset());
-					arrowTrans.translate(End.x() + ite->xPos(), End.y() + ite->yPos());
-					EndArrow.map(arrowTrans);
-					int zE = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, 0, CurrColorStroke, CommonStrings::None, true);
-					PageItem *iteE = m_Doc->Items->at(zE);
-					iteE->PoLine = EndArrow.copy();
-					finishItem(iteE);
-					break;
-				}
-			}
-		}
-	}
-	if (m_style["draw:marker-start-path"])
-	{
-		FPointArray EndArrow;
-		double EndArrowWidth;
-		QString params = QString(m_style["draw:marker-start-path"]->getStr().cstr());
-		EndArrowWidth = LineW;
-		EndArrow.resize(0);
-		EndArrow.svgInit();
-		EndArrow.parseSVG(params);
-		QPainterPath pa = EndArrow.toQPainterPath(true);
-		QRectF br = pa.boundingRect();
-		if (m_style["draw:marker-start-width"])
-			EndArrowWidth = valueAsPoint(m_style["draw:marker-start-width"]);
-		if (EndArrowWidth > 0)
-		{
-			FPoint Start = ite->PoLine.point(0);
-			for (int xx = 1; xx < ite->PoLine.size(); xx += 2)
-			{
-				FPoint Vector = ite->PoLine.point(xx);
-				if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
-				{
-					double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI);
-					QPointF refP = QPointF(br.width() / 2.0, 0);
-					QTransform m;
-					m.translate(br.width() / 2.0, br.height() / 2.0);
-					m.rotate(r + 90);
-					m.translate(-br.width() / 2.0, -br.height() / 2.0);
-					m.scale(EndArrowWidth / br.width(), EndArrowWidth / br.width());
-					EndArrow.map(m);
-					refP = m.map(refP);
-					QPainterPath pa2 = EndArrow.toQPainterPath(true);
-					QRectF br2 = pa2.boundingRect();
-					QTransform m2;
-					FPoint grOffset2(getMinClipF(&EndArrow));
-					m2.translate(-grOffset2.x(), -grOffset2.y());
-					EndArrow.map(m2);
-					refP = m2.map(refP);
-					EndArrow.translate(-refP.x(), -refP.y());
-					QTransform arrowTrans;
-					arrowTrans.translate(-m_Doc->currentPage()->xOffset(), -m_Doc->currentPage()->yOffset());
-					arrowTrans.translate(Start.x() + ite->xPos(), Start.y() + ite->yPos());
-					EndArrow.map(arrowTrans);
-					int zS = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, 0, CurrColorStroke, CommonStrings::None, true);
-					PageItem *iteS = m_Doc->Items->at(zS);
-					iteS->PoLine = EndArrow.copy();
-					finishItem(iteS);
-					break;
-				}
-			}
-		}
-	}
-}
-
-void RawVsdPainter::finishItem(PageItem* ite)
-{
-	ite->ClipEdited = true;
-	ite->FrameType = 3;
-	ite->setFillShade(CurrFillShade);
-	ite->setFillEvenOdd(fillrule);
-	ite->setLineShade(CurrStrokeShade);
-	ite->setLineJoin(lineJoin);
-	ite->setLineEnd(lineEnd);
-	if (dashArray.count() > 0)
-	{
-		ite->DashValues = dashArray;
-	}
-	FPoint wh = getMaxClipF(&ite->PoLine);
-	ite->setWidthHeight(wh.x(),wh.y(), true);
-	ite->setTextFlowMode(PageItem::TextFlowUsesBoundingBox);
-	m_Doc->AdjustItemSize(ite);
-	ite->OldB2 = ite->width();
-	ite->OldH2 = ite->height();
-	ite->setFillTransparency(CurrFillTrans);
-	ite->setLineTransparency(CurrStrokeTrans);
-	ite->updateClip();
-	Elements->append(ite);
-	if (groupStack.count() != 0)
-		groupStack.top().Items.append(ite);
-	Coords.resize(0);
-	Coords.svgInit();
-}
 
 VsdPlug::VsdPlug(ScribusDoc* doc, int flags)
 {
@@ -1732,23 +338,17 @@
 	}
 	QFileInfo fi = QFileInfo(fn);
 	QString ext = fi.suffix().toLower();
-	RawVsdPainter painter;
-	painter.m_Doc = m_Doc;
-	painter.baseX = baseX;
-	painter.baseY = baseY;
-	painter.docWidth = docWidth;
-	painter.docHeight = docHeight;
-	painter.importerFlags = importerFlags;
-	painter.Elements = &Elements;
-	painter.importedColors = &importedColors;
-	painter.importedPatterns = &importedPatterns;
-	painter.tmpSel = tmpSel;
+#if HAVE_REVENGE
+	librevenge::RVNGFileStream input(QFile::encodeName(fn).data());
+#else
 	WPXFileStream input(QFile::encodeName(fn).data());
+#endif
 	if (!libvisio::VisioDocument::isSupported(&input))
 	{
 		qDebug() << "ERROR: Unsupported file format!";
 		return false;
 	}
+	RawPainter painter(m_Doc, baseX, baseY, docWidth, docHeight, importerFlags, &Elements, &importedColors, &importedPatterns, tmpSel, "vsd");
 	if (!libvisio::VisioDocument::parse(&input, &painter))
 	{
 		qDebug() << "ERROR: Parsing failed!";

Modified: trunk/Scribus/scribus/plugins/import/vsd/importvsd.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19235&path=/trunk/Scribus/scribus/plugins/import/vsd/importvsd.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/vsd/importvsd.h (original)
+++ trunk/Scribus/scribus/plugins/import/vsd/importvsd.h Sun Jun 15 09:41:06 2014
@@ -20,102 +20,12 @@
 #include <QMultiMap>
 #include <QVector>
 
-#include <libvisio/libvisio.h>
-#include <libwpd-stream/libwpd-stream.h>
-#include <libwpd/libwpd.h>
-#include <libwpg/libwpg.h>
-
 class MultiProgressDialog;
 class ScribusDoc;
 class Selection;
 class TransactionSettings;
 
-class RawVsdPainter : public libwpg::WPGPaintInterface
-{
-public:
-	RawVsdPainter();
-	void startGraphics(const ::WPXPropertyList &propList);
-	void endGraphics();
-	void startLayer(const ::WPXPropertyList &propList);
-	void endLayer();
-	void startEmbeddedGraphics(const ::WPXPropertyList &propList);
-	void endEmbeddedGraphics();
-	void setStyle(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &gradient);
-	void drawRectangle(const ::WPXPropertyList &propList);
-	void drawEllipse(const ::WPXPropertyList &propList);
-	void drawPolyline(const ::WPXPropertyListVector &vertices);
-	void drawPolygon(const ::WPXPropertyListVector &vertices);
-	void drawPath(const ::WPXPropertyListVector &path);
-	void drawGraphicObject(const ::WPXPropertyList &propList, const ::WPXBinaryData &binaryData);
-	void startTextObject(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &path);
-	void endTextObject();
-	void startTextLine(const ::WPXPropertyList &propList);
-	void endTextLine();
-	void startTextSpan(const ::WPXPropertyList &propList);
-	void endTextSpan();
-	void insertText(const ::WPXString &str);
-	QString constructFontName(QString fontBaseName, QString fontStyle);
-	double valueAsPoint(const WPXProperty *prop);
-	double fromPercentage(const QString &s );
-	QColor  parseColorN( const QString &rgbColor );
-	QString parseColor( const QString &s );
-	void insertImage(PageItem* ite, QString imgExt, QByteArray &imageData);
-	void applyFill(PageItem* ite);
-	void applyShadow(PageItem* ite);
-	void applyArrows(PageItem* ite);
-	void finishItem(PageItem* ite);
-
-	ScribusDoc* m_Doc;
-	Selection* tmpSel;
-	QList<PageItem*> *Elements;
-	struct groupEntry
-	{
-		QList<PageItem*> Items;
-		FPointArray clip;
-	};
-	QStack<groupEntry> groupStack;
-	QStringList *importedColors;
-	QStringList *importedPatterns;
-	double LineW;
-	QString CurrColorFill;
-	QString CurrColorStroke;
-	double CurrStrokeShade;
-	double CurrFillShade;
-	double CurrStrokeTrans;
-	double CurrFillTrans;
-	FPointArray Coords;
-	bool fillrule;
-	double gradientAngle;
-	bool isGradient;
-	VGradient currentGradient;
-	QString gradColor1Str;
-	QColor gradColor1;
-	double gradColor1Trans;
-	QString gradColor2Str;
-	QColor gradColor2;
-	double gradColor2Trans;
-	QVector<double> dashArray;
-	Qt::PenJoinStyle lineJoin;
-	Qt::PenCapStyle lineEnd;
-	double baseX, baseY;
-	double docWidth;
-	double docHeight;
-	int importerFlags;
-	bool firstPage;
-	QString baseLayer;
-	int actPage;
-	WPXPropertyList m_style;
-	PageItem *actTextItem;
-	ParagraphStyle textStyle;
-	CharStyle textCharStyle;
-	double m_linespace;
-	double m_maxFontSize;
-	bool lineSpSet;
-	bool lineSpIsPT;
-	bool doProcessing;
-};
-
-//! \brief CDR importer plugin
+//! \brief VSD importer plugin
 class VsdPlug : public QObject
 {
 	Q_OBJECT
@@ -124,7 +34,7 @@
 	/*!
 	\author Franz Schmid
 	\date
-	\brief Create the Cdr importer window.
+	\brief Create the VSD importer window.
 	\param fName QString
 	\param flags combination of loadFlags
 	\param showProgress if progress must be displayed




More information about the scribus-commit mailing list