1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: componenttools.cxx,v $
10 * $Revision: 1.6.42.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_forms.hxx"
33 #include "componenttools.hxx"
35 /** === begin UNO includes === **/
36 #include <com/sun/star/container/XChild.hpp>
37 /** === end UNO includes === **/
42 //........................................................................
45 //........................................................................
47 /** === begin UNO using === **/
48 using ::com::sun::star::frame::XModel
;
49 using ::com::sun::star::uno::XInterface
;
50 using ::com::sun::star::uno::Reference
;
51 using ::com::sun::star::uno::UNO_QUERY
;
52 using ::com::sun::star::container::XChild
;
53 /** === end UNO using === **/
55 //====================================================================
57 //====================================================================
58 //--------------------------------------------------------------------
59 TypeBag::TypeBag( const TypeSequence
& _rTypes1
)
64 //--------------------------------------------------------------------
65 TypeBag::TypeBag( const TypeSequence
& _rTypes1
, const TypeSequence
& _rTypes2
)
71 //--------------------------------------------------------------------
72 TypeBag::TypeBag( const TypeSequence
& _rTypes1
, const TypeSequence
& _rTypes2
, const TypeSequence
& _rTypes3
)
79 //--------------------------------------------------------------------
80 void TypeBag::addTypes( const TypeSequence
& _rTypes
)
83 _rTypes
.getConstArray(),
84 _rTypes
.getConstArray() + _rTypes
.getLength(),
85 ::std::insert_iterator
< TypeSet
>( m_aTypes
, m_aTypes
.begin() )
89 //--------------------------------------------------------------------
90 TypeBag::TypeSequence
TypeBag::getTypes() const
92 TypeSequence
aTypes( m_aTypes
.size() );
93 ::std::copy( m_aTypes
.begin(), m_aTypes
.end(), aTypes
.getArray() );
97 //====================================================================
98 Reference
< XModel
> getXModel( const Reference
< XInterface
>& _rxComponent
)
100 Reference
< XInterface
> xParent
= _rxComponent
;
101 Reference
< XModel
> xModel( xParent
, UNO_QUERY
);;
102 while ( xParent
.is() && !xModel
.is() )
104 Reference
< XChild
> xChild( xParent
, UNO_QUERY
);
105 xParent
.set( xChild
.is() ? xChild
->getParent() : Reference
< XInterface
>(), UNO_QUERY
);
106 xModel
.set( xParent
, UNO_QUERY
);
111 //........................................................................
113 //........................................................................