tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / include / comphelper / docpasswordrequest.hxx
blobe57c293df9fd2630e5508c7edf514469bdfb2300
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 #ifndef INCLUDED_COMPHELPER_DOCPASSWORDREQUEST_HXX
21 #define INCLUDED_COMPHELPER_DOCPASSWORDREQUEST_HXX
23 #include <comphelper/comphelperdllapi.h>
24 #include <com/sun/star/task/PasswordRequestMode.hpp>
25 #include <com/sun/star/task/XInteractionRequest.hpp>
26 #include <cppuhelper/implbase.hxx>
27 #include <rtl/ref.hxx>
29 namespace com::sun::star::task { class XInteractionAbort; }
31 namespace comphelper {
33 class PasswordContinuation;
34 class AbortContinuation;
36 /** Selects which UNO document password request type to use. */
37 enum class DocPasswordRequestType
39 Standard, /// Uses the standard com.sun.star.task.DocumentPasswordRequest request.
40 MS /// Uses the com.sun.star.task.DocumentMSPasswordRequest request.
44 class COMPHELPER_DLLPUBLIC SimplePasswordRequest final :
45 public cppu::WeakImplHelper<css::task::XInteractionRequest>
47 public:
48 explicit SimplePasswordRequest();
49 virtual ~SimplePasswordRequest() override;
51 bool isPassword() const;
53 OUString getPassword() const;
55 private:
56 SimplePasswordRequest(SimplePasswordRequest const&) = delete;
57 SimplePasswordRequest& operator=(SimplePasswordRequest const&) = delete;
59 // XInteractionRequest
60 virtual css::uno::Any SAL_CALL getRequest() override;
61 virtual css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > SAL_CALL getContinuations() override;
63 private:
64 css::uno::Any maRequest;
65 rtl::Reference<AbortContinuation> mxAbort;
66 rtl::Reference<PasswordContinuation> mxPassword;
70 /** Implements the task.XInteractionRequest interface for requesting a password
71 string for a document.
73 class COMPHELPER_DLLPUBLIC DocPasswordRequest final :
74 public cppu::WeakImplHelper<css::task::XInteractionRequest>
76 public:
77 explicit DocPasswordRequest(
78 DocPasswordRequestType eType,
79 css::task::PasswordRequestMode eMode,
80 const OUString& rDocumentUrl,
81 bool bPasswordToModify = false );
82 virtual ~DocPasswordRequest() override;
84 bool isPassword() const;
86 OUString getPassword() const;
88 OUString getPasswordToModify() const;
89 bool getRecommendReadOnly() const;
91 private:
92 DocPasswordRequest(DocPasswordRequest const&) = delete;
93 DocPasswordRequest& operator=(DocPasswordRequest const&) = delete;
95 // XInteractionRequest
96 virtual css::uno::Any SAL_CALL getRequest() override;
97 virtual css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > SAL_CALL getContinuations() override;
99 private:
100 css::uno::Any maRequest;
101 rtl::Reference<AbortContinuation> mxAbort;
102 rtl::Reference<PasswordContinuation> mxPassword;
106 } // namespace comphelper
108 #endif
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */