bump product version to 4.1.6.2
[LibreOffice.git] / sd / source / ui / framework / configuration / ResourceFactoryManager.hxx
blobfd83529202e62b99077623d609b8e8d58b89b4fc
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 SD_FRAMEWORK_RESOURCE_FACTORY_MANAGER_HXX
21 #define SD_FRAMEWORK_RESOURCE_FACTORY_MANAGER_HXX
23 #include <com/sun/star/drawing/framework/XControllerManager.hpp>
24 #include <com/sun/star/drawing/framework/XModuleController.hpp>
25 #include <com/sun/star/drawing/framework/XResourceFactoryManager.hpp>
26 #include <com/sun/star/util/XURLTransformer.hpp>
27 #include <osl/mutex.hxx>
28 #include <comphelper/stl_types.hxx>
29 #include <boost/unordered_map.hpp>
31 namespace sd { namespace framework {
33 /** Container of resource factories of the drawing framework.
35 class ResourceFactoryManager
37 public:
38 ResourceFactoryManager (
39 const css::uno::Reference<css::drawing::framework::XControllerManager>& rxManager);
41 ~ResourceFactoryManager (void);
43 /** Register a resource factory for one type of resource.
44 @param rsURL
45 The type of the resource that will be created by the factory.
46 @param rxFactory
47 The factory that will create resource objects of the specfied type.
49 void AddFactory (
50 const OUString& rsURL,
51 const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxFactory)
52 throw (css::uno::RuntimeException);
54 /** Unregister the specifed factory.
55 @param rsURL
56 Unregister only the factory for this URL. When the same factory
57 is registered for other URLs then these remain registered.
59 void RemoveFactoryForURL(
60 const OUString& rsURL)
61 throw (css::uno::RuntimeException);
63 /** Unregister the specified factory.
64 @param rxFactory
65 Unregister the this factory for all URLs that it has been
66 registered for.
68 void RemoveFactoryForReference(
69 const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxFactory)
70 throw (css::uno::RuntimeException);
72 /** Return a factory that can create resources specified by the given URL.
73 @param rsCompleteURL
74 This URL specifies the type of the resource. It may contain arguments.
75 @return
76 When a factory for the specified URL has been registered by a
77 previous call to AddFactory() then a reference to that factory
78 is returned. Otherwise an empty reference is returned.
80 css::uno::Reference<css::drawing::framework::XResourceFactory> GetFactory (
81 const OUString& rsURL)
82 throw (css::uno::RuntimeException);
84 private:
85 ::osl::Mutex maMutex;
86 typedef ::boost::unordered_map<
87 OUString,
88 css::uno::Reference<css::drawing::framework::XResourceFactory>,
89 OUStringHash,
90 ::comphelper::UStringEqual> FactoryMap;
91 FactoryMap maFactoryMap;
93 typedef ::std::vector<
94 ::std::pair<
95 OUString,
96 css::uno::Reference<css::drawing::framework::XResourceFactory> > >
97 FactoryPatternList;
98 FactoryPatternList maFactoryPatternList;
100 css::uno::Reference<css::drawing::framework::XControllerManager> mxControllerManager;
101 css::uno::Reference<css::util::XURLTransformer> mxURLTransformer;
103 /** Look up the factory for the given URL.
104 @param rsURLBase
105 The css::tools::URL.Main part of a URL. Arguments have to be
106 stripped off by the caller.
107 @return
108 When the factory has not yet been added then return NULL.
110 css::uno::Reference<css::drawing::framework::XResourceFactory> FindFactory (
111 const OUString& rsURLBase)
112 throw (css::uno::RuntimeException);
116 } } // end of namespace sd::framework
118 #endif
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */