Fix of accessibility warnings for the additions dialog
[LibreOffice.git] / sal / textenc / tenchelp.hxx
blob901156730da5c8fcbcd385339cc72b8b54555d47
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 .
20 #ifndef INCLUDED_SAL_TEXTENC_TENCHELP_HXX
21 #define INCLUDED_SAL_TEXTENC_TENCHELP_HXX
23 #include <sal/config.h>
25 #include <rtl/tencinfo.h>
26 #include <rtl/textcvt.h>
27 #include <rtl/textenc.h>
28 #include <sal/types.h>
30 #include "unichars.hxx"
32 #define RTL_TEXTCVT_BYTE_PRIVATE_START 0xF100
33 #define RTL_TEXTCVT_BYTE_PRIVATE_END 0xF1FF
35 /* ----------------- */
36 /* - TextConverter - */
37 /* ----------------- */
39 typedef
40 sal_Size (* ImplConvertToUnicodeProc)(void const * pData,
41 void * pContext,
42 char const * pSrcBuf,
43 sal_Size nSrcBytes,
44 sal_Unicode * pDestBuf,
45 sal_Size nDestChars,
46 sal_uInt32 nFlags,
47 sal_uInt32 * pInfo,
48 sal_Size * pSrcCvtBytes);
50 typedef
51 sal_Size (* ImplConvertToTextProc)(void const * pData,
52 void * pContext,
53 sal_Unicode const * pSrcBuf,
54 sal_Size nSrcChars,
55 char * pDestBuf,
56 sal_Size nDestBytes,
57 sal_uInt32 nFlags,
58 sal_uInt32 * pInfo,
59 sal_Size * pSrcCvtChars);
61 typedef void * (* ImplCreateTextContextProc)();
63 typedef void (* ImplDestroyTextContextProc)(void * pContext);
65 typedef void (* ImplResetTextContextProc)(void * pContext);
67 typedef void * (* ImplCreateUnicodeContextProc)();
69 typedef void (* ImplDestroyUnicodeContextProc)(void * pContext);
71 typedef void (* ImplResetUnicodeContextProc)(void * pContext);
73 struct ImplTextConverter
75 void const * mpConvertData;
76 ImplConvertToUnicodeProc mpConvertTextToUnicodeProc;
77 ImplConvertToTextProc mpConvertUnicodeToTextProc;
78 ImplCreateTextContextProc mpCreateTextToUnicodeContext;
79 ImplDestroyTextContextProc mpDestroyTextToUnicodeContext;
80 ImplResetTextContextProc mpResetTextToUnicodeContext;
81 ImplCreateUnicodeContextProc mpCreateUnicodeToTextContext;
82 ImplDestroyUnicodeContextProc mpDestroyUnicodeToTextContext;
83 ImplResetUnicodeContextProc mpResetUnicodeToTextContext;
86 /* ----------------------------- */
87 /* - TextEncoding - Structures - */
88 /* ----------------------------- */
90 struct SAL_DLLPUBLIC_RTTI ImplTextEncodingData
92 ImplTextConverter maConverter;
93 sal_uInt8 mnMinCharSize;
94 sal_uInt8 mnMaxCharSize;
95 sal_uInt8 mnAveCharSize;
96 sal_uInt8 mnBestWindowsCharset;
97 char const * mpBestUnixCharset;
98 char const * mpBestMimeCharset;
99 sal_uInt32 mnInfoFlags;
102 /* ----------------------------------- */
103 /* - TextConverter - Byte-Structures - */
104 /* ----------------------------------- */
106 struct ImplUniCharTabData
108 sal_uInt16 mnUniChar;
109 unsigned char mnChar;
110 unsigned char mnChar2;
111 // to cater for mappings like MS1258 with 1--2 bytes per Unicode char,
112 // 0 if unused
115 struct ImplByteConvertData
117 const sal_uInt16* mpToUniTab1;
118 const sal_uInt16* mpToUniTab2;
119 unsigned char mnToUniStart1;
120 unsigned char mnToUniEnd1;
121 unsigned char mnToUniStart2;
122 unsigned char mnToUniEnd2;
123 const unsigned char* mpToCharTab1;
124 const unsigned char* mpToCharTab2;
125 const ImplUniCharTabData* mpToCharExTab;
126 sal_uInt16 mnToCharStart1;
127 sal_uInt16 mnToCharEnd1;
128 sal_uInt16 mnToCharStart2;
129 sal_uInt16 mnToCharEnd2;
130 sal_uInt16 mnToCharExCount;
133 /* ----------------------------------- */
134 /* - TextConverter - DBCS-Structures - */
135 /* ----------------------------------- */
137 struct ImplDBCSEUDCData
139 unsigned char mnLeadStart;
140 unsigned char mnLeadEnd;
141 unsigned char mnTrail1Start;
142 unsigned char mnTrail1End;
143 unsigned char mnTrail2Start;
144 unsigned char mnTrail2End;
145 unsigned char mnTrail3Start;
146 unsigned char mnTrail3End;
147 unsigned char mnTrailCount;
148 sal_uInt16 mnTrailRangeCount;
149 sal_uInt16 mnUniStart;
150 sal_uInt16 mnUniEnd;
153 struct ImplDBCSToUniLeadTab
155 sal_uInt16 mnUniChar;
156 sal_uInt8 mnTrailStart;
157 sal_uInt8 mnTrailEnd;
158 const sal_uInt16* mpToUniTrailTab;
161 struct ImplUniToDBCSHighTab
163 sal_uInt8 mnLowStart;
164 sal_uInt8 mnLowEnd;
165 const sal_uInt16* mpToUniTrailTab;
168 struct ImplDBCSConvertData
170 const ImplDBCSToUniLeadTab* mpToUniLeadTab;
171 const ImplUniToDBCSHighTab* mpToDBCSHighTab;
172 unsigned char mnLeadStart;
173 unsigned char mnLeadEnd;
174 unsigned char mnTrailStart;
175 unsigned char mnTrailEnd;
176 const ImplDBCSEUDCData* mpEUDCTab;
177 sal_uInt16 mnEUDCCount;
180 /* ---------------------------------- */
181 /* - TextConverter - EUC-Structures - */
182 /* ---------------------------------- */
184 struct ImplEUCJPConvertData
186 const ImplDBCSToUniLeadTab* mpJIS0208ToUniLeadTab;
187 const ImplDBCSToUniLeadTab* mpJIS0212ToUniLeadTab;
188 const ImplUniToDBCSHighTab* mpUniToJIS0208HighTab;
189 const ImplUniToDBCSHighTab* mpUniToJIS0212HighTab;
192 /* --------------------------------- */
193 /* - TextConverter - HelpFunctions - */
194 /* --------------------------------- */
196 inline sal_Unicode ImplGetUndefinedUnicodeChar(
197 unsigned char cChar, sal_uInt32 nFlags)
199 return ((nFlags & RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MASK)
200 == RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE) ?
201 RTL_TEXTCVT_BYTE_PRIVATE_START + cChar :
202 RTL_TEXTENC_UNICODE_REPLACEMENT_CHARACTER;
205 /* ----------------------------- */
206 /* - TextConverter - Functions - */
207 /* ----------------------------- */
209 sal_Size ImplDBCSToUnicode( const void* pData, void* pContext,
210 const char* pSrcBuf, sal_Size nSrcBytes,
211 sal_Unicode* pDestBuf, sal_Size nDestChars,
212 sal_uInt32 nFlags, sal_uInt32* pInfo,
213 sal_Size* pSrcCvtBytes );
214 sal_Size ImplUnicodeToDBCS( const void* pData, void* pContext,
215 const sal_Unicode* pSrcBuf, sal_Size nSrcChars,
216 char* pDestBuf, sal_Size nDestBytes,
217 sal_uInt32 nFlags, sal_uInt32* pInfo,
218 sal_Size* pSrcCvtChars );
219 sal_Size ImplEUCJPToUnicode( const void* pData,
220 void* pContext,
221 const char* pSrcBuf, sal_Size nSrcBytes,
222 sal_Unicode* pDestBuf, sal_Size nDestChars,
223 sal_uInt32 nFlags, sal_uInt32* pInfo,
224 sal_Size* pSrcCvtBytes );
225 sal_Size ImplUnicodeToEUCJP( const void* pData,
226 void* pContext,
227 const sal_Unicode* pSrcBuf, sal_Size nSrcChars,
228 char* pDestBuf, sal_Size nDestBytes,
229 sal_uInt32 nFlags, sal_uInt32* pInfo,
230 sal_Size* pSrcCvtChars );
231 void* ImplUTF7CreateUTF7TextToUnicodeContext();
232 void ImplUTF7DestroyTextToUnicodeContext( void* pContext );
233 void ImplUTF7ResetTextToUnicodeContext( void* pContext );
234 sal_Size ImplUTF7ToUnicode( const void* pData, void* pContext,
235 const char* pSrcBuf, sal_Size nSrcBytes,
236 sal_Unicode* pDestBuf, sal_Size nDestChars,
237 sal_uInt32 nFlags, sal_uInt32* pInfo,
238 sal_Size* pSrcCvtBytes );
239 void* ImplUTF7CreateUnicodeToTextContext();
240 void ImplUTF7DestroyUnicodeToTextContext( void* pContext );
241 void ImplUTF7ResetUnicodeToTextContext( void* pContext );
242 sal_Size ImplUnicodeToUTF7( const void* pData, void* pContext,
243 const sal_Unicode* pSrcBuf, sal_Size nSrcChars,
244 char* pDestBuf, sal_Size nDestBytes,
245 sal_uInt32 nFlags, sal_uInt32* pInfo,
246 sal_Size* pSrcCvtChars );
248 #endif
250 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */