r16943 by fschmid - PageItem property "ItemNr" is gone now as its no longer useful with the new group code.

scribus-commit scribus-commit at lists.scribus.net
Tue Nov 1 08:51:14 UTC 2011


Author: fschmid
Date: Tue Nov  1 08:51:14 2011
New Revision: 16943

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16943
Log:
PageItem property "ItemNr" is gone now as its no longer useful with the new group code.

Modified:
    trunk/Scribus/scribus/canvas.cpp
    trunk/Scribus/scribus/canvasmode.cpp
    trunk/Scribus/scribus/canvasmode_drawbezier.cpp
    trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp
    trunk/Scribus/scribus/canvasmode_drawfreehand.cpp
    trunk/Scribus/scribus/canvasmode_edit.cpp
    trunk/Scribus/scribus/canvasmode_framelinks.cpp
    trunk/Scribus/scribus/canvasmode_nodeedit.cpp
    trunk/Scribus/scribus/canvasmode_normal.cpp
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/pageitem.h
    trunk/Scribus/scribus/pageitem_osgframe.cpp
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h
    trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
    trunk/Scribus/scribus/plugins/import/ai/importai.cpp
    trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
    trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp
    trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
    trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
    trunk/Scribus/scribus/plugins/import/pct/importpct.cpp
    trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
    trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
    trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
    trunk/Scribus/scribus/plugins/import/sml/importsml.cpp
    trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
    trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
    trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp
    trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
    trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdpage.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.h
    trunk/Scribus/scribus/plugins/tools/pathfinder/pathfinder.cpp
    trunk/Scribus/scribus/plugins/tools/pathstroker/pathstroker.cpp
    trunk/Scribus/scribus/pslib.cpp
    trunk/Scribus/scribus/scpage.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusXml.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h
    trunk/Scribus/scribus/scribusview.cpp
    trunk/Scribus/scribus/sctextstruct.cpp
    trunk/Scribus/scribus/text/storytext.cpp
    trunk/Scribus/scribus/ui/charselect.cpp
    trunk/Scribus/scribus/ui/cpalette.cpp
    trunk/Scribus/scribus/ui/extimageprops.cpp
    trunk/Scribus/scribus/ui/outlinepalette.cpp
    trunk/Scribus/scribus/ui/picstatus.cpp
    trunk/Scribus/scribus/ui/propertiespalette.cpp
    trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp
    trunk/Scribus/scribus/ui/storyeditor.cpp

Modified: trunk/Scribus/scribus/canvas.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/canvas.cpp
==============================================================================
--- trunk/Scribus/scribus/canvas.cpp (original)
+++ trunk/Scribus/scribus/canvas.cpp Tue Nov  1 08:51:14 2011
@@ -557,7 +557,8 @@
 	int indice = qMin(index, m_doc->Items->count());
 	if (index < 0 || indice < 0)
 		return NULL;
-	
+
+	int itemid = m_doc->Items->indexOf(item);
 	QRectF baseRect(item->getBoundingRect());
 	int itemLevel = m_doc->layerLevelFromID(item->LayerID);
 	if (itemLevel < 0)
@@ -566,10 +567,11 @@
 	for(index = indice - 1; index >= 0; --index)
 	{
 		PageItem* item1 = m_doc->Items->at(index);
+		int item1id = m_doc->Items->indexOf(item1);
 		int level = m_doc->layerLevelFromID(item1->LayerID);
 		if ((item != item1) && (level >= 0) && (level <= itemLevel))
 		{
-			if ((level == itemLevel) && (item1->ItemNr > item->ItemNr))
+			if ((level == itemLevel) && (item1id > itemid))
 				continue;
 			QRectF uRect(item1->getBoundingRect());
 			if(baseRect.intersects(uRect))

Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Tue Nov  1 08:51:14 2011
@@ -944,7 +944,7 @@
 			if (m_doc->SubMode != -1)
 			{
 				m_view->Deselect(false);
-				m_doc->Items->removeAt(currItem->ItemNr);
+				m_doc->Items->removeOne(currItem);
 			}
 			else
 				m_view->Deselect(false);
@@ -1234,7 +1234,7 @@
 								currItem->moveImageXYOffsetBy(resizeBy / currItem->imageXScale(), 0);
 							}
 							currItem->Sizing = false;
-							m_doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem->ItemNr);
+							m_doc->SizeItem(currItem->width()+resizeBy, currItem->height(), currItem);
 						}
 					}
 					currItem->update();
@@ -1296,7 +1296,7 @@
 								currItem->moveImageXYOffsetBy(resizeBy / currItem->imageXScale(), 0);
 							}
 							currItem->Sizing = false;
-							m_doc->SizeItem(currItem->width() + resizeBy, currItem->height(), currItem->ItemNr);
+							m_doc->SizeItem(currItem->width() + resizeBy, currItem->height(), currItem);
 						}
 					}
 					currItem->update();
@@ -1358,7 +1358,7 @@
 								currItem->moveImageXYOffsetBy(0, resizeBy / currItem->imageYScale());
 							}
 							currItem->Sizing = false;
-							m_doc->SizeItem(currItem->width(), currItem->height() + resizeBy, currItem->ItemNr);
+							m_doc->SizeItem(currItem->width(), currItem->height() + resizeBy, currItem);
 						}
 					}
 					currItem->update();
@@ -1420,7 +1420,7 @@
 								currItem->moveImageXYOffsetBy(0, resizeBy / currItem->imageYScale());
 							}
 							currItem->Sizing = false;
-							m_doc->SizeItem(currItem->width(), currItem->height() + resizeBy, currItem->ItemNr);
+							m_doc->SizeItem(currItem->width(), currItem->height() + resizeBy, currItem);
 						}
 					}
 					currItem->update();

Modified: trunk/Scribus/scribus/canvasmode_drawbezier.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/canvasmode_drawbezier.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawbezier.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_drawbezier.cpp Tue Nov  1 08:51:14 2011
@@ -86,13 +86,13 @@
 	if (currItem->PoLine.size() < 4)
 	{
 //		emit DelObj(m_doc->currentPage->pageNr(), currItem->ItemNr);
-		m_doc->Items->removeAt(currItem->ItemNr);
+		m_doc->Items->removeOne(currItem);
 		m_doc->m_Selection->removeFirst();
 		//emit HaveSel(-1);
 	}
 	else
 	{
-		m_doc->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem->ItemNr, false, false);
+		m_doc->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem, false, false);
 //		currItem->setPolyClip(qRound(qMax(currItem->lineWidth() / 2.0, 1)));
 		m_doc->AdjustItemSize(currItem);
 		currItem->ContourLine = currItem->PoLine.copy();
@@ -338,7 +338,7 @@
 		currItem->PoLine.translate(0, -npf2.y());
 		m_doc->MoveItem(0, npf2.y(), currItem);
 	}
-	m_doc->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem->ItemNr, false, false, false);
+	m_doc->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem, false, false, false);
 	currItem->setPolyClip(qRound(qMax(currItem->lineWidth() / 2, 1.0)));
 	m_canvas->newRedrawPolygon();
 }
@@ -397,7 +397,7 @@
 		}
 		else
 		{
-			m_doc->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem->ItemNr, false, false, false);
+			m_doc->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem, false, false, false);
 			m_doc->AdjustItemSize(currItem);
 			currItem->Sizing = ssiz;
 			currItem->ContourLine = currItem->PoLine.copy();

Modified: trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp Tue Nov  1 08:51:14 2011
@@ -272,7 +272,7 @@
 			currItem->setXYPos(tp2.x(), tp2.y(), true);
 			currItem->PoLine.translate(-tp2.x(), -tp2.y());
 			FPoint tp(getMaxClipF(&currItem->PoLine));
-			m_doc->SizeItem(tp.x(), tp.y(), currItem->ItemNr, false, false, false);
+			m_doc->SizeItem(tp.x(), tp.y(), currItem, false, false, false);
 			m_doc->AdjustItemSize(currItem);
 			m_doc->m_Selection->clear();
 			m_doc->m_Selection->addItem(currItem);
@@ -320,7 +320,7 @@
 	//Commit drag created items to undo manager.
 	if (m_doc->m_Selection->itemAt(0)!=NULL)
 	{
-		m_doc->itemAddCommit(m_doc->m_Selection->itemAt(0)->ItemNr);
+		m_doc->itemAddCommit(m_doc->m_Selection->itemAt(0));
 	}
 	//Make sure the Zoom spinbox and page selector dont have focus if we click on the canvas
 	m_view->zoomSpinBox->clearFocus();

Modified: trunk/Scribus/scribus/canvasmode_drawfreehand.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/canvasmode_drawfreehand.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawfreehand.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_drawfreehand.cpp Tue Nov  1 08:51:14 2011
@@ -266,7 +266,7 @@
 			currItem->setXYPos(tp2.x(), tp2.y(), true);
 			currItem->PoLine.translate(-tp2.x(), -tp2.y());
 			FPoint tp(getMaxClipF(&currItem->PoLine));
-			m_doc->SizeItem(tp.x(), tp.y(), currItem->ItemNr, false, false, false);
+			m_doc->SizeItem(tp.x(), tp.y(), currItem, false, false, false);
 			m_doc->AdjustItemSize(currItem);
 			m_doc->m_Selection->clear();
 			m_doc->m_Selection->addItem(currItem);
@@ -311,7 +311,7 @@
 	//Commit drag created items to undo manager.
 	if (m_doc->m_Selection->itemAt(0)!=NULL)
 	{
-		m_doc->itemAddCommit(m_doc->m_Selection->itemAt(0)->ItemNr);
+		m_doc->itemAddCommit(m_doc->m_Selection->itemAt(0));
 	}
 	//Make sure the Zoom spinbox and page selector dont have focus if we click on the canvas
 	m_view->zoomSpinBox->clearFocus();

Modified: trunk/Scribus/scribus/canvasmode_edit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/canvasmode_edit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_edit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_edit.cpp Tue Nov  1 08:51:14 2011
@@ -912,7 +912,7 @@
 	//Commit drag created items to undo manager.
 	if (m_doc->m_Selection->itemAt(0)!=NULL)
 	{
-		m_doc->itemAddCommit(m_doc->m_Selection->itemAt(0)->ItemNr);
+		m_doc->itemAddCommit(m_doc->m_Selection->itemAt(0));
 	}
 	//Make sure the Zoom spinbox and page selector dont have focus if we click on the canvas
 	m_view->zoomSpinBox->clearFocus();

Modified: trunk/Scribus/scribus/canvasmode_framelinks.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/canvasmode_framelinks.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_framelinks.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_framelinks.cpp Tue Nov  1 08:51:14 2011
@@ -192,13 +192,14 @@
 				if (currItem->nextInChain() == 0 && bb->prevInChain() == 0 && currItem != bblast)
 				{
 					currItem->link(bb);
+					int cid = m_doc->Items->indexOf(currItem);
+					int bid = m_doc->Items->indexOf(bb);
 					// CB We need to do this because we draw in the order of the item list
 					// Which is also item number list.. but #3488: we must also renumber the items
-					if (bb->ItemNr < currItem->ItemNr)
+					if (bid < cid)
 					{
-						m_doc->Items->insert(currItem->ItemNr+1, bb);
-						bb = m_doc->Items->takeAt(bb->ItemNr);
-						m_doc->renumberItemsInListOrder();
+						m_doc->Items->insert(cid+1, bb);
+						bb = m_doc->Items->takeAt(bid);
 					}
 					// m_view->updateContents();
 					// link calls PageItem::update	

Modified: trunk/Scribus/scribus/canvasmode_nodeedit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/canvasmode_nodeedit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_nodeedit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_nodeedit.cpp Tue Nov  1 08:51:14 2011
@@ -644,7 +644,7 @@
 	//Commit drag created items to undo manager.
 	if (m_doc->m_Selection->itemAt(0)!=NULL)
 	{
-		m_doc->itemAddCommit(m_doc->m_Selection->itemAt(0)->ItemNr);
+		m_doc->itemAddCommit(m_doc->m_Selection->itemAt(0));
 	}
 	//Make sure the Zoom spinbox and page selector dont have focus if we click on the canvas
 	m_view->zoomSpinBox->clearFocus();
@@ -882,7 +882,7 @@
 					{
 						cli.putPoints(0, EndInd-StartInd, Clip, StartInd);
 						int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, currItem->xPos(), currItem->yPos(), currItem->width(), currItem->height(), currItem->lineWidth(), currItem->fillColor(), currItem->lineColor(), true);
-						PageItem* bb = m_doc->Items->at(z);
+						PageItem* bb = m_doc->Items->takeAt(z);
 						if (m_doc->nodeEdit.isContourLine)
 							bb->ContourLine.resize(0);
 						else
@@ -908,10 +908,9 @@
 								bb->PoLine.putPoints(0, Clip.size()-EndInd-4, Clip, EndInd+4);
 						}
 						bb->setRotation(currItem->rotation());
+						bb->ClipEdited = true;
+						m_doc->Items->insert(m_doc->Items->indexOf(currItem), bb);
 						m_doc->AdjustItemSize(bb);
-						bb->ClipEdited = true;
-						PageItem *bx = m_doc->Items->takeAt(bb->ItemNr);
-						m_doc->Items->insert(bb->ItemNr-1, bx);
 					}
 					currItem->PoLine = cli.copy();
 				}

Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Tue Nov  1 08:51:14 2011
@@ -387,7 +387,7 @@
 				m_doc->DraggedElem = currItem;
 				m_doc->DragElements.clear();
 				for (int dre=0; dre<m_doc->m_Selection->count(); ++dre)
-					m_doc->DragElements.append(m_doc->m_Selection->itemAt(dre)->ItemNr);
+					m_doc->DragElements.append(m_doc->m_Selection->itemAt(dre));
 				ScriXmlDoc *ss = new ScriXmlDoc();
 				ScElemMimeData* md = new ScElemMimeData();
 				md->setScribusElem(ss->WriteElem(m_doc, m_doc->m_Selection));
@@ -1088,7 +1088,7 @@
 	//Commit drag created items to undo manager.
 	if (m_doc->m_Selection->itemAt(0)!=NULL)
 	{
-		m_doc->itemAddCommit(m_doc->m_Selection->itemAt(0)->ItemNr);
+		m_doc->itemAddCommit(m_doc->m_Selection->itemAt(0));
 	}
 	//Make sure the Zoom spinbox and page selector dont have focus if we click on the canvas
 	m_view->zoomSpinBox->clearFocus();

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Tue Nov  1 08:51:14 2011
@@ -141,7 +141,6 @@
 	textPathFlipped(other.textPathFlipped),
 	ClipEdited(other.ClipEdited),
 	FrameType(other.FrameType),
-	ItemNr(other.ItemNr),
 	Frame(other.Frame),
 	OwnPage(other.OwnPage),
 	oldOwnPage(other.oldOwnPage),
@@ -354,6 +353,7 @@
 		tempImageFile = NULL;
 		isInlineImage = false;
 	}
+	Parent = NULL;
 	unWeld();
 }
 
@@ -380,6 +380,7 @@
 	m_SizeLocked(false),
 	textFlowModeVal(TextFlowDisabled)
 {
+	Parent = NULL;
 	m_Doc = pa;
 	QString tmp;
 	BackBox = 0;
@@ -4052,11 +4053,10 @@
 	{
 		QRectF baseRect(getBoundingRect());
 		QList<PageItem*>* items = OnMasterPage.isEmpty() ? &m_Doc->DocItems : &m_Doc->MasterItems;
-		for(int idx = items->count()-1; idx >= 0 ; --idx)
-		{
-			if ((items->at(idx) == this) && (!allItems))
-				break;
-			if(idx != static_cast<int>(ItemNr)) // avoids itself
+		if (!allItems)
+		{
+			int ids = items->indexOf(this) - 1;
+			for(int idx = ids; idx >= 0 ; --idx)
 			{
 				if(items->at(idx)->asTextFrame()) // do not bother with no text frames
 				{
@@ -4064,6 +4064,23 @@
 					if(baseRect.intersects(uRect))
 					{
 						items->at(idx)->update();
+					}
+				}
+			}
+		}
+		else
+		{
+			for(int idx = items->count() - 1; idx >= 0 ; --idx)
+			{
+				if(items->at(idx) != this) // avoids itself
+				{
+					if(items->at(idx)->asTextFrame()) // do not bother with no text frames
+					{
+						QRectF uRect(items->at(idx)->getBoundingRect());
+						if(baseRect.intersects(uRect))
+						{
+							items->at(idx)->update();
+						}
 					}
 				}
 			}
@@ -4713,7 +4730,8 @@
 		textFlowModeVal = newMode;
 	
 	QList<PageItem*> pList;
-	for(int idx = ItemNr-1; idx >= 0 ; --idx)
+	int id = m_Doc->Items->indexOf(this) - 1;
+	for(int idx = id; idx >= 0 ; --idx)
 	{
 		pList << m_Doc->Items->at(idx);
 	}

Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Tue Nov  1 08:51:14 2011
@@ -465,8 +465,6 @@
 	bool ClipEdited;
 	// Don't know exactly what this is, but it's not the same as itemType
 	int FrameType;
-  /** Interne Item-Nummer */
-	uint ItemNr;
   /** Internal unique Item-Number, used for the undo system */
 	uint uniqueNr;
   /** Hat Element Rahmen? FIXME: still used? - in DrawObject_Post */
@@ -539,6 +537,7 @@
 	PageItem* nextInChain() { return NextBox; }
 	const PageItem* prevInChain() const { return BackBox; }
 	const PageItem* nextInChain() const { return NextBox; }
+	PageItem *Parent;
 
 	bool testLinkCandidate(PageItem* nextFrame);
 	void unlink();

Modified: trunk/Scribus/scribus/pageitem_osgframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/pageitem_osgframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_osgframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_osgframe.cpp Tue Nov  1 08:51:14 2011
@@ -104,7 +104,7 @@
 	if (PictureIsAvailable)
 	{
 		image.save(Pfile, "PNG");
-		m_Doc->LoadPict(Pfile, ItemNr, true);
+		m_Doc->loadPict(Pfile, this, true);
 	}
 	else
 	{
@@ -113,7 +113,7 @@
 		QString imgName = getLongPathName(tempImageFile->fileName());
 		tempImageFile->close();
 		image.save(imgName, "PNG");
-		m_Doc->LoadPict(imgName, ItemNr);
+		m_Doc->loadPict(imgName, this);
 	}
 	setImageScalingMode(false, true);
 }

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Tue Nov  1 08:51:14 2011
@@ -36,6 +36,7 @@
 #include "commonstrings.h"
 #include "hyphenator.h"
 #include "pageitem.h"
+#include "pageitem_group.h"
 #include "pageitem_textframe.h"
 #include "prefsmanager.h"
 #include "scpage.h"
@@ -131,17 +132,24 @@
 		ScPage* Dp=0;
 		PageItem* docItem=0;
 		int LayerLevItem;
+		QList<PageItem*> thisList;
 		if (!OnMasterPage.isEmpty())
 		{
 			if ((savedOwnPage == -1) || (savedOwnPage >= signed(m_Doc->Pages->count())))
 				return result;
 			Mp = m_Doc->MasterPages.at(m_Doc->MasterNames[OnMasterPage]);
 			Dp = m_Doc->Pages->at(savedOwnPage);
+			if (Parent != NULL)
+				thisList = this->asGroupFrame()->groupItemList;
+			else
+				thisList = m_Doc->MasterItems;
+			int thisid = thisList.indexOf(this);
 			for (int a = 0; a < m_Doc->MasterItems.count(); ++a)
 			{
 				docItem = m_Doc->MasterItems.at(a);
+				int did = m_Doc->MasterItems.indexOf(docItem);
 				LayerLevItem = m_Doc->layerLevelFromID(docItem->LayerID);
-				if (((docItem->ItemNr > ItemNr) && (docItem->LayerID == LayerID)) || (LayerLevItem > LayerLev && m_Doc->layerFlow(docItem->LayerID)))
+				if (((did > thisid) && (docItem->LayerID == LayerID)) || (LayerLevItem > LayerLev && m_Doc->layerFlow(docItem->LayerID)))
 				{
 					if (docItem->textFlowAroundObject())
 						result = result.subtracted(itemShape(docItem, Mp->xOffset() - Dp->xOffset(), Mp->yOffset() - Dp->yOffset()));
@@ -165,11 +173,17 @@
 		} // if (!OnMasterPage.isEmpty())
 		else
 		{
+			int thisid = 0;
+			if (Parent != NULL)
+				thisid = this->asGroupFrame()->groupItemList.indexOf(this);
+			else
+				thisid = m_Doc->Items->indexOf(this);
 			for (uint a = 0; a < docItemsCount; ++a)
 			{
 				docItem = m_Doc->Items->at(a);
+				int did = m_Doc->Items->indexOf(docItem);
 				LayerLevItem = m_Doc->layerLevelFromID(docItem->LayerID);
-				if (((docItem->ItemNr > ItemNr) && (docItem->LayerID == LayerID)) || (LayerLevItem > LayerLev && m_Doc->layerFlow(docItem->LayerID)))
+				if (((did > thisid) && (docItem->LayerID == LayerID)) || (LayerLevItem > LayerLev && m_Doc->layerFlow(docItem->LayerID)))
 				{
 					if (docItem->textFlowAroundObject())
 						result = result.subtracted(itemShape(docItem, 0, 0));

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Tue Nov  1 08:51:14 2011
@@ -2647,7 +2647,7 @@
 					PutDoc("\n/Filter /FlateDecode");
 				PutDoc(" >>\nstream\n"+EncStream(Content, templateObject)+"\nendstream\nendobj\n");
 				int pIndex   = doc.MasterPages.indexOf((ScPage* const) pag) + 1;
-				QString name = QString("master_page_obj_%1_%2").arg(pIndex).arg(ite->ItemNr);
+				QString name = QString("master_page_obj_%1_%2").arg(pIndex).arg(qHash(ite));
 				Seite.XObjects[name] = templateObject;
 			}
 			if (((Options.Version == PDFOptions::PDFVersion_15) || (Options.Version == PDFOptions::PDFVersion_X4)) && (Options.useLayers))
@@ -3195,7 +3195,7 @@
 				continue;
 			if ((!pag->pageName().isEmpty()) && (ite->OwnPage != static_cast<int>(pag->pageNr())) && (ite->OwnPage != -1))
 				continue;
-			QString name = QString("/master_page_obj_%1_%2").arg(mPageIndex).arg(ite->ItemNr);
+			QString name = QString("/master_page_obj_%1_%2").arg(mPageIndex).arg(qHash(ite));
 			if (! ite->asTextFrame())
 				PutPage(name+" Do\n");
 			else

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp Tue Nov  1 08:51:14 2011
@@ -189,6 +189,7 @@
 	double h = Buffer->Height;
 	double pw = Buffer->Pwidth;
 	int z = 0;
+	PageItem *currItem = NULL;
 	switch (Buffer->PType)
 	{
 	// OBSOLETE CR 2005-02-06
@@ -199,21 +200,22 @@
 	case PageItem::ImageFrame:
 		z = m_Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, x, y, w, h, 1, m_Doc->prefsData().itemToolPrefs.imageFillColor, CommonStrings::None, true);
 //		undoManager->setUndoEnabled(false);
-		m_Doc->Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
-		m_Doc->Items->at(z)->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
-		m_Doc->Items->at(z)->setImageRotation(Buffer->LocalRot);
-		m_Doc->Items->at(z)->Pfile = Buffer->Pfile;
-		m_Doc->Items->at(z)->IProfile = Buffer->IProfile;
-		m_Doc->Items->at(z)->EmProfile = Buffer->EmProfile;
-		m_Doc->Items->at(z)->IRender = Buffer->IRender;
-		m_Doc->Items->at(z)->UseEmbedded = Buffer->UseEmbedded;
-		if (!m_Doc->Items->at(z)->Pfile.isEmpty())
-			m_Doc->LoadPict(m_Doc->Items->at(z)->Pfile, z);
-		m_Doc->Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
-		m_Doc->Items->at(z)->setImageShown(Buffer->PicArt);
-		m_Doc->Items->at(z)->ScaleType = Buffer->ScaleType;
-		m_Doc->Items->at(z)->AspectRatio = Buffer->AspectRatio;
-		m_Doc->Items->at(z)->setLineWidth(Buffer->Pwidth);
+		currItem = m_Doc->Items->at(z);
+		currItem->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
+		currItem->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
+		currItem->setImageRotation(Buffer->LocalRot);
+		currItem->Pfile = Buffer->Pfile;
+		currItem->IProfile = Buffer->IProfile;
+		currItem->EmProfile = Buffer->EmProfile;
+		currItem->IRender = Buffer->IRender;
+		currItem->UseEmbedded = Buffer->UseEmbedded;
+		if (!currItem->Pfile.isEmpty())
+			m_Doc->loadPict(currItem->Pfile, currItem);
+		currItem->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
+		currItem->setImageShown(Buffer->PicArt);
+		currItem->ScaleType = Buffer->ScaleType;
+		currItem->AspectRatio = Buffer->AspectRatio;
+		currItem->setLineWidth(Buffer->Pwidth);
 //		undoManager->setUndoEnabled(true);
 		break;
 	// OBSOLETE CR 2005-02-06
@@ -229,21 +231,22 @@
 		else
 			z = m_Doc->itemAdd(PageItem::TextFrame, PageItem::Unspecified, x, y, w, h, pw, CommonStrings::None, Buffer->Pcolor, true);
 //		undoManager->setUndoEnabled(false);
+		currItem = m_Doc->Items->at(z);
 		if ((Buffer->m_isAnnotation) && (Buffer->m_annotation.UseIcons()))
 		{
-			m_Doc->Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
-			m_Doc->Items->at(z)->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
-			m_Doc->Items->at(z)->setImageRotation(Buffer->LocalRot);
-			m_Doc->Items->at(z)->Pfile = Buffer->Pfile;
-			m_Doc->Items->at(z)->Pfile2 = Buffer->Pfile2;
-			m_Doc->Items->at(z)->Pfile3 = Buffer->Pfile3;
-			m_Doc->Items->at(z)->IProfile = Buffer->IProfile;
-			m_Doc->Items->at(z)->EmProfile = Buffer->EmProfile;
-			m_Doc->Items->at(z)->IRender = Buffer->IRender;
-			m_Doc->Items->at(z)->UseEmbedded = Buffer->UseEmbedded;
-			m_Doc->LoadPict(m_Doc->Items->at(z)->Pfile, z);
-			m_Doc->Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
-			m_Doc->Items->at(z)->setImageShown(Buffer->PicArt);
+			currItem->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
+			currItem->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
+			currItem->setImageRotation(Buffer->LocalRot);
+			currItem->Pfile = Buffer->Pfile;
+			currItem->Pfile2 = Buffer->Pfile2;
+			currItem->Pfile3 = Buffer->Pfile3;
+			currItem->IProfile = Buffer->IProfile;
+			currItem->EmProfile = Buffer->EmProfile;
+			currItem->IRender = Buffer->IRender;
+			currItem->UseEmbedded = Buffer->UseEmbedded;
+			m_Doc->loadPict(currItem->Pfile, currItem);
+			currItem->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
+			currItem->setImageShown(Buffer->PicArt);
 		}
 		if (!Buffer->itemText.isEmpty())
 		{
@@ -308,15 +311,15 @@
 				nstyle.setStrikethruOffset(it == wt.end() ? -1 : (*it).toInt());
 				it++;
 				nstyle.setStrikethruWidth(it == wt.end() ? -1 : (*it).toInt());
-				uint pos = m_Doc->Items->at(z)->itemText.length();
-				m_Doc->Items->at(z)->itemText.insertChars(pos, ch);
+				uint pos = currItem->itemText.length();
+				currItem->itemText.insertChars(pos, ch);
 				if (ch == SpecialChars::PARSEP && cab > 0) {
 					ParagraphStyle pstyle;
 					pstyle.setParent(m_Doc->paragraphStyles()[cab].name());
-					m_Doc->Items->at(z)->itemText.applyStyle(pos, pstyle);
+					currItem->itemText.applyStyle(pos, pstyle);
 				}
 				else {
-					m_Doc->Items->at(z)->itemText.applyCharStyle(pos, 1, nstyle);
+					currItem->itemText.applyCharStyle(pos, 1, nstyle);
 				}
 			}
 		}
@@ -345,7 +348,7 @@
 			pstyle.charStyle().setUnderlineWidth(Buffer->TxtUnderWidth);
 			pstyle.charStyle().setStrikethruOffset(Buffer->TxtStrikePos);
 			pstyle.charStyle().setStrikethruWidth(Buffer->TxtStrikeWidth);
-			m_Doc->Items->at(z)->itemText.setDefaultStyle(pstyle);
+			currItem->itemText.setDefaultStyle(pstyle);
 		}
 //		undoManager->setUndoEnabled(true);
 #endif
@@ -378,22 +381,23 @@
 		{
 		z = m_Doc->itemAdd(PageItem::LatexFrame, PageItem::Unspecified, x, y, w, h, 1, m_Doc->prefsData().itemToolPrefs.imageFillColor, CommonStrings::None, true);
 //		undoManager->setUndoEnabled(false);
-		m_Doc->Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
-		m_Doc->Items->at(z)->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
-		m_Doc->Items->at(z)->setImageRotation(Buffer->LocalRot);
-		m_Doc->Items->at(z)->Pfile = Buffer->Pfile;
-		m_Doc->Items->at(z)->IProfile = Buffer->IProfile;
-		m_Doc->Items->at(z)->EmProfile = Buffer->EmProfile;
-		m_Doc->Items->at(z)->IRender = Buffer->IRender;
-		m_Doc->Items->at(z)->UseEmbedded = Buffer->UseEmbedded;
-		if (!m_Doc->Items->at(z)->Pfile.isEmpty())
-			m_Doc->LoadPict(m_Doc->Items->at(z)->Pfile, z);
-		m_Doc->Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
-		m_Doc->Items->at(z)->setImageShown(Buffer->PicArt);
-		m_Doc->Items->at(z)->ScaleType = Buffer->ScaleType;
-		m_Doc->Items->at(z)->AspectRatio = Buffer->AspectRatio;
-		m_Doc->Items->at(z)->setLineWidth(Buffer->Pwidth);
-		PageItem_LatexFrame *latexframe = m_Doc->Items->at(z)->asLatexFrame();
+		currItem = m_Doc->Items->at(z);
+		currItem->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
+		currItem->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
+		currItem->setImageRotation(Buffer->LocalRot);
+		currItem->Pfile = Buffer->Pfile;
+		currItem->IProfile = Buffer->IProfile;
+		currItem->EmProfile = Buffer->EmProfile;
+		currItem->IRender = Buffer->IRender;
+		currItem->UseEmbedded = Buffer->UseEmbedded;
+		if (!currItem->Pfile.isEmpty())
+			m_Doc->loadPict(currItem->Pfile, currItem);
+		currItem->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
+		currItem->setImageShown(Buffer->PicArt);
+		currItem->ScaleType = Buffer->ScaleType;
+		currItem->AspectRatio = Buffer->AspectRatio;
+		currItem->setLineWidth(Buffer->Pwidth);
+		PageItem_LatexFrame *latexframe = currItem->asLatexFrame();
 		latexframe->setFormula(Buffer->itemText); //itemText seems to be a good choice...
 //		undoManager->setUndoEnabled(true);
 		break;
@@ -402,26 +406,27 @@
 #ifdef HAVE_OSG
 		z = m_Doc->itemAdd(PageItem::OSGFrame, PageItem::Unspecified, x, y, w, h, 1, m_Doc->prefsData().itemToolPrefs.imageFillColor, CommonStrings::None, true);
 //		undoManager->setUndoEnabled(false);
-		m_Doc->Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
-		m_Doc->Items->at(z)->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
-		m_Doc->Items->at(z)->setImageRotation(Buffer->LocalRot);
-		m_Doc->Items->at(z)->Pfile = Buffer->Pfile;
-		m_Doc->Items->at(z)->IProfile = Buffer->IProfile;
-		m_Doc->Items->at(z)->EmProfile = Buffer->EmProfile;
-		m_Doc->Items->at(z)->IRender = Buffer->IRender;
-		m_Doc->Items->at(z)->UseEmbedded = Buffer->UseEmbedded;
-		if (!m_Doc->Items->at(z)->Pfile.isEmpty())
-			m_Doc->LoadPict(m_Doc->Items->at(z)->Pfile, z);
-		m_Doc->Items->at(z)->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
-		m_Doc->Items->at(z)->setImageShown(Buffer->PicArt);
-		m_Doc->Items->at(z)->ScaleType = Buffer->ScaleType;
-		m_Doc->Items->at(z)->AspectRatio = Buffer->AspectRatio;
-		m_Doc->Items->at(z)->setLineWidth(Buffer->Pwidth);
+		currItem = m_Doc->Items->at(z);
+		currItem->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
+		currItem->setImageXYOffset(Buffer->LocalX, Buffer->LocalY);
+		currItem->setImageRotation(Buffer->LocalRot);
+		currItem->Pfile = Buffer->Pfile;
+		currItem->IProfile = Buffer->IProfile;
+		currItem->EmProfile = Buffer->EmProfile;
+		currItem->IRender = Buffer->IRender;
+		currItem->UseEmbedded = Buffer->UseEmbedded;
+		if (!currItem->Pfile.isEmpty())
+			m_Doc->loadPict(currItem->Pfile, currItem);
+		currItem->setImageXYScale(Buffer->LocalScX, Buffer->LocalScY);
+		currItem->setImageShown(Buffer->PicArt);
+		currItem->ScaleType = Buffer->ScaleType;
+		currItem->AspectRatio = Buffer->AspectRatio;
+		currItem->setLineWidth(Buffer->Pwidth);
 //		undoManager->setUndoEnabled(true);
 #endif
 		break;
 	}
-	PageItem *currItem = m_Doc->Items->at(z);
+	currItem = m_Doc->Items->at(z);
 //	undoManager->setUndoEnabled(false);
 /*FIXME
 	currItem->setLineSpacingMode(Buffer->LineSpMode);
@@ -1075,7 +1080,7 @@
 					if (Neu->isTableItem)
 					{
 						TableItems.append(Neu);
-						TableID.insert(obj.attribute("OwnLINK", "0").toInt(), Neu->ItemNr);
+						TableID.insert(obj.attribute("OwnLINK", "0").toInt(), last);
 					}
 					counter++;
 					OBJ=OBJ.nextSibling();
@@ -1971,7 +1976,7 @@
 					if (Neu->isTableItem)
 					{
 						TableItems.append(Neu);
-						TableID.insert(obj.attribute("OwnLINK", "0").toInt(), Neu->ItemNr);
+						TableID.insert(obj.attribute("OwnLINK", "0").toInt(), counter);
 					}
 					counter++;
 					OBJ=OBJ.nextSibling();

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Tue Nov  1 08:51:14 2011
@@ -189,9 +189,9 @@
 
 	bool newVersion = false;
 
-	QMap<int,int> TableID;
-	QMap<int,int> TableIDM;
-	QMap<int,int> TableIDF;
+	QMap<int,PageItem*> TableID;
+	QMap<int,PageItem*> TableIDM;
+	QMap<int,PageItem*> TableIDF;
 	QList<PageItem*> TableItems;
 	QList<PageItem*> TableItemsM;
 	QList<PageItem*> TableItemsF;
@@ -231,8 +231,6 @@
 	itemRemapM.clear();
 	itemNextM.clear();
 	itemCountM = 0;
-	itemRemapF.clear();
-	itemNextF.clear();
 
 	TableItems.clear();
 	TableID.clear();
@@ -415,12 +413,12 @@
 			if (tagName == "PAGEOBJECT")
 			{
 				if (itemInfo.nextItem != -1)
-					itemNext[itemInfo.item->ItemNr] = itemInfo.nextItem;
+					itemNext[m_Doc->DocItems.count()] = itemInfo.nextItem;
 			}
 			else if (tagName == "MASTEROBJECT")
 			{
 				if (itemInfo.nextItem != -1)
-					itemNextM[itemInfo.item->ItemNr] = itemInfo.nextItem;
+					itemNextM[m_Doc->MasterItems.count()] = itemInfo.nextItem;
 			}
 			/* not sure if we want that...
 			else if (tagName == "FRAMEOBJECT")
@@ -434,23 +432,23 @@
 				if (tagName == "PAGEOBJECT")
 				{
 					TableItems.append(itemInfo.item);
-					TableID.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
+					TableID.insert(itemInfo.ownLink, itemInfo.item);
 				}
 				else if (tagName == "FRAMEOBJECT")
 				{
 					TableItemsF.append(itemInfo.item);
-					TableIDF.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
+					TableIDF.insert(itemInfo.ownLink, itemInfo.item);
 				}
 				else
 				{
 					TableItemsM.append(itemInfo.item);
-					TableIDM.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
+					TableIDM.insert(itemInfo.ownLink, itemInfo.item);
 				}
 			}
 			if (groupStack.count() > 0)
 			{
 				groupStack.top().append(itemInfo.item);
-				while (static_cast<int>(itemInfo.item->ItemNr) == groupStack2.top())
+				while (static_cast<int>(itemInfo.ownNr) == groupStack2.top())
 				{
 					if (tagName == "PAGEOBJECT")
 						groupStackP.push(groupStack.pop());
@@ -468,7 +466,7 @@
 				QList<PageItem*> GroupItems;
 				GroupItems.append(itemInfo.item);
 				groupStack.push(GroupItems);
-				groupStack2.push(itemInfo.groupLastItem + itemInfo.item->ItemNr);
+				groupStack2.push(itemInfo.groupLastItem + itemInfo.ownNr);
 			}
 		}
 		if (tagName == "Pattern")
@@ -502,19 +500,19 @@
 		{
 			PageItem* ta = TableItemsF.at(ttc);
 			if (ta->TopLinkID != -1)
-				ta->TopLink = m_Doc->FrameItems.at(TableIDF[ta->TopLinkID]);
+				ta->TopLink = TableIDF[ta->TopLinkID];
 			else
 				ta->TopLink = 0;
 			if (ta->LeftLinkID != -1)
-				ta->LeftLink = m_Doc->FrameItems.at(TableIDF[ta->LeftLinkID]);
+				ta->LeftLink = TableIDF[ta->LeftLinkID];
 			else
 				ta->LeftLink = 0;
 			if (ta->RightLinkID != -1)
-				ta->RightLink = m_Doc->FrameItems.at(TableIDF[ta->RightLinkID]);
+				ta->RightLink = TableIDF[ta->RightLinkID];
 			else
 				ta->RightLink = 0;
 			if (ta->BottomLinkID != -1)
-				ta->BottomLink = m_Doc->FrameItems.at(TableIDF[ta->BottomLinkID]);
+				ta->BottomLink = TableIDF[ta->BottomLinkID];
 			else
 				ta->BottomLink = 0;
 		}
@@ -525,19 +523,19 @@
 		{
 			PageItem* ta = TableItemsM.at(ttc);
 			if (ta->TopLinkID != -1)
-				ta->TopLink = m_Doc->MasterItems.at(TableIDM[ta->TopLinkID]);
+				ta->TopLink = TableIDM[ta->TopLinkID];
 			else
 				ta->TopLink = 0;
 			if (ta->LeftLinkID != -1)
-				ta->LeftLink = m_Doc->MasterItems.at(TableIDM[ta->LeftLinkID]);
+				ta->LeftLink = TableIDM[ta->LeftLinkID];
 			else
 				ta->LeftLink = 0;
 			if (ta->RightLinkID != -1)
-				ta->RightLink = m_Doc->MasterItems.at(TableIDM[ta->RightLinkID]);
+				ta->RightLink = TableIDM[ta->RightLinkID];
 			else
 				ta->RightLink = 0;
 			if (ta->BottomLinkID != -1)
-				ta->BottomLink = m_Doc->MasterItems.at(TableIDM[ta->BottomLinkID]);
+				ta->BottomLink = TableIDM[ta->BottomLinkID];
 			else
 				ta->BottomLink = 0;
 		}
@@ -548,19 +546,19 @@
 		{
 			PageItem* ta = TableItems.at(ttc);
 			if (ta->TopLinkID != -1)
-				ta->TopLink = m_Doc->Items->at(TableID[ta->TopLinkID]);
+				ta->TopLink = TableID[ta->TopLinkID];
 			else
 				ta->TopLink = 0;
 			if (ta->LeftLinkID != -1)
-				ta->LeftLink = m_Doc->Items->at(TableID[ta->LeftLinkID]);
+				ta->LeftLink = TableID[ta->LeftLinkID];
 			else
 				ta->LeftLink = 0;
 			if (ta->RightLinkID != -1)
-				ta->RightLink = m_Doc->Items->at(TableID[ta->RightLinkID]);
+				ta->RightLink = TableID[ta->RightLinkID];
 			else
 				ta->RightLink = 0;
 			if (ta->BottomLinkID != -1)
-				ta->BottomLink = m_Doc->Items->at(TableID[ta->BottomLinkID]);
+				ta->BottomLink = TableID[ta->BottomLinkID];
 			else
 				ta->BottomLink = 0;
 		}
@@ -636,6 +634,7 @@
 				PageItem* cItem = gpL.at(id);
 				cItem->gXpos = cItem->xPos() - gItem->xPos();
 				cItem->gYpos = cItem->yPos() - gItem->yPos();
+				cItem->Parent = gItem;
 				if (gItem->rotation() != 0)
 				{
 					QTransform ma;
@@ -661,6 +660,7 @@
 				PageItem* cItem = gpL.at(id);
 				cItem->gXpos = cItem->xPos() - gItem->xPos();
 				cItem->gYpos = cItem->yPos() - gItem->yPos();
+				cItem->Parent = gItem;
 				if (gItem->rotation() != 0)
 				{
 					QTransform ma;
@@ -686,6 +686,7 @@
 				PageItem* cItem = gpL.at(id);
 				cItem->gXpos = cItem->xPos() - gItem->xPos();
 				cItem->gYpos = cItem->yPos() - gItem->yPos();
+				cItem->Parent = gItem;
 				if (gItem->rotation() != 0)
 				{
 					QTransform ma;
@@ -700,7 +701,6 @@
 			gItem->groupItemList = gpL;
 		}
 	}
-	m_Doc->renumberItemsInListOrder();
 	
 	// reestablish first/lastAuto
 	m_Doc->FirstAuto = m_Doc->LastAuto;
@@ -1842,14 +1842,14 @@
 
 	if (tagName == "FRAMEOBJECT")
 	{
-		doc->FrameItems.append(doc->Items->takeAt(newItem->ItemNr));
-		newItem->ItemNr = doc->FrameItems.count()-1;
+		doc->FrameItems.append(doc->Items->takeAt(doc->Items->indexOf(newItem)));
 	}
 
 	info.item     = newItem;
 	info.nextItem = attrs.valueAsInt("NEXTITEM", -1);
 	info.ownLink  = newItem->isTableItem ? attrs.valueAsInt("OwnLINK", 0) : 0;
 	info.groupLastItem = 0;
+	info.ownNr = doc->Items->indexOf(newItem);
 
 	info.isGroupFlag = attrs.valueAsBool("isGroupControl", 0);
 	if (info.isGroupFlag)
@@ -2033,7 +2033,7 @@
 	QStack< QList<PageItem*> > groupStack;
 	QStack< QList<PageItem*> > groupStackP;
 	QStack<int> groupStack2;
-	QMap<int,int> TableID2;
+	QMap<int,PageItem*> TableID2;
 	QList<PageItem*> TableItems2;
 
 	pat.setDoc(doc);
@@ -2075,12 +2075,12 @@
 		if (itemInfo.item->isTableItem)
 		{
 			TableItems2.append(itemInfo.item);
-			TableID2.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
+			TableID2.insert(itemInfo.ownLink, itemInfo.item);
 		}
 		if (groupStack.count() > 0)
 		{
 			groupStack.top().append(itemInfo.item);
-			while (static_cast<int>(itemInfo.item->ItemNr) == groupStack2.top())
+			while (static_cast<int>(itemInfo.ownNr) == groupStack2.top())
 			{
 				groupStackP.push(groupStack.pop());
 				groupStack2.pop();
@@ -2093,7 +2093,7 @@
 			QList<PageItem*> GroupItems;
 			GroupItems.append(itemInfo.item);
 			groupStack.push(GroupItems);
-			groupStack2.push(itemInfo.groupLastItem + itemInfo.item->ItemNr);
+			groupStack2.push(itemInfo.groupLastItem + itemInfo.ownNr);
 		}
 	}
 
@@ -2110,19 +2110,19 @@
 		{
 			PageItem* ta = TableItems2.at(ttc);
 			if (ta->TopLinkID != -1)
-				ta->TopLink = m_Doc->Items->at(TableID2[ta->TopLinkID]);
+				ta->TopLink = TableID2[ta->TopLinkID];
 			else
 				ta->TopLink = 0;
 			if (ta->LeftLinkID != -1)
-				ta->LeftLink = m_Doc->Items->at(TableID2[ta->LeftLinkID]);
+				ta->LeftLink = TableID2[ta->LeftLinkID];
 			else
 				ta->LeftLink = 0;
 			if (ta->RightLinkID != -1)
-				ta->RightLink = m_Doc->Items->at(TableID2[ta->RightLinkID]);
+				ta->RightLink = TableID2[ta->RightLinkID];
 			else
 				ta->RightLink = 0;
 			if (ta->BottomLinkID != -1)
-				ta->BottomLink = m_Doc->Items->at(TableID2[ta->BottomLinkID]);
+				ta->BottomLink = TableID2[ta->BottomLinkID];
 			else
 				ta->BottomLink = 0;
 		}
@@ -2138,6 +2138,7 @@
 				PageItem* cItem = gpL.at(id);
 				cItem->gXpos = cItem->xPos() - gItem->xPos();
 				cItem->gYpos = cItem->yPos() - gItem->yPos();
+				cItem->Parent = gItem;
 				if (gItem->rotation() != 0)
 				{
 					QTransform ma;
@@ -2152,7 +2153,6 @@
 			gItem->groupItemList = gpL;
 		}
 	}
-	m_Doc->renumberItemsInListOrder();
 
 	uint itemCount2 = m_Doc->Items->count();
 	if (itemCount2 > itemCount1)
@@ -2166,7 +2166,6 @@
 			newItem->moveBy(pat.xoffset, pat.yoffset, true);
 			newItem->gXpos += pat.xoffset;
 			newItem->gYpos += pat.yoffset;
-			newItem->ItemNr = pat.items.count();
 			pat.items.append(newItem);
 		}
 	}
@@ -2749,7 +2748,7 @@
 			currItem->EmProfile   = attrs.valueAsString("EPROF", "");
 			currItem->IRender     = (eRenderIntent) attrs.valueAsInt("IRENDER" , 1);
 			currItem->UseEmbedded = attrs.valueAsInt("EMBEDDED", 1);
-			doc->LoadPict(currItem->Pfile, z);
+			doc->loadPict(currItem->Pfile, currItem);
 			currItem->setImageXYScale(scx, scy);
 			currItem->setImageShown( attrs.valueAsInt("PICART"));
 /*			currItem->BBoxX = ScCLocale::toDoubleC( obj->attribute("BBOXX"));
@@ -3023,7 +3022,7 @@
 	ScPage* newPage = NULL;
 	
 	QString tmp;
-	QMap<int,int> TableID;
+	QMap<int,PageItem*> TableID;
 	QList<PageItem*> TableItems;
 	QMap<PageItem*, int> groupID;
 	double pageX = 0, pageY = 0;
@@ -3047,8 +3046,6 @@
 	itemRemapM.clear();
 	itemNextM.clear();
 	itemCountM = 0;
-	itemRemapF.clear();
-	itemNextF.clear();
 
 	DoVorl.clear();
 	DoVorl[0] = "0";
@@ -3263,12 +3260,11 @@
 				if (newItem->isTableItem)
 				{
 					TableItems.append(newItem);
-					TableID.insert(itemInfo.ownLink, newItem->ItemNr);
+					TableID.insert(itemInfo.ownLink, newItem);
 				}
 				if (tagName == "FRAMEOBJECT")
 				{
-					m_Doc->FrameItems.append(m_Doc->Items->takeAt(newItem->ItemNr));
-					newItem->ItemNr = m_Doc->FrameItems.count()-1;
+					m_Doc->FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(newItem)));
 				}
 			}
 		}
@@ -3298,19 +3294,19 @@
 		{
 			PageItem* ta = TableItems.at(ttc);
 			if (ta->TopLinkID != -1)
-				ta->TopLink = m_Doc->Items->at(TableID[ta->TopLinkID]);
+				ta->TopLink = TableID[ta->TopLinkID];
 			else
 				ta->TopLink = 0;
 			if (ta->LeftLinkID != -1)
-				ta->LeftLink = m_Doc->Items->at(TableID[ta->LeftLinkID]);
+				ta->LeftLink = TableID[ta->LeftLinkID];
 			else
 				ta->LeftLink = 0;
 			if (ta->RightLinkID != -1)
-				ta->RightLink = m_Doc->Items->at(TableID[ta->RightLinkID]);
+				ta->RightLink = TableID[ta->RightLinkID];
 			else
 				ta->RightLink = 0;
 			if (ta->BottomLinkID != -1)
-				ta->BottomLink = m_Doc->Items->at(TableID[ta->BottomLinkID]);
+				ta->BottomLink = TableID[ta->BottomLinkID];
 			else
 				ta->BottomLink = 0;
 		}

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h Tue Nov  1 08:51:14 2011
@@ -67,11 +67,12 @@
 		class ItemInfo
 		{
 		public:
-			ItemInfo(void) { groupLastItem = nextItem = ownLink = 0; item = NULL; isGroupFlag = false; };
+			ItemInfo(void) { groupLastItem = nextItem = ownLink = ownNr = 0; item = NULL; isGroupFlag = false; };
 			PageItem* item;
 			int groupLastItem;
 			int nextItem;
 			int ownLink;
+			int ownNr;
 			bool isGroupFlag;
 		};
 
@@ -143,8 +144,6 @@
 		QMap<int, int> groupRemap;
 		QMap<int, int> itemRemap;
 		QMap<int, int> itemNext;
-		QMap<int, int> itemRemapF;
-		QMap<int, int> itemNextF;
 		QMap<int, int> itemRemapM;
 		QMap<int, int> itemNextM;
 

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp Tue Nov  1 08:51:14 2011
@@ -925,25 +925,24 @@
 					m_Doc->LastAuto = Neu;
 				if (pg.tagName()=="FRAMEOBJECT")
 				{
-					m_Doc->FrameItems.append(m_Doc->Items->takeAt(Neu->ItemNr));
-					Neu->ItemNr = m_Doc->FrameItems.count()-1;
+					m_Doc->FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(Neu)));
 				}
 				if (Neu->isTableItem)
 				{
 					if (pg.tagName()=="PAGEOBJECT")
 					{
 						TableItems.append(Neu);
-						TableID.insert(pg.attribute("OwnLINK", "0").toInt(), Neu->ItemNr);
+						TableID.insert(pg.attribute("OwnLINK", "0").toInt(), m_Doc->DocItems.indexOf(Neu));
 					}
 					else if (pg.tagName()=="FRAMEOBJECT")
 					{
 						TableItemsF.append(Neu);
-						TableIDF.insert(pg.attribute("OwnLINK", "0").toInt(), Neu->ItemNr);
+						TableIDF.insert(pg.attribute("OwnLINK", "0").toInt(), m_Doc->FrameItems.indexOf(Neu));
 					}
 					else
 					{
 						TableItemsM.append(Neu);
-						TableIDM.insert(pg.attribute("OwnLINK", "0").toInt(), Neu->ItemNr);
+						TableIDM.insert(pg.attribute("OwnLINK", "0").toInt(), m_Doc->MasterItems.indexOf(Neu));
 					}
 				}
 				m_Doc->setMasterPageMode(false);
@@ -1742,7 +1741,7 @@
 			currItem->EmProfile = obj->attribute("EPROF","");
 			currItem->IRender   = (eRenderIntent) obj->attribute("IRENDER", "1").toInt();
 			currItem->UseEmbedded = obj->attribute("EMBEDDED", "1").toInt();
-			doc->LoadPict(currItem->Pfile, z);
+			doc->loadPict(currItem->Pfile, currItem);
 			currItem->setImageXYScale(scx, scy);
 			currItem->setImageShown(obj->attribute("PICART").toInt());
 /*			currItem->BBoxX = obj->attribute("BBOXX").toDouble();
@@ -2259,12 +2258,11 @@
 					if (Neu->isTableItem)
 					{
 						TableItems.append(Neu);
-						TableID.insert(pg.attribute("OwnLINK", "0").toInt(), Neu->ItemNr);
+						TableID.insert(pg.attribute("OwnLINK", "0").toInt(), m_Doc->Items->indexOf(Neu));
 					}
 					if (pg.tagName()=="FRAMEOBJECT")
 					{
-						m_Doc->FrameItems.append(m_Doc->Items->takeAt(Neu->ItemNr));
-						Neu->ItemNr = m_Doc->FrameItems.count()-1;
+						m_Doc->FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(Neu)));
 					}
 				}
 				counter++;

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Tue Nov  1 08:51:14 2011
@@ -180,15 +180,16 @@
 {
 	ParagraphStyle vg;
 	bool newVersion = false;
+	isNewFormat = false;
 	LayerToPaste = toLayer;
 	Xp = Xp_in;
 	Yp = Yp_in;
 //	GrX = 0.0;
 //	GrY = 0.0;
 
-	QMap<int,int> TableID;
-	QMap<int,int> TableIDM;
-	QMap<int,int> TableIDF;
+	QMap<int,PageItem*> TableID;
+	QMap<int,PageItem*> TableIDM;
+	QMap<int,PageItem*> TableIDF;
 	QList<PageItem*> TableItems;
 	QList<PageItem*> TableItemsM;
 	QList<PageItem*> TableItemsF;
@@ -305,32 +306,44 @@
 			success = readObject(m_Doc, reader, itemInfo, fileDir, true);
 			if (!success)
 				break;
+			if (isNewFormat)
+			{
+				if (itemInfo.nextItem != -1)
+					itemNext[itemInfo.itemID] = itemInfo.nextItem;
+				if (itemInfo.item->isTableItem)
+					TableItems.append(itemInfo.item);
+				if (itemInfo.isWeldFlag)
+					WeldItems.append(itemInfo.item);
+			}
+			else
+			{
 			// first of linked chain?
-			if (tagName == "ITEM")
-			{
-				if (itemInfo.nextItem != -1)
-					itemNext[itemInfo.item->ItemNr] = itemInfo.nextItem;
-			}
-			if (itemInfo.item->isTableItem)
-			{
 				if (tagName == "ITEM")
 				{
-					TableItems.append(itemInfo.item);
-					TableID.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
-				}
-			}
-			if (itemInfo.isWeldFlag)
-			{
-				if (tagName == "ITEM")
-				{
-					WeldItems.append(itemInfo.item);
-					WeldID.insert(itemInfo.ownWeld, itemInfo.item);
+					if (itemInfo.nextItem != -1)
+						itemNext[itemInfo.ownNr] = itemInfo.nextItem;
+				}
+				if (itemInfo.item->isTableItem)
+				{
+					if (tagName == "ITEM")
+					{
+						TableItems.append(itemInfo.item);
+						TableID.insert(itemInfo.ownLink, itemInfo.item);
+					}
+				}
+				if (itemInfo.isWeldFlag)
+				{
+					if (tagName == "ITEM")
+					{
+						WeldItems.append(itemInfo.item);
+						WeldID.insert(itemInfo.ownWeld, itemInfo.item);
+					}
 				}
 			}
 			if (groupStack.count() > 0)
 			{
 				groupStack.top().append(itemInfo.item);
-				while (static_cast<int>(itemInfo.item->ItemNr) == groupStack2.top())
+				while (static_cast<int>(itemInfo.ownNr) == groupStack2.top())
 				{
 					if ((tagName == "PAGEOBJECT") || (tagName == "ITEM"))
 						groupStackP.push(groupStack.pop());
@@ -348,7 +361,7 @@
 				QList<PageItem*> GroupItems;
 				GroupItems.append(itemInfo.item);
 				groupStack.push(GroupItems);
-				groupStack2.push(itemInfo.groupLastItem + itemInfo.item->ItemNr);
+				groupStack2.push(itemInfo.groupLastItem + itemInfo.ownNr);
 			}
 		}
 		if (tagName == "Pattern")
@@ -362,103 +375,162 @@
 		setDomParsingError(reader.errorString(), reader.lineNumber(), reader.columnNumber());
 		return false;
 	}
-	if (TableItemsF.count() != 0)
-	{
-		for (int ttc = 0; ttc < TableItemsF.count(); ++ttc)
-		{
-			PageItem* ta = TableItemsF.at(ttc);
-			if (ta->TopLinkID != -1)
-				ta->TopLink = m_Doc->FrameItems.at(TableIDF[ta->TopLinkID]);
-			else
-				ta->TopLink = 0;
-			if (ta->LeftLinkID != -1)
-				ta->LeftLink = m_Doc->FrameItems.at(TableIDF[ta->LeftLinkID]);
-			else
-				ta->LeftLink = 0;
-			if (ta->RightLinkID != -1)
-				ta->RightLink = m_Doc->FrameItems.at(TableIDF[ta->RightLinkID]);
-			else
-				ta->RightLink = 0;
-			if (ta->BottomLinkID != -1)
-				ta->BottomLink = m_Doc->FrameItems.at(TableIDF[ta->BottomLinkID]);
-			else
-				ta->BottomLink = 0;
-		}
-	}
-	if (TableItemsM.count() != 0)
-	{
-		for (int ttc = 0; ttc < TableItemsM.count(); ++ttc)
-		{
-			PageItem* ta = TableItemsM.at(ttc);
-			if (ta->TopLinkID != -1)
-				ta->TopLink = m_Doc->MasterItems.at(TableIDM[ta->TopLinkID]);
-			else
-				ta->TopLink = 0;
-			if (ta->LeftLinkID != -1)
-				ta->LeftLink = m_Doc->MasterItems.at(TableIDM[ta->LeftLinkID]);
-			else
-				ta->LeftLink = 0;
-			if (ta->RightLinkID != -1)
-				ta->RightLink = m_Doc->MasterItems.at(TableIDM[ta->RightLinkID]);
-			else
-				ta->RightLink = 0;
-			if (ta->BottomLinkID != -1)
-				ta->BottomLink = m_Doc->MasterItems.at(TableIDM[ta->BottomLinkID]);
-			else
-				ta->BottomLink = 0;
-		}
-	}
-	if (TableItems.count() != 0)
-	{
-		for (int ttc = 0; ttc < TableItems.count(); ++ttc)
-		{
-			PageItem* ta = TableItems.at(ttc);
-			if (ta->TopLinkID != -1)
-				ta->TopLink = m_Doc->Items->at(TableID[ta->TopLinkID]);
-			else
-				ta->TopLink = 0;
-			if (ta->LeftLinkID != -1)
-				ta->LeftLink = m_Doc->Items->at(TableID[ta->LeftLinkID]);
-			else
-				ta->LeftLink = 0;
-			if (ta->RightLinkID != -1)
-				ta->RightLink = m_Doc->Items->at(TableID[ta->RightLinkID]);
-			else
-				ta->RightLink = 0;
-			if (ta->BottomLinkID != -1)
-				ta->BottomLink = m_Doc->Items->at(TableID[ta->BottomLinkID]);
-			else
-				ta->BottomLink = 0;
-		}
-	}
-	if (WeldItems.count() != 0)
-	{
-		for (int ttc = 0; ttc < WeldItems.count(); ++ttc)
-		{
-			PageItem* ta = WeldItems.at(ttc);
-			for (int i = 0 ; i < ta->weldList.count(); i++)
-			{
-				PageItem::weldingInfo wInf = ta->weldList.at(i);
-				ta->weldList[i].weldItem = WeldID[wInf.weldID];
-			}
-		}
-	}
-	// reestablish textframe links
-	if (itemNext.count() != 0)
-	{
-		QMap<int,int>::Iterator lc;
-		for (lc = itemNext.begin(); lc != itemNext.end(); ++lc)
-		{
-			if (lc.value() >= 0)
-			{
-				PageItem * Its = m_Doc->DocItems.at(lc.key());
-				PageItem * Itn = m_Doc->DocItems.at(lc.value());
-				if (!Its->testLinkCandidate(Itn))
-				{
-					qDebug() << "scribus150format: corruption in linked textframes detected";
-					continue;
-				}
-				Its->link(Itn);
+	if (isNewFormat)
+	{
+		if (TableItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < TableItems.count(); ++ttc)
+			{
+				PageItem* ta = TableItems.at(ttc);
+				if (ta->TopLinkID != -1)
+					ta->TopLink = LinkID[ta->TopLinkID];
+				else
+					ta->TopLink = 0;
+				if (ta->LeftLinkID != -1)
+					ta->LeftLink = LinkID[ta->LeftLinkID];
+				else
+					ta->LeftLink = 0;
+				if (ta->RightLinkID != -1)
+					ta->RightLink = LinkID[ta->RightLinkID];
+				else
+					ta->RightLink = 0;
+				if (ta->BottomLinkID != -1)
+					ta->BottomLink = LinkID[ta->BottomLinkID];
+				else
+					ta->BottomLink = 0;
+			}
+		}
+		if (WeldItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < WeldItems.count(); ++ttc)
+			{
+				PageItem* ta = WeldItems.at(ttc);
+				for (int i = 0 ; i < ta->weldList.count(); i++)
+				{
+					PageItem::weldingInfo wInf = ta->weldList.at(i);
+					ta->weldList[i].weldItem = LinkID[wInf.weldID];
+				}
+			}
+		}
+		if (itemNext.count() != 0)
+		{
+			QMap<int,int>::Iterator lc;
+			for (lc = itemNext.begin(); lc != itemNext.end(); ++lc)
+			{
+				if (lc.value() >= 0)
+				{
+					PageItem * Its = LinkID[lc.key()];
+					PageItem * Itn = LinkID[lc.value()];
+					if (!Its->testLinkCandidate(Itn))
+					{
+						qDebug() << "scribus150format: corruption in linked textframes detected";
+						continue;
+					}
+					Its->link(Itn);
+				}
+			}
+		}
+	}
+	else
+	{
+		if (TableItemsF.count() != 0)
+		{
+			for (int ttc = 0; ttc < TableItemsF.count(); ++ttc)
+			{
+				PageItem* ta = TableItemsF.at(ttc);
+				if (ta->TopLinkID != -1)
+					ta->TopLink = TableIDF[ta->TopLinkID];
+				else
+					ta->TopLink = 0;
+				if (ta->LeftLinkID != -1)
+					ta->LeftLink = TableIDF[ta->LeftLinkID];
+				else
+					ta->LeftLink = 0;
+				if (ta->RightLinkID != -1)
+					ta->RightLink = TableIDF[ta->RightLinkID];
+				else
+					ta->RightLink = 0;
+				if (ta->BottomLinkID != -1)
+					ta->BottomLink = TableIDF[ta->BottomLinkID];
+				else
+					ta->BottomLink = 0;
+			}
+		}
+		if (TableItemsM.count() != 0)
+		{
+			for (int ttc = 0; ttc < TableItemsM.count(); ++ttc)
+			{
+				PageItem* ta = TableItemsM.at(ttc);
+				if (ta->TopLinkID != -1)
+					ta->TopLink = TableIDM[ta->TopLinkID];
+				else
+					ta->TopLink = 0;
+				if (ta->LeftLinkID != -1)
+					ta->LeftLink = TableIDM[ta->LeftLinkID];
+				else
+					ta->LeftLink = 0;
+				if (ta->RightLinkID != -1)
+					ta->RightLink = TableIDM[ta->RightLinkID];
+				else
+					ta->RightLink = 0;
+				if (ta->BottomLinkID != -1)
+					ta->BottomLink = TableIDM[ta->BottomLinkID];
+				else
+					ta->BottomLink = 0;
+			}
+		}
+		if (TableItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < TableItems.count(); ++ttc)
+			{
+				PageItem* ta = TableItems.at(ttc);
+				if (ta->TopLinkID != -1)
+					ta->TopLink = TableID[ta->TopLinkID];
+				else
+					ta->TopLink = 0;
+				if (ta->LeftLinkID != -1)
+					ta->LeftLink = TableID[ta->LeftLinkID];
+				else
+					ta->LeftLink = 0;
+				if (ta->RightLinkID != -1)
+					ta->RightLink = TableID[ta->RightLinkID];
+				else
+					ta->RightLink = 0;
+				if (ta->BottomLinkID != -1)
+					ta->BottomLink = TableID[ta->BottomLinkID];
+				else
+					ta->BottomLink = 0;
+			}
+		}
+		if (WeldItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < WeldItems.count(); ++ttc)
+			{
+				PageItem* ta = WeldItems.at(ttc);
+				for (int i = 0 ; i < ta->weldList.count(); i++)
+				{
+					PageItem::weldingInfo wInf = ta->weldList.at(i);
+					ta->weldList[i].weldItem = WeldID[wInf.weldID];
+				}
+			}
+		}
+		// reestablish textframe links
+		if (itemNext.count() != 0)
+		{
+			QMap<int,int>::Iterator lc;
+			for (lc = itemNext.begin(); lc != itemNext.end(); ++lc)
+			{
+				if (lc.value() >= 0)
+				{
+					PageItem * Its = m_Doc->DocItems.at(lc.key());
+					PageItem * Itn = m_Doc->DocItems.at(lc.value());
+					if (!Its->testLinkCandidate(Itn))
+					{
+						qDebug() << "scribus150format: corruption in linked textframes detected";
+						continue;
+					}
+					Its->link(Itn);
+				}
 			}
 		}
 	}
@@ -473,6 +545,7 @@
 				PageItem* cItem = gpL.at(id);
 				cItem->gXpos = cItem->xPos() - gItem->xPos();
 				cItem->gYpos = cItem->yPos() - gItem->yPos();
+				cItem->Parent = gItem;
 				if (gItem->rotation() != 0)
 				{
 					QTransform ma;
@@ -498,6 +571,7 @@
 				PageItem* cItem = gpL.at(id);
 				cItem->gXpos = cItem->xPos() - gItem->xPos();
 				cItem->gYpos = cItem->yPos() - gItem->yPos();
+				cItem->Parent = gItem;
 				if (gItem->rotation() != 0)
 				{
 					QTransform ma;
@@ -523,6 +597,7 @@
 				PageItem* cItem = gpL.at(id);
 				cItem->gXpos = cItem->xPos() - gItem->xPos();
 				cItem->gYpos = cItem->yPos() - gItem->yPos();
+				cItem->Parent = gItem;
 				if (gItem->rotation() != 0)
 				{
 					QTransform ma;
@@ -537,7 +612,6 @@
 			gItem->groupItemList = gpL;
 		}
 	}
-	m_Doc->renumberItemsInListOrder();
 	return true;
 }
 
@@ -553,19 +627,16 @@
 	Yp = 0.0;
 	GrX = 0.0;
 	GrY = 0.0;
-
-	QMap<int,int> TableID;
-	QMap<int,int> TableIDM;
-	QMap<int,int> TableIDF;
+	isNewFormat = false;
+
+	QMap<int,PageItem*> TableID;
+	QMap<int,PageItem*> TableIDM;
+	QMap<int,PageItem*> TableIDF;
 	QList<PageItem*> TableItems;
 	QList<PageItem*> TableItemsM;
 	QList<PageItem*> TableItemsF;
 	QMap<int,PageItem*> WeldID;
-//	QMap<int,PageItem*> WeldIDM;
-//	QMap<int,PageItem*> WeldIDF;
 	QList<PageItem*> WeldItems;
-//	QList<PageItem*> WeldItemsM;
-//	QList<PageItem*> WeldItemsF;
 	QStack< QList<PageItem*> > groupStack;
 	QStack< QList<PageItem*> > groupStackF;
 	QStack< QList<PageItem*> > groupStackM;
@@ -605,11 +676,6 @@
 	TableItemsF.clear();
 	TableIDF.clear();
 	WeldItems.clear();
-	WeldID.clear();
-//	WeldItemsM.clear();
-//	WeldIDM.clear();
-//	WeldItemsF.clear();
-//	WeldIDF.clear();
 
 	m_Doc->GroupCounter = 1;
 	m_Doc->LastAuto = 0;
@@ -688,51 +754,56 @@
 			success = readObject(m_Doc, reader, itemInfo, fileDir, false);
 			if (!success) break;
 
-			// first of linked chain?
-			if (tagName == "PAGEOBJECT")
+			if (isNewFormat)
 			{
 				if (itemInfo.nextItem != -1)
-					itemNext[itemInfo.item->ItemNr] = itemInfo.nextItem;
-			}
-			else if (tagName == "MASTEROBJECT")
-			{
-				if (itemInfo.nextItem != -1)
-					itemNextM[itemInfo.item->ItemNr] = itemInfo.nextItem;
-			}
-			/* not sure if we want that...
-			else if (tagName == "FRAMEOBJECT")
-			{
-				if (itemInfo.nextItem != -1)
-					itemNextF[itemInfo.item->ItemNr] = itemInfo.nextItem;
-			}*/
-
-			if (itemInfo.item->isTableItem)
-			{
+					itemNext[itemInfo.itemID] = itemInfo.nextItem;
+				if (itemInfo.item->isTableItem)
+					TableItems.append(itemInfo.item);
+				if (itemInfo.isWeldFlag)
+					WeldItems.append(itemInfo.item);
+			}
+			else
+			{
+				// first of linked chain?
 				if (tagName == "PAGEOBJECT")
 				{
-					TableItems.append(itemInfo.item);
-					TableID.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
-				}
-				else if (tagName == "FRAMEOBJECT")
-				{
-					TableItemsF.append(itemInfo.item);
-					TableIDF.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
-				}
-				else
-				{
-					TableItemsM.append(itemInfo.item);
-					TableIDM.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
-				}
-			}
-			if (itemInfo.isWeldFlag)
-			{
-				WeldItems.append(itemInfo.item);
-				WeldID.insert(itemInfo.ownWeld, itemInfo.item);
+					if (itemInfo.nextItem != -1)
+						itemNext[itemInfo.ownNr] = itemInfo.nextItem;
+				}
+				else if (tagName == "MASTEROBJECT")
+				{
+					if (itemInfo.nextItem != -1)
+						itemNextM[itemInfo.ownNr] = itemInfo.nextItem;
+				}
+				if (itemInfo.item->isTableItem)
+				{
+					if (tagName == "PAGEOBJECT")
+					{
+						TableItems.append(itemInfo.item);
+						TableID.insert(itemInfo.ownLink, itemInfo.item);
+					}
+					else if (tagName == "FRAMEOBJECT")
+					{
+						TableItemsF.append(itemInfo.item);
+						TableIDF.insert(itemInfo.ownLink, itemInfo.item);
+					}
+					else
+					{
+						TableItemsM.append(itemInfo.item);
+						TableIDM.insert(itemInfo.ownLink, itemInfo.item);
+					}
+				}
+				if (itemInfo.isWeldFlag)
+				{
+					WeldItems.append(itemInfo.item);
+					WeldID.insert(itemInfo.ownWeld, itemInfo.item);
+				}
 			}
 			if (groupStack.count() > 0)
 			{
 				groupStack.top().append(itemInfo.item);
-				while (static_cast<int>(itemInfo.item->ItemNr) == groupStack2.top())
+				while (static_cast<int>(itemInfo.ownNr) == groupStack2.top())
 				{
 					if (tagName == "PAGEOBJECT")
 						groupStackP.push(groupStack.pop());
@@ -750,7 +821,7 @@
 				QList<PageItem*> GroupItems;
 				GroupItems.append(itemInfo.item);
 				groupStack.push(GroupItems);
-				groupStack2.push(itemInfo.groupLastItem + itemInfo.item->ItemNr);
+				groupStack2.push(itemInfo.groupLastItem + itemInfo.ownNr);
 			}
 		}
 		if (tagName == "Pattern")
@@ -765,121 +836,180 @@
 		setDomParsingError(reader.errorString(), reader.lineNumber(), reader.columnNumber());
 		return false;
 	}
-	if (TableItemsF.count() != 0)
-	{
-		for (int ttc = 0; ttc < TableItemsF.count(); ++ttc)
-		{
-			PageItem* ta = TableItemsF.at(ttc);
-			if (ta->TopLinkID != -1)
-				ta->TopLink = m_Doc->FrameItems.at(TableIDF[ta->TopLinkID]);
-			else
-				ta->TopLink = 0;
-			if (ta->LeftLinkID != -1)
-				ta->LeftLink = m_Doc->FrameItems.at(TableIDF[ta->LeftLinkID]);
-			else
-				ta->LeftLink = 0;
-			if (ta->RightLinkID != -1)
-				ta->RightLink = m_Doc->FrameItems.at(TableIDF[ta->RightLinkID]);
-			else
-				ta->RightLink = 0;
-			if (ta->BottomLinkID != -1)
-				ta->BottomLink = m_Doc->FrameItems.at(TableIDF[ta->BottomLinkID]);
-			else
-				ta->BottomLink = 0;
-		}
-	}
-	if (TableItemsM.count() != 0)
-	{
-		for (int ttc = 0; ttc < TableItemsM.count(); ++ttc)
-		{
-			PageItem* ta = TableItemsM.at(ttc);
-			if (ta->TopLinkID != -1)
-				ta->TopLink = m_Doc->MasterItems.at(TableIDM[ta->TopLinkID]);
-			else
-				ta->TopLink = 0;
-			if (ta->LeftLinkID != -1)
-				ta->LeftLink = m_Doc->MasterItems.at(TableIDM[ta->LeftLinkID]);
-			else
-				ta->LeftLink = 0;
-			if (ta->RightLinkID != -1)
-				ta->RightLink = m_Doc->MasterItems.at(TableIDM[ta->RightLinkID]);
-			else
-				ta->RightLink = 0;
-			if (ta->BottomLinkID != -1)
-				ta->BottomLink = m_Doc->MasterItems.at(TableIDM[ta->BottomLinkID]);
-			else
-				ta->BottomLink = 0;
-		}
-	}
-	if (TableItems.count() != 0)
-	{
-		for (int ttc = 0; ttc < TableItems.count(); ++ttc)
-		{
-			PageItem* ta = TableItems.at(ttc);
-			if (ta->TopLinkID != -1)
-				ta->TopLink = m_Doc->Items->at(TableID[ta->TopLinkID]);
-			else
-				ta->TopLink = 0;
-			if (ta->LeftLinkID != -1)
-				ta->LeftLink = m_Doc->Items->at(TableID[ta->LeftLinkID]);
-			else
-				ta->LeftLink = 0;
-			if (ta->RightLinkID != -1)
-				ta->RightLink = m_Doc->Items->at(TableID[ta->RightLinkID]);
-			else
-				ta->RightLink = 0;
-			if (ta->BottomLinkID != -1)
-				ta->BottomLink = m_Doc->Items->at(TableID[ta->BottomLinkID]);
-			else
-				ta->BottomLink = 0;
-		}
-	}
-	if (WeldItems.count() != 0)
-	{
-		for (int ttc = 0; ttc < WeldItems.count(); ++ttc)
-		{
-			PageItem* ta = WeldItems.at(ttc);
-			for (int i = 0 ; i < ta->weldList.count(); i++)
-			{
-				PageItem::weldingInfo wInf = ta->weldList.at(i);
-				ta->weldList[i].weldItem = WeldID[wInf.weldID];
-			}
-		}
-	}
-	// reestablish textframe links
-	if (itemNext.count() != 0)
-	{
-		QMap<int,int>::Iterator lc;
-		for (lc = itemNext.begin(); lc != itemNext.end(); ++lc)
-		{
-			if (lc.value() >= 0)
-			{
-				PageItem * Its = m_Doc->DocItems.at(lc.key());
-				PageItem * Itn = m_Doc->DocItems.at(lc.value());
-				if (!Its->testLinkCandidate(Itn))
-				{
-					qDebug() << "scribus150format: corruption in linked textframes detected";
-					continue;
-				}
-				Its->link(Itn);
-			}
-		}
-	}
-	if (itemNextM.count() != 0)
-	{
-		QMap<int,int>::Iterator lc;
-		for (lc = itemNextM.begin(); lc != itemNextM.end(); ++lc)
-		{
-			if (lc.value() >= 0)
-			{
-				PageItem * Its = m_Doc->MasterItems.at(lc.key());
-				PageItem * Itn = m_Doc->MasterItems.at(lc.value());
-				if (!Its->testLinkCandidate(Itn))
-				{
-					qDebug() << "scribus150format: corruption in linked textframes detected";
-					continue;
-				}
-				Its->link(Itn);
+	if (isNewFormat)
+	{
+		if (TableItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < TableItems.count(); ++ttc)
+			{
+				PageItem* ta = TableItems.at(ttc);
+				if (ta->TopLinkID != -1)
+					ta->TopLink = LinkID[ta->TopLinkID];
+				else
+					ta->TopLink = 0;
+				if (ta->LeftLinkID != -1)
+					ta->LeftLink = LinkID[ta->LeftLinkID];
+				else
+					ta->LeftLink = 0;
+				if (ta->RightLinkID != -1)
+					ta->RightLink = LinkID[ta->RightLinkID];
+				else
+					ta->RightLink = 0;
+				if (ta->BottomLinkID != -1)
+					ta->BottomLink = LinkID[ta->BottomLinkID];
+				else
+					ta->BottomLink = 0;
+			}
+		}
+		if (WeldItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < WeldItems.count(); ++ttc)
+			{
+				PageItem* ta = WeldItems.at(ttc);
+				for (int i = 0 ; i < ta->weldList.count(); i++)
+				{
+					PageItem::weldingInfo wInf = ta->weldList.at(i);
+					ta->weldList[i].weldItem = LinkID[wInf.weldID];
+				}
+			}
+		}
+		if (itemNext.count() != 0)
+		{
+			QMap<int,int>::Iterator lc;
+			for (lc = itemNext.begin(); lc != itemNext.end(); ++lc)
+			{
+				if (lc.value() >= 0)
+				{
+					PageItem * Its = LinkID[lc.key()];
+					PageItem * Itn = LinkID[lc.value()];
+					if (!Its->testLinkCandidate(Itn))
+					{
+						qDebug() << "scribus150format: corruption in linked textframes detected";
+						continue;
+					}
+					Its->link(Itn);
+				}
+			}
+		}
+	}
+	else
+	{
+		if (TableItemsF.count() != 0)
+		{
+			for (int ttc = 0; ttc < TableItemsF.count(); ++ttc)
+			{
+				PageItem* ta = TableItemsF.at(ttc);
+				if (ta->TopLinkID != -1)
+					ta->TopLink = TableIDF[ta->TopLinkID];
+				else
+					ta->TopLink = 0;
+				if (ta->LeftLinkID != -1)
+					ta->LeftLink = TableIDF[ta->LeftLinkID];
+				else
+					ta->LeftLink = 0;
+				if (ta->RightLinkID != -1)
+					ta->RightLink = TableIDF[ta->RightLinkID];
+				else
+					ta->RightLink = 0;
+				if (ta->BottomLinkID != -1)
+					ta->BottomLink = TableIDF[ta->BottomLinkID];
+				else
+					ta->BottomLink = 0;
+			}
+		}
+		if (TableItemsM.count() != 0)
+		{
+			for (int ttc = 0; ttc < TableItemsM.count(); ++ttc)
+			{
+				PageItem* ta = TableItemsM.at(ttc);
+				if (ta->TopLinkID != -1)
+					ta->TopLink = TableIDM[ta->TopLinkID];
+				else
+					ta->TopLink = 0;
+				if (ta->LeftLinkID != -1)
+					ta->LeftLink = TableIDM[ta->LeftLinkID];
+				else
+					ta->LeftLink = 0;
+				if (ta->RightLinkID != -1)
+					ta->RightLink = TableIDM[ta->RightLinkID];
+				else
+					ta->RightLink = 0;
+				if (ta->BottomLinkID != -1)
+					ta->BottomLink = TableIDM[ta->BottomLinkID];
+				else
+					ta->BottomLink = 0;
+			}
+		}
+		if (TableItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < TableItems.count(); ++ttc)
+			{
+				PageItem* ta = TableItems.at(ttc);
+				if (ta->TopLinkID != -1)
+					ta->TopLink = TableID[ta->TopLinkID];
+				else
+					ta->TopLink = 0;
+				if (ta->LeftLinkID != -1)
+					ta->LeftLink = TableID[ta->LeftLinkID];
+				else
+					ta->LeftLink = 0;
+				if (ta->RightLinkID != -1)
+					ta->RightLink = TableID[ta->RightLinkID];
+				else
+					ta->RightLink = 0;
+				if (ta->BottomLinkID != -1)
+					ta->BottomLink = TableID[ta->BottomLinkID];
+				else
+					ta->BottomLink = 0;
+			}
+		}
+		if (WeldItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < WeldItems.count(); ++ttc)
+			{
+				PageItem* ta = WeldItems.at(ttc);
+				for (int i = 0 ; i < ta->weldList.count(); i++)
+				{
+					PageItem::weldingInfo wInf = ta->weldList.at(i);
+					ta->weldList[i].weldItem = WeldID[wInf.weldID];
+				}
+			}
+		}
+		// reestablish textframe links
+		if (itemNext.count() != 0)
+		{
+			QMap<int,int>::Iterator lc;
+			for (lc = itemNext.begin(); lc != itemNext.end(); ++lc)
+			{
+				if (lc.value() >= 0)
+				{
+					PageItem * Its = m_Doc->DocItems.at(lc.key());
+					PageItem * Itn = m_Doc->DocItems.at(lc.value());
+					if (!Its->testLinkCandidate(Itn))
+					{
+						qDebug() << "scribus150format: corruption in linked textframes detected";
+						continue;
+					}
+					Its->link(Itn);
+				}
+			}
+		}
+		if (itemNextM.count() != 0)
+		{
+			QMap<int,int>::Iterator lc;
+			for (lc = itemNextM.begin(); lc != itemNextM.end(); ++lc)
+			{
+				if (lc.value() >= 0)
+				{
+					PageItem * Its = m_Doc->MasterItems.at(lc.key());
+					PageItem * Itn = m_Doc->MasterItems.at(lc.value());
+					if (!Its->testLinkCandidate(Itn))
+					{
+						qDebug() << "scribus150format: corruption in linked textframes detected";
+						continue;
+					}
+					Its->link(Itn);
+				}
 			}
 		}
 	}
@@ -894,6 +1024,7 @@
 				PageItem* cItem = gpL.at(id);
 				cItem->gXpos = cItem->xPos() - gItem->xPos();
 				cItem->gYpos = cItem->yPos() - gItem->yPos();
+				cItem->Parent = gItem;
 				if (gItem->rotation() != 0)
 				{
 					QTransform ma;
@@ -919,6 +1050,7 @@
 				PageItem* cItem = gpL.at(id);
 				cItem->gXpos = cItem->xPos() - gItem->xPos();
 				cItem->gYpos = cItem->yPos() - gItem->yPos();
+				cItem->Parent = gItem;
 				if (gItem->rotation() != 0)
 				{
 					QTransform ma;
@@ -944,6 +1076,7 @@
 				PageItem* cItem = gpL.at(id);
 				cItem->gXpos = cItem->xPos() - gItem->xPos();
 				cItem->gYpos = cItem->yPos() - gItem->yPos();
+				cItem->Parent = gItem;
 				if (gItem->rotation() != 0)
 				{
 					QTransform ma;
@@ -958,7 +1091,6 @@
 			gItem->groupItemList = gpL;
 		}
 	}
-	m_Doc->renumberItemsInListOrder();
 
 	if (m_Doc->Layers.count() == 0)
 		m_Doc->Layers.newLayer( QObject::tr("Background") );
@@ -986,10 +1118,11 @@
 	QMap<int, ScribusDoc::BookMa> bookmarks;
 
 	bool newVersion = false;
-
-	QMap<int,int> TableID;
-	QMap<int,int> TableIDM;
-	QMap<int,int> TableIDF;
+	isNewFormat = false;
+
+	QMap<int,PageItem*> TableID;
+	QMap<int,PageItem*> TableIDM;
+	QMap<int,PageItem*> TableIDF;
 	QList<PageItem*> TableItems;
 	QList<PageItem*> TableItemsM;
 	QList<PageItem*> TableItemsF;
@@ -1038,6 +1171,7 @@
 	TableIDF.clear();
 	WeldItems.clear();
 	WeldID.clear();
+	LinkID.clear();
 
 	m_Doc->GroupCounter = 1;
 	m_Doc->LastAuto = 0;
@@ -1223,50 +1357,56 @@
 				break;
 
 			// first of linked chain?
-			if (tagName == "PAGEOBJECT")
+			if (isNewFormat)
 			{
 				if (itemInfo.nextItem != -1)
-					itemNext[itemInfo.item->ItemNr] = itemInfo.nextItem;
-			}
-			else if (tagName == "MASTEROBJECT")
-			{
-				if (itemInfo.nextItem != -1)
-					itemNextM[itemInfo.item->ItemNr] = itemInfo.nextItem;
-			}
-			/* not sure if we want that...
-			else if (tagName == "FRAMEOBJECT")
-			{
-				if (itemInfo.nextItem != -1)
-					itemNextF[itemInfo.item->ItemNr] = itemInfo.nextItem;
-			}*/
-
-			if (itemInfo.item->isTableItem)
+					itemNext[itemInfo.itemID] = itemInfo.nextItem;
+				if (itemInfo.item->isTableItem)
+					TableItems.append(itemInfo.item);
+				if (itemInfo.isWeldFlag)
+					WeldItems.append(itemInfo.item);
+			}
+			else
 			{
 				if (tagName == "PAGEOBJECT")
 				{
-					TableItems.append(itemInfo.item);
-					TableID.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
-				}
-				else if (tagName == "FRAMEOBJECT")
-				{
-					TableItemsF.append(itemInfo.item);
-					TableIDF.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
-				}
-				else
-				{
-					TableItemsM.append(itemInfo.item);
-					TableIDM.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
-				}
-			}
-			if (itemInfo.isWeldFlag)
-			{
-				WeldItems.append(itemInfo.item);
-				WeldID.insert(itemInfo.ownWeld, itemInfo.item);
+					if (itemInfo.nextItem != -1)
+						itemNext[itemInfo.ownNr] = itemInfo.nextItem;
+				}
+				else if (tagName == "MASTEROBJECT")
+				{
+					if (itemInfo.nextItem != -1)
+						itemNextM[itemInfo.ownNr] = itemInfo.nextItem;
+				}
+				if (itemInfo.item->isTableItem)
+				{
+					if (tagName == "PAGEOBJECT")
+					{
+						TableItems.append(itemInfo.item);
+						TableID.insert(itemInfo.ownLink, itemInfo.item);
+					}
+					else if (tagName == "FRAMEOBJECT")
+					{
+						TableItemsF.append(itemInfo.item);
+						TableIDF.insert(itemInfo.ownLink, itemInfo.item);
+					}
+					else
+					{
+						TableItemsM.append(itemInfo.item);
+						TableIDM.insert(itemInfo.ownLink, itemInfo.item);
+					}
+				}
+
+				if (itemInfo.isWeldFlag)
+				{
+					WeldItems.append(itemInfo.item);
+					WeldID.insert(itemInfo.ownWeld, itemInfo.item);
+				}
 			}
 			if (groupStack.count() > 0)
 			{
 				groupStack.top().append(itemInfo.item);
-				while (static_cast<int>(itemInfo.item->ItemNr) == groupStack2.top())
+				while (static_cast<int>(itemInfo.ownNr) == groupStack2.top())
 				{
 					if (tagName == "PAGEOBJECT")
 						groupStackP.push(groupStack.pop());
@@ -1284,7 +1424,7 @@
 				QList<PageItem*> GroupItems;
 				GroupItems.append(itemInfo.item);
 				groupStack.push(GroupItems);
-				groupStack2.push(itemInfo.groupLastItem + itemInfo.item->ItemNr);
+				groupStack2.push(itemInfo.groupLastItem + itemInfo.ownNr);
 			}
 		}
 		if (tagName == "Pattern")
@@ -1313,84 +1453,179 @@
 		}
 	}
 
-	if (TableItemsF.count() != 0)
-	{
-		for (int ttc = 0; ttc < TableItemsF.count(); ++ttc)
-		{
-			PageItem* ta = TableItemsF.at(ttc);
-			if (ta->TopLinkID != -1)
-				ta->TopLink = m_Doc->FrameItems.at(TableIDF[ta->TopLinkID]);
-			else
-				ta->TopLink = 0;
-			if (ta->LeftLinkID != -1)
-				ta->LeftLink = m_Doc->FrameItems.at(TableIDF[ta->LeftLinkID]);
-			else
-				ta->LeftLink = 0;
-			if (ta->RightLinkID != -1)
-				ta->RightLink = m_Doc->FrameItems.at(TableIDF[ta->RightLinkID]);
-			else
-				ta->RightLink = 0;
-			if (ta->BottomLinkID != -1)
-				ta->BottomLink = m_Doc->FrameItems.at(TableIDF[ta->BottomLinkID]);
-			else
-				ta->BottomLink = 0;
-		}
-	}
-	if (TableItemsM.count() != 0)
-	{
-		for (int ttc = 0; ttc < TableItemsM.count(); ++ttc)
-		{
-			PageItem* ta = TableItemsM.at(ttc);
-			if (ta->TopLinkID != -1)
-				ta->TopLink = m_Doc->MasterItems.at(TableIDM[ta->TopLinkID]);
-			else
-				ta->TopLink = 0;
-			if (ta->LeftLinkID != -1)
-				ta->LeftLink = m_Doc->MasterItems.at(TableIDM[ta->LeftLinkID]);
-			else
-				ta->LeftLink = 0;
-			if (ta->RightLinkID != -1)
-				ta->RightLink = m_Doc->MasterItems.at(TableIDM[ta->RightLinkID]);
-			else
-				ta->RightLink = 0;
-			if (ta->BottomLinkID != -1)
-				ta->BottomLink = m_Doc->MasterItems.at(TableIDM[ta->BottomLinkID]);
-			else
-				ta->BottomLink = 0;
-		}
-	}
-	if (TableItems.count() != 0)
-	{
-		for (int ttc = 0; ttc < TableItems.count(); ++ttc)
-		{
-			PageItem* ta = TableItems.at(ttc);
-			if (ta->TopLinkID != -1)
-				ta->TopLink = m_Doc->Items->at(TableID[ta->TopLinkID]);
-			else
-				ta->TopLink = 0;
-			if (ta->LeftLinkID != -1)
-				ta->LeftLink = m_Doc->Items->at(TableID[ta->LeftLinkID]);
-			else
-				ta->LeftLink = 0;
-			if (ta->RightLinkID != -1)
-				ta->RightLink = m_Doc->Items->at(TableID[ta->RightLinkID]);
-			else
-				ta->RightLink = 0;
-			if (ta->BottomLinkID != -1)
-				ta->BottomLink = m_Doc->Items->at(TableID[ta->BottomLinkID]);
-			else
-				ta->BottomLink = 0;
-		}
-	}
-	if (WeldItems.count() != 0)
-	{
-		for (int ttc = 0; ttc < WeldItems.count(); ++ttc)
-		{
-			PageItem* ta = WeldItems.at(ttc);
-			for (int i = 0 ; i < ta->weldList.count(); i++)
-			{
-				PageItem::weldingInfo wInf = ta->weldList.at(i);
-				ta->weldList[i].weldItem = WeldID[wInf.weldID];
+	if (isNewFormat)
+	{
+		if (TableItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < TableItems.count(); ++ttc)
+			{
+				PageItem* ta = TableItems.at(ttc);
+				if (ta->TopLinkID != -1)
+					ta->TopLink = LinkID[ta->TopLinkID];
+				else
+					ta->TopLink = 0;
+				if (ta->LeftLinkID != -1)
+					ta->LeftLink = LinkID[ta->LeftLinkID];
+				else
+					ta->LeftLink = 0;
+				if (ta->RightLinkID != -1)
+					ta->RightLink = LinkID[ta->RightLinkID];
+				else
+					ta->RightLink = 0;
+				if (ta->BottomLinkID != -1)
+					ta->BottomLink = LinkID[ta->BottomLinkID];
+				else
+					ta->BottomLink = 0;
+			}
+		}
+		if (WeldItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < WeldItems.count(); ++ttc)
+			{
+				PageItem* ta = WeldItems.at(ttc);
+				for (int i = 0 ; i < ta->weldList.count(); i++)
+				{
+					PageItem::weldingInfo wInf = ta->weldList.at(i);
+					ta->weldList[i].weldItem = LinkID[wInf.weldID];
+				}
+			}
+		}
+		if (itemNext.count() != 0)
+		{
+			QMap<int,int>::Iterator lc;
+			for (lc = itemNext.begin(); lc != itemNext.end(); ++lc)
+			{
+				if (lc.value() >= 0)
+				{
+					PageItem * Its = LinkID[lc.key()];
+					PageItem * Itn = LinkID[lc.value()];
+					if (!Its->testLinkCandidate(Itn))
+					{
+						qDebug() << "scribus150format: corruption in linked textframes detected";
+						continue;
+					}
+					Its->link(Itn);
+				}
+			}
+		}
+	}
+	else
+	{
+		if (TableItemsF.count() != 0)
+		{
+			for (int ttc = 0; ttc < TableItemsF.count(); ++ttc)
+			{
+				PageItem* ta = TableItemsF.at(ttc);
+				if (ta->TopLinkID != -1)
+					ta->TopLink = TableIDF[ta->TopLinkID];
+				else
+					ta->TopLink = 0;
+				if (ta->LeftLinkID != -1)
+					ta->LeftLink = TableIDF[ta->LeftLinkID];
+				else
+					ta->LeftLink = 0;
+				if (ta->RightLinkID != -1)
+					ta->RightLink = TableIDF[ta->RightLinkID];
+				else
+					ta->RightLink = 0;
+				if (ta->BottomLinkID != -1)
+					ta->BottomLink = TableIDF[ta->BottomLinkID];
+				else
+					ta->BottomLink = 0;
+			}
+		}
+		if (TableItemsM.count() != 0)
+		{
+			for (int ttc = 0; ttc < TableItemsM.count(); ++ttc)
+			{
+				PageItem* ta = TableItemsM.at(ttc);
+				if (ta->TopLinkID != -1)
+					ta->TopLink = TableIDM[ta->TopLinkID];
+				else
+					ta->TopLink = 0;
+				if (ta->LeftLinkID != -1)
+					ta->LeftLink = TableIDM[ta->LeftLinkID];
+				else
+					ta->LeftLink = 0;
+				if (ta->RightLinkID != -1)
+					ta->RightLink = TableIDM[ta->RightLinkID];
+				else
+					ta->RightLink = 0;
+				if (ta->BottomLinkID != -1)
+					ta->BottomLink = TableIDM[ta->BottomLinkID];
+				else
+					ta->BottomLink = 0;
+			}
+		}
+		if (TableItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < TableItems.count(); ++ttc)
+			{
+				PageItem* ta = TableItems.at(ttc);
+				if (ta->TopLinkID != -1)
+					ta->TopLink = TableID[ta->TopLinkID];
+				else
+					ta->TopLink = 0;
+				if (ta->LeftLinkID != -1)
+					ta->LeftLink = TableID[ta->LeftLinkID];
+				else
+					ta->LeftLink = 0;
+				if (ta->RightLinkID != -1)
+					ta->RightLink = TableID[ta->RightLinkID];
+				else
+					ta->RightLink = 0;
+				if (ta->BottomLinkID != -1)
+					ta->BottomLink = TableID[ta->BottomLinkID];
+				else
+					ta->BottomLink = 0;
+			}
+		}
+		if (WeldItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < WeldItems.count(); ++ttc)
+			{
+				PageItem* ta = WeldItems.at(ttc);
+				for (int i = 0 ; i < ta->weldList.count(); i++)
+				{
+					PageItem::weldingInfo wInf = ta->weldList.at(i);
+					ta->weldList[i].weldItem = WeldID[wInf.weldID];
+				}
+			}
+		}
+		if (itemNext.count() != 0)
+		{
+			QMap<int,int>::Iterator lc;
+			for (lc = itemNext.begin(); lc != itemNext.end(); ++lc)
+			{
+				if (lc.value() >= 0)
+				{
+					PageItem * Its = m_Doc->DocItems.at(lc.key());
+					PageItem * Itn = m_Doc->DocItems.at(lc.value());
+					if (!Its->testLinkCandidate(Itn))
+					{
+						qDebug() << "scribus150format: corruption in linked textframes detected";
+						continue;
+					}
+					Its->link(Itn);
+				}
+			}
+		}
+		if (itemNextM.count() != 0)
+		{
+			QMap<int,int>::Iterator lc;
+			for (lc = itemNextM.begin(); lc != itemNextM.end(); ++lc)
+			{
+				if (lc.value() >= 0)
+				{
+					PageItem * Its = m_Doc->MasterItems.at(lc.key());
+					PageItem * Itn = m_Doc->MasterItems.at(lc.value());
+					if (!Its->testLinkCandidate(Itn))
+					{
+						qDebug() << "scribus150format: corruption in linked textframes detected";
+						continue;
+					}
+					Its->link(Itn);
+				}
 			}
 		}
 	}
