LCOV - code coverage report
Current view: top level - libreoffice/dbaccess/source/ui/inc - dbadmin.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 2 0.0 %
Date: 2012-12-27 Functions: 0 2 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_DBADMIN_HXX_
      21             : #define _DBAUI_DBADMIN_HXX_
      22             : 
      23             : #include <sfx2/tabdlg.hxx>
      24             : #include "dsntypes.hxx"
      25             : #include "IItemSetHelper.hxx"
      26             : #include <comphelper/uno3.hxx>
      27             : #include <memory>
      28             : 
      29             : namespace com { namespace sun { namespace star {
      30             :     namespace beans {
      31             :         class XPropertySet;
      32             :     }
      33             :     namespace sdbc {
      34             :         class XConnection;
      35             :     }
      36             :     namespace lang {
      37             :         class XMultiServiceFactory;
      38             :     }
      39             : }}}
      40             : 
      41             : //.........................................................................
      42             : namespace dbaui
      43             : {
      44             : //.........................................................................
      45             : 
      46             : //=========================================================================
      47             : //= ODbAdminDialog
      48             : //=========================================================================
      49             : class ODbDataSourceAdministrationHelper;
      50             : /** tab dialog for administrating the office wide registered data sources
      51             : */
      52             : class ODbAdminDialog : public SfxTabDialog , public IItemSetHelper, public IDatabaseSettingsDialog
      53             : {
      54             : private:
      55             :     typedef ::std::stack< sal_Int32 > PageStack;
      56             :     PageStack               m_aCurrentDetailPages;  // ids of all currently enabled (type-dependent) detail pages
      57             : 
      58             :     ::std::auto_ptr<ODbDataSourceAdministrationHelper>  m_pImpl;
      59             : 
      60             :     sal_Bool                m_bApplied : 1;     /// sal_True if any changes have been applied while the dialog was executing
      61             :     sal_Bool                m_bUIEnabled : 1;   /// <TRUE/> if the UI is enabled, false otherwise. Cannot be switched back to <TRUE/>, once it is <FALSE/>
      62             :     sal_uInt16                  m_nMainPageID;
      63             : 
      64             : public:
      65             :     /** ctor. The itemset given should have been created by <method>createItemSet</method> and should be destroyed
      66             :         after the dialog has been destroyed
      67             :     */
      68             :     ODbAdminDialog(Window* pParent,
      69             :         SfxItemSet* _pItems,
      70             :         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
      71             :         );
      72             :     virtual ~ODbAdminDialog();
      73             : 
      74             :     /** create and return an item set for use with the dialog.
      75             :         @param      _pTypeCollection        pointer to an <type>ODatasourceMap</type>. May be NULL, in this case
      76             :                                             the pool will not contain a typecollection default.
      77             :     */
      78             :     static SfxItemSet*  createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection);
      79             :     /** destroy and item set / item pool / pool defaults previously created by <method>createItemSet</method>
      80             :     */
      81             :     static void         destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults);
      82             : 
      83             :     /** selects the DataSource
      84             :         @param  _rName
      85             :             The name of the data source
      86             :     */
      87             :     void selectDataSource(const ::com::sun::star::uno::Any& _aDataSourceName);
      88             : 
      89             :     virtual const SfxItemSet* getOutputSet() const;
      90             :     virtual SfxItemSet* getWriteOutputSet();
      91             : 
      92             :     // forwards to ODbDataSourceAdministrationHelper
      93             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const;
      94             :     virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection();
      95             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver();
      96             :     virtual ::rtl::OUString getDatasourceType(const SfxItemSet& _rSet) const;
      97             :     virtual void clearPassword();
      98             :     virtual sal_Bool saveDatasource();
      99             :     virtual void setTitle(const ::rtl::OUString& _sTitle);
     100             :     virtual void enableConfirmSettings( bool _bEnable );
     101             : 
     102             : protected:
     103             :     // adds a new detail page and remove all the old ones
     104             :     void addDetailPage(sal_uInt16 _nPageId,sal_uInt16 _nTextId,CreateTabPage pCreateFunc);
     105             : 
     106             :     virtual void PageCreated(sal_uInt16 _nId, SfxTabPage& _rPage);
     107             :     virtual short Ok();
     108             : 
     109             : protected:
     110           0 :     inline sal_Bool isUIEnabled() const { return m_bUIEnabled; }
     111           0 :     inline void     disabledUI() { m_bUIEnabled = sal_False; }
     112             : 
     113             : private:
     114             :     /// select a datasource with a given name, adjust the item set accordingly, and everything like that ..
     115             :     void impl_selectDataSource(const ::com::sun::star::uno::Any& _aDataSourceName);
     116             :     /// reset the tag pages according to m_sCurrentDatasource and <arg>_rxDatasource</arg>
     117             :     void impl_resetPages(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDatasource);
     118             : 
     119             :     enum ApplyResult
     120             :     {
     121             :         AR_LEAVE_MODIFIED,      // somthing was modified and has successfully been committed
     122             :         AR_LEAVE_UNCHANGED,     // no changes were made
     123             :         AR_KEEP                 // don't leave the page (e.g. because an error occurred)
     124             :     };
     125             :     /** apply all changes made
     126             :     */
     127             :     ApplyResult implApplyChanges();
     128             : };
     129             : 
     130             : //.........................................................................
     131             : }   // namespace dbaui
     132             : //.........................................................................
     133             : 
     134             : #endif // _DBAUI_DBADMIN_HXX_
     135             : 
     136             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10