diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/sfx2/dinfdlg.hxx | 3 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 58 | ||||
-rwxr-xr-x | sfx2/source/dialog/dinfdlg.hrc | 1 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.src | 12 |
4 files changed, 72 insertions, 2 deletions
diff --git a/sfx2/inc/sfx2/dinfdlg.hxx b/sfx2/inc/sfx2/dinfdlg.hxx index cbeb4b37d0..95e8a5d0c2 100644 --- a/sfx2/inc/sfx2/dinfdlg.hxx +++ b/sfx2/inc/sfx2/dinfdlg.hxx @@ -174,6 +174,7 @@ class SfxDocumentPage : public SfxTabPage private: FixedImage aBmp1; Edit aNameED; + PushButton aChangePassBtn; FixedLine aLine1FL; FixedText aTypeFT; @@ -213,7 +214,9 @@ private: DECL_LINK( DeleteHdl, PushButton * ); DECL_LINK( SignatureHdl, PushButton * ); + DECL_LINK( ChangePassHdl, PushButton * ); void ImplUpdateSignatures(); + void ImplCheckPasswordState(); protected: SfxDocumentPage( Window* pParent, const SfxItemSet& ); diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index fd095cb7f2..b0e1cab2b4 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -68,6 +68,7 @@ #include <sfx2/frame.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/request.hxx> +#include <sfx2/passwd.hxx> #include "helper.hxx" #include <sfx2/objsh.hxx> #include <sfx2/docfile.hxx> @@ -790,6 +791,7 @@ SfxDocumentPage::SfxDocumentPage( Window* pParent, const SfxItemSet& rItemSet ) aBmp1 ( this, SfxResId( BMP_FILE_1 ) ), aNameED ( this, SfxResId( ED_FILE_NAME ) ), + aChangePassBtn ( this, SfxResId( BTN_CHANGE_PASS ) ), aLine1FL ( this, SfxResId( FL_FILE_1 ) ), aTypeFT ( this, SfxResId( FT_FILE_TYP ) ), @@ -832,8 +834,10 @@ SfxDocumentPage::SfxDocumentPage( Window* pParent, const SfxItemSet& rItemSet ) FreeResource(); ImplUpdateSignatures(); + ImplCheckPasswordState(); aDeleteBtn.SetClickHdl( LINK( this, SfxDocumentPage, DeleteHdl ) ); aSignatureBtn.SetClickHdl( LINK( this, SfxDocumentPage, SignatureHdl ) ); + aChangePassBtn.SetClickHdl( LINK( this, SfxDocumentPage, ChangePassHdl ) ); // if the button text is too wide, then broaden it const long nOffset = 12; @@ -909,6 +913,32 @@ IMPL_LINK( SfxDocumentPage, SignatureHdl, PushButton*, EMPTYARG ) return 0; } +IMPL_LINK( SfxDocumentPage, ChangePassHdl, PushButton*, EMPTYARG ) +{ + SfxObjectShell* pShell = SfxObjectShell::Current(); + do + { + if (!pShell) + break; + + SfxItemSet* pMedSet = pShell->GetMedium()->GetItemSet(); + if (!pMedSet) + break; + + ::std::auto_ptr<SfxPasswordDialog> pDlg(new SfxPasswordDialog(this)); + pDlg->SetMinLen(1); + pDlg->ShowExtras(SHOWEXTRAS_CONFIRM); + if (pDlg->Execute() != RET_OK) + break; + + String aNewPass = pDlg->GetPassword(); + pMedSet->Put( SfxStringItem(SID_PASSWORD, aNewPass) ); + pShell->SetModified(true); + } + while (false); + return 0; +} + void SfxDocumentPage::ImplUpdateSignatures() { SfxObjectShell* pDoc = SfxObjectShell::Current(); @@ -944,6 +974,34 @@ void SfxDocumentPage::ImplUpdateSignatures() } } +void SfxDocumentPage::ImplCheckPasswordState() +{ + SfxObjectShell* pShell = SfxObjectShell::Current(); + do + { + if (!pShell) + break; + + SfxItemSet* pMedSet = pShell->GetMedium()->GetItemSet(); + if (!pMedSet) + break; + + const SfxPoolItem* pItem; + if (!pMedSet->GetItemState(SID_PASSWORD, true, &pItem)) + break; + + const SfxStringItem* pStrItem = dynamic_cast<const SfxStringItem*>(pItem); + if (!pStrItem) + break; + + String aPass = pStrItem->GetValue(); + aChangePassBtn.Enable(); + return; + } + while (false); + aChangePassBtn.Disable(); +} + //------------------------------------------------------------------------ SfxTabPage* SfxDocumentPage::Create( Window* pParent, const SfxItemSet& rItemSet ) diff --git a/sfx2/source/dialog/dinfdlg.hrc b/sfx2/source/dialog/dinfdlg.hrc index f710e13534..d700bedee6 100755 --- a/sfx2/source/dialog/dinfdlg.hrc +++ b/sfx2/source/dialog/dinfdlg.hrc @@ -133,6 +133,7 @@ #define FT_SIGNED_VAL 77 #define STR_MULTSIGNED 78 #define BTN_SIGNATURE 79 +#define BTN_CHANGE_PASS 80 #define WIN_PROPERTIES 90 #define SB_VERTICAL 91 diff --git a/sfx2/source/dialog/dinfdlg.src b/sfx2/source/dialog/dinfdlg.src index ccaf6fcf21..64f28f792d 100644 --- a/sfx2/source/dialog/dinfdlg.src +++ b/sfx2/source/dialog/dinfdlg.src @@ -126,10 +126,18 @@ TabPage TP_DOCINFODOC Edit ED_FILE_NAME { HelpID = "sfx2:Edit:TP_DOCINFODOC:ED_FILE_NAME"; - Pos = MAP_APPFONT ( 54 , 12 ) ; - Size = MAP_APPFONT ( 200 , RSC_CD_TEXTBOX_HEIGHT ) ; + Pos = MAP_APPFONT ( 36 , 12 ) ; + Size = MAP_APPFONT ( 140 , RSC_CD_TEXTBOX_HEIGHT ) ; Border = TRUE ; }; + PushButton BTN_CHANGE_PASS + { + HelpID = "sfx2:Edit:TP_DOCINFODOC:BTN_CHANGE_PASS"; + Pos = MAP_APPFONT ( 189 , 11 ) ; + Size = MAP_APPFONT ( 65 , RSC_CD_PUSHBUTTON_HEIGHT ) ; + Hide = FALSE; + Text [ en-US ] = "Change ~Password..."; + }; FixedLine FL_FILE_1 { Pos = MAP_APPFONT ( 6 , 31 ) ; |