LCOV - code coverage report
Current view: top level - dbaccess/source/ui/dlg - DriverSettings.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 14 0.0 %
Date: 2014-11-03 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : 
      21             : #include "DriverSettings.hxx"
      22             : #include "dsmeta.hxx"
      23             : 
      24             : #include <com/sun/star/uno/Sequence.hxx>
      25             : #include <com/sun/star/beans/NamedValue.hpp>
      26             : 
      27             : #include <connectivity/DriversConfig.hxx>
      28             : 
      29             : using ::com::sun::star::uno::Sequence;
      30             : using ::com::sun::star::beans::NamedValue;
      31             : 
      32             : using namespace dbaui;
      33           0 : void ODriversSettings::getSupportedIndirectSettings( const OUString& _sURLPrefix,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext, ::std::vector< sal_Int32>& _out_rDetailsIds )
      34             : {
      35             :     // for a number of settings, we do not need to use hard-coded here, but can ask a
      36             :     // central DataSourceUI instance.
      37           0 :     DataSourceMetaData aMeta( _sURLPrefix );
      38           0 :     const FeatureSet& rFeatures( aMeta.getFeatureSet() );
      39           0 :     for (   FeatureSet::const_iterator feature = rFeatures.begin();
      40           0 :             feature != rFeatures.end();
      41             :             ++feature
      42             :         )
      43             :     {
      44           0 :         _out_rDetailsIds.push_back( *feature );
      45             :     }
      46             : 
      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.
      53             : 
      54           0 :     ::connectivity::DriversConfig aDriverConfig(_xContext);
      55           0 :     const ::comphelper::NamedValueCollection& aProperties = aDriverConfig.getProperties(_sURLPrefix);
      56             : #if OSL_DEBUG_LEVEL > 0
      57             :     {
      58             :         Sequence< NamedValue > aNamedValues;
      59             :         aProperties >>= aNamedValues;
      60             :         for (   const NamedValue* loop = aNamedValues.getConstArray();
      61             :                 loop != aNamedValues.getConstArray() + aNamedValues.getLength();
      62             :                 ++loop
      63             :             )
      64             :         {
      65             :             int dummy = 0;
      66             :             (void)dummy;
      67             :         }
      68             :     }
      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())
      94           0 :     };
      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           0 :     for ( TProperties* pProps = aProps; pProps->first; ++pProps )
     102             :     {
     103           0 :         if ( aProperties.has(pProps->second) )
     104           0 :             _out_rDetailsIds.push_back(pProps->first);
     105           0 :     }
     106           0 : }
     107             : 
     108             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10