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: jscriptclasses.hxx,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 ************************************************************************/
30 #ifndef __JSCRIPTCLASSES_HXX
31 #define __JSCRIPTCLASSES_HXX
34 #pragma warning (push,1)
35 #pragma warning (disable:4548)
37 #include <tools/presys.h>
40 #define _WIN32_WINNT 0x0400
42 #if OSL_DEBUG_LEVEL > 0
43 //#define _ATL_DEBUG_INTERFACES
46 extern CComModule _Module
;
48 #include <tools/postsys.h>
51 #pragma warning (disable:4505)
52 // disable "unreferenced local function has been removed" globally
54 #include "comifaces.hxx"
58 // Sequences are represented by prepending "[]", e.g. []char, [][]byte, [][][]object, etc.
60 // To make a JScriptValue object to an out parameter, call
61 // "InitOutParam" and to make it a in/out parameter call
64 // If the object represents an out parameter then the value can after the call
65 // be retrived by "Get".
67 // From JavaScript the functions Get, Set, InitOutParam and InitInOutParam are
68 // used, that is they are accessible through IDispatch. The functions are used
72 public CComObjectRootEx
<CComMultiThreadModel
>,
73 public IJScriptValueObject
,
78 virtual ~JScriptValue();
80 BEGIN_COM_MAP(JScriptValue
)
81 COM_INTERFACE_ENTRY(IDispatch
)
82 COM_INTERFACE_ENTRY(IJScriptValueObject
)
85 // IDispatch -------------------------------------------
86 STDMETHOD( GetTypeInfoCount
)(UINT
*pctinfo
);
88 STDMETHOD( GetTypeInfo
)( UINT iTInfo
,
92 STDMETHOD( GetIDsOfNames
)( REFIID riid
,
98 STDMETHOD( Invoke
)( DISPID dispIdMember
,
102 DISPPARAMS
*pDispParams
,
104 EXCEPINFO
*pExcepInfo
,
106 // IJScriptOutParam --------------------------------------
108 STDMETHOD( Set
)( VARIANT type
, VARIANT value
);
109 STDMETHOD( Get
)( VARIANT
*val
);
110 STDMETHOD( InitOutParam
)();
111 STDMETHOD( InitInOutParam
)( VARIANT type
, VARIANT value
);
112 STDMETHOD( IsOutParam
)( VARIANT_BOOL
* flag
);
113 STDMETHOD( IsInOutParam
)( VARIANT_BOOL
* flag
);
114 STDMETHOD( GetValue
)( BSTR
* type
, VARIANT
*value
);
117 CComVariant m_varValue
;
119 unsigned m_bOutParam
: 1;
120 unsigned m_bInOutParam
: 1;
124 // If a class is implemented in JScript, then its method
125 class JScriptOutParam
:
126 public CComObjectRootEx
<CComMultiThreadModel
>,
131 virtual ~JScriptOutParam();
133 BEGIN_COM_MAP(JScriptOutParam
)
134 COM_INTERFACE_ENTRY(IDispatch
)
137 // IDispatch -------------------------------------------
138 STDMETHOD( GetTypeInfoCount
)(UINT
*pctinfo
);
140 STDMETHOD( GetTypeInfo
)( UINT iTInfo
,
142 ITypeInfo
**ppTInfo
);
144 STDMETHOD( GetIDsOfNames
)( REFIID riid
,
150 STDMETHOD( Invoke
)( DISPID dispIdMember
,
154 DISPPARAMS
*pDispParams
,
156 EXCEPINFO
*pExcepInfo
,
161 CComVariant m_varValue
;