LCOV - code coverage report
Current view: top level - include/dbaccess - dbsubcomponentcontroller.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 1 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 1 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_DBSUBCOMPONENTCONTROLLER_HXX
      21             : #define INCLUDED_DBACCESS_DBSUBCOMPONENTCONTROLLER_HXX
      22             : 
      23             : #include <dbaccess/genericcontroller.hxx>
      24             : 
      25             : #include <com/sun/star/document/XScriptInvocationContext.hpp>
      26             : #include <com/sun/star/sdbc/XConnection.hpp>
      27             : #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
      28             : #include <com/sun/star/sdbc/XDataSource.hpp>
      29             : #include <com/sun/star/util/XNumberFormatter.hpp>
      30             : #include <com/sun/star/util/XModifiable.hpp>
      31             : 
      32             : #include <comphelper/broadcasthelper.hxx>
      33             : #include <comphelper/proparrhlp.hxx>
      34             : #include <comphelper/propertycontainer.hxx>
      35             : #include <connectivity/dbmetadata.hxx>
      36             : #include <cppuhelper/implbase2.hxx>
      37             : 
      38             : #include <memory>
      39             : 
      40             : 
      41             : namespace dbaui
      42             : {
      43             : 
      44             : 
      45             : 
      46             :     //= DBSubComponentController
      47             : 
      48             :     class DBSubComponentController;
      49             : 
      50             :     typedef ::cppu::ImplInheritanceHelper2  <   OGenericUnoController
      51             :                                             ,   ::com::sun::star::document::XScriptInvocationContext
      52             :                                             ,   ::com::sun::star::util::XModifiable
      53             :                                             >   DBSubComponentController_Base;
      54             : 
      55             :     struct DBSubComponentController_Impl;
      56             :     class DBACCESS_DLLPUBLIC DBSubComponentController : public DBSubComponentController_Base
      57             :     {
      58             :     private:
      59             :         ::std::unique_ptr<DBSubComponentController_Impl> m_pImpl;
      60             : 
      61             :     private:
      62             :         /** forces usage of a connection which we do not own
      63             :             <p>To be used from within XInitialization::initialize, resp. impl_initialize, only.</p>
      64             :         */
      65             :         void        initializeConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxForeignConn );
      66             : 
      67             :     protected:
      68             :         // OGenericUnoController - initialization
      69             :         virtual void impl_initialize() SAL_OVERRIDE;
      70             : 
      71             :         // OGenericUnoController
      72             :         virtual void            Execute(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) SAL_OVERRIDE;
      73             : 
      74             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getPrivateModel() const SAL_OVERRIDE;
      75             : 
      76             :                 bool     impl_isModified() const;
      77             :         virtual void     impl_onModifyChanged();
      78             : 
      79             :     public:
      80             : 
      81             :         bool            isReadOnly()            const;
      82             :         bool            isEditable()            const;
      83             :         void            setEditable(bool _bEditable);
      84             : 
      85             : 
      86             :         // asking for connection-related stuff
      87             : 
      88             :         bool            isConnected() const;
      89             : 
      90             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >
      91             :                     getMetaData( ) const;
      92             : 
      93             : 
      94             :         // access to the data source / document
      95             :         OUString getDataSourceName() const;
      96             :         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >&
      97             :                     getDataSource() const;
      98             :         bool        haveDataSource() const;
      99             : 
     100             :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
     101             :                     getDatabaseDocument() const;
     102             : 
     103             :         /** provides access to the SDB-level database meta data of the current connection
     104             :         */
     105             :         const ::dbtools::DatabaseMetaData& getSdbMetaData() const;
     106             : 
     107             :         /** appends an error in the current environment.
     108             :         */
     109             :         void appendError(
     110             :                         const OUString& _rErrorMessage,
     111             :                         const ::dbtools::StandardSQLState _eSQLState = ::dbtools::SQL_GENERAL_ERROR,
     112             :                         const sal_Int32 _nErrorCode = 1000
     113             :                      );
     114             : 
     115             :         /** clears the error state.
     116             :         */
     117             :         void clearError();
     118             : 
     119             :         /** @return
     120             :                 <TRUE/> when an error was set otherwise <FALSE/>
     121             :         */
     122             :         bool hasError() const;
     123             : 
     124             :         /** returns the current error
     125             :         */
     126             :         const ::dbtools::SQLExceptionInfo& getError() const;
     127             : 
     128             :         /** displays the current error, or does nothing if there is no current error
     129             :         */
     130             :         void displayError();
     131             : 
     132             :         /** shows an info box with the string conntection lost.
     133             :         */
     134             :         void connectionLostMessage() const;
     135             : 
     136             :         /** gives access to the currently used connection
     137             :             @return
     138             :                 the currently used connection.
     139             :         */
     140             :         const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >&
     141             :                     getConnection() const;
     142             : 
     143             :         /** returns the number formatter
     144             :         */
     145             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >    getNumberFormatter() const;
     146             : 
     147             :         // ::com::sun::star::frame::XController
     148             :         virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     149             :         virtual sal_Bool SAL_CALL attachModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     150             : 
     151             :         // XScriptInvocationContext
     152             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedScripts > SAL_CALL getScriptContainer() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     153             : 
     154             :         // XModifiable
     155             :         virtual sal_Bool SAL_CALL isModified(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     156             :         virtual void SAL_CALL setModified( sal_Bool bModified ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     157             : 
     158             :         // XModifyBroadcaster
     159             :         virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     160             :         virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     161             : 
     162             :         // XTitle
     163             :         virtual OUString SAL_CALL getTitle(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     164             : 
     165             :     protected:
     166             :         DBSubComponentController(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxORB);
     167             :         virtual ~DBSubComponentController();
     168             : 
     169             :         void                disconnect();
     170             :         virtual void        reconnect( bool _bUI );
     171           0 :                 bool        ensureConnected( bool _bUI )    { if ( !isConnected() ) reconnect( _bUI ); return isConnected(); }
     172             : 
     173             :         /** called when our connection is being disposed
     174             :             <p>The default implementation does a reconnect</p>
     175             :         */
     176             :         virtual void losingConnection( );
     177             : 
     178             :     protected:
     179             :         // XEventListener
     180             :         virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     181             : 
     182             :         // OComponentHelper
     183             :         virtual void SAL_CALL disposing() SAL_OVERRIDE;
     184             : 
     185             :         // XInterface
     186             :         virtual ::com::sun::star::uno::Any  SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     187             : 
     188             :         // XTypeProvider
     189             :         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     190             : 
     191             :     protected:
     192             :         sal_Int32 getCurrentStartNumber() const;
     193             : 
     194             :     private:
     195             :         DBSubComponentController();    // never implemented
     196             :     };
     197             : 
     198             : 
     199             : }   // namespace dbaui
     200             : 
     201             : 
     202             : #endif // INCLUDED_DBACCESS_DBSUBCOMPONENTCONTROLLER_HXX
     203             : 
     204             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11