LCOV - code coverage report
Current view: top level - include/svx - dbtoolsclient.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 2 2 100.0 %
Date: 2014-11-03 Functions: 2 3 66.7 %
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         474 :             getFactory() const { return m_xDataAccessFactory; }
      59             : 
      60             :     private:
      61             :         static void registerClient();
      62             :         static void revokeClient();
      63             :     };
      64             : 
      65        5920 :     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             :             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;
      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             :             bool _bSetAsActiveConnection
      99             :         ) const;
     100             : 
     101             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getRowSetConnection(
     102             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet)
     103             :                 const;
     104             : 
     105             :         void TransferFormComponentProperties(
     106             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxOld,
     107             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxNew,
     108             :             const ::com::sun::star::lang::Locale& _rLocale
     109             :         ) const;
     110             : 
     111             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > getDataSource(
     112             :                 const OUString& _rsRegisteredName,
     113             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
     114             :             ) const;
     115             : 
     116             :         /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::INSERT
     117             :             @param      _rxCursorSet    the property set
     118             :         */
     119             :         bool canInsert(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const;
     120             : 
     121             :         /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::UPDATE
     122             :             @param      _rxCursorSet    the property set
     123             :         */
     124             :         bool canUpdate(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const;
     125             : 
     126             :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
     127             :             getFieldsByCommandDescriptor(
     128             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
     129             :                 const sal_Int32 _nCommandType,
     130             :                 const OUString& _rCommand,
     131             :                 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxKeepFieldsAlive,
     132             :                 ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL
     133             :             );
     134             : 
     135             :         bool isEmbeddedInDatabase(
     136             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
     137             :             ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxActualConnection
     138             :         );
     139             : 
     140             :         bool isEmbeddedInDatabase(
     141             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent
     142             :         );
     143             :     };
     144             : 
     145             :     class SVX_DLLPUBLIC DBToolsObjectFactory : public ODbtoolsClient
     146             :     {
     147             :     public:
     148             :         DBToolsObjectFactory();
     149             :         virtual ~DBToolsObjectFactory();
     150             : 
     151             :         ::std::unique_ptr< ::dbtools::FormattedColumnValue >  createFormattedColumnValue(
     152             :             const css::uno::Reference<css::uno::XComponentContext>& _rContext,
     153             :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet,
     154             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
     155             :         );
     156             :     };
     157             : 
     158             : }   // namespace svxform
     159             : 
     160             : 
     161             : #endif // INCLUDED_SVX_DBTOOLSCLIENT_HXX
     162             : 
     163             : 
     164             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10