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 ADABASUI_ADABAS_CREATEDB_HXX
25 #define ADABASUI_ADABAS_CREATEDB_HXX
26 
27 
28 #ifndef _SV_DIALOG_HXX
29 #include <vcl/dialog.hxx>
30 #endif
31 
32 #ifndef _SV_FIXED_HXX
33 #include <vcl/fixed.hxx>
34 #endif
35 #ifndef _SV_BUTTON_HXX
36 #include <vcl/button.hxx>
37 #endif
38 #ifndef _SV_FIELD_HXX
39 #include <vcl/field.hxx>
40 #endif
41 #ifndef _SV_EDIT_HXX
42 #include <vcl/edit.hxx>
43 #endif
44 #ifndef _COM_SUN_STAR_SDBCX_XCREATECATALOG_HPP_
45 #include <com/sun/star/sdbcx/XCreateCatalog.hpp>
46 #endif
47 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
48 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
49 #endif
50 #ifndef _FILEDLGHELPER_HXX
51 #include <sfx2/filedlghelper.hxx>
52 #endif
53 #include <memory>
54 #include "ASQLNameEdit.hxx"
55 
56 class WaitObject;
57 
58 namespace adabasui
59 {
60 	class ODatabaseCreator;
61 	//========================================================================
62 	// ADABAS for new db; is called from typepage
63 	//========================================================================
64 	class OAdabasNewDbDlg : public ModalDialog
65 	{
66 	private:
67 		FixedText			m_FT_DATABASENAME;
68 		OSQLNameEdit		m_ET_DATABASENAME;
69 
70         FixedLine           m_FL_USER;
71 		FixedText			m_FT_SYSUSR;
72 		FixedText			m_FT_CONUSR;
73 		FixedText			m_FT_DOMAIN_USR;
74 
75 		OSQLNameEdit		m_ET_SYSUSR;
76 		PushButton			m_PB_SYSPWD;
77 		OSQLNameEdit		m_ET_CONUSR;
78 		PushButton			m_PB_CONPWD;
79 		OSQLNameEdit		m_ET_DOMAIN_USR;
80 		PushButton			m_PB_DOMAINPWD;
81 
82 		FixedImage			m_BMP_CON;
83 		FixedImage			m_BMP_SYS;
84 		FixedImage			m_BMP_DOMAIN;
85 
86 		FixedText			m_FT_RESTORE;
87 		Edit				m_ET_RESTORE;
88 		PushButton			m_PB_RESTORE;
89 
90         FixedLine           m_FL_DBSETTINGS;
91 		FixedText			m_FT_SYSDEVSPACE;
92 		FixedText			m_FT_TRANSACTIONLOG;
93 		FixedText			m_FT_DATADEVSPACE;
94 		Edit				m_ET_SYSDEVSPACE;
95 		PushButton			m_PB_SYSDEVSPACE;
96 		Edit				m_ET_TRANSACTIONLOG;
97 		PushButton			m_PB_TRANSACTIONLOG;
98 		Edit				m_ET_DATADEVSPACE;
99 		PushButton			m_PB_DATADEVSPACE;
100 
101 		FixedText			m_FT_TRANSACTIONLOG_SIZE;
102 		NumericField		m_NF_TRANSACTIONLOG_SIZE;
103 		FixedText			m_FT_DATADEVSPACE_SIZE;
104 		NumericField		m_NF_DATADEVSPACE_SIZE;
105 		FixedText			m_FT_CACHE_SIZE;
106 		NumericField		m_NF_CACHE_SIZE;
107 
108         FixedLine           m_FL_END;
109 
110 		OKButton			m_PB_OK;
111 		CancelButton		m_PB_CANCEL;
112 
113 		String				m_SYSDEV_File;
114 		String				m_TRANSDEV_File;
115 		String				m_DATADEV_File;
116 		String				m_Backup_File;
117 		String				m_ConPwd;
118 		String				m_SysPwd;
119 		String				m_DomainPwd;
120 		String				m_DBName;
121 		String				m_sDbWork;
122 		String				m_sDbConfig;
123 		::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XCreateCatalog>		m_xCreateCatalog;
124 		com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >	m_xORB;
125 		sal_Bool				m_bRestore;
126 		sal_Int8				m_nSetBitmap;
127 
128 		::std::auto_ptr<WaitObject>			m_aCreatorWait;
129 		::std::auto_ptr<ODatabaseCreator>	m_aCreatorThread;
130 
131 		DECL_LINK( LoadButtonClickHdl,	Button		* );
132 		DECL_LINK( ButtonClickHdl,		Button		* );
133 		DECL_LINK( PwdClickHdl,			Button		* );
134 		DECL_LINK( ImplOKHdl,			OKButton	* );
135 		DECL_LINK( LoseFocusHdl,		Edit		* );
136 		DECL_LINK( TerminateHdl,		void		* );
137 
138 		void CheckBitmaps();
139 
140 		DECL_LINK(OnError, void*);
141 		DECL_LINK(OnNoDefaultPath, void*);
142 		DECL_LINK(OnNoAccessRights, void*);
143 
144 		sal_Bool fillEnvironmentVariable(const ::rtl::OUString& _sVariableName,String& _rsValue);
145 	public:
146 		OAdabasNewDbDlg(Window* pParent,
147 						const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XCreateCatalog>& _rxCreateCatalog,
148 						const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >&	_rxORB,
149 						sal_Bool _bRestore=sal_False);
150 		virtual ~OAdabasNewDbDlg();
151 
GetDatabaseName() const152 		::rtl::OUString GetDatabaseName()		const { return m_ET_DATABASENAME.GetText();	}
GetControlUser() const153 		::rtl::OUString GetControlUser()		const { return m_ET_CONUSR.GetText();		}
GetControlPassword() const154 		::rtl::OUString GetControlPassword()	const { return m_ConPwd;					}
GetUser() const155 		::rtl::OUString GetUser()				const { return m_ET_SYSUSR.GetText();		}
GetUserPassword() const156 		::rtl::OUString GetUserPassword()		const { return m_SysPwd;					}
GetCacheSize() const157 		sal_Int32		GetCacheSize()			const { return static_cast<sal_Int32>(m_NF_CACHE_SIZE.GetValue());	}
158 	};
159 }
160 #endif // adabasui_ADABAS_CREATEDB_HXX
161 
162