@@ -1411,43 +1646,6 @@
 	if (m_Doc->Layers.count() == 0)
 		m_Doc->Layers.newLayer( QObject::tr("Background") );
 
-	// reestablish textframe links
-	if (itemNext.count() != 0)
-	{
-		QMap<int,int>::Iterator lc;
-		for (lc = itemNext.begin(); lc != itemNext.end(); ++lc)
-		{
-			if (lc.value() >= 0)
-			{
-				PageItem * Its = m_Doc->DocItems.at(lc.key());
-				PageItem * Itn = m_Doc->DocItems.at(lc.value());
-				if (!Its->testLinkCandidate(Itn))
-				{
-					qDebug() << "scribus150format: corruption in linked textframes detected";
-					continue;
-				}
-				Its->link(Itn);
-			}
-		}
-	}
-	if (itemNextM.count() != 0)
-	{
-		QMap<int,int>::Iterator lc;
-		for (lc = itemNextM.begin(); lc != itemNextM.end(); ++lc)
-		{
-			if (lc.value() >= 0)
-			{
-				PageItem * Its = m_Doc->MasterItems.at(lc.key());
-				PageItem * Itn = m_Doc->MasterItems.at(lc.value());
-				if (!Its->testLinkCandidate(Itn))
-				{
-					qDebug() << "scribus150format: corruption in linked textframes detected";
-					continue;
-				}
-				Its->link(Itn);
-			}
-		}
-	}
 	if (groupStackP.count() > 0)
 	{
 		while (groupStackP.count() > 0)
@@ -1459,6 +1657,7 @@
 				PageItem* cItem = gpL.at(id);
 				cItem->gXpos = cItem->xPos() - gItem->xPos();
 				cItem->gYpos = cItem->yPos() - gItem->yPos();
+				cItem->Parent = gItem;
 				if (gItem->rotation() != 0)
 				{
 					QTransform ma;
@@ -1484,6 +1683,7 @@
 				PageItem* cItem = gpL.at(id);
 				cItem->gXpos = cItem->xPos() - gItem->xPos();
 				cItem->gYpos = cItem->yPos() - gItem->yPos();
+				cItem->Parent = gItem;
 				if (gItem->rotation() != 0)
 				{
 					QTransform ma;
@@ -1509,6 +1709,7 @@
 				PageItem* cItem = gpL.at(id);
 				cItem->gXpos = cItem->xPos() - gItem->xPos();
 				cItem->gYpos = cItem->yPos() - gItem->yPos();
+				cItem->Parent = gItem;
 				if (gItem->rotation() != 0)
 				{
 					QTransform ma;
@@ -1523,7 +1724,6 @@
 			gItem->groupItemList = gpL;
 		}
 	}
-	m_Doc->renumberItemsInListOrder();
 	
 	// reestablish first/lastAuto
 	m_Doc->FirstAuto = m_Doc->LastAuto;
@@ -2715,11 +2915,16 @@
 
 	if (tagName == "FRAMEOBJECT")
 	{
-		doc->FrameItems.append(doc->Items->takeAt(newItem->ItemNr));
-		newItem->ItemNr = doc->FrameItems.count()-1;
+		doc->FrameItems.append(doc->Items->takeAt(doc->Items->indexOf(newItem)));
 	}
 
 	info.item     = newItem;
+	isNewFormat = attrs.hasAttribute("ItemID");
+	if (isNewFormat)
+	{
+		LinkID.insert(attrs.valueAsInt("ItemID", 0), newItem);
+		info.itemID = attrs.valueAsInt("ItemID", 0);
+	}
 	info.nextItem = attrs.valueAsInt("NEXTITEM", -1);
 	info.ownLink  = newItem->isTableItem ? attrs.valueAsInt("OwnLINK", 0) : 0;
 	info.groupLastItem = 0;
@@ -2728,6 +2933,7 @@
 		info.groupLastItem = attrs.valueAsInt("groupsLastItem", 0);
 	info.isWeldFlag = attrs.valueAsBool("isWeldItem", 0);
 	info.ownWeld = attrs.valueAsInt("WeldSource", 0);
+	info.ownNr = doc->Items->indexOf(newItem);
 
 	struct ImageLoadRequest loadingInfo;
 #ifdef HAVE_OSG
@@ -2976,6 +3182,7 @@
 				{
 					PageItem* currItem = GroupItems.at(as);
 					newItem->groupItemList.append(currItem);
+					currItem->Parent = newItem;
 				}
 				doc->Items = DItems;
 			}
@@ -3069,6 +3276,7 @@
 	ScXmlStreamAttributes attrs = reader.scAttributes();
 	QString patternName = attrs.valueAsString("Name");
 	bool success = true;
+	isNewFormat = false;
 
 	if (patternName.isEmpty())
 	{
@@ -3079,7 +3287,7 @@
 	QStack< QList<PageItem*> > groupStack;
 	QStack< QList<PageItem*> > groupStackP;
 	QStack<int> groupStack2;
-	QMap<int,int> TableID2;
+	QMap<int,PageItem*> TableID2;
 	QList<PageItem*> TableItems2;
 	QMap<int,PageItem*> WeldID;
 	QList<PageItem*> WeldItems;
@@ -3119,21 +3327,30 @@
 
 		itemInfo.item->OwnPage = ownPage;
 		itemInfo.item->OnMasterPage = "";
-
-		if (itemInfo.item->isTableItem)
-		{
-			TableItems2.append(itemInfo.item);
-			TableID2.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
-		}
-		if (itemInfo.isWeldFlag)
-		{
-			WeldItems.append(itemInfo.item);
-			WeldID.insert(itemInfo.ownWeld, itemInfo.item);
+		if (isNewFormat)
+		{
+			if (itemInfo.item->isTableItem)
+				TableItems2.append(itemInfo.item);
+			if (itemInfo.isWeldFlag)
+				WeldItems.append(itemInfo.item);
+		}
+		else
+		{
+			if (itemInfo.item->isTableItem)
+			{
+				TableItems2.append(itemInfo.item);
+				TableID2.insert(itemInfo.ownLink, itemInfo.item);
+			}
+			if (itemInfo.isWeldFlag)
+			{
+				WeldItems.append(itemInfo.item);
+				WeldID.insert(itemInfo.ownWeld, itemInfo.item);
+			}
 		}
 		if (groupStack.count() > 0)
 		{
 			groupStack.top().append(itemInfo.item);
-			while (static_cast<int>(itemInfo.item->ItemNr) == groupStack2.top())
+			while (static_cast<int>(itemInfo.ownNr) == groupStack2.top())
 			{
 				groupStackP.push(groupStack.pop());
 				groupStack2.pop();
@@ -3146,7 +3363,7 @@
 			QList<PageItem*> GroupItems;
 			GroupItems.append(itemInfo.item);
 			groupStack.push(GroupItems);
-			groupStack2.push(itemInfo.groupLastItem + itemInfo.item->ItemNr);
+			groupStack2.push(itemInfo.groupLastItem + itemInfo.ownNr);
 		}
 	}
 
@@ -3156,38 +3373,79 @@
 	{
 		return false;
 	}
-	if (TableItems2.count() != 0)
-	{
-		for (int ttc = 0; ttc < TableItems2.count(); ++ttc)
-		{
-			PageItem* ta = TableItems2.at(ttc);
-			if (ta->TopLinkID != -1)
-				ta->TopLink = m_Doc->Items->at(TableID2[ta->TopLinkID]);
-			else
-				ta->TopLink = 0;
-			if (ta->LeftLinkID != -1)
-				ta->LeftLink = m_Doc->Items->at(TableID2[ta->LeftLinkID]);
-			else
-				ta->LeftLink = 0;
-			if (ta->RightLinkID != -1)
-				ta->RightLink = m_Doc->Items->at(TableID2[ta->RightLinkID]);
-			else
-				ta->RightLink = 0;
-			if (ta->BottomLinkID != -1)
-				ta->BottomLink = m_Doc->Items->at(TableID2[ta->BottomLinkID]);
-			else
-				ta->BottomLink = 0;
-		}
-	}
-	if (WeldItems.count() != 0)
-	{
-		for (int ttc = 0; ttc < WeldItems.count(); ++ttc)
-		{
-			PageItem* ta = WeldItems.at(ttc);
-			for (int i = 0 ; i < ta->weldList.count(); i++)
-			{
-				PageItem::weldingInfo wInf = ta->weldList.at(i);
-				ta->weldList[i].weldItem = WeldID[wInf.weldID];
+	if (isNewFormat)
+	{
+		if (TableItems2.count() != 0)
+		{
+			for (int ttc = 0; ttc < TableItems2.count(); ++ttc)
+			{
+				PageItem* ta = TableItems2.at(ttc);
+				if (ta->TopLinkID != -1)
+					ta->TopLink = LinkID[ta->TopLinkID];
+				else
+					ta->TopLink = 0;
+				if (ta->LeftLinkID != -1)
+					ta->LeftLink = LinkID[ta->LeftLinkID];
+				else
+					ta->LeftLink = 0;
+				if (ta->RightLinkID != -1)
+					ta->RightLink = LinkID[ta->RightLinkID];
+				else
+					ta->RightLink = 0;
+				if (ta->BottomLinkID != -1)
+					ta->BottomLink = LinkID[ta->BottomLinkID];
+				else
+					ta->BottomLink = 0;
+			}
+		}
+		if (WeldItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < WeldItems.count(); ++ttc)
+			{
+				PageItem* ta = WeldItems.at(ttc);
+				for (int i = 0 ; i < ta->weldList.count(); i++)
+				{
+					PageItem::weldingInfo wInf = ta->weldList.at(i);
+					ta->weldList[i].weldItem = LinkID[wInf.weldID];
+				}
+			}
+		}
+	}
+	else
+	{
+		if (TableItems2.count() != 0)
+		{
+			for (int ttc = 0; ttc < TableItems2.count(); ++ttc)
+			{
+				PageItem* ta = TableItems2.at(ttc);
+				if (ta->TopLinkID != -1)
+					ta->TopLink = TableID2[ta->TopLinkID];
+				else
+					ta->TopLink = 0;
+				if (ta->LeftLinkID != -1)
+					ta->LeftLink = TableID2[ta->LeftLinkID];
+				else
+					ta->LeftLink = 0;
+				if (ta->RightLinkID != -1)
+					ta->RightLink = TableID2[ta->RightLinkID];
+				else
+					ta->RightLink = 0;
+				if (ta->BottomLinkID != -1)
+					ta->BottomLink = TableID2[ta->BottomLinkID];
+				else
+					ta->BottomLink = 0;
+			}
+		}
+		if (WeldItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < WeldItems.count(); ++ttc)
+			{
+				PageItem* ta = WeldItems.at(ttc);
+				for (int i = 0 ; i < ta->weldList.count(); i++)
+				{
+					PageItem::weldingInfo wInf = ta->weldList.at(i);
+					ta->weldList[i].weldItem = WeldID[wInf.weldID];
+				}
 			}
 		}
 	}
@@ -3202,6 +3460,7 @@
 				PageItem* cItem = gpL.at(id);
 				cItem->gXpos = cItem->xPos() - gItem->xPos();
 				cItem->gYpos = cItem->yPos() - gItem->yPos();
+				cItem->Parent = gItem;
 				if (gItem->rotation() != 0)
 				{
 					QTransform ma;
@@ -3216,7 +3475,6 @@
 			gItem->groupItemList = gpL;
 		}
 	}
-	m_Doc->renumberItemsInListOrder();
 
 	uint itemCount2 = m_Doc->Items->count();
 	if (itemCount2 > itemCount1)
@@ -3230,7 +3488,6 @@
 			newItem->moveBy(pat.xoffset, pat.yoffset, true);
 			newItem->gXpos += pat.xoffset;
 			newItem->gYpos += pat.yoffset;
-			newItem->ItemNr = pat.items.count();
 			pat.items.append(newItem);
 		}
 	}
@@ -3284,7 +3541,7 @@
 		if (ch == SpecialChars::OBJECT) {
 			if (iobj >= 0) {
 				if (iobj < doc->FrameItems.count())
-					obj->itemText.insertObject(pos, doc->FrameItems.at(iobj));
+					obj->itemText.insertObject(pos, LinkID[iobj]);
 				else
 					qDebug() << QString("scribus150format: invalid inline frame used in text object : %1").arg(iobj);
 			}
@@ -3760,7 +4017,7 @@
 			currItem->EmProfile   = attrs.valueAsString("EPROF", "");
 			currItem->IRender     = (eRenderIntent) attrs.valueAsInt("IRENDER" , 1);
 			currItem->UseEmbedded = attrs.valueAsInt("EMBEDDED", 1);
-			doc->LoadPict(currItem->Pfile, z);
+			doc->loadPict(currItem->Pfile, currItem);
 			currItem->setImageXYScale(scx, scy);
 			currItem->setImageShown( attrs.valueAsInt("PICART"));
 /*			currItem->BBoxX = ScCLocale::toDoubleC( obj->attribute("BBOXX"));
@@ -4211,7 +4468,7 @@
 	ScPage* newPage = NULL;
 	
 	QString tmp;
-	QMap<int,int> TableID;
+	QMap<int,PageItem*> TableID;
 	QList<PageItem*> TableItems;
 	QMap<int,PageItem*> WeldID;
 	QList<PageItem*> WeldItems;
@@ -4254,6 +4511,7 @@
 
 	bool firstElement = true;
 	bool success = true;
+	isNewFormat = false;
 	
 	ScXmlStreamReader reader(f);
 	ScXmlStreamAttributes attrs;
@@ -4419,19 +4677,6 @@
 			}
 			else
 			{
-				// first of linked chain?
-				if (tagName == "PAGEOBJECT")
-				{
-					itemRemap[itemCount++] = m_Doc->DocItems.count();
-					if (attrs.valueAsInt("NEXTITEM", -1) != -1)
-						itemNext[m_Doc->DocItems.count()] = attrs.valueAsInt("NEXTITEM");
-				}
-				else if (tagName == "MASTEROBJECT")
-				{
-					itemRemapM[itemCountM++] = m_Doc->MasterItems.count();
-					if (attrs.valueAsInt("NEXTITEM", -1) != -1)
-						itemNextM[m_Doc->MasterItems.count()] = attrs.valueAsInt("NEXTITEM");
-				}
 
 				ItemInfo itemInfo;
 				success = readObject(m_Doc, reader, itemInfo, fileDir, true);
@@ -4443,26 +4688,49 @@
 				if (tagName == "PAGEOBJECT")
 					newItem->OnMasterPage = "";
 				newItem->LayerID = layerTrans.value(newItem->LayerID, newItem->LayerID);
-
-				if (newItem->isTableItem)
-				{
-					TableItems.append(newItem);
-					TableID.insert(itemInfo.ownLink, newItem->ItemNr);
-				}
-				if (itemInfo.isWeldFlag)
-				{
-					WeldItems.append(itemInfo.item);
-					WeldID.insert(itemInfo.ownWeld, itemInfo.item);
+				if (isNewFormat)
+				{
+					if (itemInfo.nextItem != -1)
+						itemNext[itemInfo.itemID] = itemInfo.nextItem;
+					if (itemInfo.item->isTableItem)
+						TableItems.append(itemInfo.item);
+					if (itemInfo.isWeldFlag)
+						WeldItems.append(itemInfo.item);
+				}
+				else
+				{
+					// first of linked chain?
+					if (tagName == "PAGEOBJECT")
+					{
+						itemRemap[itemCount++] = m_Doc->DocItems.count();
+						if (attrs.valueAsInt("NEXTITEM", -1) != -1)
+							itemNext[m_Doc->DocItems.count()] = attrs.valueAsInt("NEXTITEM");
+					}
+					else if (tagName == "MASTEROBJECT")
+					{
+						itemRemapM[itemCountM++] = m_Doc->MasterItems.count();
+						if (attrs.valueAsInt("NEXTITEM", -1) != -1)
+							itemNextM[m_Doc->MasterItems.count()] = attrs.valueAsInt("NEXTITEM");
+					}
+					if (newItem->isTableItem)
+					{
+						TableItems.append(newItem);
+						TableID.insert(itemInfo.ownLink, newItem);
+					}
+					if (itemInfo.isWeldFlag)
+					{
+						WeldItems.append(itemInfo.item);
+						WeldID.insert(itemInfo.ownWeld, itemInfo.item);
+					}
 				}
 				if (tagName == "FRAMEOBJECT")
 				{
-					m_Doc->FrameItems.append(m_Doc->Items->takeAt(newItem->ItemNr));
-					newItem->ItemNr = m_Doc->FrameItems.count()-1;
+					m_Doc->FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(newItem)));
 				}
 				if (groupStack.count() > 0)
 				{
 					groupStack.top().append(itemInfo.item);
-					while (static_cast<int>(itemInfo.item->ItemNr) == groupStack2.top())
+					while (static_cast<int>(itemInfo.ownNr) == groupStack2.top())
 					{
 						if (tagName == "PAGEOBJECT")
 							groupStackP.push(groupStack.pop());
@@ -4480,7 +4748,7 @@
 					QList<PageItem*> GroupItems;
 					GroupItems.append(itemInfo.item);
 					groupStack.push(GroupItems);
-					groupStack2.push(itemInfo.groupLastItem + itemInfo.item->ItemNr);
+					groupStack2.push(itemInfo.groupLastItem + itemInfo.ownNr);
 				}
 			}
 		}
@@ -4499,59 +4767,57 @@
 		if (elem < m_Doc->Items->count())
 		{
 			ScribusDoc::BookMa bookmark = it.value();
-			bookmark.PageObject = m_Doc->Items->at(elem);
+			bookmark.PageObject = LinkID[elem];
 			m_Doc->BookMarks.append( bookmark );
 		}
 	}
 
-	if (TableItems.count() != 0)
-	{
-		for (int ttc = 0; ttc < TableItems.count(); ++ttc)
-		{
-			PageItem* ta = TableItems.at(ttc);
-			if (ta->TopLinkID != -1)
-				ta->TopLink = m_Doc->Items->at(TableID[ta->TopLinkID]);
-			else
-				ta->TopLink = 0;
-			if (ta->LeftLinkID != -1)
-				ta->LeftLink = m_Doc->Items->at(TableID[ta->LeftLinkID]);
-			else
-				ta->LeftLink = 0;
-			if (ta->RightLinkID != -1)
-				ta->RightLink = m_Doc->Items->at(TableID[ta->RightLinkID]);
-			else
-				ta->RightLink = 0;
-			if (ta->BottomLinkID != -1)
-				ta->BottomLink = m_Doc->Items->at(TableID[ta->BottomLinkID]);
-			else
-				ta->BottomLink = 0;
-		}
-	}
-	if (WeldItems.count() != 0)
-	{
-//		QList<PageItem*> docList = m_Doc->getAllItems(*m_Doc->Items);
-		for (int ttc = 0; ttc < WeldItems.count(); ++ttc)
-		{
-			PageItem* ta = WeldItems.at(ttc);
-			for (int i = 0 ; i < ta->weldList.count(); i++)
-			{
-				PageItem::weldingInfo wInf = ta->weldList.at(i);
-				ta->weldList[i].weldItem = WeldID[wInf.weldID];
-			}
-		}
-	}
-	// reestablish textframe links
-	if (itemNext.count() != 0 && !Mpage)
-	{
-		QMap<int,int>::Iterator lc;
-		for (lc = itemNext.begin(); lc != itemNext.end(); ++lc)
-		{
-			if (itemRemap[lc.value()] >= 0)
-			{
-				if ((lc.key() < m_Doc->Items->count()) && (itemRemap[lc.value()] < m_Doc->Items->count()))
-				{
-					PageItem * Its = m_Doc->DocItems.at(lc.key());
-					PageItem * Itn = m_Doc->DocItems.at(itemRemap[lc.value()]);
+	if (isNewFormat)
+	{
+		if (TableItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < TableItems.count(); ++ttc)
+			{
+				PageItem* ta = TableItems.at(ttc);
+				if (ta->TopLinkID != -1)
+					ta->TopLink = LinkID[ta->TopLinkID];
+				else
+					ta->TopLink = 0;
+				if (ta->LeftLinkID != -1)
+					ta->LeftLink = LinkID[ta->LeftLinkID];
+				else
+					ta->LeftLink = 0;
+				if (ta->RightLinkID != -1)
+					ta->RightLink = LinkID[ta->RightLinkID];
+				else
+					ta->RightLink = 0;
+				if (ta->BottomLinkID != -1)
+					ta->BottomLink = LinkID[ta->BottomLinkID];
+				else
+					ta->BottomLink = 0;
+			}
+		}
+		if (WeldItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < WeldItems.count(); ++ttc)
+			{
+				PageItem* ta = WeldItems.at(ttc);
+				for (int i = 0 ; i < ta->weldList.count(); i++)
+				{
+					PageItem::weldingInfo wInf = ta->weldList.at(i);
+					ta->weldList[i].weldItem = LinkID[wInf.weldID];
+				}
+			}
+		}
+		if (itemNext.count() != 0)
+		{
+			QMap<int,int>::Iterator lc;
+			for (lc = itemNext.begin(); lc != itemNext.end(); ++lc)
+			{
+				if (lc.value() >= 0)
+				{
+					PageItem * Its = LinkID[lc.key()];
+					PageItem * Itn = LinkID[lc.value()];
 					if (!Its->testLinkCandidate(Itn))
 					{
 						qDebug() << "scribus150format: corruption in linked textframes detected";
@@ -4562,23 +4828,83 @@
 			}
 		}
 	}
-	else if (itemNextM.count() != 0 && Mpage)
-	{
-		QMap<int,int>::Iterator lc;
-		for (lc = itemNextM.begin(); lc != itemNextM.end(); ++lc)
-		{
-			if (itemRemapM[lc.value()] >= 0)
-			{
-				if ((lc.key() < m_Doc->MasterItems.count()) && (itemRemapM[lc.value()] < m_Doc->MasterItems.count()))
-				{
-					PageItem * Its = m_Doc->MasterItems.at(lc.key());
-					PageItem * Itn = m_Doc->MasterItems.at(itemRemapM[lc.value()]);
-					if (!Its->testLinkCandidate(Itn))
+	else
+	{
+		if (TableItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < TableItems.count(); ++ttc)
+			{
+				PageItem* ta = TableItems.at(ttc);
+				if (ta->TopLinkID != -1)
+					ta->TopLink = TableID[ta->TopLinkID];
+				else
+					ta->TopLink = 0;
+				if (ta->LeftLinkID != -1)
+					ta->LeftLink = TableID[ta->LeftLinkID];
+				else
+					ta->LeftLink = 0;
+				if (ta->RightLinkID != -1)
+					ta->RightLink = TableID[ta->RightLinkID];
+				else
+					ta->RightLink = 0;
+				if (ta->BottomLinkID != -1)
+					ta->BottomLink = TableID[ta->BottomLinkID];
+				else
+					ta->BottomLink = 0;
+			}
+		}
+		if (WeldItems.count() != 0)
+		{
+			for (int ttc = 0; ttc < WeldItems.count(); ++ttc)
+			{
+				PageItem* ta = WeldItems.at(ttc);
+				for (int i = 0 ; i < ta->weldList.count(); i++)
+				{
+					PageItem::weldingInfo wInf = ta->weldList.at(i);
+					ta->weldList[i].weldItem = WeldID[wInf.weldID];
+				}
+			}
+		}
+		// reestablish textframe links
+		if (itemNext.count() != 0 && !Mpage)
+		{
+			QMap<int,int>::Iterator lc;
+			for (lc = itemNext.begin(); lc != itemNext.end(); ++lc)
+			{
+				if (itemRemap[lc.value()] >= 0)
+				{
+					if ((lc.key() < m_Doc->Items->count()) && (itemRemap[lc.value()] < m_Doc->Items->count()))
 					{
-						qDebug() << "scribus150format: corruption in linked textframes detected";
-						continue;
+						PageItem * Its = m_Doc->DocItems.at(lc.key());
+						PageItem * Itn = m_Doc->DocItems.at(itemRemap[lc.value()]);
+						if (!Its->testLinkCandidate(Itn))
+						{
+							qDebug() << "scribus150format: corruption in linked textframes detected";
+							continue;
+						}
+						Its->link(Itn);
 					}
-					Its->link(Itn);
+				}
+			}
+		}
+		else if (itemNextM.count() != 0 && Mpage)
+		{
+			QMap<int,int>::Iterator lc;
+			for (lc = itemNextM.begin(); lc != itemNextM.end(); ++lc)
+			{
+				if (itemRemapM[lc.value()] >= 0)
+				{
+					if ((lc.key() < m_Doc->MasterItems.count()) && (itemRemapM[lc.value()] < m_Doc->MasterItems.count()))
+					{
+						PageItem * Its = m_Doc->MasterItems.at(lc.key());
+						PageItem * Itn = m_Doc->MasterItems.at(itemRemapM[lc.value()]);
+						if (!Its->testLinkCandidate(Itn))
+						{
+							qDebug() << "scribus150format: corruption in linked textframes detected";
+							continue;
+						}
+						Its->link(Itn);
+					}
 				}
 			}
 		}
@@ -4594,6 +4920,7 @@
 				PageItem* cItem = gpL.at(id);
 				cItem->gXpos = cItem->xPos() - gItem->xPos();
 				cItem->gYpos = cItem->yPos() - gItem->yPos();
+				cItem->Parent = gItem;
 				if (gItem->rotation() != 0)
 				{
 					QTransform ma;
@@ -4619,6 +4946,7 @@
 				PageItem* cItem = gpL.at(id);
 				cItem->gXpos = cItem->xPos() - gItem->xPos();
 				cItem->gYpos = cItem->yPos() - gItem->yPos();
+				cItem->Parent = gItem;
 				if (gItem->rotation() != 0)
 				{
 					QTransform ma;
@@ -4633,7 +4961,6 @@
 			gItem->groupItemList = gpL;
 		}
 	}
-	m_Doc->renumberItemsInListOrder();
 	
 	// reestablish first/lastAuto
 	m_Doc->FirstAuto = m_Doc->LastAuto;

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h Tue Nov  1 08:51:14 2011
@@ -74,12 +74,14 @@
 		class ItemInfo
 		{
 		public:
-			ItemInfo(void) { groupLastItem = nextItem = ownLink = ownWeld = 0; item = NULL; isGroupFlag = isWeldFlag = false; };
+			ItemInfo(void) { groupLastItem = nextItem = ownLink = ownWeld = ownNr = itemID = 0; item = NULL; isGroupFlag = isWeldFlag = false; };
 			PageItem* item;
 			int groupLastItem;
 			int nextItem;
 			int ownLink;
 			int ownWeld;
+			int ownNr;
+			int itemID;
 			bool isGroupFlag;
 			bool isWeldFlag;
 		};
@@ -161,6 +163,7 @@
 		QMap<int, int> itemNextF;
 		QMap<int, int> itemRemapM;
 		QMap<int, int> itemNextM;
+		QMap<int,PageItem*> LinkID;
 		QMap<PageItem*, QString> itemsWeld;  //item* and master name
 
 		int itemCount;
@@ -172,6 +175,7 @@
 		double Yp;
 		double GrY;
 		QString clipPath;
+		bool isNewFormat;
 };
 
 extern "C" PLUGIN_API int scribus150format_getPluginAPIVersion();

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp Tue Nov  1 08:51:14 2011
@@ -488,7 +488,7 @@
 		docu.writeAttribute("Text",(*itbm).Text);
 		docu.writeAttribute("Aktion",(*itbm).Aktion);
 		docu.writeAttribute("ItemNr", (*itbm).ItemNr);
-		docu.writeAttribute("Element", (*itbm).PageObject->ItemNr);
+		docu.writeAttribute("Element", qHash((*itbm).PageObject));
 		docu.writeAttribute("First", (*itbm).First);
 		docu.writeAttribute("Last", (*itbm).Last);
 		docu.writeAttribute("Prev", (*itbm).Prev);
@@ -1219,7 +1219,7 @@
 				putCStyle(docu, lastStyle);
 			tmpnum.setNum(ch.unicode());
 			docu.writeAttribute("Unicode", tmpnum);
-			docu.writeAttribute("COBJ", item->itemText.object(k)->ItemNr);		
+			docu.writeAttribute("COBJ", qHash(item->itemText.object(k)));
 		}
 		else if (ch == SpecialChars::PARSEP)	// stores also the paragraphstyle for preceding chars
 			putPStyle(docu, item->itemText.paragraphStyle(k), "para");
@@ -1516,12 +1516,12 @@
 		if (item->asTextFrame() || item->asPathText() || item->asImageFrame())
 		{
 			if (item->nextInChain() != 0)
-				docu.writeAttribute("NEXTITEM", item->nextInChain()->ItemNr);
+				docu.writeAttribute("NEXTITEM", qHash(item->nextInChain()));
 			else
 				docu.writeAttribute("NEXTITEM", -1);
 			
 			if (item->prevInChain() != 0 && items->contains(item->prevInChain()))
-				docu.writeAttribute("BACKITEM", item->prevInChain()->ItemNr);
+				docu.writeAttribute("BACKITEM", qHash(item->prevInChain()));
 			else
 			{
 				docu.writeAttribute("BACKITEM", -1);
@@ -1864,12 +1864,12 @@
 		if (item->isWelded())
 		{
 			docu.writeAttribute("isWeldItem", 1);
-			docu.writeAttribute("WeldSource", item->uniqueNr);
+			docu.writeAttribute("WeldSource", qHash(item));
 			for (int i = 0 ; i <  item->weldList.count(); i++)
 			{
 				PageItem::weldingInfo wInf = item->weldList.at(i);
 				docu.writeEmptyElement("WeldEntry");
-				docu.writeAttribute("Target", wInf.weldItem->uniqueNr);
+				docu.writeAttribute("Target", qHash(wInf.weldItem));
 				docu.writeAttribute("WX", wInf.weldPoint.x());
 				docu.writeAttribute("WY", wInf.weldPoint.y());
 			}
@@ -1884,6 +1884,7 @@
 	QString tmp, tmpy;
 	if (newFormat)
 		docu.writeAttribute("OwnPage", item->OwnPage);
+	docu.writeAttribute("ItemID", qHash(item));
 	docu.writeAttribute("PTYPE",item->realItemType());
 	docu.writeAttribute("WIDTH",item->width());
 	docu.writeAttribute("HEIGHT",item->height());
@@ -2179,22 +2180,22 @@
 		docu.writeAttribute("RightLine", static_cast<int>(item->RightLine));
 		docu.writeAttribute("BottomLine", static_cast<int>(item->BottomLine));
 		if (item->TopLink != 0)
-			docu.writeAttribute("TopLINK", item->TopLink->ItemNr);
+			docu.writeAttribute("TopLINK", qHash(item->TopLink));
 		else
 			docu.writeAttribute("TopLINK", -1);
 		if (item->LeftLink != 0)
-			docu.writeAttribute("LeftLINK", item->LeftLink->ItemNr);
+			docu.writeAttribute("LeftLINK", qHash(item->LeftLink));
 		else
 			docu.writeAttribute("LeftLINK", -1);
 		if (item->RightLink != 0)
-			docu.writeAttribute("RightLINK", item->RightLink->ItemNr);
+			docu.writeAttribute("RightLINK", qHash(item->RightLink));
 		else
 			docu.writeAttribute("RightLINK", -1);
 		if (item->BottomLink != 0)
-			docu.writeAttribute("BottomLINK", item->BottomLink->ItemNr);
+			docu.writeAttribute("BottomLINK", qHash(item->BottomLink));
 		else
 			docu.writeAttribute("BottomLINK", -1);
-		docu.writeAttribute("OwnLINK", item->ItemNr);
+		docu.writeAttribute("OwnLINK", qHash(item));
 	}
 
 	if (item->isTable())

Modified: trunk/Scribus/scribus/plugins/import/ai/importai.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/import/ai/importai.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/ai/importai.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/ai/importai.cpp Tue Nov  1 08:51:14 2011
@@ -497,7 +497,6 @@
 				m_Doc->m_Selection->delaySignalsOn();
 				for (int dre=0; dre<Elements.count(); ++dre)
 				{
-					m_Doc->DragElements.append(Elements.at(dre)->ItemNr);
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
@@ -1439,7 +1438,7 @@
 					QString imgName = getLongPathName(ite->tempImageFile->fileName());
 					ite->tempImageFile->close();
 					ite->isInlineImage = true;
-					m_Doc->LoadPict(imgName, z);
+					m_Doc->loadPict(imgName, ite);
 					if (ite->PictureIsAvailable)
 						ite->setImageXYScale(ite->width() / ite->pixm.width(), ite->height() / ite->pixm.height());
 					ite->setImageFlippedV(true);
@@ -3092,7 +3091,7 @@
 		}
 		TIFFClose(tif);
 	}
-	m_Doc->LoadPict(imgName, z);
+	m_Doc->loadPict(imgName, ite);
 	if (ite->PictureIsAvailable)
 		ite->setImageXYScale(ite->width() / ite->pixm.width(), ite->height() / ite->pixm.height());
 	if (importerFlags & LoadSavePlugin::lfCreateDoc)

Modified: trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp Tue Nov  1 08:51:14 2011
@@ -260,7 +260,6 @@
 				m_Doc->m_Selection->delaySignalsOn();
 				for (int dre=0; dre<Elements.count(); ++dre)
 				{
-					m_Doc->DragElements.append(Elements.at(dre)->ItemNr);
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
@@ -1259,7 +1258,7 @@
 		ite->tempImageFile->close();
 		ite->isInlineImage = true;
 		image.save(fileName, "PNG");
-		m_Doc->LoadPict(fileName, z);
+		m_Doc->loadPict(fileName, ite);
 		ite->setImageScalingMode(false, false);
 	}
 	else if (elemID == 10)

Modified: trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp Tue Nov  1 08:51:14 2011
@@ -257,7 +257,6 @@
 				m_Doc->m_Selection->delaySignalsOn();
 				for (int dre=0; dre<Elements.count(); ++dre)
 				{
-					m_Doc->DragElements.append(Elements.at(dre)->ItemNr);
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
@@ -334,7 +333,7 @@
 bool CvgPlug::convert(QString fn)
 {
 	QString tmp;
-	CurrColorFill = "White";
+	CurrColorFill = "Black";
 	CurrFillShade = 100.0;
 	CurrColorStroke = "Black";
 	CurrStrokeShade = 100.0;
@@ -418,6 +417,7 @@
 	ts >> obX >> obY >> obW >> obH;
 	ts >> colorFill >> colorLine;
 	ts >> fillFlag >> lineWidth;
+	fillFlag = fillFlag & 0x0FFF;
 	qreal scX = obW / 16384.0;
 	qreal scY = obH / 16384.0;
 	parseColor(colorFill, colorLine, color, fillFlag);

Modified: trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp Tue Nov  1 08:51:14 2011
@@ -274,7 +274,6 @@
 				m_Doc->m_Selection->delaySignalsOn();
 				for (int dre=0; dre<Elements.count(); ++dre)
 				{
-					m_Doc->DragElements.append(Elements.at(dre)->ItemNr);
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
@@ -1222,6 +1221,7 @@
 						popped.groupItem->groupItemList.append(item);
 						item->gXpos = item->xPos() - popped.groupItem->xPos();
 						item->gYpos = item->yPos() - popped.groupItem->yPos();
+						item->Parent = popped.groupItem;
 						if (groupStack.count() > 0)
 							groupStack.top().GElements.removeAll(tmpSel->itemAt(i));
 						Elements.removeAll(tmpSel->itemAt(i));
@@ -1902,7 +1902,6 @@
 					newItem->gWidth = pat.pattern.width();
 					newItem->gHeight = pat.pattern.height();
 					pat.items.append(newItem);
-					newItem->ItemNr = pat.items.count();
 				}
 				patternName = "Pattern_"+newItem->itemName();
 				patternName = patternName.trimmed().simplified().replace(" ", "_");

Modified: trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp Tue Nov  1 08:51:14 2011
@@ -615,7 +615,6 @@
 			m_Doc->m_Selection->delaySignalsOn();
 			for (int dre=0; dre<Elements.count(); ++dre)
 			{
-				m_Doc->DragElements.append(Elements.at(dre)->ItemNr);
 				tmpSel->addItem(Elements.at(dre), true);
 			}
 			ScriXmlDoc *ss = new ScriXmlDoc();
@@ -676,12 +675,6 @@
 	}
 	if (cElements.count() < 2)
 	{
-//		m_Doc->Items->takeAt(zn);
-//		delete neu;
-		for (int a = 0; a < m_Doc->Items->count(); ++a)
-		{
-			m_Doc->Items->at(a)->ItemNr = a;
-		}
 		for (int gr = 0; gr < cElements.count(); ++gr)
 		{
 			elements.append(cElements.at(gr));

Modified: trunk/Scribus/scribus/plugins/import/pct/importpct.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/import/pct/importpct.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pct/importpct.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pct/importpct.cpp Tue Nov  1 08:51:14 2011
@@ -260,7 +260,6 @@
 				m_Doc->m_Selection->delaySignalsOn();
 				for (int dre=0; dre<Elements.count(); ++dre)
 				{
-					m_Doc->DragElements.append(Elements.at(dre)->ItemNr);
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
@@ -947,7 +946,7 @@
 						image.save(fileName, "PNG");
 						ite->moveBy(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
 						finishItem(ite);
-						m_Doc->LoadPict(fileName, z);
+						m_Doc->loadPict(fileName, ite);
 						ite->setImageScalingMode(false, false);
 					}
 //					qDebug() << "End of Pict";
@@ -1770,7 +1769,7 @@
 		image.save(fileName, "PNG");
 		ite->moveBy(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
 		finishItem(ite);
-		m_Doc->LoadPict(fileName, z);
+		m_Doc->loadPict(fileName, ite);
 		ite->setImageScalingMode(false, false);
 		skipOpcode = false;
 	}
@@ -2122,7 +2121,6 @@
 			newItem->gWidth = pat.pattern.width();
 			newItem->gHeight = pat.pattern.height();
 			pat.items.append(newItem);
-			newItem->ItemNr = pat.items.count();
 		}
 		patternName = "Pattern_"+newItem->itemName();
 		patternName = patternName.trimmed().simplified().replace(" ", "_");

Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp Tue Nov  1 08:51:14 2011
@@ -220,7 +220,6 @@
 				m_Doc->m_Selection->delaySignalsOn();
 				for (int dre=0; dre<Elements.count(); ++dre)
 				{
-					m_Doc->DragElements.append(Elements.at(dre)->ItemNr);
 					tmpSele->addItem(Elements.at(dre), true);
 				}
 				tmpSele->setGroupRect();

Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp Tue Nov  1 08:51:14 2011
@@ -1120,7 +1120,7 @@
 			ite->tempImageFile->close();
 			ite->isInlineImage = true;
 			res.save(fileName, "PNG");
-			m_doc->LoadPict(fileName, z);
+			m_doc->loadPict(fileName, ite);
 			ite->setImageScalingMode(false, true);
 			m_doc->AdjustItemSize(ite);
 			m_Elements->append(ite);
@@ -1244,7 +1244,7 @@
 			ite->tempImageFile->close();
 			ite->isInlineImage = true;
 			res.save(fileName, "PNG");
-			m_doc->LoadPict(fileName, z);
+			m_doc->loadPict(fileName, ite);
 			ite->setImageScalingMode(false, true);
 			m_doc->AdjustItemSize(ite);
 			m_Elements->append(ite);
@@ -1359,7 +1359,7 @@
 			ite->tempImageFile->close();
 			ite->isInlineImage = true;
 			img.save(fileName, "PNG");
-			m_doc->LoadPict(fileName, z);
+			m_doc->loadPict(fileName, ite);
 			ite->setImageScalingMode(false, true);
 			m_doc->AdjustItemSize(ite);
 			m_Elements->append(ite);

Modified: trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/shape/importshape.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/shape/importshape.cpp Tue Nov  1 08:51:14 2011
@@ -260,7 +260,6 @@
 				m_Doc->m_Selection->delaySignalsOn();
 				for (int dre=0; dre<Elements.count(); ++dre)
 				{
-					m_Doc->DragElements.append(Elements.at(dre)->ItemNr);
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
@@ -611,7 +610,6 @@
 				Selection tmpSelection(m_Doc, false);
 				tmpSelection.addItem(neu);
 				m_Doc->itemSelection_DeleteItem(&tmpSelection);
-				m_Doc->renumberItemsInListOrder();
 			}
 			else
 			{
@@ -651,6 +649,7 @@
 					currItem->gYpos = currItem->yPos() - gy;
 					currItem->gWidth = gw;
 					currItem->gHeight = gh;
+					currItem->Parent = neu;
 					neu->groupItemList.append(currItem);
 					m_Doc->Items->removeAll(currItem);
 					Elements.removeAll(currItem);
@@ -658,7 +657,6 @@
 				neu->setRedrawBounding();
 				neu->setTextFlowMode(PageItem::TextFlowDisabled);
 				m_Doc->GroupCounter++;
-				m_Doc->renumberItemsInListOrder();
 			}
 		}
 		DOC = DOC.nextSibling();

Modified: trunk/Scribus/scribus/plugins/import/sml/importsml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/import/sml/importsml.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/sml/importsml.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/sml/importsml.cpp Tue Nov  1 08:51:14 2011
@@ -258,7 +258,6 @@
 				m_Doc->m_Selection->delaySignalsOn();
 				for (int dre=0; dre<Elements.count(); ++dre)
 				{
-					m_Doc->DragElements.append(Elements.at(dre)->ItemNr);
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();

Modified: trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp Tue Nov  1 08:51:14 2011
@@ -508,7 +508,6 @@
 			m_Doc->m_Selection->delaySignalsOn();
 			for (int dre=0; dre<Elements.count(); ++dre)
 			{
-				m_Doc->DragElements.append(Elements.at(dre)->ItemNr);
 				tmpSel->addItem(Elements.at(dre), true);
 			}
 			ScriXmlDoc *ss = new ScriXmlDoc();
@@ -1151,10 +1150,6 @@
 			Selection tmpSelection(m_Doc, false);
 			tmpSelection.addItem(neu);
 			m_Doc->itemSelection_DeleteItem(&tmpSelection);
-			for (int a = 0; a < m_Doc->Items->count(); ++a)
-			{
-				m_Doc->Items->at(a)->ItemNr = a;
-			}
 			for (int gr = 0; gr < gElements.count(); ++gr)
 			{
 				GElements.append(gElements.at(gr));
@@ -1212,13 +1207,13 @@
 					currItem->gYpos = currItem->yPos() - gy;
 					currItem->gWidth = gw;
 					currItem->gHeight = gh;
+					currItem->Parent = neu;
 					neu->groupItemList.append(currItem);
 					m_Doc->Items->removeAll(currItem);
 				}
 				neu->setRedrawBounding();
 				neu->setTextFlowMode(PageItem::TextFlowDisabled);
 				m_Doc->GroupCounter++;
-				m_Doc->renumberItemsInListOrder();
 			}
 			else
 			{
@@ -1231,7 +1226,6 @@
 					tmpSelection.addItem(gElements.at(gr));
 				}
 				m_Doc->itemSelection_DeleteItem(&tmpSelection);
-				m_Doc->renumberItemsInListOrder();
 			}
 		}
 		delete( m_gc.pop() );
@@ -1462,7 +1456,7 @@
 	if (!fname.isEmpty())
 	{
 		if (!fname.startsWith("data:"))
-			m_Doc->LoadPict(fname, z);
+			m_Doc->loadPict(fname, ite);
 		else
 		{
 			int startData = fname.indexOf(",");
@@ -1480,7 +1474,7 @@
 			QImage img;
 			img.loadFromData(ba);
 			img.save(fileName, "PNG");
-			m_Doc->LoadPict(fileName, z);
+			m_Doc->loadPict(fileName, ite);
 		}
 	}
 	if (clipPath.size() != 0)

Modified: trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp Tue Nov  1 08:51:14 2011
@@ -659,7 +659,6 @@
 			m_Doc->m_Selection->delaySignalsOn();
 			for (int dre=0; dre<Elements.count(); ++dre)
 			{
-				m_Doc->DragElements.append(Elements.at(dre)->ItemNr);
 				m_tmpSel->addItem(Elements.at(dre), true);
 			}
 			ScriXmlDoc *ss = new ScriXmlDoc();

Modified: trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp Tue Nov  1 08:51:14 2011
@@ -403,7 +403,7 @@
 	image.setDotsPerMeterX ((int) (hres / 0.0254));
 	image.setDotsPerMeterY ((int) (vres / 0.0254));
 	image.save(fileName, "PNG");
-	m_Doc->LoadPict(fileName, z);
+	m_Doc->loadPict(fileName, ite);
 	ite->setImageScalingMode(false, false);
 	ite->moveBy(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
 	finishItem(ite);
@@ -620,7 +620,6 @@
 				m_Doc->m_Selection->delaySignalsOn();
 				for (int dre=0; dre<Elements.count(); ++dre)
 				{
-					m_Doc->DragElements.append(Elements.at(dre)->ItemNr);
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();

Modified: trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xar/importxar.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/xar/importxar.cpp Tue Nov  1 08:51:14 2011
@@ -365,7 +365,6 @@
 				m_Doc->m_Selection->delaySignalsOn();
 				for (int dre=0; dre<Elements.count(); ++dre)
 				{
-					m_Doc->DragElements.append(Elements.at(dre)->ItemNr);
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
@@ -1860,7 +1859,6 @@
 			newItem->gWidth = pat.pattern.width();
 			newItem->gHeight = pat.pattern.height();
 			pat.items.append(newItem);
-			newItem->ItemNr = pat.items.count();
 		}
 		QString patternName = patternRef[bref]+"_"+newItem->itemName();
 		patternName = patternName.trimmed().simplified().replace(" ", "_");
@@ -2624,7 +2622,6 @@
 			newItem->gWidth = pat.pattern.width();
 			newItem->gHeight = pat.pattern.height();
 			pat.items.append(newItem);
-			newItem->ItemNr = pat.items.count();
 		}
 		QString patternName = patternRef[bref]+"_"+newItem->itemName();
 		patternName = patternName.trimmed().simplified().replace(" ", "_");
@@ -2695,7 +2692,7 @@
 		ite->tempImageFile->close();
 		ite->isInlineImage = true;
 		image.save(fileName, "PNG");
-		m_Doc->LoadPict(fileName, z);
+		m_Doc->loadPict(fileName, ite);
 		ite->setImageScalingMode(false, false);
 	}
 }
@@ -2776,7 +2773,6 @@
 			newItem->gWidth = pat.pattern.width();
 			newItem->gHeight = pat.pattern.height();
 			pat.items.append(newItem);
-			newItem->ItemNr = pat.items.count();
 		}
 		QString patternName = "Pattern_"+newItem->itemName();
 		patternName = patternName.trimmed().simplified().replace(" ", "_");
@@ -3485,6 +3481,7 @@
 				{
 					PageItem* currItem = Elements.at(a);
 					groupItem->groupItemList.append(currItem);
+					currItem->Parent = groupItem;
 					double x1, x2, y1, y2;
 					currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
 					minx = qMin(minx, x1);
@@ -3537,10 +3534,10 @@
 					PageItem* currItem = groupItem->groupItemList.at(a);
 					currItem->gXpos = currItem->xPos() - groupItem->xPos();
 					currItem->gYpos = currItem->yPos() - groupItem->yPos();
+					currItem->Parent = groupItem;
 					m_Doc->Items->removeAll(currItem);
 					Elements.removeAll(currItem);
 				}
-				m_Doc->renumberItemsInListOrder();
 			}
 		}
 	}

Modified: trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp Tue Nov  1 08:51:14 2011
@@ -395,7 +395,6 @@
 				m_Doc->m_Selection->delaySignalsOn();
 				for (int dre=0; dre<Elements.count(); ++dre)
 				{
-					m_Doc->DragElements.append(Elements.at(dre)->ItemNr);
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
@@ -1585,7 +1584,6 @@
 			PageItem* ite = itemList.at(elems.at(i));
 			Elements.append(ite);
 			m_Doc->Items->append(ite);
-			ite->ItemNr = m_Doc->Items->count()-1;
 			if ((importerFlags & LoadSavePlugin::lfCreateDoc) && (it > 0))
 				ite->LayerID = currentLayer;
 		}

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp Tue Nov  1 08:51:14 2011
@@ -30,7 +30,7 @@
 		PyErr_SetString(WrongFrameTypeError, QObject::tr("Target is not an image frame.","python error").toLocal8Bit().constData());
 		return NULL;
 	}
-	ScCore->primaryMainWindow()->doc->LoadPict(QString::fromUtf8(Image), item->ItemNr);
+	ScCore->primaryMainWindow()->doc->loadPict(QString::fromUtf8(Image), item);
 //	Py_INCREF(Py_None);
 //	return Py_None;
 	Py_RETURN_NONE;
@@ -62,7 +62,7 @@
 	ScCore->primaryMainWindow()->view->Deselect();
 	// Select the item, which will also select its group if
 	// there is one.
-	ScCore->primaryMainWindow()->view->SelectItemNr(item->ItemNr);
+	ScCore->primaryMainWindow()->view->SelectItem(item);
 
 	// scale
 	ScCore->primaryMainWindow()->doc->itemSelection_SetImageScale(x, y); //CB why when this is done above?
@@ -104,7 +104,7 @@
 	ScCore->primaryMainWindow()->view->Deselect();
 	// Select the item, which will also select its group if
 	// there is one.
-	ScCore->primaryMainWindow()->view->SelectItemNr(item->ItemNr);
+	ScCore->primaryMainWindow()->view->SelectItem(item);
 
 	// scale
 	double newScaleX = x / item->pixm.imgInfo.xres * 72.0;
@@ -147,7 +147,7 @@
 	ScCore->primaryMainWindow()->view->Deselect();
 	// Select the item, which will also select its group if
 	// there is one.
-	ScCore->primaryMainWindow()->view->SelectItemNr(item->ItemNr);
+	ScCore->primaryMainWindow()->view->SelectItem(item);
 
 	// offset
 	double newOffsetX = x / ((item->imageXScale() != 0.0) ? item->imageXScale() : 1);
@@ -244,7 +244,7 @@
 	ScCore->primaryMainWindow()->view->Deselect();
 	// Select the item, which will also select its group if
 	// there is one.
-	ScCore->primaryMainWindow()->view->SelectItemNr(item->ItemNr);
+	ScCore->primaryMainWindow()->view->SelectItem(item);
 	// Move the item, or items
 	if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
 	{
@@ -281,7 +281,7 @@
 	ScCore->primaryMainWindow()->view->Deselect();
 	// Select the item, which will also select its group if
 	// there is one.
-	ScCore->primaryMainWindow()->view->SelectItemNr(item->ItemNr);
+	ScCore->primaryMainWindow()->view->SelectItem(item);
 	// Move the item, or items
 	if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
 	{
@@ -312,7 +312,7 @@
 	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
-	ScCore->primaryMainWindow()->doc->RotateItem(item->rotation() - x, item->ItemNr);
+	ScCore->primaryMainWindow()->doc->RotateItem(item->rotation() - x, item);
 //	Py_INCREF(Py_None);
 //	return Py_None;
 	Py_RETURN_NONE;
@@ -329,7 +329,7 @@
 	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
-	ScCore->primaryMainWindow()->doc->RotateItem(x * -1.0, item->ItemNr);
+	ScCore->primaryMainWindow()->doc->RotateItem(x * -1.0, item);
 //	Py_INCREF(Py_None);
 //	return Py_None;
 	Py_RETURN_NONE;
@@ -346,7 +346,7 @@
 	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
-	ScCore->primaryMainWindow()->doc->SizeItem(ValueToPoint(x), ValueToPoint(y), item->ItemNr);
+	ScCore->primaryMainWindow()->doc->SizeItem(ValueToPoint(x), ValueToPoint(y), item);
 //	Py_INCREF(Py_None);
 //	return Py_None;
 	Py_RETURN_NONE;
@@ -418,7 +418,7 @@
 	if (i == NULL)
 		return NULL;
 	ScCore->primaryMainWindow()->view->Deselect();
-	ScCore->primaryMainWindow()->view->SelectItemNr(i->ItemNr);
+	ScCore->primaryMainWindow()->view->SelectItem(i);
 	ScCore->primaryMainWindow()->UnGroupObj();
 //	Py_INCREF(Py_None);
 //	return Py_None;
@@ -442,7 +442,7 @@
 	if (i == NULL)
 		return NULL;
 	ScCore->primaryMainWindow()->view->Deselect();
-	ScCore->primaryMainWindow()->view->SelectItemNr(i->ItemNr);
+	ScCore->primaryMainWindow()->view->SelectItem(i);
 //	int h = ScCore->primaryMainWindow()->view->frameResizeHandle;
 //	ScCore->primaryMainWindow()->view->frameResizeHandle = 1;
 	ScCore->primaryMainWindow()->view->startGroupTransaction(Um::Resize, "", Um::IResize);
@@ -485,7 +485,7 @@
 	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
-	ScCore->primaryMainWindow()->view->SelectItemNr(i->ItemNr);
+	ScCore->primaryMainWindow()->view->SelectItem(i);
 //	Py_INCREF(Py_None);
 //	return Py_None;
 	Py_RETURN_NONE;
@@ -593,7 +593,7 @@
 	ScCore->primaryMainWindow()->view->Deselect();
 	// Select the item, which will also select its group if
 	// there is one.
-	ScCore->primaryMainWindow()->view->SelectItemNr(item->ItemNr);
+	ScCore->primaryMainWindow()->view->SelectItem(item);
 
 	// flip
 	if (h == 1) {

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp Tue Nov  1 08:51:14 2011
@@ -206,11 +206,11 @@
 	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
 	if (i == NULL)
 		return NULL;
-	ScCore->primaryMainWindow()->view->SelectItemNr(i->ItemNr);
-	bool found = false;
-	for (int lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
-	{
-		ScCore->primaryMainWindow()->view->SelectItemNr(i->ItemNr);
+	ScCore->primaryMainWindow()->view->SelectItem(i);
+	bool found = false;
+	for (int lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
+	{
+		ScCore->primaryMainWindow()->view->SelectItem(i);
 		for (int lam=0; lam < ScCore->primaryMainWindow()->doc->Layers.count(); ++lam)
 			if (ScCore->primaryMainWindow()->doc->Layers[lam].Name == QString::fromUtf8(Layer))
 			{

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp Tue Nov  1 08:51:14 2011
@@ -282,7 +282,7 @@
 		it->PoLine.translate(0, -np2.y());
 		ScCore->primaryMainWindow()->doc->MoveItem(0, np2.y(), it);
 	}
-	ScCore->primaryMainWindow()->doc->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
+	ScCore->primaryMainWindow()->doc->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), it, false, false, false);
 	ScCore->primaryMainWindow()->doc->AdjustItemSize(it);
 	if (Name != EMPTY_STRING)
 	{
@@ -364,7 +364,7 @@
 		it->PoLine.translate(0, -np2.y());
 		ScCore->primaryMainWindow()->doc->MoveItem(0, np2.y(), it);
 	}
-	ScCore->primaryMainWindow()->doc->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
+	ScCore->primaryMainWindow()->doc->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), it, false, false, false);
 	ScCore->primaryMainWindow()->doc->AdjustItemSize(it);
 	if (Name != EMPTY_STRING)
 	{
@@ -455,7 +455,7 @@
 		it->PoLine.translate(0, -np2.y());
 		ScCore->primaryMainWindow()->doc->MoveItem(0, np2.y(), it);
 	}
-	ScCore->primaryMainWindow()->doc->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), ic, false, false, false);
+	ScCore->primaryMainWindow()->doc->SizeItem(it->PoLine.WidthHeight().x(), it->PoLine.WidthHeight().y(), it, false, false, false);
 	ScCore->primaryMainWindow()->doc->AdjustItemSize(it);
 	if (Name != EMPTY_STRING)
 	{
@@ -486,26 +486,25 @@
 //	}
 	//FIXME: Why use GetItem not GetUniqueItem? Maybe use GetUniqueItem and use the exceptions
 	// its sets for us?
-	int i = GetItem(QString::fromUtf8(TextB));
-	int ii = GetItem(QString::fromUtf8(PolyB));
-	if ((i == -1) || (ii == -1))
+	PageItem *i = GetItem(QString::fromUtf8(TextB));
+	PageItem *ii = GetItem(QString::fromUtf8(PolyB));
+	if ((i == NULL) || (ii == NULL))
 	{
 		PyErr_SetString(NotFoundError, QObject::tr("Object not found.","python error").toLocal8Bit().constData());
 		return NULL;
 	}
 	ScCore->primaryMainWindow()->doc->m_Selection->clear();
-	ScCore->primaryMainWindow()->doc->m_Selection->addItem(ScCore->primaryMainWindow()->doc->Items->at(i));
-	ScCore->primaryMainWindow()->doc->m_Selection->addItem(ScCore->primaryMainWindow()->doc->Items->at(ii));
-	PageItem *it = ScCore->primaryMainWindow()->doc->Items->at(i);
+	ScCore->primaryMainWindow()->doc->m_Selection->addItem(i);
+	ScCore->primaryMainWindow()->doc->m_Selection->addItem(ii);
 	ScCore->primaryMainWindow()->view->ToPathText();
-	ScCore->primaryMainWindow()->doc->MoveItem(pageUnitXToDocX(x) - it->xPos(), pageUnitYToDocY(y) - it->yPos(), it);
-	if (Name != EMPTY_STRING)
-	{
-		QString objName = QString::fromUtf8(Name);
-		if (!ItemExists(objName))
-			ScCore->primaryMainWindow()->doc->Items->at(i)->setItemName(objName);
-	}
-	return PyString_FromString(it->itemName().toUtf8());
+	ScCore->primaryMainWindow()->doc->MoveItem(pageUnitXToDocX(x) - i->xPos(), pageUnitYToDocY(y) - i->yPos(), i);
+	if (Name != EMPTY_STRING)
+	{
+		QString objName = QString::fromUtf8(Name);
+		if (!ItemExists(objName))
+			i->setItemName(objName);
+	}
+	return PyString_FromString(i->itemName().toUtf8());
 }
 
 

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdpage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdpage.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdpage.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdpage.cpp Tue Nov  1 08:51:14 2011
@@ -245,7 +245,7 @@
 			row = Py_BuildValue((char*)"(sii)",
 			                    ScCore->primaryMainWindow()->doc->Items->at(i)->itemName().toUtf8().constData(),
 			                    ScCore->primaryMainWindow()->doc->Items->at(i)->itemType(),
-			                    ScCore->primaryMainWindow()->doc->Items->at(i)->ItemNr
+								ScCore->primaryMainWindow()->doc->Items->at(i)->uniqueNr
 			                   );
 			PyList_SetItem(l, counter, row);
 			counter++;

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp Tue Nov  1 08:51:14 2011
@@ -263,10 +263,6 @@
 	Daten.replace(QChar('\n') , SpecialChars::PARSEP);
 	PyMem_Free(Text);
 	currItem->itemText.clear();
-	for (int a = 0; a < ScCore->primaryMainWindow()->doc->FrameItems.count(); ++a)
-	{
-		ScCore->primaryMainWindow()->doc->FrameItems.at(a)->ItemNr = a;
-	}
 	currItem->itemText.insertChars(0, Daten);
 	currItem->invalidateLayout();
 	currItem->Dirty = false;
@@ -644,10 +640,6 @@
 	else
 	{
 		it->itemText.clear();
-		for (int a = 0; a < ScCore->primaryMainWindow()->doc->FrameItems.count(); ++a)
-		{
-			ScCore->primaryMainWindow()->doc->FrameItems.at(a)->ItemNr = a;
-		}
 	}
 //	Py_INCREF(Py_None);
 //	return Py_None;
@@ -962,7 +954,7 @@
 	if (item->invalid)
 		item->layout();
 	ScCore->primaryMainWindow()->view->Deselect(true);
-	ScCore->primaryMainWindow()->view->SelectItemNr(item->ItemNr);
+	ScCore->primaryMainWindow()->view->SelectItem(item);
 	ScCore->primaryMainWindow()->view->TextToPath();
 //	Py_INCREF(Py_None);
 //	return Py_None;

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp Tue Nov  1 08:51:14 2011
@@ -54,22 +54,22 @@
 	return PointToValue(pageUnitY - ScCore->primaryMainWindow()->doc->currentPage()->yOffset());
 }
 
-int GetItem(QString Name)
+PageItem *GetItem(QString Name)
 {
 	if (!Name.isEmpty())
 	{
 		for (int a = 0; a < ScCore->primaryMainWindow()->doc->Items->count(); a++)
 		{
 			if (ScCore->primaryMainWindow()->doc->Items->at(a)->itemName() == Name)
-				return static_cast<int>(a);
+				return ScCore->primaryMainWindow()->doc->Items->at(a);
 		}
 	}
 	else
 	{
 		if (ScCore->primaryMainWindow()->doc->m_Selection->count() != 0)
-			return ScCore->primaryMainWindow()->doc->m_Selection->itemAt(0)->ItemNr;
-	}
-	return -1;
+			return ScCore->primaryMainWindow()->doc->m_Selection->itemAt(0);
+	}
+	return NULL;
 }
 
 void ReplaceColor(QString col, QString rep)
@@ -227,7 +227,7 @@
 		if (!item)
 			return false;
 		// and select it
-		ScCore->primaryMainWindow()->view->SelectItemNr(item->ItemNr);
+		ScCore->primaryMainWindow()->view->SelectItem(item);
 	}
 	return true;
 }

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.h (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.h Tue Nov  1 08:51:14 2011
@@ -27,7 +27,7 @@
 /// \brief Doc units -> page-relative units
 double docUnitYToPageY(double pageUnitY);
 
-int GetItem(QString Name);
+PageItem *GetItem(QString Name);
 void ReplaceColor(QString col, QString rep);
 /*!
  * @brief Returns named PageItem, or selection if name '', or exception and NULL if no item.

Modified: trunk/Scribus/scribus/plugins/tools/pathfinder/pathfinder.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/tools/pathfinder/pathfinder.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/pathfinder/pathfinder.cpp (original)
+++ trunk/Scribus/scribus/plugins/tools/pathfinder/pathfinder.cpp Tue Nov  1 08:51:14 2011
@@ -147,13 +147,13 @@
 				{
 					newItem = new PageItem_Polygon(*Item2);
 					newItem->setSelected(false);
-					currDoc->Items->insert(Item2->ItemNr, newItem);
+					currDoc->Items->insert(currDoc->Items->indexOf(Item2), newItem);
 				}
 				else
 				{
 					newItem = new PageItem_Polygon(*Item1);
 					newItem->setSelected(false);
-					currDoc->Items->insert(Item1->ItemNr, newItem);
+					currDoc->Items->insert(currDoc->Items->indexOf(Item1), newItem);
 				}
 			}
 			if (dia->keepItem2)
@@ -163,17 +163,15 @@
 				{
 					newItem = new PageItem_Polygon(*Item1);
 					newItem->setSelected(false);
-					currDoc->Items->insert(Item1->ItemNr, newItem);
+					currDoc->Items->insert(currDoc->Items->indexOf(Item1), newItem);
 				}
 				else
 				{
 					newItem = new PageItem_Polygon(*Item2);
 					newItem->setSelected(false);
-					currDoc->Items->insert(Item2->ItemNr, newItem);
+					currDoc->Items->insert(currDoc->Items->indexOf(Item2), newItem);
 				}
 			}
-			if (dia->keepItem1 || dia->keepItem2)
-				currDoc->renumberItemsInListOrder();
 			if (dia->opMode != 4)
 			{
 				PageItem *currItem;
@@ -270,7 +268,6 @@
 						newItem->setRotation(0.0);
 					}
 					currDoc->Items->append(newItem);
-					newItem->ItemNr = currDoc->Items->count()-1;
 					newItem->setSelected(false);
 					points.fromQPainterPath(path);
 					newItem->PoLine = points;

Modified: trunk/Scribus/scribus/plugins/tools/pathstroker/pathstroker.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/plugins/tools/pathstroker/pathstroker.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/pathstroker/pathstroker.cpp (original)
+++ trunk/Scribus/scribus/plugins/tools/pathstroker/pathstroker.cpp Tue Nov  1 08:51:14 2011
@@ -243,7 +243,6 @@
 						currDoc->Items->append(newItem);
 					}
 					first = false;
-					newItem->ItemNr = currDoc->Items->count()-1;
 					newItem->setLineStyle(Qt::SolidLine);
 					newItem->setFillColor(ml[it].Color);
 					newItem->setFillShade(ml[it].Shade);
@@ -284,7 +283,6 @@
 						arrow.map(arrowTrans);
 						PageItem* newItem = new PageItem_Polygon(*currItem);
 						currDoc->Items->append(newItem);
-						newItem->ItemNr = currDoc->Items->count()-1;
 						newItem->setLineWidth(0);
 						newItem->setLineStyle(Qt::SolidLine);
 						newItem->setCustomLineStyle("");
@@ -325,7 +323,6 @@
 						arrow.map(arrowTrans);
 						PageItem* newItem = new PageItem_Polygon(*currItem);
 						currDoc->Items->append(newItem);
-						newItem->ItemNr = currDoc->Items->count()-1;
 						newItem->setLineWidth(0);
 						newItem->setLineStyle(Qt::SolidLine);
 						newItem->setCustomLineStyle("");

Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp (original)
+++ trunk/Scribus/scribus/pslib.cpp Tue Nov  1 08:51:14 2011
@@ -1601,7 +1601,7 @@
 							errorOccured = !PS_ImageData(it, it->Pfile, it->itemName(), it->IProfile, it->UseEmbedded, Ic);
 							if (errorOccured) break;
 						}
-						PS_TemplateStart(QString("mp_obj_%1_%2").arg(ap).arg(it->ItemNr));
+						PS_TemplateStart(QString("mp_obj_%1_%2").arg(ap).arg(qHash(it)));
 						ProcessItem(Doc, Doc->MasterPages.at(ap), it, ap+1, sep, farb, Ic, gcr, true);
 						PS_TemplateEnd();
 					}
@@ -2813,7 +2813,7 @@
 			if (!(ite->asTextFrame()) && !(ite->asImageFrame()))
 			{
 				int mpIndex = Doc->MasterNames[page->MPageNam];
-				PS_UseTemplate(QString("mp_obj_%1_%2").arg(mpIndex).arg(ite->ItemNr));
+				PS_UseTemplate(QString("mp_obj_%1_%2").arg(mpIndex).arg(qHash(ite)));
 			}
 			else if (ite->asImageFrame())
 			{

Modified: trunk/Scribus/scribus/scpage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/scpage.cpp
==============================================================================
--- trunk/Scribus/scribus/scpage.cpp (original)
+++ trunk/Scribus/scribus/scpage.cpp Tue Nov  1 08:51:14 2011
@@ -241,7 +241,6 @@
 		if ((stateCode == 0) || (stateCode == 1))
 			m_Doc->view()->Deselect(true);
 		m_Doc->Items->append(ite);
-		ite->ItemNr = m_Doc->Items->count()-1;
 		if ((stateCode == 0) || (stateCode == 2))
 			update();
 	}
@@ -254,6 +253,7 @@
 	if (!state)
 		return;
 	QList<PageItem*> itemList = state->getItem();
+	int id = state->getInt("ITEMID");
 	if (itemList.count() <= 0) 
 		return;
 	m_Doc->view()->Deselect(true);
@@ -268,9 +268,8 @@
 		for (int i = 0; i < itemList.count(); ++i)
 		{
 			PageItem* ite = itemList.at(i);
-			m_Doc->Items->insert(ite->ItemNr, ite);
-		}
-		m_Doc->renumberItemsInListOrder();
+			m_Doc->Items->insert(id, ite);
+		}
  		update();
 	}
 	else
@@ -304,13 +303,13 @@
 	m_Doc->setMasterPageMode(!oldItem->OnMasterPage.isEmpty());
 	if (isUndo)
 	{
-		m_Doc->Items->replace(newItem->ItemNr, oldItem);
+		m_Doc->Items->replace(m_Doc->Items->indexOf(newItem), oldItem);
 		oldItem->updatePolyClip();
 		m_Doc->AdjustItemSize(oldItem);
 	}
 	else
 	{
-		m_Doc->Items->replace(oldItem->ItemNr, newItem);
+		m_Doc->Items->replace(m_Doc->Items->indexOf(oldItem), newItem);
 	}
 	m_Doc->setMasterPageMode(oldMPMode);
 }

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Tue Nov  1 08:51:14 2011
@@ -1326,7 +1326,7 @@
 					if (doc->SubMode != -1)
 					{
 						view->Deselect(false);
-						doc->Items->removeAt(currItem->ItemNr);
+						doc->Items->removeOne(currItem);
 					}
 					else
 						view->Deselect(false);
@@ -1352,11 +1352,11 @@
 					if (currItem->PoLine.size() < 4)
 					{
 						view->Deselect(false);
-						doc->Items->removeAt(currItem->ItemNr);
+						doc->Items->removeOne(currItem);
 					}
 					else
 					{
-						doc->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem->ItemNr, false, false);
+						doc->SizeItem(currItem->PoLine.WidthHeight().x(), currItem->PoLine.WidthHeight().y(), currItem, false, false);
 						currItem->setPolyClip(qRound(qMax(currItem->lineWidth() / 2.0, 1.0)));
 						doc->AdjustItemSize(currItem);
 						currItem->ContourLine = currItem->PoLine.copy();
@@ -1370,7 +1370,7 @@
 					if (currItem->Sizing)
 					{
 						view->Deselect(false);
-						doc->Items->removeAt(currItem->ItemNr);
+						doc->Items->removeOne(currItem);
 					}
 					break;
 			}
@@ -2606,24 +2606,24 @@
 	if (SelectedType != -1)
 	{
 		if (docSelectionCount != 0)
-		{
-			PageItem *lowestItem = doc->m_Selection->itemAt(0);
-			for (uint a=0; a < docSelectionCount; ++a)
-			{
-				currItem = doc->m_Selection->itemAt(a);
-				if (currItem->ItemNr < lowestItem->ItemNr)
-					lowestItem = currItem;
-			}
-			currItem = lowestItem;
-			if ((docSelectionCount == 1) && currItem && currItem->asImageFrame())
-				isRaster = currItem->isRaster;
+			currItem = doc->m_Selection->itemAt(0);
+	//	{
+	//		int lowestItem = 999999;
+	//		for (int a = 0; a < doc->m_Selection->count(); ++a)
+	//		{
+	//			currItem = doc->m_Selection->itemAt(a);
+	//			lowestItem = qMin(lowestItem, doc->Items->indexOf(currItem));
+	//		}
+	//		currItem = doc->Items->at(lowestItem);
+	//		if ((docSelectionCount == 1) && currItem && currItem->asImageFrame())
+	//			isRaster = currItem->isRaster;
 //			doc->m_Selection->removeItem(currItem);
 //			doc->m_Selection->prependItem(currItem);
 //			currItem = doc->m_Selection->itemAt(0);
-			assert(currItem);
+	//		assert(currItem);
 //			if (!currItem)
 //				SelectedType=-1;
-		}
+	//	}
 		else
 			SelectedType = -1;
 	}
@@ -3374,7 +3374,7 @@
 			int z = doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), 1, 1, doc->itemToolPrefs().shapeLineWidth, doc->itemToolPrefs().imageFillColor, CommonStrings::None, true);
 			PageItem *b = doc->Items->at(z);
 			b->LayerID = doc->activeLayer();
-			doc->LoadPict(data, b->ItemNr);
+			doc->loadPict(data, b);
 			b->setWidth(static_cast<double>(b->OrigW * 72.0 / b->pixm.imgInfo.xres));
 			b->setHeight(static_cast<double>(b->OrigH * 72.0 / b->pixm.imgInfo.yres));
 			b->OldB2 = b->width();
@@ -4152,7 +4152,7 @@
 				currItem->IRender = doc->cmsSettings().DefaultIntentImages;
 				qApp->changeOverrideCursor( QCursor(Qt::WaitCursor) );
 				qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
-				doc->LoadPict(fileName, currItem->ItemNr, false, true);
+				doc->loadPict(fileName, currItem, false, true);
 				propertiesPalette->imagePal->displayScaleAndOffset(currItem->imageXScale(), currItem->imageYScale(), currItem->imageXOffset(), currItem->imageYOffset());
 				qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
 				view->DrawNew();
@@ -4240,7 +4240,7 @@
 					currItem->isInlineImage = true;
 					currItem->Pfile = fileName;
 					img.save(fileName, "PNG");
-					doc->LoadPict(fileName, currItem->ItemNr, false, true);
+					doc->loadPict(fileName, currItem, false, true);
 					propertiesPalette->imagePal->displayScaleAndOffset(currItem->imageXScale(), currItem->imageYScale(), currItem->imageXOffset(), currItem->imageYOffset());
 					qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
 					view->DrawNew();
@@ -5097,7 +5097,6 @@
 					currItem2->gYpos = currItem2->yPos() - gy;
 					currItem2->gWidth = gw;
 					currItem2->gHeight = gh;
-					currItem2->ItemNr = doc->FrameItems.count();
 					doc->FrameItems.append(currItem2);
 				}
 				int acc = doc->Items->count();

Modified: trunk/Scribus/scribus/scribusXml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/scribusXml.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusXml.cpp (original)
+++ trunk/Scribus/scribus/scribusXml.cpp Tue Nov  1 08:51:14 2011
@@ -167,7 +167,7 @@
 	emG.clear();
 	for (int cor = 0; cor < selection->count(); ++cor)
 	{
-		emMap.insert(selection->itemAt(cor)->ItemNr, selection->itemAt(cor));
+		emMap.insert(doc->Items->indexOf(selection->itemAt(cor)), selection->itemAt(cor));
 	}
 	emG = emMap.values();
 	double selectionWidth = 0;

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Tue Nov  1 08:51:14 2011
@@ -4442,9 +4442,8 @@
 	if (newItem==NULL)
 		return -1;
 	Items->append(newItem);
-	newItem->ItemNr = Items->count()-1;
 	//Add in item default values based on itemType and frameType
-	itemAddDetails(itemType, frameType, newItem->ItemNr);
+	itemAddDetails(itemType, frameType, newItem);
 	if (UndoManager::undoEnabled())
 	{
 		ScItemState<PageItem*> *is = new ScItemState<PageItem*>("Create PageItem");
@@ -4465,7 +4464,7 @@
 			activeTransaction = NULL;
 		}
 	}
-	return newItem->ItemNr;
+	return Items->count()-1;
 }
 
 
@@ -4617,9 +4616,8 @@
 }
 
 
-void ScribusDoc::itemAddDetails(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, const int itemNumber)
-{
-	PageItem* newItem=Items->at(itemNumber);
+void ScribusDoc::itemAddDetails(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, PageItem* newItem)
+{
 	Q_ASSERT(newItem->realItemType()==itemType);
 	switch( itemType )
 	{
@@ -4704,20 +4702,18 @@
 }
 
 
-bool ScribusDoc::itemAddCommit(const int /*itemNumber*/)
+bool ScribusDoc::itemAddCommit(PageItem* item)
 {
 	//TODO use the parameter
 	if (m_itemCreationTransaction && appMode !=  modeDrawBezierLine)
 	{
-		PageItem *createdItem=m_Selection->itemAt(0);
-		if (createdItem!=NULL)
-		{
-			createdItem->checkChanges(true);
+		if (item != NULL)
+		{
+			item->checkChanges(true);
 			QString targetName = Um::ScratchSpace;
-			if (createdItem->OwnPage > -1)
-				targetName = Pages->at(createdItem->OwnPage)->getUName();
-			m_itemCreationTransaction->commit(targetName, createdItem->getUPixmap(),
-								Um::Create + " " + createdItem->getUName(),  "", Um::ICreate);
+			if (item->OwnPage > -1)
+				targetName = Pages->at(item->OwnPage)->getUName();
+			m_itemCreationTransaction->commit(targetName, item->getUPixmap(), Um::Create + " " + item->getUName(),  "", Um::ICreate);
 			delete m_itemCreationTransaction;
 			m_itemCreationTransaction = NULL;
 			if (!isLoading())
@@ -4735,7 +4731,7 @@
 	{
 		if (Items->at(a)->uniqueNr == unique)
 		{
-			ret = Items->at(a)->ItemNr;
+			ret = Items->indexOf(Items->at(a));
 			break;
 		}
 	}
@@ -4752,29 +4748,6 @@
 	}
 	return ret;
 }
-
-void ScribusDoc::updateFrameItems()
-{
-	uint frameItemsCount=FrameItems.count();
-	for (uint a = 0; a < frameItemsCount; ++a)
-		FrameItems.at(a)->ItemNr = a;
-}
-
-
-void ScribusDoc::renumberItemsInListOrder( )
-{
-	m_docUpdater->beginUpdate();
-	m_updateManager.setUpdatesEnabled(false);
-	int itemsCount=Items->count();
-	for (int i = 0; i < itemsCount; ++i)
-	{
-		Items->at(i)->ItemNr = i;
-		Items->at(i)->checkTextFlowInteractions(true);
-	}
-	m_updateManager.setUpdatesEnabled(true);
-	m_docUpdater->endUpdate();
-}
-
 
 void ScribusDoc::rebuildItemLists()
 {
@@ -4782,7 +4755,6 @@
 	QList<PageItem*> newDocItems, newMasterItems;
 	Layers.sort();
 	uint layerCount = this->layerCount();
-	uint itemIndex  = 0, masterIndex = 0;
 	for (uint la = 0; la < layerCount; ++la)
 	{
 		PageItem* currItem;
@@ -4793,7 +4765,6 @@
 			if (currItem->LayerID != layerID)
 				continue;
 			newDocItems.append(currItem);
-			currItem->ItemNr = itemIndex++;
 		}
 		for (int it = 0; it < MasterItems.count(); ++it)
 		{
@@ -4801,7 +4772,6 @@
 			if (currItem->LayerID != layerID)
 				continue;
 			newMasterItems.append(currItem);
-			currItem->ItemNr = masterIndex++;
 		}
 	}
 	DocItems    = newDocItems;
@@ -4820,12 +4790,12 @@
 	automaticTextFrames=atf;
 }
 
-
+/*
 bool ScribusDoc::LoadPict(QString fn, int ItNr, bool reload, bool showMsg )
 {
 	return loadPict(fn, Items->at(ItNr), reload, showMsg);
 }
-
+*/
 
 bool ScribusDoc::loadPict(QString fn, PageItem *pageItem, bool reload, bool showMsg)
 {
@@ -5339,8 +5309,8 @@
 	//Take the item to convert from the docs Items list
 //	PageItem *oldItem = Items->take(currItem->ItemNr);
 	// Don't use take as we will insert the new item later at the same position
-	PageItem *oldItem = Items->at(currItem->ItemNr);
-	uint oldItemNr = currItem->ItemNr;
+	PageItem *oldItem = Items->at(Items->indexOf(currItem));
+	uint oldItemNr = Items->indexOf(currItem);
 	//Remove old item from the doc's selection if it was in it
 	bool removedFromSelection=m_Selection->removeItem(oldItem);
 	//Create a new item from the old one
@@ -5491,7 +5461,6 @@
 	//for (uint a = 0; a < Items->count(); ++a)
 	//	Items->at(a)->ItemNr = a;
 //	Items->insert(oldItem->ItemNr, newItem);
-	newItem->ItemNr = oldItemNr;
 	newItem->uniqueNr = oldItem->uniqueNr;
 	Items->replace(oldItemNr, newItem);
 	//FIXME: shouldn't we delete the oldItem ???
@@ -5603,7 +5572,6 @@
 		TempPages.append(addedPage);
 		Pages = &TempPages;
 		Items = &docPatterns[symbolName].items;
-		renumberItemsInListOrder();
 		m_Selection->delaySignalsOn();
 		for (int as = 0; as < Items->count(); ++as)
 		{
@@ -5670,7 +5638,6 @@
 				groupItem->setLineTransparency(0);
 				groupItem->asGroupFrame()->adjustXYPosition();
 				GroupCounter++;
-				renumberItemsInListOrder();
 			}
 		}
 		currItem = Items->at(0);
@@ -5682,7 +5649,6 @@
 			for (int a = 1; a < m_ScMW->patternsDependingOnThis.count(); a++)
 			{
 				Items = &docPatterns[m_ScMW->patternsDependingOnThis[a]].items;
-				renumberItemsInListOrder();
 				currItem = Items->at(0);
 				docPatterns[m_ScMW->patternsDependingOnThis[a]].pattern = currItem->DrawObj_toImage(qMax(currItem->gWidth, currItem->gHeight));
 			}
@@ -6342,8 +6308,8 @@
 			currItem = m_Selection->itemAt(c);
 			if (((currItem->isSingleSel) && (currItem->isGroup())) || ((currItem->isSingleSel) && (currItem->isTableItem)))
 				return false;
-			ObjOrder.insert(currItem->ItemNr, c);
 			int d = Items->indexOf(currItem);
+			ObjOrder.insert(d, c);
 			Items->takeAt(d);
 		}
 		QList<uint> Oindex = ObjOrder.values();
@@ -6351,7 +6317,6 @@
 		{
 			Items->prepend(m_Selection->itemAt(Oindex[c]));
 		}
-		renumberItemsInListOrder();
 		return true;
 	}
 	return false;
@@ -6371,8 +6336,8 @@
 			currItem = m_Selection->itemAt(c);
 			if (((currItem->isSingleSel) && (currItem->isGroup())) || ((currItem->isSingleSel) && (currItem->isTableItem)))
 				return false;
-			ObjOrder.insert(currItem->ItemNr, c);
 			int d = Items->indexOf(currItem);
+			ObjOrder.insert(d, c);
 			Items->takeAt(d);
 		}
 		QList<uint> Oindex = ObjOrder.values();
@@ -6380,7 +6345,6 @@
 		{
 			Items->append(m_Selection->itemAt(Oindex[c]));
 		}
-		renumberItemsInListOrder();
 		return true;
 	}
 	return false;
@@ -9562,7 +9526,6 @@
 			}
 			currItem->clearContents();
 		}
-		updateFrameItems();
 		regionsChanged()->update(QRectF());
 		changed();
 	}
@@ -9641,7 +9604,8 @@
 		}
 		if(currItem->textFlowMode() != PageItem::TextFlowDisabled)
 		{
-			for(int tIdx(currItem->ItemNr - 1);tIdx >= 0;--tIdx)
+			int id = Items->indexOf(currItem) - 1;
+			for(int tIdx = id; tIdx >= 0; --tIdx)
 			{
 				if( (Items->at(tIdx)->asTextFrame())
 					&& (!itemSelection->containsItem(Items->at(tIdx)))
@@ -9697,21 +9661,20 @@
 		if (currItem->isBookmark)
 			//CB From view   emit DelBM(currItem);
 			m_ScMW->DelBookMark(currItem);
+		if (UndoManager::undoEnabled() && (selectedItemCount > 0) && !forceDeletion)
+		{
+			ScItemState< QList<PageItem*> > *is = new ScItemState< QList<PageItem*> >(Um::Delete + " " + currItem->getUName(), "", Um::IDelete);
+			is->setItem(delItems);
+			is->set("ITEMID", itemList->indexOf(currItem));
+			is->set("DELETE_ITEM", "delete_item");
+			undoManager->action(Pages->at(0), is, currItem->getUPixmap());
+		}
 		itemList->removeAll(currItem);
 //		if (forceDeletion || !UndoManager::undoEnabled())
 		if (forceDeletion)
 			delete currItem;
 	}
-	if (UndoManager::undoEnabled() && (selectedItemCount > 0) && !forceDeletion)
-	{
-		ScItemState< QList<PageItem*> > *is = new ScItemState< QList<PageItem*> >(Um::Delete + " " + currItem->getUName(), "", Um::IDelete);
-		is->setItem(delItems);
-		is->set("DELETE_ITEM", "delete_item");
-		undoManager->action(Pages->at(0), is, currItem->getUPixmap());
-	}
 	itemSelection->delaySignalsOff();
-	updateFrameItems();
-	renumberItemsInListOrder();
 	if (activeTransaction)
 	{
 		activeTransaction->commit();
@@ -10193,7 +10156,7 @@
 		Object.Objects.clear();
 		currItem->getBoundingRect(&Object.x1, &Object.y1, &Object.x2, &Object.y2);
 		Object.Group = 0;
-		Object.ObjNr = currItem->ItemNr;
+		Object.ObjNr = Items->indexOf(currItem);
 		Object.Objects.append(currItem);
 		AObjects.append(Object);
 	}
@@ -12203,12 +12166,12 @@
 	return retw;
 }
 
-
+/*
 void ScribusDoc::RotateItem(double angle, int ite)
 {
 	RotateItem(angle, Items->at(ite));
 }
-
+*/
 
 void ScribusDoc::RotateItem(double angle, PageItem *currItem)
 {
@@ -12279,12 +12242,12 @@
 	MoveItem(-mxc, -myc, currItem, fromMP);
 }
 
-
+/*
 bool ScribusDoc::SizeItem(double newX, double newY, int ite, bool fromMP, bool DoUpdateClip, bool redraw)
 {
 	return SizeItem(newX, newY, Items->at(ite), fromMP, DoUpdateClip, redraw);
 }
-
+*/
 
 bool ScribusDoc::SizeItem(double newX, double newY, PageItem *pi, bool fromMP, bool DoUpdateClip, bool redraw)
 {
@@ -12428,13 +12391,13 @@
 	return true;
 }
 
-
+/*
 bool ScribusDoc::MoveSizeItem(FPoint newX, FPoint newY, int ite, bool fromMP, bool constrainRotation)
 {
 	PageItem *currItem = Items->at(ite);
 	return MoveSizeItem(newX, newY, currItem, fromMP, constrainRotation);
 }
-
+*/
 bool ScribusDoc::MoveSizeItem(FPoint newX, FPoint newY, PageItem* currItem, bool fromMP, bool constrainRotation)
 {
 	QRectF oldR(currItem->getBoundingRect());
@@ -12856,7 +12819,7 @@
 	double x, y, w, h;
 	uint selectedItemCount = itemSelection->count();
 	itemSelection->getVisualGroupRect(&x, &y, &w, &h);
-	uint lowestItem = 999999;
+	int lowestItem = 999999;
 	for (uint a = 0; a < selectedItemCount; ++a)
 	{
 		currItem = itemSelection->itemAt(a);
@@ -12864,7 +12827,7 @@
 		currItem->gYpos = currItem->yPos() - y;
 		currItem->gWidth = w;
 		currItem->gHeight = h;
-		lowestItem = qMin(lowestItem, currItem->ItemNr);
+		lowestItem = qMin(lowestItem, Items->indexOf(currItem));
 	}
 	double minx =  std::numeric_limits<double>::max();
 	double miny =  std::numeric_limits<double>::max();
@@ -12900,9 +12863,9 @@
 			groupItem->groupItemList.append(Items->takeAt(d));
 		else
 			groupItem->groupItemList.append(currItem);
+		currItem->Parent = groupItem;
 	}
 	groupItem->asGroupFrame()->adjustXYPosition();
-	renumberItemsInListOrder();
 	itemSelection->clear();
 	itemSelection->addItem(groupItem);
 	GroupCounter++;
@@ -12915,11 +12878,11 @@
 		return NULL;
 	PageItem *currItem;
 	uint selectedItemCount = itemList.count();
-	uint lowestItem = 999999;
+	int lowestItem = 999999;
 	for (uint a = 0; a < selectedItemCount; ++a)
 	{
 		currItem = itemList.at(a);
-		lowestItem = qMin(lowestItem, currItem->ItemNr);
+		lowestItem = qMin(lowestItem, Items->indexOf(currItem));
 	}
 	double minx =  std::numeric_limits<double>::max();
 	double miny =  std::numeric_limits<double>::max();
@@ -12958,8 +12921,8 @@
 		currItem->gYpos = currItem->yPos() - miny;
 		currItem->gWidth = maxx - minx;
 		currItem->gHeight = maxy - miny;
-	}
-	renumberItemsInListOrder();
+		currItem->Parent = groupItem;
+	}
 	groupItem->asGroupFrame()->adjustXYPosition();
 	GroupCounter++;
 	itemList.clear();
@@ -13001,8 +12964,8 @@
 		currItem->gYpos = currItem->yPos() - groupItem->yPos();
 		currItem->gWidth = maxx - minx;
 		currItem->gHeight = maxy - miny;
-	}
-	renumberItemsInListOrder();
+		currItem->Parent = groupItem;
+	}
 	GroupCounter++;
 	groupItem->asGroupFrame()->adjustXYPosition();
 	itemList.clear();
@@ -13053,7 +13016,7 @@
 		}
 	}
 	itemSelection->getVisualGroupRect(&x, &y, &w, &h);
-	uint lowestItem = 999999;
+	int lowestItem = 999999;
 	for (uint a=0; a<selectedItemCount; ++a)
 	{
 		currItem = itemSelection->itemAt(a);
@@ -13061,7 +13024,7 @@
 		currItem->gYpos = currItem->yPos() - y;
 		currItem->gWidth = w;
 		currItem->gHeight = h;
-		lowestItem = qMin(lowestItem, currItem->ItemNr);
+		lowestItem = qMin(lowestItem, Items->indexOf(currItem));
 	}
 	double minx =  std::numeric_limits<double>::max();
 	double miny =  std::numeric_limits<double>::max();
@@ -13096,8 +13059,8 @@
 		currItem = itemSelection->itemAt(c);
 		int d = Items->indexOf(currItem);
 		groupItem->groupItemList.append(Items->takeAt(d));
