1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: syslocale.hxx,v $
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 INCLUDED_SVTOOLS_SYSLOCALE_HXX
32 #define INCLUDED_SVTOOLS_SYSLOCALE_HXX
34 #ifndef INCLUDED_SVTDLLAPI_H
35 #include "bf_svtools/svtdllapi.h"
38 #ifndef _UNOTOOLS_LOCALEDATAWRAPPER_HXX
39 #include <unotools/localedatawrapper.hxx>
41 #ifndef _UNOTOOLS_CHARCLASS_HXX
42 #include <unotools/charclass.hxx>
45 #include <sal/types.h>
48 namespace osl
{ class Mutex
; }
50 class LocaleDataWrapper
;
55 class SvtSysLocale_Impl
;
58 SvtSysLocale provides a refcounted single instance of an application wide
59 <type>LocaleDataWrapper</type> and <type>CharClass</type> which always
60 follow the locale as it is currently configured by the user. You may use
61 it anywhere to access the locale data elements like decimal separator and
62 simple date formatting and so on. Contructing and destructing a
63 SvtSysLocale is not expensive as long as there is at least one instance
68 friend class SvtSysLocale_Impl
; // access to mutex
70 static SvtSysLocale_Impl
* pImpl
;
71 static sal_Int32 nRefCount
;
73 static ::osl::Mutex
& GetMutex();
79 const LocaleDataWrapper
& GetLocaleData() const;
80 const CharClass
& GetCharClass() const;
82 /** It is safe to store the pointers locally and use them AS LONG AS THE
83 INSTANCE OF SvtSysLocale LIVES!
84 It is a faster access but be sure what you do!
86 const LocaleDataWrapper
* GetLocaleDataPtr() const;
87 const CharClass
* GetCharClassPtr() const;
93 #endif // INCLUDED_SVTOOLS_SYSLOCALE_HXX