xref: /AOO41X/main/cui/source/dialogs/passwdomdlg.cxx (revision 2ee96f1cdb99d49425d866b1ec4c5567f37285e6)
1*2ee96f1cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2ee96f1cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2ee96f1cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2ee96f1cSAndrew Rist  * distributed with this work for additional information
6*2ee96f1cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2ee96f1cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2ee96f1cSAndrew Rist  * "License"); you may not use this file except in compliance
9*2ee96f1cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*2ee96f1cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*2ee96f1cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2ee96f1cSAndrew Rist  * software distributed under the License is distributed on an
15*2ee96f1cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2ee96f1cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*2ee96f1cSAndrew Rist  * specific language governing permissions and limitations
18*2ee96f1cSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*2ee96f1cSAndrew Rist  *************************************************************/
21*2ee96f1cSAndrew Rist 
22*2ee96f1cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_cui.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // include ---------------------------------------------------------------
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "passwdomdlg.hrc"
30cdf0e10cSrcweir #include "passwdomdlg.hxx"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include "cuires.hrc"
33cdf0e10cSrcweir #include "dialmgr.hxx"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include <sfx2/tabdlg.hxx>
36cdf0e10cSrcweir #include <tools/debug.hxx>
37cdf0e10cSrcweir #include <vcl/fixed.hxx>
38cdf0e10cSrcweir #include <vcl/edit.hxx>
39cdf0e10cSrcweir #include <vcl/button.hxx>
40cdf0e10cSrcweir #include <vcl/morebtn.hxx>
41cdf0e10cSrcweir #include <vcl/settings.hxx>
42cdf0e10cSrcweir #include <vcl/msgbox.hxx>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir 
45cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
46cdf0e10cSrcweir 
47cdf0e10cSrcweir class PasswordReenterEdit_Impl : public Edit
48cdf0e10cSrcweir {
49cdf0e10cSrcweir     String  m_aDefaultTxt;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir     // disallow use of copy c-tor and assignment operator
52cdf0e10cSrcweir     PasswordReenterEdit_Impl( const PasswordReenterEdit_Impl & );
53cdf0e10cSrcweir     PasswordReenterEdit_Impl & operator = ( const PasswordReenterEdit_Impl & );
54cdf0e10cSrcweir 
55cdf0e10cSrcweir public:
56cdf0e10cSrcweir     PasswordReenterEdit_Impl( Window * pParent, const ResId &rResId );
57cdf0e10cSrcweir     virtual ~PasswordReenterEdit_Impl();
58cdf0e10cSrcweir 
59cdf0e10cSrcweir     // Edit
60cdf0e10cSrcweir     virtual void        Paint( const Rectangle& rRect );
61cdf0e10cSrcweir };
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 
PasswordReenterEdit_Impl(Window * pParent,const ResId & rResId)64cdf0e10cSrcweir PasswordReenterEdit_Impl::PasswordReenterEdit_Impl( Window * pParent, const ResId &rResId ) :
65cdf0e10cSrcweir     Edit( pParent, rResId )
66cdf0e10cSrcweir {
67cdf0e10cSrcweir // currently the spec does not want to display this text anymore...
68cdf0e10cSrcweir //    m_aDefaultTxt = String( CUI_RES( STR_PASSWD_MUST_BE_CONFIRMED ) );
69cdf0e10cSrcweir }
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 
~PasswordReenterEdit_Impl()72cdf0e10cSrcweir PasswordReenterEdit_Impl::~PasswordReenterEdit_Impl()
73cdf0e10cSrcweir {
74cdf0e10cSrcweir }
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 
Paint(const Rectangle & rRect)77cdf0e10cSrcweir void PasswordReenterEdit_Impl::Paint( const Rectangle& rRect )
78cdf0e10cSrcweir {
79cdf0e10cSrcweir     if (GetText().Len() == 0)
80cdf0e10cSrcweir     {
81cdf0e10cSrcweir         Push( /*PUSH_FILLCOLOR | PUSH_TEXTFILLCOLOR |*/ PUSH_TEXTCOLOR );
82cdf0e10cSrcweir /*
83cdf0e10cSrcweir         Color aFillColor( GetParent()->GetBackground().GetColor() );
84cdf0e10cSrcweir         SetLineColor(); // don't draw a border when painting the Edit field rectangle with the new background color
85cdf0e10cSrcweir         SetFillColor( aFillColor );
86cdf0e10cSrcweir         SetTextFillColor( aFillColor );
87cdf0e10cSrcweir         SetTextColor( GetParent()->GetTextColor() );    // use plain text color even if the Edit field is disabled (it is hard to read the text otherwise)
88cdf0e10cSrcweir 
89cdf0e10cSrcweir         DrawRect( Rectangle( Point(), GetOutputSizePixel() ) );
90cdf0e10cSrcweir */
91cdf0e10cSrcweir         SetTextColor( Color( COL_GRAY ) );
92cdf0e10cSrcweir         DrawText( Point(), m_aDefaultTxt );
93cdf0e10cSrcweir 
94cdf0e10cSrcweir         Pop();
95cdf0e10cSrcweir     }
96cdf0e10cSrcweir     else
97cdf0e10cSrcweir         Edit::Paint( rRect );
98cdf0e10cSrcweir }
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 
101cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
102cdf0e10cSrcweir 
103cdf0e10cSrcweir struct PasswordToOpenModifyDialog_Impl
104cdf0e10cSrcweir {
105cdf0e10cSrcweir     PasswordToOpenModifyDialog *    m_pParent;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     FixedLine                   m_aFileEncryptionFL;
108cdf0e10cSrcweir     FixedText                   m_aPasswdToOpenFT;
109cdf0e10cSrcweir     Edit                        m_aPasswdToOpenED;
110cdf0e10cSrcweir     FixedText                   m_aReenterPasswdToOpenFT;
111cdf0e10cSrcweir     PasswordReenterEdit_Impl    m_aReenterPasswdToOpenED;
112cdf0e10cSrcweir //    FixedImage                  m_aPasswdToOpenMatchFI;
113cdf0e10cSrcweir     FixedText                   m_aPasswdNoteFT;
114cdf0e10cSrcweir     FixedLine                   m_aButtonsFL;
115cdf0e10cSrcweir     MoreButton                  m_aMoreFewerOptionsBTN;
116cdf0e10cSrcweir     OKButton                    m_aOk;
117cdf0e10cSrcweir     CancelButton                m_aCancel;
118cdf0e10cSrcweir     FixedLine                   m_aFileSharingOptionsFL;
119cdf0e10cSrcweir     CheckBox                    m_aOpenReadonlyCB;
120cdf0e10cSrcweir     FixedText                   m_aPasswdToModifyFT;
121cdf0e10cSrcweir     Edit                        m_aPasswdToModifyED;
122cdf0e10cSrcweir     FixedText                   m_aReenterPasswdToModifyFT;
123cdf0e10cSrcweir     PasswordReenterEdit_Impl    m_aReenterPasswdToModifyED;
124cdf0e10cSrcweir //    FixedImage                  m_aPasswdToModifyMatchFI;
125cdf0e10cSrcweir 
126cdf0e10cSrcweir     String                      m_aOneMismatch;
127cdf0e10cSrcweir     String                      m_aTwoMismatch;
128cdf0e10cSrcweir     String                      m_aInvalidStateForOkButton;
129cdf0e10cSrcweir     String                      m_aInvalidStateForOkButton_v2;
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     bool                        m_bIsPasswordToModify;
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 
134cdf0e10cSrcweir //    DECL_LINK( ModifyHdl, Edit * );
135cdf0e10cSrcweir     DECL_LINK( OkBtnClickHdl, OKButton * );
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     PasswordToOpenModifyDialog_Impl( PasswordToOpenModifyDialog * pParent,
138cdf0e10cSrcweir             sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify );
139cdf0e10cSrcweir     ~PasswordToOpenModifyDialog_Impl();
140cdf0e10cSrcweir };
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 
PasswordToOpenModifyDialog_Impl(PasswordToOpenModifyDialog * pParent,sal_uInt16 nMinPasswdLen,sal_uInt16 nMaxPasswdLen,bool bIsPasswordToModify)143cdf0e10cSrcweir PasswordToOpenModifyDialog_Impl::PasswordToOpenModifyDialog_Impl(
144cdf0e10cSrcweir         PasswordToOpenModifyDialog * pParent,
145cdf0e10cSrcweir         sal_uInt16 nMinPasswdLen,
146cdf0e10cSrcweir         sal_uInt16 nMaxPasswdLen,
147cdf0e10cSrcweir         bool bIsPasswordToModify ) :
148cdf0e10cSrcweir     m_pParent( pParent ),
149cdf0e10cSrcweir     m_aFileEncryptionFL         ( pParent, CUI_RES( FL_FILE_ENCRYPTION ) ),
150cdf0e10cSrcweir     m_aPasswdToOpenFT           ( pParent, CUI_RES( FT_PASSWD_TO_OPEN ) ),
151cdf0e10cSrcweir     m_aPasswdToOpenED           ( pParent, CUI_RES( ED_PASSWD_TO_OPEN ) ),
152cdf0e10cSrcweir     m_aReenterPasswdToOpenFT    ( pParent, CUI_RES( FT_REENTER_PASSWD_TO_OPEN ) ),
153cdf0e10cSrcweir     m_aReenterPasswdToOpenED    ( pParent, CUI_RES( ED_REENTER_PASSWD_TO_OPEN ) ),
154cdf0e10cSrcweir //    m_aPasswdToOpenMatchFI      ( pParent, CUI_RES( FI_PASSWD_TO_OPEN_MATCH ) ),
155cdf0e10cSrcweir     m_aPasswdNoteFT             ( pParent, CUI_RES( FT_PASSWD_NOTE ) ),
156cdf0e10cSrcweir     m_aButtonsFL                ( pParent, CUI_RES( FL_BUTTONS ) ),
157cdf0e10cSrcweir     m_aMoreFewerOptionsBTN      ( pParent, CUI_RES( BTN_MORE_FEWER_OPTIONS ) ),
158cdf0e10cSrcweir     m_aOk                       ( pParent, CUI_RES( BTN_OK ) ),
159cdf0e10cSrcweir     m_aCancel                   ( pParent, CUI_RES( BTN_CANCEL ) ),
160cdf0e10cSrcweir     m_aFileSharingOptionsFL     ( pParent, CUI_RES( FL_FILE_SHARING_OPTIONS ) ),
161cdf0e10cSrcweir     m_aOpenReadonlyCB           ( pParent, CUI_RES( CB_OPEN_READONLY ) ),
162cdf0e10cSrcweir     m_aPasswdToModifyFT         ( pParent, CUI_RES( FT_PASSWD_TO_MODIFY ) ),
163cdf0e10cSrcweir     m_aPasswdToModifyED         ( pParent, CUI_RES( ED_PASSWD_TO_MODIFY ) ),
164cdf0e10cSrcweir     m_aReenterPasswdToModifyFT  ( pParent, CUI_RES( FT_REENTER_PASSWD_TO_MODIFY ) ),
165cdf0e10cSrcweir     m_aReenterPasswdToModifyED  ( pParent, CUI_RES( ED_REENTER_PASSWD_TO_MODIFY ) ),
166cdf0e10cSrcweir //    m_aPasswdToModifyMatchFI    ( pParent, CUI_RES( FI_PASSWD_TO_MODIFY_MATCH ) )
167cdf0e10cSrcweir     m_aOneMismatch( CUI_RES( STR_ONE_PASSWORD_MISMATCH ) ),
168cdf0e10cSrcweir     m_aTwoMismatch( CUI_RES( STR_TWO_PASSWORDS_MISMATCH ) ),
169cdf0e10cSrcweir     m_aInvalidStateForOkButton( CUI_RES( STR_INVALID_STATE_FOR_OK_BUTTON ) ),
170cdf0e10cSrcweir     m_aInvalidStateForOkButton_v2( CUI_RES( STR_INVALID_STATE_FOR_OK_BUTTON_V2 ) ),
171cdf0e10cSrcweir     m_bIsPasswordToModify( bIsPasswordToModify )
172cdf0e10cSrcweir {
173cdf0e10cSrcweir /*
174cdf0e10cSrcweir     const sal_Bool bHighContrast = pParent->GetSettings().GetStyleSettings().GetHighContrastMode();
175cdf0e10cSrcweir     const Image aImage( CUI_RES( bHighContrast ? IMG_PASSWD_MATCH_HC : IMG_PASSWD_MATCH ) );
176cdf0e10cSrcweir     m_aPasswdToOpenMatchFI.SetImage( aImage );
177cdf0e10cSrcweir     m_aPasswdToModifyMatchFI.SetImage( aImage );
178cdf0e10cSrcweir */
179cdf0e10cSrcweir 
180cdf0e10cSrcweir     m_aMoreFewerOptionsBTN.SetMoreText( String( CUI_RES( STR_MORE_OPTIONS ) ) );
181cdf0e10cSrcweir     m_aMoreFewerOptionsBTN.SetLessText( String( CUI_RES( STR_FEWER_OPTIONS ) ) );
182cdf0e10cSrcweir 
183cdf0e10cSrcweir #if 0
184cdf0e10cSrcweir     Link aModifyLink = LINK( this, PasswordToOpenModifyDialog_Impl, ModifyHdl );
185cdf0e10cSrcweir     m_aPasswdToOpenED.SetModifyHdl( aModifyLink );
186cdf0e10cSrcweir     m_aReenterPasswdToOpenED.SetModifyHdl( aModifyLink );
187cdf0e10cSrcweir     m_aPasswdToModifyED.SetModifyHdl( aModifyLink );
188cdf0e10cSrcweir     m_aReenterPasswdToModifyED.SetModifyHdl( aModifyLink );
189cdf0e10cSrcweir #endif
190cdf0e10cSrcweir 
191cdf0e10cSrcweir     m_aOk.SetClickHdl( LINK( this, PasswordToOpenModifyDialog_Impl, OkBtnClickHdl ) );
192cdf0e10cSrcweir 
193cdf0e10cSrcweir //    m_aOk.Enable( sal_False );
194cdf0e10cSrcweir 
195cdf0e10cSrcweir     if (nMaxPasswdLen)
196cdf0e10cSrcweir     {
197cdf0e10cSrcweir         m_aPasswdToOpenED.SetMaxTextLen( nMaxPasswdLen );
198cdf0e10cSrcweir 	    m_aReenterPasswdToOpenED.SetMaxTextLen( nMaxPasswdLen );
199cdf0e10cSrcweir         m_aPasswdToModifyED.SetMaxTextLen( nMaxPasswdLen );
200cdf0e10cSrcweir         m_aReenterPasswdToModifyED.SetMaxTextLen( nMaxPasswdLen );
201cdf0e10cSrcweir     }
202cdf0e10cSrcweir 
203cdf0e10cSrcweir     (void) nMinPasswdLen;   // currently not supported
204cdf0e10cSrcweir 
205cdf0e10cSrcweir     m_aPasswdToOpenED.GrabFocus();
206cdf0e10cSrcweir 
207cdf0e10cSrcweir //    ModifyHdl( NULL );
208cdf0e10cSrcweir 
209cdf0e10cSrcweir     m_aMoreFewerOptionsBTN.Enable( bIsPasswordToModify );
210cdf0e10cSrcweir     if (!bIsPasswordToModify)
211cdf0e10cSrcweir         m_aMoreFewerOptionsBTN.Hide( sal_True );
212cdf0e10cSrcweir }
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 
~PasswordToOpenModifyDialog_Impl()215cdf0e10cSrcweir PasswordToOpenModifyDialog_Impl::~PasswordToOpenModifyDialog_Impl()
216cdf0e10cSrcweir {
217cdf0e10cSrcweir }
218cdf0e10cSrcweir 
219cdf0e10cSrcweir #if 0
220cdf0e10cSrcweir IMPL_LINK( PasswordToOpenModifyDialog_Impl, ModifyHdl, Edit *, EMPTYARG /*pEdit*/ )
221cdf0e10cSrcweir {
222cdf0e10cSrcweir     // force repaints to get the m_aDefaultTxt displayed again
223cdf0e10cSrcweir     if (m_aReenterPasswdToOpenED.GetText().Len() == 0)
224cdf0e10cSrcweir         m_aReenterPasswdToOpenED.Invalidate();
225cdf0e10cSrcweir     if (m_aReenterPasswdToModifyED.GetText().Len() == 0)
226cdf0e10cSrcweir         m_aReenterPasswdToModifyED.Invalidate();
227cdf0e10cSrcweir 
228cdf0e10cSrcweir     const sal_Int32 nPasswdToOpenLen    = m_aPasswdToOpenED.GetText().Len();
229cdf0e10cSrcweir     const sal_Int32 nPasswdToModifyLen  = m_aPasswdToModifyED.GetText().Len();
230cdf0e10cSrcweir 
231cdf0e10cSrcweir     const bool bBothEmpty       = nPasswdToOpenLen == 0 && nPasswdToModifyLen == 0;
232cdf0e10cSrcweir     const bool bToOpenMatch     = m_aPasswdToOpenED.GetText()   == m_aReenterPasswdToOpenED.GetText();
233cdf0e10cSrcweir     const bool bToModifyMatch   = m_aPasswdToModifyED.GetText() == m_aReenterPasswdToModifyED.GetText();
234cdf0e10cSrcweir 
235cdf0e10cSrcweir     m_aOk.Enable( bToOpenMatch && bToModifyMatch && !bBothEmpty );
236cdf0e10cSrcweir 
237cdf0e10cSrcweir //    m_aPasswdToOpenMatchFI.Enable( bToOpenMatch && !bBothEmpty );
238cdf0e10cSrcweir //    m_aPasswdToModifyMatchFI.Enable( bToModifyMatch && !bBothEmpty );
239cdf0e10cSrcweir 
240cdf0e10cSrcweir     return 0;
241cdf0e10cSrcweir }
242cdf0e10cSrcweir #endif
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 
IMPL_LINK(PasswordToOpenModifyDialog_Impl,OkBtnClickHdl,OKButton *,EMPTYARG)245cdf0e10cSrcweir IMPL_LINK( PasswordToOpenModifyDialog_Impl, OkBtnClickHdl, OKButton *, EMPTYARG /*pBtn*/ )
246cdf0e10cSrcweir {
247cdf0e10cSrcweir     bool bInvalidState = !m_aOpenReadonlyCB.IsChecked() &&
248cdf0e10cSrcweir             m_aPasswdToOpenED.GetText().Len() == 0 &&
249cdf0e10cSrcweir             m_aPasswdToModifyED.GetText().Len() == 0;
250cdf0e10cSrcweir     if (bInvalidState)
251cdf0e10cSrcweir     {
252cdf0e10cSrcweir         ErrorBox aErrorBox( m_pParent, WB_OK,
253cdf0e10cSrcweir             m_bIsPasswordToModify? m_aInvalidStateForOkButton : m_aInvalidStateForOkButton_v2 );
254cdf0e10cSrcweir         aErrorBox.Execute();
255cdf0e10cSrcweir     }
256cdf0e10cSrcweir     else // check for mismatched passwords...
257cdf0e10cSrcweir     {
258cdf0e10cSrcweir         const bool bToOpenMatch     = m_aPasswdToOpenED.GetText()   == m_aReenterPasswdToOpenED.GetText();
259cdf0e10cSrcweir         const bool bToModifyMatch   = m_aPasswdToModifyED.GetText() == m_aReenterPasswdToModifyED.GetText();
260cdf0e10cSrcweir         const int nMismatch = (bToOpenMatch? 0 : 1) + (bToModifyMatch? 0 : 1);
261cdf0e10cSrcweir         if (nMismatch > 0)
262cdf0e10cSrcweir         {
263cdf0e10cSrcweir             ErrorBox aErrorBox( m_pParent, WB_OK, nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch );
264cdf0e10cSrcweir             aErrorBox.Execute();
265cdf0e10cSrcweir 
266cdf0e10cSrcweir             Edit &rEdit = !bToOpenMatch? m_aPasswdToOpenED : m_aPasswdToModifyED;
267cdf0e10cSrcweir             PasswordReenterEdit_Impl &rRepeatEdit = !bToOpenMatch? m_aReenterPasswdToOpenED : m_aReenterPasswdToModifyED;
268cdf0e10cSrcweir             String aEmpty;
269cdf0e10cSrcweir             if (nMismatch == 1)
270cdf0e10cSrcweir             {
271cdf0e10cSrcweir                 rEdit.SetText( aEmpty );
272cdf0e10cSrcweir                 rRepeatEdit.SetText( aEmpty );
273cdf0e10cSrcweir             }
274cdf0e10cSrcweir             else if (nMismatch == 2)
275cdf0e10cSrcweir             {
276cdf0e10cSrcweir                 m_aPasswdToOpenED.SetText( aEmpty );
277cdf0e10cSrcweir                 m_aReenterPasswdToOpenED.SetText( aEmpty );
278cdf0e10cSrcweir                 m_aPasswdToModifyED.SetText( aEmpty );
279cdf0e10cSrcweir                 m_aReenterPasswdToModifyED.SetText( aEmpty );
280cdf0e10cSrcweir             }
281cdf0e10cSrcweir             rEdit.GrabFocus();
282cdf0e10cSrcweir         }
283cdf0e10cSrcweir         else
284cdf0e10cSrcweir         {
285cdf0e10cSrcweir             m_pParent->EndDialog( RET_OK );
286cdf0e10cSrcweir         }
287cdf0e10cSrcweir     }
288cdf0e10cSrcweir 
289cdf0e10cSrcweir     return 0;
290cdf0e10cSrcweir }
291cdf0e10cSrcweir 
292cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
293cdf0e10cSrcweir 
294cdf0e10cSrcweir 
PasswordToOpenModifyDialog(Window * pParent,sal_uInt16 nMinPasswdLen,sal_uInt16 nMaxPasswdLen,bool bIsPasswordToModify)295cdf0e10cSrcweir PasswordToOpenModifyDialog::PasswordToOpenModifyDialog(
296cdf0e10cSrcweir         Window * pParent,
297cdf0e10cSrcweir         sal_uInt16 nMinPasswdLen,
298cdf0e10cSrcweir         sal_uInt16 nMaxPasswdLen,
299cdf0e10cSrcweir         bool bIsPasswordToModify ) :
300cdf0e10cSrcweir     SfxModalDialog( pParent, CUI_RES( RID_DLG_PASSWORD_TO_OPEN_MODIFY ) )
301cdf0e10cSrcweir {
302cdf0e10cSrcweir     m_pImpl = std::auto_ptr< PasswordToOpenModifyDialog_Impl >(
303cdf0e10cSrcweir             new PasswordToOpenModifyDialog_Impl( this, nMinPasswdLen, nMaxPasswdLen, bIsPasswordToModify ) );
304cdf0e10cSrcweir 
305cdf0e10cSrcweir     FreeResource();
306cdf0e10cSrcweir }
307cdf0e10cSrcweir 
308cdf0e10cSrcweir 
~PasswordToOpenModifyDialog()309cdf0e10cSrcweir PasswordToOpenModifyDialog::~PasswordToOpenModifyDialog()
310cdf0e10cSrcweir {
311cdf0e10cSrcweir }
312cdf0e10cSrcweir 
313cdf0e10cSrcweir 
GetPasswordToOpen() const314cdf0e10cSrcweir String PasswordToOpenModifyDialog::GetPasswordToOpen() const
315cdf0e10cSrcweir {
316cdf0e10cSrcweir     const bool bPasswdOk =
317cdf0e10cSrcweir             m_pImpl->m_aPasswdToOpenED.GetText().Len() > 0 &&
318cdf0e10cSrcweir             m_pImpl->m_aPasswdToOpenED.GetText() == m_pImpl->m_aReenterPasswdToOpenED.GetText();
319cdf0e10cSrcweir     return bPasswdOk ? m_pImpl->m_aPasswdToOpenED.GetText() : String();
320cdf0e10cSrcweir }
321cdf0e10cSrcweir 
322cdf0e10cSrcweir 
GetPasswordToModify() const323cdf0e10cSrcweir String PasswordToOpenModifyDialog::GetPasswordToModify() const
324cdf0e10cSrcweir {
325cdf0e10cSrcweir     const bool bPasswdOk =
326cdf0e10cSrcweir             m_pImpl->m_aPasswdToModifyED.GetText().Len() > 0 &&
327cdf0e10cSrcweir             m_pImpl->m_aPasswdToModifyED.GetText() == m_pImpl->m_aReenterPasswdToModifyED.GetText();
328cdf0e10cSrcweir     return bPasswdOk ? m_pImpl->m_aPasswdToModifyED.GetText() : String();
329cdf0e10cSrcweir }
330cdf0e10cSrcweir 
331cdf0e10cSrcweir 
IsRecommendToOpenReadonly() const332cdf0e10cSrcweir bool PasswordToOpenModifyDialog::IsRecommendToOpenReadonly() const
333cdf0e10cSrcweir {
334cdf0e10cSrcweir     return m_pImpl->m_aOpenReadonlyCB.IsChecked();
335cdf0e10cSrcweir }
336cdf0e10cSrcweir 
337cdf0e10cSrcweir 
338cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
339cdf0e10cSrcweir 
340