LCOV - code coverage report
Current view: top level - dbaccess/source/ui/dlg - DbAdminImpl.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 3 0.0 %
Date: 2014-11-03 Functions: 0 3 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             : #ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_DBADMINIMPL_HXX
      21             : #define INCLUDED_DBACCESS_SOURCE_UI_DLG_DBADMINIMPL_HXX
      22             : 
      23             : #include <sal/config.h>
      24             : 
      25             : #include <map>
      26             : #include <set>
      27             : 
      28             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      29             : #include <com/sun/star/beans/XPropertySet.hpp>
      30             : #include <com/sun/star/beans/PropertyValue.hpp>
      31             : #include <com/sun/star/sdb/XDatabaseContext.hpp>
      32             : #include <com/sun/star/sdbc/XConnection.hpp>
      33             : #include <com/sun/star/sdbc/XDriver.hpp>
      34             : #include "dsntypes.hxx"
      35             : #include <svl/itemset.hxx>
      36             : #include <com/sun/star/frame/XModel.hpp>
      37             : #include <svl/poolitem.hxx>
      38             : 
      39             : namespace vcl { class Window; }
      40             : namespace dbaui
      41             : {
      42             :     namespace DataSourceInfoConverter
      43             :     {
      44             :         void convert(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> & xContext,
      45             :                      const ::dbaccess::ODsnTypeCollection* _pCollection,
      46             :                      const OUString& _sOldURLPrefix,
      47             :                      const OUString& _sNewURLPrefix,
      48             :                      const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDatasource);
      49             :     };
      50             :     class IItemSetHelper;
      51             :     // ODbDataSourceAdministrationHelper
      52           0 :     class ODbDataSourceAdministrationHelper
      53             :     {
      54             :     public:
      55             :         typedef std::map<sal_Int32, OUString> MapInt2String;
      56             : 
      57             :     private:
      58             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
      59             :                             m_xContext;                 /// service factory
      60             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext >
      61             :                                 m_xDatabaseContext;     /// database context we're working in
      62             :         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >   m_xDatasource;
      63             :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >         m_xModel;
      64             : 
      65             :         ::com::sun::star::uno::Any              m_aDataSourceOrName;
      66             :         typedef ::std::set< OUString >   StringSet;
      67             :         typedef StringSet::const_iterator       ConstStringSetIterator;
      68             : 
      69             :         MapInt2String           m_aDirectPropTranslator;    /// translating property id's into names (direct properties of a data source)
      70             :         MapInt2String           m_aIndirectPropTranslator;  /// translating property id's into names (indirect properties of a data source)
      71             :         vcl::Window*                 m_pParent;
      72             :         IItemSetHelper*         m_pItemSetHelper;
      73             :     public:
      74             : 
      75             :         ODbDataSourceAdministrationHelper(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xORB
      76             :                                         ,vcl::Window* _pParent
      77             :                                         ,IItemSetHelper* _pItemSetHelper);
      78             : 
      79             :         /** translate the current dialog SfxItems into driver relevant PropertyValues
      80             :             @see successfullyConnected
      81             :         */
      82             :         bool    getCurrentSettings(::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rDriverParams);
      83             : 
      84             :         /** to be called if the settings got from getCurrentSettings have been used for successfully connecting
      85             :             @see getCurrentSettings
      86             :         */
      87             :         void        successfullyConnected();
      88             : 
      89             :         /// clear the password in the current data source's item set
      90             :         void        clearPassword();
      91             : 
      92           0 :         inline ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getORB() const { return m_xContext; }
      93             : 
      94             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext > getDatabaseContext() const { return m_xDatabaseContext; }
      95             : 
      96             :         /** creates a new connection. The caller is responsible to dispose it !!!!
      97             :         */
      98             :         ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool>      createConnection();
      99             : 
     100             :         /** return the corresponding driver for the selected URL
     101             :         */
     102             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver >         getDriver();
     103             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver >         getDriver(const OUString& _sURL);
     104             : 
     105             :         /** returns the data source the dialog is currently working with
     106             :         */
     107             :         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >   getCurrentDataSource();
     108             :         // returns the Url of a database document
     109             :         OUString            getDocumentUrl(SfxItemSet& _rDest);
     110             : 
     111             :         void setDataSourceOrName( const ::com::sun::star::uno::Any& _rDataSourceOrName );
     112             : 
     113             :         /** extracts the connection type from the given set<p/>
     114             :             The connection type is determined by the value of the DSN item, analyzed by the TypeCollection item.
     115             :         */
     116             :         static OUString getDatasourceType( const SfxItemSet& _rSet );
     117             : 
     118             :         /** returns the connection URL
     119             :             @return
     120             :                 The connection URL
     121             :         */
     122             :         OUString getConnectionURL() const;
     123             : 
     124             :         /// fill the necessary information from the url line
     125             :         void convertUrl(SfxItemSet& _rDest);
     126             : 
     127           0 :         const MapInt2String& getIndirectProperties() const { return m_aIndirectPropTranslator; }
     128             : 
     129             :         /** translates properties of an UNO data source into SfxItems
     130             :             @param  _rxSource
     131             :                 The data source
     132             :             @param  _rDest
     133             :                 The item set to fill.
     134             :         */
     135             :         void translateProperties(
     136             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxSource,
     137             :                 SfxItemSet& _rDest);
     138             : 
     139             :         /** translate SfxItems into properties of an UNO data source
     140             :             @param  _rSource
     141             :                 The item set to read from.
     142             :             @param  _rxDest
     143             :                 The data source to fill.
     144             :         */
     145             :         void translateProperties(
     146             :                 const SfxItemSet& _rSource,
     147             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDest);
     148             : 
     149             :         bool saveChanges(const SfxItemSet& _rSource);
     150             :     protected:
     151             :         /** fill a data source info array with the settings from a given item set
     152             :         */
     153             :         void fillDatasourceInfo(const SfxItemSet& _rSource, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo);
     154             : 
     155             :         /// translate the given value into an SfxPoolItem, put this into the given set under the given id
     156             :         void        implTranslateProperty(SfxItemSet& _rSet, sal_Int32  _nId, const ::com::sun::star::uno::Any& _rValue);
     157             : 
     158             :         /// translate the given SfxPoolItem into an <type scope="com.sun.star.Any">uno</type>
     159             :         ::com::sun::star::uno::Any implTranslateProperty(const SfxPoolItem* _pItem);
     160             : 
     161             :         /// translate the given SfxPoolItem into an <type scope="com.sun.star.Any">uno</type>, set it (under the given name) on the given property set
     162             :         void        implTranslateProperty(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxSet, const OUString& _rName, const SfxPoolItem* _pItem);
     163             : 
     164             :         /** check if the data source described by the given set needs authentication<p/>
     165             :             The return value depends on the data source type only.
     166             :         */
     167             :         bool            hasAuthentication(const SfxItemSet& _rSet) const;
     168             : 
     169             : #if OSL_DEBUG_LEVEL > 0
     170             :         OString translatePropertyId( sal_Int32 _nId );
     171             : #endif
     172             :     };
     173             : 
     174             : }   // namespace dbaui
     175             : 
     176             : #endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_DBADMINIMPL_HXX
     177             : 
     178             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10