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( Window
* pParent
, WinBits nBits
);
37 virtual ~SvxTextEncodingBox();
39 /** Fill with all known encodings but exclude those matching one or more
40 given flags as defined in rtl/tencinfo.h
42 <p> If nButIncludeInfoFlags is given, encodings are included even if they
43 match nExcludeInfoFlags. Thus it is possible to exclude 16/32-bit
44 Unicode with RTL_TEXTENCODING_INFO_UNICODE but to include UTF7 and UTF8
45 with RTL_TEXTENCODING_INFO_MIME </p>
47 @param bExcludeImportSubsets
48 If <TRUE/>, some specific encodings are not listed, as they are a
49 subset of another encoding. This is the case for
50 RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
51 RTL_TEXTENCODING_MS_936, which are covered by
52 RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
53 <TRUE/> whenever the box is used in import dialogs. */
54 void FillFromTextEncodingTable(
55 bool bExcludeImportSubsets
= false,
56 sal_uInt32 nExcludeInfoFlags
= 0,
57 sal_uInt32 nButIncludeInfoFlags
= 0
60 /** Fill with all encodings known to the dbtools::OCharsetMap but exclude
61 those matching one or more given flags as defined in rtl/tencinfo.h
63 <p> If nButIncludeInfoFlags is given, encodings are included even if they
64 match nExcludeInfoFlags. Thus it is possible to exclude 16/32-bit
65 Unicode with RTL_TEXTENCODING_INFO_UNICODE but to include UTF7 and UTF8
66 with RTL_TEXTENCODING_INFO_MIME </p>
68 @param bExcludeImportSubsets
69 If <TRUE/>, some specific encodings are not listed, as they are a
70 subset of another encoding. This is the case for
71 RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
72 RTL_TEXTENCODING_MS_936, which are covered by
73 RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
74 <TRUE/> whenever the box is used in import dialogs. */
75 void FillFromDbTextEncodingMap(
76 bool bExcludeImportSubsets
= false,
77 sal_uInt32 nExcludeInfoFlags
= 0,
78 sal_uInt32 nButIncludeInfoFlags
= 0
81 /** Fill with all known MIME encodings and select the best according to
82 <method>GetBestMimeEncoding</method>
84 void FillWithMimeAndSelectBest();
86 const SvxTextEncodingTable
* GetTextEncodingTable() const
87 { return m_pEncTable
; }
89 void InsertTextEncoding( const rtl_TextEncoding nEnc
,
90 sal_Int32 nPos
= LISTBOX_APPEND
);
92 void InsertTextEncoding( const rtl_TextEncoding nEnc
,
93 const OUString
& rEntry
,
94 sal_Int32 nPos
= LISTBOX_APPEND
);
96 void SelectTextEncoding( const rtl_TextEncoding nEnc
,
97 bool bSelect
= true );
99 rtl_TextEncoding
GetSelectTextEncoding() const;
101 const OUString
& GetSelectTextString() const;
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */