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 #include <com/sun/star/uno/Sequence.hxx>
40 #include <com/sun/star/beans/NamedValue.hpp>
42 using ::com::sun::star::uno::Sequence
;
43 using ::com::sun::star::beans::NamedValue
;
45 using namespace dbaui
;
46 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
)
48 // for a number of settings, we do not need to use hard-coded here, but can ask a
49 // central DataSourceUI instance.
50 // TODO: isn't DataSourceUI obsolete, now that this is in the configuration?
51 DataSourceMetaData
aMeta(_sURLPrefix
);
52 DataSourceUI
aDSUI( aMeta
);
53 const USHORT nGenericKnownSettings
[] =
56 DSID_APPEND_TABLE_ALIAS
,
57 DSID_AS_BEFORE_CORRNAME
,
59 DSID_IGNOREDRIVER_PRIV
,
60 DSID_PARAMETERNAMESUBST
,
61 DSID_SUPPRESSVERSIONCL
,
65 DSID_CHECK_REQUIRED_FIELDS
,
66 DSID_AUTORETRIEVEENABLED
,
67 DSID_AUTOINCREMENTVALUE
,
68 DSID_AUTORETRIEVEVALUE
,
69 DSID_BOOLEANCOMPARISON
,
73 for ( const USHORT
* pGenericKnowSetting
= nGenericKnownSettings
; *pGenericKnowSetting
; ++pGenericKnowSetting
)
74 if ( aDSUI
.hasSetting( *pGenericKnowSetting
) )
75 _out_rDetailsIds
.push_back( *pGenericKnowSetting
);
77 // the rest is configuration-based
78 ::connectivity::DriversConfig
aDriverConfig(_xFactory
);
79 const ::comphelper::NamedValueCollection
& aProperties
= aDriverConfig
.getProperties(_sURLPrefix
);
80 #if OSL_DEBUG_LEVEL > 0
82 Sequence
< NamedValue
> aNamedValues
;
83 aProperties
>>= aNamedValues
;
84 for ( const NamedValue
* loop
= aNamedValues
.getConstArray();
85 loop
!= aNamedValues
.getConstArray() + aNamedValues
.getLength();
94 typedef ::std::pair
<USHORT
, ::rtl::OUString
> TProperties
;
95 TProperties aProps
[] = { TProperties(DSID_SHOWDELETEDROWS
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowDeleted")))
96 ,TProperties(DSID_CHARSET
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet")))
97 ,TProperties(DSID_FIELDDELIMITER
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldDelimiter")))
98 ,TProperties(DSID_TEXTDELIMITER
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StringDelimiter")))
99 ,TProperties(DSID_DECIMALDELIMITER
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalDelimiter")))
100 ,TProperties(DSID_THOUSANDSDELIMITER
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ThousandDelimiter")))
101 ,TProperties(DSID_TEXTFILEEXTENSION
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Extension")))
102 ,TProperties(DSID_TEXTFILEHEADER
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderLine")))
103 ,TProperties(DSID_ADDITIONALOPTIONS
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SystemDriverSettings")))
104 ,TProperties(DSID_CONN_SHUTSERVICE
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShutdownDatabase")))
105 ,TProperties(DSID_CONN_DATAINC
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataCacheSizeIncrement")))
106 ,TProperties(DSID_CONN_CACHESIZE
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataCacheSize")))
107 ,TProperties(DSID_CONN_CTRLUSER
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlUser")))
108 ,TProperties(DSID_CONN_CTRLPWD
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlPassword")))
109 ,TProperties(DSID_USECATALOG
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseCatalog")))
110 ,TProperties(DSID_CONN_SOCKET
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LocalSocket")))
111 ,TProperties(DSID_NAMED_PIPE
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NamedPipe")))
112 ,TProperties(DSID_JDBCDRIVERCLASS
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JavaDriverClass")))
113 ,TProperties(DSID_CONN_LDAP_BASEDN
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseDN")))
114 ,TProperties(DSID_CONN_LDAP_ROWCOUNT
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MaxRowCount")))
115 ,TProperties(DSID_CONN_LDAP_USESSL
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseSSL")))
116 ,TProperties(DSID_IGNORECURRENCY
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreCurrency")))
117 ,TProperties(0,::rtl::OUString())
119 // TODO: This mapping between IDs and property names already exists - in ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper.
120 // We should not duplicate it here.
121 for ( TProperties
* pProps
= aProps
; pProps
->first
; ++pProps
)
123 if ( aProperties
.has(pProps
->second
) )
124 _out_rDetailsIds
.push_back(pProps
->first
);