Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / include / comphelper / docpasswordrequest.hxx
blob3dce6c94d18f0bf7c46f6e467afdb71a09a20ea1
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>
28 namespace comphelper {
30 class AbortContinuation;
31 class PasswordContinuation;
34 /** Selects which UNO document password request type to use. */
35 enum class DocPasswordRequestType
37 Standard, /// Uses the standard com.sun.star.task.DocumentPasswordRequest request.
38 MS /// Uses the com.sun.star.task.DocumentMSPasswordRequest request.
42 class COMPHELPER_DLLPUBLIC SimplePasswordRequest :
43 public cppu::WeakImplHelper<css::task::XInteractionRequest>
45 public:
46 explicit SimplePasswordRequest( css::task::PasswordRequestMode eMode );
47 virtual ~SimplePasswordRequest();
49 bool isPassword() const;
51 OUString getPassword() const;
53 private:
54 // XInteractionRequest
55 virtual css::uno::Any SAL_CALL getRequest() throw( css::uno::RuntimeException, std::exception ) override;
56 virtual css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > SAL_CALL getContinuations() throw( css::uno::RuntimeException, std::exception ) override;
58 private:
59 css::uno::Any maRequest;
60 css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > maContinuations;
61 PasswordContinuation * mpPassword;
65 /** Implements the task.XInteractionRequest interface for requesting a password
66 string for a document.
68 class COMPHELPER_DLLPUBLIC DocPasswordRequest :
69 public cppu::WeakImplHelper<css::task::XInteractionRequest>
71 public:
72 explicit DocPasswordRequest(
73 DocPasswordRequestType eType,
74 css::task::PasswordRequestMode eMode,
75 const OUString& rDocumentUrl,
76 bool bPasswordToModify = false );
77 virtual ~DocPasswordRequest();
79 bool isPassword() const;
81 OUString getPassword() const;
83 OUString getPasswordToModify() const;
84 bool getRecommendReadOnly() const;
86 private:
87 // XInteractionRequest
88 virtual css::uno::Any SAL_CALL getRequest() throw( css::uno::RuntimeException, std::exception ) override;
89 virtual css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > SAL_CALL getContinuations() throw( css::uno::RuntimeException, std::exception ) override;
91 private:
92 css::uno::Any maRequest;
93 css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > maContinuations;
94 PasswordContinuation * mpPassword;
98 } // namespace comphelper
100 #endif
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */