Ipelib
|
#include <ipedoc.h>
Classes | |
struct | SProperties |
Properties of a document. More... |
Public Types | |
enum | TFormat { EXml, EPdf, EEps, EIpe5, EUnknown } |
enum | { ESaveNormal = 0, EExport = 1, ENoZip = 2, EMarkedView = 4, ENoColor = 8 } |
enum | LoadErrors { EVersionTooOld = -1, EVersionTooRecent = -2, EFileOpenError = -3 } |
enum | { ErrNone, ErrNoText, ErrNoDir, ErrWritingSource, ErrOldPdfLatex, ErrRunLatex, ErrLatex, ErrLatexOutput, ErrNoIconv } |
Public Member Functions | |
Document () | |
Document (const Document &rhs) | |
~Document () | |
bool | save (TellStream &stream, TFormat format, uint flags) const |
bool | save (const char *fname, TFormat format, uint flags) const |
bool | exportPages (const char *fname, uint flags, int fromPage, int toPage) const |
bool | exportView (const char *fname, TFormat format, uint flags, int pno, int vno) const |
void | saveAsXml (Stream &stream, bool usePdfBitmaps=false) const |
int | countPages () const |
int | countTotalViews () const |
const Page * | page (int no) const |
Page * | page (int no) |
Page * | set (int no, Page *page) |
void | insert (int no, Page *page) |
void | push_back (Page *page) |
Page * | remove (int no) |
SProperties | properties () const |
void | setProperties (const SProperties &info) |
Cascade * | cascade () |
const Cascade * | cascade () const |
Cascade * | replaceCascade (Cascade *cascade) |
void | setFontPool (FontPool *fontPool) |
const FontPool * | fontPool () const |
bool | hasTrueTypeFonts () const |
bool | hasTransparency () const |
bool | hasTilings () const |
bool | hasGradients () const |
void | findBitmaps (BitmapFinder &bm) const |
bool | checkStyle (AttributeSeq &seq) const |
int | runLatex (String &logFile) |
int | runLatex () |
Static Public Member Functions | |
static TFormat | fileFormat (DataSource &source) |
static TFormat | formatFromFilename (String fn) |
static Document * | load (DataSource &source, TFormat format, int &reason) |
static Document * | load (const char *fname, int &reason) |
static Document * | loadWithErrorReport (const char *fname) |
The model for an Ipe document.
The Document class represents the contents of an Ipe document, and all the methods necessary to load, save, and modify it.
anonymous enum |
anonymous enum |
Document::Document | ( | ) |
Construct an empty document for filling by a client.
As constructed, it has no pages, A4 media, and only the standard style sheet.
Document::Document | ( | const Document & | rhs | ) |
Copy constructor.
Document::~Document | ( | ) |
Destructor.
|
static |
Determine format of file in source.
|
static |
Determine format of file from filename fn.
|
static |
Construct a document from an input stream.
Returns 0 if the stream couldn't be parsed, and a reason explaining that in reason. If reason is positive, it is a file (stream) offset where parsing failed. If reason is negative, it is an error code, see Document::LoadErrors.
|
static |
|
static |
bool Document::save | ( | TellStream & | stream, |
TFormat | format, | ||
uint | flags | ||
) | const |
Save in a stream.
Returns true if sucessful.
bool Document::save | ( | const char * | fname, |
TFormat | format, | ||
uint | flags | ||
) | const |
bool Document::exportPages | ( | const char * | fname, |
uint | flags, | ||
int | fromPage, | ||
int | toPage | ||
) | const |
Export a range of pages to PDF.
bool Document::exportView | ( | const char * | fname, |
TFormat | format, | ||
uint | flags, | ||
int | pno, | ||
int | vno | ||
) | const |
Export a single view to PDF or EPS.
void Document::saveAsXml | ( | Stream & | stream, |
bool | usePdfBitmaps = false |
||
) | const |
Save in XML format into an Stream.
|
inline |
Return number of pages of document.
int Document::countTotalViews | ( | ) | const |
Return total number of views in all pages.
|
inline |
Return page (const version).
The first page is no 0.
|
inline |
Return page.
The first page is no 0.
void Document::insert | ( | int | no, |
Page * | page | ||
) |
Insert a new page.
The page is inserted at index no.
void Document::push_back | ( | Page * | page | ) |
Append a new page.
Page * Document::remove | ( | int | no | ) |
Remove a page.
Returns the page that has been removed.
|
inline |
Return document properties.
void Document::setProperties | ( | const SProperties & | info | ) |
Set document properties.
|
inline |
Return stylesheet cascade.
|
inline |
Return stylesheet cascade (const version).
Replace the entire style sheet cascade.
Takes ownership of cascade, and returns the original cascade.
void Document::setFontPool | ( | FontPool * | fontPool | ) |
Update the font pool (after running Pdflatex).
Takes ownership of the font pool.
|
inline |
Return the current FontPool.
bool Document::hasTrueTypeFonts | ( | ) | const |
Return whether this document uses any Truetype fonts.
bool Document::hasTransparency | ( | ) | const |
Does this document make any use of transparency?
The document is considered to make use of transparency if its style sheets define any opacities whose value is not 1.0.
bool Document::hasTilings | ( | ) | const |
Does this document contain any tiling patterns?
bool Document::hasGradients | ( | ) | const |
Does this document contain any gradients?
void Document::findBitmaps | ( | BitmapFinder & | bm | ) | const |
Create a list of all bitmaps in the document.
bool Document::checkStyle | ( | AttributeSeq & | seq | ) | const |
Check all symbolic attributes in the document.
This function verifies that all symbolic attributes in the document are defined in the style sheet. It appends to seq all symbolic attributes (in no particular order, but without duplicates) that are NOT defined.
Returns true
if there are no undefined symbolic attributes in the document.
int Document::runLatex | ( | String & | logFile | ) |
Run PdfLatex.
int Document::runLatex | ( | ) |
Run Pdflatex (suitable for console applications)
Success/error is reported on stderr.