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/button.hxx>
24 : #include <vcl/dialog.hxx>
25 : #include <vcl/edit.hxx>
26 : #include <vcl/fixed.hxx>
27 : #include <vcl/layout.hxx>
28 : #include <vcl/scrbar.hxx>
29 : #include <svx/checklbx.hxx>
30 : #include <svtools/stdctrl.hxx>
31 :
32 : #include "tabprotection.hxx"
33 :
34 : #include <boost/shared_ptr.hpp>
35 :
36 : class Window;
37 : class ScDocProtection;
38 : class ScTableProtection;
39 : class ScDocument;
40 :
41 : class ScRetypePassDlg : public ModalDialog
42 : {
43 : public:
44 : typedef ::boost::shared_ptr<ScDocProtection> DocProtectionPtr;
45 : typedef ::boost::shared_ptr<ScTableProtection> TabProtectionPtr;
46 :
47 : explicit ScRetypePassDlg(Window* pParent);
48 : virtual ~ScRetypePassDlg();
49 :
50 : virtual short Execute() SAL_OVERRIDE;
51 :
52 : void SetDataFromDocument(const ScDocument& rDoc);
53 : void SetDesiredHash(ScPasswordHash eHash);
54 :
55 : /** Write the new set of password data to the document instance to
56 : overwrite the current ones. */
57 : void WriteNewDataToDocument(ScDocument& rDoc) const;
58 :
59 : private:
60 : ScRetypePassDlg(); // disabled
61 :
62 : void Init();
63 : void PopulateDialog();
64 : void SetDocData();
65 : void SetTableData(size_t nRowPos, SCTAB nTab);
66 : void ResetTableRows();
67 :
68 : /** Check the status of all hash values to see if it's okay to enable
69 : the OK button. */
70 : void CheckHashStatus();
71 :
72 : private:
73 : OKButton maBtnOk;
74 : CancelButton maBtnCancel;
75 : HelpButton maBtnHelp;
76 :
77 : FixedInfo maTextDescription;
78 :
79 : FixedLine maLineDocument;
80 : FixedText maTextDocStatus;
81 : PushButton maBtnRetypeDoc;
82 :
83 : FixedLine maLineSheet;
84 : FixedText maTextSheetName1;
85 : FixedText maTextSheetStatus1;
86 : PushButton maBtnRetypeSheet1;
87 :
88 : FixedText maTextSheetName2;
89 : FixedText maTextSheetStatus2;
90 : PushButton maBtnRetypeSheet2;
91 :
92 : FixedText maTextSheetName3;
93 : FixedText maTextSheetStatus3;
94 : PushButton maBtnRetypeSheet3;
95 :
96 : FixedText maTextSheetName4;
97 : FixedText maTextSheetStatus4;
98 : PushButton maBtnRetypeSheet4;
99 :
100 : ScrollBar maScrollBar;
101 :
102 : OUString maTextNotProtected;
103 : OUString maTextNotPassProtected;
104 : OUString maTextHashBad;
105 : OUString maTextHashGood;
106 : OUString maTextHashRegen;
107 :
108 : DECL_LINK( OKHdl, void* );
109 : DECL_LINK( RetypeBtnHdl, PushButton* );
110 : DECL_LINK( ScrollHdl, void* );
111 :
112 0 : struct TableItem
113 : {
114 : OUString maName;
115 : TabProtectionPtr mpProtect;
116 : };
117 : ::std::vector<TableItem> maTableItems;
118 :
119 : DocProtectionPtr mpDocItem;
120 : size_t mnCurScrollPos;
121 : ScPasswordHash meDesiredHash;
122 : };
123 :
124 : class ScRetypePassInputDlg : public ModalDialog
125 : {
126 : public:
127 : explicit ScRetypePassInputDlg(Window* pParent, ScPassHashProtectable* pProtected);
128 : virtual ~ScRetypePassInputDlg();
129 :
130 : virtual short Execute() SAL_OVERRIDE;
131 :
132 : bool IsRemovePassword() const;
133 : OUString GetNewPassword() const;
134 :
135 : private:
136 : ScRetypePassInputDlg(); // disabled
137 :
138 : void Init();
139 : void CheckPasswordInput();
140 :
141 : private:
142 : OKButton* m_pBtnOk;
143 :
144 : RadioButton* m_pBtnRetypePassword;
145 :
146 : VclContainer* m_pPasswordGrid;
147 : Edit* m_pPassword1Edit;
148 : Edit* m_pPassword2Edit;
149 :
150 : CheckBox* m_pBtnMatchOldPass;
151 :
152 : RadioButton* m_pBtnRemovePassword;
153 :
154 : DECL_LINK( OKHdl, void* );
155 : DECL_LINK( RadioBtnHdl, RadioButton* );
156 : DECL_LINK( CheckBoxHdl, void* );
157 : DECL_LINK( PasswordModifyHdl, void* );
158 :
159 : ScPassHashProtectable* mpProtected;
160 : };
161 :
162 : #endif
163 :
164 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|