Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / extensions / source / ole / jscriptclasses.hxx
blob5d43b3a6b772c3f25fc489eb966574114b962797
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 INCLUDED_EXTENSIONS_SOURCE_OLE_JSCRIPTCLASSES_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_OLE_JSCRIPTCLASSES_HXX
23 #include "wincrap.hxx"
25 #include "comifaces.hxx"
28 // Sequences are represented by prepending "[]", e.g. []char, [][]byte, [][][]object, etc.
30 // To make a JScriptValue object to an out parameter, call
31 // "InitOutParam" and to make it a in/out parameter call
32 // "InitInOutParam"
34 // If the object represents an out parameter then the value can after the call
35 // be retrieved by "Get".
37 // From JavaScript the functions Get, Set, InitOutParam and InitInOutParam are
38 // used, that is they are accessible through IDispatch. The functions are used
39 // by the bridge.
41 class JScriptValue:
42 public CComObjectRootEx<CComMultiThreadModel>,
43 public IJScriptValueObject,
44 public IDispatch
46 public:
47 JScriptValue();
48 virtual ~JScriptValue();
50 BEGIN_COM_MAP(JScriptValue)
51 COM_INTERFACE_ENTRY(IDispatch)
52 COM_INTERFACE_ENTRY(IJScriptValueObject)
53 #if defined __clang__
54 #pragma clang diagnostic push
55 #pragma clang diagnostic ignored "-Winconsistent-missing-override"
56 #endif
57 END_COM_MAP()
58 #if defined __clang__
59 #pragma clang diagnostic pop
60 #endif
62 // IDispatch -------------------------------------------
63 STDMETHOD( GetTypeInfoCount)(UINT *pctinfo) override;
65 STDMETHOD( GetTypeInfo)( UINT iTInfo,
66 LCID lcid,
67 ITypeInfo **ppTInfo) override;
69 STDMETHOD( GetIDsOfNames)( REFIID riid,
70 LPOLESTR *rgszNames,
71 UINT cNames,
72 LCID lcid,
73 DISPID *rgDispId) override;
75 STDMETHOD( Invoke)( DISPID dispIdMember,
76 REFIID riid,
77 LCID lcid,
78 WORD wFlags,
79 DISPPARAMS *pDispParams,
80 VARIANT *pVarResult,
81 EXCEPINFO *pExcepInfo,
82 UINT *puArgErr) override;
83 // IJScriptOutParam --------------------------------------
85 STDMETHOD( Set)( VARIANT type, VARIANT value) override;
86 STDMETHOD( Get)( VARIANT *val) override;
87 STDMETHOD( InitOutParam)() override;
88 STDMETHOD( InitInOutParam)( VARIANT type, VARIANT value) override;
89 STDMETHOD( IsOutParam)( VARIANT_BOOL * flag) override;
90 STDMETHOD( IsInOutParam)( VARIANT_BOOL * flag) override;
91 STDMETHOD( GetValue)( BSTR* type, VARIANT *value) override;
94 CComVariant m_varValue;
95 CComBSTR m_bstrType;
96 bool m_bOutParam: 1;
97 bool m_bInOutParam: 1;
101 // If a class is implemented in JScript, then its method
102 class JScriptOutParam:
103 public CComObjectRootEx<CComMultiThreadModel>,
104 public IDispatch
106 public:
107 JScriptOutParam();
108 virtual ~JScriptOutParam();
110 BEGIN_COM_MAP(JScriptOutParam)
111 COM_INTERFACE_ENTRY(IDispatch)
112 #if defined __clang__
113 #pragma clang diagnostic push
114 #pragma clang diagnostic ignored "-Winconsistent-missing-override"
115 #endif
116 END_COM_MAP()
117 #if defined __clang__
118 #pragma clang diagnostic pop
119 #endif
121 // IDispatch -------------------------------------------
122 STDMETHOD( GetTypeInfoCount)(UINT *pctinfo) override;
124 STDMETHOD( GetTypeInfo)( UINT iTInfo,
125 LCID lcid,
126 ITypeInfo **ppTInfo) override;
128 STDMETHOD( GetIDsOfNames)( REFIID riid,
129 LPOLESTR *rgszNames,
130 UINT cNames,
131 LCID lcid,
132 DISPID *rgDispId) override;
134 STDMETHOD( Invoke)( DISPID dispIdMember,
135 REFIID riid,
136 LCID lcid,
137 WORD wFlags,
138 DISPPARAMS *pDispParams,
139 VARIANT *pVarResult,
140 EXCEPINFO *pExcepInfo,
141 UINT *puArgErr) override;
144 private:
145 CComVariant m_varValue;
148 #endif
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */