Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / retypepassdlg.hxx
blobefb0872922eba38734691922044bc6b33099bc25
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SC_UI_RETYPEPASS_DLG_HXX
21 #define SC_UI_RETYPEPASS_DLG_HXX
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>
31 #include "tabprotection.hxx"
33 #include <boost/shared_ptr.hpp>
35 class Window;
36 class ScDocProtection;
37 class ScTableProtection;
38 class ScDocument;
40 class ScRetypePassDlg : public ModalDialog
42 public:
43 typedef ::boost::shared_ptr<ScDocProtection> DocProtectionPtr;
44 typedef ::boost::shared_ptr<ScTableProtection> TabProtectionPtr;
46 explicit ScRetypePassDlg(Window* pParent);
47 virtual ~ScRetypePassDlg();
49 virtual short Execute();
51 void SetDataFromDocument(const ScDocument& rDoc);
52 void SetDesiredHash(ScPasswordHash eHash);
54 /** Write the new set of password data to the document instance to
55 overwrite the current ones. */
56 void WriteNewDataToDocument(ScDocument& rDoc) const;
58 private:
59 ScRetypePassDlg(); // disabled
61 void Init();
62 void PopulateDialog();
63 void SetDocData();
64 void SetTableData(size_t nRowPos, SCTAB nTab);
65 void ResetTableRows();
67 /** Check the status of all hash values to see if it's okay to enable
68 the OK button. */
69 void CheckHashStatus();
71 private:
72 OKButton maBtnOk;
73 CancelButton maBtnCancel;
74 HelpButton maBtnHelp;
76 FixedInfo maTextDescription;
78 FixedLine maLineDocument;
79 FixedText maTextDocStatus;
80 PushButton maBtnRetypeDoc;
82 FixedLine maLineSheet;
83 FixedText maTextSheetName1;
84 FixedText maTextSheetStatus1;
85 PushButton maBtnRetypeSheet1;
87 FixedText maTextSheetName2;
88 FixedText maTextSheetStatus2;
89 PushButton maBtnRetypeSheet2;
91 FixedText maTextSheetName3;
92 FixedText maTextSheetStatus3;
93 PushButton maBtnRetypeSheet3;
95 FixedText maTextSheetName4;
96 FixedText maTextSheetStatus4;
97 PushButton maBtnRetypeSheet4;
99 ScrollBar maScrollBar;
101 OUString maTextNotProtected;
102 OUString maTextNotPassProtected;
103 OUString maTextHashBad;
104 OUString maTextHashGood;
105 OUString maTextHashRegen;
107 DECL_LINK( OKHdl, void* );
108 DECL_LINK( RetypeBtnHdl, PushButton* );
109 DECL_LINK( ScrollHdl, void* );
111 struct TableItem
113 OUString maName;
114 TabProtectionPtr mpProtect;
116 ::std::vector<TableItem> maTableItems;
118 DocProtectionPtr mpDocItem;
119 size_t mnCurScrollPos;
120 ScPasswordHash meDesiredHash;
123 // ============================================================================
125 class ScRetypePassInputDlg : public ModalDialog
127 public:
128 explicit ScRetypePassInputDlg(Window* pParent, ScPassHashProtectable* pProtected);
129 virtual ~ScRetypePassInputDlg();
131 virtual short Execute();
133 bool IsRemovePassword() const;
134 OUString GetNewPassword() const;
136 private:
137 ScRetypePassInputDlg(); // disabled
139 void Init();
140 void CheckPasswordInput();
142 private:
143 OKButton maBtnOk;
144 CancelButton maBtnCancel;
145 HelpButton maBtnHelp;
147 RadioButton maBtnRetypePassword;
149 FixedText maPassword1Text;
150 Edit maPassword1Edit;
151 FixedText maPassword2Text;
152 Edit maPassword2Edit;
154 CheckBox maBtnMatchOldPass;
156 RadioButton maBtnRemovePassword;
158 DECL_LINK( OKHdl, void* );
159 DECL_LINK( RadioBtnHdl, RadioButton* );
160 DECL_LINK( CheckBoxHdl, void* );
161 DECL_LINK( PasswordModifyHdl, void* );
163 ScPassHashProtectable* mpProtected;
166 #endif
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */