|
Canorus
0.0
|
Interface to start a typesetter in the background. More...
#include <typesetctl.h>

Signals | |
| void | nextOutput (const QByteArray &roData) |
| void | nextStep () |
| void | typesetterFinished (int iExitCode) |
Public Member Functions | |
| CATypesetCtl () | |
| ~CATypesetCtl () | |
| void | setTypesetter (const QString &roProgramName, const QString &roProgramPath="") |
| void | setPS2PDF (const QString &roProgrammName, const QString &roProgramPath="", const QStringList &roParams=(QStringList()<< QString(""))) |
| virtual void | setExpOption (const QVariant &roName, const QVariant &roValue) |
| virtual void | setTSetOption (const QVariant &roName, const QVariant &roValue, bool bSpace=false, bool bShortParam=true) |
| void | setPDFConversion (bool bConversion) |
| void | setExporter (CAExport *poExport) |
| void | exportDocument (CADocument *poDoc) |
| void | exportSheet (CASheet *poSheet) |
| void | runTypesetter () |
| bool | getPDFConversion () |
| CAExport * | getExporter () |
| QString | getTempFilePath () |
| bool | waitForFinished (int iMSecs) |
Protected Slots | |
| void | rcvTypesetterOutput (const QByteArray &roData) |
| void | typsetterExited (int iExitCode) |
Protected Member Functions | |
| bool | createPDF () |
Protected Attributes | |
| CAExternProgram * | _poTypesetter |
| CAExternProgram * | _poConvPS2PDF |
| CAExport * | _poExport |
| QVector< QVariant > | _oExpOptList |
| QVector< QVariant > | _oTSetOptList |
| QTemporaryFile * | _poOutputFile |
| QString | _oOutputFileName |
| bool | _bPDFConversion |
| bool | _bOutputFileNameFirst |
Interface to start a typesetter in the background.
Copyright (c) 2006-2008, Reinhard Katzmann, Matevž Jekovec, Canorus development team All Rights Reserved. See AUTHORS for a complete list of authors.
Licensed under the GNU GENERAL PUBLIC LICENSE. See COPYING for details.
This class is used to run a typesetter in the background while receiving the output of it. The output of the typesetter can be fetched via signal/slots. If the typesetter does not support creation of pdf files another process can be started to do the conversion.
Constructor:
| CATypesetCtl::CATypesetCtl | ( | ) |
References _bOutputFileNameFirst, _bPDFConversion, _poConvPS2PDF, _poExport, _poOutputFile, _poTypesetter, nextOutput(), rcvTypesetterOutput(), and typsetterExited().

| CATypesetCtl::~CATypesetCtl | ( | ) |
References _poConvPS2PDF, _poOutputFile, and _poTypesetter.
|
protected |
Runs the conversion from postscript to pdf in the background
Currently neither progress nor output messages are supported when doing this conversion step. Only startup failures are handled.
References _poConvPS2PDF, and CAExternProgram::execProgram().
Referenced by typsetterExited().


| void CATypesetCtl::exportDocument | ( | CADocument * | poDoc | ) |
Export the file to disk to be run by the typesetter
This method creates a random file name as a stream file name for the exporter. Then it exports the document poDoc.
References _bOutputFileNameFirst, _oOutputFileName, _poExport, _poOutputFile, _poTypesetter, CAExternProgram::addParameter(), CAExternProgram::clearParameters(), CAExport::exportDocument(), CAFile::setStreamToDevice(), and CAExport::wait().
Referenced by CAPDFExport::exportDocumentImpl(), and CASVGExport::exportDocumentImpl().


| void CATypesetCtl::exportSheet | ( | CASheet * | poSheet | ) |
Export the file to disk to be run by the typesetter
This method creates a random file name as a stream file name for the exporter. Then it exports the sheet poSheet.
References _bOutputFileNameFirst, _oOutputFileName, _poExport, _poOutputFile, _poTypesetter, CAExternProgram::addParameter(), CAExternProgram::clearParameters(), CAExport::exportSheet(), CAFile::setStreamToDevice(), and CAExport::wait().
Referenced by CAPDFExport::exportSheetImpl(), and CASVGExport::exportSheetImpl().


|
inline |
References _poExport.
Referenced by CAPDFExport::~CAPDFExport(), and CASVGExport::~CASVGExport().

|
inline |
References _bPDFConversion.
|
inline |
References _oOutputFileName.
Referenced by CAPDFExport::getTempFilePath(), CASVGExport::getTempFilePath(), CAPDFExport::runTypesetter(), and CASVGExport::runTypesetter().

|
signal |
Referenced by CATypesetCtl(), and rcvTypesetterOutput().

|
signal |
|
protectedslot |
Sends new received output to a connected slot
If slots are connected to the signal nextOutput the output received by the typesetter are sent to that slot. No distinction is made between standard error and output.
References nextOutput().
Referenced by CATypesetCtl().

| void CATypesetCtl::runTypesetter | ( | ) |
Start the typesetter
This method runs the typesetter. Make sure that all the required name, path and parameters are set
References _bOutputFileNameFirst, _oOutputFileName, _poTypesetter, CAExternProgram::addParameter(), and CAExternProgram::execProgram().
Referenced by CAPDFExport::runTypesetter(), and CASVGExport::runTypesetter().


Defines the export options
For the run of one exporter additional options can be defined using this method. The oName does define the name of the option and the oValue defines the value of the option name to be passed to the exporter. There is no conversion / transformation done in the base class.
References _oExpOptList.
|
inline |
References _poExport.
Referenced by CAPDFExport::startExport(), and CASVGExport::startExport().

|
inline |
References _bPDFConversion.
| void CATypesetCtl::setPS2PDF | ( | const QString & | roProgramName, |
| const QString & | roProgramPath = "", |
||
| const QStringList & | roParams = (QStringList() << QString("") ) |
||
| ) |
Defines the postscript->pdf executable name to be run
This method let's you define the executble name of an optional postscript->pdf converter in case the typesetter does not support the output of pdf. (with optionally included path name and a list of parameters)
References _poConvPS2PDF, CAExternProgram::setParameters(), CAExternProgram::setProgramName(), and CAExternProgram::setProgramPath().

|
virtual |
Defines the typesetter options
For the run of one typesetter additional parameters can be defined using this method. The oName does define the name of the parameter and the oValue defines the value of the parameter name to be passed to the typesetter.
If the optional parameter bSpace is set to true a space between the name and value is set, else the "=" character is set. If bShortParam is set to true nothing is set between the parameter name and value.
The name and values are converted to a string (so only QVariants that can be converted to QString are supported) in the form "-<name>=<option>" (without < and > signs) with no additional apostrophes.
References _oTSetOptList, _poTypesetter, and CAExternProgram::addParameter().
Referenced by CAPDFExport::runTypesetter(), CASVGExport::runTypesetter(), and CASVGExport::startExport().


| void CATypesetCtl::setTypesetter | ( | const QString & | roProgramName, |
| const QString & | roProgramPath = "" |
||
| ) |
Defines the typesetter executable name to be run
This method let's you define the typesetter executable name (with optionally included path name)
References _poTypesetter, CAExternProgram::setProgramName(), and CAExternProgram::setProgramPath().
Referenced by CAPDFExport::startExport(), and CASVGExport::startExport().


|
signal |
|
protectedslot |
Send the exit code of the finished typesetter to a connected slot.
As soon as the typesetter finished it's job in the background this method sends the typesetterFinished method to all connected slots. The method assumes that on a successful finish the exit code of the typesetter is set to 0. If a typesetter only does support postscript output, the pdf creation process can be started afterwards (this also requires that the exit code of the typesetter was 0!)
References _bPDFConversion, createPDF(), and typesetterFinished().
Referenced by CATypesetCtl().


| bool CATypesetCtl::waitForFinished | ( | int | iMSecs | ) |
Blocks until the process has finished and the finished() signal has been emitted or until msecs milliseconds have passed.
Returns true if the process finished; otherwise returns false (if the operation timed out or if an error occurred).
References _poTypesetter, and CAExternProgram::waitForFinished().
Referenced by CAPDFExport::runTypesetter(), and CASVGExport::runTypesetter().


|
protected |
Referenced by CATypesetCtl(), exportDocument(), exportSheet(), and runTypesetter().
|
protected |
Referenced by CATypesetCtl(), getPDFConversion(), setPDFConversion(), and typsetterExited().
|
protected |
Referenced by setExpOption().
|
protected |
Referenced by exportDocument(), exportSheet(), getTempFilePath(), and runTypesetter().
|
protected |
Referenced by setTSetOption().
|
protected |
Referenced by CATypesetCtl(), createPDF(), setPS2PDF(), and ~CATypesetCtl().
|
protected |
Referenced by CATypesetCtl(), exportDocument(), exportSheet(), getExporter(), and setExporter().
|
protected |
Referenced by CATypesetCtl(), exportDocument(), exportSheet(), and ~CATypesetCtl().
|
protected |
Referenced by CATypesetCtl(), exportDocument(), exportSheet(), runTypesetter(), setTSetOption(), setTypesetter(), waitForFinished(), and ~CATypesetCtl().