summaryrefslogtreecommitdiff
path: root/cui/source/dialogs
diff options
context:
space:
mode:
authorThomas Lange [tl] <tl@openoffice.org>2010-03-03 16:36:43 +0100
committerThomas Lange [tl] <tl@openoffice.org>2010-03-03 16:36:43 +0100
commit5d80039860ebc67494e489137138fbc935089cc0 (patch)
tree38a7458126fa156773aebff3157f3225e2590532 /cui/source/dialogs
parent055bc5c7f48cd556d256dedc32671f60ad30ccf4 (diff)
#109634# password to modify dialog
Diffstat (limited to 'cui/source/dialogs')
-rwxr-xr-xcui/source/dialogs/makefile.mk2
-rwxr-xr-xcui/source/dialogs/passwdomdlg.cxx256
-rwxr-xr-xcui/source/dialogs/passwdomdlg.hrc55
-rwxr-xr-xcui/source/dialogs/passwdomdlg.src188
4 files changed, 501 insertions, 0 deletions
diff --git a/cui/source/dialogs/makefile.mk b/cui/source/dialogs/makefile.mk
index f7d597a219a1..edb9b124a60e 100755
--- a/cui/source/dialogs/makefile.mk
+++ b/cui/source/dialogs/makefile.mk
@@ -60,6 +60,7 @@ SRC1FILES = \
insrc.src \
multipat.src \
newtabledlg.src \
+ passwdomdlg.src \
postdlg.src \
scriptdlg.src \
sdrcelldlg.src \
@@ -96,6 +97,7 @@ SLOFILES+=\
$(SLO)$/multifil.obj \
$(SLO)$/multipat.obj \
$(SLO)$/newtabledlg.obj \
+ $(SLO)$/passwdomdlg.obj \
$(SLO)$/pastedlg.obj \
$(SLO)$/plfilter.obj \
$(SLO)$/postdlg.obj \
diff --git a/cui/source/dialogs/passwdomdlg.cxx b/cui/source/dialogs/passwdomdlg.cxx
new file mode 100755
index 000000000000..42a930febd89
--- /dev/null
+++ b/cui/source/dialogs/passwdomdlg.cxx
@@ -0,0 +1,256 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cui.hxx"
+
+// include ---------------------------------------------------------------
+
+#include "passwdomdlg.hrc"
+#include "passwdomdlg.hxx"
+
+#include "cuires.hrc"
+#include "dialmgr.hxx"
+
+#include <sfx2/tabdlg.hxx>
+#include <tools/debug.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/button.hxx>
+#include <vcl/morebtn.hxx>
+#include <vcl/settings.hxx>
+
+
+//////////////////////////////////////////////////////////////////////
+
+class PasswordReenterEdit_Impl : public Edit
+{
+ String m_aDefaultTxt;
+ bool m_bForceNonEmptyPasswd;
+
+ // disallow use of copy c-tor and assignment operator
+ PasswordReenterEdit_Impl( const PasswordReenterEdit_Impl & );
+ PasswordReenterEdit_Impl & operator = ( const PasswordReenterEdit_Impl & );
+
+public:
+ PasswordReenterEdit_Impl( Window * pParent, const ResId &rResId, bool bForceNonEmptyPasswd );
+ virtual ~PasswordReenterEdit_Impl();
+
+ // Edit
+// virtual void Modify();
+ virtual void Paint( const Rectangle& rRect );
+};
+
+
+PasswordReenterEdit_Impl::PasswordReenterEdit_Impl( Window * pParent, const ResId &rResId, bool bForceNonEmptyPasswd ) :
+ Edit( pParent, rResId ),
+ m_bForceNonEmptyPasswd( bForceNonEmptyPasswd )
+{
+ m_aDefaultTxt = String( CUI_RES( STR_PASSWD_MUST_BE_CONFIRMED ) );
+}
+
+
+PasswordReenterEdit_Impl::~PasswordReenterEdit_Impl()
+{
+}
+
+/*
+void PasswordReenterEdit_Impl::Modify()
+{
+ Edit::Modify();
+ SetModifyFlag();
+ if (m_bForceNonEmptyPasswd && GetText().Len() == 0)
+ Invalidate(); // get the m_aDefaultTxt displayed again
+}
+*/
+
+void PasswordReenterEdit_Impl::Paint( const Rectangle& rRect )
+{
+ if (!IsEnabled() || !IsModified() || (m_bForceNonEmptyPasswd && GetText().Len() == 0))
+ {
+ Push( PUSH_FILLCOLOR | PUSH_TEXTFILLCOLOR );
+
+ Color aFillColor( GetParent()->GetBackground().GetColor() );
+ SetLineColor();
+ SetFillColor( aFillColor );
+ SetTextFillColor( aFillColor );
+
+ DrawRect( Rectangle( Point(), GetOutputSizePixel() ) );
+ DrawText( Point(), m_aDefaultTxt );
+
+ Pop();
+ }
+ else
+ Edit::Paint( rRect );
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+struct PasswordToOpenModifyDialog_Impl
+{
+ Window * m_pParent;
+
+ FixedText m_aPasswdToOpenFT;
+ Edit m_aPasswdToOpenED;
+ FixedText m_aReenterPasswdToOpenFT;
+ PasswordReenterEdit_Impl m_aReenterPasswdToOpenED;
+ FixedImage m_aPasswdToOpenMatchFI;
+ FixedText m_aPasswdNoteFT;
+ FixedLine m_aButtonsFL;
+ MoreButton m_aMoreFewerOptionsBTN;
+ OKButton m_aOk;
+ CancelButton m_aCancel;
+ FixedLine m_aFileSharingOptionsFL;
+ FixedText m_aPasswdToModifyFT;
+ Edit m_aPasswdToModifyED;
+ FixedText m_aReenterPasswdToModifyFT;
+ PasswordReenterEdit_Impl m_aReenterPasswdToModifyED;
+ FixedImage m_aPasswdToModifyMatchFI;
+
+ bool m_bReenterPasswdToOpenEdited;
+ bool m_bReenterPasswdToModifyEdited;
+
+
+ DECL_LINK( ModifyHdl, Edit * );
+
+ PasswordToOpenModifyDialog_Impl( Window * pParent );
+ ~PasswordToOpenModifyDialog_Impl();
+};
+
+
+PasswordToOpenModifyDialog_Impl::PasswordToOpenModifyDialog_Impl( Window * pParent ) :
+ m_pParent( pParent ),
+ m_aPasswdToOpenFT ( pParent, CUI_RES( FT_PASSWD_TO_OPEN ) ),
+ m_aPasswdToOpenED ( pParent, CUI_RES( ED_PASSWD_TO_OPEN ) ),
+ m_aReenterPasswdToOpenFT ( pParent, CUI_RES( FT_REENTER_PASSWD_TO_OPEN ) ),
+ m_aReenterPasswdToOpenED ( pParent, CUI_RES( ED_REENTER_PASSWD_TO_OPEN ), true ),
+ m_aPasswdToOpenMatchFI ( pParent, CUI_RES( FI_PASSWD_TO_OPEN_MATCH ) ),
+ m_aPasswdNoteFT ( pParent, CUI_RES( FT_PASSWD_NOTE ) ),
+ m_aButtonsFL ( pParent, CUI_RES( FL_BUTTONS ) ),
+ m_aMoreFewerOptionsBTN ( pParent, CUI_RES( BTN_MORE_FEWER_OPTIONS ) ),
+ m_aOk ( pParent, CUI_RES( BTN_OK ) ),
+ m_aCancel ( pParent, CUI_RES( BTN_CANCEL ) ),
+ m_aFileSharingOptionsFL ( pParent, CUI_RES( FL_FILE_SHARING_OPTIONS ) ),
+ m_aPasswdToModifyFT ( pParent, CUI_RES( FT_PASSWD_TO_MODIFY ) ),
+ m_aPasswdToModifyED ( pParent, CUI_RES( ED_PASSWD_TO_MODIFY ) ),
+ m_aReenterPasswdToModifyFT ( pParent, CUI_RES( FT_REENTER_PASSWD_TO_MODIFY ) ),
+ m_aReenterPasswdToModifyED ( pParent, CUI_RES( ED_REENTER_PASSWD_TO_MODIFY ), false ),
+ m_aPasswdToModifyMatchFI ( pParent, CUI_RES( FI_PASSWD_TO_MODIFY_MATCH ) ),
+ m_bReenterPasswdToOpenEdited ( false ),
+ m_bReenterPasswdToModifyEdited ( false )
+{
+ const sal_Bool bHighContrast = pParent->GetSettings().GetStyleSettings().GetHighContrastMode();
+ const Image aImage( CUI_RES( bHighContrast ? IMG_PASSWD_MATCH_HC : IMG_PASSWD_MATCH ) );
+ m_aPasswdToOpenMatchFI.SetImage( aImage );
+ m_aPasswdToModifyMatchFI.SetImage( aImage );
+
+ m_aMoreFewerOptionsBTN.SetMoreText( String( CUI_RES( STR_MORE_OPTIONS ) ) );
+ m_aMoreFewerOptionsBTN.SetLessText( String( CUI_RES( STR_FEWER_OPTIONS ) ) );
+
+ Link aModifyLink = LINK( this, PasswordToOpenModifyDialog_Impl, ModifyHdl );
+ m_aPasswdToOpenED.SetModifyHdl( aModifyLink );
+ m_aReenterPasswdToOpenED.SetModifyHdl( aModifyLink );
+ m_aPasswdToModifyED.SetModifyHdl( aModifyLink );
+ m_aReenterPasswdToModifyED.SetModifyHdl( aModifyLink );
+
+ m_aReenterPasswdToOpenED.Enable( FALSE );
+ m_aReenterPasswdToModifyED.Enable( FALSE );
+ m_aOk.Enable( FALSE );
+
+ ModifyHdl( NULL );
+}
+
+
+PasswordToOpenModifyDialog_Impl::~PasswordToOpenModifyDialog_Impl()
+{
+}
+
+
+IMPL_LINK( PasswordToOpenModifyDialog_Impl, ModifyHdl, Edit *, pEdit )
+{
+ if (pEdit == &m_aReenterPasswdToOpenED)
+ m_bReenterPasswdToOpenEdited = true;
+ if (pEdit == &m_aReenterPasswdToModifyED)
+ m_bReenterPasswdToModifyEdited = true;
+
+ m_aReenterPasswdToOpenED.Enable( m_aPasswdToOpenED.GetText().Len() > 0 );
+ m_aReenterPasswdToModifyED.Enable( m_aPasswdToModifyED.GetText().Len() > 0 );
+
+ const bool bToOpenEqual = m_aPasswdToOpenED.GetText() == m_aReenterPasswdToOpenED.GetText();
+ const bool bToModifyEqual = m_aPasswdToModifyED.GetText() == m_aReenterPasswdToModifyED.GetText();
+ const BOOL bEnableOk =
+ m_bReenterPasswdToOpenEdited && m_aPasswdToOpenED.GetText().Len() > 0 &&
+ bToOpenEqual && (!m_bReenterPasswdToModifyEdited || bToModifyEqual);
+ m_aOk.Enable( bEnableOk );
+
+ m_aPasswdToOpenMatchFI.Enable( bToOpenEqual && m_aPasswdToOpenED.GetText().Len() > 0 );
+ m_aPasswdToModifyMatchFI.Enable( bToModifyEqual );
+
+ if (m_aReenterPasswdToOpenED.GetText().Len() == 0)
+ m_aReenterPasswdToOpenED.Invalidate(); // get the m_aDefaultTxt displayed again
+
+ return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+
+PasswordToOpenModifyDialog::PasswordToOpenModifyDialog( Window * pParent ) :
+ SfxModalDialog( pParent, CUI_RES( RID_DLG_PASSWORD_TO_OPEN_MODIFY ) )
+{
+ m_pImpl = boost::shared_ptr< PasswordToOpenModifyDialog_Impl >( new PasswordToOpenModifyDialog_Impl( this ) );
+
+ FreeResource();
+}
+
+
+PasswordToOpenModifyDialog::~PasswordToOpenModifyDialog()
+{
+}
+
+
+String PasswordToOpenModifyDialog::GetPasswordToOpen() const
+{
+ const bool bPasswdEditedAndOk =
+ m_pImpl->m_bReenterPasswdToOpenEdited && m_pImpl->m_aPasswdToOpenED.GetText().Len() > 0 &&
+ m_pImpl->m_aPasswdToOpenED.GetText() == m_pImpl->m_aReenterPasswdToOpenED.GetText();
+ return bPasswdEditedAndOk ? m_pImpl->m_aPasswdToOpenED.GetText() : String();
+}
+
+
+String PasswordToOpenModifyDialog::GetPasswordToModify() const
+{
+ const bool bPasswdEditedAndOk =
+ m_pImpl->m_bReenterPasswdToModifyEdited && m_pImpl->m_aPasswdToModifyED.GetText().Len() > 0 &&
+ m_pImpl->m_aPasswdToModifyED.GetText() == m_pImpl->m_aReenterPasswdToModifyED.GetText();
+ return bPasswdEditedAndOk ? m_pImpl->m_aPasswdToModifyED.GetText() : String();
+}
+
+//////////////////////////////////////////////////////////////////////
+
diff --git a/cui/source/dialogs/passwdomdlg.hrc b/cui/source/dialogs/passwdomdlg.hrc
new file mode 100755
index 000000000000..7c1f0d86fa5a
--- /dev/null
+++ b/cui/source/dialogs/passwdomdlg.hrc
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef _CUI_PASSWDOMDLG_HRC_
+#define _CUI_PASSWDOMDLG_HRC_
+
+#define FT_PASSWD_TO_OPEN 11
+#define ED_PASSWD_TO_OPEN 12
+#define FT_REENTER_PASSWD_TO_OPEN 13
+#define ED_REENTER_PASSWD_TO_OPEN 14
+#define IMG_PASSWD_MATCH 15
+#define IMG_PASSWD_MATCH_HC 16
+#define FT_PASSWD_NOTE 17
+#define FL_BUTTONS 18
+#define BTN_MORE_FEWER_OPTIONS 19
+#define BTN_OK 20
+#define BTN_CANCEL 21
+#define FL_FILE_SHARING_OPTIONS 22
+#define FT_PASSWD_TO_MODIFY 23
+#define ED_PASSWD_TO_MODIFY 24
+#define FT_REENTER_PASSWD_TO_MODIFY 25
+#define ED_REENTER_PASSWD_TO_MODIFY 26
+#define FI_PASSWD_TO_OPEN_MATCH 27
+#define FI_PASSWD_TO_MODIFY_MATCH 28
+
+#define STR_MORE_OPTIONS 51
+#define STR_FEWER_OPTIONS 52
+#define STR_PASSWD_MUST_BE_CONFIRMED 53
+
+#endif
+
diff --git a/cui/source/dialogs/passwdomdlg.src b/cui/source/dialogs/passwdomdlg.src
new file mode 100755
index 000000000000..08652e8f345b
--- /dev/null
+++ b/cui/source/dialogs/passwdomdlg.src
@@ -0,0 +1,188 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 <cuires.hrc>
+#include "passwdomdlg.hrc"
+
+
+ModalDialog RID_DLG_PASSWORD_TO_OPEN_MODIFY
+{
+ Size = MAP_APPFONT( 201, 135 );
+ Text [ en-US ] = "Password";
+// HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY;
+ Border = TRUE ;
+ Moveable = TRUE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+
+ FixedText FT_PASSWD_TO_OPEN
+ {
+ Pos = MAP_APPFONT( 3, 3 );
+ Size = MAP_APPFONT( 175, 8 );
+ Text [ en-US ] = "~Enter password to open";
+ WordBreak = TRUE;
+ };
+
+ Edit ED_PASSWD_TO_OPEN
+ {
+ Pos = MAP_APPFONT( 3, 14 );
+ Size = MAP_APPFONT( 175, 12 );
+ Border = TRUE ;
+ PassWord = TRUE ;
+ };
+
+ FixedText FT_REENTER_PASSWD_TO_OPEN
+ {
+ Pos = MAP_APPFONT( 3, 31 );
+ Size = MAP_APPFONT( 175, 8 );
+ Text [ en-US ] = "~Reenter password to open";
+ WordBreak = TRUE;
+ };
+
+ Edit ED_REENTER_PASSWD_TO_OPEN
+ {
+ Pos = MAP_APPFONT( 3, 42 );
+ Size = MAP_APPFONT( 175, 12 );
+ Border = TRUE ;
+ PassWord = TRUE ;
+ };
+
+ FixedImage FI_PASSWD_TO_OPEN_MATCH
+ {
+ Pos = MAP_APPFONT ( 180, 42 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ };
+
+ FixedText FT_PASSWD_NOTE
+ {
+ Pos = MAP_APPFONT( 3, 66 );
+ Size = MAP_APPFONT( 195, 4*8 ); // some extra space for translation in other languages
+ Text [ en-US ] = "Note: If you lose or forget the password, it can not be recovered. "\
+ "It is advisable to keep passwords in a safe place. Passwords are "\
+ "case-sensitive.";
+ WordBreak = TRUE;
+ };
+
+ FixedLine FL_BUTTONS
+ {
+ Pos = MAP_APPFONT( 0, 103 );
+ Size = MAP_APPFONT( 201, 8 );
+ };
+
+ MoreButton BTN_MORE_FEWER_OPTIONS
+ {
+ Pos = MAP_APPFONT( 3 , 116 ) ;
+ Size = MAP_APPFONT( 60 , 14 ) ;
+ Delta = 124+5 ;
+ State = FALSE ;
+ };
+
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT( 73, 116 );
+ Size = MAP_APPFONT( 60, 14 );
+ DefButton = TRUE ;
+ };
+
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT( 138, 116 );
+ Size = MAP_APPFONT( 60, 14 );
+ };
+
+ FixedLine FL_FILE_SHARING_OPTIONS
+ {
+ Pos = MAP_APPFONT( 3, 140 );
+ Size = MAP_APPFONT( 195, 8 );
+ Text [ en-US ] = "File sharing options";
+ };
+
+ FixedText FT_PASSWD_TO_MODIFY
+ {
+ Pos = MAP_APPFONT( 8, 151+5 );
+ Size = MAP_APPFONT( 170, 8 );
+ Text [ en-US ] = "Enter password to modify";
+ WordBreak = TRUE;
+ };
+
+ Edit ED_PASSWD_TO_MODIFY
+ {
+ Pos = MAP_APPFONT( 8, 162+5 );
+ Size = MAP_APPFONT( 170, 12 );
+ Border = TRUE ;
+ PassWord = TRUE ;
+ };
+
+ FixedText FT_REENTER_PASSWD_TO_MODIFY
+ {
+ Pos = MAP_APPFONT( 8, 180+5 );
+ Size = MAP_APPFONT( 170, 8 );
+ Text [ en-US ] = "Reenter password to modify";
+ WordBreak = TRUE;
+ };
+
+ Edit ED_REENTER_PASSWD_TO_MODIFY
+ {
+ Pos = MAP_APPFONT( 8, 191+5 );
+ Size = MAP_APPFONT( 170, 12 );
+ Border = TRUE ;
+ PassWord = TRUE ;
+ };
+
+ FixedImage FI_PASSWD_TO_MODIFY_MATCH
+ {
+ Pos = MAP_APPFONT ( 180, 191+5 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ };
+
+ String STR_PASSWD_MUST_BE_CONFIRMED
+ {
+ Text [ en-US ] = "Password must be confirmed" ;
+ };
+
+ String STR_MORE_OPTIONS
+ {
+ Text [ en-US ] = "More ~Options" ;
+ };
+
+ String STR_FEWER_OPTIONS
+ {
+ Text [ en-US ] = "Fewer ~Options" ;
+ };
+
+ Image IMG_PASSWD_MATCH
+ {
+ ImageBitmap = Bitmap { File = "apply.png"; };
+ };
+
+ Image IMG_PASSWD_MATCH_HC
+ {
+ ImageBitmap = Bitmap { File = "apply_h.png"; };
+ };
+};
+