1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef m_LOGINERR_HXX 29 #define m_LOGINERR_HXX 30 31 #include <tools/string.hxx> 32 33 //========================================================================= 34 35 #define LOGINERROR_FLAG_MODIFY_ACCOUNT 1 36 #define LOGINERROR_FLAG_MODIFY_USER_NAME 2 37 #define LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD 4 38 #define LOGINERROR_FLAG_IS_REMEMBER_PASSWORD 8 39 #define LOGINERROR_FLAG_CAN_USE_SYSCREDS 16 40 #define LOGINERROR_FLAG_IS_USE_SYSCREDS 32 41 #define LOGINERROR_FLAG_REMEMBER_PERSISTENT 64 42 43 class LoginErrorInfo 44 { 45 private: 46 String m_aTitle; 47 String m_aServer; 48 String m_aAccount; 49 String m_aUserName; 50 String m_aPassword; 51 String m_aPasswordToModify; 52 String m_aPath; 53 String m_aErrorText; 54 sal_uInt8 m_nFlags; 55 sal_uInt16 m_nRet; 56 bool m_bRecommendToOpenReadonly; 57 58 public: 59 LoginErrorInfo() 60 : m_nFlags( LOGINERROR_FLAG_MODIFY_USER_NAME ), 61 m_nRet( ERRCODE_BUTTON_CANCEL ) 62 { 63 } 64 65 const String& GetTitle() const { return m_aTitle; } 66 const String& GetServer() const { return m_aServer; } 67 const String& GetAccount() const { return m_aAccount; } 68 const String& GetUserName() const { return m_aUserName; } 69 const String& GetPassword() const { return m_aPassword; } 70 const String& GetPasswordToModify() const { return m_aPasswordToModify; } 71 bool IsRecommendToOpenReadonly() const { return m_bRecommendToOpenReadonly; } 72 const String& GetPath() const { return m_aPath; } 73 const String& GetErrorText() const { return m_aErrorText; } 74 sal_Bool GetCanRememberPassword() const { return ( m_nFlags & LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD ); } 75 sal_Bool GetIsRememberPersistent() const { return ( m_nFlags & LOGINERROR_FLAG_REMEMBER_PERSISTENT ); } 76 sal_Bool GetIsRememberPassword() const { return ( m_nFlags & LOGINERROR_FLAG_IS_REMEMBER_PASSWORD ); } 77 78 sal_Bool GetCanUseSystemCredentials() const 79 { return ( m_nFlags & LOGINERROR_FLAG_CAN_USE_SYSCREDS ); } 80 sal_Bool GetIsUseSystemCredentials() const 81 { return ( m_nFlags & LOGINERROR_FLAG_IS_USE_SYSCREDS ) == 82 LOGINERROR_FLAG_IS_USE_SYSCREDS; } 83 sal_uInt8 GetFlags() const { return m_nFlags; } 84 sal_uInt16 GetResult() const { return m_nRet; } 85 86 void SetTitle( const String& aTitle ) 87 { m_aTitle = aTitle; } 88 void SetServer( const String& aServer ) 89 { m_aServer = aServer; } 90 void SetAccount( const String& aAccount ) 91 { m_aAccount = aAccount; } 92 void SetUserName( const String& aUserName ) 93 { m_aUserName = aUserName; } 94 void SetPassword( const String& aPassword ) 95 { m_aPassword = aPassword; } 96 void SetPasswordToModify( const String& aPassword ) 97 { m_aPasswordToModify = aPassword; } 98 void SetRecommendToOpenReadonly( bool bVal ) 99 { m_bRecommendToOpenReadonly = bVal; } 100 void SetPath( const String& aPath ) 101 { m_aPath = aPath; } 102 void SetErrorText( const String& aErrorText ) 103 { m_aErrorText = aErrorText; } 104 void SetFlags( sal_uInt8 nFlags ) 105 { m_nFlags = nFlags; } 106 107 inline void SetCanRememberPassword( sal_Bool bSet ); 108 inline void SetIsRememberPassword( sal_Bool bSet ); 109 inline void SetIsRememberPersistent( sal_Bool bSet ); 110 111 inline void SetCanUseSystemCredentials( sal_Bool bSet ); 112 inline void SetIsUseSystemCredentials( sal_Bool bSet ); 113 inline void SetModifyAccount( sal_Bool bSet ); 114 inline void SetModifyUserName( sal_Bool bSet ); 115 116 void SetResult( sal_uInt16 nRet ) 117 { m_nRet = nRet; } 118 }; 119 120 inline void LoginErrorInfo::SetCanRememberPassword( sal_Bool bSet ) 121 { 122 if ( bSet ) 123 m_nFlags |= LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD; 124 else 125 m_nFlags &= ~LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD; 126 } 127 128 inline void LoginErrorInfo::SetIsRememberPassword( sal_Bool bSet ) 129 { 130 if ( bSet ) 131 m_nFlags |= LOGINERROR_FLAG_IS_REMEMBER_PASSWORD; 132 else 133 m_nFlags &= ~LOGINERROR_FLAG_IS_REMEMBER_PASSWORD; 134 } 135 136 inline void LoginErrorInfo::SetIsRememberPersistent( sal_Bool bSet ) 137 { 138 if ( bSet ) 139 m_nFlags |= LOGINERROR_FLAG_REMEMBER_PERSISTENT; 140 else 141 m_nFlags &= ~LOGINERROR_FLAG_REMEMBER_PERSISTENT; 142 } 143 144 inline void LoginErrorInfo::SetCanUseSystemCredentials( sal_Bool bSet ) 145 { 146 if ( bSet ) 147 m_nFlags |= LOGINERROR_FLAG_CAN_USE_SYSCREDS; 148 else 149 m_nFlags &= ~LOGINERROR_FLAG_CAN_USE_SYSCREDS; 150 } 151 152 inline void LoginErrorInfo::SetIsUseSystemCredentials( sal_Bool bSet ) 153 { 154 if ( bSet ) 155 m_nFlags |= LOGINERROR_FLAG_IS_USE_SYSCREDS; 156 else 157 m_nFlags &= ~LOGINERROR_FLAG_IS_USE_SYSCREDS; 158 } 159 160 inline void LoginErrorInfo::SetModifyAccount( sal_Bool bSet ) 161 { 162 if ( bSet ) 163 m_nFlags |= LOGINERROR_FLAG_MODIFY_ACCOUNT; 164 else 165 m_nFlags &= ~LOGINERROR_FLAG_MODIFY_ACCOUNT; 166 } 167 168 inline void LoginErrorInfo::SetModifyUserName( sal_Bool bSet ) 169 { 170 if ( bSet ) 171 m_nFlags |= LOGINERROR_FLAG_MODIFY_USER_NAME; 172 else 173 m_nFlags &= ~LOGINERROR_FLAG_MODIFY_USER_NAME; 174 } 175 176 #endif 177 178 179