diff options
Diffstat (limited to 'src/rtfdocvisitor.cpp')
-rw-r--r-- | src/rtfdocvisitor.cpp | 203 |
1 files changed, 11 insertions, 192 deletions
diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index 7c2fef8..67faf98 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 by Dimitri van Heesch. + * Copyright (C) 1997-2014 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its * documentation under the terms of the GNU General Public License is hereby @@ -32,6 +32,7 @@ #include "dia.h" #include "filedef.h" #include "config.h" +#include "htmlentity.h" //#define DBG_RTF(x) m_t << x #define DBG_RTF(x) do {} while(0) @@ -121,198 +122,14 @@ void RTFDocVisitor::visit(DocSymbol *s) { if (m_hide) return; DBG_RTF("{\\comment RTFDocVisitor::visit(DocSymbol)}\n"); - switch(s->symbol()) + const char *res = HtmlEntityMapper::instance()->rtf(s->symbol()); + if (res) { - case DocSymbol::BSlash: m_t << "\\\\"; break; - case DocSymbol::At: m_t << "@"; break; - case DocSymbol::Less: m_t << "<"; break; - case DocSymbol::Greater: m_t << ">"; break; - case DocSymbol::Amp: m_t << "&"; break; - case DocSymbol::Dollar: m_t << "$"; break; - case DocSymbol::Hash: m_t << "#"; break; - case DocSymbol::DoubleColon: m_t << "::"; break; - case DocSymbol::Percent: m_t << "%"; break; - case DocSymbol::Pipe: m_t << "|"; break; - case DocSymbol::Copy: m_t << "(C)"; break; - case DocSymbol::Tm: m_t << "(TM)"; break; - case DocSymbol::Reg: m_t << "(R)"; break; - case DocSymbol::Apos: m_t << "'"; break; - case DocSymbol::Quot: m_t << "\""; break; - case DocSymbol::Lsquo: m_t << "`"; break; - case DocSymbol::Rsquo: m_t << "'"; break; - case DocSymbol::Ldquo: m_t << "\""; break; - case DocSymbol::Rdquo: m_t << "\""; break; - case DocSymbol::Ndash: m_t << "-"; break; - case DocSymbol::Mdash: m_t << "--"; break; - case DocSymbol::Uml: switch(s->letter()) - { - case 'A' : m_t << '\304'; break; - case 'E' : m_t << '\313'; break; - case 'I' : m_t << '\317'; break; - case 'O' : m_t << '\326'; break; - case 'U' : m_t << '\334'; break; - case 'Y' : m_t << 'Y'; break; - case 'a' : m_t << '\344'; break; - case 'e' : m_t << '\353'; break; - case 'i' : m_t << '\357'; break; - case 'o' : m_t << '\366'; break; - case 'u' : m_t << '\374'; break; - case 'y' : m_t << '\377'; break; - default: m_t << '?'; break; - } - break; - case DocSymbol::Acute: switch(s->letter()) - { - case 'A' : m_t << '\301'; break; - case 'E' : m_t << '\311'; break; - case 'I' : m_t << '\315'; break; - case 'O' : m_t << '\323'; break; - case 'U' : m_t << '\332'; break; - case 'Y' : m_t << '\335'; break; - case 'a' : m_t << '\341'; break; - case 'e' : m_t << '\351'; break; - case 'i' : m_t << '\355'; break; - case 'o' : m_t << '\363'; break; - case 'u' : m_t << '\372'; break; - case 'y' : m_t << '\375'; break; - default: m_t << '?'; break; - } - break; - case DocSymbol::Grave: switch(s->letter()) - { - case 'A' : m_t << '\300'; break; - case 'E' : m_t << '\310'; break; - case 'I' : m_t << '\314'; break; - case 'O' : m_t << '\322'; break; - case 'U' : m_t << '\331'; break; - case 'a' : m_t << '\340'; break; - case 'e' : m_t << '\350'; break; - case 'i' : m_t << '\354'; break; - case 'o' : m_t << '\362'; break; - case 'u' : m_t << '\371'; break; - default: m_t << '?'; break; - } - break; - case DocSymbol::Circ: switch(s->letter()) - { - case 'A' : m_t << '\302'; break; - case 'E' : m_t << '\312'; break; - case 'I' : m_t << '\316'; break; - case 'O' : m_t << '\324'; break; - case 'U' : m_t << '\333'; break; - case 'a' : m_t << '\342'; break; - case 'e' : m_t << '\352'; break; - case 'i' : m_t << '\356'; break; - case 'o' : m_t << '\364'; break; - case 'u' : m_t << '\373'; break; - default: m_t << '?'; break; - } - break; - case DocSymbol::Tilde: switch(s->letter()) - { - case 'A' : m_t << '\303'; break; - case 'N' : m_t << '\321'; break; - case 'O' : m_t << '\325'; break; - case 'a' : m_t << '\343'; break; - case 'n' : m_t << '\361'; break; - case 'o' : m_t << '\365'; break; - default: m_t << '?'; break; - } - break; - case DocSymbol::Cedil: switch(s->letter()) - { - case 'C' : m_t << '\307'; break; - case 'c' : m_t << '\347'; break; - default: m_t << '?'; break; - } - break; - case DocSymbol::Slash: switch(s->letter()) - { - case 'O' : m_t << '\330'; break; - case 'o' : m_t << '\370'; break; - default: m_t << '?'; break; - } - break; - case DocSymbol::Ring: switch(s->letter()) - { - case 'A' : m_t << '\305'; break; - case 'a' : m_t << '\345'; break; - default: m_t << '?'; break; - } - break; - case DocSymbol::Szlig: m_t << "\337"; break; - case DocSymbol::Nbsp: m_t << "\\~ "; break; - case DocSymbol::Aelig: m_t << "\346"; break; - case DocSymbol::AElig: m_t << "\306"; break; - case DocSymbol::GrkGamma: m_t << "Gamma "; break; - case DocSymbol::GrkDelta: m_t << "Delta "; break; - case DocSymbol::GrkTheta: m_t << "Theta "; break; - case DocSymbol::GrkLambda: m_t << "Lambda "; break; - case DocSymbol::GrkXi: m_t << "Xi "; break; - case DocSymbol::GrkPi: m_t << "Pi "; break; - case DocSymbol::GrkSigma: m_t << "Sigma "; break; - case DocSymbol::GrkUpsilon: m_t << "Upsilon "; break; - case DocSymbol::GrkPhi: m_t << "Phi "; break; - case DocSymbol::GrkPsi: m_t << "Psi "; break; - case DocSymbol::GrkOmega: m_t << "Omega "; break; - case DocSymbol::Grkalpha: m_t << "alpha "; break; - case DocSymbol::Grkbeta: m_t << "beta "; break; - case DocSymbol::Grkgamma: m_t << "gamma "; break; - case DocSymbol::Grkdelta: m_t << "delta "; break; - case DocSymbol::Grkepsilon: m_t << "epsilon "; break; - case DocSymbol::Grkzeta: m_t << "zeta "; break; - case DocSymbol::Grketa: m_t << "eta "; break; - case DocSymbol::Grktheta: m_t << "theta "; break; - case DocSymbol::Grkiota: m_t << "iota "; break; - case DocSymbol::Grkkappa: m_t << "kappa "; break; - case DocSymbol::Grklambda: m_t << "lambda "; break; - case DocSymbol::Grkmu: m_t << "mu "; break; - case DocSymbol::Grknu: m_t << "nu "; break; - case DocSymbol::Grkxi: m_t << "xi "; break; - case DocSymbol::Grkpi: m_t << "pi "; break; - case DocSymbol::Grkrho: m_t << "rho "; break; - case DocSymbol::Grksigma: m_t << "sigma "; break; - case DocSymbol::Grktau: m_t << "tau "; break; - case DocSymbol::Grkupsilon: m_t << "upsilon "; break; - case DocSymbol::Grkphi: m_t << "phi "; break; - case DocSymbol::Grkchi: m_t << "chi "; break; - case DocSymbol::Grkpsi: m_t << "psi "; break; - case DocSymbol::Grkomega: m_t << "omega "; break; - case DocSymbol::Grkvarsigma: m_t << "sigma "; break; - case DocSymbol::Section: m_t << "\247"; break; - case DocSymbol::Degree: m_t << "\260"; break; - case DocSymbol::Prime: m_t << "'"; break; - case DocSymbol::DoublePrime: m_t << "\""; break; - case DocSymbol::Infinity: m_t << "inf "; break; - case DocSymbol::EmptySet: m_t << "empty "; break; - case DocSymbol::PlusMinus: m_t << "\261"; break; - case DocSymbol::Times: m_t << "\327"; break; - case DocSymbol::Minus: m_t << "-"; break; - case DocSymbol::CenterDot: m_t << "."; break; - case DocSymbol::Partial: m_t << "partial "; break; - case DocSymbol::Nabla: m_t << "nabla "; break; - case DocSymbol::SquareRoot: m_t << "sqrt "; break; - case DocSymbol::Perpendicular: m_t << "perp "; break; - case DocSymbol::Sum: m_t << "sum "; break; - case DocSymbol::Integral: m_t << "int "; break; - case DocSymbol::Product: m_t << "prod "; break; - case DocSymbol::Similar: m_t << "~"; break; - case DocSymbol::Approx: m_t << "approx "; break; - case DocSymbol::NotEqual: m_t << "!="; break; - case DocSymbol::Equivalent: m_t << "equiv "; break; - case DocSymbol::Proportional: m_t << "propto "; break; - case DocSymbol::LessEqual: m_t << "<="; break; - case DocSymbol::GreaterEqual: m_t << ">="; break; - case DocSymbol::LeftArrow: m_t << "<-"; break; - case DocSymbol::RightArrow: m_t << "->"; break; - case DocSymbol::SetIn: m_t << "in "; break; - case DocSymbol::SetNotIn: m_t << "notin "; break; - case DocSymbol::LeftCeil: m_t << "lceil "; break; - case DocSymbol::RightCeil: m_t << "rceil "; break; - case DocSymbol::LeftFloor: m_t << "lfloor "; break; - case DocSymbol::RightFloor: m_t << "rfloor "; break; - default: - err("unknown symbol found\n"); + m_t << res; + } + else + { + err("RTF: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE)); } m_lastIsPara=FALSE; } @@ -565,6 +382,8 @@ void RTFDocVisitor::visit(DocInclude *inc) break; case DocInclude::HtmlInclude: break; + case DocInclude::LatexInclude: + break; case DocInclude::VerbInclude: m_t << "{" << endl; m_t << "\\par" << endl; |