bump product version to 4.1.6.2
[LibreOffice.git] / extensions / source / ole / jscriptclasses.hxx
blob606c2385f7119b71201b98fcf11846fecf652aaf
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef JSCRIPTCLASSES_HXX
21 #define JSCRIPTCLASSES_HXX
23 #include <wincrap.hxx>
25 #pragma warning (disable:4505)
26 // disable "unreferenced local function has been removed" globally
28 #include "comifaces.hxx"
32 // Sequences are represented by prepending "[]", e.g. []char, [][]byte, [][][]object, etc.
34 // To make a JScriptValue object to an out parameter, call
35 // "InitOutParam" and to make it a in/out parameter call
36 // "InitInOutParam"
38 // If the object represents an out parameter then the value can after the call
39 // be retrived by "Get".
41 // From JavaScript the functions Get, Set, InitOutParam and InitInOutParam are
42 // used, that is they are accessible through IDispatch. The functions are used
43 // by the bridge.
45 class JScriptValue:
46 public CComObjectRootEx<CComMultiThreadModel>,
47 public IJScriptValueObject,
48 public IDispatch
50 public:
51 JScriptValue();
52 virtual ~JScriptValue();
54 BEGIN_COM_MAP(JScriptValue)
55 COM_INTERFACE_ENTRY(IDispatch)
56 COM_INTERFACE_ENTRY(IJScriptValueObject)
57 END_COM_MAP()
59 // IDispatch -------------------------------------------
60 STDMETHOD( GetTypeInfoCount)(UINT *pctinfo);
62 STDMETHOD( GetTypeInfo)( UINT iTInfo,
63 LCID lcid,
64 ITypeInfo **ppTInfo);
66 STDMETHOD( GetIDsOfNames)( REFIID riid,
67 LPOLESTR *rgszNames,
68 UINT cNames,
69 LCID lcid,
70 DISPID *rgDispId);
72 STDMETHOD( Invoke)( DISPID dispIdMember,
73 REFIID riid,
74 LCID lcid,
75 WORD wFlags,
76 DISPPARAMS *pDispParams,
77 VARIANT *pVarResult,
78 EXCEPINFO *pExcepInfo,
79 UINT *puArgErr);
80 // IJScriptOutParam --------------------------------------
82 STDMETHOD( Set)( VARIANT type, VARIANT value);
83 STDMETHOD( Get)( VARIANT *val);
84 STDMETHOD( InitOutParam)();
85 STDMETHOD( InitInOutParam)( VARIANT type, VARIANT value);
86 STDMETHOD( IsOutParam)( VARIANT_BOOL * flag);
87 STDMETHOD( IsInOutParam)( VARIANT_BOOL * flag);
88 STDMETHOD( GetValue)( BSTR* type, VARIANT *value);
91 CComVariant m_varValue;
92 CComBSTR m_bstrType;
93 unsigned m_bOutParam: 1;
94 unsigned m_bInOutParam: 1;
98 // If a class is implemented in JScript, then its method
99 class JScriptOutParam:
100 public CComObjectRootEx<CComMultiThreadModel>,
101 public IDispatch
103 public:
104 JScriptOutParam();
105 virtual ~JScriptOutParam();
107 BEGIN_COM_MAP(JScriptOutParam)
108 COM_INTERFACE_ENTRY(IDispatch)
109 END_COM_MAP()
111 // IDispatch -------------------------------------------
112 STDMETHOD( GetTypeInfoCount)(UINT *pctinfo);
114 STDMETHOD( GetTypeInfo)( UINT iTInfo,
115 LCID lcid,
116 ITypeInfo **ppTInfo);
118 STDMETHOD( GetIDsOfNames)( REFIID riid,
119 LPOLESTR *rgszNames,
120 UINT cNames,
121 LCID lcid,
122 DISPID *rgDispId);
124 STDMETHOD( Invoke)( DISPID dispIdMember,
125 REFIID riid,
126 LCID lcid,
127 WORD wFlags,
128 DISPPARAMS *pDispParams,
129 VARIANT *pVarResult,
130 EXCEPINFO *pExcepInfo,
131 UINT *puArgErr);
134 private:
135 CComVariant m_varValue;
138 #endif
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */