xref: /aoo41x/main/svx/inc/svx/txencbox.hxx (revision 3334a7e6)
1*3334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*3334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*3334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*3334a7e6SAndrew Rist  * distributed with this work for additional information
6*3334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*3334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*3334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
9*3334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*3334a7e6SAndrew Rist  *
11*3334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*3334a7e6SAndrew Rist  *
13*3334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*3334a7e6SAndrew Rist  * software distributed under the License is distributed on an
15*3334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*3334a7e6SAndrew Rist  * specific language governing permissions and limitations
18*3334a7e6SAndrew Rist  * under the License.
19*3334a7e6SAndrew Rist  *
20*3334a7e6SAndrew Rist  *************************************************************/
21*3334a7e6SAndrew Rist 
22*3334a7e6SAndrew Rist 
23cdf0e10cSrcweir #ifndef _SVX_TXENCBOX_HXX
24cdf0e10cSrcweir #define _SVX_TXENCBOX_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir // include ---------------------------------------------------------------
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #ifndef _LSTBOX_HXX //autogen
29cdf0e10cSrcweir #include <vcl/lstbox.hxx>
30cdf0e10cSrcweir #endif
31cdf0e10cSrcweir #include <rtl/textenc.h>
32cdf0e10cSrcweir #include "svx/svxdllapi.h"
33cdf0e10cSrcweir 
34cdf0e10cSrcweir class SvxTextEncodingTable;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir class SVX_DLLPUBLIC SvxTextEncodingBox : public ListBox
37cdf0e10cSrcweir {
38cdf0e10cSrcweir private:
39cdf0e10cSrcweir 	const SvxTextEncodingTable*		m_pEncTable;
40cdf0e10cSrcweir 
41cdf0e10cSrcweir 	SVX_DLLPRIVATE sal_uInt16				EncodingToPos_Impl( rtl_TextEncoding nEnc ) const;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir public:
44cdf0e10cSrcweir 						SvxTextEncodingBox( Window* pParent, const ResId& rResId );
45cdf0e10cSrcweir 						~SvxTextEncodingBox();
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 	/** Fill with all known encodings but exclude those matching one or more
48cdf0e10cSrcweir 		given flags as defined in rtl/tencinfo.h
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 	 	<p> If nButIncludeInfoFlags is given, encodings are included even if they
51cdf0e10cSrcweir 	 	match nExcludeInfoFlags. Thus it is possible to exclude 16/32-bit
52cdf0e10cSrcweir 	 	Unicode with RTL_TEXTENCODING_INFO_UNICODE but to include UTF7 and UTF8
53cdf0e10cSrcweir 	 	with RTL_TEXTENCODING_INFO_MIME </p>
54cdf0e10cSrcweir 
55cdf0e10cSrcweir         @param bExcludeImportSubsets
56cdf0e10cSrcweir             If <TRUE/>, some specific encodings are not listed, as they are a
57cdf0e10cSrcweir             subset of another encoding. This is the case for
58cdf0e10cSrcweir             RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
59cdf0e10cSrcweir             RTL_TEXTENCODING_MS_936, which are covered by
60cdf0e10cSrcweir             RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
61cdf0e10cSrcweir             <TRUE/> whenever the box is used in import dialogs. */
62cdf0e10cSrcweir 	void				FillFromTextEncodingTable(
63cdf0e10cSrcweir                             sal_Bool bExcludeImportSubsets = sal_False,
64cdf0e10cSrcweir 							sal_uInt32 nExcludeInfoFlags = 0,
65cdf0e10cSrcweir 							sal_uInt32 nButIncludeInfoFlags = 0
66cdf0e10cSrcweir 							);
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     /** Fill with all encodings known to the dbtools::OCharsetMap but exclude
69cdf0e10cSrcweir         those matching one or more given flags as defined in rtl/tencinfo.h
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 	 	<p> If nButIncludeInfoFlags is given, encodings are included even if they
72cdf0e10cSrcweir 	 	match nExcludeInfoFlags. Thus it is possible to exclude 16/32-bit
73cdf0e10cSrcweir 	 	Unicode with RTL_TEXTENCODING_INFO_UNICODE but to include UTF7 and UTF8
74cdf0e10cSrcweir 	 	with RTL_TEXTENCODING_INFO_MIME </p>
75cdf0e10cSrcweir 
76cdf0e10cSrcweir         @param bExcludeImportSubsets
77cdf0e10cSrcweir             If <TRUE/>, some specific encodings are not listed, as they are a
78cdf0e10cSrcweir             subset of another encoding. This is the case for
79cdf0e10cSrcweir             RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
80cdf0e10cSrcweir             RTL_TEXTENCODING_MS_936, which are covered by
81cdf0e10cSrcweir             RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
82cdf0e10cSrcweir             <TRUE/> whenever the box is used in import dialogs. */
83cdf0e10cSrcweir     void                FillFromDbTextEncodingMap(
84cdf0e10cSrcweir                             sal_Bool bExcludeImportSubsets = sal_False,
85cdf0e10cSrcweir 							sal_uInt32 nExcludeInfoFlags = 0,
86cdf0e10cSrcweir 							sal_uInt32 nButIncludeInfoFlags = 0
87cdf0e10cSrcweir 							);
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     /** Fill with all known MIME encodings and select the best according to
90cdf0e10cSrcweir         <method>GetBestMimeEncoding</method>
91cdf0e10cSrcweir 	 */
92cdf0e10cSrcweir 	void				FillWithMimeAndSelectBest();
93cdf0e10cSrcweir 
GetTextEncodingTable() const94cdf0e10cSrcweir 	const SvxTextEncodingTable*		GetTextEncodingTable() const
95cdf0e10cSrcweir 							{ return m_pEncTable; }
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	void				InsertTextEncoding( const rtl_TextEncoding nEnc,
98cdf0e10cSrcweir 							sal_uInt16 nPos = LISTBOX_APPEND );
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	void				InsertTextEncoding( const rtl_TextEncoding nEnc,
101cdf0e10cSrcweir 							const String& rEntry,
102cdf0e10cSrcweir 							sal_uInt16 nPos = LISTBOX_APPEND );
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	void				RemoveTextEncoding( const rtl_TextEncoding nEnc );
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	void				SelectTextEncoding( const rtl_TextEncoding nEnc,
107cdf0e10cSrcweir 							sal_Bool bSelect = sal_True );
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	rtl_TextEncoding	GetSelectTextEncoding() const;
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	const String&		GetSelectTextString() const;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	sal_Bool				IsTextEncodingSelected( const rtl_TextEncoding nEnc ) const;
114cdf0e10cSrcweir };
115cdf0e10cSrcweir 
116cdf0e10cSrcweir #endif
117cdf0e10cSrcweir 
118