1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
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
46 public CComObjectRootEx
<CComMultiThreadModel
>,
47 public IJScriptValueObject
,
52 virtual ~JScriptValue();
54 BEGIN_COM_MAP(JScriptValue
)
55 COM_INTERFACE_ENTRY(IDispatch
)
56 COM_INTERFACE_ENTRY(IJScriptValueObject
)
59 // IDispatch -------------------------------------------
60 STDMETHOD( GetTypeInfoCount
)(UINT
*pctinfo
);
62 STDMETHOD( GetTypeInfo
)( UINT iTInfo
,
66 STDMETHOD( GetIDsOfNames
)( REFIID riid
,
72 STDMETHOD( Invoke
)( DISPID dispIdMember
,
76 DISPPARAMS
*pDispParams
,
78 EXCEPINFO
*pExcepInfo
,
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
;
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
>,
105 virtual ~JScriptOutParam();
107 BEGIN_COM_MAP(JScriptOutParam
)
108 COM_INTERFACE_ENTRY(IDispatch
)
111 // IDispatch -------------------------------------------
112 STDMETHOD( GetTypeInfoCount
)(UINT
*pctinfo
);
114 STDMETHOD( GetTypeInfo
)( UINT iTInfo
,
116 ITypeInfo
**ppTInfo
);
118 STDMETHOD( GetIDsOfNames
)( REFIID riid
,
124 STDMETHOD( Invoke
)( DISPID dispIdMember
,
128 DISPPARAMS
*pDispParams
,
130 EXCEPINFO
*pExcepInfo
,
135 CComVariant m_varValue
;
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */