1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _INETHIST_HXX 28 #define _INETHIST_HXX 29 30 #include "svl/svldllapi.h" 31 #include <tools/solar.h> 32 #include <tools/string.hxx> 33 #include <tools/urlobj.hxx> 34 #include <svl/brdcst.hxx> 35 #include <svl/hint.hxx> 36 37 /*======================================================================== 38 * 39 * INetURLHistory interface. 40 * 41 *=======================================================================*/ 42 class INetURLHistory_Impl; 43 class INetURLHistory : public SfxBroadcaster 44 { 45 struct StaticInstance 46 { 47 INetURLHistory * operator()(); 48 }; 49 friend INetURLHistory * StaticInstance::operator()(); 50 51 /** Representation. 52 */ 53 INetURLHistory_Impl *m_pImpl; 54 55 /** Construction/Destruction. 56 */ 57 INetURLHistory (void); 58 virtual ~INetURLHistory (void); 59 60 /** Implementation. 61 */ 62 static void NormalizeUrl_Impl (INetURLObject &rUrl); 63 64 SVL_DLLPUBLIC void PutUrl_Impl (const INetURLObject &rUrl); 65 SVL_DLLPUBLIC sal_Bool QueryUrl_Impl (const INetURLObject &rUrl); 66 67 /** Not implemented. 68 */ 69 INetURLHistory (const INetURLHistory&); 70 INetURLHistory& operator= (const INetURLHistory&); 71 72 public: 73 /** GetOrCreate. 74 */ 75 SVL_DLLPUBLIC static INetURLHistory* GetOrCreate (void); 76 77 /** QueryProtocol. 78 */ 79 sal_Bool QueryProtocol (INetProtocol eProto) const 80 { 81 return ((eProto == INET_PROT_FILE ) || 82 (eProto == INET_PROT_FTP ) || 83 (eProto == INET_PROT_HTTP ) || 84 (eProto == INET_PROT_HTTPS) ); 85 } 86 87 /** QueryUrl. 88 */ 89 sal_Bool QueryUrl (const INetURLObject &rUrl) 90 { 91 if (QueryProtocol (rUrl.GetProtocol())) 92 return QueryUrl_Impl (rUrl); 93 else 94 return sal_False; 95 } 96 97 sal_Bool QueryUrl (const String &rUrl) 98 { 99 INetProtocol eProto = 100 INetURLObject::CompareProtocolScheme (rUrl); 101 if (QueryProtocol (eProto)) 102 return QueryUrl_Impl (INetURLObject (rUrl)); 103 else 104 return sal_False; 105 } 106 107 /** PutUrl. 108 */ 109 void PutUrl (const INetURLObject &rUrl) 110 { 111 if (QueryProtocol (rUrl.GetProtocol())) 112 PutUrl_Impl (rUrl); 113 } 114 115 void PutUrl (const String &rUrl) 116 { 117 INetProtocol eProto = 118 INetURLObject::CompareProtocolScheme (rUrl); 119 if (QueryProtocol (eProto)) 120 PutUrl_Impl (INetURLObject (rUrl)); 121 } 122 }; 123 124 /*======================================================================== 125 * 126 * INetURLHistoryHint (broadcasted from PutUrl()). 127 * 128 *=======================================================================*/ 129 DECL_PTRHINT (SVL_DLLPUBLIC, INetURLHistoryHint, const INetURLObject); 130 131 #endif /* _INETHIST_HXX */ 132 133