Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 2029 → Rev 2030

/branches/Version13x/Scribus/scribus/pdfoptions.h
11,6 → 11,7
#include "qstring.h"
#include "qmap.h"
#include "qvaluelist.h"
#include "qdom.h"
 
struct LPIData;
struct PDFPresentationData;
67,36 → 68,8
* @return Verify_NoError for sane options, otherwise error code.
*/
PDFOptions::VerifyResults verify(QString* problemDescription);
PDFOptions::VerifyResults verify();
 
/**
* @author Craig Ringer
* @brief Save the PDF settings to a file or other stream
*
* @warning unimplemented, always fails.
*
* @param outStream QTextStream to write output to.
* @return True for success.
*/
bool saveTo(QTextStream& outStream) const;
bool saveTo(QString outFileName) const;
bool saveTo(FILE* outFilePtr) const;
 
/**
* @author Craig Ringer
* @brief Load the PDF settings from a file or other data stream, overwriting
* any current settings
*
* @warning unimplemented, always fails
*
* @warning on failure, struct contents are undefined.
*
* @param inStream QTextStream to settings data from.
* @return True for success.
*/
bool readFrom(QTextStream& inStream);
bool readFrom(QString inFileName);
bool readFrom(FILE* inFilePtr);
 
bool Thumbnails;
bool Articles;
bool useLayers;
141,4 → 114,87
int Permissions;
};
 
/*
* @brief Helper class for reading/writing PDFOptions
* @author Craig Ringer
*
* PDFOptionsIO reads and writes PDFOptions to various
* formats. Currently only a custom XML format is
* supported, but support for reading/writing Adobe's
* .joboptions (for example) might be added in future.
*
* Usage:
* // Writing:
* // where `opts' is an existing PDFOptions instance
* PDFOptionsIO io(opts);
* if (!io.writeTo("/path/to/file"))
* // handle error. Not like this:
* qDebug("Darn, it didn't work.");
*
* // Reading:
* PDFOptions opts;
* PDFOptionsIO io(opts);
* if (!io.readFrom("/path/to/file"))
* // handle error. Not like this:
* qDebug("incomprehensible gibberish");
*/
class PDFOptionsIO
{
public:
/**
* @brief simple ctor
*/
PDFOptionsIO(PDFOptions& opts);
 
/**
* @brief Save the PDF settings to a file or other stream
*
* @warning unimplemented, always fails.
*
* @param outStream QTextStream to write output to.
* @return True for success.
*/
bool writeTo(QTextStream& outStream);
bool writeTo(QString outFileName);
bool writeTo(FILE* outFilePtr);
 
/**
* @brief Load the PDF settings from a file or other data stream, overwriting
* any current settings
*
* @warning unimplemented, always fails
*
* @warning on failure, struct contents are undefined.
*
* @param inStream QTextStream to settings data from.
* @return True for success.
*/
bool readFrom(QTextStream& inStream);
bool readFrom(QString inFileName);
bool readFrom(FILE* inFilePtr);
 
protected:
// Populate the current DOM tree with the settings from the
// current PDFOptions instance.
bool buildSettings();
 
// Helper functions. Add elements under the root element
// with a single attribute "value=" set to the passed value.
void addElem(QString name, bool value);
void addElem(QString name, QString value);
void addElem(QString name, int value);
void addElem(QString name, double value);
 
// The QDomDocument used by the class for all its XML work
QDomDocument doc;
// The root element
QDomElement root;
// The PDFOptions instance we're operating on
PDFOptions* opts;
 
// Version, of the form Mmpr: Major, minor, patch, revision
// eg 1300 - 1.3.0r0
static const int formatVersion;
};
 
#endif