Ipelib: ipe::Document Class Reference

Ipelib

- Main Page
- Modules
- Classes

- Class List
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Static Public Member Functions

# ipe::Document Class Reference
Ipe Document

The model for an Ipe document. More...

`#include <ipedoc.h>`

List of all members.

## 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)

## Detailed Description

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.

## Member Enumeration Documentation

enum ipe::Document::TFormat

There are several Ipe document save formats.

Enumerator:

  EXml | Save as XML.
  EPdf | Save as PDF.
  EEps | Save as Encapsulated Postscript.
  EIpe5 | Ancient Ipe format.
  EUnknown | Unknown file format.

anonymous enum

Options for saving Ipe documents (to PDF and Postscript)

Enumerator:

  ESaveNormal | Nothing special.
  EExport | Don't include Ipe markup.
  ENoZip | Do not compress streams.
  EMarkedView | Create marked views only.
  ENoColor | No color commands in EPS output.

enum ipe::Document::LoadErrors

Errors that can happen while loading documents.

Enumerator:

  EVersionTooOld | The version of the file is too old.
  EVersionTooRecent | The file version is newer than this Ipelib.
  EFileOpenError | Error opening the file.

anonymous enum

Error codes returned by RunLatex.

Enumerator:

  ErrNone |
  ErrNoText |
  ErrNoDir |
  ErrWritingSource |
  ErrOldPdfLatex |
  ErrRunLatex |
  ErrLatex |
  ErrLatexOutput |
  ErrNoIconv |

## Constructor & Destructor Documentation

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.

## Member Function Documentation

Document::TFormat Document::fileFormat | ( | DataSource & | source | ) | `[static]`

Determine format of file in source.

Document::TFormat Document::formatFromFilename | ( | String | fn | ) | `[static]`

Determine format of file from filename fn.

Document * Document::load | ( | DataSource & | source,
|  | TFormat | format,
|  | int & | reason
| ) |  | `[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.

Document * Document::load | ( | const char * | fname,
|  | int & | reason
| ) |  | `[static]`

Document * Document::loadWithErrorReport | ( | const char * | fname | ) | `[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.

int ipe::Document::countPages | ( |  | ) | const`[inline]`

Return number of pages of document.

int Document::countTotalViews | ( |  | ) | const

Return total number of views in all pages.

const Page* ipe::Document::page | ( | int | no | ) | const`[inline]`

Return page (const version).

The first page is no 0.

Page* ipe::Document::page | ( | int | no | ) | `[inline]`

Return page.

The first page is no 0.

Page * Document::set | ( | int | no,
|  | Page * | page
| ) |  |

Replace page.

Returns the original page.

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.

SProperties ipe::Document::properties | ( |  | ) | const`[inline]`

Return document properties.

void Document::setProperties | ( | const SProperties & | info | ) |

Set document properties.

Cascade* ipe::Document::cascade | ( |  | ) | `[inline]`

Return stylesheet cascade.

const Cascade* ipe::Document::cascade | ( |  | ) | const`[inline]`

Return stylesheet cascade (const version).

Cascade * Document::replaceCascade | ( | Cascade * | sheets | ) |

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.

const FontPool* ipe::Document::fontPool | ( |  | ) | const`[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.

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

- ipedoc.h
- ipedoc.cpp