1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SVL_INETHIST_HXX
20 #define INCLUDED_SVL_INETHIST_HXX
22 #include <svl/SfxBroadcaster.hxx>
23 #include <svl/hint.hxx>
24 #include <svl/svldllapi.h>
25 #include <tools/urlobj.hxx>
27 class INetURLHistory_Impl
;
28 class SVL_DLLPUBLIC INetURLHistory
: public SfxBroadcaster
30 struct SAL_DLLPRIVATE StaticInstance
32 INetURLHistory
* operator()();
34 friend INetURLHistory
* StaticInstance::operator()();
38 INetURLHistory_Impl
*m_pImpl
;
40 /** Construction/Destruction.
42 SAL_DLLPRIVATE
INetURLHistory();
43 SAL_DLLPRIVATE
virtual ~INetURLHistory();
47 SAL_DLLPRIVATE
static void NormalizeUrl_Impl (INetURLObject
&rUrl
);
49 void PutUrl_Impl (const INetURLObject
&rUrl
);
50 bool QueryUrl_Impl (const INetURLObject
&rUrl
);
54 INetURLHistory (const INetURLHistory
&) SAL_DELETED_FUNCTION
;
55 INetURLHistory
& operator= (const INetURLHistory
&) SAL_DELETED_FUNCTION
;
60 static INetURLHistory
* GetOrCreate();
64 bool QueryProtocol (INetProtocol eProto
) const
66 return ((eProto
== INetProtocol::File
) ||
67 (eProto
== INetProtocol::Ftp
) ||
68 (eProto
== INetProtocol::Http
) ||
69 (eProto
== INetProtocol::Https
) );
74 bool QueryUrl (const INetURLObject
&rUrl
)
76 if (QueryProtocol (rUrl
.GetProtocol()))
77 return QueryUrl_Impl (rUrl
);
82 bool QueryUrl (const OUString
&rUrl
)
85 INetURLObject::CompareProtocolScheme (rUrl
);
86 if (QueryProtocol (eProto
))
87 return QueryUrl_Impl (INetURLObject (rUrl
));
94 void PutUrl (const INetURLObject
&rUrl
)
96 if (QueryProtocol (rUrl
.GetProtocol()))
100 void PutUrl (const OUString
&rUrl
)
102 INetProtocol eProto
=
103 INetURLObject::CompareProtocolScheme (rUrl
);
104 if (QueryProtocol (eProto
))
105 PutUrl_Impl (INetURLObject (rUrl
));
109 // broadcasted from PutUrl().
110 class SVL_DLLPUBLIC INetURLHistoryHint
: public SfxHint
112 const INetURLObject
* pObj
;
114 explicit INetURLHistoryHint( const INetURLObject
* Object
) : pObj(Object
) {}
115 virtual ~INetURLHistoryHint() {}
116 const INetURLObject
* GetObject() const { return pObj
; }
119 #endif // INCLUDED_SVL_INETHIST_HXX
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */