20#include <config_features.h>
25#if HAVE_FEATURE_DBCONNECTIVITY
29#include <rtl/tencinfo.h>
31#include <txenctab.hrc>
35 std::vector<rtl_TextEncoding> FillFromDbTextEncodingMap(
bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags)
37 std::vector<rtl_TextEncoding> aRet;
38#if !HAVE_FEATURE_DBCONNECTIVITY
39 (void)bExcludeImportSubsets;
40 (void)nExcludeInfoFlags;
42 rtl_TextEncodingInfo aInfo;
43 aInfo.StructSize =
sizeof(rtl_TextEncodingInfo);
44 ::std::vector< rtl_TextEncoding > aEncs;
46 for ( sal_Int32 j=0; j<
nCount; j++ )
49 rtl_TextEncoding nEnc = rtl_TextEncoding( aEncs[j] );
50 if ( nExcludeInfoFlags )
52 if ( !rtl_getTextEncodingInfo( nEnc, &aInfo ) )
56 if ( (aInfo.Flags & nExcludeInfoFlags) == 0 )
58 if ( (nExcludeInfoFlags & RTL_TEXTENCODING_INFO_UNICODE) &&
59 ((nEnc == RTL_TEXTENCODING_UCS2) ||
60 nEnc == RTL_TEXTENCODING_UCS4) )
69 if ( bExcludeImportSubsets )
74 case RTL_TEXTENCODING_GB_2312 :
75 case RTL_TEXTENCODING_GBK :
76 case RTL_TEXTENCODING_MS_936 :
84 if ( bInsert && nEnc != RTL_TEXTENCODING_DONTKNOW )
94 bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags )
98 for (
auto nEnc : aEncs)
104 bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags )
108 for (
auto nEnc : aEncs)
135 std::vector<int> FillFromTextEncodingTable(
bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags)
137 std::vector<int> aRet;
139 rtl_TextEncodingInfo aInfo;
140 aInfo.StructSize =
sizeof(rtl_TextEncodingInfo);
142 for (sal_uInt32 j = 0; j <
nCount; ++j)
145 rtl_TextEncoding nEnc = RID_SVXSTR_TEXTENCODING_TABLE[j].second;
146 if ( nExcludeInfoFlags )
148 if ( !rtl_getTextEncodingInfo( nEnc, &aInfo ) )
152 if ( (aInfo.Flags & nExcludeInfoFlags) == 0 )
154 if ( (nExcludeInfoFlags & RTL_TEXTENCODING_INFO_UNICODE) &&
155 ((nEnc == RTL_TEXTENCODING_UCS2) ||
156 nEnc == RTL_TEXTENCODING_UCS4) )
163 if ( bExcludeImportSubsets )
168 case RTL_TEXTENCODING_GB_2312 :
169 case RTL_TEXTENCODING_GBK :
170 case RTL_TEXTENCODING_MS_936 :
183 bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags )
189 rtl_TextEncoding nEnc = RID_SVXSTR_TEXTENCODING_TABLE[j].second;
196 bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags )
202 rtl_TextEncoding nEnc = RID_SVXSTR_TEXTENCODING_TABLE[j].second;
209 const OUString& rEntry )
211 m_xControl->append(OUString::number(nEnc), rEntry);
215 const OUString& rEntry )
217 m_xControl->append(OUString::number(nEnc), rEntry);
223 if (!rEntry.isEmpty())
226 SAL_WARN(
"svx.dialog",
"SvxTextEncodingBox::InsertTextEncoding: no resource string for text encoding: " <<
static_cast<sal_Int32
>( nEnc ) );
232 if (!rEntry.isEmpty())
235 SAL_WARN(
"svx.dialog",
"SvxTextEncodingTreeView::InsertTextEncoding: no resource string for text encoding: " <<
static_cast<sal_Int32
>( nEnc ) );
242 return rtl_TextEncoding(
sId.toInt32());
244 return RTL_TEXTENCODING_DONTKNOW;
251 return rtl_TextEncoding(
sId.toInt32());
253 return RTL_TEXTENCODING_DONTKNOW;
258 m_xControl->set_active_id(OUString::number(nEnc));
263 m_xControl->select_id(OUString::number(nEnc));
std::unique_ptr< weld::ComboBox > m_xControl
void FillFromTextEncodingTable(bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags=0)
Fill with all known encodings but exclude those matching one or more given flags as defined in rtl/te...
SvxTextEncodingBox(std::unique_ptr< weld::ComboBox > pControl)
void FillFromDbTextEncodingMap(bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags=0)
Fill with all encodings known to the dbtools::OCharsetMap but exclude those matching one or more give...
rtl_TextEncoding GetSelectTextEncoding() const
void InsertTextEncoding(const rtl_TextEncoding nEnc)
void SelectTextEncoding(const rtl_TextEncoding nEnc)
static OUString GetTextString(const rtl_TextEncoding nEnc)
~SvxTextEncodingTreeView()
SvxTextEncodingTreeView(std::unique_ptr< weld::TreeView > pControl)
std::unique_ptr< weld::TreeView > m_xControl
void FillFromDbTextEncodingMap(bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags=0)
Fill with all encodings known to the dbtools::OCharsetMap but exclude those matching one or more give...
void FillFromTextEncodingTable(bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags=0)
Fill with all known encodings but exclude those matching one or more given flags as defined in rtl/te...
rtl_TextEncoding GetSelectTextEncoding() const
void InsertTextEncoding(const rtl_TextEncoding nEnc)
void SelectTextEncoding(const rtl_TextEncoding nEnc)
OUString SvxResId(TranslateId aId)
#define SAL_WARN(area, stream)
#define SAL_N_ELEMENTS(arr)
constexpr OUStringLiteral first