1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "ConnectionPage.hxx"
#include "DbAdminImpl.hxx"
#include "DriverSettings.hxx"
#include "adminpages.hxx"
#include <dbadmin.hxx>
#include <svl/stritem.hxx>
#include <svl/eitem.hxx>
#include <svl/intitem.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
#include <dsitems.hxx>
#include "dsnItem.hxx"
#include "optionalboolitem.hxx"
#include <stringlistitem.hxx>
#include <unotools/confignode.hxx>
namespace dbaui
{
using namespace com::sun::star::uno;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::beans;
// ODbAdminDialog
ODbAdminDialog::ODbAdminDialog(weld::Window* pParent,
SfxItemSet const * _pItems,
const Reference< XComponentContext >& _rxContext)
: SfxTabDialogController(pParent, u"dbaccess/ui/admindialog.ui"_ustr, u"AdminDialog"_ustr, _pItems)
, m_sMainPageID(u"advanced"_ustr)
{
m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxContext, m_xDialog.get(), pParent, this));
// add the initial tab page
AddTabPage(m_sMainPageID, OConnectionTabPage::Create, nullptr);
// remove the reset button - it's meaning is much too ambiguous in this dialog
RemoveResetButton();
}
ODbAdminDialog::~ODbAdminDialog()
{
SetInputSet(nullptr);
}
short ODbAdminDialog::Ok()
{
SfxTabDialogController::Ok();
return ( AR_LEAVE_MODIFIED == implApplyChanges() ) ? RET_OK : RET_CANCEL;
// TODO : AR_ERROR is not handled correctly, we always close the dialog here
}
void ODbAdminDialog::PageCreated(const OUString& rId, SfxTabPage& _rPage)
{
// register ourself as modified listener
static_cast<OGenericAdministrationPage&>(_rPage).SetServiceFactory( getORB() );
static_cast<OGenericAdministrationPage&>(_rPage).SetAdminDialog(this,this);
SfxTabDialogController::PageCreated(rId, _rPage);
}
void ODbAdminDialog::addDetailPage(const OUString& rPageId, TranslateId pTextId, CreateTabPage pCreateFunc)
{
AddTabPage(rPageId, DBA_RES(pTextId), pCreateFunc);
}
void ODbAdminDialog::impl_selectDataSource(const css::uno::Any& _aDataSourceName)
{
m_pImpl->setDataSourceOrName(_aDataSourceName);
Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
impl_resetPages( xDatasource );
const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>(getOutputSet()->GetItem(DSID_TYPECOLLECTION));
assert(pCollectionItem && "must exist");
::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
::dbaccess::DATASOURCE_TYPE eType = pCollection->determineType(getDatasourceType(*getOutputSet()));
// and insert the new ones
switch ( eType )
{
case ::dbaccess::DST_DBASE:
addDetailPage(u"dbase"_ustr, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateDbase);
break;
case ::dbaccess::DST_ADO:
addDetailPage(u"ado"_ustr, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateAdo);
break;
case ::dbaccess::DST_FLAT:
addDetailPage(u"text"_ustr, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateText);
break;
case ::dbaccess::DST_ODBC:
addDetailPage(u"odbc"_ustr, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateODBC);
break;
case ::dbaccess::DST_MYSQL_ODBC:
addDetailPage(u"mysqlodbc"_ustr, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateMySQLODBC);
break;
case ::dbaccess::DST_MYSQL_JDBC:
addDetailPage(u"mysqljdbc"_ustr, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateMySQLJDBC);
break;
case ::dbaccess::DST_ORACLE_JDBC:
addDetailPage(u"oraclejdbc"_ustr, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateOracleJDBC);
break;
case ::dbaccess::DST_LDAP:
addDetailPage(u"ldap"_ustr,STR_PAGETITLE_ADVANCED,ODriversSettings::CreateLDAP);
break;
case ::dbaccess::DST_USERDEFINE1: /// first user defined driver
case ::dbaccess::DST_USERDEFINE2:
case ::dbaccess::DST_USERDEFINE3:
case ::dbaccess::DST_USERDEFINE4:
case ::dbaccess::DST_USERDEFINE5:
case ::dbaccess::DST_USERDEFINE6:
case ::dbaccess::DST_USERDEFINE7:
case ::dbaccess::DST_USERDEFINE8:
case ::dbaccess::DST_USERDEFINE9:
case ::dbaccess::DST_USERDEFINE10:
{
OUString aTitle(DBA_RES(STR_PAGETITLE_ADVANCED));
AddTabPage("user" + OUString::number(eType - dbaccess::DST_USERDEFINE1 + 1), aTitle, ODriversSettings::CreateUser);
}
break;
default:
break;
}
}
void ODbAdminDialog::impl_resetPages(const Reference< XPropertySet >& _rxDatasource)
{
// the selection is valid if and only if we have a datasource now
GetInputSetImpl()->Put(SfxBoolItem(DSID_INVALID_SELECTION, !_rxDatasource.is()));
// (sal_False tells the tab pages to disable and reset all their controls, which is different
// from "just set them to readonly")
// reset the pages
// prevent flicker
m_xDialog->freeze();
// remove all items which relate to indirect properties from the input set
// (without this, the following may happen: select an arbitrary data source where some indirect properties
// are set. Select another data source of the same type, where the indirect props are not set (yet). Then,
// the indirect property values of the first ds are shown in the second ds ...)
const ODbDataSourceAdministrationHelper::MapInt2String& rMap = m_pImpl->getIndirectProperties();
for (auto const& elem : rMap)
GetInputSetImpl()->ClearItem( static_cast<sal_uInt16>(elem.first) );
// extract all relevant data from the property set of the data source
m_pImpl->translateProperties(_rxDatasource, *GetInputSetImpl());
// reset the example set
m_xExampleSet.reset(new SfxItemSet(*GetInputSetImpl()));
// special case: MySQL Native does not have the generic "advanced" page
const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>(getOutputSet()->GetItem(DSID_TYPECOLLECTION));
assert(pCollectionItem && "must exist");
::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
if ( pCollection->determineType(getDatasourceType( *m_xExampleSet )) == ::dbaccess::DST_MYSQL_NATIVE )
{
OUString sMySqlNative(u"mysqlnative"_ustr);
AddTabPage(sMySqlNative, DBA_RES(STR_PAGETITLE_CONNECTION), ODriversSettings::CreateMySQLNATIVE);
RemoveTabPage(u"advanced"_ustr);
m_sMainPageID = sMySqlNative;
}
SetCurPageId(m_sMainPageID);
SfxTabPage* pConnectionPage = GetTabPage(m_sMainPageID);
if ( pConnectionPage )
pConnectionPage->Reset(GetInputSetImpl());
// if this is NULL, the page has not been created yet, which means we're called before the
// dialog was displayed (probably from inside the ctor)
m_xDialog->thaw();
}
void ODbAdminDialog::setTitle(const OUString& rTitle)
{
m_xDialog->set_title(rTitle);
}
void ODbAdminDialog::enableConfirmSettings( bool ) {}
void ODbAdminDialog::saveDatasource()
{
PrepareLeaveCurrentPage();
}
ODbAdminDialog::ApplyResult ODbAdminDialog::implApplyChanges()
{
if (!PrepareLeaveCurrentPage())
{ // the page did not allow us to leave
return AR_KEEP;
}
if ( !m_pImpl->saveChanges(*m_xExampleSet) )
return AR_KEEP;
return AR_LEAVE_MODIFIED;
}
void ODbAdminDialog::selectDataSource(const css::uno::Any& _aDataSourceName)
{
impl_selectDataSource(_aDataSourceName);
}
const SfxItemSet* ODbAdminDialog::getOutputSet() const
{
return GetExampleSet();
}
SfxItemSet* ODbAdminDialog::getWriteOutputSet()
{
return m_xExampleSet.get();
}
std::pair< Reference<XConnection>,bool> ODbAdminDialog::createConnection()
{
return m_pImpl->createConnection();
}
Reference< XComponentContext > ODbAdminDialog::getORB() const
{
return m_pImpl->getORB();
}
Reference< XDriver > ODbAdminDialog::getDriver()
{
return m_pImpl->getDriver();
}
OUString ODbAdminDialog::getDatasourceType(const SfxItemSet& _rSet) const
{
return dbaui::ODbDataSourceAdministrationHelper::getDatasourceType(_rSet);
}
void ODbAdminDialog::clearPassword()
{
m_pImpl->clearPassword();
}
static ItemInfoPackage& getItemInfoPackageAdminDlg()
{
class ItemInfoPackageAdminDlg : public ItemInfoPackage
{
typedef std::array<ItemInfoStatic, DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1> ItemInfoArrayAdminDlg;
ItemInfoArrayAdminDlg maItemInfos {{
// m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags
{ DSID_NAME, new SfxStringItem(DSID_NAME, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_ORIGINALNAME, new SfxStringItem(DSID_ORIGINALNAME, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_CONNECTURL, new SfxStringItem(DSID_CONNECTURL, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
// gets added in constructor below once for LO runtime as static default
{ DSID_TABLEFILTER, nullptr, 0, SFX_ITEMINFOFLAG_NONE },
// gets added by callback for each new Pool as dynamic default
{ DSID_TYPECOLLECTION, nullptr, 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_INVALID_SELECTION, new SfxBoolItem(DSID_INVALID_SELECTION, false), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_READONLY, new SfxBoolItem(DSID_READONLY, false), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_USER, new SfxStringItem(DSID_USER, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_PASSWORD, new SfxStringItem(DSID_PASSWORD, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_ADDITIONALOPTIONS, new SfxStringItem(DSID_ADDITIONALOPTIONS, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_CHARSET, new SfxStringItem(DSID_CHARSET, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_PASSWORDREQUIRED, new SfxBoolItem(DSID_PASSWORDREQUIRED, false), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_SHOWDELETEDROWS, new SfxBoolItem(DSID_SHOWDELETEDROWS, false), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_ALLOWLONGTABLENAMES, new SfxBoolItem(DSID_ALLOWLONGTABLENAMES, false), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_JDBCDRIVERCLASS, new SfxStringItem(DSID_JDBCDRIVERCLASS, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_FIELDDELIMITER, new SfxStringItem(DSID_FIELDDELIMITER, OUString(',')), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_TEXTDELIMITER, new SfxStringItem(DSID_TEXTDELIMITER, OUString('"')), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_DECIMALDELIMITER, new SfxStringItem(DSID_DECIMALDELIMITER, OUString('.')), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_THOUSANDSDELIMITER, new SfxStringItem(DSID_THOUSANDSDELIMITER, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_TEXTFILEEXTENSION, new SfxStringItem(DSID_TEXTFILEEXTENSION, u"txt"_ustr), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_TEXTFILEHEADER, new SfxBoolItem(DSID_TEXTFILEHEADER, true), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_PARAMETERNAMESUBST, new SfxBoolItem(DSID_PARAMETERNAMESUBST, false), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_CONN_PORTNUMBER, new SfxInt32Item(DSID_CONN_PORTNUMBER, 8100), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_SUPPRESSVERSIONCL, new SfxBoolItem(DSID_SUPPRESSVERSIONCL, false), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_CONN_SHUTSERVICE, new SfxBoolItem(DSID_CONN_SHUTSERVICE, false), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_CONN_DATAINC, new SfxInt32Item(DSID_CONN_DATAINC, 20), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_CONN_CACHESIZE, new SfxInt32Item(DSID_CONN_CACHESIZE, 20), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_CONN_CTRLUSER, new SfxStringItem(DSID_CONN_CTRLUSER, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_CONN_CTRLPWD, new SfxStringItem(DSID_CONN_CTRLPWD, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_USECATALOG, new SfxBoolItem(DSID_USECATALOG, false), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_CONN_HOSTNAME, new SfxStringItem(DSID_CONN_HOSTNAME, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_CONN_LDAP_BASEDN, new SfxStringItem(DSID_CONN_LDAP_BASEDN, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_CONN_LDAP_PORTNUMBER, new SfxInt32Item(DSID_CONN_LDAP_PORTNUMBER, 389), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_CONN_LDAP_ROWCOUNT, new SfxInt32Item(DSID_CONN_LDAP_ROWCOUNT, 100), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_SQL92CHECK, new SfxBoolItem(DSID_SQL92CHECK, false), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_AUTOINCREMENTVALUE, new SfxStringItem(DSID_AUTOINCREMENTVALUE, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_AUTORETRIEVEVALUE, new SfxStringItem(DSID_AUTORETRIEVEVALUE, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_AUTORETRIEVEENABLED, new SfxBoolItem(DSID_AUTORETRIEVEENABLED, false), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_APPEND_TABLE_ALIAS, new SfxBoolItem(DSID_APPEND_TABLE_ALIAS, false), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_MYSQL_PORTNUMBER, new SfxInt32Item(DSID_MYSQL_PORTNUMBER, 3306), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_IGNOREDRIVER_PRIV, new SfxBoolItem(DSID_IGNOREDRIVER_PRIV, true), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_BOOLEANCOMPARISON, new SfxInt32Item(DSID_BOOLEANCOMPARISON, 0), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_ORACLE_PORTNUMBER, new SfxInt32Item(DSID_ORACLE_PORTNUMBER, 1521), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_ENABLEOUTERJOIN, new SfxBoolItem(DSID_ENABLEOUTERJOIN, true), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_CATALOG, new SfxBoolItem(DSID_CATALOG, true), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_SCHEMA, new SfxBoolItem(DSID_SCHEMA, true), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_INDEXAPPENDIX, new SfxBoolItem(DSID_INDEXAPPENDIX, true), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_CONN_LDAP_USESSL, new SfxBoolItem(DSID_CONN_LDAP_USESSL, false), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_DOCUMENT_URL, new SfxStringItem(DSID_DOCUMENT_URL, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_DOSLINEENDS, new SfxBoolItem(DSID_DOSLINEENDS, false), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_DATABASENAME, new SfxStringItem(DSID_DATABASENAME, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_AS_BEFORE_CORRNAME, new SfxBoolItem(DSID_AS_BEFORE_CORRNAME, false), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_CHECK_REQUIRED_FIELDS, new SfxBoolItem(DSID_CHECK_REQUIRED_FIELDS, true), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_IGNORECURRENCY, new SfxBoolItem(DSID_IGNORECURRENCY, false), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_CONN_SOCKET, new SfxStringItem(DSID_CONN_SOCKET, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_ESCAPE_DATETIME, new SfxBoolItem(DSID_ESCAPE_DATETIME, true), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_NAMED_PIPE, new SfxStringItem(DSID_NAMED_PIPE, OUString()), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_PRIMARY_KEY_SUPPORT, new OptionalBoolItem( DSID_PRIMARY_KEY_SUPPORT ), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_MAX_ROW_SCAN, new SfxInt32Item(DSID_MAX_ROW_SCAN, 100), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_RESPECTRESULTSETTYPE, new SfxBoolItem( DSID_RESPECTRESULTSETTYPE,false ), 0, SFX_ITEMINFOFLAG_NONE },
{ DSID_POSTGRES_PORTNUMBER, new SfxInt32Item(DSID_POSTGRES_PORTNUMBER, 5432), 0, SFX_ITEMINFOFLAG_NONE }
}};
virtual const ItemInfoStatic& getItemInfoStatic(size_t nIndex) const override { return maItemInfos[nIndex]; }
public:
ItemInfoPackageAdminDlg()
{
static constexpr OUString sFilterAll( u"%"_ustr );
setItemAtItemInfoStatic(
new OStringListItem(DSID_TABLEFILTER, Sequence< OUString >{sFilterAll}),
maItemInfos[DSID_TABLEFILTER - DSID_FIRST_ITEM_ID]);
}
virtual size_t size() const override { return maItemInfos.size(); }
virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& /*rPool*/) override { return maItemInfos[nIndex]; }
};
static std::unique_ptr<ItemInfoPackageAdminDlg> g_aItemInfoPackageAdminDlg;
if (!g_aItemInfoPackageAdminDlg)
g_aItemInfoPackageAdminDlg.reset(new ItemInfoPackageAdminDlg);
return *g_aItemInfoPackageAdminDlg;
}
void ODbAdminDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, ::dbaccess::ODsnTypeCollection* _pTypeCollection)
{
// just to be sure...
_rpSet = nullptr;
_rpPool = nullptr;
_rpPool = new SfxItemPool(u"DSAItemPool"_ustr);
// here we have to use the callback to create all needed default entries since
// the DSID_TYPECOLLECTION needs the local given _pTypeCollection. Thus this will
// be a ItemInfoDynamic created by SfxItemPool::registerItemInfoPackage. That
// (and the contained Item) will be owned by the Pool and cleaned up when it goes
// down (see SfxItemPool::cleanupItemInfos())
_rpPool->registerItemInfoPackage(
getItemInfoPackageAdminDlg(),
[&_pTypeCollection](sal_uInt16 nWhich)
{
SfxPoolItem* pRetval(nullptr);
if (DSID_TYPECOLLECTION == nWhich)
pRetval = new DbuTypeCollectionItem(DSID_TYPECOLLECTION, _pTypeCollection);
return pRetval;
});
// and, finally, the set
_rpSet.reset(new SfxItemSet(*_rpPool));
}
void ODbAdminDialog::destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool)
{
// _first_ delete the set (referring the pool)
_rpSet.reset();
// delete the pool
_rpPool = nullptr;
}
} // namespace dbaui
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|