Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / uui / source / getcontinuations.hxx
blob2b0df1a39582003454efe29f95a10823321db8e2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef INCLUDED_UUI_GETCONTINUATIONS_HXX
30 #define INCLUDED_UUI_GETCONTINUATIONS_HXX
32 #include "com/sun/star/uno/Reference.hxx"
33 #include "com/sun/star/uno/Sequence.hxx"
35 namespace com { namespace sun { namespace star {
36 namespace task {
37 class XInteractionContinuation;
39 } } }
41 template< class t1 >
42 bool setContinuation(
43 com::sun::star::uno::Reference<
44 com::sun::star::task::XInteractionContinuation > const & rContinuation,
45 com::sun::star::uno::Reference< t1 > * pContinuation)
47 if (pContinuation && !pContinuation->is())
49 pContinuation->set(rContinuation, com::sun::star::uno::UNO_QUERY);
50 if (pContinuation->is())
51 return true;
53 return false;
56 template< class t1, class t2 >
57 void getContinuations(
58 com::sun::star::uno::Sequence<
59 com::sun::star::uno::Reference<
60 com::sun::star::task::XInteractionContinuation > > const &
61 rContinuations,
62 com::sun::star::uno::Reference< t1 > * pContinuation1,
63 com::sun::star::uno::Reference< t2 > * pContinuation2)
65 for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
67 if (setContinuation(rContinuations[i], pContinuation1))
68 continue;
69 if (setContinuation(rContinuations[i], pContinuation2))
70 continue;
74 template< class t1, class t2, class t3 >
75 void getContinuations(
76 com::sun::star::uno::Sequence<
77 com::sun::star::uno::Reference<
78 com::sun::star::task::XInteractionContinuation > > const &
79 rContinuations,
80 com::sun::star::uno::Reference< t1 > * pContinuation1,
81 com::sun::star::uno::Reference< t2 > * pContinuation2,
82 com::sun::star::uno::Reference< t3 > * pContinuation3)
84 for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
86 if (setContinuation(rContinuations[i], pContinuation1))
87 continue;
88 if (setContinuation(rContinuations[i], pContinuation2))
89 continue;
90 if (setContinuation(rContinuations[i], pContinuation3))
91 continue;
95 template< class t1, class t2, class t3, class t4 >
96 void getContinuations(
97 com::sun::star::uno::Sequence<
98 com::sun::star::uno::Reference<
99 com::sun::star::task::XInteractionContinuation > > const &
100 rContinuations,
101 com::sun::star::uno::Reference< t1 > * pContinuation1,
102 com::sun::star::uno::Reference< t2 > * pContinuation2,
103 com::sun::star::uno::Reference< t3 > * pContinuation3,
104 com::sun::star::uno::Reference< t4 > * pContinuation4)
106 for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
108 if (setContinuation(rContinuations[i], pContinuation1))
109 continue;
110 if (setContinuation(rContinuations[i], pContinuation2))
111 continue;
112 if (setContinuation(rContinuations[i], pContinuation3))
113 continue;
114 if (setContinuation(rContinuations[i], pContinuation4))
115 continue;
119 #endif /* INCLUDED_UUI_GETCONTINUATIONS_HXX */
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */