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

Generated by: LCOV version 1.10