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_EXTENDEDSECURITYOPTIONS_HXX
24 #define INCLUDED_unotools_EXTENDEDSECURITYOPTIONS_HXX
25 
26 //_________________________________________________________________________________________________________________
27 //	includes
28 //_________________________________________________________________________________________________________________
29 
30 #include "unotools/unotoolsdllapi.h"
31 #include <sal/types.h>
32 #include <osl/mutex.hxx>
33 #include <com/sun/star/uno/Sequence.h>
34 #include <rtl/ustring.hxx>
35 #include <unotools/options.hxx>
36 
37 //_________________________________________________________________________________________________________________
38 //	forward declarations
39 //_________________________________________________________________________________________________________________
40 
41 /*-************************************************************************************************************//**
42 	@short			forward declaration to our private date container implementation
43 	@descr			We use these class as internal member to support small memory requirements.
44 					You can create the container if it is necessary. The class which use these mechanism
45 					is faster and smaller then a complete implementation!
46 *//*-*************************************************************************************************************/
47 
48 class SvtExtendedSecurityOptions_Impl;
49 
50 //_________________________________________________________________________________________________________________
51 //	declarations
52 //_________________________________________________________________________________________________________________
53 
54 /*-************************************************************************************************************//**
55 	@short			collect informations about security features
56 	@descr          -
57 
58 	@implements		-
59 	@base			-
60 
61 	@ATTENTION		This class is partially threadsafe.
62 
63 	@devstatus		ready to use
64 *//*-*************************************************************************************************************/
65 
66 class UNOTOOLS_DLLPUBLIC SvtExtendedSecurityOptions: public utl::detail::Options
67 {
68 	//-------------------------------------------------------------------------------------------------------------
69 	//	public methods
70 	//-------------------------------------------------------------------------------------------------------------
71 
72 	public:
73 		// Must be zero based!
74 		enum OpenHyperlinkMode
75 		{
76 			OPEN_NEVER					= 0,
77 			OPEN_WITHSECURITYCHECK,
78 			OPEN_ALWAYS
79 		};
80 
81 		//---------------------------------------------------------------------------------------------------------
82 		//	constructor / destructor
83 		//---------------------------------------------------------------------------------------------------------
84 
85 		/*-****************************************************************************************************//**
86 			@short		standard constructor and destructor
87 			@descr		This will initialize an instance with default values.
88 						We implement these class with a refcount mechanism! Every instance of this class increase it
89 						at create and decrease it at delete time - but all instances use the same data container!
90 						He is implemented as a static member ...
91 
92 			@seealso	member m_nRefCount
93 			@seealso	member m_pDataContainer
94 
95 			@param		-
96 			@return		-
97 
98 			@onerror	-
99 		*//*-*****************************************************************************************************/
100 
101          SvtExtendedSecurityOptions();
102         virtual ~SvtExtendedSecurityOptions();
103 
104 		//---------------------------------------------------------------------------------------------------------
105 		//	interface
106 		//---------------------------------------------------------------------------------------------------------
107 
108 		sal_Bool										IsSecureHyperlink( const rtl::OUString& aURL ) const;
109 		com::sun::star::uno::Sequence< rtl::OUString >	GetSecureExtensionList() const;
110 
111 		OpenHyperlinkMode								GetOpenHyperlinkMode();
112 		void											SetOpenHyperlinkMode( OpenHyperlinkMode aMode );
113         sal_Bool                                        IsOpenHyperlinkModeReadOnly() const;
114 
115 	//-------------------------------------------------------------------------------------------------------------
116 	//	private methods
117 	//-------------------------------------------------------------------------------------------------------------
118 
119 	private:
120 
121 		/*-****************************************************************************************************//**
122 			@short		return a reference to a static mutex
123 			@descr		These class is partially threadsafe (for de-/initialization only).
124 						All access methods are'nt safe!
125 						We create a static mutex only for one ime and use at different times.
126 
127 			@seealso	-
128 
129 			@param		-
130 			@return		A reference to a static mutex member.
131 
132 			@onerror	-
133 		*//*-*****************************************************************************************************/
134 
135         UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetInitMutex();
136 
137 	//-------------------------------------------------------------------------------------------------------------
138 	//	private member
139 	//-------------------------------------------------------------------------------------------------------------
140 
141 	private:
142 
143 		/*Attention
144 
145 			Don't initialize these static member in these header!
146 			a) Double dfined symbols will be detected ...
147 			b) and unresolved externals exist at linking time.
148 			Do it in your source only.
149 		 */
150 
151     	static SvtExtendedSecurityOptions_Impl*	m_pDataContainer	;	/// impl. data container as dynamic pointer for smaller memory requirements!
152 		static sal_Int32						m_nRefCount			;	/// internal ref count mechanism
153 
154 };		// class SvtExtendedSecurityOptions
155 
156 #endif  // #ifndef INCLUDED_unotools_EXTENDEDSECURITYOPTIONS_HXX
157