LCOV - code coverage report
Current view: top level - libreoffice/dbaccess/source/ui/inc - TableCopyHelper.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 14 0.0 %
Date: 2012-12-27 Functions: 0 8 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             : #ifndef DBUI_TABLECOPYHELPER_HXX
      20             : #define DBUI_TABLECOPYHELPER_HXX
      21             : 
      22             : #include "AppElementType.hxx"
      23             : #include "commontypes.hxx"
      24             : #include <svx/dataaccessdescriptor.hxx>
      25             : #include <sot/storage.hxx>
      26             : #include <svtools/transfer.hxx>
      27             : #include <com/sun/star/sdbc/XConnection.hpp>
      28             : #include <com/sun/star/sdbc/XResultSet.hpp>
      29             : #include <functional>
      30             : 
      31             : class SvTreeListEntry;
      32             : //........................................................................
      33             : namespace dbaui
      34             : {
      35             : //........................................................................
      36             :     class OGenericUnoController;
      37             :     /// unary_function Functor object for class DataFlavorExVector::value_type returntype is bool
      38             :     struct TAppSupportedSotFunctor : ::std::unary_function<DataFlavorExVector::value_type,bool>
      39             :     {
      40             :         ElementType eEntryType;
      41             :         sal_Bool    bQueryDrop;
      42           0 :         TAppSupportedSotFunctor(const ElementType& _eEntryType,sal_Bool _bQueryDrop)
      43             :             : eEntryType(_eEntryType)
      44           0 :             , bQueryDrop(_bQueryDrop)
      45             :         {
      46           0 :         }
      47             : 
      48           0 :         inline bool operator()(const DataFlavorExVector::value_type& _aType)
      49             :         {
      50           0 :             switch (_aType.mnSotId)
      51             :             {
      52             :                 case SOT_FORMAT_RTF:                    // RTF data descriptions
      53             :                 case SOT_FORMATSTR_ID_HTML:             // HTML data descriptions
      54             :                 case SOT_FORMATSTR_ID_DBACCESS_TABLE:   // table descriptor
      55           0 :                     return (E_TABLE == eEntryType);
      56             :                 case SOT_FORMATSTR_ID_DBACCESS_QUERY:   // query descriptor
      57             :                 case SOT_FORMATSTR_ID_DBACCESS_COMMAND: // SQL command
      58           0 :                     return ((E_QUERY == eEntryType) || ( !bQueryDrop && E_TABLE == eEntryType));
      59             :             }
      60           0 :             return false;
      61             :         }
      62             :     };
      63             : 
      64           0 :     class OTableCopyHelper
      65             :     {
      66             :     private:
      67             :         OGenericUnoController*  m_pController;
      68             :         ::rtl::OUString         m_sTableNameForAppend;
      69             : 
      70             :     public:
      71             :         // is needed to describe the drop target
      72           0 :         struct DropDescriptor
      73             :         {
      74             :             ::svx::ODataAccessDescriptor    aDroppedData;
      75             : 
      76             :             //for transfor the tablename
      77             :             ::rtl::OUString                 sDefaultTableName;
      78             : 
      79             :             String                          aUrl;
      80             :             SotStorageStreamRef             aHtmlRtfStorage;
      81             :             ElementType                     nType;
      82             :             SvTreeListEntry*                    pDroppedAt;
      83             :             sal_Int8                        nAction;
      84             :             sal_Bool                        bHtml;
      85             :             sal_Bool                        bError;
      86             : 
      87           0 :             DropDescriptor() : nType(E_TABLE),pDroppedAt(NULL),nAction(DND_ACTION_NONE) { }
      88             :         };
      89             : 
      90             :         OTableCopyHelper(OGenericUnoController* _pControler);
      91             : 
      92             :         /** pastes a table into the data source
      93             :             @param  _rPasteData
      94             :                 The data helper.
      95             :             @param  _sDestDataSourceName
      96             :                 The name of the dest data source.
      97             :         */
      98             :         void pasteTable( const TransferableDataHelper& _rTransData
      99             :                         ,const ::rtl::OUString& _sDestDataSourceName
     100             :                         ,const SharedConnection& _xConnection);
     101             : 
     102             :         /** pastes a table into the data source
     103             :             @param  _nFormatId
     104             :                 The format which should be copied.
     105             :             @param  _rPasteData
     106             :                 The data helper.
     107             :             @param  _sDestDataSourceName
     108             :                 The name of the dest data source.
     109             :         */
     110             :         void pasteTable( SotFormatStringId _nFormatId
     111             :                         ,const TransferableDataHelper& _rTransData
     112             :                         ,const ::rtl::OUString& _sDestDataSourceName
     113             :                         ,const SharedConnection& _xConnection);
     114             : 
     115             :         /** copies a table which was constructed by tags like HTML or RTF
     116             :             @param  _rDesc
     117             :                 The Drop descriptor
     118             :             @param  _bCheck
     119             :                 If set to <TRUE/> than the controller checks only if a copy is possible.
     120             :             @param  _xConnection
     121             :                 The connection
     122             :         */
     123             :         sal_Bool copyTagTable(  DropDescriptor& _rDesc,
     124             :                                 sal_Bool _bCheck,
     125             :                                 const SharedConnection& _xConnection);
     126             : 
     127             :         /** copies a table which was constructed by tags like HTML or RTF
     128             :             @param  _rDesc
     129             :                 The Drop descriptor
     130             :             @param  _bCheck
     131             :                 If set to <TRUE/> than the controller checks only if a copy is possible.
     132             :             @param  _xConnection
     133             :                 The connection
     134             :         */
     135             :         void asyncCopyTagTable(  DropDescriptor& _rDesc
     136             :                                 ,const ::rtl::OUString& _sDestDataSourceName
     137             :                                 ,const SharedConnection& _xConnection);
     138             : 
     139             :         /** copies a table which was constructed by tags like HTML or RTF
     140             :             @param  _aDroppedData
     141             :                 The dropped data
     142             :             @param  _rDesc
     143             :                 IN/OUT parameter
     144             :             @param  _xConnection
     145             :                 The connection
     146             :         */
     147             :         sal_Bool copyTagTable(const TransferableDataHelper& _aDroppedData,
     148             :                               DropDescriptor& _rAsyncDrop,
     149             :                               const SharedConnection& _xConnection);
     150             : 
     151             :         /// returns <TRUE/> if the clipboard supports a table format, otherwise <FALSE/>.
     152             :         sal_Bool isTableFormat(const TransferableDataHelper& _rClipboard) const;
     153             : 
     154           0 :         inline void                     SetTableNameForAppend( const ::rtl::OUString& _rDefaultTableName ) { m_sTableNameForAppend = _rDefaultTableName; }
     155           0 :         inline void                     ResetTableNameForAppend() { SetTableNameForAppend( ::rtl::OUString() ); }
     156           0 :         inline const ::rtl::OUString&   GetTableNameForAppend() const { return m_sTableNameForAppend ;}
     157             : 
     158             :     private:
     159             :         /** pastes a table into the data source
     160             :             @param  _rPasteData
     161             :                 The data descriptor.
     162             :             @param  _sDestDataSourceName
     163             :                 The name of the dest data source.
     164             :         */
     165             :         void pasteTable(
     166             :             const ::svx::ODataAccessDescriptor& _rPasteData,
     167             :             const ::rtl::OUString& _sDestDataSourceName,
     168             :             const SharedConnection& _xDestConnection
     169             :         );
     170             : 
     171             :         /** insert a table into the data source. The source can eihter be a table or a query
     172             :         */
     173             :         void insertTable(
     174             :             const ::rtl::OUString& i_rSourceDataSource,
     175             :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& i_rSourceConnection,
     176             :             const ::rtl::OUString& i_rCommand,
     177             :             const sal_Int32 i_nCommandType,
     178             :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& i_rSourceRows,
     179             :             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& i_rSelection,
     180             :             const sal_Bool i_bBookmarkSelection,
     181             :             const ::rtl::OUString& i_rDestDataSource,
     182             :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& i_rDestConnection
     183             :         );
     184             : 
     185             :     };
     186             : //........................................................................
     187             : }   // namespace dbaui
     188             : //........................................................................
     189             : #endif // DBUI_TABLECOPYHELPER_HXX
     190             : 
     191             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10