196de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
396de5490SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
496de5490SAndrew Rist * or more contributor license agreements. See the NOTICE file
596de5490SAndrew Rist * distributed with this work for additional information
696de5490SAndrew Rist * regarding copyright ownership. The ASF licenses this file
796de5490SAndrew Rist * to you under the Apache License, Version 2.0 (the
896de5490SAndrew Rist * "License"); you may not use this file except in compliance
996de5490SAndrew Rist * with the License. You may obtain a copy of the License at
1096de5490SAndrew Rist *
1196de5490SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
1296de5490SAndrew Rist *
1396de5490SAndrew Rist * Unless required by applicable law or agreed to in writing,
1496de5490SAndrew Rist * software distributed under the License is distributed on an
1596de5490SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1696de5490SAndrew Rist * KIND, either express or implied. See the License for the
1796de5490SAndrew Rist * specific language governing permissions and limitations
1896de5490SAndrew Rist * under the License.
1996de5490SAndrew Rist *
2096de5490SAndrew Rist *************************************************************/
2196de5490SAndrew Rist
2296de5490SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25*b63233d8Sdamjan #include "precompiled_dbui.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #ifndef _DBAUI_TABLESSINGLEDLG_HXX_
28cdf0e10cSrcweir #include "TablesSingleDlg.hxx"
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef _DBAUI_DBADMINIMPL_HXX_
31cdf0e10cSrcweir #include "DbAdminImpl.hxx"
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef _DBAUI_TABLESPAGE_HXX_
34cdf0e10cSrcweir #include "tablespage.hxx"
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef _SV_MSGBOX_HXX
37cdf0e10cSrcweir #include <vcl/msgbox.hxx>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _DBAUI_DATASOURCEITEMS_HXX_
40cdf0e10cSrcweir #include "dsitems.hxx"
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir
43cdf0e10cSrcweir #ifndef _DBAUI_PROPERTYSETITEM_HXX_
44cdf0e10cSrcweir #include "propertysetitem.hxx"
45cdf0e10cSrcweir #endif
46cdf0e10cSrcweir
47cdf0e10cSrcweir #include "dbu_dlg.hrc"
48cdf0e10cSrcweir
49cdf0e10cSrcweir //.........................................................................
50cdf0e10cSrcweir namespace dbaui
51cdf0e10cSrcweir {
52cdf0e10cSrcweir //.........................................................................
53cdf0e10cSrcweir using namespace com::sun::star::uno;
54cdf0e10cSrcweir using namespace com::sun::star::sdbc;
55cdf0e10cSrcweir using namespace com::sun::star::lang;
56cdf0e10cSrcweir using namespace com::sun::star::beans;
57cdf0e10cSrcweir using namespace com::sun::star::container;
58cdf0e10cSrcweir
DBG_NAME(OTableSubscriptionDialog)59cdf0e10cSrcweir DBG_NAME(OTableSubscriptionDialog)
60cdf0e10cSrcweir //========================================================================
61cdf0e10cSrcweir //= OTableSubscriptionDialog
62cdf0e10cSrcweir //========================================================================
63cdf0e10cSrcweir OTableSubscriptionDialog::OTableSubscriptionDialog(Window* pParent
64cdf0e10cSrcweir ,SfxItemSet* _pItems
65cdf0e10cSrcweir ,const Reference< XMultiServiceFactory >& _rxORB
66cdf0e10cSrcweir ,const ::com::sun::star::uno::Any& _aDataSourceName)
67cdf0e10cSrcweir :SfxSingleTabDialog(pParent,DLG_TABLE_FILTER,_pItems)
68cdf0e10cSrcweir ,m_pImpl( new ODbDataSourceAdministrationHelper( _rxORB, pParent, this ) )
69cdf0e10cSrcweir ,m_bStopExecution(sal_False)
70cdf0e10cSrcweir ,m_pOutSet(_pItems)
71cdf0e10cSrcweir {
72cdf0e10cSrcweir DBG_CTOR(OTableSubscriptionDialog,NULL);
73cdf0e10cSrcweir m_pImpl->setDataSourceOrName(_aDataSourceName);
74cdf0e10cSrcweir Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
75cdf0e10cSrcweir m_pOutSet = new SfxItemSet( *_pItems );
76cdf0e10cSrcweir
77cdf0e10cSrcweir m_pImpl->translateProperties(xDatasource, *m_pOutSet);
78cdf0e10cSrcweir SetInputSet(m_pOutSet);
79cdf0e10cSrcweir
80cdf0e10cSrcweir OTableSubscriptionPage* pTabPage = new OTableSubscriptionPage(this,*m_pOutSet,this);
81cdf0e10cSrcweir pTabPage->SetServiceFactory(_rxORB);
82cdf0e10cSrcweir SetTabPage(pTabPage);
83cdf0e10cSrcweir }
84cdf0e10cSrcweir // -----------------------------------------------------------------------------
~OTableSubscriptionDialog()85cdf0e10cSrcweir OTableSubscriptionDialog::~OTableSubscriptionDialog()
86cdf0e10cSrcweir {
87cdf0e10cSrcweir DBG_DTOR(OTableSubscriptionDialog,NULL);
88cdf0e10cSrcweir delete m_pOutSet;
89cdf0e10cSrcweir }
90cdf0e10cSrcweir // -----------------------------------------------------------------------------
Execute()91cdf0e10cSrcweir short OTableSubscriptionDialog::Execute()
92cdf0e10cSrcweir {
93cdf0e10cSrcweir short nRet = RET_CANCEL;
94cdf0e10cSrcweir if ( !m_bStopExecution )
95cdf0e10cSrcweir {
96cdf0e10cSrcweir nRet = SfxSingleTabDialog::Execute();
97cdf0e10cSrcweir if ( nRet == RET_OK )
98cdf0e10cSrcweir {
99cdf0e10cSrcweir m_pOutSet->Put(*GetOutputItemSet());
100cdf0e10cSrcweir m_pImpl->saveChanges(*m_pOutSet);
101cdf0e10cSrcweir }
102cdf0e10cSrcweir }
103cdf0e10cSrcweir return nRet;
104cdf0e10cSrcweir }
105cdf0e10cSrcweir // -----------------------------------------------------------------------------
getCurrentSettings(Sequence<PropertyValue> & _rDriverParams)106cdf0e10cSrcweir sal_Bool OTableSubscriptionDialog::getCurrentSettings(Sequence< PropertyValue >& _rDriverParams)
107cdf0e10cSrcweir {
108cdf0e10cSrcweir return m_pImpl->getCurrentSettings(_rDriverParams);
109cdf0e10cSrcweir }
110cdf0e10cSrcweir // -----------------------------------------------------------------------------
successfullyConnected()111cdf0e10cSrcweir void OTableSubscriptionDialog::successfullyConnected()
112cdf0e10cSrcweir {
113cdf0e10cSrcweir m_pImpl->successfullyConnected();
114cdf0e10cSrcweir }
115cdf0e10cSrcweir // -----------------------------------------------------------------------------
clearPassword()116cdf0e10cSrcweir void OTableSubscriptionDialog::clearPassword()
117cdf0e10cSrcweir {
118cdf0e10cSrcweir m_pImpl->clearPassword();
119cdf0e10cSrcweir }
120cdf0e10cSrcweir // -----------------------------------------------------------------------------
getConnectionURL() const121cdf0e10cSrcweir String OTableSubscriptionDialog::getConnectionURL() const
122cdf0e10cSrcweir {
123cdf0e10cSrcweir return m_pImpl->getConnectionURL();
124cdf0e10cSrcweir }
125cdf0e10cSrcweir // -----------------------------------------------------------------------------
getCurrentDataSource()126cdf0e10cSrcweir Reference< XPropertySet > OTableSubscriptionDialog::getCurrentDataSource()
127cdf0e10cSrcweir {
128cdf0e10cSrcweir return m_pImpl->getCurrentDataSource();
129cdf0e10cSrcweir }
130cdf0e10cSrcweir // -----------------------------------------------------------------------------
getOutputSet() const131cdf0e10cSrcweir const SfxItemSet* OTableSubscriptionDialog::getOutputSet() const
132cdf0e10cSrcweir {
133cdf0e10cSrcweir return m_pOutSet;
134cdf0e10cSrcweir }
135cdf0e10cSrcweir // -----------------------------------------------------------------------------
getWriteOutputSet()136cdf0e10cSrcweir SfxItemSet* OTableSubscriptionDialog::getWriteOutputSet()
137cdf0e10cSrcweir {
138cdf0e10cSrcweir return m_pOutSet;
139cdf0e10cSrcweir }
140cdf0e10cSrcweir // -----------------------------------------------------------------------------
141cdf0e10cSrcweir //.........................................................................
142cdf0e10cSrcweir } // namespace dbaui
143cdf0e10cSrcweir //.........................................................................
144cdf0e10cSrcweir
145cdf0e10cSrcweir
146cdf0e10cSrcweir
147