Class Document

Index Home MAE > MAE Architecture > MAE Data Types > Class Index > Class Document

Summary
Using Document
Public Methods
Document(group_id, docName, module)
bool pagesize(newWidth, newHeight)
bool header(text, depth, bookmarkLabel)
bool write(text, style, linkToBookmark)
bool textxref(text, style, indexReadableReference, indexName)
bool indexref(text, indexReadableReference, indexName)
bool bookmark(text, style, bookmarkLabel)
inline bool italic(text, linkToBookmark)
inline bool bold(text, linkToBookmark)
inline bool bolditalic(text, linkToBookmark)
inline bool underscore(text, linkToBookmark)
bool image(image, alignment)
bool image(imagefile, alignment)
bool tableOfContents(title, maxdepth)
bool index(title, indexName)
bool comment(comment)
bool newPage(width, height)
bool endPage()
bool newParagraph(style)
bool endParagraph()
bool horizontalLine()
bool newList(listType, style)
bool newListItem(style)
bool endList()
bool newTable(rows, columns, name, alignment)
bool addTableRow()
bool endTable()
bool newSection(sectionType)
inline bool newSection1Column()
inline bool newSection2Columns()
inline bool newSection3Columns()
bool endSection()
bool insert(newdoc)
inline bool append(newdoc)
int getRegionId() const
Document& region(regionId)
Document& setRegion(regionId)
string getBookmark(createIfNone) const
int getRow() const
int getColumn() const
Document& begin()
Document& end()
Document& beginningOfPage()
Document& endOfPage()
inline bool setTable(tableName)
Document& setTableCaption(caption)
Document& cell(row, column, style)
Document& endOfTable()
Document& endOfCell()
inline void setParagraphStyle(style)
inline void setTableStyle(style)
inline void setTableCellStyle(style)
inline void setListStyle(style)
inline void setListLineStyle(style)
inline void setDefaultStyle(blockType, style)
inline const string& getParagraphStyle() const
inline const string& getTableStyle() const
inline const string& getTableCellStyle() const
inline const string& getListStyle() const
inline const string& getListLineStyle() const
inline const string& getDefaultStyle(blockType) const
string renderToString(format, fulldoc) const
bool renderToFile(f, format, fulldoc) const
string getId() const
inline int getGroupId() const
inline string getModule() const
inline string getName() const
inline string getDocumentName() const
string getLastParagraphStyle() const
inline bool isEmptyParagraph() const
bool setId(id)
bool setId(group_id, docName, module)
inline void setGroupId(id)
void setModule(newModule)
void setName(newName)
inline bool isSaved() const
inline bool isChanged() const
inline void setSaved()
inline void setChanged()
inline int size() const
int pages() const
inline float getWidth() const
inline float getHeight() const
int getHeaderCount() const
int getIndexEntryCount(indexName) const
inline int getCurrentBlock() const
inline bool setCurrentBlock(newBlock)
inline void setCurrentBlockDocEnd()
XMLData toXML() const
inline void clearRegion(regionId)
inline bool valid() const
void clear()
Private Properties
Private Methods
int findPageTop() const
int findPageEnd() const
int findListTop() const
int findTable(tableName) const
int findCellBegin(row, column) const
int findCellEnd() const
int findTableTop(startPos, insideTable) const
int findTableEnd(startPos) const
int findHeader(depth, startBlock) const
DocumentBlock& addBlock(type)
DocumentBlock& addBlock(block)
void transform(p, translate, scale, rotate)
void transform(p, translate, scale, rotate)
bool isExternalLink(link) const
string htmlLinkStart(link) const
string htmlLinkEnd(link) const
bool findBookmark(bookmark, regionId, itemId) const
string makeBookmarkRef(regionId, itemId) const
string getBookmarkRef(bookmark) const
string renderTextBlockToString(b) const
string renderTextBlockToStringHTML(b) const
string renderToStringHTML(fulldoc) const
string viewBlocks(startBlock, keyBlock, noBlocks) const

#include <Document.h >

Summary

Class that abstracts a formatted document.

A document created with this class can be converted to other formats (e.g. HTML, wiki).

Using Document

A document is a abstract document that is not format specific until it is rendered.

Today, a document can be output to HTML or PDF.  Other formats are expected for the future.

A document is made up of a series of blocks.

An example block is: header, paragraph, table cell, image

A block is made up of a series of items.

An example item is: text fragment of a particular style.

White space is not automatically added between items.

A region is a block.

Text written to a region is appended.

A bookmark is an anchor where a link from elsewhere in the document points to.

A link points to a bookmark inside the document.  An external link points to somewhere outside the document.

An index key is the text that appears in a generated index, perhaps different from the text it references.

When headers are used, Document can generate a table of contents for the document.

When named indexes are used, Document can generate an index for each named index.

Public Methods

Document(group_id, docName, module)

int group_id

Default value: 0

string docName

Default value: ""

string module

Default value: ""


using this class to communicate with docmaker

bool pagesize(newWidth, newHeight)

float newWidth

float newHeight


Specify how many units wide and tall the document is; specify how many pixels are in a unit

bool header(text, depth, bookmarkLabel)

const string& text

int depth

Default value: 1

const string& bookmarkLabel

Default value: ""


Header 0 is reserved for the cover page title (not part of the table of contents)

bool write(text, style, linkToBookmark)

const string& text

const string& style

Default value: ""

const string& linkToBookmark

Default value: ""


Generate text using the optional style provided and optionally link it to a bookmark provided

bool textxref(text, style, indexReadableReference, indexName)

const string& text

const string& style

Default value: ""

const string& indexReadableReference

Default value: "here"

const string& indexName

Default value: ""


Generate text and add an index entry to here using printed text, with reference text provided inside the named index

bool indexref(text, indexReadableReference, indexName)

const string& text

const string& indexReadableReference

Default value: "here"

const string& indexName

Default value: ""


Generate NO text, but add an index entry to here using printed text, with reference text provided inside the named index

bool bookmark(text, style, bookmarkLabel)

const string& text

const string& style

Default value: ""

const string& bookmarkLabel

Default value: ""


inline bool italic(text, linkToBookmark)

const string& text

const string& linkToBookmark

Default value: ""


inline bool bold(text, linkToBookmark)

const string& text

const string& linkToBookmark

Default value: ""


inline bool bolditalic(text, linkToBookmark)

const string& text

const string& linkToBookmark

Default value: ""


inline bool underscore(text, linkToBookmark)

const string& text

const string& linkToBookmark

Default value: ""


bool image(image, alignment)

const Image& image

const string& alignment

Default value: "center"


align: left, center, right

bool image(imagefile, alignment)

const string& imagefile

const string& alignment

Default value: "center"


bool tableOfContents(title, maxdepth)

const string& title

Default value: ""

int maxdepth

Default value: 0


bool index(title, indexName)

const string& title

Default value: ""

const string& indexName

Default value: ""


bool comment(comment)

string comment


does not appear visible in output document

bool newPage(width, height)

float width

Default value: 8.5

float height

Default value: 11.0


Start/End blocks

bool endPage()

bool newParagraph(style)

string style

Default value: ""


bool endParagraph()

bool horizontalLine()

bool newList(listType, style)

const string& listType

Default value: "."

const string& style

Default value: ""


a list is a container of paragraphs

bool newListItem(style)

const string& style

Default value: ""


bool endList()

bool newTable(rows, columns, name, alignment)

int rows

int columns

const string& name

Default value: ""

const string& alignment

Default value: "center"


a table name is an identifier which may include dashes

bool addTableRow()

bool endTable()

bool newSection(sectionType)

const string& sectionType

Default value: ""


inline bool newSection1Column()

inline bool newSection2Columns()

inline bool newSection3Columns()

bool endSection()

bool insert(newdoc)

const Document& newdoc


inline bool append(newdoc)

const Document& newdoc


int getRegionId() const

Document navigation

Document& region(regionId)

int regionId


Document& setRegion(regionId)

int regionId


string getBookmark(createIfNone) const

bool createIfNone

Default value: true


int getRow() const

int getColumn() const

Document& begin()

beginning of document

Document& end()

end of document

Document& beginningOfPage()

beginning of page

Document& endOfPage()

end of page

inline bool setTable(tableName)

const string& tableName


Document& setTableCaption(caption)

const string& caption


Document& cell(row, column, style)

int row

int column

const string& style

Default value: ""


if not inside table or invalid row/column, document returns itself at current region

Document& endOfTable()

end of table (immediately following the table)

Document& endOfCell()

end of cell

inline void setParagraphStyle(style)

const string& style


Control output styles

inline void setTableStyle(style)

const string& style


inline void setTableCellStyle(style)

const string& style


inline void setListStyle(style)

const string& style


inline void setListLineStyle(style)

const string& style


inline void setDefaultStyle(blockType, style)

const string& blockType

const string& style


Valid block types: paragraph, table, tablecell, list, listline

inline const string& getParagraphStyle() const

inline const string& getTableStyle() const

inline const string& getTableCellStyle() const

inline const string& getListStyle() const

inline const string& getListLineStyle() const

inline const string& getDefaultStyle(blockType) const

const string& blockType


string renderToString(format, fulldoc) const

string format

Default value: "html"

bool fulldoc

Default value: true


alt format: pdf, xml

bool renderToFile(f, format, fulldoc) const

FILE* f

string format

Default value: "html"

bool fulldoc

Default value: true


alt format: pdf, xml

string getId() const

GET

inline int getGroupId() const

inline string getModule() const

inline string getName() const

inline string getDocumentName() const

string getLastParagraphStyle() const

inline bool isEmptyParagraph() const

bool setId(id)

string id


SET

bool setId(group_id, docName, module)

int group_id

string docName

string module


inline void setGroupId(id)

DbRecNum id


void setModule(newModule)

string newModule


void setName(newName)

string newName


inline bool isSaved() const

managing change

inline bool isChanged() const

inline void setSaved()

inline void setChanged()

inline int size() const

querying the document

int pages() const

inline float getWidth() const

inline float getHeight() const

int getHeaderCount() const

int getIndexEntryCount(indexName) const

const string& indexName

Default value: ""


Count how many entries are in the named index

inline int getCurrentBlock() const

inline bool setCurrentBlock(newBlock)

int newBlock


inline void setCurrentBlockDocEnd()

XMLData toXML() const

convert structure data to XML

inline void clearRegion(regionId)

int regionId


inline bool valid() const

void clear()

Private Properties

int group_id

using this class to write to the docmaker daemon

string name

string module

bool changed

Flag: true if data was changed and needs to be saved

DocumentIndexRefList indexRefs

HashArray defaultStyle

for block types: paragraph

vector <DocumentBlock > block

common variables

vector <Image > images

int nextRegionId

int currentBlock

current block for manipulation

static htmlTagFN htmlStartTag

static htmlTagFN htmlEndTag


Private Methods

int findPageTop() const

int findPageEnd() const

int findListTop() const

int findTable(tableName) const

const string& tableName


int findCellBegin(row, column) const

int row

int column


int findCellEnd() const

int findTableTop(startPos, insideTable) const

int startPos

Default value: 0

bool insideTable

Default value: false


int findTableEnd(startPos) const

int startPos

Default value: 0


int findHeader(depth, startBlock) const

int depth

int startBlock

Default value: 0


DocumentBlock& addBlock(type)

const string& type

Default value: ""


append after currentBlock

DocumentBlock& addBlock(block)

DocumentBlock block


void transform(p, translate, scale, rotate)

Point& p

Point translate

float scale

float rotate


void transform(p, translate, scale, rotate)

PointList& p

Point translate

float scale

float rotate


const string& link


string link


string link


bool findBookmark(bookmark, regionId, itemId) const

const string& bookmark

int& regionId

int& itemId


string makeBookmarkRef(regionId, itemId) const

int regionId

DbRecNum itemId


string getBookmarkRef(bookmark) const

const string& bookmark


string renderTextBlockToString(b) const

const DocumentBlock& b


string renderTextBlockToStringHTML(b) const

const DocumentBlock& b


string renderToStringHTML(fulldoc) const

bool fulldoc

Default value: true


string viewBlocks(startBlock, keyBlock, noBlocks) const

int startBlock

int keyBlock

int noBlocks

Default value: 19


for debugging