Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef SC_UI_RETYPEPASS_DLG_HXX
21 : #define SC_UI_RETYPEPASS_DLG_HXX
22 :
23 : #include <vcl/dialog.hxx>
24 : #include <vcl/button.hxx>
25 : #include <vcl/fixed.hxx>
26 : #include <vcl/edit.hxx>
27 : #include <vcl/scrbar.hxx>
28 : #include <svx/checklbx.hxx>
29 : #include <svtools/stdctrl.hxx>
30 :
31 : #include "tabprotection.hxx"
32 :
33 : #include <boost/shared_ptr.hpp>
34 :
35 : class Window;
36 : class ScDocProtection;
37 : class ScTableProtection;
38 : class ScDocument;
39 :
40 : class ScRetypePassDlg : public ModalDialog
41 : {
42 : public:
43 : typedef ::boost::shared_ptr<ScDocProtection> DocProtectionPtr;
44 : typedef ::boost::shared_ptr<ScTableProtection> TabProtectionPtr;
45 :
46 : explicit ScRetypePassDlg(Window* pParent);
47 : virtual ~ScRetypePassDlg();
48 :
49 : virtual short Execute();
50 :
51 : void SetDataFromDocument(const ScDocument& rDoc);
52 : void SetDesiredHash(ScPasswordHash eHash);
53 :
54 : /** Write the new set of password data to the document instance to
55 : overwrite the current ones. */
56 : void WriteNewDataToDocument(ScDocument& rDoc) const;
57 :
58 : private:
59 : ScRetypePassDlg(); // disabled
60 :
61 : void Init();
62 : void PopulateDialog();
63 : void SetDocData();
64 : void SetTableData(size_t nRowPos, SCTAB nTab);
65 : void ResetTableRows();
66 :
67 : /** Check the status of all hash values to see if it's okay to enable
68 : the OK button. */
69 : void CheckHashStatus();
70 :
71 : private:
72 : OKButton maBtnOk;
73 : CancelButton maBtnCancel;
74 : HelpButton maBtnHelp;
75 :
76 : FixedInfo maTextDescription;
77 :
78 : FixedLine maLineDocument;
79 : FixedText maTextDocStatus;
80 : PushButton maBtnRetypeDoc;
81 :
82 : FixedLine maLineSheet;
83 : FixedText maTextSheetName1;
84 : FixedText maTextSheetStatus1;
85 : PushButton maBtnRetypeSheet1;
86 :
87 : FixedText maTextSheetName2;
88 : FixedText maTextSheetStatus2;
89 : PushButton maBtnRetypeSheet2;
90 :
91 : FixedText maTextSheetName3;
92 : FixedText maTextSheetStatus3;
93 : PushButton maBtnRetypeSheet3;
94 :
95 : FixedText maTextSheetName4;
96 : FixedText maTextSheetStatus4;
97 : PushButton maBtnRetypeSheet4;
98 :
99 : ScrollBar maScrollBar;
100 :
101 : String maTextNotProtected;
102 : String maTextNotPassProtected;
103 : String maTextHashBad;
104 : String maTextHashGood;
105 : String maTextHashRegen;
106 :
107 : DECL_LINK( OKHdl, void* );
108 : DECL_LINK( RetypeBtnHdl, PushButton* );
109 : DECL_LINK( ScrollHdl, void* );
110 :
111 0 : struct TableItem
112 : {
113 : OUString maName;
114 : TabProtectionPtr mpProtect;
115 : };
116 : ::std::vector<TableItem> maTableItems;
117 :
118 : DocProtectionPtr mpDocItem;
119 : size_t mnCurScrollPos;
120 : ScPasswordHash meDesiredHash;
121 : };
122 :
123 : // ============================================================================
124 :
125 : class ScRetypePassInputDlg : public ModalDialog
126 : {
127 : public:
128 : explicit ScRetypePassInputDlg(Window* pParent, ScPassHashProtectable* pProtected);
129 : virtual ~ScRetypePassInputDlg();
130 :
131 : virtual short Execute();
132 :
133 : bool IsRemovePassword() const;
134 : String GetNewPassword() const;
135 :
136 : private:
137 : ScRetypePassInputDlg(); // disabled
138 :
139 : void Init();
140 : void CheckPasswordInput();
141 :
142 : private:
143 : OKButton maBtnOk;
144 : CancelButton maBtnCancel;
145 : HelpButton maBtnHelp;
146 :
147 : RadioButton maBtnRetypePassword;
148 :
149 : FixedText maPassword1Text;
150 : Edit maPassword1Edit;
151 : FixedText maPassword2Text;
152 : Edit maPassword2Edit;
153 :
154 : CheckBox maBtnMatchOldPass;
155 :
156 : RadioButton maBtnRemovePassword;
157 :
158 : DECL_LINK( OKHdl, void* );
159 : DECL_LINK( RadioBtnHdl, RadioButton* );
160 : DECL_LINK( CheckBoxHdl, void* );
161 : DECL_LINK( PasswordModifyHdl, void* );
162 :
163 : ScPassHashProtectable* mpProtected;
164 : };
165 :
166 : #endif
167 :
168 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|