sync master with lastest vba changes
[ooovba.git] / binfilter / inc / bf_svtools / loginerr.hxx
blobb70bde3034bf52012c40ef7e427fc124b023efca
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 #ifndef _STRING_HXX //autogen
35 #include <tools/string.hxx>
36 #endif
37 #ifndef _ERRCODE_HXX //autogen
38 #include <tools/errcode.hxx>
39 #endif
41 #ifndef _SFXHINT_HXX //autogen
42 #include <bf_svtools/hint.hxx>
43 #endif
45 namespace binfilter
48 //=========================================================================
50 #define LOGINERROR_FLAG_SET_SAVE_PASSWORD 1
51 #define LOGINERROR_FLAG_MODIFY_ACCOUNT 2
52 #define LOGINERROR_FLAG_MODIFY_USER_NAME 4
53 #define LOGINERROR_FLAG_PERSISTENT_PASSWORD 8
55 class LoginErrorInfo
57 private:
58 String _aTitle;
59 String _aServer;
60 String _aAccount;
61 String _aUserName;
62 String _aPassword;
63 String _aPath;
64 String _aErrorText;
65 BYTE _nFlags;
66 USHORT _nRet;
68 public:
69 LoginErrorInfo()
70 : _nFlags( LOGINERROR_FLAG_MODIFY_USER_NAME ),
71 _nRet( ERRCODE_BUTTON_CANCEL )
75 const String& GetTitle() const { return _aTitle; }
76 const String& GetServer() const { return _aServer; }
77 const String& GetAccount() const { return _aAccount; }
78 const String& GetUserName() const { return _aUserName; }
79 const String& GetPassword() const { return _aPassword; }
80 const String& GetPath() const { return _aPath; }
81 const String& GetErrorText() const { return _aErrorText; }
82 BOOL GetIsPersistentPassword() const
83 { return ( _nFlags & LOGINERROR_FLAG_PERSISTENT_PASSWORD ); }
84 BOOL GetIsSavePassword() const
85 { return ( _nFlags & LOGINERROR_FLAG_SET_SAVE_PASSWORD ); }
86 BYTE GetFlags() const { return _nFlags; }
87 USHORT GetResult() const { return _nRet; }
89 void SetTitle( const String& aTitle )
90 { _aTitle = aTitle; }
91 void SetServer( const String& aServer )
92 { _aServer = aServer; }
93 void SetAccount( const String& aAccount )
94 { _aAccount = aAccount; }
95 void SetUserName( const String& aUserName )
96 { _aUserName = aUserName; }
97 void SetPassword( const String& aPassword )
98 { _aPassword = aPassword; }
99 void SetPath( const String& aPath )
100 { _aPath = aPath; }
101 void SetErrorText( const String& aErrorText )
102 { _aErrorText = aErrorText; }
103 void SetFlags( BYTE nFlags )
104 { _nFlags = nFlags; }
105 inline void SetSavePassword( BOOL bSet );
106 inline void SetPersistentPassword( BOOL bSet );
107 inline void SetModifyAccount( BOOL bSet );
108 inline void SetModifyUserName( BOOL bSet );
109 void SetResult( USHORT nRet )
110 { _nRet = nRet; }
113 inline void LoginErrorInfo::SetSavePassword( BOOL bSet )
115 if ( bSet )
116 _nFlags |= LOGINERROR_FLAG_SET_SAVE_PASSWORD;
117 else
118 _nFlags &= ~LOGINERROR_FLAG_SET_SAVE_PASSWORD;
121 inline void LoginErrorInfo::SetPersistentPassword( BOOL bSet )
123 if ( bSet )
124 _nFlags |= LOGINERROR_FLAG_PERSISTENT_PASSWORD;
125 else
126 _nFlags &= ~LOGINERROR_FLAG_PERSISTENT_PASSWORD;
129 inline void LoginErrorInfo::SetModifyAccount( BOOL bSet )
131 if ( bSet )
132 _nFlags |= LOGINERROR_FLAG_MODIFY_ACCOUNT;
133 else
134 _nFlags &= ~LOGINERROR_FLAG_MODIFY_ACCOUNT;
137 inline void LoginErrorInfo::SetModifyUserName( BOOL bSet )
139 if ( bSet )
140 _nFlags |= LOGINERROR_FLAG_MODIFY_USER_NAME;
141 else
142 _nFlags &= ~LOGINERROR_FLAG_MODIFY_USER_NAME;
145 //=========================================================================
147 class CntLoginErrorHint : public SfxHint
149 private:
150 LoginErrorInfo* _pInfo;
152 CntLoginErrorHint( const CntLoginErrorHint& ); // n.i.
153 CntLoginErrorHint& operator=( const CntLoginErrorHint& ); // n.i.
155 public:
156 TYPEINFO();
158 CntLoginErrorHint( LoginErrorInfo* pInfo )
159 : _pInfo( pInfo )
163 LoginErrorInfo& GetErrorInfo() const { return *_pInfo; }
168 #endif