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