1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef INCLUDED_unotools_LOCALISATIONOPTIONS_HXX
28 #define INCLUDED_unotools_LOCALISATIONOPTIONS_HXX
29 
30 //_________________________________________________________________________________________________________________
31 //	includes
32 //_________________________________________________________________________________________________________________
33 
34 #include <sal/types.h>
35 #include "unotools/unotoolsdllapi.h"
36 #include <osl/mutex.hxx>
37 #include <unotools/options.hxx>
38 
39 //_________________________________________________________________________________________________________________
40 //	forward declarations
41 //_________________________________________________________________________________________________________________
42 
43 /*-************************************************************************************************************//**
44 	@short			forward declaration to our private date container implementation
45 	@descr			We use these class as internal member to support small memory requirements.
46 					You can create the container if it is neccessary. The class which use these mechanism
47 					is faster and smaller then a complete implementation!
48 *//*-*************************************************************************************************************/
49 
50 class SvtLocalisationOptions_Impl;
51 
52 //_________________________________________________________________________________________________________________
53 //	declarations
54 //_________________________________________________________________________________________________________________
55 
56 /*-************************************************************************************************************//**
57 	@short			collect informations about localisation features
58 	@descr          -
59 
60 	@implements		-
61 	@base			-
62 
63 	@devstatus		ready to use
64 *//*-*************************************************************************************************************/
65 
66 class UNOTOOLS_DLLPUBLIC SvtLocalisationOptions: public utl::detail::Options
67 {
68 	//-------------------------------------------------------------------------------------------------------------
69 	//	public methods
70 	//-------------------------------------------------------------------------------------------------------------
71 
72 	public:
73 
74 		//---------------------------------------------------------------------------------------------------------
75 		//	constructor / destructor
76 		//---------------------------------------------------------------------------------------------------------
77 
78 		/*-****************************************************************************************************//**
79 			@short		standard constructor and destructor
80 			@descr		This will initialize an instance with default values.
81 						We implement these class with a refcount mechanism! Every instance of this class increase it
82 						at create and decrease it at delete time - but all instances use the same data container!
83 						He is implemented as a static member ...
84 
85 			@seealso	member m_nRefCount
86 			@seealso	member m_pDataContainer
87 
88 			@param		-
89 			@return		-
90 
91 			@onerror	-
92 		*//*-*****************************************************************************************************/
93 
94          SvtLocalisationOptions();
95         virtual ~SvtLocalisationOptions();
96 
97 		//---------------------------------------------------------------------------------------------------------
98 		//	interface
99 		//---------------------------------------------------------------------------------------------------------
100 
101 		/*-****************************************************************************************************//**
102 			@short		interface methods to get and set value of config key "org.openoffice.Office.Common/View/Localisation/AutoMnemonic"
103 			@descr		These value specifies if shortcuts should be assigned automatically.
104 
105 			@seealso	-
106 
107 			@param		"bState", new value to set it in configuration.
108 			@return		The value which represent current state of internal variable.
109 
110 			@onerror	No error should occurre!
111 		*//*-*****************************************************************************************************/
112 
113 		sal_Bool	IsAutoMnemonic	(					) const	;
114 		void		SetAutoMnemonic	( sal_Bool bState	)		;
115 
116 		/*-****************************************************************************************************//**
117 			@short		interface methods to get and set value of config key "org.openoffice.Office.Common/View/Localisation/DialogScale"
118 			@descr		These value specifies the factor for increasing controls.
119 						Value from [0..100] are allowed.
120 
121 			@ATTENTION	These methods don't check for valid or invalid values!
122 						Our configuration server can do it ... but these implementation don't get any notifications
123 						about wrong commits ...!
124 						=> If you set an invalid value - nothing will be changed. The information will lost.
125 
126 			@seealso	baseclass ConfigItem
127 
128 			@param		"nScale" new value to set it in configuration.
129 			@return		The value which represent current state of internal variable.
130 
131 			@onerror	No error should occurre!
132 		*//*-*****************************************************************************************************/
133 
134 		sal_Int32	GetDialogScale(						) const	;
135 		void		SetDialogScale( sal_Int32 nScale	)		;
136 
137 	//-------------------------------------------------------------------------------------------------------------
138 	//	private methods
139 	//-------------------------------------------------------------------------------------------------------------
140 
141 	private:
142 
143 		/*-****************************************************************************************************//**
144 			@short		return a reference to a static mutex
145 			@descr		These class is partially threadsafe (for de-/initialization only).
146 						All access methods are'nt safe!
147 						We create a static mutex only for one ime and use at different times.
148 
149 			@seealso	-
150 
151 			@param		-
152 			@return		A reference to a static mutex member.
153 
154 			@onerror	-
155 		*//*-*****************************************************************************************************/
156 
157         UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
158 
159 	//-------------------------------------------------------------------------------------------------------------
160 	//	private member
161 	//-------------------------------------------------------------------------------------------------------------
162 
163 	private:
164 
165 		/*Attention
166 
167 			Don't initialize these static member in these header!
168 			a) Double dfined symbols will be detected ...
169 			b) and unresolved externals exist at linking time.
170 			Do it in your source only.
171 		 */
172 
173     	static SvtLocalisationOptions_Impl*	m_pDataContainer	;	/// impl. data container as dynamic pointer for smaller memory requirements!
174 		static sal_Int32					m_nRefCount			;	/// internal ref count mechanism
175 
176 };		// class SvtLocalisationOptions
177 
178 #endif  // #ifndef INCLUDED_unotools_LOCALISATIONOPTIONS_HXX
179