Update ooo320-m1
[ooovba.git] / uui / source / loginerr.hxx
blob49aaf818e530a8bd3d09b31b35f4c41f9edd021b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: loginerr.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _LOGINERR_HXX
32 #define _LOGINERR_HXX
34 #include <tools/string.hxx>
36 //=========================================================================
38 #define LOGINERROR_FLAG_SET_SAVE_PASSWORD 1
39 #define LOGINERROR_FLAG_MODIFY_ACCOUNT 2
40 #define LOGINERROR_FLAG_MODIFY_USER_NAME 4
41 #define LOGINERROR_FLAG_PERSISTENT_PASSWORD 8
42 #define LOGINERROR_FLAG_CAN_USE_SYSCREDS 16
43 #define LOGINERROR_FLAG_IS_USE_SYSCREDS 32
45 class LoginErrorInfo
47 private:
48 String _aTitle;
49 String _aServer;
50 String _aAccount;
51 String _aUserName;
52 String _aPassword;
53 String _aPath;
54 String _aErrorText;
55 BYTE _nFlags;
56 USHORT _nRet;
58 public:
59 LoginErrorInfo()
60 : _nFlags( LOGINERROR_FLAG_MODIFY_USER_NAME ),
61 _nRet( ERRCODE_BUTTON_CANCEL )
65 const String& GetTitle() const { return _aTitle; }
66 const String& GetServer() const { return _aServer; }
67 const String& GetAccount() const { return _aAccount; }
68 const String& GetUserName() const { return _aUserName; }
69 const String& GetPassword() const { return _aPassword; }
70 const String& GetPath() const { return _aPath; }
71 const String& GetErrorText() const { return _aErrorText; }
72 BOOL GetIsPersistentPassword() const
73 { return ( _nFlags & LOGINERROR_FLAG_PERSISTENT_PASSWORD ); }
74 BOOL GetIsSavePassword() const
75 { return ( _nFlags & LOGINERROR_FLAG_SET_SAVE_PASSWORD ); }
76 BOOL GetCanUseSystemCredentials() const
77 { return ( _nFlags & LOGINERROR_FLAG_CAN_USE_SYSCREDS ); }
78 BOOL GetIsUseSystemCredentials() const
79 { return ( _nFlags & LOGINERROR_FLAG_IS_USE_SYSCREDS ) ==
80 LOGINERROR_FLAG_IS_USE_SYSCREDS; }
81 BYTE GetFlags() const { return _nFlags; }
82 USHORT GetResult() const { return _nRet; }
84 void SetTitle( const String& aTitle )
85 { _aTitle = aTitle; }
86 void SetServer( const String& aServer )
87 { _aServer = aServer; }
88 void SetAccount( const String& aAccount )
89 { _aAccount = aAccount; }
90 void SetUserName( const String& aUserName )
91 { _aUserName = aUserName; }
92 void SetPassword( const String& aPassword )
93 { _aPassword = aPassword; }
94 void SetPath( const String& aPath )
95 { _aPath = aPath; }
96 void SetErrorText( const String& aErrorText )
97 { _aErrorText = aErrorText; }
98 void SetFlags( BYTE nFlags )
99 { _nFlags = nFlags; }
100 inline void SetSavePassword( BOOL bSet );
101 inline void SetPersistentPassword( BOOL bSet );
102 inline void SetCanUseSystemCredentials( BOOL bSet );
103 inline void SetIsUseSystemCredentials( BOOL bSet );
104 inline void SetModifyAccount( BOOL bSet );
105 inline void SetModifyUserName( BOOL bSet );
106 void SetResult( USHORT nRet )
107 { _nRet = nRet; }
110 inline void LoginErrorInfo::SetSavePassword( BOOL bSet )
112 if ( bSet )
113 _nFlags |= LOGINERROR_FLAG_SET_SAVE_PASSWORD;
114 else
115 _nFlags &= ~LOGINERROR_FLAG_SET_SAVE_PASSWORD;
118 inline void LoginErrorInfo::SetPersistentPassword( BOOL bSet )
120 if ( bSet )
121 _nFlags |= LOGINERROR_FLAG_PERSISTENT_PASSWORD;
122 else
123 _nFlags &= ~LOGINERROR_FLAG_PERSISTENT_PASSWORD;
126 inline void LoginErrorInfo::SetCanUseSystemCredentials( BOOL bSet )
128 if ( bSet )
129 _nFlags |= LOGINERROR_FLAG_CAN_USE_SYSCREDS;
130 else
131 _nFlags &= ~LOGINERROR_FLAG_CAN_USE_SYSCREDS;
134 inline void LoginErrorInfo::SetIsUseSystemCredentials( BOOL bSet )
136 if ( bSet )
137 _nFlags |= LOGINERROR_FLAG_IS_USE_SYSCREDS;
138 else
139 _nFlags &= ~LOGINERROR_FLAG_IS_USE_SYSCREDS;
142 inline void LoginErrorInfo::SetModifyAccount( BOOL bSet )
144 if ( bSet )
145 _nFlags |= LOGINERROR_FLAG_MODIFY_ACCOUNT;
146 else
147 _nFlags &= ~LOGINERROR_FLAG_MODIFY_ACCOUNT;
150 inline void LoginErrorInfo::SetModifyUserName( BOOL bSet )
152 if ( bSet )
153 _nFlags |= LOGINERROR_FLAG_MODIFY_USER_NAME;
154 else
155 _nFlags &= ~LOGINERROR_FLAG_MODIFY_USER_NAME;
158 #endif