Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_SVL_INETHIST_HXX
20 : #define INCLUDED_SVL_INETHIST_HXX
21 :
22 : #include <svl/brdcst.hxx>
23 : #include <svl/hint.hxx>
24 : #include <svl/svldllapi.h>
25 : #include <tools/urlobj.hxx>
26 :
27 : class INetURLHistory_Impl;
28 : class INetURLHistory : public SfxBroadcaster
29 : {
30 : struct StaticInstance
31 : {
32 : INetURLHistory * operator()();
33 : };
34 : friend INetURLHistory * StaticInstance::operator()();
35 :
36 : /** Representation.
37 : */
38 : INetURLHistory_Impl *m_pImpl;
39 :
40 : /** Construction/Destruction.
41 : */
42 : INetURLHistory (void);
43 : virtual ~INetURLHistory (void);
44 :
45 : /** Implementation.
46 : */
47 : static void NormalizeUrl_Impl (INetURLObject &rUrl);
48 :
49 : SVL_DLLPUBLIC void PutUrl_Impl (const INetURLObject &rUrl);
50 : SVL_DLLPUBLIC bool QueryUrl_Impl (const INetURLObject &rUrl);
51 :
52 : /** Not implemented.
53 : */
54 : INetURLHistory (const INetURLHistory&);
55 : INetURLHistory& operator= (const INetURLHistory&);
56 :
57 : public:
58 : /** GetOrCreate.
59 : */
60 : SVL_DLLPUBLIC static INetURLHistory* GetOrCreate (void);
61 :
62 : /** QueryProtocol.
63 : */
64 0 : bool QueryProtocol (INetProtocol eProto) const
65 : {
66 0 : return ((eProto == INET_PROT_FILE ) ||
67 0 : (eProto == INET_PROT_FTP ) ||
68 0 : (eProto == INET_PROT_HTTP ) ||
69 0 : (eProto == INET_PROT_HTTPS) );
70 : }
71 :
72 : /** QueryUrl.
73 : */
74 0 : bool QueryUrl (const INetURLObject &rUrl)
75 : {
76 0 : if (QueryProtocol (rUrl.GetProtocol()))
77 0 : return QueryUrl_Impl (rUrl);
78 : else
79 0 : return false;
80 : }
81 :
82 0 : bool QueryUrl (const OUString &rUrl)
83 : {
84 : INetProtocol eProto =
85 0 : INetURLObject::CompareProtocolScheme (rUrl);
86 0 : if (QueryProtocol (eProto))
87 0 : return QueryUrl_Impl (INetURLObject (rUrl));
88 : else
89 0 : return false;
90 : }
91 :
92 : /** PutUrl.
93 : */
94 0 : void PutUrl (const INetURLObject &rUrl)
95 : {
96 0 : if (QueryProtocol (rUrl.GetProtocol()))
97 0 : PutUrl_Impl (rUrl);
98 0 : }
99 :
100 : void PutUrl (const OUString &rUrl)
101 : {
102 : INetProtocol eProto =
103 : INetURLObject::CompareProtocolScheme (rUrl);
104 : if (QueryProtocol (eProto))
105 : PutUrl_Impl (INetURLObject (rUrl));
106 : }
107 : };
108 :
109 : // broadcasted from PutUrl().
110 0 : DECL_PTRHINT (SVL_DLLPUBLIC, INetURLHistoryHint, const INetURLObject);
111 :
112 : #endif // INCLUDED_SVL_INETHIST_HXX
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|