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