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 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_dbaccess.hxx"
30 
31 #ifndef _DBAUI_TABLESSINGLEDLG_HXX_
32 #include "TablesSingleDlg.hxx"
33 #endif
34 #ifndef _DBAUI_DBADMINIMPL_HXX_
35 #include "DbAdminImpl.hxx"
36 #endif
37 #ifndef _DBAUI_TABLESPAGE_HXX_
38 #include "tablespage.hxx"
39 #endif
40 #ifndef _SV_MSGBOX_HXX
41 #include <vcl/msgbox.hxx>
42 #endif
43 #ifndef _DBAUI_DATASOURCEITEMS_HXX_
44 #include "dsitems.hxx"
45 #endif
46 
47 #ifndef _DBAUI_PROPERTYSETITEM_HXX_
48 #include "propertysetitem.hxx"
49 #endif
50 
51 #include "dbu_dlg.hrc"
52 
53 //.........................................................................
54 namespace dbaui
55 {
56 //.........................................................................
57 using namespace com::sun::star::uno;
58 using namespace com::sun::star::sdbc;
59 using namespace com::sun::star::lang;
60 using namespace com::sun::star::beans;
61 using namespace com::sun::star::container;
62 
63 DBG_NAME(OTableSubscriptionDialog)
64 	//========================================================================
65 	//= OTableSubscriptionDialog
66 	//========================================================================
67 OTableSubscriptionDialog::OTableSubscriptionDialog(Window* pParent
68 			,SfxItemSet* _pItems
69 			,const Reference< XMultiServiceFactory >& _rxORB
70 			,const ::com::sun::star::uno::Any& _aDataSourceName)
71     :SfxSingleTabDialog(pParent,DLG_TABLE_FILTER,_pItems)
72     ,m_pImpl( new ODbDataSourceAdministrationHelper( _rxORB, pParent, this ) )
73     ,m_bStopExecution(sal_False)
74     ,m_pOutSet(_pItems)
75 {
76 	DBG_CTOR(OTableSubscriptionDialog,NULL);
77 	m_pImpl->setDataSourceOrName(_aDataSourceName);
78 	Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
79 	m_pOutSet = new SfxItemSet( *_pItems );
80 
81 	m_pImpl->translateProperties(xDatasource, *m_pOutSet);
82 	SetInputSet(m_pOutSet);
83 
84 	OTableSubscriptionPage* pTabPage = new OTableSubscriptionPage(this,*m_pOutSet,this);
85 	pTabPage->SetServiceFactory(_rxORB);
86 	SetTabPage(pTabPage);
87 }
88 // -----------------------------------------------------------------------------
89 OTableSubscriptionDialog::~OTableSubscriptionDialog()
90 {
91 	DBG_DTOR(OTableSubscriptionDialog,NULL);
92 	delete m_pOutSet;
93 }
94 // -----------------------------------------------------------------------------
95 short OTableSubscriptionDialog::Execute()
96 {
97 	short nRet = RET_CANCEL;
98 	if ( !m_bStopExecution )
99 	{
100 		nRet = SfxSingleTabDialog::Execute();
101 		if ( nRet == RET_OK )
102 		{
103 			m_pOutSet->Put(*GetOutputItemSet());
104 			m_pImpl->saveChanges(*m_pOutSet);
105 		}
106 	}
107 	return nRet;
108 }
109 // -----------------------------------------------------------------------------
110 sal_Bool OTableSubscriptionDialog::getCurrentSettings(Sequence< PropertyValue >& _rDriverParams)
111 {
112 	return m_pImpl->getCurrentSettings(_rDriverParams);
113 }
114 // -----------------------------------------------------------------------------
115 void OTableSubscriptionDialog::successfullyConnected()
116 {
117 	m_pImpl->successfullyConnected();
118 }
119 // -----------------------------------------------------------------------------
120 void OTableSubscriptionDialog::clearPassword()
121 {
122 	m_pImpl->clearPassword();
123 }
124 // -----------------------------------------------------------------------------
125 String OTableSubscriptionDialog::getConnectionURL() const
126 {
127 	return m_pImpl->getConnectionURL();
128 }
129 // -----------------------------------------------------------------------------
130 Reference< XPropertySet > OTableSubscriptionDialog::getCurrentDataSource()
131 {
132 	return m_pImpl->getCurrentDataSource();
133 }
134 // -----------------------------------------------------------------------------
135 const SfxItemSet* OTableSubscriptionDialog::getOutputSet() const
136 {
137 	return m_pOutSet;
138 }
139 // -----------------------------------------------------------------------------
140 SfxItemSet* OTableSubscriptionDialog::getWriteOutputSet()
141 {
142 	return m_pOutSet;
143 }
144 // -----------------------------------------------------------------------------
145 //.........................................................................
146 }	// namespace dbaui
147 //.........................................................................
148 
149 
150 
151