merged tag ooo/OOO330_m14
[LibreOffice.git] / extensions / source / bibliography / datman.cxx
blob9fa401a1620cb0b8c0fd8740cbd06914c011ee6f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_extensions.hxx"
30 #include <osl/mutex.hxx>
31 #include <tools/diagnose_ex.h>
32 #include <tools/urlobj.hxx>
33 #include <comphelper/processfactory.hxx>
34 #include <com/sun/star/io/XPersistObject.hpp>
35 #include <com/sun/star/sdbc/ResultSetType.hpp>
36 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
37 #include <com/sun/star/sdbc/XResultSetUpdate.hpp>
38 #include <com/sun/star/sdbcx/XRowLocate.hpp>
39 #include <com/sun/star/sdbc/DataType.hpp>
40 #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
41 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
42 #include <com/sun/star/sdb/XDatabaseEnvironment.hpp>
43 #include <com/sun/star/uno/XNamingService.hpp>
44 #include <com/sun/star/sdbc/XDataSource.hpp>
45 #include <com/sun/star/sdb/CommandType.hpp>
46 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
47 #include <com/sun/star/sdbc/XConnection.hpp>
48 #include <com/sun/star/sdb/XCompletedConnection.hpp>
49 #include <com/sun/star/task/XInteractionHandler.hpp>
50 #include <com/sun/star/form/XLoadable.hpp>
51 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
52 #include <com/sun/star/form/XGridColumnFactory.hpp>
53 #include <com/sun/star/io/XDataInputStream.hpp>
54 #include <com/sun/star/container/XNameContainer.hpp>
55 #include <com/sun/star/ucb/XContentProvider.hpp>
56 #include <com/sun/star/ucb/XContentAccess.hpp>
57 #include <ucbhelper/contentbroker.hxx>
58 #include <ucbhelper/content.hxx>
59 #include <ucbhelper/contentidentifier.hxx>
60 #include <comphelper/container.hxx>
61 #include <svl/urihelper.hxx>
62 #include <svtools/svtabbx.hxx>
63 #include <svtools/headbar.hxx>
64 #include <vcl/dialog.hxx>
65 #ifndef _SV_BUTTON_HXX
66 #include <vcl/button.hxx>
67 #endif
68 #include <vcl/lstbox.hxx>
69 #include <vcl/fixed.hxx>
70 #include <vcl/group.hxx>
71 #include <vcl/lstbox.hxx>
72 #include <vcl/edit.hxx>
73 #include <vcl/msgbox.hxx>
74 #include <tools/debug.hxx>
75 #include "datman.hxx"
76 #include "bibresid.hxx"
77 #include "bibmod.hxx"
78 #include "bibview.hxx"
79 // #100312# ---------
80 #include "bibbeam.hxx"
81 #include "bibprop.hrc"
82 #include "toolbar.hxx"
83 #include "toolbar.hrc"
84 #include "bibconfig.hxx"
85 #include "bibbeam.hxx"
86 #include "bib.hrc"
87 #include "datman.hrc"
88 #include "bibliography.hrc"
89 #include <connectivity/dbtools.hxx>
91 using namespace ::com::sun::star;
92 using namespace ::com::sun::star::beans;
93 using namespace ::com::sun::star::container;
94 using namespace ::com::sun::star::uno;
95 using namespace ::com::sun::star::sdb;
96 using namespace ::com::sun::star::sdbc;
97 using namespace ::com::sun::star::sdbcx;
98 using namespace ::com::sun::star::form;
99 using namespace ::com::sun::star::frame;
100 using namespace ::com::sun::star::ucb;
101 using namespace ::com::sun::star::lang;
102 using namespace ::ucb;
104 #define C2U(cChar) ::rtl::OUString::createFromAscii(cChar)
105 #define C2S(cChar) String::CreateFromAscii(cChar)
106 #define MAP_TOKEN ';'
107 #define PAIR_TOKEN ':'
110 /* -----------------17.01.00 14:38-------------------
112 --------------------------------------------------*/
113 Reference< XConnection > getConnection(const ::rtl::OUString& _rURL)
115 // first get the sdb::DataSource corresponding to the url
116 Reference< XDataSource > xDataSource;
117 // is it a favorite title ?
118 Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory();
119 Reference<XInterface> xNamingContextIfc = xMgr->createInstance(C2U("com.sun.star.sdb.DatabaseContext"));
120 Reference< XNameAccess > xNamingContext(xNamingContextIfc, UNO_QUERY);
121 if (xNamingContext.is() && xNamingContext->hasByName(_rURL))
123 DBG_ASSERT(Reference< XNamingService > (xNamingContext, UNO_QUERY).is(), "::getDataSource : no NamingService interface on the sdb::DatabaseAccessContext !");
126 xDataSource = Reference< XDataSource > (Reference< XNamingService > (xNamingContext, UNO_QUERY)->getRegisteredObject(_rURL), UNO_QUERY);
128 catch(Exception eEx)
130 (void) eEx; // make compiler happy
131 DBG_ERROR("Exception caught in ODatabaseContext::getRegisteredObject()");
134 // build the connection from the data source
135 Reference< XConnection > xConn;
136 if (xDataSource.is())
138 // need user/pwd for this
139 ::rtl::OUString sUser, sPwd;
140 Reference< XPropertySet > xDataSourceProps(xDataSource, UNO_QUERY);
141 Reference< XCompletedConnection > xComplConn(xDataSource, UNO_QUERY);
142 /* Reference< XPropertySetInfo > xInfo = xDataSourceProps.is() ? xDataSourceProps->getPropertySetInfo() : Reference< XPropertySetInfo > ();
143 if (xInfo.is() && xInfo->hasPropertyByName(C2U("User")))
144 xDataSourceProps->getPropertyValue(C2U("User")) >>= sUser;
145 if (xInfo.is() && xInfo->hasPropertyByName(C2U("Password")))
146 xDataSourceProps->getPropertyValue(C2U("Password"))>>= sPwd;
151 Reference<XInterface> xHdl = xMgr->createInstance(C2U("com.sun.star.task.InteractionHandler"));
152 Reference<task::XInteractionHandler> xIHdl(xHdl, UNO_QUERY);
153 xConn = xComplConn->connectWithCompletion(xIHdl);
154 // xConn = xDataSource->getConnection(sUser, sPwd);
156 catch(SQLException&)
158 // TODO : a real error handling
160 catch(Exception& e )
162 (void) e; // make compiler happy
166 return xConn;
169 /* -----------------17.01.00 14:46-------------------
171 --------------------------------------------------*/
172 Reference< XConnection > getConnection(const Reference< XInterface > & xRowSet)
174 Reference< XConnection > xConn;
177 Reference< XPropertySet > xFormProps(xRowSet, UNO_QUERY);
178 if (!xFormProps.is())
179 return xConn;
181 xConn = Reference< XConnection > (*(Reference< XInterface > *)xFormProps->getPropertyValue(C2U("ActiveConnection")).getValue(), UNO_QUERY);
182 if (!xConn.is())
184 DBG_WARNING("no active connection");
187 catch(Exception& e )
189 (void) e; // make compiler happy
190 DBG_ERROR("exception in getConnection");
193 return xConn;
195 /* -----------------17.01.00 16:07-------------------
197 --------------------------------------------------*/
198 Reference< XNameAccess > getColumns(const Reference< XForm > & _rxForm)
200 Reference< XNameAccess > xReturn;
201 // check if the form is alive
202 Reference< XColumnsSupplier > xSupplyCols( _rxForm, UNO_QUERY );
203 if (xSupplyCols.is())
204 xReturn = xSupplyCols->getColumns();
206 if (!xReturn.is() || (xReturn->getElementNames().getLength() == 0))
207 { // no ....
208 xReturn = NULL;
209 // -> get the table the form is bound to and ask it for their columns
210 Reference< XTablesSupplier > xSupplyTables( getConnection( _rxForm ), UNO_QUERY );
211 Reference< XPropertySet > xFormProps( _rxForm, UNO_QUERY );
212 if (xFormProps.is() && xSupplyTables.is())
216 DBG_ASSERT((*(sal_Int32*)xFormProps->getPropertyValue(C2U("CommandType")).getValue()) == CommandType::TABLE,
217 "::getColumns : invalid form (has no table as data source) !");
218 ::rtl::OUString sTable;
219 xFormProps->getPropertyValue(C2U("Command")) >>= sTable;
220 Reference< XNameAccess > xTables = xSupplyTables->getTables();
221 if (xTables.is() && xTables->hasByName(sTable))
222 xSupplyCols = Reference< XColumnsSupplier > (
223 *(Reference< XInterface > *)xTables->getByName(sTable).getValue(), UNO_QUERY);
224 if (xSupplyCols.is())
225 xReturn = xSupplyCols->getColumns();
227 #ifdef DBG_UTIL
228 catch(Exception& e )
229 #else
230 catch(Exception&)
231 #endif
233 #ifdef DBG_UTIL
234 String sMsg(String::CreateFromAscii("::getColumns : catched an exception ("));
235 sMsg += String(e.Message);
236 sMsg.AppendAscii(") ...");
237 DBG_ERROR( ByteString(sMsg, RTL_TEXTENCODING_ASCII_US ).GetBuffer());
238 #endif
243 return xReturn;
246 /* -----------------11.11.99 15:54-------------------
248 --------------------------------------------------*/
249 class MappingDialog_Impl : public ModalDialog
251 BibDataManager* pDatMan;
252 OKButton aOKBT;
253 CancelButton aCancelBT;
254 HelpButton aHelpBT;
255 FixedLine aMapGB;
256 FixedText aIdentifierFT;
257 ListBox aIdentifierLB;
258 FixedText aAuthorityTypeFT;
259 ListBox aAuthorityTypeLB;
260 FixedText aAuthorFT;
261 ListBox aAuthorLB;
262 FixedText aTitleFT;
263 ListBox aTitleLB;
264 FixedText aMonthFT;
265 ListBox aMonthLB;
266 FixedText aYearFT;
267 ListBox aYearLB;
268 FixedText aISBNFT;
269 ListBox aISBNLB;
270 FixedText aBooktitleFT;
271 ListBox aBooktitleLB;
272 FixedText aChapterFT;
273 ListBox aChapterLB;
274 FixedText aEditionFT;
275 ListBox aEditionLB;
276 FixedText aEditorFT;
277 ListBox aEditorLB;
278 FixedText aHowpublishedFT;
279 ListBox aHowpublishedLB;
280 FixedText aInstitutionFT;
281 ListBox aInstitutionLB;
282 FixedText aJournalFT;
283 ListBox aJournalLB;
284 FixedText aNoteFT;
285 ListBox aNoteLB;
286 FixedText aAnnoteFT;
287 ListBox aAnnoteLB;
288 FixedText aNumberFT;
289 ListBox aNumberLB;
290 FixedText aOrganizationsFT;
291 ListBox aOrganizationsLB;
292 FixedText aPagesFT;
293 ListBox aPagesLB;
294 FixedText aPublisherFT;
295 ListBox aPublisherLB;
296 FixedText aAddressFT;
297 ListBox aAddressLB;
298 FixedText aSchoolFT;
299 ListBox aSchoolLB;
300 FixedText aSeriesFT;
301 ListBox aSeriesLB;
302 FixedText aReportTypeFT;
303 ListBox aReportTypeLB;
304 FixedText aVolumeFT;
305 ListBox aVolumeLB;
306 FixedText aURLFT;
307 ListBox aURLLB;
308 FixedText aCustom1FT;
309 ListBox aCustom1LB;
310 FixedText aCustom2FT;
311 ListBox aCustom2LB;
312 FixedText aCustom3FT;
313 ListBox aCustom3LB;
314 FixedText aCustom4FT;
315 ListBox aCustom4LB;
316 FixedText aCustom5FT;
317 ListBox aCustom5LB;
318 ListBox* aListBoxes[COLUMN_COUNT];
319 String sNone;
321 sal_Bool bModified;
325 DECL_LINK(OkHdl, OKButton*);
326 DECL_LINK(ListBoxSelectHdl, ListBox*);
328 public:
329 MappingDialog_Impl(Window* pParent, BibDataManager* pDatMan);
330 ~MappingDialog_Impl();
332 void SetModified() {bModified = TRUE;}
335 /* -----------------11.11.99 16:42-------------------
337 --------------------------------------------------*/
338 sal_uInt16 lcl_FindLogicalName(BibConfig* pConfig ,
339 const ::rtl::OUString& rLogicalColumnName)
341 for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++)
343 if(rLogicalColumnName == pConfig->GetDefColumnName(i))
344 return i;
346 return USHRT_MAX;
348 //-----------------------------------------------------------------------------
349 MappingDialog_Impl::MappingDialog_Impl(Window* pParent, BibDataManager* pMan) :
350 ModalDialog(pParent, BibResId(RID_DLG_MAPPING) ),
351 pDatMan(pMan),
352 aOKBT(this, BibResId( BT_OK )),
353 aCancelBT(this, BibResId( BT_CANCEL )),
354 aHelpBT(this, BibResId( BT_HELP )),
356 aMapGB(this, BibResId( GB_MAPPING )),
358 aIdentifierFT(this, BibResId( FT_IDENTIFIER )),
359 aIdentifierLB(this, BibResId( LB_IDENTIFIER )),
360 aAuthorityTypeFT(this, BibResId( FT_AUTHORITYTYPE )),
361 aAuthorityTypeLB(this, BibResId( LB_AUTHORITYTYPE )),
362 aAuthorFT(this, BibResId( FT_AUTHOR )),
363 aAuthorLB(this, BibResId( LB_AUTHOR )),
364 aTitleFT(this, BibResId( FT_TITLE )),
365 aTitleLB(this, BibResId( LB_TITLE )),
366 aMonthFT(this, BibResId( FT_MONTH )),
367 aMonthLB(this, BibResId( LB_MONTH )),
368 aYearFT(this, BibResId( FT_YEAR )),
369 aYearLB(this, BibResId( LB_YEAR )),
370 aISBNFT(this, BibResId( FT_ISBN )),
371 aISBNLB(this, BibResId( LB_ISBN )),
372 aBooktitleFT(this, BibResId( FT_BOOKTITLE )),
373 aBooktitleLB(this, BibResId( LB_BOOKTITLE )),
374 aChapterFT(this, BibResId( FT_CHAPTER )),
375 aChapterLB(this, BibResId( LB_CHAPTER )),
376 aEditionFT(this, BibResId( FT_EDITION )),
377 aEditionLB(this, BibResId( LB_EDITION )),
378 aEditorFT(this, BibResId( FT_EDITOR )),
379 aEditorLB(this, BibResId( LB_EDITOR )),
380 aHowpublishedFT(this, BibResId( FT_HOWPUBLISHED )),
381 aHowpublishedLB(this, BibResId( LB_HOWPUBLISHED )),
382 aInstitutionFT(this, BibResId( FT_INSTITUTION )),
383 aInstitutionLB(this, BibResId( LB_INSTITUTION )),
384 aJournalFT(this, BibResId( FT_JOURNAL )),
385 aJournalLB(this, BibResId( LB_JOURNAL )),
386 aNoteFT(this, BibResId( FT_NOTE )),
387 aNoteLB(this, BibResId( LB_NOTE )),
388 aAnnoteFT(this, BibResId( FT_ANNOTE )),
389 aAnnoteLB(this, BibResId( LB_ANNOTE )),
390 aNumberFT(this, BibResId( FT_NUMBER )),
391 aNumberLB(this, BibResId( LB_NUMBER )),
392 aOrganizationsFT(this, BibResId( FT_ORGANIZATIONS )),
393 aOrganizationsLB(this, BibResId( LB_ORGANIZATIONS )),
394 aPagesFT(this, BibResId( FT_PAGES )),
395 aPagesLB(this, BibResId( LB_PAGES )),
396 aPublisherFT(this, BibResId( FT_PUBLISHER )),
397 aPublisherLB(this, BibResId( LB_PUBLISHER )),
398 aAddressFT(this, BibResId( FT_ADDRESS )),
399 aAddressLB(this, BibResId( LB_ADDRESS )),
400 aSchoolFT(this, BibResId( FT_SCHOOL )),
401 aSchoolLB(this, BibResId( LB_SCHOOL )),
402 aSeriesFT(this, BibResId( FT_SERIES )),
403 aSeriesLB(this, BibResId( LB_SERIES )),
404 aReportTypeFT(this, BibResId( FT_REPORTTYPE )),
405 aReportTypeLB(this, BibResId( LB_REPORTTYPE )),
406 aVolumeFT(this, BibResId( FT_VOLUME )),
407 aVolumeLB(this, BibResId( LB_VOLUME )),
408 aURLFT(this, BibResId( FT_URL )),
409 aURLLB(this, BibResId( LB_URL )),
410 aCustom1FT(this, BibResId( FT_CUSTOM1 )),
411 aCustom1LB(this, BibResId( LB_CUSTOM1 )),
412 aCustom2FT(this, BibResId( FT_CUSTOM2 )),
413 aCustom2LB(this, BibResId( LB_CUSTOM2 )),
414 aCustom3FT(this, BibResId( FT_CUSTOM3 )),
415 aCustom3LB(this, BibResId( LB_CUSTOM3 )),
416 aCustom4FT(this, BibResId( FT_CUSTOM4 )),
417 aCustom4LB(this, BibResId( LB_CUSTOM4 )),
418 aCustom5FT(this, BibResId( FT_CUSTOM5 )),
419 aCustom5LB(this, BibResId( LB_CUSTOM5 )),
420 sNone(BibResId(ST_NONE)),
421 bModified(sal_False)
423 FreeResource();
425 aIdentifierFT.SetText(String( BibResId( ST_IDENTIFIER )));
426 aAuthorityTypeFT.SetText(String( BibResId( ST_AUTHTYPE )));
427 aAuthorFT.SetText(String( BibResId( ST_AUTHOR )));
428 aTitleFT.SetText(String( BibResId( ST_TITLE )));
429 aMonthFT.SetText(String( BibResId( ST_MONTH )));
430 aYearFT.SetText(String( BibResId( ST_YEAR )));
431 aISBNFT.SetText(String( BibResId( ST_ISBN )));
432 aBooktitleFT.SetText(String( BibResId( ST_BOOKTITLE )));
433 aChapterFT.SetText(String( BibResId( ST_CHAPTER )));
434 aEditionFT.SetText(String( BibResId( ST_EDITION )));
435 aEditorFT.SetText(String( BibResId( ST_EDITOR )));
436 aHowpublishedFT.SetText(String( BibResId( ST_HOWPUBLISHED )));
437 aInstitutionFT.SetText(String( BibResId( ST_INSTITUTION )));
438 aJournalFT.SetText(String( BibResId( ST_JOURNAL )));
439 aNoteFT.SetText(String( BibResId( ST_NOTE )));
440 aAnnoteFT.SetText(String( BibResId( ST_ANNOTE )));
441 aNumberFT.SetText(String( BibResId( ST_NUMBER )));
442 aOrganizationsFT.SetText(String( BibResId( ST_ORGANIZATION )));
443 aPagesFT.SetText(String( BibResId( ST_PAGE )));
444 aPublisherFT.SetText(String( BibResId( ST_PUBLISHER )));
445 aAddressFT.SetText(String( BibResId( ST_ADDRESS )));
446 aSchoolFT.SetText(String( BibResId( ST_SCHOOL )));
447 aSeriesFT.SetText(String( BibResId( ST_SERIES )));
448 aReportTypeFT.SetText(String( BibResId( ST_REPORT )));
449 aVolumeFT.SetText(String( BibResId( ST_VOLUME )));
450 aURLFT.SetText(String( BibResId( ST_URL )));
451 aCustom1FT.SetText(String( BibResId( ST_CUSTOM1 )));
452 aCustom2FT.SetText(String( BibResId( ST_CUSTOM2 )));
453 aCustom3FT.SetText(String( BibResId( ST_CUSTOM3 )));
454 aCustom4FT.SetText(String( BibResId( ST_CUSTOM4 )));
455 aCustom5FT.SetText(String( BibResId( ST_CUSTOM5 )));
457 aOKBT.SetClickHdl(LINK(this, MappingDialog_Impl, OkHdl));
458 String sTitle = GetText();
459 sTitle.SearchAndReplace(C2S("%1"), pDatMan->getActiveDataTable(), 0);
460 SetText(sTitle);
462 aListBoxes[0] = &aIdentifierLB;
463 aListBoxes[1] = &aAuthorityTypeLB;
464 aListBoxes[2] = &aAuthorLB;
465 aListBoxes[3] = &aTitleLB;
466 aListBoxes[4] = &aYearLB;
467 aListBoxes[5] = &aISBNLB;
468 aListBoxes[6] = &aBooktitleLB;
469 aListBoxes[7] = &aChapterLB;
470 aListBoxes[8] = &aEditionLB;
471 aListBoxes[9] = &aEditorLB;
472 aListBoxes[10] = &aHowpublishedLB;
473 aListBoxes[11] = &aInstitutionLB;
474 aListBoxes[12] = &aJournalLB;
475 aListBoxes[13] = &aMonthLB;
476 aListBoxes[14] = &aNoteLB;
477 aListBoxes[15] = &aAnnoteLB;
478 aListBoxes[16] = &aNumberLB;
479 aListBoxes[17] = &aOrganizationsLB;
480 aListBoxes[18] = &aPagesLB;
481 aListBoxes[19] = &aPublisherLB;
482 aListBoxes[20] = &aAddressLB;
483 aListBoxes[21] = &aSchoolLB;
484 aListBoxes[22] = &aSeriesLB;
485 aListBoxes[23] = &aReportTypeLB;
486 aListBoxes[24] = &aVolumeLB;
487 aListBoxes[25] = &aURLLB;
488 aListBoxes[26] = &aCustom1LB;
489 aListBoxes[27] = &aCustom2LB;
490 aListBoxes[28] = &aCustom3LB;
491 aListBoxes[29] = &aCustom4LB;
492 aListBoxes[30] = &aCustom5LB;
494 aListBoxes[0]->InsertEntry(sNone);
495 Reference< XNameAccess > xFields = getColumns( pDatMan->getForm() );
496 DBG_ASSERT(xFields.is(), "MappingDialog_Impl::MappingDialog_Impl : gave me an invalid form !");
497 if(xFields.is())
499 Sequence< ::rtl::OUString > aNames = xFields->getElementNames();
500 sal_Int32 nFieldsCount = aNames.getLength();
501 const ::rtl::OUString* pNames = aNames.getConstArray();
503 for(sal_Int32 nField = 0; nField < nFieldsCount; nField++)
504 aListBoxes[0]->InsertEntry(pNames[nField]);
507 Link aLnk = LINK(this, MappingDialog_Impl, ListBoxSelectHdl);
509 aListBoxes[0]->SelectEntryPos(0);
510 aListBoxes[0]->SetSelectHdl(aLnk);
511 for(sal_uInt16 i = 1; i < COLUMN_COUNT; i++)
513 for(sal_uInt16 j = 0; j < aListBoxes[0]->GetEntryCount();j++)
514 aListBoxes[i]->InsertEntry(aListBoxes[0]->GetEntry(j));
515 aListBoxes[i]->SelectEntryPos(0);
516 aListBoxes[i]->SetSelectHdl(aLnk);
518 BibConfig* pConfig = BibModul::GetConfig();
519 BibDBDescriptor aDesc;
520 aDesc.sDataSource = pDatMan->getActiveDataSource();
521 aDesc.sTableOrQuery = pDatMan->getActiveDataTable();
522 aDesc.nCommandType = CommandType::TABLE;
523 const Mapping* pMapping = pConfig->GetMapping(aDesc);
524 if(pMapping)
526 for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
528 sal_uInt16 nListBoxIndex = lcl_FindLogicalName( pConfig, pMapping->aColumnPairs[nEntry].sLogicalColumnName);
529 if(nListBoxIndex < COLUMN_COUNT)
531 aListBoxes[nListBoxIndex]->SelectEntry(pMapping->aColumnPairs[nEntry].sRealColumnName);
536 /* -----------------11.11.99 16:44-------------------
538 --------------------------------------------------*/
539 MappingDialog_Impl::~MappingDialog_Impl()
541 /* -----------------15.11.99 10:38-------------------
543 --------------------------------------------------*/
544 IMPL_LINK(MappingDialog_Impl, ListBoxSelectHdl, ListBox*, pListBox)
546 sal_uInt16 nEntryPos = pListBox->GetSelectEntryPos();
547 if(0 < nEntryPos)
549 for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++)
551 if(pListBox != aListBoxes[i] && aListBoxes[i]->GetSelectEntryPos() == nEntryPos)
552 aListBoxes[i]->SelectEntryPos(0);
555 SetModified();
556 return 0;
558 /* -----------------12.11.99 14:50-------------------
560 --------------------------------------------------*/
561 IMPL_LINK(MappingDialog_Impl, OkHdl, OKButton*, EMPTYARG)
563 if(bModified)
565 Mapping aNew;
566 aNew.sTableName = String(pDatMan->getActiveDataTable());
567 aNew.sURL = String(pDatMan->getActiveDataSource());
569 sal_uInt16 nWriteIndex = 0;
570 BibConfig* pConfig = BibModul::GetConfig();
571 for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
573 String sSel = aListBoxes[nEntry]->GetSelectEntry();
574 if(sSel != sNone)
576 aNew.aColumnPairs[nWriteIndex].sRealColumnName = sSel;
577 aNew.aColumnPairs[nWriteIndex].sLogicalColumnName = pConfig->GetDefColumnName(nEntry);
578 nWriteIndex++;
581 BibDBDescriptor aDesc;
582 aDesc.sDataSource = pDatMan->getActiveDataSource();
583 aDesc.sTableOrQuery = pDatMan->getActiveDataTable();
584 aDesc.nCommandType = CommandType::TABLE;
585 pDatMan->ResetIdentifierMapping();
586 pConfig->SetMapping(aDesc, &aNew);
588 EndDialog(bModified ? RET_OK : RET_CANCEL);
589 return 0;
591 /* -----------------18.11.99 10:23-------------------
593 --------------------------------------------------*/
594 class DBChangeDialog_Impl : public ModalDialog
596 OKButton aOKBT;
597 CancelButton aCancelBT;
598 HelpButton aHelpBT;
599 FixedLine aSelectionGB;
600 SvTabListBox aSelectionLB;
601 HeaderBar aSelectionHB;
602 DBChangeDialogConfig_Impl aConfig;
603 String aEntryST;
604 String aURLST;
606 BibDataManager* pDatMan;
608 // DECL_LINK(EndDragHdl, HeaderBar*);
609 DECL_LINK(DoubleClickHdl, SvTabListBox*);
610 public:
611 DBChangeDialog_Impl(Window* pParent, BibDataManager* pMan );
612 ~DBChangeDialog_Impl();
614 String GetCurrentURL()const;
617 /*-- 18.11.99 10:35:20---------------------------------------------------
619 -----------------------------------------------------------------------*/
620 DBChangeDialog_Impl::DBChangeDialog_Impl(Window* pParent, BibDataManager* pMan ) :
621 ModalDialog(pParent, BibResId(RID_DLG_DBCHANGE) ),
622 aOKBT(this, BibResId( BT_OK )),
623 aCancelBT(this, BibResId( BT_CANCEL )),
624 aHelpBT(this, BibResId( BT_HELP )),
625 aSelectionGB(this, BibResId( GB_SELECTION )),
626 aSelectionLB(this, BibResId( LB_SELECTION )),
627 aSelectionHB(this, BibResId( HB_SELECTION )),
628 aEntryST(BibResId(ST_ENTRY)),
629 aURLST( BibResId(ST_URL)),
630 pDatMan(pMan)
632 FreeResource();
633 aSelectionLB.SetDoubleClickHdl( LINK(this, DBChangeDialog_Impl, DoubleClickHdl));
636 Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory();
638 ::Size aSize = aSelectionHB.GetSizePixel();
639 long nTabs[2];
640 nTabs[0] = 1;// Number of Tabs
641 nTabs[1] = aSize.Width() / 4;
643 aSelectionHB.SetStyle(aSelectionHB.GetStyle()|WB_STDHEADERBAR);
644 aSelectionHB.InsertItem( 1, aEntryST, aSize.Width());
645 aSelectionHB.SetSizePixel(aSelectionHB.CalcWindowSizePixel());
646 aSelectionHB.Show();
648 aSelectionLB.SetTabs( &nTabs[0], MAP_PIXEL );
649 aSelectionLB.SetWindowBits(WB_CLIPCHILDREN|WB_SORT);
650 aSelectionLB.GetModel()->SetSortMode(SortAscending);
652 ::rtl::OUString sActiveSource = pDatMan->getActiveDataSource();
653 const Sequence< ::rtl::OUString >& rSources = aConfig.GetDataSourceNames();
654 const ::rtl::OUString* pSourceNames = rSources.getConstArray();
655 for(int i = 0; i < rSources.getLength(); i++)
657 SvLBoxEntry* pEntry = aSelectionLB.InsertEntry(pSourceNames[i]);
658 if(pSourceNames[i] == sActiveSource)
660 aSelectionLB.Select(pEntry);
663 aSelectionLB.GetModel()->Resort();
665 catch(Exception& e )
667 (void) e; // make compiler happy
668 DBG_ERROR("Exception in BibDataManager::DBChangeDialog_Impl::DBChangeDialog_Impl");
673 /* -----------------06.12.99 12:09-------------------
675 --------------------------------------------------*/
676 IMPL_LINK(DBChangeDialog_Impl, DoubleClickHdl, SvTabListBox*, /*pLB*/)
678 EndDialog(RET_OK);
679 return 0;
681 /* -----------------18.11.99 11:17-------------------
683 --------------------------------------------------*/
684 /*IMPL_LINK(DBChangeDialog_Impl, EndDragHdl, HeaderBar*, pHB)
686 long nTabs[3];
687 nTabs[0] = 2;// Number of Tabs
688 nTabs[1] = 0;
689 nTabs[2] = pHB->GetItemSize( 1 );
690 aSelectionLB.SetTabs( &nTabs[0], MAP_PIXEL );
691 return 0;
692 };*/
694 /*-- 18.11.99 10:35:20---------------------------------------------------
696 -----------------------------------------------------------------------*/
697 DBChangeDialog_Impl::~DBChangeDialog_Impl()
700 /* -----------------18.11.99 12:36-------------------
702 --------------------------------------------------*/
703 String DBChangeDialog_Impl::GetCurrentURL()const
705 String sRet;
706 SvLBoxEntry* pEntry = aSelectionLB.FirstSelected();
707 if(pEntry)
709 sRet = aSelectionLB.GetEntryText(pEntry, 0);
711 return sRet;
714 // #100312# --------------------------------------------------------------------
715 // XDispatchProvider
716 BibInterceptorHelper::BibInterceptorHelper( ::bib::BibBeamer* pBibBeamer, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch)
718 if( pBibBeamer )
720 xInterception = pBibBeamer->getDispatchProviderInterception();
721 if( xInterception.is() )
722 xInterception->registerDispatchProviderInterceptor( this );
724 if( xDispatch.is() )
725 xFormDispatch = xDispatch;
728 BibInterceptorHelper::~BibInterceptorHelper( )
732 void BibInterceptorHelper::ReleaseInterceptor()
734 if ( xInterception.is() )
735 xInterception->releaseDispatchProviderInterceptor( this );
736 xInterception.clear();
739 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL
740 BibInterceptorHelper::queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw (::com::sun::star::uno::RuntimeException)
742 Reference< XDispatch > xReturn;
744 String aCommand( aURL.Path );
745 if ( aCommand.EqualsAscii("FormSlots/ConfirmDeletion") )
746 xReturn = xFormDispatch;
747 else
748 if ( xSlaveDispatchProvider.is() )
749 xReturn = xSlaveDispatchProvider->queryDispatch( aURL, aTargetFrameName, nSearchFlags);
751 return xReturn;
754 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL
755 BibInterceptorHelper::queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw (::com::sun::star::uno::RuntimeException)
757 Sequence< Reference< XDispatch> > aReturn( aDescripts.getLength() );
758 Reference< XDispatch >* pReturn = aReturn.getArray();
759 const DispatchDescriptor* pDescripts = aDescripts.getConstArray();
760 for ( sal_Int16 i=0; i<aDescripts.getLength(); ++i, ++pReturn, ++pDescripts )
762 *pReturn = queryDispatch( pDescripts->FeatureURL, pDescripts->FrameName, pDescripts->SearchFlags );
764 return aReturn;
767 // XDispatchProviderInterceptor
768 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL
769 BibInterceptorHelper::getSlaveDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException)
771 return xSlaveDispatchProvider;
774 void SAL_CALL BibInterceptorHelper::setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSlaveDispatchProvider ) throw (::com::sun::star::uno::RuntimeException)
776 xSlaveDispatchProvider = xNewSlaveDispatchProvider;
779 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL
780 BibInterceptorHelper::getMasterDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException)
782 return xMasterDispatchProvider;
785 void SAL_CALL BibInterceptorHelper::setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewMasterDispatchProvider ) throw (::com::sun::star::uno::RuntimeException)
787 xMasterDispatchProvider = xNewMasterDispatchProvider;
790 //-----------------------------------------------------------------------------
791 #define STR_UID "uid"
792 ::rtl::OUString gGridName(C2U("theGrid"));
793 ::rtl::OUString gViewName(C2U("theView"));
794 ::rtl::OUString gGlobalName(C2U("theGlobals"));
795 ::rtl::OUString gBeamerSize(C2U("theBeamerSize"));
796 ::rtl::OUString gViewSize(C2U("theViewSize"));
798 BibDataManager::BibDataManager()
799 :BibDataManager_Base( GetMutex() )
800 // #100312# --------------
801 ,m_pInterceptorHelper( NULL )
802 ,m_aLoadListeners(m_aMutex)
803 ,pBibView( NULL )
804 ,pToolbar(0)
808 /* --------------------------------------------------
810 --------------------------------------------------*/
811 BibDataManager::~BibDataManager()
813 Reference< XLoadable > xLoad( m_xForm, UNO_QUERY );
814 Reference< XPropertySet > xPrSet( m_xForm, UNO_QUERY );
815 Reference< XComponent > xComp( m_xForm, UNO_QUERY );
816 if ( m_xForm.is() )
818 Reference< XComponent > xConnection;
819 xPrSet->getPropertyValue(C2U("ActiveConnection")) >>= xConnection;
820 RemoveMeAsUidListener();
821 if (xLoad.is())
822 xLoad->unload();
823 if (xComp.is())
824 xComp->dispose();
825 if(xConnection.is())
826 xConnection->dispose();
827 m_xForm = NULL;
829 // #100312# ----------------
830 if( m_pInterceptorHelper )
832 m_pInterceptorHelper->ReleaseInterceptor();
833 m_pInterceptorHelper->release();
834 m_pInterceptorHelper = NULL;
837 //------------------------------------------------------------------------
838 void BibDataManager::InsertFields(const Reference< XFormComponent > & _rxGrid)
840 if ( !_rxGrid.is() )
841 return;
845 Reference< XNameContainer > xColContainer( _rxGrid, UNO_QUERY );
846 // remove the old fields
847 if ( xColContainer->hasElements() )
849 Sequence< ::rtl::OUString > aNames = xColContainer->getElementNames();
850 const ::rtl::OUString* pNames = aNames.getConstArray();
851 const ::rtl::OUString* pNamesEnd = pNames + aNames.getLength();
852 for ( ; pNames != pNamesEnd; ++pNames )
853 xColContainer->removeByName( *pNames );
856 Reference< XNameAccess > xFields = getColumns( m_xForm );
857 if (!xFields.is())
858 return;
860 Reference< XGridColumnFactory > xColFactory( _rxGrid, UNO_QUERY );
862 Reference< XPropertySet > xField;
864 Sequence< ::rtl::OUString > aFields( xFields->getElementNames() );
865 const ::rtl::OUString* pFields = aFields.getConstArray();
866 const ::rtl::OUString* pFieldsEnd = pFields + aFields.getLength();
868 for ( ; pFields != pFieldsEnd; ++pFields )
870 xFields->getByName( *pFields ) >>= xField;
872 ::rtl::OUString sCurrentModelType;
873 const ::rtl::OUString sType(C2U("Type"));
874 sal_Int32 nType = 0;
875 sal_Bool bIsFormatted = sal_False;
876 sal_Bool bFormattedIsNumeric = sal_True;
877 xField->getPropertyValue(sType) >>= nType;
878 switch(nType)
880 case DataType::BIT:
881 case DataType::BOOLEAN:
882 sCurrentModelType = C2U("CheckBox");
883 break;
885 case DataType::BINARY:
886 case DataType::VARBINARY:
887 case DataType::LONGVARBINARY:
888 case DataType::BLOB:
889 sCurrentModelType = C2U("TextField");
890 break;
892 case DataType::VARCHAR:
893 case DataType::LONGVARCHAR:
894 case DataType::CHAR:
895 case DataType::CLOB:
896 bFormattedIsNumeric = sal_False;
897 // _NO_ break !
898 default:
899 sCurrentModelType = C2U("FormattedField");
900 bIsFormatted = sal_True;
901 break;
904 Reference< XPropertySet > xCurrentCol = xColFactory->createColumn(sCurrentModelType);
905 if (bIsFormatted)
907 ::rtl::OUString sFormatKey(C2U("FormatKey"));
908 xCurrentCol->setPropertyValue(sFormatKey, xField->getPropertyValue(sFormatKey));
909 Any aFormatted(&bFormattedIsNumeric, ::getBooleanCppuType());
910 xCurrentCol->setPropertyValue(C2U("TreatAsNumber"), aFormatted);
912 Any aColName = makeAny( *pFields );
913 xCurrentCol->setPropertyValue(FM_PROP_CONTROLSOURCE, aColName);
914 xCurrentCol->setPropertyValue(FM_PROP_LABEL, aColName);
916 xColContainer->insertByName( *pFields, makeAny( xCurrentCol ) );
919 catch(Exception& e )
921 (void) e; // make compiler happy
922 DBG_ERROR("Exception in BibDataManager::InsertFields");
925 /* --------------------------------------------------
927 --------------------------------------------------*/
928 Reference< awt::XControlModel > BibDataManager::updateGridModel()
930 return updateGridModel( m_xForm );
932 /* --------------------------------------------------
934 --------------------------------------------------*/
935 Reference< awt::XControlModel > BibDataManager::updateGridModel(const Reference< XForm > & xDbForm)
939 Reference< XPropertySet > aFormPropSet( xDbForm, UNO_QUERY );
940 ::rtl::OUString sName;
941 aFormPropSet->getPropertyValue(C2U("Command")) >>= sName;
943 if ( !m_xGridModel.is() )
945 m_xGridModel = createGridModel( gGridName );
947 Reference< XNameContainer > xNameCont(xDbForm, UNO_QUERY);
948 // if (xNameCont->hasByName(sName))
949 // xNameCont->removeByName(sName);
951 xNameCont->insertByName( sName, makeAny( m_xGridModel ) );
954 // insert the fields
955 Reference< XFormComponent > xFormComp( m_xGridModel, UNO_QUERY );
956 InsertFields( xFormComp );
958 catch(Exception& e )
960 (void) e; // make compiler happy
961 DBG_ERROR("::updateGridModel: something went wrong !");
965 return m_xGridModel;
967 /* --------------------------------------------------
969 --------------------------------------------------*/
970 Reference< XForm > BibDataManager::createDatabaseForm(BibDBDescriptor& rDesc)
972 Reference< XForm > xResult;
975 Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory();
976 m_xForm = Reference< XForm > ( xMgr->createInstance( C2U("com.sun.star.form.component.Form") ), UNO_QUERY );
978 Reference< XPropertySet > aPropertySet( m_xForm, UNO_QUERY );
980 aDataSourceURL = rDesc.sDataSource;
981 if(aPropertySet.is())
983 Any aVal;
984 aVal <<= (sal_Int32)ResultSetType::SCROLL_INSENSITIVE;
985 aPropertySet->setPropertyValue(C2U("ResultSetType"),aVal );
986 aVal <<= (sal_Int32)ResultSetConcurrency::READ_ONLY;
987 aPropertySet->setPropertyValue(C2U("ResultSetConcurrency"), aVal);
989 //Caching for Performance
990 aVal <<= (sal_Int32)50;
991 aPropertySet->setPropertyValue(C2U("FetchSize"), aVal);
993 Reference< XConnection > xConnection = getConnection(rDesc.sDataSource);
994 aVal <<= xConnection;
995 aPropertySet->setPropertyValue(C2U("ActiveConnection"), aVal);
997 Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY);
998 Reference< XNameAccess > xTables = xSupplyTables.is() ?
999 xSupplyTables->getTables() : Reference< XNameAccess > ();
1001 Sequence< ::rtl::OUString > aTableNameSeq;
1002 if (xTables.is())
1003 aTableNameSeq = xTables->getElementNames();
1005 if(aTableNameSeq.getLength() > 0)
1007 const ::rtl::OUString* pTableNames = aTableNameSeq.getConstArray();
1008 if(rDesc.sTableOrQuery.getLength())
1009 aActiveDataTable = rDesc.sTableOrQuery;
1010 else
1012 rDesc.sTableOrQuery = aActiveDataTable = pTableNames[0];
1013 rDesc.nCommandType = CommandType::TABLE;
1016 aVal <<= aActiveDataTable;
1017 aPropertySet->setPropertyValue(C2U("Command"), aVal);
1018 aVal <<= rDesc.nCommandType;
1019 aPropertySet->setPropertyValue(C2U("CommandType"), aVal);
1022 Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
1023 aQuoteChar = xMetaData->getIdentifierQuoteString();
1025 Reference< XMultiServiceFactory > xFactory(xConnection, UNO_QUERY);
1026 if ( xFactory.is() )
1027 m_xParser.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.SingleSelectQueryComposer" ) ) ), UNO_QUERY );
1029 ::rtl::OUString aString(C2U("SELECT * FROM "));
1031 ::rtl::OUString sCatalog, sSchema, sName;
1032 ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::eInDataManipulation );
1033 aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName );
1035 m_xParser->setElementaryQuery(aString);
1036 BibConfig* pConfig = BibModul::GetConfig();
1037 pConfig->setQueryField(getQueryField());
1038 startQueryWith(pConfig->getQueryText());
1040 xResult = m_xForm;
1044 catch(Exception& e )
1046 (void) e; // make compiler happy
1047 DBG_ERROR("::createDatabaseForm: something went wrong !");
1051 return xResult;
1053 //------------------------------------------------------------------------
1054 Sequence< ::rtl::OUString > BibDataManager::getDataSources()
1056 Sequence< ::rtl::OUString > aTableNameSeq;
1060 Reference< XTablesSupplier > xSupplyTables( getConnection( m_xForm ), UNO_QUERY );
1061 Reference< XNameAccess > xTables;
1062 if (xSupplyTables.is())
1063 xTables = xSupplyTables->getTables();
1064 if (xTables.is())
1065 aTableNameSeq = xTables->getElementNames();
1067 catch(Exception& e )
1069 (void) e; // make compiler happy
1070 DBG_ERROR("::getDataSources: something went wrong !");
1074 return aTableNameSeq;
1076 //------------------------------------------------------------------------
1077 ::rtl::OUString BibDataManager::getActiveDataTable()
1079 return aActiveDataTable;
1081 //------------------------------------------------------------------------
1082 void BibDataManager::setFilter(const ::rtl::OUString& rQuery)
1084 if(!m_xParser.is())
1085 return;
1088 m_xParser->setFilter( rQuery );
1089 ::rtl::OUString aQuery = m_xParser->getFilter();
1090 Reference< XPropertySet > xFormProps( m_xForm, UNO_QUERY_THROW );
1091 xFormProps->setPropertyValue( C2U( "Filter" ), makeAny( aQuery ) );
1092 xFormProps->setPropertyValue( C2U( "ApplyFilter" ), makeAny( sal_True ) );
1093 reload();
1095 catch(Exception& e )
1097 DBG_UNHANDLED_EXCEPTION();
1102 //------------------------------------------------------------------------
1103 ::rtl::OUString BibDataManager::getFilter()
1106 ::rtl::OUString aQueryString;
1109 Reference< XPropertySet > xFormProps( m_xForm, UNO_QUERY_THROW );
1110 OSL_VERIFY( xFormProps->getPropertyValue( C2U( "Filter" ) ) >>= aQueryString );
1112 catch( const Exception& )
1114 DBG_UNHANDLED_EXCEPTION();
1118 return aQueryString;
1121 //------------------------------------------------------------------------
1122 Sequence< ::rtl::OUString > BibDataManager::getQueryFields()
1124 Sequence< ::rtl::OUString > aFieldSeq;
1125 Reference< XNameAccess > xFields = getColumns( m_xForm );
1126 if (xFields.is())
1127 aFieldSeq = xFields->getElementNames();
1128 return aFieldSeq;
1130 //------------------------------------------------------------------------
1131 ::rtl::OUString BibDataManager::getQueryField()
1133 BibConfig* pConfig = BibModul::GetConfig();
1134 ::rtl::OUString aFieldString = pConfig->getQueryField();
1135 if(!aFieldString.getLength())
1137 Sequence< ::rtl::OUString > aSeq = getQueryFields();
1138 const ::rtl::OUString* pFields = aSeq.getConstArray();
1139 if(aSeq.getLength()>0)
1141 aFieldString=pFields[0];
1144 return aFieldString;
1146 //------------------------------------------------------------------------
1147 void BibDataManager::startQueryWith(const ::rtl::OUString& rQuery)
1149 BibConfig* pConfig = BibModul::GetConfig();
1150 pConfig->setQueryText( rQuery );
1152 ::rtl::OUString aQueryString;
1153 if(rQuery.getLength()>0)
1155 aQueryString=aQuoteChar;
1156 aQueryString+=getQueryField();
1157 aQueryString+=aQuoteChar;
1158 aQueryString+=C2U(" like '");
1159 String sQuery(rQuery);
1160 sQuery.SearchAndReplaceAll('?','_');
1161 sQuery.SearchAndReplaceAll('*','%');
1162 aQueryString += sQuery;
1163 aQueryString+=C2U("%'");
1165 setFilter(aQueryString);
1167 /* -----------------03.12.99 15:05-------------------
1169 --------------------------------------------------*/
1170 void BibDataManager::setActiveDataSource(const ::rtl::OUString& rURL)
1172 ::rtl::OUString uTable;
1173 ::rtl::OUString sTmp(aDataSourceURL);
1174 aDataSourceURL = rURL;
1176 Reference< XPropertySet > aPropertySet( m_xForm, UNO_QUERY );
1177 if(aPropertySet.is())
1179 unload();
1181 Reference< XComponent > xOldConnection;
1182 aPropertySet->getPropertyValue(C2U("ActiveConnection")) >>= xOldConnection;
1184 Reference< XConnection > xConnection = getConnection(rURL);
1185 if(!xConnection.is())
1187 aDataSourceURL = sTmp;
1188 return;
1190 Any aVal; aVal <<= xConnection;
1191 aPropertySet->setPropertyValue(C2U("ActiveConnection"), aVal);
1192 Reference< XMultiServiceFactory > xFactory(xConnection, UNO_QUERY);
1193 if ( xFactory.is() )
1194 m_xParser.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.SingleSelectQueryComposer" ) ) ), UNO_QUERY );
1196 if(xOldConnection.is())
1197 xOldConnection->dispose();
1199 Sequence< ::rtl::OUString > aTableNameSeq;
1200 Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY);
1201 if(xSupplyTables.is())
1203 Reference< XNameAccess > xAccess = xSupplyTables->getTables();
1204 aTableNameSeq = xAccess->getElementNames();
1206 if(aTableNameSeq.getLength() > 0)
1208 const ::rtl::OUString* pTableNames = aTableNameSeq.getConstArray();
1209 aActiveDataTable = pTableNames[0];
1210 aVal <<= aActiveDataTable;
1211 aPropertySet->setPropertyValue(C2U("Command"), aVal);
1212 aPropertySet->setPropertyValue(C2U("CommandType"), makeAny(CommandType::TABLE));
1213 //Caching for Performance
1214 aVal <<= (sal_Int32)50;
1215 aPropertySet->setPropertyValue(C2U("FetchSize"), aVal);
1216 ::rtl::OUString aString(C2U("SELECT * FROM "));
1217 // quote the table name which may contain catalog.schema.table
1218 Reference<XDatabaseMetaData> xMetaData(xConnection->getMetaData(),UNO_QUERY);
1219 aQuoteChar = xMetaData->getIdentifierQuoteString();
1221 ::rtl::OUString sCatalog, sSchema, sName;
1222 ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::eInDataManipulation );
1223 aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName );
1225 m_xParser->setElementaryQuery(aString);
1226 BibConfig* pConfig = BibModul::GetConfig();
1227 pConfig->setQueryField(getQueryField());
1228 startQueryWith(pConfig->getQueryText());
1229 setActiveDataTable(aActiveDataTable);
1231 FeatureStateEvent aEvent;
1232 util::URL aURL;
1233 aEvent.IsEnabled = sal_True;
1234 aEvent.Requery = sal_False;
1235 aEvent.FeatureDescriptor = getActiveDataTable();
1237 aEvent.State = makeAny( getDataSources() );
1239 if(pToolbar)
1241 aURL.Complete =C2U(".uno:Bib/source");
1242 aEvent.FeatureURL = aURL;
1243 pToolbar->statusChanged( aEvent );
1246 updateGridModel();
1247 load();
1251 /* --------------------------------------------------
1253 --------------------------------------------------*/
1254 void BibDataManager::setActiveDataTable(const ::rtl::OUString& rTable)
1256 ResetIdentifierMapping();
1259 Reference< XPropertySet > aPropertySet( m_xForm, UNO_QUERY );
1261 if(aPropertySet.is())
1263 Reference< XConnection > xConnection = getConnection( m_xForm );
1264 Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY);
1265 Reference< XNameAccess > xAccess = xSupplyTables->getTables();
1266 Sequence< ::rtl::OUString > aTableNameSeq = xAccess->getElementNames();
1267 sal_uInt32 nCount = aTableNameSeq.getLength();
1269 const ::rtl::OUString* pTableNames = aTableNameSeq.getConstArray();
1270 const ::rtl::OUString* pTableNamesEnd = pTableNames + nCount;
1272 for ( ; pTableNames != pTableNamesEnd; ++pTableNames )
1274 if ( rTable == *pTableNames )
1276 aActiveDataTable = rTable;
1277 Any aVal; aVal <<= rTable;
1278 aPropertySet->setPropertyValue( C2U("Command"), aVal );
1279 break;
1282 if (pTableNames != pTableNamesEnd)
1284 Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
1285 aQuoteChar = xMetaData->getIdentifierQuoteString();
1287 Reference< XMultiServiceFactory > xFactory(xConnection, UNO_QUERY);
1288 if ( xFactory.is() )
1289 m_xParser.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.SingleSelectQueryComposer" ) ) ), UNO_QUERY );
1291 ::rtl::OUString aString(C2U("SELECT * FROM "));
1293 ::rtl::OUString sCatalog, sSchema, sName;
1294 ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::eInDataManipulation );
1295 aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName );
1297 m_xParser->setElementaryQuery(aString);
1299 BibConfig* pConfig = BibModul::GetConfig();
1300 pConfig->setQueryField(getQueryField());
1301 startQueryWith(pConfig->getQueryText());
1303 BibDBDescriptor aDesc;
1304 aDesc.sDataSource = aDataSourceURL;
1305 aDesc.sTableOrQuery = aActiveDataTable;
1306 aDesc.nCommandType = CommandType::TABLE;
1307 BibModul::GetConfig()->SetBibliographyURL(aDesc);
1311 catch(Exception& e )
1313 (void) e; // make compiler happy
1314 DBG_ERROR("::setActiveDataTable: something went wrong !");
1319 //------------------------------------------------------------------------
1320 void SAL_CALL BibDataManager::load( ) throw (RuntimeException)
1322 if ( isLoaded() )
1323 // nothing to do
1324 return;
1326 Reference< XLoadable > xFormAsLoadable( m_xForm, UNO_QUERY );
1327 DBG_ASSERT( xFormAsLoadable.is() || !m_xForm.is(), "BibDataManager::load: invalid form!");
1328 if ( xFormAsLoadable.is() )
1330 xFormAsLoadable->load();
1331 SetMeAsUidListener();
1333 EventObject aEvt( static_cast< XWeak* >( this ) );
1334 m_aLoadListeners.notifyEach( &XLoadListener::loaded, aEvt );
1338 //------------------------------------------------------------------------
1339 void SAL_CALL BibDataManager::unload( ) throw (RuntimeException)
1341 if ( !isLoaded() )
1342 // nothing to do
1343 return;
1345 Reference< XLoadable >xFormAsLoadable( m_xForm, UNO_QUERY );
1346 DBG_ASSERT( xFormAsLoadable.is() || !m_xForm.is(), "BibDataManager::unload: invalid form!");
1347 if ( xFormAsLoadable.is() )
1349 EventObject aEvt( static_cast< XWeak* >( this ) );
1352 m_aLoadListeners.notifyEach( &XLoadListener::unloading, aEvt );
1355 RemoveMeAsUidListener();
1356 xFormAsLoadable->unload();
1359 m_aLoadListeners.notifyEach( &XLoadListener::unloaded, aEvt );
1364 //------------------------------------------------------------------------
1365 void SAL_CALL BibDataManager::reload( ) throw (RuntimeException)
1367 if ( !isLoaded() )
1368 // nothing to do
1369 return;
1371 Reference< XLoadable >xFormAsLoadable( m_xForm, UNO_QUERY );
1372 DBG_ASSERT( xFormAsLoadable.is() || !m_xForm.is(), "BibDataManager::unload: invalid form!");
1373 if ( xFormAsLoadable.is() )
1375 EventObject aEvt( static_cast< XWeak* >( this ) );
1378 m_aLoadListeners.notifyEach( &XLoadListener::reloading, aEvt );
1381 xFormAsLoadable->reload();
1384 m_aLoadListeners.notifyEach( &XLoadListener::reloaded, aEvt );
1389 //------------------------------------------------------------------------
1390 sal_Bool SAL_CALL BibDataManager::isLoaded( ) throw (RuntimeException)
1392 Reference< XLoadable >xFormAsLoadable( m_xForm, UNO_QUERY );
1393 DBG_ASSERT( xFormAsLoadable.is() || !m_xForm.is(), "BibDataManager::isLoaded: invalid form!");
1395 sal_Bool bLoaded = sal_False;
1396 if ( xFormAsLoadable.is() )
1397 bLoaded = xFormAsLoadable->isLoaded();
1398 return bLoaded;
1401 //------------------------------------------------------------------------
1402 void SAL_CALL BibDataManager::addLoadListener( const Reference< XLoadListener >& aListener ) throw (RuntimeException)
1404 m_aLoadListeners.addInterface( aListener );
1407 //------------------------------------------------------------------------
1408 void SAL_CALL BibDataManager::removeLoadListener( const Reference< XLoadListener >& aListener ) throw (RuntimeException)
1410 m_aLoadListeners.removeInterface( aListener );
1413 //------------------------------------------------------------------------
1414 Reference< awt::XControlModel > BibDataManager::createGridModel(const ::rtl::OUString& rName)
1416 Reference< awt::XControlModel > xModel;
1420 // create the control model
1421 Reference< XMultiServiceFactory > xMgr = ::comphelper::getProcessServiceFactory();
1422 Reference< XInterface > xObject = xMgr->createInstance(C2U("com.sun.star.form.component.GridControl"));
1423 xModel=Reference< awt::XControlModel > ( xObject, UNO_QUERY );
1425 // set the
1426 Reference< XPropertySet > xPropSet( xModel, UNO_QUERY );
1427 xPropSet->setPropertyValue( C2U("Name"), makeAny( rName ) );
1429 // set the name of the to-be-created control
1430 ::rtl::OUString aControlName(C2U("com.sun.star.form.control.InteractionGridControl"));
1431 Any aAny; aAny <<= aControlName;
1432 xPropSet->setPropertyValue( C2U("DefaultControl"),aAny );
1434 // the the helpURL
1435 ::rtl::OUString uProp(C2U("HelpURL"));
1436 Reference< XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo();
1437 if (xPropInfo->hasPropertyByName(uProp))
1439 ::rtl::OUString sId = ::rtl::OUString::createFromAscii( "HID:" );
1440 sId += ::rtl::OUString::valueOf( (sal_Int32) HID_BIB_DB_GRIDCTRL );
1441 xPropSet->setPropertyValue( uProp, makeAny( ::rtl::OUString( sId ) ) );
1444 catch(Exception& e )
1446 (void) e; // make compiler happy
1447 DBG_ERROR("::createGridModel: something went wrong !");
1451 return xModel;
1453 //------------------------------------------------------------------------
1454 ::rtl::OUString BibDataManager::getControlName(sal_Int32 nFormatKey )
1456 ::rtl::OUString aResStr;
1457 switch (nFormatKey)
1459 case DataType::BIT:
1460 case DataType::BOOLEAN:
1461 aResStr=C2U("CheckBox");
1462 break;
1463 case DataType::TINYINT:
1464 case DataType::SMALLINT:
1465 case DataType::INTEGER:
1466 aResStr=C2U("NumericField"); ;
1467 break;
1468 case DataType::REAL:
1469 case DataType::DOUBLE:
1470 case DataType::NUMERIC:
1471 case DataType::DECIMAL:
1472 aResStr=C2U("FormattedField");
1473 break;
1474 case DataType::TIMESTAMP:
1475 aResStr=C2U("FormattedField");
1476 break;
1477 case DataType::DATE:
1478 aResStr=C2U("DateField");
1479 break;
1480 case DataType::TIME:
1481 aResStr=C2U("TimeField");
1482 break;
1483 case DataType::CHAR:
1484 case DataType::VARCHAR:
1485 case DataType::LONGVARCHAR:
1486 default:
1487 aResStr=C2U("TextField");
1488 break;
1490 return aResStr;
1492 //------------------------------------------------------------------------
1493 Reference< awt::XControlModel > BibDataManager::loadControlModel(
1494 const ::rtl::OUString& rName, sal_Bool bForceListBox)
1496 Reference< awt::XControlModel > xModel;
1497 ::rtl::OUString aName(C2U("View_"));
1498 aName += rName;
1502 Reference< XNameAccess > xFields = getColumns( m_xForm );
1503 if (!xFields.is())
1504 return xModel;
1505 Reference< XPropertySet > xField;
1507 Any aElement;
1509 if(xFields->hasByName(rName))
1511 aElement = xFields->getByName(rName);
1512 aElement >>= xField;
1513 Reference< XPropertySetInfo > xInfo = xField.is() ? xField->getPropertySetInfo() : Reference< XPropertySetInfo > ();
1515 ::rtl::OUString sCurrentModelType;
1516 const ::rtl::OUString sType(C2U("Type"));
1517 sal_Int32 nFormatKey = 0;
1518 xField->getPropertyValue(sType) >>= nFormatKey;
1520 ::rtl::OUString aInstanceName(C2U("com.sun.star.form.component."));
1522 if (bForceListBox)
1523 aInstanceName += C2U("ListBox");
1524 else
1525 aInstanceName += getControlName(nFormatKey);
1527 Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory();
1528 Reference< XInterface > xObject = xMgr->createInstance(aInstanceName);
1529 xModel=Reference< awt::XControlModel > ( xObject, UNO_QUERY );
1530 Reference< XPropertySet > xPropSet( xModel, UNO_QUERY );
1531 Any aFieldName; aFieldName <<= aName;
1533 xPropSet->setPropertyValue( FM_PROP_NAME,aFieldName);
1534 xPropSet->setPropertyValue( FM_PROP_CONTROLSOURCE, makeAny( rName ) );
1535 xPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NativeWidgetLook" ) ), makeAny( (sal_Bool)sal_True ) );
1537 Reference< XFormComponent > aFormComp(xModel,UNO_QUERY );
1539 Reference< XNameContainer > xNameCont( m_xForm, UNO_QUERY );
1540 xNameCont->insertByName(aName, makeAny( aFormComp ) );
1542 // now if the form where we inserted the new model is already loaded, notify the model of this
1543 // Note that this implementation below is a HACK as it relies on the fact that the model adds itself
1544 // as load listener to it's parent, which is an implementation detail of the model.
1546 // the better solution would be the following:
1547 // in the current scenario, we insert a control model into a form. This results in the control model
1548 // adding itself as load listener to the form. Now, the form should realize that it's already loaded
1549 // and notify the model (which it knows as XLoadListener only) immediately. This seems to make sense.
1550 // (as an anologon to the XStatusListener semantics).
1552 // But this would be way too risky for this last-day fix here.
1553 // 97140 - 30.01.2002 - fs@openoffice.org
1554 Reference< XLoadable > xLoad( m_xForm, UNO_QUERY );
1555 if ( xLoad.is() && xLoad->isLoaded() )
1557 Reference< XLoadListener > xListener( aFormComp, UNO_QUERY );
1558 if ( xListener.is() )
1560 EventObject aLoadSource;
1561 aLoadSource.Source = xLoad;
1562 xListener->loaded( aLoadSource );
1567 catch(Exception& e )
1569 (void) e; // make compiler happy
1570 DBG_ERROR("::loadControlModel: something went wrong !");
1572 return xModel;
1574 //------------------------------------------------------------------------
1575 void SAL_CALL BibDataManager::disposing()
1577 BibDataManager_Base::WeakComponentImplHelperBase::disposing();
1580 //------------------------------------------------------------------------
1581 void BibDataManager::disposing( const EventObject& /*Source*/ ) throw( ::com::sun::star::uno::RuntimeException )
1583 // not interested in
1586 //------------------------------------------------------------------------
1587 void BibDataManager::propertyChange(const beans::PropertyChangeEvent& evt) throw( RuntimeException )
1591 sal_Bool bFlag=sal_False;
1592 if(evt.PropertyName == FM_PROP_VALUE)
1594 if( evt.NewValue.getValueType() == ::getCppuType((Reference<io::XInputStream>*)0) )
1596 Reference< io::XDataInputStream > xStream(
1597 *(const Reference< io::XInputStream > *)evt.NewValue.getValue(), UNO_QUERY );
1598 aUID <<= xStream->readUTF();
1600 else
1601 aUID = evt.NewValue;
1603 Reference< XRowLocate > xLocate(xBibCursor, UNO_QUERY);
1604 DBG_ASSERT(xLocate.is(), "BibDataManager::propertyChange : invalid cursor !");
1605 bFlag = xLocate->moveToBookmark(aUID);
1608 catch(Exception& e )
1610 (void) e; // make compiler happy
1611 DBG_ERROR("::propertyChange: something went wrong !");
1616 //------------------------------------------------------------------------
1617 void BibDataManager::SetMeAsUidListener()
1621 Reference< XNameAccess > xFields = getColumns( m_xForm );
1622 if (!xFields.is())
1623 return;
1625 Sequence< ::rtl::OUString > aFields(xFields->getElementNames());
1626 const ::rtl::OUString* pFields = aFields.getConstArray();
1627 sal_Int32 nCount=aFields.getLength();
1628 String StrUID(C2S(STR_UID));
1629 ::rtl::OUString theFieldName;
1630 for( sal_Int32 i=0; i<nCount; i++ )
1632 String aName= pFields[i];
1634 if(aName.EqualsIgnoreCaseAscii(StrUID))
1636 theFieldName=pFields[i];
1637 break;
1641 if(theFieldName.getLength()>0)
1643 Reference< XPropertySet > xPropSet;
1644 Any aElement;
1646 aElement = xFields->getByName(theFieldName);
1647 xPropSet = *(Reference< XPropertySet > *)aElement.getValue();
1649 xPropSet->addPropertyChangeListener(FM_PROP_VALUE, this);
1653 catch(Exception& e )
1655 (void) e; // make compiler happy
1656 DBG_ERROR("Exception in BibDataManager::SetMeAsUidListener");
1661 //------------------------------------------------------------------------
1662 void BibDataManager::RemoveMeAsUidListener()
1666 Reference< XNameAccess > xFields = getColumns( m_xForm );
1667 if (!xFields.is())
1668 return;
1671 Sequence< ::rtl::OUString > aFields(xFields->getElementNames());
1672 const ::rtl::OUString* pFields = aFields.getConstArray();
1673 sal_Int32 nCount=aFields.getLength();
1674 String StrUID(C2S(STR_UID));
1675 ::rtl::OUString theFieldName;
1676 for( sal_Int32 i=0; i<nCount; i++ )
1678 String aName= pFields[i];
1680 if(aName.EqualsIgnoreCaseAscii(StrUID))
1682 theFieldName=pFields[i];
1683 break;
1687 if(theFieldName.getLength()>0)
1689 Reference< XPropertySet > xPropSet;
1690 Any aElement;
1692 aElement = xFields->getByName(theFieldName);
1693 xPropSet = *(Reference< XPropertySet > *)aElement.getValue();
1695 xPropSet->removePropertyChangeListener(FM_PROP_VALUE, this);
1699 catch(Exception& e )
1701 (void) e; // make compiler happy
1702 DBG_ERROR("Exception in BibDataManager::RemoveMeAsUidListener");
1707 /* -----------------11.11.99 15:51-------------------
1709 --------------------------------------------------*/
1710 void BibDataManager::CreateMappingDialog(Window* pParent)
1712 MappingDialog_Impl* pDlg = new MappingDialog_Impl(pParent, this);
1713 if(RET_OK == pDlg->Execute() && pBibView)
1715 reload();
1716 // unload();
1717 // pBibView->UpdatePages();
1718 // load();
1720 delete pDlg;
1722 /* --------------------------------------------------
1724 --------------------------------------------------*/
1725 ::rtl::OUString BibDataManager::CreateDBChangeDialog(Window* pParent)
1727 ::rtl::OUString uRet;
1728 DBChangeDialog_Impl * pDlg = new DBChangeDialog_Impl(pParent, this );
1729 if(RET_OK == pDlg->Execute())
1731 String sNewURL = pDlg->GetCurrentURL();
1732 if(sNewURL != String(getActiveDataSource()))
1734 uRet = sNewURL;
1737 delete pDlg;
1738 return uRet;
1740 /*-- 18.05.2004 15:20:15---------------------------------------------------
1742 -----------------------------------------------------------------------*/
1743 void BibDataManager::DispatchDBChangeDialog()
1745 if(pToolbar)
1746 pToolbar->SendDispatch(TBC_BT_CHANGESOURCE, Sequence< PropertyValue >());
1748 /* -----------------06.12.99 15:11-------------------
1750 --------------------------------------------------*/
1751 const ::rtl::OUString& BibDataManager::GetIdentifierMapping()
1753 if(!sIdentifierMapping.getLength())
1755 BibConfig* pConfig = BibModul::GetConfig();
1756 BibDBDescriptor aDesc;
1757 aDesc.sDataSource = getActiveDataSource();
1758 aDesc.sTableOrQuery = getActiveDataTable();
1759 aDesc.nCommandType = CommandType::TABLE;
1760 const Mapping* pMapping = pConfig->GetMapping(aDesc);
1761 sIdentifierMapping = pConfig->GetDefColumnName(IDENTIFIER_POS);
1762 if(pMapping)
1764 for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
1766 if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == sIdentifierMapping)
1768 sIdentifierMapping = pMapping->aColumnPairs[nEntry].sRealColumnName;
1769 break;
1774 return sIdentifierMapping;
1776 /* -----------------------------20.11.00 10:31--------------------------------
1778 ---------------------------------------------------------------------------*/
1779 void BibDataManager::SetToolbar(BibToolBar* pSet)
1781 pToolbar = pSet;
1782 if(pToolbar)
1783 pToolbar->SetDatMan(*this);
1785 /* -----------------------------08.05.2002 09:26------------------------------
1787 ---------------------------------------------------------------------------*/
1788 uno::Reference< form::runtime::XFormController > BibDataManager::GetFormController()
1790 if(!m_xFormCtrl.is())
1792 Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory();
1793 m_xFormCtrl = uno::Reference< form::runtime::XFormController > (
1794 xMgr->createInstance(C2U("com.sun.star.form.runtime.FormController")), UNO_QUERY);
1795 m_xFormCtrl->setModel(uno::Reference< awt::XTabControllerModel > (getForm(), UNO_QUERY));
1796 // #100312# -------------
1797 m_xFormDispatch = uno::Reference< frame::XDispatch > ( m_xFormCtrl, UNO_QUERY);
1799 return m_xFormCtrl;
1802 // #100312# ----------
1803 void BibDataManager::RegisterInterceptor( ::bib::BibBeamer* pBibBeamer)
1805 DBG_ASSERT( !m_pInterceptorHelper, "BibDataManager::RegisterInterceptor: called twice!" );
1807 if( pBibBeamer )
1808 m_pInterceptorHelper = new BibInterceptorHelper( pBibBeamer, m_xFormDispatch);
1809 if( m_pInterceptorHelper )
1810 m_pInterceptorHelper->acquire();
1813 /*-- 18.05.2004 17:04:20---------------------------------------------------
1815 -----------------------------------------------------------------------*/
1816 sal_Bool BibDataManager::HasActiveConnection()const
1818 sal_Bool bRet = sal_False;
1819 Reference< XPropertySet > xPrSet( m_xForm, UNO_QUERY );
1820 if( xPrSet.is() )
1822 Reference< XComponent > xConnection;
1823 xPrSet->getPropertyValue(C2U("ActiveConnection")) >>= xConnection;
1824 bRet = xConnection.is();
1826 return bRet;
1828 /*-- 04.06.2004 14:37:29---------------------------------------------------
1830 -----------------------------------------------------------------------*/
1831 sal_Bool BibDataManager::HasActiveConnection()
1833 return getConnection( m_xForm ).is();