summaryrefslogtreecommitdiff
path: root/uui
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 /uui
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 'uui')
-rw-r--r--uui/source/iahndl.cxx93
-rw-r--r--uui/source/iahndl.hxx16
-rw-r--r--uui/source/passcrtdlg.cxx12
-rw-r--r--uui/source/passcrtdlg.hrc27
-rw-r--r--uui/source/passcrtdlg.hxx2
-rw-r--r--uui/source/passcrtdlg.src67
6 files changed, 170 insertions, 47 deletions
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index 30a4d0f48c94..62de20f87a74 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -63,6 +63,7 @@
#include "com/sun/star/task/XInteractionHandler.hpp"
#include "com/sun/star/task/XInteractionHandler2.hpp"
#include "com/sun/star/task/DocumentPasswordRequest.hpp"
+#include "com/sun/star/task/DocumentMSPasswordRequest.hpp"
#include "com/sun/star/task/ErrorCodeIOException.hpp"
#include "com/sun/star/task/ErrorCodeRequest.hpp"
#include "com/sun/star/task/MasterPasswordRequest.hpp"
@@ -1132,6 +1133,15 @@ bool UUIInteractionHelper::handleDialogRequests(
return true;
}
+ star::task::DocumentMSPasswordRequest aDocumentMSPasswordRequest;
+ if (aAnyRequest >>= aDocumentMSPasswordRequest)
+ {
+ handleMSPasswordRequest(aDocumentMSPasswordRequest.Mode,
+ rRequest->getContinuations(),
+ aDocumentMSPasswordRequest.Name);
+ return true;
+ }
+
star::task::PasswordRequest aPasswordRequest;
if (aAnyRequest >>= aPasswordRequest)
{
@@ -1839,6 +1849,48 @@ UUIInteractionHelper::executePasswordDialog(
}
void
+UUIInteractionHelper::executeMSPasswordDialog(
+ LoginErrorInfo & rInfo,
+ star::task::PasswordRequestMode nMode,
+ ::rtl::OUString aDocName)
+ SAL_THROW((star::uno::RuntimeException))
+{
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ std::auto_ptr< ResMgr >
+ xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ if( nMode == star::task::PasswordRequestMode_PASSWORD_CREATE )
+ {
+ std::auto_ptr< PasswordCreateDialog >
+ xDialog(new PasswordCreateDialog(
+ getParentProperty(), xManager.get(), true));
+
+ rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK :
+ ERRCODE_BUTTON_CANCEL);
+ rInfo.SetPassword( xDialog->GetPassword() );
+ }
+ else
+ {
+ std::auto_ptr< PasswordDialog >
+ xDialog(new PasswordDialog(
+ getParentProperty(), nMode, xManager.get(), aDocName ));
+
+ rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK :
+ ERRCODE_BUTTON_CANCEL);
+ rInfo.SetPassword( xDialog->GetPassword() );
+ }
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw star::uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ star::uno::Reference< star::uno::XInterface>());
+ }
+}
+
+void
UUIInteractionHelper::executeCookieDialog(CntHTTPCookieRequest & rRequest)
SAL_THROW((star::uno::RuntimeException))
{
@@ -2558,6 +2610,47 @@ UUIInteractionHelper::handlePasswordRequest(
}
void
+UUIInteractionHelper::handleMSPasswordRequest(
+ star::task::PasswordRequestMode nMode,
+ star::uno::Sequence< star::uno::Reference<
+ star::task::XInteractionContinuation > > const &
+ rContinuations,
+ ::rtl::OUString aDocumentName )
+ SAL_THROW((star::uno::RuntimeException))
+{
+ star::uno::Reference< star::task::XInteractionRetry > xRetry;
+ star::uno::Reference< star::task::XInteractionAbort > xAbort;
+ star::uno::Reference< star::task::XInteractionPassword >
+ xPassword;
+ getContinuations(
+ rContinuations, 0, 0, &xRetry, &xAbort, 0, &xPassword, 0, 0);
+ LoginErrorInfo aInfo;
+
+ executeMSPasswordDialog(aInfo, nMode, aDocumentName);
+
+ switch (aInfo.GetResult())
+ {
+ case ERRCODE_BUTTON_OK:
+ if (xPassword.is())
+ {
+ xPassword->setPassword(aInfo.GetPassword());
+ xPassword->select();
+ }
+ break;
+
+ case ERRCODE_BUTTON_RETRY:
+ if (xRetry.is())
+ xRetry->select();
+ break;
+
+ default:
+ if (xAbort.is())
+ xAbort->select();
+ break;
+ }
+}
+
+void
UUIInteractionHelper::handleCookiesRequest(
star::ucb::HandleCookiesRequest const & rRequest,
star::uno::Sequence< star::uno::Reference<
diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx
index 8b53b071a629..4053f919bf7b 100644
--- a/uui/source/iahndl.hxx
+++ b/uui/source/iahndl.hxx
@@ -201,6 +201,12 @@ private:
::rtl::OUString aDocumentName)
SAL_THROW((com::sun::star::uno::RuntimeException));
+ void
+ executeMSPasswordDialog(LoginErrorInfo & rInfo,
+ com::sun::star::task::PasswordRequestMode nMode,
+ ::rtl::OUString aDocumentName)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
void executeCookieDialog(CntHTTPCookieRequest & rRequest)
SAL_THROW((com::sun::star::uno::RuntimeException));
@@ -280,6 +286,16 @@ private:
::rtl::OUString aDocumentName = ::rtl::OUString())
SAL_THROW((com::sun::star::uno::RuntimeException));
+ void
+ handleMSPasswordRequest(
+ com::sun::star::task::PasswordRequestMode nMode,
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations,
+ ::rtl::OUString aDocumentName = ::rtl::OUString())
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
void
handleCookiesRequest(
com::sun::star::ucb::HandleCookiesRequest const & rRequest,
diff --git a/uui/source/passcrtdlg.cxx b/uui/source/passcrtdlg.cxx
index a57255cddefe..636cd4510ecc 100644
--- a/uui/source/passcrtdlg.cxx
+++ b/uui/source/passcrtdlg.cxx
@@ -69,19 +69,19 @@ IMPL_LINK( PasswordCreateDialog, OKHdl_Impl, OKButton *, EMPTYARG )
// -----------------------------------------------------------------------
-PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr )
+PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr, bool bMSCryptoMode)
:ModalDialog( _pParent, ResId( DLG_UUI_PASSWORD_CRT, *pResMgr ) )
,aFTPasswordCrt ( this, ResId( FT_PASSWORD_CRT, *pResMgr ) )
,aEDPasswordCrt ( this, ResId( ED_PASSWORD_CRT, *pResMgr ) )
,aFTPasswordRepeat ( this, ResId( FT_PASSWORD_REPEAT, *pResMgr ) )
,aEDPasswordRepeat ( this, ResId( ED_PASSWORD_REPEAT, *pResMgr ) )
- ,aFTWarning ( this, ResId( FT_PASSWORD_WARNING, *pResMgr ) )
+ ,aFTWarning ( this, ResId( bMSCryptoMode ? FT_MSPASSWORD_WARNING : FT_PASSWORD_WARNING, *pResMgr ) )
,aFixedLine1 ( this, ResId( FL_FIXED_LINE_1, *pResMgr ) )
,aOKBtn ( this, ResId( BTN_PASSCRT_OK, *pResMgr ) )
,aCancelBtn ( this, ResId( BTN_PASSCRT_CANCEL, *pResMgr ) )
,aHelpBtn ( this, ResId( BTN_PASSCRT_HELP, *pResMgr ) )
,pResourceMgr ( pResMgr )
- ,nMinLen(5)
+ ,nMinLen( bMSCryptoMode ? 1 : 5 )
{
FreeResource();
@@ -90,6 +90,12 @@ PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr )
aOKBtn.Enable( sal_False );
+ if ( bMSCryptoMode )
+ {
+ aEDPasswordCrt.SetMaxTextLen( 15 );
+ aEDPasswordRepeat.SetMaxTextLen( 15 );
+ }
+
long nLabelWidth = aFTWarning.GetSizePixel().Width();
long nLabelHeight = aFTWarning.GetSizePixel().Height();
long nTextWidth = aFTWarning.GetCtrlTextWidth( aFTWarning.GetText() );
diff --git a/uui/source/passcrtdlg.hrc b/uui/source/passcrtdlg.hrc
index 4c10fa92fddd..54a09494e2ab 100644
--- a/uui/source/passcrtdlg.hrc
+++ b/uui/source/passcrtdlg.hrc
@@ -28,19 +28,20 @@
*
************************************************************************/
-#ifndef UUI_PASSCRTDLG_HRC
-#define UUI_PASSCRTDLG_HRC
+#ifndef UUI_PASSCRTDLG_HRC
+#define UUI_PASSCRTDLG_HRC
-// local identifiers
-#define BTN_PASSCRT_CANCEL 1
-#define ED_PASSWORD_CRT 2
-#define FT_PASSWORD_REPEAT 3
-#define FT_PASSWORD_WARNING 4
-#define ED_PASSWORD_REPEAT 5
-#define FL_FIXED_LINE_1 6
-#define BTN_PASSCRT_OK 7
-#define BTN_PASSCRT_HELP 8
-#define FT_PASSWORD_CRT 9
+// local identifiers
+#define BTN_PASSCRT_CANCEL 1
+#define ED_PASSWORD_CRT 2
+#define FT_PASSWORD_REPEAT 3
+#define FT_PASSWORD_WARNING 4
+#define ED_PASSWORD_REPEAT 5
+#define FL_FIXED_LINE_1 6
+#define BTN_PASSCRT_OK 7
+#define BTN_PASSCRT_HELP 8
+#define FT_PASSWORD_CRT 9
+#define FT_MSPASSWORD_WARNING 10
-#endif // UUI_PASSCRTDLG_HRC
+#endif // UUI_PASSCRTDLG_HRC
diff --git a/uui/source/passcrtdlg.hxx b/uui/source/passcrtdlg.hxx
index 0fefc10d09ba..b4f0f61644d6 100644
--- a/uui/source/passcrtdlg.hxx
+++ b/uui/source/passcrtdlg.hxx
@@ -58,7 +58,7 @@ class PasswordCreateDialog : public ModalDialog
DECL_LINK( EditHdl_Impl, Edit * );
public:
- PasswordCreateDialog( Window* pParent, ResMgr * pResMgr );
+ PasswordCreateDialog( Window* pParent, ResMgr * pResMgr, bool bMSCryptoMode = false );
String GetPassword() const { return aEDPasswordCrt.GetText(); }
};
diff --git a/uui/source/passcrtdlg.src b/uui/source/passcrtdlg.src
index cdfc9d380079..13f1ea688620 100644
--- a/uui/source/passcrtdlg.src
+++ b/uui/source/passcrtdlg.src
@@ -34,7 +34,7 @@
#include <ids.hrc>
#endif
#ifndef UUI_PASSCRTDLG_HRC
-#include "passcrtdlg.hrc"
+#include "passcrtdlg.hrc"
#endif
ModalDialog DLG_UUI_PASSWORD_CRT
@@ -44,61 +44,68 @@ ModalDialog DLG_UUI_PASSWORD_CRT
Moveable = TRUE ;
OutputSize = TRUE ;
SVLook = TRUE ;
- Size = MAP_APPFONT( 145, 129 );
+ Size = MAP_APPFONT( 145, 129 );
FixedText FT_PASSWORD_CRT
{
- Pos = MAP_APPFONT( 3, 4 );
- Size = MAP_APPFONT( 139, 9 );
- Text [ en-US ] = "Enter password";
+ Pos = MAP_APPFONT( 3, 4 );
+ Size = MAP_APPFONT( 139, 9 );
+ Text [ en-US ] = "Enter password";
};
Edit ED_PASSWORD_CRT
{
Border = TRUE ;
- Pos = MAP_APPFONT( 3, 17 );
+ Pos = MAP_APPFONT( 3, 17 );
Size = MAP_APPFONT( 139, 13 );
PassWord = TRUE ;
};
Edit ED_PASSWORD_REPEAT
{
Border = TRUE ;
- Pos = MAP_APPFONT( 3, 47 );
+ Pos = MAP_APPFONT( 3, 47 );
Size = MAP_APPFONT( 139, 13 );
PassWord = TRUE ;
};
OKButton BTN_PASSCRT_OK
{
- Pos = MAP_APPFONT( 27, 110 );
+ Pos = MAP_APPFONT( 27, 110 );
Size = MAP_APPFONT( 37, 15 );
DefButton = TRUE ;
};
CancelButton BTN_PASSCRT_CANCEL
{
- Pos = MAP_APPFONT( 66, 110 );
- Size = MAP_APPFONT( 37, 15 );
+ Pos = MAP_APPFONT( 66, 110 );
+ Size = MAP_APPFONT( 37, 15 );
};
HelpButton BTN_PASSCRT_HELP
{
- Pos = MAP_APPFONT( 105, 110 );
- Size = MAP_APPFONT( 37, 15 );
+ Pos = MAP_APPFONT( 105, 110 );
+ Size = MAP_APPFONT( 37, 15 );
};
- FixedText FT_PASSWORD_REPEAT
- {
- Pos = MAP_APPFONT( 3, 34 );
- Size = MAP_APPFONT( 139, 9 );
- Text [ en-US ] = "Reenter password";
- };
- FixedText FT_PASSWORD_WARNING
- {
- Pos = MAP_APPFONT( 4, 64 );
- Size = MAP_APPFONT( 137, 40 );
- Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive and at least five characters long.";
- WordBreak = TRUE;
- };
- FixedLine FL_FIXED_LINE_1
- {
- Pos = MAP_APPFONT( 0, 104 );
- Size = MAP_APPFONT( 145, 6 );
+ FixedText FT_PASSWORD_REPEAT
+ {
+ Pos = MAP_APPFONT( 3, 34 );
+ Size = MAP_APPFONT( 139, 9 );
+ Text [ en-US ] = "Reenter password";
+ };
+ FixedText FT_PASSWORD_WARNING
+ {
+ Pos = MAP_APPFONT( 4, 64 );
+ Size = MAP_APPFONT( 137, 40 );
+ Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive and at least five characters long.";
+ WordBreak = TRUE;
+ };
+ FixedText FT_MSPASSWORD_WARNING
+ {
+ Pos = MAP_APPFONT( 4, 64 );
+ Size = MAP_APPFONT( 137, 40 );
+ Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive and at most fifteen characters long.";
+ WordBreak = TRUE;
+ };
+ FixedLine FL_FIXED_LINE_1
+ {
+ Pos = MAP_APPFONT( 0, 104 );
+ Size = MAP_APPFONT( 145, 6 );
};
- Text [ en-US ] = "Enter Password";
+ Text [ en-US ] = "Enter Password";
};