Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / shell / inc / spsupp / COMOpenDocuments.hpp
blob21b378d895e69ee40dad637dbe5461e765dc7863
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/.
8 */
10 #ifndef INCLUDED_SHELL_INC_SPSUPP_COMOPENDOCUMENTS_HPP
11 #define INCLUDED_SHELL_INC_SPSUPP_COMOPENDOCUMENTS_HPP
13 #if defined __clang__
14 #pragma clang diagnostic push
15 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
16 #endif
17 #include <spsupp_h.h>
18 #if defined __clang__
19 #pragma clang diagnostic pop
20 #endif
21 #include "COMRefCounted.hpp"
22 #include <Objsafe.h>
23 #include <assert.h>
25 class COMOpenDocuments : public COMRefCounted<IOWSNewDocument3, IObjectSafety>
27 public:
29 class Error {
30 public:
31 Error(HRESULT syserr) : m_nErr(syserr) {}
32 HRESULT val() const { return m_nErr; }
33 private:
34 HRESULT m_nErr;
37 COMOpenDocuments();
38 virtual ~COMOpenDocuments() override;
40 // IUnknown methods
42 HRESULT STDMETHODCALLTYPE QueryInterface(
43 REFIID riid,
44 void **ppvObject) override;
46 // IDispatch methods
48 HRESULT STDMETHODCALLTYPE GetTypeInfoCount(
49 UINT *pctinfo) override;
51 HRESULT STDMETHODCALLTYPE GetTypeInfo(
52 UINT iTInfo,
53 LCID lcid,
54 ITypeInfo **ppTInfo) override;
56 HRESULT STDMETHODCALLTYPE GetIDsOfNames(
57 REFIID riid,
58 LPOLESTR *rgszNames,
59 UINT cNames,
60 LCID lcid,
61 DISPID *rgDispId) override;
63 HRESULT STDMETHODCALLTYPE Invoke(
64 DISPID dispIdMember,
65 REFIID riid,
66 LCID lcid,
67 WORD wFlags,
68 DISPPARAMS *pDispParams,
69 VARIANT *pVarResult,
70 EXCEPINFO *pExcepInfo,
71 UINT *puArgErr) override;
73 // IOWSNewDocument methods https://msdn.microsoft.com/en-us/library/cc264316
75 HRESULT STDMETHODCALLTYPE CreateNewDocument(
76 BSTR bstrTemplateLocation,
77 BSTR bstrDefaultSaveLocation,
78 VARIANT_BOOL *pbResult) override;
80 HRESULT STDMETHODCALLTYPE EditDocument(
81 BSTR bstrDocumentLocation,
82 VARIANT varProgID,
83 VARIANT_BOOL *pbResult) override;
85 // IOWSNewDocument2 methods
87 HRESULT STDMETHODCALLTYPE ViewDocument(
88 BSTR bstrDocumentLocation,
89 VARIANT varProgID,
90 VARIANT_BOOL *pbResult) override;
92 HRESULT STDMETHODCALLTYPE ViewDocument2(
93 IDispatch *pdisp,
94 BSTR bstrDocumentLocation,
95 VARIANT varProgID,
96 VARIANT_BOOL *pbResult) override;
98 HRESULT STDMETHODCALLTYPE EditDocument2(
99 IDispatch *pdisp,
100 BSTR bstrDocumentLocation,
101 VARIANT varProgID,
102 VARIANT_BOOL *pbResult) override;
104 HRESULT STDMETHODCALLTYPE CreateNewDocument2(
105 IDispatch *pdisp,
106 BSTR bstrTemplateLocation,
107 BSTR bstrDefaultSaveLocation,
108 VARIANT_BOOL *pbResult) override;
110 HRESULT STDMETHODCALLTYPE PromptedOnLastOpen(
111 VARIANT_BOOL *pbResult) override;
113 // IOWSNewDocument3 methods
115 HRESULT STDMETHODCALLTYPE ViewDocument3(
116 IDispatch *pdisp,
117 BSTR bstrDocumentLocation,
118 int OpenType,
119 VARIANT varProgID,
120 VARIANT_BOOL *pbResult) override;
122 HRESULT STDMETHODCALLTYPE CheckinDocument(
123 BSTR bstrDocumentLocation,
124 int CheckinType,
125 BSTR CheckinComment,
126 VARIANT_BOOL bKeepCheckout,
127 VARIANT_BOOL *pbResult) override;
129 HRESULT STDMETHODCALLTYPE DiscardLocalCheckout(
130 BSTR bstrDocumentLocationRaw,
131 VARIANT_BOOL *pbResult) override;
133 HRESULT STDMETHODCALLTYPE ViewInExcel(
134 BSTR SiteUrl,
135 BSTR FileName,
136 BSTR SessionId,
137 BSTR Cmd,
138 BSTR Sheet,
139 int Row,
140 int Column,
141 VARIANT varProgID) override;
143 HRESULT STDMETHODCALLTYPE CheckoutDocumentPrompt(
144 BSTR bstrDocumentLocationRaw,
145 VARIANT_BOOL fEditAfterCheckout,
146 VARIANT varProgID,
147 VARIANT_BOOL *pbResult) override;
149 HRESULT STDMETHODCALLTYPE EditDocument3(
150 IDispatch *pdisp,
151 BSTR bstrDocumentLocation,
152 VARIANT_BOOL fUseLocalCopy,
153 VARIANT varProgID,
154 VARIANT_BOOL *pbResult) override;
156 HRESULT STDMETHODCALLTYPE NewBlogPost(
157 BSTR bstrProviderId,
158 BSTR bstrBlogUrl,
159 BSTR bstrBlogName) override;
161 // IObjectSafety methods
163 HRESULT STDMETHODCALLTYPE GetInterfaceSafetyOptions(
164 REFIID riid,
165 DWORD *pdwSupportedOptions,
166 DWORD *pdwEnabledOptions) override;
168 HRESULT STDMETHODCALLTYPE SetInterfaceSafetyOptions(
169 REFIID riid,
170 DWORD dwOptionSetMask,
171 DWORD dwEnabledOptions) override;
173 // Non-COM methods
175 static long GetObjectCount();
177 private:
178 static long m_nObjCount;
179 static ITypeInfo* m_pTypeInfo;
180 static constexpr DWORD iSupportedOptionsMask = INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA;
181 DWORD m_iEnabledOptions = 0;
184 #endif
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */