bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / inc / framework / ModuleController.hxx
blob40d998013faeb020efa144118ac25a6bc34b41ed
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <com/sun/star/drawing/framework/XModuleController.hpp>
26 #include <com/sun/star/lang/XInitialization.hpp>
27 #include <cppuhelper/compbase.hxx>
29 #include <memory>
31 namespace com { namespace sun { namespace star { namespace frame { class XController; } } } }
32 namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } }
34 namespace sd { namespace framework {
36 typedef ::cppu::WeakComponentImplHelper <
37 css::drawing::framework::XModuleController,
38 css::lang::XInitialization
39 > ModuleControllerInterfaceBase;
41 /** The ModuleController has two tasks:
43 1. It reads the
44 org.openoffice.Office.Impress/MultiPaneGUI/Framework/ResourceFactories
45 configuration data that maps from resource URLs to service names of
46 factories that can create resources for the URLs. When the
47 configuration controller wants to create a resource for which it does
48 not have a factory, it asks the ModuleController to provide one. The
49 ModuleController looks up the service name registered for the URL of the
50 resource and instantiates this service. The service is expected to
51 register on its creation a factory for the resource in question.
53 2. The ModuleController reads on its creation
54 org.openoffice.Office.Impress/MultiPaneGUI/Framework/StartupServices
55 configuration data and instantiates all listed services. These services
56 can then register as listeners at the ConfigurationController or do
57 whatever they like.
59 class ModuleController
60 : private sd::MutexOwner,
61 public ModuleControllerInterfaceBase
63 public:
64 static css::uno::Reference<
65 css::drawing::framework::XModuleController>
66 CreateInstance (
67 const css::uno::Reference<css::uno::XComponentContext>&
68 rxContext);
70 virtual void SAL_CALL disposing() override;
72 // XModuleController
74 virtual void SAL_CALL requestResource(const OUString& rsResourceURL) override;
76 // XInitialization
78 virtual void SAL_CALL initialize(
79 const css::uno::Sequence<css::uno::Any>& aArguments) override;
81 private:
82 css::uno::Reference<
83 css::frame::XController> mxController;
85 class ResourceToFactoryMap;
86 std::unique_ptr<ResourceToFactoryMap> mpResourceToFactoryMap;
87 class LoadedFactoryContainer;
88 std::unique_ptr<LoadedFactoryContainer> mpLoadedFactories;
90 /// @throws std::exception
91 ModuleController (
92 const css::uno::Reference<css::uno::XComponentContext>& rxContext);
93 ModuleController (const ModuleController&) = delete;
94 virtual ~ModuleController() throw() override;
96 /** Called for every entry in the ResourceFactories configuration entry.
98 void ProcessFactory (const ::std::vector<css::uno::Any>& rValues);
100 /** Instantiate all startup services that are found in the
101 /org.openoffice.Office.Impress/MultiPaneGUI/Framework/StartupServices
102 configuration entry. This method is called once when a new
103 ModuleController object is created.
105 void InstantiateStartupServices();
107 /** Called for one entry in the StartupServices configuration list this
108 method instantiates the service described by the entry. It does not
109 hold references to the new object so that the object will be
110 destroyed on function exit when it does not register itself
111 somewhere. It typically will register as
112 XConfigurationChangeListener at the configuration controller.
114 void ProcessStartupService (const ::std::vector<css::uno::Any>& rValues);
117 } } // end of namespace sd::framework
119 #endif
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */