Update ooo320-m1
[ooovba.git] / applied_patches / 0210-document-password-change-sfx2.diff
blob686c341b9da5ddf1ff511665f1e1a6c61775d011
1 --- sfx2/inc/sfx2/dinfdlg.hxx.old 2009-04-02 10:44:03.000000000 +0000
2 +++ sfx2/inc/sfx2/dinfdlg.hxx 2009-04-06 16:41:54.000000000 +0000
3 @@ -184,6 +184,7 @@ class SfxDocumentPage : public SfxTabPag
4 private:
5 FixedImage aBmp1;
6 Edit aNameED;
7 + PushButton aChangePassBtn;
9 FixedLine aLine1FL;
10 FixedText aTypeFT;
11 @@ -223,7 +224,9 @@ private:
13 DECL_LINK( DeleteHdl, PushButton * );
14 DECL_LINK( SignatureHdl, PushButton * );
15 + DECL_LINK( ChangePassHdl, PushButton * );
16 void ImplUpdateSignatures();
17 + void ImplCheckPasswordState();
19 protected:
20 SfxDocumentPage( Window* pParent, const SfxItemSet& );
21 --- sfx2/source/dialog/dinfdlg.cxx.old 2009-04-06 16:41:46.000000000 +0000
22 +++ sfx2/source/dialog/dinfdlg.cxx 2009-04-06 16:41:54.000000000 +0000
23 @@ -64,6 +64,7 @@
24 #include <sfx2/frame.hxx>
25 #include <sfx2/viewfrm.hxx>
26 #include <sfx2/request.hxx>
27 +#include <sfx2/passwd.hxx>
28 //#include "exptypes.hxx"
29 #include "helper.hxx"
30 #include <sfx2/objsh.hxx>
31 @@ -854,6 +855,7 @@ SfxDocumentPage::SfxDocumentPage( Window
33 aBmp1 ( this, SfxResId( BMP_FILE_1 ) ),
34 aNameED ( this, SfxResId( ED_FILE_NAME ) ),
35 + aChangePassBtn ( this, SfxResId( BTN_CHANGE_PASS ) ),
37 aLine1FL ( this, SfxResId( FL_FILE_1 ) ),
38 aTypeFT ( this, SfxResId( FT_FILE_TYP ) ),
39 @@ -895,8 +897,10 @@ SfxDocumentPage::SfxDocumentPage( Window
40 FreeResource();
42 ImplUpdateSignatures();
43 + ImplCheckPasswordState();
44 aDeleteBtn.SetClickHdl( LINK( this, SfxDocumentPage, DeleteHdl ) );
45 aSignatureBtn.SetClickHdl( LINK( this, SfxDocumentPage, SignatureHdl ) );
46 + aChangePassBtn.SetClickHdl( LINK( this, SfxDocumentPage, ChangePassHdl ) );
48 // if the button text is too wide, then broaden it
49 const long nOffset = 12;
50 @@ -965,6 +969,32 @@ IMPL_LINK( SfxDocumentPage, SignatureHdl
51 return 0;
54 +IMPL_LINK( SfxDocumentPage, ChangePassHdl, PushButton*, EMPTYARG )
56 + SfxObjectShell* pShell = SfxObjectShell::Current();
57 + do
58 + {
59 + if (!pShell)
60 + break;
62 + SfxItemSet* pMedSet = pShell->GetMedium()->GetItemSet();
63 + if (!pMedSet)
64 + break;
66 + ::std::auto_ptr<SfxPasswordDialog> pDlg(new SfxPasswordDialog(this));
67 + pDlg->SetMinLen(1);
68 + pDlg->ShowExtras(SHOWEXTRAS_CONFIRM);
69 + if (pDlg->Execute() != RET_OK)
70 + break;
72 + String aNewPass = pDlg->GetPassword();
73 + pMedSet->Put( SfxStringItem(SID_PASSWORD, aNewPass) );
74 + pShell->SetModified(true);
75 + }
76 + while (false);
77 + return 0;
80 void SfxDocumentPage::ImplUpdateSignatures()
82 SfxObjectShell* pDoc = SfxObjectShell::Current();
83 @@ -1000,6 +1030,34 @@ void SfxDocumentPage::ImplUpdateSignatur
87 +void SfxDocumentPage::ImplCheckPasswordState()
89 + SfxObjectShell* pShell = SfxObjectShell::Current();
90 + do
91 + {
92 + if (!pShell)
93 + break;
95 + SfxItemSet* pMedSet = pShell->GetMedium()->GetItemSet();
96 + if (!pMedSet)
97 + break;
99 + const SfxPoolItem* pItem;
100 + if (!pMedSet->GetItemState(SID_PASSWORD, true, &pItem))
101 + break;
103 + const SfxStringItem* pStrItem = dynamic_cast<const SfxStringItem*>(pItem);
104 + if (!pStrItem)
105 + break;
107 + String aPass = pStrItem->GetValue();
108 + aChangePassBtn.Enable();
109 + return;
111 + while (false);
112 + aChangePassBtn.Disable();
115 //------------------------------------------------------------------------
117 SfxTabPage* SfxDocumentPage::Create( Window* pParent, const SfxItemSet& rItemSet )
118 --- sfx2/source/dialog/dinfdlg.hrc.old 2009-04-02 10:43:54.000000000 +0000
119 +++ sfx2/source/dialog/dinfdlg.hrc 2009-04-06 16:41:54.000000000 +0000
120 @@ -134,6 +134,7 @@
121 #define FT_SIGNED_VAL 77
122 #define STR_MULTSIGNED 78
123 #define BTN_SIGNATURE 79
124 +#define BTN_CHANGE_PASS 80
126 #define WIN_PROPERTIES 90
127 #define SB_VERTICAL 91
128 --- sfx2/source/dialog/dinfdlg.src.old 2009-04-02 10:43:54.000000000 +0000
129 +++ sfx2/source/dialog/dinfdlg.src 2009-04-06 16:41:54.000000000 +0000
130 @@ -123,10 +123,17 @@ TabPage TP_DOCINFODOC
132 Edit ED_FILE_NAME
134 - Pos = MAP_APPFONT ( 54 , 12 ) ;
135 - Size = MAP_APPFONT ( 200 , RSC_CD_TEXTBOX_HEIGHT ) ;
136 + Pos = MAP_APPFONT ( 36 , 12 ) ;
137 + Size = MAP_APPFONT ( 140 , RSC_CD_TEXTBOX_HEIGHT ) ;
138 Border = TRUE ;
140 + PushButton BTN_CHANGE_PASS
142 + Pos = MAP_APPFONT ( 189 , 11 ) ;
143 + Size = MAP_APPFONT ( 65 , RSC_CD_PUSHBUTTON_HEIGHT ) ;
144 + Hide = FALSE;
145 + Text [ en-US ] = "Change ~Password...";
146 + };
147 FixedLine FL_FILE_1
149 Pos = MAP_APPFONT ( 6 , 31 ) ;