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

Generated by: LCOV version 1.10