xref: /aoo4110/main/sal/inc/rtl/textcvt.h (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _RTL_TEXTCVT_H
25 #define _RTL_TEXTCVT_H
26 
27 #ifndef _SAL_TYPES_H
28 #include <sal/types.h>
29 #endif
30 #include <rtl/textenc.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /* Documentation about this file can be found at
37    <http://udk.openoffice.org/cpp/man/spec/textconversion.html>. */
38 
39 /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
40  */
41 typedef void* rtl_TextToUnicodeConverter;
42 
43 /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
44  */
45 typedef void* rtl_TextToUnicodeContext;
46 
47 /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
48  */
49 rtl_TextToUnicodeConverter SAL_CALL rtl_createTextToUnicodeConverter( rtl_TextEncoding eTextEncoding );
50 
51 /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
52  */
53 void					   SAL_CALL rtl_destroyTextToUnicodeConverter( rtl_TextToUnicodeConverter hConverter );
54 
55 /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
56  */
57 rtl_TextToUnicodeContext   SAL_CALL rtl_createTextToUnicodeContext( rtl_TextToUnicodeConverter hConverter );
58 
59 /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
60  */
61 void					   SAL_CALL rtl_destroyTextToUnicodeContext( rtl_TextToUnicodeConverter hConverter, rtl_TextToUnicodeContext hContext );
62 
63 /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
64  */
65 void					   SAL_CALL rtl_resetTextToUnicodeContext( rtl_TextToUnicodeConverter hConverter, rtl_TextToUnicodeContext hContext );
66 
67 #define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR 			((sal_uInt32)0x0001)
68 #define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE			((sal_uInt32)0x0002)
69 #define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE		((sal_uInt32)0x0003)
70 #define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT			((sal_uInt32)0x0004)
71 #define RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR			((sal_uInt32)0x0010)
72 #define RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_IGNORE			((sal_uInt32)0x0020)
73 #define RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT 		((sal_uInt32)0x0030)
74 #define RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR				((sal_uInt32)0x0100)
75 #define RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE				((sal_uInt32)0x0200)
76 #define RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT 			((sal_uInt32)0x0300)
77 #define RTL_TEXTTOUNICODE_FLAGS_FLUSH						((sal_uInt32)0x8000)
78 #define RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE 0x10000
79     /* Accept any global document signatures (for example, in UTF-8, a leading
80        EF BB BF encoding the Byte Order Mark U+FEFF) */
81 
82 #define RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MASK				((sal_uInt32)0x000F)
83 #define RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_MASK			((sal_uInt32)0x00F0)
84 #define RTL_TEXTTOUNICODE_FLAGS_INVALID_MASK				((sal_uInt32)0x0F00)
85 
86 #define RTL_TEXTTOUNICODE_INFO_ERROR						((sal_uInt32)0x0001)
87 #define RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL 			((sal_uInt32)0x0002)
88 #define RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL			((sal_uInt32)0x0004)
89 #define RTL_TEXTTOUNICODE_INFO_UNDEFINED					((sal_uInt32)0x0008)
90 #define RTL_TEXTTOUNICODE_INFO_MBUNDEFINED					((sal_uInt32)0x0010)
91 #define RTL_TEXTTOUNICODE_INFO_INVALID						((sal_uInt32)0x0020)
92 
93 /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
94  */
95 sal_Size SAL_CALL rtl_convertTextToUnicode( rtl_TextToUnicodeConverter hConverter,
96 											rtl_TextToUnicodeContext hContext,
97 											const sal_Char* pSrcBuf, sal_Size nSrcBytes,
98 											sal_Unicode* pDestBuf, sal_Size nDestChars,
99 											sal_uInt32 nFlags, sal_uInt32* pInfo,
100 											sal_Size* pSrcCvtBytes );
101 
102 /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
103  */
104 typedef void* rtl_UnicodeToTextConverter;
105 
106 /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
107  */
108 typedef void* rtl_UnicodeToTextContext;
109 
110 /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
111  */
112 rtl_UnicodeToTextConverter SAL_CALL rtl_createUnicodeToTextConverter( rtl_TextEncoding eTextEncoding );
113 
114 /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
115  */
116 void					   SAL_CALL rtl_destroyUnicodeToTextConverter( rtl_UnicodeToTextConverter hConverter );
117 
118 /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
119  */
120 rtl_UnicodeToTextContext   SAL_CALL rtl_createUnicodeToTextContext( rtl_UnicodeToTextConverter hConverter );
121 
122 /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
123  */
124 void					   SAL_CALL rtl_destroyUnicodeToTextContext( rtl_UnicodeToTextConverter hConverter, rtl_UnicodeToTextContext hContext );
125 
126 /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
127  */
128 void					   SAL_CALL rtl_resetUnicodeToTextContext( rtl_UnicodeToTextConverter hConverter, rtl_UnicodeToTextContext hContext );
129 
130 #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR 			((sal_uInt32)0x0001)
131 #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE			((sal_uInt32)0x0002)
132 #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_0 				((sal_uInt32)0x0003)
133 #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_QUESTIONMARK		((sal_uInt32)0x0004)
134 #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_UNDERLINE 		((sal_uInt32)0x0005)
135 #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT			((sal_uInt32)0x0006)
136 #define RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR				((sal_uInt32)0x0010)
137 #define RTL_UNICODETOTEXT_FLAGS_INVALID_IGNORE				((sal_uInt32)0x0020)
138 #define RTL_UNICODETOTEXT_FLAGS_INVALID_0					((sal_uInt32)0x0030)
139 #define RTL_UNICODETOTEXT_FLAGS_INVALID_QUESTIONMARK		((sal_uInt32)0x0040)
140 #define RTL_UNICODETOTEXT_FLAGS_INVALID_UNDERLINE			((sal_uInt32)0x0050)
141 #define RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT 			((sal_uInt32)0x0060)
142 #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE			((sal_uInt32)0x0100)
143 #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR		((sal_uInt32)0x0200)
144 #define RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0				((sal_uInt32)0x0400)
145 #define RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE			((sal_uInt32)0x0800)
146 #define RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE				((sal_uInt32)0x1000)
147 #define RTL_UNICODETOTEXT_FLAGS_PRIVATE_IGNORE				((sal_uInt32)0x2000)
148 #define RTL_UNICODETOTEXT_FLAGS_NOCOMPOSITE 				((sal_uInt32)0x4000)
149 #define RTL_UNICODETOTEXT_FLAGS_FLUSH						((sal_uInt32)0x8000)
150 #define RTL_UNICODETOTEXT_FLAGS_GLOBAL_SIGNATURE 0x10000
151     /* Write any global document signatures (for example, in UTF-8, a leading
152        EF BB BF encoding the Byte Order Mark U+FEFF) */
153 
154 #define RTL_UNICODETOTEXT_FLAGS_UNDEFINED_MASK				((sal_uInt32)0x000F)
155 #define RTL_UNICODETOTEXT_FLAGS_INVALID_MASK				((sal_uInt32)0x00F0)
156 
157 #define RTL_UNICODETOTEXT_INFO_ERROR						((sal_uInt32)0x0001)
158 #define RTL_UNICODETOTEXT_INFO_SRCBUFFERTOSMALL 			((sal_uInt32)0x0002)
159 #define RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL			((sal_uInt32)0x0004)
160 #define RTL_UNICODETOTEXT_INFO_UNDEFINED					((sal_uInt32)0x0008)
161 #define RTL_UNICODETOTEXT_INFO_INVALID						((sal_uInt32)0x0010)
162 
163 /** see http://udk.openoffice.org/cpp/man/spec/textconversion.html
164  */
165 sal_Size SAL_CALL rtl_convertUnicodeToText( rtl_UnicodeToTextConverter hConverter,
166 											rtl_UnicodeToTextContext hContext,
167 											const sal_Unicode* pSrcBuf, sal_Size nSrcChars,
168 											sal_Char* pDestBuf, sal_Size nDestBytes,
169 											sal_uInt32 nFlags, sal_uInt32* pInfo,
170 											sal_Size* pSrcCvtChars );
171 
172 #ifdef __cplusplus
173 }
174 #endif
175 
176 #endif /* _RTL_TEXTCVT_H */
177