1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 #ifndef INCLUDED_UUI_GETCONTINUATIONS_HXX
25 #define INCLUDED_UUI_GETCONTINUATIONS_HXX
26
27 #include "com/sun/star/uno/Reference.hxx"
28 #include "com/sun/star/uno/Sequence.hxx"
29
30 namespace com { namespace sun { namespace star {
31 namespace task {
32 class XInteractionContinuation;
33 }
34 } } }
35
36 template< class t1 >
setContinuation(com::sun::star::uno::Reference<com::sun::star::task::XInteractionContinuation> const & rContinuation,com::sun::star::uno::Reference<t1> * pContinuation)37 bool setContinuation(
38 com::sun::star::uno::Reference<
39 com::sun::star::task::XInteractionContinuation > const & rContinuation,
40 com::sun::star::uno::Reference< t1 > * pContinuation)
41 {
42 if (pContinuation && !pContinuation->is())
43 {
44 pContinuation->set(rContinuation, com::sun::star::uno::UNO_QUERY);
45 if (pContinuation->is())
46 return true;
47 }
48 return false;
49 }
50
51 template< class t1, class t2 >
getContinuations(com::sun::star::uno::Sequence<com::sun::star::uno::Reference<com::sun::star::task::XInteractionContinuation>> const & rContinuations,com::sun::star::uno::Reference<t1> * pContinuation1,com::sun::star::uno::Reference<t2> * pContinuation2)52 void getContinuations(
53 com::sun::star::uno::Sequence<
54 com::sun::star::uno::Reference<
55 com::sun::star::task::XInteractionContinuation > > const &
56 rContinuations,
57 com::sun::star::uno::Reference< t1 > * pContinuation1,
58 com::sun::star::uno::Reference< t2 > * pContinuation2)
59 {
60 for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
61 {
62 if (setContinuation(rContinuations[i], pContinuation1))
63 continue;
64 if (setContinuation(rContinuations[i], pContinuation2))
65 continue;
66 }
67 }
68
69 template< class t1, class t2, class t3 >
getContinuations(com::sun::star::uno::Sequence<com::sun::star::uno::Reference<com::sun::star::task::XInteractionContinuation>> const & rContinuations,com::sun::star::uno::Reference<t1> * pContinuation1,com::sun::star::uno::Reference<t2> * pContinuation2,com::sun::star::uno::Reference<t3> * pContinuation3)70 void getContinuations(
71 com::sun::star::uno::Sequence<
72 com::sun::star::uno::Reference<
73 com::sun::star::task::XInteractionContinuation > > const &
74 rContinuations,
75 com::sun::star::uno::Reference< t1 > * pContinuation1,
76 com::sun::star::uno::Reference< t2 > * pContinuation2,
77 com::sun::star::uno::Reference< t3 > * pContinuation3)
78 {
79 for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
80 {
81 if (setContinuation(rContinuations[i], pContinuation1))
82 continue;
83 if (setContinuation(rContinuations[i], pContinuation2))
84 continue;
85 if (setContinuation(rContinuations[i], pContinuation3))
86 continue;
87 }
88 }
89
90 template< class t1, class t2, class t3, class t4 >
getContinuations(com::sun::star::uno::Sequence<com::sun::star::uno::Reference<com::sun::star::task::XInteractionContinuation>> const & rContinuations,com::sun::star::uno::Reference<t1> * pContinuation1,com::sun::star::uno::Reference<t2> * pContinuation2,com::sun::star::uno::Reference<t3> * pContinuation3,com::sun::star::uno::Reference<t4> * pContinuation4)91 void getContinuations(
92 com::sun::star::uno::Sequence<
93 com::sun::star::uno::Reference<
94 com::sun::star::task::XInteractionContinuation > > const &
95 rContinuations,
96 com::sun::star::uno::Reference< t1 > * pContinuation1,
97 com::sun::star::uno::Reference< t2 > * pContinuation2,
98 com::sun::star::uno::Reference< t3 > * pContinuation3,
99 com::sun::star::uno::Reference< t4 > * pContinuation4)
100 {
101 for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
102 {
103 if (setContinuation(rContinuations[i], pContinuation1))
104 continue;
105 if (setContinuation(rContinuations[i], pContinuation2))
106 continue;
107 if (setContinuation(rContinuations[i], pContinuation3))
108 continue;
109 if (setContinuation(rContinuations[i], pContinuation4))
110 continue;
111 }
112 }
113
114 #endif /* INCLUDED_UUI_GETCONTINUATIONS_HXX */
115