Bump version to 6.4-15
[LibreOffice.git] / include / svl / inethist.hxx
blobeef642a2b7703bf5aa937d243488bdd4f25cefc3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
26 #include <memory>
28 class INetURLHistory_Impl;
29 class SVL_DLLPUBLIC INetURLHistory final : public SfxBroadcaster
31 struct SAL_DLLPRIVATE StaticInstance
33 INetURLHistory * operator()();
35 friend INetURLHistory * StaticInstance::operator()();
37 /** Representation.
39 std::unique_ptr<INetURLHistory_Impl> m_pImpl;
41 /** Construction/Destruction.
43 SAL_DLLPRIVATE INetURLHistory();
44 SAL_DLLPRIVATE virtual ~INetURLHistory() override;
46 /** Implementation.
48 SAL_DLLPRIVATE static void NormalizeUrl_Impl (INetURLObject &rUrl);
50 void PutUrl_Impl (const INetURLObject &rUrl);
51 bool QueryUrl_Impl (const INetURLObject &rUrl);
53 /** Not implemented.
55 INetURLHistory (const INetURLHistory&) = delete;
56 INetURLHistory& operator= (const INetURLHistory&) = delete;
58 public:
59 /** GetOrCreate.
61 static INetURLHistory* GetOrCreate();
63 /** QueryProtocol.
65 bool QueryProtocol (INetProtocol eProto) const
67 return ((eProto == INetProtocol::File ) ||
68 (eProto == INetProtocol::Ftp ) ||
69 (eProto == INetProtocol::Http ) ||
70 (eProto == INetProtocol::Https) );
73 /** QueryUrl.
75 bool QueryUrl (const INetURLObject &rUrl)
77 if (QueryProtocol (rUrl.GetProtocol()))
78 return QueryUrl_Impl (rUrl);
79 else
80 return false;
83 bool QueryUrl (const OUString &rUrl)
85 INetProtocol eProto =
86 INetURLObject::CompareProtocolScheme (rUrl);
87 if (QueryProtocol (eProto))
88 return QueryUrl_Impl (INetURLObject (rUrl));
89 else
90 return false;
93 /** PutUrl.
95 void PutUrl (const INetURLObject &rUrl)
97 if (QueryProtocol (rUrl.GetProtocol()))
98 PutUrl_Impl (rUrl);
102 // broadcasted from PutUrl().
103 class SVL_DLLPUBLIC INetURLHistoryHint final : public SfxHint
105 const INetURLObject* pObj;
106 public:
107 explicit INetURLHistoryHint( const INetURLObject* Object ) : pObj(Object) {}
108 const INetURLObject* GetObject() const { return pObj; }
111 #endif // INCLUDED_SVL_INETHIST_HXX
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */