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_INTERNALOPTIONS_HXX
24 #define INCLUDED_unotools_INTERNALOPTIONS_HXX
25 
26 //_________________________________________________________________________________________________________________
27 //	includes
28 //_________________________________________________________________________________________________________________
29 
30 #include "unotools/unotoolsdllapi.h"
31 #include <sal/types.h>
32 #include <osl/mutex.hxx>
33 #include <rtl/ustring.hxx>
34 #include <unotools/options.hxx>
35 
36 //_________________________________________________________________________________________________________________
37 //	namespaces!
38 //_________________________________________________________________________________________________________________
39 
40 #define	MUTEX			::osl::Mutex
41 #define	OUSTRING		::rtl::OUString
42 
43 //_________________________________________________________________________________________________________________
44 //	forward declarations
45 //_________________________________________________________________________________________________________________
46 
47 /*-************************************************************************************************************//**
48 	@short			forward declaration to our private date container implementation
49 	@descr			We use these class as internal member to support small memory requirements.
50 					You can create the container if it is neccessary. The class which use these mechanism
51 					is faster and smaller then a complete implementation!
52 *//*-*************************************************************************************************************/
53 
54 class SvtInternalOptions_Impl;
55 
56 //_________________________________________________________________________________________________________________
57 //	declarations
58 //_________________________________________________________________________________________________________________
59 
60 /*-************************************************************************************************************//**
61 	@short			collect informations about internal features
62 	@descr          -
63 
64 	@implements		-
65 	@base			-
66 
67 	@ATTENTION		This class is partially threadsafe.
68 
69 	@devstatus		ready to use
70 *//*-*************************************************************************************************************/
71 
72 class UNOTOOLS_DLLPUBLIC SvtInternalOptions: public utl::detail::Options
73 {
74 	//-------------------------------------------------------------------------------------------------------------
75 	//	public methods
76 	//-------------------------------------------------------------------------------------------------------------
77 
78 	public:
79 
80 		//---------------------------------------------------------------------------------------------------------
81 		//	constructor / destructor
82 		//---------------------------------------------------------------------------------------------------------
83 
84 		/*-****************************************************************************************************//**
85 			@short		standard constructor and destructor
86 			@descr		This will initialize an instance with default values.
87 						We implement these class with a refcount mechanism! Every instance of this class increase it
88 						at create and decrease it at delete time - but all instances use the same data container!
89 						He is implemented as a static member ...
90 
91 			@seealso	member m_nRefCount
92 			@seealso	member m_pDataContainer
93 
94 			@param		-
95 			@return		-
96 
97 			@onerror	-
98 		*//*-*****************************************************************************************************/
99 
100          SvtInternalOptions();
101         virtual ~SvtInternalOptions();
102 
103 		//---------------------------------------------------------------------------------------------------------
104 		//	interface
105 		//---------------------------------------------------------------------------------------------------------
106 
107 		/*-****************************************************************************************************//**
108 			@short		interface methods to get and set value of config key "org.openoffice.Office.Common/Internal/..."
109 			@descr      These options describe internal states to enable/disable features of installed office.
110 						The values are fixed at runtime - and implemented as readonly!
111 
112 						SlotCFGEnabled()	=>  If this option is set (true), StarOffice is searching for the slot.cfg.
113 												If the slot.cfg cannot be found, the start is aborted.
114 												If this option is not set (false), the slot.cfg must not be available,
115 												otherwise the start is also aborted.
116 
117 						CrashMailEnabled()	=>  Crash-Mail-Feature to document program crashes. After a crash,
118 												an e-mail with information about the system used is generated
119 												automatically when starting StarOffice.
120 
121 			@seealso	configuration package "org.openoffice.Office.Common/Internal"
122 		*//*-*****************************************************************************************************/
123 
124 		sal_Bool	SlotCFGEnabled		() const;
125 		sal_Bool	CrashMailEnabled	() const;
126         sal_Bool	MailUIEnabled      () const;
127         sal_Bool	IsRemoveMenuEntryClose() const;
128         sal_Bool	IsRemoveMenuEntryBackToWebtop() const;
129         sal_Bool	IsRemoveMenuEntryNewWebtop() const;
130         sal_Bool	IsRemoveMenuEntryLogout() const;
131 
132 		OUSTRING	GetCurrentTempURL() const;
133 		void		SetCurrentTempURL( const OUSTRING& aNewCurrentTempURL );
134 
135 	//-------------------------------------------------------------------------------------------------------------
136 	//	private methods
137 	//-------------------------------------------------------------------------------------------------------------
138 
139 	private:
140 
141 		/*-****************************************************************************************************//**
142 			@short		return a reference to a static mutex
143 			@descr		These class is partially threadsafe (for de-/initialization only).
144 						All access methods are'nt safe!
145 						We create a static mutex only for one ime and use at different times.
146 
147 			@seealso	-
148 
149 			@param		-
150 			@return		A reference to a static mutex member.
151 
152 			@onerror	-
153 		*//*-*****************************************************************************************************/
154 
155         UNOTOOLS_DLLPRIVATE static MUTEX& GetOwnStaticMutex();
156 
157 	//-------------------------------------------------------------------------------------------------------------
158 	//	private member
159 	//-------------------------------------------------------------------------------------------------------------
160 
161 	private:
162 
163 		/*Attention
164 
165 			Don't initialize these static member in these header!
166 			a) Double dfined symbols will be detected ...
167 			b) and unresolved externals exist at linking time.
168 			Do it in your source only.
169 		 */
170 
171     	static SvtInternalOptions_Impl*	m_pDataContainer	;	/// impl. data container as dynamic pointer for smaller memory requirements!
172 		static sal_Int32				m_nRefCount			;	/// internal ref count mechanism
173 
174 };		// class SvtInternalOptions
175 
176 #endif  // #ifndef INCLUDED_unotools_INTERNALOPTIONS_HXX
177