Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef INCLUDED_UUI_GETCONTINUATIONS_HXX
21 : : #define INCLUDED_UUI_GETCONTINUATIONS_HXX
22 : :
23 : : #include "com/sun/star/uno/Reference.hxx"
24 : : #include "com/sun/star/uno/Sequence.hxx"
25 : :
26 : : namespace com { namespace sun { namespace star {
27 : : namespace task {
28 : : class XInteractionContinuation;
29 : : }
30 : : } } }
31 : :
32 : : template< class t1 >
33 : 0 : bool setContinuation(
34 : : com::sun::star::uno::Reference<
35 : : com::sun::star::task::XInteractionContinuation > const & rContinuation,
36 : : com::sun::star::uno::Reference< t1 > * pContinuation)
37 : : {
38 [ # # ][ # # ]: 0 : if (pContinuation && !pContinuation->is())
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
39 : : {
40 : 0 : pContinuation->set(rContinuation, com::sun::star::uno::UNO_QUERY);
41 [ # # # # : 0 : if (pContinuation->is())
# # # # #
# # # ]
42 : 0 : return true;
43 : : }
44 : 0 : return false;
45 : : }
46 : :
47 : : template< class t1, class t2 >
48 : 0 : 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)
55 : : {
56 [ # # ][ # # ]: 0 : for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
57 : : {
58 [ # # ][ # # ]: 0 : if (setContinuation(rContinuations[i], pContinuation1))
59 : 0 : continue;
60 [ # # ][ # # ]: 0 : if (setContinuation(rContinuations[i], pContinuation2))
61 : 0 : continue;
62 : : }
63 : 0 : }
64 : :
65 : : template< class t1, class t2, class t3 >
66 : 0 : 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)
74 : : {
75 [ # # ][ # # ]: 0 : for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
[ # # ]
76 : : {
77 [ # # ][ # # ]: 0 : if (setContinuation(rContinuations[i], pContinuation1))
[ # # ]
78 : 0 : continue;
79 [ # # ][ # # ]: 0 : if (setContinuation(rContinuations[i], pContinuation2))
[ # # ]
80 : 0 : continue;
81 [ # # ][ # # ]: 0 : if (setContinuation(rContinuations[i], pContinuation3))
[ # # ]
82 : 0 : continue;
83 : : }
84 : 0 : }
85 : :
86 : : template< class t1, class t2, class t3, class t4 >
87 : 0 : 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)
96 : : {
97 [ # # ]: 0 : for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
98 : : {
99 [ # # ]: 0 : if (setContinuation(rContinuations[i], pContinuation1))
100 : 0 : continue;
101 [ # # ]: 0 : if (setContinuation(rContinuations[i], pContinuation2))
102 : 0 : continue;
103 [ # # ]: 0 : if (setContinuation(rContinuations[i], pContinuation3))
104 : 0 : continue;
105 [ # # ]: 0 : if (setContinuation(rContinuations[i], pContinuation4))
106 : 0 : continue;
107 : : }
108 : 0 : }
109 : :
110 : : #endif /* INCLUDED_UUI_GETCONTINUATIONS_HXX */
111 : :
112 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|