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