Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / uui / source / getcontinuations.hxx
blob8175b002b974f65a6064d9f813f99ea8dd1f010b
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_SOURCE_GETCONTINUATIONS_HXX
21 #define INCLUDED_UUI_SOURCE_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 css::uno::Reference< css::task::XInteractionContinuation > const & rContinuation,
35 css::uno::Reference< t1 > * pContinuation)
37 if (pContinuation && !pContinuation->is())
39 pContinuation->set(rContinuation, css::uno::UNO_QUERY);
40 if (pContinuation->is())
41 return true;
43 return false;
46 template< class t1, class t2 >
47 void getContinuations(
48 css::uno::Sequence<
49 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations,
50 css::uno::Reference< t1 > * pContinuation1,
51 css::uno::Reference< t2 > * pContinuation2)
53 for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
55 if (setContinuation(rContinuations[i], pContinuation1))
56 continue;
57 if (setContinuation(rContinuations[i], pContinuation2))
58 continue;
62 template< class t1, class t2, class t3 >
63 void getContinuations(
64 css::uno::Sequence<
65 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations,
66 css::uno::Reference< t1 > * pContinuation1,
67 css::uno::Reference< t2 > * pContinuation2,
68 css::uno::Reference< t3 > * pContinuation3)
70 for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
72 if (setContinuation(rContinuations[i], pContinuation1))
73 continue;
74 if (setContinuation(rContinuations[i], pContinuation2))
75 continue;
76 if (setContinuation(rContinuations[i], pContinuation3))
77 continue;
81 template< class t1, class t2, class t3, class t4 >
82 void getContinuations(
83 css::uno::Sequence<
84 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations,
85 css::uno::Reference< t1 > * pContinuation1,
86 css::uno::Reference< t2 > * pContinuation2,
87 css::uno::Reference< t3 > * pContinuation3,
88 css::uno::Reference< t4 > * pContinuation4)
90 for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
92 if (setContinuation(rContinuations[i], pContinuation1))
93 continue;
94 if (setContinuation(rContinuations[i], pContinuation2))
95 continue;
96 if (setContinuation(rContinuations[i], pContinuation3))
97 continue;
98 if (setContinuation(rContinuations[i], pContinuation4))
99 continue;
103 #endif // INCLUDED_UUI_SOURCE_GETCONTINUATIONS_HXX
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */