LibreOffice Module extensions (master) 1
SOActionsApproval.h
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// SOActionsApproval.h: Definition of the SOActionsApproval class
21
22#pragma once
23
24#ifdef _MSC_VER
25#pragma once
26#endif
27
28#include "resource.h"
29#include <ExDispID.h>
30#include <ExDisp.h>
31#include <shlguid.h>
32
33#include <atlctl.h>
34
35#include <so_activex.h>
36
37// SOActionsApproval
38
40 public IDispatchImpl<ISOActionsApproval, &IID_ISOActionsApproval, &LIBID_SO_ACTIVEXLib>,
41 public ISupportErrorInfo,
42 public CComObjectRoot,
43 public CComCoClass<SOActionsApproval,&CLSID_SOActionsApproval>
44{
45public:
47 virtual ~SOActionsApproval() {}
48
49BEGIN_COM_MAP(SOActionsApproval)
50 COM_INTERFACE_ENTRY(IDispatch)
51 COM_INTERFACE_ENTRY(ISOActionsApproval)
52 COM_INTERFACE_ENTRY(ISupportErrorInfo)
53#if defined __clang__
54#pragma clang diagnostic push
55#pragma clang diagnostic ignored "-Winconsistent-missing-override"
56#endif
57END_COM_MAP()
58#if defined __clang__
59#pragma clang diagnostic pop
60#endif
61DECLARE_NOT_AGGREGATABLE(SOActionsApproval)
62// Remove the comment from the line above if you don't want your object to
63// support aggregation.
64
65DECLARE_REGISTRY_RESOURCEID(IDR_SODOCUMENTEVENTLISTENER)
66
67// ISupportsErrorInfo
68 STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) override;
69
70// ISOActionsApproval
71 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE approveAction(
72 /* [in] */ long nActionID,
73 /* [retval][out] */ boolean *pbApproval) override
74 {
75 // only PreventClose is approved
76 USES_CONVERSION;
77 *pbApproval = ( nActionID == 1 );
78
79 return S_OK;
80 }
81
82 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Bridge_implementedInterfaces(
83 /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal) override
84 {
85 *pVal = SafeArrayCreateVector( VT_BSTR, 0, 1 );
86
87 if( !*pVal )
88 return E_FAIL;
89
90 LONG ix = 0;
91 CComBSTR aInterface( OLESTR( "com.sun.star.embed.XActionsApproval" ) );
92 SafeArrayPutElement( *pVal, &ix, aInterface );
93
94 return S_OK;
95 }
96};
97
98/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
STDMETHOD() InterfaceSupportsErrorInfo(REFIID riid) override
virtual HRESULT STDMETHODCALLTYPE get_Bridge_implementedInterfaces(SAFEARRAY __RPC_FAR *__RPC_FAR *pVal) override
virtual ~SOActionsApproval()
virtual HRESULT STDMETHODCALLTYPE approveAction(long nActionID, boolean *pbApproval) override
#define VT_BSTR
LONG
#define IDR_SODOCUMENTEVENTLISTENER
Definition: resource.h:32