My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions | Variables
rtfstyle.cpp File Reference
#include "rtfstyle.h"
#include <qfile.h>
#include <qtextstream.h>
#include <stdlib.h>
#include "message.h"

Go to the source code of this file.

Functions

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

Variables

RTFListItemInfo rtf_listItemInfo [rtf_maxIndentLevels]
 
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
 
char rtf_Style_Reset [] = "\\pard\\plain "
 
Rtf_Style_Default rtf_Style_Default []
 

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++;
}
}
QDict<StyleData> rtf_Style ( 257  )

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().

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[] = "\\pard\\plain "
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().