1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SD_FRAMEWORK_MODULE_CONTROLLER_HXX
21 #define SD_FRAMEWORK_MODULE_CONTROLLER_HXX
23 #include "MutexOwner.hxx"
25 #include <osl/mutex.hxx>
26 #include <com/sun/star/drawing/framework/XModuleController.hpp>
27 #include <com/sun/star/uno/XComponentContext.hpp>
28 #include <com/sun/star/lang/XInitialization.hpp>
29 #include <com/sun/star/frame/XController.hpp>
30 #include <cppuhelper/compbase2.hxx>
32 #include <boost/scoped_ptr.hpp>
37 typedef ::cppu::WeakComponentImplHelper2
<
38 css::drawing::framework::XModuleController
,
39 css::lang::XInitialization
40 > ModuleControllerInterfaceBase
;
42 } // end of anonymous namespace.
46 namespace sd
{ namespace framework
{
48 /** The ModuleController has to tasks:
51 org.openoffice.Office.Impress/MultiPaneGUI/Framework/ResourceFactories
52 configuration data that maps from resource URLs to service names of
53 factories that can create resources for the URLs. When the
54 configuration controller wants to create a resource for which it does
55 not have a factory, it asks the ModuleController to provide one. The
56 ModuleController looks up the service name registered for the URL of the
57 resource and instantiates this service. The service is expected to
58 register on its creation a factory for the resource in question.
60 2. The ModuleController reads on its creation
61 org.openoffice.Office.Impress/MultiPaneGUI/Framework/StartupServices
62 configuration data and instantiates all listed services. These servces
63 can then register as listeners at the ConfigurationController or do
66 class ModuleController
67 : private sd::MutexOwner
,
68 public ModuleControllerInterfaceBase
71 static css::uno::Reference
<
72 css::drawing::framework::XModuleController
>
74 const css::uno::Reference
<css::uno::XComponentContext
>&
77 virtual void SAL_CALL
disposing (void);
82 virtual void SAL_CALL
requestResource(const OUString
& rsResourceURL
)
83 throw (css::uno::RuntimeException
);
88 virtual void SAL_CALL
initialize(
89 const css::uno::Sequence
<css::uno::Any
>& aArguments
)
90 throw (css::uno::Exception
, css::uno::RuntimeException
);
94 css::frame::XController
> mxController
;
96 class ResourceToFactoryMap
;
97 ::boost::scoped_ptr
<ResourceToFactoryMap
> mpResourceToFactoryMap
;
98 class LoadedFactoryContainer
;
99 ::boost::scoped_ptr
<LoadedFactoryContainer
> mpLoadedFactories
;
102 const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
)
104 ModuleController (void); // Not implemented.
105 ModuleController (const ModuleController
&); // Not implemented.
106 virtual ~ModuleController (void) throw();
108 /** Load a list of URL to service mappings from the
109 /org.openoffice.Office.Impress/MultiPaneGUI/Framework/ResourceFactories
110 configuration entry. The mappings are stored in the
111 mpResourceToFactoryMap member.
113 void LoadFactories (const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
);
115 /** Called for every entry in the ResourceFactories configuration entry.
117 void ProcessFactory (const ::std::vector
<css::uno::Any
>& rValues
);
119 /** Instantiate all startup services that are found in the
120 /org.openoffice.Office.Impress/MultiPaneGUI/Framework/StartupServices
121 configuration entry. This method is called once when a new
122 ModuleController object is created.
124 void InstantiateStartupServices (void);
126 /** Called for one entry in the StartupServices configuration list this
127 method instantiates the service described by the entry. It does not
128 hold references to the new object so that the object will be
129 destroyed on function exit when it does not register itself
130 somewhere. It typically will register as
131 XConfigurationChangeListener at the configuration controller.
133 void ProcessStartupService (const ::std::vector
<css::uno::Any
>& rValues
);
136 } } // end of namespace sd::framework
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */