1*cdf0e10cSrcweir/*************************************************************************
2*cdf0e10cSrcweir *
3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir *
5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir *
7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir *
9*cdf0e10cSrcweir * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir *
11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir *
15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir *
21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir *
26*cdf0e10cSrcweir ************************************************************************/
27*cdf0e10cSrcweir#ifndef __com_sun_star_uno_XAggregation_idl__
28*cdf0e10cSrcweir#define __com_sun_star_uno_XAggregation_idl__
29*cdf0e10cSrcweir
30*cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__
31*cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
32*cdf0e10cSrcweir#endif
33*cdf0e10cSrcweir
34*cdf0e10cSrcweir//=============================================================================
35*cdf0e10cSrcweir
36*cdf0e10cSrcweirmodule com { module sun { module star { module uno {
37*cdf0e10cSrcweir
38*cdf0e10cSrcweir//=============================================================================
39*cdf0e10cSrcweir/** Objects which implement this interface can become aggregates of
40*cdf0e10cSrcweir	a delegator.
41*cdf0e10cSrcweir
42*cdf0e10cSrcweir	<p>That means if an object "A" aggregates "B", "A" can provide all
43*cdf0e10cSrcweir	or some of the interfaces of "B". Whenever the method
44*cdf0e10cSrcweir	<member>XInterface::queryInterface()</member>
45*cdf0e10cSrcweir	is called on either of the objects, the call will be forwarded
46*cdf0e10cSrcweir	to object "A". Object "A" now can determine whether to use the
47*cdf0e10cSrcweir	interfaces of "A" or "B" or neither. Actually, any number of
48*cdf0e10cSrcweir	aggregates can be used, even nested ones (aggregated objects which are
49*cdf0e10cSrcweir	delegators by themselves).
50*cdf0e10cSrcweir
51*cdf0e10cSrcweir	<p>The following rules are to be observed:
52*cdf0e10cSrcweir	<ol>
53*cdf0e10cSrcweir	<li>All calls to <member>XInterface::acquire()</member>
54*cdf0e10cSrcweir	which are made before the delegator was set (using the method
55*cdf0e10cSrcweir	<member>XAggregation::setDelegator()</member>) must not be taken back
56*cdf0e10cSrcweir	(using the method <member>XInterface::release()</member>)
57*cdf0e10cSrcweir	before the delegation is removed by calling
58*cdf0e10cSrcweir	<code>xAggregation-&gt;setDelegator(NULL)</code>.
59*cdf0e10cSrcweir
60*cdf0e10cSrcweir	<li>The constructor of a delegator has to increment its
61*cdf0e10cSrcweir	own reference count by calling its method
62*cdf0e10cSrcweir	<member>XInterface::acquire()</member>
63*cdf0e10cSrcweir	before it sets itself to any aggregate using the method
64*cdf0e10cSrcweir	<member>XAggregation::setDelegator()</member>. After that
65*cdf0e10cSrcweir	call it has to reset its own reference count without the
66*cdf0e10cSrcweir	destructor getting called.
67*cdf0e10cSrcweir
68*cdf0e10cSrcweir	<li>The destructor of a delegator has to reset the delegator in
69*cdf0e10cSrcweir	its aggregated objects by calling their method
70*cdf0e10cSrcweir	<member>XAggregation::setDelegator()</member> with
71*cdf0e10cSrcweir	<const>NULL</const> before it releases its reference to
72*cdf0e10cSrcweir	its aggregated objects.
73*cdf0e10cSrcweir	</ol>
74*cdf0e10cSrcweir
75*cdf0e10cSrcweir	@deprecated
76*cdf0e10cSrcweir    Aggregation will no longer be supported as a high-level concept of UNO.
77*cdf0e10cSrcweir    You may still have the option to implement an UNO object consisting of
78*cdf0e10cSrcweir    several single objects in your specific programming language, though this
79*cdf0e10cSrcweir    depends on your programming language.
80*cdf0e10cSrcweir*/
81*cdf0e10cSrcweirpublished interface XAggregation: com::sun::star::uno::XInterface
82*cdf0e10cSrcweir{
83*cdf0e10cSrcweir	//-------------------------------------------------------------------------
84*cdf0e10cSrcweir	/** sets the object to which all calls to the method
85*cdf0e10cSrcweir		<member>XInterface::queryInterface()</member>
86*cdf0e10cSrcweir		have to be forwarded. @
87*cdf0e10cSrcweir
88*cdf0e10cSrcweir		@param xDelegator
89*cdf0e10cSrcweir		specifies the object which handles the calls to
90*cdf0e10cSrcweir		<member>XInterface::queryInterface()</member>.
91*cdf0e10cSrcweir		If <var>xDelegator</var> is <const>NULL</const>, the delegator is
92*cdf0e10cSrcweir		removed and thus the object becomes its own delegator and has
93*cdf0e10cSrcweir		to handle calls to the method
94*cdf0e10cSrcweir		<member>XInterface::queryInterface()</member>
95*cdf0e10cSrcweir		itself.
96*cdf0e10cSrcweir
97*cdf0e10cSrcweir		@see XAggregation::queryAggregation
98*cdf0e10cSrcweir	*/
99*cdf0e10cSrcweir	void setDelegator( [in] com::sun::star::uno::XInterface pDelegator );
100*cdf0e10cSrcweir
101*cdf0e10cSrcweir	//-------------------------------------------------------------------------
102*cdf0e10cSrcweir	/** is similar to <member>XInterface::queryInterface()</member>,
103*cdf0e10cSrcweir		but it is to be processed directly without being forwarded to the
104*cdf0e10cSrcweir		delegator. @
105*cdf0e10cSrcweir
106*cdf0e10cSrcweir		<p>This method is only called from within an implementation of
107*cdf0e10cSrcweir		<member>XInterface::queryInterface()</member>
108*cdf0e10cSrcweir		or <member>XAggregation::queryAggregation()</member>. This method
109*cdf0e10cSrcweir		is to be called by the delegator if it does not implement the
110*cdf0e10cSrcweir		interface itself. An object which got aggregated cannot depend
111*cdf0e10cSrcweir		on getting its own interface when it calls the method
112*cdf0e10cSrcweir		<member>XInterface::queryInterface()</member>.
113*cdf0e10cSrcweir
114*cdf0e10cSrcweir		@see XAggregation::setDelegator
115*cdf0e10cSrcweir	*/
116*cdf0e10cSrcweir	any queryAggregation( [in] type aType );
117*cdf0e10cSrcweir
118*cdf0e10cSrcweir};
119*cdf0e10cSrcweir
120*cdf0e10cSrcweir//=============================================================================
121*cdf0e10cSrcweir
122*cdf0e10cSrcweir}; }; }; };
123*cdf0e10cSrcweir
124*cdf0e10cSrcweir#endif
125