update dev300-m58
[ooovba.git] / extensions / source / ole / jscriptclasses.hxx
bloba9aceea45a938407f341b4d67c39927302fe696c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: jscriptclasses.hxx,v $
10 * $Revision: 1.7 $
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>
38 //#include "stdafx.h"
39 #define STRICT
40 #define _WIN32_WINNT 0x0400
41 #define _WIN32_DCOM
42 #if OSL_DEBUG_LEVEL > 0
43 //#define _ATL_DEBUG_INTERFACES
44 #endif
45 #include <atlbase.h>
46 extern CComModule _Module;
47 #include <atlcom.h>
48 #include <tools/postsys.h>
50 #pragma warning (pop)
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
62 // "InitInOutParam"
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
69 // by the bridge.
71 class JScriptValue:
72 public CComObjectRootEx<CComMultiThreadModel>,
73 public IJScriptValueObject,
74 public IDispatch
76 public:
77 JScriptValue();
78 virtual ~JScriptValue();
80 BEGIN_COM_MAP(JScriptValue)
81 COM_INTERFACE_ENTRY(IDispatch)
82 COM_INTERFACE_ENTRY(IJScriptValueObject)
83 END_COM_MAP()
85 // IDispatch -------------------------------------------
86 STDMETHOD( GetTypeInfoCount)(UINT *pctinfo);
88 STDMETHOD( GetTypeInfo)( UINT iTInfo,
89 LCID lcid,
90 ITypeInfo **ppTInfo);
92 STDMETHOD( GetIDsOfNames)( REFIID riid,
93 LPOLESTR *rgszNames,
94 UINT cNames,
95 LCID lcid,
96 DISPID *rgDispId);
98 STDMETHOD( Invoke)( DISPID dispIdMember,
99 REFIID riid,
100 LCID lcid,
101 WORD wFlags,
102 DISPPARAMS *pDispParams,
103 VARIANT *pVarResult,
104 EXCEPINFO *pExcepInfo,
105 UINT *puArgErr);
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;
118 CComBSTR m_bstrType;
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>,
127 public IDispatch
129 public:
130 JScriptOutParam();
131 virtual ~JScriptOutParam();
133 BEGIN_COM_MAP(JScriptOutParam)
134 COM_INTERFACE_ENTRY(IDispatch)
135 END_COM_MAP()
137 // IDispatch -------------------------------------------
138 STDMETHOD( GetTypeInfoCount)(UINT *pctinfo);
140 STDMETHOD( GetTypeInfo)( UINT iTInfo,
141 LCID lcid,
142 ITypeInfo **ppTInfo);
144 STDMETHOD( GetIDsOfNames)( REFIID riid,
145 LPOLESTR *rgszNames,
146 UINT cNames,
147 LCID lcid,
148 DISPID *rgDispId);
150 STDMETHOD( Invoke)( DISPID dispIdMember,
151 REFIID riid,
152 LCID lcid,
153 WORD wFlags,
154 DISPPARAMS *pDispParams,
155 VARIANT *pVarResult,
156 EXCEPINFO *pExcepInfo,
157 UINT *puArgErr);
160 private:
161 CComVariant m_varValue;
164 #endif