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 INCLUDED_SD_SOURCE_UI_INC_FRAMEWORK_MODULECONTROLLER_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_FRAMEWORK_MODULECONTROLLER_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.
44 namespace sd
{ namespace framework
{
46 /** The ModuleController has to tasks:
49 org.openoffice.Office.Impress/MultiPaneGUI/Framework/ResourceFactories
50 configuration data that maps from resource URLs to service names of
51 factories that can create resources for the URLs. When the
52 configuration controller wants to create a resource for which it does
53 not have a factory, it asks the ModuleController to provide one. The
54 ModuleController looks up the service name registered for the URL of the
55 resource and instantiates this service. The service is expected to
56 register on its creation a factory for the resource in question.
58 2. The ModuleController reads on its creation
59 org.openoffice.Office.Impress/MultiPaneGUI/Framework/StartupServices
60 configuration data and instantiates all listed services. These servces
61 can then register as listeners at the ConfigurationController or do
64 class ModuleController
65 : private sd::MutexOwner
,
66 public ModuleControllerInterfaceBase
69 static css::uno::Reference
<
70 css::drawing::framework::XModuleController
>
72 const css::uno::Reference
<css::uno::XComponentContext
>&
75 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
79 virtual void SAL_CALL
requestResource(const OUString
& rsResourceURL
)
80 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
84 virtual void SAL_CALL
initialize(
85 const css::uno::Sequence
<css::uno::Any
>& aArguments
)
86 throw (css::uno::Exception
, css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
90 css::frame::XController
> mxController
;
92 class ResourceToFactoryMap
;
93 ::boost::scoped_ptr
<ResourceToFactoryMap
> mpResourceToFactoryMap
;
94 class LoadedFactoryContainer
;
95 ::boost::scoped_ptr
<LoadedFactoryContainer
> mpLoadedFactories
;
98 const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
)
99 throw (std::exception
);
100 ModuleController (const ModuleController
&) SAL_DELETED_FUNCTION
;
101 virtual ~ModuleController() throw();
103 /** Load a list of URL to service mappings from the
104 /org.openoffice.Office.Impress/MultiPaneGUI/Framework/ResourceFactories
105 configuration entry. The mappings are stored in the
106 mpResourceToFactoryMap member.
108 void LoadFactories (const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
);
110 /** Called for every entry in the ResourceFactories configuration entry.
112 void ProcessFactory (const ::std::vector
<css::uno::Any
>& rValues
);
114 /** Instantiate all startup services that are found in the
115 /org.openoffice.Office.Impress/MultiPaneGUI/Framework/StartupServices
116 configuration entry. This method is called once when a new
117 ModuleController object is created.
119 void InstantiateStartupServices();
121 /** Called for one entry in the StartupServices configuration list this
122 method instantiates the service described by the entry. It does not
123 hold references to the new object so that the object will be
124 destroyed on function exit when it does not register itself
125 somewhere. It typically will register as
126 XConfigurationChangeListener at the configuration controller.
128 void ProcessStartupService (const ::std::vector
<css::uno::Any
>& rValues
);
131 } } // end of namespace sd::framework
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */