Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <svl/zformat.hxx>
31 : : #include <svl/macitem.hxx>
32 : : #include <vcl/svapp.hxx>
33 : : #include <svl/zforlist.hxx>
34 : :
35 : : #include <svtools/htmlout.hxx>
36 : : #include <svtools/htmlkywd.hxx>
37 : : #include <svtools/imap.hxx>
38 : : #include <svtools/imaprect.hxx>
39 : : #include <svtools/imapcirc.hxx>
40 : : #include <svtools/imappoly.hxx>
41 : : #include "svl/urihelper.hxx"
42 : :
43 : : #if defined(UNX)
44 : : const sal_Char HTMLOutFuncs::sNewLine = '\012';
45 : : #else
46 : : const sal_Char HTMLOutFuncs::sNewLine[] = "\015\012";
47 : : #endif
48 : :
49 : : #define TXTCONV_BUFFER_SIZE 20
50 : :
51 : 20 : HTMLOutContext::HTMLOutContext( rtl_TextEncoding eDestEnc )
52 : : {
53 : : m_eDestEnc = RTL_TEXTENCODING_DONTKNOW == eDestEnc
54 : : ? osl_getThreadTextEncoding()
55 [ - + ]: 20 : : eDestEnc;
56 : :
57 : 20 : m_hConv = rtl_createUnicodeToTextConverter( eDestEnc );
58 : : DBG_ASSERT( m_hConv,
59 : : "HTMLOutContext::HTMLOutContext: no converter for source encoding" );
60 : 20 : m_hContext = m_hConv ? rtl_createUnicodeToTextContext( m_hConv )
61 [ + - ]: 20 : : (rtl_TextToUnicodeContext)1;
62 : 20 : }
63 : :
64 : 20 : HTMLOutContext::~HTMLOutContext()
65 : : {
66 : 20 : rtl_destroyUnicodeToTextContext( m_hConv, m_hContext );
67 : 20 : rtl_destroyUnicodeToTextConverter( m_hConv );
68 : 20 : }
69 : :
70 : 216 : const sal_Char *lcl_svhtml_GetEntityForChar( sal_Unicode c,
71 : : rtl_TextEncoding eDestEnc )
72 : : {
73 : 216 : const sal_Char* pStr = 0;
74 : :
75 : : // Note: We currently handle special cases for ISO-8859-2 here simply because
76 : : // the code was already submitted. But we should also handle other code pages
77 : : // as well as the code becomes available.
78 : :
79 [ + - ][ - + ]: 216 : if( eDestEnc == RTL_TEXTENCODING_ISO_8859_2 || eDestEnc == RTL_TEXTENCODING_MS_1250 )
80 : : {
81 : : // Don't handle the following characters for Easter European (ISO-8859-2).
82 [ # # ]: 0 : switch ( c )
83 : : {
84 : : case 164: // curren
85 : : case 184: // ccedil
86 : : case 193: // Aacute
87 : : case 194: // Acirc
88 : : case 196: // Auml
89 : : case 199: // Ccedil
90 : : case 201: // Eacute
91 : : case 203: // Euml
92 : : case 205: // Iacute
93 : : case 206: // Icirc
94 : : case 211: // Oacute
95 : : case 212: // Ocirc
96 : : case 214: // Ouml
97 : : case 215: // times
98 : : case 218: // Uacute
99 : : case 220: // Uuml
100 : : case 221: // Yacute
101 : : case 225: // aacute
102 : : case 226: // acirc
103 : : case 228: // auml
104 : : case 233: // eacute
105 : : case 235: // euml
106 : : case 237: // iacute
107 : : case 238: // icirc
108 : : case 243: // oacute
109 : : case 244: // ocirc
110 : : case 246: // ouml
111 : : case 247: // divide
112 : : case 250: // uacute
113 : : case 252: // uuml
114 : : case 253: // yacute
115 : : case 352: // Scaron
116 : : case 353: // scaron
117 : 0 : return pStr;
118 : : }
119 : : }
120 : :
121 : : // TODO: handle more special cases for other code pages.
122 : :
123 [ - - - - : 216 : switch( c )
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - -
+ ]
124 : : {
125 : : // case '\x0a': return HTMLOutFuncs::Out_Tag( rStream, OOO_STRING_SVTOOLS_HTML_linebreak );
126 : :
127 : 0 : case '<': pStr = OOO_STRING_SVTOOLS_HTML_C_lt; break;
128 : 0 : case '>': pStr = OOO_STRING_SVTOOLS_HTML_C_gt; break;
129 : 0 : case '&': pStr = OOO_STRING_SVTOOLS_HTML_C_amp; break;
130 : 0 : case '"': pStr = OOO_STRING_SVTOOLS_HTML_C_quot; break;
131 : :
132 : 0 : case 161: pStr = OOO_STRING_SVTOOLS_HTML_S_iexcl; break;
133 : 0 : case 162: pStr = OOO_STRING_SVTOOLS_HTML_S_cent; break;
134 : 0 : case 163: pStr = OOO_STRING_SVTOOLS_HTML_S_pound; break;
135 : 0 : case 164: pStr = OOO_STRING_SVTOOLS_HTML_S_curren; break;
136 : 0 : case 165: pStr = OOO_STRING_SVTOOLS_HTML_S_yen; break;
137 : 0 : case 166: pStr = OOO_STRING_SVTOOLS_HTML_S_brvbar; break;
138 : 0 : case 167: pStr = OOO_STRING_SVTOOLS_HTML_S_sect; break;
139 : 0 : case 168: pStr = OOO_STRING_SVTOOLS_HTML_S_uml; break;
140 : 0 : case 169: pStr = OOO_STRING_SVTOOLS_HTML_S_copy; break;
141 : 0 : case 170: pStr = OOO_STRING_SVTOOLS_HTML_S_ordf; break;
142 : 0 : case 171: pStr = OOO_STRING_SVTOOLS_HTML_S_laquo; break;
143 : 0 : case 172: pStr = OOO_STRING_SVTOOLS_HTML_S_not; break;
144 : 0 : case 174: pStr = OOO_STRING_SVTOOLS_HTML_S_reg; break;
145 : 0 : case 175: pStr = OOO_STRING_SVTOOLS_HTML_S_macr; break;
146 : 0 : case 176: pStr = OOO_STRING_SVTOOLS_HTML_S_deg; break;
147 : 0 : case 177: pStr = OOO_STRING_SVTOOLS_HTML_S_plusmn; break;
148 : 0 : case 178: pStr = OOO_STRING_SVTOOLS_HTML_S_sup2; break;
149 : 0 : case 179: pStr = OOO_STRING_SVTOOLS_HTML_S_sup3; break;
150 : 0 : case 180: pStr = OOO_STRING_SVTOOLS_HTML_S_acute; break;
151 : 0 : case 181: pStr = OOO_STRING_SVTOOLS_HTML_S_micro; break;
152 : 0 : case 182: pStr = OOO_STRING_SVTOOLS_HTML_S_para; break;
153 : 0 : case 183: pStr = OOO_STRING_SVTOOLS_HTML_S_middot; break;
154 : 0 : case 184: pStr = OOO_STRING_SVTOOLS_HTML_S_cedil; break;
155 : 0 : case 185: pStr = OOO_STRING_SVTOOLS_HTML_S_sup1; break;
156 : 0 : case 186: pStr = OOO_STRING_SVTOOLS_HTML_S_ordm; break;
157 : 0 : case 187: pStr = OOO_STRING_SVTOOLS_HTML_S_raquo; break;
158 : 0 : case 188: pStr = OOO_STRING_SVTOOLS_HTML_S_frac14; break;
159 : 0 : case 189: pStr = OOO_STRING_SVTOOLS_HTML_S_frac12; break;
160 : 0 : case 190: pStr = OOO_STRING_SVTOOLS_HTML_S_frac34; break;
161 : 0 : case 191: pStr = OOO_STRING_SVTOOLS_HTML_S_iquest; break;
162 : :
163 : 0 : case 192: pStr = OOO_STRING_SVTOOLS_HTML_C_Agrave; break;
164 : 0 : case 193: pStr = OOO_STRING_SVTOOLS_HTML_C_Aacute; break;
165 : 0 : case 194: pStr = OOO_STRING_SVTOOLS_HTML_C_Acirc; break;
166 : 0 : case 195: pStr = OOO_STRING_SVTOOLS_HTML_C_Atilde; break;
167 : 0 : case 196: pStr = OOO_STRING_SVTOOLS_HTML_C_Auml; break;
168 : 0 : case 197: pStr = OOO_STRING_SVTOOLS_HTML_C_Aring; break;
169 : 0 : case 198: pStr = OOO_STRING_SVTOOLS_HTML_C_AElig; break;
170 : 0 : case 199: pStr = OOO_STRING_SVTOOLS_HTML_C_Ccedil; break;
171 : 0 : case 200: pStr = OOO_STRING_SVTOOLS_HTML_C_Egrave; break;
172 : 0 : case 201: pStr = OOO_STRING_SVTOOLS_HTML_C_Eacute; break;
173 : 0 : case 202: pStr = OOO_STRING_SVTOOLS_HTML_C_Ecirc; break;
174 : 0 : case 203: pStr = OOO_STRING_SVTOOLS_HTML_C_Euml; break;
175 : 0 : case 204: pStr = OOO_STRING_SVTOOLS_HTML_C_Igrave; break;
176 : 0 : case 205: pStr = OOO_STRING_SVTOOLS_HTML_C_Iacute; break;
177 : 0 : case 206: pStr = OOO_STRING_SVTOOLS_HTML_C_Icirc; break;
178 : 0 : case 207: pStr = OOO_STRING_SVTOOLS_HTML_C_Iuml; break;
179 : 0 : case 208: pStr = OOO_STRING_SVTOOLS_HTML_C_ETH; break;
180 : 0 : case 209: pStr = OOO_STRING_SVTOOLS_HTML_C_Ntilde; break;
181 : 0 : case 210: pStr = OOO_STRING_SVTOOLS_HTML_C_Ograve; break;
182 : 0 : case 211: pStr = OOO_STRING_SVTOOLS_HTML_C_Oacute; break;
183 : 0 : case 212: pStr = OOO_STRING_SVTOOLS_HTML_C_Ocirc; break;
184 : 0 : case 213: pStr = OOO_STRING_SVTOOLS_HTML_C_Otilde; break;
185 : 0 : case 214: pStr = OOO_STRING_SVTOOLS_HTML_C_Ouml; break;
186 : 0 : case 215: pStr = OOO_STRING_SVTOOLS_HTML_S_times; break;
187 : 0 : case 216: pStr = OOO_STRING_SVTOOLS_HTML_C_Oslash; break;
188 : 0 : case 217: pStr = OOO_STRING_SVTOOLS_HTML_C_Ugrave; break;
189 : 0 : case 218: pStr = OOO_STRING_SVTOOLS_HTML_C_Uacute; break;
190 : 0 : case 219: pStr = OOO_STRING_SVTOOLS_HTML_C_Ucirc; break;
191 : 0 : case 220: pStr = OOO_STRING_SVTOOLS_HTML_C_Uuml; break;
192 : 0 : case 221: pStr = OOO_STRING_SVTOOLS_HTML_C_Yacute; break;
193 : :
194 : 0 : case 222: pStr = OOO_STRING_SVTOOLS_HTML_C_THORN; break;
195 : 0 : case 223: pStr = OOO_STRING_SVTOOLS_HTML_C_szlig; break;
196 : :
197 : 0 : case 224: pStr = OOO_STRING_SVTOOLS_HTML_S_agrave; break;
198 : 0 : case 225: pStr = OOO_STRING_SVTOOLS_HTML_S_aacute; break;
199 : 0 : case 226: pStr = OOO_STRING_SVTOOLS_HTML_S_acirc; break;
200 : 0 : case 227: pStr = OOO_STRING_SVTOOLS_HTML_S_atilde; break;
201 : 0 : case 228: pStr = OOO_STRING_SVTOOLS_HTML_S_auml; break;
202 : 0 : case 229: pStr = OOO_STRING_SVTOOLS_HTML_S_aring; break;
203 : 0 : case 230: pStr = OOO_STRING_SVTOOLS_HTML_S_aelig; break;
204 : 0 : case 231: pStr = OOO_STRING_SVTOOLS_HTML_S_ccedil; break;
205 : 0 : case 232: pStr = OOO_STRING_SVTOOLS_HTML_S_egrave; break;
206 : 0 : case 233: pStr = OOO_STRING_SVTOOLS_HTML_S_eacute; break;
207 : 0 : case 234: pStr = OOO_STRING_SVTOOLS_HTML_S_ecirc; break;
208 : 0 : case 235: pStr = OOO_STRING_SVTOOLS_HTML_S_euml; break;
209 : 0 : case 236: pStr = OOO_STRING_SVTOOLS_HTML_S_igrave; break;
210 : 0 : case 237: pStr = OOO_STRING_SVTOOLS_HTML_S_iacute; break;
211 : 0 : case 238: pStr = OOO_STRING_SVTOOLS_HTML_S_icirc; break;
212 : 0 : case 239: pStr = OOO_STRING_SVTOOLS_HTML_S_iuml; break;
213 : 0 : case 240: pStr = OOO_STRING_SVTOOLS_HTML_S_eth; break;
214 : 0 : case 241: pStr = OOO_STRING_SVTOOLS_HTML_S_ntilde; break;
215 : 0 : case 242: pStr = OOO_STRING_SVTOOLS_HTML_S_ograve; break;
216 : 0 : case 243: pStr = OOO_STRING_SVTOOLS_HTML_S_oacute; break;
217 : 0 : case 244: pStr = OOO_STRING_SVTOOLS_HTML_S_ocirc; break;
218 : 0 : case 245: pStr = OOO_STRING_SVTOOLS_HTML_S_otilde; break;
219 : 0 : case 246: pStr = OOO_STRING_SVTOOLS_HTML_S_ouml; break;
220 : 0 : case 247: pStr = OOO_STRING_SVTOOLS_HTML_S_divide; break;
221 : 0 : case 248: pStr = OOO_STRING_SVTOOLS_HTML_S_oslash; break;
222 : 0 : case 249: pStr = OOO_STRING_SVTOOLS_HTML_S_ugrave; break;
223 : 0 : case 250: pStr = OOO_STRING_SVTOOLS_HTML_S_uacute; break;
224 : 0 : case 251: pStr = OOO_STRING_SVTOOLS_HTML_S_ucirc; break;
225 : 0 : case 252: pStr = OOO_STRING_SVTOOLS_HTML_S_uuml; break;
226 : 0 : case 253: pStr = OOO_STRING_SVTOOLS_HTML_S_yacute; break;
227 : 0 : case 254: pStr = OOO_STRING_SVTOOLS_HTML_S_thorn; break;
228 : 0 : case 255: pStr = OOO_STRING_SVTOOLS_HTML_S_yuml; break;
229 : :
230 : 0 : case 338: pStr = OOO_STRING_SVTOOLS_HTML_S_OElig; break;
231 : 0 : case 339: pStr = OOO_STRING_SVTOOLS_HTML_S_oelig; break;
232 : 0 : case 352: pStr = OOO_STRING_SVTOOLS_HTML_S_Scaron; break;
233 : 0 : case 353: pStr = OOO_STRING_SVTOOLS_HTML_S_scaron; break;
234 : 0 : case 376: pStr = OOO_STRING_SVTOOLS_HTML_S_Yuml; break;
235 : 0 : case 402: pStr = OOO_STRING_SVTOOLS_HTML_S_fnof; break;
236 : 0 : case 710: pStr = OOO_STRING_SVTOOLS_HTML_S_circ; break;
237 : 0 : case 732: pStr = OOO_STRING_SVTOOLS_HTML_S_tilde; break;
238 : :
239 : : // Greek chars are handled later,
240 : : // since they should *not* be transformed to entities
241 : : // when generating Greek text (== using Greek encoding)
242 : :
243 : 0 : case 8194: pStr = OOO_STRING_SVTOOLS_HTML_S_ensp; break;
244 : 0 : case 8195: pStr = OOO_STRING_SVTOOLS_HTML_S_emsp; break;
245 : 0 : case 8201: pStr = OOO_STRING_SVTOOLS_HTML_S_thinsp; break;
246 : 0 : case 8204: pStr = OOO_STRING_SVTOOLS_HTML_S_zwnj; break;
247 : 0 : case 8205: pStr = OOO_STRING_SVTOOLS_HTML_S_zwj; break;
248 : 0 : case 8206: pStr = OOO_STRING_SVTOOLS_HTML_S_lrm; break;
249 : 0 : case 8207: pStr = OOO_STRING_SVTOOLS_HTML_S_rlm; break;
250 : 0 : case 8211: pStr = OOO_STRING_SVTOOLS_HTML_S_ndash; break;
251 : 0 : case 8212: pStr = OOO_STRING_SVTOOLS_HTML_S_mdash; break;
252 : 0 : case 8216: pStr = OOO_STRING_SVTOOLS_HTML_S_lsquo; break;
253 : 0 : case 8217: pStr = OOO_STRING_SVTOOLS_HTML_S_rsquo; break;
254 : 0 : case 8218: pStr = OOO_STRING_SVTOOLS_HTML_S_sbquo; break;
255 : 0 : case 8220: pStr = OOO_STRING_SVTOOLS_HTML_S_ldquo; break;
256 : 0 : case 8221: pStr = OOO_STRING_SVTOOLS_HTML_S_rdquo; break;
257 : 0 : case 8222: pStr = OOO_STRING_SVTOOLS_HTML_S_bdquo; break;
258 : 0 : case 8224: pStr = OOO_STRING_SVTOOLS_HTML_S_dagger; break;
259 : 0 : case 8225: pStr = OOO_STRING_SVTOOLS_HTML_S_Dagger; break;
260 : 0 : case 8226: pStr = OOO_STRING_SVTOOLS_HTML_S_bull; break;
261 : 0 : case 8230: pStr = OOO_STRING_SVTOOLS_HTML_S_hellip; break;
262 : 0 : case 8240: pStr = OOO_STRING_SVTOOLS_HTML_S_permil; break;
263 : 0 : case 8242: pStr = OOO_STRING_SVTOOLS_HTML_S_prime; break;
264 : 0 : case 8243: pStr = OOO_STRING_SVTOOLS_HTML_S_Prime; break;
265 : 0 : case 8249: pStr = OOO_STRING_SVTOOLS_HTML_S_lsaquo; break;
266 : 0 : case 8250: pStr = OOO_STRING_SVTOOLS_HTML_S_rsaquo; break;
267 : 0 : case 8254: pStr = OOO_STRING_SVTOOLS_HTML_S_oline; break;
268 : 0 : case 8260: pStr = OOO_STRING_SVTOOLS_HTML_S_frasl; break;
269 : 0 : case 8364: pStr = OOO_STRING_SVTOOLS_HTML_S_euro; break;
270 : 0 : case 8465: pStr = OOO_STRING_SVTOOLS_HTML_S_image; break;
271 : 0 : case 8472: pStr = OOO_STRING_SVTOOLS_HTML_S_weierp; break;
272 : 0 : case 8476: pStr = OOO_STRING_SVTOOLS_HTML_S_real; break;
273 : 0 : case 8482: pStr = OOO_STRING_SVTOOLS_HTML_S_trade; break;
274 : 0 : case 8501: pStr = OOO_STRING_SVTOOLS_HTML_S_alefsym; break;
275 : 0 : case 8592: pStr = OOO_STRING_SVTOOLS_HTML_S_larr; break;
276 : 0 : case 8593: pStr = OOO_STRING_SVTOOLS_HTML_S_uarr; break;
277 : 0 : case 8594: pStr = OOO_STRING_SVTOOLS_HTML_S_rarr; break;
278 : 0 : case 8595: pStr = OOO_STRING_SVTOOLS_HTML_S_darr; break;
279 : 0 : case 8596: pStr = OOO_STRING_SVTOOLS_HTML_S_harr; break;
280 : 0 : case 8629: pStr = OOO_STRING_SVTOOLS_HTML_S_crarr; break;
281 : 0 : case 8656: pStr = OOO_STRING_SVTOOLS_HTML_S_lArr; break;
282 : 0 : case 8657: pStr = OOO_STRING_SVTOOLS_HTML_S_uArr; break;
283 : 0 : case 8658: pStr = OOO_STRING_SVTOOLS_HTML_S_rArr; break;
284 : 0 : case 8659: pStr = OOO_STRING_SVTOOLS_HTML_S_dArr; break;
285 : 0 : case 8660: pStr = OOO_STRING_SVTOOLS_HTML_S_hArr; break;
286 : 0 : case 8704: pStr = OOO_STRING_SVTOOLS_HTML_S_forall; break;
287 : 0 : case 8706: pStr = OOO_STRING_SVTOOLS_HTML_S_part; break;
288 : 0 : case 8707: pStr = OOO_STRING_SVTOOLS_HTML_S_exist; break;
289 : 0 : case 8709: pStr = OOO_STRING_SVTOOLS_HTML_S_empty; break;
290 : 0 : case 8711: pStr = OOO_STRING_SVTOOLS_HTML_S_nabla; break;
291 : 0 : case 8712: pStr = OOO_STRING_SVTOOLS_HTML_S_isin; break;
292 : 0 : case 8713: pStr = OOO_STRING_SVTOOLS_HTML_S_notin; break;
293 : 0 : case 8715: pStr = OOO_STRING_SVTOOLS_HTML_S_ni; break;
294 : 0 : case 8719: pStr = OOO_STRING_SVTOOLS_HTML_S_prod; break;
295 : 0 : case 8721: pStr = OOO_STRING_SVTOOLS_HTML_S_sum; break;
296 : 0 : case 8722: pStr = OOO_STRING_SVTOOLS_HTML_S_minus; break;
297 : 0 : case 8727: pStr = OOO_STRING_SVTOOLS_HTML_S_lowast; break;
298 : 0 : case 8730: pStr = OOO_STRING_SVTOOLS_HTML_S_radic; break;
299 : 0 : case 8733: pStr = OOO_STRING_SVTOOLS_HTML_S_prop; break;
300 : 0 : case 8734: pStr = OOO_STRING_SVTOOLS_HTML_S_infin; break;
301 : 0 : case 8736: pStr = OOO_STRING_SVTOOLS_HTML_S_ang; break;
302 : 0 : case 8743: pStr = OOO_STRING_SVTOOLS_HTML_S_and; break;
303 : 0 : case 8744: pStr = OOO_STRING_SVTOOLS_HTML_S_or; break;
304 : 0 : case 8745: pStr = OOO_STRING_SVTOOLS_HTML_S_cap; break;
305 : 0 : case 8746: pStr = OOO_STRING_SVTOOLS_HTML_S_cup; break;
306 : 0 : case 8747: pStr = OOO_STRING_SVTOOLS_HTML_S_int; break;
307 : 0 : case 8756: pStr = OOO_STRING_SVTOOLS_HTML_S_there4; break;
308 : 0 : case 8764: pStr = OOO_STRING_SVTOOLS_HTML_S_sim; break;
309 : 0 : case 8773: pStr = OOO_STRING_SVTOOLS_HTML_S_cong; break;
310 : 0 : case 8776: pStr = OOO_STRING_SVTOOLS_HTML_S_asymp; break;
311 : 0 : case 8800: pStr = OOO_STRING_SVTOOLS_HTML_S_ne; break;
312 : 0 : case 8801: pStr = OOO_STRING_SVTOOLS_HTML_S_equiv; break;
313 : 0 : case 8804: pStr = OOO_STRING_SVTOOLS_HTML_S_le; break;
314 : 0 : case 8805: pStr = OOO_STRING_SVTOOLS_HTML_S_ge; break;
315 : 0 : case 8834: pStr = OOO_STRING_SVTOOLS_HTML_S_sub; break;
316 : 0 : case 8835: pStr = OOO_STRING_SVTOOLS_HTML_S_sup; break;
317 : 0 : case 8836: pStr = OOO_STRING_SVTOOLS_HTML_S_nsub; break;
318 : 0 : case 8838: pStr = OOO_STRING_SVTOOLS_HTML_S_sube; break;
319 : 0 : case 8839: pStr = OOO_STRING_SVTOOLS_HTML_S_supe; break;
320 : 0 : case 8853: pStr = OOO_STRING_SVTOOLS_HTML_S_oplus; break;
321 : 0 : case 8855: pStr = OOO_STRING_SVTOOLS_HTML_S_otimes; break;
322 : 0 : case 8869: pStr = OOO_STRING_SVTOOLS_HTML_S_perp; break;
323 : 0 : case 8901: pStr = OOO_STRING_SVTOOLS_HTML_S_sdot; break;
324 : 0 : case 8968: pStr = OOO_STRING_SVTOOLS_HTML_S_lceil; break;
325 : 0 : case 8969: pStr = OOO_STRING_SVTOOLS_HTML_S_rceil; break;
326 : 0 : case 8970: pStr = OOO_STRING_SVTOOLS_HTML_S_lfloor; break;
327 : 0 : case 8971: pStr = OOO_STRING_SVTOOLS_HTML_S_rfloor; break;
328 : 0 : case 9001: pStr = OOO_STRING_SVTOOLS_HTML_S_lang; break;
329 : 0 : case 9002: pStr = OOO_STRING_SVTOOLS_HTML_S_rang; break;
330 : 0 : case 9674: pStr = OOO_STRING_SVTOOLS_HTML_S_loz; break;
331 : 0 : case 9824: pStr = OOO_STRING_SVTOOLS_HTML_S_spades; break;
332 : 0 : case 9827: pStr = OOO_STRING_SVTOOLS_HTML_S_clubs; break;
333 : 0 : case 9829: pStr = OOO_STRING_SVTOOLS_HTML_S_hearts; break;
334 : 0 : case 9830: pStr = OOO_STRING_SVTOOLS_HTML_S_diams; break;
335 : : }
336 : :
337 : : // Greek chars: if we do not produce a Greek encoding,
338 : : // transform them into entities
339 [ + - ][ + - ]: 216 : if( !pStr &&
[ + - ]
340 : : ( eDestEnc != RTL_TEXTENCODING_ISO_8859_7 ) &&
341 : : ( eDestEnc != RTL_TEXTENCODING_MS_1253 ) )
342 : : {
343 [ - - - - : 216 : switch( c )
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - - -
- - - + ]
344 : : {
345 : 0 : case 913: pStr = OOO_STRING_SVTOOLS_HTML_S_Alpha; break;
346 : 0 : case 914: pStr = OOO_STRING_SVTOOLS_HTML_S_Beta; break;
347 : 0 : case 915: pStr = OOO_STRING_SVTOOLS_HTML_S_Gamma; break;
348 : 0 : case 916: pStr = OOO_STRING_SVTOOLS_HTML_S_Delta; break;
349 : 0 : case 917: pStr = OOO_STRING_SVTOOLS_HTML_S_Epsilon; break;
350 : 0 : case 918: pStr = OOO_STRING_SVTOOLS_HTML_S_Zeta; break;
351 : 0 : case 919: pStr = OOO_STRING_SVTOOLS_HTML_S_Eta; break;
352 : 0 : case 920: pStr = OOO_STRING_SVTOOLS_HTML_S_Theta; break;
353 : 0 : case 921: pStr = OOO_STRING_SVTOOLS_HTML_S_Iota; break;
354 : 0 : case 922: pStr = OOO_STRING_SVTOOLS_HTML_S_Kappa; break;
355 : 0 : case 923: pStr = OOO_STRING_SVTOOLS_HTML_S_Lambda; break;
356 : 0 : case 924: pStr = OOO_STRING_SVTOOLS_HTML_S_Mu; break;
357 : 0 : case 925: pStr = OOO_STRING_SVTOOLS_HTML_S_Nu; break;
358 : 0 : case 926: pStr = OOO_STRING_SVTOOLS_HTML_S_Xi; break;
359 : 0 : case 927: pStr = OOO_STRING_SVTOOLS_HTML_S_Omicron; break;
360 : 0 : case 928: pStr = OOO_STRING_SVTOOLS_HTML_S_Pi; break;
361 : 0 : case 929: pStr = OOO_STRING_SVTOOLS_HTML_S_Rho; break;
362 : 0 : case 931: pStr = OOO_STRING_SVTOOLS_HTML_S_Sigma; break;
363 : 0 : case 932: pStr = OOO_STRING_SVTOOLS_HTML_S_Tau; break;
364 : 0 : case 933: pStr = OOO_STRING_SVTOOLS_HTML_S_Upsilon; break;
365 : 0 : case 934: pStr = OOO_STRING_SVTOOLS_HTML_S_Phi; break;
366 : 0 : case 935: pStr = OOO_STRING_SVTOOLS_HTML_S_Chi; break;
367 : 0 : case 936: pStr = OOO_STRING_SVTOOLS_HTML_S_Psi; break;
368 : 0 : case 937: pStr = OOO_STRING_SVTOOLS_HTML_S_Omega; break;
369 : 0 : case 945: pStr = OOO_STRING_SVTOOLS_HTML_S_alpha; break;
370 : 0 : case 946: pStr = OOO_STRING_SVTOOLS_HTML_S_beta; break;
371 : 0 : case 947: pStr = OOO_STRING_SVTOOLS_HTML_S_gamma; break;
372 : 0 : case 948: pStr = OOO_STRING_SVTOOLS_HTML_S_delta; break;
373 : 0 : case 949: pStr = OOO_STRING_SVTOOLS_HTML_S_epsilon; break;
374 : 0 : case 950: pStr = OOO_STRING_SVTOOLS_HTML_S_zeta; break;
375 : 0 : case 951: pStr = OOO_STRING_SVTOOLS_HTML_S_eta; break;
376 : 0 : case 952: pStr = OOO_STRING_SVTOOLS_HTML_S_theta; break;
377 : 0 : case 953: pStr = OOO_STRING_SVTOOLS_HTML_S_iota; break;
378 : 0 : case 954: pStr = OOO_STRING_SVTOOLS_HTML_S_kappa; break;
379 : 0 : case 955: pStr = OOO_STRING_SVTOOLS_HTML_S_lambda; break;
380 : 0 : case 956: pStr = OOO_STRING_SVTOOLS_HTML_S_mu; break;
381 : 0 : case 957: pStr = OOO_STRING_SVTOOLS_HTML_S_nu; break;
382 : 0 : case 958: pStr = OOO_STRING_SVTOOLS_HTML_S_xi; break;
383 : 0 : case 959: pStr = OOO_STRING_SVTOOLS_HTML_S_omicron; break;
384 : 0 : case 960: pStr = OOO_STRING_SVTOOLS_HTML_S_pi; break;
385 : 0 : case 961: pStr = OOO_STRING_SVTOOLS_HTML_S_rho; break;
386 : 0 : case 962: pStr = OOO_STRING_SVTOOLS_HTML_S_sigmaf; break;
387 : 0 : case 963: pStr = OOO_STRING_SVTOOLS_HTML_S_sigma; break;
388 : 0 : case 964: pStr = OOO_STRING_SVTOOLS_HTML_S_tau; break;
389 : 0 : case 965: pStr = OOO_STRING_SVTOOLS_HTML_S_upsilon; break;
390 : 0 : case 966: pStr = OOO_STRING_SVTOOLS_HTML_S_phi; break;
391 : 0 : case 967: pStr = OOO_STRING_SVTOOLS_HTML_S_chi; break;
392 : 0 : case 968: pStr = OOO_STRING_SVTOOLS_HTML_S_psi; break;
393 : 0 : case 969: pStr = OOO_STRING_SVTOOLS_HTML_S_omega; break;
394 : 0 : case 977: pStr = OOO_STRING_SVTOOLS_HTML_S_thetasym;break;
395 : 0 : case 978: pStr = OOO_STRING_SVTOOLS_HTML_S_upsih; break;
396 : 216 : case 982: pStr = OOO_STRING_SVTOOLS_HTML_S_piv; break;
397 : : }
398 : : }
399 : :
400 : 216 : return pStr;
401 : : }
402 : :
403 : 216 : rtl::OString lcl_ConvertCharToHTML( sal_Unicode c,
404 : : HTMLOutContext& rContext,
405 : : String *pNonConvertableChars )
406 : : {
407 : 216 : rtl::OStringBuffer aDest;
408 : : DBG_ASSERT( RTL_TEXTENCODING_DONTKNOW != rContext.m_eDestEnc,
409 : : "wrong destination encoding" );
410 : 216 : const sal_Char *pStr = 0;
411 [ - - - + ]: 216 : switch( c )
412 : : {
413 : : case 0xA0: // is a hard blank
414 : 0 : pStr = OOO_STRING_SVTOOLS_HTML_S_nbsp;
415 : 0 : break;
416 : : case 0x2011: // is a hard hyphen
417 : 0 : pStr = "#8209";
418 : 0 : break;
419 : : case 0xAD: // is a soft hyphen
420 : 0 : pStr = OOO_STRING_SVTOOLS_HTML_S_shy;
421 : 0 : break;
422 : : default:
423 : : // There may be an entity for the character.
424 : : // The new HTML4 entities above 255 are not used for UTF-8,
425 : : // because Netscape 4 does support UTF-8 but does not support
426 : : // these entities.
427 [ - + ][ # # ]: 216 : if( c < 128 || RTL_TEXTENCODING_UTF8 != rContext.m_eDestEnc )
428 : 216 : pStr = lcl_svhtml_GetEntityForChar( c, rContext.m_eDestEnc );
429 : 216 : break;
430 : : }
431 : :
432 : : sal_Char cBuffer[TXTCONV_BUFFER_SIZE];
433 : 216 : sal_uInt32 nInfo = 0;
434 : : sal_Size nSrcChars;
435 : : const sal_uInt32 nFlags = RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE|
436 : : RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE|
437 : : RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR|
438 : 216 : RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR;
439 [ - + ]: 216 : if( pStr )
440 : : {
441 : : sal_Size nLen = rtl_convertUnicodeToText(
442 : : rContext.m_hConv, rContext.m_hContext, &c, 0,
443 : : cBuffer, TXTCONV_BUFFER_SIZE,
444 : : nFlags|RTL_UNICODETOTEXT_FLAGS_FLUSH,
445 [ # # ]: 0 : &nInfo, &nSrcChars );
446 : : DBG_ASSERT( (nInfo & (RTL_UNICODETOTEXT_INFO_ERROR|RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL)) == 0, "HTMLOut: error while flushing" );
447 : 0 : sal_Char *pBuffer = cBuffer;
448 [ # # ]: 0 : while( nLen-- )
449 [ # # ]: 0 : aDest.append(*pBuffer++);
450 [ # # ][ # # ]: 0 : aDest.append('&').append(pStr).append(';');
[ # # ]
451 : : }
452 : : else
453 : : {
454 : : sal_Size nLen = rtl_convertUnicodeToText( rContext.m_hConv,
455 : : rContext.m_hContext, &c, 1,
456 : : cBuffer, TXTCONV_BUFFER_SIZE,
457 : : nFlags,
458 [ + - ]: 216 : &nInfo, &nSrcChars );
459 [ + - ][ + - ]: 216 : if( nLen > 0 && (nInfo & (RTL_UNICODETOTEXT_INFO_ERROR|RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL)) == 0 )
460 : : {
461 : 216 : sal_Char *pBuffer = cBuffer;
462 [ + + ]: 432 : while( nLen-- )
463 [ + - ]: 432 : aDest.append(*pBuffer++);
464 : : }
465 : : else
466 : : {
467 : : // If the character could not be converted to the destination
468 : : // character set, the UNICODE character is exported as character
469 : : // entity.
470 : : nLen = rtl_convertUnicodeToText(
471 : : rContext.m_hConv, rContext.m_hContext, &c, 0,
472 : : cBuffer, TXTCONV_BUFFER_SIZE,
473 : : nFlags|RTL_UNICODETOTEXT_FLAGS_FLUSH,
474 [ # # ]: 0 : &nInfo, &nSrcChars );
475 : : DBG_ASSERT( (nInfo & (RTL_UNICODETOTEXT_INFO_ERROR|RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL)) == 0, "HTMLOut: error while flushing" );
476 : 0 : sal_Char *pBuffer = cBuffer;
477 [ # # ]: 0 : while( nLen-- )
478 [ # # ]: 0 : aDest.append(*pBuffer++);
479 : :
480 [ # # ][ # # ]: 0 : aDest.append('&').append('#').append(static_cast<sal_Int64>(c))
[ # # ]
481 [ # # ]: 0 : .append(';');
482 [ # # ][ # # ]: 0 : if( pNonConvertableChars &&
[ # # ]
483 [ # # ]: 0 : STRING_NOTFOUND == pNonConvertableChars->Search( c ) )
484 [ # # ]: 0 : pNonConvertableChars->Append( c );
485 : : }
486 : : }
487 : 216 : return aDest.makeStringAndClear();
488 : : }
489 : :
490 : 20 : rtl::OString lcl_FlushToAscii( HTMLOutContext& rContext )
491 : : {
492 : 20 : rtl::OStringBuffer aDest;
493 : :
494 : 20 : sal_Unicode c = 0;
495 : : sal_Char cBuffer[TXTCONV_BUFFER_SIZE];
496 : 20 : sal_uInt32 nInfo = 0;
497 : : sal_Size nSrcChars;
498 : : const sal_uInt32 nFlags = RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE|
499 : : RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE|
500 : : RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR|
501 : : RTL_UNICODETOTEXT_FLAGS_FLUSH|
502 : 20 : RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR;
503 : : sal_Size nLen = rtl_convertUnicodeToText(
504 : : rContext.m_hConv, rContext.m_hContext, &c, 0,
505 : : cBuffer, TXTCONV_BUFFER_SIZE, nFlags,
506 [ + - ]: 20 : &nInfo, &nSrcChars );
507 : : DBG_ASSERT( (nInfo & (RTL_UNICODETOTEXT_INFO_ERROR|RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL)) == 0, "HTMLOut: error while flushing" );
508 : 20 : sal_Char *pBuffer = cBuffer;
509 [ - + ]: 20 : while( nLen-- )
510 [ # # ]: 0 : aDest.append(*pBuffer++);
511 : 20 : return aDest.makeStringAndClear();
512 : : }
513 : :
514 : 0 : rtl::OString HTMLOutFuncs::ConvertStringToHTML( const String& rSrc,
515 : : rtl_TextEncoding eDestEnc, String *pNonConvertableChars )
516 : : {
517 [ # # ]: 0 : HTMLOutContext aContext( eDestEnc );
518 : 0 : rtl::OStringBuffer aDest;
519 [ # # ]: 0 : for( sal_uInt32 i=0UL, nLen = rSrc.Len(); i < nLen; i++ )
520 : : aDest.append(lcl_ConvertCharToHTML(
521 [ # # ][ # # ]: 0 : rSrc.GetChar( (xub_StrLen)i ), aContext, pNonConvertableChars));
522 [ # # ][ # # ]: 0 : aDest.append(lcl_FlushToAscii(aContext));
523 [ # # ]: 0 : return aDest.makeStringAndClear();
524 : : }
525 : :
526 : 22 : SvStream& HTMLOutFuncs::Out_AsciiTag( SvStream& rStream, const sal_Char *pStr,
527 : : sal_Bool bOn, rtl_TextEncoding )
528 : : {
529 : 22 : sal_Char sStt[3] = "</";
530 [ + + ]: 22 : if( bOn )
531 : 12 : sStt[1] = 0;
532 [ + - ][ + - ]: 22 : return (rStream << sStt << pStr << '>');
[ + - ]
533 : : }
534 : :
535 : 216 : SvStream& HTMLOutFuncs::Out_Char( SvStream& rStream, sal_Unicode c,
536 : : HTMLOutContext& rContext,
537 : : String *pNonConvertableChars )
538 : : {
539 [ + - ]: 216 : rtl::OString sOut = lcl_ConvertCharToHTML( c, rContext, pNonConvertableChars );
540 [ + - ]: 216 : rStream << sOut.getStr();
541 : 216 : return rStream;
542 : : }
543 : :
544 : 18 : SvStream& HTMLOutFuncs::Out_String( SvStream& rStream, const String& rStr,
545 : : rtl_TextEncoding eDestEnc,
546 : : String *pNonConvertableChars )
547 : : {
548 [ + - ]: 18 : HTMLOutContext aContext( eDestEnc );
549 : 18 : xub_StrLen nLen = rStr.Len();
550 [ + + ]: 234 : for( xub_StrLen n = 0; n < nLen; n++ )
551 : 216 : HTMLOutFuncs::Out_Char( rStream, rStr.GetChar( (xub_StrLen)n ),
552 [ + - ]: 216 : aContext, pNonConvertableChars );
553 [ + - ]: 18 : HTMLOutFuncs::FlushToAscii( rStream, aContext );
554 [ + - ]: 18 : return rStream;
555 : : }
556 : :
557 : 20 : SvStream& HTMLOutFuncs::FlushToAscii( SvStream& rStream,
558 : : HTMLOutContext& rContext )
559 : : {
560 [ + - ]: 20 : rtl::OString sOut = lcl_FlushToAscii( rContext );
561 : :
562 [ - + ]: 20 : if (!sOut.isEmpty())
563 [ # # ]: 0 : rStream << sOut.getStr();
564 : :
565 : 20 : return rStream;
566 : : }
567 : :
568 : 0 : SvStream& HTMLOutFuncs::Out_Hex( SvStream& rStream, sal_uLong nHex, sal_uInt8 nLen,
569 : : rtl_TextEncoding )
570 : : { // in einen Stream aus
571 : 0 : sal_Char aNToABuf[] = "0000000000000000";
572 : :
573 : : DBG_ASSERT( nLen < sizeof(aNToABuf), "zu viele Stellen" );
574 [ # # ]: 0 : if( nLen>=sizeof(aNToABuf) )
575 : 0 : nLen = (sizeof(aNToABuf)-1);
576 : :
577 : : // Pointer an das Bufferende setzen
578 : 0 : sal_Char *pStr = aNToABuf + (sizeof(aNToABuf)-1);
579 [ # # ]: 0 : for( sal_uInt8 n = 0; n < nLen; ++n )
580 : : {
581 : 0 : *(--pStr) = (sal_Char)(nHex & 0xf ) + 48;
582 [ # # ]: 0 : if( *pStr > '9' )
583 : 0 : *pStr += 39;
584 : 0 : nHex >>= 4;
585 : : }
586 [ # # ]: 0 : return rStream << pStr;
587 : : }
588 : :
589 : :
590 : 0 : SvStream& HTMLOutFuncs::Out_Color( SvStream& rStream, const Color& rColor,
591 : : rtl_TextEncoding )
592 : : {
593 : 0 : rStream << "\"#";
594 [ # # ]: 0 : if( rColor.GetColor() == COL_AUTO )
595 : : {
596 : 0 : rStream << "000000";
597 : : }
598 : : else
599 : : {
600 : 0 : Out_Hex( rStream, rColor.GetRed(), 2 );
601 : 0 : Out_Hex( rStream, rColor.GetGreen(), 2 );
602 : 0 : Out_Hex( rStream, rColor.GetBlue(), 2 );
603 : : }
604 : 0 : rStream << '\"';
605 : :
606 : 0 : return rStream;
607 : : }
608 : :
609 : 0 : SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream,
610 : : const String& rBaseURL,
611 : : const ImageMap& rIMap,
612 : : const String& rName,
613 : : const HTMLOutEvent *pEventTable,
614 : : sal_Bool bOutStarBasic,
615 : : const sal_Char *pDelim,
616 : : const sal_Char *pIndentArea,
617 : : const sal_Char *pIndentMap,
618 : : rtl_TextEncoding eDestEnc,
619 : : String *pNonConvertableChars )
620 : : {
621 [ # # ]: 0 : if( RTL_TEXTENCODING_DONTKNOW == eDestEnc )
622 [ # # ]: 0 : eDestEnc = osl_getThreadTextEncoding();
623 : :
624 [ # # ]: 0 : const String& rOutName = rName.Len() ? rName : rIMap.GetName();
625 : : DBG_ASSERT( rOutName.Len(), "Kein ImageMap-Name" );
626 [ # # ]: 0 : if( !rOutName.Len() )
627 : 0 : return rStream;
628 : :
629 : 0 : rtl::OStringBuffer sOut;
630 [ # # ]: 0 : sOut.append('<')
631 [ # # ]: 0 : .append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_map))
632 [ # # ]: 0 : .append(' ')
633 [ # # ]: 0 : .append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_O_name))
634 [ # # ]: 0 : .append(RTL_CONSTASCII_STRINGPARAM("=\""));
635 [ # # ]: 0 : rStream << sOut.makeStringAndClear().getStr();
636 [ # # ]: 0 : Out_String( rStream, rOutName, eDestEnc, pNonConvertableChars );
637 [ # # ]: 0 : rStream << "\">";
638 : :
639 [ # # ]: 0 : for( sal_uInt16 i=0U; i<rIMap.GetIMapObjectCount(); i++ )
640 : : {
641 [ # # ]: 0 : const IMapObject* pObj = rIMap.GetIMapObject( i );
642 : : DBG_ASSERT( pObj, "Wo ist das ImageMap-Object?" );
643 : :
644 [ # # ]: 0 : if( pObj )
645 : : {
646 : 0 : const sal_Char *pShape = 0;
647 : 0 : rtl::OString aCoords;
648 [ # # # # ]: 0 : switch( pObj->GetType() )
[ # # ]
649 : : {
650 : : case( IMAP_OBJ_RECTANGLE ):
651 : : {
652 : : const IMapRectangleObject* pRectObj =
653 : 0 : (const IMapRectangleObject *)pObj;
654 : 0 : pShape = OOO_STRING_SVTOOLS_HTML_SH_rect;
655 [ # # ]: 0 : Rectangle aRect( pRectObj->GetRectangle() );
656 : :
657 : : aCoords = rtl::OStringBuffer()
658 [ # # ]: 0 : .append(static_cast<sal_Int32>(aRect.Left()))
659 [ # # ]: 0 : .append(',')
660 [ # # ]: 0 : .append(static_cast<sal_Int32>(aRect.Top()))
661 [ # # ]: 0 : .append(',')
662 [ # # ]: 0 : .append(static_cast<sal_Int32>(aRect.Right()))
663 [ # # ]: 0 : .append(',')
664 [ # # ]: 0 : .append(static_cast<sal_Int32>(aRect.Bottom()))
665 : 0 : .makeStringAndClear();
666 : : }
667 : 0 : break;
668 : : case( IMAP_OBJ_CIRCLE ):
669 : : {
670 : : const IMapCircleObject* pCirc =
671 : 0 : (const IMapCircleObject *)pObj;
672 : 0 : pShape= OOO_STRING_SVTOOLS_HTML_SH_circ;
673 [ # # ]: 0 : Point aCenter( pCirc->GetCenter() );
674 [ # # ]: 0 : long nOff = pCirc->GetRadius();
675 : :
676 : : aCoords = rtl::OStringBuffer()
677 [ # # ]: 0 : .append(static_cast<sal_Int32>(aCenter.X()))
678 [ # # ]: 0 : .append(',')
679 [ # # ]: 0 : .append(static_cast<sal_Int32>(aCenter.Y()))
680 [ # # ]: 0 : .append(',')
681 [ # # ]: 0 : .append(static_cast<sal_Int32>(nOff))
682 : 0 : .makeStringAndClear();
683 : : }
684 : 0 : break;
685 : : case( IMAP_OBJ_POLYGON ):
686 : : {
687 : : const IMapPolygonObject* pPolyObj =
688 : 0 : (const IMapPolygonObject *)pObj;
689 : 0 : pShape= OOO_STRING_SVTOOLS_HTML_SH_poly;
690 [ # # ]: 0 : Polygon aPoly( pPolyObj->GetPolygon() );
691 [ # # ]: 0 : sal_uInt16 nCount = aPoly.GetSize();
692 : 0 : rtl::OStringBuffer aTmpBuf;
693 [ # # ]: 0 : if( nCount>0 )
694 : : {
695 [ # # ]: 0 : const Point& rPoint = aPoly[0];
696 [ # # ]: 0 : aTmpBuf.append(static_cast<sal_Int32>(rPoint.X()))
697 [ # # ]: 0 : .append(',')
698 [ # # ]: 0 : .append(static_cast<sal_Int32>(rPoint.Y()));
699 : : }
700 [ # # ]: 0 : for( sal_uInt16 j=1; j<nCount; j++ )
701 : : {
702 [ # # ]: 0 : const Point& rPoint = aPoly[j];
703 [ # # ]: 0 : aTmpBuf.append(',')
704 [ # # ]: 0 : .append(static_cast<sal_Int32>(rPoint.X()))
705 [ # # ]: 0 : .append(',')
706 [ # # ]: 0 : .append(static_cast<sal_Int32>(rPoint.Y()));
707 : : }
708 [ # # ]: 0 : aCoords = aTmpBuf.makeStringAndClear();
709 : : }
710 : 0 : break;
711 : : default:
712 : : DBG_ASSERT( pShape, "unbekanntes IMapObject" );
713 : 0 : break;
714 : : }
715 : :
716 [ # # ]: 0 : if( pShape )
717 : : {
718 [ # # ]: 0 : if( pDelim )
719 [ # # ]: 0 : rStream << pDelim;
720 [ # # ]: 0 : if( pIndentArea )
721 [ # # ]: 0 : rStream << pIndentArea;
722 : :
723 [ # # ][ # # ]: 0 : sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_area)
724 [ # # ][ # # ]: 0 : .append(' ').append(OOO_STRING_SVTOOLS_HTML_O_shape)
725 [ # # ][ # # ]: 0 : .append('=').append(pShape).append(' ')
[ # # ]
726 [ # # ][ # # ]: 0 : .append(OOO_STRING_SVTOOLS_HTML_O_coords).append("=\"")
727 [ # # ][ # # ]: 0 : .append(aCoords).append("\" ");
728 [ # # ]: 0 : rStream << sOut.makeStringAndClear().getStr();
729 : :
730 [ # # ]: 0 : String aURL( pObj->GetURL() );
731 [ # # ][ # # ]: 0 : if( aURL.Len() && pObj->IsActive() )
[ # # ]
732 : : {
733 : : aURL = URIHelper::simpleNormalizedMakeRelative(
734 [ # # ][ # # ]: 0 : rBaseURL, aURL );
[ # # ][ # # ]
735 [ # # ][ # # ]: 0 : sOut.append(OOO_STRING_SVTOOLS_HTML_O_href).append("=\"");
736 [ # # ]: 0 : rStream << sOut.makeStringAndClear().getStr();
737 [ # # ][ # # ]: 0 : Out_String( rStream, aURL, eDestEnc, pNonConvertableChars ) << '\"';
738 : : }
739 : : else
740 [ # # ]: 0 : rStream << OOO_STRING_SVTOOLS_HTML_O_nohref;
741 : :
742 : 0 : const String& rObjName = pObj->GetName();
743 [ # # ]: 0 : if( rObjName.Len() )
744 : : {
745 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_name)
746 [ # # ]: 0 : .append("=\"");
747 [ # # ]: 0 : rStream << sOut.makeStringAndClear().getStr();
748 [ # # ][ # # ]: 0 : Out_String( rStream, rObjName, eDestEnc, pNonConvertableChars ) << '\"';
749 : : }
750 : :
751 : 0 : const String& rTarget = pObj->GetTarget();
752 [ # # ][ # # ]: 0 : if( rTarget.Len() && pObj->IsActive() )
[ # # ]
753 : : {
754 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_target)
755 [ # # ]: 0 : .append("=\"");
756 [ # # ]: 0 : rStream << sOut.makeStringAndClear().getStr();
757 [ # # ][ # # ]: 0 : Out_String( rStream, rTarget, eDestEnc, pNonConvertableChars ) << '\"';
758 : : }
759 : :
760 [ # # ]: 0 : String rDesc( pObj->GetAltText() );
761 [ # # ]: 0 : if( rDesc.Len() == 0 )
762 [ # # ]: 0 : rDesc = pObj->GetDesc();
763 : :
764 [ # # ]: 0 : if( rDesc.Len() )
765 : : {
766 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_alt)
767 [ # # ]: 0 : .append("=\"");
768 [ # # ]: 0 : rStream << sOut.makeStringAndClear().getStr();
769 [ # # ][ # # ]: 0 : Out_String( rStream, rDesc, eDestEnc, pNonConvertableChars ) << '\"';
770 : : }
771 : :
772 : 0 : const SvxMacroTableDtor& rMacroTab = pObj->GetMacroTable();
773 [ # # ][ # # ]: 0 : if( pEventTable && !rMacroTab.empty() )
[ # # ]
774 : : Out_Events( rStream, rMacroTab, pEventTable,
775 [ # # ]: 0 : bOutStarBasic, eDestEnc, pNonConvertableChars );
776 : :
777 [ # # ][ # # ]: 0 : rStream << '>';
[ # # ]
778 : 0 : }
779 : : }
780 : :
781 : : }
782 : :
783 [ # # ]: 0 : if( pDelim )
784 [ # # ]: 0 : rStream << pDelim;
785 [ # # ]: 0 : if( pIndentMap )
786 [ # # ]: 0 : rStream << pIndentMap;
787 [ # # ]: 0 : Out_AsciiTag( rStream, OOO_STRING_SVTOOLS_HTML_map, sal_False );
788 : :
789 : 0 : return rStream;
790 : : }
791 : :
792 : 0 : SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm,
793 : : const String& rBaseURL,
794 : : const String& rSource,
795 : : const String& rLanguage,
796 : : ScriptType eScriptType,
797 : : const String& rSrc,
798 : : const String *pSBLibrary,
799 : : const String *pSBModule,
800 : : rtl_TextEncoding eDestEnc,
801 : : String *pNonConvertableChars )
802 : : {
803 [ # # ]: 0 : if( RTL_TEXTENCODING_DONTKNOW == eDestEnc )
804 [ # # ]: 0 : eDestEnc = osl_getThreadTextEncoding();
805 : :
806 : : // Script wird komplett nicht eingerueckt!
807 : 0 : rtl::OStringBuffer sOut;
808 [ # # ]: 0 : sOut.append('<')
809 [ # # ]: 0 : .append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_script));
810 : :
811 [ # # ]: 0 : if( rLanguage.Len() )
812 : : {
813 [ # # ]: 0 : sOut.append(' ')
814 [ # # ]: 0 : .append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_O_language))
815 [ # # ]: 0 : .append(RTL_CONSTASCII_STRINGPARAM("=\""));
816 [ # # ]: 0 : rStrm << sOut.makeStringAndClear().getStr();
817 [ # # ]: 0 : Out_String( rStrm, rLanguage, eDestEnc, pNonConvertableChars );
818 [ # # ]: 0 : sOut.append('\"');
819 : : }
820 : :
821 [ # # ]: 0 : if( rSrc.Len() )
822 : : {
823 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_src).append("=\"");
[ # # ]
824 [ # # ]: 0 : rStrm << sOut.makeStringAndClear().getStr();
825 [ # # ][ # # ]: 0 : Out_String( rStrm, URIHelper::simpleNormalizedMakeRelative(rBaseURL, rSrc), eDestEnc, pNonConvertableChars );
[ # # ][ # # ]
[ # # ][ # # ]
826 [ # # ]: 0 : sOut.append('\"');
827 : : }
828 : :
829 [ # # ][ # # ]: 0 : if( STARBASIC != eScriptType && pSBLibrary )
830 : : {
831 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_sdlibrary)
832 [ # # ]: 0 : .append("=\"");
833 [ # # ]: 0 : rStrm << sOut.makeStringAndClear().getStr();
834 [ # # ]: 0 : Out_String( rStrm, *pSBLibrary, eDestEnc, pNonConvertableChars );
835 [ # # ]: 0 : sOut.append('\"');
836 : : }
837 : :
838 [ # # ][ # # ]: 0 : if( STARBASIC != eScriptType && pSBModule )
839 : : {
840 [ # # ][ # # ]: 0 : sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_sdmodule)
841 [ # # ]: 0 : .append("=\"");
842 [ # # ]: 0 : rStrm << sOut.makeStringAndClear().getStr();
843 [ # # ]: 0 : Out_String( rStrm, *pSBModule, eDestEnc, pNonConvertableChars );
844 [ # # ]: 0 : sOut.append('\"');
845 : : }
846 : :
847 [ # # ]: 0 : sOut.append('>');
848 : :
849 [ # # ]: 0 : rStrm << sOut.makeStringAndClear().getStr();
850 : :
851 [ # # ][ # # ]: 0 : if( rSource.Len() || pSBLibrary || pSBModule )
[ # # ][ # # ]
852 : : {
853 [ # # ]: 0 : rStrm << sNewLine;
854 : :
855 [ # # ]: 0 : if( JAVASCRIPT != eScriptType )
856 : : {
857 [ # # ]: 0 : rStrm << "<!--"
858 [ # # ]: 0 : << sNewLine;
859 : : }
860 : :
861 [ # # ]: 0 : if( STARBASIC == eScriptType )
862 : : {
863 [ # # ]: 0 : if( pSBLibrary )
864 : : {
865 [ # # ]: 0 : sOut.append(RTL_CONSTASCII_STRINGPARAM("' "))
866 [ # # ]: 0 : .append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_SB_library))
867 [ # # ]: 0 : .append(' ')
868 [ # # ][ # # ]: 0 : .append(rtl::OUStringToOString(*pSBLibrary, eDestEnc));
[ # # ]
869 [ # # ][ # # ]: 0 : rStrm << sOut.makeStringAndClear().getStr() << sNewLine;
870 : : }
871 : :
872 [ # # ]: 0 : if( pSBModule )
873 : : {
874 [ # # ]: 0 : sOut.append(RTL_CONSTASCII_STRINGPARAM("' "))
875 [ # # ]: 0 : .append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_SB_module))
876 [ # # ]: 0 : .append(' ')
877 [ # # ][ # # ]: 0 : .append(rtl::OUStringToOString(*pSBModule, eDestEnc));
[ # # ]
878 [ # # ][ # # ]: 0 : rStrm << sOut.makeStringAndClear().getStr() << sNewLine;
879 : : }
880 : : }
881 : :
882 [ # # ]: 0 : if( rSource.Len() )
883 : : {
884 : : // Wir schreiben das Modul mm ANSI-Zeichensatz, aber mit
885 : : // System-Zeilenumbruechen raus.
886 [ # # ][ # # ]: 0 : const rtl::OString sSource(rtl::OUStringToOString(rSource, eDestEnc));
887 [ # # ][ # # ]: 0 : rStrm << sSource.getStr() << sNewLine;
888 : : }
889 [ # # ]: 0 : rStrm << sNewLine;
890 : :
891 [ # # ]: 0 : if( JAVASCRIPT != eScriptType )
892 : : {
893 : : // MIB/MM: Wenn es kein StarBasic ist, kann ein // natuerlich
894 : : // falsch sein. Da der Kommentar aber beim Einlesen wider
895 : : // entfernt wird, schickt uns das nicht weiter ...
896 [ # # ][ # # ]: 0 : rStrm << (STARBASIC == eScriptType ? "' -->" : "// -->")
897 [ # # ]: 0 : << sNewLine;
898 : : }
899 : : }
900 : :
901 [ # # ]: 0 : HTMLOutFuncs::Out_AsciiTag( rStrm, OOO_STRING_SVTOOLS_HTML_script, sal_False );
902 : :
903 : 0 : return rStrm;
904 : : }
905 : :
906 : :
907 : 0 : SvStream& HTMLOutFuncs::Out_Events( SvStream& rStrm,
908 : : const SvxMacroTableDtor& rMacroTable,
909 : : const HTMLOutEvent *pEventTable,
910 : : sal_Bool bOutStarBasic,
911 : : rtl_TextEncoding eDestEnc,
912 : : String *pNonConvertableChars )
913 : : {
914 : 0 : sal_uInt16 i=0;
915 [ # # ][ # # ]: 0 : while( pEventTable[i].pBasicName || pEventTable[i].pJavaName )
[ # # ]
916 : : {
917 : : const SvxMacro *pMacro =
918 : 0 : rMacroTable.Get( pEventTable[i].nEvent );
919 : :
920 [ # # # # ]: 0 : if( pMacro && pMacro->HasMacro() &&
[ # # ][ # # ]
[ # # ]
921 : 0 : ( JAVASCRIPT == pMacro->GetScriptType() || bOutStarBasic ))
922 : : {
923 : 0 : const sal_Char *pStr = STARBASIC == pMacro->GetScriptType()
924 : 0 : ? pEventTable[i].pBasicName
925 [ # # ]: 0 : : pEventTable[i].pJavaName;
926 : :
927 [ # # ]: 0 : if( pStr )
928 : : {
929 : 0 : rtl::OStringBuffer sOut;
930 [ # # ][ # # ]: 0 : sOut.append(' ').append(pStr).append("=\"");
[ # # ]
931 [ # # ]: 0 : rStrm << sOut.makeStringAndClear().getStr();
932 : :
933 [ # # ][ # # ]: 0 : Out_String( rStrm, pMacro->GetMacName(), eDestEnc, pNonConvertableChars ) << '\"';
[ # # ][ # # ]
934 : : }
935 : : }
936 : 0 : i++;
937 : : }
938 : :
939 : 0 : return rStrm;
940 : : }
941 : :
942 : 0 : rtl::OString HTMLOutFuncs::CreateTableDataOptionsValNum(
943 : : sal_Bool bValue,
944 : : double fVal, sal_uLong nFormat, SvNumberFormatter& rFormatter,
945 : : rtl_TextEncoding eDestEnc, String* pNonConvertableChars)
946 : : {
947 : 0 : rtl::OStringBuffer aStrTD;
948 : :
949 [ # # ]: 0 : if ( bValue )
950 : : {
951 : : // printf / scanf ist zu ungenau
952 [ # # ]: 0 : String aValStr;
953 [ # # ]: 0 : rFormatter.GetInputLineString( fVal, 0, aValStr );
954 [ # # ][ # # ]: 0 : rtl::OString sTmp(rtl::OUStringToOString(aValStr, eDestEnc));
955 [ # # ]: 0 : aStrTD.append(' ').
956 [ # # ]: 0 : append(OOO_STRING_SVTOOLS_HTML_O_SDval).
957 [ # # ]: 0 : append(RTL_CONSTASCII_STRINGPARAM("=\"")).
958 [ # # ][ # # ]: 0 : append(sTmp).append('\"');
[ # # ]
959 : : }
960 [ # # ][ # # ]: 0 : if ( bValue || nFormat )
961 : : {
962 [ # # ]: 0 : aStrTD.append(' ').
963 [ # # ]: 0 : append(OOO_STRING_SVTOOLS_HTML_O_SDnum).
964 [ # # ]: 0 : append(RTL_CONSTASCII_STRINGPARAM("=\"")).
965 : : append(static_cast<sal_Int32>(
966 [ # # ][ # # ]: 0 : Application::GetSettings().GetLanguage())).
[ # # ]
967 [ # # ]: 0 : append(';'); // Language fuer Format 0
968 [ # # ]: 0 : if ( nFormat )
969 : : {
970 : 0 : rtl::OString aNumStr;
971 : : LanguageType nLang;
972 [ # # ]: 0 : const SvNumberformat* pFormatEntry = rFormatter.GetEntry( nFormat );
973 [ # # ]: 0 : if ( pFormatEntry )
974 : : {
975 : 0 : aNumStr = ConvertStringToHTML( pFormatEntry->GetFormatstring(),
976 [ # # ]: 0 : eDestEnc, pNonConvertableChars );
977 : 0 : nLang = pFormatEntry->GetLanguage();
978 : : }
979 : : else
980 : 0 : nLang = LANGUAGE_SYSTEM;
981 [ # # ][ # # ]: 0 : aStrTD.append(static_cast<sal_Int32>(nLang)).append(';').
982 [ # # ]: 0 : append(aNumStr);
983 : : }
984 [ # # ]: 0 : aStrTD.append('\"');
985 : : }
986 : 0 : return aStrTD.makeStringAndClear();
987 : : }
988 : :
989 : 0 : sal_Bool HTMLOutFuncs::PrivateURLToInternalImg( String& rURL )
990 : : {
991 [ # # # # ]: 0 : if( rURL.Len() > 14UL &&
[ # # ]
992 : 0 : rURL.CompareToAscii( OOO_STRING_SVTOOLS_HTML_private_image, 14UL ) == COMPARE_EQUAL )
993 : : {
994 : 0 : rURL.Erase( 0UL, 14UL );
995 : 0 : return sal_True;
996 : : }
997 : :
998 : 0 : return sal_False;
999 : : }
1000 : :
1001 : :
1002 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|