Bump version to 6.4-15
[LibreOffice.git] / include / svx / txencbox.hxx
blobd98c66713f99b5eb81856f8b4ed26453795fb1f2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
28 private:
29 std::unique_ptr<weld::ComboBox> m_xControl;
31 public:
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 <p> If nButIncludeInfoFlags is given, encodings are included even if they
40 match nExcludeInfoFlags. Thus it is possible to exclude 16/32-bit
41 Unicode with RTL_TEXTENCODING_INFO_UNICODE but to include UTF7 and UTF8
42 with RTL_TEXTENCODING_INFO_MIME </p>
44 @param bExcludeImportSubsets
45 If <TRUE/>, some specific encodings are not listed, as they are a
46 subset of another encoding. This is the case for
47 RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
48 RTL_TEXTENCODING_MS_936, which are covered by
49 RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
50 <TRUE/> whenever the box is used in import dialogs. */
51 void FillFromTextEncodingTable(
52 bool bExcludeImportSubsets,
53 sal_uInt32 nExcludeInfoFlags = 0,
54 sal_uInt32 nButIncludeInfoFlags = 0
57 /** Fill with all encodings known to the dbtools::OCharsetMap but exclude
58 those matching one or more given flags as defined in rtl/tencinfo.h
60 <p> If nButIncludeInfoFlags is given, encodings are included even if they
61 match nExcludeInfoFlags. Thus it is possible to exclude 16/32-bit
62 Unicode with RTL_TEXTENCODING_INFO_UNICODE but to include UTF7 and UTF8
63 with RTL_TEXTENCODING_INFO_MIME </p>
65 @param bExcludeImportSubsets
66 If <TRUE/>, some specific encodings are not listed, as they are a
67 subset of another encoding. This is the case for
68 RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
69 RTL_TEXTENCODING_MS_936, which are covered by
70 RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
71 <TRUE/> whenever the box is used in import dialogs. */
72 void FillFromDbTextEncodingMap(
73 bool bExcludeImportSubsets,
74 sal_uInt32 nExcludeInfoFlags = 0);
76 /** Fill with all known MIME encodings and select the best according to
77 <method>GetBestMimeEncoding</method>
79 void FillWithMimeAndSelectBest();
81 void InsertTextEncoding( const rtl_TextEncoding nEnc );
83 void InsertTextEncoding( const rtl_TextEncoding nEnc,
84 const OUString& rEntry );
86 void SelectTextEncoding( const rtl_TextEncoding nEnc );
88 rtl_TextEncoding GetSelectTextEncoding() const;
90 void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); }
91 void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
92 void grab_focus() { m_xControl->grab_focus(); }
93 int get_active() const { return m_xControl->get_active(); }
94 void set_active(int nActive) { m_xControl->set_active(nActive); }
95 void show() { m_xControl->show(); }
96 void hide() { m_xControl->hide(); }
99 class SVX_DLLPUBLIC SvxTextEncodingTreeView
101 private:
102 std::unique_ptr<weld::TreeView> m_xControl;
104 public:
105 SvxTextEncodingTreeView(std::unique_ptr<weld::TreeView> pControl);
107 ~SvxTextEncodingTreeView();
109 /** Fill with all known encodings but exclude those matching one or more
110 given flags as defined in rtl/tencinfo.h
112 @param bExcludeImportSubsets
113 If <TRUE/>, some specific encodings are not listed, as they are a
114 subset of another encoding. This is the case for
115 RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
116 RTL_TEXTENCODING_MS_936, which are covered by
117 RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
118 <TRUE/> whenever the box is used in import dialogs. */
119 void FillFromTextEncodingTable(
120 bool bExcludeImportSubsets,
121 sal_uInt32 nExcludeInfoFlags = 0);
123 /** Fill with all encodings known to the dbtools::OCharsetMap but exclude
124 those matching one or more given flags as defined in rtl/tencinfo.h
126 @param bExcludeImportSubsets
127 If <TRUE/>, some specific encodings are not listed, as they are a
128 subset of another encoding. This is the case for
129 RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
130 RTL_TEXTENCODING_MS_936, which are covered by
131 RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
132 <TRUE/> whenever the box is used in import dialogs. */
133 void FillFromDbTextEncodingMap(
134 bool bExcludeImportSubsets,
135 sal_uInt32 nExcludeInfoFlags = 0);
137 void InsertTextEncoding( const rtl_TextEncoding nEnc );
139 void InsertTextEncoding( const rtl_TextEncoding nEnc,
140 const OUString& rEntry );
142 void SelectTextEncoding( const rtl_TextEncoding nEnc );
144 rtl_TextEncoding GetSelectTextEncoding() const;
146 void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xControl->connect_changed(rLink); }
147 void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { m_xControl->connect_row_activated(rLink); }
148 void grab_focus() { m_xControl->grab_focus(); }
149 void show() { m_xControl->show(); }
150 void hide() { m_xControl->hide(); }
151 int get_height_rows(int nRows) const
153 return m_xControl->get_height_rows(nRows);
155 void set_size_request(int nWidth, int nHeight)
157 m_xControl->set_size_request(nWidth, nHeight);
161 #endif
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */