2000-11-07 07:40:31 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 05:52:29 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-11-07 07:40:31 -06:00
|
|
|
*
|
2008-04-11 05:52:29 -05:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2000-11-07 07:40:31 -06:00
|
|
|
*
|
2008-04-11 05:52:29 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-11-07 07:40:31 -06:00
|
|
|
*
|
2008-04-11 05:52:29 -05:00
|
|
|
* $RCSfile: apitreeimplobj.hxx,v $
|
|
|
|
* $Revision: 1.27 $
|
2000-11-07 07:40:31 -06:00
|
|
|
*
|
2008-04-11 05:52:29 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-11-07 07:40:31 -06:00
|
|
|
*
|
2008-04-11 05:52:29 -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-11-07 07:40:31 -06:00
|
|
|
*
|
2008-04-11 05:52:29 -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-11-07 07:40:31 -06:00
|
|
|
*
|
2008-04-11 05:52:29 -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-11-07 07:40:31 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef CONFIGMGR_API_TREEIMPLOBJECTS_HXX_
|
|
|
|
#define CONFIGMGR_API_TREEIMPLOBJECTS_HXX_
|
|
|
|
|
|
|
|
#include "noderef.hxx"
|
|
|
|
#include "configset.hxx"
|
2001-09-28 06:44:40 -05:00
|
|
|
#include "configdefaultprovider.hxx"
|
2000-11-10 05:22:55 -06:00
|
|
|
#include "confevents.hxx"
|
2001-07-16 02:15:45 -05:00
|
|
|
#include "options.hxx"
|
2003-03-19 09:20:19 -06:00
|
|
|
#include "utility.hxx"
|
2000-11-07 07:40:31 -06:00
|
|
|
#include <vos/ref.hxx>
|
2003-03-19 09:20:19 -06:00
|
|
|
#include <rtl/ref.hxx>
|
2001-09-28 06:44:40 -05:00
|
|
|
#include <osl/mutex.hxx>
|
|
|
|
|
|
|
|
#ifndef INCLUDED_MEMORY
|
2001-02-13 10:16:59 -06:00
|
|
|
#include <memory>
|
2001-09-28 06:44:40 -05:00
|
|
|
#define INCLUDED_MEMORY
|
|
|
|
#endif
|
2000-11-07 07:40:31 -06:00
|
|
|
#include <com/sun/star/lang/XEventListener.hpp>
|
|
|
|
#include <com/sun/star/lang/XComponent.hpp>
|
|
|
|
|
2000-11-10 10:29:04 -06:00
|
|
|
namespace com { namespace sun { namespace star {
|
|
|
|
namespace script { class XTypeConverter; }
|
|
|
|
} } }
|
|
|
|
|
2000-11-07 07:40:31 -06:00
|
|
|
namespace configmgr
|
|
|
|
{
|
|
|
|
//-----------------------------------------------------------------------------
|
2000-11-10 15:45:40 -06:00
|
|
|
class OProviderImpl;
|
2000-11-07 07:40:31 -06:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
namespace configapi
|
|
|
|
{
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class Factory;
|
|
|
|
class Notifier;
|
|
|
|
class NotifierImpl;
|
|
|
|
typedef vos::ORef<NotifierImpl> NotifierImplHolder;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class ObjectRegistry;
|
2003-03-19 09:20:19 -06:00
|
|
|
typedef rtl::Reference<ObjectRegistry> ObjectRegistryHolder;
|
2000-11-07 07:40:31 -06:00
|
|
|
|
2000-11-10 05:22:55 -06:00
|
|
|
typedef uno::XInterface UnoInterface;
|
|
|
|
typedef uno::Reference<UnoInterface> UnoInterfaceRef;
|
2000-11-10 10:29:04 -06:00
|
|
|
typedef uno::Reference<com::sun::star::script::XTypeConverter> UnoTypeConverter;
|
2000-11-07 07:40:31 -06:00
|
|
|
|
2003-03-19 09:20:19 -06:00
|
|
|
typedef vos::ORef< OOptions > TreeOptions;
|
2000-11-07 07:40:31 -06:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// API object implementation wrappers
|
|
|
|
//-------------------------------------------------------------------------
|
2003-03-19 09:20:19 -06:00
|
|
|
class ApiProvider : Noncopyable
|
2000-11-07 07:40:31 -06:00
|
|
|
{
|
|
|
|
Factory& m_rFactory;
|
2000-11-10 15:45:40 -06:00
|
|
|
OProviderImpl& m_rProviderImpl;
|
2000-11-07 07:40:31 -06:00
|
|
|
public:
|
2000-11-19 18:38:19 -06:00
|
|
|
ApiProvider(Factory& rFactory, OProviderImpl& rProviderImpl );
|
|
|
|
|
2000-11-07 07:40:31 -06:00
|
|
|
~ApiProvider()
|
|
|
|
{}
|
|
|
|
|
2000-11-10 10:29:04 -06:00
|
|
|
UnoTypeConverter getTypeConverter() const;
|
2000-11-07 07:40:31 -06:00
|
|
|
Factory& getFactory() { return m_rFactory; }
|
2000-11-10 15:45:40 -06:00
|
|
|
OProviderImpl& getProviderImpl() { return m_rProviderImpl; }
|
2000-11-07 07:40:31 -06:00
|
|
|
};
|
|
|
|
|
2001-02-27 08:47:31 -06:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2000-11-07 07:40:31 -06:00
|
|
|
//-------------------------------------------------------------------------
|
2003-03-19 09:20:19 -06:00
|
|
|
class ApiTreeImpl : Noncopyable
|
2000-11-07 07:40:31 -06:00
|
|
|
{
|
2001-02-27 08:47:31 -06:00
|
|
|
class ComponentAdapter;
|
|
|
|
typedef uno::Reference<ComponentAdapter> ComponentRef;
|
|
|
|
typedef uno::Reference<com::sun::star::lang::XComponent> UnoComponent;
|
|
|
|
|
2002-02-11 06:47:56 -06:00
|
|
|
typedef configuration::TreeRef TreeRef;
|
2001-09-28 06:44:40 -05:00
|
|
|
typedef configuration::DefaultProvider DefaultProvider;
|
2001-04-19 09:20:07 -05:00
|
|
|
|
2002-02-11 06:47:56 -06:00
|
|
|
TreeRef m_aTree;
|
2000-11-07 07:40:31 -06:00
|
|
|
NotifierImplHolder m_aNotifier;
|
2001-09-28 06:44:40 -05:00
|
|
|
DefaultProvider m_aDefaultProvider;
|
2000-11-10 05:22:55 -06:00
|
|
|
ComponentRef m_xProvider;
|
2000-11-07 07:40:31 -06:00
|
|
|
ApiProvider& m_rProvider;
|
|
|
|
ApiTreeImpl* m_pParentTree;
|
2000-11-10 05:22:55 -06:00
|
|
|
UnoInterface* m_pInstance;
|
2000-11-30 01:40:48 -06:00
|
|
|
|
2000-11-07 07:40:31 -06:00
|
|
|
public:
|
2002-02-11 06:47:56 -06:00
|
|
|
explicit ApiTreeImpl(UnoInterface* pInstance, configuration::TreeRef const& aTree, ApiTreeImpl& rParentTree);
|
|
|
|
explicit ApiTreeImpl(UnoInterface* pInstance, ApiProvider& rProvider, configuration::TreeRef const& aTree, ApiTreeImpl* pParentTree);
|
|
|
|
explicit ApiTreeImpl(UnoInterface* _pInstance, ApiProvider& _rProvider, configuration::TreeRef const& _aTree, DefaultProvider const & _aDefaultProvider);
|
2000-11-07 07:40:31 -06:00
|
|
|
~ApiTreeImpl();
|
|
|
|
|
2000-11-13 07:38:58 -06:00
|
|
|
// initialization
|
|
|
|
void setNodeInstance(configuration::NodeRef const& aNode, UnoInterface* pInstance);
|
|
|
|
|
2000-11-07 07:40:31 -06:00
|
|
|
// model access
|
2002-02-11 06:47:56 -06:00
|
|
|
TreeRef getTree() const { return m_aTree; }
|
2000-11-07 07:40:31 -06:00
|
|
|
|
|
|
|
// self-locked methods for dispose handling
|
2000-12-03 04:58:37 -06:00
|
|
|
bool isAlive() const;
|
2000-11-07 07:40:31 -06:00
|
|
|
void checkAlive() const;
|
|
|
|
bool disposeTree(bool bForce);
|
2000-12-06 05:14:34 -06:00
|
|
|
bool disposeTreeNow();
|
2000-11-07 07:40:31 -06:00
|
|
|
void disposeNode(configuration::NodeRef const& aNode, UnoInterface* pInstance);
|
|
|
|
|
|
|
|
// api object handling
|
|
|
|
Factory& getFactory() const { return m_rProvider.getFactory(); }
|
|
|
|
Notifier getNotifier() const;
|
2001-09-28 06:44:40 -05:00
|
|
|
DefaultProvider getDefaultProvider() const { return m_aDefaultProvider; }
|
2000-11-07 07:40:31 -06:00
|
|
|
|
2000-11-16 11:15:43 -06:00
|
|
|
// needs external locking
|
|
|
|
ApiTreeImpl const* getRootTreeImpl() const;
|
|
|
|
|
2000-11-07 07:40:31 -06:00
|
|
|
uno::XInterface* getUnoInstance() const { return m_pInstance; }
|
|
|
|
ApiProvider& getProvider() { return m_rProvider; }
|
2001-02-27 08:47:31 -06:00
|
|
|
UnoInterfaceRef getUnoProviderInstance() const; // { return m_xProvider; }
|
2001-04-19 09:20:07 -05:00
|
|
|
|
2000-11-10 05:22:55 -06:00
|
|
|
/// wire this to a new parent tree
|
|
|
|
void haveNewParent(ApiTreeImpl* pNewParent);
|
2000-11-07 07:40:31 -06:00
|
|
|
private:
|
|
|
|
void init(ApiTreeImpl* pParentTree);
|
|
|
|
void setParentTree(ApiTreeImpl* pNewParentTree);
|
|
|
|
void deinit();
|
|
|
|
|
2007-11-23 07:04:44 -06:00
|
|
|
bool implDisposeTree();
|
|
|
|
void implDisposeNode(configuration::NodeRef const& aNode, UnoInterface* pInstance);
|
2000-11-10 05:22:55 -06:00
|
|
|
|
2001-02-27 08:47:31 -06:00
|
|
|
friend class ComponentAdapter;
|
|
|
|
void disposing(com::sun::star::lang::EventObject const& rEvt) throw();
|
|
|
|
UnoComponent getProviderComponent();
|
|
|
|
UnoComponent getParentComponent();
|
2000-11-07 07:40:31 -06:00
|
|
|
|
2001-04-19 09:20:07 -05:00
|
|
|
};
|
2000-11-10 05:22:55 -06:00
|
|
|
|
2000-11-10 10:29:04 -06:00
|
|
|
//-----------------------------------------------------------------------------
|
2000-12-08 04:19:25 -06:00
|
|
|
class ApiRootTreeImpl
|
2000-11-10 10:29:04 -06:00
|
|
|
{
|
2001-07-05 11:05:51 -05:00
|
|
|
typedef configuration::AbsolutePath AbsolutePath;
|
2001-09-28 06:44:40 -05:00
|
|
|
typedef configuration::DefaultProvider DefaultProvider;
|
2000-11-30 01:40:48 -06:00
|
|
|
|
2000-11-10 10:29:04 -06:00
|
|
|
public:
|
2003-03-19 09:20:19 -06:00
|
|
|
explicit ApiRootTreeImpl(UnoInterface* pInstance, ApiProvider& rProvider, configuration::Tree const& aTree, TreeOptions const& _xOptions);
|
2000-11-10 10:29:04 -06:00
|
|
|
~ApiRootTreeImpl();
|
|
|
|
|
|
|
|
ApiTreeImpl& getApiTree() { return m_aTreeImpl; }
|
|
|
|
ApiTreeImpl const& getApiTree() const { return m_aTreeImpl; }
|
2000-11-30 01:40:48 -06:00
|
|
|
|
2002-02-11 06:47:56 -06:00
|
|
|
AbsolutePath const & getLocation() const { return m_aLocationPath; }
|
2003-03-19 09:20:19 -06:00
|
|
|
TreeOptions getOptions() const { return m_xOptions; }
|
2000-11-10 10:29:04 -06:00
|
|
|
|
|
|
|
// self-locked methods for dispose handling
|
|
|
|
bool disposeTree();
|
|
|
|
|
|
|
|
/// toggle whether this object relays notifications from the base provider
|
2001-09-28 06:44:40 -05:00
|
|
|
bool enableNotification(bool bEnable);
|
2000-11-10 10:29:04 -06:00
|
|
|
private:
|
|
|
|
IConfigBroadcaster* implSetNotificationSource(IConfigBroadcaster* pNew);
|
2002-02-11 06:47:56 -06:00
|
|
|
void implSetLocation(configuration::Tree const& _aTree);
|
2000-12-04 02:11:39 -06:00
|
|
|
void releaseData();
|
2000-11-10 10:29:04 -06:00
|
|
|
|
|
|
|
private:
|
2000-12-08 04:19:25 -06:00
|
|
|
class NodeListener;
|
|
|
|
friend class NodeListener;
|
|
|
|
//IConfigBroadcaster* m_pNotificationSource;
|
|
|
|
|
2000-11-10 05:22:55 -06:00
|
|
|
// IConfigListener
|
2000-12-08 04:19:25 -06:00
|
|
|
void disposing(IConfigBroadcaster* pSource) ;
|
2000-11-10 05:22:55 -06:00
|
|
|
//INodeListener : IConfigListener
|
2007-11-23 07:04:44 -06:00
|
|
|
void nodeChanged(Change const& aChange, AbsolutePath const& aPath, IConfigBroadcaster* pSource);
|
|
|
|
void nodeDeleted(AbsolutePath const& aPath, IConfigBroadcaster* pSource);
|
2000-11-10 10:29:04 -06:00
|
|
|
|
2000-11-10 05:22:55 -06:00
|
|
|
private:
|
2001-07-05 11:05:51 -05:00
|
|
|
ApiTreeImpl m_aTreeImpl;
|
|
|
|
AbsolutePath m_aLocationPath;
|
2003-03-19 09:20:19 -06:00
|
|
|
rtl::Reference<NodeListener> m_pNotificationListener;
|
2004-03-23 03:21:40 -06:00
|
|
|
TreeOptions m_xOptions;
|
2000-11-07 07:40:31 -06:00
|
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // CONFIGMGR_API_TREEIMPLOBJECTS_HXX_
|