r17326 by jghali - #10393: opening sla from symbolic link breaks relative paths to graphics (+ some refactoring of FileLoader)

scribus-commit scribus-commit at lists.scribus.net
Thu Feb 23 20:27:50 UTC 2012


Author: jghali
Date: Thu Feb 23 20:27:50 2012
New Revision: 17326

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17326
Log:
#10393: opening sla from symbolic link breaks relative paths to graphics (+ some refactoring of FileLoader)

Modified:
    trunk/Scribus/scribus/canvasmode_normal.cpp
    trunk/Scribus/scribus/fileloader.cpp
    trunk/Scribus/scribus/fileloader.h
    trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/svgimport.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusview.cpp
    trunk/Scribus/scribus/scribuswin.cpp
    trunk/Scribus/scribus/ui/customfdialog.cpp
    trunk/Scribus/scribus/ui/mergedoc.cpp
    trunk/Scribus/scribus/ui/paintmanager.cpp
    trunk/Scribus/scribus/ui/scrapbookpalette.cpp
    trunk/Scribus/scribus/ui/stylemanager.cpp
    trunk/Scribus/scribus/util_color.cpp

Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17326&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Thu Feb 23 20:27:50 2012
@@ -1374,7 +1374,7 @@
 		{
 			m_doc->dontResize = true;
 			FileLoader *fileLoader = new FileLoader(fileName);
-			int testResult = fileLoader->TestFile();
+			int testResult = fileLoader->testFile();
 			delete fileLoader;
 			if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
 			{

Modified: trunk/Scribus/scribus/fileloader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17326&path=/trunk/Scribus/scribus/fileloader.cpp
==============================================================================
--- trunk/Scribus/scribus/fileloader.cpp (original)
+++ trunk/Scribus/scribus/fileloader.cpp Thu Feb 23 20:27:50 2012
@@ -61,8 +61,6 @@
  */
 FileLoader::FileLoader(const QString & fileName) :
 	QObject(0),
-	FileName(fileName),
-	FileType(-1),
 	formatSLA12x(LoadSavePlugin::getFormatById(FORMATID_SLA12XIMPORT)),
 	formatSLA13x(LoadSavePlugin::getFormatById(FORMATID_SLA13XIMPORT)),
 	formatSLA134(LoadSavePlugin::getFormatById(FORMATID_SLA134IMPORT)),
@@ -71,8 +69,13 @@
 	formatSVG(LoadSavePlugin::getFormatById(FORMATID_SVGIMPORT)),
 	formatSXD(LoadSavePlugin::getFormatById(FORMATID_SXDIMPORT)),
 	formatODG(LoadSavePlugin::getFormatById(FORMATID_ODGIMPORT)),
-	prefsManager(PrefsManager::instance())
-{
+	prefsManager(PrefsManager::instance()),
+	m_fileName(fileName),
+	m_fileType(-1)
+{
+	QString realPath = QFileInfo(fileName).canonicalFilePath();
+	if (!realPath.isEmpty())
+		m_fileName = realPath;
 }
 
 // FIXME: This static method is here as a temporary transitional
@@ -112,9 +115,9 @@
  \brief Tests if the file "FileName" exists and determines the type of the file.
  \retval int -1 if the file doesn't exist or any other error has occurred, 0 for the old Format, 1 for the new Format, 2 for EPS and PS files, 3 for SVG files and 4 for PDF files
  */
-int FileLoader::TestFile()
-{
-	QFileInfo fi = QFileInfo(FileName);
+int FileLoader::testFile()
+{
+	QFileInfo fi = QFileInfo(m_fileName);
 	int ret = -1;
 	if (!fi.exists())
 		ret = -1;
@@ -125,143 +128,54 @@
 	QList<FileFormat>::const_iterator itEnd(fileFormats.constEnd());
 	for ( ; it != itEnd ; ++it )
 	{
-		if ((*it).nameMatch.indexIn("."+ext)!=-1)
-		{
-//  		qDebug() << QString("Match :%1: :.%2: on %3").arg((*it).nameMatch.pattern()).arg(ext).arg((*it).trName);
-			if ((*it).plug!=0)
+		if (it->nameMatch.indexIn("."+ext)!=-1)
+		{
+//  		qDebug() << QString("Match :%1: :.%2: on %3").arg(it->nameMatch.pattern()).arg(ext).arg(it->trName);
+			if (it->plug != 0)
 			{
-				if ((*it).plug->fileSupported(0, FileName))
+				if (it->plug->fileSupported(0, m_fileName))
 				{
-// 					qDebug(QString("File Supported With: %1").arg((*it).trName));
-					ret=(*it).formatId;
+// 					qDebug(QString("File Supported With: %1").arg(it->trName));
+					ret = it->formatId;
 					break;
 				}
 			}
 		}
 // 		else
-// 			qDebug() << QString("No Match :%1: :.%2: on %3").arg((*it).nameMatch.pattern()).arg(ext).arg((*it).trName);
+// 			qDebug() << QString("No Match :%1: :.%2: on %3").arg(it->nameMatch.pattern()).arg(ext).arg(it->trName);
 	}
 	
-// 	if (ret==-1)
-// 	{
-// 		if ((ext.endsWith("sla.gz")) || (ext.endsWith("sla")) || (ext.endsWith("scd.gz")) || (ext.endsWith("scd")))
-// 			ret = CheckScribus();
-// 		else 
-// 		if (((ext.endsWith("ps")) || (ext.endsWith("eps"))) && (formatPS))
-// 			ret = FORMATID_PSIMPORT;
-// 		else if (((ext.endsWith("svg")) || (ext.endsWith("svgz"))) && (formatSVG))
-// 			ret = FORMATID_SVGIMPORT;
-// 		else if ((ext.endsWith("sxd")) && (formatSXD))
-// 			ret = FORMATID_SXDIMPORT;
-// 		else if ((ext.endsWith("odg")) && (formatODG))
-// 			ret = FORMATID_ODGIMPORT;
-// 	}
-/*	if (ext == "pdf")
-		ret = 4; */
-	FileType = ret;
+	m_fileType = ret;
 	return ret;
 }
-/*
-static void replaceFonts(ScribusDoc* currDoc, PageItem *it, QMap<QString, int> UsedFonts, QMap<QString, QString> ReplacedFonts)
-{	
-	if ((it->asTextFrame()) || (it->asPathText()))
-	{
-		CharStyle newFontStyle;
-		for (uint e = 0; e < it->itemText.nrOfRuns(); ++e)
-		{
-			int start = it->itemText.startOfRun(e);
-			ScFace oldFont = it->itemText.charStyle(start).font();
-			if (!UsedFonts.contains(oldFont.scName())) {
-				newFontStyle.setFont((*currDoc->AllFonts)[ReplacedFonts[oldFont.scName()]]);
-				it->itemText.applyCharStyle(start, it->itemText.endOfRun(e) - start, newFontStyle );
-			}
-		}
-	}
-}
-
-*/
-bool FileLoader::LoadPage(ScribusDoc* currDoc, int PageToLoad, bool Mpage, QString renamedPageName)
+
+bool FileLoader::loadPage(ScribusDoc* currDoc, int PageToLoad, bool Mpage, QString renamedPageName)
 {
 	bool ret = false;
 // 	newReplacement = false;
 	ReplacedFonts = currDoc->AllFonts->getSubstitutions();
 // 	dummyScFaces.clear();
 	QList<FileFormat>::const_iterator it;
-	if (findFormat(FileType, it))
-	{
-		if (FileType==FORMATID_SLA12XIMPORT)
-		{
-			(*it).plug->setupTargets(currDoc, currDoc->view(), currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.fontPrefs.AvailFonts));
-			ret=(*it).plug->loadPage(FileName, PageToLoad, Mpage, renamedPageName);
+	if (findFormat(m_fileType, it))
+	{
+		if (m_fileType == FORMATID_SLA12XIMPORT)
+		{
+			it->plug->setupTargets(currDoc, currDoc->view(), currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.fontPrefs.AvailFonts));
+			ret = it->plug->loadPage(m_fileName, PageToLoad, Mpage, renamedPageName);
 // 			if (ret)
-// 				(*it).plug->getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
-		}
-		if (FileType==FORMATID_SLA13XIMPORT || FileType==FORMATID_SLA134IMPORT || FileType==FORMATID_SLA150IMPORT)
-		{
-			(*it).plug->setupTargets(currDoc, 0, currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.fontPrefs.AvailFonts));
-			ret=(*it).plug->loadPage(FileName, PageToLoad, Mpage, renamedPageName);
+// 				it->plug->getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
+		}
+		if (m_fileType == FORMATID_SLA13XIMPORT || m_fileType == FORMATID_SLA134IMPORT || m_fileType == FORMATID_SLA150IMPORT)
+		{
+			it->plug->setupTargets(currDoc, 0, currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.fontPrefs.AvailFonts));
+			ret = it->plug->loadPage(m_fileName, PageToLoad, Mpage, renamedPageName);
 // 			if (ret)
-// 				(*it).plug->getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
+// 				it->plug->getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
 		}
 	}
 	if (ret)
 		ret = postLoad(currDoc);  // FIXME: return false if user doesnt want to replace fonts??
-	
-	/*
-	//FIXME: this goes into scribusdoc and should work with substitutes
-	if (ReplacedFonts.count() != 0)
-	{
-		if ((prefsManager->appPrefs.askBeforeSubstituite) || (newReplacement))
-		{
-			qApp->setOverrideCursor(QCursor(Qt::arrowCursor), true);
-			FontReplaceDialog dia(0, &ReplacedFonts);
-			if (dia.exec())
-			{
-				QMap<QString,QString>::Iterator itfsu;
-				for (itfsu = ReplacedFonts.begin(); itfsu != ReplacedFonts.end(); ++itfsu)
-				{
-					if (dia.stickyReplacements->isChecked())
-						prefsManager->appPrefs.GFontSub[itfsu.key()] = itfsu.data();
-				}
-			}
-			else
-			{
-				return false;
-			}
-		}
-		for (uint d = 0; d < currDoc->MasterItems.count(); ++d)
-		{
-			replaceFonts(currDoc, currDoc->MasterItems.at(d), currDoc->UsedFonts, ReplacedFonts);
-		}
-		for (uint d = 0; d < currDoc->DocItems.count(); ++d)
-		{
-			replaceFonts(currDoc, currDoc->DocItems.at(d), currDoc->UsedFonts, ReplacedFonts);
-		}
-		for (uint d = 0; d < currDoc->FrameItems.count(); ++d)
-		{
-			replaceFonts(currDoc, currDoc->FrameItems.at(d), currDoc->UsedFonts, ReplacedFonts);
-		}
-		for (uint a = 0; a < currDoc->paragraphStyles().count(); ++a)
-		{
-//			if ( !currDoc->paragraphStyles()[a].charStyle().font().isNone() && !currDoc->UsedFonts.contains(currDoc->paragraphStyles()[a].charStyle().font().scName()))
-//				currDoc->paragraphStyles()[a].charStyle().setFont
-//					((*currDoc->AllFonts)[ReplacedFonts[currDoc->paragraphStyles()[a].charStyle().font().scName()]]);
-		}
-		QMap<QString,QString>::Iterator itfsu;
-		for (itfsu = ReplacedFonts.begin(); itfsu != ReplacedFonts.end(); ++itfsu)
-		{
-			if (!currDoc->UsedFonts.contains(itfsu.data()))
-			{
-//				QFont fo = prefsManager->appPrefs.AvailFonts[itfsu.data()]->Font;
-//				fo.setPointSize(qRound(ScMW->doc->toolSettings.textSize / 10.0));
-				currDoc->AddFont(itfsu.data(), qRound(currDoc->toolSettings.textSize / 10.0));
-			}
-		}
-		if (prefsManager->appPrefs.askBeforeSubstituite)
-			ReplacedFonts.clear();
-// 		dummyScFaces.clear();
-	}
-	*/
+
 	return ret;
 }
 
@@ -273,7 +187,7 @@
  \param currDoc the current document
  \retval bool true when loading is succsessful, false otherwise
  */
-bool FileLoader::LoadFile(ScribusDoc* currDoc)
+bool FileLoader::loadFile(ScribusDoc* currDoc)
 {
 	newReplacement = false;
 	currDoc->guidesPrefs().marginsShown = prefsManager->appPrefs.guidesPrefs.marginsShown;
@@ -297,39 +211,39 @@
 	//dummyScFaces.clear();
 	bool ret = false;
 	QList<FileFormat>::const_iterator it;
-	if (findFormat(FileType, it))
-	{
-//		qDebug("fileloader: type %d plugin %s"),FileType,(*it).trName);
-		switch (FileType)
+	if (findFormat(m_fileType, it))
+	{
+//		qDebug("fileloader: type %d plugin %s"),m_fileType,it->trName);
+		switch (m_fileType)
 		{
 			case FORMATID_SLA12XIMPORT:
 				{
-					(*it).setupTargets(currDoc, currDoc->view(), currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.fontPrefs.AvailFonts));
-					ret=(*it).loadFile(FileName, LoadSavePlugin::lfCreateDoc);
+					it->setupTargets(currDoc, currDoc->view(), currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.fontPrefs.AvailFonts));
+					ret=it->loadFile(m_fileName, LoadSavePlugin::lfCreateDoc);
 // 					if (ret)
-// 						(*it).getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
+// 						it->getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
 				}
 				break;
 			case FORMATID_SLA13XIMPORT:
 			case FORMATID_SLA134IMPORT:
 			case FORMATID_SLA150IMPORT:
 				{
-					(*it).setupTargets(currDoc, 0, currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.fontPrefs.AvailFonts));
-					ret=(*it).loadFile(FileName, LoadSavePlugin::lfCreateDoc);
+					it->setupTargets(currDoc, 0, currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.fontPrefs.AvailFonts));
+					ret=it->loadFile(m_fileName, LoadSavePlugin::lfCreateDoc);
 // 					if (ret)
-// 						(*it).getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
+// 						it->getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
 				}
 				break;
 			default:
-				(*it).setupTargets(currDoc, currDoc->view(), currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.fontPrefs.AvailFonts));
-				ret = (*it).loadFile(FileName, LoadSavePlugin::lfCreateDoc);
+				it->setupTargets(currDoc, currDoc->view(), currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.fontPrefs.AvailFonts));
+				ret = it->loadFile(m_fileName, LoadSavePlugin::lfCreateDoc);
 				break;
 		}
 	}
 	return ret;
 }
 
