Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / uui / source / loginerr.hxx
blobb069c4f553d38942d01aef518cbec6736b96b178
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef m_LOGINERR_HXX
21 #define m_LOGINERR_HXX
23 #include <tools/string.hxx>
25 //=========================================================================
27 #define LOGINERROR_FLAG_MODIFY_ACCOUNT 1
28 #define LOGINERROR_FLAG_MODIFY_USER_NAME 2
29 #define LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD 4
30 #define LOGINERROR_FLAG_IS_REMEMBER_PASSWORD 8
31 #define LOGINERROR_FLAG_CAN_USE_SYSCREDS 16
32 #define LOGINERROR_FLAG_IS_USE_SYSCREDS 32
33 #define LOGINERROR_FLAG_REMEMBER_PERSISTENT 64
35 class LoginErrorInfo
37 private:
38 String m_aTitle;
39 String m_aServer;
40 String m_aAccount;
41 String m_aUserName;
42 String m_aPassword;
43 String m_aPasswordToModify;
44 String m_aPath;
45 String m_aErrorText;
46 sal_uInt8 m_nFlags;
47 sal_uInt16 m_nRet;
48 bool m_bRecommendToOpenReadonly;
50 public:
51 LoginErrorInfo()
52 : m_nFlags( LOGINERROR_FLAG_MODIFY_USER_NAME ),
53 m_nRet( ERRCODE_BUTTON_CANCEL )
57 const String& GetTitle() const { return m_aTitle; }
58 const String& GetServer() const { return m_aServer; }
59 const String& GetAccount() const { return m_aAccount; }
60 const String& GetUserName() const { return m_aUserName; }
61 const String& GetPassword() const { return m_aPassword; }
62 const String& GetPasswordToModify() const { return m_aPasswordToModify; }
63 bool IsRecommendToOpenReadonly() const { return m_bRecommendToOpenReadonly; }
64 const String& GetPath() const { return m_aPath; }
65 const String& GetErrorText() const { return m_aErrorText; }
66 sal_Bool GetCanRememberPassword() const { return ( m_nFlags & LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD ); }
67 sal_Bool GetIsRememberPersistent() const { return ( m_nFlags & LOGINERROR_FLAG_REMEMBER_PERSISTENT ); }
68 sal_Bool GetIsRememberPassword() const { return ( m_nFlags & LOGINERROR_FLAG_IS_REMEMBER_PASSWORD ); }
70 sal_Bool GetCanUseSystemCredentials() const
71 { return ( m_nFlags & LOGINERROR_FLAG_CAN_USE_SYSCREDS ); }
72 sal_Bool GetIsUseSystemCredentials() const
73 { return ( m_nFlags & LOGINERROR_FLAG_IS_USE_SYSCREDS ) ==
74 LOGINERROR_FLAG_IS_USE_SYSCREDS; }
75 sal_uInt8 GetFlags() const { return m_nFlags; }
76 sal_uInt16 GetResult() const { return m_nRet; }
78 void SetTitle( const String& aTitle )
79 { m_aTitle = aTitle; }
80 void SetServer( const String& aServer )
81 { m_aServer = aServer; }
82 void SetAccount( const String& aAccount )
83 { m_aAccount = aAccount; }
84 void SetUserName( const String& aUserName )
85 { m_aUserName = aUserName; }
86 void SetPassword( const String& aPassword )
87 { m_aPassword = aPassword; }
88 void SetPasswordToModify( const String& aPassword )
89 { m_aPasswordToModify = aPassword; }
90 void SetRecommendToOpenReadonly( bool bVal )
91 { m_bRecommendToOpenReadonly = bVal; }
92 void SetPath( const String& aPath )
93 { m_aPath = aPath; }
94 void SetErrorText( const String& aErrorText )
95 { m_aErrorText = aErrorText; }
96 void SetFlags( sal_uInt8 nFlags )
97 { m_nFlags = nFlags; }
99 inline void SetCanRememberPassword( sal_Bool bSet );
100 inline void SetIsRememberPassword( sal_Bool bSet );
101 inline void SetIsRememberPersistent( sal_Bool bSet );
103 inline void SetCanUseSystemCredentials( sal_Bool bSet );
104 inline void SetIsUseSystemCredentials( sal_Bool bSet );
105 inline void SetModifyAccount( sal_Bool bSet );
106 inline void SetModifyUserName( sal_Bool bSet );
108 void SetResult( sal_uInt16 nRet )
109 { m_nRet = nRet; }
112 inline void LoginErrorInfo::SetCanRememberPassword( sal_Bool bSet )
114 if ( bSet )
115 m_nFlags |= LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD;
116 else
117 m_nFlags &= ~LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD;
120 inline void LoginErrorInfo::SetIsRememberPassword( sal_Bool bSet )
122 if ( bSet )
123 m_nFlags |= LOGINERROR_FLAG_IS_REMEMBER_PASSWORD;
124 else
125 m_nFlags &= ~LOGINERROR_FLAG_IS_REMEMBER_PASSWORD;
128 inline void LoginErrorInfo::SetIsRememberPersistent( sal_Bool bSet )
130 if ( bSet )
131 m_nFlags |= LOGINERROR_FLAG_REMEMBER_PERSISTENT;
132 else
133 m_nFlags &= ~LOGINERROR_FLAG_REMEMBER_PERSISTENT;
136 inline void LoginErrorInfo::SetCanUseSystemCredentials( sal_Bool bSet )
138 if ( bSet )
139 m_nFlags |= LOGINERROR_FLAG_CAN_USE_SYSCREDS;
140 else
141 m_nFlags &= ~LOGINERROR_FLAG_CAN_USE_SYSCREDS;
144 inline void LoginErrorInfo::SetIsUseSystemCredentials( sal_Bool bSet )
146 if ( bSet )
147 m_nFlags |= LOGINERROR_FLAG_IS_USE_SYSCREDS;
148 else
149 m_nFlags &= ~LOGINERROR_FLAG_IS_USE_SYSCREDS;
152 inline void LoginErrorInfo::SetModifyAccount( sal_Bool bSet )
154 if ( bSet )
155 m_nFlags |= LOGINERROR_FLAG_MODIFY_ACCOUNT;
156 else
157 m_nFlags &= ~LOGINERROR_FLAG_MODIFY_ACCOUNT;
160 inline void LoginErrorInfo::SetModifyUserName( sal_Bool bSet )
162 if ( bSet )
163 m_nFlags |= LOGINERROR_FLAG_MODIFY_USER_NAME;
164 else
165 m_nFlags &= ~LOGINERROR_FLAG_MODIFY_USER_NAME;
168 #endif
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */