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 INCLUDED_SC_SOURCE_UI_INC_RETYPEPASSDLG_HXX
21 : #define INCLUDED_SC_SOURCE_UI_INC_RETYPEPASSDLG_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 : namespace vcl { 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(vcl::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 :
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 : void DeleteSheets();
72 :
73 : private:
74 : OKButton* mpBtnOk;
75 : FixedText* mpTextDocStatus;
76 : PushButton* mpBtnRetypeDoc;
77 : VclVBox* mpSheetsBox;
78 :
79 : std::vector<VclHBox*> maSheets;
80 :
81 : OUString maTextNotProtected;
82 : OUString maTextNotPassProtected;
83 : OUString maTextHashBad;
84 : OUString maTextHashGood;
85 : OUString maTextHashRegen;
86 :
87 : DECL_LINK( OKHdl, void* );
88 : DECL_LINK( RetypeBtnHdl, PushButton* );
89 :
90 0 : struct TableItem
91 : {
92 : OUString maName;
93 : TabProtectionPtr mpProtect;
94 : };
95 : ::std::vector<TableItem> maTableItems;
96 :
97 : DocProtectionPtr mpDocItem;
98 : size_t mnCurScrollPos;
99 : ScPasswordHash meDesiredHash;
100 : };
101 :
102 : class ScRetypePassInputDlg : public ModalDialog
103 : {
104 : public:
105 : explicit ScRetypePassInputDlg(vcl::Window* pParent, ScPassHashProtectable* pProtected);
106 : virtual ~ScRetypePassInputDlg();
107 :
108 : virtual short Execute() SAL_OVERRIDE;
109 :
110 : bool IsRemovePassword() const;
111 : OUString GetNewPassword() const;
112 :
113 : private:
114 : ScRetypePassInputDlg(); // disabled
115 :
116 : void Init();
117 : void CheckPasswordInput();
118 :
119 : private:
120 : OKButton* m_pBtnOk;
121 :
122 : RadioButton* m_pBtnRetypePassword;
123 :
124 : VclContainer* m_pPasswordGrid;
125 : Edit* m_pPassword1Edit;
126 : Edit* m_pPassword2Edit;
127 :
128 : CheckBox* m_pBtnMatchOldPass;
129 :
130 : RadioButton* m_pBtnRemovePassword;
131 :
132 : DECL_LINK( OKHdl, void* );
133 : DECL_LINK( RadioBtnHdl, RadioButton* );
134 : DECL_LINK( CheckBoxHdl, void* );
135 : DECL_LINK( PasswordModifyHdl, void* );
136 :
137 : ScPassHashProtectable* mpProtected;
138 : };
139 :
140 : #endif
141 :
142 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|