26#include <com/sun/star/sdbc/ResultSetType.hpp>
27#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
28#include <com/sun/star/sdbcx/XRowLocate.hpp>
29#include <com/sun/star/sdbc/DataType.hpp>
30#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
31#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
32#include <com/sun/star/sdbc/XDataSource.hpp>
33#include <com/sun/star/sdb/CommandType.hpp>
34#include <com/sun/star/sdb/DatabaseContext.hpp>
35#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
36#include <com/sun/star/sdbc/XConnection.hpp>
37#include <com/sun/star/sdb/XCompletedConnection.hpp>
38#include <com/sun/star/sdbc/SQLException.hpp>
39#include <com/sun/star/task/InteractionHandler.hpp>
40#include <com/sun/star/form/ListSourceType.hpp>
41#include <com/sun/star/form/XLoadable.hpp>
42#include <com/sun/star/form/runtime/FormController.hpp>
43#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
44#include <com/sun/star/form/XGridColumnFactory.hpp>
45#include <com/sun/star/lang/XMultiServiceFactory.hpp>
46#include <com/sun/star/container/XNameContainer.hpp>
82 Reference< XDataSource > xDataSource;
85 Reference< XDatabaseContext > xNamingContext = DatabaseContext::create(xContext);
86 if (xNamingContext->hasByName(_rURL))
88 DBG_ASSERT(xNamingContext.is(),
"::getDataSource : no NamingService interface on the sdb::DatabaseAccessContext !");
91 xDataSource.set(xNamingContext->getRegisteredObject(_rURL), UNO_QUERY);
99 Reference< XConnection > xConn;
100 if (xDataSource.is())
103 Reference< XCompletedConnection > xComplConn(xDataSource, UNO_QUERY);
106 Reference<task::XInteractionHandler> xIHdl( task::InteractionHandler::createWithParent(xContext,
nullptr), UNO_QUERY_THROW);
107 xConn = xComplConn->connectWithCompletion(xIHdl);
109 catch (
const SQLException&)
122 Reference< XConnection > xConn;
125 Reference< XPropertySet > xFormProps(xRowSet, UNO_QUERY);
126 if (!xFormProps.is())
129 xConn.set(xFormProps->getPropertyValue(
"ActiveConnection"), UNO_QUERY);
132 SAL_INFO(
"extensions.biblio",
"no active connection");
143static Reference< XNameAccess >
getColumns(
const Reference< XForm > & _rxForm)
145 Reference< XNameAccess > xReturn;
147 Reference< XColumnsSupplier > xSupplyCols( _rxForm, UNO_QUERY );
148 if (xSupplyCols.is())
149 xReturn = xSupplyCols->getColumns();
151 if (!xReturn.is() || !xReturn->getElementNames().hasElements())
155 Reference< XTablesSupplier > xSupplyTables(
getConnection( _rxForm ), UNO_QUERY );
156 Reference< XPropertySet > xFormProps( _rxForm, UNO_QUERY );
157 if (xFormProps.is() && xSupplyTables.is())
161 DBG_ASSERT(*o3tl::forceAccess<sal_Int32>(xFormProps->getPropertyValue(
"CommandType")) == CommandType::TABLE,
162 "::getColumns : invalid form (has no table as data source) !");
164 xFormProps->getPropertyValue(
"Command") >>= sTable;
165 Reference< XNameAccess > xTables = xSupplyTables->getTables();
166 if (xTables.is() && xTables->hasByName(sTable))
167 xSupplyCols.set(xTables->getByName(sTable), UNO_QUERY);
168 if (xSupplyCols.is())
169 xReturn = xSupplyCols->getColumns();
190 std::unique_ptr<weld::Button> m_xOKBT;
191 std::unique_ptr<weld::ComboBox> m_xIdentifierLB;
192 std::unique_ptr<weld::ComboBox> m_xAuthorityTypeLB;
193 std::unique_ptr<weld::ComboBox> m_xAuthorLB;
194 std::unique_ptr<weld::ComboBox> m_xTitleLB;
195 std::unique_ptr<weld::ComboBox> m_xMonthLB;
196 std::unique_ptr<weld::ComboBox> m_xYearLB;
197 std::unique_ptr<weld::ComboBox> m_xISBNLB;
198 std::unique_ptr<weld::ComboBox> m_xBooktitleLB;
199 std::unique_ptr<weld::ComboBox> m_xChapterLB;
200 std::unique_ptr<weld::ComboBox> m_xEditionLB;
201 std::unique_ptr<weld::ComboBox> m_xEditorLB;
202 std::unique_ptr<weld::ComboBox> m_xHowpublishedLB;
203 std::unique_ptr<weld::ComboBox> m_xInstitutionLB;
204 std::unique_ptr<weld::ComboBox> m_xJournalLB;
205 std::unique_ptr<weld::ComboBox> m_xNoteLB;
206 std::unique_ptr<weld::ComboBox> m_xAnnoteLB;
207 std::unique_ptr<weld::ComboBox> m_xNumberLB;
208 std::unique_ptr<weld::ComboBox> m_xOrganizationsLB;
209 std::unique_ptr<weld::ComboBox> m_xPagesLB;
210 std::unique_ptr<weld::ComboBox> m_xPublisherLB;
211 std::unique_ptr<weld::ComboBox> m_xAddressLB;
212 std::unique_ptr<weld::ComboBox> m_xSchoolLB;
213 std::unique_ptr<weld::ComboBox> m_xSeriesLB;
214 std::unique_ptr<weld::ComboBox> m_xReportTypeLB;
215 std::unique_ptr<weld::ComboBox> m_xVolumeLB;
216 std::unique_ptr<weld::ComboBox> m_xURLLB;
217 std::unique_ptr<weld::ComboBox> m_xCustom1LB;
218 std::unique_ptr<weld::ComboBox> m_xCustom2LB;
219 std::unique_ptr<weld::ComboBox> m_xCustom3LB;
220 std::unique_ptr<weld::ComboBox> m_xCustom4LB;
221 std::unique_ptr<weld::ComboBox> m_xCustom5LB;
222 std::unique_ptr<weld::ComboBox> m_xLocalURLLB;
235 std::u16string_view rLogicalColumnName)
246 : GenericDialogController(pParent,
"modules/sbibliography/ui/mappingdialog.ui",
"MappingDialog")
250 , m_xOKBT(m_xBuilder->weld_button(
"ok"))
251 , m_xIdentifierLB(m_xBuilder->weld_combo_box(
"identifierCombobox"))
252 , m_xAuthorityTypeLB(m_xBuilder->weld_combo_box(
"authorityTypeCombobox"))
253 , m_xAuthorLB(m_xBuilder->weld_combo_box(
"authorCombobox"))
254 , m_xTitleLB(m_xBuilder->weld_combo_box(
"titleCombobox"))
255 , m_xMonthLB(m_xBuilder->weld_combo_box(
"monthCombobox"))
256 , m_xYearLB(m_xBuilder->weld_combo_box(
"yearCombobox"))
257 , m_xISBNLB(m_xBuilder->weld_combo_box(
"ISBNCombobox"))
258 , m_xBooktitleLB(m_xBuilder->weld_combo_box(
"bookTitleCombobox"))
259 , m_xChapterLB(m_xBuilder->weld_combo_box(
"chapterCombobox"))
260 , m_xEditionLB(m_xBuilder->weld_combo_box(
"editionCombobox"))
261 , m_xEditorLB(m_xBuilder->weld_combo_box(
"editorCombobox"))
262 , m_xHowpublishedLB(m_xBuilder->weld_combo_box(
"howPublishedCombobox"))
263 , m_xInstitutionLB(m_xBuilder->weld_combo_box(
"institutionCombobox"))
264 , m_xJournalLB(m_xBuilder->weld_combo_box(
"journalCombobox"))
265 , m_xNoteLB(m_xBuilder->weld_combo_box(
"noteCombobox"))
266 , m_xAnnoteLB(m_xBuilder->weld_combo_box(
"annoteCombobox"))
267 , m_xNumberLB(m_xBuilder->weld_combo_box(
"numberCombobox"))
268 , m_xOrganizationsLB(m_xBuilder->weld_combo_box(
"organizationCombobox"))
269 , m_xPagesLB(m_xBuilder->weld_combo_box(
"pagesCombobox"))
270 , m_xPublisherLB(m_xBuilder->weld_combo_box(
"publisherCombobox"))
271 , m_xAddressLB(m_xBuilder->weld_combo_box(
"addressCombobox"))
272 , m_xSchoolLB(m_xBuilder->weld_combo_box(
"schoolCombobox"))
273 , m_xSeriesLB(m_xBuilder->weld_combo_box(
"seriesCombobox"))
274 , m_xReportTypeLB(m_xBuilder->weld_combo_box(
"reportTypeCombobox"))
275 , m_xVolumeLB(m_xBuilder->weld_combo_box(
"volumeCombobox"))
276 , m_xURLLB(m_xBuilder->weld_combo_box(
"URLCombobox"))
277 , m_xCustom1LB(m_xBuilder->weld_combo_box(
"custom1Combobox"))
278 , m_xCustom2LB(m_xBuilder->weld_combo_box(
"custom2Combobox"))
279 , m_xCustom3LB(m_xBuilder->weld_combo_box(
"custom3Combobox"))
280 , m_xCustom4LB(m_xBuilder->weld_combo_box(
"custom4Combobox"))
281 , m_xCustom5LB(m_xBuilder->weld_combo_box(
"custom5Combobox"))
282 , m_xLocalURLLB(m_xBuilder->weld_combo_box(
"LocalURLCombobox"))
284 m_xOKBT->connect_clicked(
LINK(
this, MappingDialog_Impl, OkHdl));
285 OUString sTitle =
m_xDialog->get_title();
286 sTitle = sTitle.replaceFirst(
"%1", pDatMan->getActiveDataTable());
289 aListBoxes[0] = m_xIdentifierLB.get();
290 aListBoxes[1] = m_xAuthorityTypeLB.get();
291 aListBoxes[2] = m_xAuthorLB.get();
292 aListBoxes[3] = m_xTitleLB.get();
293 aListBoxes[4] = m_xYearLB.get();
294 aListBoxes[5] = m_xISBNLB.get();
295 aListBoxes[6] = m_xBooktitleLB.get();
296 aListBoxes[7] = m_xChapterLB.get();
297 aListBoxes[8] = m_xEditionLB.get();
298 aListBoxes[9] = m_xEditorLB.get();
299 aListBoxes[10] = m_xHowpublishedLB.get();
300 aListBoxes[11] = m_xInstitutionLB.get();
301 aListBoxes[12] = m_xJournalLB.get();
302 aListBoxes[13] = m_xMonthLB.get();
303 aListBoxes[14] = m_xNoteLB.get();
304 aListBoxes[15] = m_xAnnoteLB.get();
305 aListBoxes[16] = m_xNumberLB.get();
306 aListBoxes[17] = m_xOrganizationsLB.get();
307 aListBoxes[18] = m_xPagesLB.get();
308 aListBoxes[19] = m_xPublisherLB.get();
309 aListBoxes[20] = m_xAddressLB.get();
310 aListBoxes[21] = m_xSchoolLB.get();
311 aListBoxes[22] = m_xSeriesLB.get();
312 aListBoxes[23] = m_xReportTypeLB.get();
313 aListBoxes[24] = m_xVolumeLB.get();
314 aListBoxes[25] = m_xURLLB.get();
315 aListBoxes[26] = m_xCustom1LB.get();
316 aListBoxes[27] = m_xCustom2LB.get();
317 aListBoxes[28] = m_xCustom3LB.get();
318 aListBoxes[29] = m_xCustom4LB.get();
319 aListBoxes[30] = m_xCustom5LB.get();
320 aListBoxes[31] = m_xLocalURLLB.get();
322 aListBoxes[0]->append_text(sNone);
323 Reference< XNameAccess > xFields =
getColumns( pDatMan->getForm() );
324 DBG_ASSERT(xFields.is(),
"MappingDialog_Impl::MappingDialog_Impl : gave me an invalid form !");
327 const Sequence<OUString>
aFieldNames = xFields->getElementNames();
328 for(
const OUString& rName : aFieldNames)
329 aListBoxes[0]->append_text(rName);
334 aListBoxes[0]->set_active(0);
335 aListBoxes[0]->connect_changed(aLnk);
338 for(sal_Int32 j = 0, nEntryCount = aListBoxes[0]->get_count(); j < nEntryCount; ++j)
339 aListBoxes[i]->append_text(aListBoxes[0]->get_text(j));
340 aListBoxes[
i]->set_active(0);
341 aListBoxes[
i]->connect_changed(aLnk);
345 aDesc.
sDataSource = pDatMan->getActiveDataSource();
351 for(
const auto & aColumnPair :
pMapping->aColumnPairs)
356 aListBoxes[nListBoxIndex]->set_active_text(aColumnPair.sRealColumnName);
364 const sal_Int32 nEntryPos = rListBox.get_active();
367 for(
auto & pListBoxe : aListBoxes)
369 if (&rListBox != pListBoxe && pListBoxe->get_active() == nEntryPos)
370 pListBoxe->set_active(0);
381 aNew.
sTableName = pDatMan->getActiveDataTable();
382 aNew.
sURL = pDatMan->getActiveDataSource();
384 sal_uInt16 nWriteIndex = 0;
386 for(sal_uInt16 nEntry = 0; nEntry <
COLUMN_COUNT; nEntry++)
388 OUString sSel = aListBoxes[nEntry]->get_active_text();
397 aDesc.
sDataSource = pDatMan->getActiveDataSource();
400 pDatMan->ResetIdentifierMapping();
412 std::unique_ptr<weld::TreeView> m_xSelectionLB;
418 OUString GetCurrentURL()
const;
424 : GenericDialogController(pParent,
"modules/sbibliography/ui/choosedatasourcedialog.ui",
"ChooseDataSourceDialog")
425 , m_xSelectionLB(m_xBuilder->weld_tree_view(
"treeview"))
427 m_xSelectionLB->set_size_request(-1, m_xSelectionLB->get_height_rows(6));
428 m_xSelectionLB->connect_row_activated(
LINK(
this, DBChangeDialog_Impl, DoubleClickHdl));
429 m_xSelectionLB->make_sorted();
434 for (
const OUString& rSourceName : aConfig.GetDataSourceNames())
435 m_xSelectionLB->append_text(rSourceName);
436 m_xSelectionLB->select_text(sActiveSource);
438 catch (
const Exception&)
450OUString DBChangeDialog_Impl::GetCurrentURL()
const
452 return m_xSelectionLB->get_selected_text();
460 xInterception = pBibBeamer->getDispatchProviderInterception();
479css::uno::Reference< css::frame::XDispatch > SAL_CALL
482 Reference< XDispatch > xReturn;
485 if (
aCommand ==
"FormSlots/ConfirmDeletion" )
494css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL
497 Sequence< Reference< XDispatch> > aReturn( aDescripts.getLength() );
498 Reference< XDispatch >* pReturn = aReturn.getArray();
499 for (
const DispatchDescriptor& rDescript : aDescripts )
501 *pReturn++ =
queryDispatch( rDescript.FeatureURL, rDescript.FrameName, rDescript.SearchFlags );
507css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL
518css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL
541 Reference< XLoadable > xLoad(
m_xForm, UNO_QUERY );
542 Reference< XPropertySet > xPrSet(
m_xForm, UNO_QUERY );
543 Reference< XComponent > xComp(
m_xForm, UNO_QUERY );
546 Reference< XComponent > xConnection;
547 xPrSet->getPropertyValue(
"ActiveConnection") >>= xConnection;
553 xConnection->dispose();
570 Reference< XNameContainer > xColContainer( _rxGrid, UNO_QUERY );
572 if ( xColContainer->hasElements() )
574 const Sequence<OUString> aOldNames = xColContainer->getElementNames();
575 for (
const OUString& rName : aOldNames )
576 xColContainer->removeByName( rName );
583 Reference< XGridColumnFactory > xColFactory( _rxGrid, UNO_QUERY );
585 Reference< XPropertySet > xField;
587 const Sequence<OUString>
aFieldNames = xFields->getElementNames();
590 xFields->getByName( rField ) >>= xField;
592 OUString sCurrentModelType;
594 bool bIsFormatted =
false;
595 bool bFormattedIsNumeric =
true;
596 xField->getPropertyValue(
"Type") >>=
nType;
600 case DataType::BOOLEAN:
601 sCurrentModelType =
"CheckBox";
604 case DataType::BINARY:
605 case DataType::VARBINARY:
606 case DataType::LONGVARBINARY:
608 sCurrentModelType =
"TextField";
611 case DataType::VARCHAR:
612 case DataType::LONGVARCHAR:
615 bFormattedIsNumeric =
false;
618 sCurrentModelType =
"FormattedField";
623 Reference< XPropertySet > xCurrentCol = xColFactory->createColumn(sCurrentModelType);
626 OUString sFormatKey(
"FormatKey");
627 xCurrentCol->setPropertyValue(sFormatKey, xField->getPropertyValue(sFormatKey));
628 Any aFormatted(bFormattedIsNumeric);
629 xCurrentCol->setPropertyValue(
"TreatAsNumber", aFormatted);
631 Any aColName( rField );
635 xColContainer->insertByName( rField,
Any( xCurrentCol ) );
653 Reference< XPropertySet > aFormPropSet( xDbForm, UNO_QUERY );
655 aFormPropSet->getPropertyValue(
"Command") >>=
sName;
661 Reference< XNameContainer > xNameCont(xDbForm, UNO_QUERY);
666 Reference< XFormComponent > xFormComp(
m_xGridModel, UNO_QUERY );
669 catch (
const Exception&)
671 OSL_FAIL(
"::updateGridModel: something went wrong !");
679 Reference< XForm > xResult;
683 m_xForm.set( xMgr->createInstance(
"com.sun.star.form.component.Form" ), UNO_QUERY );
685 Reference< XPropertySet > aPropertySet(
m_xForm, UNO_QUERY );
688 if(aPropertySet.is())
691 aVal <<= sal_Int32(ResultSetType::SCROLL_INSENSITIVE);
692 aPropertySet->setPropertyValue(
"ResultSetType",aVal );
693 aVal <<= sal_Int32(ResultSetConcurrency::READ_ONLY);
694 aPropertySet->setPropertyValue(
"ResultSetConcurrency", aVal);
697 aVal <<= sal_Int32(50);
698 aPropertySet->setPropertyValue(
"FetchSize", aVal);
701 aVal <<= xConnection;
702 aPropertySet->setPropertyValue(
"ActiveConnection", aVal);
704 Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY);
705 Reference< XNameAccess > xTables = xSupplyTables.is() ?
706 xSupplyTables->getTables() : Reference< XNameAccess > ();
708 Sequence< OUString > aTableNameSeq;
710 aTableNameSeq = xTables->getElementNames();
712 if(aTableNameSeq.hasElements())
723 aPropertySet->setPropertyValue(
"Command", aVal);
725 aPropertySet->setPropertyValue(
"CommandType", aVal);
728 Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
729 aQuoteChar = xMetaData->getIdentifierQuoteString();
733 m_xParser.set(
xFactory->createInstance(
"com.sun.star.sdb.SingleSelectQueryComposer"), UNO_QUERY );
735 OUString aString(
"SELECT * FROM ");
752 OSL_FAIL(
"::createDatabaseForm: something went wrong !");
760 Sequence< OUString > aTableNameSeq;
765 Reference< XNameAccess > xTables;
766 if (xSupplyTables.is())
767 xTables = xSupplyTables->getTables();
769 aTableNameSeq = xTables->getElementNames();
773 OSL_FAIL(
"::getDataSources: something went wrong !");
776 return aTableNameSeq;
787 OUString aQuery =
m_xParser->getFilter();
788 Reference< XPropertySet > xFormProps(
m_xForm, UNO_QUERY_THROW );
789 xFormProps->setPropertyValue(
"Filter",
Any( aQuery ) );
790 xFormProps->setPropertyValue(
"ApplyFilter",
Any(
true ) );
804 OUString aQueryString;
807 Reference< XPropertySet > xFormProps(
m_xForm, UNO_QUERY_THROW );
808 OSL_VERIFY( xFormProps->getPropertyValue(
"Filter" ) >>= aQueryString );
822 Sequence< OUString > aFieldSeq;
825 aFieldSeq = xFields->getElementNames();
833 if(aFieldString.isEmpty())
836 if(
aSeq.hasElements())
838 aFieldString=
aSeq[0];
849 OUString aQueryString;
850 if(!rQuery.isEmpty())
853 OUString sQuery = rQuery.replaceAll(
"?",
"_").replaceAll(
"*",
"%");
854 aQueryString += sQuery +
"%'";
864 Reference< XPropertySet > aPropertySet(
m_xForm, UNO_QUERY );
865 if(!aPropertySet.is())
870 Reference< XComponent > xOldConnection;
871 aPropertySet->getPropertyValue(
"ActiveConnection") >>= xOldConnection;
874 if(!xConnection.is())
879 Any aVal; aVal <<= xConnection;
880 aPropertySet->setPropertyValue(
"ActiveConnection", aVal);
883 m_xParser.set(
xFactory->createInstance(
"com.sun.star.sdb.SingleSelectQueryComposer"), UNO_QUERY );
885 if(xOldConnection.is())
886 xOldConnection->dispose();
888 Sequence< OUString > aTableNameSeq;
889 Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY);
890 if(xSupplyTables.is())
892 Reference< XNameAccess > xAccess = xSupplyTables->getTables();
893 aTableNameSeq = xAccess->getElementNames();
895 if(aTableNameSeq.hasElements())
899 aPropertySet->setPropertyValue(
"Command", aVal);
900 aPropertySet->setPropertyValue(
"CommandType",
Any(CommandType::TABLE));
902 aVal <<= sal_Int32(50);
903 aPropertySet->setPropertyValue(
"FetchSize", aVal);
904 OUString aString(
"SELECT * FROM ");
906 Reference<XDatabaseMetaData> xMetaData = xConnection->getMetaData();
907 aQuoteChar = xMetaData->getIdentifierQuoteString();
929 aURL.Complete =
".uno:Bib/source";
944 Reference< XPropertySet > aPropertySet(
m_xForm, UNO_QUERY );
946 if(aPropertySet.is())
949 Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY);
950 Reference< XNameAccess > xAccess = xSupplyTables->getTables();
951 Sequence< OUString > aTableNameSeq = xAccess->getElementNames();
952 sal_uInt32
nCount = aTableNameSeq.getLength();
954 const OUString* pTableNames = aTableNameSeq.getConstArray();
955 const OUString* pTableNamesEnd = pTableNames +
nCount;
957 for ( ; pTableNames != pTableNamesEnd; ++pTableNames )
959 if ( rTable == *pTableNames )
962 Any aVal; aVal <<= rTable;
963 aPropertySet->setPropertyValue(
"Command", aVal );
967 if (pTableNames != pTableNamesEnd)
969 Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
970 aQuoteChar = xMetaData->getIdentifierQuoteString();
974 m_xParser.set(
xFactory->createInstance(
"com.sun.star.sdb.SingleSelectQueryComposer"), UNO_QUERY );
976 OUString aString(
"SELECT * FROM ");
998 OSL_FAIL(
"::setActiveDataTable: something went wrong !");
1009 Reference< XLoadable > xFormAsLoadable(
m_xForm, UNO_QUERY );
1010 DBG_ASSERT( xFormAsLoadable.is() || !
m_xForm.is(),
"BibDataManager::load: invalid form!");
1011 if ( xFormAsLoadable.is() )
1013 xFormAsLoadable->load();
1016 EventObject aEvt(
static_cast< XWeak*
>(
this ) );
1028 Reference< XLoadable >xFormAsLoadable(
m_xForm, UNO_QUERY );
1029 DBG_ASSERT( xFormAsLoadable.is() || !
m_xForm.is(),
"BibDataManager::unload: invalid form!");
1030 if ( !xFormAsLoadable.is() )
1033 EventObject aEvt(
static_cast< XWeak*
>(
this ) );
1040 xFormAsLoadable->unload();
1055 Reference< XLoadable >xFormAsLoadable(
m_xForm, UNO_QUERY );
1056 DBG_ASSERT( xFormAsLoadable.is() || !
m_xForm.is(),
"BibDataManager::unload: invalid form!");
1057 if ( !xFormAsLoadable.is() )
1060 EventObject aEvt(
static_cast< XWeak*
>(
this ) );
1067 xFormAsLoadable->reload();
1078 Reference< XLoadable >xFormAsLoadable(
m_xForm, UNO_QUERY );
1079 DBG_ASSERT( xFormAsLoadable.is() || !
m_xForm.is(),
"BibDataManager::isLoaded: invalid form!");
1081 bool bLoaded =
false;
1082 if ( xFormAsLoadable.is() )
1083 bLoaded = xFormAsLoadable->isLoaded();
1104 Reference< awt::XControlModel >
xModel;
1111 xModel.set( xObject, UNO_QUERY );
1114 Reference< XPropertySet > xPropSet(
xModel, UNO_QUERY );
1115 xPropSet->setPropertyValue(
"Name",
Any( rName ) );
1118 Any aAny(OUString(
"com.sun.star.form.control.InteractionGridControl"));
1119 xPropSet->setPropertyValue(
"DefaultControl",aAny );
1122 OUString uProp(
"HelpURL");
1123 Reference< XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo();
1124 if (xPropInfo->hasPropertyByName(uProp))
1126 xPropSet->setPropertyValue(
1132 OSL_FAIL(
"::createGridModel: something went wrong !");
1144 case DataType::BOOLEAN:
1147 case DataType::TINYINT:
1148 case DataType::SMALLINT:
1149 case DataType::INTEGER:
1150 aResStr=
"NumericField";
1152 case DataType::REAL:
1153 case DataType::DOUBLE:
1154 case DataType::NUMERIC:
1155 case DataType::DECIMAL:
1156 aResStr=
"FormattedField";
1158 case DataType::TIMESTAMP:
1159 aResStr=
"FormattedField";
1161 case DataType::DATE:
1162 aResStr=
"DateField";
1164 case DataType::TIME:
1165 aResStr=
"TimeField";
1167 case DataType::CHAR:
1168 case DataType::VARCHAR:
1169 case DataType::LONGVARCHAR:
1171 aResStr=
"TextField";
1178 const OUString& rName,
bool bForceListBox)
1180 Reference< awt::XControlModel >
xModel;
1181 OUString
aName =
"View_" + rName;
1188 Reference< XPropertySet > xField;
1192 if(xFields->hasByName(rName))
1194 aElement = xFields->getByName(rName);
1195 aElement >>= xField;
1197 sal_Int32 nFormatKey = 0;
1198 xField->getPropertyValue(
"Type") >>= nFormatKey;
1200 OUString aInstanceName(
"com.sun.star.form.component.");
1203 aInstanceName +=
"ListBox";
1208 Reference< XInterface > xObject = xContext->getServiceManager()->createInstanceWithContext(aInstanceName, xContext);
1209 xModel.set( xObject, UNO_QUERY );
1210 Reference< XPropertySet > xPropSet(
xModel, UNO_QUERY );
1211 Any aFieldName; aFieldName <<=
aName;
1215 xPropSet->setPropertyValue(
"NativeWidgetLook",
Any(
true ) );
1222 aAny <<= sal_Int16(1);
1223 xPropSet->setPropertyValue(
"BoundColumn", aAny);
1224 aAny <<= ListSourceType_VALUELIST;
1225 xPropSet->setPropertyValue(
"ListSourceType", aAny);
1227 uno::Sequence<OUString> aListSource(
TYPE_COUNT);
1228 OUString* pListSourceArr = aListSource.getArray();
1231 pListSourceArr[
i] = OUString::number(
i);
1232 aAny <<= aListSource;
1234 xPropSet->setPropertyValue(
"ListSource", aAny);
1236 uno::Sequence<OUString> aValues(
TYPE_COUNT + 1);
1237 OUString* pValuesArr = aValues.getArray();
1238 pValuesArr[0] =
BibResId(ST_TYPE_ARTICLE);
1239 pValuesArr[1] =
BibResId(ST_TYPE_BOOK);
1240 pValuesArr[2] =
BibResId(ST_TYPE_BOOKLET);
1241 pValuesArr[3] =
BibResId(ST_TYPE_CONFERENCE);
1242 pValuesArr[4] =
BibResId(ST_TYPE_INBOOK );
1243 pValuesArr[5] =
BibResId(ST_TYPE_INCOLLECTION);
1244 pValuesArr[6] =
BibResId(ST_TYPE_INPROCEEDINGS);
1245 pValuesArr[7] =
BibResId(ST_TYPE_JOURNAL );
1246 pValuesArr[8] =
BibResId(ST_TYPE_MANUAL );
1247 pValuesArr[9] =
BibResId(ST_TYPE_MASTERSTHESIS);
1248 pValuesArr[10] =
BibResId(ST_TYPE_MISC );
1249 pValuesArr[11] =
BibResId(ST_TYPE_PHDTHESIS );
1250 pValuesArr[12] =
BibResId(ST_TYPE_PROCEEDINGS );
1251 pValuesArr[13] =
BibResId(ST_TYPE_TECHREPORT );
1252 pValuesArr[14] =
BibResId(ST_TYPE_UNPUBLISHED );
1253 pValuesArr[15] =
BibResId(ST_TYPE_EMAIL );
1254 pValuesArr[16] =
BibResId(ST_TYPE_WWW );
1255 pValuesArr[17] =
BibResId(ST_TYPE_CUSTOM1 );
1256 pValuesArr[18] =
BibResId(ST_TYPE_CUSTOM2 );
1257 pValuesArr[19] =
BibResId(ST_TYPE_CUSTOM3 );
1258 pValuesArr[20] =
BibResId(ST_TYPE_CUSTOM4 );
1259 pValuesArr[21] =
BibResId(ST_TYPE_CUSTOM5 );
1265 xPropSet->setPropertyValue(
"StringItemList", aAny);
1267 xPropSet->setPropertyValue(
"Dropdown",
Any(
true) );
1270 Reference< XFormComponent > aFormComp(
xModel,UNO_QUERY );
1272 Reference< XNameContainer > xNameCont(
m_xForm, UNO_QUERY );
1273 xNameCont->insertByName(
aName,
Any( aFormComp ) );
1286 Reference< XLoadable > xLoad(
m_xForm, UNO_QUERY );
1287 if ( xLoad.is() && xLoad->isLoaded() )
1289 Reference< XLoadListener > xListener( aFormComp, UNO_QUERY );
1290 if ( xListener.is() )
1292 EventObject aLoadSource;
1293 aLoadSource.Source = xLoad;
1294 xListener->loaded( aLoadSource );
1301 OSL_FAIL(
"::loadControlModel: something went wrong !");
1308 MappingDialog_Impl aDlg(pParent,
this);
1318 DBChangeDialog_Impl aDlg(pParent,
this);
1319 if (aDlg.run() ==
RET_OK)
1321 OUString sNewURL = aDlg.GetCurrentURL();
1333 pToolbar->SendDispatch(
pToolbar->GetChangeSourceId(), Sequence< PropertyValue >());
1349 for(
const auto & aColumnPair :
pMapping->aColumnPairs)
1374 m_xFormCtrl = form::runtime::FormController::create(xContext);
1375 m_xFormCtrl->setModel(uno::Reference< awt::XTabControllerModel > (
getForm(), UNO_QUERY));
Reference< XExecutableDialog > m_xDialog
const char *const aFieldNames[]
OUString BibResId(TranslateId aId)
const Mapping * GetMapping(const BibDBDescriptor &rDesc) const
const OUString & GetDefColumnName(sal_uInt16 nIndex) const
void SetMapping(const BibDBDescriptor &rDesc, const Mapping *pMapping)
const OUString & getQueryField() const
void setQueryText(const OUString &rSet)
const OUString & getQueryText() const
void SetBibliographyURL(const BibDBDescriptor &rDesc)
void setQueryField(const OUString &rSet)
css::uno::Reference< css::frame::XDispatch > m_xFormDispatch
VclPtr< ::bib::BibView > pBibView
const OUString & GetIdentifierMapping()
virtual sal_Bool SAL_CALL isLoaded() override
static css::uno::Reference< css::awt::XControlModel > createGridModel(const OUString &rName)
const OUString & getActiveDataTable() const
void DispatchDBChangeDialog()
css::uno::Reference< css::form::runtime::XFormController > m_xFormCtrl
VclPtr< BibToolBar > pToolbar
OUString sIdentifierMapping
void CreateMappingDialog(weld::Window *pParent)
css::uno::Reference< css::form::XForm > m_xForm
::comphelper::OInterfaceContainerHelper4< css::form::XLoadListener > m_aLoadListeners
rtl::Reference< BibInterceptorHelper > m_xInterceptorHelper
css::uno::Reference< css::awt::XControlModel > loadControlModel(const OUString &rName, bool bForceListBox)
void setActiveDataTable(const OUString &rTable)
OUString getQueryField() const
void ResetIdentifierMapping()
css::uno::Sequence< OUString > getDataSources() const
const OUString & getActiveDataSource() const
css::uno::Reference< css::form::XForm > createDatabaseForm(BibDBDescriptor &aDesc)
void InsertFields(const css::uno::Reference< css::form::XFormComponent > &xGrid)
virtual void SAL_CALL unload() override
virtual void SAL_CALL reload() override
virtual void SAL_CALL removeLoadListener(const css::uno::Reference< css::form::XLoadListener > &aListener) override
virtual ~BibDataManager() override
OUString CreateDBChangeDialog(weld::Window *pParent)
void setFilter(const OUString &rQuery)
OUString getFilter() const
css::uno::Reference< css::sdb::XSingleSelectQueryComposer > m_xParser
virtual void SAL_CALL load() override
bool HasActiveConnection() const
static OUString getControlName(sal_Int32 nFormatKey)
virtual void SAL_CALL addLoadListener(const css::uno::Reference< css::form::XLoadListener > &aListener) override
css::uno::Reference< css::awt::XControlModel > updateGridModel()
const css::uno::Reference< css::form::XForm > & getForm() const
void RegisterInterceptor(const ::bib::BibBeamer *pBibBeamer)
void startQueryWith(const OUString &rQuery)
css::uno::Sequence< OUString > getQueryFields() const
void setActiveDataSource(const OUString &rURL)
OUString aActiveDataTable
void SetToolbar(BibToolBar *pSet)
css::uno::Reference< css::form::runtime::XFormController > const & GetFormController()
css::uno::Reference< css::awt::XControlModel > m_xGridModel
virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider() override
virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL &aURL, const OUString &aTargetFrameName, sal_Int32 nSearchFlags) override
void ReleaseInterceptor()
BibInterceptorHelper(const ::bib::BibBeamer *pBibBeamer, css::uno::Reference< css::frame::XDispatch > const &xDispatch)
css::uno::Reference< css::frame::XDispatch > xFormDispatch
css::uno::Reference< css::frame::XDispatchProvider > xSlaveDispatchProvider
virtual void SAL_CALL setSlaveDispatchProvider(const css::uno::Reference< css::frame::XDispatchProvider > &xNewSlaveDispatchProvider) override
virtual void SAL_CALL setMasterDispatchProvider(const css::uno::Reference< css::frame::XDispatchProvider > &xNewMasterDispatchProvider) override
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches(const css::uno::Sequence< css::frame::DispatchDescriptor > &aDescripts) override
virtual ~BibInterceptorHelper() override
css::uno::Reference< css::frame::XDispatchProviderInterception > xInterception
virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider() override
css::uno::Reference< css::frame::XDispatchProvider > xMasterDispatchProvider
static BibConfig * GetConfig()
sal_Int32 addInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
void notifyEach(std::unique_lock< std::mutex > &rGuard, void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event) const
sal_Int32 removeInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
IMPL_LINK_NOARG(MappingDialog_Impl, OkHdl, weld::Button &, void)
IMPL_LINK(MappingDialog_Impl, ListBoxSelectHdl, weld::ComboBox &, rListBox, void)
constexpr OUStringLiteral FM_PROP_LABEL
constexpr OUStringLiteral FM_PROP_CONTROLSOURCE
constexpr OUStringLiteral FM_PROP_NAME
static Reference< XNameAccess > getColumns(const Reference< XForm > &_rxForm)
static Reference< XConnection > getConnection(const OUString &_rURL)
static sal_uInt16 lcl_FindLogicalName(BibConfig const *pConfig, std::u16string_view rLogicalColumnName)
constexpr OUStringLiteral gGridName(u"theGrid")
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
Reference< XDispatch > xDispatch
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
Reference< XSingleServiceFactory > xFactory
#define HID_BIB_DB_GRIDCTRL
#define LINK(Instance, Class, Member)
Sequence< sal_Int8 > aSeq
#define SAL_INFO(area, stream)
Reference< XMultiServiceFactory > getProcessServiceFactory()
Reference< XComponentContext > getProcessComponentContext()
StringPair aColumnPairs[COLUMN_COUNT]
OUString sLogicalColumnName
Reference< XModel > xModel
constexpr OUStringLiteral sNone
constexpr OUStringLiteral INET_HID_SCHEME