Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes
CATypesetCtl Class Reference

Interface to start a typesetter in the background. More...

#include <typesetctl.h>

Inheritance diagram for CATypesetCtl:
Inheritance graph
[legend]

List of all members.

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 runTypesetter ()
bool getPDFConversion ()
CAExportgetExporter ()
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

Detailed Description

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:

Constructor & Destructor Documentation


Member Function Documentation

bool CATypesetCtl::createPDF ( ) [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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

See also:
setExpOption( QVariant oName, QVariant oValue )

References _bOutputFileNameFirst, _oOutputFileName, _poExport, _poOutputFile, _poTypesetter, CAExternProgram::addParameter(), CAExternProgram::clearParameters(), CAExport::exportDocument(), CAFile::setStreamToDevice(), and CAExport::wait().

Referenced by CAPDFExport::exportDocumentImpl(), and CASVGExport::exportDocumentImpl().

Here is the call graph for this function:

Here is the caller graph for this function:

References _poExport.

Referenced by CAPDFExport::~CAPDFExport(), and CASVGExport::~CASVGExport().

Here is the caller graph for this function:

bool CATypesetCtl::getPDFConversion ( ) [inline]

References _bPDFConversion.

QString CATypesetCtl::getTempFilePath ( ) [inline]
void CATypesetCtl::nextOutput ( const QByteArray &  roData) [signal]

Referenced by CATypesetCtl(), and rcvTypesetterOutput().

Here is the caller graph for this function:

void CATypesetCtl::nextStep ( ) [signal]
void CATypesetCtl::rcvTypesetterOutput ( const QByteArray &  roData) [protected, slot]

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().

Here is the call graph for this function:

Here is the caller graph for this function:

Start the typesetter

This method runs the typesetter. Make sure that all the required name, path and parameters are set

See also:
setTypesetter( const QString &roProgramName, const QString &roProgramPath )

References _bOutputFileNameFirst, _oOutputFileName, _poTypesetter, CAExternProgram::addParameter(), and CAExternProgram::execProgram().

Referenced by CAPDFExport::exportDocumentImpl(), and CASVGExport::exportDocumentImpl().

Here is the call graph for this function:

Here is the caller graph for this function:

void CATypesetCtl::setExpOption ( const QVariant &  roName,
const QVariant &  roValue 
) [virtual]

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.

See also:
exportDocument();

References _oExpOptList.

void CATypesetCtl::setExporter ( CAExport poExport) [inline]

References _poExport.

Referenced by CAPDFExport::startExport(), and CASVGExport::startExport().

Here is the caller graph for this function:

void CATypesetCtl::setPDFConversion ( bool  bConversion) [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)

See also:
createPDF();
CAExternProgram::execProgram( QString oCwd )

References _poConvPS2PDF, CAExternProgram::setParameters(), CAExternProgram::setProgramName(), and CAExternProgram::setProgramPath().

Here is the call graph for this function:

void CATypesetCtl::setTSetOption ( const QVariant &  roName,
const QVariant &  roValue,
bool  bSpace = false,
bool  bShortParam = true 
) [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.

See also:
runTypesetter();

References _oTSetOptList, _poTypesetter, and CAExternProgram::addParameter().

Referenced by CAPDFExport::exportDocumentImpl(), CASVGExport::exportDocumentImpl(), and CASVGExport::startExport().

Here is the call graph for this function:

Here is the caller graph for this function:

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)

See also:
setTSetOption( QVariant oName, QVariant oValue );
CAExternProgram::execProgram( QString oCwd )

References _poTypesetter, CAExternProgram::setProgramName(), and CAExternProgram::setProgramPath().

Referenced by CAPDFExport::startExport(), and CASVGExport::startExport().

Here is the call graph for this function:

Here is the caller graph for this function:

void CATypesetCtl::typesetterFinished ( int  iExitCode) [signal]

Referenced by typsetterExited().

Here is the caller graph for this function:

void CATypesetCtl::typsetterExited ( int  iExitCode) [protected, slot]

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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::exportDocumentImpl(), and CASVGExport::exportDocumentImpl().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

QVector<QVariant> CATypesetCtl::_oExpOptList [protected]

Referenced by setExpOption().

QString CATypesetCtl::_oOutputFileName [protected]
QVector<QVariant> CATypesetCtl::_oTSetOptList [protected]

Referenced by setTSetOption().

QTemporaryFile* CATypesetCtl::_poOutputFile [protected]

The documentation for this class was generated from the following files: