1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: Basic.cpp,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 //#include "AxTestComponents.h"
36 /////////////////////////////////////////////////////////////////////////////
38 CBasic::CBasic(): m_cPrpByte(0),m_nPrpShort(0),m_lPrpLong(0),m_fPrpFloat(0), m_dPrpDouble(0),m_PrpArray(0),
39 m_safearray(NULL
), m_bool(VARIANT_FALSE
),
40 m_arByte(0), m_arShort(0), m_arLong(0), m_arString(0), m_arVariant(0), m_arFloat(0),
41 m_arDouble(0), m_arObject(0), m_arByteDim2(0), m_date(0.), m_scode(0)
44 memset(&m_cy
, 0, sizeof(CY
));
45 memset(&m_decimal
, 0, sizeof(DECIMAL
));
50 SafeArrayDestroy(m_safearray
);
51 SafeArrayDestroy(m_arByte
);
52 SafeArrayDestroy(m_arShort
);
53 SafeArrayDestroy(m_arLong
);
54 SafeArrayDestroy(m_arString
);
55 SafeArrayDestroy(m_arVariant
);
56 SafeArrayDestroy(m_arFloat
);
57 SafeArrayDestroy(m_arDouble
);
58 SafeArrayDestroy(m_arObject
);
59 SafeArrayDestroy(m_arByteDim2
);
62 STDMETHODIMP
CBasic::inBool(VARIANT_BOOL val
)
67 STDMETHODIMP
CBasic::inByte(unsigned char val
)
73 STDMETHODIMP
CBasic::inShort(short val
)
79 STDMETHODIMP
CBasic::inLong(long val
)
85 STDMETHODIMP
CBasic::inString(BSTR val
)
91 STDMETHODIMP
CBasic::inFloat(float val
)
97 STDMETHODIMP
CBasic::inDouble(double val
)
102 CComVariant
varSource(val
);
103 HRESULT hr
= VariantChangeType(&varDest
, &varSource
, 0, VT_BSTR
);
107 STDMETHODIMP
CBasic::inVariant(VARIANT val
)
113 STDMETHODIMP
CBasic::inArray(LPSAFEARRAY val
)
116 if (FAILED(hr
= SafeArrayDestroy(m_safearray
)))
118 if (FAILED(hr
= SafeArrayCopy(val
, &m_safearray
)))
123 STDMETHODIMP
CBasic::inObject(IDispatch
*val
)
129 STDMETHODIMP
CBasic::inoutBool(VARIANT_BOOL
* val
)
131 VARIANT_BOOL aBool
= *val
;
138 STDMETHODIMP
CBasic::inoutByte(unsigned char* val
)
140 unsigned char aByte
= *val
;
146 STDMETHODIMP
CBasic::inoutShort(short *val
)
154 STDMETHODIMP
CBasic::inoutLong(long *val
)
162 STDMETHODIMP
CBasic::inoutString(BSTR
*val
)
164 CComBSTR aStr
= *val
;
166 if (FAILED( hr
= m_bstr
.CopyTo(val
)))
172 STDMETHODIMP
CBasic::inoutFloat(float *val
)
180 STDMETHODIMP
CBasic::inoutDouble(double *val
)
182 double aDouble
= *val
;
188 STDMETHODIMP
CBasic::inoutVariant(VARIANT
*val
)
190 CComVariant aVar
= *val
;
192 if (FAILED(hr
= VariantCopy(val
, &m_var1
)))
198 /* The array contains VARIANT according to IDL.
199 If the VARIANTs contain strings then we append "out" to each string.
201 STDMETHODIMP
CBasic::inoutArray(LPSAFEARRAY
*val
)
203 SAFEARRAY
* aAr
= NULL
;
205 if (FAILED(hr
= SafeArrayCopy(*val
, &aAr
)))
207 if (FAILED(hr
= SafeArrayCopy(m_safearray
, val
)))
209 if (FAILED(hr
= SafeArrayCopy(aAr
, & m_safearray
)))
214 STDMETHODIMP
CBasic::inoutObject(IDispatch
**val
)
216 CComPtr
<IDispatch
> disp
= *val
;
227 STDMETHODIMP
CBasic::outBool(VARIANT_BOOL
* val
)
233 STDMETHODIMP
CBasic::outByte(unsigned char *val
)
239 STDMETHODIMP
CBasic::outShort(short *val
)
245 STDMETHODIMP
CBasic::outLong(long *val
)
251 STDMETHODIMP
CBasic::outString(BSTR
*val
)
253 *val
= SysAllocString(m_bstr
);
257 STDMETHODIMP
CBasic::outFloat(float *val
)
263 STDMETHODIMP
CBasic::outDouble(double *val
)
269 STDMETHODIMP
CBasic::outVariant(VARIANT
*val
)
272 if (FAILED(hr
= VariantCopy(val
, &m_var1
)))
277 STDMETHODIMP
CBasic::outArray(LPSAFEARRAY
*val
)
280 if (FAILED(hr
= SafeArrayCopy(m_safearray
, val
)))
285 STDMETHODIMP
CBasic::outObject(IDispatch
* *val
)
295 STDMETHODIMP
CBasic::get_prpBool(VARIANT_BOOL
* pVal
)
297 if (!pVal
) return E_POINTER
;
302 STDMETHODIMP
CBasic::put_prpBool(VARIANT_BOOL val
)
309 STDMETHODIMP
CBasic::get_prpByte(unsigned char *pVal
)
317 STDMETHODIMP
CBasic::put_prpByte(unsigned char newVal
)
323 STDMETHODIMP
CBasic::get_prpShort(short *pVal
)
331 STDMETHODIMP
CBasic::put_prpShort(short newVal
)
337 STDMETHODIMP
CBasic::get_prpLong(long *pVal
)
345 STDMETHODIMP
CBasic::put_prpLong(long newVal
)
351 STDMETHODIMP
CBasic::get_prpString(BSTR
*pVal
)
355 m_bstrPrpString
.CopyTo( pVal
);
359 STDMETHODIMP
CBasic::put_prpString(BSTR newVal
)
361 m_bstrPrpString
= newVal
;
365 STDMETHODIMP
CBasic::get_prpFloat(float *pVal
)
373 STDMETHODIMP
CBasic::put_prpFloat(float newVal
)
379 STDMETHODIMP
CBasic::get_prpDouble(double *pVal
)
387 STDMETHODIMP
CBasic::put_prpDouble(double newVal
)
389 m_dPrpDouble
= newVal
;
393 STDMETHODIMP
CBasic::get_prpVariant(VARIANT
*pVal
)
398 if (FAILED(hr
= VariantCopy( pVal
, &m_PropVariant
)))
403 STDMETHODIMP
CBasic::put_prpVariant(VARIANT newVal
)
405 m_PropVariant
= newVal
;
409 STDMETHODIMP
CBasic::get_prpArray(LPSAFEARRAY
*pVal
)
414 if (FAILED(hr
= SafeArrayCopy( m_PrpArray
, pVal
)))
419 STDMETHODIMP
CBasic::put_prpArray(LPSAFEARRAY newVal
)
422 if (FAILED(hr
= SafeArrayDestroy( m_PrpArray
)))
424 if (FAILED(hr
= SafeArrayCopy( newVal
, &m_PrpArray
)))
429 STDMETHODIMP
CBasic::get_prpObject(IDispatch
**pVal
)
439 STDMETHODIMP
CBasic::put_prpObject(IDispatch
*newVal
)
445 STDMETHODIMP
CBasic::mixed1(
446 /* [out][in] */ unsigned char *aChar
,
447 /* [out][in] */ float *aFloat
,
448 /* [out][in] */ VARIANT
*aVar
)
463 STDMETHODIMP
CBasic::inSequenceLong(LPSAFEARRAY val
)
466 if (FAILED(hr
= SafeArrayDestroy(m_arLong
)))
468 if (FAILED(hr
= SafeArrayCopy(val
, & m_arLong
)))
473 STDMETHODIMP
CBasic::inSequenceByte( LPSAFEARRAY val
)
476 if (FAILED(hr
= SafeArrayDestroy(m_arByte
)))
478 if (FAILED(hr
= SafeArrayCopy(val
, & m_arByte
)))
483 STDMETHODIMP
CBasic::inSequenceShort(LPSAFEARRAY val
)
486 if (FAILED(hr
= SafeArrayDestroy(m_arShort
)))
488 if (FAILED(hr
= SafeArrayCopy(val
, & m_arShort
)))
493 STDMETHODIMP
CBasic::inSequenceString(LPSAFEARRAY val
)
496 if (FAILED(hr
= SafeArrayDestroy(m_arString
)))
498 if (FAILED(hr
= SafeArrayCopy(val
, & m_arString
)))
503 STDMETHODIMP
CBasic::inSequenceFloat(LPSAFEARRAY val
)
506 if (FAILED(hr
= SafeArrayDestroy(m_arFloat
)))
508 if (FAILED(hr
= SafeArrayCopy(val
, & m_arFloat
)))
513 STDMETHODIMP
CBasic::inSequenceDouble(LPSAFEARRAY val
)
516 if (FAILED(hr
= SafeArrayDestroy(m_arDouble
)))
518 if (FAILED(hr
= SafeArrayCopy(val
, & m_arDouble
)))
523 STDMETHODIMP
CBasic::inSequenceObject(LPSAFEARRAY val
)
526 if (FAILED(hr
= SafeArrayDestroy(m_arObject
)))
528 if (FAILED(hr
= SafeArrayCopy(val
, & m_arObject
)))
533 void CBasic::printArray( LPSAFEARRAY val
, BSTR message
, VARTYPE type
)
540 hr
= SafeArrayGetLBound( val
, 1, &lbound
);
541 hr
= SafeArrayGetUBound( val
, 1, &ubound
);
542 long length
= ubound
- lbound
+1;
544 CComVariant varElement
;
546 sprintf( buf
,"%s", W2A(message
));
548 for( long i
= 0; i
< length
; i
++)
559 hr
= SafeArrayGetElement( val
, &i
, (void*)&data
);
560 sprintf( tmp
, "%d \n", *(long*)&data
);
563 hr
= SafeArrayGetElement( val
, &i
, (void*)&data
);
564 sprintf( tmp
, "%S \n", (BSTR
)data
);
567 hr
= SafeArrayGetElement( val
, &i
, &var
);
568 sprintf( tmp
, "%x \n", var
.byref
);
571 hr
= SafeArrayGetElement( val
, &i
, (void*)&data
);
572 sprintf( tmp
, "%f \n", *(float*) &data
);
575 hr
= SafeArrayGetElement( val
, &i
, (void*)&data
);
576 sprintf( tmp
, "%f \n", *(double*) &data
);
579 // we assume the objects are instances of this component and have the
580 // property prpString set.
581 hr
= SafeArrayGetElement( val
, &i
, (void*)&data
);
582 IDispatch
* pdisp
= ( IDispatch
*) data
;
583 CComDispatchDriver
driver( pdisp
);
587 driver
.GetPropertyByName(L
"prpString", &var
);
588 sprintf( tmp
, "%x : %S \n", *(long*)&data
, var
.bstrVal
);
591 sprintf( tmp
, "%x\n", *(long*)&data
);
596 MessageBox( NULL
, _T(A2T(buf
)), _T("AxTestComponents.Basic"), MB_OK
);
599 // V_ERROR OLECHAR VARIANT VT_UI1
601 STDMETHODIMP
CBasic::outSequenceByte(LPSAFEARRAY
* val
)
604 hr
= SafeArrayCopy(m_arByte
, val
);
608 STDMETHODIMP
CBasic::outSequenceShort(LPSAFEARRAY
* val
)
611 hr
= SafeArrayCopy(m_arShort
, val
);
615 STDMETHODIMP
CBasic::outSequenceLong(LPSAFEARRAY
* val
)
618 hr
= SafeArrayCopy(m_arLong
, val
);
622 STDMETHODIMP
CBasic::outSequenceString(LPSAFEARRAY
* val
)
625 hr
= SafeArrayCopy(m_arString
, val
);
629 STDMETHODIMP
CBasic::outSequenceFloat(LPSAFEARRAY
* val
)
632 hr
= SafeArrayCopy(m_arFloat
, val
);
636 STDMETHODIMP
CBasic::outSequenceDouble(LPSAFEARRAY
* val
)
639 hr
= SafeArrayCopy(m_arDouble
, val
);
643 STDMETHODIMP
CBasic::outSequenceObject(LPSAFEARRAY
* val
)
646 hr
= SafeArrayCopy(m_arObject
, val
);
650 STDMETHODIMP
CBasic::inoutSequenceByte(LPSAFEARRAY
* val
)
653 SAFEARRAY
*arTemp
= NULL
;
654 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
656 if (FAILED(hr
= SafeArrayCopy(m_arByte
, val
)))
662 STDMETHODIMP
CBasic::inoutSequenceShort(LPSAFEARRAY
* val
)
665 SAFEARRAY
*arTemp
= NULL
;
666 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
668 if (FAILED(hr
= SafeArrayCopy(m_arShort
, val
)))
674 STDMETHODIMP
CBasic::inoutSequenceLong(LPSAFEARRAY
* val
)
677 SAFEARRAY
*arTemp
= NULL
;
678 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
680 if (FAILED(hr
= SafeArrayCopy(m_arLong
, val
)))
686 STDMETHODIMP
CBasic::inoutSequenceString(LPSAFEARRAY
* val
)
689 SAFEARRAY
*arTemp
= NULL
;
690 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
692 if (FAILED(hr
= SafeArrayCopy(m_arString
, val
)))
698 STDMETHODIMP
CBasic::inoutSequenceFloat(LPSAFEARRAY
* val
)
701 SAFEARRAY
*arTemp
= NULL
;
702 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
704 if (FAILED(hr
= SafeArrayCopy(m_arFloat
, val
)))
710 STDMETHODIMP
CBasic::inoutSequenceDouble(LPSAFEARRAY
* val
)
713 SAFEARRAY
*arTemp
= NULL
;
714 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
716 if (FAILED(hr
= SafeArrayCopy(m_arDouble
, val
)))
722 STDMETHODIMP
CBasic::inoutSequenceObject(LPSAFEARRAY
* val
)
725 SAFEARRAY
*arTemp
= NULL
;
726 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
728 if (FAILED(hr
= SafeArrayCopy(m_arObject
, val
)))
734 // 2-dimensional Array
735 STDMETHODIMP
CBasic::inMulDimArrayLong(LPSAFEARRAY val
)
737 printMulArray( val
, VT_I4
);
740 // 2-dimensional Array
741 STDMETHODIMP
CBasic::inMulDimArrayVariant(LPSAFEARRAY val
)
743 printMulArray( val
, VT_VARIANT
);
746 // 3-dimensional Array
747 STDMETHODIMP
CBasic::inMulDimArrayLong2(LPSAFEARRAY val
)
749 printMulArray( val
, VT_I4
);
752 // 3-dimensional Array
753 STDMETHODIMP
CBasic::inMulDimArrayVariant2(LPSAFEARRAY val
)
759 STDMETHODIMP
CBasic::inMulDimArrayByte(LPSAFEARRAY val
)
762 if (FAILED(hr
= SafeArrayDestroy(m_arByteDim2
)))
764 if (FAILED(hr
= SafeArrayCopy(val
, & m_arByteDim2
)))
768 // 3-dimensionales array
769 STDMETHODIMP
CBasic::inMulDimArrayByte2(LPSAFEARRAY val
)
772 // TODO: Add your implementation code here
773 //printMulArray( val, VT_UI1);
777 // supports 2 and 3 dimensionals SAFEARRAY with elements of long or VARIANT
778 void CBasic::printMulArray( SAFEARRAY
* val
, VARTYPE type
)
781 UINT dims
= SafeArrayGetDim( val
);
797 hr
= SafeArrayGetLBound( val
, 1, &lbound1
);
798 hr
= SafeArrayGetUBound( val
, 1, &ubound1
);
799 length1
= ubound1
- lbound1
+1;
801 hr
= SafeArrayGetLBound( val
, 2, &lbound2
);
802 hr
= SafeArrayGetUBound( val
, 2, &ubound2
);
803 length2
= ubound2
- lbound2
+ 1;
807 for( long i
= 0; i
< length2
; i
++)
809 for( long j
= 0; j
<length1
; j
++)
818 hr
= SafeArrayGetElement( val
, index
, &longVal
);
819 sprintf( tmpBuf
, "(%d,%d): %d\n", index
[1], index
[0], longVal
);
822 hr
= SafeArrayGetElement( val
, index
, &longVal
);
823 sprintf( tmpBuf
, "(%d,%d): %d\n", index
[1], index
[0], (unsigned char)longVal
);
826 hr
= SafeArrayGetElement( val
, index
, &var
);
827 sprintf( tmpBuf
, "(%d,%d): %d (vartype %d)\n", index
[1], index
[0], var
.byref
, var
.vt
);
830 strcat( buff
,tmpBuf
);
839 hr
= SafeArrayGetLBound( val
, 1, &lbound1
);
840 hr
= SafeArrayGetUBound( val
, 1, &ubound1
);
841 length1
= ubound1
- lbound1
+1;
843 hr
= SafeArrayGetLBound( val
, 2, &lbound2
);
844 hr
= SafeArrayGetUBound( val
, 2, &ubound2
);
845 length2
= ubound2
- lbound2
+ 1;
847 hr
= SafeArrayGetLBound( val
, 3, &lbound3
);
848 hr
= SafeArrayGetUBound( val
, 3, &ubound3
);
849 length3
= ubound3
- lbound3
+1;
853 for( long i
= 0; i
< length3
; i
++)
855 for( long j
= 0; j
<length2
; j
++)
857 for( long k
= 0; k
<length1
; k
++)
867 hr
= SafeArrayGetElement( val
, index
, &longVal
);
868 sprintf( tmpBuf
, "(%d,%d,%d): %d\n", index
[2], index
[1], index
[0], longVal
);
871 hr
= SafeArrayGetElement( val
, index
, &longVal
);
872 sprintf( tmpBuf
, "(%d,%d,%d): %d\n", index
[2], index
[1], index
[0], (unsigned char)longVal
);
876 hr
= SafeArrayGetElement( val
, index
, &var
);
877 sprintf( tmpBuf
, "(%d,%d,%d): %d (vartype %d)\n", index
[2], index
[1], index
[0], var
.byref
, var
.vt
);
880 strcat( buff
,tmpBuf
);
888 MessageBox( NULL
, A2T( buff
), _T("AxTestControl.Basic"), MB_OK
);
896 STDMETHODIMP
CBasic::outMore(long* val1
, long* val2
)
898 // TODO: Add your implementation code here
903 // If an optional parameter was not provided then the respective member will
905 STDMETHODIMP
CBasic::optional1(/*[in]*/ long val1
, /*[in, optional]*/ VARIANT
* val2
)
908 if (val2
->vt
!= VT_ERROR
)
913 STDMETHODIMP
CBasic::optional2(/*[out]*/ long* val1
,/*[out, optional]*/ VARIANT
* val2
)
918 if (val2
->vt
!= VT_ERROR
)
919 hr
= VariantCopy(val2
, & m_var1
);
923 STDMETHODIMP
CBasic::optional3(/*[in, optional]*/ VARIANT
* val1
,/*[in, optional]*/ VARIANT
* val2
)
925 //if (val1->vt != VT_ERROR)
928 //if (val2->vt != VT_ERROR)
933 STDMETHODIMP
CBasic::optional4(/*[in, out, optional]*/ VARIANT
* val1
,
934 /*[in, out, optional]*/ VARIANT
* val2
)
937 //return the previously set in values
938 if (val1
->vt
!= VT_ERROR
)
940 CComVariant
var1(*val1
);
941 if (FAILED(hr
= VariantCopy(val1
, & m_var1
)))
945 if (val2
->vt
!= VT_ERROR
)
947 CComVariant
var2(*val2
);
948 if (FAILED(hr
= VariantCopy(val2
, & m_var2
)))
955 STDMETHODIMP
CBasic::optional5(/*[out, optional]*/ VARIANT
* val1
,
956 /*[out, optional]*/ VARIANT
* val2
)
959 if (FAILED(hr
= VariantCopy(val1
, &m_var1
)))
961 if (FAILED(hr
= VariantCopy(val2
, &m_var2
)))
966 STDMETHODIMP
CBasic::defaultvalue1(/*[in, defaultvalue(10)]*/ long val1
,
967 /*[in, defaultvalue(3.14)]*/ double* val2
,
968 // /*[in, defaultvalue(10)]*/ VARIANT val3,
969 /*[in, defaultvalue(100)]*/ VARIANT
* val4
)
977 STDMETHODIMP
CBasic::defaultvalue2(/*[in, out, defaultvalue(10)]*/ long* val1
,
978 /*[in, out, defaultvalue(3.14)]*/ double* val2
,
979 // /*[in, out, defaultvalue(10)]*/ VARIANT* val3,
980 /*[in, out, defaultvalue(100)]*/ VARIANT
* val4
)
984 double aDouble
= *val2
;
985 // CComVariant var1(*val3);
986 CComVariant
var2(*val4
);
989 //if (FAILED(hr = VariantCopy(val3, &m_var1)))
991 if (FAILED(hr
= VariantCopy(val4
, &m_var2
)))
999 /* val2 contains the variable argument list. If no such arguments are supplied
1000 then the safearray is invalid. SafeArrayCopy then returns E_INVALIDARG
1002 STDMETHODIMP
CBasic::varargfunc1(/*[in]*/ long val1
,/*[in]*/ LPSAFEARRAY val2
)
1007 if (FAILED(hr
= SafeArrayDestroy(m_safearray
)))
1009 if (FAILED(hr
= SafeArrayCopy(val2
, & m_safearray
)))
1011 if (hr
!= E_INVALIDARG
)
1017 STDMETHODIMP
CBasic::varargfunc2(/*[out]*/ long* val1
, /*[out]*/ SAFEARRAY
** val2
)
1020 HRESULT hr
= SafeArrayCopy(m_safearray
, val2
);
1024 STDMETHODIMP
CBasic::inSequenceByteDim2(LPSAFEARRAY val
)
1027 if (FAILED(hr
= SafeArrayDestroy(m_arByteDim2
)))
1029 if (FAILED(hr
= SafeArrayCopy(val
, & m_arByteDim2
)))
1035 STDMETHODIMP
CBasic::inCurrency(CY val
)
1041 STDMETHODIMP
CBasic::outCurrency(CY
* val
)
1047 STDMETHODIMP
CBasic::inoutCurrency(CY
* val
)
1055 STDMETHODIMP
CBasic::inDate(DATE val
)
1061 STDMETHODIMP
CBasic::outDate(DATE
* val
)
1067 STDMETHODIMP
CBasic::inoutDate(DATE
* val
)
1075 STDMETHODIMP
CBasic::get_prpCurrency(CY
* pVal
)
1081 STDMETHODIMP
CBasic::put_prpCurrency(CY newVal
)
1087 STDMETHODIMP
CBasic::get_prpDate(DATE
* pVal
)
1093 STDMETHODIMP
CBasic::put_prpDate(DATE newVal
)
1099 //VT_I4 DECIMAL_NEG //tagVARIANT DISPATCH_PROPERTYPUT
1100 STDMETHODIMP
CBasic::inDecimal(DECIMAL val
)
1106 STDMETHODIMP
CBasic::outDecimal(DECIMAL
* val
)
1112 STDMETHODIMP
CBasic::inoutDecimal(DECIMAL
* val
)
1121 STDMETHODIMP
CBasic::get_prpDecimal(DECIMAL
* pVal
)
1127 STDMETHODIMP
CBasic::put_prpDecimal(DECIMAL newVal
)
1133 STDMETHODIMP
CBasic::inSCode(SCODE val
)
1139 STDMETHODIMP
CBasic::outScode(SCODE
* val
)
1145 STDMETHODIMP
CBasic::inoutSCode(SCODE
* val
)
1153 STDMETHODIMP
CBasic::get_prpSCode(SCODE
* pVal
)
1159 STDMETHODIMP
CBasic::put_prpSCode(SCODE newVal
)
1165 STDMETHODIMP
CBasic::inrefLong(LONG
* val
)
1171 STDMETHODIMP
CBasic::inrefVariant(VARIANT
* val
)
1174 if (FAILED(hr
= VariantCopy( & m_var1
, val
)))
1179 STDMETHODIMP
CBasic::inrefDecimal(DECIMAL
* val
)
1185 STDMETHODIMP
CBasic::get_prpRefLong(long* pVal
)
1191 STDMETHODIMP
CBasic::putref_prpRefLong(long* newVal
)
1197 STDMETHODIMP
CBasic::get_prprefVariant(VARIANT
* pVal
)
1200 hr
= VariantCopy(pVal
, & m_var1
);
1204 STDMETHODIMP
CBasic::putref_prprefVariant(VARIANT
* newVal
)
1210 STDMETHODIMP
CBasic::get_prprefDecimal(DECIMAL
* pVal
)
1216 STDMETHODIMP
CBasic::putref_prprefDecimal(DECIMAL
* newVal
)
1218 m_decimal
= *newVal
;
1223 STDMETHODIMP
CBasic::optional6(VARIANT
* val1
, VARIANT
* val2
, VARIANT
* val3
, VARIANT
* val4
)
1226 if (FAILED(hr
= m_var1
.Copy(val1
)))
1228 if (FAILED(hr
= m_var2
.Copy(val2
)))
1230 if (FAILED(hr
= m_var3
.Copy(val3
)))
1232 if (FAILED(hr
= m_var4
.Copy(val4
)))
1237 STDMETHODIMP
CBasic::optional7(VARIANT
* val1
, VARIANT
* val2
, VARIANT
* val3
, VARIANT
* val4
)
1240 if (FAILED(hr
= VariantCopy(val1
, & m_var1
)))
1242 if (FAILED(hr
= VariantCopy(val2
, & m_var2
)))
1244 if (FAILED(hr
= VariantCopy(val3
, & m_var3
)))
1246 if (FAILED(hr
= VariantCopy(val4
, & m_var4
)))
1252 STDMETHODIMP
CBasic::get_prpMultiArg1(VARIANT
* val1
, VARIANT
* val2
, VARIANT
* pVal
)
1255 CComVariant
tmp1(*val1
);
1256 CComVariant
tmp2(*val2
);
1258 if (FAILED(hr
= VariantCopy(val1
, & m_var1
)))
1260 if (FAILED(hr
= VariantCopy(val2
, & m_var2
)))
1264 if (FAILED(hr
= VariantCopy(pVal
, & m_var3
)))
1269 STDMETHODIMP
CBasic::put_prpMultiArg1(VARIANT
* val1
, VARIANT
* val2
, VARIANT
* newVal
)
1272 CComVariant
tmp1( * val1
);
1273 CComVariant
tmp2( * val2
);
1275 if (FAILED(hr
= VariantCopy(val1
, & m_var1
)))
1277 if (FAILED(hr
= VariantCopy(val2
, & m_var2
)))
1286 // tagVARIANT DISPATCH_PROPERTYPUT DISPID_PROPERTYPUT VARIANTARG LOCALE_USER_DEFAULT
1288 STDMETHODIMP
CBasic::get_prpMultiArg2(VARIANT val1
, VARIANT
* pVal
)
1293 if (FAILED(hr
= VariantCopy(pVal
, & m_var2
)))
1298 STDMETHODIMP
CBasic::put_prpMultiArg2(VARIANT val1
, VARIANT newVal
)
1305 // returns the values set by prpMultiArg2
1306 STDMETHODIMP
CBasic::prpMultiArg2GetValues(VARIANT
* val1
, VARIANT
* valProperty
)
1309 if (FAILED(VariantCopy(val1
, & m_var1
)))
1311 if (FAILED(VariantCopy(valProperty
, & m_var2
)))
1316 STDMETHODIMP
CBasic::get_prpMultiArg3(LONG
* val1
, LONG
* pVal
)
1326 STDMETHODIMP
CBasic::put_prpMultiArg3(LONG
* val1
, LONG newVal
)
1336 STDMETHODIMP
CBasic::inUnknown(IUnknown
* val
)
1343 STDMETHODIMP
CBasic::outUnknown(IUnknown
** val
)
1345 m_unknown
.CopyTo(val
);
1349 STDMETHODIMP
CBasic::inoutUnknown(IUnknown
** val
)
1351 CComPtr
<IUnknown
> tmp
= *val
;
1352 m_unknown
.CopyTo(val
);
1357 STDMETHODIMP
CBasic::get_prpUnknown(IUnknown
** pVal
)
1359 m_prpUnknown
.CopyTo(pVal
);
1363 STDMETHODIMP
CBasic::put_prpUnknown(IUnknown
* newVal
)
1365 m_prpUnknown
= newVal
;