diff options
author | Oliver Bolte <obo@openoffice.org> | 2009-09-07 14:41:16 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2009-09-07 14:41:16 +0000 |
commit | 3bcd5515229713275014a66f5b9e7367f2cc979c (patch) | |
tree | a0f94b2c364a2c572264d079461007dc108d4885 | |
parent | 619cd064b2434d53faf13da92921d566ba63c52e (diff) |
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'
-rw-r--r-- | sfx2/source/appl/appopen.cxx | 102 | ||||
-rw-r--r-- | sfx2/source/dialog/filedlghelper.cxx | 64 | ||||
-rw-r--r-- | svx/source/cui/webconninfo.cxx | 7 |
3 files changed, 78 insertions, 95 deletions
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index c73a40dd75a7..85f38abf284c 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -48,7 +48,6 @@ #include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/document/UpdateDocMode.hpp> -#include <com/sun/star/task/XInteractionRequest.hpp> #include <com/sun/star/task/ErrorCodeRequest.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/embed/ElementModes.hpp> @@ -81,7 +80,7 @@ #include <svtools/templdlg.hxx> #include <osl/file.hxx> #include <svtools/extendedsecurityoptions.hxx> -#include <svtools/docpasswdrequest.hxx> +#include <comphelper/docpasswordhelper.hxx> #include <vcl/svapp.hxx> #include <vos/mutex.hxx> @@ -247,6 +246,50 @@ void SetTemplate_Impl( const String &rFileName, //-------------------------------------------------------------------- +class SfxDocPasswordVerifier : public ::comphelper::IDocPasswordVerifier +{ +public: + inline explicit SfxDocPasswordVerifier( const Reference< embed::XStorage >& rxStorage ) : + mxStorage( rxStorage ) {} + + virtual ::comphelper::DocPasswordVerifierResult + verifyPassword( const ::rtl::OUString& rPassword ); + +private: + Reference< embed::XStorage > mxStorage; +}; + +::comphelper::DocPasswordVerifierResult SfxDocPasswordVerifier::verifyPassword( const ::rtl::OUString& rPassword ) +{ + ::comphelper::DocPasswordVerifierResult eResult = ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; + try + { + // check the password + // if the password correct is the stream will be opened successfuly + // and immediatelly closed + ::comphelper::OStorageHelper::SetCommonStoragePassword( mxStorage, rPassword ); + + mxStorage->openStreamElement( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "content.xml" ) ), + embed::ElementModes::READ | embed::ElementModes::NOCREATE ); + + // no exception -> success + eResult = ::comphelper::DocPasswordVerifierResult_OK; + } + catch( const packages::WrongPasswordException& ) + { + eResult = ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; + } + catch( const uno::Exception& ) + { + // unknown error, do not try to ask again + eResult = ::comphelper::DocPasswordVerifierResult_ABORT; + } + return eResult; +} + +//-------------------------------------------------------------------- + sal_uInt32 CheckPasswd_Impl ( //Window *pWin, // Parent des Dialogs @@ -302,56 +345,13 @@ sal_uInt32 CheckPasswd_Impl Reference< ::com::sun::star::task::XInteractionHandler > xInteractionHandler = pFile->GetInteractionHandler(); if( xInteractionHandler.is() ) { - sal_Bool bRetry = sal_True; - sal_Bool bGotPasswd = sal_False; - ::rtl::OUString aPassword; - ::com::sun::star::task::PasswordRequestMode nDlgMode = ::com::sun::star::task::PasswordRequestMode_PASSWORD_ENTER; - - while( bRetry ) - { - bRetry = sal_False; - - RequestDocumentPassword* pPasswordRequest = new RequestDocumentPassword( nDlgMode, - INetURLObject( pFile->GetOrigURL() ).GetMainURL( INetURLObject::DECODE_WITH_CHARSET ) ); - - Reference< XInteractionRequest > rRequest( pPasswordRequest ); - xInteractionHandler->handle( rRequest ); - - if ( pPasswordRequest->isPassword() ) - { - aPassword = pPasswordRequest->getPassword(); - bGotPasswd = sal_True; - - try - { - // check the password - // if the password correct is the stream will be opened successfuly - // and immediatelly closed - ::comphelper::OStorageHelper::SetCommonStoragePassword( - xStorage, - aPassword ); - - xStorage->openStreamElement( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "content.xml" ) ), - embed::ElementModes::READ | embed::ElementModes::NOCREATE ); - } - catch( const packages::WrongPasswordException& ) - { - // reask for the password - nDlgMode = ::com::sun::star::task::PasswordRequestMode_PASSWORD_REENTER; - bRetry = sal_True; - } - catch( const uno::Exception& ) - { - // do nothing special - // the error will be detected by loading - } - } - else - bGotPasswd = sal_False; - } + // use the comphelper password helper to request a password + ::rtl::OUString aDocumentName = INetURLObject( pFile->GetOrigURL() ).GetMainURL( INetURLObject::DECODE_WITH_CHARSET ); + SfxDocPasswordVerifier aVerifier( xStorage ); + ::rtl::OUString aPassword = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword( + aVerifier, ::rtl::OUString(), xInteractionHandler, aDocumentName, comphelper::DocPasswordRequestType_STANDARD ); - if ( bGotPasswd ) + if ( aPassword.getLength() > 0 ) { pSet->Put( SfxStringItem( SID_PASSWORD, aPassword ) ); diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 33359a45ec96..b9fe056112c5 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -45,9 +45,7 @@ #include <com/sun/star/ui/dialogs/XFilePreview.hpp> #include <com/sun/star/ui/dialogs/XFilterManager.hpp> #include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp> -#ifndef _COM_SUN_STAR_UI_DIALOGS_XFOLDERPICKER_HDL_ #include <com/sun/star/ui/dialogs/XFolderPicker.hpp> -#endif #include <com/sun/star/ui/dialogs/XFilePicker2.hpp> #include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -82,12 +80,9 @@ #include <svtools/filter.hxx> #include <svtools/viewoptions.hxx> #include <svtools/moduleoptions.hxx> -#ifndef _SVT_HELPID_HRC #include <svtools/helpid.hrc> -#endif #include <svtools/pickerhelper.hxx> -#include <svtools/docpasswdrequest.hxx> -#include <svtools/docmspasswdrequest.hxx> +#include <comphelper/docpasswordrequest.hxx> #include <ucbhelper/content.hxx> #include <ucbhelper/commandenvironment.hxx> #include <comphelper/storagehelper.hxx> @@ -99,13 +94,9 @@ #include <sfx2/passwd.hxx> #include "sfxresid.hxx" #include <sfx2/sfxsids.hrc> -#ifndef _SFX_FILEDLGHELPER_HRC #include "filedlghelper.hrc" -#endif #include "filtergrouping.hxx" -#ifndef SFX2_REQUEST_HXX #include <sfx2/request.hxx> -#endif #include "filedlgimpl.hxx" #include <sfxlocal.hrc> @@ -557,13 +548,15 @@ void FileDialogHelper_Impl::updateSelectionBox() } // ------------------------------------------------------------------------ -struct CheckMSPasswordCapability + +namespace { + +bool lclCheckMSPasswordCapability( const String rFilterName ) { - sal_Bool operator() ( const String rFilterName ) - { - return rFilterName.EqualsAscii("MS Word 97"); - } -}; + return rFilterName.EqualsAscii("MS Word 97"); +} + +} // namespace // ------------------------------------------------------------------------ struct CheckPasswordCapability @@ -584,7 +577,7 @@ struct CheckPasswordCapability return ( _pFilter->IsOwnFormat() && _pFilter->UsesStorage() && ( SOFFICE_FILEFORMAT_60 <= _pFilter->GetVersion() ) ) - || CheckMSPasswordCapability()( _pFilter->GetFilterName() ); + || lclCheckMSPasswordCapability( _pFilter->GetFilterName() ); } }; @@ -1671,30 +1664,21 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, if( xInteractionHandler.is() ) { // TODO: find out a way to set the 1-15 char limits on MS Excel 97 filter. - if ( CheckMSPasswordCapability()( rFilter ) ) - { - RequestMSDocumentPassword* pMSPasswordRequest = new RequestMSDocumentPassword( - ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) ); - - uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pMSPasswordRequest ); - xInteractionHandler->handle( rRequest ); - if ( pMSPasswordRequest->isPassword() ) - rpSet->Put( SfxStringItem( SID_PASSWORD, pMSPasswordRequest->getPassword() ) ); - else - return ERRCODE_ABORT; - } + + bool bMSType = lclCheckMSPasswordCapability( rFilter ); + ::comphelper::DocPasswordRequestType eType = bMSType ? + ::comphelper::DocPasswordRequestType_MS : + ::comphelper::DocPasswordRequestType_STANDARD; + + ::comphelper::DocPasswordRequest* pPasswordRequest = new ::comphelper::DocPasswordRequest( + eType, ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) ); + + uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest ); + xInteractionHandler->handle( rRequest ); + if ( pPasswordRequest->isPassword() ) + rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) ); else - { - RequestDocumentPassword* pPasswordRequest = new RequestDocumentPassword( - ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) ); - - uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest ); - xInteractionHandler->handle( rRequest ); - if ( pPasswordRequest->isPassword() ) - rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) ); - else - return ERRCODE_ABORT; - } + return ERRCODE_ABORT; } } } diff --git a/svx/source/cui/webconninfo.cxx b/svx/source/cui/webconninfo.cxx index 8fdf6a26d2bd..0298a8fc7e93 100644 --- a/svx/source/cui/webconninfo.cxx +++ b/svx/source/cui/webconninfo.cxx @@ -46,7 +46,7 @@ #include <com/sun/star/task/XMasterPasswordHandling.hpp> #include <comphelper/processfactory.hxx> -#include <svtools/docpasswdrequest.hxx> +#include <comphelper/docpasswordrequest.hxx> #include "webconninfo.hxx" #include "webconninfo.hrc" @@ -297,9 +297,8 @@ IMPL_LINK( WebConnectionInfoDialog, ChangePasswordHdl, PushButton*, EMPTYARG ) ::rtl::OUString aURL = m_aPasswordsLB.GetEntryText( pEntry, 0 ); ::rtl::OUString aUserName = m_aPasswordsLB.GetEntryText( pEntry, 1 ); - RequestDocumentPassword* pPasswordRequest = new RequestDocumentPassword( - task::PasswordRequestMode_PASSWORD_CREATE, - aURL ); + ::comphelper::DocPasswordRequest* pPasswordRequest = new ::comphelper::DocPasswordRequest( + ::comphelper::DocPasswordRequestType_STANDARD, task::PasswordRequestMode_PASSWORD_CREATE, aURL ); uno::Reference< task::XInteractionRequest > rRequest( pPasswordRequest ); xInteractionHandler->handle( rRequest ); |