2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-29 14:02:24 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2009-09-07 14:41:16 +00:00
|
|
|
|
2013-10-23 19:17:00 +02:00
|
|
|
#ifndef INCLUDED_COMPHELPER_DOCPASSWORDREQUEST_HXX
|
|
|
|
#define INCLUDED_COMPHELPER_DOCPASSWORDREQUEST_HXX
|
2009-09-07 14:41:16 +00:00
|
|
|
|
|
|
|
#include "comphelper/comphelperdllapi.h"
|
|
|
|
#include <com/sun/star/task/PasswordRequestMode.hpp>
|
|
|
|
#include <com/sun/star/task/XInteractionRequest.hpp>
|
|
|
|
#include <cppuhelper/implbase1.hxx>
|
2010-09-06 10:02:33 +02:00
|
|
|
|
2009-09-07 14:41:16 +00:00
|
|
|
namespace comphelper {
|
|
|
|
|
2010-09-06 10:02:33 +02:00
|
|
|
class AbortContinuation;
|
|
|
|
class PasswordContinuation;
|
|
|
|
|
2009-09-07 14:41:16 +00:00
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
/** Selects which UNO document password request type to use. */
|
|
|
|
enum DocPasswordRequestType
|
|
|
|
{
|
|
|
|
DocPasswordRequestType_STANDARD, /// Uses the standard com.sun.star.task.DocumentPasswordRequest request.
|
|
|
|
DocPasswordRequestType_MS /// Uses the com.sun.star.task.DocumentMSPasswordRequest request.
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
|
2010-09-06 10:02:33 +02:00
|
|
|
class COMPHELPER_DLLPUBLIC SimplePasswordRequest :
|
2013-08-16 12:31:07 +02:00
|
|
|
public cppu::WeakImplHelper1<css::task::XInteractionRequest>
|
2010-09-06 10:02:33 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit SimplePasswordRequest( com::sun::star::task::PasswordRequestMode eMode );
|
|
|
|
virtual ~SimplePasswordRequest();
|
|
|
|
|
|
|
|
sal_Bool isPassword() const;
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString getPassword() const;
|
2010-09-06 10:02:33 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
// XInteractionRequest
|
|
|
|
virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException );
|
|
|
|
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations() throw( ::com::sun::star::uno::RuntimeException );
|
|
|
|
|
|
|
|
private:
|
|
|
|
::com::sun::star::uno::Any maRequest;
|
|
|
|
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > maContinuations;
|
|
|
|
AbortContinuation * mpAbort;
|
|
|
|
PasswordContinuation * mpPassword;
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================================================================
|
2009-09-07 14:41:16 +00:00
|
|
|
|
|
|
|
/** Implements the task.XInteractionRequest interface for requesting a password
|
|
|
|
string for a document.
|
|
|
|
*/
|
2010-05-07 10:40:12 +02:00
|
|
|
class COMPHELPER_DLLPUBLIC DocPasswordRequest :
|
2013-08-16 12:31:07 +02:00
|
|
|
public cppu::WeakImplHelper1<css::task::XInteractionRequest>
|
2009-09-07 14:41:16 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit DocPasswordRequest(
|
|
|
|
DocPasswordRequestType eType,
|
|
|
|
::com::sun::star::task::PasswordRequestMode eMode,
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& rDocumentName,
|
2010-03-30 16:47:18 +02:00
|
|
|
sal_Bool bPasswordToModify = sal_False );
|
2009-09-07 14:41:16 +00:00
|
|
|
virtual ~DocPasswordRequest();
|
|
|
|
|
2010-03-30 16:47:18 +02:00
|
|
|
sal_Bool isPassword() const;
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString getPassword() const;
|
2009-09-07 14:41:16 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString getPasswordToModify() const;
|
2010-03-30 16:47:18 +02:00
|
|
|
sal_Bool getRecommendReadOnly() const;
|
|
|
|
|
2009-09-07 14:41:16 +00:00
|
|
|
private:
|
2010-09-06 10:02:33 +02:00
|
|
|
// XInteractionRequest
|
|
|
|
virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException );
|
|
|
|
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations() throw( ::com::sun::star::uno::RuntimeException );
|
2009-09-07 14:41:16 +00:00
|
|
|
|
|
|
|
private:
|
2010-09-06 10:02:33 +02:00
|
|
|
::com::sun::star::uno::Any maRequest;
|
2009-09-07 14:41:16 +00:00
|
|
|
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > maContinuations;
|
2010-09-06 10:02:33 +02:00
|
|
|
AbortContinuation * mpAbort;
|
|
|
|
PasswordContinuation * mpPassword;
|
2009-09-07 14:41:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
} // namespace comphelper
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2010-10-14 08:27:31 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|