r18603 by fschmid - XPS Importer: Fixed parsing of Open XML Paper (oxps) files.
scribus-commit
scribus-commit at lists.scribus.net
Tue Nov 26 19:30:45 UTC 2013
Author: fschmid
Date: Tue Nov 26 19:30:45 2013
New Revision: 18603
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18603
Log:
XPS Importer: Fixed parsing of Open XML Paper (oxps) files.
Modified:
trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
trunk/Scribus/scribus/plugins/import/xps/importxpsplugin.cpp
Modified: trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18603&path=/trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xps/importxps.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/xps/importxps.cpp Tue Nov 26 19:30:45 2013
@@ -491,7 +491,10 @@
else
{
if (!PageReference.startsWith(path))
+ {
PageReference = path + "/" + PageReference;
+ PageReference = QDir::cleanPath(PageReference);
+ }
parsePageReference(PageReference);
}
}
@@ -545,7 +548,10 @@
else
{
if (!PageReference.startsWith(path))
+ {
PageReference = path + "/" + PageReference;
+ PageReference = QDir::cleanPath(PageReference);
+ }
parsePageReference(PageReference);
}
}
@@ -648,7 +654,10 @@
else
{
if (!resFile.startsWith(path))
+ {
resFile = path + "/" + resFile;
+ resFile = QDir::cleanPath(resFile);
+ }
parseResourceFile(resFile);
}
}
@@ -813,7 +822,10 @@
else
{
if (!fontUrl.startsWith(path))
+ {
fontUrl = path + "/" + fontUrl;
+ fontUrl = QDir::cleanPath(fontUrl);
+ }
}
ScFace iteFont = loadFontByName(fontUrl);
if (iteFont.usable())
@@ -1123,7 +1135,10 @@
else
{
if (!resFile.startsWith(path))
+ {
resFile = path + "/" + resFile;
+ resFile = QDir::cleanPath(resFile);
+ }
parseResourceFile(resFile);
}
}
@@ -1201,7 +1216,7 @@
retObj->OldH2 = retObj->height();
}
if ((obState.transform.dx() != 0.0) || (obState.transform.dy() != 0))
- retObj->moveBy((double)obState.transform.dx(), (double)obState.transform.dy(), true);
+ retObj->moveBy((double)(obState.transform.dx() * obState.transform.m11()) * conversionFactor, (double)(obState.transform.dy() * obState.transform.m22()) * conversionFactor, true);
if (obState.maskTyp != 0)
{
double xp = retObj->xPos() - m_Doc->currentPage()->xOffset();
@@ -1304,7 +1319,10 @@
else
{
if (!obState.imagePath.startsWith(path))
+ {
obState.imagePath = path + "/" + obState.imagePath;
+ obState.imagePath = QDir::cleanPath(obState.imagePath);
+ }
}
if (eog.hasAttribute("Opacity"))
{
Modified: trunk/Scribus/scribus/plugins/import/xps/importxpsplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18603&path=/trunk/Scribus/scribus/plugins/import/xps/importxpsplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xps/importxpsplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/xps/importxpsplugin.cpp Tue Nov 26 19:30:45 2013
@@ -60,6 +60,9 @@
FileFormat* fmt = getFormatByExt("xps");
fmt->trName = tr("Microsoft XPS");
fmt->filter = tr("Microsoft XPS (*.xps *.XPS)");
+ FileFormat* fmt2 = getFormatByExt("oxps");
+ fmt2->trName = tr("Open XML Paper");
+ fmt2->filter = tr("Open XML Paper (*.oxps *.OXPS)");
}
ImportXpsPlugin::~ImportXpsPlugin()
@@ -77,8 +80,8 @@
{
AboutData* about = new AboutData;
about->authors = "Franz Schmid <franz at scribus.info>";
- about->shortDescription = tr("Imports XPS Files");
- about->description = tr("Imports most XPS files into the current document,\nconverting their vector data into Scribus objects.");
+ about->shortDescription = tr("Imports XPS and Open XML Paper Files");
+ about->description = tr("Imports most XPS and Open XML Paper files into the current document,\nconverting their vector data into Scribus objects.");
about->license = "GPL";
Q_CHECK_PTR(about);
return about;
@@ -101,10 +104,23 @@
fmt.save = false;
fmt.thumb = true;
fmt.colorReading = false;
- fmt.mimeTypes = QStringList() << "application/oxps" << "application/vnd.ms-xpsdocument";
+ fmt.mimeTypes = QStringList() << "application/vnd.ms-xpsdocument";
fmt.mimeTypes.append("");
fmt.priority = 64; // Priority
registerFormat(fmt);
+ FileFormat fmt2(this);
+ fmt2.trName = tr("Open XML Paper");
+ fmt2.filter = tr("Open XML Paper (*.oxps *.OXPS)");
+ fmt2.formatId = 0;
+ fmt2.fileExtensions = QStringList() << "oxps";
+ fmt2.load = true;
+ fmt2.save = false;
+ fmt2.thumb = true;
+ fmt2.colorReading = false;
+ fmt2.mimeTypes = QStringList() << "application/oxps";
+ fmt2.mimeTypes.append("");
+ fmt2.priority = 64; // Priority
+ registerFormat(fmt2);
}
bool ImportXpsPlugin::fileSupported(QIODevice* /* file */, const QString & fileName) const
@@ -127,7 +143,7 @@
flags |= lfInteractive;
PrefsContext* prefs = PrefsManager::instance()->prefsFile->getPluginContext("importxps");
QString wdir = prefs->get("wdir", ".");
- CustomFDialog diaf(ScCore->primaryMainWindow(), wdir, QObject::tr("Open"), tr("All Supported Formats")+" (*.xps *.XPS);;All Files (*)");
+ CustomFDialog diaf(ScCore->primaryMainWindow(), wdir, QObject::tr("Open"), tr("All Supported Formats")+" (*.oxps *.OXPS *.xps *.XPS);;All Files (*)");
if (diaf.exec())
{
fileName = diaf.selectedFile();
More information about the scribus-commit
mailing list