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