1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_SC_SOURCE_UI_INC_RETYPEPASSDLG_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_RETYPEPASSDLG_HXX
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>
32 #include "tabprotection.hxx"
34 #include <boost/shared_ptr.hpp>
36 namespace vcl
{ class Window
; }
37 class ScDocProtection
;
38 class ScTableProtection
;
41 class ScRetypePassDlg
: public ModalDialog
44 typedef ::boost::shared_ptr
<ScDocProtection
> DocProtectionPtr
;
45 typedef ::boost::shared_ptr
<ScTableProtection
> TabProtectionPtr
;
47 explicit ScRetypePassDlg(vcl::Window
* pParent
);
48 virtual ~ScRetypePassDlg();
49 virtual void dispose() SAL_OVERRIDE
;
51 virtual short Execute() SAL_OVERRIDE
;
53 void SetDataFromDocument(const ScDocument
& rDoc
);
54 void SetDesiredHash(ScPasswordHash eHash
);
56 /** Write the new set of password data to the document instance to
57 overwrite the current ones. */
58 void WriteNewDataToDocument(ScDocument
& rDoc
) const;
61 ScRetypePassDlg(); // disabled
64 void PopulateDialog();
66 void SetTableData(size_t nRowPos
, SCTAB nTab
);
68 /** Check the status of all hash values to see if it's okay to enable
70 void CheckHashStatus();
75 VclPtr
<OKButton
> mpBtnOk
;
76 VclPtr
<FixedText
> mpTextDocStatus
;
77 VclPtr
<PushButton
> mpBtnRetypeDoc
;
78 VclPtr
<VclVBox
> mpSheetsBox
;
80 std::vector
<VclPtr
<VclHBox
>> maSheets
;
82 OUString maTextNotProtected
;
83 OUString maTextNotPassProtected
;
84 OUString maTextHashBad
;
85 OUString maTextHashGood
;
86 OUString maTextHashRegen
;
88 DECL_LINK( OKHdl
, void* );
89 DECL_LINK( RetypeBtnHdl
, PushButton
* );
94 TabProtectionPtr mpProtect
;
96 ::std::vector
<TableItem
> maTableItems
;
98 DocProtectionPtr mpDocItem
;
99 size_t mnCurScrollPos
;
100 ScPasswordHash meDesiredHash
;
103 class ScRetypePassInputDlg
: public ModalDialog
106 explicit ScRetypePassInputDlg(vcl::Window
* pParent
, ScPassHashProtectable
* pProtected
);
107 virtual ~ScRetypePassInputDlg();
108 virtual void dispose() SAL_OVERRIDE
;
110 virtual short Execute() SAL_OVERRIDE
;
112 bool IsRemovePassword() const;
113 OUString
GetNewPassword() const;
116 ScRetypePassInputDlg(); // disabled
119 void CheckPasswordInput();
122 VclPtr
<OKButton
> m_pBtnOk
;
124 VclPtr
<RadioButton
> m_pBtnRetypePassword
;
126 VclPtr
<VclContainer
> m_pPasswordGrid
;
127 VclPtr
<Edit
> m_pPassword1Edit
;
128 VclPtr
<Edit
> m_pPassword2Edit
;
130 VclPtr
<CheckBox
> m_pBtnMatchOldPass
;
132 VclPtr
<RadioButton
> m_pBtnRemovePassword
;
134 DECL_LINK( OKHdl
, void* );
135 DECL_LINK( RadioBtnHdl
, RadioButton
* );
136 DECL_LINK( CheckBoxHdl
, void* );
137 DECL_LINK( PasswordModifyHdl
, void* );
139 ScPassHashProtectable
* mpProtected
;
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */