LibreOffice Module comphelper (master)  1
docpasswordrequest.hxx
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 #ifndef INCLUDED_COMPHELPER_DOCPASSWORDREQUEST_HXX
21 #define INCLUDED_COMPHELPER_DOCPASSWORDREQUEST_HXX
22 
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>
28 
29 namespace com { namespace sun { namespace star { namespace task { class XInteractionAbort; } } } }
30 
31 namespace comphelper {
32 
33 class PasswordContinuation;
34 
35 
38 {
39  Standard,
40  MS
41 };
42 
43 
45  public cppu::WeakImplHelper<css::task::XInteractionRequest>
46 {
47 public:
48  explicit SimplePasswordRequest();
49  virtual ~SimplePasswordRequest() override;
50 
51  bool isPassword() const;
52 
53  OUString getPassword() const;
54 
55 private:
57  SimplePasswordRequest& operator=(SimplePasswordRequest const&) = delete;
58 
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;
62 
63 private:
64  css::uno::Any maRequest;
65  css::uno::Reference<css::task::XInteractionAbort> mxAbort;
67 };
68 
69 
74  public cppu::WeakImplHelper<css::task::XInteractionRequest>
75 {
76 public:
77  explicit DocPasswordRequest(
79  css::task::PasswordRequestMode eMode,
80  const OUString& rDocumentUrl,
81  bool bPasswordToModify = false );
82  virtual ~DocPasswordRequest() override;
83 
84  bool isPassword() const;
85 
86  OUString getPassword() const;
87 
88  OUString getPasswordToModify() const;
89  bool getRecommendReadOnly() const;
90 
91 private:
92  DocPasswordRequest(DocPasswordRequest const&) = delete;
93  DocPasswordRequest& operator=(DocPasswordRequest const&) = delete;
94 
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;
98 
99 private:
100  css::uno::Any maRequest;
101  css::uno::Reference<css::task::XInteractionAbort> mxAbort;
103 };
104 
105 
106 } // namespace comphelper
107 
108 #endif
109 
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Implements the task.XInteractionRequest interface for requesting a password string for a document...
rtl::Reference< PasswordContinuation > mxPassword
css::uno::Reference< css::task::XInteractionAbort > mxAbort
bool getPassword(const css::uno::Reference< css::task::XInteractionHandler > &xHandler, OUString &rOutPwd, bool bFirstTry, const OUString &rDocName)
DocumentType const eType
DocPasswordRequestType
Selects which UNO document password request type to use.
css::uno::Reference< css::task::XInteractionAbort > mxAbort
Uses the standard com.sun.star.task.DocumentPasswordRequest request.
#define COMPHELPER_DLLPUBLIC
void getContinuations(css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > const &rContinuations, css::uno::Reference< t1 > *pContinuation1, css::uno::Reference< t2 > *pContinuation2)
rtl::Reference< PasswordContinuation > mxPassword