1*408a4873SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3*408a4873SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*408a4873SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*408a4873SAndrew Rist * distributed with this work for additional information
6*408a4873SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*408a4873SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*408a4873SAndrew Rist * "License"); you may not use this file except in compliance
9*408a4873SAndrew Rist * with the License.  You may obtain a copy of the License at
10*408a4873SAndrew Rist *
11*408a4873SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*408a4873SAndrew Rist *
13*408a4873SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*408a4873SAndrew Rist * software distributed under the License is distributed on an
15*408a4873SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*408a4873SAndrew Rist * KIND, either express or implied.  See the License for the
17*408a4873SAndrew Rist * specific language governing permissions and limitations
18*408a4873SAndrew Rist * under the License.
19*408a4873SAndrew Rist *
20*408a4873SAndrew Rist *************************************************************/
21*408a4873SAndrew Rist
22*408a4873SAndrew Rist
23cdf0e10cSrcweir#ifndef __com_sun_star_uno_XAggregation_idl__
24cdf0e10cSrcweir#define __com_sun_star_uno_XAggregation_idl__
25cdf0e10cSrcweir
26cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__
27cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
28cdf0e10cSrcweir#endif
29cdf0e10cSrcweir
30cdf0e10cSrcweir//=============================================================================
31cdf0e10cSrcweir
32cdf0e10cSrcweirmodule com { module sun { module star { module uno {
33cdf0e10cSrcweir
34cdf0e10cSrcweir//=============================================================================
35cdf0e10cSrcweir/** Objects which implement this interface can become aggregates of
36cdf0e10cSrcweir	a delegator.
37cdf0e10cSrcweir
38cdf0e10cSrcweir	<p>That means if an object "A" aggregates "B", "A" can provide all
39cdf0e10cSrcweir	or some of the interfaces of "B". Whenever the method
40cdf0e10cSrcweir	<member>XInterface::queryInterface()</member>
41cdf0e10cSrcweir	is called on either of the objects, the call will be forwarded
42cdf0e10cSrcweir	to object "A". Object "A" now can determine whether to use the
43cdf0e10cSrcweir	interfaces of "A" or "B" or neither. Actually, any number of
44cdf0e10cSrcweir	aggregates can be used, even nested ones (aggregated objects which are
45cdf0e10cSrcweir	delegators by themselves).
46cdf0e10cSrcweir
47cdf0e10cSrcweir	<p>The following rules are to be observed:
48cdf0e10cSrcweir	<ol>
49cdf0e10cSrcweir	<li>All calls to <member>XInterface::acquire()</member>
50cdf0e10cSrcweir	which are made before the delegator was set (using the method
51cdf0e10cSrcweir	<member>XAggregation::setDelegator()</member>) must not be taken back
52cdf0e10cSrcweir	(using the method <member>XInterface::release()</member>)
53cdf0e10cSrcweir	before the delegation is removed by calling
54cdf0e10cSrcweir	<code>xAggregation-&gt;setDelegator(NULL)</code>.
55cdf0e10cSrcweir
56cdf0e10cSrcweir	<li>The constructor of a delegator has to increment its
57cdf0e10cSrcweir	own reference count by calling its method
58cdf0e10cSrcweir	<member>XInterface::acquire()</member>
59cdf0e10cSrcweir	before it sets itself to any aggregate using the method
60cdf0e10cSrcweir	<member>XAggregation::setDelegator()</member>. After that
61cdf0e10cSrcweir	call it has to reset its own reference count without the
62cdf0e10cSrcweir	destructor getting called.
63cdf0e10cSrcweir
64cdf0e10cSrcweir	<li>The destructor of a delegator has to reset the delegator in
65cdf0e10cSrcweir	its aggregated objects by calling their method
66cdf0e10cSrcweir	<member>XAggregation::setDelegator()</member> with
67cdf0e10cSrcweir	<const>NULL</const> before it releases its reference to
68cdf0e10cSrcweir	its aggregated objects.
69cdf0e10cSrcweir	</ol>
70cdf0e10cSrcweir
71cdf0e10cSrcweir	@deprecated
72cdf0e10cSrcweir    Aggregation will no longer be supported as a high-level concept of UNO.
73cdf0e10cSrcweir    You may still have the option to implement an UNO object consisting of
74cdf0e10cSrcweir    several single objects in your specific programming language, though this
75cdf0e10cSrcweir    depends on your programming language.
76cdf0e10cSrcweir*/
77cdf0e10cSrcweirpublished interface XAggregation: com::sun::star::uno::XInterface
78cdf0e10cSrcweir{
79cdf0e10cSrcweir	//-------------------------------------------------------------------------
80cdf0e10cSrcweir	/** sets the object to which all calls to the method
81cdf0e10cSrcweir		<member>XInterface::queryInterface()</member>
82cdf0e10cSrcweir		have to be forwarded. @
83cdf0e10cSrcweir
84cdf0e10cSrcweir		@param xDelegator
85cdf0e10cSrcweir		specifies the object which handles the calls to
86cdf0e10cSrcweir		<member>XInterface::queryInterface()</member>.
87cdf0e10cSrcweir		If <var>xDelegator</var> is <const>NULL</const>, the delegator is
88cdf0e10cSrcweir		removed and thus the object becomes its own delegator and has
89cdf0e10cSrcweir		to handle calls to the method
90cdf0e10cSrcweir		<member>XInterface::queryInterface()</member>
91cdf0e10cSrcweir		itself.
92cdf0e10cSrcweir
93cdf0e10cSrcweir		@see XAggregation::queryAggregation
94cdf0e10cSrcweir	*/
95cdf0e10cSrcweir	void setDelegator( [in] com::sun::star::uno::XInterface pDelegator );
96cdf0e10cSrcweir
97cdf0e10cSrcweir	//-------------------------------------------------------------------------
98cdf0e10cSrcweir	/** is similar to <member>XInterface::queryInterface()</member>,
99cdf0e10cSrcweir		but it is to be processed directly without being forwarded to the
100cdf0e10cSrcweir		delegator. @
101cdf0e10cSrcweir
102cdf0e10cSrcweir		<p>This method is only called from within an implementation of
103cdf0e10cSrcweir		<member>XInterface::queryInterface()</member>
104cdf0e10cSrcweir		or <member>XAggregation::queryAggregation()</member>. This method
105cdf0e10cSrcweir		is to be called by the delegator if it does not implement the
106cdf0e10cSrcweir		interface itself. An object which got aggregated cannot depend
107cdf0e10cSrcweir		on getting its own interface when it calls the method
108cdf0e10cSrcweir		<member>XInterface::queryInterface()</member>.
109cdf0e10cSrcweir
110cdf0e10cSrcweir		@see XAggregation::setDelegator
111cdf0e10cSrcweir	*/
112cdf0e10cSrcweir	any queryAggregation( [in] type aType );
113cdf0e10cSrcweir
114cdf0e10cSrcweir};
115cdf0e10cSrcweir
116cdf0e10cSrcweir//=============================================================================
117cdf0e10cSrcweir
118cdf0e10cSrcweir}; }; }; };
119cdf0e10cSrcweir
120cdf0e10cSrcweir#endif
121