1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #ifndef INCLUDED_SVX_TXENCBOX_HXX
20 #define INCLUDED_SVX_TXENCBOX_HXX
22 #include <vcl/lstbox.hxx>
23 #include <rtl/textenc.h>
24 #include <svx/svxdllapi.h>
26 class SvxTextEncodingTable
;
28 class SVX_DLLPUBLIC SvxTextEncodingBox
: public ListBox
31 const SvxTextEncodingTable
* m_pEncTable
;
33 SVX_DLLPRIVATE sal_Int32
EncodingToPos_Impl( rtl_TextEncoding nEnc
) const;
36 SvxTextEncodingBox( vcl::Window
* pParent
, WinBits nBits
);
37 virtual ~SvxTextEncodingBox() override
;
38 virtual void dispose() override
;
40 /** Fill with all known encodings but exclude those matching one or more
41 given flags as defined in rtl/tencinfo.h
43 <p> If nButIncludeInfoFlags is given, encodings are included even if they
44 match nExcludeInfoFlags. Thus it is possible to exclude 16/32-bit
45 Unicode with RTL_TEXTENCODING_INFO_UNICODE but to include UTF7 and UTF8
46 with RTL_TEXTENCODING_INFO_MIME </p>
48 @param bExcludeImportSubsets
49 If <TRUE/>, some specific encodings are not listed, as they are a
50 subset of another encoding. This is the case for
51 RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
52 RTL_TEXTENCODING_MS_936, which are covered by
53 RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
54 <TRUE/> whenever the box is used in import dialogs. */
55 void FillFromTextEncodingTable(
56 bool bExcludeImportSubsets
,
57 sal_uInt32 nExcludeInfoFlags
= 0,
58 sal_uInt32 nButIncludeInfoFlags
= 0
61 /** Fill with all encodings known to the dbtools::OCharsetMap but exclude
62 those matching one or more given flags as defined in rtl/tencinfo.h
64 <p> If nButIncludeInfoFlags is given, encodings are included even if they
65 match nExcludeInfoFlags. Thus it is possible to exclude 16/32-bit
66 Unicode with RTL_TEXTENCODING_INFO_UNICODE but to include UTF7 and UTF8
67 with RTL_TEXTENCODING_INFO_MIME </p>
69 @param bExcludeImportSubsets
70 If <TRUE/>, some specific encodings are not listed, as they are a
71 subset of another encoding. This is the case for
72 RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
73 RTL_TEXTENCODING_MS_936, which are covered by
74 RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
75 <TRUE/> whenever the box is used in import dialogs. */
76 void FillFromDbTextEncodingMap(
77 bool bExcludeImportSubsets
,
78 sal_uInt32 nExcludeInfoFlags
= 0
81 /** Fill with all known MIME encodings and select the best according to
82 <method>GetBestMimeEncoding</method>
84 void FillWithMimeAndSelectBest();
86 void InsertTextEncoding( const rtl_TextEncoding nEnc
);
88 void InsertTextEncoding( const rtl_TextEncoding nEnc
,
89 const OUString
& rEntry
);
91 void SelectTextEncoding( const rtl_TextEncoding nEnc
);
93 rtl_TextEncoding
GetSelectTextEncoding() const;
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */