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