1 /******************************************************************************
6 * Copyright (C) 1997-2012 by Dimitri van Heesch.
8 * Permission to use, copy, modify, and distribute this software and its
9 * documentation under the terms of the GNU General Public License is hereby
10 * granted. No representations are made about the suitability of this software
11 * for any purpose. It is provided "as is" without express or implied warranty.
12 * See the GNU General Public License for more details.
14 * Documents produced by Doxygen are derivative works derived from the
15 * input used in their production; they are not affected by this license.
19 #include "rtfdocvisitor.h"
20 #include "docparser.h"
23 #include "outputgen.h"
29 #include <qfileinfo.h>
30 #include "parserintf.h"
34 //#define DBG_RTF(x) m_t << x
35 #define DBG_RTF(x) do {} while(0)
37 static QCString align(DocHtmlCell *cell)
39 HtmlAttribList attrs = cell->attribs();
41 for (i=0; i<attrs.count(); ++i)
43 if (attrs.at(i)->name.lower()=="align")
45 if (attrs.at(i)->value.lower()=="center")
47 else if (attrs.at(i)->value.lower()=="right")
55 RTFDocVisitor::RTFDocVisitor(FTextStream &t,CodeOutputInterface &ci,
57 : DocVisitor(DocVisitor_RTF), m_t(t), m_ci(ci), m_insidePre(FALSE),
58 m_hide(FALSE), m_indentLevel(0), m_lastIsPara(FALSE), m_langExt(langExt)
62 QCString RTFDocVisitor::getStyle(const char *name)
65 n.sprintf("%s%d",name,m_indentLevel);
66 StyleData *sd = rtf_Style[n];
71 void RTFDocVisitor::incIndentLevel()
73 if (m_indentLevel<rtf_maxIndentLevels-1) m_indentLevel++;
76 void RTFDocVisitor::decIndentLevel()
78 if (m_indentLevel>0) m_indentLevel--;
81 //--------------------------------------
82 // visitor functions for leaf nodes
83 //--------------------------------------
85 void RTFDocVisitor::visit(DocWord *w)
88 DBG_RTF("{\\comment RTFDocVisitor::visit(DocWord)}\n");
93 void RTFDocVisitor::visit(DocLinkedWord *w)
96 DBG_RTF("{\\comment RTFDocVisitor::visit(DocLinkedWord)}\n");
97 startLink(w->ref(),w->file(),w->anchor());
103 void RTFDocVisitor::visit(DocWhiteSpace *w)
106 DBG_RTF("{\\comment RTFDocVisitor::visit(DocWhiteSpace)}\n");
118 void RTFDocVisitor::visit(DocSymbol *s)
121 DBG_RTF("{\\comment RTFDocVisitor::visit(DocSymbol)}\n");
124 case DocSymbol::BSlash: m_t << "\\\\"; break;
125 case DocSymbol::At: m_t << "@"; break;
126 case DocSymbol::Less: m_t << "<"; break;
127 case DocSymbol::Greater: m_t << ">"; break;
128 case DocSymbol::Amp: m_t << "&"; break;
129 case DocSymbol::Dollar: m_t << "$"; break;
130 case DocSymbol::Hash: m_t << "#"; break;
131 case DocSymbol::DoubleColon: m_t << "::"; break;
132 case DocSymbol::Percent: m_t << "%"; break;
133 case DocSymbol::Pipe: m_t << "|"; break;
134 case DocSymbol::Copy: m_t << "(C)"; break;
135 case DocSymbol::Tm: m_t << "(TM)"; break;
136 case DocSymbol::Reg: m_t << "(R)"; break;
137 case DocSymbol::Apos: m_t << "'"; break;
138 case DocSymbol::Quot: m_t << "\""; break;
139 case DocSymbol::Lsquo: m_t << "`"; break;
140 case DocSymbol::Rsquo: m_t << "'"; break;
141 case DocSymbol::Ldquo: m_t << "\""; break;
142 case DocSymbol::Rdquo: m_t << "\""; break;
143 case DocSymbol::Ndash: m_t << "-"; break;
144 case DocSymbol::Mdash: m_t << "--"; break;
145 case DocSymbol::Uml: switch(s->letter())
147 case 'A' : m_t << '\304'; break;
148 case 'E' : m_t << '\313'; break;
149 case 'I' : m_t << '\317'; break;
150 case 'O' : m_t << '\326'; break;
151 case 'U' : m_t << '\334'; break;
152 case 'Y' : m_t << 'Y'; break;
153 case 'a' : m_t << '\344'; break;
154 case 'e' : m_t << '\353'; break;
155 case 'i' : m_t << '\357'; break;
156 case 'o' : m_t << '\366'; break;
157 case 'u' : m_t << '\374'; break;
158 case 'y' : m_t << '\377'; break;
159 default: m_t << '?'; break;
162 case DocSymbol::Acute: switch(s->letter())
164 case 'A' : m_t << '\301'; break;
165 case 'E' : m_t << '\311'; break;
166 case 'I' : m_t << '\315'; break;
167 case 'O' : m_t << '\323'; break;
168 case 'U' : m_t << '\332'; break;
169 case 'Y' : m_t << '\335'; break;
170 case 'a' : m_t << '\341'; break;
171 case 'e' : m_t << '\351'; break;
172 case 'i' : m_t << '\355'; break;
173 case 'o' : m_t << '\363'; break;
174 case 'u' : m_t << '\372'; break;
175 case 'y' : m_t << '\375'; break;
176 default: m_t << '?'; break;
179 case DocSymbol::Grave: switch(s->letter())
181 case 'A' : m_t << '\300'; break;
182 case 'E' : m_t << '\310'; break;
183 case 'I' : m_t << '\314'; break;
184 case 'O' : m_t << '\322'; break;
185 case 'U' : m_t << '\331'; break;
186 case 'a' : m_t << '\340'; break;
187 case 'e' : m_t << '\350'; break;
188 case 'i' : m_t << '\354'; break;
189 case 'o' : m_t << '\362'; break;
190 case 'u' : m_t << '\371'; break;
191 default: m_t << '?'; break;
194 case DocSymbol::Circ: switch(s->letter())
196 case 'A' : m_t << '\302'; break;
197 case 'E' : m_t << '\312'; break;
198 case 'I' : m_t << '\316'; break;
199 case 'O' : m_t << '\324'; break;
200 case 'U' : m_t << '\333'; break;
201 case 'a' : m_t << '\342'; break;
202 case 'e' : m_t << '\352'; break;
203 case 'i' : m_t << '\356'; break;
204 case 'o' : m_t << '\364'; break;
205 case 'u' : m_t << '\373'; break;
206 default: m_t << '?'; break;
209 case DocSymbol::Tilde: switch(s->letter())
211 case 'A' : m_t << '\303'; break;
212 case 'N' : m_t << '\321'; break;
213 case 'O' : m_t << '\325'; break;
214 case 'a' : m_t << '\343'; break;
215 case 'n' : m_t << '\361'; break;
216 case 'o' : m_t << '\365'; break;
217 default: m_t << '?'; break;
220 case DocSymbol::Cedil: switch(s->letter())
222 case 'C' : m_t << '\307'; break;
223 case 'c' : m_t << '\347'; break;
224 default: m_t << '?'; break;
227 case DocSymbol::Slash: switch(s->letter())
229 case 'O' : m_t << '\330'; break;
230 case 'o' : m_t << '\370'; break;
231 default: m_t << '?'; break;
234 case DocSymbol::Ring: switch(s->letter())
236 case 'A' : m_t << '\305'; break;
237 case 'a' : m_t << '\345'; break;
238 default: m_t << '?'; break;
241 case DocSymbol::Szlig: m_t << "\337"; break;
242 case DocSymbol::Nbsp: m_t << "\\~ "; break;
243 case DocSymbol::Aelig: m_t << "\346"; break;
244 case DocSymbol::AElig: m_t << "\306"; break;
245 case DocSymbol::GrkGamma: m_t << "Gamma "; break;
246 case DocSymbol::GrkDelta: m_t << "Delta "; break;
247 case DocSymbol::GrkTheta: m_t << "Theta "; break;
248 case DocSymbol::GrkLambda: m_t << "Lambda "; break;
249 case DocSymbol::GrkXi: m_t << "Xi "; break;
250 case DocSymbol::GrkPi: m_t << "Pi "; break;
251 case DocSymbol::GrkSigma: m_t << "Sigma "; break;
252 case DocSymbol::GrkUpsilon: m_t << "Upsilon "; break;
253 case DocSymbol::GrkPhi: m_t << "Phi "; break;
254 case DocSymbol::GrkPsi: m_t << "Psi "; break;
255 case DocSymbol::GrkOmega: m_t << "Omega "; break;
256 case DocSymbol::Grkalpha: m_t << "alpha "; break;
257 case DocSymbol::Grkbeta: m_t << "beta "; break;
258 case DocSymbol::Grkgamma: m_t << "gamma "; break;
259 case DocSymbol::Grkdelta: m_t << "delta "; break;
260 case DocSymbol::Grkepsilon: m_t << "epsilon "; break;
261 case DocSymbol::Grkzeta: m_t << "zeta "; break;
262 case DocSymbol::Grketa: m_t << "eta "; break;
263 case DocSymbol::Grktheta: m_t << "theta "; break;
264 case DocSymbol::Grkiota: m_t << "iota "; break;
265 case DocSymbol::Grkkappa: m_t << "kappa "; break;
266 case DocSymbol::Grklambda: m_t << "lambda "; break;
267 case DocSymbol::Grkmu: m_t << "mu "; break;
268 case DocSymbol::Grknu: m_t << "nu "; break;
269 case DocSymbol::Grkxi: m_t << "xi "; break;
270 case DocSymbol::Grkpi: m_t << "pi "; break;
271 case DocSymbol::Grkrho: m_t << "rho "; break;
272 case DocSymbol::Grksigma: m_t << "sigma "; break;
273 case DocSymbol::Grktau: m_t << "tau "; break;
274 case DocSymbol::Grkupsilon: m_t << "upsilon "; break;
275 case DocSymbol::Grkphi: m_t << "phi "; break;
276 case DocSymbol::Grkchi: m_t << "chi "; break;
277 case DocSymbol::Grkpsi: m_t << "psi "; break;
278 case DocSymbol::Grkomega: m_t << "omega "; break;
279 case DocSymbol::Grkvarsigma: m_t << "sigma "; break;
280 case DocSymbol::Section: m_t << "\247"; break;
281 case DocSymbol::Degree: m_t << "\260"; break;
282 case DocSymbol::Prime: m_t << "'"; break;
283 case DocSymbol::DoublePrime: m_t << "\""; break;
284 case DocSymbol::Infinity: m_t << "inf "; break;
285 case DocSymbol::EmptySet: m_t << "empty "; break;
286 case DocSymbol::PlusMinus: m_t << "\261"; break;
287 case DocSymbol::Times: m_t << "\327"; break;
288 case DocSymbol::Minus: m_t << "-"; break;
289 case DocSymbol::CenterDot: m_t << "."; break;
290 case DocSymbol::Partial: m_t << "partial "; break;
291 case DocSymbol::Nabla: m_t << "nabla "; break;
292 case DocSymbol::SquareRoot: m_t << "sqrt "; break;
293 case DocSymbol::Perpendicular: m_t << "perp "; break;
294 case DocSymbol::Sum: m_t << "sum "; break;
295 case DocSymbol::Integral: m_t << "int "; break;
296 case DocSymbol::Product: m_t << "prod "; break;
297 case DocSymbol::Similar: m_t << "~"; break;
298 case DocSymbol::Approx: m_t << "approx "; break;
299 case DocSymbol::NotEqual: m_t << "!="; break;
300 case DocSymbol::Equivalent: m_t << "equiv "; break;
301 case DocSymbol::Proportional: m_t << "propto "; break;
302 case DocSymbol::LessEqual: m_t << "<="; break;
303 case DocSymbol::GreaterEqual: m_t << ">="; break;
304 case DocSymbol::LeftArrow: m_t << "<-"; break;
305 case DocSymbol::RightArrow: m_t << "->"; break;
306 case DocSymbol::SetIn: m_t << "in "; break;
307 case DocSymbol::SetNotIn: m_t << "notin "; break;
308 case DocSymbol::LeftCeil: m_t << "lceil "; break;
309 case DocSymbol::RightCeil: m_t << "rceil "; break;
310 case DocSymbol::LeftFloor: m_t << "lfloor "; break;
311 case DocSymbol::RightFloor: m_t << "rfloor "; break;
313 err("error: unknown symbol found\n");
318 void RTFDocVisitor::visit(DocURL *u)
321 DBG_RTF("{\\comment RTFDocVisitor::visit(DocURL)}\n");
322 if (Config_getBool("RTF_HYPERLINKS"))
326 "{ HYPERLINK \\\\l \"";
327 if (u->isEmail()) m_t << "mailto:";
348 void RTFDocVisitor::visit(DocLineBreak *)
351 DBG_RTF("{\\comment RTFDocVisitor::visit(DocLineBreak)}\n");
356 void RTFDocVisitor::visit(DocHorRuler *)
359 DBG_RTF("{\\comment RTFDocVisitor::visit(DocHorRuler)}\n");
360 m_t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw5\\brsp20 \\adjustright \\par}" << endl;
364 void RTFDocVisitor::visit(DocStyleChange *s)
368 DBG_RTF("{\\comment RTFDocVisitor::visit(DocStyleChange)}\n");
371 case DocStyleChange::Bold:
372 if (s->enable()) m_t << "{\\b "; else m_t << "} ";
374 case DocStyleChange::Italic:
375 if (s->enable()) m_t << "{\\i "; else m_t << "} ";
377 case DocStyleChange::Code:
378 if (s->enable()) m_t << "{\\f2 "; else m_t << "} ";
380 case DocStyleChange::Subscript:
381 if (s->enable()) m_t << "{\\sub "; else m_t << "} ";
383 case DocStyleChange::Superscript:
384 if (s->enable()) m_t << "{\\super "; else m_t << "} ";
386 case DocStyleChange::Center:
387 if (s->enable()) m_t << "{\\qc "; else m_t << "} ";
389 case DocStyleChange::Small:
390 if (s->enable()) m_t << "{\\sub "; else m_t << "} ";
392 case DocStyleChange::Preformatted:
396 m_t << "\\par" << endl;
397 m_t << rtf_Style_Reset << getStyle("CodeExample");
408 case DocStyleChange::Div: /* HTML only */ break;
409 case DocStyleChange::Span: /* HTML only */ break;
413 void RTFDocVisitor::visit(DocVerbatim *s)
416 DBG_RTF("{\\comment RTFDocVisitor::visit(DocVerbatim)}\n");
417 QCString lang = m_langExt;
418 if (!s->language().isEmpty()) // explicit language setting
420 lang = s->language();
424 case DocVerbatim::Code: // fall though
426 m_t << "\\par" << endl;
427 m_t << rtf_Style_Reset << getStyle("CodeExample");
428 Doxygen::parserManager->getParser(lang)
429 ->parseCode(m_ci,s->context(),s->text(),
430 s->isExample(),s->exampleFile());
431 //m_t << "\\par" << endl;
434 case DocVerbatim::Verbatim:
436 m_t << "\\par" << endl;
437 m_t << rtf_Style_Reset << getStyle("CodeExample");
438 filter(s->text(),TRUE);
439 //m_t << "\\par" << endl;
442 case DocVerbatim::RtfOnly:
445 case DocVerbatim::HtmlOnly:
446 case DocVerbatim::LatexOnly:
447 case DocVerbatim::XmlOnly:
448 case DocVerbatim::ManOnly:
451 case DocVerbatim::Dot:
453 static int dotindex = 1;
454 QCString fileName(4096);
456 fileName.sprintf("%s%d%s",
457 (Config_getString("RTF_OUTPUT")+"/inline_dotgraph_").data(),
461 QFile file(fileName);
462 if (!file.open(IO_WriteOnly))
464 err("Could not open file %s for writing\n",fileName.data());
466 file.writeBlock( s->text(), s->text().length() );
468 m_t << "\\par{\\qc "; // center picture
469 writeDotFile(fileName);
471 if (Config_getBool("DOT_CLEANUP")) file.remove();
474 case DocVerbatim::Msc:
476 static int mscindex = 1;
477 QCString baseName(4096);
479 baseName.sprintf("%s%d",
480 (Config_getString("RTF_OUTPUT")+"/inline_mscgraph_").data(),
483 QFile file(baseName+".msc");
484 if (!file.open(IO_WriteOnly))
486 err("Could not open file %s for writing\n",baseName.data());
488 QCString text = "msc {";
491 file.writeBlock( text, text.length() );
493 m_t << "\\par{\\qc "; // center picture
494 writeMscFile(baseName);
496 if (Config_getBool("DOT_CLEANUP")) file.remove();
503 void RTFDocVisitor::visit(DocAnchor *anc)
506 DBG_RTF("{\\comment RTFDocVisitor::visit(DocAnchor)}\n");
508 if (!anc->file().isEmpty())
512 if (!anc->file().isEmpty() && !anc->anchor().isEmpty())
516 if (!anc->anchor().isEmpty())
518 anchor+=anc->anchor();
520 m_t << "{\\bkmkstart " << rtfFormatBmkStr(anchor) << "}" << endl;
521 m_t << "{\\bkmkend " << rtfFormatBmkStr(anchor) << "}" << endl;
525 void RTFDocVisitor::visit(DocInclude *inc)
528 DBG_RTF("{\\comment RTFDocVisitor::visit(DocInclude)}\n");
531 case DocInclude::IncWithLines:
534 m_t << "\\par" << endl;
535 m_t << rtf_Style_Reset << getStyle("CodeExample");
536 QFileInfo cfi( inc->file() );
537 FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() );
538 Doxygen::parserManager->getParser(inc->extension())
539 ->parseCode(m_ci,inc->context(),
542 inc->exampleFile(), &fd);
547 case DocInclude::Include:
549 m_t << "\\par" << endl;
550 m_t << rtf_Style_Reset << getStyle("CodeExample");
551 Doxygen::parserManager->getParser(inc->extension())
552 ->parseCode(m_ci,inc->context(),
553 inc->text(),inc->isExample(),
558 case DocInclude::DontInclude:
560 case DocInclude::HtmlInclude:
562 case DocInclude::VerbInclude:
564 m_t << "\\par" << endl;
565 m_t << rtf_Style_Reset << getStyle("CodeExample");
570 case DocInclude::Snippet:
572 if (!m_lastIsPara) m_t << "\\par" << endl;
573 m_t << rtf_Style_Reset << getStyle("CodeExample");
574 Doxygen::parserManager->getParser(inc->extension())
577 extractBlock(inc->text(),inc->blockId()),
587 void RTFDocVisitor::visit(DocIncOperator *op)
589 //printf("DocIncOperator: type=%d first=%d, last=%d text=`%s'\n",
590 // op->type(),op->isFirst(),op->isLast(),op->text().data());
591 DBG_RTF("{\\comment RTFDocVisitor::visit(DocIncOperator)}\n");
597 m_t << "\\par" << endl;
598 m_t << rtf_Style_Reset << getStyle("CodeExample");
603 if (op->type()!=DocIncOperator::Skip)
608 Doxygen::parserManager->getParser(m_langExt)
609 ->parseCode(m_ci,op->context(),op->text(),
610 op->isExample(),op->exampleFile());
627 if (!m_hide) m_t << endl;
632 void RTFDocVisitor::visit(DocFormula *f)
635 // TODO: do something sensible here, like including a bitmap
636 DBG_RTF("{\\comment RTFDocVisitor::visit(DocFormula)}\n");
641 void RTFDocVisitor::visit(DocIndexEntry *i)
644 DBG_RTF("{\\comment RTFDocVisitor::visit(DocIndexEntry)}\n");
645 m_t << "{\\xe \\v " << i->entry() << "}" << endl;
649 void RTFDocVisitor::visit(DocSimpleSectSep *)
653 void RTFDocVisitor::visit(DocCite *cite)
656 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocCite)}\n");
657 if (!cite->file().isEmpty())
659 startLink(cite->ref(),cite->file(),cite->anchor());
665 filter(cite->text());
666 if (!cite->file().isEmpty())
668 endLink(cite->ref());
677 //--------------------------------------
678 // visitor functions for compound nodes
679 //--------------------------------------
681 void RTFDocVisitor::visitPre(DocAutoList *l)
684 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocAutoList)}\n");
686 rtf_listItemInfo[m_indentLevel].isEnum = l->isEnumList();
687 rtf_listItemInfo[m_indentLevel].number = 1;
691 void RTFDocVisitor::visitPost(DocAutoList *)
694 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocAutoList)}\n");
700 void RTFDocVisitor::visitPre(DocAutoListItem *)
703 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocAutoListItem)}\n");
704 if (!m_lastIsPara) m_t << "\\par" << endl;
705 m_t << rtf_Style_Reset;
706 if (rtf_listItemInfo[m_indentLevel].isEnum)
708 m_t << getStyle("ListEnum") << endl;
709 m_t << rtf_listItemInfo[m_indentLevel].number << ".\\tab ";
710 rtf_listItemInfo[m_indentLevel].number++;
714 m_t << getStyle("ListBullet") << endl;
720 void RTFDocVisitor::visitPost(DocAutoListItem *)
723 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocAutoListItem)}\n");
726 void RTFDocVisitor::visitPre(DocPara *)
728 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocPara)}\n");
731 void RTFDocVisitor::visitPost(DocPara *p)
734 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocPara)}\n");
736 !p->isLast() && // omit <p> for last paragraph
737 !(p->parent() && // and for parameters & sections
738 p->parent()->kind()==DocNode::Kind_ParamSect
742 m_t << "\\par" << endl;
747 void RTFDocVisitor::visitPre(DocRoot *r)
750 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocRoot)}\n");
751 if (r->indent()) incIndentLevel();
752 m_t << "{" << rtf_Style["BodyText"]->reference << endl;
755 void RTFDocVisitor::visitPost(DocRoot *r)
758 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocRoot)}\n");
759 if (!m_lastIsPara && !r->singleLine()) m_t << "\\par" << endl;
762 if (r->indent()) decIndentLevel();
765 void RTFDocVisitor::visitPre(DocSimpleSect *s)
768 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSimpleSect)}\n");
769 if (!m_lastIsPara) m_t << "\\par" << endl;
770 m_t << "{"; // start desc
771 //m_t << "{\\b "; // start bold
772 m_t << "{" << rtf_Style["Heading5"]->reference << endl;
775 case DocSimpleSect::See:
776 m_t << theTranslator->trSeeAlso(); break;
777 case DocSimpleSect::Return:
778 m_t << theTranslator->trReturns(); break;
779 case DocSimpleSect::Author:
780 m_t << theTranslator->trAuthor(TRUE,TRUE); break;
781 case DocSimpleSect::Authors:
782 m_t << theTranslator->trAuthor(TRUE,FALSE); break;
783 case DocSimpleSect::Version:
784 m_t << theTranslator->trVersion(); break;
785 case DocSimpleSect::Since:
786 m_t << theTranslator->trSince(); break;
787 case DocSimpleSect::Date:
788 m_t << theTranslator->trDate(); break;
789 case DocSimpleSect::Note:
790 m_t << theTranslator->trNote(); break;
791 case DocSimpleSect::Warning:
792 m_t << theTranslator->trWarning(); break;
793 case DocSimpleSect::Pre:
794 m_t << theTranslator->trPrecondition(); break;
795 case DocSimpleSect::Post:
796 m_t << theTranslator->trPostcondition(); break;
797 case DocSimpleSect::Copyright:
798 m_t << theTranslator->trCopyright(); break;
799 case DocSimpleSect::Invar:
800 m_t << theTranslator->trInvariant(); break;
801 case DocSimpleSect::Remark:
802 m_t << theTranslator->trRemarks(); break;
803 case DocSimpleSect::Attention:
804 m_t << theTranslator->trAttention(); break;
805 case DocSimpleSect::User: break;
806 case DocSimpleSect::Rcs: break;
807 case DocSimpleSect::Unknown: break;
810 // special case 1: user defined title
811 if (s->type()!=DocSimpleSect::User && s->type()!=DocSimpleSect::Rcs)
815 m_t << "}"; // end bold
817 m_t << rtf_Style_Reset << getStyle("DescContinue");
822 void RTFDocVisitor::visitPost(DocSimpleSect *)
825 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSimpleSect)}\n");
826 if (!m_lastIsPara) m_t << "\\par" << endl;
828 m_t << "}"; // end desc
832 void RTFDocVisitor::visitPre(DocTitle *)
834 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocTitle)}\n");
837 void RTFDocVisitor::visitPost(DocTitle *)
840 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocTitle)}\n");
841 m_t << "\\par" << endl;
842 m_t << "}"; // end bold
844 m_t << rtf_Style_Reset << getStyle("DescContinue");
848 void RTFDocVisitor::visitPre(DocSimpleList *)
851 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSimpleSect)}\n");
853 rtf_listItemInfo[m_indentLevel].isEnum = FALSE;
857 void RTFDocVisitor::visitPost(DocSimpleList *)
860 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSimpleSect)}\n");
861 if (!m_lastIsPara) m_t << "\\par" << endl;
866 void RTFDocVisitor::visitPre(DocSimpleListItem *)
869 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSimpleListItem)}\n");
870 m_t << "\\par" << rtf_Style_Reset << getStyle("ListBullet") << endl;
875 void RTFDocVisitor::visitPost(DocSimpleListItem *)
878 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSimpleListItem)}\n");
881 void RTFDocVisitor::visitPre(DocSection *s)
884 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSection)}\n");
885 if (!m_lastIsPara) m_t << "\\par" << endl;
886 m_t << "{\\bkmkstart " << rtfFormatBmkStr(s->file()+"_"+s->anchor()) << "}" << endl;
887 m_t << "{\\bkmkend " << rtfFormatBmkStr(s->file()+"_"+s->anchor()) << "}" << endl;
888 m_t << "{{" // start section
891 int level = QMIN(s->level()+1,4);
892 heading.sprintf("Heading%d",level);
894 m_t << rtf_Style[heading]->reference << endl;
895 // make table of contents entry
897 m_t << endl << "\\par" << "}" << endl;
898 m_t << "{\\tc\\tcl" << level << " \\v ";
904 void RTFDocVisitor::visitPost(DocSection *)
907 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSection)}\n");
908 m_t << "\\par}" << endl; // end section
912 void RTFDocVisitor::visitPre(DocHtmlList *l)
915 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlList)}\n");
917 rtf_listItemInfo[m_indentLevel].isEnum = l->type()==DocHtmlList::Ordered;
918 rtf_listItemInfo[m_indentLevel].number = 1;
922 void RTFDocVisitor::visitPost(DocHtmlList *)
925 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlList)}\n");
926 m_t << "\\par" << "}" << endl;
930 void RTFDocVisitor::visitPre(DocHtmlListItem *)
933 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlListItem)}\n");
934 m_t << "\\par" << endl;
935 m_t << rtf_Style_Reset;
936 if (rtf_listItemInfo[m_indentLevel].isEnum)
938 m_t << getStyle("ListEnum") << endl;
939 m_t << rtf_listItemInfo[m_indentLevel].number << ".\\tab ";
940 rtf_listItemInfo[m_indentLevel].number++;
944 m_t << getStyle("ListBullet") << endl;
950 void RTFDocVisitor::visitPost(DocHtmlListItem *)
953 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlListItem)}\n");
956 void RTFDocVisitor::visitPre(DocHtmlDescList *)
959 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlDescList)}\n");
960 //m_t << "{" << endl;
961 //m_t << rtf_Style_Reset << getStyle("ListContinue");
962 //m_lastIsPara=FALSE;
965 void RTFDocVisitor::visitPost(DocHtmlDescList *)
968 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlDescList)}\n");
969 //m_t << "}" << endl;
970 //m_t << "\\par" << endl;
974 void RTFDocVisitor::visitPre(DocHtmlDescTitle *)
977 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlDescTitle)}\n");
978 //m_t << "\\par" << endl;
980 m_t << "{" << rtf_Style["Heading5"]->reference << endl;
984 void RTFDocVisitor::visitPost(DocHtmlDescTitle *)
987 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlDescTitle)}\n");
988 m_t << "\\par" << endl;
993 void RTFDocVisitor::visitPre(DocHtmlDescData *)
996 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlDescData)}\n");
998 m_t << "{" << rtf_Style_Reset << getStyle("DescContinue");
1001 void RTFDocVisitor::visitPost(DocHtmlDescData *)
1004 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlDescData)}\n");
1011 void RTFDocVisitor::visitPre(DocHtmlTable *)
1014 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlTable)}\n");
1015 if (!m_lastIsPara) m_t << "\\par" << endl;
1019 void RTFDocVisitor::visitPost(DocHtmlTable *)
1022 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlTable)}\n");
1023 m_t << "\\pard\\plain" << endl;
1024 m_t << "\\par" << endl;
1028 void RTFDocVisitor::visitPre(DocHtmlCaption *)
1030 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlCaption)}\n");
1033 void RTFDocVisitor::visitPost(DocHtmlCaption *)
1035 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlCaption)}\n");
1038 void RTFDocVisitor::visitPre(DocHtmlRow *r)
1041 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlRow)}\n");
1042 uint i,columnWidth=r->numCells()>0 ? rtf_pageWidth/r->numCells() : 10;
1043 m_t << "\\trowd \\trgaph108\\trleft-108"
1044 "\\trbrdrt\\brdrs\\brdrw10 "
1045 "\\trbrdrl\\brdrs\\brdrw10 "
1046 "\\trbrdrb\\brdrs\\brdrw10 "
1047 "\\trbrdrr\\brdrs\\brdrw10 "
1048 "\\trbrdrh\\brdrs\\brdrw10 "
1049 "\\trbrdrv\\brdrs\\brdrw10 "<< endl;
1050 for (i=0;i<r->numCells();i++)
1054 m_t << "\\clcbpat16"; // set cell shading to light grey (color 16 in the clut)
1056 m_t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10 "
1057 "\\clbrdrl\\brdrs\\brdrw10 "
1058 "\\clbrdrb\\brdrs\\brdrw10 "
1059 "\\clbrdrr \\brdrs\\brdrw10 "
1061 "\\cellx" << ((i+1)*columnWidth) << endl;
1063 m_t << "\\pard \\widctlpar\\intbl\\adjustright" << endl;
1067 void RTFDocVisitor::visitPost(DocHtmlRow *)
1070 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlRow)}\n");
1072 m_t << "\\pard \\widctlpar\\intbl\\adjustright" << endl;
1073 m_t << "{\\row }" << endl;
1077 void RTFDocVisitor::visitPre(DocHtmlCell *c)
1080 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlCell)}\n");
1081 m_t << "{" << align(c);
1085 void RTFDocVisitor::visitPost(DocHtmlCell *)
1088 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlCell)}\n");
1093 void RTFDocVisitor::visitPre(DocInternal *)
1096 //DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocInternal)}\n");
1097 //m_t << "{"; // start desc
1098 //m_t << "{\\b "; // start bold
1099 //m_t << theTranslator->trForInternalUseOnly();
1100 //m_t << "}"; // end bold
1101 //m_t << "\\par" << endl;
1103 //m_t << rtf_Style_Reset << getStyle("DescContinue");
1104 //m_lastIsPara=FALSE;
1107 void RTFDocVisitor::visitPost(DocInternal *)
1110 //DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocInternal)}\n");
1113 //m_t << "}"; // end desc
1114 //m_lastIsPara=TRUE;
1117 void RTFDocVisitor::visitPre(DocHRef *href)
1120 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHRef)}\n");
1121 if (Config_getBool("RTF_HYPERLINKS"))
1125 "{ HYPERLINK \\\\l \"" << href->url() << "\" "
1129 "{\\cs37\\ul\\cf2 ";
1139 void RTFDocVisitor::visitPost(DocHRef *)
1142 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHRef)}\n");
1143 if (Config_getBool("RTF_HYPERLINKS"))
1156 void RTFDocVisitor::visitPre(DocHtmlHeader *header)
1159 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlHeader)}\n");
1160 m_t << "{" // start section
1163 int level = QMIN(header->level()+2,4);
1164 heading.sprintf("Heading%d",level);
1166 m_t << rtf_Style[heading]->reference;
1167 // make table of contents entry
1168 m_t << "{\\tc\\tcl \\v " << level << "}";
1173 void RTFDocVisitor::visitPost(DocHtmlHeader *)
1176 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlHeader)}\n");
1178 m_t << "}" << endl; // end section
1182 void RTFDocVisitor::visitPre(DocImage *img)
1184 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocImage)}\n");
1185 if (img->type()==DocImage::Rtf)
1187 m_t << "\\par" << endl;
1189 m_t << rtf_Style_Reset << endl;
1190 m_t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
1192 m_t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
1196 else // other format -> skip
1199 // hide caption since it is not supported at the moment
1204 void RTFDocVisitor::visitPost(DocImage *)
1206 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocImage)}\n");
1210 void RTFDocVisitor::visitPre(DocDotFile *df)
1212 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocDotFile)}\n");
1213 writeDotFile(df->file());
1215 // hide caption since it is not supported at the moment
1220 void RTFDocVisitor::visitPost(DocDotFile *)
1222 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocDotFile)}\n");
1225 void RTFDocVisitor::visitPre(DocMscFile *df)
1227 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocMscFile)}\n");
1228 writeMscFile(df->file());
1230 // hide caption since it is not supported at the moment
1235 void RTFDocVisitor::visitPost(DocMscFile *)
1237 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocMscFile)}\n");
1241 void RTFDocVisitor::visitPre(DocLink *lnk)
1244 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocLink)}\n");
1245 startLink(lnk->ref(),lnk->file(),lnk->anchor());
1248 void RTFDocVisitor::visitPost(DocLink *lnk)
1251 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocLink)}\n");
1252 endLink(lnk->ref());
1255 void RTFDocVisitor::visitPre(DocRef *ref)
1258 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocRef)}\n");
1259 // when ref->isSubPage()==TRUE we use ref->file() for HTML and
1260 // ref->anchor() for LaTeX/RTF
1261 if (ref->isSubPage())
1263 startLink(ref->ref(),0,ref->anchor());
1267 if (!ref->file().isEmpty()) startLink(ref->ref(),ref->file(),ref->anchor());
1269 if (!ref->hasLinkText()) filter(ref->targetTitle());
1272 void RTFDocVisitor::visitPost(DocRef *ref)
1275 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocRef)}\n");
1276 if (!ref->file().isEmpty()) endLink(ref->ref());
1281 void RTFDocVisitor::visitPre(DocSecRefItem *)
1283 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSecRefItem)}\n");
1286 void RTFDocVisitor::visitPost(DocSecRefItem *)
1288 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSecRefItem)}\n");
1291 void RTFDocVisitor::visitPre(DocSecRefList *)
1294 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSecRefList)}\n");
1297 m_t << rtf_Style_Reset << getStyle("LatexTOC") << endl;
1298 m_t << "\\par" << endl;
1302 void RTFDocVisitor::visitPost(DocSecRefList *)
1305 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocSecRefList)}\n");
1312 //void RTFDocVisitor::visitPre(DocLanguage *l)
1314 // DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocLanguage)}\n");
1315 // QCString langId = Config_getEnum("OUTPUT_LANGUAGE");
1316 // if (l->id().lower()!=langId.lower())
1323 //void RTFDocVisitor::visitPost(DocLanguage *l)
1325 // DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocLanguage)}\n");
1326 // QCString langId = Config_getEnum("OUTPUT_LANGUAGE");
1327 // if (l->id().lower()!=langId.lower())
1333 void RTFDocVisitor::visitPre(DocParamSect *s)
1336 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocParamSect)}\n");
1337 m_t << "{"; // start param list
1338 if (!m_lastIsPara) m_t << "\\par" << endl;
1339 //m_t << "{\\b "; // start bold
1340 m_t << "{" << rtf_Style["Heading5"]->reference << endl;
1343 case DocParamSect::Param:
1344 m_t << theTranslator->trParameters(); break;
1345 case DocParamSect::RetVal:
1346 m_t << theTranslator->trReturnValues(); break;
1347 case DocParamSect::Exception:
1348 m_t << theTranslator->trExceptions(); break;
1349 case DocParamSect::TemplateParam:
1351 m_t << theTranslator->trTemplateParam(); break;
1353 m_t << "Template Parameters"; break;
1360 bool useTable = s->type()==DocParamSect::Param ||
1361 s->type()==DocParamSect::RetVal ||
1362 s->type()==DocParamSect::Exception ||
1363 s->type()==DocParamSect::TemplateParam;
1368 m_t << rtf_Style_Reset << getStyle("DescContinue");
1372 void RTFDocVisitor::visitPost(DocParamSect *s)
1375 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocParamSect)}\n");
1376 //m_t << "\\par" << endl;
1377 bool useTable = s->type()==DocParamSect::Param ||
1378 s->type()==DocParamSect::RetVal ||
1379 s->type()==DocParamSect::Exception ||
1380 s->type()==DocParamSect::TemplateParam;
1388 void RTFDocVisitor::visitPre(DocParamList *pl)
1390 static int columnPos[4][5] =
1391 { { 2, 25, 100, 100, 100 }, // no inout, no type
1392 { 3, 14, 35, 100, 100 }, // inout, no type
1393 { 3, 25, 50, 100, 100 }, // no inout, type
1394 { 4, 14, 35, 55, 100 }, // inout, type
1398 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocParamList)}\n");
1400 DocParamSect::Type parentType = DocParamSect::Unknown;
1401 DocParamSect *sect = 0;
1402 if (pl->parent() && pl->parent()->kind()==DocNode::Kind_ParamSect)
1404 parentType = ((DocParamSect*)pl->parent())->type();
1405 sect=(DocParamSect*)pl->parent();
1407 bool useTable = parentType==DocParamSect::Param ||
1408 parentType==DocParamSect::RetVal ||
1409 parentType==DocParamSect::Exception ||
1410 parentType==DocParamSect::TemplateParam;
1411 if (sect && sect->hasInOutSpecifier()) config+=1;
1412 if (sect && sect->hasTypeSpecifier()) config+=2;
1416 m_t << "\\trowd \\trgaph108\\trleft426\\tblind426"
1417 "\\trbrdrt\\brdrs\\brdrw10\\brdrcf15 "
1418 "\\trbrdrl\\brdrs\\brdrw10\\brdrcf15 "
1419 "\\trbrdrb\\brdrs\\brdrw10\\brdrcf15 "
1420 "\\trbrdrr\\brdrs\\brdrw10\\brdrcf15 "
1421 "\\trbrdrh\\brdrs\\brdrw10\\brdrcf15 "
1422 "\\trbrdrv\\brdrs\\brdrw10\\brdrcf15 "<< endl;
1423 for (i=0;i<columnPos[config][0];i++)
1425 m_t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10\\brdrcf15 "
1426 "\\clbrdrl\\brdrs\\brdrw10\\brdrcf15 "
1427 "\\clbrdrb\\brdrs\\brdrw10\\brdrcf15 "
1428 "\\clbrdrr \\brdrs\\brdrw10\\brdrcf15 "
1430 "\\cellx" << (rtf_pageWidth*columnPos[config][i+1]/100) << endl;
1432 m_t << "\\pard \\widctlpar\\intbl\\adjustright" << endl;
1435 if (sect && sect->hasInOutSpecifier())
1442 // Put in the direction: in/out/in,out if specified.
1443 if (pl->direction()!=DocParamSect::Unspecified)
1445 if (pl->direction()==DocParamSect::In)
1449 else if (pl->direction()==DocParamSect::Out)
1453 else if (pl->direction()==DocParamSect::InOut)
1465 if (sect && sect->hasTypeSpecifier())
1471 QListIterator<DocNode> li(pl->paramTypes());
1474 for (li.toFirst();(type=li.current());++li)
1476 if (!first) m_t << " | "; else first=FALSE;
1477 if (type->kind()==DocNode::Kind_Word)
1479 visit((DocWord*)type);
1481 else if (type->kind()==DocNode::Kind_LinkedWord)
1483 visit((DocLinkedWord*)type);
1499 //QStrListIterator li(pl->parameters());
1501 QListIterator<DocNode> li(pl->parameters());
1504 for (li.toFirst();(param=li.current());++li)
1506 if (!first) m_t << ","; else first=FALSE;
1507 if (param->kind()==DocNode::Kind_Word)
1509 visit((DocWord*)param);
1511 else if (param->kind()==DocNode::Kind_LinkedWord)
1513 visit((DocLinkedWord*)param);
1525 void RTFDocVisitor::visitPost(DocParamList *pl)
1528 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocParamList)}\n");
1530 DocParamSect::Type parentType = DocParamSect::Unknown;
1531 //DocParamSect *sect = 0;
1532 if (pl->parent() && pl->parent()->kind()==DocNode::Kind_ParamSect)
1534 parentType = ((DocParamSect*)pl->parent())->type();
1535 //sect=(DocParamSect*)pl->parent();
1537 bool useTable = parentType==DocParamSect::Param ||
1538 parentType==DocParamSect::RetVal ||
1539 parentType==DocParamSect::Exception ||
1540 parentType==DocParamSect::TemplateParam;
1543 m_t << "\\cell }" << endl;
1544 //m_t << "\\pard \\widctlpar\\intbl\\adjustright" << endl;
1545 m_t << "{\\row }" << endl;
1549 m_t << "\\par" << endl;
1555 void RTFDocVisitor::visitPre(DocXRefItem *x)
1558 bool anonymousEnum = x->file()=="@";
1559 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocXRefItem)}\n");
1560 m_t << "{"; // start param list
1561 //m_t << "{\\b "; // start bold
1562 m_t << "{" << rtf_Style["Heading5"]->reference << endl;
1563 if (Config_getBool("RTF_HYPERLINKS") && !anonymousEnum)
1566 if (!x->file().isEmpty())
1570 if (!x->file().isEmpty() && !x->anchor().isEmpty())
1574 if (!x->anchor().isEmpty())
1576 refName+=x->anchor();
1581 "{ HYPERLINK \\\\l \"" << refName << "\" "
1585 "{\\cs37\\ul\\cf2 ";
1597 m_t << "}"; // end bold
1599 m_t << rtf_Style_Reset << getStyle("DescContinue");
1603 void RTFDocVisitor::visitPost(DocXRefItem *)
1606 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocXRefItem)}\n");
1607 m_t << "\\par" << endl;
1609 m_t << "}" << endl; // end xref item
1613 void RTFDocVisitor::visitPre(DocInternalRef *ref)
1616 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocInternalRef)}\n");
1617 startLink("",ref->file(),ref->anchor());
1620 void RTFDocVisitor::visitPost(DocInternalRef *)
1623 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocInternalRef)}\n");
1628 void RTFDocVisitor::visitPre(DocCopy *)
1631 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocCopy)}\n");
1634 void RTFDocVisitor::visitPost(DocCopy *)
1637 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocCopy)}\n");
1640 void RTFDocVisitor::visitPre(DocText *)
1643 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocText)}\n");
1646 void RTFDocVisitor::visitPost(DocText *)
1649 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocText)}\n");
1652 void RTFDocVisitor::visitPre(DocHtmlBlockQuote *)
1655 DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlBlockQuote)}\n");
1656 if (!m_lastIsPara) m_t << "\\par" << endl;
1657 m_t << "{"; // start desc
1659 m_t << rtf_Style_Reset << getStyle("DescContinue");
1662 void RTFDocVisitor::visitPost(DocHtmlBlockQuote *)
1665 DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlBlockQuote)}\n");
1666 if (!m_lastIsPara) m_t << "\\par" << endl;
1668 m_t << "}"; // end desc
1673 //static char* getMultiByte(int c)
1675 // static char s[10];
1676 // sprintf(s,"\\'%X",c);
1680 void RTFDocVisitor::filter(const char *str,bool verbatim)
1684 const unsigned char *p=(const unsigned char *)str;
1686 //unsigned char pc='\0';
1689 //static bool MultiByte = FALSE;
1694 // m_t << getMultiByte( c );
1695 // MultiByte = FALSE;
1700 // MultiByte = TRUE;
1701 // m_t << getMultiByte( c );
1707 case '{': m_t << "\\{"; break;
1708 case '}': m_t << "\\}"; break;
1709 case '\\': m_t << "\\\\"; break;
1710 case '\n': if (verbatim)
1712 m_t << "\\par" << endl;
1719 default: m_t << (char)c;
1726 void RTFDocVisitor::startLink(const QCString &ref,const QCString &file,const QCString &anchor)
1728 if (ref.isEmpty() && Config_getBool("RTF_HYPERLINKS"))
1731 if (!file.isEmpty())
1735 if (!file.isEmpty() && anchor)
1744 m_t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \"";
1745 m_t << rtfFormatBmkStr(refName);
1747 m_t << "}{\\fldrslt {\\cs37\\ul\\cf2 ";
1756 void RTFDocVisitor::endLink(const QCString &ref)
1758 if (ref.isEmpty() && Config_getBool("RTF_HYPERLINKS"))
1769 void RTFDocVisitor::pushEnabled()
1771 m_enabled.push(new bool(m_hide));
1774 void RTFDocVisitor::popEnabled()
1776 bool *v=m_enabled.pop();
1782 void RTFDocVisitor::writeDotFile(const QCString &fileName)
1784 QCString baseName=fileName;
1786 if ((i=baseName.findRev('/'))!=-1)
1788 baseName=baseName.right(baseName.length()-i-1);
1790 QCString outDir = Config_getString("RTF_OUTPUT");
1791 writeDotGraphFromFile(fileName,outDir,baseName,BITMAP);
1792 if (!m_lastIsPara) m_t << "\\par" << endl;
1794 m_t << rtf_Style_Reset;
1795 m_t << "\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
1796 m_t << baseName << "." << Config_getEnum("DOT_IMAGE_FORMAT");
1797 m_t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;
1802 void RTFDocVisitor::writeMscFile(const QCString &fileName)
1804 QCString baseName=fileName;
1806 if ((i=baseName.findRev('/'))!=-1)
1808 baseName=baseName.right(baseName.length()-i-1);
1810 QCString outDir = Config_getString("RTF_OUTPUT");
1811 writeMscGraphFromFile(fileName+".msc",outDir,baseName,MSC_BITMAP);
1812 if (!m_lastIsPara) m_t << "\\par" << endl;
1814 m_t << rtf_Style_Reset;
1815 m_t << "\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"";
1816 m_t << baseName << ".png";
1817 m_t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par" << endl;