Revert "Related tdf#158739: blacklist Nvidia RTX 4050 for Skia hardware"
[LibreOffice.git] / basctl / source / basicide / docsignature.cxx
blob08d7a1ab9c138c6cf3f57da9d5bc46ce75343f9d
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/.
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 #include <docsignature.hxx>
21 #include <scriptdocument.hxx>
23 #include <sfx2/objsh.hxx>
24 #include <sfx2/signaturestate.hxx>
26 #include <osl/diagnose.h>
29 namespace basctl
31 using ::com::sun::star::uno::Reference;
32 using ::com::sun::star::frame::XModel;
34 // DocumentSignature
36 DocumentSignature::DocumentSignature (ScriptDocument const& rDocument) :
37 m_pShell(nullptr)
39 if (!rDocument.isDocument())
40 return;
42 Reference<XModel> xDocument(rDocument.getDocument());
43 // find object shell for document
44 SfxObjectShell* pShell = SfxObjectShell::GetFirst();
45 while ( pShell )
47 if ( pShell->GetModel() == xDocument )
48 break;
49 pShell = SfxObjectShell::GetNext( *pShell );
51 m_pShell = pShell;
54 bool DocumentSignature::supportsSignatures() const
56 return ( m_pShell != nullptr );
59 void DocumentSignature::signScriptingContent(weld::Window* pDialogParent) const
61 OSL_PRECOND( supportsSignatures(), "DocumentSignature::signScriptingContent: signatures not supported by this document!" );
62 if ( m_pShell )
63 m_pShell->SignScriptingContent(pDialogParent);
66 SignatureState DocumentSignature::getScriptingSignatureState() const
68 if ( m_pShell )
69 return m_pShell->GetScriptingSignatureState();
70 return SignatureState::NOSIGNATURES;
73 } // namespace basctl
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */