Ananas Library 0.9.5
aOOTemplate Class Reference

#include <aootemplate.h>

Inheritance diagram for aOOTemplate:
iTemplate aCalcTemplate

Public Member Functions

virtual bool open (const QString &fname)
virtual void close ()
virtual void clear ()
virtual QString getValue (const QString &name)
virtual void setValue (const QString &name, const QString &value)
virtual QString exec (const QString &sname)
virtual QString result ()
virtual bool save (const QString &fname)
virtual void setDir (const QString &dirName)
virtual QString getDir ()
virtual void cleanUpTags ()
virtual bool lineFeedRemove (const QString &filename)
Public Member Functions inherited from iTemplate
 iTemplate ()
virtual ~iTemplate ()

Protected Member Functions

void searchTags (QDomNode node, const QString &sname)
virtual bool getNodeTags (QDomNode node, const QString &tagname, bool params)
void insertRowValues (QDomNode node)
virtual void insertTagsValues (QDomNode node, const QString &tagName)
void clearTags (QDomNode node, bool section)
void clearRow (QDomNode node)

Protected Attributes

QString copyName
QString templateDir
QMap< QString, QString > values
QDomDocument docTpl
QDomDocument docStyle

Detailed Description

Class for work with pattern in OpenOffice format

Member Function Documentation

◆ cleanUpTags()

void aOOTemplate::cleanUpTags ( )
virtual

clears all tags from pattern

Reimplemented from iTemplate.

References clearRow(), clearTags(), docStyle, and docTpl.

◆ clear()

void aOOTemplate::clear ( )
virtual

clears internal variable.

Reimplemented from iTemplate.

◆ clearRow()

void aOOTemplate::clearRow ( QDomNode node)
protected

Deletes row, having section tag

Parameters
node- context

References clearRow().

Referenced by cleanUpTags(), and clearRow().

◆ clearTags()

void aOOTemplate::clearTags ( QDomNode node,
bool section )
protected

Deletes tags from node

Parameters
node- context
section-

References clearTags().

Referenced by cleanUpTags(), clearTags(), and insertRowValues().

◆ close()

void aOOTemplate::close ( )
virtual

Closes pattern. Deletes temporary files.

Reimplemented from iTemplate.

References copyName, docStyle, and docTpl.

◆ exec()

QString aOOTemplate::exec ( const QString & sname)
virtual

Sets value parameter `name' _en \ru Устанавливает значение параметра по его имени. _ru */ void aOOTemplate::setValue( const QString &name, const QString &value ) { values[name]=value; } /** \en Execute replace tags to values. _en \ru Выполняет подстановку значения параметра в шаблоне. Есть 2 типа тегов

  • обычные теги
  • секции - могут находиться ТОЛЬКО в строках таблицы.

Для подстановки значений обычных тегов необходимо выполнить setValue() где name = PARAM (сейчас #define PARAM "param") а value - значение для подстановки. Потом выполнить exec() с параметром = имени тега. Для подстановки секций необходимо задать нужные параметры, используя setValue() а потом выполнить exec() с именем секции. exec может вызываться нужное число раз как для обычных тегов, так и для секций _ru

Reimplemented from iTemplate.

References docStyle, docTpl, and getValue().

◆ getDir()

QString aOOTemplate::getDir ( )
virtual

Gets working directory

Reimplemented from iTemplate.

◆ getNodeTags()

bool aOOTemplate::getNodeTags ( QDomNode node,
const QString & tagname,
bool params )
protectedvirtual

Added value to end tag with name `sname'. Don't deletes tag.

Parameters
node- context for searching
sname- tag name
See also
cleanUpTags() getNodeTags() insertRowValues() */ void aOOTemplate::searchTags(QDomNode node, const QString &sname ) { QDomNode n = node.lastChild(); while( !n.isNull() ) {

printf("n->name=%s\n",n.nodeName().ascii()); bool res = getNodeTags(n, sname, false); if( res ) { insertRowValues(n); } else { res = getNodeTags(n, sname, true); if(res) { insertTagsValues(n, sname); } else { searchTags(n, sname); } } n = n.previousSibling(); } } /**

Return true, if node contain tag

Parameters
node- context for searching
sname- tag name
params- true, if find simple tag and false, if section

Reimplemented in aCalcTemplate.

◆ getValue()

QString aOOTemplate::getValue ( const QString & name)
virtual

Returns value parameter name

Reimplemented from iTemplate.

References aLog::print().

Referenced by exec(), aCalcTemplate::insertTagsValues(), and insertTagsValues().

◆ insertRowValues()

void aOOTemplate::insertRowValues ( QDomNode node)
protected

insert new row in table and replace tag to value

See also
searchTags()

References clearTags().

◆ insertTagsValues()

void aOOTemplate::insertTagsValues ( QDomNode node,
const QString & tagName )
protectedvirtual

Addes to tag value of parametr tagName

Parameters
node- context
sname- tag name

Reimplemented in aCalcTemplate.

References getValue().

◆ lineFeedRemove()

bool aOOTemplate::lineFeedRemove ( const QString & filename)
virtual

Deletes from a file line feeds

References aLog::print().

Referenced by save().

◆ open()

bool aOOTemplate::open ( const QString & fname)
virtual

Open pattern.

Parameters
fname

Implements iTemplate.

References copyName, docStyle, docTpl, aLog::print(), and templateDir.

◆ result()

QString aOOTemplate::result ( )
virtual

Returns patten

Reimplemented from iTemplate.

References docTpl.

◆ save()

bool aOOTemplate::save ( const QString & fname)
virtual

Save pattern

Reimplemented from iTemplate.

References copyName, docStyle, docTpl, lineFeedRemove(), aLog::print(), and templateDir.

◆ setDir()

void aOOTemplate::setDir ( const QString & dir)
virtual

Sets working directory

Reimplemented from iTemplate.

References templateDir.

◆ setValue()

virtual void aOOTemplate::setValue ( const QString & name,
const QString & value )
virtual

Reimplemented from iTemplate.

Member Data Documentation

◆ copyName

QString aOOTemplate::copyName
protected

directory name for unzip

Referenced by close(), open(), and save().

◆ docStyle

QDomDocument aOOTemplate::docStyle
protected

Variable for store unpacking teplate stales

Referenced by cleanUpTags(), close(), exec(), open(), and save().

◆ docTpl

QDomDocument aOOTemplate::docTpl
protected

Variable for store unpacking teplate content

Referenced by cleanUpTags(), close(), exec(), open(), result(), and save().

◆ templateDir

QString aOOTemplate::templateDir
protected

directory template name

Referenced by open(), save(), and setDir().


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