summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-07-30 10:24:24 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-07-30 10:24:24 +0000
commita013040879f34aa9ba69a86c86fa940691c0dc70 (patch)
treeef9b9b14568c6ee0d4e804f07bf94d721a9e971c /sfx2
parent331241fb1aacd89db473580d2a06e757da72ea12 (diff)
CWS-TOOLING: integrate CWS wordencryption
2009-07-10 09:42:25 +0200 mav r273872 : resolve merge problem 2009-07-08 07:46:13 +0200 mav r273815 : CWS-TOOLING: rebase CWS wordencryption to trunk@273468 (milestone: DEV300:m51) 2009-07-03 10:38:03 +0200 mav r273682 : #i10000# resolve conflict 2009-07-02 08:47:35 +0200 steve_yin r273618 : Removed IBM(C) from modified files. 2009-06-22 04:34:44 +0200 steve_yin r273191 : Based on Mikhail suggestions, I changed some code. 2009-06-18 09:37:14 +0200 mav r273100 : #i10000# get rid of windows warnings 2009-06-17 08:18:33 +0200 mav r273047 : #i10000# adopt for linux build
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx46
1 files changed, 36 insertions, 10 deletions
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index da9bf4a8b04c..33359a45ec96 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -87,6 +87,7 @@
#endif
#include <svtools/pickerhelper.hxx>
#include <svtools/docpasswdrequest.hxx>
+#include <svtools/docmspasswdrequest.hxx>
#include <ucbhelper/content.hxx>
#include <ucbhelper/commandenvironment.hxx>
#include <comphelper/storagehelper.hxx>
@@ -556,6 +557,15 @@ void FileDialogHelper_Impl::updateSelectionBox()
}
// ------------------------------------------------------------------------
+struct CheckMSPasswordCapability
+{
+ sal_Bool operator() ( const String rFilterName )
+ {
+ return rFilterName.EqualsAscii("MS Word 97");
+ }
+};
+
+// ------------------------------------------------------------------------
struct CheckPasswordCapability
{
sal_Bool operator() ( const SfxFilter* _pFilter )
@@ -572,8 +582,9 @@ struct CheckPasswordCapability
return true;
#endif
- return _pFilter->IsOwnFormat() && _pFilter->UsesStorage()
- && ( SOFFICE_FILEFORMAT_60 <= _pFilter->GetVersion() );
+ return ( _pFilter->IsOwnFormat() && _pFilter->UsesStorage()
+ && ( SOFFICE_FILEFORMAT_60 <= _pFilter->GetVersion() ) )
+ || CheckMSPasswordCapability()( _pFilter->GetFilterName() );
}
};
@@ -1660,15 +1671,30 @@ 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.
- 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() ) );
+ 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;
+ }
else
- return ERRCODE_ABORT;
+ {
+ 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;
+ }
}
}
}