xref: /aoo41x/main/svl/inc/svl/inethist.hxx (revision 39a19a47)
1*39a19a47SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*39a19a47SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*39a19a47SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*39a19a47SAndrew Rist  * distributed with this work for additional information
6*39a19a47SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*39a19a47SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*39a19a47SAndrew Rist  * "License"); you may not use this file except in compliance
9*39a19a47SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*39a19a47SAndrew Rist  *
11*39a19a47SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*39a19a47SAndrew Rist  *
13*39a19a47SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*39a19a47SAndrew Rist  * software distributed under the License is distributed on an
15*39a19a47SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*39a19a47SAndrew Rist  * KIND, either express or implied.  See the License for the
17*39a19a47SAndrew Rist  * specific language governing permissions and limitations
18*39a19a47SAndrew Rist  * under the License.
19*39a19a47SAndrew Rist  *
20*39a19a47SAndrew Rist  *************************************************************/
21*39a19a47SAndrew Rist 
22*39a19a47SAndrew Rist 
23cdf0e10cSrcweir #ifndef _INETHIST_HXX
24cdf0e10cSrcweir #define _INETHIST_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "svl/svldllapi.h"
27cdf0e10cSrcweir #include <tools/solar.h>
28cdf0e10cSrcweir #include <tools/string.hxx>
29cdf0e10cSrcweir #include <tools/urlobj.hxx>
30cdf0e10cSrcweir #include <svl/brdcst.hxx>
31cdf0e10cSrcweir #include <svl/hint.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir /*========================================================================
34cdf0e10cSrcweir  *
35cdf0e10cSrcweir  * INetURLHistory interface.
36cdf0e10cSrcweir  *
37cdf0e10cSrcweir  *=======================================================================*/
38cdf0e10cSrcweir class INetURLHistory_Impl;
39cdf0e10cSrcweir class INetURLHistory : public SfxBroadcaster
40cdf0e10cSrcweir {
41cdf0e10cSrcweir 	struct StaticInstance
42cdf0e10cSrcweir 	{
43cdf0e10cSrcweir 		INetURLHistory * operator()();
44cdf0e10cSrcweir 	};
45cdf0e10cSrcweir 	friend INetURLHistory * StaticInstance::operator()();
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 	/** Representation.
48cdf0e10cSrcweir 	*/
49cdf0e10cSrcweir 	INetURLHistory_Impl *m_pImpl;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 	/** Construction/Destruction.
52cdf0e10cSrcweir 	*/
53cdf0e10cSrcweir 	INetURLHistory (void);
54cdf0e10cSrcweir 	virtual ~INetURLHistory (void);
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 	/** Implementation.
57cdf0e10cSrcweir 	*/
58cdf0e10cSrcweir 	static void NormalizeUrl_Impl (INetURLObject &rUrl);
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	SVL_DLLPUBLIC void PutUrl_Impl   (const INetURLObject &rUrl);
61cdf0e10cSrcweir 	SVL_DLLPUBLIC sal_Bool QueryUrl_Impl (const INetURLObject &rUrl);
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 	/** Not implemented.
64cdf0e10cSrcweir 	*/
65cdf0e10cSrcweir 	INetURLHistory (const INetURLHistory&);
66cdf0e10cSrcweir 	INetURLHistory& operator= (const INetURLHistory&);
67cdf0e10cSrcweir 
68cdf0e10cSrcweir public:
69cdf0e10cSrcweir 	/** GetOrCreate.
70cdf0e10cSrcweir 	*/
71cdf0e10cSrcweir 	SVL_DLLPUBLIC static INetURLHistory* GetOrCreate (void);
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 	/** QueryProtocol.
74cdf0e10cSrcweir 	*/
QueryProtocol(INetProtocol eProto) const75cdf0e10cSrcweir 	sal_Bool QueryProtocol (INetProtocol eProto) const
76cdf0e10cSrcweir 	{
77cdf0e10cSrcweir 		return ((eProto == INET_PROT_FILE ) ||
78cdf0e10cSrcweir 				(eProto == INET_PROT_FTP  ) ||
79cdf0e10cSrcweir 				(eProto == INET_PROT_HTTP ) ||
80cdf0e10cSrcweir 				(eProto == INET_PROT_HTTPS)    );
81cdf0e10cSrcweir 	}
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 	/** QueryUrl.
84cdf0e10cSrcweir 	*/
QueryUrl(const INetURLObject & rUrl)85cdf0e10cSrcweir 	sal_Bool QueryUrl (const INetURLObject &rUrl)
86cdf0e10cSrcweir 	{
87cdf0e10cSrcweir 		if (QueryProtocol (rUrl.GetProtocol()))
88cdf0e10cSrcweir 			return QueryUrl_Impl (rUrl);
89cdf0e10cSrcweir 		else
90cdf0e10cSrcweir 			return sal_False;
91cdf0e10cSrcweir 	}
92cdf0e10cSrcweir 
QueryUrl(const String & rUrl)93cdf0e10cSrcweir 	sal_Bool QueryUrl (const String &rUrl)
94cdf0e10cSrcweir 	{
95cdf0e10cSrcweir 		INetProtocol eProto =
96cdf0e10cSrcweir 			INetURLObject::CompareProtocolScheme (rUrl);
97cdf0e10cSrcweir 		if (QueryProtocol (eProto))
98cdf0e10cSrcweir 			return QueryUrl_Impl (INetURLObject (rUrl));
99cdf0e10cSrcweir 		else
100cdf0e10cSrcweir 			return sal_False;
101cdf0e10cSrcweir 	}
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	/** PutUrl.
104cdf0e10cSrcweir 	*/
PutUrl(const INetURLObject & rUrl)105cdf0e10cSrcweir 	void PutUrl (const INetURLObject &rUrl)
106cdf0e10cSrcweir 	{
107cdf0e10cSrcweir 		if (QueryProtocol (rUrl.GetProtocol()))
108cdf0e10cSrcweir 			PutUrl_Impl (rUrl);
109cdf0e10cSrcweir 	}
110cdf0e10cSrcweir 
PutUrl(const String & rUrl)111cdf0e10cSrcweir 	void PutUrl (const String &rUrl)
112cdf0e10cSrcweir 	{
113cdf0e10cSrcweir 		INetProtocol eProto =
114cdf0e10cSrcweir 			INetURLObject::CompareProtocolScheme (rUrl);
115cdf0e10cSrcweir 		if (QueryProtocol (eProto))
116cdf0e10cSrcweir 			PutUrl_Impl (INetURLObject (rUrl));
117cdf0e10cSrcweir 	}
118cdf0e10cSrcweir };
119cdf0e10cSrcweir 
120cdf0e10cSrcweir /*========================================================================
121cdf0e10cSrcweir  *
122cdf0e10cSrcweir  * INetURLHistoryHint (broadcasted from PutUrl()).
123cdf0e10cSrcweir  *
124cdf0e10cSrcweir  *=======================================================================*/
125cdf0e10cSrcweir DECL_PTRHINT (SVL_DLLPUBLIC, INetURLHistoryHint, const INetURLObject);
126cdf0e10cSrcweir 
127cdf0e10cSrcweir #endif /* _INETHIST_HXX */
128cdf0e10cSrcweir 
129