1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/numformat.hxx>
22 #include <svl/zformat.hxx>
23 #include <svl/macitem.hxx>
24 #include <vcl/svapp.hxx>
25 #include <vcl/settings.hxx>
27 #include <svtools/HtmlWriter.hxx>
28 #include <svtools/htmlout.hxx>
29 #include <svtools/htmlkywd.hxx>
30 #include <vcl/imap.hxx>
31 #include <vcl/imaprect.hxx>
32 #include <vcl/imapcirc.hxx>
33 #include <vcl/imappoly.hxx>
34 #include <svl/urihelper.hxx>
35 #include <rtl/character.hxx>
36 #include <tools/debug.hxx>
37 #include <o3tl/string_view.hxx>
41 #define TXTCONV_BUFFER_SIZE 20
43 static sal_Size
convertUnicodeToText(const sal_Unicode
* pSrcBuf
, sal_Size nSrcChars
, char* pDestBuf
,
44 sal_Size nDestBytes
, sal_uInt32 nFlags
, sal_uInt32
* pInfo
,
45 sal_Size
* pSrcCvtChars
)
47 static rtl_UnicodeToTextConverter hConverter
48 = rtl_createUnicodeToTextConverter(RTL_TEXTENCODING_UTF8
);
49 static rtl_UnicodeToTextContext hContext
= hConverter
50 ? rtl_createUnicodeToTextContext(hConverter
)
51 : reinterpret_cast<rtl_TextToUnicodeContext
>(1);
53 return rtl_convertUnicodeToText(hConverter
, hContext
, pSrcBuf
, nSrcChars
, pDestBuf
, nDestBytes
,
54 nFlags
, pInfo
, pSrcCvtChars
);
57 static const char *lcl_svhtml_GetEntityForChar( sal_uInt32 c
,
58 rtl_TextEncoding eDestEnc
)
60 const char* pStr
= nullptr;
62 // Note: We currently handle special cases for ISO-8859-2 here simply because
63 // the code was already submitted. But we should also handle other code pages
64 // as well as the code becomes available.
66 if( eDestEnc
== RTL_TEXTENCODING_ISO_8859_2
|| eDestEnc
== RTL_TEXTENCODING_MS_1250
)
68 // Don't handle the following characters for Easter European (ISO-8859-2).
108 // TODO: handle more special cases for other code pages.
112 // case '\x0a': return HTMLOutFuncs::Out_Tag( rStream, OOO_STRING_SVTOOLS_HTML_linebreak );
114 case '<': pStr
= OOO_STRING_SVTOOLS_HTML_C_lt
; break;
115 case '>': pStr
= OOO_STRING_SVTOOLS_HTML_C_gt
; break;
116 case '&': pStr
= OOO_STRING_SVTOOLS_HTML_C_amp
; break;
117 case '"': pStr
= OOO_STRING_SVTOOLS_HTML_C_quot
; break;
119 case 161: pStr
= OOO_STRING_SVTOOLS_HTML_S_iexcl
; break;
120 case 162: pStr
= OOO_STRING_SVTOOLS_HTML_S_cent
; break;
121 case 163: pStr
= OOO_STRING_SVTOOLS_HTML_S_pound
; break;
122 case 164: pStr
= OOO_STRING_SVTOOLS_HTML_S_curren
; break;
123 case 165: pStr
= OOO_STRING_SVTOOLS_HTML_S_yen
; break;
124 case 166: pStr
= OOO_STRING_SVTOOLS_HTML_S_brvbar
; break;
125 case 167: pStr
= OOO_STRING_SVTOOLS_HTML_S_sect
; break;
126 case 168: pStr
= OOO_STRING_SVTOOLS_HTML_S_uml
; break;
127 case 169: pStr
= OOO_STRING_SVTOOLS_HTML_S_copy
; break;
128 case 170: pStr
= OOO_STRING_SVTOOLS_HTML_S_ordf
; break;
129 case 171: pStr
= OOO_STRING_SVTOOLS_HTML_S_laquo
; break;
130 case 172: pStr
= OOO_STRING_SVTOOLS_HTML_S_not
; break;
131 case 174: pStr
= OOO_STRING_SVTOOLS_HTML_S_reg
; break;
132 case 175: pStr
= OOO_STRING_SVTOOLS_HTML_S_macr
; break;
133 case 176: pStr
= OOO_STRING_SVTOOLS_HTML_S_deg
; break;
134 case 177: pStr
= OOO_STRING_SVTOOLS_HTML_S_plusmn
; break;
135 case 178: pStr
= OOO_STRING_SVTOOLS_HTML_S_sup2
; break;
136 case 179: pStr
= OOO_STRING_SVTOOLS_HTML_S_sup3
; break;
137 case 180: pStr
= OOO_STRING_SVTOOLS_HTML_S_acute
; break;
138 case 181: pStr
= OOO_STRING_SVTOOLS_HTML_S_micro
; break;
139 case 182: pStr
= OOO_STRING_SVTOOLS_HTML_S_para
; break;
140 case 183: pStr
= OOO_STRING_SVTOOLS_HTML_S_middot
; break;
141 case 184: pStr
= OOO_STRING_SVTOOLS_HTML_S_cedil
; break;
142 case 185: pStr
= OOO_STRING_SVTOOLS_HTML_S_sup1
; break;
143 case 186: pStr
= OOO_STRING_SVTOOLS_HTML_S_ordm
; break;
144 case 187: pStr
= OOO_STRING_SVTOOLS_HTML_S_raquo
; break;
145 case 188: pStr
= OOO_STRING_SVTOOLS_HTML_S_frac14
; break;
146 case 189: pStr
= OOO_STRING_SVTOOLS_HTML_S_frac12
; break;
147 case 190: pStr
= OOO_STRING_SVTOOLS_HTML_S_frac34
; break;
148 case 191: pStr
= OOO_STRING_SVTOOLS_HTML_S_iquest
; break;
150 case 192: pStr
= OOO_STRING_SVTOOLS_HTML_C_Agrave
; break;
151 case 193: pStr
= OOO_STRING_SVTOOLS_HTML_C_Aacute
; break;
152 case 194: pStr
= OOO_STRING_SVTOOLS_HTML_C_Acirc
; break;
153 case 195: pStr
= OOO_STRING_SVTOOLS_HTML_C_Atilde
; break;
154 case 196: pStr
= OOO_STRING_SVTOOLS_HTML_C_Auml
; break;
155 case 197: pStr
= OOO_STRING_SVTOOLS_HTML_C_Aring
; break;
156 case 198: pStr
= OOO_STRING_SVTOOLS_HTML_C_AElig
; break;
157 case 199: pStr
= OOO_STRING_SVTOOLS_HTML_C_Ccedil
; break;
158 case 200: pStr
= OOO_STRING_SVTOOLS_HTML_C_Egrave
; break;
159 case 201: pStr
= OOO_STRING_SVTOOLS_HTML_C_Eacute
; break;
160 case 202: pStr
= OOO_STRING_SVTOOLS_HTML_C_Ecirc
; break;
161 case 203: pStr
= OOO_STRING_SVTOOLS_HTML_C_Euml
; break;
162 case 204: pStr
= OOO_STRING_SVTOOLS_HTML_C_Igrave
; break;
163 case 205: pStr
= OOO_STRING_SVTOOLS_HTML_C_Iacute
; break;
164 case 206: pStr
= OOO_STRING_SVTOOLS_HTML_C_Icirc
; break;
165 case 207: pStr
= OOO_STRING_SVTOOLS_HTML_C_Iuml
; break;
166 case 208: pStr
= OOO_STRING_SVTOOLS_HTML_C_ETH
; break;
167 case 209: pStr
= OOO_STRING_SVTOOLS_HTML_C_Ntilde
; break;
168 case 210: pStr
= OOO_STRING_SVTOOLS_HTML_C_Ograve
; break;
169 case 211: pStr
= OOO_STRING_SVTOOLS_HTML_C_Oacute
; break;
170 case 212: pStr
= OOO_STRING_SVTOOLS_HTML_C_Ocirc
; break;
171 case 213: pStr
= OOO_STRING_SVTOOLS_HTML_C_Otilde
; break;
172 case 214: pStr
= OOO_STRING_SVTOOLS_HTML_C_Ouml
; break;
173 case 215: pStr
= OOO_STRING_SVTOOLS_HTML_S_times
; break;
174 case 216: pStr
= OOO_STRING_SVTOOLS_HTML_C_Oslash
; break;
175 case 217: pStr
= OOO_STRING_SVTOOLS_HTML_C_Ugrave
; break;
176 case 218: pStr
= OOO_STRING_SVTOOLS_HTML_C_Uacute
; break;
177 case 219: pStr
= OOO_STRING_SVTOOLS_HTML_C_Ucirc
; break;
178 case 220: pStr
= OOO_STRING_SVTOOLS_HTML_C_Uuml
; break;
179 case 221: pStr
= OOO_STRING_SVTOOLS_HTML_C_Yacute
; break;
181 case 222: pStr
= OOO_STRING_SVTOOLS_HTML_C_THORN
; break;
182 case 223: pStr
= OOO_STRING_SVTOOLS_HTML_C_szlig
; break;
184 case 224: pStr
= OOO_STRING_SVTOOLS_HTML_S_agrave
; break;
185 case 225: pStr
= OOO_STRING_SVTOOLS_HTML_S_aacute
; break;
186 case 226: pStr
= OOO_STRING_SVTOOLS_HTML_S_acirc
; break;
187 case 227: pStr
= OOO_STRING_SVTOOLS_HTML_S_atilde
; break;
188 case 228: pStr
= OOO_STRING_SVTOOLS_HTML_S_auml
; break;
189 case 229: pStr
= OOO_STRING_SVTOOLS_HTML_S_aring
; break;
190 case 230: pStr
= OOO_STRING_SVTOOLS_HTML_S_aelig
; break;
191 case 231: pStr
= OOO_STRING_SVTOOLS_HTML_S_ccedil
; break;
192 case 232: pStr
= OOO_STRING_SVTOOLS_HTML_S_egrave
; break;
193 case 233: pStr
= OOO_STRING_SVTOOLS_HTML_S_eacute
; break;
194 case 234: pStr
= OOO_STRING_SVTOOLS_HTML_S_ecirc
; break;
195 case 235: pStr
= OOO_STRING_SVTOOLS_HTML_S_euml
; break;
196 case 236: pStr
= OOO_STRING_SVTOOLS_HTML_S_igrave
; break;
197 case 237: pStr
= OOO_STRING_SVTOOLS_HTML_S_iacute
; break;
198 case 238: pStr
= OOO_STRING_SVTOOLS_HTML_S_icirc
; break;
199 case 239: pStr
= OOO_STRING_SVTOOLS_HTML_S_iuml
; break;
200 case 240: pStr
= OOO_STRING_SVTOOLS_HTML_S_eth
; break;
201 case 241: pStr
= OOO_STRING_SVTOOLS_HTML_S_ntilde
; break;
202 case 242: pStr
= OOO_STRING_SVTOOLS_HTML_S_ograve
; break;
203 case 243: pStr
= OOO_STRING_SVTOOLS_HTML_S_oacute
; break;
204 case 244: pStr
= OOO_STRING_SVTOOLS_HTML_S_ocirc
; break;
205 case 245: pStr
= OOO_STRING_SVTOOLS_HTML_S_otilde
; break;
206 case 246: pStr
= OOO_STRING_SVTOOLS_HTML_S_ouml
; break;
207 case 247: pStr
= OOO_STRING_SVTOOLS_HTML_S_divide
; break;
208 case 248: pStr
= OOO_STRING_SVTOOLS_HTML_S_oslash
; break;
209 case 249: pStr
= OOO_STRING_SVTOOLS_HTML_S_ugrave
; break;
210 case 250: pStr
= OOO_STRING_SVTOOLS_HTML_S_uacute
; break;
211 case 251: pStr
= OOO_STRING_SVTOOLS_HTML_S_ucirc
; break;
212 case 252: pStr
= OOO_STRING_SVTOOLS_HTML_S_uuml
; break;
213 case 253: pStr
= OOO_STRING_SVTOOLS_HTML_S_yacute
; break;
214 case 254: pStr
= OOO_STRING_SVTOOLS_HTML_S_thorn
; break;
215 case 255: pStr
= OOO_STRING_SVTOOLS_HTML_S_yuml
; break;
217 case 338: pStr
= OOO_STRING_SVTOOLS_HTML_S_OElig
; break;
218 case 339: pStr
= OOO_STRING_SVTOOLS_HTML_S_oelig
; break;
219 case 352: pStr
= OOO_STRING_SVTOOLS_HTML_S_Scaron
; break;
220 case 353: pStr
= OOO_STRING_SVTOOLS_HTML_S_scaron
; break;
221 case 376: pStr
= OOO_STRING_SVTOOLS_HTML_S_Yuml
; break;
222 case 402: pStr
= OOO_STRING_SVTOOLS_HTML_S_fnof
; break;
223 case 710: pStr
= OOO_STRING_SVTOOLS_HTML_S_circ
; break;
224 case 732: pStr
= OOO_STRING_SVTOOLS_HTML_S_tilde
; break;
226 // Greek chars are handled later,
227 // since they should *not* be transformed to entities
228 // when generating Greek text (== using Greek encoding)
230 case 8194: pStr
= OOO_STRING_SVTOOLS_HTML_S_ensp
; break;
231 case 8195: pStr
= OOO_STRING_SVTOOLS_HTML_S_emsp
; break;
232 case 8201: pStr
= OOO_STRING_SVTOOLS_HTML_S_thinsp
; break;
233 case 8204: pStr
= OOO_STRING_SVTOOLS_HTML_S_zwnj
; break;
234 case 8205: pStr
= OOO_STRING_SVTOOLS_HTML_S_zwj
; break;
235 case 8206: pStr
= OOO_STRING_SVTOOLS_HTML_S_lrm
; break;
236 case 8207: pStr
= OOO_STRING_SVTOOLS_HTML_S_rlm
; break;
237 case 8211: pStr
= OOO_STRING_SVTOOLS_HTML_S_ndash
; break;
238 case 8212: pStr
= OOO_STRING_SVTOOLS_HTML_S_mdash
; break;
239 case 8216: pStr
= OOO_STRING_SVTOOLS_HTML_S_lsquo
; break;
240 case 8217: pStr
= OOO_STRING_SVTOOLS_HTML_S_rsquo
; break;
241 case 8218: pStr
= OOO_STRING_SVTOOLS_HTML_S_sbquo
; break;
242 case 8220: pStr
= OOO_STRING_SVTOOLS_HTML_S_ldquo
; break;
243 case 8221: pStr
= OOO_STRING_SVTOOLS_HTML_S_rdquo
; break;
244 case 8222: pStr
= OOO_STRING_SVTOOLS_HTML_S_bdquo
; break;
245 case 8224: pStr
= OOO_STRING_SVTOOLS_HTML_S_dagger
; break;
246 case 8225: pStr
= OOO_STRING_SVTOOLS_HTML_S_Dagger
; break;
247 case 8226: pStr
= OOO_STRING_SVTOOLS_HTML_S_bull
; break;
248 case 8230: pStr
= OOO_STRING_SVTOOLS_HTML_S_hellip
; break;
249 case 8240: pStr
= OOO_STRING_SVTOOLS_HTML_S_permil
; break;
250 case 8242: pStr
= OOO_STRING_SVTOOLS_HTML_S_prime
; break;
251 case 8243: pStr
= OOO_STRING_SVTOOLS_HTML_S_Prime
; break;
252 case 8249: pStr
= OOO_STRING_SVTOOLS_HTML_S_lsaquo
; break;
253 case 8250: pStr
= OOO_STRING_SVTOOLS_HTML_S_rsaquo
; break;
254 case 8254: pStr
= OOO_STRING_SVTOOLS_HTML_S_oline
; break;
255 case 8260: pStr
= OOO_STRING_SVTOOLS_HTML_S_frasl
; break;
256 case 8364: pStr
= OOO_STRING_SVTOOLS_HTML_S_euro
; break;
257 case 8465: pStr
= OOO_STRING_SVTOOLS_HTML_S_image
; break;
258 case 8472: pStr
= OOO_STRING_SVTOOLS_HTML_S_weierp
; break;
259 case 8476: pStr
= OOO_STRING_SVTOOLS_HTML_S_real
; break;
260 case 8482: pStr
= OOO_STRING_SVTOOLS_HTML_S_trade
; break;
261 case 8501: pStr
= OOO_STRING_SVTOOLS_HTML_S_alefsym
; break;
262 case 8592: pStr
= OOO_STRING_SVTOOLS_HTML_S_larr
; break;
263 case 8593: pStr
= OOO_STRING_SVTOOLS_HTML_S_uarr
; break;
264 case 8594: pStr
= OOO_STRING_SVTOOLS_HTML_S_rarr
; break;
265 case 8595: pStr
= OOO_STRING_SVTOOLS_HTML_S_darr
; break;
266 case 8596: pStr
= OOO_STRING_SVTOOLS_HTML_S_harr
; break;
267 case 8629: pStr
= OOO_STRING_SVTOOLS_HTML_S_crarr
; break;
268 case 8656: pStr
= OOO_STRING_SVTOOLS_HTML_S_lArr
; break;
269 case 8657: pStr
= OOO_STRING_SVTOOLS_HTML_S_uArr
; break;
270 case 8658: pStr
= OOO_STRING_SVTOOLS_HTML_S_rArr
; break;
271 case 8659: pStr
= OOO_STRING_SVTOOLS_HTML_S_dArr
; break;
272 case 8660: pStr
= OOO_STRING_SVTOOLS_HTML_S_hArr
; break;
273 case 8704: pStr
= OOO_STRING_SVTOOLS_HTML_S_forall
; break;
274 case 8706: pStr
= OOO_STRING_SVTOOLS_HTML_S_part
; break;
275 case 8707: pStr
= OOO_STRING_SVTOOLS_HTML_S_exist
; break;
276 case 8709: pStr
= OOO_STRING_SVTOOLS_HTML_S_empty
; break;
277 case 8711: pStr
= OOO_STRING_SVTOOLS_HTML_S_nabla
; break;
278 case 8712: pStr
= OOO_STRING_SVTOOLS_HTML_S_isin
; break;
279 case 8713: pStr
= OOO_STRING_SVTOOLS_HTML_S_notin
; break;
280 case 8715: pStr
= OOO_STRING_SVTOOLS_HTML_S_ni
; break;
281 case 8719: pStr
= OOO_STRING_SVTOOLS_HTML_S_prod
; break;
282 case 8721: pStr
= OOO_STRING_SVTOOLS_HTML_S_sum
; break;
283 case 8722: pStr
= OOO_STRING_SVTOOLS_HTML_S_minus
; break;
284 case 8727: pStr
= OOO_STRING_SVTOOLS_HTML_S_lowast
; break;
285 case 8730: pStr
= OOO_STRING_SVTOOLS_HTML_S_radic
; break;
286 case 8733: pStr
= OOO_STRING_SVTOOLS_HTML_S_prop
; break;
287 case 8734: pStr
= OOO_STRING_SVTOOLS_HTML_S_infin
; break;
288 case 8736: pStr
= OOO_STRING_SVTOOLS_HTML_S_ang
; break;
289 case 8743: pStr
= OOO_STRING_SVTOOLS_HTML_S_and
; break;
290 case 8744: pStr
= OOO_STRING_SVTOOLS_HTML_S_or
; break;
291 case 8745: pStr
= OOO_STRING_SVTOOLS_HTML_S_cap
; break;
292 case 8746: pStr
= OOO_STRING_SVTOOLS_HTML_S_cup
; break;
293 case 8747: pStr
= OOO_STRING_SVTOOLS_HTML_S_int
; break;
294 case 8756: pStr
= OOO_STRING_SVTOOLS_HTML_S_there4
; break;
295 case 8764: pStr
= OOO_STRING_SVTOOLS_HTML_S_sim
; break;
296 case 8773: pStr
= OOO_STRING_SVTOOLS_HTML_S_cong
; break;
297 case 8776: pStr
= OOO_STRING_SVTOOLS_HTML_S_asymp
; break;
298 case 8800: pStr
= OOO_STRING_SVTOOLS_HTML_S_ne
; break;
299 case 8801: pStr
= OOO_STRING_SVTOOLS_HTML_S_equiv
; break;
300 case 8804: pStr
= OOO_STRING_SVTOOLS_HTML_S_le
; break;
301 case 8805: pStr
= OOO_STRING_SVTOOLS_HTML_S_ge
; break;
302 case 8834: pStr
= OOO_STRING_SVTOOLS_HTML_S_sub
; break;
303 case 8835: pStr
= OOO_STRING_SVTOOLS_HTML_S_sup
; break;
304 case 8836: pStr
= OOO_STRING_SVTOOLS_HTML_S_nsub
; break;
305 case 8838: pStr
= OOO_STRING_SVTOOLS_HTML_S_sube
; break;
306 case 8839: pStr
= OOO_STRING_SVTOOLS_HTML_S_supe
; break;
307 case 8853: pStr
= OOO_STRING_SVTOOLS_HTML_S_oplus
; break;
308 case 8855: pStr
= OOO_STRING_SVTOOLS_HTML_S_otimes
; break;
309 case 8869: pStr
= OOO_STRING_SVTOOLS_HTML_S_perp
; break;
310 case 8901: pStr
= OOO_STRING_SVTOOLS_HTML_S_sdot
; break;
311 case 8968: pStr
= OOO_STRING_SVTOOLS_HTML_S_lceil
; break;
312 case 8969: pStr
= OOO_STRING_SVTOOLS_HTML_S_rceil
; break;
313 case 8970: pStr
= OOO_STRING_SVTOOLS_HTML_S_lfloor
; break;
314 case 8971: pStr
= OOO_STRING_SVTOOLS_HTML_S_rfloor
; break;
315 case 9001: pStr
= OOO_STRING_SVTOOLS_HTML_S_lang
; break;
316 case 9002: pStr
= OOO_STRING_SVTOOLS_HTML_S_rang
; break;
317 case 9674: pStr
= OOO_STRING_SVTOOLS_HTML_S_loz
; break;
318 case 9824: pStr
= OOO_STRING_SVTOOLS_HTML_S_spades
; break;
319 case 9827: pStr
= OOO_STRING_SVTOOLS_HTML_S_clubs
; break;
320 case 9829: pStr
= OOO_STRING_SVTOOLS_HTML_S_hearts
; break;
321 case 9830: pStr
= OOO_STRING_SVTOOLS_HTML_S_diams
; break;
324 // Greek chars: if we do not produce a Greek encoding,
325 // transform them into entities
327 ( eDestEnc
!= RTL_TEXTENCODING_ISO_8859_7
) &&
328 ( eDestEnc
!= RTL_TEXTENCODING_MS_1253
) )
332 case 913: pStr
= OOO_STRING_SVTOOLS_HTML_S_Alpha
; break;
333 case 914: pStr
= OOO_STRING_SVTOOLS_HTML_S_Beta
; break;
334 case 915: pStr
= OOO_STRING_SVTOOLS_HTML_S_Gamma
; break;
335 case 916: pStr
= OOO_STRING_SVTOOLS_HTML_S_Delta
; break;
336 case 917: pStr
= OOO_STRING_SVTOOLS_HTML_S_Epsilon
; break;
337 case 918: pStr
= OOO_STRING_SVTOOLS_HTML_S_Zeta
; break;
338 case 919: pStr
= OOO_STRING_SVTOOLS_HTML_S_Eta
; break;
339 case 920: pStr
= OOO_STRING_SVTOOLS_HTML_S_Theta
; break;
340 case 921: pStr
= OOO_STRING_SVTOOLS_HTML_S_Iota
; break;
341 case 922: pStr
= OOO_STRING_SVTOOLS_HTML_S_Kappa
; break;
342 case 923: pStr
= OOO_STRING_SVTOOLS_HTML_S_Lambda
; break;
343 case 924: pStr
= OOO_STRING_SVTOOLS_HTML_S_Mu
; break;
344 case 925: pStr
= OOO_STRING_SVTOOLS_HTML_S_Nu
; break;
345 case 926: pStr
= OOO_STRING_SVTOOLS_HTML_S_Xi
; break;
346 case 927: pStr
= OOO_STRING_SVTOOLS_HTML_S_Omicron
; break;
347 case 928: pStr
= OOO_STRING_SVTOOLS_HTML_S_Pi
; break;
348 case 929: pStr
= OOO_STRING_SVTOOLS_HTML_S_Rho
; break;
349 case 931: pStr
= OOO_STRING_SVTOOLS_HTML_S_Sigma
; break;
350 case 932: pStr
= OOO_STRING_SVTOOLS_HTML_S_Tau
; break;
351 case 933: pStr
= OOO_STRING_SVTOOLS_HTML_S_Upsilon
; break;
352 case 934: pStr
= OOO_STRING_SVTOOLS_HTML_S_Phi
; break;
353 case 935: pStr
= OOO_STRING_SVTOOLS_HTML_S_Chi
; break;
354 case 936: pStr
= OOO_STRING_SVTOOLS_HTML_S_Psi
; break;
355 case 937: pStr
= OOO_STRING_SVTOOLS_HTML_S_Omega
; break;
356 case 945: pStr
= OOO_STRING_SVTOOLS_HTML_S_alpha
; break;
357 case 946: pStr
= OOO_STRING_SVTOOLS_HTML_S_beta
; break;
358 case 947: pStr
= OOO_STRING_SVTOOLS_HTML_S_gamma
; break;
359 case 948: pStr
= OOO_STRING_SVTOOLS_HTML_S_delta
; break;
360 case 949: pStr
= OOO_STRING_SVTOOLS_HTML_S_epsilon
; break;
361 case 950: pStr
= OOO_STRING_SVTOOLS_HTML_S_zeta
; break;
362 case 951: pStr
= OOO_STRING_SVTOOLS_HTML_S_eta
; break;
363 case 952: pStr
= OOO_STRING_SVTOOLS_HTML_S_theta
; break;
364 case 953: pStr
= OOO_STRING_SVTOOLS_HTML_S_iota
; break;
365 case 954: pStr
= OOO_STRING_SVTOOLS_HTML_S_kappa
; break;
366 case 955: pStr
= OOO_STRING_SVTOOLS_HTML_S_lambda
; break;
367 case 956: pStr
= OOO_STRING_SVTOOLS_HTML_S_mu
; break;
368 case 957: pStr
= OOO_STRING_SVTOOLS_HTML_S_nu
; break;
369 case 958: pStr
= OOO_STRING_SVTOOLS_HTML_S_xi
; break;
370 case 959: pStr
= OOO_STRING_SVTOOLS_HTML_S_omicron
; break;
371 case 960: pStr
= OOO_STRING_SVTOOLS_HTML_S_pi
; break;
372 case 961: pStr
= OOO_STRING_SVTOOLS_HTML_S_rho
; break;
373 case 962: pStr
= OOO_STRING_SVTOOLS_HTML_S_sigmaf
; break;
374 case 963: pStr
= OOO_STRING_SVTOOLS_HTML_S_sigma
; break;
375 case 964: pStr
= OOO_STRING_SVTOOLS_HTML_S_tau
; break;
376 case 965: pStr
= OOO_STRING_SVTOOLS_HTML_S_upsilon
; break;
377 case 966: pStr
= OOO_STRING_SVTOOLS_HTML_S_phi
; break;
378 case 967: pStr
= OOO_STRING_SVTOOLS_HTML_S_chi
; break;
379 case 968: pStr
= OOO_STRING_SVTOOLS_HTML_S_psi
; break;
380 case 969: pStr
= OOO_STRING_SVTOOLS_HTML_S_omega
; break;
381 case 977: pStr
= OOO_STRING_SVTOOLS_HTML_S_thetasym
;break;
382 case 978: pStr
= OOO_STRING_SVTOOLS_HTML_S_upsih
; break;
383 case 982: pStr
= OOO_STRING_SVTOOLS_HTML_S_piv
; break;
390 static sal_Size
lcl_FlushContext(char* pBuffer
, sal_uInt32 nFlags
)
392 sal_uInt32 nInfo
= 0;
394 sal_Size nLen
= convertUnicodeToText(nullptr, 0,
395 pBuffer
, TXTCONV_BUFFER_SIZE
, nFlags
|RTL_UNICODETOTEXT_FLAGS_FLUSH
,
397 DBG_ASSERT((nInfo
& (RTL_UNICODETOTEXT_INFO_ERROR
|RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL
)) == 0, "HTMLOut: error while flushing");
401 static OString
lcl_ConvertCharToHTML( sal_uInt32 c
,
402 OUString
*pNonConvertableChars
)
404 assert(rtl::isUnicodeCodePoint(c
));
407 const char *pStr
= nullptr;
410 case 0xA0: // is a hard blank
411 pStr
= OOO_STRING_SVTOOLS_HTML_S_nbsp
;
413 case 0x2011: // is a hard hyphen
416 case 0xAD: // is a soft hyphen
417 pStr
= OOO_STRING_SVTOOLS_HTML_S_shy
;
420 // There may be an entity for the character.
421 // The new HTML4 entities above 255 are not used for UTF-8,
422 // because Netscape 4 does support UTF-8 but does not support
425 pStr
= lcl_svhtml_GetEntityForChar( c
, RTL_TEXTENCODING_UTF8
);
429 char cBuffer
[TXTCONV_BUFFER_SIZE
];
430 const sal_uInt32 nFlags
= RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE
|
431 RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE
|
432 RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
|
433 RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR
;
436 sal_Size nLen
= lcl_FlushContext(cBuffer
, nFlags
);
437 char *pBuffer
= cBuffer
;
439 aDest
.append(*pBuffer
++);
440 aDest
.append(OString::Concat("&") + pStr
+ ";");
444 sal_uInt32 nInfo
= 0;
447 sal_Unicode utf16
[2];
448 auto n
= rtl::splitSurrogates(c
, utf16
);
449 sal_Size nLen
= convertUnicodeToText(utf16
, n
,
450 cBuffer
, TXTCONV_BUFFER_SIZE
,
451 nFlags
, &nInfo
, &nSrcChars
);
452 if( nLen
> 0 && (nInfo
& (RTL_UNICODETOTEXT_INFO_ERROR
|RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL
)) == 0 )
454 char *pBuffer
= cBuffer
;
456 aDest
.append(*pBuffer
++);
460 // If the character could not be converted to the destination
461 // character set, the UNICODE character is exported as character
463 // coverity[callee_ptr_arith] - its ok
464 nLen
= lcl_FlushContext(cBuffer
, nFlags
);
465 char *pBuffer
= cBuffer
;
467 aDest
.append(*pBuffer
++);
469 aDest
.append("&#" + OString::number(static_cast<sal_Int32
>(c
))
470 // Unicode code points guaranteed to fit into sal_Int32
472 if( pNonConvertableChars
)
475 if( -1 == pNonConvertableChars
->indexOf( cs
) )
476 (*pNonConvertableChars
) += cs
;
480 return aDest
.makeStringAndClear();
483 static OString
lcl_FlushToAscii()
487 char cBuffer
[TXTCONV_BUFFER_SIZE
];
488 const sal_uInt32 nFlags
= RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE
|
489 RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE
|
490 RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
|
491 RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR
;
492 sal_Size nLen
= lcl_FlushContext(cBuffer
, nFlags
);
493 char *pBuffer
= cBuffer
;
495 aDest
.append(*pBuffer
++);
496 return aDest
.makeStringAndClear();
499 OString
HTMLOutFuncs::ConvertStringToHTML( std::u16string_view rSrc
,
500 OUString
*pNonConvertableChars
)
503 for( sal_Int32 i
=0, nLen
= rSrc
.size(); i
< nLen
; )
504 aDest
.append(lcl_ConvertCharToHTML(
505 o3tl::iterateCodePoints(rSrc
, &i
), pNonConvertableChars
));
506 aDest
.append(lcl_FlushToAscii());
507 return aDest
.makeStringAndClear();
510 SvStream
& HTMLOutFuncs::Out_AsciiTag( SvStream
& rStream
, std::string_view rStr
,
514 rStream
.WriteOString("<");
516 rStream
.WriteOString("</");
518 rStream
.WriteOString(rStr
).WriteChar('>');
523 SvStream
& HTMLOutFuncs::Out_Char( SvStream
& rStream
, sal_uInt32 c
,
524 OUString
*pNonConvertableChars
)
526 OString sOut
= lcl_ConvertCharToHTML( c
, pNonConvertableChars
);
527 rStream
.WriteOString( sOut
);
531 SvStream
& HTMLOutFuncs::Out_String( SvStream
& rStream
, std::u16string_view rOUStr
,
532 OUString
*pNonConvertableChars
)
534 sal_Int32 nLen
= rOUStr
.size();
535 for( sal_Int32 n
= 0; n
< nLen
; )
536 HTMLOutFuncs::Out_Char( rStream
, o3tl::iterateCodePoints(rOUStr
, &n
),
537 pNonConvertableChars
);
538 HTMLOutFuncs::FlushToAscii( rStream
);
542 SvStream
& HTMLOutFuncs::FlushToAscii( SvStream
& rStream
)
544 OString sOut
= lcl_FlushToAscii();
547 rStream
.WriteOString( sOut
);
552 SvStream
& HTMLOutFuncs::Out_Hex( SvStream
& rStream
, sal_uInt32 nHex
, sal_uInt8 nLen
)
553 { // out into a stream
554 char aNToABuf
[] = "0000000000000000";
556 DBG_ASSERT( nLen
< sizeof(aNToABuf
), "too many places" );
557 if( nLen
>=sizeof(aNToABuf
) )
558 nLen
= (sizeof(aNToABuf
)-1);
560 // set pointer to end of buffer
561 char *pStr
= aNToABuf
+ (sizeof(aNToABuf
)-1);
562 for( sal_uInt8 n
= 0; n
< nLen
; ++n
)
564 *(--pStr
) = static_cast<char>(nHex
& 0xf ) + 48;
569 return rStream
.WriteOString( pStr
);
573 SvStream
& HTMLOutFuncs::Out_Color( SvStream
& rStream
, const Color
& rColor
, bool bXHTML
)
575 rStream
.WriteOString( "\"" );
577 rStream
.WriteOString( "color: " );
578 rStream
.WriteOString( "#" );
579 if( rColor
== COL_AUTO
)
581 rStream
.WriteOString( "000000" );
585 Out_Hex( rStream
, rColor
.GetRed(), 2 );
586 Out_Hex( rStream
, rColor
.GetGreen(), 2 );
587 Out_Hex( rStream
, rColor
.GetBlue(), 2 );
589 rStream
.WriteChar( '\"' );
594 SvStream
& HTMLOutFuncs::Out_ImageMap( SvStream
& rStream
,
595 const OUString
& rBaseURL
,
596 const ImageMap
& rIMap
,
597 const OUString
& rName
,
598 const HTMLOutEvent
*pEventTable
,
601 const char *pIndentArea
,
602 const char *pIndentMap
)
604 const OUString
& rOutName
= !rName
.isEmpty() ? rName
: rIMap
.GetName();
605 DBG_ASSERT( !rOutName
.isEmpty(), "No ImageMap-Name" );
606 if( rOutName
.isEmpty() )
610 OString::Concat("<") +
611 OOO_STRING_SVTOOLS_HTML_map
613 OOO_STRING_SVTOOLS_HTML_O_name
615 rStream
.WriteOString( sOut
);
617 Out_String( rStream
, rOutName
);
618 rStream
.WriteOString( "\">" );
620 for( size_t i
=0; i
<rIMap
.GetIMapObjectCount(); i
++ )
622 const IMapObject
* pObj
= rIMap
.GetIMapObject( i
);
623 DBG_ASSERT( pObj
, "Where is the ImageMap-Object?" );
627 const char *pShape
= nullptr;
629 switch( pObj
->GetType() )
631 case IMapObjectType::Rectangle
:
633 const IMapRectangleObject
* pRectObj
=
634 static_cast<const IMapRectangleObject
*>(pObj
);
635 pShape
= OOO_STRING_SVTOOLS_HTML_SH_rect
;
636 tools::Rectangle
aRect( pRectObj
->GetRectangle() );
639 OString::number(static_cast<sal_Int32
>(aRect
.Left()))
641 + OString::number(static_cast<sal_Int32
>(aRect
.Top()))
643 + OString::number(static_cast<sal_Int32
>(aRect
.Right()))
645 + OString::number(static_cast<sal_Int32
>(aRect
.Bottom()));;
648 case IMapObjectType::Circle
:
650 const IMapCircleObject
* pCirc
=
651 static_cast<const IMapCircleObject
*>(pObj
);
652 pShape
= OOO_STRING_SVTOOLS_HTML_SH_circ
;
653 Point
aCenter( pCirc
->GetCenter() );
654 tools::Long nOff
= pCirc
->GetRadius();
657 OString::number(static_cast<sal_Int32
>(aCenter
.X()))
659 + OString::number(static_cast<sal_Int32
>(aCenter
.Y()))
661 + OString::number(static_cast<sal_Int32
>(nOff
));
664 case IMapObjectType::Polygon
:
666 const IMapPolygonObject
* pPolyObj
=
667 static_cast<const IMapPolygonObject
*>(pObj
);
668 pShape
= OOO_STRING_SVTOOLS_HTML_SH_poly
;
669 tools::Polygon
aPoly( pPolyObj
->GetPolygon() );
670 sal_uInt16 nCount
= aPoly
.GetSize();
674 const Point
& rPoint
= aPoly
[0];
675 aTmpBuf
= OString::number(static_cast<sal_Int32
>(rPoint
.X()))
677 + OString::number(static_cast<sal_Int32
>(rPoint
.Y()));
679 for( sal_uInt16 j
=1; j
<nCount
; j
++ )
681 const Point
& rPoint
= aPoly
[j
];
684 + OString::number(static_cast<sal_Int32
>(rPoint
.X()))
686 + OString::number(static_cast<sal_Int32
>(rPoint
.Y()));
692 DBG_ASSERT( pShape
, "unknown IMapObject" );
699 rStream
.WriteOString( pDelim
);
701 rStream
.WriteOString( pIndentArea
);
703 sOut
.append(OString::Concat("<") + OOO_STRING_SVTOOLS_HTML_area
704 " " OOO_STRING_SVTOOLS_HTML_O_shape
705 "=\"" + pShape
+ "\" "
706 OOO_STRING_SVTOOLS_HTML_O_coords
"=\"" +
708 rStream
.WriteOString( sOut
);
711 OUString
aURL( pObj
->GetURL() );
712 if( !aURL
.isEmpty() && pObj
->IsActive() )
714 aURL
= URIHelper::simpleNormalizedMakeRelative(
716 sOut
.append(OOO_STRING_SVTOOLS_HTML_O_href
"=\"");
717 rStream
.WriteOString( sOut
);
719 Out_String( rStream
, aURL
).WriteChar( '\"' );
722 rStream
.WriteOString( OOO_STRING_SVTOOLS_HTML_O_nohref
);
724 const OUString
& rObjName
= pObj
->GetName();
725 if( !rObjName
.isEmpty() )
727 sOut
.append(" " OOO_STRING_SVTOOLS_HTML_O_name
"=\"");
728 rStream
.WriteOString( sOut
);
730 Out_String( rStream
, rObjName
).WriteChar( '\"' );
733 const OUString
& rTarget
= pObj
->GetTarget();
734 if( !rTarget
.isEmpty() && pObj
->IsActive() )
736 sOut
.append(" " OOO_STRING_SVTOOLS_HTML_O_target
"=\"");
737 rStream
.WriteOString( sOut
);
739 Out_String( rStream
, rTarget
).WriteChar( '\"' );
742 OUString
rDesc( pObj
->GetAltText() );
743 if( rDesc
.isEmpty() )
744 rDesc
= pObj
->GetDesc();
746 if( !rDesc
.isEmpty() )
748 sOut
.append(" " OOO_STRING_SVTOOLS_HTML_O_alt
"=\"");
749 rStream
.WriteOString( sOut
);
751 Out_String( rStream
, rDesc
).WriteChar( '\"' );
754 const SvxMacroTableDtor
& rMacroTab
= pObj
->GetMacroTable();
755 if( pEventTable
&& !rMacroTab
.empty() )
756 Out_Events( rStream
, rMacroTab
, pEventTable
,
759 rStream
.WriteOString("/>");
766 rStream
.WriteOString( pDelim
);
768 rStream
.WriteOString( pIndentMap
);
769 Out_AsciiTag( rStream
, OOO_STRING_SVTOOLS_HTML_map
, false );
774 SvStream
& HTMLOutFuncs::OutScript( SvStream
& rStrm
,
775 const OUString
& rBaseURL
,
776 std::u16string_view rSource
,
777 std::u16string_view rLanguage
,
778 ScriptType eScriptType
,
779 const OUString
& rSrc
,
780 const OUString
*pSBLibrary
,
781 const OUString
*pSBModule
)
783 // script is not indented!
784 OStringBuffer
sOut("<" OOO_STRING_SVTOOLS_HTML_script
);
786 if( !rLanguage
.empty() )
788 sOut
.append(" " OOO_STRING_SVTOOLS_HTML_O_language
"=\"");
789 rStrm
.WriteOString( sOut
);
791 Out_String( rStrm
, rLanguage
);
795 if( !rSrc
.isEmpty() )
797 sOut
.append(" " OOO_STRING_SVTOOLS_HTML_O_src
"=\"");
798 rStrm
.WriteOString( sOut
);
800 Out_String( rStrm
, URIHelper::simpleNormalizedMakeRelative(rBaseURL
, rSrc
) );
804 if( STARBASIC
!= eScriptType
&& pSBLibrary
)
806 sOut
.append(" " OOO_STRING_SVTOOLS_HTML_O_sdlibrary
"=\"");
807 rStrm
.WriteOString( sOut
);
809 Out_String( rStrm
, *pSBLibrary
);
813 if( STARBASIC
!= eScriptType
&& pSBModule
)
815 sOut
.append(" " OOO_STRING_SVTOOLS_HTML_O_sdmodule
"=\"");
816 rStrm
.WriteOString( sOut
);
818 Out_String( rStrm
, *pSBModule
);
824 rStrm
.WriteOString( sOut
);
827 if( !rSource
.empty() || pSBLibrary
|| pSBModule
)
829 rStrm
.WriteOString( SAL_NEWLINE_STRING
);
831 if( JAVASCRIPT
!= eScriptType
)
833 rStrm
.WriteOString( "<!--" )
834 .WriteOString( SAL_NEWLINE_STRING
);
837 if( STARBASIC
== eScriptType
)
841 sOut
.append("' " OOO_STRING_SVTOOLS_HTML_SB_library
" " +
842 OUStringToOString(*pSBLibrary
, RTL_TEXTENCODING_UTF8
));
843 rStrm
.WriteOString( sOut
).WriteOString( SAL_NEWLINE_STRING
);
849 sOut
.append("' " OOO_STRING_SVTOOLS_HTML_SB_module
" " +
850 OUStringToOString(*pSBModule
, RTL_TEXTENCODING_UTF8
));
851 rStrm
.WriteOString( sOut
).WriteOString( SAL_NEWLINE_STRING
);
856 if( !rSource
.empty() )
858 // we write the module in ANSI-charset, but with
859 // the system new line.
860 const OString
sSource(OUStringToOString(rSource
, RTL_TEXTENCODING_UTF8
));
861 rStrm
.WriteOString( sSource
).WriteOString( SAL_NEWLINE_STRING
);
863 rStrm
.WriteOString( SAL_NEWLINE_STRING
);
865 if( JAVASCRIPT
!= eScriptType
)
867 // MIB/MM: if it is not StarBasic, a // could be wrong.
868 // As the comment is removed during reading, it is not helping us...
869 rStrm
.WriteOString( STARBASIC
== eScriptType
? "' -->" : "// -->" )
870 .WriteOString( SAL_NEWLINE_STRING
);
874 HTMLOutFuncs::Out_AsciiTag( rStrm
, OOO_STRING_SVTOOLS_HTML_script
, false );
880 SvStream
& HTMLOutFuncs::Out_Events( SvStream
& rStrm
,
881 const SvxMacroTableDtor
& rMacroTable
,
882 const HTMLOutEvent
*pEventTable
,
886 while( pEventTable
[i
].pBasicName
|| pEventTable
[i
].pJavaName
)
888 const SvxMacro
*pMacro
=
889 rMacroTable
.Get( pEventTable
[i
].nEvent
);
891 if( pMacro
&& pMacro
->HasMacro() &&
892 ( JAVASCRIPT
== pMacro
->GetScriptType() || bOutStarBasic
))
894 const char *pStr
= STARBASIC
== pMacro
->GetScriptType()
895 ? pEventTable
[i
].pBasicName
896 : pEventTable
[i
].pJavaName
;
900 OString sOut
= OString::Concat(" ") + pStr
+ "=\"";
901 rStrm
.WriteOString( sOut
);
903 Out_String( rStrm
, pMacro
->GetMacName(), /*pNonConvertableChars*/nullptr ).WriteChar( '\"' );
912 OString
HTMLOutFuncs::CreateTableDataOptionsValNum(
914 double fVal
, sal_uInt32 nFormat
, SvNumberFormatter
& rFormatter
,
915 OUString
* pNonConvertableChars
)
917 OStringBuffer aStrTD
;
921 // printf / scanf is not precise enough
922 OUString aValStr
= rFormatter
.GetInputLineString( fVal
, 0 );
923 OString
sTmp(OUStringToOString(aValStr
, RTL_TEXTENCODING_UTF8
));
924 aStrTD
.append(" " OOO_STRING_SVTOOLS_HTML_O_SDval
"=\"" +
927 if ( bValue
|| nFormat
)
929 aStrTD
.append(" " OOO_STRING_SVTOOLS_HTML_O_SDnum
"=\"" +
930 OString::number(static_cast<sal_uInt16
>(
931 Application::GetSettings().GetLanguageTag().getLanguageType())) +
932 ";"); // Language for Format 0
937 const SvNumberformat
* pFormatEntry
= rFormatter
.GetEntry( nFormat
);
940 aNumStr
= ConvertStringToHTML( pFormatEntry
->GetFormatstring(),
941 pNonConvertableChars
);
942 nLang
= pFormatEntry
->GetLanguage();
945 nLang
= LANGUAGE_SYSTEM
;
947 OString::number(static_cast<sal_Int32
>(static_cast<sal_uInt16
>(nLang
)))
953 return aStrTD
.makeStringAndClear();
956 bool HTMLOutFuncs::PrivateURLToInternalImg( OUString
& rURL
)
958 if( rURL
.startsWith(OOO_STRING_SVTOOLS_HTML_private_image
) )
960 rURL
= rURL
.copy( strlen(OOO_STRING_SVTOOLS_HTML_private_image
) );
967 void HtmlWriterHelper::applyColor(HtmlWriter
& rHtmlWriter
, std::string_view aAttributeName
, const Color
& rColor
)
969 OStringBuffer sBuffer
;
971 if( rColor
== COL_AUTO
)
973 sBuffer
.append("#000000");
978 std::ostringstream sStringStream
;
984 << sal_uInt32(rColor
.GetRGBColor());
985 sBuffer
.append(sStringStream
.str().c_str());
988 rHtmlWriter
.attribute(aAttributeName
, sBuffer
);
992 void HtmlWriterHelper::applyEvents(HtmlWriter
& rHtmlWriter
, const SvxMacroTableDtor
& rMacroTable
, const HTMLOutEvent
* pEventTable
, bool bOutStarBasic
)
995 while (pEventTable
[i
].pBasicName
|| pEventTable
[i
].pJavaName
)
997 const SvxMacro
* pMacro
= rMacroTable
.Get(pEventTable
[i
].nEvent
);
999 if (pMacro
&& pMacro
->HasMacro() && (JAVASCRIPT
== pMacro
->GetScriptType() || bOutStarBasic
))
1001 const char* pAttributeName
= nullptr;
1002 if (STARBASIC
== pMacro
->GetScriptType())
1003 pAttributeName
= pEventTable
[i
].pBasicName
;
1005 pAttributeName
= pEventTable
[i
].pJavaName
;
1009 rHtmlWriter
.attribute(pAttributeName
, OUStringToOString(pMacro
->GetMacName(), RTL_TEXTENCODING_UTF8
));
1016 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */