Update ooo320-m1
[ooovba.git] / lingucomponent / source / lingutil / lingutil.hxx
blobdf2fedaffb5cecc36a1300c50d5aa3720d59463b
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: lingutil.hxx,v $
10 * $Revision: 1.3 $
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 ************************************************************************/
31 #ifndef _LINGUTIL_HXX_
32 #define _LINGUTIL_HXX_
35 #include <com/sun/star/lang/Locale.hpp>
36 #include <rtl/string.hxx>
37 #include <rtl/ustring.hxx>
38 #include <tools/string.hxx>
40 #include <vector>
41 #include <list>
44 #define A2OU(x) ::rtl::OUString::createFromAscii( x )
46 #define OU2A(rtlOUString) \
47 ::rtl::OString((rtlOUString).getStr(), (rtlOUString).getLength(), \
48 RTL_TEXTENCODING_ASCII_US).getStr()
50 #define OU2UTF8(rtlOUString) \
51 ::rtl::OString((rtlOUString).getStr(), (rtlOUString).getLength(), \
52 RTL_TEXTENCODING_UTF8).getStr()
54 #define OU2ISO_1(rtlOUString) \
55 ::rtl::OString((rtlOUString).getStr(), (rtlOUString).getLength(), \
56 RTL_TEXTENCODING_ISO_8859_1).getStr()
58 #define OU2ENC(rtlOUString, rtlEncoding) \
59 ::rtl::OString((rtlOUString).getStr(), (rtlOUString).getLength(), \
60 rtlEncoding, RTL_UNICODETOTEXT_FLAGS_UNDEFINED_QUESTIONMARK).getStr()
63 struct SvtLinguConfigDictionaryEntry;
65 ///////////////////////////////////////////////////////////////////////////
67 struct lt_rtl_OUString
69 bool operator() (const rtl::OUString &r1, const rtl::OUString &r2) const
71 return r1 < r2;
75 inline BOOL operator == ( const ::com::sun::star::lang::Locale &rL1, const ::com::sun::star::lang::Locale &rL2 )
77 return rL1.Language == rL2.Language &&
78 rL1.Country == rL2.Country &&
79 rL1.Variant == rL2.Variant;
82 #if 0
83 ///////////////////////////////////////////////////////////////////////////
85 String GetDirectoryPathFromFileURL( const String &rFileURL );
86 #endif
88 #if defined(WNT)
89 ///////////////////////////////////////////////////////////////////////////
90 // to be use to get a short path name under Windows that still can be used with
91 // the 'fopen' call. This is necessary since under Windows there seems to be
92 // a restriction of only about 110-130 characters length to a path name in order
93 // for it to work with 'fopen'. And that length is usually easily exceeded
94 // when using extensions...
95 rtl::OString Win_GetShortPathName( const rtl::OUString &rLongPathName );
96 #endif
98 ///////////////////////////////////////////////////////////////////////////
100 // temporary function, to be removed when new style dictionaries
101 // using configuration entries are fully implemented and provided
102 std::vector< SvtLinguConfigDictionaryEntry > GetOldStyleDics( const char * pDicType );
103 void MergeNewStyleDicsAndOldStyleDics( std::list< SvtLinguConfigDictionaryEntry > &rNewStyleDics, const std::vector< SvtLinguConfigDictionaryEntry > &rOldStyleDics );
105 ///////////////////////////////////////////////////////////////////////////
107 #endif