-	}
-	renumberItemsInListOrder();
+		currItem->Parent = groupItem;
+	}
 	groupItem->asGroupFrame()->adjustXYPosition();
 	itemSelection->clear();
 	itemSelection->addItem(groupItem);
@@ -13156,6 +13119,7 @@
 			for (int c = gcount; c >= 0; c--)
 			{
 				PageItem* gItem = currItem->groupItemList.at(c);
+				gItem->Parent = currItem->Parent;
 				gItem->setXYPos(currItem->xPos() + gItem->gXpos, currItem->yPos() + gItem->gYpos, true);
 				list->insert(d, gItem);
 				itemSelection->addItem(currItem->groupItemList.at(gcount - c));
@@ -13177,7 +13141,6 @@
 			}
 			tempSelection.clear();
 			tempSelection.delaySignalsOff();
-			renumberItemsInListOrder();
 		}
 		setLoading(wasLoad);
 		itemSelection->delaySignalsOff();
@@ -13240,7 +13203,7 @@
 {
 	PageItem *currItem;
 	PageItem *bb;
-	QList<int> toDel;
+	QList<PageItem *> toDel;
 	toDel.clear();
 	uint docSelectionCount = m_Selection->count();
 	if (docSelectionCount > 1)
@@ -13255,7 +13218,7 @@
 		for (uint a = 1; a < docSelectionCount; ++a)
 		{
 			bb = m_Selection->itemAt(a);
-			toDel.append(bb->ItemNr);
+			toDel.append(bb);
 			QTransform ma;
 			ma.translate(bb->xPos(), bb->yPos());
 			ma.rotate(bb->rotation());
@@ -13274,7 +13237,7 @@
 		//FIXME: stop using m_View
 		m_View->Deselect(true);
 		for (int c = 0; c < toDel.count(); ++c)
-			m_View->SelectItemNr(toDel.at(c));
+			m_View->SelectItem(toDel.at(c));
 		m_Selection->delaySignalsOff();
 		itemSelection_DeleteItem();
 		regionsChanged()->update(QRectF());
@@ -13291,7 +13254,7 @@
 		if (!currItem->isPolygon() || currItem->Segments.count() <= 0)
 			continue;
 		uint StartInd = 0;
-		int currItemNr = currItem->ItemNr;
+		int currItemNr = Items->indexOf(currItem);
 		uint EndInd = currItem->PoLine.size();
 		for (uint a = EndInd-1; a > 0; --a)
 		{
@@ -13301,7 +13264,6 @@
 				bb = new PageItem_Polygon(*currItem);
 				currItemNr++;
 				Items->insert(currItemNr, bb);
-				bb->ItemNr = currItemNr;
 				bb->convertTo(PageItem::Polygon);
 				bb->Frame = false;
 				bb->FrameType = 3;
@@ -13322,7 +13284,6 @@
 		currItem->ClipEdited = true;
 	}
 	m_Selection->delaySignalsOff();
-	renumberItemsInListOrder();
 	//FIXME: stop using m_View
 	m_View->Deselect(true);
 	regionsChanged()->update(QRectF());
@@ -13405,11 +13366,11 @@
 					y = currItem->imageYOffset() * currItem->imageYScale();
 					if ((x != 0.0) || (y != 0.0)) // if the image frame has an offset, its assumed that the user wants the image to stay where it is
 					{
-						SizeItem(w, h, currItem->ItemNr);
+						SizeItem(w, h, currItem);
 						MoveItem(x, y, currItem);
 					}
 					else
-						SizeItem(w, h, currItem->ItemNr, true);
+						SizeItem(w, h, currItem, true);
 					currItem->setImageXYOffset(0.0, 0.0);
 				}
 			}
@@ -13687,7 +13648,7 @@
 	{
 		if ((np.x() < 0) && (!isContourLine) && (!(currItem->isGroup() || currItem->isSymbol())))
 		{
-			Doc->SizeItem(currItem->width() - np.x(), currItem->height(), currItem->ItemNr, false, false, false);
+			Doc->SizeItem(currItem->width() - np.x(), currItem->height(), currItem, false, false, false);
 			if (currItem->rotation() != 0)
 			{
 				FPoint npv(np.x(), 0);
@@ -13702,7 +13663,7 @@
 		}
 		if ((np.y() < 0) && (!isContourLine) && (!(currItem->isGroup() || currItem->isSymbol())))
 		{
-			Doc->SizeItem(currItem->width(), currItem->height() - np.y(), currItem->ItemNr, false, false, false);
+			Doc->SizeItem(currItem->width(), currItem->height() - np.y(), currItem, false, false, false);
 			if (currItem->rotation() != 0)
 			{
 				FPoint npv(0, np.y());
@@ -13986,7 +13947,7 @@
 		{
 			currItem->IProfile = profileName;
 			currItem->UseEmbedded = profileName.startsWith("Embedded");
-			LoadPict(currItem->Pfile, currItem->ItemNr, true);
+			loadPict(currItem->Pfile, currItem, true);
 			currItem->update();
 		}
 	}
@@ -14009,7 +13970,7 @@
 		if (currItem && currItem->itemType() == PageItem::ImageFrame)
 		{
 			currItem->IRender = (eRenderIntent) intentIndex;
-			LoadPict(currItem->Pfile, currItem->ItemNr, true);
+			loadPict(currItem->Pfile, currItem, true);
 			currItem->update();
 		}
 	}

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Tue Nov  1 08:51:14 2011
@@ -765,32 +765,20 @@
 	 * Only called from ScribusView. Note the undo target is the page, so the undo code remains their for now.
 	 * @return If an item was committed and the view must emit its signal, which needs removing from here, TODO.
 	 */
-	bool itemAddCommit(const int itemNumber);
+	bool itemAddCommit(PageItem* item);
 	
 	/**
 	 * @brief Finalise item creation. Simply split off code from itemAdd
 	 * Only to be called from itemAdd()
 	 */
-	void itemAddDetails(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, const int itemNumber);
+	void itemAddDetails(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, PageItem* newItem);
 
 	uint getItemNrfromUniqueID(uint unique);
 	//return pointer to item
 	PageItem* getItemFromName(QString name);
 	//itemDelete
 	//itemBlah...
-	
-	/**
-	 * @brief Run this common frame item update code
-	 */
-	void updateFrameItems();
-	/**
-	 * @brief Renumbers the items into the order they are stored in in the lists.
-	 * Utility function used in various places, basically handles keeping items numbered in the way
-	 * they are layered. When layer is a property and not a fuction of storage, this should be removed.
-	 * Depends on the Items pointer pointing to the correct item list (doc, master, etc).
-	 * @sa updateFrameItems();
-	 */
-	void renumberItemsInListOrder();
+
 	/**
 	 * @brief Rebuild item lists taking into account layer order.
 	 * Utility function used in various places, basically handles keeping items numbered in the way
@@ -808,7 +796,7 @@
 	 * @brief Load images into an image frame, moved from the view
 	 * @retval Return false on failure
 	 */
-	bool LoadPict(QString fn, int ItNr, bool reload = false, bool showMsg = false);
+//	bool LoadPict(QString fn, int ItNr, bool reload = false, bool showMsg = false);
 	/**
 	 * 
 	 * @param fn 
@@ -1068,12 +1056,12 @@
 	bool ApplyGuides(double *x, double *y);
 	bool ApplyGuides(FPoint* point);
 	bool MoveItem(double newX, double newY, PageItem* ite, bool fromMP = false);
-	void RotateItem(double win, int ite);
+//	void RotateItem(double win, int ite);
 	void RotateItem(double win, PageItem *currItem);
 	void MoveRotated(PageItem *currItem, FPoint npv, bool fromMP = false);
-	bool SizeItem(double newX, double newY, int ite, bool fromMP = false, bool DoUpdateClip = true, bool redraw = true);
+//	bool SizeItem(double newX, double newY, int ite, bool fromMP = false, bool DoUpdateClip = true, bool redraw = true);
 	bool SizeItem(double newX, double newY, PageItem *pi, bool fromMP = false, bool DoUpdateClip = true, bool redraw = true);
-	bool MoveSizeItem(FPoint newX, FPoint newY, int ite, bool fromMP = false, bool constrainRotation=false);
+//	bool MoveSizeItem(FPoint newX, FPoint newY, int ite, bool fromMP = false, bool constrainRotation=false);
 	bool MoveSizeItem(FPoint newX, FPoint newY, PageItem* currItem, bool fromMP = false, bool constrainRotation = false);
 	void AdjustItemSize(PageItem *currItem, bool includeGroup = false, bool moveInGroup = true);
 	void moveGroup(double x, double y, bool fromMP = false, Selection* customSelection = 0);
@@ -1182,7 +1170,7 @@
 	bool leaveDrag;
 	PageItem *DraggedElem;
 	PageItem *ElemToLink;
-	QList<uint> DragElements;
+	QList<PageItem*> DragElements;
 private:
 	StyleSet<ParagraphStyle> docParagraphStyles;
 	StyleSet<CharStyle> docCharStyles;

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Tue Nov  1 08:51:14 2011
@@ -946,7 +946,7 @@
 			int z = Doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, dropPosDoc.x(), dropPosDoc.y(), 1, 1, Doc->itemToolPrefs().shapeLineWidth, Doc->itemToolPrefs().imageFillColor, CommonStrings::None, true);
 			PageItem *b = Doc->Items->at(z);
 			b->LayerID = Doc->activeLayer();
-			Doc->LoadPict(url.toLocalFile(), b->ItemNr);
+			Doc->loadPict(url.toLocalFile(), b);
 			b->setWidth(static_cast<double>(b->OrigW * 72.0 / b->pixm.imgInfo.xres));
 			b->setHeight(static_cast<double>(b->OrigH * 72.0 / b->pixm.imgInfo.yres));
 			b->OldB2 = b->width();
@@ -964,7 +964,7 @@
 			if (b->itemType() == PageItem::ImageFrame)
 			{
 				if ((fi.exists()) && (img))
-					Doc->LoadPict(url.toLocalFile(), b->ItemNr);
+					Doc->loadPict(url.toLocalFile(), b);
 			}
 			else if (b->itemType() == PageItem::TextFrame)
 			{
@@ -1081,7 +1081,7 @@
 						pmen->addAction( tr("Cancel"));
 						for (int dre=0; dre<Doc->DragElements.count(); ++dre)
 						{
-							if (Doc->Items->at(Doc->DragElements[dre])->locked())
+							if (Doc->DragElements[dre]->locked())
 							{
 								mov->setEnabled(false);
 								break;
@@ -1110,7 +1110,7 @@
 						tmpSelection.copy(*Doc->m_Selection, true);
 						for (int dre=0; dre<Doc->DragElements.count(); ++dre)
 						{
-							tmpSelection.addItem(Doc->Items->at(Doc->DragElements[dre]), true);
+							tmpSelection.addItem(Doc->DragElements[dre], true);
 						}
 						Doc->m_Selection->copy(tmpSelection, false);
 						PageItem* bb;
@@ -1895,7 +1895,7 @@
 	if (Doc->bringItemSelectionToFront())
 	{
 //		m_ScMW->outlinePalette->BuildTree();
-		emit LevelChanged(Doc->m_Selection->itemAt(0)->ItemNr);
+//		emit LevelChanged(Doc->m_Selection->itemAt(0)->ItemNr);
 		emit DocChanged();
 		m_canvas->m_viewMode.forceRedraw = true;
 		updateContents();
@@ -1919,8 +1919,9 @@
 			currItem = Doc->m_Selection->itemAt(c);
 			if (currItem->isTableItem && currItem->isSingleSel)
 				return;
-			low = qMin(currItem->ItemNr, low);
-			high = qMax(currItem->ItemNr, high);
+			uint id = Doc->Items->indexOf(currItem);
+			low = qMin(id, low);
+			high = qMax(id, high);
 		}
 		if (low == 0)
 			return;
@@ -1935,8 +1936,8 @@
 		for (int c = 0; c < Doc->m_Selection->count(); ++c)
 		{
 			currItem = Doc->m_Selection->itemAt(c);
-			ObjOrder.insert(currItem->ItemNr, c);
 			d = Doc->Items->indexOf(currItem);
+			ObjOrder.insert(d, c);
 			Doc->Items->takeAt(d);
 		}
 		d = Doc->Items->indexOf(b2);
@@ -1946,13 +1947,12 @@
 			Doc->Items->insert(d+1, Doc->m_Selection->itemAt(Oindex[c]));
 		}
 		Doc->m_Selection->clear();
-		Doc->renumberItemsInListOrder();
 //		m_ScMW->outlinePalette->BuildTree();
 		/*if (wasGUISelection)
 			tempSelection.setIsGUISelection(true);*/
 		*Doc->m_Selection=tempSelection;
 		Doc->m_Selection->delaySignalsOff();
-		emit LevelChanged(Doc->m_Selection->itemAt(0)->ItemNr);
+//		emit LevelChanged(Doc->m_Selection->itemAt(0)->ItemNr);
 		emit DocChanged();
 		m_canvas->m_viewMode.forceRedraw = true;
 		updateContents();
@@ -1976,8 +1976,9 @@
 			currItem = Doc->m_Selection->itemAt(c);
 			if (currItem->isTableItem && currItem->isSingleSel)
 				return;
-			low = qMin(currItem->ItemNr, low);
-			high = qMax(currItem->ItemNr, high);
+			uint id = Doc->Items->indexOf(currItem);
+			low = qMin(id, low);
+			high = qMax(id, high);
 		}
 		if (high == static_cast<uint>(Doc->Items->count()-1))
 			return;
@@ -1992,8 +1993,8 @@
 		for (int c = 0; c < Doc->m_Selection->count(); ++c)
 		{
 			currItem = Doc->m_Selection->itemAt(c);
-			ObjOrder.insert(currItem->ItemNr, c);
 			d = Doc->Items->indexOf(currItem);
+			ObjOrder.insert(d, c);
 			Doc->Items->takeAt(d);
 		}
 		QList<uint> Oindex = ObjOrder.values();
@@ -2005,13 +2006,12 @@
 			Doc->Items->insert(d, Doc->m_Selection->itemAt(Oindex[c]));
 		}
 		Doc->m_Selection->clear();
-		Doc->renumberItemsInListOrder();
 //		m_ScMW->outlinePalette->BuildTree();
 		/*if (wasGUISelection)
 			tempSelection.setIsGUISelection(true);*/
 		*Doc->m_Selection=tempSelection;
 		Doc->m_Selection->delaySignalsOff();
-		emit LevelChanged(Doc->m_Selection->itemAt(0)->ItemNr);
+//		emit LevelChanged(Doc->m_Selection->itemAt(0)->ItemNr);
 		emit DocChanged();
 		m_canvas->m_viewMode.forceRedraw = true;
 		updateContents();
@@ -4019,20 +4019,19 @@
 			delItems.append(tmpSelection.takeItem(offset));
 		}
 		tmpSelection.clear();
+		int ind = Doc->Items->indexOf(currItem);
 		if (newGroupedItems.count() > 1)
 		{
 			for (int ag = 0; ag < newGroupedItems.count(); ++ag)
 			{
-				Doc->Items->insert(currItem->ItemNr+1+ag, newGroupedItems.at(ag));
+				Doc->Items->insert(ind+1+ag, newGroupedItems.at(ag));
 				tmpSelection.addItem(newGroupedItems.at(ag));
 			}
-			Doc->renumberItemsInListOrder();
 			Doc->itemSelection_GroupObjects(true, false, &tmpSelection);
 		}
 		else if (newGroupedItems.count() > 0)
 		{
-			Doc->Items->insert(currItem->ItemNr+1, newGroupedItems.at(0));
-			Doc->renumberItemsInListOrder();
+			Doc->Items->insert(ind+1, newGroupedItems.at(0));
 		}
 		int toDeleteItemCount=delItems.count();
 		if (toDeleteItemCount != 0)

Modified: trunk/Scribus/scribus/sctextstruct.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/sctextstruct.cpp
==============================================================================
--- trunk/Scribus/scribus/sctextstruct.cpp (original)
+++ trunk/Scribus/scribus/sctextstruct.cpp Tue Nov  1 08:51:14 2011
@@ -36,7 +36,6 @@
 		if (refs == 0 && item != NULL)
 		{
 			item->doc()->FrameItems.removeAll(item);
-			item->doc()->updateFrameItems();
 			delete item;
 			item = NULL;
 		}

Modified: trunk/Scribus/scribus/text/storytext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/text/storytext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/storytext.cpp (original)
+++ trunk/Scribus/scribus/text/storytext.cpp Tue Nov  1 08:51:14 2011
@@ -1829,7 +1829,6 @@
 				items->removeAll(obj);
 		}
 		obj->doc()->FrameItems.append(obj);
-		obj->ItemNr = obj->doc()->FrameItems.count() - 1;
 		story->insertObject(-1, obj);
 	}
 };

Modified: trunk/Scribus/scribus/ui/charselect.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/ui/charselect.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/charselect.cpp (original)
+++ trunk/Scribus/scribus/ui/charselect.cpp Tue Nov  1 08:51:14 2011
@@ -125,7 +125,6 @@
 			ch = QChar(32);
 		m_Item->itemText.insertChars(ch, true);
 	}
-	m_doc->updateFrameItems();
 	m_doc->view()->DrawNew();
 	m_doc->changed();
 // 	delEdit();
@@ -145,7 +144,6 @@
 	if (ch == QChar(9))
 		ch = QChar(32);
 	m_Item->itemText.insertChars(ch, true);
-	m_doc->updateFrameItems();
 	m_doc->view()->DrawNew();
 	m_doc->changed();
 }

Modified: trunk/Scribus/scribus/ui/cpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/ui/cpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/cpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/cpalette.cpp Tue Nov  1 08:51:14 2011
@@ -349,11 +349,11 @@
 	{
 		if (currentDoc->m_Selection->count() > 1)
 		{
-			uint lowestItem = 999999;
+			int lowestItem = 999999;
 			for (int a=0; a < currentDoc->m_Selection->count(); ++a)
 			{
 				currentItem = currentDoc->m_Selection->itemAt(a);
-				lowestItem = qMin(lowestItem, currentItem->ItemNr);
+				lowestItem = qMin(lowestItem, currentDoc->Items->indexOf(currentItem));
 			}
 			currentItem = currentDoc->Items->at(lowestItem);
 		}

Modified: trunk/Scribus/scribus/ui/extimageprops.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/ui/extimageprops.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/extimageprops.cpp (original)
+++ trunk/Scribus/scribus/ui/extimageprops.cpp Tue Nov  1 08:51:14 2011
@@ -305,7 +305,7 @@
 	doPreview = false;
 	if (originalInfo.layerInfo.count() != 0)
 		changedLayer();
-	viewWidget->Doc->LoadPict(currentItem->Pfile, currentItem->ItemNr, true);
+	viewWidget->Doc->loadPict(currentItem->Pfile, currentItem, true);
 	if (pathList->count() != 0)
 	{
 		QList<QListWidgetItem *>sel = pathList->selectedItems();
@@ -332,7 +332,7 @@
 void ExtImageProps::leaveCancel()
 {
 	currentItem->pixm.imgInfo = originalInfo;
-	viewWidget->Doc->LoadPict(currentItem->Pfile, currentItem->ItemNr, true);
+	viewWidget->Doc->loadPict(currentItem->Pfile, currentItem, true);
 	currentItem->imageClip = originalImageClip.copy();
 	currentItem->update();
 	reject();
@@ -345,7 +345,7 @@
 	{
 		if (originalInfo.layerInfo.count() != 0)
 			changedLayer();
-		viewWidget->Doc->LoadPict(currentItem->Pfile, currentItem->ItemNr, true);
+		viewWidget->Doc->loadPict(currentItem->Pfile, currentItem, true);
 		if (pathList->count() != 0)
 		{
 			QList<QListWidgetItem *>sel = pathList->selectedItems();
@@ -370,7 +370,7 @@
 	else
 	{
 		currentItem->pixm.imgInfo = originalInfo;
-		viewWidget->Doc->LoadPict(currentItem->Pfile, currentItem->ItemNr, true);
+		viewWidget->Doc->loadPict(currentItem->Pfile, currentItem, true);
 		currentItem->imageClip = originalImageClip.copy();
 		currentItem->update();
 	}
@@ -401,7 +401,7 @@
 	}
 	if (doPreview)
 	{
-		viewWidget->Doc->LoadPict(currentItem->Pfile, currentItem->ItemNr, true);
+		viewWidget->Doc->loadPict(currentItem->Pfile, currentItem, true);
 		currentItem->update();
 	}
 }

Modified: trunk/Scribus/scribus/ui/outlinepalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/ui/outlinepalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/outlinepalette.cpp (original)
+++ trunk/Scribus/scribus/ui/outlinepalette.cpp Tue Nov  1 08:51:14 2011
@@ -150,7 +150,6 @@
 							item->PageItemObject->OwnPage = item->DocObject->OnPage(item->PageItemObject);
 							item->DocObject->scMW()->selectItemsFromOutlines(item->PageItemObject, true);
 						}
-						item->DocObject->renumberItemsInListOrder();
 						QList<QTreeWidgetItem*> selList;
 						selList.append(it);
 						selectItems(selList);
@@ -182,7 +181,6 @@
 								item->PageItemObject->OwnPage = item->DocObject->OnPage(item->PageItemObject);
 								item->DocObject->scMW()->selectItemsFromOutlines(item->PageItemObject, true);
 							}
-							item->DocObject->renumberItemsInListOrder();
 							QList<QTreeWidgetItem*> selList;
 							selList.append(it);
 							selectItems(selList);
@@ -878,7 +876,7 @@
 					if (!pgItem->isSelected())
 					{
 						m_MainWindow->closeActiveWindowMasterPageEditor();
-						currDoc->view()->SelectItemNr(pgItem->ItemNr, false, false);
+						currDoc->view()->SelectItem(pgItem, false, false);
 					}
 					break;
 				default:
@@ -1291,6 +1289,7 @@
 			grp->setText(0, pgItem->itemName());
 			setItemIcon(grp, pgItem);
 			grp->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+//			grp->setFlags(Qt::ItemIsEnabled);
 		}
 		else
 		{
@@ -1302,6 +1301,7 @@
 			grp->setText(0, pgItem->itemName());
 			grp->setIcon( 0, groupIcon );
 			grp->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+//			grp->setFlags(Qt::ItemIsEnabled);
 			parseSubGroup(grp, &pgItem->groupItemList, itemType, a);
 		}
 	}

Modified: trunk/Scribus/scribus/ui/picstatus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/ui/picstatus.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/picstatus.cpp (original)
+++ trunk/Scribus/scribus/ui/picstatus.cpp Tue Nov  1 08:51:14 2011
@@ -421,7 +421,7 @@
 	bool oldMasterPageMode = m_Doc->masterPageMode();
 	if (masterPageMode != oldMasterPageMode)
 		m_Doc->setMasterPageMode(masterPageMode);
-	m_Doc->LoadPict(newFilePath, currItem->ItemNr, true);
+	m_Doc->loadPict(newFilePath, currItem, true);
 	if (masterPageMode != oldMasterPageMode)
 		m_Doc->setMasterPageMode(oldMasterPageMode);
 	return currItem->PictureIsAvailable;

Modified: trunk/Scribus/scribus/ui/propertiespalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/ui/propertiespalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette.cpp Tue Nov  1 08:51:14 2011
@@ -374,20 +374,21 @@
 
 	if (m_doc)
 	{
-		if (m_doc->m_Selection->count() > 1)
-		{
-			uint lowestItem = 999999;
+		currentItem = m_doc->m_Selection->itemAt(0);
+	/*	if (m_doc->m_Selection->count() > 1)
+		{
+			int lowestItem = 999999;
 			for (int a=0; a<m_doc->m_Selection->count(); ++a)
 			{
 				currentItem = m_doc->m_Selection->itemAt(a);
-				lowestItem = qMin(lowestItem, currentItem->ItemNr);
+				lowestItem = qMin(lowestItem, m_doc->Items->indexOf(currentItem));
 			}
 			currentItem = m_doc->Items->at(lowestItem);
 		}
 		else if (m_doc->m_Selection->count() == 1)
 		{
 			currentItem = m_doc->m_Selection->itemAt(0);
-		}
+		} */
 	}
 
 	return currentItem;
@@ -534,7 +535,7 @@
 		int itemType = currItem ? (int) currItem->itemType() : -1;
 		m_haveItem   = (itemType != -1);
 
-		int visID = TabStack->currentIndex();
+//		int visID = TabStack->currentIndex();
 		TabStack->widget(0)->setEnabled(true);
 		TabStack->setItemEnabled(idXYZItem, true);
 		TabStack->setItemEnabled(idColorsItem, true);

Modified: trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_xyz.cpp Tue Nov  1 08:51:14 2011
@@ -296,7 +296,7 @@
 
 	nameEdit->setText(m_item->itemName());
 	QString tm;
-	levelLabel->setText(tm.setNum(m_item->ItemNr + 1));
+	levelLabel->setText(tm.setNum(m_doc->Items->indexOf(m_item) + 1));
 
 	connect(nameEdit, SIGNAL(Leaved()), this, SLOT(handleNewName()));
 

Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16943&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp (original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp Tue Nov  1 08:51:14 2011
@@ -2902,7 +2902,6 @@
 	}
 	FrameItemsDel.clear();
 #endif
-	currDoc->updateFrameItems();
 #if 0
 	if (currItem->asTextFrame())
 	{




More information about the scribus-commit mailing list