1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski *
3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file
5*b1cdbd2cSJim Jagielski * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file
7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski *
11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the
17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski * under the License.
19*b1cdbd2cSJim Jagielski *
20*b1cdbd2cSJim Jagielski *************************************************************/
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski
23*b1cdbd2cSJim Jagielski
24*b1cdbd2cSJim Jagielski // MARKER(update_precomp.py): autogen include statement, do not remove
25*b1cdbd2cSJim Jagielski #include "precompiled_dbaccess.hxx"
26*b1cdbd2cSJim Jagielski
27*b1cdbd2cSJim Jagielski #include "ConnectionPage.hxx"
28*b1cdbd2cSJim Jagielski #include "DbAdminImpl.hxx"
29*b1cdbd2cSJim Jagielski #include "DriverSettings.hxx"
30*b1cdbd2cSJim Jagielski #include "adminpages.hxx"
31*b1cdbd2cSJim Jagielski #include "dbadmin.hrc"
32*b1cdbd2cSJim Jagielski #include "dbadmin.hxx"
33*b1cdbd2cSJim Jagielski #include "dbu_dlg.hrc"
34*b1cdbd2cSJim Jagielski #include <svl/stritem.hxx>
35*b1cdbd2cSJim Jagielski #include <svl/eitem.hxx>
36*b1cdbd2cSJim Jagielski #include <svl/intitem.hxx>
37*b1cdbd2cSJim Jagielski #include "dbustrings.hrc"
38*b1cdbd2cSJim Jagielski #include "dsitems.hxx"
39*b1cdbd2cSJim Jagielski #include "dsnItem.hxx"
40*b1cdbd2cSJim Jagielski #include "localresaccess.hxx"
41*b1cdbd2cSJim Jagielski #include "optionalboolitem.hxx"
42*b1cdbd2cSJim Jagielski #include "propertysetitem.hxx"
43*b1cdbd2cSJim Jagielski #include "stringlistitem.hxx"
44*b1cdbd2cSJim Jagielski
45*b1cdbd2cSJim Jagielski #include <svl/eitem.hxx>
46*b1cdbd2cSJim Jagielski #include <svl/intitem.hxx>
47*b1cdbd2cSJim Jagielski #include <svl/stritem.hxx>
48*b1cdbd2cSJim Jagielski #include <unotools/confignode.hxx>
49*b1cdbd2cSJim Jagielski #include <vcl/msgbox.hxx>
50*b1cdbd2cSJim Jagielski
51*b1cdbd2cSJim Jagielski //.........................................................................
52*b1cdbd2cSJim Jagielski namespace dbaui
53*b1cdbd2cSJim Jagielski {
54*b1cdbd2cSJim Jagielski //.........................................................................
55*b1cdbd2cSJim Jagielski using namespace com::sun::star::uno;
56*b1cdbd2cSJim Jagielski using namespace com::sun::star::sdbc;
57*b1cdbd2cSJim Jagielski using namespace com::sun::star::lang;
58*b1cdbd2cSJim Jagielski using namespace com::sun::star::util;
59*b1cdbd2cSJim Jagielski using namespace com::sun::star::beans;
60*b1cdbd2cSJim Jagielski using namespace com::sun::star::container;
61*b1cdbd2cSJim Jagielski
62*b1cdbd2cSJim Jagielski //=========================================================================
63*b1cdbd2cSJim Jagielski //= ODbAdminDialog
64*b1cdbd2cSJim Jagielski //=========================================================================
DBG_NAME(ODbAdminDialog)65*b1cdbd2cSJim Jagielski DBG_NAME(ODbAdminDialog)
66*b1cdbd2cSJim Jagielski //-------------------------------------------------------------------------
67*b1cdbd2cSJim Jagielski ODbAdminDialog::ODbAdminDialog(Window* _pParent
68*b1cdbd2cSJim Jagielski , SfxItemSet* _pItems
69*b1cdbd2cSJim Jagielski , const Reference< XMultiServiceFactory >& _rxORB
70*b1cdbd2cSJim Jagielski )
71*b1cdbd2cSJim Jagielski :SfxTabDialog(_pParent, ModuleRes(DLG_DATABASE_ADMINISTRATION), _pItems)
72*b1cdbd2cSJim Jagielski ,m_bApplied(sal_False)
73*b1cdbd2cSJim Jagielski ,m_bUIEnabled( sal_True )
74*b1cdbd2cSJim Jagielski ,m_nMainPageID( PAGE_CONNECTION )
75*b1cdbd2cSJim Jagielski {
76*b1cdbd2cSJim Jagielski DBG_CTOR(ODbAdminDialog,NULL);
77*b1cdbd2cSJim Jagielski
78*b1cdbd2cSJim Jagielski m_pImpl = ::std::auto_ptr<ODbDataSourceAdministrationHelper>(new ODbDataSourceAdministrationHelper(_rxORB,this,this));
79*b1cdbd2cSJim Jagielski
80*b1cdbd2cSJim Jagielski // add the initial tab page
81*b1cdbd2cSJim Jagielski AddTabPage( m_nMainPageID, String( ModuleRes( STR_PAGETITLE_GENERAL ) ), OConnectionTabPage::Create, NULL );
82*b1cdbd2cSJim Jagielski
83*b1cdbd2cSJim Jagielski // remove the reset button - it's meaning is much too ambiguous in this dialog
84*b1cdbd2cSJim Jagielski RemoveResetButton();
85*b1cdbd2cSJim Jagielski // no local resources needed anymore
86*b1cdbd2cSJim Jagielski FreeResource();
87*b1cdbd2cSJim Jagielski }
88*b1cdbd2cSJim Jagielski
89*b1cdbd2cSJim Jagielski //-------------------------------------------------------------------------
~ODbAdminDialog()90*b1cdbd2cSJim Jagielski ODbAdminDialog::~ODbAdminDialog()
91*b1cdbd2cSJim Jagielski {
92*b1cdbd2cSJim Jagielski SetInputSet(NULL);
93*b1cdbd2cSJim Jagielski DELETEZ(pExampleSet);
94*b1cdbd2cSJim Jagielski
95*b1cdbd2cSJim Jagielski DBG_DTOR(ODbAdminDialog,NULL);
96*b1cdbd2cSJim Jagielski }
97*b1cdbd2cSJim Jagielski //-------------------------------------------------------------------------
Ok()98*b1cdbd2cSJim Jagielski short ODbAdminDialog::Ok()
99*b1cdbd2cSJim Jagielski {
100*b1cdbd2cSJim Jagielski SfxTabDialog::Ok();
101*b1cdbd2cSJim Jagielski disabledUI();
102*b1cdbd2cSJim Jagielski return ( AR_LEAVE_MODIFIED == implApplyChanges() ) ? RET_OK : RET_CANCEL;
103*b1cdbd2cSJim Jagielski // TODO : AR_ERROR is not handled correctly, we always close the dialog here
104*b1cdbd2cSJim Jagielski }
105*b1cdbd2cSJim Jagielski
106*b1cdbd2cSJim Jagielski //-------------------------------------------------------------------------
PageCreated(sal_uInt16 _nId,SfxTabPage & _rPage)107*b1cdbd2cSJim Jagielski void ODbAdminDialog::PageCreated(sal_uInt16 _nId, SfxTabPage& _rPage)
108*b1cdbd2cSJim Jagielski {
109*b1cdbd2cSJim Jagielski // register ourself as modified listener
110*b1cdbd2cSJim Jagielski static_cast<OGenericAdministrationPage&>(_rPage).SetServiceFactory(m_pImpl->getORB());
111*b1cdbd2cSJim Jagielski static_cast<OGenericAdministrationPage&>(_rPage).SetAdminDialog(this,this);
112*b1cdbd2cSJim Jagielski
113*b1cdbd2cSJim Jagielski AdjustLayout();
114*b1cdbd2cSJim Jagielski Window *pWin = GetViewWindow();
115*b1cdbd2cSJim Jagielski if(pWin)
116*b1cdbd2cSJim Jagielski pWin->Invalidate();
117*b1cdbd2cSJim Jagielski
118*b1cdbd2cSJim Jagielski SfxTabDialog::PageCreated(_nId, _rPage);
119*b1cdbd2cSJim Jagielski }
120*b1cdbd2cSJim Jagielski
121*b1cdbd2cSJim Jagielski // -----------------------------------------------------------------------------
addDetailPage(sal_uInt16 _nPageId,sal_uInt16 _nTextId,CreateTabPage _pCreateFunc)122*b1cdbd2cSJim Jagielski void ODbAdminDialog::addDetailPage(sal_uInt16 _nPageId, sal_uInt16 _nTextId, CreateTabPage _pCreateFunc)
123*b1cdbd2cSJim Jagielski {
124*b1cdbd2cSJim Jagielski // open our own resource block, as the page titles are strings local to this block
125*b1cdbd2cSJim Jagielski LocalResourceAccess aDummy(DLG_DATABASE_ADMINISTRATION, RSC_TABDIALOG);
126*b1cdbd2cSJim Jagielski
127*b1cdbd2cSJim Jagielski AddTabPage(_nPageId, String(ModuleRes(_nTextId)), _pCreateFunc, NULL);
128*b1cdbd2cSJim Jagielski m_aCurrentDetailPages.push(_nPageId);
129*b1cdbd2cSJim Jagielski }
130*b1cdbd2cSJim Jagielski
131*b1cdbd2cSJim Jagielski //-------------------------------------------------------------------------
impl_selectDataSource(const::com::sun::star::uno::Any & _aDataSourceName)132*b1cdbd2cSJim Jagielski void ODbAdminDialog::impl_selectDataSource(const ::com::sun::star::uno::Any& _aDataSourceName)
133*b1cdbd2cSJim Jagielski {
134*b1cdbd2cSJim Jagielski m_pImpl->setDataSourceOrName(_aDataSourceName);
135*b1cdbd2cSJim Jagielski Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
136*b1cdbd2cSJim Jagielski impl_resetPages( xDatasource );
137*b1cdbd2cSJim Jagielski
138*b1cdbd2cSJim Jagielski DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, getOutputSet()->GetItem(DSID_TYPECOLLECTION));
139*b1cdbd2cSJim Jagielski ::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
140*b1cdbd2cSJim Jagielski ::dbaccess::DATASOURCE_TYPE eType = pCollection->determineType(getDatasourceType(*getOutputSet()));
141*b1cdbd2cSJim Jagielski
142*b1cdbd2cSJim Jagielski // and insert the new ones
143*b1cdbd2cSJim Jagielski switch ( eType )
144*b1cdbd2cSJim Jagielski {
145*b1cdbd2cSJim Jagielski case ::dbaccess::DST_DBASE:
146*b1cdbd2cSJim Jagielski addDetailPage(PAGE_DBASE, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateDbase);
147*b1cdbd2cSJim Jagielski // bResetPasswordRequired = sal_True;
148*b1cdbd2cSJim Jagielski break;
149*b1cdbd2cSJim Jagielski
150*b1cdbd2cSJim Jagielski case ::dbaccess::DST_ADO:
151*b1cdbd2cSJim Jagielski addDetailPage(PAGE_ADO, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateAdo);
152*b1cdbd2cSJim Jagielski break;
153*b1cdbd2cSJim Jagielski
154*b1cdbd2cSJim Jagielski case ::dbaccess::DST_FLAT:
155*b1cdbd2cSJim Jagielski addDetailPage(PAGE_TEXT, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateText);
156*b1cdbd2cSJim Jagielski // bResetPasswordRequired = sal_True;
157*b1cdbd2cSJim Jagielski break;
158*b1cdbd2cSJim Jagielski
159*b1cdbd2cSJim Jagielski case ::dbaccess::DST_ODBC:
160*b1cdbd2cSJim Jagielski addDetailPage(PAGE_ODBC, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateODBC);
161*b1cdbd2cSJim Jagielski break;
162*b1cdbd2cSJim Jagielski
163*b1cdbd2cSJim Jagielski case ::dbaccess::DST_MYSQL_ODBC:
164*b1cdbd2cSJim Jagielski addDetailPage(PAGE_MYSQL_ODBC, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateMySQLODBC);
165*b1cdbd2cSJim Jagielski break;
166*b1cdbd2cSJim Jagielski
167*b1cdbd2cSJim Jagielski case ::dbaccess::DST_MYSQL_JDBC:
168*b1cdbd2cSJim Jagielski addDetailPage(PAGE_MYSQL_JDBC, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateMySQLJDBC);
169*b1cdbd2cSJim Jagielski break;
170*b1cdbd2cSJim Jagielski
171*b1cdbd2cSJim Jagielski case ::dbaccess::DST_ORACLE_JDBC:
172*b1cdbd2cSJim Jagielski addDetailPage(PAGE_ORACLE_JDBC, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateOracleJDBC);
173*b1cdbd2cSJim Jagielski break;
174*b1cdbd2cSJim Jagielski
175*b1cdbd2cSJim Jagielski case ::dbaccess::DST_ADABAS:
176*b1cdbd2cSJim Jagielski // for adabas we have more than one page
177*b1cdbd2cSJim Jagielski // CAUTION: the order of inserting pages matters.
178*b1cdbd2cSJim Jagielski // the major detail page should be inserted last always (thus, it becomes the first page after
179*b1cdbd2cSJim Jagielski // the general page)
180*b1cdbd2cSJim Jagielski addDetailPage(PAGE_ADABAS, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateAdabas);
181*b1cdbd2cSJim Jagielski break;
182*b1cdbd2cSJim Jagielski
183*b1cdbd2cSJim Jagielski case ::dbaccess::DST_LDAP:
184*b1cdbd2cSJim Jagielski addDetailPage(PAGE_LDAP,STR_PAGETITLE_ADVANCED,ODriversSettings::CreateLDAP);
185*b1cdbd2cSJim Jagielski break;
186*b1cdbd2cSJim Jagielski case ::dbaccess::DST_USERDEFINE1: /// first user defined driver
187*b1cdbd2cSJim Jagielski case ::dbaccess::DST_USERDEFINE2:
188*b1cdbd2cSJim Jagielski case ::dbaccess::DST_USERDEFINE3:
189*b1cdbd2cSJim Jagielski case ::dbaccess::DST_USERDEFINE4:
190*b1cdbd2cSJim Jagielski case ::dbaccess::DST_USERDEFINE5:
191*b1cdbd2cSJim Jagielski case ::dbaccess::DST_USERDEFINE6:
192*b1cdbd2cSJim Jagielski case ::dbaccess::DST_USERDEFINE7:
193*b1cdbd2cSJim Jagielski case ::dbaccess::DST_USERDEFINE8:
194*b1cdbd2cSJim Jagielski case ::dbaccess::DST_USERDEFINE9:
195*b1cdbd2cSJim Jagielski case ::dbaccess::DST_USERDEFINE10:
196*b1cdbd2cSJim Jagielski {
197*b1cdbd2cSJim Jagielski LocalResourceAccess aDummy(DLG_DATABASE_ADMINISTRATION, RSC_TABDIALOG);
198*b1cdbd2cSJim Jagielski String aTitle(ModuleRes(STR_PAGETITLE_ADVANCED));
199*b1cdbd2cSJim Jagielski AddTabPage(PAGE_USERDRIVER, aTitle, ODriversSettings::CreateUser, 0, sal_False, 1);
200*b1cdbd2cSJim Jagielski m_aCurrentDetailPages.push(PAGE_USERDRIVER);
201*b1cdbd2cSJim Jagielski }
202*b1cdbd2cSJim Jagielski break;
203*b1cdbd2cSJim Jagielski default:
204*b1cdbd2cSJim Jagielski break;
205*b1cdbd2cSJim Jagielski }
206*b1cdbd2cSJim Jagielski }
207*b1cdbd2cSJim Jagielski
208*b1cdbd2cSJim Jagielski //-------------------------------------------------------------------------
impl_resetPages(const Reference<XPropertySet> & _rxDatasource)209*b1cdbd2cSJim Jagielski void ODbAdminDialog::impl_resetPages(const Reference< XPropertySet >& _rxDatasource)
210*b1cdbd2cSJim Jagielski {
211*b1cdbd2cSJim Jagielski // the selection is valid if and only if we have a datasource now
212*b1cdbd2cSJim Jagielski GetInputSetImpl()->Put(SfxBoolItem(DSID_INVALID_SELECTION, !_rxDatasource.is()));
213*b1cdbd2cSJim Jagielski // (sal_False tells the tab pages to disable and reset all their controls, which is different
214*b1cdbd2cSJim Jagielski // from "just set them to readonly")
215*b1cdbd2cSJim Jagielski
216*b1cdbd2cSJim Jagielski // reset the pages
217*b1cdbd2cSJim Jagielski
218*b1cdbd2cSJim Jagielski // prevent flicker
219*b1cdbd2cSJim Jagielski SetUpdateMode(sal_False);
220*b1cdbd2cSJim Jagielski
221*b1cdbd2cSJim Jagielski // remove all items which relate to indirect properties from the input set
222*b1cdbd2cSJim Jagielski // (without this, the following may happen: select an arbitrary data source where some indirect properties
223*b1cdbd2cSJim Jagielski // are set. Select another data source of the same type, where the indirect props are not set (yet). Then,
224*b1cdbd2cSJim Jagielski // the indirect property values of the first ds are shown in the second ds ...)
225*b1cdbd2cSJim Jagielski const ODbDataSourceAdministrationHelper::MapInt2String& rMap = m_pImpl->getIndirectProperties();
226*b1cdbd2cSJim Jagielski for ( ODbDataSourceAdministrationHelper::ConstMapInt2StringIterator aIndirect = rMap.begin();
227*b1cdbd2cSJim Jagielski aIndirect != rMap.end();
228*b1cdbd2cSJim Jagielski ++aIndirect
229*b1cdbd2cSJim Jagielski )
230*b1cdbd2cSJim Jagielski GetInputSetImpl()->ClearItem( (sal_uInt16)aIndirect->first );
231*b1cdbd2cSJim Jagielski
232*b1cdbd2cSJim Jagielski // extract all relevant data from the property set of the data source
233*b1cdbd2cSJim Jagielski m_pImpl->translateProperties(_rxDatasource, *GetInputSetImpl());
234*b1cdbd2cSJim Jagielski
235*b1cdbd2cSJim Jagielski // propagate this set as our new input set and reset the example set
236*b1cdbd2cSJim Jagielski SetInputSet(GetInputSetImpl());
237*b1cdbd2cSJim Jagielski delete pExampleSet;
238*b1cdbd2cSJim Jagielski pExampleSet = new SfxItemSet(*GetInputSetImpl());
239*b1cdbd2cSJim Jagielski
240*b1cdbd2cSJim Jagielski // special case: MySQL Native does not have the generic PAGE_CONNECTION page
241*b1cdbd2cSJim Jagielski
242*b1cdbd2cSJim Jagielski DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, getOutputSet()->GetItem(DSID_TYPECOLLECTION));
243*b1cdbd2cSJim Jagielski ::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
244*b1cdbd2cSJim Jagielski if ( pCollection->determineType(getDatasourceType( *pExampleSet )) == ::dbaccess::DST_MYSQL_NATIVE )
245*b1cdbd2cSJim Jagielski {
246*b1cdbd2cSJim Jagielski LocalResourceAccess aDummy(DLG_DATABASE_ADMINISTRATION, RSC_TABDIALOG);
247*b1cdbd2cSJim Jagielski AddTabPage( PAGE_MYSQL_NATIVE, String( ModuleRes( STR_PAGETITLE_CONNECTION ) ), ODriversSettings::CreateMySQLNATIVE, NULL );
248*b1cdbd2cSJim Jagielski RemoveTabPage( PAGE_CONNECTION );
249*b1cdbd2cSJim Jagielski m_nMainPageID = PAGE_MYSQL_NATIVE;
250*b1cdbd2cSJim Jagielski }
251*b1cdbd2cSJim Jagielski
252*b1cdbd2cSJim Jagielski ShowPage( m_nMainPageID );
253*b1cdbd2cSJim Jagielski SfxTabPage* pConnectionPage = GetTabPage( m_nMainPageID );
254*b1cdbd2cSJim Jagielski if ( pConnectionPage )
255*b1cdbd2cSJim Jagielski pConnectionPage->Reset(*GetInputSetImpl());
256*b1cdbd2cSJim Jagielski // if this is NULL, the page has not been created yet, which means we're called before the
257*b1cdbd2cSJim Jagielski // dialog was displayed (probably from inside the ctor)
258*b1cdbd2cSJim Jagielski
259*b1cdbd2cSJim Jagielski SetUpdateMode(sal_True);
260*b1cdbd2cSJim Jagielski }
261*b1cdbd2cSJim Jagielski // -----------------------------------------------------------------------------
setTitle(const::rtl::OUString & _sTitle)262*b1cdbd2cSJim Jagielski void ODbAdminDialog::setTitle(const ::rtl::OUString& _sTitle)
263*b1cdbd2cSJim Jagielski {
264*b1cdbd2cSJim Jagielski SetText(_sTitle);
265*b1cdbd2cSJim Jagielski }
266*b1cdbd2cSJim Jagielski //-------------------------------------------------------------------------
enableConfirmSettings(bool _bEnable)267*b1cdbd2cSJim Jagielski void ODbAdminDialog::enableConfirmSettings( bool _bEnable )
268*b1cdbd2cSJim Jagielski {
269*b1cdbd2cSJim Jagielski (void)_bEnable;
270*b1cdbd2cSJim Jagielski }
271*b1cdbd2cSJim Jagielski //-------------------------------------------------------------------------
saveDatasource()272*b1cdbd2cSJim Jagielski sal_Bool ODbAdminDialog::saveDatasource()
273*b1cdbd2cSJim Jagielski {
274*b1cdbd2cSJim Jagielski return PrepareLeaveCurrentPage();
275*b1cdbd2cSJim Jagielski }
276*b1cdbd2cSJim Jagielski //-------------------------------------------------------------------------
implApplyChanges()277*b1cdbd2cSJim Jagielski ODbAdminDialog::ApplyResult ODbAdminDialog::implApplyChanges()
278*b1cdbd2cSJim Jagielski {
279*b1cdbd2cSJim Jagielski if (!PrepareLeaveCurrentPage())
280*b1cdbd2cSJim Jagielski { // the page did not allow us to leave
281*b1cdbd2cSJim Jagielski return AR_KEEP;
282*b1cdbd2cSJim Jagielski }
283*b1cdbd2cSJim Jagielski
284*b1cdbd2cSJim Jagielski if ( !m_pImpl->saveChanges(*pExampleSet) )
285*b1cdbd2cSJim Jagielski return AR_KEEP;
286*b1cdbd2cSJim Jagielski
287*b1cdbd2cSJim Jagielski if ( isUIEnabled() )
288*b1cdbd2cSJim Jagielski ShowPage(GetCurPageId());
289*b1cdbd2cSJim Jagielski // This does the usual ActivatePage, so the pages can save their current status.
290*b1cdbd2cSJim Jagielski // This way, next time they're asked what has changed since now and here, they really
291*b1cdbd2cSJim Jagielski // can compare with the status they have _now_ (not the one they had before this apply call).
292*b1cdbd2cSJim Jagielski
293*b1cdbd2cSJim Jagielski m_bApplied = sal_True;
294*b1cdbd2cSJim Jagielski
295*b1cdbd2cSJim Jagielski return AR_LEAVE_MODIFIED;
296*b1cdbd2cSJim Jagielski }
297*b1cdbd2cSJim Jagielski //-------------------------------------------------------------------------
selectDataSource(const::com::sun::star::uno::Any & _aDataSourceName)298*b1cdbd2cSJim Jagielski void ODbAdminDialog::selectDataSource(const ::com::sun::star::uno::Any& _aDataSourceName)
299*b1cdbd2cSJim Jagielski {
300*b1cdbd2cSJim Jagielski impl_selectDataSource(_aDataSourceName);
301*b1cdbd2cSJim Jagielski }
302*b1cdbd2cSJim Jagielski
303*b1cdbd2cSJim Jagielski // -----------------------------------------------------------------------------
getOutputSet() const304*b1cdbd2cSJim Jagielski const SfxItemSet* ODbAdminDialog::getOutputSet() const
305*b1cdbd2cSJim Jagielski {
306*b1cdbd2cSJim Jagielski return GetExampleSet();
307*b1cdbd2cSJim Jagielski }
308*b1cdbd2cSJim Jagielski // -----------------------------------------------------------------------------
getWriteOutputSet()309*b1cdbd2cSJim Jagielski SfxItemSet* ODbAdminDialog::getWriteOutputSet()
310*b1cdbd2cSJim Jagielski {
311*b1cdbd2cSJim Jagielski return pExampleSet;
312*b1cdbd2cSJim Jagielski }
313*b1cdbd2cSJim Jagielski // -----------------------------------------------------------------------------
createConnection()314*b1cdbd2cSJim Jagielski ::std::pair< Reference<XConnection>,sal_Bool> ODbAdminDialog::createConnection()
315*b1cdbd2cSJim Jagielski {
316*b1cdbd2cSJim Jagielski return m_pImpl->createConnection();
317*b1cdbd2cSJim Jagielski }
318*b1cdbd2cSJim Jagielski // -----------------------------------------------------------------------------
getORB() const319*b1cdbd2cSJim Jagielski Reference< XMultiServiceFactory > ODbAdminDialog::getORB() const
320*b1cdbd2cSJim Jagielski {
321*b1cdbd2cSJim Jagielski return m_pImpl->getORB();
322*b1cdbd2cSJim Jagielski }
323*b1cdbd2cSJim Jagielski // -----------------------------------------------------------------------------
getDriver()324*b1cdbd2cSJim Jagielski Reference< XDriver > ODbAdminDialog::getDriver()
325*b1cdbd2cSJim Jagielski {
326*b1cdbd2cSJim Jagielski return m_pImpl->getDriver();
327*b1cdbd2cSJim Jagielski }
328*b1cdbd2cSJim Jagielski // -----------------------------------------------------------------------------
getDatasourceType(const SfxItemSet & _rSet) const329*b1cdbd2cSJim Jagielski ::rtl::OUString ODbAdminDialog::getDatasourceType(const SfxItemSet& _rSet) const
330*b1cdbd2cSJim Jagielski {
331*b1cdbd2cSJim Jagielski return m_pImpl->getDatasourceType(_rSet);
332*b1cdbd2cSJim Jagielski }
333*b1cdbd2cSJim Jagielski // -----------------------------------------------------------------------------
clearPassword()334*b1cdbd2cSJim Jagielski void ODbAdminDialog::clearPassword()
335*b1cdbd2cSJim Jagielski {
336*b1cdbd2cSJim Jagielski m_pImpl->clearPassword();
337*b1cdbd2cSJim Jagielski }
338*b1cdbd2cSJim Jagielski //-------------------------------------------------------------------------
createItemSet(SfxItemSet * & _rpSet,SfxItemPool * & _rpPool,SfxPoolItem ** & _rppDefaults,::dbaccess::ODsnTypeCollection * _pTypeCollection)339*b1cdbd2cSJim Jagielski SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection)
340*b1cdbd2cSJim Jagielski {
341*b1cdbd2cSJim Jagielski // just to be sure ....
342*b1cdbd2cSJim Jagielski _rpSet = NULL;
343*b1cdbd2cSJim Jagielski _rpPool = NULL;
344*b1cdbd2cSJim Jagielski _rppDefaults = NULL;
345*b1cdbd2cSJim Jagielski
346*b1cdbd2cSJim Jagielski const ::rtl::OUString sFilterAll( "%", 1, RTL_TEXTENCODING_ASCII_US );
347*b1cdbd2cSJim Jagielski // create and initialize the defaults
348*b1cdbd2cSJim Jagielski _rppDefaults = new SfxPoolItem*[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1];
349*b1cdbd2cSJim Jagielski SfxPoolItem** pCounter = _rppDefaults; // want to modify this without affecting the out param _rppDefaults
350*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_NAME, String());
351*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_ORIGINALNAME, String());
352*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_CONNECTURL, String());
353*b1cdbd2cSJim Jagielski *pCounter++ = new OStringListItem(DSID_TABLEFILTER, Sequence< ::rtl::OUString >(&sFilterAll, 1));
354*b1cdbd2cSJim Jagielski *pCounter++ = new DbuTypeCollectionItem(DSID_TYPECOLLECTION, _pTypeCollection);
355*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_INVALID_SELECTION, sal_False);
356*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_READONLY, sal_False);
357*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_USER, String());
358*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_PASSWORD, String());
359*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_ADDITIONALOPTIONS, String());
360*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_CHARSET, String());
361*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_PASSWORDREQUIRED, sal_False);
362*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_SHOWDELETEDROWS, sal_False);
363*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_ALLOWLONGTABLENAMES, sal_False);
364*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_JDBCDRIVERCLASS, String());
365*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_FIELDDELIMITER, ',');
366*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_TEXTDELIMITER, '"');
367*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_DECIMALDELIMITER, '.');
368*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_THOUSANDSDELIMITER, String());
369*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_TEXTFILEEXTENSION, String::CreateFromAscii("txt"));
370*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_TEXTFILEHEADER, sal_True);
371*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_PARAMETERNAMESUBST, sal_False);
372*b1cdbd2cSJim Jagielski *pCounter++ = new SfxInt32Item(DSID_CONN_PORTNUMBER, 8100);
373*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_SUPPRESSVERSIONCL, sal_False);
374*b1cdbd2cSJim Jagielski *pCounter++ = new OPropertySetItem(DSID_DATASOURCE_UNO);
375*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_CONN_SHUTSERVICE, sal_False);
376*b1cdbd2cSJim Jagielski *pCounter++ = new SfxInt32Item(DSID_CONN_DATAINC, 20);
377*b1cdbd2cSJim Jagielski *pCounter++ = new SfxInt32Item(DSID_CONN_CACHESIZE, 20);
378*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_CONN_CTRLUSER, String());
379*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_CONN_CTRLPWD, String());
380*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_USECATALOG, sal_False);
381*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_CONN_HOSTNAME, String());
382*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_CONN_LDAP_BASEDN, String());
383*b1cdbd2cSJim Jagielski *pCounter++ = new SfxInt32Item(DSID_CONN_LDAP_PORTNUMBER, 389);
384*b1cdbd2cSJim Jagielski *pCounter++ = new SfxInt32Item(DSID_CONN_LDAP_ROWCOUNT, 100);
385*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_SQL92CHECK, sal_False);
386*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_AUTOINCREMENTVALUE, String());
387*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_AUTORETRIEVEVALUE, String());
388*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_AUTORETRIEVEENABLED, sal_False);
389*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_APPEND_TABLE_ALIAS, sal_False);
390*b1cdbd2cSJim Jagielski *pCounter++ = new SfxInt32Item(DSID_MYSQL_PORTNUMBER, 3306);
391*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_IGNOREDRIVER_PRIV, sal_True);
392*b1cdbd2cSJim Jagielski *pCounter++ = new SfxInt32Item(DSID_BOOLEANCOMPARISON, 0);
393*b1cdbd2cSJim Jagielski *pCounter++ = new SfxInt32Item(DSID_ORACLE_PORTNUMBER, 1521);
394*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_ENABLEOUTERJOIN, sal_True);
395*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_CATALOG, sal_True);
396*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_SCHEMA, sal_True);
397*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_INDEXAPPENDIX, sal_True);
398*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_CONN_LDAP_USESSL, sal_False);
399*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_DOCUMENT_URL, String());
400*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_DOSLINEENDS, sal_False);
401*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_DATABASENAME, String());
402*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_AS_BEFORE_CORRNAME, sal_True);
403*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_CHECK_REQUIRED_FIELDS, sal_True);
404*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_IGNORECURRENCY, sal_False);
405*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_CONN_SOCKET, String());
406*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem(DSID_ESCAPE_DATETIME, sal_True);
407*b1cdbd2cSJim Jagielski *pCounter++ = new SfxStringItem(DSID_NAMED_PIPE, String());
408*b1cdbd2cSJim Jagielski *pCounter++ = new OptionalBoolItem( DSID_PRIMARY_KEY_SUPPORT );
409*b1cdbd2cSJim Jagielski *pCounter++ = new SfxInt32Item(DSID_MAX_ROW_SCAN, 100);
410*b1cdbd2cSJim Jagielski *pCounter++ = new SfxBoolItem( DSID_RESPECTRESULTSETTYPE,sal_False );
411*b1cdbd2cSJim Jagielski
412*b1cdbd2cSJim Jagielski // create the pool
413*b1cdbd2cSJim Jagielski static SfxItemInfo __READONLY_DATA aItemInfos[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1] =
414*b1cdbd2cSJim Jagielski {
415*b1cdbd2cSJim Jagielski {0,0},
416*b1cdbd2cSJim Jagielski {0,0},
417*b1cdbd2cSJim Jagielski {0,0},
418*b1cdbd2cSJim Jagielski {0,0},
419*b1cdbd2cSJim Jagielski {0,0},
420*b1cdbd2cSJim Jagielski {0,0},
421*b1cdbd2cSJim Jagielski {0,0},
422*b1cdbd2cSJim Jagielski {0,0},
423*b1cdbd2cSJim Jagielski {0,0},
424*b1cdbd2cSJim Jagielski {0,0},
425*b1cdbd2cSJim Jagielski {0,0},
426*b1cdbd2cSJim Jagielski {0,0},
427*b1cdbd2cSJim Jagielski {0,0},
428*b1cdbd2cSJim Jagielski {0,0},
429*b1cdbd2cSJim Jagielski {0,0},
430*b1cdbd2cSJim Jagielski {0,0},
431*b1cdbd2cSJim Jagielski {0,0},
432*b1cdbd2cSJim Jagielski {0,0},
433*b1cdbd2cSJim Jagielski {0,0},
434*b1cdbd2cSJim Jagielski {0,0},
435*b1cdbd2cSJim Jagielski {0,0},
436*b1cdbd2cSJim Jagielski {0,0},
437*b1cdbd2cSJim Jagielski {0,0},
438*b1cdbd2cSJim Jagielski {0,0},
439*b1cdbd2cSJim Jagielski {0,0},
440*b1cdbd2cSJim Jagielski {0,0},
441*b1cdbd2cSJim Jagielski {0,0},
442*b1cdbd2cSJim Jagielski {0,0},
443*b1cdbd2cSJim Jagielski {0,0},
444*b1cdbd2cSJim Jagielski {0,0},
445*b1cdbd2cSJim Jagielski {0,0},
446*b1cdbd2cSJim Jagielski {0,0},
447*b1cdbd2cSJim Jagielski {0,0},
448*b1cdbd2cSJim Jagielski {0,0},
449*b1cdbd2cSJim Jagielski {0,0},
450*b1cdbd2cSJim Jagielski {0,0},
451*b1cdbd2cSJim Jagielski {0,0},
452*b1cdbd2cSJim Jagielski {0,0},
453*b1cdbd2cSJim Jagielski {0,0},
454*b1cdbd2cSJim Jagielski {0,0},
455*b1cdbd2cSJim Jagielski {0,0},
456*b1cdbd2cSJim Jagielski {0,0},
457*b1cdbd2cSJim Jagielski {0,0},
458*b1cdbd2cSJim Jagielski {0,0},
459*b1cdbd2cSJim Jagielski {0,0},
460*b1cdbd2cSJim Jagielski {0,0},
461*b1cdbd2cSJim Jagielski {0,0},
462*b1cdbd2cSJim Jagielski {0,0},
463*b1cdbd2cSJim Jagielski {0,0},
464*b1cdbd2cSJim Jagielski {0,0},
465*b1cdbd2cSJim Jagielski {0,0},
466*b1cdbd2cSJim Jagielski {0,0},
467*b1cdbd2cSJim Jagielski {0,0},
468*b1cdbd2cSJim Jagielski {0,0},
469*b1cdbd2cSJim Jagielski {0,0},
470*b1cdbd2cSJim Jagielski {0,0},
471*b1cdbd2cSJim Jagielski {0,0},
472*b1cdbd2cSJim Jagielski {0,0},
473*b1cdbd2cSJim Jagielski {0,0},
474*b1cdbd2cSJim Jagielski {0,0},
475*b1cdbd2cSJim Jagielski {0,0}
476*b1cdbd2cSJim Jagielski };
477*b1cdbd2cSJim Jagielski
478*b1cdbd2cSJim Jagielski OSL_ENSURE(sizeof(aItemInfos)/sizeof(aItemInfos[0]) == DSID_LAST_ITEM_ID,"Invalid Ids!");
479*b1cdbd2cSJim Jagielski _rpPool = new SfxItemPool(String::CreateFromAscii("DSAItemPool"), DSID_FIRST_ITEM_ID, DSID_LAST_ITEM_ID,
480*b1cdbd2cSJim Jagielski aItemInfos, _rppDefaults);
481*b1cdbd2cSJim Jagielski _rpPool->FreezeIdRanges();
482*b1cdbd2cSJim Jagielski
483*b1cdbd2cSJim Jagielski // and, finally, the set
484*b1cdbd2cSJim Jagielski _rpSet = new SfxItemSet(*_rpPool, sal_True);
485*b1cdbd2cSJim Jagielski
486*b1cdbd2cSJim Jagielski return _rpSet;
487*b1cdbd2cSJim Jagielski }
488*b1cdbd2cSJim Jagielski //-------------------------------------------------------------------------
destroyItemSet(SfxItemSet * & _rpSet,SfxItemPool * & _rpPool,SfxPoolItem ** & _rppDefaults)489*b1cdbd2cSJim Jagielski void ODbAdminDialog::destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults)
490*b1cdbd2cSJim Jagielski {
491*b1cdbd2cSJim Jagielski // _first_ delete the set (refering the pool)
492*b1cdbd2cSJim Jagielski if (_rpSet)
493*b1cdbd2cSJim Jagielski {
494*b1cdbd2cSJim Jagielski delete _rpSet;
495*b1cdbd2cSJim Jagielski _rpSet = NULL;
496*b1cdbd2cSJim Jagielski }
497*b1cdbd2cSJim Jagielski
498*b1cdbd2cSJim Jagielski // delete the pool
499*b1cdbd2cSJim Jagielski if (_rpPool)
500*b1cdbd2cSJim Jagielski {
501*b1cdbd2cSJim Jagielski _rpPool->ReleaseDefaults(sal_True);
502*b1cdbd2cSJim Jagielski // the "true" means delete the items, too
503*b1cdbd2cSJim Jagielski SfxItemPool::Free(_rpPool);
504*b1cdbd2cSJim Jagielski _rpPool = NULL;
505*b1cdbd2cSJim Jagielski }
506*b1cdbd2cSJim Jagielski
507*b1cdbd2cSJim Jagielski // reset the defaults ptr
508*b1cdbd2cSJim Jagielski _rppDefaults = NULL;
509*b1cdbd2cSJim Jagielski // no need to explicitly delete the defaults, this has been done by the ReleaseDefaults
510*b1cdbd2cSJim Jagielski }
511*b1cdbd2cSJim Jagielski
512*b1cdbd2cSJim Jagielski //.........................................................................
513*b1cdbd2cSJim Jagielski } // namespace dbaui
514*b1cdbd2cSJim Jagielski //.........................................................................
515*b1cdbd2cSJim Jagielski
516