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