My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions | Variables
rtfstyle.h File Reference
#include <qregexp.h>
#include <qdict.h>

Go to the source code of this file.

Classes

struct  RTFListItemInfo
 
struct  Rtf_Style_Default
 
struct  StyleData
 

Functions

void loadExtensions (const char *name)
 
void loadStylesheet (const char *name, QDict< StyleData > &dict)
 

Variables

const int rtf_pageWidth = 8748
 
QCString rtf_title
 
QCString rtf_subject
 
QCString rtf_comments
 
QCString rtf_company
 
QCString rtf_logoFilename
 
QCString rtf_author
 
QCString rtf_manager
 
QCString rtf_documentType
 
QCString rtf_documentId
 
QCString rtf_keywords
 
const int rtf_maxIndentLevels = 10
 
RTFListItemInfo rtf_listItemInfo [rtf_maxIndentLevels]
 
char rtf_Style_Reset []
 
Rtf_Style_Default rtf_Style_Default []
 
QDict< StyleDatartf_Style
 

Function Documentation

void loadExtensions ( const char *  name)

Definition at line 475 of file rtfstyle.cpp.

References err(), msg(), rtf_author, rtf_comments, rtf_company, rtf_documentId, rtf_documentType, rtf_keywords, rtf_logoFilename, rtf_manager, rtf_subject, rtf_title, and warn().

Referenced by RTFGenerator::init().

{
QFile file(name);
if (!file.open(IO_ReadOnly))
{
err("Can't open RTF extensions file %s. Using defaults.\n",name);
return;
}
msg("Loading RTF extensions %s...\n",name);
static const QRegExp separator("[ \t]*=[ \t]*");
uint lineNr=1;
QTextStream t(&file);
t.setEncoding(QTextStream::UnicodeUTF8);
while (!t.eof())
{
QCString s(4096); // string buffer of max line length
s = t.readLine().stripWhiteSpace().utf8();
if (s.length()==0 || s.at(0)=='#') continue; // skip blanks & comments
int sepLength;
int sepStart = separator.match(s,0,&sepLength);
if (sepStart<=0) // no valid assignment statement
{
warn(name,lineNr,"Assignment of extension field expected!\n");
continue;
}
QCString key=s.left(sepStart);
QCString data=s.data() + sepStart + sepLength;
if (key == "Title") rtf_title = data.data();
if (key == "Subject") rtf_subject = data.data();
if (key == "Comments") rtf_comments = data.data();
if (key == "Company") rtf_company = data.data();
if (key == "LogoFilename") rtf_logoFilename = data.data();
if (key == "Author") rtf_author = data.data();
if (key == "Manager") rtf_manager = data.data();
if (key == "DocumentType") rtf_documentType = data.data();
if (key == "DocumentId") rtf_documentId = data.data();
if (key == "Keywords") rtf_keywords = data.data();
lineNr++;
}
}
void loadStylesheet ( const char *  name,
QDict< StyleData > &  dict 
)

Definition at line 428 of file rtfstyle.cpp.

References err(), msg(), StyleData::setStyle(), and warn().

Referenced by RTFGenerator::init().

{
QFile file(name);
if (!file.open(IO_ReadOnly))
{
err("Can't open RTF style sheet file %s. Using defaults.\n",name);
return;
}
msg("Loading RTF style sheet %s...\n",name);
static const QRegExp separator("[ \t]*=[ \t]*");
uint lineNr=1;
QTextStream t(&file);
t.setEncoding(QTextStream::UnicodeUTF8);
while (!t.eof())
{
QCString s(4096); // string buffer of max line length
s = t.readLine().stripWhiteSpace().utf8();
if (s.isEmpty() || s.at(0)=='#') continue; // skip blanks & comments
int sepLength;
int sepStart = separator.match(s,0,&sepLength);
if (sepStart<=0) // no valid assignment statement
{
warn(name,lineNr,"Assignment of style sheet name expected!\n");
continue;
}
QCString key=s.left(sepStart);
if (dict[key]==0) // not a valid style sheet name
{
warn(name,lineNr,"Invalid style sheet name %s ignored.\n",key.data());
continue;
}
StyleData* styleData = dict.find(key);
if (styleData == 0)
{
warn(name,lineNr,"Unknown style sheet name %s ignored.\n",key.data());
continue;
}
s+=" "; // add command separator
styleData->setStyle(s.data() + sepStart + sepLength, key.data());
lineNr++;
}
}

Variable Documentation

QCString rtf_author
QCString rtf_comments

Definition at line 32 of file rtfstyle.cpp.

Referenced by loadExtensions(), and RTFGenerator::startIndexSection().

QCString rtf_company
QCString rtf_documentId

Definition at line 38 of file rtfstyle.cpp.

Referenced by RTFGenerator::endIndexSection(), and loadExtensions().

QCString rtf_documentType
QCString rtf_keywords

Definition at line 39 of file rtfstyle.cpp.

Referenced by loadExtensions(), and RTFGenerator::startIndexSection().

QCString rtf_logoFilename

Definition at line 34 of file rtfstyle.cpp.

Referenced by RTFGenerator::endIndexSection(), and loadExtensions().

QCString rtf_manager

Definition at line 36 of file rtfstyle.cpp.

Referenced by loadExtensions(), and RTFGenerator::startIndexSection().

const int rtf_maxIndentLevels = 10

Definition at line 45 of file rtfstyle.h.

Referenced by RTFDocVisitor::incIndentLevel(), and RTFGenerator::incrementIndentLevel().

const int rtf_pageWidth = 8748
QDict<StyleData> rtf_Style
Rtf_Style_Default rtf_Style_Default[]

Definition at line 43 of file rtfstyle.cpp.

Referenced by RTFGenerator::init(), and RTFGenerator::writeStyleSheetFile().

char rtf_Style_Reset[]
QCString rtf_subject

Definition at line 31 of file rtfstyle.cpp.

Referenced by loadExtensions(), and RTFGenerator::startIndexSection().

QCString rtf_title

Definition at line 30 of file rtfstyle.cpp.

Referenced by RTFGenerator::endIndexSection(), and loadExtensions().