tdf#122471 xlsx import: pivottable error OUString, not uInt8
[LibreOffice.git] / xmlsecurity / inc / documentsignaturehelper.hxx
blobd517787af0cfb34bf506ad61844c428b7949e20e
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 #pragma once
22 #include <com/sun/star/uno/Reference.h>
23 #include <rtl/ustring.hxx>
24 #include <svl/sigstruct.hxx>
26 #include <vector>
28 namespace com::sun::star {
29 namespace io { class XStream; }
30 namespace embed { class XStorage; }
33 namespace com::sun::star::xml::sax { class XDocumentHandler; }
35 enum class DocumentSignatureMode
37 Content,
38 Macros,
39 Package
42 enum class DocumentSignatureAlgorithm
44 OOo2,
45 OOo3_0,
46 OOo3_2
49 struct SignatureStreamHelper
51 css::uno::Reference < css::embed::XStorage > xSignatureStorage;
52 css::uno::Reference < css::io::XStream > xSignatureStream;
53 /// If this is embed::StorageFormats::OFOPXML, then it's expected that xSignatureStream is an empty reference.
54 sal_Int32 nStorageFormat;
56 SignatureStreamHelper()
57 : nStorageFormat(0)
62 namespace DocumentSignatureHelper
64 SignatureStreamHelper OpenSignatureStream(
65 const css::uno::Reference < css::embed::XStorage >& rxStore, sal_Int32 nOpenMode,
66 DocumentSignatureMode eDocSigMode );
68 std::vector< OUString > CreateElementList(
69 const css::uno::Reference < css::embed::XStorage >& rxStore,
70 DocumentSignatureMode eMode,
71 const DocumentSignatureAlgorithm mode);
73 bool isODFPre_1_2(const OUString & sODFVersion);
74 bool isOOo3_2_Signature(const SignatureInformation & sigInfo);
76 DocumentSignatureAlgorithm getDocumentAlgorithm(
77 const OUString & sODFVersion, const SignatureInformation & sigInfo);
79 bool CanSignWithGPG(const css::uno::Reference < css::embed::XStorage >& rxStore,
80 const OUString& sOdfVersion);
82 bool checkIfAllFilesAreSigned( const ::std::vector< OUString > & sElementList,
83 const SignatureInformation & sigInfo, const DocumentSignatureAlgorithm alg);
85 bool equalsReferenceUriManifestPath(
86 const OUString & rUri, const OUString & rPath);
88 OUString GetDocumentContentSignatureDefaultStreamName();
89 OUString GetScriptingContentSignatureDefaultStreamName();
90 OUString GetPackageSignatureDefaultStreamName();
92 /// In case the storage is OOXML, prepend a leading '/' and append content type to the element URIs.
93 void AppendContentTypes(const css::uno::Reference<css::embed::XStorage>& xStorage, std::vector<OUString>& rElements);
95 void writeDigestMethod(
96 const css::uno::Reference<css::xml::sax::XDocumentHandler>& xDocumentHandler);
97 void writeSignedProperties(
98 const css::uno::Reference<css::xml::sax::XDocumentHandler>& xDocumentHandler,
99 const SignatureInformation& signatureInfo,
100 const OUString& sDate,
101 const bool bWriteSignatureLineData);
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */