lok: avoid expensive fetching of a property.
[LibreOffice.git] / include / ucbhelper / macros.hxx
blobecdbeef7007e2148d66677e298115a58b981efdf
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_UCBHELPER_MACROS_HXX
21 #define INCLUDED_UCBHELPER_MACROS_HXX
23 #include <sal/types.h>
24 #include <cppuhelper/factory.hxx>
25 #include <cppuhelper/supportsservice.hxx>
26 #include <cppuhelper/typeprovider.hxx>
28 #define CPPU_TYPE( T ) cppu::UnoType<T>::get()
29 #define CPPU_TYPE_REF( T ) CPPU_TYPE( T )
31 // XTypeProvider impl. internals
34 #define XTYPEPROVIDER_COMMON_IMPL( Class ) \
35 css::uno::Sequence< sal_Int8 > SAL_CALL \
36 Class::getImplementationId() \
37 { \
38 return css::uno::Sequence<sal_Int8>(); \
41 #define GETTYPES_IMPL_START( Class ) \
42 css::uno::Sequence< css::uno::Type > SAL_CALL \
43 Class::getTypes() \
44 { \
45 static cppu::OTypeCollection collection(
48 #define GETTYPES_IMPL_END \
49 ); \
51 return collection.getTypes(); \
55 // XTypeProvider impl.
58 // 2 interfaces supported
59 #define XTYPEPROVIDER_IMPL_2( Class, I1,I2 ) \
60 XTYPEPROVIDER_COMMON_IMPL( Class ) \
61 GETTYPES_IMPL_START( Class ) \
62 CPPU_TYPE_REF( I1 ), \
63 CPPU_TYPE_REF( I2 ) \
64 GETTYPES_IMPL_END
66 // 3 interfaces supported
67 #define XTYPEPROVIDER_IMPL_3( Class, I1,I2,I3 ) \
68 XTYPEPROVIDER_COMMON_IMPL( Class ) \
69 GETTYPES_IMPL_START( Class ) \
70 CPPU_TYPE_REF( I1 ), \
71 CPPU_TYPE_REF( I2 ), \
72 CPPU_TYPE_REF( I3 ) \
73 GETTYPES_IMPL_END
75 // 4 interfaces supported
76 #define XTYPEPROVIDER_IMPL_4( Class, I1,I2,I3,I4 ) \
77 XTYPEPROVIDER_COMMON_IMPL( Class ) \
78 GETTYPES_IMPL_START( Class ) \
79 CPPU_TYPE_REF( I1 ), \
80 CPPU_TYPE_REF( I2 ), \
81 CPPU_TYPE_REF( I3 ), \
82 CPPU_TYPE_REF( I4 ) \
83 GETTYPES_IMPL_END
85 // 5 interfaces supported
86 #define XTYPEPROVIDER_IMPL_5( Class, I1,I2,I3,I4,I5 ) \
87 XTYPEPROVIDER_COMMON_IMPL( Class ) \
88 GETTYPES_IMPL_START( Class ) \
89 CPPU_TYPE_REF( I1 ), \
90 CPPU_TYPE_REF( I2 ), \
91 CPPU_TYPE_REF( I3 ), \
92 CPPU_TYPE_REF( I4 ), \
93 CPPU_TYPE_REF( I5 ) \
94 GETTYPES_IMPL_END
96 // 9 interfaces supported
97 #define XTYPEPROVIDER_IMPL_9( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9 ) \
98 XTYPEPROVIDER_COMMON_IMPL( Class ) \
99 GETTYPES_IMPL_START( Class ) \
100 CPPU_TYPE_REF( I1 ), \
101 CPPU_TYPE_REF( I2 ), \
102 CPPU_TYPE_REF( I3 ), \
103 CPPU_TYPE_REF( I4 ), \
104 CPPU_TYPE_REF( I5 ), \
105 CPPU_TYPE_REF( I6 ), \
106 CPPU_TYPE_REF( I7 ), \
107 CPPU_TYPE_REF( I8 ), \
108 CPPU_TYPE_REF( I9 ) \
109 GETTYPES_IMPL_END
111 // 10 interfaces supported
112 #define XTYPEPROVIDER_IMPL_10( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10 ) \
113 XTYPEPROVIDER_COMMON_IMPL( Class ) \
114 GETTYPES_IMPL_START( Class ) \
115 CPPU_TYPE_REF( I1 ), \
116 CPPU_TYPE_REF( I2 ), \
117 CPPU_TYPE_REF( I3 ), \
118 CPPU_TYPE_REF( I4 ), \
119 CPPU_TYPE_REF( I5 ), \
120 CPPU_TYPE_REF( I6 ), \
121 CPPU_TYPE_REF( I7 ), \
122 CPPU_TYPE_REF( I8 ), \
123 CPPU_TYPE_REF( I9 ), \
124 CPPU_TYPE_REF( I10 ) \
125 GETTYPES_IMPL_END
127 // 11 interfaces supported
128 #define XTYPEPROVIDER_IMPL_11( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11 ) \
129 XTYPEPROVIDER_COMMON_IMPL( Class ) \
130 GETTYPES_IMPL_START( Class ) \
131 CPPU_TYPE_REF( I1 ), \
132 CPPU_TYPE_REF( I2 ), \
133 CPPU_TYPE_REF( I3 ), \
134 CPPU_TYPE_REF( I4 ), \
135 CPPU_TYPE_REF( I5 ), \
136 CPPU_TYPE_REF( I6 ), \
137 CPPU_TYPE_REF( I7 ), \
138 CPPU_TYPE_REF( I8 ), \
139 CPPU_TYPE_REF( I9 ), \
140 CPPU_TYPE_REF( I10 ), \
141 CPPU_TYPE_REF( I11 ) \
142 GETTYPES_IMPL_END
144 #endif /* ! INCLUDED_UCBHELPER_MACROS_HXX */
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */