Update ooo320-m1
[ooovba.git] / svx / inc / txencbox.hxx
blobc861118c875c0298062fc1514b39d8aba03c2118
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: txencbox.hxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SVX_TXENCBOX_HXX
31 #define _SVX_TXENCBOX_HXX
33 // include ---------------------------------------------------------------
35 #ifndef _LSTBOX_HXX //autogen
36 #include <vcl/lstbox.hxx>
37 #endif
38 #include <rtl/textenc.h>
39 #include "svx/svxdllapi.h"
41 class SvxTextEncodingTable;
43 class SVX_DLLPUBLIC SvxTextEncodingBox : public ListBox
45 private:
46 const SvxTextEncodingTable* m_pEncTable;
48 SVX_DLLPRIVATE USHORT EncodingToPos_Impl( rtl_TextEncoding nEnc ) const;
50 public:
51 SvxTextEncodingBox( Window* pParent, const ResId& rResId );
52 ~SvxTextEncodingBox();
54 /** Fill with all known encodings but exclude those matching one or more
55 given flags as defined in rtl/tencinfo.h
57 <p> If nButIncludeInfoFlags is given, encodings are included even if they
58 match nExcludeInfoFlags. Thus it is possible to exclude 16/32-bit
59 Unicode with RTL_TEXTENCODING_INFO_UNICODE but to include UTF7 and UTF8
60 with RTL_TEXTENCODING_INFO_MIME </p>
62 @param bExcludeImportSubsets
63 If <TRUE/>, some specific encodings are not listed, as they are a
64 subset of another encoding. This is the case for
65 RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
66 RTL_TEXTENCODING_MS_936, which are covered by
67 RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
68 <TRUE/> whenever the box is used in import dialogs. */
69 void FillFromTextEncodingTable(
70 sal_Bool bExcludeImportSubsets = FALSE,
71 sal_uInt32 nExcludeInfoFlags = 0,
72 sal_uInt32 nButIncludeInfoFlags = 0
75 /** Fill with all encodings known to the dbtools::OCharsetMap but exclude
76 those matching one or more given flags as defined in rtl/tencinfo.h
78 <p> If nButIncludeInfoFlags is given, encodings are included even if they
79 match nExcludeInfoFlags. Thus it is possible to exclude 16/32-bit
80 Unicode with RTL_TEXTENCODING_INFO_UNICODE but to include UTF7 and UTF8
81 with RTL_TEXTENCODING_INFO_MIME </p>
83 @param bExcludeImportSubsets
84 If <TRUE/>, some specific encodings are not listed, as they are a
85 subset of another encoding. This is the case for
86 RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
87 RTL_TEXTENCODING_MS_936, which are covered by
88 RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
89 <TRUE/> whenever the box is used in import dialogs. */
90 void FillFromDbTextEncodingMap(
91 sal_Bool bExcludeImportSubsets = FALSE,
92 sal_uInt32 nExcludeInfoFlags = 0,
93 sal_uInt32 nButIncludeInfoFlags = 0
96 /** Fill with all known MIME encodings and select the best according to
97 <method>GetBestMimeEncoding</method>
99 void FillWithMimeAndSelectBest();
101 /** Get the best MIME encoding matching the system locale, or if that isn't
102 determinable one that matches the UI locale, or UTF8 if everything else
103 fails.
105 static rtl_TextEncoding GetBestMimeEncoding();
107 const SvxTextEncodingTable* GetTextEncodingTable() const
108 { return m_pEncTable; }
110 void InsertTextEncoding( const rtl_TextEncoding nEnc,
111 USHORT nPos = LISTBOX_APPEND );
113 void InsertTextEncoding( const rtl_TextEncoding nEnc,
114 const String& rEntry,
115 USHORT nPos = LISTBOX_APPEND );
117 void RemoveTextEncoding( const rtl_TextEncoding nEnc );
119 void SelectTextEncoding( const rtl_TextEncoding nEnc,
120 BOOL bSelect = TRUE );
122 rtl_TextEncoding GetSelectTextEncoding() const;
124 const String& GetSelectTextString() const;
126 BOOL IsTextEncodingSelected( const rtl_TextEncoding nEnc ) const;
129 #endif