Skip to content

Commit

Permalink
Refactoring: modernize rtf_Style
Browse files Browse the repository at this point in the history
  • Loading branch information
doxygen committed Jan 22, 2021
1 parent 81ce4ec commit fbe73e2
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 85 deletions.
19 changes: 9 additions & 10 deletions src/rtfdocvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ QCString RTFDocVisitor::getStyle(const char *name)
{
QCString n;
n.sprintf("%s%d",name,m_indentLevel);
StyleData *sd = rtf_Style[n];
ASSERT(sd!=0);
return sd->reference();
StyleData &sd = rtf_Style[n.str()];
return sd.reference();
}

void RTFDocVisitor::incIndentLevel()
Expand Down Expand Up @@ -726,7 +725,7 @@ void RTFDocVisitor::visitPre(DocRoot *r)
if (m_hide) return;
DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocRoot)}\n");
if (r->indent()) incIndentLevel();
m_t << "{" << rtf_Style["BodyText"]->reference() << endl;
m_t << "{" << rtf_Style["BodyText"].reference() << endl;
}

void RTFDocVisitor::visitPost(DocRoot *r)
Expand All @@ -746,7 +745,7 @@ void RTFDocVisitor::visitPre(DocSimpleSect *s)
if (!m_lastIsPara) m_t << "\\par" << endl;
m_t << "{"; // start desc
//m_t << "{\\b "; // start bold
m_t << "{" << rtf_Style["Heading5"]->reference() << endl;
m_t << "{" << rtf_Style["Heading5"].reference() << endl;
switch(s->type())
{
case DocSimpleSect::See:
Expand Down Expand Up @@ -869,7 +868,7 @@ void RTFDocVisitor::visitPre(DocSection *s)
int level = QMIN(s->level()+1,4);
heading.sprintf("Heading%d",level);
// set style
m_t << rtf_Style[heading]->reference() << endl;
m_t << rtf_Style[heading.str()].reference() << endl;
// make table of contents entry
filter(s->title());
m_t << endl << "\\par" << "}" << endl;
Expand Down Expand Up @@ -955,7 +954,7 @@ void RTFDocVisitor::visitPre(DocHtmlDescTitle *)
DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlDescTitle)}\n");
//m_t << "\\par" << endl;
//m_t << "{\\b ";
m_t << "{" << rtf_Style["Heading5"]->reference() << endl;
m_t << "{" << rtf_Style["Heading5"].reference() << endl;
m_lastIsPara=FALSE;
}

Expand Down Expand Up @@ -1160,7 +1159,7 @@ void RTFDocVisitor::visitPre(DocHtmlHeader *header)
int level = QMIN(header->level(),5);
heading.sprintf("Heading%d",level);
// set style
m_t << rtf_Style[heading]->reference();
m_t << rtf_Style[heading.str()].reference();
// make open table of contents entry that will be closed in visitPost method
m_t << "{\\tc\\tcl" << level << " ";
m_lastIsPara=FALSE;
Expand Down Expand Up @@ -1386,7 +1385,7 @@ void RTFDocVisitor::visitPre(DocParamSect *s)
m_t << "{"; // start param list
if (!m_lastIsPara) m_t << "\\par" << endl;
//m_t << "{\\b "; // start bold
m_t << "{" << rtf_Style["Heading5"]->reference() << endl;
m_t << "{" << rtf_Style["Heading5"].reference() << endl;
switch(s->type())
{
case DocParamSect::Param:
Expand Down Expand Up @@ -1612,7 +1611,7 @@ void RTFDocVisitor::visitPre(DocXRefItem *x)
}
m_t << "{"; // start param list
//m_t << "{\\b "; // start bold
m_t << "{" << rtf_Style["Heading5"]->reference() << endl;
m_t << "{" << rtf_Style["Heading5"].reference() << endl;
if (Config_getBool(RTF_HYPERLINKS) && !anonymousEnum)
{
QCString refName;
Expand Down
Loading

0 comments on commit fbe73e2

Please sign in to comment.