r17222 by fschmid - Idml Importer:

scribus-commit scribus-commit at lists.scribus.net
Sun Jan 22 18:53:59 UTC 2012


Author: fschmid
Date: Sun Jan 22 18:53:59 2012
New Revision: 17222

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17222
Log:
Idml Importer:
- fixed geometry issues
- added support for IDMS (Indesign Snippet) files.

Modified:
    trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
    trunk/Scribus/scribus/plugins/import/idml/importidml.h
    trunk/Scribus/scribus/plugins/import/idml/importidmlplugin.cpp

Modified: trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17222&path=/trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/idml/importidml.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/idml/importidml.cpp Sun Jan 22 18:53:59 2012
@@ -70,6 +70,7 @@
 	importerFlags = flags;
 	interactive = (flags & LoadSavePlugin::lfInteractive);
 	progressDialog = NULL;
+	fun = NULL;
 }
 
 QString IdmlPlug::getNodeValue(QDomNode &baseNode, QString path)
@@ -102,11 +103,22 @@
 QImage IdmlPlug::readThumbnail(QString fName)
 {
 	QImage tmp;
-	QByteArray f, f2;
+	QByteArray f;
+	QString designMap;
 	if ( !QFile::exists(fName) )
 		return QImage();
-	fun = new FileUnzip(fName);
-	QString designMap = fun->getFile("designmap.xml");
+	QFileInfo fi = QFileInfo(fName);
+	QString ext = fi.suffix().toLower();
+	if (ext == "idml")
+	{
+		fun = new FileUnzip(fName);
+		designMap = fun->getFile("designmap.xml");
+	}
+	else if (ext == "idms")
+	{
+		designMap = fName;
+		fun = NULL;
+	}
 	if (!designMap.isNull())
 	{
 		loadRawText(designMap, f);
@@ -213,23 +225,41 @@
 	m_Doc->addPage(0);
 	m_Doc->setGUI(false, ScCore->primaryMainWindow(), 0);
 	QByteArray f;
-	fun = new FileUnzip(fNameIn);
-	QString designMap = fun->getFile("designmap.xml");
+	QString designMap;
+	QFileInfo fi = QFileInfo(fNameIn);
+	QString ext = fi.suffix().toLower();
+	if (ext == "idml")
+	{
+		fun = new FileUnzip(fNameIn);
+		designMap = fun->getFile("designmap.xml");
+	}
+	else if (ext == "idms")
+	{
+		designMap = fNameIn;
+		fun = NULL;
+	}
 	if (!designMap.isNull())
 	{
 		loadRawText(designMap, f);
 		if(designMapDom.setContent(f))
 		{
 			QDomElement docElem = designMapDom.documentElement();
-			for(QDomNode drawPag = docElem.firstChild(); !drawPag.isNull(); drawPag = drawPag.nextSibling() )
-			{
-				QDomElement dpg = drawPag.toElement();
-				if (dpg.tagName() == "idPkg:Graphic")
-				{
-					if (!parseGraphicsXML(dpg))
-					{
-						delete fun;
-						return false;
+			if (ext == "idms")
+			{
+				parseGraphicsXMLNode(docElem);
+			}
+			else
+			{
+				for(QDomNode drawPag = docElem.firstChild(); !drawPag.isNull(); drawPag = drawPag.nextSibling() )
+				{
+					QDomElement dpg = drawPag.toElement();
+					if (dpg.tagName() == "idPkg:Graphic")
+					{
+						if (!parseGraphicsXML(dpg))
+						{
+							delete fun;
+							return false;
+						}
 					}
 				}
 			}
@@ -256,6 +286,7 @@
 	firstLayer = true;
 	firstPage = true;
 	pagecount = 1;
+	mpagecount = 0;
 	QFileInfo fi = QFileInfo(fName);
 	if ( !ScCore->usingGUI() )
 	{
@@ -452,8 +483,6 @@
 	def_TextFlow = PageItem::TextFlowDisabled;
 	frameLinks.clear();
 	frameTargets.clear();
-	MasterSpreads.clear();
-	Spreads.clear();
 	importedColors.clear();
 	colorTranslate.clear();
 	importedGradients.clear();
@@ -474,8 +503,19 @@
 	bool retVal = true;
 	bool firstSpread = true;
 	QByteArray f;
-	fun = new FileUnzip(fn);
-	QString designMap = fun->getFile("designmap.xml");
+	QString designMap;
+	QFileInfo fi = QFileInfo(fn);
+	QString ext = fi.suffix().toLower();
+	if (ext == "idml")
+	{
+		fun = new FileUnzip(fn);
+		designMap = fun->getFile("designmap.xml");
+	}
+	else if (ext == "idms")
+	{
+		designMap = fn;
+		fun = NULL;
+	}
 	if (!designMap.isNull())
 	{
 		loadRawText(designMap, f);
@@ -483,76 +523,119 @@
 		{
 			QDomElement docElem = designMapDom.documentElement();
 			QString activeLayer = docElem.attribute("ActiveLayer");
-			for(QDomNode drawPag = docElem.firstChild(); !drawPag.isNull(); drawPag = drawPag.nextSibling() )
-			{
-				QDomElement dpg = drawPag.toElement();
-				if (dpg.tagName() == "Layer")
-				{
-					QString layerSelf = dpg.attribute("Self");
-					QString layerName = dpg.attribute("Name");
-					if (importerFlags & LoadSavePlugin::lfCreateDoc)
-					{
-						int currentLayer = 0;
-						if (!firstLayer)
-							currentLayer = m_Doc->addLayer(layerName);
-						else
-							m_Doc->changeLayerName(currentLayer, layerName);
-						m_Doc->setLayerVisible(currentLayer, (dpg.attribute("Visible") == "true"));
-						m_Doc->setLayerLocked(currentLayer, (dpg.attribute("Locked") == "true"));
-						m_Doc->setLayerPrintable(currentLayer, (dpg.attribute("Printable") == "true"));
-						m_Doc->setLayerFlow(currentLayer, (dpg.attribute("IgnoreWrap","") == "true"));
-					}
-					layerTranslate.insert(layerSelf, layerName);
-					firstLayer = false;
-				}
-				if (dpg.tagName() == "idPkg:Graphic")
-				{
-					if (!parseGraphicsXML(dpg))
-					{
-						retVal = false;
-						break;
-					}
-				}
-				if (dpg.tagName() == "idPkg:Styles")
-				{
-					if (!parseStylesXML(dpg))
-					{
-						retVal = false;
-						break;
-					}
-				}
-				if (dpg.tagName() == "idPkg:Preferences")
-				{
-					if (!parsePreferencesXML(dpg))
-					{
-						retVal = false;
-						break;
-					}
-				}
-				if (dpg.tagName() == "idPkg:MasterSpread")
-					MasterSpreads.append(dpg.attribute("src"));
-				if (dpg.tagName() == "idPkg:Spread")
-				{
-					if (!(importerFlags & LoadSavePlugin::lfCreateDoc))
-					{
-						if (firstSpread)
+			if (ext == "idms")
+			{
+				for(QDomNode drawPag = docElem.firstChild(); !drawPag.isNull(); drawPag = drawPag.nextSibling() )
+				{
+					QDomElement dpg = drawPag.toElement();
+					if (dpg.tagName() == "Layer")
+					{
+						QString layerSelf = dpg.attribute("Self");
+						QString layerName = dpg.attribute("Name");
+						if (importerFlags & LoadSavePlugin::lfCreateDoc)
 						{
-							parseSpreadXML(dpg);
-							firstSpread = false;
+							int currentLayer = 0;
+							if (!firstLayer)
+								currentLayer = m_Doc->addLayer(layerName);
+							else
+								m_Doc->changeLayerName(currentLayer, layerName);
+							m_Doc->setLayerVisible(currentLayer, (dpg.attribute("Visible") == "true"));
+							m_Doc->setLayerLocked(currentLayer, (dpg.attribute("Locked") == "true"));
+							m_Doc->setLayerPrintable(currentLayer, (dpg.attribute("Printable") == "true"));
+							m_Doc->setLayerFlow(currentLayer, (dpg.attribute("IgnoreWrap","") == "true"));
 						}
-					}
-					else if (!parseSpreadXML(dpg))
-					{
-						retVal = false;
-						break;
-					}
-				}
-				if (dpg.tagName() == "idPkg:Story")
-				{
-					if (!parseStoryXML(dpg))
-					{
-						retVal = false;
-						break;
+						layerTranslate.insert(layerSelf, layerName);
+						firstLayer = false;
+					}
+				}
+				parseGraphicsXMLNode(docElem);
+				parseStylesXMLNode(docElem);
+				parsePreferencesXMLNode(docElem);
+				parseSpreadXMLNode(docElem);
+				parseStoryXMLNode(docElem);
+			}
+			else
+			{
+				for(QDomNode drawPag = docElem.firstChild(); !drawPag.isNull(); drawPag = drawPag.nextSibling() )
+				{
+					QDomElement dpg = drawPag.toElement();
+					if (dpg.tagName() == "Layer")
+					{
+						QString layerSelf = dpg.attribute("Self");
+						QString layerName = dpg.attribute("Name");
+						if (importerFlags & LoadSavePlugin::lfCreateDoc)
+						{
+							int currentLayer = 0;
+							if (!firstLayer)
+								currentLayer = m_Doc->addLayer(layerName);
+							else
+								m_Doc->changeLayerName(currentLayer, layerName);
+							m_Doc->setLayerVisible(currentLayer, (dpg.attribute("Visible") == "true"));
+							m_Doc->setLayerLocked(currentLayer, (dpg.attribute("Locked") == "true"));
+							m_Doc->setLayerPrintable(currentLayer, (dpg.attribute("Printable") == "true"));
+							m_Doc->setLayerFlow(currentLayer, (dpg.attribute("IgnoreWrap","") == "true"));
+						}
+						layerTranslate.insert(layerSelf, layerName);
+						firstLayer = false;
+					}
+					if (dpg.tagName() == "idPkg:Graphic")
+					{
+						if (!parseGraphicsXML(dpg))
+						{
+							retVal = false;
+							break;
+						}
+					}
+					if (dpg.tagName() == "idPkg:Styles")
+					{
+						if (!parseStylesXML(dpg))
+						{
+							retVal = false;
+							break;
+						}
+					}
+					if (dpg.tagName() == "idPkg:Preferences")
+					{
+						if (!parsePreferencesXML(dpg))
+						{
+							retVal = false;
+							break;
+						}
+					}
+					if (dpg.tagName() == "idPkg:MasterSpread")
+					{
+						if (importerFlags & LoadSavePlugin::lfCreateDoc)
+						{
+							if (!parseSpreadXML(dpg))
+							{
+								retVal = false;
+								break;
+							}
+						}
+					}
+					if (dpg.tagName() == "idPkg:Spread")
+					{
+						if (!(importerFlags & LoadSavePlugin::lfCreateDoc))
+						{
+							if (firstSpread)
+							{
+								parseSpreadXML(dpg);
+								firstSpread = false;
+							}
+						}
+						else if (!parseSpreadXML(dpg))
+						{
+							retVal = false;
+							break;
+						}
+					}
+					if (dpg.tagName() == "idPkg:Story")
+					{
+						if (!parseStoryXML(dpg))
+						{
+							retVal = false;
+							break;
+						}
 					}
 				}
 			}
@@ -577,7 +660,8 @@
 			}
 		}
 	}
-	delete fun;
+	if (fun != NULL)
+		delete fun;
 	if (progressDialog)
 		progressDialog->close();
 	return retVal;
@@ -603,6 +687,12 @@
 		else
 			return false;
 	}
+	parseGraphicsXMLNode(grNode);
+	return true;
+}
+
+void IdmlPlug::parseGraphicsXMLNode(const QDomElement& grNode)
+	{
 	for (QDomNode n = grNode.firstChild(); !n.isNull(); n = n.nextSibling() )
 	{
 		QDomElement e = n.toElement();
@@ -670,7 +760,7 @@
 			gradientTypeMap.insert(grSelf, grTyp);
 		}
 	}
-	return true;
+	return;
 }
 
 bool IdmlPlug::parseStylesXML(const QDomElement& sElem)
@@ -693,6 +783,12 @@
 		else
 			return false;
 	}
+	parseStylesXMLNode(sNode);
+	return true;
+}
+
+void IdmlPlug::parseStylesXMLNode(const QDomElement& sNode)
+{
 	for (QDomNode n = sNode.firstChild(); !n.isNull(); n = n.nextSibling() )
 	{
 		QDomElement e = n.toElement();
@@ -751,7 +847,7 @@
 			}
 		}
 	}
-	return true;
+	return;
 }
 
 void IdmlPlug::parseObjectStyle(const QDomElement& styleElem)
@@ -947,6 +1043,12 @@
 		else
 			return false;
 	}
+	parsePreferencesXMLNode(prNode);
+	return true;
+}
+
+void IdmlPlug::parsePreferencesXMLNode(const QDomElement& prNode)
+{
 	double topMargin = m_Doc->marginsVal().Top;
 	double leftMargin = m_Doc->marginsVal().Left;
 	double rightMargin = m_Doc->marginsVal().Right;
@@ -1069,7 +1171,7 @@
 		baseX = m_Doc->currentPage()->xOffset();
 		baseY = m_Doc->currentPage()->yOffset() + m_Doc->currentPage()->height() / 2.0;
 	}
-	return true;
+	return;
 }
 
 bool IdmlPlug::parseSpreadXML(const QDomElement& spElem)
@@ -1092,6 +1194,12 @@
 		else
 			return false;
 	}
+	parseSpreadXMLNode(spNode);
+	return true;
+}
+
+void IdmlPlug::parseSpreadXMLNode(const QDomElement& spNode)
+{
 	for (QDomNode n = spNode.firstChild(); !n.isNull(); n = n.nextSibling() )
 	{
 		QDomElement e = n.toElement();
@@ -1138,8 +1246,50 @@
 				}
 			}
 		}
-	}
-	return true;
+/*		else if (e.tagName() == "MasterSpread")
+		{
+			m_Doc->setMasterPageMode(true);
+			for(QDomNode sp = e.firstChild(); !sp.isNull(); sp = sp.nextSibling() )
+			{
+				QDomElement spe = sp.toElement();
+				if (spe.tagName() == "Page")
+				{
+					QString pageNam = spe.attribute("Name") + "_" + spe.attribute("Self");
+					m_Doc->addMasterPage(mpagecount, pageNam);
+					m_Doc->currentPage()->MPageNam = "";
+					m_Doc->view()->addPage(mpagecount, true);
+					mpagecount++;
+					baseX = m_Doc->currentPage()->xOffset();
+					baseY = m_Doc->currentPage()->yOffset() + m_Doc->currentPage()->height() / 2.0;
+				}
+			}
+			if ((facingPages) && (mpagecount % 2 == 0))
+			{
+				baseX = m_Doc->currentPage()->xOffset() + m_Doc->currentPage()->width();
+				baseY = m_Doc->currentPage()->yOffset() + m_Doc->currentPage()->height() / 2.0;
+			}
+			if (!facingPages)
+			{
+				baseX = m_Doc->currentPage()->xOffset() + m_Doc->currentPage()->width() / 2.0;
+				baseY = m_Doc->currentPage()->yOffset() + m_Doc->currentPage()->height() / 2.0;
+			}
+			for(QDomNode sp = e.firstChild(); !sp.isNull(); sp = sp.nextSibling() )
+			{
+				QDomElement spe = sp.toElement();
+				if ((spe.tagName() == "Rectangle") || (spe.tagName() == "Oval") || (spe.tagName() == "GraphicLine") || (spe.tagName() == "Polygon") || (spe.tagName() == "TextFrame") || (spe.tagName() == "Group") || (spe.tagName() == "Button"))
+				{
+					QList<PageItem*> el = parseItemXML(spe);
+					for (int ec = 0; ec < el.count(); ++ec)
+					{
+						m_Doc->Items->append(el.at(ec));
+						Elements.append(el.at(ec));
+					}
+				}
+			}
+			m_Doc->setMasterPageMode(false);
+		} */
+	}
+	return;
 }
 
 QList<PageItem*> IdmlPlug::parseItemXML(const QDomElement& itElem, QTransform pTrans)
@@ -1457,7 +1607,22 @@
 		QTransform finalMat = transformation * pTrans;
 		double scX, scY, rot, dx, dy;
 		getTransformValuesFromMatrix(finalMat, scX, scY, rot, dx, dy);
+		if ((finalMat.m11() < 0) && (finalMat.m12() == 0) && (finalMat.m21() == 0))
+		{
+			QLineF line = QLineF(0.0, 0.0, 1.0, 0.0);
+			line.setAngle(rot);
+			QTransform matrix;
+			matrix.scale(-1, 0);
+			line = matrix.map(line);
+			rot = line.angle();
+			scX *= -1;
+		}
+		if ((finalMat.m22() < 0) && (finalMat.m12() == 0) && (finalMat.m21() == 0))
+		{
+			scY *= -1;
+		}
 		FPoint grOffset(getMinClipF(&GCoords));
+		GCoords.map(finalMat);
 		if (isGroup)
 		{
 			QString pre = "";
@@ -1501,6 +1666,20 @@
 				}
 				PageItem* item = m_Doc->Items->at(z);
 				item->PoLine = GCoords.copy();
+				double dx = 0;
+				double dy = 0;
+				if (rot != 0)
+				{
+					QTransform mr;
+					FPoint grOffset2(getMinClipF(&item->PoLine));
+					mr.translate(-grOffset2.x(), -grOffset2.y());
+					mr.rotate(rot);
+					mr.translate(grOffset2.x(), grOffset2.y());
+					item->PoLine.map(mr);
+					FPoint grOffset3(getMinClipF(&item->PoLine));
+					dx = grOffset2.x() - grOffset3.x();
+					dy = grOffset2.y() - grOffset3.y();
+				}
 				item->ClipEdited = true;
 				item->FrameType = 3;
 				item->setFillShade(fillShade);
