r23629 by jghali - Refactor Scribus150Format::updateNames2Ptr()

scribus-commit scribus-commit at lists.scribus.net
Mon Apr 20 12:24:24 UTC 2020


Author: jghali
Date: Mon Apr 20 12:24:24 2020
New Revision: 23629

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23629
Log:
Refactor Scribus150Format::updateNames2Ptr()

Modified:
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23629&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	Mon Apr 20 12:24:24 2020
@@ -7121,43 +7121,44 @@
 		for (int i = 0; i < notesFramesData.count(); ++i)
 		{
 			NoteFrameData eF = notesFramesData.at(i);
-			NotesStyle* NS = m_Doc->getNotesStyle(eF.NSname);
-			if (NS != nullptr)
-			{
-				PageItem* item = LinkID.value(eF.myID);
-				if ((item != nullptr) && item->isNoteFrame())
-				{
-					item->asNoteFrame()->setNoteStyle(NS);
-					if (NS->isEndNotes())
+			NotesStyle* ns = m_Doc->getNotesStyle(eF.NSname);
+			if (ns == nullptr)
+				continue;
+
+			PageItem* item = LinkID.value(eF.myID);
+			if (item == nullptr || !item->isNoteFrame())
+			{
+				qDebug() << "Scribus150Format::updateNames2Ptr() : update end frames pointers - item is not note frame or name is wrong";
+				continue;
+			}
+
+			PageItem_NoteFrame* noteFrame = item->asNoteFrame();
+			noteFrame->setNoteStyle(ns);
+			if (ns->isEndNotes())
+			{
+				if (eF.NSrange == NSRdocument)
+					m_Doc->setEndNoteFrame(noteFrame, (void*) nullptr);
+				else if (eF.NSrange == NSRstory)
+					m_Doc->setEndNoteFrame(noteFrame, (void*) LinkID.value(eF.itemID));
+			}
+			else
+			{
+				PageItem* master = LinkID.value(eF.itemID);
+				if (master == nullptr)
+					continue;
+				noteFrame->setMaster(master);
+				master->asTextFrame()->setNoteFrame(noteFrame);
+				//FIX welding with note frame
+				PageItem::WeldingInfo wInf;
+				for (int i = 0 ; i < master->weldList.count(); i++)
+				{
+					wInf = master->weldList.at(i);
+					if (wInf.weldID == eF.myID)
 					{
-						if (eF.NSrange == NSRdocument)
-							m_Doc->setEndNoteFrame(item->asNoteFrame(), (void*) nullptr);
-						else if (eF.NSrange == NSRstory)
-							m_Doc->setEndNoteFrame(item->asNoteFrame(), (void*) LinkID.value(eF.itemID));
+						master->weldList[i].weldItem = item;
+						break;
 					}
-					else
-					{
-						PageItem* master = LinkID.value(eF.itemID);
-						if (master != nullptr)
-						{
-							item->asNoteFrame()->setMaster(master);
-							master->asTextFrame()->setNoteFrame(item->asNoteFrame());
-						//FIX welding with note frame
-							PageItem::WeldingInfo wInf;
-							for (int i = 0 ; i < master->weldList.count(); i++)
-							{
-								wInf = master->weldList.at(i);
-								if (wInf.weldID == eF.myID)
-								{
-									master->weldList[i].weldItem = item;
-									break;
-								}
-							}
-						}
-					}
-				}
-				else
-					qDebug() << "Scribus150Format::updateNames2Ptr() : update end frames pointers - item is not note frame or name is wrong";
+				}
 			}
 		}
 	}




More information about the scribus-commit mailing list