1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
|
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Sun Microsystems, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*************************************************************************/
/*
This example shows a UNO component that inherits com.sun.star.lib.uno.helper.PropertySet in
order to provide implementations of these interfaces:
com.sun.star.beans.XPropertySet
com.sun.star.beans.XMultiPropertySet
com.sun.star.beans.XFastPropertySet
com.sun.star.lang.XComponent
com.sun.star.uno.XWeak
com.sun.star.lang.XTypeProvider
*/
import com.sun.star.lib.uno.helper.PropertySet;
import com.sun.star.comp.loader.FactoryHelper;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.registry.XRegistryKey;
import com.sun.star.uno.Any;
import com.sun.star.uno.Type;
import com.sun.star.uno.XInterface;
import com.sun.star.lang.XTypeProvider;
import com.sun.star.beans.PropertyAttribute;
/**
This component contains the following properties:
* <table border>
* <tr>
* <th> Property Name </th>
* <th> Type Name </th>
* <th> PropertyAttribute </th>
* <tr><td>boolA</td><td>BOOLEAN</td><td> - </td</tr>
* <tr><td>charA</td><td>CHAR</td><td> - </td></tr>
* <tr><td>byteA</td><td>BYTE</td><td> - </td></tr>
* <tr><td>shortA</td><td>SHORT</td><td> - </td></tr>
* <tr><td>intA</td><td>LONG</td><td> - </td></tr>
* <tr><td>longA</td><td>HYPER</td><td> - </td></tr>
* <tr><td>floatA</td><td>FLOAT</td><td> - </td></tr>
* <tr><td>doubleA</td><td>DOUBLE</td><td> - </td></tr>
* <tr><td>stringA</td><td>STRING</td><td> - </td></tr>
* <tr><td>objectA</td><td>ANY</td><td> - </td></tr>
* <tr><td>anyA</td><td>ANY</td><td> - </td></tr>
* <tr><td>typeA</td><td>TYPE</td><td> - </td></tr>
* <tr><td>xinterfaceA</td><td>INTERFACE</td><td> - </td></tr>
* <tr><td>xtypeproviderA</td><td>INTERFACE</td><td> - </td></tr>
* <tr><td>arBoolA</td><td>[]boolean</td><td> - </td></tr>
* <tr><td>arCharA</td><td>[]char</td><td> - </td></tr>
* <tr><td>arByteA</td><td>[]byte</td><td> - </td></tr>
* <tr><td>arShortA</td><td>[]short</td><td> - </td></tr>
* <tr><td>arIntA</td><td>[]long</td><td> - </td></tr>
* <tr><td>arLongA</td><td>[]hyper</td><td> - </td></tr>
* <tr><td>arFloatA</td><td>[]float</td><td> - </td></tr>
* <tr><td>arDoubleA</td><td>[]double</td><td> - </td></tr>
* <tr><td>arStringA</td><td>[]string</td><td> - </td></tr>
* <tr><td>arObjectA</td><td>[]any</td><td> - </td></tr>
* <tr><td>arXinterfaceA</td><td>[]com.sun.star.uno.XInterface</td><td> - </td></tr>
* <tr><td>ar2BoolA</td><td>[][]boolean</td><td> - </td></tr>
* <tr><td>boolClassA</td><td>boolean</td><td> - </td></tr>
* <tr><td>charClassA</td><td>char</td><td> - </td></tr>
* <tr><td>byteClassA</td><td>byte</td><td> - </td></tr>
* <tr><td>shortClassA</td><td>short</td><td> - </td></tr>
* <tr><td>intClassA</td><td>long</td><td> - </td></tr>
* <tr><td>longClassA</td><td>hyper</td><td> - </td></tr>
* <tr><td>floatClassA</td><td>float</td><td> - </td></tr>
* <tr><td>doubleClassA</td><td>double</td><td> - </td></tr>
* <tr><td>roIntA</td><td>long</td><td>READONLY</td></tr>
* <tr><td>roIntClassA</td><td>long</td><td>READONLY</td></tr>
* <tr><td>roObjectA</td><td>any</td><td>READONLY</td></tr>
* <tr><td>roAnyA</td><td>any</td><td>READONLY</td></tr>
* <tr><td>bcBoolA</td><td>boolean</td><td>BOUND,CONSTRAINED</td></tr>
* <tr><td>bcBoolClassA</td><td>boolean</td><td>BOUND,CONSTRAINED</td></tr>
* <tr><td>bcObjectA</td><td>any</td><td>BOUND,CONSTRAINED</td></tr>
* <tr><td>bcAnyA</td><td>any</td><td>BOUND,CONSTRAINED</td></tr>
* <tr><td>mvIntA</td><td>long</td><td>MAYBEVOID</td></tr>
* <tr><td>mvObjectA</td><td>any</td><td>MAYBEVOID</td></tr>
* <tr><td>mvAnyA</td><td>any</td><td>MAYBEVOID</td></tr>
* <tr><td>mvXinterfaceA</td><td>any</td><td>MAYBEVOID</td></tr>
</table>
*/
public class PropTest extends PropertySet implements XServiceInfo
{
public boolean boolA;
public char charA;
public byte byteA;
public short shortA;
public int intA;
public long longA;
public float floatA;
public double doubleA;
public String stringA; // MAYBEVOID
public Object objectA; // MAYBEVOID
public Any anyA; // MAYBEVOID
public Type typeA;// MAYBEVOID
public XInterface xinterfaceA;// MAYBEVOID
public XTypeProvider xtypeproviderA;// MAYBEVOID
public boolean[] arBoolA; // MAYBEVOID
public char[] arCharA; // MAYBEVOID
public byte[] arByteA; // MAYBEVOID
public short[] arShortA; // MAYBEVOID
public int[] arIntA; // MAYBEVOID
public long[] arLongA; // MAYBEVOID
public float[] arFloatA; // MAYBEVOID
public double[] arDoubleA; // MAYBEVOID
public String[] arStringA; // MAYBEVOID
public Object[] arObjectA; // MAYBEVOID
public Any[] arAnyA; // MAYBEVOID
public XInterface[] arXinterfaceA; // MAYBEVOID
public boolean[][] ar2BoolA; // MAYBEVOID
public Boolean boolClassA; // MAYBEVOID
public Character charClassA; // MAYBEVOID
public Byte byteClassA; // MAYBEVOID
public Short shortClassA; // MAYBEVOID
public Integer intClassA; // MAYBEVOID
public Long longClassA; // MAYBEVOID
public Float floatClassA; // MAYBEVOID
public Double doubleClassA; // MAYBEVOID
// readonly
public int roIntA= 100;
public Integer roIntClassA= Integer.valueOf(100);
public Object roObjectA= Integer.valueOf(101);
public Any roAnyA= new Any( new Type(int.class), Integer.valueOf(102));
// BOUND & CONSTRAINED
public boolean bcBoolA;
public Boolean bcBoolClassA; // MAYBEVOID
public Object bcObjectA; // MAYBEVOID
public Any bcAnyA; // MAYBEVOID
// MAYBEVOID
public Integer mvIntA;
public Object mvObjectA;
public Any mvAnyA;
public XInterface mvXinterfaceA;
public static final String __serviceName="PropTest";
public PropTest() {
registerProperty("boolA", (short) 0);
registerProperty("charA", (short) 0);
registerProperty("byteA", (short) 0);
registerProperty("shortA", (short) 0);
registerProperty("intA", (short) 0);
registerProperty("longA", (short) 0);
registerProperty("floatA", (short) 0);
registerProperty("doubleA", (short) 0);
registerProperty("stringA", PropertyAttribute.MAYBEVOID);
registerProperty("objectA", PropertyAttribute.MAYBEVOID);
registerProperty("anyA", PropertyAttribute.MAYBEVOID);
registerProperty("typeA", PropertyAttribute.MAYBEVOID);
registerProperty("xinterfaceA", PropertyAttribute.MAYBEVOID);
registerProperty("xtypeproviderA", PropertyAttribute.MAYBEVOID);
registerProperty("arBoolA", PropertyAttribute.MAYBEVOID);
registerProperty("arCharA", PropertyAttribute.MAYBEVOID);
registerProperty("arByteA", PropertyAttribute.MAYBEVOID);
registerProperty("arShortA", PropertyAttribute.MAYBEVOID);
registerProperty("arIntA", PropertyAttribute.MAYBEVOID);
registerProperty("arLongA", PropertyAttribute.MAYBEVOID);
registerProperty("arFloatA", PropertyAttribute.MAYBEVOID);
registerProperty("arDoubleA", PropertyAttribute.MAYBEVOID);
registerProperty("arStringA", PropertyAttribute.MAYBEVOID);
registerProperty("arObjectA", PropertyAttribute.MAYBEVOID);
registerProperty("arAnyA", PropertyAttribute.MAYBEVOID);
registerProperty("arXinterfaceA", PropertyAttribute.MAYBEVOID);
registerProperty("ar2BoolA", PropertyAttribute.MAYBEVOID);
registerProperty("boolClassA", PropertyAttribute.MAYBEVOID);
registerProperty("charClassA", PropertyAttribute.MAYBEVOID);
registerProperty("byteClassA", PropertyAttribute.MAYBEVOID);
registerProperty("shortClassA", PropertyAttribute.MAYBEVOID);
registerProperty("intClassA", PropertyAttribute.MAYBEVOID);
registerProperty("longClassA", PropertyAttribute.MAYBEVOID);
registerProperty("floatClassA", PropertyAttribute.MAYBEVOID);
registerProperty("doubleClassA", PropertyAttribute.MAYBEVOID);
registerProperty("roIntA", PropertyAttribute.READONLY);
registerProperty("roIntClassA", PropertyAttribute.READONLY);
registerProperty("roObjectA", PropertyAttribute.READONLY);
registerProperty("roAnyA", PropertyAttribute.READONLY);
registerProperty("bcBoolA",(short) ( PropertyAttribute.BOUND | PropertyAttribute.CONSTRAINED));
registerProperty("bcBoolClassA", (short) (PropertyAttribute.BOUND | PropertyAttribute.CONSTRAINED | PropertyAttribute.MAYBEVOID));
registerProperty("bcObjectA", (short) (PropertyAttribute.BOUND | PropertyAttribute.CONSTRAINED | PropertyAttribute.MAYBEVOID));
registerProperty("bcAnyA", (short) (PropertyAttribute.BOUND | PropertyAttribute.CONSTRAINED |PropertyAttribute.MAYBEVOID));
registerProperty("mvIntA", PropertyAttribute.MAYBEVOID);
registerProperty("mvObjectA", PropertyAttribute.MAYBEVOID);
registerProperty("mvAnyA", PropertyAttribute.MAYBEVOID);
registerProperty("mvXinterfaceA", PropertyAttribute.MAYBEVOID);
}
// XServiceName
public String getImplementationName( )
{
return getClass().getName();
}
// XServiceName
public boolean supportsService( /*IN*/String name )
{
if (name.equals(__serviceName))
return true;
return false;
}
//XServiceName
public String[] getSupportedServiceNames( )
{
String[] retValue= new String[]{__serviceName};
return retValue;
}
public static XSingleServiceFactory __getServiceFactory(String implName,
XMultiServiceFactory multiFactory,
XRegistryKey regKey)
{
XSingleServiceFactory xSingleServiceFactory = null;
if (implName.equals( PropTest.class.getName()) )
xSingleServiceFactory = FactoryHelper.getServiceFactory( PropTest.class,
PropTest.__serviceName,
multiFactory,
regKey);
return xSingleServiceFactory;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|