@@ -1520,8 +1699,8 @@
 				item->setWidthHeight(wh.x(),wh.y());
 				item->setTextFlowMode(textFlow);
 				m_Doc->AdjustItemSize(item);
+				item->setRotation(-rot, true);
 				item->moveBy(dx, dy, true);
-				item->setRotation(-rot, true);
 				item->OldB2 = item->width();
 				item->OldH2 = item->height();
 				item->updateClip();
@@ -1540,6 +1719,20 @@
 			}
 			z = m_Doc->itemAdd(PageItem::Group, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
 			PageItem *itemg = m_Doc->Items->at(z);
+			double dx = 0;
+			double dy = 0;
+			if (rot != 0)
+			{
+				QTransform mr;
+				FPoint grOffset2(getMinClipF(&GCoords));
+				mr.translate(-grOffset2.x(), -grOffset2.y());
+				mr.rotate(rot);
+				mr.translate(grOffset2.x(), grOffset2.y());
+				GCoords.map(mr);
+				FPoint grOffset3(getMinClipF(&GCoords));
+				dx = grOffset2.x() - grOffset3.x();
+				dy = grOffset2.y() - grOffset3.y();
+			}
 			itemg->PoLine = GCoords.copy();
 			itemg->ClipEdited = true;
 			itemg->FrameType = 3;
@@ -1565,6 +1758,7 @@
 			itemg->OwnPage = m_Doc->OnPage(itemg);
 			m_Doc->Items->takeAt(z);
 			m_Doc->groupObjectsToItem(itemg, GElements);
+			m_Doc->GroupOnPage(itemg);
 		}
 		else
 		{
@@ -1603,6 +1797,20 @@
 					z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, lineWidth, fillColor, strokeColor, true);
 			}
 			PageItem* item = m_Doc->Items->at(z);
