LCOV - code coverage report
Current view: top level - svx/inc/svx - dbtoolsclient.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 2 100.0 %
Date: 2012-08-25 Functions: 2 3 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 4 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef SVX_DBTOOLSCLIENT_HXX
      30                 :            : #define SVX_DBTOOLSCLIENT_HXX
      31                 :            : 
      32                 :            : #include <connectivity/virtualdbtools.hxx>
      33                 :            : #include <osl/mutex.hxx>
      34                 :            : #include <osl/module.h>
      35                 :            : #include <tools/solar.h>
      36                 :            : #include <unotools/sharedunocomponent.hxx>
      37                 :            : #include "svx/svxdllapi.h"
      38                 :            : 
      39                 :            : //........................................................................
      40                 :            : namespace svxform
      41                 :            : {
      42                 :            : //........................................................................
      43                 :            : 
      44                 :            :     typedef ::utl::SharedUNOComponent< ::com::sun::star::sdbc::XConnection > SharedConnection;
      45                 :            : 
      46                 :            :     //====================================================================
      47                 :            :     //= ODbtoolsClient
      48                 :            :     //====================================================================
      49                 :            :     /** base class for classes which want to use dbtools features with load-on-call
      50                 :            :         of the dbtools lib.
      51                 :            :     */
      52                 :            :     class SVX_DLLPUBLIC ODbtoolsClient
      53                 :            :     {
      54                 :            :     private:
      55                 :            :         static  sal_Int32       s_nClients;
      56                 :            :         static oslModule        s_hDbtoolsModule;
      57                 :            :         static ::connectivity::simple::createDataAccessToolsFactoryFunction
      58                 :            :                                 s_pFactoryCreationFunc;
      59                 :            : 
      60                 :            :         mutable sal_Bool            m_bCreateAlready;
      61                 :            : 
      62                 :            :     private:
      63                 :            :         mutable ::rtl::Reference< ::connectivity::simple::IDataAccessToolsFactory > m_xDataAccessFactory;
      64                 :            : 
      65                 :            :     protected:
      66                 :            :         ODbtoolsClient();
      67                 :            :         virtual ~ODbtoolsClient();
      68                 :            : 
      69                 :            :         virtual bool ensureLoaded() const;
      70                 :            : 
      71                 :            :     protected:
      72                 :            :         const ::rtl::Reference< ::connectivity::simple::IDataAccessToolsFactory >&
      73                 :        487 :             getFactory() const { return m_xDataAccessFactory; }
      74                 :            : 
      75                 :            :     private:
      76                 :            :         static void registerClient();
      77                 :            :         static void revokeClient();
      78                 :            :     };
      79                 :            : 
      80                 :            :     //====================================================================
      81                 :            :     //= OStaticDataAccessTools
      82                 :            :     //====================================================================
      83 [ +  - ][ -  + ]:       1987 :     class SVX_DLLPUBLIC OStaticDataAccessTools : public ODbtoolsClient
      84                 :            :     {
      85                 :            :     protected:
      86                 :            :         mutable ::rtl::Reference< ::connectivity::simple::IDataAccessTools >    m_xDataAccessTools;
      87                 :            : 
      88                 :            :     protected:
      89                 :            :         virtual bool ensureLoaded() const;
      90                 :            : 
      91                 :            :     public:
      92                 :            :         OStaticDataAccessTools();
      93                 :            : 
      94                 :            :         const ::rtl::Reference< ::connectivity::simple::IDataAccessTools >& getDataAccessTools() const { return m_xDataAccessTools; }
      95                 :            : 
      96                 :            :         // ------------------------------------------------
      97                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> getNumberFormats(
      98                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn,
      99                 :            :             sal_Bool _bAllowDefault
     100                 :            :         ) const;
     101                 :            : 
     102                 :            :         // ------------------------------------------------
     103                 :            :         sal_Int32 getDefaultNumberFormat(
     104                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xColumn,
     105                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _xTypes,
     106                 :            :             const ::com::sun::star::lang::Locale& _rLocale );
     107                 :            : 
     108                 :            :         // ------------------------------------------------
     109                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection_withFeedback(
     110                 :            :             const ::rtl::OUString& _rDataSourceName,
     111                 :            :             const ::rtl::OUString& _rUser,
     112                 :            :             const ::rtl::OUString& _rPwd,
     113                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory
     114                 :            :         ) const SAL_THROW ( (::com::sun::star::sdbc::SQLException) );
     115                 :            : 
     116                 :            :         // ------------------------------------------------
     117                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> connectRowset(
     118                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet,
     119                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory,
     120                 :            :             sal_Bool _bSetAsActiveConnection
     121                 :            :         ) const SAL_THROW ( ( ::com::sun::star::sdbc::SQLException
     122                 :            :                             , ::com::sun::star::lang::WrappedTargetException
     123                 :            :                             , ::com::sun::star::uno::RuntimeException) );
     124                 :            : 
     125                 :            :         // ------------------------------------------------
     126                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getRowSetConnection(
     127                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet)
     128                 :            :                 const SAL_THROW ( (::com::sun::star::uno::RuntimeException) );
     129                 :            : 
     130                 :            :         // ------------------------------------------------
     131                 :            :         void TransferFormComponentProperties(
     132                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxOld,
     133                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxNew,
     134                 :            :             const ::com::sun::star::lang::Locale& _rLocale
     135                 :            :         ) const;
     136                 :            : 
     137                 :            :         // ------------------------------------------------
     138                 :            :         ::rtl::OUString quoteName(
     139                 :            :             const ::rtl::OUString& _rQuote,
     140                 :            :             const ::rtl::OUString& _rName
     141                 :            :         ) const;
     142                 :            : 
     143                 :            :         // ------------------------------------------------
     144                 :            :         ::rtl::OUString composeTableNameForSelect(
     145                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
     146                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable
     147                 :            :         ) const;
     148                 :            : 
     149                 :            :         // ------------------------------------------------
     150                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > getDataSource(
     151                 :            :                 const ::rtl::OUString& _rsRegisteredName,
     152                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory
     153                 :            :             ) const;
     154                 :            : 
     155                 :            :         // ------------------------------------------------
     156                 :            :         /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::INSERT
     157                 :            :             @param      _rxCursorSet    the property set
     158                 :            :         */
     159                 :            :         sal_Bool canInsert(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const;
     160                 :            : 
     161                 :            :         // ------------------------------------------------
     162                 :            :         /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::UPDATE
     163                 :            :             @param      _rxCursorSet    the property set
     164                 :            :         */
     165                 :            :         sal_Bool canUpdate(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const;
     166                 :            : 
     167                 :            :         // ------------------------------------------------
     168                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
     169                 :            :             getFieldsByCommandDescriptor(
     170                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
     171                 :            :                 const sal_Int32 _nCommandType,
     172                 :            :                 const ::rtl::OUString& _rCommand,
     173                 :            :                 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxKeepFieldsAlive,
     174                 :            :                 ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL
     175                 :            :             )   SAL_THROW( ( ) );
     176                 :            : 
     177                 :            :         // ------------------------------------------------
     178                 :            :         bool isEmbeddedInDatabase(
     179                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
     180                 :            :             ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxActualConnection
     181                 :            :         );
     182                 :            : 
     183                 :            :         // ------------------------------------------------
     184                 :            :         bool isEmbeddedInDatabase(
     185                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent
     186                 :            :         );
     187                 :            :     };
     188                 :            : 
     189                 :            :     //====================================================================
     190                 :            :     //= DBToolsObjectFactory
     191                 :            :     //====================================================================
     192                 :            :     class SVX_DLLPUBLIC DBToolsObjectFactory : public ODbtoolsClient
     193                 :            :     {
     194                 :            :     public:
     195                 :            :         DBToolsObjectFactory();
     196                 :            :         ~DBToolsObjectFactory();
     197                 :            : 
     198                 :            :         // ------------------------------------------------
     199                 :            :         ::std::auto_ptr< ::dbtools::FormattedColumnValue >  createFormattedColumnValue(
     200                 :            :             const ::comphelper::ComponentContext& _rContext,
     201                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet,
     202                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
     203                 :            :         );
     204                 :            :     };
     205                 :            : 
     206                 :            : //........................................................................
     207                 :            : }   // namespace svxform
     208                 :            : //........................................................................
     209                 :            : 
     210                 :            : #endif // SVX_DBTOOLSCLIENT_HXX
     211                 :            : 
     212                 :            : 
     213                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10