summaryrefslogtreecommitdiff
path: root/sfx2/source/dialog/dinfdlg.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/dialog/dinfdlg.cxx')
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx62
1 files changed, 60 insertions, 2 deletions
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 086fcc226537..106633b0a9d5 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 )
@@ -2172,8 +2230,8 @@ void CustomPropertiesWindow::DoScroll( sal_Int32 nNewPos )
if ( pLine->m_bIsRemoved )
continue;
- Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, &pLine->m_aDurationField,
- &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL };
+ Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, &pLine->m_aDateField, &pLine->m_aTimeField,
+ &pLine->m_aDurationField, &pLine->m_aEditButton, &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL };
Window** pCurrent = pWindows;
while ( *pCurrent )
{