2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-21 14:30:25 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2013-10-23 19:14:56 +02:00
|
|
|
#ifndef INCLUDED_SVL_INETHIST_HXX
|
|
|
|
#define INCLUDED_SVL_INETHIST_HXX
|
2007-04-11 18:23:15 +00:00
|
|
|
|
2014-07-16 21:22:34 +02:00
|
|
|
#include <svl/SfxBroadcaster.hxx>
|
2009-10-08 16:59:48 +02:00
|
|
|
#include <svl/hint.hxx>
|
2014-01-29 21:56:01 -02:00
|
|
|
#include <svl/svldllapi.h>
|
|
|
|
#include <tools/urlobj.hxx>
|
2007-04-11 18:23:15 +00:00
|
|
|
|
|
|
|
class INetURLHistory_Impl;
|
2014-07-02 16:01:51 +02:00
|
|
|
class SVL_DLLPUBLIC INetURLHistory : public SfxBroadcaster
|
2007-04-11 18:23:15 +00:00
|
|
|
{
|
2014-07-02 16:01:51 +02:00
|
|
|
struct SAL_DLLPRIVATE StaticInstance
|
2007-04-11 18:23:15 +00:00
|
|
|
{
|
|
|
|
INetURLHistory * operator()();
|
|
|
|
};
|
|
|
|
friend INetURLHistory * StaticInstance::operator()();
|
|
|
|
|
|
|
|
/** Representation.
|
|
|
|
*/
|
|
|
|
INetURLHistory_Impl *m_pImpl;
|
|
|
|
|
|
|
|
/** Construction/Destruction.
|
|
|
|
*/
|
2015-04-14 12:44:47 +02:00
|
|
|
SAL_DLLPRIVATE INetURLHistory();
|
|
|
|
SAL_DLLPRIVATE virtual ~INetURLHistory();
|
2007-04-11 18:23:15 +00:00
|
|
|
|
|
|
|
/** Implementation.
|
|
|
|
*/
|
2014-07-02 16:01:51 +02:00
|
|
|
SAL_DLLPRIVATE static void NormalizeUrl_Impl (INetURLObject &rUrl);
|
2007-04-11 18:23:15 +00:00
|
|
|
|
2014-07-02 16:01:51 +02:00
|
|
|
void PutUrl_Impl (const INetURLObject &rUrl);
|
|
|
|
bool QueryUrl_Impl (const INetURLObject &rUrl);
|
2007-04-11 18:23:15 +00:00
|
|
|
|
|
|
|
/** Not implemented.
|
|
|
|
*/
|
2015-02-07 12:30:34 +01:00
|
|
|
INetURLHistory (const INetURLHistory&) SAL_DELETED_FUNCTION;
|
|
|
|
INetURLHistory& operator= (const INetURLHistory&) SAL_DELETED_FUNCTION;
|
2007-04-11 18:23:15 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** GetOrCreate.
|
|
|
|
*/
|
2015-04-14 12:44:47 +02:00
|
|
|
static INetURLHistory* GetOrCreate();
|
2007-04-11 18:23:15 +00:00
|
|
|
|
|
|
|
/** QueryProtocol.
|
|
|
|
*/
|
2014-02-19 21:49:02 +01:00
|
|
|
bool QueryProtocol (INetProtocol eProto) const
|
2007-04-11 18:23:15 +00:00
|
|
|
{
|
2015-04-02 18:32:36 +02:00
|
|
|
return ((eProto == INetProtocol::File ) ||
|
|
|
|
(eProto == INetProtocol::Ftp ) ||
|
|
|
|
(eProto == INetProtocol::Http ) ||
|
|
|
|
(eProto == INetProtocol::Https) );
|
2007-04-11 18:23:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** QueryUrl.
|
|
|
|
*/
|
2014-02-19 21:49:02 +01:00
|
|
|
bool QueryUrl (const INetURLObject &rUrl)
|
2007-04-11 18:23:15 +00:00
|
|
|
{
|
|
|
|
if (QueryProtocol (rUrl.GetProtocol()))
|
|
|
|
return QueryUrl_Impl (rUrl);
|
|
|
|
else
|
2014-02-19 21:49:02 +01:00
|
|
|
return false;
|
2007-04-11 18:23:15 +00:00
|
|
|
}
|
|
|
|
|
2014-02-19 21:49:02 +01:00
|
|
|
bool QueryUrl (const OUString &rUrl)
|
2007-04-11 18:23:15 +00:00
|
|
|
{
|
|
|
|
INetProtocol eProto =
|
|
|
|
INetURLObject::CompareProtocolScheme (rUrl);
|
|
|
|
if (QueryProtocol (eProto))
|
|
|
|
return QueryUrl_Impl (INetURLObject (rUrl));
|
|
|
|
else
|
2014-02-19 21:49:02 +01:00
|
|
|
return false;
|
2007-04-11 18:23:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** PutUrl.
|
|
|
|
*/
|
|
|
|
void PutUrl (const INetURLObject &rUrl)
|
|
|
|
{
|
|
|
|
if (QueryProtocol (rUrl.GetProtocol()))
|
|
|
|
PutUrl_Impl (rUrl);
|
|
|
|
}
|
|
|
|
|
2013-07-05 16:25:03 -05:00
|
|
|
void PutUrl (const OUString &rUrl)
|
2007-04-11 18:23:15 +00:00
|
|
|
{
|
|
|
|
INetProtocol eProto =
|
|
|
|
INetURLObject::CompareProtocolScheme (rUrl);
|
|
|
|
if (QueryProtocol (eProto))
|
|
|
|
PutUrl_Impl (INetURLObject (rUrl));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-01-29 21:56:01 -02:00
|
|
|
// broadcasted from PutUrl().
|
2015-04-25 21:07:12 +02:00
|
|
|
class SVL_DLLPUBLIC INetURLHistoryHint: public SfxHint
|
|
|
|
{
|
|
|
|
const INetURLObject* pObj;
|
|
|
|
public:
|
|
|
|
explicit INetURLHistoryHint( const INetURLObject* Object ) : pObj(Object) {}
|
|
|
|
virtual ~INetURLHistoryHint() {}
|
|
|
|
const INetURLObject* GetObject() const { return pObj; }
|
|
|
|
};
|
2007-04-11 18:23:15 +00:00
|
|
|
|
2013-10-23 19:14:56 +02:00
|
|
|
#endif // INCLUDED_SVL_INETHIST_HXX
|
2007-04-11 18:23:15 +00:00
|
|
|
|
2010-10-14 08:27:31 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|