1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: inethist.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <tools/solar.h>
38 #include <tools/string.hxx>
42 #include <tools/urlobj.hxx>
45 #ifndef _SFXBRDCST_HXX
46 #include <bf_svtools/brdcst.hxx>
50 #include <bf_svtools/hint.hxx>
56 /*========================================================================
58 * INetURLHistory interface.
60 *=======================================================================*/
61 class INetURLHistory_Impl
;
62 class INetURLHistory
: public SfxBroadcaster
66 INetURLHistory
* operator()();
68 friend INetURLHistory
* StaticInstance::operator()();
72 INetURLHistory_Impl
*m_pImpl
;
74 /** Construction/Destruction.
76 INetURLHistory (void);
77 virtual ~INetURLHistory (void);
81 static void NormalizeUrl_Impl (INetURLObject
&rUrl
);
83 void PutUrl_Impl (const INetURLObject
&rUrl
);
84 BOOL
QueryUrl_Impl (const INetURLObject
&rUrl
);
88 INetURLHistory (const INetURLHistory
&);
89 INetURLHistory
& operator= (const INetURLHistory
&);
94 static INetURLHistory
* GetOrCreate (void);
98 BOOL
QueryProtocol (INetProtocol eProto
) const
100 return ((eProto
== INET_PROT_FILE
) ||
101 (eProto
== INET_PROT_FTP
) ||
102 (eProto
== INET_PROT_HTTP
) ||
103 (eProto
== INET_PROT_HTTPS
) );
108 BOOL
QueryUrl (const INetURLObject
&rUrl
)
110 if (QueryProtocol (rUrl
.GetProtocol()))
111 return QueryUrl_Impl (rUrl
);
116 BOOL
QueryUrl (const String
&rUrl
)
118 INetProtocol eProto
=
119 INetURLObject::CompareProtocolScheme (rUrl
);
120 if (QueryProtocol (eProto
))
121 return QueryUrl_Impl (INetURLObject (rUrl
));
128 void PutUrl (const INetURLObject
&rUrl
)
130 if (QueryProtocol (rUrl
.GetProtocol()))
134 void PutUrl (const String
&rUrl
)
136 INetProtocol eProto
=
137 INetURLObject::CompareProtocolScheme (rUrl
);
138 if (QueryProtocol (eProto
))
139 PutUrl_Impl (INetURLObject (rUrl
));
143 /*========================================================================
145 * INetURLHistoryHint (broadcasted from PutUrl()).
147 *=======================================================================*/
148 DECL_PTRHINT (, INetURLHistoryHint
, const INetURLObject
);
152 #endif /* _INETHIST_HXX */