2010-10-27 07:11:31 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-10-16 08:56:13 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 08:39:12 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-10-16 08:56:13 -05:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-10-16 08:56:13 -05:00
|
|
|
*
|
2008-04-10 08:39:12 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-10-16 08:56:13 -05:00
|
|
|
*
|
2008-04-10 08:39:12 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-10-16 08:56:13 -05:00
|
|
|
*
|
2008-04-10 08:39:12 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-10-16 08:56:13 -05:00
|
|
|
*
|
2008-04-10 08:39:12 -05:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-10-16 08:56:13 -05:00
|
|
|
*
|
2008-04-10 08:39:12 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-10-16 08:56:13 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _UCB_HXX
|
|
|
|
#define _UCB_HXX
|
|
|
|
|
2001-02-02 01:21:39 -06:00
|
|
|
#include <com/sun/star/ucb/XCommandProcessor.hpp>
|
2000-10-16 08:56:13 -05:00
|
|
|
#include <com/sun/star/ucb/XContentProvider.hpp>
|
|
|
|
#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
|
|
|
|
#include <com/sun/star/ucb/XContentProviderManager.hpp>
|
|
|
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
|
|
|
#include <com/sun/star/lang/XComponent.hpp>
|
|
|
|
#include <com/sun/star/lang/XInitialization.hpp>
|
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
|
|
|
#include <com/sun/star/lang/XTypeProvider.hpp>
|
2009-12-18 01:24:03 -06:00
|
|
|
#include <com/sun/star/util/XChangesListener.hpp>
|
|
|
|
#include <com/sun/star/util/XChangesNotifier.hpp>
|
|
|
|
#include <com/sun/star/container/XContainer.hpp>
|
|
|
|
|
2000-10-16 08:56:13 -05:00
|
|
|
#include <rtl/ustrbuf.hxx>
|
|
|
|
#include <cppuhelper/weak.hxx>
|
|
|
|
#include <osl/mutex.hxx>
|
|
|
|
#include <osl/interlck.h>
|
|
|
|
#include <ucbhelper/macros.hxx>
|
|
|
|
#include "providermap.hxx"
|
2009-12-18 01:24:03 -06:00
|
|
|
#include <ucbhelper/registerucb.hxx>
|
2000-10-16 08:56:13 -05:00
|
|
|
|
2009-12-18 01:24:03 -06:00
|
|
|
#include <vector>
|
2000-10-16 08:56:13 -05:00
|
|
|
//=========================================================================
|
|
|
|
|
|
|
|
#define UCB_SERVICE_NAME "com.sun.star.ucb.UniversalContentBroker"
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
|
|
|
namespace cppu { class OInterfaceContainerHelper; }
|
|
|
|
|
2001-02-02 01:21:39 -06:00
|
|
|
namespace com { namespace sun { namespace star { namespace ucb {
|
|
|
|
class XCommandInfo;
|
|
|
|
struct GlobalTransferCommandArgument;
|
|
|
|
} } } }
|
|
|
|
|
2000-10-16 08:56:13 -05:00
|
|
|
class UniversalContentBroker :
|
|
|
|
public cppu::OWeakObject,
|
|
|
|
public com::sun::star::lang::XTypeProvider,
|
|
|
|
public com::sun::star::lang::XComponent,
|
|
|
|
public com::sun::star::lang::XServiceInfo,
|
|
|
|
public com::sun::star::lang::XInitialization,
|
|
|
|
public com::sun::star::ucb::XContentProviderManager,
|
|
|
|
public com::sun::star::ucb::XContentProvider,
|
|
|
|
public com::sun::star::ucb::XContentIdentifierFactory,
|
2009-12-18 01:24:03 -06:00
|
|
|
public com::sun::star::ucb::XCommandProcessor,
|
|
|
|
public com::sun::star::util::XChangesListener
|
2000-10-16 08:56:13 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
UniversalContentBroker( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
|
|
|
|
virtual ~UniversalContentBroker();
|
|
|
|
|
|
|
|
// XInterface
|
|
|
|
XINTERFACE_DECL()
|
|
|
|
|
|
|
|
// XTypeProvider
|
|
|
|
XTYPEPROVIDER_DECL()
|
|
|
|
|
|
|
|
// XServiceInfo
|
|
|
|
XSERVICEINFO_DECL()
|
|
|
|
|
|
|
|
// XComponent
|
2001-02-02 01:21:39 -06:00
|
|
|
virtual void SAL_CALL
|
|
|
|
dispose()
|
2000-10-16 08:56:13 -05:00
|
|
|
throw( com::sun::star::uno::RuntimeException );
|
2001-02-02 01:21:39 -06:00
|
|
|
virtual void SAL_CALL
|
|
|
|
addEventListener( const com::sun::star::uno::Reference<
|
|
|
|
com::sun::star::lang::XEventListener >& Listener )
|
2000-10-16 08:56:13 -05:00
|
|
|
throw( com::sun::star::uno::RuntimeException );
|
2001-02-02 01:21:39 -06:00
|
|
|
virtual void SAL_CALL
|
|
|
|
removeEventListener( const com::sun::star::uno::Reference<
|
|
|
|
com::sun::star::lang::XEventListener >& Listener )
|
2000-10-16 08:56:13 -05:00
|
|
|
throw( com::sun::star::uno::RuntimeException );
|
|
|
|
|
|
|
|
// XInitialization
|
2001-02-02 01:21:39 -06:00
|
|
|
virtual void SAL_CALL
|
|
|
|
initialize( const com::sun::star::uno::Sequence<
|
|
|
|
com::sun::star::uno::Any >& aArguments )
|
|
|
|
throw( com::sun::star::uno::Exception,
|
|
|
|
com::sun::star::uno::RuntimeException );
|
2000-10-16 08:56:13 -05:00
|
|
|
|
|
|
|
// XContentProviderManager
|
2001-02-02 01:21:39 -06:00
|
|
|
virtual com::sun::star::uno::Reference<
|
|
|
|
com::sun::star::ucb::XContentProvider > SAL_CALL
|
|
|
|
registerContentProvider( const com::sun::star::uno::Reference<
|
|
|
|
com::sun::star::ucb::XContentProvider >&
|
|
|
|
Provider,
|
|
|
|
const rtl::OUString& Scheme,
|
|
|
|
sal_Bool ReplaceExisting )
|
|
|
|
throw( com::sun::star::ucb::DuplicateProviderException,
|
|
|
|
com::sun::star::uno::RuntimeException );
|
|
|
|
virtual void SAL_CALL
|
|
|
|
deregisterContentProvider( const com::sun::star::uno::Reference<
|
|
|
|
com::sun::star::ucb::XContentProvider >&
|
|
|
|
Provider,
|
|
|
|
const rtl::OUString& Scheme )
|
2000-10-16 08:56:13 -05:00
|
|
|
throw( com::sun::star::uno::RuntimeException );
|
2001-02-02 01:21:39 -06:00
|
|
|
virtual com::sun::star::uno::Sequence<
|
|
|
|
com::sun::star::ucb::ContentProviderInfo > SAL_CALL
|
|
|
|
queryContentProviders()
|
2000-10-16 08:56:13 -05:00
|
|
|
throw( com::sun::star::uno::RuntimeException );
|
2001-02-02 01:21:39 -06:00
|
|
|
virtual com::sun::star::uno::Reference<
|
|
|
|
com::sun::star::ucb::XContentProvider > SAL_CALL
|
2001-11-28 02:43:55 -06:00
|
|
|
queryContentProvider( const rtl::OUString& Identifier )
|
2000-10-16 08:56:13 -05:00
|
|
|
throw( com::sun::star::uno::RuntimeException );
|
|
|
|
|
|
|
|
// XContentProvider
|
2001-02-02 01:21:39 -06:00
|
|
|
virtual com::sun::star::uno::Reference<
|
|
|
|
com::sun::star::ucb::XContent > SAL_CALL
|
|
|
|
queryContent( const com::sun::star::uno::Reference<
|
|
|
|
com::sun::star::ucb::XContentIdentifier >& Identifier )
|
|
|
|
throw( com::sun::star::ucb::IllegalIdentifierException,
|
|
|
|
com::sun::star::uno::RuntimeException );
|
|
|
|
virtual sal_Int32 SAL_CALL
|
|
|
|
compareContentIds( const com::sun::star::uno::Reference<
|
|
|
|
com::sun::star::ucb::XContentIdentifier >& Id1,
|
|
|
|
const com::sun::star::uno::Reference<
|
|
|
|
com::sun::star::ucb::XContentIdentifier >& Id2 )
|
2000-10-16 08:56:13 -05:00
|
|
|
throw( com::sun::star::uno::RuntimeException );
|
|
|
|
|
|
|
|
// XContentIdentifierFactory
|
2001-02-02 01:21:39 -06:00
|
|
|
virtual com::sun::star::uno::Reference<
|
|
|
|
com::sun::star::ucb::XContentIdentifier > SAL_CALL
|
|
|
|
createContentIdentifier( const rtl::OUString& ContentId )
|
2000-10-16 08:56:13 -05:00
|
|
|
throw( com::sun::star::uno::RuntimeException );
|
|
|
|
|
2001-02-02 01:21:39 -06:00
|
|
|
// XCommandProcessor
|
|
|
|
virtual sal_Int32 SAL_CALL
|
|
|
|
createCommandIdentifier()
|
2000-10-16 08:56:13 -05:00
|
|
|
throw( com::sun::star::uno::RuntimeException );
|
2001-02-02 01:21:39 -06:00
|
|
|
virtual com::sun::star::uno::Any SAL_CALL
|
|
|
|
execute( const com::sun::star::ucb::Command& aCommand,
|
|
|
|
sal_Int32 CommandId,
|
|
|
|
const com::sun::star::uno::Reference<
|
|
|
|
com::sun::star::ucb::XCommandEnvironment >& Environment )
|
|
|
|
throw( com::sun::star::uno::Exception,
|
|
|
|
com::sun::star::ucb::CommandAbortedException,
|
|
|
|
com::sun::star::uno::RuntimeException );
|
|
|
|
virtual void SAL_CALL
|
|
|
|
abort( sal_Int32 CommandId )
|
2000-10-16 08:56:13 -05:00
|
|
|
throw( com::sun::star::uno::RuntimeException );
|
|
|
|
|
2009-12-18 01:24:03 -06:00
|
|
|
// XChangesListener
|
|
|
|
virtual void SAL_CALL changesOccurred( const com::sun::star::util::ChangesEvent& Event )
|
|
|
|
throw( com::sun::star::uno::RuntimeException );
|
|
|
|
|
|
|
|
// XEventListener ( base of XChangesLisetenr )
|
|
|
|
virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source )
|
|
|
|
throw( com::sun::star::uno::RuntimeException );
|
|
|
|
|
2000-10-16 08:56:13 -05:00
|
|
|
private:
|
|
|
|
com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider >
|
2001-11-28 02:43:55 -06:00
|
|
|
queryContentProvider( const rtl::OUString& Identifier,
|
|
|
|
sal_Bool bResolved );
|
2000-10-16 08:56:13 -05:00
|
|
|
|
2001-02-02 01:21:39 -06:00
|
|
|
com::sun::star::uno::Reference< com::sun::star::ucb::XCommandInfo >
|
|
|
|
getCommandInfo();
|
|
|
|
|
|
|
|
void
|
|
|
|
globalTransfer(
|
|
|
|
const com::sun::star::ucb::GlobalTransferCommandArgument & rArg,
|
|
|
|
const com::sun::star::uno::Reference<
|
|
|
|
com::sun::star::ucb::XCommandEnvironment >& xEnv )
|
|
|
|
throw( com::sun::star::uno::Exception );
|
|
|
|
|
2009-12-18 01:24:03 -06:00
|
|
|
|
|
|
|
bool configureUcb()
|
|
|
|
throw ( com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
bool getContentProviderData(
|
|
|
|
const rtl::OUString & rKey1,
|
|
|
|
const rtl::OUString & rKey2,
|
|
|
|
ucbhelper::ContentProviderDataList & rListToFill);
|
|
|
|
|
|
|
|
void prepareAndRegister( const ucbhelper::ContentProviderDataList& rData);
|
|
|
|
|
2001-02-02 01:21:39 -06:00
|
|
|
com::sun::star::uno::Reference<
|
|
|
|
com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
|
2009-12-18 01:24:03 -06:00
|
|
|
|
|
|
|
com::sun::star::uno::Reference<
|
|
|
|
com::sun::star::util::XChangesNotifier > m_xNotifier;
|
|
|
|
|
|
|
|
com::sun::star::uno::Sequence< com::sun::star::uno::Any > m_aArguments;
|
2000-10-16 08:56:13 -05:00
|
|
|
ProviderMap_Impl m_aProviders;
|
|
|
|
osl::Mutex m_aMutex;
|
|
|
|
cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
|
|
|
|
oslInterlockedCount m_nInitCount; //@@@ see initialize() method
|
2001-02-02 01:21:39 -06:00
|
|
|
sal_Int32 m_nCommandId;
|
2000-10-16 08:56:13 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* !_UCB_HXX */
|
2010-10-27 07:11:31 -05:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|