LibreOffice Module sd (master) 1
ConfigurationControllerResourceManager.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <osl/mutex.hxx>
23
24#include <com/sun/star/uno/Reference.hxx>
25
26#include <map>
27#include <memory>
28#include <vector>
29
30namespace com::sun::star::drawing::framework { class XConfiguration; }
31namespace com::sun::star::drawing::framework { class XResourceFactory; }
32namespace com::sun::star::drawing::framework { class XResource; }
33namespace com::sun::star::drawing::framework { class XResourceId; }
34
35namespace sd::framework {
36
37class ConfigurationControllerBroadcaster;
38class ResourceFactoryManager;
39
43{
44public:
50 {
51 public:
52 css::uno::Reference<css::drawing::framework::XResource> mxResource;
53 css::uno::Reference<css::drawing::framework::XResourceFactory> mxResourceFactory;
54 };
55
62 std::shared_ptr<ResourceFactoryManager> pResourceFactoryContainer,
63 std::shared_ptr<ConfigurationControllerBroadcaster> pBroadcaster);
64
66
70
77 const ::std::vector<
78 css::uno::Reference<css::drawing::framework::XResourceId> >& rResources,
79 const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration);
80
87 const ::std::vector<
88 css::uno::Reference<css::drawing::framework::XResourceId> >& rResources,
89 const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration);
90
97 const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId);
98
99private:
100 osl::Mutex maMutex;
101
103 {
104 public:
105 bool operator() (
106 const css::uno::Reference<css::drawing::framework::XResourceId>& rxId1,
107 const css::uno::Reference<css::drawing::framework::XResourceId>& rxId2) const;
108 };
109
110 typedef ::std::map<
111 css::uno::Reference<css::drawing::framework::XResourceId>,
115
116 std::shared_ptr<ResourceFactoryManager> mpResourceFactoryContainer;
117
121 std::shared_ptr<ConfigurationControllerBroadcaster> mpBroadcaster;
122
123 void ActivateResource (
124 const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
125 const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration);
126
127 void DeactivateResource (
128 const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
129 const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration);
130
131 void AddResource (
132 const css::uno::Reference<css::drawing::framework::XResource>& rxResource,
133 const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxFactory);
134
136 const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId);
137};
138
139} // end of namespace sd::framework
140
141/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool operator()(const css::uno::Reference< css::drawing::framework::XResourceId > &rxId1, const css::uno::Reference< css::drawing::framework::XResourceId > &rxId2) const
For every active resource both the resource itself as well as its creating factory are remembered,...
css::uno::Reference< css::drawing::framework::XResourceFactory > mxResourceFactory
std::shared_ptr< ConfigurationControllerBroadcaster > mpBroadcaster
This broadcaster is used to notify the activation and deactivation of resources.
void ActivateResources(const ::std::vector< css::uno::Reference< css::drawing::framework::XResourceId > > &rResources, const css::uno::Reference< css::drawing::framework::XConfiguration > &rxConfiguration)
Activate all the resources that are specified by resource ids in rResources.
void DeactivateResources(const ::std::vector< css::uno::Reference< css::drawing::framework::XResourceId > > &rResources, const css::uno::Reference< css::drawing::framework::XConfiguration > &rxConfiguration)
Deactivate all the resources that are specified by resource ids in rResources.
void DeactivateResource(const css::uno::Reference< css::drawing::framework::XResourceId > &rxResourceId, const css::uno::Reference< css::drawing::framework::XConfiguration > &rxConfiguration)
ConfigurationControllerResourceManager(const ConfigurationControllerResourceManager &)=delete
Forbid copy construction and copy assignment.
::std::map< css::uno::Reference< css::drawing::framework::XResourceId >, ResourceDescriptor, ResourceComparator > ResourceMap
ResourceDescriptor GetResource(const css::uno::Reference< css::drawing::framework::XResourceId > &rxResourceId)
Return the descriptor for the specified resource.
ConfigurationControllerResourceManager & operator=(const ConfigurationControllerResourceManager &)=delete
void ActivateResource(const css::uno::Reference< css::drawing::framework::XResourceId > &rxResourceId, const css::uno::Reference< css::drawing::framework::XConfiguration > &rxConfiguration)
void AddResource(const css::uno::Reference< css::drawing::framework::XResource > &rxResource, const css::uno::Reference< css::drawing::framework::XResourceFactory > &rxFactory)
ConfigurationControllerResourceManager(std::shared_ptr< ResourceFactoryManager > pResourceFactoryContainer, std::shared_ptr< ConfigurationControllerBroadcaster > pBroadcaster)
A new ResourceManager object is created with the resource factory container for creating resources an...
ResourceDescriptor RemoveResource(const css::uno::Reference< css::drawing::framework::XResourceId > &rxResourceId)