--- a
+++ b/gsoc2009/textfilter/scribus/plugins/idmlimplugin/designmap.cpp
@@ -0,0 +1,199 @@
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+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.
+*/
+
+#include "util.h"
+#include "designmap.h"
+
+
+IDPKGDesignMap::IDPKGDesignMap(QString &designPath)
+{
+	loadFile(designPath);
+}
+
+void IDPKGDesignMap::loadFile(QString &filename)
+{
+	QFile file(filename);
+	file.open(QIODevice::ReadOnly || QIODevice::Text);
+	doc.setContent(filename);
+	root = doc.documentElement();
+	file.close();
+}
+
+bool IDPKGDesignMap::processDesignMap()
+{
+	if(root.tagName() != "Document")
+	      return false;
+	else
+	{
+		/*get the attributes of Document Tag before going into its children */
+		docAttributes(root);
+		node = root.firstChild();
+		while(!node.isNull())
+		{
+			element = node.toElement();
+			if(!element.isNull())
+			{
+				if(element.tagName()=="Language")
+				{
+					handleLanguage(element);
+				}
+				if(element.tagName()=="idPkg:Graphic")
+				{
+					/* set the source here */
+				}
+				if(element.tagName()=="idPkg:Fonts")
+				{
+					/* set the source here */
+				}
+				if(element.tagName()=="idPkg:Styles")
+				{
+					/* set the source here */
+				}
+				if(element.tagName()=="NumberingList")
+				{
+					/* set the source here */
+				}
+				if(element.tagName()=="NamedGrid")
+				{
+				}
+				if(element.tagName()=="idPkg:Preferences")
+				{
+					/* set the source here */
+				}
+				if(element.tagName()=="Layer")
+				{
+					handleLayer(element);
+				}
+				if(element.tagName()=="idPkg:Spread")
+				{
+					getSpreadSrc();
+				}
+				if(element.tagName()=="idPkg:MasterSpread")
+				{
+					getMSpreadSrc();
+				}
+				if(element.tagName()=="idPkg:Story")
+				{
+					getStorySrc();
+				}
+				if(element.tagName()=="Section")
+				{
+					handleSection(element);
+				}
+				if(element.tagName()=="CrossReferenceFormat")
+				{
+					handleCRFormat(element);
+				}
+				if(element.tagName()=="Bookmark")
+				{
+					handleBookmarks();
+				}
+			}
+			node = node.nextSibling();
+	      }
+}
+
+void IDPKGDesignMap::docAttributes(QDomElement& element)
+{
+	idmlDocument.self=element.attribute("Self","");
+}
+
+
+void IDPKGDesignMap::handleLanguage(QDomElement& element)
+{
+	Language l;
+	l.name=element.attribute("Name","");
+	l.languageID=element.attribute("Id","").toInt();
+	l.DoubleQuotes=element.attribute("DoubleQuotes","");
+	l.singleQuotes=element.attribute("SingleQuotes","");
+	l.Self=element.attribute("Self","");
+	l.Sublanguage=element.attribute("SublanguageName","");
+	idmlDocument.languageList<<l;
+}
+
+
+void IDPKGDesignMap::handleLayer(QDomElement& element)
+{
+	Layer l;
+	l.self=element.attribute("Self","");
+	l.Name=element.attribute("Name","");
+	l.visible = (element.attribute("Visible","")=="true")?true:false;
+	l.locked = (element.attribute("Locked","")=="true")?true:false;
+	l.ignoreWrap = (element.attribute("IgnoreWrap","")=="true")?true:false;
+	l.showGuides = (element.attribute("ShowGuides","")=="true")?true:false;
+	l.lockGuides = (element.attribute("LockGuides","")=="true")?true:false;
+	l.expandable = (element.attribute("Expendable","")=="true")?true:false;
+	l.printable = (element.attribute("Printable","")=="true")?true:false;
+	//descending down to properties of layer
+	QDomNode n = node.firstChild().firstChild();
+	QDomElement lcolor = n.toElement();
+	l.LayerColor=lcolor.text();
+	
+	idmlDocument.layerList<<l;
+}
+
+
+void IDPKGDesignMap::handleSection(QDomElement& element)
+{
+	Section s;
+	s.self=element.attribute("Self","");
+	s.length=element.attribute("Length","").toInt();
+	s.Name=element.attribute("Name","");
+	s.PageNumberStyle=element.attribute("PageNumberStyle","");
+	s.continueNumbering = (element.attribute("ContinueNumbering","")=="true")?true:false;
+	s.includeSecPrefix = (element.attribute("IncludeSectionPrefix","")=="true")?true:false;
+	s.Marker=element.attribute("Marker","");
+	s.pageStart=element.attribute("PageStart","");
+	s.sectionPrefix=element.attribute("SectionPrefix","");
+	idmlDocument.sectionList<<s;
+}
+
+
+void IDPKGDesignMap::handleBookmarks(QDomElement& element)
+{
+	Bookmark b;
+	b.self=element.attribute("Self","");
+	b.Name=element.attribute("Name","");
+	b.Destination=element.attribute("Destination","");
+	
+	QDomNode n = node.firstChild().firstChild();
+	QDomElement label = n.toElement();
+	b.Label = label.attribute("Label","");
+	
+	idmlDocument.bookmark<<b;
+}
+
+
+void IDPKGDesignMap::handleCRFormat(QDomElement& element)
+{
+	/* will add later, currently, we don't need this to import the documentElement
+	*/
+}
+
+
+void IDPKGDesignMap::getMSpreadSrc(QDomElement& element)
+{
+	idmlDocument.MasterSpreads<<element.attribute("src","");
+}
+
+
+void IDPKGDesignMap::getSpreadSrc(QDomElement& element)
+{
+	idmlDocument.Spreads<<element.attribute("src","");
+}
+
+
+void IDPKGDesignMap::getStorySrc(QDomElement& element)
+{
+	idmlDocument.storyList<<element.attribute("src","");
+}
+
+void IDPKGDesignMap::getBStorySrc(QDomElement& element)
+{
+	/* will be tackled later on
+	*/
+}