1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef __JSCRIPTCLASSES_HXX
28 #define __JSCRIPTCLASSES_HXX
31 #pragma warning (push,1)
32 #pragma warning (disable:4548)
34 #include <tools/presys.h>
37 #define _WIN32_WINNT 0x0400
39 #if OSL_DEBUG_LEVEL > 0
40 //#define _ATL_DEBUG_INTERFACES
43 extern CComModule _Module
;
45 #include <tools/postsys.h>
48 #pragma warning (disable:4505)
49 // disable "unreferenced local function has been removed" globally
51 #include "comifaces.hxx"
55 // Sequences are represented by prepending "[]", e.g. []char, [][]byte, [][][]object, etc.
57 // To make a JScriptValue object to an out parameter, call
58 // "InitOutParam" and to make it a in/out parameter call
61 // If the object represents an out parameter then the value can after the call
62 // be retrived by "Get".
64 // From JavaScript the functions Get, Set, InitOutParam and InitInOutParam are
65 // used, that is they are accessible through IDispatch. The functions are used
69 public CComObjectRootEx
<CComMultiThreadModel
>,
70 public IJScriptValueObject
,
75 virtual ~JScriptValue();
77 BEGIN_COM_MAP(JScriptValue
)
78 COM_INTERFACE_ENTRY(IDispatch
)
79 COM_INTERFACE_ENTRY(IJScriptValueObject
)
82 // IDispatch -------------------------------------------
83 STDMETHOD( GetTypeInfoCount
)(UINT
*pctinfo
);
85 STDMETHOD( GetTypeInfo
)( UINT iTInfo
,
89 STDMETHOD( GetIDsOfNames
)( REFIID riid
,
95 STDMETHOD( Invoke
)( DISPID dispIdMember
,
99 DISPPARAMS
*pDispParams
,
101 EXCEPINFO
*pExcepInfo
,
103 // IJScriptOutParam --------------------------------------
105 STDMETHOD( Set
)( VARIANT type
, VARIANT value
);
106 STDMETHOD( Get
)( VARIANT
*val
);
107 STDMETHOD( InitOutParam
)();
108 STDMETHOD( InitInOutParam
)( VARIANT type
, VARIANT value
);
109 STDMETHOD( IsOutParam
)( VARIANT_BOOL
* flag
);
110 STDMETHOD( IsInOutParam
)( VARIANT_BOOL
* flag
);
111 STDMETHOD( GetValue
)( BSTR
* type
, VARIANT
*value
);
114 CComVariant m_varValue
;
116 unsigned m_bOutParam
: 1;
117 unsigned m_bInOutParam
: 1;
121 // If a class is implemented in JScript, then its method
122 class JScriptOutParam
:
123 public CComObjectRootEx
<CComMultiThreadModel
>,
128 virtual ~JScriptOutParam();
130 BEGIN_COM_MAP(JScriptOutParam
)
131 COM_INTERFACE_ENTRY(IDispatch
)
134 // IDispatch -------------------------------------------
135 STDMETHOD( GetTypeInfoCount
)(UINT
*pctinfo
);
137 STDMETHOD( GetTypeInfo
)( UINT iTInfo
,
139 ITypeInfo
**ppTInfo
);
141 STDMETHOD( GetIDsOfNames
)( REFIID riid
,
147 STDMETHOD( Invoke
)( DISPID dispIdMember
,
151 DISPPARAMS
*pDispParams
,
153 EXCEPINFO
*pExcepInfo
,
158 CComVariant m_varValue
;