1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24#ifndef __com_sun_star_drawing_framework_XResourceFactory_idl__
25#define __com_sun_star_drawing_framework_XResourceFactory_idl__
26
27#ifndef __com_sun_star_uno_XInterface_idl__
28#include <com/sun/star/uno/XInterface.idl>
29#endif
30#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
31#include <com/sun/star/lang/IllegalArgumentException.idl>
32#endif
33#ifndef __com_sun_star_lang_WrappedTargetException_idl__
34#include <com/sun/star/lang/WrappedTargetException.idl>
35#endif
36
37module com { module sun { module star { module drawing { module framework {
38
39published interface XResource;
40published interface XResourceId;
41
42/** Factory and possibly cache for creating and releasing resources.
43    <p>A resource factory is created and used by the
44    <type>XConfigurationController</type> object.</p>
45    <p>A factory may want to implement a cache to reuse previously released
46    resources.</p>
47*/
48published interface XResourceFactory
49{
50    /** Create a resource for the given <type>XResourceId</type> object.
51        @param xResourceId
52            The resourc URL of this id specifies the type of resource to
53            create.  The anchor can be used to obtain the associated object
54            from the configuration controller.  For example, when a view is
55            created, then the new object can be initialized with the pane
56            that is its anchor.
57            <p>Valid values are those for which the factory has previously been
58            registered at the <type>XConfigurationController</type></p>.
59        @return
60            Returns a resource object that has been just created or was
61            taken from a cache.  When the requested resource can not be
62            created then an empty reference is returned.  A later call may
63            be successfull.  This, for example, can be the case with SFX
64            based side panes.  They are not available right after the
65            creation of a new application frame.
66        @throws InvalidArgumentException
67            when the given URL is not supported by the factory.
68    */
69    XResource createResource (
70            [in] XResourceId xResourceId)
71        raises  (   ::com::sun::star::lang::IllegalArgumentException,
72                    ::com::sun::star::lang::WrappedTargetException
73                );
74
75    /** Call this method to tell a factory that the given resource is no
76        longer in use.  The factory can decide whether to destroy the
77        resource or to keep it in a cache in order to reuse it later.
78        @param xResource
79            The given resource has to be one created by the same factory.
80        @throws InvalidArgumentException
81            when the given pane was not created by the same factory.
82    */
83    void releaseResource ([in] XResource xResource);
84};
85
86}; }; }; }; }; // ::com::sun::star::drawing::framework
87
88#endif
89