Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 12390 → Rev 12391

/branches/Version133x/Scribus/scribus/pdflib.cpp
201,9 → 201,9
if (!abortExport)
{
if (doc.PDF_Options.Version == PDFOptions::PDFVersion_X3)
PDF_End_Doc(ScMW->PrinterProfiles[doc.PDF_Options.PrintProf], nam, Components);
ret = PDF_End_Doc(ScMW->PrinterProfiles[doc.PDF_Options.PrintProf], nam, Components);
else
PDF_End_Doc();
ret = PDF_End_Doc();
}
else
closeAndCleanup();
5682,7 → 5682,7
return "";
}
 
void PDFlib::PDF_End_Doc(const QString& PrintPr, const QString& Name, int Components)
bool PDFlib::PDF_End_Doc(const QString& PrintPr, const QString& Name, int Components)
{
QString tmp;
uint StX;
6066,13 → 6066,16
PutDoc("/Encrypt "+QString::number(Encrypt)+" 0 R\n");
PutDoc(">>\nstartxref\n");
PutDoc(QString::number(StX)+"\n%%EOF\n");
closeAndCleanup();
return closeAndCleanup();
}
 
void PDFlib::closeAndCleanup()
bool PDFlib::closeAndCleanup()
{
bool writeSucceed = (Spool.status() == IO_Ok);
if (!writeSucceed)
PDF_Error_WriteFailure();
Spool.close();
if (abortExport)
if (abortExport || !writeSucceed)
{
if (Spool.exists())
Spool.remove();
6086,9 → 6089,21
Shadings.clear();
Transpar.clear();
ICCProfiles.clear();
return writeSucceed;
}
 
void PDFlib::PDF_Error(const QString& errorMsg)
{
ErrorMessage = errorMsg;
if (!ScQApp->usingGUI())
qDebug(errorMsg.local8Bit().data());
}
 
void PDFlib::PDF_Error_WriteFailure(void)
{
PDF_Error( tr("A write error occured, please check available disk space"));
}
 
void PDFlib::cancelRequested()
{
abortExport=true;
/branches/Version133x/Scribus/scribus/pdflib.h
57,6 → 57,7
bool doExport(const QString& fn, const QString& nam, int Components,
const std::vector<int> & pageNs, const QMap<int,QPixmap> & thumbs);
 
const QString& errorMessage(void) const { return ErrorMessage; }
bool exportCancelled(void) const { return abortExport; }
 
// used by ScFonts
74,9 → 75,12
void PDF_End_Page();
void PDF_TemplatePage(const Page* pag, bool clip = false);
void PDF_ProcessPage(const Page* pag, uint PNr, bool clip = false);
void PDF_End_Doc(const QString& PrintPr = "", const QString& Name = "", int Components = 0);
void closeAndCleanup();
bool PDF_End_Doc(const QString& PrintPr = "", const QString& Name = "", int Components = 0);
bool closeAndCleanup();
 
void PDF_Error(const QString& errorMsg);
void PDF_Error_WriteFailure(void);
 
QByteArray EncodeUTF16(const QString &in);
QString EncStream(const QString & in, int ObjNum);
QString EncStringUTF16(const QString & in, int ObjNum);
122,6 → 126,7
 
QMap<QString, GListeInd> GlyphsIdxOfFont;
QString Inhalt;
QString ErrorMessage;
ScribusDoc & doc;
const Page * ActPageP;
const PDFOptions & Options;
/branches/Version133x/Scribus/scribus/scribus.cpp
7266,12 → 7266,14
 
bool ScribusMainWindow::getPDFDriver(const QString & fn, const QString & nam, int Components,
const std::vector<int> & pageNs, const QMap<int,QPixmap> & thumbs,
bool* cancelled)
QString& error, bool* cancelled)
{
fileWatcher->forceScan();
fileWatcher->stop();
PDFlib pdflib(*doc);
bool ret = pdflib.doExport(fn, nam, Components, pageNs, thumbs);
if (!ret)
error = pdflib.errorMessage();
if (cancelled)
*cancelled = pdflib.exportCancelled();
fileWatcher->start();
7358,6 → 7360,7
int components=dia.colorSpaceComponents();
QString nam(dia.cmsDescriptor());
QString fileName = doc->PDF_Options.Datei;
QString errorMsg;
parsePagesString(pageString, &pageNs, doc->DocPages.count());
if (doc->PDF_Options.doMultiFile)
{
7381,10 → 7384,13
pm.convertFromImage(view->PageToPixmap(pageNs[aa]-1, 100));
thumbs.insert(1, pm);
QString realName = QDir::convertSeparators(path+"/"+name+ tr("-Page%1").arg(pageNs[aa])+"."+ext);
if (!getPDFDriver(realName, nam, components, pageNs2, thumbs, &cancelled))
if (!getPDFDriver(realName, nam, components, pageNs2, thumbs, errorMsg, &cancelled))
{
qApp->setOverrideCursor(QCursor(arrowCursor), true);
QMessageBox::warning(this, CommonStrings::trWarning, tr("Cannot write the file: \n%1").arg(doc->PDF_Options.Datei), CommonStrings::tr_OK);
QString message = tr("Cannot write the file: \n%1").arg(doc->PDF_Options.Datei);
if (!errorMsg.isEmpty())
message = QString("%1\n%2").arg(message).arg(errorMsg);
QMessageBox::warning(this, CommonStrings::trWarning, message, CommonStrings::tr_OK);
return;
}
aa++;
7400,10 → 7406,13
pm.convertFromImage(view->PageToPixmap(pageNs[ap]-1, 100));
thumbs.insert(pageNs[ap], pm);
}
if (!getPDFDriver(fileName, nam, components, pageNs, thumbs))
if (!getPDFDriver(fileName, nam, components, pageNs, thumbs, errorMsg))
{
qApp->setOverrideCursor(QCursor(arrowCursor), true);
QMessageBox::warning(this, CommonStrings::trWarning, tr("Cannot write the file: \n%1").arg(doc->PDF_Options.Datei), CommonStrings::tr_OK);
QString message = tr("Cannot write the file: \n%1").arg(doc->PDF_Options.Datei);
if (!errorMsg.isEmpty())
message = QString("%1\n%2").arg(message).arg(errorMsg);
QMessageBox::warning(this, CommonStrings::trWarning, message, CommonStrings::tr_OK);
}
}
qApp->setOverrideCursor(QCursor(arrowCursor), true);
/branches/Version133x/Scribus/scribus/plugins/scriptplugin/objpdffile.cpp
1154,8 → 1154,11
thumbs.insert(pageNs[ap], pm);
}
ReOrderText(ScMW->doc, ScMW->view);
if (!ScMW->getPDFDriver(fn, nam, Components, pageNs, thumbs)) {
QString errorMessage;
if (!ScMW->getPDFDriver(fn, nam, Components, pageNs, thumbs, errorMessage)) {
fn = "Cannot write the File: " + fn;
if (!errorMessage.isEmpty())
fn += QString("\n%1").arg(errorMessage);
PyErr_SetString(PyExc_SystemError, fn.ascii());
return NULL;
}
/branches/Version133x/Scribus/scribus/scribus.h
155,7 → 155,8
QString GetLang(QString inLang);
bool getPDFDriver(const QString & fn, const QString & nam,
int Components, const std::vector<int> & pageNs,
const QMap<int,QPixmap> & thumbs, bool* cancelled = NULL);
const QMap<int,QPixmap> & thumbs, QString& error,
bool* cancelled = NULL);
bool DoSaveAsEps(QString fn);
QString CFileDialog(QString wDir = ".", QString caption = "", QString filter = "", QString defNa = "",
bool Pre = false, bool mod = true, bool comp = false, bool cod = false,