Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / uui / source / getcontinuations.hxx
blob81bef0e23f64bc3895da2c0129f6a84b78b9ddc2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_UUI_GETCONTINUATIONS_HXX
21 #define INCLUDED_UUI_GETCONTINUATIONS_HXX
23 #include "com/sun/star/uno/Reference.hxx"
24 #include "com/sun/star/uno/Sequence.hxx"
26 namespace com { namespace sun { namespace star {
27 namespace task {
28 class XInteractionContinuation;
30 } } }
32 template< class t1 >
33 bool setContinuation(
34 com::sun::star::uno::Reference<
35 com::sun::star::task::XInteractionContinuation > const & rContinuation,
36 com::sun::star::uno::Reference< t1 > * pContinuation)
38 if (pContinuation && !pContinuation->is())
40 pContinuation->set(rContinuation, com::sun::star::uno::UNO_QUERY);
41 if (pContinuation->is())
42 return true;
44 return false;
47 template< class t1, class t2 >
48 void getContinuations(
49 com::sun::star::uno::Sequence<
50 com::sun::star::uno::Reference<
51 com::sun::star::task::XInteractionContinuation > > const &
52 rContinuations,
53 com::sun::star::uno::Reference< t1 > * pContinuation1,
54 com::sun::star::uno::Reference< t2 > * pContinuation2)
56 for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
58 if (setContinuation(rContinuations[i], pContinuation1))
59 continue;
60 if (setContinuation(rContinuations[i], pContinuation2))
61 continue;
65 template< class t1, class t2, class t3 >
66 void getContinuations(
67 com::sun::star::uno::Sequence<
68 com::sun::star::uno::Reference<
69 com::sun::star::task::XInteractionContinuation > > const &
70 rContinuations,
71 com::sun::star::uno::Reference< t1 > * pContinuation1,
72 com::sun::star::uno::Reference< t2 > * pContinuation2,
73 com::sun::star::uno::Reference< t3 > * pContinuation3)
75 for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
77 if (setContinuation(rContinuations[i], pContinuation1))
78 continue;
79 if (setContinuation(rContinuations[i], pContinuation2))
80 continue;
81 if (setContinuation(rContinuations[i], pContinuation3))
82 continue;
86 template< class t1, class t2, class t3, class t4 >
87 void getContinuations(
88 com::sun::star::uno::Sequence<
89 com::sun::star::uno::Reference<
90 com::sun::star::task::XInteractionContinuation > > const &
91 rContinuations,
92 com::sun::star::uno::Reference< t1 > * pContinuation1,
93 com::sun::star::uno::Reference< t2 > * pContinuation2,
94 com::sun::star::uno::Reference< t3 > * pContinuation3,
95 com::sun::star::uno::Reference< t4 > * pContinuation4)
97 for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
99 if (setContinuation(rContinuations[i], pContinuation1))
100 continue;
101 if (setContinuation(rContinuations[i], pContinuation2))
102 continue;
103 if (setContinuation(rContinuations[i], pContinuation3))
104 continue;
105 if (setContinuation(rContinuations[i], pContinuation4))
106 continue;
110 #endif /* INCLUDED_UUI_GETCONTINUATIONS_HXX */
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */