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

Generated by: LCOV version 1.11