Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "tablespage.hxx"
21 : #include "dbu_dlg.hrc"
22 : #include "dbadmin.hrc"
23 : #include "dsitems.hxx"
24 : #include "browserids.hxx"
25 : #include "datasourceconnector.hxx"
26 : #include <comphelper/types.hxx>
27 : #include <connectivity/dbtools.hxx>
28 : #include <connectivity/dbexception.hxx>
29 : #include "stringlistitem.hxx"
30 : #include <svl/eitem.hxx>
31 : #include <svl/stritem.hxx>
32 : #include "dbustrings.hrc"
33 : #include <vcl/svapp.hxx>
34 : #include <vcl/settings.hxx>
35 : #include <vcl/waitobj.hxx>
36 : #include <com/sun/star/i18n/Collator.hpp>
37 : #include <com/sun/star/sdb/SQLContext.hpp>
38 : #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
39 : #include <com/sun/star/sdbcx/XAppend.hpp>
40 : #include <com/sun/star/util/XModifiable.hpp>
41 : #include <com/sun/star/sdbcx/XDrop.hpp>
42 : #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
43 : #include "sqlmessage.hxx"
44 : #include <vcl/msgbox.hxx>
45 : #include "dbaccess_helpid.hrc"
46 : #include "UITools.hxx"
47 : #include <osl/mutex.hxx>
48 : #include <osl/diagnose.h>
49 : #include <svtools/imgdef.hxx>
50 : #include "svtools/treelistentry.hxx"
51 : #include "TablesSingleDlg.hxx"
52 : #include <tools/diagnose_ex.h>
53 : #include <comphelper/processfactory.hxx>
54 : #include <cppuhelper/exc_hlp.hxx>
55 : #include "AutoControls.hrc"
56 :
57 : namespace dbaui
58 : {
59 :
60 : using namespace ::com::sun::star::uno;
61 : using namespace ::com::sun::star::sdbc;
62 : using namespace ::com::sun::star::sdbcx;
63 : using namespace ::com::sun::star::sdb;
64 : using namespace ::com::sun::star::beans;
65 : using namespace ::com::sun::star::lang;
66 : using namespace ::com::sun::star::i18n;
67 : using namespace ::com::sun::star::container;
68 : using namespace ::com::sun::star::frame;
69 : using namespace ::com::sun::star::util;
70 : using namespace ::dbtools;
71 : using namespace ::comphelper;
72 :
73 : // OTableSubscriptionPage
74 0 : OTableSubscriptionPage::OTableSubscriptionPage(Window* pParent, const SfxItemSet& _rCoreAttrs,
75 : OTableSubscriptionDialog* _pTablesDlg)
76 : : OGenericAdministrationPage(pParent, "TablesFilterPage",
77 : "dbaccess/ui/tablesfilterpage.ui", _rCoreAttrs)
78 : , m_bCatalogAtStart(true)
79 0 : , m_pTablesDlg(_pTablesDlg)
80 : {
81 0 : get(m_pTables, "TablesFilterPage");
82 :
83 0 : get(m_pTablesList, "treeview");
84 0 : m_pTablesList->set_width_request(56 * m_pTablesList->approximate_char_width());
85 0 : m_pTablesList->set_height_request(12 * m_pTablesList->GetTextHeight());
86 :
87 0 : m_pTablesList->SetCheckHandler(getControlModifiedLink());
88 :
89 : // initialize the TabListBox
90 0 : m_pTablesList->SetSelectionMode( MULTIPLE_SELECTION );
91 0 : m_pTablesList->SetDragDropMode( 0 );
92 0 : m_pTablesList->EnableInplaceEditing( false );
93 0 : m_pTablesList->SetStyle(m_pTablesList->GetStyle() | WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT);
94 :
95 0 : m_pTablesList->Clear();
96 :
97 0 : m_pTablesList->SetCheckButtonHdl(LINK(this, OTableSubscriptionPage, OnTreeEntryChecked));
98 0 : m_pTablesList->SetCheckHandler(LINK(this, OTableSubscriptionPage, OnTreeEntryChecked));
99 0 : }
100 :
101 0 : OTableSubscriptionPage::~OTableSubscriptionPage()
102 : {
103 : // just to make sure that our connection will be removed
104 : try
105 : {
106 0 : ::comphelper::disposeComponent(m_xCurrentConnection);
107 : }
108 0 : catch (RuntimeException&) { }
109 :
110 0 : }
111 :
112 0 : void OTableSubscriptionPage::StateChanged( StateChangedType nType )
113 : {
114 0 : OGenericAdministrationPage::StateChanged( nType );
115 :
116 0 : if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
117 : {
118 : // Check if we need to get new images for normal/high contrast mode
119 0 : m_pTablesList->notifyHiContrastChanged();
120 : }
121 0 : }
122 0 : void OTableSubscriptionPage::DataChanged( const DataChangedEvent& rDCEvt )
123 : {
124 0 : OGenericAdministrationPage::DataChanged( rDCEvt );
125 :
126 0 : if ((( rDCEvt.GetType() == DATACHANGED_SETTINGS ) ||
127 0 : ( rDCEvt.GetType() == DATACHANGED_DISPLAY )) &&
128 0 : ( rDCEvt.GetFlags() & SETTINGS_STYLE ))
129 : {
130 : // Check if we need to get new images for normal/high contrast mode
131 0 : m_pTablesList->notifyHiContrastChanged();
132 : }
133 0 : }
134 0 : void OTableSubscriptionPage::resizeControls(const Size& _rDiff)
135 : {
136 0 : if ( _rDiff.Height() )
137 : {
138 0 : Size aOldSize = m_pTablesList->GetSizePixel();
139 0 : aOldSize.Height() -= _rDiff.Height();
140 : m_pTablesList->SetPosSizePixel(
141 0 : m_pTablesList->GetPosPixel()+Point(0,_rDiff.Height()),
142 : aOldSize
143 0 : );
144 : }
145 0 : }
146 0 : void OTableSubscriptionPage::implCheckTables(const Sequence< OUString >& _rTables)
147 : {
148 : // the meta data for the current connection, used for splitting up table names
149 0 : Reference< XDatabaseMetaData > xMeta;
150 : try
151 : {
152 0 : if (m_xCurrentConnection.is())
153 0 : xMeta = m_xCurrentConnection->getMetaData();
154 : }
155 0 : catch(SQLException&)
156 : {
157 : OSL_FAIL("OTableSubscriptionPage::implCheckTables : could not retrieve the current connection's meta data!");
158 : }
159 :
160 : // uncheck all
161 0 : CheckAll(sal_False);
162 :
163 : // check the ones which are in the list
164 0 : OUString sCatalog, sSchema, sName;
165 :
166 0 : SvTreeListEntry* pRootEntry = m_pTablesList->getAllObjectsEntry();
167 0 : sal_Bool bAllTables = sal_False;
168 0 : sal_Bool bAllSchemas = sal_False;
169 :
170 0 : const OUString* pIncludeTable = _rTables.getConstArray();
171 0 : for (sal_Int32 i=0; i<_rTables.getLength(); ++i, ++pIncludeTable)
172 : {
173 0 : if (xMeta.is())
174 0 : qualifiedNameComponents(xMeta, pIncludeTable->getStr(), sCatalog, sSchema, sName,::dbtools::eInDataManipulation);
175 : else
176 0 : sName = pIncludeTable->getStr();
177 :
178 0 : bAllTables = (1 == sName.getLength()) && ('%' == sName[0]);
179 0 : bAllSchemas = (1 == sSchema.getLength()) && ('%' == sSchema[0]);
180 :
181 : // the catalog entry
182 0 : SvTreeListEntry* pCatalog = m_pTablesList->GetEntryPosByName(sCatalog, pRootEntry);
183 0 : if (!(pCatalog || sCatalog.isEmpty()))
184 : // the table (resp. its catalog) refered in this filter entry does not exist anymore
185 0 : continue;
186 :
187 0 : if (bAllSchemas && pCatalog)
188 : {
189 0 : m_pTablesList->checkWildcard(pCatalog);
190 0 : continue;
191 : }
192 :
193 : // the schema entry
194 0 : SvTreeListEntry* pSchema = m_pTablesList->GetEntryPosByName(sSchema, (pCatalog ? pCatalog : pRootEntry));
195 0 : if (!(pSchema || sSchema.isEmpty()))
196 : // the table (resp. its schema) refered in this filter entry does not exist anymore
197 0 : continue;
198 :
199 0 : if (bAllTables && pSchema)
200 : {
201 0 : m_pTablesList->checkWildcard(pSchema);
202 0 : continue;
203 : }
204 :
205 0 : SvTreeListEntry* pEntry = m_pTablesList->GetEntryPosByName(sName, pSchema ? pSchema : (pCatalog ? pCatalog : pRootEntry) );
206 0 : if (pEntry)
207 0 : m_pTablesList->SetCheckButtonState(pEntry, SV_BUTTON_CHECKED);
208 : }
209 0 : m_pTablesList->CheckButtons();
210 0 : }
211 :
212 0 : void OTableSubscriptionPage::implCompleteTablesCheck( const ::com::sun::star::uno::Sequence< OUString >& _rTableFilter )
213 : {
214 0 : if (!_rTableFilter.getLength())
215 : { // no tables visible
216 0 : CheckAll(sal_False);
217 : }
218 : else
219 : {
220 0 : if ((1 == _rTableFilter.getLength()) && _rTableFilter[0] == "%")
221 : { // all tables visible
222 0 : CheckAll(sal_True);
223 : }
224 : else
225 0 : implCheckTables( _rTableFilter );
226 : }
227 0 : }
228 :
229 0 : void OTableSubscriptionPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
230 : {
231 : // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
232 : sal_Bool bValid, bReadonly;
233 0 : getFlags(_rSet, bValid, bReadonly);
234 :
235 : // get the name of the data source we're working for
236 0 : SFX_ITEMSET_GET(_rSet, pNameItem, SfxStringItem, DSID_NAME, true);
237 : OSL_ENSURE(pNameItem, "OTableSubscriptionPage::implInitControls: missing the name attribute!");
238 0 : OUString sDSName = pNameItem->GetValue();
239 :
240 0 : if (bValid && !sDSName.isEmpty() && !m_xCurrentConnection.is() )
241 : { // get the current table list from the connection for the current settings
242 :
243 : // the PropertyValues for the current dialog settings
244 0 : Sequence< PropertyValue > aConnectionParams;
245 : OSL_ENSURE(m_pTablesDlg, "OTableSubscriptionPage::implInitControls: need a parent dialog doing the translation!");
246 0 : if ( m_pTablesDlg )
247 : {
248 0 : if (!m_pTablesDlg->getCurrentSettings(aConnectionParams))
249 : {
250 0 : m_pTablesList->Clear();
251 0 : m_pTablesDlg->endExecution();
252 0 : return;
253 : }
254 : }
255 :
256 0 : if (!m_xCollator.is())
257 : {
258 : // the collator for the string compares
259 : try
260 : {
261 0 : m_xCollator = Collator::create(m_xORB);
262 0 : m_xCollator->loadDefaultCollator(Application::GetSettings().GetLanguageTag().getLocale(), 0);
263 : }
264 0 : catch(const Exception&)
265 : {
266 : DBG_UNHANDLED_EXCEPTION();
267 : }
268 : }
269 :
270 : // fill the table list with this connection information
271 0 : SQLExceptionInfo aErrorInfo;
272 : // the current DSN
273 0 : OUString sURL;
274 0 : if ( m_pTablesDlg )
275 0 : sURL = m_pTablesDlg->getConnectionURL();
276 :
277 : try
278 : {
279 0 : WaitObject aWaitCursor(this);
280 0 : m_pTablesList->GetModel()->SetSortMode(SortAscending);
281 0 : m_pTablesList->GetModel()->SetCompareHdl(LINK(this, OTableSubscriptionPage, OnTreeEntryCompare));
282 :
283 0 : Reference< XDriver > xDriver;
284 0 : Reference<XPropertySet> xProp = m_pTablesDlg->getCurrentDataSource();
285 : OSL_ENSURE(xProp.is(),"No data source set!");
286 0 : if ( xProp.is() )
287 : {
288 0 : Any aTableFilter = xProp->getPropertyValue(PROPERTY_TABLEFILTER);
289 0 : Any aTableTypeFilter = xProp->getPropertyValue(PROPERTY_TABLETYPEFILTER);
290 :
291 0 : Reference<XModifiable> xModi(getDataSourceOrModel(xProp),UNO_QUERY);
292 0 : sal_Bool bModified = ( xModi.is() && xModi->isModified() );
293 :
294 0 : Sequence< OUString > aNewTableFilter(1);
295 0 : aNewTableFilter[0] = "%";
296 0 : xProp->setPropertyValue(PROPERTY_TABLEFILTER,makeAny(aNewTableFilter));
297 :
298 0 : xProp->setPropertyValue( PROPERTY_TABLETYPEFILTER, makeAny( Sequence< OUString >() ) );
299 0 : Reference< ::com::sun::star::lang::XEventListener> xEvt;
300 0 : aErrorInfo = ::dbaui::createConnection(xProp, m_xORB, xEvt, m_xCurrentConnection);
301 :
302 0 : xProp->setPropertyValue(PROPERTY_TABLEFILTER,aTableFilter);
303 0 : xProp->setPropertyValue(PROPERTY_TABLETYPEFILTER,aTableTypeFilter);
304 :
305 0 : if ( xModi.is() && !bModified )
306 0 : xModi->setModified(sal_False);
307 :
308 : }
309 :
310 0 : if ( m_xCurrentConnection.is() )
311 : {
312 0 : m_pTablesList->UpdateTableList( m_xCurrentConnection );
313 0 : if (m_pTablesDlg)
314 0 : m_pTablesDlg->successfullyConnected();
315 0 : }
316 : }
317 0 : catch (const SQLException&)
318 : {
319 0 : aErrorInfo = ::cppu::getCaughtException();
320 : }
321 :
322 0 : if (aErrorInfo.isValid())
323 : {
324 : // establishing the connection failed. Show an error window and exit.
325 0 : OSQLMessageBox aMessageBox( GetParentDialog(), aErrorInfo );
326 0 : aMessageBox.Execute();
327 0 : m_pTables->Enable(false);
328 0 : m_pTablesList->Clear();
329 :
330 0 : if ( m_pTablesDlg )
331 : {
332 0 : m_pTablesDlg->clearPassword();
333 0 : m_pTablesDlg->endExecution();
334 0 : }
335 : }
336 : else
337 : {
338 : // in addition, we need some infos about the connection used
339 0 : m_sCatalogSeparator = "."; // (default)
340 0 : m_bCatalogAtStart = sal_True; // (default)
341 : try
342 : {
343 0 : Reference< XDatabaseMetaData > xMeta;
344 0 : if (m_xCurrentConnection.is())
345 0 : xMeta = m_xCurrentConnection->getMetaData();
346 0 : if (xMeta.is() && xMeta->supportsCatalogsInDataManipulation())
347 : {
348 0 : m_sCatalogSeparator = xMeta->getCatalogSeparator();
349 0 : m_bCatalogAtStart = xMeta->isCatalogAtStart();
350 0 : }
351 : }
352 0 : catch(Exception&)
353 : {
354 : DBG_UNHANDLED_EXCEPTION();
355 : }
356 0 : }
357 : }
358 :
359 0 : bValid = bValid && m_xCurrentConnection.is();
360 0 : bReadonly = bReadonly || !bValid;
361 :
362 : // get the current table filter
363 0 : SFX_ITEMSET_GET(_rSet, pTableFilter, OStringListItem, DSID_TABLEFILTER, true);
364 0 : Sequence< OUString > aTableFilter;
365 0 : if (pTableFilter)
366 0 : aTableFilter = pTableFilter->getList();
367 :
368 0 : implCompleteTablesCheck( aTableFilter );
369 :
370 : // expand the first entry by default
371 0 : SvTreeListEntry* pExpand = m_pTablesList->getAllObjectsEntry();
372 0 : while (pExpand)
373 : {
374 0 : m_pTablesList->Expand(pExpand);
375 0 : pExpand = m_pTablesList->FirstChild(pExpand);
376 0 : if (pExpand && m_pTablesList->NextSibling(pExpand))
377 0 : pExpand = NULL;
378 : }
379 :
380 : // update the toolbox according the current selection and check state
381 0 : OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
382 : }
383 :
384 0 : void OTableSubscriptionPage::CheckAll( sal_Bool _bCheck )
385 : {
386 0 : SvButtonState eState = _bCheck ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED;
387 0 : SvTreeListEntry* pEntry = m_pTablesList->First();
388 0 : while (pEntry)
389 : {
390 0 : m_pTablesList->SetCheckButtonState( pEntry, eState);
391 0 : pEntry = m_pTablesList->Next(pEntry);
392 : }
393 :
394 0 : if (_bCheck && m_pTablesList->getAllObjectsEntry())
395 0 : m_pTablesList->checkWildcard(m_pTablesList->getAllObjectsEntry());
396 0 : }
397 :
398 0 : int OTableSubscriptionPage::DeactivatePage(SfxItemSet* _pSet)
399 : {
400 0 : int nResult = OGenericAdministrationPage::DeactivatePage(_pSet);
401 :
402 : // dispose the connection, we don't need it anymore, so we're not wasting resources
403 : try
404 : {
405 0 : ::comphelper::disposeComponent(m_xCurrentConnection);
406 : }
407 0 : catch (RuntimeException&) { }
408 :
409 0 : return nResult;
410 : }
411 0 : IMPL_LINK( OTableSubscriptionPage, OnTreeEntryChecked, Control*, _pControl )
412 : {
413 0 : return OnControlModified(_pControl);
414 : }
415 0 : IMPL_LINK( OTableSubscriptionPage, OnTreeEntryCompare, const SvSortData*, _pSortData )
416 : {
417 0 : const SvTreeListEntry* pLHS = static_cast<const SvTreeListEntry*>(_pSortData->pLeft);
418 0 : const SvTreeListEntry* pRHS = static_cast<const SvTreeListEntry*>(_pSortData->pRight);
419 : OSL_ENSURE(pLHS && pRHS, "SbaTableQueryBrowser::OnTreeEntryCompare: invalid tree entries!");
420 :
421 0 : const SvLBoxString* pLeftTextItem = static_cast<const SvLBoxString*>(pLHS->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
422 0 : const SvLBoxString* pRightTextItem = static_cast<const SvLBoxString*>(pRHS->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
423 : OSL_ENSURE(pLeftTextItem && pRightTextItem, "SbaTableQueryBrowser::OnTreeEntryCompare: invalid text items!");
424 :
425 0 : OUString sLeftText = pLeftTextItem->GetText();
426 0 : OUString sRightText = pRightTextItem->GetText();
427 :
428 0 : sal_Int32 nCompareResult = 0; // equal by default
429 :
430 0 : if (m_xCollator.is())
431 : {
432 : try
433 : {
434 0 : nCompareResult = m_xCollator->compareString(sLeftText, sRightText);
435 : }
436 0 : catch(Exception&)
437 : {
438 : }
439 : }
440 : else
441 : // default behaviour if we do not have a collator -> do the simple string compare
442 0 : nCompareResult = sLeftText.compareTo(sRightText);
443 :
444 0 : return nCompareResult;
445 : }
446 :
447 0 : Sequence< OUString > OTableSubscriptionPage::collectDetailedSelection() const
448 : {
449 0 : Sequence< OUString > aTableFilter;
450 0 : static const OUString sDot(".");
451 0 : static const OUString sWildcard("%");
452 :
453 0 : OUString sComposedName;
454 0 : const SvTreeListEntry* pAllObjectsEntry = m_pTablesList->getAllObjectsEntry();
455 0 : if (!pAllObjectsEntry)
456 0 : return aTableFilter;
457 0 : SvTreeListEntry* pEntry = m_pTablesList->GetModel()->Next(const_cast<SvTreeListEntry*>(pAllObjectsEntry));
458 0 : while(pEntry)
459 : {
460 0 : sal_Bool bCatalogWildcard = sal_False;
461 0 : sal_Bool bSchemaWildcard = sal_False;
462 0 : SvTreeListEntry* pSchema = NULL;
463 0 : SvTreeListEntry* pCatalog = NULL;
464 :
465 0 : if (m_pTablesList->GetCheckButtonState(pEntry) == SV_BUTTON_CHECKED && !m_pTablesList->GetModel()->HasChildren(pEntry))
466 : { // checked and a leaf, which means it's no catalog, no schema, but a real table
467 0 : OUString sCatalog;
468 0 : if(m_pTablesList->GetModel()->HasParent(pEntry))
469 : {
470 0 : pSchema = m_pTablesList->GetModel()->GetParent(pEntry);
471 0 : if (pAllObjectsEntry == pSchema)
472 : // do not want to have the root entry
473 0 : pSchema = NULL;
474 :
475 0 : if (pSchema)
476 : { // it's a real schema entry, not the "all objects" root
477 0 : if(m_pTablesList->GetModel()->HasParent(pSchema))
478 : {
479 0 : pCatalog = m_pTablesList->GetModel()->GetParent(pSchema);
480 0 : if (pAllObjectsEntry == pCatalog)
481 : // do not want to have the root entry
482 0 : pCatalog = NULL;
483 :
484 0 : if (pCatalog)
485 : { // it's a real catalog entry, not the "all objects" root
486 0 : bCatalogWildcard = m_pTablesList->isWildcardChecked(pCatalog);
487 0 : if (m_bCatalogAtStart)
488 : {
489 0 : sComposedName += m_pTablesList->GetEntryText( pCatalog );
490 0 : sComposedName += m_sCatalogSeparator;
491 0 : if (bCatalogWildcard)
492 0 : sComposedName += sWildcard;
493 : }
494 : else
495 : {
496 0 : if (bCatalogWildcard)
497 0 : sCatalog = sWildcard;
498 : else
499 0 : sCatalog = "";
500 0 : sCatalog += m_sCatalogSeparator;
501 0 : sCatalog += m_pTablesList->GetEntryText( pCatalog );
502 : }
503 : }
504 : }
505 0 : bSchemaWildcard = m_pTablesList->isWildcardChecked(pSchema);
506 0 : sComposedName += m_pTablesList->GetEntryText( pSchema );
507 0 : sComposedName += sDot;
508 : }
509 :
510 0 : if (bSchemaWildcard)
511 0 : sComposedName += sWildcard;
512 : }
513 0 : if (!bSchemaWildcard && !bCatalogWildcard)
514 0 : sComposedName += m_pTablesList->GetEntryText( pEntry );
515 :
516 0 : if (!m_bCatalogAtStart && !bCatalogWildcard)
517 0 : sComposedName += sCatalog;
518 :
519 : // need some space
520 0 : sal_Int32 nOldLen = aTableFilter.getLength();
521 0 : aTableFilter.realloc(nOldLen + 1);
522 : // add the new name
523 0 : aTableFilter[nOldLen] = sComposedName;
524 :
525 : // reset the composed name
526 0 : sComposedName = "";
527 : }
528 :
529 0 : if (bCatalogWildcard)
530 0 : pEntry = implNextSibling(pCatalog);
531 0 : else if (bSchemaWildcard)
532 0 : pEntry = implNextSibling(pSchema);
533 : else
534 0 : pEntry = m_pTablesList->GetModel()->Next(pEntry);
535 : }
536 :
537 0 : return aTableFilter;
538 : }
539 :
540 0 : SvTreeListEntry* OTableSubscriptionPage::implNextSibling(SvTreeListEntry* _pEntry) const
541 : {
542 0 : SvTreeListEntry* pReturn = NULL;
543 0 : if (_pEntry)
544 : {
545 0 : pReturn = m_pTablesList->NextSibling(_pEntry);
546 0 : if (!pReturn)
547 0 : pReturn = implNextSibling(m_pTablesList->GetParent(_pEntry));
548 : }
549 0 : return pReturn;
550 : }
551 :
552 0 : bool OTableSubscriptionPage::FillItemSet( SfxItemSet& _rCoreAttrs )
553 : {
554 : sal_Bool bValid, bReadonly;
555 0 : getFlags(_rCoreAttrs, bValid, bReadonly);
556 :
557 0 : if (!bValid || bReadonly)
558 : // don't store anything if the data we're working with is invalid or readonly
559 0 : return true;
560 :
561 : // create the output string which contains all the table names
562 0 : if ( m_xCurrentConnection.is() )
563 : { // collect the table filter data only if we have a connection - else no tables are displayed at all
564 0 : Sequence< OUString > aTableFilter;
565 0 : if (m_pTablesList->isWildcardChecked(m_pTablesList->getAllObjectsEntry()))
566 : {
567 0 : aTableFilter.realloc(1);
568 0 : aTableFilter[0] = "%";
569 : }
570 : else
571 : {
572 0 : aTableFilter = collectDetailedSelection();
573 : }
574 0 : _rCoreAttrs.Put( OStringListItem(DSID_TABLEFILTER, aTableFilter) );
575 : }
576 :
577 0 : return true;
578 : }
579 :
580 0 : void OTableSubscriptionPage::fillControls(::std::vector< ISaveValueWrapper* >& /*_rControlList*/)
581 : {
582 0 : }
583 :
584 0 : void OTableSubscriptionPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
585 : {
586 0 : _rControlList.push_back(new ODisableWrapper<VclContainer>(m_pTables));
587 0 : }
588 0 : } // namespace dbaui
589 :
590 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|