1e29c3191e
2008-12-04 14:43:28 +0100 oc r264844 : #i96788# 2008-12-03 02:15:17 +0100 fredrikh r264734 : i96817 2008-12-02 16:42:46 +0100 tbo r264720 : #i96763# changes to password dialog for framework, math, global 2008-11-26 16:26:28 +0100 mav r264418 : #i93617# fix typo 2008-11-26 16:13:03 +0100 mav r264411 : #i93617# fix the linux scenario 2008-11-25 17:58:01 +0100 mav r264323 : #i93617# fix the windows problems 2008-11-25 17:51:33 +0100 mav r264321 : #i93617# fix the windows problems 2008-11-21 16:01:18 +0100 mav r264145 : #i78753# integrate the patch 2008-11-21 14:08:32 +0100 mav r264136 : #i93617# integrate the patch 2008-11-21 13:01:56 +0100 mav r264127 : #i82947# integrate the patch 2008-11-20 18:14:19 +0100 mav r264092 : #i95793# look for import filter 2008-11-18 15:23:44 +0100 pb r263776 : fix: #i92579# #i92583# SvxSecurity/SearchPage: more space for controls 2008-11-18 15:21:39 +0100 pb r263774 : fix: #i92579# #i92583# SvxSecurity/SearchPage: more space for controls 2008-11-18 15:18:54 +0100 pb r263772 : fix: #i92583# SvxSearchPage::InitControls_Impl() added 2008-11-18 15:16:07 +0100 pb r263771 : fix: #i92579# columns calculated newly 2008-11-18 11:09:28 +0100 mav r263751 : #i21923# small fixes 2008-11-17 17:22:04 +0100 mav r263730 : #i21923# integrate the patch 2008-11-17 14:29:02 +0100 mav r263723 : #i21923# integrate the patch 2008-11-13 16:46:08 +0100 mav r263653 : #i88127# integrate the patch 2008-11-13 14:46:56 +0100 mav r263645 : #i54638# integrate the patch 2008-11-11 13:11:03 +0100 pb r263554 : fix: #i93142# disable maRecommReadOnlyCB on read-only documents 2008-11-10 13:30:58 +0100 pb r263516 : fix: #i93833# Mozilla Plug-in -> Browser Plug-in 2008-11-10 13:29:10 +0100 pb r263515 : fix: #i93833# Mozilla Plug-in -> Browser Plug-in 2008-11-10 06:10:11 +0100 pb r263505 : fix: #i94937# now .uno.ExtendedHelp without image 2008-11-04 20:52:50 +0100 mav r263337 : migrate cws fwk92 to svn
130 lines
5.1 KiB
C++
130 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: masterpasscrtdlg.cxx,v $
|
|
* $Revision: 1.4 $
|
|
*
|
|
* 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.
|
|
*
|
|
************************************************************************/
|
|
|
|
#include <svtools/filedlg.hxx>
|
|
#include <vcl/msgbox.hxx>
|
|
|
|
#ifndef UUI_IDS_HRC
|
|
#include <ids.hrc>
|
|
#endif
|
|
#ifndef UUI_MASTERPASSCRTDLG_HRC
|
|
#include <masterpasscrtdlg.hrc>
|
|
#endif
|
|
#include <masterpasscrtdlg.hxx>
|
|
|
|
// MasterPasswordCreateDialog---------------------------------------------------
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
IMPL_LINK( MasterPasswordCreateDialog, EditHdl_Impl, Edit *, EMPTYARG )
|
|
{
|
|
aOKBtn.Enable( aEDMasterPasswordCrt.GetText().Len() >= nMinLen );
|
|
return 0;
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
IMPL_LINK( MasterPasswordCreateDialog, OKHdl_Impl, OKButton *, EMPTYARG )
|
|
{
|
|
// compare both passwords and show message box if there are not equal!!
|
|
if( aEDMasterPasswordCrt.GetText() == aEDMasterPasswordRepeat.GetText() )
|
|
EndDialog( RET_OK );
|
|
else
|
|
{
|
|
String aErrorMsg( ResId( STR_ERROR_PASSWORDS_NOT_IDENTICAL, *pResourceMgr ));
|
|
ErrorBox aErrorBox( this, WB_OK, aErrorMsg );
|
|
aErrorBox.Execute();
|
|
aEDMasterPasswordCrt.SetText( String() );
|
|
aEDMasterPasswordRepeat.SetText( String() );
|
|
aEDMasterPasswordCrt.GrabFocus();
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
MasterPasswordCreateDialog::MasterPasswordCreateDialog
|
|
(
|
|
Window* pParent,
|
|
ResMgr* pResMgr
|
|
) :
|
|
|
|
ModalDialog( pParent, ResId( DLG_UUI_MASTERPASSWORD_CRT, *pResMgr ) ),
|
|
|
|
aFTMasterPasswordCrt ( this, ResId( FT_MASTERPASSWORD_CRT, *pResMgr ) ),
|
|
aEDMasterPasswordCrt ( this, ResId( ED_MASTERPASSWORD_CRT, *pResMgr ) ),
|
|
aFTMasterPasswordRepeat ( this, ResId( FT_MASTERPASSWORD_REPEAT, *pResMgr ) ),
|
|
aEDMasterPasswordRepeat ( this, ResId( ED_MASTERPASSWORD_REPEAT, *pResMgr ) ),
|
|
aFTMasterPasswordWarning ( this, ResId( FT_MASTERPASSWORD_WARNING, *pResMgr ) ),
|
|
aFL ( this, ResId( FL_FIXED_LINE, *pResMgr ) ),
|
|
aOKBtn ( this, ResId( BTN_MASTERPASSCRT_OK, *pResMgr ) ),
|
|
aCancelBtn ( this, ResId( BTN_MASTERPASSCRT_CANCEL, *pResMgr ) ),
|
|
aHelpBtn ( this, ResId( BTN_MASTERPASSCRT_HELP, *pResMgr ) ),
|
|
pResourceMgr ( pResMgr ),
|
|
nMinLen(5)
|
|
{
|
|
FreeResource();
|
|
|
|
aOKBtn.Enable( sal_False );
|
|
aOKBtn.SetClickHdl( LINK( this, MasterPasswordCreateDialog, OKHdl_Impl ) );
|
|
aEDMasterPasswordCrt.SetModifyHdl( LINK( this, MasterPasswordCreateDialog, EditHdl_Impl ) );
|
|
|
|
long nLableWidth = aFTMasterPasswordWarning.GetSizePixel().Width();
|
|
long nLabelHeight = aFTMasterPasswordWarning.GetSizePixel().Height();
|
|
long nTextWidth = aFTMasterPasswordWarning.GetCtrlTextWidth( aFTMasterPasswordWarning.GetText() );
|
|
long nTextHeight = aFTMasterPasswordWarning.GetTextHeight();
|
|
|
|
Rectangle aLabelRect( aFTMasterPasswordWarning.GetPosPixel(), aFTMasterPasswordWarning.GetSizePixel() );
|
|
Rectangle aRect = aFTMasterPasswordWarning.GetTextRect( aLabelRect, aFTMasterPasswordWarning.GetText() );
|
|
|
|
long nNewLabelHeight = 0;
|
|
for( nNewLabelHeight = ( nTextWidth / nLableWidth + 1 ) * nTextHeight;
|
|
nNewLabelHeight < aRect.GetHeight();
|
|
nNewLabelHeight += nTextHeight );
|
|
|
|
long nDelta = nNewLabelHeight - nLabelHeight;
|
|
Size aNewDlgSize = GetSizePixel();
|
|
aNewDlgSize.Height() += nDelta;
|
|
SetSizePixel( aNewDlgSize );
|
|
|
|
Size aNewWarningSize = aFTMasterPasswordWarning.GetSizePixel();
|
|
aNewWarningSize.Height() = nNewLabelHeight;
|
|
aFTMasterPasswordWarning.SetPosSizePixel( aFTMasterPasswordWarning.GetPosPixel(), aNewWarningSize );
|
|
|
|
Window* pControls[] = { &aFL, &aOKBtn, &aCancelBtn, &aHelpBtn };
|
|
const sal_Int32 nCCount = sizeof( pControls ) / sizeof( pControls[0] );
|
|
for ( int i = 0; i < nCCount; ++i )
|
|
{
|
|
Point aNewPos =(*pControls[i]).GetPosPixel();
|
|
aNewPos.Y() += nDelta;
|
|
pControls[i]->SetPosSizePixel( aNewPos, pControls[i]->GetSizePixel() );
|
|
}
|
|
};
|
|
|