fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dbaccess / source / ui / dlg / DriverSettings.cxx
blobb613cd6975906066fa64cfdc36f46a8f89255532
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include "DriverSettings.hxx"
22 #include "dsmeta.hxx"
24 #include <com/sun/star/uno/Sequence.hxx>
25 #include <com/sun/star/beans/NamedValue.hpp>
27 #include <connectivity/DriversConfig.hxx>
29 using ::com::sun::star::uno::Sequence;
30 using ::com::sun::star::beans::NamedValue;
32 using namespace dbaui;
33 void ODriversSettings::getSupportedIndirectSettings( const OUString& _sURLPrefix,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext, ::std::vector< sal_Int32>& _out_rDetailsIds )
35 // for a number of settings, we do not need to use hard-coded here, but can ask a
36 // central DataSourceUI instance.
37 DataSourceMetaData aMeta( _sURLPrefix );
38 const FeatureSet& rFeatures( aMeta.getFeatureSet() );
39 for ( FeatureSet::const_iterator feature = rFeatures.begin();
40 feature != rFeatures.end();
41 ++feature
44 _out_rDetailsIds.push_back( *feature );
47 // the rest is configuration-based
48 // TODO: that's not really true: *everything* is configuration-based nowadays, even the FeatureSet obtained
49 // from the DataSourceMetaData has been initialized from the configuration. So in fact, we could consolidate
50 // the two blocks.
51 // The best approach would be to extend the FeatureSet to contain *all* known data source features, not only
52 // the ones from the "Advanced settings" UI.
54 ::connectivity::DriversConfig aDriverConfig(_xContext);
55 const ::comphelper::NamedValueCollection& aProperties = aDriverConfig.getProperties(_sURLPrefix);
56 #if OSL_DEBUG_LEVEL > 0
58 Sequence< NamedValue > aNamedValues;
59 aProperties >>= aNamedValues;
60 for ( const NamedValue* loop = aNamedValues.getConstArray();
61 loop != aNamedValues.getConstArray() + aNamedValues.getLength();
62 ++loop
65 int dummy = 0;
66 (void)dummy;
69 #endif
70 typedef ::std::pair<sal_uInt16, OUString> TProperties;
71 TProperties aProps[] = { TProperties(DSID_SHOWDELETEDROWS,OUString("ShowDeleted"))
72 ,TProperties(DSID_CHARSET,OUString("CharSet"))
73 ,TProperties(DSID_FIELDDELIMITER,OUString("FieldDelimiter"))
74 ,TProperties(DSID_TEXTDELIMITER,OUString("StringDelimiter"))
75 ,TProperties(DSID_DECIMALDELIMITER,OUString("DecimalDelimiter"))
76 ,TProperties(DSID_THOUSANDSDELIMITER,OUString("ThousandDelimiter"))
77 ,TProperties(DSID_TEXTFILEEXTENSION,OUString("Extension"))
78 ,TProperties(DSID_TEXTFILEHEADER,OUString("HeaderLine"))
79 ,TProperties(DSID_ADDITIONALOPTIONS,OUString("SystemDriverSettings"))
80 ,TProperties(DSID_CONN_SHUTSERVICE,OUString("ShutdownDatabase"))
81 ,TProperties(DSID_CONN_DATAINC,OUString("DataCacheSizeIncrement"))
82 ,TProperties(DSID_CONN_CACHESIZE,OUString("DataCacheSize"))
83 ,TProperties(DSID_CONN_CTRLUSER,OUString("ControlUser"))
84 ,TProperties(DSID_CONN_CTRLPWD,OUString("ControlPassword"))
85 ,TProperties(DSID_USECATALOG,OUString("UseCatalog"))
86 ,TProperties(DSID_CONN_SOCKET,OUString("LocalSocket"))
87 ,TProperties(DSID_NAMED_PIPE,OUString("NamedPipe"))
88 ,TProperties(DSID_JDBCDRIVERCLASS,OUString("JavaDriverClass"))
89 ,TProperties(DSID_CONN_LDAP_BASEDN,OUString("BaseDN"))
90 ,TProperties(DSID_CONN_LDAP_ROWCOUNT,OUString("MaxRowCount"))
91 ,TProperties(DSID_CONN_LDAP_USESSL,OUString("UseSSL"))
92 ,TProperties(DSID_IGNORECURRENCY,OUString("IgnoreCurrency"))
93 ,TProperties(0,OUString())
95 // TODO: This mapping between IDs and property names already exists - in ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper.
96 // Another mapping (which is also duplicated in ODbDataSourceAdministrationHelper) exists in dsmeta.cxx. We should
97 // consolidate those three places into one.
98 // However, care has to be taken: We need to distinguish between "features" and "properties" of a data source (resp. driver).
99 // That is, a driver can support a certain property, but not allow to change it in the UI, which means it would
100 // not have the respective "feature".
101 for ( TProperties* pProps = aProps; pProps->first; ++pProps )
103 if ( aProperties.has(pProps->second) )
104 _out_rDetailsIds.push_back(pProps->first);
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */