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