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/weld.hxx>
23 #include <rtl/textenc.h>
24 #include <svx/svxdllapi.h>
26 class SVX_DLLPUBLIC SvxTextEncodingBox
29 std::unique_ptr
<weld::ComboBox
> m_xControl
;
32 SvxTextEncodingBox(std::unique_ptr
<weld::ComboBox
> pControl
);
34 ~SvxTextEncodingBox();
36 /** Fill with all known encodings but exclude those matching one or more
37 given flags as defined in rtl/tencinfo.h
39 @param bExcludeImportSubsets
40 If <TRUE/>, some specific encodings are not listed, as they are a
41 subset of another encoding. This is the case for
42 RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
43 RTL_TEXTENCODING_MS_936, which are covered by
44 RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
45 <TRUE/> whenever the box is used in import dialogs. */
46 void FillFromTextEncodingTable(
47 bool bExcludeImportSubsets
,
48 sal_uInt32 nExcludeInfoFlags
= 0
51 /** Fill with all encodings known to the dbtools::OCharsetMap but exclude
52 those matching one or more given flags as defined in rtl/tencinfo.h
54 <p> If nButIncludeInfoFlags is given, encodings are included even if they
55 match nExcludeInfoFlags. Thus it is possible to exclude 16/32-bit
56 Unicode with RTL_TEXTENCODING_INFO_UNICODE but to include UTF7 and UTF8
57 with RTL_TEXTENCODING_INFO_MIME </p>
59 @param bExcludeImportSubsets
60 If <TRUE/>, some specific encodings are not listed, as they are a
61 subset of another encoding. This is the case for
62 RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
63 RTL_TEXTENCODING_MS_936, which are covered by
64 RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
65 <TRUE/> whenever the box is used in import dialogs. */
66 void FillFromDbTextEncodingMap(
67 bool bExcludeImportSubsets
,
68 sal_uInt32 nExcludeInfoFlags
= 0);
70 void InsertTextEncoding( const rtl_TextEncoding nEnc
);
72 void InsertTextEncoding( const rtl_TextEncoding nEnc
,
73 const OUString
& rEntry
);
75 void SelectTextEncoding( const rtl_TextEncoding nEnc
);
77 rtl_TextEncoding
GetSelectTextEncoding() const;
79 void connect_changed(const Link
<weld::ComboBox
&, void>& rLink
) { m_xControl
->connect_changed(rLink
); }
80 void set_sensitive(bool bSensitive
) { m_xControl
->set_sensitive(bSensitive
); }
81 void grab_focus() { m_xControl
->grab_focus(); }
82 int get_active() const { return m_xControl
->get_active(); }
83 void set_active(int nActive
) { m_xControl
->set_active(nActive
); }
84 void show() { m_xControl
->show(); }
85 void hide() { m_xControl
->hide(); }
88 class SVX_DLLPUBLIC SvxTextEncodingTreeView
91 std::unique_ptr
<weld::TreeView
> m_xControl
;
94 SvxTextEncodingTreeView(std::unique_ptr
<weld::TreeView
> pControl
);
96 ~SvxTextEncodingTreeView();
98 /** Fill with all known encodings but exclude those matching one or more
99 given flags as defined in rtl/tencinfo.h
101 @param bExcludeImportSubsets
102 If <TRUE/>, some specific encodings are not listed, as they are a
103 subset of another encoding. This is the case for
104 RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
105 RTL_TEXTENCODING_MS_936, which are covered by
106 RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
107 <TRUE/> whenever the box is used in import dialogs. */
108 void FillFromTextEncodingTable(
109 bool bExcludeImportSubsets
,
110 sal_uInt32 nExcludeInfoFlags
= 0);
112 /** Fill with all encodings known to the dbtools::OCharsetMap but exclude
113 those matching one or more given flags as defined in rtl/tencinfo.h
115 @param bExcludeImportSubsets
116 If <TRUE/>, some specific encodings are not listed, as they are a
117 subset of another encoding. This is the case for
118 RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
119 RTL_TEXTENCODING_MS_936, which are covered by
120 RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
121 <TRUE/> whenever the box is used in import dialogs. */
122 void FillFromDbTextEncodingMap(
123 bool bExcludeImportSubsets
,
124 sal_uInt32 nExcludeInfoFlags
= 0);
126 void InsertTextEncoding( const rtl_TextEncoding nEnc
);
128 void InsertTextEncoding( const rtl_TextEncoding nEnc
,
129 const OUString
& rEntry
);
131 void SelectTextEncoding( const rtl_TextEncoding nEnc
);
133 rtl_TextEncoding
GetSelectTextEncoding() const;
135 void connect_changed(const Link
<weld::TreeView
&, void>& rLink
) { m_xControl
->connect_changed(rLink
); }
136 void connect_row_activated(const Link
<weld::TreeView
&, bool>& rLink
) { m_xControl
->connect_row_activated(rLink
); }
137 void grab_focus() { m_xControl
->grab_focus(); }
138 void show() { m_xControl
->show(); }
139 void hide() { m_xControl
->hide(); }
140 int get_height_rows(int nRows
) const
142 return m_xControl
->get_height_rows(nRows
);
144 void set_size_request(int nWidth
, int nHeight
)
146 m_xControl
->set_size_request(nWidth
, nHeight
);
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */