LibreOffice Module basctl (master) 1
docsignature.cxx
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#include <docsignature.hxx>
21#include <scriptdocument.hxx>
22
23#include <sfx2/objsh.hxx>
25
26#include <osl/diagnose.h>
27
28
29namespace basctl
30{
31 using ::com::sun::star::uno::Reference;
32 using ::com::sun::star::frame::XModel;
33
34 // DocumentSignature
35
37 m_pShell(nullptr)
38 {
39 if (!rDocument.isDocument())
40 return;
41
42 Reference<XModel> xDocument(rDocument.getDocument());
43 // find object shell for document
45 while ( pShell )
46 {
47 if ( pShell->GetModel() == xDocument )
48 break;
49 pShell = SfxObjectShell::GetNext( *pShell );
50 }
51 m_pShell = pShell;
52 }
53
55 {
56 return ( m_pShell != nullptr );
57 }
58
60 {
61 OSL_PRECOND( supportsSignatures(), "DocumentSignature::signScriptingContent: signatures not supported by this document!" );
62 if ( m_pShell )
63 m_pShell->SignScriptingContent(pDialogParent);
64 }
65
67 {
68 if ( m_pShell )
70 return SignatureState::NOSIGNATURES;
71 }
72
73} // namespace basctl
74
75/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static SAL_WARN_UNUSED_RESULT SfxObjectShell * GetNext(const SfxObjectShell &rPrev, const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
css::uno::Reference< css::frame::XModel3 > GetModel() const
static SAL_WARN_UNUSED_RESULT SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
SignatureState GetScriptingSignatureState()
bool SignScriptingContent(weld::Window *pDialogParent)
bool supportsSignatures() const
determines whether the instance is valid
SignatureState getScriptingSignatureState() const
retrieves the state of the signature of the scripting content inside the document
void signScriptingContent(weld::Window *pDialogParent) const
signs the scripting content inside the document
SfxObjectShell * m_pShell
encapsulates a document which contains Basic scripts and dialogs
css::uno::Reference< css::frame::XModel > getDocument() const
returns the UNO component representing the document which the instance operates on
bool isDocument() const
determines whether the ScriptDocument instance operates on a real document, as opposed to the whole a...
Shell * m_pShell
Definition: iderdll.cxx:50
SignatureState