LibreOffice Module sc (master) 1
retypepassdlg.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <vcl/weld.hxx>
23#include <tabprotection.hxx>
24#include <memory>
25
26class ScDocument;
27
29{
30 std::unique_ptr<weld::Builder> m_xBuilder;
31 std::unique_ptr<weld::Container> m_xSheetsBox;
32 std::unique_ptr<weld::Label> m_xName;
33 std::unique_ptr<weld::Label> m_xStatus;
34 std::unique_ptr<weld::Button> m_xButton;
35
36 PassFragment(weld::Widget* pParent);
37};
38
40{
41public:
42 explicit ScRetypePassDlg(weld::Window* pParent);
43 virtual ~ScRetypePassDlg() override;
44
45 virtual short run() override;
46
47 void SetDataFromDocument(const ScDocument& rDoc);
49
52 void WriteNewDataToDocument(ScDocument& rDoc) const;
53
54private:
55 void Init();
56 void PopulateDialog();
57 void SetDocData();
58 void SetTableData(size_t nRowPos, SCTAB nTab);
59
62 void CheckHashStatus();
63
64 void DeleteSheets();
65
66private:
69 OUString maTextHashBad;
71
72 DECL_LINK(OKHdl, weld::Button&, void);
73 DECL_LINK(RetypeBtnHdl, weld::Button&, void);
74
75 struct TableItem
76 {
77 OUString maName;
78 std::shared_ptr<ScTableProtection> mpProtect;
79 };
80 ::std::vector<TableItem> maTableItems;
81
82 std::shared_ptr<ScDocProtection> mpDocItem;
84
85 std::unique_ptr<weld::Button> mxBtnOk;
86 std::unique_ptr<weld::Label> mxTextDocStatus;
87 std::unique_ptr<weld::Button> mxBtnRetypeDoc;
88 std::unique_ptr<weld::ScrolledWindow> mxScrolledWindow;
89 std::unique_ptr<weld::Container> mxSheetsBox;
90 std::vector<std::unique_ptr<PassFragment>> maSheets;
91};
92
94{
95public:
97 explicit ScRetypePassInputDlg(weld::Window* pParent, ScPassHashProtectable* pProtected);
98 virtual ~ScRetypePassInputDlg() override;
99
100 bool IsRemovePassword() const;
101 OUString GetNewPassword() const;
102
103private:
104 void Init();
105 void CheckPasswordInput();
106
107private:
109
110 std::unique_ptr<weld::Button> m_xBtnOk;
111
112 std::unique_ptr<weld::RadioButton> m_xBtnRetypePassword;
113
114 std::unique_ptr<weld::Widget> m_xPasswordGrid;
115 std::unique_ptr<weld::Entry> m_xPassword1Edit;
116 std::unique_ptr<weld::Entry> m_xPassword2Edit;
117
118 std::unique_ptr<weld::CheckButton> m_xBtnMatchOldPass;
119
120 std::unique_ptr<weld::RadioButton> m_xBtnRemovePassword;
121
122 DECL_LINK(OKHdl, weld::Button&, void);
123 DECL_LINK(RadioBtnHdl, weld::Toggleable&, void);
124 DECL_LINK(CheckBoxHdl, weld::Toggleable&, void);
125 DECL_LINK(PasswordModifyHdl, weld::Entry&, void);
126};
127
128/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DECL_LINK(OKHdl, weld::Button &, void)
std::unique_ptr< weld::Button > mxBtnRetypeDoc
void WriteNewDataToDocument(ScDocument &rDoc) const
Write the new set of password data to the document instance to overwrite the current ones.
void SetDataFromDocument(const ScDocument &rDoc)
void SetDesiredHash(ScPasswordHash eHash)
OUString maTextNotPassProtected
std::shared_ptr< ScDocProtection > mpDocItem
DECL_LINK(RetypeBtnHdl, weld::Button &, void)
void CheckHashStatus()
Check the status of all hash values to see if it's okay to enable the OK button.
::std::vector< TableItem > maTableItems
virtual ~ScRetypePassDlg() override
std::unique_ptr< weld::Container > mxSheetsBox
virtual short run() override
OUString maTextHashGood
ScPasswordHash meDesiredHash
std::unique_ptr< weld::ScrolledWindow > mxScrolledWindow
OUString maTextHashBad
ScRetypePassDlg(weld::Window *pParent)
OUString maTextNotProtected
std::unique_ptr< weld::Button > mxBtnOk
std::unique_ptr< weld::Label > mxTextDocStatus
void SetTableData(size_t nRowPos, SCTAB nTab)
std::vector< std::unique_ptr< PassFragment > > maSheets
std::unique_ptr< weld::RadioButton > m_xBtnRetypePassword
DECL_LINK(OKHdl, weld::Button &, void)
bool IsRemovePassword() const
std::unique_ptr< weld::RadioButton > m_xBtnRemovePassword
std::unique_ptr< weld::CheckButton > m_xBtnMatchOldPass
ScRetypePassInputDlg()=delete
std::unique_ptr< weld::Widget > m_xPasswordGrid
DECL_LINK(CheckBoxHdl, weld::Toggleable &, void)
std::unique_ptr< weld::Entry > m_xPassword2Edit
std::unique_ptr< weld::Button > m_xBtnOk
OUString GetNewPassword() const
DECL_LINK(RadioBtnHdl, weld::Toggleable &, void)
DECL_LINK(PasswordModifyHdl, weld::Entry &, void)
std::unique_ptr< weld::Entry > m_xPassword1Edit
ScPassHashProtectable * m_pProtected
virtual ~ScRetypePassInputDlg() override
std::unique_ptr< weld::Button > m_xButton
std::unique_ptr< weld::Container > m_xSheetsBox
std::unique_ptr< weld::Label > m_xStatus
std::unique_ptr< weld::Builder > m_xBuilder
PassFragment(weld::Widget *pParent)
std::unique_ptr< weld::Label > m_xName
std::shared_ptr< ScTableProtection > mpProtect
ScPasswordHash
sal_Int16 SCTAB
Definition: types.hxx:22