24#include <document.hxx>
28 : GenericDialogController(pParent,
"modules/scalc/ui/retypepassdialog.ui",
"RetypePass")
29 , maTextNotProtected(
ScResId(STR_NOT_PROTECTED))
30 , maTextNotPassProtected(
ScResId(STR_NOT_PASS_PROTECTED))
31 , maTextHashBad(
ScResId(STR_HASH_BAD))
32 , maTextHashGood(
ScResId(STR_HASH_GOOD))
34 , mxBtnOk(m_xBuilder->weld_button(
"ok"))
35 , mxTextDocStatus(m_xBuilder->weld_label(
"docStatusLabel"))
36 , mxBtnRetypeDoc(m_xBuilder->weld_button(
"retypeDocButton"))
37 , mxScrolledWindow(m_xBuilder->weld_scrolled_window(
"scrolledwindow"))
38 , mxSheetsBox(m_xBuilder->weld_container(
"sheetsBox"))
53 return GenericDialogController::run();
57 : m_xBuilder(
Application::CreateBuilder(pParent,
"modules/scalc/ui/passfragment.ui"))
58 , m_xSheetsBox(m_xBuilder->weld_container(
"PassEntry"))
59 , m_xName(m_xBuilder->weld_label(
"name"))
60 , m_xStatus(m_xBuilder->weld_label(
"status"))
61 , m_xButton(m_xBuilder->weld_button(
"button"))
71 mpDocItem = std::make_shared<ScDocProtection>(*pDocProtect);
76 for (
SCTAB i = 0;
i < nTabCount; ++
i)
83 aTabItem.
mpProtect = std::make_shared<ScTableProtection>(*pTabProtect);
100 for (
size_t i = 0;
i <
n; ++
i)
114 mxBtnOk->connect_clicked(aLink);
135 bool bBtnEnabled =
false;
161 bool bBtnEnabled =
false;
205 bool bStatusGood =
true;
207 for (
size_t i = 0;
i < nTabCount && bStatusGood; ++
i)
227 if (&rBtn == mxBtnRetypeDoc.get())
230 pProtected = mpDocItem.get();
236 while (aPos < maSheets.size() && &rBtn != maSheets[aPos]->m_xButton.get())
239 pProtected = aPos < maSheets.size() ? maTableItems[aPos].mpProtect.get() :
nullptr;
268 : GenericDialogController(pParent,
"modules/scalc/ui/retypepassworddialog.ui",
269 "RetypePasswordDialog")
270 , m_pProtected(pProtected)
271 , m_xBtnOk(m_xBuilder->weld_button(
"ok"))
272 , m_xBtnRetypePassword(m_xBuilder->weld_radio_button(
"retypepassword"))
273 , m_xPasswordGrid(m_xBuilder->weld_widget(
"passwordgrid"))
274 , m_xPassword1Edit(m_xBuilder->weld_entry(
"newpassEntry"))
275 , m_xPassword2Edit(m_xBuilder->weld_entry(
"confirmpassEntry"))
276 , m_xBtnMatchOldPass(m_xBuilder->weld_check_button(
"mustmatch"))
277 , m_xBtnRemovePassword(m_xBuilder->weld_radio_button(
"removepassword"))
309 if (aPass1.isEmpty() || aPass2.isEmpty())
316 if (aPass1 != aPass2)
344 if (m_xBtnRetypePassword->get_active())
346 m_xPasswordGrid->set_sensitive(
true);
347 CheckPasswordInput();
351 m_xPasswordGrid->set_sensitive(
false);
352 m_xBtnOk->set_sensitive(
true);
358 CheckPasswordInput();
363 CheckPasswordInput();
Reference< XExecutableDialog > m_xDialog
virtual bool isProtected() const override
SC_DLLPUBLIC const ScTableProtection * GetTabProtection(SCTAB nTab) const
SC_DLLPUBLIC ScDocProtection * GetDocProtection() const
SC_DLLPUBLIC void SetDocProtection(const ScDocProtection *pProtect)
SC_DLLPUBLIC void SetTabProtection(SCTAB nTab, const ScTableProtection *pProtect)
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
SC_DLLPUBLIC SCTAB GetTableCount() const
virtual bool verifyPassword(const OUString &aPassText) const =0
virtual bool isProtected() const =0
virtual void setPassword(const OUString &aPassText)=0
virtual bool isPasswordEmpty() const =0
virtual bool hasPasswordHash(ScPasswordHash eHash, ScPasswordHash eHash2=PASSHASH_UNSPECIFIED) const =0
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
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
ScPasswordHash meDesiredHash
std::unique_ptr< weld::ScrolledWindow > mxScrolledWindow
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
sheet protection state container
virtual bool hasPasswordHash(ScPasswordHash eHash, ScPasswordHash eHash2=PASSHASH_UNSPECIFIED) const override
virtual bool isPasswordEmpty() const override
virtual bool isProtected() const override
virtual void set_label(const OUString &rText)=0
#define LINK(Instance, Class, Member)
IMPL_LINK(ScRetypePassDlg, RetypeBtnHdl, weld::Button &, rBtn, void)
static bool lcl_IsInGoodStatus(const ScPassHashProtectable *pProtected, ScPasswordHash eDesiredHash)
IMPL_LINK_NOARG(ScRetypePassDlg, OKHdl, weld::Button &, void)
OUString ScResId(TranslateId aId)
std::unique_ptr< weld::Button > m_xButton
PassFragment(weld::Widget *pParent)
std::shared_ptr< ScTableProtection > mpProtect