Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_UI_RETYPEPASS_DLG_HXX
30 : : #define SC_UI_RETYPEPASS_DLG_HXX
31 : :
32 : : #include <vcl/dialog.hxx>
33 : : #include <vcl/button.hxx>
34 : : #include <vcl/fixed.hxx>
35 : : #include <vcl/edit.hxx>
36 : : #include <vcl/scrbar.hxx>
37 : : #include <svx/checklbx.hxx>
38 : : #include <svtools/stdctrl.hxx>
39 : :
40 : : #include "tabprotection.hxx"
41 : :
42 : : #include <boost/shared_ptr.hpp>
43 : :
44 : : class Window;
45 : : class ScDocProtection;
46 : : class ScTableProtection;
47 : : class ScDocument;
48 : :
49 : : class ScRetypePassDlg : public ModalDialog
50 : : {
51 : : public:
52 : : typedef ::boost::shared_ptr<ScDocProtection> DocProtectionPtr;
53 : : typedef ::boost::shared_ptr<ScTableProtection> TabProtectionPtr;
54 : :
55 : : explicit ScRetypePassDlg(Window* pParent);
56 : : virtual ~ScRetypePassDlg();
57 : :
58 : : virtual short Execute();
59 : :
60 : : void SetDataFromDocument(const ScDocument& rDoc);
61 : : void SetDesiredHash(ScPasswordHash eHash);
62 : :
63 : : /** Write the new set of password data to the document instance to
64 : : overwrite the current ones. */
65 : : void WriteNewDataToDocument(ScDocument& rDoc) const;
66 : :
67 : : private:
68 : : ScRetypePassDlg(); // disabled
69 : :
70 : : void Init();
71 : : void PopulateDialog();
72 : : void SetDocData();
73 : : void SetTableData(size_t nRowPos, SCTAB nTab);
74 : : void ResetTableRows();
75 : :
76 : : /** Check the status of all hash values to see if it's okay to enable
77 : : the OK button. */
78 : : void CheckHashStatus();
79 : :
80 : : private:
81 : : OKButton maBtnOk;
82 : : CancelButton maBtnCancel;
83 : : HelpButton maBtnHelp;
84 : :
85 : : FixedInfo maTextDescription;
86 : :
87 : : FixedLine maLineDocument;
88 : : FixedText maTextDocStatus;
89 : : PushButton maBtnRetypeDoc;
90 : :
91 : : FixedLine maLineSheet;
92 : : FixedText maTextSheetName1;
93 : : FixedText maTextSheetStatus1;
94 : : PushButton maBtnRetypeSheet1;
95 : :
96 : : FixedText maTextSheetName2;
97 : : FixedText maTextSheetStatus2;
98 : : PushButton maBtnRetypeSheet2;
99 : :
100 : : FixedText maTextSheetName3;
101 : : FixedText maTextSheetStatus3;
102 : : PushButton maBtnRetypeSheet3;
103 : :
104 : : FixedText maTextSheetName4;
105 : : FixedText maTextSheetStatus4;
106 : : PushButton maBtnRetypeSheet4;
107 : :
108 : : ScrollBar maScrollBar;
109 : :
110 : : String maTextNotProtected;
111 : : String maTextNotPassProtected;
112 : : String maTextHashBad;
113 : : String maTextHashGood;
114 : : String maTextHashRegen;
115 : :
116 : : DECL_LINK( OKHdl, void* );
117 : : DECL_LINK( RetypeBtnHdl, PushButton* );
118 : : DECL_LINK( ScrollHdl, void* );
119 : :
120 [ # # ][ # # ]: 0 : struct TableItem
[ # # ]
121 : : {
122 : : rtl::OUString maName;
123 : : TabProtectionPtr mpProtect;
124 : : };
125 : : ::std::vector<TableItem> maTableItems;
126 : :
127 : : DocProtectionPtr mpDocItem;
128 : : size_t mnCurScrollPos;
129 : : ScPasswordHash meDesiredHash;
130 : : };
131 : :
132 : : // ============================================================================
133 : :
134 : : class ScRetypePassInputDlg : public ModalDialog
135 : : {
136 : : public:
137 : : explicit ScRetypePassInputDlg(Window* pParent, ScPassHashProtectable* pProtected);
138 : : virtual ~ScRetypePassInputDlg();
139 : :
140 : : virtual short Execute();
141 : :
142 : : bool IsRemovePassword() const;
143 : : String GetNewPassword() const;
144 : :
145 : : private:
146 : : ScRetypePassInputDlg(); // disabled
147 : :
148 : : void Init();
149 : : void CheckPasswordInput();
150 : :
151 : : private:
152 : : OKButton maBtnOk;
153 : : CancelButton maBtnCancel;
154 : : HelpButton maBtnHelp;
155 : :
156 : : RadioButton maBtnRetypePassword;
157 : :
158 : : FixedText maPassword1Text;
159 : : Edit maPassword1Edit;
160 : : FixedText maPassword2Text;
161 : : Edit maPassword2Edit;
162 : :
163 : : CheckBox maBtnMatchOldPass;
164 : :
165 : : RadioButton maBtnRemovePassword;
166 : :
167 : : DECL_LINK( OKHdl, void* );
168 : : DECL_LINK( RadioBtnHdl, RadioButton* );
169 : : DECL_LINK( CheckBoxHdl, void* );
170 : : DECL_LINK( PasswordModifyHdl, void* );
171 : :
172 : : ScPassHashProtectable* mpProtected;
173 : : };
174 : :
175 : : #endif
176 : :
177 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|