1*b16fc349SAndrew Rist /************************************************************** 2*b16fc349SAndrew Rist * 3*b16fc349SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*b16fc349SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*b16fc349SAndrew Rist * distributed with this work for additional information 6*b16fc349SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*b16fc349SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*b16fc349SAndrew Rist * "License"); you may not use this file except in compliance 9*b16fc349SAndrew Rist * with the License. You may obtain a copy of the License at 10*b16fc349SAndrew Rist * 11*b16fc349SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*b16fc349SAndrew Rist * 13*b16fc349SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*b16fc349SAndrew Rist * software distributed under the License is distributed on an 15*b16fc349SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b16fc349SAndrew Rist * KIND, either express or implied. See the License for the 17*b16fc349SAndrew Rist * specific language governing permissions and limitations 18*b16fc349SAndrew Rist * under the License. 19*b16fc349SAndrew Rist * 20*b16fc349SAndrew Rist *************************************************************/ 21*b16fc349SAndrew Rist 22*b16fc349SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef m_LOGINERR_HXX 25cdf0e10cSrcweir #define m_LOGINERR_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <tools/string.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir //========================================================================= 30cdf0e10cSrcweir 31cdf0e10cSrcweir #define LOGINERROR_FLAG_MODIFY_ACCOUNT 1 32cdf0e10cSrcweir #define LOGINERROR_FLAG_MODIFY_USER_NAME 2 33cdf0e10cSrcweir #define LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD 4 34cdf0e10cSrcweir #define LOGINERROR_FLAG_IS_REMEMBER_PASSWORD 8 35cdf0e10cSrcweir #define LOGINERROR_FLAG_CAN_USE_SYSCREDS 16 36cdf0e10cSrcweir #define LOGINERROR_FLAG_IS_USE_SYSCREDS 32 37cdf0e10cSrcweir #define LOGINERROR_FLAG_REMEMBER_PERSISTENT 64 38cdf0e10cSrcweir 39cdf0e10cSrcweir class LoginErrorInfo 40cdf0e10cSrcweir { 41cdf0e10cSrcweir private: 42cdf0e10cSrcweir String m_aTitle; 43cdf0e10cSrcweir String m_aServer; 44cdf0e10cSrcweir String m_aAccount; 45cdf0e10cSrcweir String m_aUserName; 46cdf0e10cSrcweir String m_aPassword; 47cdf0e10cSrcweir String m_aPasswordToModify; 48cdf0e10cSrcweir String m_aPath; 49cdf0e10cSrcweir String m_aErrorText; 50cdf0e10cSrcweir sal_uInt8 m_nFlags; 51cdf0e10cSrcweir sal_uInt16 m_nRet; 52cdf0e10cSrcweir bool m_bRecommendToOpenReadonly; 53cdf0e10cSrcweir 54cdf0e10cSrcweir public: LoginErrorInfo()55cdf0e10cSrcweir LoginErrorInfo() 56cdf0e10cSrcweir : m_nFlags( LOGINERROR_FLAG_MODIFY_USER_NAME ), 57cdf0e10cSrcweir m_nRet( ERRCODE_BUTTON_CANCEL ) 58cdf0e10cSrcweir { 59cdf0e10cSrcweir } 60cdf0e10cSrcweir GetTitle() const61cdf0e10cSrcweir const String& GetTitle() const { return m_aTitle; } GetServer() const62cdf0e10cSrcweir const String& GetServer() const { return m_aServer; } GetAccount() const63cdf0e10cSrcweir const String& GetAccount() const { return m_aAccount; } GetUserName() const64cdf0e10cSrcweir const String& GetUserName() const { return m_aUserName; } GetPassword() const65cdf0e10cSrcweir const String& GetPassword() const { return m_aPassword; } GetPasswordToModify() const66cdf0e10cSrcweir const String& GetPasswordToModify() const { return m_aPasswordToModify; } IsRecommendToOpenReadonly() const67cdf0e10cSrcweir bool IsRecommendToOpenReadonly() const { return m_bRecommendToOpenReadonly; } GetPath() const68cdf0e10cSrcweir const String& GetPath() const { return m_aPath; } GetErrorText() const69cdf0e10cSrcweir const String& GetErrorText() const { return m_aErrorText; } GetCanRememberPassword() const70cdf0e10cSrcweir sal_Bool GetCanRememberPassword() const { return ( m_nFlags & LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD ); } GetIsRememberPersistent() const71cdf0e10cSrcweir sal_Bool GetIsRememberPersistent() const { return ( m_nFlags & LOGINERROR_FLAG_REMEMBER_PERSISTENT ); } GetIsRememberPassword() const72cdf0e10cSrcweir sal_Bool GetIsRememberPassword() const { return ( m_nFlags & LOGINERROR_FLAG_IS_REMEMBER_PASSWORD ); } 73cdf0e10cSrcweir GetCanUseSystemCredentials() const74cdf0e10cSrcweir sal_Bool GetCanUseSystemCredentials() const 75cdf0e10cSrcweir { return ( m_nFlags & LOGINERROR_FLAG_CAN_USE_SYSCREDS ); } GetIsUseSystemCredentials() const76cdf0e10cSrcweir sal_Bool GetIsUseSystemCredentials() const 77cdf0e10cSrcweir { return ( m_nFlags & LOGINERROR_FLAG_IS_USE_SYSCREDS ) == 78cdf0e10cSrcweir LOGINERROR_FLAG_IS_USE_SYSCREDS; } GetFlags() const79cdf0e10cSrcweir sal_uInt8 GetFlags() const { return m_nFlags; } GetResult() const80cdf0e10cSrcweir sal_uInt16 GetResult() const { return m_nRet; } 81cdf0e10cSrcweir SetTitle(const String & aTitle)82cdf0e10cSrcweir void SetTitle( const String& aTitle ) 83cdf0e10cSrcweir { m_aTitle = aTitle; } SetServer(const String & aServer)84cdf0e10cSrcweir void SetServer( const String& aServer ) 85cdf0e10cSrcweir { m_aServer = aServer; } SetAccount(const String & aAccount)86cdf0e10cSrcweir void SetAccount( const String& aAccount ) 87cdf0e10cSrcweir { m_aAccount = aAccount; } SetUserName(const String & aUserName)88cdf0e10cSrcweir void SetUserName( const String& aUserName ) 89cdf0e10cSrcweir { m_aUserName = aUserName; } SetPassword(const String & aPassword)90cdf0e10cSrcweir void SetPassword( const String& aPassword ) 91cdf0e10cSrcweir { m_aPassword = aPassword; } SetPasswordToModify(const String & aPassword)92cdf0e10cSrcweir void SetPasswordToModify( const String& aPassword ) 93cdf0e10cSrcweir { m_aPasswordToModify = aPassword; } SetRecommendToOpenReadonly(bool bVal)94cdf0e10cSrcweir void SetRecommendToOpenReadonly( bool bVal ) 95cdf0e10cSrcweir { m_bRecommendToOpenReadonly = bVal; } SetPath(const String & aPath)96cdf0e10cSrcweir void SetPath( const String& aPath ) 97cdf0e10cSrcweir { m_aPath = aPath; } SetErrorText(const String & aErrorText)98cdf0e10cSrcweir void SetErrorText( const String& aErrorText ) 99cdf0e10cSrcweir { m_aErrorText = aErrorText; } SetFlags(sal_uInt8 nFlags)100cdf0e10cSrcweir void SetFlags( sal_uInt8 nFlags ) 101cdf0e10cSrcweir { m_nFlags = nFlags; } 102cdf0e10cSrcweir 103cdf0e10cSrcweir inline void SetCanRememberPassword( sal_Bool bSet ); 104cdf0e10cSrcweir inline void SetIsRememberPassword( sal_Bool bSet ); 105cdf0e10cSrcweir inline void SetIsRememberPersistent( sal_Bool bSet ); 106cdf0e10cSrcweir 107cdf0e10cSrcweir inline void SetCanUseSystemCredentials( sal_Bool bSet ); 108cdf0e10cSrcweir inline void SetIsUseSystemCredentials( sal_Bool bSet ); 109cdf0e10cSrcweir inline void SetModifyAccount( sal_Bool bSet ); 110cdf0e10cSrcweir inline void SetModifyUserName( sal_Bool bSet ); 111cdf0e10cSrcweir SetResult(sal_uInt16 nRet)112cdf0e10cSrcweir void SetResult( sal_uInt16 nRet ) 113cdf0e10cSrcweir { m_nRet = nRet; } 114cdf0e10cSrcweir }; 115cdf0e10cSrcweir SetCanRememberPassword(sal_Bool bSet)116cdf0e10cSrcweirinline void LoginErrorInfo::SetCanRememberPassword( sal_Bool bSet ) 117cdf0e10cSrcweir { 118cdf0e10cSrcweir if ( bSet ) 119cdf0e10cSrcweir m_nFlags |= LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD; 120cdf0e10cSrcweir else 121cdf0e10cSrcweir m_nFlags &= ~LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD; 122cdf0e10cSrcweir } 123cdf0e10cSrcweir SetIsRememberPassword(sal_Bool bSet)124cdf0e10cSrcweirinline void LoginErrorInfo::SetIsRememberPassword( sal_Bool bSet ) 125cdf0e10cSrcweir { 126cdf0e10cSrcweir if ( bSet ) 127cdf0e10cSrcweir m_nFlags |= LOGINERROR_FLAG_IS_REMEMBER_PASSWORD; 128cdf0e10cSrcweir else 129cdf0e10cSrcweir m_nFlags &= ~LOGINERROR_FLAG_IS_REMEMBER_PASSWORD; 130cdf0e10cSrcweir } 131cdf0e10cSrcweir SetIsRememberPersistent(sal_Bool bSet)132cdf0e10cSrcweirinline void LoginErrorInfo::SetIsRememberPersistent( sal_Bool bSet ) 133cdf0e10cSrcweir { 134cdf0e10cSrcweir if ( bSet ) 135cdf0e10cSrcweir m_nFlags |= LOGINERROR_FLAG_REMEMBER_PERSISTENT; 136cdf0e10cSrcweir else 137cdf0e10cSrcweir m_nFlags &= ~LOGINERROR_FLAG_REMEMBER_PERSISTENT; 138cdf0e10cSrcweir } 139cdf0e10cSrcweir SetCanUseSystemCredentials(sal_Bool bSet)140cdf0e10cSrcweirinline void LoginErrorInfo::SetCanUseSystemCredentials( sal_Bool bSet ) 141cdf0e10cSrcweir { 142cdf0e10cSrcweir if ( bSet ) 143cdf0e10cSrcweir m_nFlags |= LOGINERROR_FLAG_CAN_USE_SYSCREDS; 144cdf0e10cSrcweir else 145cdf0e10cSrcweir m_nFlags &= ~LOGINERROR_FLAG_CAN_USE_SYSCREDS; 146cdf0e10cSrcweir } 147cdf0e10cSrcweir SetIsUseSystemCredentials(sal_Bool bSet)148cdf0e10cSrcweirinline void LoginErrorInfo::SetIsUseSystemCredentials( sal_Bool bSet ) 149cdf0e10cSrcweir { 150cdf0e10cSrcweir if ( bSet ) 151cdf0e10cSrcweir m_nFlags |= LOGINERROR_FLAG_IS_USE_SYSCREDS; 152cdf0e10cSrcweir else 153cdf0e10cSrcweir m_nFlags &= ~LOGINERROR_FLAG_IS_USE_SYSCREDS; 154cdf0e10cSrcweir } 155cdf0e10cSrcweir SetModifyAccount(sal_Bool bSet)156cdf0e10cSrcweirinline void LoginErrorInfo::SetModifyAccount( sal_Bool bSet ) 157cdf0e10cSrcweir { 158cdf0e10cSrcweir if ( bSet ) 159cdf0e10cSrcweir m_nFlags |= LOGINERROR_FLAG_MODIFY_ACCOUNT; 160cdf0e10cSrcweir else 161cdf0e10cSrcweir m_nFlags &= ~LOGINERROR_FLAG_MODIFY_ACCOUNT; 162cdf0e10cSrcweir } 163cdf0e10cSrcweir SetModifyUserName(sal_Bool bSet)164cdf0e10cSrcweirinline void LoginErrorInfo::SetModifyUserName( sal_Bool bSet ) 165cdf0e10cSrcweir { 166cdf0e10cSrcweir if ( bSet ) 167cdf0e10cSrcweir m_nFlags |= LOGINERROR_FLAG_MODIFY_USER_NAME; 168cdf0e10cSrcweir else 169cdf0e10cSrcweir m_nFlags &= ~LOGINERROR_FLAG_MODIFY_USER_NAME; 170cdf0e10cSrcweir } 171cdf0e10cSrcweir 172cdf0e10cSrcweir #endif 173cdf0e10cSrcweir 174cdf0e10cSrcweir 175