1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27
28#ifndef __com_sun_star_drawing_framework_XResourceFactory_idl__
29#define __com_sun_star_drawing_framework_XResourceFactory_idl__
30
31#ifndef __com_sun_star_uno_XInterface_idl__
32#include <com/sun/star/uno/XInterface.idl>
33#endif
34#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
35#include <com/sun/star/lang/IllegalArgumentException.idl>
36#endif
37#ifndef __com_sun_star_lang_WrappedTargetException_idl__
38#include <com/sun/star/lang/WrappedTargetException.idl>
39#endif
40
41module com { module sun { module star { module drawing { module framework {
42
43published interface XResource;
44published interface XResourceId;
45
46/** Factory and possibly cache for creating and releasing resources.
47    <p>A resource factory is created and used by the
48    <type>XConfigurationController</type> object.</p>
49    <p>A factory may want to implement a cache to reuse previously released
50    resources.</p>
51*/
52published interface XResourceFactory
53{
54    /** Create a resource for the given <type>XResourceId</type> object.
55        @param xResourceId
56            The resourc URL of this id specifies the type of resource to
57            create.  The anchor can be used to obtain the associated object
58            from the configuration controller.  For example, when a view is
59            created, then the new object can be initialized with the pane
60            that is its anchor.
61            <p>Valid values are those for which the factory has previously been
62            registered at the <type>XConfigurationController</type></p>.
63        @return
64            Returns a resource object that has been just created or was
65            taken from a cache.  When the requested resource can not be
66            created then an empty reference is returned.  A later call may
67            be successfull.  This, for example, can be the case with SFX
68            based side panes.  They are not available right after the
69            creation of a new application frame.
70        @throws InvalidArgumentException
71            when the given URL is not supported by the factory.
72    */
73    XResource createResource (
74            [in] XResourceId xResourceId)
75        raises  (   ::com::sun::star::lang::IllegalArgumentException,
76                    ::com::sun::star::lang::WrappedTargetException
77                );
78
79    /** Call this method to tell a factory that the given resource is no
80        longer in use.  The factory can decide whether to destroy the
81        resource or to keep it in a cache in order to reuse it later.
82        @param xResource
83            The given resource has to be one created by the same factory.
84        @throws InvalidArgumentException
85            when the given pane was not created by the same factory.
86    */
87    void releaseResource ([in] XResource xResource);
88};
89
90}; }; }; }; }; // ::com::sun::star::drawing::framework
91
92#endif
93