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 _INETHIST_HXX
20 : #define _INETHIST_HXX
21 :
22 : #include "svl/svldllapi.h"
23 : #include <tools/solar.h>
24 : #include <tools/urlobj.hxx>
25 : #include <svl/brdcst.hxx>
26 : #include <svl/hint.hxx>
27 :
28 : /*========================================================================
29 : *
30 : * INetURLHistory interface.
31 : *
32 : *=======================================================================*/
33 : class INetURLHistory_Impl;
34 : class INetURLHistory : public SfxBroadcaster
35 : {
36 : struct StaticInstance
37 : {
38 : INetURLHistory * operator()();
39 : };
40 : friend INetURLHistory * StaticInstance::operator()();
41 :
42 : /** Representation.
43 : */
44 : INetURLHistory_Impl *m_pImpl;
45 :
46 : /** Construction/Destruction.
47 : */
48 : INetURLHistory (void);
49 : virtual ~INetURLHistory (void);
50 :
51 : /** Implementation.
52 : */
53 : static void NormalizeUrl_Impl (INetURLObject &rUrl);
54 :
55 : SVL_DLLPUBLIC void PutUrl_Impl (const INetURLObject &rUrl);
56 : SVL_DLLPUBLIC sal_Bool QueryUrl_Impl (const INetURLObject &rUrl);
57 :
58 : /** Not implemented.
59 : */
60 : INetURLHistory (const INetURLHistory&);
61 : INetURLHistory& operator= (const INetURLHistory&);
62 :
63 : public:
64 : /** GetOrCreate.
65 : */
66 : SVL_DLLPUBLIC static INetURLHistory* GetOrCreate (void);
67 :
68 : /** QueryProtocol.
69 : */
70 545 : sal_Bool QueryProtocol (INetProtocol eProto) const
71 : {
72 89 : return ((eProto == INET_PROT_FILE ) ||
73 89 : (eProto == INET_PROT_FTP ) ||
74 599 : (eProto == INET_PROT_HTTP ) ||
75 545 : (eProto == INET_PROT_HTTPS) );
76 : }
77 :
78 : /** QueryUrl.
79 : */
80 6 : sal_Bool QueryUrl (const INetURLObject &rUrl)
81 : {
82 6 : if (QueryProtocol (rUrl.GetProtocol()))
83 0 : return QueryUrl_Impl (rUrl);
84 : else
85 6 : return sal_False;
86 : }
87 :
88 83 : sal_Bool QueryUrl (const OUString &rUrl)
89 : {
90 : INetProtocol eProto =
91 83 : INetURLObject::CompareProtocolScheme (rUrl);
92 83 : if (QueryProtocol (eProto))
93 35 : return QueryUrl_Impl (INetURLObject (rUrl));
94 : else
95 48 : return sal_False;
96 : }
97 :
98 : /** PutUrl.
99 : */
100 456 : void PutUrl (const INetURLObject &rUrl)
101 : {
102 456 : if (QueryProtocol (rUrl.GetProtocol()))
103 456 : PutUrl_Impl (rUrl);
104 456 : }
105 :
106 : void PutUrl (const OUString &rUrl)
107 : {
108 : INetProtocol eProto =
109 : INetURLObject::CompareProtocolScheme (rUrl);
110 : if (QueryProtocol (eProto))
111 : PutUrl_Impl (INetURLObject (rUrl));
112 : }
113 : };
114 :
115 : /*========================================================================
116 : *
117 : * INetURLHistoryHint (broadcasted from PutUrl()).
118 : *
119 : *=======================================================================*/
120 3 : DECL_PTRHINT (SVL_DLLPUBLIC, INetURLHistoryHint, const INetURLObject);
121 :
122 : #endif /* _INETHIST_HXX */
123 :
124 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|