LibreOffice Module extensions (master) 1
jscriptclasses.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include "wincrap.hxx"
23
24#include "comifaces.hxx"
25
26
27// Sequences are represented by prepending "[]", e.g. []char, [][]byte, [][][]object, etc.
28
29// To make a JScriptValue object to an out parameter, call
30// "InitOutParam" and to make it a in/out parameter call
31// "InitInOutParam"
32
33// If the object represents an out parameter then the value can after the call
34// be retrieved by "Get".
35
36// From JavaScript the functions Get, Set, InitOutParam and InitInOutParam are
37// used, that is they are accessible through IDispatch. The functions are used
38// by the bridge.
39
41 public CComObjectRootEx<CComMultiThreadModel>,
42 public IJScriptValueObject,
43 public IDispatch
44{
45public:
47 virtual ~JScriptValue();
48
49 BEGIN_COM_MAP(JScriptValue)
50 COM_INTERFACE_ENTRY(IDispatch)
51 COM_INTERFACE_ENTRY(IJScriptValueObject)
52#if defined __clang__
53#pragma clang diagnostic push
54#pragma clang diagnostic ignored "-Winconsistent-missing-override"
55#endif
56 END_COM_MAP()
57#if defined __clang__
58#pragma clang diagnostic pop
59#endif
60
61 // IDispatch -------------------------------------------
62 STDMETHOD( GetTypeInfoCount)(UINT *pctinfo) override;
63
64 STDMETHOD( GetTypeInfo)( UINT iTInfo,
65 LCID lcid,
66 ITypeInfo **ppTInfo) override;
67
68 STDMETHOD( GetIDsOfNames)( REFIID riid,
69 LPOLESTR *rgszNames,
70 UINT cNames,
71 LCID lcid,
72 DISPID *rgDispId) override;
73
74 STDMETHOD( Invoke)( DISPID dispIdMember,
75 REFIID riid,
76 LCID lcid,
77 WORD wFlags,
78 DISPPARAMS *pDispParams,
79 VARIANT *pVarResult,
80 EXCEPINFO *pExcepInfo,
81 UINT *puArgErr) override;
82 // IJScriptOutParam --------------------------------------
83
84 STDMETHOD( Set)( VARIANT type, VARIANT value) override;
85 STDMETHOD( Get)( VARIANT *val) override;
86 STDMETHOD( InitOutParam)() override;
87 STDMETHOD( InitInOutParam)( VARIANT type, VARIANT value) override;
88 STDMETHOD( IsOutParam)( VARIANT_BOOL * flag) override;
89 STDMETHOD( IsInOutParam)( VARIANT_BOOL * flag) override;
90 STDMETHOD( GetValue)( BSTR* type, VARIANT *value) override;
91
92
93 CComVariant m_varValue;
94 CComBSTR m_bstrType;
95 bool m_bOutParam: 1;
97
98};
99
100// If a class is implemented in JScript, then its method
102 public CComObjectRootEx<CComMultiThreadModel>,
103 public IDispatch
104{
105public:
107 virtual ~JScriptOutParam();
108
109 BEGIN_COM_MAP(JScriptOutParam)
110 COM_INTERFACE_ENTRY(IDispatch)
111#if defined __clang__
112#pragma clang diagnostic push
113#pragma clang diagnostic ignored "-Winconsistent-missing-override"
114#endif
115 END_COM_MAP()
116#if defined __clang__
117#pragma clang diagnostic pop
118#endif
119
120 // IDispatch -------------------------------------------
121 STDMETHOD( GetTypeInfoCount)(UINT *pctinfo) override;
122
123 STDMETHOD( GetTypeInfo)( UINT iTInfo,
124 LCID lcid,
125 ITypeInfo **ppTInfo) override;
126
127 STDMETHOD( GetIDsOfNames)( REFIID riid,
128 LPOLESTR *rgszNames,
129 UINT cNames,
130 LCID lcid,
131 DISPID *rgDispId) override;
132
133 STDMETHOD( Invoke)( DISPID dispIdMember,
134 REFIID riid,
135 LCID lcid,
136 WORD wFlags,
137 DISPPARAMS *pDispParams,
138 VARIANT *pVarResult,
139 EXCEPINFO *pExcepInfo,
140 UINT *puArgErr) override;
141
142
143private:
144 CComVariant m_varValue;
145};
146
147/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
STDMETHOD() GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) override
STDMETHOD() GetTypeInfoCount(UINT *pctinfo) override
STDMETHOD() Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) override
CComVariant m_varValue
virtual ~JScriptOutParam()
STDMETHOD() GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) override
STDMETHOD() Get(VARIANT *val) override
STDMETHOD() Set(VARIANT type, VARIANT value) override
CComVariant m_varValue
STDMETHOD() IsInOutParam(VARIANT_BOOL *flag) override
STDMETHOD() GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) override
virtual ~JScriptValue()
STDMETHOD() GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) override
STDMETHOD() GetValue(BSTR *type, VARIANT *value) override
STDMETHOD() InitInOutParam(VARIANT type, VARIANT value) override
STDMETHOD() GetTypeInfoCount(UINT *pctinfo) override
CComBSTR m_bstrType
STDMETHOD() IsOutParam(VARIANT_BOOL *flag) override
STDMETHOD() Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) override
STDMETHOD() InitOutParam() override
Any value
unsigned short WORD
ResultType type