LibreOffice Module sfx2 (master) 1
docmacromode.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#ifndef INCLUDED_SFX2_DOCMACROMODE_HXX
21#define INCLUDED_SFX2_DOCMACROMODE_HXX
22
23#include <sfx2/dllapi.h>
25
26#include <com/sun/star/uno/Reference.hxx>
27
28#include <memory>
29
30namespace com::sun::star::document { class XEmbeddedScripts; }
31namespace com::sun::star::embed { class XStorage; }
32namespace com::sun::star::script { class XLibraryContainer; }
34
35
36namespace sfx2
37{
38
39
40 //= IMacroDocumentAccess
41
46 {
47 public:
68 virtual sal_Int16
70
87 virtual void
88 setCurrentMacroExecMode( sal_uInt16 ) = 0;
89
103 virtual OUString
105
113 virtual bool
115
119 virtual bool
121
131 virtual css::uno::Reference< css::document::XEmbeddedScripts >
133
144 virtual SignatureState
146
157 virtual bool
158 hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) = 0;
159
160 protected:
162 };
163
164
165 //= DocumentMacroMode
166
167 struct DocumentMacroMode_Data;
168
174 {
175 public:
182 DocumentMacroMode( IMacroDocumentAccess& _rDocumentAccess );
183
191 bool allowMacroExecution();
192
200 bool disallowMacroExecution();
201
225 bool adjustMacroMode(
226 const css::uno::Reference< css::task::XInteractionHandler >& _rxInteraction,
227 bool bHasValidContentSignature = false
228 );
229
248 bool isMacroExecutionDisallowed() const;
249
256 bool hasMacroLibrary() const;
257
258 bool hasUnsignedContentError() const;
259
267 static bool storageHasMacros( const css::uno::Reference< css::embed::XStorage >& _rxStorage );
268
269 static bool containerHasBasicMacros( const css::uno::Reference< css::script::XLibraryContainer >& xContainer );
293 bool
294 checkMacrosOnLoading(
295 const css::uno::Reference< css::task::XInteractionHandler >& _rxInteraction,
296 bool bHasValidContentSignature = false
297 );
298
299 private:
300 std::shared_ptr< DocumentMacroMode_Data > m_xData;
301 };
302
303
304} // namespace sfx2
305
306
307#endif // INCLUDED_SFX2_DOCMACROMODE_HXX
308
309/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
encapsulates handling the macro mode of a document
std::shared_ptr< DocumentMacroMode_Data > m_xData
provides access to several settings of a document, which are needed by ->DocumentMacroMode to properl...
virtual OUString getDocumentLocation() const =0
returns the origin of the document
virtual bool documentStorageHasMacros() const =0
checks whether the document's storage contains sub storages with macros or scripts
virtual void setCurrentMacroExecMode(sal_uInt16)=0
sets the MacroExecutionMode of the document, as calculated by the DocumentMacroMode class.
virtual bool macroCallsSeenWhileLoading() const =0
checks whether the document's contained calls to macros or scripts after loading
virtual sal_Int16 getCurrentMacroExecMode() const =0
retrieves the current MacroExecutionMode.
virtual css::uno::Reference< css::document::XEmbeddedScripts > getEmbeddedDocumentScripts() const =0
provides access to the XEmbeddedScripts interface of the document
virtual SignatureState getScriptingSignatureState()=0
returns the state of the signatures for the scripts embedded in the document
virtual bool hasTrustedScriptingSignature(bool bAllowUIToAddAuthor)=0
allows to detect whether there is a trusted scripting signature
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
Implementation of the interface com.sun.star.rdf.XDocumentMetadataAccess.
SignatureState
#define SAL_NO_VTABLE