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