xref: /AOO41X/main/sal/inc/rtl/textcvt.h (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _RTL_TEXTCVT_H
29*cdf0e10cSrcweir #define _RTL_TEXTCVT_H
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #ifndef _SAL_TYPES_H
32*cdf0e10cSrcweir #include <sal/types.h>
33*cdf0e10cSrcweir #endif
34*cdf0e10cSrcweir #include <rtl/textenc.h>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #ifdef __cplusplus
37*cdf0e10cSrcweir extern "C" {
38*cdf0e10cSrcweir #endif
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir /* Documentation about this file can be found at
41*cdf0e10cSrcweir    <http://udk.openoffice.org/cpp/man/spec/textconversion.html>. */
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
44*cdf0e10cSrcweir  */
45*cdf0e10cSrcweir typedef void* rtl_TextToUnicodeConverter;
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
48*cdf0e10cSrcweir  */
49*cdf0e10cSrcweir typedef void* rtl_TextToUnicodeContext;
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
52*cdf0e10cSrcweir  */
53*cdf0e10cSrcweir rtl_TextToUnicodeConverter SAL_CALL rtl_createTextToUnicodeConverter( rtl_TextEncoding eTextEncoding );
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
56*cdf0e10cSrcweir  */
57*cdf0e10cSrcweir void					   SAL_CALL rtl_destroyTextToUnicodeConverter( rtl_TextToUnicodeConverter hConverter );
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
60*cdf0e10cSrcweir  */
61*cdf0e10cSrcweir rtl_TextToUnicodeContext   SAL_CALL rtl_createTextToUnicodeContext( rtl_TextToUnicodeConverter hConverter );
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
64*cdf0e10cSrcweir  */
65*cdf0e10cSrcweir void					   SAL_CALL rtl_destroyTextToUnicodeContext( rtl_TextToUnicodeConverter hConverter, rtl_TextToUnicodeContext hContext );
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
68*cdf0e10cSrcweir  */
69*cdf0e10cSrcweir void					   SAL_CALL rtl_resetTextToUnicodeContext( rtl_TextToUnicodeConverter hConverter, rtl_TextToUnicodeContext hContext );
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR 			((sal_uInt32)0x0001)
72*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE			((sal_uInt32)0x0002)
73*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE		((sal_uInt32)0x0003)
74*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT			((sal_uInt32)0x0004)
75*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR			((sal_uInt32)0x0010)
76*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_IGNORE			((sal_uInt32)0x0020)
77*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT 		((sal_uInt32)0x0030)
78*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR				((sal_uInt32)0x0100)
79*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE				((sal_uInt32)0x0200)
80*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT 			((sal_uInt32)0x0300)
81*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_FLAGS_FLUSH						((sal_uInt32)0x8000)
82*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE 0x10000
83*cdf0e10cSrcweir     /* Accept any global document signatures (for example, in UTF-8, a leading
84*cdf0e10cSrcweir        EF BB BF encoding the Byte Order Mark U+FEFF) */
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MASK				((sal_uInt32)0x000F)
87*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_MASK			((sal_uInt32)0x00F0)
88*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_FLAGS_INVALID_MASK				((sal_uInt32)0x0F00)
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_INFO_ERROR						((sal_uInt32)0x0001)
91*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL 			((sal_uInt32)0x0002)
92*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL			((sal_uInt32)0x0004)
93*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_INFO_UNDEFINED					((sal_uInt32)0x0008)
94*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_INFO_MBUNDEFINED					((sal_uInt32)0x0010)
95*cdf0e10cSrcweir #define RTL_TEXTTOUNICODE_INFO_INVALID						((sal_uInt32)0x0020)
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
98*cdf0e10cSrcweir  */
99*cdf0e10cSrcweir sal_Size SAL_CALL rtl_convertTextToUnicode( rtl_TextToUnicodeConverter hConverter,
100*cdf0e10cSrcweir 											rtl_TextToUnicodeContext hContext,
101*cdf0e10cSrcweir 											const sal_Char* pSrcBuf, sal_Size nSrcBytes,
102*cdf0e10cSrcweir 											sal_Unicode* pDestBuf, sal_Size nDestChars,
103*cdf0e10cSrcweir 											sal_uInt32 nFlags, sal_uInt32* pInfo,
104*cdf0e10cSrcweir 											sal_Size* pSrcCvtBytes );
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
107*cdf0e10cSrcweir  */
108*cdf0e10cSrcweir typedef void* rtl_UnicodeToTextConverter;
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
111*cdf0e10cSrcweir  */
112*cdf0e10cSrcweir typedef void* rtl_UnicodeToTextContext;
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
115*cdf0e10cSrcweir  */
116*cdf0e10cSrcweir rtl_UnicodeToTextConverter SAL_CALL rtl_createUnicodeToTextConverter( rtl_TextEncoding eTextEncoding );
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
119*cdf0e10cSrcweir  */
120*cdf0e10cSrcweir void					   SAL_CALL rtl_destroyUnicodeToTextConverter( rtl_UnicodeToTextConverter hConverter );
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
123*cdf0e10cSrcweir  */
124*cdf0e10cSrcweir rtl_UnicodeToTextContext   SAL_CALL rtl_createUnicodeToTextContext( rtl_UnicodeToTextConverter hConverter );
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
127*cdf0e10cSrcweir  */
128*cdf0e10cSrcweir void					   SAL_CALL rtl_destroyUnicodeToTextContext( rtl_UnicodeToTextConverter hConverter, rtl_UnicodeToTextContext hContext );
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
131*cdf0e10cSrcweir  */
132*cdf0e10cSrcweir void					   SAL_CALL rtl_resetUnicodeToTextContext( rtl_UnicodeToTextConverter hConverter, rtl_UnicodeToTextContext hContext );
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR 			((sal_uInt32)0x0001)
135*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE			((sal_uInt32)0x0002)
136*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_0 				((sal_uInt32)0x0003)
137*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_QUESTIONMARK		((sal_uInt32)0x0004)
138*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_UNDERLINE 		((sal_uInt32)0x0005)
139*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT			((sal_uInt32)0x0006)
140*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR				((sal_uInt32)0x0010)
141*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_INVALID_IGNORE				((sal_uInt32)0x0020)
142*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_INVALID_0					((sal_uInt32)0x0030)
143*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_INVALID_QUESTIONMARK		((sal_uInt32)0x0040)
144*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_INVALID_UNDERLINE			((sal_uInt32)0x0050)
145*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT 			((sal_uInt32)0x0060)
146*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE			((sal_uInt32)0x0100)
147*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR		((sal_uInt32)0x0200)
148*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0				((sal_uInt32)0x0400)
149*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE			((sal_uInt32)0x0800)
150*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE				((sal_uInt32)0x1000)
151*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_PRIVATE_IGNORE				((sal_uInt32)0x2000)
152*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_NOCOMPOSITE 				((sal_uInt32)0x4000)
153*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_FLUSH						((sal_uInt32)0x8000)
154*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_GLOBAL_SIGNATURE 0x10000
155*cdf0e10cSrcweir     /* Write any global document signatures (for example, in UTF-8, a leading
156*cdf0e10cSrcweir        EF BB BF encoding the Byte Order Mark U+FEFF) */
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_MASK				((sal_uInt32)0x000F)
159*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_FLAGS_INVALID_MASK				((sal_uInt32)0x00F0)
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_INFO_ERROR						((sal_uInt32)0x0001)
162*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_INFO_SRCBUFFERTOSMALL 			((sal_uInt32)0x0002)
163*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL			((sal_uInt32)0x0004)
164*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_INFO_UNDEFINED					((sal_uInt32)0x0008)
165*cdf0e10cSrcweir #define RTL_UNICODETOTEXT_INFO_INVALID						((sal_uInt32)0x0010)
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
168*cdf0e10cSrcweir  */
169*cdf0e10cSrcweir sal_Size SAL_CALL rtl_convertUnicodeToText( rtl_UnicodeToTextConverter hConverter,
170*cdf0e10cSrcweir 											rtl_UnicodeToTextContext hContext,
171*cdf0e10cSrcweir 											const sal_Unicode* pSrcBuf, sal_Size nSrcChars,
172*cdf0e10cSrcweir 											sal_Char* pDestBuf, sal_Size nDestBytes,
173*cdf0e10cSrcweir 											sal_uInt32 nFlags, sal_uInt32* pInfo,
174*cdf0e10cSrcweir 											sal_Size* pSrcCvtChars );
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir #ifdef __cplusplus
177*cdf0e10cSrcweir }
178*cdf0e10cSrcweir #endif
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir #endif /* _RTL_TEXTCVT_H */
181