update ooo310-m15
[ooovba.git] / applied_patches / 0154-cws-scsheetprotection02-sfx2.diff
blob39c9fa6c4fb885614b6985dafdbb38f41ce2b2e6
1 diff --git sfx2/inc/sfx2/passwd.hxx sfx2/inc/sfx2/passwd.hxx
2 index a9b176b..15aeb1f 100644
3 --- sfx2/inc/sfx2/passwd.hxx
4 +++ sfx2/inc/sfx2/passwd.hxx
5 @@ -86,6 +86,7 @@ public:
6 String GetConfirm() const { return maConfirmED.GetText(); }
8 void SetMinLen( USHORT Len );
9 + void SetMaxLen( USHORT Len );
10 void SetEditHelpId( ULONG nId ) { maPasswordED.SetHelpId( nId ); }
11 void ShowExtras( USHORT nExtras ) { mnExtras = nExtras; }
13 diff --git sfx2/source/dialog/filedlghelper.cxx sfx2/source/dialog/filedlghelper.cxx
14 index 42976cd..37f2426 100644
15 --- sfx2/source/dialog/filedlghelper.cxx
16 +++ sfx2/source/dialog/filedlghelper.cxx
17 @@ -559,9 +559,20 @@ struct CheckPasswordCapability
19 sal_Bool operator() ( const SfxFilter* _pFilter )
21 - return _pFilter && _pFilter->IsOwnFormat()
22 - && _pFilter->UsesStorage()
23 - && ( SOFFICE_FILEFORMAT_60 <= _pFilter->GetVersion() );
24 + if (!_pFilter)
25 + return false;
27 +#if 0 // to be enabled in the future
28 + if (_pFilter->GetFilterName().EqualsAscii("MS Excel 97"))
29 + // For now, we eanble password protection for Excel 97 as a
30 + // special case. If we start having more filters supporting
31 + // export encryption with password, we should probably switch to
32 + // using a filter flag instead.
33 + return true;
34 +#endif
36 + return _pFilter->IsOwnFormat() && _pFilter->UsesStorage()
37 + && ( SOFFICE_FILEFORMAT_60 <= _pFilter->GetVersion() );
41 @@ -1617,11 +1628,12 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
42 sal_Bool bPassWord = sal_False;
43 if ( ( aValue >>= bPassWord ) && bPassWord )
45 - // ask for the password
46 + // ask for a password
47 uno::Reference < ::com::sun::star::task::XInteractionHandler > xInteractionHandler( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.comp.uui.UUIInteractionHandler")), UNO_QUERY );
49 if( xInteractionHandler.is() )
51 + // TODO: find out a way to set the 1-15 char limits on MS Excel 97 filter.
52 RequestDocumentPassword* pPasswordRequest = new RequestDocumentPassword(
53 ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) );
55 diff --git sfx2/source/dialog/passwd.cxx sfx2/source/dialog/passwd.cxx
56 index f49467f..062fb9c 100644
57 --- sfx2/source/dialog/passwd.cxx
58 +++ sfx2/source/dialog/passwd.cxx
59 @@ -136,6 +136,15 @@ void SfxPasswordDialog::SetMinLen( USHORT nLen )
61 // -----------------------------------------------------------------------
63 +void SfxPasswordDialog::SetMaxLen( USHORT nLen )
65 + maPasswordED.SetMaxTextLen( nLen );
66 + maConfirmED.SetMaxTextLen( nLen );
67 + EditModifyHdl( NULL );
70 +// -----------------------------------------------------------------------
72 short SfxPasswordDialog::Execute()
74 if ( mnExtras < SHOWEXTRAS_ALL )