-bool FileLoader::SaveFile(const QString& fileName, ScribusDoc *doc, QString *savedFile)
+bool FileLoader::saveFile(const QString& fileName, ScribusDoc *doc, QString *savedFile)
 {
 	bool ret = false;
 	QList<FileFormat>::const_iterator it;
@@ -343,48 +257,47 @@
 	return ret;
 }
 
-bool FileLoader::ReadStyles(const QString& fileName, ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles)
-{
-	QList<FileFormat>::const_iterator it;
-	if (findFormat(FileType, it)) {
-		(*it).plug->setupTargets(doc, 0, doc->scMW(), doc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.fontPrefs.AvailFonts));
-		return (*it).readStyles(fileName, doc, docParagraphStyles);
-	}
-	return false;
-}
-
-bool FileLoader::ReadCharStyles(const QString& fileName, ScribusDoc* doc, StyleSet<CharStyle> &docCharStyles)
-{
-	QList<FileFormat>::const_iterator it;
-	if (findFormat(FileType, it)) {
-		(*it).plug->setupTargets(doc, 0, doc->scMW(), doc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.fontPrefs.AvailFonts));
-		return (*it).readCharStyles(fileName, doc, docCharStyles);
-	}
-	return false;
-}
-
-bool FileLoader::ReadColors(const QString& fileName, ColorList & colors)
-{
-	QList<FileFormat>::const_iterator it;
-	if (findFormat(FileType, it))
-		return (*it).readColors(fileName, colors);
-	return false;
-}
-
-
-bool FileLoader::ReadPageCount(const QString& fileName, int *num1, int *num2, QStringList & masterPageNames)
-{
-	QList<FileFormat>::const_iterator it;
-	if (findFormat(FileType, it))
-		return (*it).readPageCount(fileName, num1, num2, masterPageNames);
-	return false;
-}
-
-bool FileLoader::ReadLineStyles(const QString& fileName, QMap<QString,multiLine> *Sty)
-{
-	QList<FileFormat>::const_iterator it;
-	if (findFormat(FileType, it))
-		return (*it).readLineStyles(fileName, Sty);
+bool FileLoader::readStyles(ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles)
+{
+	QList<FileFormat>::const_iterator it;
+	if (findFormat(m_fileType, it)) {
+		it->plug->setupTargets(doc, 0, doc->scMW(), doc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.fontPrefs.AvailFonts));
+		return it->readStyles(m_fileName, doc, docParagraphStyles);
+	}
+	return false;
+}
+
+bool FileLoader::readCharStyles(ScribusDoc* doc, StyleSet<CharStyle> &docCharStyles)
+{
+	QList<FileFormat>::const_iterator it;
+	if (findFormat(m_fileType, it)) {
+		it->plug->setupTargets(doc, 0, doc->scMW(), doc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.fontPrefs.AvailFonts));
+		return it->readCharStyles(m_fileName, doc, docCharStyles);
+	}
+	return false;
+}
+
+bool FileLoader::readColors(ColorList & colors)
+{
+	QList<FileFormat>::const_iterator it;
+	if (findFormat(m_fileType, it))
+		return it->readColors(m_fileName, colors);
+	return false;
+}
+
+bool FileLoader::readPageCount(int *num1, int *num2, QStringList & masterPageNames)
+{
+	QList<FileFormat>::const_iterator it;
+	if (findFormat(m_fileType, it))
+		return it->readPageCount(m_fileName, num1, num2, masterPageNames);
+	return false;
+}
+
+bool FileLoader::readLineStyles(QMap<QString,multiLine> *Sty)
+{
+	QList<FileFormat>::const_iterator it;
+	if (findFormat(m_fileType, it))
+		return it->readLineStyles(m_fileName, Sty);
 	return false;
 }
 
@@ -473,11 +386,11 @@
 		}
 }
 
-QImage FileLoader::ReadThumbnail(const QString& fileName)
-{
-	QList<FileFormat>::const_iterator it;
-	if (findFormat(FileType, it))
-		return (*it).readThumbnail(fileName);
+QImage FileLoader::readThumbnail()
+{
+	QList<FileFormat>::const_iterator it;
+	if (findFormat(m_fileType, it))
+		return it->readThumbnail(m_fileName);
 	return QImage();
 }
 
@@ -494,48 +407,8 @@
 			currDoc->docHyphenator->MinWordLen=currDoc->hyphMinimumWordLength();
 			currDoc->docHyphenator->HyCount=currDoc->hyphConsecutiveLines();
 	}
-/*	for (uint d = 0; d < ScMW->doc->MasterItems.count(); ++d)
-	{
-		PageItem *it = ScMW->doc->MasterItems.at(d);
-		if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText))
-		{
-			for (uint e = 0; e < it->itemText.count(); ++e)
-			{
-				ScText *hl = it->itemText.at(e);
-				if ((hl->ch == QChar(25)) && ((int)hl->cembedded != -1))
-					hl->cembedded = ScMW->doc->FrameItems.at((int)hl->cembedded);
-				else
-					hl->cembedded = 0;
-			}
-		}
-	}
-	for (uint d = 0; d < ScMW->doc->DocItems.count(); ++d)
-	{
-		PageItem *it = ScMW->doc->DocItems.at(d);
-		if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText))
-		{
-			for (uint e = 0; e < it->itemText.count(); ++e)
-			{
-				ScText *hl = it->itemText.at(e);
-				if ((hl->ch == QChar(25)) && ((int)hl->cembedded != -1))
-					hl->cembedded = ScMW->doc->FrameItems.at((int)hl->cembedded);
-				else
-					hl->cembedded = 0;
-			}
-		}
-	} */
-	//FIXME: this goes into scribusdoc
-	//ResourceCollection rsc;
-	//currDoc->getNamedResources(rsc);
-	//ReplacedFonts.clear();
-	//QMap<QString,QString>::ConstIterator it;
-	//for (it = rsc.fonts().begin(); it != rsc.fonts().end(); ++it)
-	//{
-	//	const ScFace& font (rsc.availableFonts->findFont(it.key(), currDoc));
-	//	if (font.isReplacement() )
-	//		ReplacedFonts[it.key()] = font.replacementName();
-	//}
-		ReplacedFonts = currDoc->AllFonts->getSubstitutions(ReplacedFonts.keys());
+
+	ReplacedFonts = currDoc->AllFonts->getSubstitutions(ReplacedFonts.keys());
 	if (ReplacedFonts.count() != 0)
 	{
 		if ((prefsManager->appPrefs.fontPrefs.askBeforeSubstitute))
@@ -562,61 +435,6 @@
 				return false;
 			}
 		}
-		/*
-		for (uint d = 0; d < currDoc->MasterItems.count(); ++d)
-		{
-			replaceFonts(currDoc, currDoc->MasterItems.at(d), currDoc->UsedFonts, ReplacedFonts);
-		}
-		for (uint d = 0; d < currDoc->DocItems.count(); ++d)
-		{
-			replaceFonts(currDoc, currDoc->DocItems.at(d), currDoc->UsedFonts, ReplacedFonts);
-		}
-		for (uint d = 0; d < currDoc->FrameItems.count(); ++d)
-		{
-			replaceFonts(currDoc, currDoc->FrameItems.at(d), currDoc->UsedFonts, ReplacedFonts);
-		}
-		for (uint a = 0; a < currDoc->paragraphStyles().count(); ++a)
-		{
-			if ( !currDoc->paragraphStyles()[a].charStyle().font().isNone() 
-				 && !currDoc->UsedFonts.contains(currDoc->paragraphStyles()[a].charStyle().font().scName()))
-			{
-//				currDoc->paragraphStyles()[a].charStyle().setFont
-//					((*currDoc->AllFonts)[ReplacedFonts[currDoc->paragraphStyles()[a].charStyle().font().scName()]]);
-			}
-		}
-		QList<QString> tmpList;
-		tmpList.clear();
-		for (int fe = 0; fe < currDoc->PDF_Options.EmbedList.count(); ++fe)
-		{
-			if (ReplacedFonts.contains(currDoc->PDF_Options.EmbedList[fe]))
-				tmpList.append(ReplacedFonts[currDoc->PDF_Options.EmbedList[fe]]);
-			else
-				tmpList.append(currDoc->PDF_Options.EmbedList[fe]);
-		}
-		currDoc->PDF_Options.EmbedList = tmpList;
-		tmpList.clear();
-		for (int fe = 0; fe < currDoc->PDF_Options.SubsetList.count(); ++fe)
-		{
-			if (ReplacedFonts.contains(currDoc->PDF_Options.SubsetList[fe]))
-				tmpList.append(ReplacedFonts[currDoc->PDF_Options.SubsetList[fe]]);
-			else
-				tmpList.append(currDoc->PDF_Options.SubsetList[fe]);
-		}
-		currDoc->PDF_Options.SubsetList = tmpList;
-		QMap<QString,QString>::Iterator itfsu;
-		for (itfsu = ReplacedFonts.begin(); itfsu != ReplacedFonts.end(); ++itfsu)
-		{
-			if (!currDoc->UsedFonts.contains(itfsu.data()))
-			{
-//				QFont fo = prefsManager->appPrefs.AvailFonts[itfsu.data()]->Font;
-//				fo.setPointSize(qRound(ScMW->doc->toolSettings.textSize / 10.0));
-				currDoc->AddFont(itfsu.data(), qRound(currDoc->toolSettings.textSize / 10.0));
-			}
-		}
-		if (prefsManager->appPrefs.askBeforeSubstituite)
-			ReplacedFonts.clear();
-		dummyScFaces.clear();
-		*/
 	}
 
 	return true;
@@ -644,7 +462,7 @@
 	QList<FileFormat>::const_iterator itEnd(fileFormats.constEnd());
 	for ( ; it != itEnd ; ++it )
 	{
-		if (formatId==(*it).formatId)
+		if (formatId == it->formatId)
 			return true;
 	}
 	return false;

Modified: trunk/Scribus/scribus/fileloader.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17326&path=/trunk/Scribus/scribus/fileloader.h
==============================================================================
--- trunk/Scribus/scribus/fileloader.h (original)
+++ trunk/Scribus/scribus/fileloader.h Thu Feb 23 20:27:50 2012
@@ -32,21 +32,22 @@
 public:
 	FileLoader(const QString & fileName);
 	~FileLoader() {};
-	int TestFile();
-// 	int CheckScribus();
-	bool LoadPage(ScribusDoc* currDoc, int PageToLoad, bool Mpage, QString renamedPageName=QString::null);
-	bool LoadFile(ScribusDoc* currDoc);
-	bool SaveFile(const QString& fileName, ScribusDoc *doc, QString *savedFile = NULL);
-	bool ReadStyles(const QString& fileName, ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles);
-	bool ReadCharStyles(const QString& fileName, ScribusDoc* doc, StyleSet<CharStyle> &docCharStyles);
-	bool ReadPageCount(const QString& fileName, int *num1, int *num2, QStringList & masterPageNames);
-	bool ReadColors(const QString& fileName, ColorList & colors);
-	bool ReadLineStyles(const QString& fileName, QMap<QString,multiLine> *Sty);
-	QImage ReadThumbnail(const QString& fileName);
+
+	int  fileType() const { return m_fileType; }
+	int  testFile();
+
+	bool loadPage(ScribusDoc* currDoc, int PageToLoad, bool Mpage, QString renamedPageName=QString::null);
+	bool loadFile(ScribusDoc* currDoc);
+	bool saveFile(const QString& fileName, ScribusDoc *doc, QString *savedFile = NULL);
+	bool readStyles(ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles);
+	bool readCharStyles(ScribusDoc* doc, StyleSet<CharStyle> &docCharStyles);
+	bool readPageCount(int *num1, int *num2, QStringList & masterPageNames);
+	bool readColors(ColorList & colors);
+	bool readLineStyles(QMap<QString,multiLine> *Sty);
+	QImage readThumbnail();
 	bool postLoad(ScribusDoc* currDoc);
  	void informReplacementFonts();
