--- a
+++ b/gsoc2009/textfilter/scribus/plugins/idmlimplugin/idmlstyles.cpp
@@ -0,0 +1,226 @@
+/*
+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.
+*/
+ /***************************************************************************
+  *   Copyright (C) 2009 by Jain Basil Aliyas                               *
+  *   mail@jainbasil.net                                                    *
+  *                                                                         *
+  *   This program is free software; you can redistribute it and/or modify  *
+  *   it under the terms of the GNU General Public License as published by  *
+  *   the Free Software Foundation; either version 2 of the License, or     *
+  *   (at your option) any later version.                                   *
+  *                                                                         *
+  *   This program is distributed in the hope that it will be useful,       *
+  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+  *   GNU General Public License for more details.                          *
+  *                                                                         *
+  *   You should have received a copy of the GNU General Public License     *
+  *   along with this program; if not, write to the                         *
+  *   Free Software Foundation, Inc.,                                       *
+  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+  ***************************************************************************/
+ 
+#include "styles/charstyle.h"
+#include "styles/paragraphstyle.h"
+#include "styles/linestyle.h"
+#include "idmlstyles.h"
+#include <QByteArray>
+#include <QXmlStreamReader>
+#include <QFile>
+
+
+IDMLStyles::IDMLStyles(QString &stylePath)
+{
+	loadFile(stylePath);
+}
+
+IDMLStyles::~IDMLStyles()
+{
+}
+
+void IDMLStyles::loadFile(QString &fileName)
+{
+    QFile file(fileName);
+    file.open(QIODevice::ReadOnly || QIODevice::Text);
+    doc.setContent( fileName );
+    root=doc.documentElement();
+    file.close();
+}
+
+bool IDMLStyles::processStyleFile()
+{
+	if(root.tagName() != "idPkg:Styles")
+	{
+		return false;
+	}
+	else
+	{
+		node = root.firstChild();
+		while( !node.isNull() )
+		{
+			element = node.toElement();
+			if(!element.isNull())
+			{
+				if( element.tagName()=="RootCharacterStyleGroup" )
+					getCharacterStyles();
+				if( element.tagName()=="RootParagraphStyleGroup")
+					getParagraphStyles();
+				if( element.tagName()=="TOCStyle")
+					getTOCStyles();
+				if( element.tagName()=="RootCellStyleGroup")
+					getCellStyles();
+				if( element.tagName()=="RootTableStyleGroup")
+					getTableStyles();
+				if( element.tagName()=="RootObjectStyleGroup")
+					getObjectStyles();
+			}
+			node = node.nextSibling();
+		}
+		return true;
+	}
+}
+
+void IDMLStyles::getCharacterStyles()
+{
+	QDomNode icharStyle = node.firstChild();
+	while( !icharStyle.isNull())
+	{
+		QDomElement e = icharStyle.toElement();
+		if(!e.isNull())
+		{
+			QString Self = e.attribute("Self","");
+			cstyle.setName(e.attribute("Name",""));
+			cstyle.setParent(e.attribute("BasedOn",""));
+			cstyle.setFontSize(e.attribute("FontSize","").toDouble());
+			cstyle.setFillShade(e.attribute("FillTint","").toDouble());
+			cstyle.setStrokeShade(e.attribute("StrokeTint","").toDouble());
+			cstyle.setScaleH(e.attribute("HorizontalScale","").toDouble());
+			cstyle.setScaleV(c.vertScale=e.attribute("VerticalScale","").toDouble());
+			cstyle.setBaselineOffset(e.attribute("BaselineShift","").toDouble().toDouble());
+			cstyle.setOutlineWidth(e.attribute("StrokeWeight","").toDouble());
+			cstyle.setUnderlineOffset(e.attribute("UnderlineOffset","").toDouble());
+			cstyle.setUnderlineWidth(e.attribute("UnderlineWeight","").toDouble());
+			/*
+			c.self=e.attribute("Self","");
+			c.imported=(e.attribute("Imported","")=="true")?true:false;
+			c.fontStyle=e.attribute("FontStyle","");
+			c.pointSize=e.attribute("PointSize","").toDouble();
+			c.kerningMethod=e.attribute("KerningMethod","");
+			c.Tracking=e.attribute("Tracking","").toDouble();
+			c.underline=(e.attribute("Underline","")=="true")?true:false;
+			c.strikeThru=(e.attribute("StrikeThru","")=="true")?true:false;
+			c.BasedOn=e.attribute("BasedOn","");
+			c.horizScale=e.attribute("HorizontalScale","").toDouble();
+			c.language=e.attribute("AppliedLanguage","");
+			c.Name=e.attribute("Name","");
+			c.underlineOffset=e.attribute("UnderlineOffset","").toDouble();
+			c.Name=e.attribute("Name","");
+			c.KeyboardShortcut=e.attribute("KeyboardShortcut","");
+			c.underlineOffset=e.attribute("UnderlineOffset","").toDouble();
+			c.strikethruOffset=e.attribute("StrikethruOffset","");
+			c.fillColor=e.attribute("FillColor","");
+			c.fillTint=e.attribute("FillTint","");
+			c.vertScale=e.attribute("VerticalScale","").toDouble();
+			c.baselineShift=e.attribute("BaselineShift","").toDouble();*/
+			// reading the properties, if exist for this style
+			
+			QDomNode property = icharStyle.firstChild();
+			while( !property.isNull() )
+			{
+				QDomElement e = property.toElement();
+				if(!e.isNull())
+				{
+					if( e.tagName()=="BasedOn")
+						c.BasedOn=e.text();
+					if( e.tagName()=="AppliedFont")
+						c.AppliedFont=e.text();
+				}
+				property=property.nextSibling();
+			}
+			
+		}
+		icharStyle = icharStyle.nextSibling();
+	}
+}
+
+void IDMLStyles::getParagraphStyles()
+{
+	QDomNode pstyle = node.firstChild();
+	while( !pstyle.isNull() )
+	{
+		QDomElement e = pstyle.toElement();
+		if(!e.isNull())
+		{
+			IDMLPStyle parStyle;
+			parStyle.self = e.attribute("Self","");
+			parStyle.Name = e.attribute("Name","");
+			parStyle.imported = (e.attribute("Imported","")=="true")?true:false;
+			parStyle.NextStyle = e.attribute("NextStyle","");
+			
+		}
+		pstyle=pstyle.nextSibling();
+	}
+}
+
+void IDMLStyles::getTOCStyles()
+{
+	QDomNode tocStyle = node.firstChild();
+	while( !tocStyle.isNull() )
+	{
+		QDomElement e = tocStyle.toElement();
+		if( !e.isNull() )
+		{
+			/* Do ajor of you toc style code here 
+			*/
+		}
+		tocStyle=tocStyle.nextSibling();
+	}
+}
+
+void IDMLStyles::getCellStyles()
+{
+	QDomNode cellStyle = node.firstChild();
+	while( !cellStyle.isNull() )
+	{
+		QDomElement e = cellStyle.toElement();
+		if( !e.isNull() )
+		{
+			/* major coding section here */
+		}
+		cellStyle=cellStyle.nextSibling();		
+	}
+}
+
+void IDMLStyles::getTableStyles()
+{
+	QDomNode tableStyle = node.firstChild();
+	while( !tableStyle.isNull() )
+	{
+		QDomElement e = tableStyle.toElement();
+		if( !e.isNull())
+		{
+			/* do code here
+			*/
+		}
+		tableStyle=tableStyle.nextSibling();
+	}
+}
+
+void IDMLStyles::getObjectStyles()
+{
+	QDomNode objStyle = node.firstChild();
+	while( !objStyle.isNull() )
+	{
+		QDomElement e = objStyle.toElement();
+		if( !e.isNull() )
+		{
+			/* implement object style here */
+		}
+		objStyle=objStyle.nextSibling();
+	}
+}
+