1*24acc546SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*24acc546SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*24acc546SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*24acc546SAndrew Rist  * distributed with this work for additional information
6*24acc546SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*24acc546SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*24acc546SAndrew Rist  * "License"); you may not use this file except in compliance
9*24acc546SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*24acc546SAndrew Rist  *
11*24acc546SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*24acc546SAndrew Rist  *
13*24acc546SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*24acc546SAndrew Rist  * software distributed under the License is distributed on an
15*24acc546SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*24acc546SAndrew Rist  * KIND, either express or implied.  See the License for the
17*24acc546SAndrew Rist  * specific language governing permissions and limitations
18*24acc546SAndrew Rist  * under the License.
19*24acc546SAndrew Rist  *
20*24acc546SAndrew Rist  *************************************************************/
21*24acc546SAndrew Rist 
22*24acc546SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_forms.hxx"
26cdf0e10cSrcweir #include "cloneable.hxx"
27cdf0e10cSrcweir #include <com/sun/star/util/XCloneable.hpp>
28cdf0e10cSrcweir #include <comphelper/uno3.hxx>
29cdf0e10cSrcweir #include <tools/debug.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir //.........................................................................
32cdf0e10cSrcweir namespace frm
33cdf0e10cSrcweir {
34cdf0e10cSrcweir //.........................................................................
35cdf0e10cSrcweir 
36cdf0e10cSrcweir 	using namespace ::comphelper;
37cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
38cdf0e10cSrcweir 	using namespace ::com::sun::star::util;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 	//====================================================================
41cdf0e10cSrcweir 	//= OCloneableAggregation
42cdf0e10cSrcweir 	//====================================================================
43cdf0e10cSrcweir 	//------------------------------------------------------------------
createAggregateClone(const OCloneableAggregation * _pOriginal)44cdf0e10cSrcweir 	Reference< XAggregation > OCloneableAggregation::createAggregateClone( const OCloneableAggregation* _pOriginal )
45cdf0e10cSrcweir 	{
46cdf0e10cSrcweir 		Reference< XCloneable > xAggregateCloneable;	// will be the aggregate's XCloneable
47cdf0e10cSrcweir 		Reference< XAggregation > xAggregateClone;		// will be the aggregate's clone
48cdf0e10cSrcweir 
49cdf0e10cSrcweir 		if ( query_aggregation( _pOriginal->m_xAggregate, xAggregateCloneable ) )
50cdf0e10cSrcweir 		{
51cdf0e10cSrcweir 			xAggregateClone = xAggregateClone.query( xAggregateCloneable->createClone() );
52cdf0e10cSrcweir 			DBG_ASSERT( xAggregateClone.is(), "OCloneableAggregation::createAggregateClone: invalid clone returned by the aggregate!" );
53cdf0e10cSrcweir 		}
54cdf0e10cSrcweir 		else {
55cdf0e10cSrcweir 			DBG_ASSERT( !_pOriginal->m_xAggregate.is(), "OCloneableAggregation::createAggregateClone: aggregate is not cloneable!" );
56cdf0e10cSrcweir         }
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 		return xAggregateClone;
59cdf0e10cSrcweir 	}
60cdf0e10cSrcweir 
61cdf0e10cSrcweir //.........................................................................
62cdf0e10cSrcweir }	// namespace frm
63cdf0e10cSrcweir //.........................................................................
64cdf0e10cSrcweir 
65