Files
libreoffice/comphelper/source/misc/docpasswordrequest.cxx
Oliver Bolte 937268ddae CWS-TOOLING: integrate CWS dr72
2009-08-26 10:24:00 +0200 dr  r275402 : #i92645# CODEPAGE is encrypted...
2009-08-24 14:37:36 +0200 dr  r275316 : #i10000# enable exceptions for xlroot.cxx
2009-08-24 14:33:15 +0200 dr  r275313 : #i10000# link openssl under solaris correctly
2009-08-21 17:41:16 +0200 dr  r275267 : #i10000# unxlngi6 warning
2009-08-21 15:35:56 +0200 dr  r275265 : #i10000# remove files again, already deleted in previous milestone...
2009-08-21 11:24:57 +0200 dr  r275227 : #160401# port to DEV300
2009-08-21 09:53:45 +0200 dr  r275221 : #i92645# full support for encrypted Word2007 files
2009-08-21 09:50:52 +0200 dr  r275219 : #i92645# final changes for decryption
2009-08-20 19:48:40 +0200 dr  r275195 : #i104370# missing parentheses, patch from cmc
2009-08-20 18:28:22 +0200 dr  r275193 : #i92645# rework package decryption to repair 'Reload Document' functionality
2009-08-20 13:55:14 +0200 dr  r275179 : #i92645# add new property names
2009-08-19 19:24:21 +0200 dr  r275159 : #160401# open writeprotected files read-only, merged to DEV300
2009-08-18 14:41:47 +0200 dr  r275109 : #i92645# add 'Aborted' property
2009-08-18 11:20:34 +0200 dr  r275084 : #i92645# write back password to medium
2009-08-17 17:52:51 +0200 dr  r275066 : #i92645# detect Word2007 docs with oox detection impl, this adds support of encryped Word2007; correct detection of templates and macro-enabled docs
2009-08-17 17:51:31 +0200 dr  r275065 : #i92645# detect Word2007 docs with oox detection impl, this adds support of encryped Word2007; correct detection of templates and macro-enabled docs
2009-08-17 11:06:39 +0200 dr  r275035 : #i92645# more password handling
2009-08-17 11:05:21 +0200 dr  r275034 : #i92645# use new password input mechanism for BIFF filter and dumper in oox
2009-08-14 16:33:53 +0200 nn  r274996 : #i104228# DelBroadcastAreasInRange: remove area from hash_set before deleting
2009-08-14 16:27:12 +0200 nn  r274995 : #i104059# restore a change lost in the integration of fhawfixes1
2009-08-14 16:24:00 +0200 dr  r274994 : #i92645# adapt BIFF import to latest changes
2009-08-14 16:21:30 +0200 dr  r274993 : #i92645# adapt BIFF import to latest changes
2009-08-14 16:20:43 +0200 dr  r274992 : #i92645# do not add default passwords to media descriptor
2009-08-13 19:20:45 +0200 dr  r274965 : #i92645# add a helper to request a document password
2009-08-13 19:09:35 +0200 dr  r274964 : #i92645# add a helper to request a document password
2009-08-13 19:09:03 +0200 dr  r274963 : #i92645# add a helper to request a document password
2009-08-13 14:35:01 +0200 dr  r274946 : #i92645# comment typo
2009-08-13 14:33:47 +0200 dr  r274945 : #i92645# add a helper to request a document password
2009-08-13 14:04:47 +0200 dr  r274941 : #i92645# add a helper to request a document password
2009-08-13 14:04:22 +0200 dr  r274940 : #i92645# add a helper to request a document password
2009-08-13 11:16:27 +0200 dr  r274927 : #i42303# show quick help if field name too long for button
2009-08-13 10:55:48 +0200 dr  r274925 : #i31600# cut field name and add ellipsis, if too long for button
2009-08-12 18:47:26 +0200 dr  r274914 : #i92645# ask user for a password
2009-08-12 18:02:39 +0200 dr  r274909 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox
2009-08-12 16:59:11 +0200 dr  r274906 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox
2009-08-12 16:41:18 +0200 dr  r274905 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox
2009-08-12 16:40:33 +0200 dr  r274904 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox
2009-08-12 16:40:08 +0200 dr  r274903 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox
2009-08-12 16:39:30 +0200 dr  r274902 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox
2009-08-12 16:15:28 +0200 dr  r274899 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox
2009-08-11 19:51:12 +0200 dr  r274877 : #i92645# open encrypted MSOOXML package protected with standard XL password 'VelvetSweatshop'
2009-09-07 14:41:16 +00:00

154 lines
5.1 KiB
C++

/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: docpasswordrequest.cxx,v $
* $Revision: 1.1 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_comphelper.hxx"
#include "comphelper/docpasswordrequest.hxx"
#include <com/sun/star/task/DocumentMSPasswordRequest.hpp>
#include <com/sun/star/task/DocumentPasswordRequest.hpp>
#include <com/sun/star/task/XInteractionAbort.hpp>
#include <com/sun/star/task/XInteractionPassword.hpp>
using ::rtl::OUString;
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::RuntimeException;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::XInterface;
using ::com::sun::star::task::InteractionClassification_QUERY;
using ::com::sun::star::task::DocumentMSPasswordRequest;
using ::com::sun::star::task::DocumentPasswordRequest;
using ::com::sun::star::task::PasswordRequestMode;
using ::com::sun::star::task::XInteractionAbort;
using ::com::sun::star::task::XInteractionContinuation;
using ::com::sun::star::task::XInteractionPassword;
namespace comphelper {
// ============================================================================
class AbortContinuation : public ::cppu::WeakImplHelper1< XInteractionAbort >
{
public:
inline explicit AbortContinuation() : mbSelected( false ) {}
inline bool isSelected() const { return mbSelected; }
inline void reset() { mbSelected = false; }
virtual void SAL_CALL select() throw( RuntimeException ) { mbSelected = true; }
private:
bool mbSelected;
};
// ============================================================================
class PasswordContinuation : public ::cppu::WeakImplHelper1< XInteractionPassword >
{
public:
inline explicit PasswordContinuation() : mbSelected( false ) {}
inline bool isSelected() const { return mbSelected; }
inline void reset() { mbSelected = false; }
virtual void SAL_CALL select() throw( RuntimeException ) { mbSelected = true; }
virtual void SAL_CALL setPassword( const OUString& rPass ) throw( RuntimeException ) { maPassword = rPass; }
virtual OUString SAL_CALL getPassword() throw( RuntimeException ) { return maPassword; }
private:
OUString maPassword;
bool mbSelected;
};
// ============================================================================
DocPasswordRequest::DocPasswordRequest( DocPasswordRequestType eType,
PasswordRequestMode eMode, const OUString& rDocumentName )
{
switch( eType )
{
case DocPasswordRequestType_STANDARD:
{
DocumentPasswordRequest aRequest( OUString(), Reference< XInterface >(),
InteractionClassification_QUERY, eMode, rDocumentName );
maRequest <<= aRequest;
}
break;
case DocPasswordRequestType_MS:
{
DocumentMSPasswordRequest aRequest( OUString(), Reference< XInterface >(),
InteractionClassification_QUERY, eMode, rDocumentName );
maRequest <<= aRequest;
}
break;
/* no 'default', so compilers will complain about missing
implementation of a new enum value. */
}
maContinuations.realloc( 2 );
maContinuations[ 0 ].set( mpAbort = new AbortContinuation );
maContinuations[ 1 ].set( mpPassword = new PasswordContinuation );
}
DocPasswordRequest::~DocPasswordRequest()
{
}
bool DocPasswordRequest::isAbort() const
{
return mpAbort->isSelected();
}
bool DocPasswordRequest::isPassword() const
{
return mpPassword->isSelected();
}
OUString DocPasswordRequest::getPassword() const
{
return mpPassword->getPassword();
}
Any SAL_CALL DocPasswordRequest::getRequest() throw( RuntimeException )
{
return maRequest;
}
Sequence< Reference< XInteractionContinuation > > SAL_CALL DocPasswordRequest::getContinuations() throw( RuntimeException )
{
return maContinuations;
}
// ============================================================================
} // namespace comphelper