aboutsummaryrefslogtreecommitdiffstats
path: root/doc/api-documentation/html/rtfhtml_8cpp-source.html
blob: 47280d8ff86b0a93bf22e51809334097cf5ec0bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>rtfhtml.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; </center>
<hr><h1>rtfhtml.cpp</h1><div class="fragment"><pre>00001 <font class="comment">/***************************************************************************</font>
00002 <font class="comment">                          rtfhtml.cpp  -  description</font>
00003 <font class="comment">                             -------------------</font>
00004 <font class="comment">    begin                : Wed Oct 13 1999</font>
00005 <font class="comment">    copyright            : (C) 1999 by The team of BibleTime</font>
00006 <font class="comment">    email                : info@bibletime.de</font>
00007 <font class="comment"> ***************************************************************************/</font>
00008 
00009 <font class="comment">/***************************************************************************</font>
00010 <font class="comment"> *                                                                         *</font>
00011 <font class="comment"> *   This program is free software; you can redistribute it and/or modify  *</font>
00012 <font class="comment"> *   it under the terms of the GNU General Public License as published by  *</font>
00013 <font class="comment"> *   the Free Software Foundation; either version 2 of the License, or     *</font>
00014 <font class="comment"> *   (at your option) any later version.                                   *</font>
00015 <font class="comment"> *                                                                         *</font>
00016 <font class="comment"> ***************************************************************************/</font>
00017 
00018 <font class="preprocessor">#include &lt;stdlib.h&gt;</font>
00019 <font class="preprocessor">#include &lt;string.h&gt;</font>
00020 <font class="preprocessor">#include &lt;rtfhtml.h&gt;</font>
00021 
00022 
00023 RTFHTML::RTFHTML() {
00024 
00025 }
00026 
00027 
00028 <font class="keywordtype">char</font> RTFHTML::ProcessText(<font class="keywordtype">char</font> *text, <font class="keywordtype">int</font> maxlen, <font class="keyword">const</font> <a class="code" href="class_s_w_key.html">SWKey</a> *key, <font class="keyword">const</font> <a class="code" href="class_s_w_module.html">SWModule</a> *module)
00029 {
00030         <font class="keywordtype">char</font> *to, *from;
00031         <font class="keywordtype">int</font> len;
00032         <font class="keywordtype">bool</font> center = <font class="keyword">false</font>;
00033 
00034         len = strlen(text) + 1;                                         <font class="comment">// shift string to right of buffer</font>
00035         <font class="keywordflow">if</font> (len &lt; maxlen) {
00036                 memmove(&amp;text[maxlen - len], text, len);
00037                 from = &amp;text[maxlen - len];
00038         }
00039         <font class="keywordflow">else</font>    from = text;                                                    <font class="comment">// -------------------------------</font>
00040         <font class="keywordflow">for</font> (to = text; *from; from++) {
00041                 <font class="keywordflow">if</font> (*from == <font class="charliteral">'\\'</font>) <font class="comment">// a RTF command</font>
00042                 {
00043                         <font class="keywordflow">if</font> ((from[1] == <font class="charliteral">'p'</font>) &amp;&amp; (from[2] == <font class="charliteral">'a'</font>) &amp;&amp; (from[3] == <font class="charliteral">'r'</font>) &amp;&amp; (from[4] == <font class="charliteral">'d'</font>))
00044                         { <font class="comment">// switch all modifier off</font>
00045                                 <font class="keywordflow">if</font> (center)
00046                                 {
00047                                         *to++ = <font class="charliteral">'&lt;'</font>;
00048                                         *to++ = <font class="charliteral">'/'</font>;
00049                                         *to++ = <font class="charliteral">'C'</font>;
00050                                         *to++ = <font class="charliteral">'E'</font>;
00051                                         *to++ = <font class="charliteral">'N'</font>;
00052                                         *to++ = <font class="charliteral">'T'</font>;
00053                                         *to++ = <font class="charliteral">'E'</font>;
00054                                         *to++ = <font class="charliteral">'R'</font>;
00055                                         *to++ = <font class="charliteral">'&gt;'</font>;
00056                                         center = <font class="keyword">false</font>;
00057                                 }
00058                                 from += 4;
00059                                 <font class="keywordflow">continue</font>;
00060                         }
00061                         <font class="keywordflow">if</font> ((from[1] == <font class="charliteral">'p'</font>) &amp;&amp; (from[2] == <font class="charliteral">'a'</font>) &amp;&amp; (from[3] == <font class="charliteral">'r'</font>))
00062                         {
00063                                 *to++ = <font class="charliteral">'&lt;'</font>;
00064                                 *to++ = <font class="charliteral">'P'</font>;
00065                                 *to++ = <font class="charliteral">'&gt;'</font>;
00066                                 *to++ = <font class="charliteral">'\n'</font>;
00067                                 from += 3;
00068                                 <font class="keywordflow">continue</font>;
00069                         }
00070                         <font class="keywordflow">if</font> (from[1] == <font class="charliteral">' '</font>)
00071                         {
00072                                 from += 1;
00073                                 <font class="keywordflow">continue</font>;
00074                         }
00075                         <font class="keywordflow">if</font> ((from[1] == <font class="charliteral">'q'</font>) &amp;&amp; (from[2] == <font class="charliteral">'c'</font>)) <font class="comment">// center on</font>
00076                         {
00077                                 <font class="keywordflow">if</font> (!center)
00078                                 {
00079                                         *to++ = <font class="charliteral">'&lt;'</font>;
00080                                         *to++ = <font class="charliteral">'C'</font>;
00081                                         *to++ = <font class="charliteral">'E'</font>;
00082                                         *to++ = <font class="charliteral">'N'</font>;
00083                                         *to++ = <font class="charliteral">'T'</font>;
00084                                         *to++ = <font class="charliteral">'E'</font>;
00085                                         *to++ = <font class="charliteral">'R'</font>;
00086                                         *to++ = <font class="charliteral">'&gt;'</font>;
00087                                         center = <font class="keyword">true</font>;
00088                                 }
00089                                 from += 2;
00090                                 <font class="keywordflow">continue</font>;
00091                         }
00092                 }
00093 
00094                 *to++ = *from;
00095         }
00096         *to++ = 0;
00097         *to = 0;
00098         <font class="keywordflow">return</font> 0;
00099 }
</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:13:00 2002 for The Sword Project by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>