summaryrefslogtreecommitdiff
path: root/extensions/test/ole/AxTestComponents/Basic.h
blob: 004ec2f4600387ebc950744e08f2aea133bf5528 (plain)
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
263
264
265
266
267
268
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 * 
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/
// Basic.h : Declaration of the CBasic

#ifndef __BASIC_H_
#define __BASIC_H_

#include "resource.h"       // main symbols
#import  "AxTestComponents.tlb" no_namespace no_implementation raw_interfaces_only named_guids

/////////////////////////////////////////////////////////////////////////////
// CBasic
class ATL_NO_VTABLE CBasic : 
    public CComObjectRootEx<CComSingleThreadModel>,
    public CComCoClass<CBasic, &CLSID_Basic>,
    public IDispatchImpl<IBasic, &IID_IBasic, &LIBID_AXTESTCOMPONENTSLib>
    {
public:
    CBasic();
    ~CBasic();

    DECLARE_REGISTRY_RESOURCEID(IDR_BASIC)

    DECLARE_PROTECT_FINAL_CONSTRUCT()

    BEGIN_COM_MAP(CBasic)
        COM_INTERFACE_ENTRY(IBasic)
        COM_INTERFACE_ENTRY(IDispatch)
    END_COM_MAP()

    // IBasic
public:  
    STDMETHOD(outMore)(/*[out]*/long* val1, /*[out]*/long* val2);
    STDMETHOD(inMulDimArrayByte2)(LPSAFEARRAY val);
    STDMETHOD(inMulDimArrayByte)(LPSAFEARRAY val);
    STDMETHOD(inMulDimArrayVariant2)(LPSAFEARRAY val);
    STDMETHOD(inMulDimArrayLong2)(LPSAFEARRAY val);
    STDMETHOD(inMulDimArrayVariant)(LPSAFEARRAY val);
    STDMETHOD(inMulDimArrayLong)( LPSAFEARRAY val);
    STDMETHOD(inoutSequenceObject)(LPSAFEARRAY* val);
    STDMETHOD(inoutSequenceDouble)(LPSAFEARRAY * val);
    STDMETHOD(inoutSequenceFloat)(LPSAFEARRAY * val);
    STDMETHOD(inoutSequenceString)(LPSAFEARRAY* val);
    STDMETHOD(inoutSequenceLong)(LPSAFEARRAY * val);
    STDMETHOD(inoutSequenceShort)(LPSAFEARRAY * val);
    STDMETHOD(inoutSequenceByte)(LPSAFEARRAY * val);
    STDMETHOD(outSequenceObject)(/*[out]*/ LPSAFEARRAY* val);
    STDMETHOD(outSequenceDouble)(/*[out]*/ LPSAFEARRAY* val);
    STDMETHOD(outSequenceFloat)(/*[out]*/ LPSAFEARRAY* val);
    STDMETHOD(outSequenceString)(/*[out]*/ LPSAFEARRAY* val);
    STDMETHOD(outSequenceLong)(/*[out]*/ LPSAFEARRAY* val);
    STDMETHOD(outSequenceShort)(/*[out]*/ LPSAFEARRAY* val);
    STDMETHOD(outSequenceByte)(/*[out]*/ LPSAFEARRAY* val);
    STDMETHOD(inSequenceObject)(LPSAFEARRAY ar);
    STDMETHOD(inSequenceDouble)(LPSAFEARRAY ar);
    STDMETHOD(inSequenceFloat)(LPSAFEARRAY ar);
    STDMETHOD(inSequenceString)(LPSAFEARRAY ar);
    STDMETHOD(inSequenceShort)(LPSAFEARRAY ar);
    STDMETHOD(inSequenceByte)(LPSAFEARRAY ar);
    STDMETHOD(inSequenceLong)(LPSAFEARRAY  ar);
    STDMETHOD(mixed1)( 
        /* [out][in] */ unsigned char *aChar,
        /* [out][in] */ float *aFloat,
        /* [out][in] */ VARIANT *aVar);
        STDMETHOD(get_prpObject)(/*[out, retval]*/ IDispatch* *pVal);
    STDMETHOD(put_prpObject)(/*[in]*/ IDispatch* newVal);
    STDMETHOD(get_prpArray)(/*[out, retval]*/ LPSAFEARRAY *pVal);
    STDMETHOD(put_prpArray)(/*[in]*/ LPSAFEARRAY newVal);
    STDMETHOD(get_prpVariant)(/*[out, retval]*/ VARIANT *pVal);
    STDMETHOD(put_prpVariant)(/*[in]*/ VARIANT newVal);
    STDMETHOD(get_prpDouble)(/*[out, retval]*/ double *pVal);
    STDMETHOD(put_prpDouble)(/*[in]*/ double newVal);
    STDMETHOD(get_prpFloat)(/*[out, retval]*/ float *pVal);
    STDMETHOD(put_prpFloat)(/*[in]*/ float newVal);
    STDMETHOD(get_prpString)(/*[out, retval]*/ BSTR *pVal);
    STDMETHOD(put_prpString)(/*[in]*/ BSTR newVal);
    STDMETHOD(get_prpLong)(/*[out, retval]*/ long *pVal);
    STDMETHOD(put_prpLong)(/*[in]*/ long newVal);
    STDMETHOD(get_prpShort)(/*[out, retval]*/ short *pVal);
    STDMETHOD(put_prpShort)(/*[in]*/ short newVal);
    STDMETHOD(get_prpByte)(/*[out, retval]*/ unsigned char *pVal);
    STDMETHOD(put_prpByte)(/*[in]*/ unsigned char newVal);
    STDMETHOD(get_prpBool)(/*[out, retval]*/ VARIANT_BOOL *pVal);
    STDMETHOD(put_prpBool)(/*[in]*/ VARIANT_BOOL newVal);

    STDMETHOD(outObject)(/*[out]*/ IDispatch* *val);
    STDMETHOD(outArray)(/*[out]*/ LPSAFEARRAY * val);
    STDMETHOD(outVariant)(/*[out]*/ VARIANT* val);
    STDMETHOD(outDouble)(/*[out]*/ double* val);
    STDMETHOD(outFloat)(/*[out]*/ float* val);
    STDMETHOD(outString)(/*[out]*/ BSTR* val);
    STDMETHOD(outLong)(/*[out]*/ long* val);
    STDMETHOD(outShort)(/*[out]*/ short* val);
    STDMETHOD(outByte)(/*[out]*/ unsigned char* val);
    STDMETHOD(outBool)(/*[out]*/ VARIANT_BOOL* val);

    STDMETHOD(inoutObject)(/*[in,out]*/ IDispatch* *val);
    STDMETHOD(inoutArray)(/*[in,out]*/ LPSAFEARRAY * val);
    STDMETHOD(inoutVariant)(/*[in,out]*/ VARIANT * val);
    STDMETHOD(inoutDouble)(/*[in,out]*/ double * val);
    STDMETHOD(inoutFloat)(/*[in,out]*/ float * val);
    STDMETHOD(inoutString)(/*[in, out]*/ BSTR* val);
    STDMETHOD(inoutLong)(/*[in,out]*/ long * val);
    STDMETHOD(inoutShort)(/*[in,out]*/ short* val);
    STDMETHOD(inoutByte)(/*[in,out]*/ unsigned char* val);
    STDMETHOD(inoutBool)(/*[in,out]*/ VARIANT_BOOL* val);


    STDMETHOD(inObject)(/*[in]*/ IDispatch* val);
    STDMETHOD(inArray)(/*[in]*/ LPSAFEARRAY val);
    STDMETHOD(inVariant)(/*[in]*/ VARIANT val);
    STDMETHOD(inDouble)(/*[in]*/ double val);
    STDMETHOD(inFloat)(/*[in]*/ float val);
    STDMETHOD(inString)(/*[in]*/ BSTR val);
    STDMETHOD(inLong)(/*[in]*/ long val);
    STDMETHOD(inShort)(/*[in]*/ short val);
    STDMETHOD(inByte)(/*[in]*/ unsigned char val);
    STDMETHOD(inBool)(/*[in]*/ VARIANT_BOOL val);


    STDMETHOD(optional1)(/*[in]*/ long val1, /*[in, optional]*/ VARIANT* val2);
    STDMETHOD(optional2)(/*[out]*/ long* val1,/*[out, optional]*/ VARIANT* val2);
    STDMETHOD(optional3)(/*[in, optional]*/ VARIANT* val1,/*[in, optional]*/ VARIANT* val2);
    STDMETHOD(optional4)(/*[in, out, optional]*/ VARIANT* val1,/*[in, out, optional]*/ VARIANT* val2);
    STDMETHOD(optional5)(/*[out, optional]*/ VARIANT* val1,/*[out, optional]*/ VARIANT* val2);


    STDMETHOD(defaultvalue1)(/*[in, defaultvalue(10)]*/ long val1,
        /*[in, defaultvalue(3.14)]*/ double* val2,
        // /*[in, defaultvalue(10)]*/ VARIANT val3,
        /*[in, defaultvalue(100)]*/ VARIANT* val4);

        STDMETHOD(defaultvalue2)(/*[in, out, defaultvalue(10)]*/ long* val1,
        /*[in, out, defaultvalue(3.14)]*/ double* val2,
        // /*[in, out, defaultvalue(10)]*/ VARIANT* val3,
        /*[in, out, defaultvalue(100)]*/ VARIANT* val4);

        STDMETHOD(varargfunc1)(/*[in]*/ long val1,/*[in]*/ LPSAFEARRAY val2);

    STDMETHOD(varargfunc2)(/*[out]*/ long* val1, /*[out]*/ SAFEARRAY ** val2);


    // members for property implementations
    unsigned char m_cPrpByte;
    short m_nPrpShort;
    long m_lPrpLong;
    float m_fPrpFloat;
    double m_dPrpDouble;
    CComPtr<IDispatch> m_PrpObject;
    CComPtr<IUnknown> m_prpUnknown;

    CComBSTR m_bstrPrpString;
    CComVariant m_PropVariant;
    LPSAFEARRAY m_PrpArray;
protected:
    VARIANT_BOOL m_bool;
    unsigned char  m_byte;
    short m_short;
    long m_long;
    long m_long2;
    float m_float;
    double m_double;
    CComVariant m_var1;
    CComVariant m_var2;
    CComVariant m_var3;
    CComVariant m_var4;
    CComBSTR m_bstr;
    CY m_cy;
    DATE m_date;
    DECIMAL m_decimal;
    SCODE m_scode;
    SAFEARRAY * m_safearray;
    CComPtr<IDispatch> m_obj;
    CComPtr<IUnknown> m_unknown;

    SAFEARRAY * m_arByte;
    SAFEARRAY * m_arShort;
    SAFEARRAY * m_arLong;
    SAFEARRAY * m_arString;
    SAFEARRAY * m_arVariant;
    SAFEARRAY * m_arFloat;
    SAFEARRAY * m_arDouble;
    SAFEARRAY * m_arObject;
    SAFEARRAY * m_arByteDim2;

    static void printArray(LPSAFEARRAY val, BSTR message, VARTYPE type);
    static void printMulArray(LPSAFEARRAY val, VARTYPE type);


public:
    STDMETHOD(inSequenceByteDim2)(LPSAFEARRAY val);
    STDMETHOD(inCurrency)(CY val);
    STDMETHOD(outCurrency)(CY* val);
    STDMETHOD(inoutCurrency)(CY* val);
    STDMETHOD(inDate)(DATE val);
    STDMETHOD(outDate)(DATE* val);
    STDMETHOD(inoutDate)(DATE* val);
    STDMETHOD(get_prpCurrency)(CY* pVal);
    STDMETHOD(put_prpCurrency)(CY newVal);
    STDMETHOD(get_prpDate)(DATE* pVal);
    STDMETHOD(put_prpDate)(DATE newVal);
    STDMETHOD(inDecimal)(DECIMAL val);
    STDMETHOD(outDecimal)(DECIMAL* val);
    STDMETHOD(inoutDecimal)(DECIMAL* val);
    STDMETHOD(get_prpDecimal)(DECIMAL* pVal);
    STDMETHOD(put_prpDecimal)(DECIMAL newVal);
    STDMETHOD(inSCode)(SCODE val);
    STDMETHOD(outScode)(SCODE* val);
    STDMETHOD(inoutSCode)(SCODE* val);
    STDMETHOD(get_prpSCode)(SCODE* pVal);
    STDMETHOD(put_prpSCode)(SCODE newVal);
    STDMETHOD(inrefLong)(LONG* val);
    STDMETHOD(inrefVariant)(VARIANT* val);
    STDMETHOD(inrefDecimal)(DECIMAL* val);
    STDMETHOD(get_prpRefLong)(long* pVal);
    STDMETHOD(putref_prpRefLong)(long* newVal);
    STDMETHOD(get_prprefVariant)(VARIANT* pVal);
    STDMETHOD(putref_prprefVariant)(VARIANT* newVal);
    STDMETHOD(get_prprefDecimal)(DECIMAL* pVal);
    STDMETHOD(putref_prprefDecimal)(DECIMAL* newVal);
    STDMETHOD(optional6)(VARIANT* val1, VARIANT* val2, VARIANT* val3, VARIANT* val4);
    STDMETHOD(optional7)(VARIANT* val1, VARIANT* val2, VARIANT* val3, VARIANT* val4);

    STDMETHOD(get_prpMultiArg1)(VARIANT* val1, VARIANT* val2, VARIANT* pVal);
    //STDMETHOD(get_prpMultiArg1)(VARIANT* val1, VARIANT* pVal);
    STDMETHOD(put_prpMultiArg1)(VARIANT* val1, VARIANT* val2, VARIANT* newVal);
    //STDMETHOD(put_prpMultiArg1)(VARIANT* val1, VARIANT* newVal);
    STDMETHOD(get_prpMultiArg2)(VARIANT val1, VARIANT* pVal);
    STDMETHOD(put_prpMultiArg2)(VARIANT val1, VARIANT newVal);
    STDMETHOD(prpMultiArg2GetValues)(VARIANT* val1, VARIANT* valProperty);
    STDMETHOD(get_prpMultiArg3)(LONG* val1, LONG* pVal);
    STDMETHOD(put_prpMultiArg3)(LONG* val1, LONG newVal);

    // IFoo Methods
public:
    STDMETHOD(inUnknown)(IUnknown* val);
    STDMETHOD(outUnknown)(IUnknown** val);
    STDMETHOD(inoutUnknown)(IUnknown** val);
    STDMETHOD(get_prpUnknown)(IUnknown** pVal);
    STDMETHOD(put_prpUnknown)(IUnknown* newVal);
};

#endif //__BASIC_H_