r17325 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:21:58 UTC 2012
Author: jghali
Date: Thu Feb 23 20:21:58 2012
New Revision: 17325
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17325
Log:
#10393: opening sla from symbolic link breaks relative paths to graphics (+ some refactoring of FileLoader)
Modified:
branches/Version14x/Scribus/scribus/canvasmode_legacy.cpp
branches/Version14x/Scribus/scribus/canvasmode_normal.cpp
branches/Version14x/Scribus/scribus/fileloader.cpp
branches/Version14x/Scribus/scribus/fileloader.h
branches/Version14x/Scribus/scribus/mergedoc.cpp
branches/Version14x/Scribus/scribus/patterndialog.cpp
branches/Version14x/Scribus/scribus/scribus.cpp
branches/Version14x/Scribus/scribus/scribusdoc.cpp
branches/Version14x/Scribus/scribus/scribusview.cpp
branches/Version14x/Scribus/scribus/scribuswin.cpp
branches/Version14x/Scribus/scribus/stylemanager.cpp
branches/Version14x/Scribus/scribus/util_color.cpp
Modified: branches/Version14x/Scribus/scribus/canvasmode_legacy.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17325&path=/branches/Version14x/Scribus/scribus/canvasmode_legacy.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/canvasmode_legacy.cpp (original)
+++ branches/Version14x/Scribus/scribus/canvasmode_legacy.cpp Thu Feb 23 20:21:58 2012
@@ -5031,7 +5031,7 @@
else
{
FileLoader *fileLoader = new FileLoader(fileName);
- int testResult = fileLoader->TestFile();
+ int testResult = fileLoader->testFile();
delete fileLoader;
if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
{
Modified: branches/Version14x/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17325&path=/branches/Version14x/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/canvasmode_normal.cpp (original)
+++ branches/Version14x/Scribus/scribus/canvasmode_normal.cpp Thu Feb 23 20:21:58 2012
@@ -1374,7 +1374,7 @@
else
{
FileLoader *fileLoader = new FileLoader(fileName);
- int testResult = fileLoader->TestFile();
+ int testResult = fileLoader->testFile();
delete fileLoader;
if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
{
Modified: branches/Version14x/Scribus/scribus/fileloader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17325&path=/branches/Version14x/Scribus/scribus/fileloader.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/fileloader.cpp (original)
+++ branches/Version14x/Scribus/scribus/fileloader.cpp Thu Feb 23 20:21:58 2012
@@ -60,8 +60,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)),
@@ -69,8 +67,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
@@ -87,9 +90,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;
@@ -100,143 +103,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.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.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)
- {
- (*it).plug->setupTargets(currDoc, 0, currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
- ret=(*it).plug->loadPage(FileName, PageToLoad, Mpage, renamedPageName);
+// it->plug->getReplacedFontData(newReplacement, ReplacedFonts, dummyScFaces);
+ }
+ if (m_fileType == FORMATID_SLA13XIMPORT || m_fileType == FORMATID_SLA134IMPORT)
+ {
+ it->plug->setupTargets(currDoc, 0, currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.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.defSize / 10.0));
- currDoc->AddFont(itfsu.data(), qRound(currDoc->toolSettings.defSize / 10.0));
- }
- }
- if (prefsManager->appPrefs.askBeforeSubstituite)
- ReplacedFonts.clear();
-// dummyScFaces.clear();
- }
- */
return ret;
}
@@ -248,7 +162,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->guidesSettings.marginsShown = prefsManager->appPrefs.guidesSettings.marginsShown;
@@ -271,38 +185,38 @@
//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"),FileType,it->trName);
+ switch (m_fileType)
{
case FORMATID_SLA12XIMPORT:
{
- (*it).setupTargets(currDoc, currDoc->view(), currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
- ret=(*it).loadFile(FileName, LoadSavePlugin::lfCreateDoc);
+ it->setupTargets(currDoc, currDoc->view(), currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.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:
{
- (*it).setupTargets(currDoc, 0, currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.AvailFonts));
- ret=(*it).loadFile(FileName, LoadSavePlugin::lfCreateDoc);
+ it->setupTargets(currDoc, 0, currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.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.AvailFonts));
- ret = (*it).loadFile(FileName, LoadSavePlugin::lfCreateDoc);
+ it->setupTargets(currDoc, currDoc->view(), currDoc->scMW(), currDoc->scMW()->mainWindowProgressBar, &(prefsManager->appPrefs.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;
@@ -316,48 +230,48 @@
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.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.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.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.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;
}
@@ -458,48 +372,8 @@
currDoc->docHyphenator->MinWordLen=currDoc->MinWordLen;
currDoc->docHyphenator->HyCount=currDoc->HyCount;
}
-/* 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.askBeforeSubstituite))
@@ -526,61 +400,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.defSize / 10.0));
- currDoc->AddFont(itfsu.data(), qRound(currDoc->toolSettings.defSize / 10.0));
- }
- }
- if (prefsManager->appPrefs.askBeforeSubstituite)
- ReplacedFonts.clear();
- dummyScFaces.clear();
- */
}
return true;
@@ -608,7 +427,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: branches/Version14x/Scribus/scribus/fileloader.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17325&path=/branches/Version14x/Scribus/scribus/fileloader.h
==============================================================================
--- branches/Version14x/Scribus/scribus/fileloader.h (original)
+++ branches/Version14x/Scribus/scribus/fileloader.h Thu Feb 23 20:21:58 2012
@@ -32,20 +32,21 @@
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);
+
+ 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);
bool postLoad(ScribusDoc* currDoc);
void informReplacementFonts();
- QString FileName;
- int FileType;
+
const FileFormat * const formatSLA12x;
const FileFormat * const formatSLA13x;
const FileFormat * const formatSLA134;
@@ -53,9 +54,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:
@@ -63,9 +61,11 @@
bool newReplacement;
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: branches/Version14x/Scribus/scribus/mergedoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17325&path=/branches/Version14x/Scribus/scribus/mergedoc.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/mergedoc.cpp (original)
+++ branches/Version14x/Scribus/scribus/mergedoc.cpp Thu Feb 23 20:21:58 2012
@@ -143,15 +143,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: branches/Version14x/Scribus/scribus/patterndialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17325&path=/branches/Version14x/Scribus/scribus/patterndialog.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/patterndialog.cpp (original)
+++ branches/Version14x/Scribus/scribus/patterndialog.cpp Thu Feb 23 20:21:58 2012
@@ -368,7 +368,7 @@
else
{
FileLoader *fileLoader = new FileLoader(data);
- int testResult = fileLoader->TestFile();
+ int testResult = fileLoader->testFile();
delete fileLoader;
if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
{
Modified: branches/Version14x/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17325&path=/branches/Version14x/Scribus/scribus/scribus.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scribus.cpp (original)
+++ branches/Version14x/Scribus/scribus/scribus.cpp Thu Feb 23 20:21:58 2012
@@ -3646,7 +3646,7 @@
else
{
FileLoader *fileLoader = new FileLoader(fileName);
- int testResult = fileLoader->TestFile();
+ int testResult = fileLoader->testFile();
delete fileLoader;
if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT))
{
@@ -3845,14 +3845,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);
@@ -3949,7 +3949,7 @@
{
QString FName = fi.absoluteFilePath();
FileLoader *fileLoader = new FileLoader(FName);
- int testResult=fileLoader->TestFile();
+ int testResult = fileLoader->testFile();
if (testResult == -1)
{
delete fileLoader;
@@ -3999,11 +3999,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();
@@ -4158,7 +4158,7 @@
}
// propertiesPalette->updateColorList();
// propertiesPalette->Cpal->ChooseGrad(0);
- if (fileLoader->FileType > FORMATID_NATIVEIMPORTEND)
+ if (fileLoader->fileType() > FORMATID_NATIVEIMPORTEND)
{
doc->setName(FName+ tr("(converted)"));
QFileInfo fi(doc->DocName);
@@ -9232,7 +9232,7 @@
std::cout << "Saving: " << doc->DocName.toStdString() << ".emergency" << std::endl;
doc->autoSaveTimer->stop();
FileLoader fl(doc->DocName+".emergency");
- fl.SaveFile(doc->DocName+".emergency", doc, 0);
+ fl.saveFile(doc->DocName+".emergency", doc, 0);
}
view->close();
uint numPages=doc->Pages->count();
@@ -9553,7 +9553,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))
{
@@ -9591,7 +9591,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: branches/Version14x/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17325&path=/branches/Version14x/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scribusdoc.cpp (original)
+++ branches/Version14x/Scribus/scribus/scribusdoc.cpp Thu Feb 23 20:21:58 2012
@@ -1182,21 +1182,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
}
@@ -1219,21 +1219,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
}
@@ -3517,7 +3517,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: branches/Version14x/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17325&path=/branches/Version14x/Scribus/scribus/scribusview.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scribusview.cpp (original)
+++ branches/Version14x/Scribus/scribus/scribusview.cpp Thu Feb 23 20:21:58 2012
@@ -941,7 +941,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;
@@ -1041,7 +1041,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: branches/Version14x/Scribus/scribus/scribuswin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17325&path=/branches/Version14x/Scribus/scribus/scribuswin.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scribuswin.cpp (original)
+++ branches/Version14x/Scribus/scribus/scribuswin.cpp Thu Feb 23 20:21:58 2012
@@ -96,7 +96,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: branches/Version14x/Scribus/scribus/stylemanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17325&path=/branches/Version14x/Scribus/scribus/stylemanager.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/stylemanager.cpp (original)
+++ branches/Version14x/Scribus/scribus/stylemanager.cpp Thu Feb 23 20:21:58 2012
@@ -409,13 +409,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: branches/Version14x/Scribus/scribus/util_color.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17325&path=/branches/Version14x/Scribus/scribus/util_color.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/util_color.cpp (original)
+++ branches/Version14x/Scribus/scribus/util_color.cpp Thu Feb 23 20:21:58 2012
@@ -734,11 +734,11 @@
else
{
FileLoader fl(fileName);
- int test = fl.TestFile();
+ int test = fl.testFile();
if ((test == FORMATID_SLA134IMPORT) || (test == FORMATID_SLA13XIMPORT) || (test == FORMATID_SLA12XIMPORT))
{
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