Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef _LINGUTIL_HXX_
21 : : #define _LINGUTIL_HXX_
22 : :
23 : :
24 : : #include <com/sun/star/lang/Locale.hpp>
25 : : #include <rtl/string.hxx>
26 : : #include <rtl/ustring.hxx>
27 : : #include <tools/string.hxx>
28 : :
29 : : #include <vector>
30 : : #include <list>
31 : :
32 : :
33 : : #ifndef A2OU
34 : : # define A2OU(x) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( x ))
35 : : #endif
36 : :
37 : : #define OU2ENC(rtlOUString, rtlEncoding) \
38 : : ::rtl::OString((rtlOUString).getStr(), (rtlOUString).getLength(), \
39 : : rtlEncoding, RTL_UNICODETOTEXT_FLAGS_UNDEFINED_QUESTIONMARK).getStr()
40 : :
41 : :
42 : : struct SvtLinguConfigDictionaryEntry;
43 : :
44 : : ///////////////////////////////////////////////////////////////////////////
45 : :
46 : : struct lt_rtl_OUString
47 : : {
48 : 45080 : bool operator() (const rtl::OUString &r1, const rtl::OUString &r2) const
49 : : {
50 : 45080 : return r1 < r2;
51 : : }
52 : : };
53 : :
54 : 3440108 : inline sal_Bool operator == ( const ::com::sun::star::lang::Locale &rL1, const ::com::sun::star::lang::Locale &rL2 )
55 : : {
56 : 3440108 : return rL1.Language == rL2.Language &&
57 : 2223695 : rL1.Country == rL2.Country &&
58 [ + - ]: 5663803 : rL1.Variant == rL2.Variant;
[ + + + + ]
59 : : }
60 : :
61 : : #if 0
62 : : ///////////////////////////////////////////////////////////////////////////
63 : :
64 : : String GetDirectoryPathFromFileURL( const String &rFileURL );
65 : : #endif
66 : :
67 : : #if defined(WNT)
68 : : ///////////////////////////////////////////////////////////////////////////
69 : : // to be use to get a short path name under Windows that still can be used with
70 : : // the 'fopen' call. This is necessary since under Windows there seems to be
71 : : // a restriction of only about 110-130 characters length to a path name in order
72 : : // for it to work with 'fopen'. And that length is usually easily exceeded
73 : : // when using extensions...
74 : : rtl::OString Win_GetShortPathName( const rtl::OUString &rLongPathName );
75 : : #endif
76 : :
77 : : ///////////////////////////////////////////////////////////////////////////
78 : :
79 : : // temporary function, to be removed when new style dictionaries
80 : : // using configuration entries are fully implemented and provided
81 : : std::vector< SvtLinguConfigDictionaryEntry > GetOldStyleDics( const char * pDicType );
82 : : void MergeNewStyleDicsAndOldStyleDics( std::list< SvtLinguConfigDictionaryEntry > &rNewStyleDics, const std::vector< SvtLinguConfigDictionaryEntry > &rOldStyleDics );
83 : :
84 : : ///////////////////////////////////////////////////////////////////////////
85 : :
86 : :
87 : : //Find an encoding from a charset string, using
88 : : //rtl_getTextEncodingFromMimeCharset and falling back to
89 : : //rtl_getTextEncodingFromUnixCharset with the addition of
90 : : //ISCII-DEVANAGARI. On failure will return final fallback of
91 : : //RTL_TEXTENCODING_ISO_8859_1
92 : : rtl_TextEncoding getTextEncodingFromCharset(const sal_Char* pCharset);
93 : :
94 : : #endif
95 : :
96 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|