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

Generated by: LCOV version 1.10