1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: retypepassdlg.hxx,v $
10 * $Revision: 1.1.2.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_UI_RETYPEPASS_DLG_HXX
32 #define SC_UI_RETYPEPASS_DLG_HXX
34 #include <vcl/dialog.hxx>
35 #include <vcl/button.hxx>
36 #include <vcl/fixed.hxx>
37 #include <vcl/edit.hxx>
38 #include <vcl/scrbar.hxx>
39 #include <svx/checklbx.hxx>
40 #include <svtools/stdctrl.hxx>
42 #include "tabprotection.hxx"
44 #include <boost/shared_ptr.hpp>
47 class ScDocProtection
;
48 class ScTableProtection
;
51 class ScRetypePassDlg
: public ModalDialog
54 typedef ::boost::shared_ptr
<ScDocProtection
> DocProtectionPtr
;
55 typedef ::boost::shared_ptr
<ScTableProtection
> TabProtectionPtr
;
57 explicit ScRetypePassDlg(Window
* pParent
);
58 virtual ~ScRetypePassDlg();
60 virtual short Execute();
62 void SetDataFromDocument(const ScDocument
& rDoc
);
63 void SetDesiredHash(ScPasswordHash eHash
);
65 /** Write the new set of password data to the document instance to
66 overwrite the current ones. */
67 void WriteNewDataToDocument(ScDocument
& rDoc
) const;
70 ScRetypePassDlg(); // disabled
73 void PopulateDialog();
75 void SetTableData(size_t nRowPos
, SCTAB nTab
);
76 void ResetTableRows();
78 /** Check the status of all hash values to see if it's okay to enable
80 void CheckHashStatus();
84 CancelButton maBtnCancel
;
87 FixedInfo maTextDescription
;
89 FixedLine maLineDocument
;
90 FixedText maTextDocStatus
;
91 PushButton maBtnRetypeDoc
;
93 FixedLine maLineSheet
;
94 FixedText maTextSheetName1
;
95 FixedText maTextSheetStatus1
;
96 PushButton maBtnRetypeSheet1
;
98 FixedText maTextSheetName2
;
99 FixedText maTextSheetStatus2
;
100 PushButton maBtnRetypeSheet2
;
102 FixedText maTextSheetName3
;
103 FixedText maTextSheetStatus3
;
104 PushButton maBtnRetypeSheet3
;
106 FixedText maTextSheetName4
;
107 FixedText maTextSheetStatus4
;
108 PushButton maBtnRetypeSheet4
;
110 ScrollBar maScrollBar
;
112 String maTextNotProtected
;
113 String maTextNotPassProtected
;
114 String maTextHashBad
;
115 String maTextHashGood
;
116 String maTextHashRegen
;
118 DECL_LINK( OKHdl
, OKButton
* );
119 DECL_LINK( RetypeBtnHdl
, PushButton
* );
120 DECL_LINK( ScrollHdl
, ScrollBar
* );
125 TabProtectionPtr mpProtect
;
127 ::std::vector
<TableItem
> maTableItems
;
129 DocProtectionPtr mpDocItem
;
130 size_t mnCurScrollPos
;
131 ScPasswordHash meDesiredHash
;
134 // ============================================================================
136 class ScRetypePassInputDlg
: public ModalDialog
139 explicit ScRetypePassInputDlg(Window
* pParent
, ScPassHashProtectable
* pProtected
);
140 virtual ~ScRetypePassInputDlg();
142 virtual short Execute();
144 bool IsRemovePassword() const;
145 String
GetNewPassword() const;
148 ScRetypePassInputDlg(); // disabled
151 void CheckPasswordInput();
155 CancelButton maBtnCancel
;
156 HelpButton maBtnHelp
;
158 RadioButton maBtnRetypePassword
;
160 FixedText maPassword1Text
;
161 Edit maPassword1Edit
;
162 FixedText maPassword2Text
;
163 Edit maPassword2Edit
;
165 CheckBox maBtnMatchOldPass
;
167 RadioButton maBtnRemovePassword
;
169 DECL_LINK( OKHdl
, OKButton
* );
170 DECL_LINK( RadioBtnHdl
, RadioButton
* );
171 DECL_LINK( CheckBoxHdl
, CheckBox
* );
172 DECL_LINK( PasswordModifyHdl
, Edit
* );
174 ScPassHashProtectable
* mpProtected
;