LCOV - code coverage report
Current view: top level - include/svx - dbtoolsclient.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 2 0.0 %
Date: 2014-04-14 Functions: 0 3 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_SVX_DBTOOLSCLIENT_HXX
      21             : #define INCLUDED_SVX_DBTOOLSCLIENT_HXX
      22             : 
      23             : #include <connectivity/virtualdbtools.hxx>
      24             : #include <osl/mutex.hxx>
      25             : #include <osl/module.h>
      26             : #include <svx/svxdllapi.h>
      27             : #include <tools/solar.h>
      28             : #include <unotools/sharedunocomponent.hxx>
      29             : 
      30             : namespace svxform
      31             : {
      32             :     typedef ::utl::SharedUNOComponent< ::com::sun::star::sdbc::XConnection > SharedConnection;
      33             : 
      34             :     /** base class for classes which want to use dbtools features with load-on-call
      35             :         of the dbtools lib.
      36             :     */
      37             :     class SVX_DLLPUBLIC ODbtoolsClient
      38             :     {
      39             :     private:
      40             :         static  sal_Int32       s_nClients;
      41             :         static oslModule        s_hDbtoolsModule;
      42             :         static ::connectivity::simple::createDataAccessToolsFactoryFunction
      43             :                                 s_pFactoryCreationFunc;
      44             : 
      45             :         mutable bool            m_bCreateAlready;
      46             : 
      47             :     private:
      48             :         mutable ::rtl::Reference< ::connectivity::simple::IDataAccessToolsFactory > m_xDataAccessFactory;
      49             : 
      50             :     protected:
      51             :         ODbtoolsClient();
      52             :         virtual ~ODbtoolsClient();
      53             : 
      54             :         virtual bool ensureLoaded() const;
      55             : 
      56             :     protected:
      57             :         const ::rtl::Reference< ::connectivity::simple::IDataAccessToolsFactory >&
      58           0 :             getFactory() const { return m_xDataAccessFactory; }
      59             : 
      60             :     private:
      61             :         static void registerClient();
      62             :         static void revokeClient();
      63             :     };
      64             : 
      65           0 :     class SVX_DLLPUBLIC OStaticDataAccessTools : public ODbtoolsClient
      66             :     {
      67             :     protected:
      68             :         mutable ::rtl::Reference< ::connectivity::simple::IDataAccessTools >    m_xDataAccessTools;
      69             : 
      70             :     protected:
      71             :         virtual bool ensureLoaded() const SAL_OVERRIDE;
      72             : 
      73             :     public:
      74             :         OStaticDataAccessTools();
      75             : 
      76             :         const ::rtl::Reference< ::connectivity::simple::IDataAccessTools >& getDataAccessTools() const { return m_xDataAccessTools; }
      77             : 
      78             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> getNumberFormats(
      79             :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn,
      80             :             sal_Bool _bAllowDefault
      81             :         ) const;
      82             : 
      83             :         sal_Int32 getDefaultNumberFormat(
      84             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xColumn,
      85             :             const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _xTypes,
      86             :             const ::com::sun::star::lang::Locale& _rLocale );
      87             : 
      88             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection_withFeedback(
      89             :             const OUString& _rDataSourceName,
      90             :             const OUString& _rUser,
      91             :             const OUString& _rPwd,
      92             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
      93             :         ) const SAL_THROW ( (::com::sun::star::sdbc::SQLException) );
      94             : 
      95             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> connectRowset(
      96             :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet,
      97             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext,
      98             :             sal_Bool _bSetAsActiveConnection
      99             :         ) const SAL_THROW ( ( ::com::sun::star::sdbc::SQLException
     100             :                             , ::com::sun::star::lang::WrappedTargetException
     101             :                             , ::com::sun::star::uno::RuntimeException) );
     102             : 
     103             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getRowSetConnection(
     104             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet)
     105             :                 const SAL_THROW ( (::com::sun::star::uno::RuntimeException) );
     106             : 
     107             :         void TransferFormComponentProperties(
     108             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxOld,
     109             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxNew,
     110             :             const ::com::sun::star::lang::Locale& _rLocale
     111             :         ) const;
     112             : 
     113             :         OUString quoteName(
     114             :             const OUString& _rQuote,
     115             :             const OUString& _rName
     116             :         ) const;
     117             : 
     118             :         OUString composeTableNameForSelect(
     119             :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
     120             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable
     121             :         ) const;
     122             : 
     123             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > getDataSource(
     124             :                 const OUString& _rsRegisteredName,
     125             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
     126             :             ) const;
     127             : 
     128             :         /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::INSERT
     129             :             @param      _rxCursorSet    the property set
     130             :         */
     131             :         bool canInsert(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const;
     132             : 
     133             :         /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::UPDATE
     134             :             @param      _rxCursorSet    the property set
     135             :         */
     136             :         bool canUpdate(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const;
     137             : 
     138             :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
     139             :             getFieldsByCommandDescriptor(
     140             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
     141             :                 const sal_Int32 _nCommandType,
     142             :                 const OUString& _rCommand,
     143             :                 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxKeepFieldsAlive,
     144             :                 ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL
     145             :             )   SAL_THROW( ( ) );
     146             : 
     147             :         bool isEmbeddedInDatabase(
     148             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
     149             :             ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxActualConnection
     150             :         );
     151             : 
     152             :         bool isEmbeddedInDatabase(
     153             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent
     154             :         );
     155             :     };
     156             : 
     157             :     class SVX_DLLPUBLIC DBToolsObjectFactory : public ODbtoolsClient
     158             :     {
     159             :     public:
     160             :         DBToolsObjectFactory();
     161             :         virtual ~DBToolsObjectFactory();
     162             : 
     163             :         ::std::auto_ptr< ::dbtools::FormattedColumnValue >  createFormattedColumnValue(
     164             :             const css::uno::Reference<css::uno::XComponentContext>& _rContext,
     165             :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet,
     166             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
     167             :         );
     168             :     };
     169             : 
     170             : }   // namespace svxform
     171             : 
     172             : 
     173             : #endif // INCLUDED_SVX_DBTOOLSCLIENT_HXX
     174             : 
     175             : 
     176             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10