r21709 by jghali - simplify font collection code by using getItemList() implementation for tables

scribus-commit scribus-commit at lists.scribus.net
Sun Jan 8 14:30:07 UTC 2017


Author: jghali
Date: Sun Jan  8 14:30:07 2017
New Revision: 21709

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21709
Log:
simplify font collection code by using getItemList() implementation for tables

Modified:
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21709&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp	(original)
+++ trunk/Scribus/scribus/pdflib_core.cpp	Sun Jan  8 14:30:07 2017
@@ -1218,100 +1218,134 @@
 	size_t ar = sizeof(tmpf) / sizeof(*tmpf);
 	for (uint ax = 0; ax < ar; ++ax)
 		ind2PDFabr[ax] = tmpf[ax];
-	QList<PageItem*> allItems;
-	for (QHash<int, PageItem*>::iterator itf = doc.FrameItems.begin(); itf != doc.FrameItems.end(); ++itf)
-	{
-		pgit = itf.value();
-		if (pgit->isGroup())
-			allItems = pgit->asGroupFrame()->getItemList();
-		else
-			allItems.append(pgit);
-		for (int ii = 0; ii < allItems.count(); ii++)
-		{
-			pgit = allItems.at(ii);
-			if (pgit->isTable())
-			{
-				for (int row = 0; row < pgit->asTable()->rows(); ++row)
-				{
-					for (int col = 0; col < pgit->asTable()->columns(); col ++)
-					{
-						TableCell cell = pgit->asTable()->cellAt(row, col);
-						if (cell.row() == row && cell.column() == col)
-						{
-							PageItem* textFrame = cell.textFrame();
-							for (uint e = 0; e < static_cast<uint>(textFrame->itemText.length()); ++e)
-							{
-								QString replacementName = textFrame->itemText.charStyle(e).font().replacementName();
-								ReallyUsed.insert(replacementName, DocFonts[replacementName]);
-							}
-						}
-					}
+
+	QList<PageItem*> allItems = doc.FrameItems.values();
+	while (allItems.count() > 0)
+	{
+		pgit = allItems.takeFirst();
+		if (pgit->isGroup() || pgit->isTable())
+		{
+			allItems = pgit->getItemList() + allItems;
+			continue;
+		}
+		if ((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText))
+		{
+			if (pgit->isAnnotation())
+			{
+				int annotType  = pgit->annotation().Type();
+				bool mustEmbed = ((annotType >= Annotation::Button) && (annotType <= Annotation::Listbox) && (annotType != Annotation::Checkbox));
+				if ((pgit->annotation().Type() == Annotation::Checkbox) || (pgit->annotation().Type() == Annotation::RadioButton))
+					StdFonts.insert("/ZapfDingbats", "");
+				if (pgit->itemText.length() > 0 || mustEmbed)
+				{
+					if (Options.Version < PDFOptions::PDFVersion_14)
+						StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
+					ReallyUsed.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), DocFonts[pgit->itemText.defaultStyle().charStyle().font().replacementName()]);
 				}
 			}
+			uint start = pgit->isTextFrame() ? (uint) pgit->firstInFrame() : 0;
+			uint stop  = pgit->isTextFrame() ? (uint) pgit->lastInFrame() + 1 : (uint) pgit->itemText.length();
+			for (uint e = start; e < stop; ++e)
+			{
+				QString replacementName = pgit->itemText.charStyle(e).font().replacementName();
+				ReallyUsed.insert(replacementName, DocFonts[replacementName]);
+			}
+		}
+	}
+
+	allItems = doc.MasterItems;
+	while (allItems.count() > 0)
+	{
+		pgit = allItems.takeFirst();
+		if (pgit->isGroup() || pgit->isTable())
+		{
+			allItems = pgit->getItemList() + allItems;
+			continue;
+		}
+		if ((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText))
+		{
+			if (pgit->isAnnotation())
+			{
+				int annotType  = pgit->annotation().Type();
+				bool mustEmbed = ((annotType >= Annotation::Button) && (annotType <= Annotation::Listbox) && (annotType != Annotation::Checkbox));
+				if ((pgit->annotation().Type() == Annotation::Checkbox) || (pgit->annotation().Type() == Annotation::RadioButton))
+					StdFonts.insert("/ZapfDingbats", "");
+				if (pgit->itemText.length() > 0 || mustEmbed)
+				{
+					if (Options.Version < PDFOptions::PDFVersion_14)
+						StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
+					QString replacementName = pgit->itemText.defaultStyle().charStyle().font().replacementName();
+					ReallyUsed.insert(replacementName, DocFonts[replacementName]);
+				}
+			}
+			uint start = pgit->isTextFrame() ? (uint) pgit->firstInFrame() : 0;
+			uint stop  = pgit->isTextFrame() ? (uint) pgit->lastInFrame() + 1 : (uint) pgit->itemText.length();
+			for (uint e = start; e < stop; ++e)
+			{
+				QString replacementName = pgit->itemText.charStyle(e).font().replacementName();
+				ReallyUsed.insert(replacementName, DocFonts[replacementName]);
+			}
+		}
+	}
+
+	allItems = *(doc.Items);
+	while (allItems.count() > 0)
+	{
+		pgit = allItems.takeFirst();
+		if (pgit->isGroup() || pgit->isTable())
+		{
+			allItems = pgit->getItemList() + allItems;
+			continue;
+		}
+		if ((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText))
+		{
+			if (pgit->isAnnotation())
+			{
+				int annotType  = pgit->annotation().Type();
+				bool mustEmbed = ((annotType >= Annotation::Button) && (annotType <= Annotation::Listbox) && (annotType != Annotation::Checkbox));
+				if ((pgit->annotation().Type() == Annotation::Checkbox) || (pgit->annotation().Type() == Annotation::RadioButton))
+					StdFonts.insert("/ZapfDingbats", "");
+				if (pgit->itemText.length() > 0 || mustEmbed)
+				{
+					if (Options.Version < PDFOptions::PDFVersion_14)
+						StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
+					QString replacementName = pgit->itemText.defaultStyle().charStyle().font().replacementName();
+					ReallyUsed.insert(replacementName, DocFonts[replacementName]);
+				}
+			}
+			uint start = pgit->isTextFrame() ? (uint) pgit->firstInFrame() : 0;
+			uint stop  = pgit->isTextFrame() ? (uint) pgit->lastInFrame() + 1 : (uint) pgit->itemText.length();
+			for (uint e = start; e < stop; ++e)
+			{
+				QString replacementName = pgit->itemText.charStyle(e).font().replacementName();
+				ReallyUsed.insert(replacementName, DocFonts[replacementName]);
+			}
+		}
+	}
+/*	if (Options.docInfoMarks)
+	{
+		StdFonts.insert("/Helvetica", "");
+	} */
+	QStringList patterns = doc.getPatternDependencyList(doc.getUsedPatterns());
+	for (int c = 0; c < patterns.count(); ++c)
+	{
+		ScPattern pa = doc.docPatterns[patterns[c]];
+		allItems = pa.items;
+		while (allItems.count() > 0)
+		{
+			pgit = allItems.takeFirst();
+			if (pgit->isGroup() || pgit->isTable())
+			{
+				allItems = pgit->getItemList() + allItems;
+				continue;
+			}
 			if ((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText))
 			{
 				if (pgit->isAnnotation())
 				{
-					int annotType  = pgit->annotation().Type();
-					bool mustEmbed = ((annotType >= Annotation::Button) && (annotType <= Annotation::Listbox) && (annotType != Annotation::Checkbox));
 					if ((pgit->annotation().Type() == Annotation::Checkbox) || (pgit->annotation().Type() == Annotation::RadioButton))
 						StdFonts.insert("/ZapfDingbats", "");
-					if (pgit->itemText.length() > 0 || mustEmbed)
-					{
-						if (Options.Version < PDFOptions::PDFVersion_14)
-							StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
-						ReallyUsed.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), DocFonts[pgit->itemText.defaultStyle().charStyle().font().replacementName()]);
-					}
-				}
-				uint start = pgit->isTextFrame() ? (uint) pgit->firstInFrame() : 0;
-				uint stop  = pgit->isTextFrame() ? (uint) pgit->lastInFrame() + 1 : (uint) pgit->itemText.length();
-				for (uint e = start; e < stop; ++e)
-				{
-					QString replacementName = pgit->itemText.charStyle(e).font().replacementName();
-					ReallyUsed.insert(replacementName, DocFonts[replacementName]);
-				}
-			}
-		}
-		allItems.clear();
-	}
-	for (int c = 0; c < doc.MasterItems.count(); ++c)
-	{
-		pgit = doc.MasterItems.at(c);
-		if (pgit->isGroup())
-			allItems = pgit->asGroupFrame()->getItemList();
-		else
-			allItems.append(pgit);
-		for (int ii = 0; ii < allItems.count(); ii++)
-		{
-			pgit = allItems.at(ii);
-			if (pgit->isTable())
-			{
-				for (int row = 0; row < pgit->asTable()->rows(); ++row)
-				{
-					for (int col = 0; col < pgit->asTable()->columns(); col ++)
-					{
-						TableCell cell = pgit->asTable()->cellAt(row, col);
-						if (cell.row() == row && cell.column() == col)
-						{
-							PageItem* textFrame = cell.textFrame();
-							for (uint e = 0; e < static_cast<uint>(textFrame->itemText.length()); ++e)
-							{
-								QString replacementName = textFrame->itemText.charStyle(e).font().replacementName();
-								ReallyUsed.insert(replacementName, DocFonts[replacementName]);
-							}
-						}
-					}
-				}
-			}
-			if ((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText))
-			{
-				if (pgit->isAnnotation())
-				{
-					int annotType  = pgit->annotation().Type();
-					bool mustEmbed = ((annotType >= Annotation::Button) && (annotType <= Annotation::Listbox) && (annotType != Annotation::Checkbox));
-					if ((pgit->annotation().Type() == Annotation::Checkbox) || (pgit->annotation().Type() == Annotation::RadioButton))
-						StdFonts.insert("/ZapfDingbats", "");
-					if (pgit->itemText.length() > 0 || mustEmbed)
+					if (pgit->itemText.length() > 0)
 					{
 						if (Options.Version < PDFOptions::PDFVersion_14)
 							StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
@@ -1327,126 +1361,6 @@
 					ReallyUsed.insert(replacementName, DocFonts[replacementName]);
 				}
 			}
-		}
-		allItems.clear();
-	}
-	for (int d = 0; d < doc.Items->count(); ++d)
-	{
-		pgit = doc.Items->at(d);
-		if (pgit->isGroup())
-			allItems = pgit->asGroupFrame()->getItemList();
-		else
-			allItems.append(pgit);
-		for (int ii = 0; ii < allItems.count(); ii++)
-		{
-			pgit = allItems.at(ii);
-			if (pgit->isTable())
-			{
-				for (int row = 0; row < pgit->asTable()->rows(); ++row)
-				{
-					for (int col = 0; col < pgit->asTable()->columns(); col ++)
-					{
-						TableCell cell = pgit->asTable()->cellAt(row, col);
-						if (cell.row() == row && cell.column() == col)
-						{
-							PageItem* textFrame = cell.textFrame();
-							for (uint e = 0; e < static_cast<uint>(textFrame->itemText.length()); ++e)
-							{
-								QString replacementName = textFrame->itemText.charStyle(e).font().replacementName();
-								ReallyUsed.insert(replacementName, DocFonts[replacementName]);
-							}
-						}
-					}
-				}
-			}
-			if ((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText))
-			{
-				if (pgit->isAnnotation())
-				{
-					int annotType  = pgit->annotation().Type();
-					bool mustEmbed = ((annotType >= Annotation::Button) && (annotType <= Annotation::Listbox) && (annotType != Annotation::Checkbox));
-					if ((pgit->annotation().Type() == Annotation::Checkbox) || (pgit->annotation().Type() == Annotation::RadioButton))
-						StdFonts.insert("/ZapfDingbats", "");
-					if (pgit->itemText.length() > 0 || mustEmbed)
-					{
-						if (Options.Version < PDFOptions::PDFVersion_14)
-							StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
-						QString replacementName = pgit->itemText.defaultStyle().charStyle().font().replacementName();
-						ReallyUsed.insert(replacementName, DocFonts[replacementName]);
-					}
-				}
-				uint start = pgit->isTextFrame() ? (uint) pgit->firstInFrame() : 0;
-				uint stop  = pgit->isTextFrame() ? (uint) pgit->lastInFrame() + 1 : (uint) pgit->itemText.length();
-				for (uint e = start; e < stop; ++e)
-				{
-					QString replacementName = pgit->itemText.charStyle(e).font().replacementName();
-					ReallyUsed.insert(replacementName, DocFonts[replacementName]);
-				}
-			}
-		}
-		allItems.clear();
-	}
-/*	if (Options.docInfoMarks)
-	{
-		StdFonts.insert("/Helvetica", "");
-	} */
-	QStringList patterns = doc.getPatternDependencyList(doc.getUsedPatterns());
-	for (int c = 0; c < patterns.count(); ++c)
-	{
-		ScPattern pa = doc.docPatterns[patterns[c]];
-		for (int o = 0; o < pa.items.count(); o++)
-		{
-			pgit = pa.items.at(o);
-			if (pgit->isGroup())
-				allItems = pgit->asGroupFrame()->getItemList();
-			else
-				allItems.append(pgit);
-			for (int ii = 0; ii < allItems.count(); ii++)
-			{
-				pgit = allItems.at(ii);
-				if (pgit->isTable())
-				{
-					for (int row = 0; row < pgit->asTable()->rows(); ++row)
-					{
-						for (int col = 0; col < pgit->asTable()->columns(); col ++)
-						{
-							TableCell cell = pgit->asTable()->cellAt(row, col);
-							if (cell.row() == row && cell.column() == col)
-							{
-								PageItem* textFrame = cell.textFrame();
-								for (uint e = 0; e < static_cast<uint>(textFrame->itemText.length()); ++e)
-								{
-									QString replacementName = textFrame->itemText.charStyle(e).font().replacementName();
-									ReallyUsed.insert(replacementName, DocFonts[replacementName]);
-								}
-							}
-						}
-					}
-				}
-				if ((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText))
-				{
-					if (pgit->isAnnotation())
-					{
-						if ((pgit->annotation().Type() == Annotation::Checkbox) || (pgit->annotation().Type() == Annotation::RadioButton))
-							StdFonts.insert("/ZapfDingbats", "");
-						if (pgit->itemText.length() > 0)
-						{
-							if (Options.Version < PDFOptions::PDFVersion_14)
-								StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
-							QString replacementName = pgit->itemText.defaultStyle().charStyle().font().replacementName();
-							ReallyUsed.insert(replacementName, DocFonts[replacementName]);
-						}
-					}
-					uint start = pgit->isTextFrame() ? (uint) pgit->firstInFrame() : 0;
-					uint stop  = pgit->isTextFrame() ? (uint) pgit->lastInFrame() + 1 : (uint) pgit->itemText.length();
-					for (uint e = start; e < stop; ++e)
-					{
-						QString replacementName = pgit->itemText.charStyle(e).font().replacementName();
-						ReallyUsed.insert(replacementName, DocFonts[replacementName]);
-					}
-				}
-			}
-			allItems.clear();
 		}
 	}
 	return ReallyUsed;

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21709&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Sun Jan  8 14:30:07 2017
@@ -4269,114 +4269,26 @@
 {
 	QMap<QString,int> Really;
 	QList<PageItem*> allItems;
-	int counter = 0;
+
 	for (int i = 0; i < 2; ++i)
 	{
 		switch (i)
 		{
 			case 0:
-				counter = MasterItems.count();
+				allItems = MasterItems;
 				break;
 			case 1:
-				counter = DocItems.count();
+				allItems = DocItems;
 				break;
 		}
 		PageItem* it = NULL;
-		for (int d = 0; d < counter; ++d)
-		{
-			switch (i)
-			{
-				case 0:
-					it = MasterItems.at(d);
-					break;
-				case 1:
-					it = DocItems.at(d);
-					break;
-			}
-			if (it->isGroup())
-				allItems = it->asGroupFrame()->getItemList();
-			else
-				allItems.append(it);
-			for (int ii = 0; ii < allItems.count(); ii++)
-			{
-				it = allItems.at(ii);
-				if (it->isTable())
-				{
-					for (int row = 0; row < it->asTable()->rows(); ++row)
-					{
-						for (int col = 0; col < it->asTable()->columns(); col ++)
-						{
-							TableCell cell = it->asTable()->cellAt(row, col);
-							if (cell.row() == row && cell.column() == col)
-							{
-								PageItem* textFrame = cell.textFrame();
-								QString fontName(textFrame->itemText.defaultStyle().charStyle().font().replacementName());
-								Really.insert(fontName, UsedFonts[fontName]);
-								int start = textFrame->firstInFrame();
-								int stop = textFrame->lastInFrame();
-								for (int e = start; e <= stop; ++e)
-								{
-									QString rep = textFrame->itemText.charStyle(e).font().replacementName();
-									if (Really.contains(rep))
-										continue;
-									Really.insert(rep, UsedFonts[rep]);
-								}
-							}
-						}
-					}
-				}
-				if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText))
-				{
-					QString fontName(it->itemText.defaultStyle().charStyle().font().replacementName());
-					Really.insert(fontName, UsedFonts[fontName]);
-					int start = it->firstInFrame();
-					int stop = it->lastInFrame();
-					for (int e = start; e <= stop; ++e)
-					{
-						QString rep = it->itemText.charStyle(e).font().replacementName();
-						if (Really.contains(rep))
-							continue;
-						Really.insert(rep, UsedFonts[rep]);
-					}
-				}
-			}
-			allItems.clear();
-		}
-	}
-	for (QHash<int, PageItem*>::iterator itf = FrameItems.begin(); itf != FrameItems.end(); ++itf)
-	{
-		PageItem *it = itf.value();
-		if (it->isGroup())
-			allItems = it->asGroupFrame()->getItemList();
-		else
-			allItems.append(it);
-		for (int ii = 0; ii < allItems.count(); ii++)
-		{
-			it = allItems.at(ii);
-			if (it->isTable())
-			{
-				for (int row = 0; row < it->asTable()->rows(); ++row)
-				{
-					for (int col = 0; col < it->asTable()->columns(); col ++)
-					{
-						TableCell cell = it->asTable()->cellAt(row, col);
-						if (cell.row() == row && cell.column() == col)
-						{
-							PageItem* textFrame = cell.textFrame();
-							QString fontName(textFrame->itemText.defaultStyle().charStyle().font().replacementName());
-							Really.insert(fontName, UsedFonts[fontName]);
-							int start = textFrame->firstInFrame();
-							int stop = textFrame->lastInFrame();
-							for (int e = start; e <= stop; ++e)
-							{
-								QString rep = textFrame->itemText.charStyle(e).font().replacementName();
-								if (Really.contains(rep))
-									continue;
-								Really.insert(rep, UsedFonts[rep]);
-							}
-						}
-					}
-				}
+		while (allItems.count() > 0)
+		{
+			it = allItems.takeFirst();
+			if (it->isGroup() || it->isTable())
+			{
+				allItems = it->getItemList() + allItems;
+				continue;
 			}
 			if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText))
 			{
@@ -4393,8 +4305,33 @@
 				}
 			}
 		}
-		allItems.clear();
-	}
+	}
+
+	allItems = FrameItems.values();
+	while (allItems.count() > 0)
+	{
+		PageItem *it = allItems.takeFirst();
+		if (it->isGroup() || it->isTable())
+		{
+			allItems = it->getItemList() + allItems;
+			continue;
+		}
+		if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText))
+		{
+			QString fontName(it->itemText.defaultStyle().charStyle().font().replacementName());
+			Really.insert(fontName, UsedFonts[fontName]);
+			int start = it->firstInFrame();
+			int stop = it->lastInFrame();
+			for (int e = start; e <= stop; ++e)
+			{
+				QString rep = it->itemText.charStyle(e).font().replacementName();
+				if (Really.contains(rep))
+					continue;
+				Really.insert(rep, UsedFonts[rep]);
+			}
+		}
+	}
+
 	QMap<QString,int>::Iterator itfo, itnext;
 	for (itfo = UsedFonts.begin(); itfo != UsedFonts.end(); itfo = itnext)
 	{
@@ -4417,89 +4354,48 @@
 	QList<PageItem*>  allItems;
 	QList<PageItem*>* itemLists[] = { &MasterItems, &DocItems };
 	PageItem* it = NULL;
-	int counter = 0;
+
 	for (int i = 0; i < 2; ++i)
 	{
-		QList<PageItem*>* itemList = itemLists[i];
-		counter = itemList->count();
-		for (int d = 0; d < counter; ++d)
-		{
-			it = itemList->at(d);
-			if (it->isGroup())
-				allItems = it->asGroupFrame()->getItemList();
-			else
-				allItems.append(it);
-			for (int ii = 0; ii < allItems.count(); ii++)
-			{
-				it = allItems.at(ii);
-				if (it->isTable())
-				{
-					for (int row = 0; row < it->asTable()->rows(); ++row)
-					{
-						for (int col = 0; col < it->asTable()->columns(); col ++)
-						{
-							TableCell cell = it->asTable()->cellAt(row, col);
-							if (cell.row() == row && cell.column() == col)
-							{
-								PageItem* textFrame = cell.textFrame();
-								checkItemForFonts(textFrame, Really, i);
-							}
-						}
-					}
-				}
-				else
-					checkItemForFonts(it, Really, i);
-			}
-			allItems.clear();
-		}
-	}
-	for (QHash<int, PageItem*>::iterator itf = FrameItems.begin(); itf != FrameItems.end(); ++itf)
-	{
-		PageItem *ite = itf.value();
-		if (ite->isGroup())
-			allItems = ite->asGroupFrame()->getItemList();
-		else
-			allItems.append(ite);
-		for (int ii = 0; ii < allItems.count(); ii++)
-		{
-			ite = allItems.at(ii);
-			if (ite->isTable())
-			{
-				for (int row = 0; row < ite->asTable()->rows(); ++row)
-				{
-					for (int col = 0; col < ite->asTable()->columns(); col ++)
-					{
-						TableCell cell = ite->asTable()->cellAt(row, col);
-						if (cell.row() == row && cell.column() == col)
-						{
-							PageItem* textFrame = cell.textFrame();
-							checkItemForFonts(textFrame, Really, 3);
-						}
-					}
-				}
-			}
-			else
-				checkItemForFonts(ite, Really, 3);
-		}
-		allItems.clear();
-	}
+		allItems = *(itemLists[i]);
+		while (allItems.count() > 0)
+		{
+			it = allItems.takeFirst();
+			if (it->isGroup() || it->isTable())
+			{
+				allItems = it->getItemList() + allItems;
+				continue;
+			}
+			checkItemForFonts(it, Really, i);
+		}
+	}
+
+	allItems = FrameItems.values();
+	while (allItems.count() > 0)
+	{
+		PageItem *ite = allItems.takeFirst();
+		if (it->isGroup() || it->isTable())
+		{
+			allItems = it->getItemList() + allItems;
+			continue;
+		}
+		checkItemForFonts(ite, Really, 3);
+	}
+
 	QStringList patterns = getUsedPatterns();
 	for (int c = 0; c < patterns.count(); ++c)
 	{
 		ScPattern pa = docPatterns[patterns[c]];
-		for (int o = 0; o < pa.items.count(); o++)
-		{
-			it = pa.items.at(o);
-			if (it->isGroup())
-				allItems = it->asGroupFrame()->getItemList();
-			else
-				allItems.append(it);
-			for (int ii = 0; ii < allItems.count(); ii++)
-			{
-				it = allItems.at(ii);
-				checkItemForFonts(it, Really, 3);
-			}
-			allItems.clear();
+		allItems = pa.items;
+		while (allItems.count() > 0)
+		{
+			it = allItems.takeFirst();
+			if (it->isGroup() || it->isTable())
+			{
+				allItems = it->getItemList() + allItems;
+				continue;
+			}
+			checkItemForFonts(it, Really, 3);
 		}
 	}
 }
@@ -4547,7 +4443,12 @@
 		return;
 
 	if (it->invalid)
+	{
+		bool wasMasterPageMode = m_masterPageMode;
+		setMasterPageMode(it->OnMasterPage.length() > 0);
 		it->layout();
+		setMasterPageMode(wasMasterPageMode);
+	}
 
 	// This works pretty well except for the case of page numbers and al. placed on masterpages
 	// where layout may depend on the page where the masterpage item is placed




More information about the scribus-commit mailing list