merged tag ooo/DEV300_m102
[LibreOffice.git] / uui / source / getcontinuations.hxx
blob650bb50bedfbbedbfdcd6c892110a3438cc56569
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef INCLUDED_UUI_GETCONTINUATIONS_HXX
29 #define INCLUDED_UUI_GETCONTINUATIONS_HXX
31 #include "com/sun/star/uno/Reference.hxx"
32 #include "com/sun/star/uno/Sequence.hxx"
34 namespace com { namespace sun { namespace star {
35 namespace task {
36 class XInteractionContinuation;
38 } } }
40 template< class t1 >
41 bool setContinuation(
42 com::sun::star::uno::Reference<
43 com::sun::star::task::XInteractionContinuation > const & rContinuation,
44 com::sun::star::uno::Reference< t1 > * pContinuation)
46 if (pContinuation && !pContinuation->is())
48 pContinuation->set(rContinuation, com::sun::star::uno::UNO_QUERY);
49 if (pContinuation->is())
50 return true;
52 return false;
55 template< class t1, class t2 >
56 void getContinuations(
57 com::sun::star::uno::Sequence<
58 com::sun::star::uno::Reference<
59 com::sun::star::task::XInteractionContinuation > > const &
60 rContinuations,
61 com::sun::star::uno::Reference< t1 > * pContinuation1,
62 com::sun::star::uno::Reference< t2 > * pContinuation2)
64 for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
66 if (setContinuation(rContinuations[i], pContinuation1))
67 continue;
68 if (setContinuation(rContinuations[i], pContinuation2))
69 continue;
73 template< class t1, class t2, class t3 >
74 void getContinuations(
75 com::sun::star::uno::Sequence<
76 com::sun::star::uno::Reference<
77 com::sun::star::task::XInteractionContinuation > > const &
78 rContinuations,
79 com::sun::star::uno::Reference< t1 > * pContinuation1,
80 com::sun::star::uno::Reference< t2 > * pContinuation2,
81 com::sun::star::uno::Reference< t3 > * pContinuation3)
83 for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
85 if (setContinuation(rContinuations[i], pContinuation1))
86 continue;
87 if (setContinuation(rContinuations[i], pContinuation2))
88 continue;
89 if (setContinuation(rContinuations[i], pContinuation3))
90 continue;
94 template< class t1, class t2, class t3, class t4 >
95 void getContinuations(
96 com::sun::star::uno::Sequence<
97 com::sun::star::uno::Reference<
98 com::sun::star::task::XInteractionContinuation > > const &
99 rContinuations,
100 com::sun::star::uno::Reference< t1 > * pContinuation1,
101 com::sun::star::uno::Reference< t2 > * pContinuation2,
102 com::sun::star::uno::Reference< t3 > * pContinuation3,
103 com::sun::star::uno::Reference< t4 > * pContinuation4)
105 for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
107 if (setContinuation(rContinuations[i], pContinuation1))
108 continue;
109 if (setContinuation(rContinuations[i], pContinuation2))
110 continue;
111 if (setContinuation(rContinuations[i], pContinuation3))
112 continue;
113 if (setContinuation(rContinuations[i], pContinuation4))
114 continue;
118 #endif /* INCLUDED_UUI_GETCONTINUATIONS_HXX */