1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DriverSettings.cxx,v $
10 * $Revision: 1.17.18.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
34 #include "DriverSettings.hxx"
35 #include "dsitems.hxx"
36 #include "datasourceui.hxx"
37 #include <connectivity/DriversConfig.hxx>
39 using namespace dbaui
;
40 void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString
& _sURLPrefix
,const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _xFactory
, ::std::vector
< sal_Int32
>& _out_rDetailsIds
)
42 // for a number of settings, we do not need to use hard-coded here, but can ask a
43 // central DataSourceUI instance.
44 DataSourceMetaData
aMeta(_sURLPrefix
);
45 DataSourceUI
aDSUI( aMeta
);
46 const USHORT nGenericKnownSettings
[] =
49 DSID_APPEND_TABLE_ALIAS
,
50 DSID_AS_BEFORE_CORRNAME
,
52 DSID_IGNOREDRIVER_PRIV
,
53 DSID_PARAMETERNAMESUBST
,
54 DSID_SUPPRESSVERSIONCL
,
58 DSID_CHECK_REQUIRED_FIELDS
,
59 DSID_AUTORETRIEVEENABLED
,
60 DSID_AUTOINCREMENTVALUE
,
61 DSID_AUTORETRIEVEVALUE
,
62 DSID_BOOLEANCOMPARISON
,
66 for ( const USHORT
* pGenericKnowSetting
= nGenericKnownSettings
; *pGenericKnowSetting
; ++pGenericKnowSetting
)
67 if ( aDSUI
.hasSetting( *pGenericKnowSetting
) )
68 _out_rDetailsIds
.push_back( *pGenericKnowSetting
);
70 // the rest is hard-coded. On the long run, all of this should be done via DataSourceUI::hasSetting
71 ::connectivity::DriversConfig
aDriverConfig(_xFactory
);
72 const ::comphelper::NamedValueCollection
& aProperties
= aDriverConfig
.getProperties(_sURLPrefix
);
73 typedef ::std::pair
<USHORT
, ::rtl::OUString
> TProperties
;
74 TProperties aProps
[] = { TProperties(DSID_SHOWDELETEDROWS
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowDeleted")))
75 ,TProperties(DSID_CHARSET
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet")))
76 ,TProperties(DSID_FIELDDELIMITER
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldDelimiter")))
77 ,TProperties(DSID_TEXTDELIMITER
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StringDelimiter")))
78 ,TProperties(DSID_DECIMALDELIMITER
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalDelimiter")))
79 ,TProperties(DSID_THOUSANDSDELIMITER
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ThousandDelimiter")))
80 ,TProperties(DSID_TEXTFILEEXTENSION
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Extension")))
81 ,TProperties(DSID_TEXTFILEHEADER
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderLine")))
82 ,TProperties(DSID_ADDITIONALOPTIONS
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SystemDriverSettings")))
83 ,TProperties(DSID_CONN_SHUTSERVICE
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShutdownDatabase")))
84 ,TProperties(DSID_CONN_DATAINC
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataCacheSizeIncrement")))
85 ,TProperties(DSID_CONN_CACHESIZE
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataCacheSize")))
86 ,TProperties(DSID_CONN_CTRLUSER
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlUser")))
87 ,TProperties(DSID_CONN_CTRLPWD
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlPassword")))
88 ,TProperties(DSID_USECATALOG
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseCatalog")))
89 ,TProperties(DSID_CONN_SOCKET
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LocalSocket")))
90 ,TProperties(DSID_JDBCDRIVERCLASS
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass")))
91 ,TProperties(DSID_CONN_LDAP_BASEDN
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseDN")))
92 ,TProperties(DSID_CONN_LDAP_ROWCOUNT
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MaxRowCount")))
93 ,TProperties(DSID_CONN_LDAP_USESSL
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseSSL")))
94 ,TProperties(DSID_IGNORECURRENCY
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreCurrency")))
95 ,TProperties(0,::rtl::OUString())
97 for ( TProperties
* pProps
= aProps
; pProps
->first
; ++pProps
)
99 if ( aProperties
.has(pProps
->second
) )
100 _out_rDetailsIds
.push_back(pProps
->first
);