1*38d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*38d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*38d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*38d50f7bSAndrew Rist * distributed with this work for additional information 6*38d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*38d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*38d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 9*38d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 10*38d50f7bSAndrew Rist * 11*38d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*38d50f7bSAndrew Rist * 13*38d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*38d50f7bSAndrew Rist * software distributed under the License is distributed on an 15*38d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*38d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 17*38d50f7bSAndrew Rist * specific language governing permissions and limitations 18*38d50f7bSAndrew Rist * under the License. 19*38d50f7bSAndrew Rist * 20*38d50f7bSAndrew Rist *************************************************************/ 21*38d50f7bSAndrew Rist 22*38d50f7bSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SC_UI_RETYPEPASS_DLG_HXX 25cdf0e10cSrcweir #define SC_UI_RETYPEPASS_DLG_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <vcl/dialog.hxx> 28cdf0e10cSrcweir #include <vcl/button.hxx> 29cdf0e10cSrcweir #include <vcl/fixed.hxx> 30cdf0e10cSrcweir #include <vcl/edit.hxx> 31cdf0e10cSrcweir #include <vcl/scrbar.hxx> 32cdf0e10cSrcweir #include <svx/checklbx.hxx> 33cdf0e10cSrcweir #include <svtools/stdctrl.hxx> 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include "tabprotection.hxx" 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 38cdf0e10cSrcweir 39cdf0e10cSrcweir class Window; 40cdf0e10cSrcweir class ScDocProtection; 41cdf0e10cSrcweir class ScTableProtection; 42cdf0e10cSrcweir class ScDocument; 43cdf0e10cSrcweir 44cdf0e10cSrcweir class ScRetypePassDlg : public ModalDialog 45cdf0e10cSrcweir { 46cdf0e10cSrcweir public: 47cdf0e10cSrcweir typedef ::boost::shared_ptr<ScDocProtection> DocProtectionPtr; 48cdf0e10cSrcweir typedef ::boost::shared_ptr<ScTableProtection> TabProtectionPtr; 49cdf0e10cSrcweir 50cdf0e10cSrcweir explicit ScRetypePassDlg(Window* pParent); 51cdf0e10cSrcweir virtual ~ScRetypePassDlg(); 52cdf0e10cSrcweir 53cdf0e10cSrcweir virtual short Execute(); 54cdf0e10cSrcweir 55cdf0e10cSrcweir void SetDataFromDocument(const ScDocument& rDoc); 56cdf0e10cSrcweir void SetDesiredHash(ScPasswordHash eHash); 57cdf0e10cSrcweir 58cdf0e10cSrcweir /** Write the new set of password data to the document instance to 59cdf0e10cSrcweir overwrite the current ones. */ 60cdf0e10cSrcweir void WriteNewDataToDocument(ScDocument& rDoc) const; 61cdf0e10cSrcweir 62cdf0e10cSrcweir private: 63cdf0e10cSrcweir ScRetypePassDlg(); // disabled 64cdf0e10cSrcweir 65cdf0e10cSrcweir void Init(); 66cdf0e10cSrcweir void PopulateDialog(); 67cdf0e10cSrcweir void SetDocData(); 68cdf0e10cSrcweir void SetTableData(size_t nRowPos, SCTAB nTab); 69cdf0e10cSrcweir void ResetTableRows(); 70cdf0e10cSrcweir 71cdf0e10cSrcweir /** Check the status of all hash values to see if it's okay to enable 72cdf0e10cSrcweir the OK button. */ 73cdf0e10cSrcweir void CheckHashStatus(); 74cdf0e10cSrcweir 75cdf0e10cSrcweir private: 76cdf0e10cSrcweir OKButton maBtnOk; 77cdf0e10cSrcweir CancelButton maBtnCancel; 78cdf0e10cSrcweir HelpButton maBtnHelp; 79cdf0e10cSrcweir 80cdf0e10cSrcweir FixedInfo maTextDescription; 81cdf0e10cSrcweir 82cdf0e10cSrcweir FixedLine maLineDocument; 83cdf0e10cSrcweir FixedText maTextDocStatus; 84cdf0e10cSrcweir PushButton maBtnRetypeDoc; 85cdf0e10cSrcweir 86cdf0e10cSrcweir FixedLine maLineSheet; 87cdf0e10cSrcweir FixedText maTextSheetName1; 88cdf0e10cSrcweir FixedText maTextSheetStatus1; 89cdf0e10cSrcweir PushButton maBtnRetypeSheet1; 90cdf0e10cSrcweir 91cdf0e10cSrcweir FixedText maTextSheetName2; 92cdf0e10cSrcweir FixedText maTextSheetStatus2; 93cdf0e10cSrcweir PushButton maBtnRetypeSheet2; 94cdf0e10cSrcweir 95cdf0e10cSrcweir FixedText maTextSheetName3; 96cdf0e10cSrcweir FixedText maTextSheetStatus3; 97cdf0e10cSrcweir PushButton maBtnRetypeSheet3; 98cdf0e10cSrcweir 99cdf0e10cSrcweir FixedText maTextSheetName4; 100cdf0e10cSrcweir FixedText maTextSheetStatus4; 101cdf0e10cSrcweir PushButton maBtnRetypeSheet4; 102cdf0e10cSrcweir 103cdf0e10cSrcweir ScrollBar maScrollBar; 104cdf0e10cSrcweir 105cdf0e10cSrcweir String maTextNotProtected; 106cdf0e10cSrcweir String maTextNotPassProtected; 107cdf0e10cSrcweir String maTextHashBad; 108cdf0e10cSrcweir String maTextHashGood; 109cdf0e10cSrcweir String maTextHashRegen; 110cdf0e10cSrcweir 111cdf0e10cSrcweir DECL_LINK( OKHdl, OKButton* ); 112cdf0e10cSrcweir DECL_LINK( RetypeBtnHdl, PushButton* ); 113cdf0e10cSrcweir DECL_LINK( ScrollHdl, ScrollBar* ); 114cdf0e10cSrcweir 115cdf0e10cSrcweir struct TableItem 116cdf0e10cSrcweir { 117cdf0e10cSrcweir String maName; 118cdf0e10cSrcweir TabProtectionPtr mpProtect; 119cdf0e10cSrcweir }; 120cdf0e10cSrcweir ::std::vector<TableItem> maTableItems; 121cdf0e10cSrcweir 122cdf0e10cSrcweir DocProtectionPtr mpDocItem; 123cdf0e10cSrcweir size_t mnCurScrollPos; 124cdf0e10cSrcweir ScPasswordHash meDesiredHash; 125cdf0e10cSrcweir }; 126cdf0e10cSrcweir 127cdf0e10cSrcweir // ============================================================================ 128cdf0e10cSrcweir 129cdf0e10cSrcweir class ScRetypePassInputDlg : public ModalDialog 130cdf0e10cSrcweir { 131cdf0e10cSrcweir public: 132cdf0e10cSrcweir explicit ScRetypePassInputDlg(Window* pParent, ScPassHashProtectable* pProtected); 133cdf0e10cSrcweir virtual ~ScRetypePassInputDlg(); 134cdf0e10cSrcweir 135cdf0e10cSrcweir virtual short Execute(); 136cdf0e10cSrcweir 137cdf0e10cSrcweir bool IsRemovePassword() const; 138cdf0e10cSrcweir String GetNewPassword() const; 139cdf0e10cSrcweir 140cdf0e10cSrcweir private: 141cdf0e10cSrcweir ScRetypePassInputDlg(); // disabled 142cdf0e10cSrcweir 143cdf0e10cSrcweir void Init(); 144cdf0e10cSrcweir void CheckPasswordInput(); 145cdf0e10cSrcweir 146cdf0e10cSrcweir private: 147cdf0e10cSrcweir OKButton maBtnOk; 148cdf0e10cSrcweir CancelButton maBtnCancel; 149cdf0e10cSrcweir HelpButton maBtnHelp; 150cdf0e10cSrcweir 151cdf0e10cSrcweir RadioButton maBtnRetypePassword; 152cdf0e10cSrcweir 153cdf0e10cSrcweir FixedText maPassword1Text; 154cdf0e10cSrcweir Edit maPassword1Edit; 155cdf0e10cSrcweir FixedText maPassword2Text; 156cdf0e10cSrcweir Edit maPassword2Edit; 157cdf0e10cSrcweir 158cdf0e10cSrcweir CheckBox maBtnMatchOldPass; 159cdf0e10cSrcweir 160cdf0e10cSrcweir RadioButton maBtnRemovePassword; 161cdf0e10cSrcweir 162cdf0e10cSrcweir DECL_LINK( OKHdl, OKButton* ); 163cdf0e10cSrcweir DECL_LINK( RadioBtnHdl, RadioButton* ); 164cdf0e10cSrcweir DECL_LINK( CheckBoxHdl, CheckBox* ); 165cdf0e10cSrcweir DECL_LINK( PasswordModifyHdl, Edit* ); 166cdf0e10cSrcweir 167cdf0e10cSrcweir ScPassHashProtectable* mpProtected; 168cdf0e10cSrcweir }; 169cdf0e10cSrcweir 170cdf0e10cSrcweir #endif 171