1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
26 CBasic::CBasic(): m_cPrpByte(0),m_nPrpShort(0),m_lPrpLong(0),m_fPrpFloat(0), m_dPrpDouble(0),m_PrpArray(0),
27 m_safearray(NULL
), m_bool(VARIANT_FALSE
),
28 m_arByte(0), m_arShort(0), m_arLong(0), m_arString(0), m_arVariant(0), m_arFloat(0),
29 m_arDouble(0), m_arObject(0), m_arByteDim2(0), m_date(0.), m_scode(0)
32 memset(&m_cy
, 0, sizeof(CY
));
33 memset(&m_decimal
, 0, sizeof(DECIMAL
));
38 SafeArrayDestroy(m_safearray
);
39 SafeArrayDestroy(m_arByte
);
40 SafeArrayDestroy(m_arShort
);
41 SafeArrayDestroy(m_arLong
);
42 SafeArrayDestroy(m_arString
);
43 SafeArrayDestroy(m_arVariant
);
44 SafeArrayDestroy(m_arFloat
);
45 SafeArrayDestroy(m_arDouble
);
46 SafeArrayDestroy(m_arObject
);
47 SafeArrayDestroy(m_arByteDim2
);
50 STDMETHODIMP
CBasic::inBool(VARIANT_BOOL val
)
55 STDMETHODIMP
CBasic::inByte(unsigned char val
)
61 STDMETHODIMP
CBasic::inShort(short val
)
67 STDMETHODIMP
CBasic::inLong(long val
)
73 STDMETHODIMP
CBasic::inString(BSTR val
)
79 STDMETHODIMP
CBasic::inFloat(float val
)
85 STDMETHODIMP
CBasic::inDouble(double val
)
90 CComVariant
varSource(val
);
91 HRESULT hr
= VariantChangeType(&varDest
, &varSource
, 0, VT_BSTR
);
95 STDMETHODIMP
CBasic::inVariant(VARIANT val
)
101 STDMETHODIMP
CBasic::inArray(LPSAFEARRAY val
)
104 if (FAILED(hr
= SafeArrayDestroy(m_safearray
)))
106 if (FAILED(hr
= SafeArrayCopy(val
, &m_safearray
)))
111 STDMETHODIMP
CBasic::inObject(IDispatch
*val
)
117 STDMETHODIMP
CBasic::inoutBool(VARIANT_BOOL
* val
)
119 VARIANT_BOOL aBool
= *val
;
126 STDMETHODIMP
CBasic::inoutByte(unsigned char* val
)
128 unsigned char aByte
= *val
;
134 STDMETHODIMP
CBasic::inoutShort(short *val
)
142 STDMETHODIMP
CBasic::inoutLong(long *val
)
150 STDMETHODIMP
CBasic::inoutString(BSTR
*val
)
152 CComBSTR aStr
= *val
;
154 if (FAILED( hr
= m_bstr
.CopyTo(val
)))
160 STDMETHODIMP
CBasic::inoutFloat(float *val
)
168 STDMETHODIMP
CBasic::inoutDouble(double *val
)
170 double aDouble
= *val
;
176 STDMETHODIMP
CBasic::inoutVariant(VARIANT
*val
)
178 CComVariant aVar
= *val
;
180 if (FAILED(hr
= VariantCopy(val
, &m_var1
)))
186 /* The array contains VARIANT according to IDL.
187 If the VARIANTs contain strings then we append "out" to each string.
189 STDMETHODIMP
CBasic::inoutArray(LPSAFEARRAY
*val
)
191 SAFEARRAY
* aAr
= NULL
;
193 if (FAILED(hr
= SafeArrayCopy(*val
, &aAr
)))
195 if (FAILED(hr
= SafeArrayCopy(m_safearray
, val
)))
197 if (FAILED(hr
= SafeArrayCopy(aAr
, & m_safearray
)))
202 STDMETHODIMP
CBasic::inoutObject(IDispatch
**val
)
204 CComPtr
<IDispatch
> disp
= *val
;
215 STDMETHODIMP
CBasic::outBool(VARIANT_BOOL
* val
)
221 STDMETHODIMP
CBasic::outByte(unsigned char *val
)
227 STDMETHODIMP
CBasic::outShort(short *val
)
233 STDMETHODIMP
CBasic::outLong(long *val
)
239 STDMETHODIMP
CBasic::outString(BSTR
*val
)
241 *val
= SysAllocString(m_bstr
);
245 STDMETHODIMP
CBasic::outFloat(float *val
)
251 STDMETHODIMP
CBasic::outDouble(double *val
)
257 STDMETHODIMP
CBasic::outVariant(VARIANT
*val
)
260 if (FAILED(hr
= VariantCopy(val
, &m_var1
)))
265 STDMETHODIMP
CBasic::outArray(LPSAFEARRAY
*val
)
268 if (FAILED(hr
= SafeArrayCopy(m_safearray
, val
)))
273 STDMETHODIMP
CBasic::outObject(IDispatch
* *val
)
283 STDMETHODIMP
CBasic::get_prpBool(VARIANT_BOOL
* pVal
)
285 if (!pVal
) return E_POINTER
;
290 STDMETHODIMP
CBasic::put_prpBool(VARIANT_BOOL val
)
297 STDMETHODIMP
CBasic::get_prpByte(unsigned char *pVal
)
305 STDMETHODIMP
CBasic::put_prpByte(unsigned char newVal
)
311 STDMETHODIMP
CBasic::get_prpShort(short *pVal
)
319 STDMETHODIMP
CBasic::put_prpShort(short newVal
)
325 STDMETHODIMP
CBasic::get_prpLong(long *pVal
)
333 STDMETHODIMP
CBasic::put_prpLong(long newVal
)
339 STDMETHODIMP
CBasic::get_prpString(BSTR
*pVal
)
343 m_bstrPrpString
.CopyTo( pVal
);
347 STDMETHODIMP
CBasic::put_prpString(BSTR newVal
)
349 m_bstrPrpString
= newVal
;
353 STDMETHODIMP
CBasic::get_prpFloat(float *pVal
)
361 STDMETHODIMP
CBasic::put_prpFloat(float newVal
)
367 STDMETHODIMP
CBasic::get_prpDouble(double *pVal
)
375 STDMETHODIMP
CBasic::put_prpDouble(double newVal
)
377 m_dPrpDouble
= newVal
;
381 STDMETHODIMP
CBasic::get_prpVariant(VARIANT
*pVal
)
386 if (FAILED(hr
= VariantCopy( pVal
, &m_PropVariant
)))
391 STDMETHODIMP
CBasic::put_prpVariant(VARIANT newVal
)
393 m_PropVariant
= newVal
;
397 STDMETHODIMP
CBasic::get_prpArray(LPSAFEARRAY
*pVal
)
402 if (FAILED(hr
= SafeArrayCopy( m_PrpArray
, pVal
)))
407 STDMETHODIMP
CBasic::put_prpArray(LPSAFEARRAY newVal
)
410 if (FAILED(hr
= SafeArrayDestroy( m_PrpArray
)))
412 if (FAILED(hr
= SafeArrayCopy( newVal
, &m_PrpArray
)))
417 STDMETHODIMP
CBasic::get_prpObject(IDispatch
**pVal
)
427 STDMETHODIMP
CBasic::put_prpObject(IDispatch
*newVal
)
433 STDMETHODIMP
CBasic::mixed1(
434 /* [out][in] */ unsigned char *aChar
,
435 /* [out][in] */ float *aFloat
,
436 /* [out][in] */ VARIANT
*aVar
)
451 STDMETHODIMP
CBasic::inSequenceLong(LPSAFEARRAY val
)
454 if (FAILED(hr
= SafeArrayDestroy(m_arLong
)))
456 if (FAILED(hr
= SafeArrayCopy(val
, & m_arLong
)))
461 STDMETHODIMP
CBasic::inSequenceByte( LPSAFEARRAY val
)
464 if (FAILED(hr
= SafeArrayDestroy(m_arByte
)))
466 if (FAILED(hr
= SafeArrayCopy(val
, & m_arByte
)))
471 STDMETHODIMP
CBasic::inSequenceShort(LPSAFEARRAY val
)
474 if (FAILED(hr
= SafeArrayDestroy(m_arShort
)))
476 if (FAILED(hr
= SafeArrayCopy(val
, & m_arShort
)))
481 STDMETHODIMP
CBasic::inSequenceString(LPSAFEARRAY val
)
484 if (FAILED(hr
= SafeArrayDestroy(m_arString
)))
486 if (FAILED(hr
= SafeArrayCopy(val
, & m_arString
)))
491 STDMETHODIMP
CBasic::inSequenceFloat(LPSAFEARRAY val
)
494 if (FAILED(hr
= SafeArrayDestroy(m_arFloat
)))
496 if (FAILED(hr
= SafeArrayCopy(val
, & m_arFloat
)))
501 STDMETHODIMP
CBasic::inSequenceDouble(LPSAFEARRAY val
)
504 if (FAILED(hr
= SafeArrayDestroy(m_arDouble
)))
506 if (FAILED(hr
= SafeArrayCopy(val
, & m_arDouble
)))
511 STDMETHODIMP
CBasic::inSequenceObject(LPSAFEARRAY val
)
514 if (FAILED(hr
= SafeArrayDestroy(m_arObject
)))
516 if (FAILED(hr
= SafeArrayCopy(val
, & m_arObject
)))
521 void CBasic::printArray( LPSAFEARRAY val
, BSTR message
, VARTYPE type
)
528 hr
= SafeArrayGetLBound( val
, 1, &lbound
);
529 hr
= SafeArrayGetUBound( val
, 1, &ubound
);
530 long length
= ubound
- lbound
+1;
532 CComVariant varElement
;
534 sprintf( buf
,"%s", W2A(message
));
536 for( long i
= 0; i
< length
; i
++)
547 hr
= SafeArrayGetElement( val
, &i
, (void*)&data
);
548 sprintf( tmp
, "%ld \n", *(long*)&data
);
551 hr
= SafeArrayGetElement( val
, &i
, (void*)&data
);
552 sprintf( tmp
, "%S \n", (BSTR
)data
);
555 hr
= SafeArrayGetElement( val
, &i
, &var
);
556 sprintf( tmp
, "%x \n", var
.byref
);
559 hr
= SafeArrayGetElement( val
, &i
, (void*)&data
);
560 sprintf( tmp
, "%f \n", *(float*) &data
);
563 hr
= SafeArrayGetElement( val
, &i
, (void*)&data
);
564 sprintf( tmp
, "%f \n", *(double*) &data
);
567 // we assume the objects are instances of this component and have the
568 // property prpString set.
569 hr
= SafeArrayGetElement( val
, &i
, (void*)&data
);
570 IDispatch
* pdisp
= ( IDispatch
*) data
;
571 CComDispatchDriver
driver( pdisp
);
575 driver
.GetPropertyByName(L
"prpString", &var
);
576 sprintf( tmp
, "%x : %S \n", *(long*)&data
, var
.bstrVal
);
579 sprintf( tmp
, "%x\n", *(long*)&data
);
584 MessageBox( NULL
, _T(A2T(buf
)), _T("AxTestComponents.Basic"), MB_OK
);
587 // V_ERROR OLECHAR VARIANT VT_UI1
589 STDMETHODIMP
CBasic::outSequenceByte(LPSAFEARRAY
* val
)
592 hr
= SafeArrayCopy(m_arByte
, val
);
596 STDMETHODIMP
CBasic::outSequenceShort(LPSAFEARRAY
* val
)
599 hr
= SafeArrayCopy(m_arShort
, val
);
603 STDMETHODIMP
CBasic::outSequenceLong(LPSAFEARRAY
* val
)
606 hr
= SafeArrayCopy(m_arLong
, val
);
610 STDMETHODIMP
CBasic::outSequenceString(LPSAFEARRAY
* val
)
613 hr
= SafeArrayCopy(m_arString
, val
);
617 STDMETHODIMP
CBasic::outSequenceFloat(LPSAFEARRAY
* val
)
620 hr
= SafeArrayCopy(m_arFloat
, val
);
624 STDMETHODIMP
CBasic::outSequenceDouble(LPSAFEARRAY
* val
)
627 hr
= SafeArrayCopy(m_arDouble
, val
);
631 STDMETHODIMP
CBasic::outSequenceObject(LPSAFEARRAY
* val
)
634 hr
= SafeArrayCopy(m_arObject
, val
);
638 STDMETHODIMP
CBasic::inoutSequenceByte(LPSAFEARRAY
* val
)
641 SAFEARRAY
*arTemp
= NULL
;
642 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
644 if (FAILED(hr
= SafeArrayCopy(m_arByte
, val
)))
650 STDMETHODIMP
CBasic::inoutSequenceShort(LPSAFEARRAY
* val
)
653 SAFEARRAY
*arTemp
= NULL
;
654 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
656 if (FAILED(hr
= SafeArrayCopy(m_arShort
, val
)))
662 STDMETHODIMP
CBasic::inoutSequenceLong(LPSAFEARRAY
* val
)
665 SAFEARRAY
*arTemp
= NULL
;
666 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
668 if (FAILED(hr
= SafeArrayCopy(m_arLong
, val
)))
674 STDMETHODIMP
CBasic::inoutSequenceString(LPSAFEARRAY
* val
)
677 SAFEARRAY
*arTemp
= NULL
;
678 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
680 if (FAILED(hr
= SafeArrayCopy(m_arString
, val
)))
686 STDMETHODIMP
CBasic::inoutSequenceFloat(LPSAFEARRAY
* val
)
689 SAFEARRAY
*arTemp
= NULL
;
690 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
692 if (FAILED(hr
= SafeArrayCopy(m_arFloat
, val
)))
698 STDMETHODIMP
CBasic::inoutSequenceDouble(LPSAFEARRAY
* val
)
701 SAFEARRAY
*arTemp
= NULL
;
702 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
704 if (FAILED(hr
= SafeArrayCopy(m_arDouble
, val
)))
710 STDMETHODIMP
CBasic::inoutSequenceObject(LPSAFEARRAY
* val
)
713 SAFEARRAY
*arTemp
= NULL
;
714 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
716 if (FAILED(hr
= SafeArrayCopy(m_arObject
, val
)))
722 // 2-dimensional Array
723 STDMETHODIMP
CBasic::inMulDimArrayLong(LPSAFEARRAY val
)
725 printMulArray( val
, VT_I4
);
728 // 2-dimensional Array
729 STDMETHODIMP
CBasic::inMulDimArrayVariant(LPSAFEARRAY val
)
731 printMulArray( val
, VT_VARIANT
);
734 // 3-dimensional Array
735 STDMETHODIMP
CBasic::inMulDimArrayLong2(LPSAFEARRAY val
)
737 printMulArray( val
, VT_I4
);
740 // 3-dimensional Array
741 STDMETHODIMP
CBasic::inMulDimArrayVariant2(LPSAFEARRAY val
)
747 STDMETHODIMP
CBasic::inMulDimArrayByte(LPSAFEARRAY val
)
750 if (FAILED(hr
= SafeArrayDestroy(m_arByteDim2
)))
752 if (FAILED(hr
= SafeArrayCopy(val
, & m_arByteDim2
)))
756 // 3-dimensionales array
757 STDMETHODIMP
CBasic::inMulDimArrayByte2(LPSAFEARRAY val
)
760 // TODO: Add your implementation code here
761 //printMulArray( val, VT_UI1);
765 // supports 2 and 3 dimensionals SAFEARRAY with elements of long or VARIANT
766 void CBasic::printMulArray( SAFEARRAY
* val
, VARTYPE type
)
769 UINT dims
= SafeArrayGetDim( val
);
784 hr
= SafeArrayGetLBound( val
, 1, &lbound1
);
785 hr
= SafeArrayGetUBound( val
, 1, &ubound1
);
786 length1
= ubound1
- lbound1
+1;
788 hr
= SafeArrayGetLBound( val
, 2, &lbound2
);
789 hr
= SafeArrayGetUBound( val
, 2, &ubound2
);
790 length2
= ubound2
- lbound2
+ 1;
794 for( long i
= 0; i
< length2
; i
++)
796 for( long j
= 0; j
<length1
; j
++)
805 hr
= SafeArrayGetElement( val
, index
, &longVal
);
806 sprintf( tmpBuf
, "(%ld,%ld): %ld\n", index
[1], index
[0], longVal
);
809 hr
= SafeArrayGetElement( val
, index
, &longVal
);
810 sprintf( tmpBuf
, "(%ld,%ld): %d\n", index
[1], index
[0], (unsigned char)longVal
);
813 hr
= SafeArrayGetElement( val
, index
, &var
);
814 sprintf( tmpBuf
, "(%ld,%ld): %d (vartype %d)\n", index
[1], index
[0], var
.byref
, var
.vt
);
817 strcat( buff
,tmpBuf
);
826 hr
= SafeArrayGetLBound( val
, 1, &lbound1
);
827 hr
= SafeArrayGetUBound( val
, 1, &ubound1
);
828 length1
= ubound1
- lbound1
+1;
830 hr
= SafeArrayGetLBound( val
, 2, &lbound2
);
831 hr
= SafeArrayGetUBound( val
, 2, &ubound2
);
832 length2
= ubound2
- lbound2
+ 1;
834 hr
= SafeArrayGetLBound( val
, 3, &lbound3
);
835 hr
= SafeArrayGetUBound( val
, 3, &ubound3
);
836 long length3
= ubound3
- lbound3
+1;
840 for( long i
= 0; i
< length3
; i
++)
842 for( long j
= 0; j
<length2
; j
++)
844 for( long k
= 0; k
<length1
; k
++)
854 hr
= SafeArrayGetElement( val
, index
, &longVal
);
855 sprintf( tmpBuf
, "(%ld,%ld,%ld): %ld\n", index
[2], index
[1], index
[0], longVal
);
858 hr
= SafeArrayGetElement( val
, index
, &longVal
);
859 sprintf( tmpBuf
, "(%ld,%ld,%ld): %d\n", index
[2], index
[1], index
[0], (unsigned char)longVal
);
863 hr
= SafeArrayGetElement( val
, index
, &var
);
864 sprintf( tmpBuf
, "(%ld,%ld,%ld): %d (vartype %d)\n", index
[2], index
[1], index
[0], var
.byref
, var
.vt
);
867 strcat( buff
,tmpBuf
);
875 MessageBox( NULL
, A2T( buff
), _T("AxTestControl.Basic"), MB_OK
);
883 STDMETHODIMP
CBasic::outMore(long* val1
, long* val2
)
885 // TODO: Add your implementation code here
890 // If an optional parameter was not provided then the respective member will
892 STDMETHODIMP
CBasic::optional1(/*[in]*/ long val1
, /*[in, optional]*/ VARIANT
* val2
)
895 if (val2
->vt
!= VT_ERROR
)
900 STDMETHODIMP
CBasic::optional2(/*[out]*/ long* val1
,/*[out, optional]*/ VARIANT
* val2
)
905 if (val2
->vt
!= VT_ERROR
)
906 hr
= VariantCopy(val2
, & m_var1
);
910 STDMETHODIMP
CBasic::optional3(/*[in, optional]*/ VARIANT
* val1
,/*[in, optional]*/ VARIANT
* val2
)
912 //if (val1->vt != VT_ERROR)
915 //if (val2->vt != VT_ERROR)
920 STDMETHODIMP
CBasic::optional4(/*[in, out, optional]*/ VARIANT
* val1
,
921 /*[in, out, optional]*/ VARIANT
* val2
)
924 //return the previously set in values
925 if (val1
->vt
!= VT_ERROR
)
927 CComVariant
var1(*val1
);
928 if (FAILED(hr
= VariantCopy(val1
, & m_var1
)))
932 if (val2
->vt
!= VT_ERROR
)
934 CComVariant
var2(*val2
);
935 if (FAILED(hr
= VariantCopy(val2
, & m_var2
)))
942 STDMETHODIMP
CBasic::optional5(/*[out, optional]*/ VARIANT
* val1
,
943 /*[out, optional]*/ VARIANT
* val2
)
946 if (FAILED(hr
= VariantCopy(val1
, &m_var1
)))
948 if (FAILED(hr
= VariantCopy(val2
, &m_var2
)))
953 STDMETHODIMP
CBasic::defaultvalue1(/*[in, defaultvalue(10)]*/ long val1
,
954 /*[in, defaultvalue(3.14)]*/ double* val2
,
955 // /*[in, defaultvalue(10)]*/ VARIANT val3,
956 /*[in, defaultvalue(100)]*/ VARIANT
* val4
)
964 STDMETHODIMP
CBasic::defaultvalue2(/*[in, out, defaultvalue(10)]*/ long* val1
,
965 /*[in, out, defaultvalue(3.14)]*/ double* val2
,
966 // /*[in, out, defaultvalue(10)]*/ VARIANT* val3,
967 /*[in, out, defaultvalue(100)]*/ VARIANT
* val4
)
971 double aDouble
= *val2
;
972 // CComVariant var1(*val3);
973 CComVariant
var2(*val4
);
976 //if (FAILED(hr = VariantCopy(val3, &m_var1)))
978 if (FAILED(hr
= VariantCopy(val4
, &m_var2
)))
986 /* val2 contains the variable argument list. If no such arguments are supplied
987 then the safearray is invalid. SafeArrayCopy then returns E_INVALIDARG
989 STDMETHODIMP
CBasic::varargfunc1(/*[in]*/ long val1
,/*[in]*/ LPSAFEARRAY val2
)
994 if (FAILED(hr
= SafeArrayDestroy(m_safearray
)))
996 if (FAILED(hr
= SafeArrayCopy(val2
, & m_safearray
)))
998 if (hr
!= E_INVALIDARG
)
1004 STDMETHODIMP
CBasic::varargfunc2(/*[out]*/ long* val1
, /*[out]*/ SAFEARRAY
** val2
)
1007 HRESULT hr
= SafeArrayCopy(m_safearray
, val2
);
1011 STDMETHODIMP
CBasic::inSequenceByteDim2(LPSAFEARRAY val
)
1014 if (FAILED(hr
= SafeArrayDestroy(m_arByteDim2
)))
1016 if (FAILED(hr
= SafeArrayCopy(val
, & m_arByteDim2
)))
1022 STDMETHODIMP
CBasic::inCurrency(CY val
)
1028 STDMETHODIMP
CBasic::outCurrency(CY
* val
)
1034 STDMETHODIMP
CBasic::inoutCurrency(CY
* val
)
1042 STDMETHODIMP
CBasic::inDate(DATE val
)
1048 STDMETHODIMP
CBasic::outDate(DATE
* val
)
1054 STDMETHODIMP
CBasic::inoutDate(DATE
* val
)
1062 STDMETHODIMP
CBasic::get_prpCurrency(CY
* pVal
)
1068 STDMETHODIMP
CBasic::put_prpCurrency(CY newVal
)
1074 STDMETHODIMP
CBasic::get_prpDate(DATE
* pVal
)
1080 STDMETHODIMP
CBasic::put_prpDate(DATE newVal
)
1086 //VT_I4 DECIMAL_NEG //tagVARIANT DISPATCH_PROPERTYPUT
1087 STDMETHODIMP
CBasic::inDecimal(DECIMAL val
)
1093 STDMETHODIMP
CBasic::outDecimal(DECIMAL
* val
)
1099 STDMETHODIMP
CBasic::inoutDecimal(DECIMAL
* val
)
1108 STDMETHODIMP
CBasic::get_prpDecimal(DECIMAL
* pVal
)
1114 STDMETHODIMP
CBasic::put_prpDecimal(DECIMAL newVal
)
1120 STDMETHODIMP
CBasic::inSCode(SCODE val
)
1126 STDMETHODIMP
CBasic::outScode(SCODE
* val
)
1132 STDMETHODIMP
CBasic::inoutSCode(SCODE
* val
)
1140 STDMETHODIMP
CBasic::get_prpSCode(SCODE
* pVal
)
1146 STDMETHODIMP
CBasic::put_prpSCode(SCODE newVal
)
1152 STDMETHODIMP
CBasic::inrefLong(LONG
* val
)
1158 STDMETHODIMP
CBasic::inrefVariant(VARIANT
* val
)
1161 if (FAILED(hr
= VariantCopy( & m_var1
, val
)))
1166 STDMETHODIMP
CBasic::inrefDecimal(DECIMAL
* val
)
1172 STDMETHODIMP
CBasic::get_prpRefLong(long* pVal
)
1178 STDMETHODIMP
CBasic::putref_prpRefLong(long* newVal
)
1184 STDMETHODIMP
CBasic::get_prprefVariant(VARIANT
* pVal
)
1187 hr
= VariantCopy(pVal
, & m_var1
);
1191 STDMETHODIMP
CBasic::putref_prprefVariant(VARIANT
* newVal
)
1197 STDMETHODIMP
CBasic::get_prprefDecimal(DECIMAL
* pVal
)
1203 STDMETHODIMP
CBasic::putref_prprefDecimal(DECIMAL
* newVal
)
1205 m_decimal
= *newVal
;
1210 STDMETHODIMP
CBasic::optional6(VARIANT
* val1
, VARIANT
* val2
, VARIANT
* val3
, VARIANT
* val4
)
1213 if (FAILED(hr
= m_var1
.Copy(val1
)))
1215 if (FAILED(hr
= m_var2
.Copy(val2
)))
1217 if (FAILED(hr
= m_var3
.Copy(val3
)))
1219 if (FAILED(hr
= m_var4
.Copy(val4
)))
1224 STDMETHODIMP
CBasic::optional7(VARIANT
* val1
, VARIANT
* val2
, VARIANT
* val3
, VARIANT
* val4
)
1227 if (FAILED(hr
= VariantCopy(val1
, & m_var1
)))
1229 if (FAILED(hr
= VariantCopy(val2
, & m_var2
)))
1231 if (FAILED(hr
= VariantCopy(val3
, & m_var3
)))
1233 if (FAILED(hr
= VariantCopy(val4
, & m_var4
)))
1239 STDMETHODIMP
CBasic::get_prpMultiArg1(VARIANT
* val1
, VARIANT
* val2
, VARIANT
* pVal
)
1242 CComVariant
tmp1(*val1
);
1243 CComVariant
tmp2(*val2
);
1245 if (FAILED(hr
= VariantCopy(val1
, & m_var1
)))
1247 if (FAILED(hr
= VariantCopy(val2
, & m_var2
)))
1251 if (FAILED(hr
= VariantCopy(pVal
, & m_var3
)))
1256 STDMETHODIMP
CBasic::put_prpMultiArg1(VARIANT
* val1
, VARIANT
* val2
, VARIANT
* newVal
)
1259 CComVariant
tmp1( * val1
);
1260 CComVariant
tmp2( * val2
);
1262 if (FAILED(hr
= VariantCopy(val1
, & m_var1
)))
1264 if (FAILED(hr
= VariantCopy(val2
, & m_var2
)))
1273 // tagVARIANT DISPATCH_PROPERTYPUT DISPID_PROPERTYPUT VARIANTARG LOCALE_USER_DEFAULT
1275 STDMETHODIMP
CBasic::get_prpMultiArg2(VARIANT val1
, VARIANT
* pVal
)
1280 if (FAILED(hr
= VariantCopy(pVal
, & m_var2
)))
1285 STDMETHODIMP
CBasic::put_prpMultiArg2(VARIANT val1
, VARIANT newVal
)
1292 // returns the values set by prpMultiArg2
1293 STDMETHODIMP
CBasic::prpMultiArg2GetValues(VARIANT
* val1
, VARIANT
* valProperty
)
1296 if (FAILED(VariantCopy(val1
, & m_var1
)))
1298 if (FAILED(VariantCopy(valProperty
, & m_var2
)))
1303 STDMETHODIMP
CBasic::get_prpMultiArg3(LONG
* val1
, LONG
* pVal
)
1313 STDMETHODIMP
CBasic::put_prpMultiArg3(LONG
* val1
, LONG newVal
)
1323 STDMETHODIMP
CBasic::inUnknown(IUnknown
* val
)
1330 STDMETHODIMP
CBasic::outUnknown(IUnknown
** val
)
1332 m_unknown
.CopyTo(val
);
1336 STDMETHODIMP
CBasic::inoutUnknown(IUnknown
** val
)
1338 CComPtr
<IUnknown
> tmp
= *val
;
1339 m_unknown
.CopyTo(val
);
1344 STDMETHODIMP
CBasic::get_prpUnknown(IUnknown
** pVal
)
1346 m_prpUnknown
.CopyTo(pVal
);
1350 STDMETHODIMP
CBasic::put_prpUnknown(IUnknown
* newVal
)
1352 m_prpUnknown
= newVal
;
1356 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */