merged tag ooo/OOO330_m14
[LibreOffice.git] / extensions / source / ole / jscriptclasses.hxx
blobf583a7962e035316546a97852f32c85777a74b7f
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>
35 //#include "stdafx.h"
36 #define STRICT
37 #define _WIN32_WINNT 0x0400
38 #define _WIN32_DCOM
39 #if OSL_DEBUG_LEVEL > 0
40 //#define _ATL_DEBUG_INTERFACES
41 #endif
42 #include <atlbase.h>
43 extern CComModule _Module;
44 #include <atlcom.h>
45 #include <tools/postsys.h>
47 #pragma warning (pop)
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
59 // "InitInOutParam"
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
66 // by the bridge.
68 class JScriptValue:
69 public CComObjectRootEx<CComMultiThreadModel>,
70 public IJScriptValueObject,
71 public IDispatch
73 public:
74 JScriptValue();
75 virtual ~JScriptValue();
77 BEGIN_COM_MAP(JScriptValue)
78 COM_INTERFACE_ENTRY(IDispatch)
79 COM_INTERFACE_ENTRY(IJScriptValueObject)
80 END_COM_MAP()
82 // IDispatch -------------------------------------------
83 STDMETHOD( GetTypeInfoCount)(UINT *pctinfo);
85 STDMETHOD( GetTypeInfo)( UINT iTInfo,
86 LCID lcid,
87 ITypeInfo **ppTInfo);
89 STDMETHOD( GetIDsOfNames)( REFIID riid,
90 LPOLESTR *rgszNames,
91 UINT cNames,
92 LCID lcid,
93 DISPID *rgDispId);
95 STDMETHOD( Invoke)( DISPID dispIdMember,
96 REFIID riid,
97 LCID lcid,
98 WORD wFlags,
99 DISPPARAMS *pDispParams,
100 VARIANT *pVarResult,
101 EXCEPINFO *pExcepInfo,
102 UINT *puArgErr);
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;
115 CComBSTR m_bstrType;
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>,
124 public IDispatch
126 public:
127 JScriptOutParam();
128 virtual ~JScriptOutParam();
130 BEGIN_COM_MAP(JScriptOutParam)
131 COM_INTERFACE_ENTRY(IDispatch)
132 END_COM_MAP()
134 // IDispatch -------------------------------------------
135 STDMETHOD( GetTypeInfoCount)(UINT *pctinfo);
137 STDMETHOD( GetTypeInfo)( UINT iTInfo,
138 LCID lcid,
139 ITypeInfo **ppTInfo);
141 STDMETHOD( GetIDsOfNames)( REFIID riid,
142 LPOLESTR *rgszNames,
143 UINT cNames,
144 LCID lcid,
145 DISPID *rgDispId);
147 STDMETHOD( Invoke)( DISPID dispIdMember,
148 REFIID riid,
149 LCID lcid,
150 WORD wFlags,
151 DISPPARAMS *pDispParams,
152 VARIANT *pVarResult,
153 EXCEPINFO *pExcepInfo,
154 UINT *puArgErr);
157 private:
158 CComVariant m_varValue;
161 #endif