Update ooo320-m1
[ooovba.git] / forms / source / inc / componenttools.hxx
blob2ac8341569379717744f53dce7e43303a70ec178
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: componenttools.hxx,v $
10 * $Revision: 1.5.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 #ifndef FORMS_SOURCE_INC_COMPONENTTOOLS_HXX
32 #define FORMS_SOURCE_INC_COMPONENTTOOLS_HXX
34 /** === begin UNO includes === **/
35 #include <com/sun/star/uno/Type.hxx>
36 #include <com/sun/star/uno/Sequence.hxx>
37 #include <com/sun/star/frame/XModel.hpp>
38 /** === end UNO includes === **/
40 #include <set>
41 #include <functional>
43 //........................................................................
44 namespace frm
46 //........................................................................
48 struct TypeCompareLess : public ::std::binary_function< ::com::sun::star::uno::Type, ::com::sun::star::uno::Type, bool >
50 private:
51 typedef ::com::sun::star::uno::Type Type;
53 public:
54 bool operator()( const Type& _rLHS, const Type& _rRHS )
56 return _rLHS.getTypeName() < _rRHS.getTypeName();
60 //====================================================================
61 //= TypeBag
62 //====================================================================
63 /** a helper class which merges sequences of <type scope="com::sun::star::uno">Type</type>s,
64 so that the resulting sequence contains every type at most once
66 class TypeBag
68 public:
69 typedef ::com::sun::star::uno::Type Type;
70 typedef ::com::sun::star::uno::Sequence< Type > TypeSequence;
71 typedef ::std::set< Type, TypeCompareLess > TypeSet;
73 private:
74 TypeSet m_aTypes;
76 public:
77 TypeBag(
78 const TypeSequence& _rTypes1
81 TypeBag(
82 const TypeSequence& _rTypes1,
83 const TypeSequence& _rTypes2
85 TypeBag(
86 const TypeSequence& _rTypes1,
87 const TypeSequence& _rTypes2,
88 const TypeSequence& _rTypes3
91 void addTypes( const TypeSequence& _rTypes );
93 /** returns the types represented by this bag
95 TypeSequence getTypes() const;
98 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getXModel(
99 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
101 //........................................................................
102 } // namespace frm
103 //........................................................................
105 #endif // FORMS_SOURCE_INC_COMPONENTTOOLS_HXX