-	QString FileName;
-	int FileType;
+
 	const FileFormat * const formatSLA12x;
 	const FileFormat * const formatSLA13x;
 	const FileFormat * const formatSLA134;
@@ -55,9 +56,6 @@
 	const FileFormat * const formatSVG;
 	const FileFormat * const formatSXD;
 	const FileFormat * const formatODG;
- 	QList<int> LFrames;
-	QMap<uint,QString> DoVorl;
-	uint VorlC;
 
 	static const QString getLoadFilterString();
 private:
@@ -66,8 +64,9 @@
 	void readParagraphStyle(ParagraphStyle& vg, const QDomElement& pg, SCFonts &avail, ScribusDoc *doc);
 	bool findFormat(uint formatId, QList<FileFormat>::const_iterator &it);
 	PrefsManager* prefsManager;
-	double maximumX;
-	double maximumY;
+
+	QString m_fileName;
+	int     m_fileType;
 };
 
 #endif

Modified: trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17326&path=/trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp (original)
+++ trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp Thu Feb 23 20:27:50 2012
@@ -87,7 +87,7 @@
 	if (allFormatsV.contains(ext.toUtf8()))
 	{
 		FileLoader *fileLoader = new FileLoader(path);
-		int testResult = fileLoader->TestFile();
+		int testResult = fileLoader->testFile();
 		delete fileLoader;
 		if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
 		{

Modified: trunk/Scribus/scribus/plugins/scriptplugin/svgimport.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17326&path=/trunk/Scribus/scribus/plugins/scriptplugin/svgimport.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/svgimport.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/svgimport.cpp Thu Feb 23 20:27:50 2012
@@ -40,7 +40,7 @@
 		return NULL;
 	}
 	FileLoader *fileLoader = new FileLoader(fName);
-	int testResult = fileLoader->TestFile();
+	int testResult = fileLoader->testFile();
 	delete fileLoader;
 	if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
 	{

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17326&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Thu Feb 23 20:27:50 2012
@@ -3344,7 +3344,7 @@
 		if (vectorFiles.contains(fi.suffix().toLower()))
 		{
 			FileLoader *fileLoader = new FileLoader(data);
-			int testResult = fileLoader->TestFile();
+			int testResult = fileLoader->testFile();
 			delete fileLoader;
 			if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
 			{
@@ -3465,7 +3465,7 @@
 		else
 		{
 			FileLoader *fileLoader = new FileLoader(fileName);
-			int testResult = fileLoader->TestFile();
+			int testResult = fileLoader->testFile();
 			delete fileLoader;
 			if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
 			{
@@ -3665,14 +3665,14 @@
 	if (!fileName.isEmpty())
 	{
 		FileLoader *fl = new FileLoader(fileName);
-		if (fl->TestFile() == -1)
+		if (fl->testFile() == -1)
 		{
 			delete fl;
 			return false;
 		}
 		doc->setLoading(true);
 		uint oldItemsCount = doc->Items->count();
-		if(!fl->LoadPage(doc, Nr, Mpa, renamedPageName))
+		if(!fl->loadPage(doc, Nr, Mpa, renamedPageName))
 		{
 			delete fl;
 			doc->setLoading(false);
@@ -3772,7 +3772,7 @@
 	{
 		QString FName = fi.absoluteFilePath();
 		FileLoader *fileLoader = new FileLoader(FName);
-		int testResult=fileLoader->TestFile();
+		int testResult = fileLoader->testFile();
 		if (testResult == -1)
 		{
 			delete fileLoader;
@@ -3822,11 +3822,11 @@
 		doc->SoftProofing = false;
 		doc->Gamut = false;
 		setScriptRunning(true);
-		bool loadSuccess=fileLoader->LoadFile(doc);
+		bool loadSuccess = fileLoader->loadFile(doc);
 		//Do the font replacement check from here, when we have a GUI. TODO do this also somehow without the GUI
 		//This also gives the user the opportunity to cancel the load when finding theres a replacement required.
 		if (loadSuccess && ScCore->usingGUI())
-			loadSuccess=fileLoader->postLoad(doc);
+			loadSuccess = fileLoader->postLoad(doc);
 		if(!loadSuccess)
 		{
 			view->close();
@@ -3982,7 +3982,7 @@
 		}
 //		propertiesPalette->updateColorList();
 //		propertiesPalette->Cpal->displayGradient(0);
-		if (fileLoader->FileType > FORMATID_NATIVEIMPORTEND)
+		if (fileLoader->fileType() > FORMATID_NATIVEIMPORTEND)
 		{
 			doc->setName(FName+ tr("(converted)"));
 			QFileInfo fi(doc->DocName);
@@ -9231,7 +9231,7 @@
 				if (doc->DocName.right(2) == "gz")
 					emName += ".gz";
 				FileLoader fl(emName);
-				fl.SaveFile(emName, doc, 0);
+				fl.saveFile(emName, doc, 0);
 			}
 			view->close();
 			uint numPages=doc->Pages->count();
@@ -9533,7 +9533,7 @@
 			{
 				QUrl url( fileUrls[i] );
 				FileLoader *fileLoader = new FileLoader(url.path());
-				int testResult = fileLoader->TestFile();
+				int testResult = fileLoader->testFile();
 				delete fileLoader;
 				if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
 				{
@@ -9602,7 +9602,7 @@
 			{
 				QUrl url( fileUrls[i] );
 				FileLoader *fileLoader = new FileLoader(url.path());
-				int testResult = fileLoader->TestFile();
+				int testResult = fileLoader->testFile();
 				delete fileLoader;
 				if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
 				{

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17326&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Thu Feb 23 20:27:50 2012
@@ -1501,21 +1501,21 @@
 	if (!fileName.isEmpty())
 	{
 		FileLoader fl(fileName);
-		if (fl.TestFile() == -1)
+		if (fl.testFile() == -1)
 		//TODO put in nice user warning
 			return;
 
-		if (!fl.ReadStyles(fileName, this, *wrkStyles))
+		if (!fl.readStyles(this, *wrkStyles))
 		{
 			//TODO put in nice user warning
 		}
 
-		if (!fl.ReadCharStyles(fileName, this, *wrkCharStyles))
+		if (!fl.readCharStyles(this, *wrkCharStyles))
 		{
 			//TODO put in nice user warning
 		}
 
-		if (!fl.ReadLineStyles(fileName, wrkLineStyles))
+		if (!fl.readLineStyles(wrkLineStyles))
 		{
 			//TODO put in nice user warning
 		}
@@ -1538,21 +1538,21 @@
 	if (!fileName.isEmpty())
 	{
 		FileLoader fl(fileName);
-		if (fl.TestFile() == -1)
+		if (fl.testFile() == -1)
 		//TODO put in nice user warning
 			return;
 
-		if (!fl.ReadStyles(fileName, this, *wrkStyles))
+		if (!fl.readStyles(this, *wrkStyles))
 		{
 			//TODO put in nice user warning
 		}
 
-		if (!fl.ReadCharStyles(fileName, this, *wrkCharStyles))
+		if (!fl.readCharStyles(this, *wrkCharStyles))
 		{
 			//TODO put in nice user warning
 		}
 
-		if (!fl.ReadLineStyles(fileName, wrkLineStyles))
+		if (!fl.readLineStyles(wrkLineStyles))
 		{
 			//TODO put in nice user warning
 		}
@@ -4175,7 +4175,7 @@
 		mainWindowProgressBar->reset();
 	}
 	FileLoader fl(fileName);
-	bool ret = fl.SaveFile(fileName, this, savedFile);
+	bool ret = fl.saveFile(fileName, this, savedFile);
 	if (ret)
 	{
 		setName(fileName);

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17326&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Thu Feb 23 20:27:50 2012
@@ -928,7 +928,7 @@
 			else
 			{
 				FileLoader *fileLoader = new FileLoader(url.toLocalFile());
-				int testResult = fileLoader->TestFile();
+				int testResult = fileLoader->testFile();
 				delete fileLoader;
 				if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
 					vectorFile = true;
@@ -1008,7 +1008,7 @@
 					else
 					{
 						FileLoader *fileLoader = new FileLoader(url.toLocalFile());
-						int testResult = fileLoader->TestFile();
+						int testResult = fileLoader->testFile();
 						delete fileLoader;
 						if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
 						{

Modified: trunk/Scribus/scribus/scribuswin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17326&path=/trunk/Scribus/scribus/scribuswin.cpp
==============================================================================
--- trunk/Scribus/scribus/scribuswin.cpp (original)
+++ trunk/Scribus/scribus/scribuswin.cpp Thu Feb 23 20:27:50 2012
@@ -99,7 +99,7 @@
 		//instead of overwriting source document
 		//moveFile(m_Doc->DocName, m_Doc->DocName+".bak");
 		FileLoader fl(m_Doc->DocName);
-		if (fl.SaveFile(m_Doc->DocName+".autosave", m_Doc, 0))
+		if (fl.saveFile(m_Doc->DocName+".autosave", m_Doc, 0))
 		{
 			//#8081 related : do not unset modified flag until user really save file
 			//m_Doc->setModified(false);

Modified: trunk/Scribus/scribus/ui/customfdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17326&path=/trunk/Scribus/scribus/ui/customfdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/customfdialog.cpp (original)
+++ trunk/Scribus/scribus/ui/customfdialog.cpp Thu Feb 23 20:27:50 2012
@@ -199,7 +199,7 @@
 	else if (allFormatsV.contains(ext.toUtf8()))
 	{
 		FileLoader *fileLoader = new FileLoader(name);
-		int testResult = fileLoader->TestFile();
+		int testResult = fileLoader->testFile();
 		delete fileLoader;
 		if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
 		{

Modified: trunk/Scribus/scribus/ui/mergedoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17326&path=/trunk/Scribus/scribus/ui/mergedoc.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/mergedoc.cpp (original)
+++ trunk/Scribus/scribus/ui/mergedoc.cpp Thu Feb 23 20:27:50 2012
@@ -145,15 +145,15 @@
 			dirs->set("merge", fn.left(fn.lastIndexOf("/")));
 			qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
 			FileLoader fl(fn);
-			if (fl.TestFile() == -1)
+			if (fl.testFile() == -1)
 			//TODO put in nice user warning
 				return;
 			QStringList masterPageNames;
 			bool ret = false;
 			if (masterPages)
-				ret = fl.ReadPageCount(fn, &dummy, &count, masterPageNames);
+				ret = fl.readPageCount(&dummy, &count, masterPageNames);
 			else
-				ret = fl.ReadPageCount(fn, &count, &dummy, masterPageNames);
+				ret = fl.readPageCount(&count, &dummy, masterPageNames);
 			qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
 			if ((ret) && (count != 0))
 			{

Modified: trunk/Scribus/scribus/ui/paintmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17326&path=/trunk/Scribus/scribus/ui/paintmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/paintmanager.cpp (original)
+++ trunk/Scribus/scribus/ui/paintmanager.cpp Thu Feb 23 20:27:50 2012
@@ -1296,7 +1296,7 @@
 	else
 	{
 		FileLoader *fileLoader = new FileLoader(data);
-		int testResult = fileLoader->TestFile();
+		int testResult = fileLoader->testFile();
 		delete fileLoader;
 		if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
 		{

Modified: trunk/Scribus/scribus/ui/scrapbookpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17326&path=/trunk/Scribus/scribus/ui/scrapbookpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrapbookpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/scrapbookpalette.cpp Thu Feb 23 20:27:50 2012
@@ -153,7 +153,7 @@
 			if (vectorFiles.contains(fi.suffix().toLower()))
 			{
 				FileLoader *fileLoader = new FileLoader(url.path());
-				int testResult = fileLoader->TestFile();
+				int testResult = fileLoader->testFile();
 				delete fileLoader;
 				if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT) && (fi.exists()))
 					emit fileDropped(url.path(), testResult);
@@ -451,7 +451,7 @@
 				else
 				{
 					FileLoader *fileLoader = new FileLoader(QDir::cleanPath(QDir::toNativeSeparators(name + "/" + d4[dc])));
-					int testResult = fileLoader->TestFile();
+					int testResult = fileLoader->testFile();
 					delete fileLoader;
 					if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
 					{

Modified: trunk/Scribus/scribus/ui/stylemanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17326&path=/trunk/Scribus/scribus/ui/stylemanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/stylemanager.cpp (original)
+++ trunk/Scribus/scribus/ui/stylemanager.cpp Thu Feb 23 20:27:50 2012
@@ -410,13 +410,13 @@
 			if (!neededColors.isEmpty())
 			{
 				FileLoader fl(selectedFile);
-				if (fl.TestFile() == -1)
+				if (fl.testFile() == -1)
 				{ //TODO put in nice user warning
 					delete dia2;
 					return;
 				}
 				ColorList LColors;
-				if (fl.ReadColors(selectedFile, LColors))
+				if (fl.readColors(LColors))
 				{
 					ColorList::Iterator itc;
 					for (itc = LColors.begin(); itc != LColors.end(); ++itc)

Modified: trunk/Scribus/scribus/util_color.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17326&path=/trunk/Scribus/scribus/util_color.cpp
==============================================================================
--- trunk/Scribus/scribus/util_color.cpp (original)
+++ trunk/Scribus/scribus/util_color.cpp Thu Feb 23 20:27:50 2012
@@ -718,11 +718,11 @@
 			if (allFormatsV.contains(ext))
 			{
 				FileLoader fl(fileName);
-				int testResult = fl.TestFile();
+				int testResult = fl.testFile();
 				if (testResult != -1)
 				{
 					ColorList LColors;
-					if (fl.ReadColors(fileName, LColors))
+					if (fl.readColors(LColors))
 					{
 						ColorList::Iterator it;
 						for (it = LColors.begin(); it != LColors.end(); ++it)




More information about the scribus-commit mailing list