+			double dx = 0;
+			double dy = 0;
+			if (rot != 0)
+			{
+				QTransform mr;
+				FPoint grOffset2(getMinClipF(&GCoords));
+				mr.translate(-grOffset2.x(), -grOffset2.y());
+				mr.rotate(rot);
+				mr.translate(grOffset2.x(), grOffset2.y());
+				GCoords.map(mr);
+				FPoint grOffset3(getMinClipF(&GCoords));
+				dx = grOffset2.x() - grOffset3.x();
+				dy = grOffset2.y() - grOffset3.y();
+			}
 			item->PoLine = GCoords.copy();
 			item->ClipEdited = true;
 			item->FrameType = 3;
@@ -1744,6 +1952,7 @@
 			item->OwnPage = m_Doc->OnPage(item);
 			m_Doc->Items->takeAt(z);
 			m_Doc->groupObjectsToItem(item, GElements);
+			m_Doc->GroupOnPage(item);
 		}
 	}
 	return GElements;
@@ -1769,13 +1978,19 @@
 		else
 			return false;
 	}
+	parseStoryXMLNode(stNode);
+	return true;
+}
+
+void IdmlPlug::parseStoryXMLNode(const QDomElement& stNode)
+{
 	for (QDomNode n = stNode.firstChild(); !n.isNull(); n = n.nextSibling() )
 	{
 		QDomElement e = n.toElement();
 		QString storyName = e.attribute("Self");
 		PageItem *item = NULL;
 		if (!storyMap.contains(storyName))
-			return true;
+			return;
 		item = storyMap[storyName];
 		if (e.tagName() == "Story")
 		{
@@ -1869,7 +2084,15 @@
 								QDomElement s = stch.toElement();
 								if (s.tagName() == "Content")
 								{
-									QString ch = s.text();
+									QString ch = "";
+									for(QDomNode sh = s.firstChild(); !sh.isNull(); sh = sh.nextSibling() )
+									{
+										QString p = sh.nodeValue();
+										if (sh.nodeName() == "#text")
+											ch += p;
+										else if (p == "18")
+											ch += SpecialChars::PAGENUMBER;
+									}
 									if (!ch.isEmpty())
 									{
 										for (int tt = 0; tt < ch.length(); ++tt)
@@ -1914,7 +2137,7 @@
 			}
 		}
 	}
-	return true;
+	return;
 }
 
 void IdmlPlug::readCharStyleAttributes(CharStyle &newStyle, const QDomElement &styleElem)

Modified: trunk/Scribus/scribus/plugins/import/idml/importidml.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17222&path=/trunk/Scribus/scribus/plugins/import/idml/importidml.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/idml/importidml.h (original)
+++ trunk/Scribus/scribus/plugins/import/idml/importidml.h Sun Jan 22 18:53:59 2012
@@ -83,14 +83,19 @@
 	QString getNodeValue(QDomNode &baseNode, QString path);
 	bool convert(QString fn);
 	bool parseGraphicsXML(const QDomElement& grElem);
+	void parseGraphicsXMLNode(const QDomElement& grNode);
 	bool parseStylesXML(const QDomElement& sElem);
+	void parseStylesXMLNode(const QDomElement& sNode);
 	void parseObjectStyle(const QDomElement& styleElem);
 	void parseCharacterStyle(const QDomElement& styleElem);
 	void parseParagraphStyle(const QDomElement& styleElem);
 	bool parsePreferencesXML(const QDomElement& prElem);
+	void parsePreferencesXMLNode(const QDomElement& prNode);
 	bool parseSpreadXML(const QDomElement& spElem);
+	void parseSpreadXMLNode(const QDomElement& spNode);
 	QList<PageItem*> parseItemXML(const QDomElement& itElem, QTransform pTrans = QTransform());
 	bool parseStoryXML(const QDomElement& stElem);
+	void parseStoryXMLNode(const QDomElement& stNode);
 	void readCharStyleAttributes(CharStyle &newStyle, const QDomElement &styleElem);
 	void readParagraphStyleAttributes(ParagraphStyle &newStyle, const QDomElement &styleElem);
 	void resolveObjectStyle(ObjectStyle &nstyle, QString baseStyleName);
@@ -113,10 +118,9 @@
 	bool firstLayer;
 	bool firstPage;
 	int pagecount;
+	int mpagecount;
 	bool facingPages;
 	QDomDocument designMapDom;
-	QStringList MasterSpreads;
-	QStringList Spreads;
 	QStringList importedColors;
 	QMap<QString, QString> colorTranslate;
 	QStringList importedGradients;

Modified: trunk/Scribus/scribus/plugins/import/idml/importidmlplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17222&path=/trunk/Scribus/scribus/plugins/import/idml/importidmlplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/idml/importidmlplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/idml/importidmlplugin.cpp Sun Jan 22 18:53:59 2012
@@ -106,6 +106,21 @@
 	fmt.mimeTypes.append("application/vnd.adobe.indesign-idml-package");
 	fmt.priority = 64; // Priority
 	registerFormat(fmt);
+
+	FileFormat fmt2(this);
+	fmt2.trName = tr("Adobe Indesign IDMS");
+	fmt2.filter = tr("Adobe Indesign IDMS (*.idms *.IDMS)");
+	fmt2.formatId = 0;
+	fmt2.nameMatch = QRegExp("\\.idms$", Qt::CaseInsensitive);
+	fmt2.fileExtensions = QStringList() << "idms";
+	fmt2.load = true;
+	fmt2.save = false;
+	fmt2.thumb = true;
+	fmt2.colorReading = true;
+	fmt2.mimeTypes = QStringList();
+	fmt2.mimeTypes.append("application/vnd.adobe.indesign-idms");
+	fmt2.priority = 64; // Priority
+	registerFormat(fmt2);
 }
 
 bool ImportIdmlPlugin::fileSupported(QIODevice* /* file */, const QString & fileName) const
@@ -128,7 +143,7 @@
 		flags |= lfInteractive;
 		PrefsContext* prefs = PrefsManager::instance()->prefsFile->getPluginContext("importidml");
 		QString wdir = prefs->get("wdir", ".");
-		CustomFDialog diaf(ScCore->primaryMainWindow(), wdir, QObject::tr("Open"), tr("All Supported Formats")+" (*.idml *.IDML);;All Files (*)");
+		CustomFDialog diaf(ScCore->primaryMainWindow(), wdir, QObject::tr("Open"), tr("All Supported Formats")+" (*.idml *.IDML *.idms *.IDMS);;All Files (*)");
 		if (diaf.exec())
 		{
 			fileName = diaf.selectedFile();




More information about the scribus-commit mailing list