xref: /aoo42x/main/uui/source/loginerr.hxx (revision cdf0e10c)
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 #ifndef m_LOGINERR_HXX
29*cdf0e10cSrcweir #define m_LOGINERR_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <tools/string.hxx>
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir //=========================================================================
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #define LOGINERROR_FLAG_MODIFY_ACCOUNT         1
36*cdf0e10cSrcweir #define LOGINERROR_FLAG_MODIFY_USER_NAME       2
37*cdf0e10cSrcweir #define LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD  4
38*cdf0e10cSrcweir #define LOGINERROR_FLAG_IS_REMEMBER_PASSWORD   8
39*cdf0e10cSrcweir #define LOGINERROR_FLAG_CAN_USE_SYSCREDS      16
40*cdf0e10cSrcweir #define LOGINERROR_FLAG_IS_USE_SYSCREDS       32
41*cdf0e10cSrcweir #define LOGINERROR_FLAG_REMEMBER_PERSISTENT   64
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir class LoginErrorInfo
44*cdf0e10cSrcweir {
45*cdf0e10cSrcweir private:
46*cdf0e10cSrcweir     String m_aTitle;
47*cdf0e10cSrcweir     String m_aServer;
48*cdf0e10cSrcweir     String m_aAccount;
49*cdf0e10cSrcweir     String m_aUserName;
50*cdf0e10cSrcweir     String m_aPassword;
51*cdf0e10cSrcweir     String m_aPasswordToModify;
52*cdf0e10cSrcweir     String m_aPath;
53*cdf0e10cSrcweir     String m_aErrorText;
54*cdf0e10cSrcweir     sal_uInt8   m_nFlags;
55*cdf0e10cSrcweir     sal_uInt16 m_nRet;
56*cdf0e10cSrcweir     bool   m_bRecommendToOpenReadonly;
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir public:
59*cdf0e10cSrcweir                     LoginErrorInfo()
60*cdf0e10cSrcweir                     : m_nFlags( LOGINERROR_FLAG_MODIFY_USER_NAME ),
61*cdf0e10cSrcweir                       m_nRet( ERRCODE_BUTTON_CANCEL )
62*cdf0e10cSrcweir                     {
63*cdf0e10cSrcweir                     }
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir     const String&   GetTitle() const                    { return m_aTitle; }
66*cdf0e10cSrcweir     const String&   GetServer() const                   { return m_aServer; }
67*cdf0e10cSrcweir     const String&   GetAccount() const                  { return m_aAccount; }
68*cdf0e10cSrcweir     const String&   GetUserName() const                 { return m_aUserName; }
69*cdf0e10cSrcweir     const String&   GetPassword() const                 { return m_aPassword; }
70*cdf0e10cSrcweir     const String&   GetPasswordToModify() const         { return m_aPasswordToModify; }
71*cdf0e10cSrcweir     bool      IsRecommendToOpenReadonly() const   { return m_bRecommendToOpenReadonly; }
72*cdf0e10cSrcweir     const String&   GetPath() const                     { return m_aPath; }
73*cdf0e10cSrcweir     const String&   GetErrorText() const                { return m_aErrorText; }
74*cdf0e10cSrcweir     sal_Bool            GetCanRememberPassword() const      { return ( m_nFlags & LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD ); }
75*cdf0e10cSrcweir     sal_Bool            GetIsRememberPersistent() const     { return ( m_nFlags & LOGINERROR_FLAG_REMEMBER_PERSISTENT ); }
76*cdf0e10cSrcweir     sal_Bool            GetIsRememberPassword() const       { return ( m_nFlags & LOGINERROR_FLAG_IS_REMEMBER_PASSWORD ); }
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir     sal_Bool            GetCanUseSystemCredentials() const
79*cdf0e10cSrcweir                     { return ( m_nFlags & LOGINERROR_FLAG_CAN_USE_SYSCREDS ); }
80*cdf0e10cSrcweir     sal_Bool            GetIsUseSystemCredentials() const
81*cdf0e10cSrcweir                     { return ( m_nFlags & LOGINERROR_FLAG_IS_USE_SYSCREDS ) ==
82*cdf0e10cSrcweir                              LOGINERROR_FLAG_IS_USE_SYSCREDS; }
83*cdf0e10cSrcweir     sal_uInt8            GetFlags() const        { return m_nFlags; }
84*cdf0e10cSrcweir     sal_uInt16          GetResult() const       { return m_nRet; }
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir     void            SetTitle( const String& aTitle )
87*cdf0e10cSrcweir                     { m_aTitle = aTitle; }
88*cdf0e10cSrcweir     void            SetServer( const String& aServer )
89*cdf0e10cSrcweir                     { m_aServer = aServer; }
90*cdf0e10cSrcweir     void            SetAccount( const String& aAccount )
91*cdf0e10cSrcweir                     { m_aAccount = aAccount; }
92*cdf0e10cSrcweir     void            SetUserName( const String& aUserName )
93*cdf0e10cSrcweir                     { m_aUserName = aUserName; }
94*cdf0e10cSrcweir     void            SetPassword( const String& aPassword )
95*cdf0e10cSrcweir                     { m_aPassword = aPassword; }
96*cdf0e10cSrcweir     void            SetPasswordToModify( const String& aPassword )
97*cdf0e10cSrcweir                     { m_aPasswordToModify = aPassword; }
98*cdf0e10cSrcweir     void            SetRecommendToOpenReadonly( bool bVal )
99*cdf0e10cSrcweir                     { m_bRecommendToOpenReadonly = bVal; }
100*cdf0e10cSrcweir     void            SetPath( const String& aPath )
101*cdf0e10cSrcweir                     { m_aPath = aPath; }
102*cdf0e10cSrcweir     void            SetErrorText( const String& aErrorText )
103*cdf0e10cSrcweir                     { m_aErrorText = aErrorText; }
104*cdf0e10cSrcweir     void            SetFlags( sal_uInt8 nFlags )
105*cdf0e10cSrcweir                     { m_nFlags = nFlags; }
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir     inline void     SetCanRememberPassword( sal_Bool bSet );
108*cdf0e10cSrcweir     inline void     SetIsRememberPassword( sal_Bool bSet );
109*cdf0e10cSrcweir     inline void     SetIsRememberPersistent( sal_Bool bSet );
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir     inline void     SetCanUseSystemCredentials( sal_Bool bSet );
112*cdf0e10cSrcweir     inline void     SetIsUseSystemCredentials( sal_Bool bSet );
113*cdf0e10cSrcweir     inline void     SetModifyAccount( sal_Bool bSet );
114*cdf0e10cSrcweir     inline void     SetModifyUserName( sal_Bool bSet );
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir     void            SetResult( sal_uInt16 nRet )
117*cdf0e10cSrcweir                     { m_nRet = nRet; }
118*cdf0e10cSrcweir };
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir inline void LoginErrorInfo::SetCanRememberPassword( sal_Bool bSet )
121*cdf0e10cSrcweir {
122*cdf0e10cSrcweir     if ( bSet )
123*cdf0e10cSrcweir         m_nFlags |= LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD;
124*cdf0e10cSrcweir     else
125*cdf0e10cSrcweir         m_nFlags &= ~LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD;
126*cdf0e10cSrcweir }
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir inline void LoginErrorInfo::SetIsRememberPassword( sal_Bool bSet )
129*cdf0e10cSrcweir {
130*cdf0e10cSrcweir     if ( bSet )
131*cdf0e10cSrcweir         m_nFlags |= LOGINERROR_FLAG_IS_REMEMBER_PASSWORD;
132*cdf0e10cSrcweir     else
133*cdf0e10cSrcweir         m_nFlags &= ~LOGINERROR_FLAG_IS_REMEMBER_PASSWORD;
134*cdf0e10cSrcweir }
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir inline void LoginErrorInfo::SetIsRememberPersistent( sal_Bool bSet )
137*cdf0e10cSrcweir {
138*cdf0e10cSrcweir     if ( bSet )
139*cdf0e10cSrcweir         m_nFlags |= LOGINERROR_FLAG_REMEMBER_PERSISTENT;
140*cdf0e10cSrcweir     else
141*cdf0e10cSrcweir         m_nFlags &= ~LOGINERROR_FLAG_REMEMBER_PERSISTENT;
142*cdf0e10cSrcweir }
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir inline void LoginErrorInfo::SetCanUseSystemCredentials( sal_Bool bSet )
145*cdf0e10cSrcweir {
146*cdf0e10cSrcweir     if ( bSet )
147*cdf0e10cSrcweir         m_nFlags |= LOGINERROR_FLAG_CAN_USE_SYSCREDS;
148*cdf0e10cSrcweir     else
149*cdf0e10cSrcweir         m_nFlags &= ~LOGINERROR_FLAG_CAN_USE_SYSCREDS;
150*cdf0e10cSrcweir }
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir inline void LoginErrorInfo::SetIsUseSystemCredentials( sal_Bool bSet )
153*cdf0e10cSrcweir {
154*cdf0e10cSrcweir     if ( bSet )
155*cdf0e10cSrcweir         m_nFlags |= LOGINERROR_FLAG_IS_USE_SYSCREDS;
156*cdf0e10cSrcweir     else
157*cdf0e10cSrcweir         m_nFlags &= ~LOGINERROR_FLAG_IS_USE_SYSCREDS;
158*cdf0e10cSrcweir }
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir inline void LoginErrorInfo::SetModifyAccount( sal_Bool bSet )
161*cdf0e10cSrcweir {
162*cdf0e10cSrcweir     if ( bSet )
163*cdf0e10cSrcweir         m_nFlags |= LOGINERROR_FLAG_MODIFY_ACCOUNT;
164*cdf0e10cSrcweir     else
165*cdf0e10cSrcweir         m_nFlags &= ~LOGINERROR_FLAG_MODIFY_ACCOUNT;
166*cdf0e10cSrcweir }
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir inline void LoginErrorInfo::SetModifyUserName( sal_Bool bSet )
169*cdf0e10cSrcweir {
170*cdf0e10cSrcweir     if ( bSet )
171*cdf0e10cSrcweir         m_nFlags |= LOGINERROR_FLAG_MODIFY_USER_NAME;
172*cdf0e10cSrcweir     else
173*cdf0e10cSrcweir         m_nFlags &= ~LOGINERROR_FLAG_MODIFY_USER_NAME;
174*cdf0e10cSrcweir }
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir #endif
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 
179