INTEGRATION: CWS presenterview (1.2.22); FILE MERGED

2007/07/10 14:29:14 af 1.2.22.2: #i18486# Typos.
2007/06/19 08:14:07 af 1.2.22.1: #i18486# Added code for instantiating services at framework startup.
This commit is contained in:
Kurt Zenker
2008-04-03 13:03:19 +00:00
parent 218d25133b
commit a69788495e

View File

@@ -5,9 +5,9 @@
*
* $RCSfile: ModuleController.hxx,v $
*
* $Revision: 1.2 $
* $Revision: 1.3 $
*
* last change: $Author: rt $ $Date: 2007-04-03 16:11:35 $
* last change: $Author: kz $ $Date: 2008-04-03 14:03:19 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -39,34 +39,23 @@
#include "MutexOwner.hxx"
#ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx>
#endif
#ifndef _COM_SUN_STAR_DRAWING_FRAMEWORK_XMODULECONTROLLER_HPP_
#include <com/sun/star/drawing/framework/XModuleController.hpp>
#endif
#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_
#include <com/sun/star/uno/XComponentContext.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
#include <com/sun/star/lang/XInitialization.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_
#include <com/sun/star/frame/XController.hpp>
#endif
#ifndef _CPPUHELPER_COMPBASE2_HXX_
#include <cppuhelper/compbase2.hxx>
#endif
#include <boost/scoped_ptr.hpp>
#include <set>
namespace css = ::com::sun::star;
namespace {
typedef ::cppu::WeakComponentImplHelper2 <
::com::sun::star::drawing::framework::XModuleController,
::com::sun::star::lang::XInitialization
css::drawing::framework::XModuleController,
css::lang::XInitialization
> ModuleControllerInterfaceBase;
} // end of anonymous namespace.
@@ -75,28 +64,33 @@ typedef ::cppu::WeakComponentImplHelper2 <
namespace sd { namespace framework {
/** At the moment the ModuleController reads the
/** The ModuleController has to tasks:
1. It reads the
org.openoffice.Office.Impress/MultiPaneGUI/Framework/ResourceFactories
configuration data that maps from resource URLs to service names of
factories that can create resources for the URLs. When a resource
controller, for example the PaneController, wants to create a pane for
which it does not have a factory, it asks the ModuleController to
provide one. The ModuleController looks up the service name registere
for the resource URL, in this case a pane URL and instantiates the
service. The service is expected to register on its creation a factory
for the resource in question.
factories that can create resources for the URLs. When the
configuration controller wants to create a resource for which it does
not have a factory, it asks the ModuleController to provide one. The
ModuleController looks up the service name registered for the URL of the
resource and instantiates this service. The service is expected to
register on its creation a factory for the resource in question.
This simple concept may be extended in the future.
2. The ModuleController reads on its creation
org.openoffice.Office.Impress/MultiPaneGUI/Framework/StartupServices
configuration data and instantiates all listed services. These servces
can then register as listeners at the ConfigurationController or do
whatever they like.
*/
class ModuleController
: private sd::MutexOwner,
public ModuleControllerInterfaceBase
{
public:
static ::com::sun::star::uno::Reference<
::com::sun::star::drawing::framework::XModuleController>
static css::uno::Reference<
css::drawing::framework::XModuleController>
CreateInstance (
const ::com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>&
const css::uno::Reference<css::uno::XComponentContext>&
rxContext);
virtual void SAL_CALL disposing (void);
@@ -105,18 +99,18 @@ public:
// XModuleController
virtual void SAL_CALL requestResource(const ::rtl::OUString& rsResourceURL)
throw (::com::sun::star::uno::RuntimeException);
throw (css::uno::RuntimeException);
// XInitialization
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);
const css::uno::Sequence<css::uno::Any>& aArguments)
throw (css::uno::Exception, css::uno::RuntimeException);
private:
::com::sun::star::uno::Reference<
com::sun::star::frame::XController> mxController;
css::uno::Reference<
css::frame::XController> mxController;
class ResourceToFactoryMap;
::boost::scoped_ptr<ResourceToFactoryMap> mpResourceToFactoryMap;
@@ -124,13 +118,38 @@ private:
::boost::scoped_ptr<LoadedFactoryContainer> mpLoadedFactories;
ModuleController (
const ::com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& rxContext)
const css::uno::Reference<css::uno::XComponentContext>& rxContext)
throw();
ModuleController (void); // Not implemented.
ModuleController (const ModuleController&); // Not implemented.
virtual ~ModuleController (void) throw();
void LoadFactories (void);
void ProcessFactory (const ::std::vector<com::sun::star::uno::Any>& rValues);
/** Load a list of URL to service mappings from the
/org.openoffice.Office.Impress/MultiPaneGUI/Framework/ResourceFactories
configuration entry. The mappings are stored in the
mpResourceToFactoryMap member.
*/
void LoadFactories (const css::uno::Reference<css::uno::XComponentContext>& rxContext);
/** Called for every entry in the ResourceFactories configuration entry.
*/
void ProcessFactory (const ::std::vector<css::uno::Any>& rValues);
/** Instantiate all startup services that are found in the
/org.openoffice.Office.Impress/MultiPaneGUI/Framework/StartupServices
configuration entry. This method is called once when a new
ModuleController object is created.
*/
void InstantiateStartupServices (void);
/** Called for one entry in the StartupServices configuration list this
method instantiates the service described by the entry. It does not
hold references to the new object so that the object will be
destroyed on function exit when it does not register itself
somewhere. It typically will register as
XConfigurationChangeListener at the configuration controller.
*/
void ProcessStartupService (const ::std::vector<css::uno::Any>& rValues);
};
} } // end of namespace sd::framework