LCOV - code coverage report
Current view: top level - dbaccess/source/ui/misc - WCopyTable.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 786 0.0 %
Date: 2012-08-25 Functions: 0 82 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1842 0.0 %

           Branch data     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                 :            : 
      21                 :            : #include "dbu_misc.hrc"
      22                 :            : #include "dbustrings.hrc"
      23                 :            : #include "moduledbu.hxx"
      24                 :            : #include "sqlmessage.hxx"
      25                 :            : #include "UITools.hxx"
      26                 :            : #include "WColumnSelect.hxx"
      27                 :            : #include "WCopyTable.hxx"
      28                 :            : #include "WCPage.hxx"
      29                 :            : #include "WExtendPages.hxx"
      30                 :            : #include "WizardPages.hrc"
      31                 :            : #include "WNameMatch.hxx"
      32                 :            : #include "WTypeSelect.hxx"
      33                 :            : 
      34                 :            : #include <com/sun/star/sdb/application/CopyTableOperation.hpp>
      35                 :            : #include <com/sun/star/sdb/SQLContext.hpp>
      36                 :            : #include <com/sun/star/sdbc/ColumnValue.hpp>
      37                 :            : #include <com/sun/star/sdbc/DataType.hpp>
      38                 :            : #include <com/sun/star/sdbc/XResultSet.hpp>
      39                 :            : #include <com/sun/star/sdbc/XRow.hpp>
      40                 :            : #include <com/sun/star/sdbcx/KeyType.hpp>
      41                 :            : #include <com/sun/star/sdbcx/XAppend.hpp>
      42                 :            : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
      43                 :            : #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
      44                 :            : #include <com/sun/star/sdbcx/XKeysSupplier.hpp>
      45                 :            : #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
      46                 :            : #include <com/sun/star/sdbcx/XViewsSupplier.hpp>
      47                 :            : #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
      48                 :            : 
      49                 :            : #include <comphelper/extract.hxx>
      50                 :            : #include <comphelper/types.hxx>
      51                 :            : #include <comphelper/interaction.hxx>
      52                 :            : #include <connectivity/dbtools.hxx>
      53                 :            : #include <connectivity/dbmetadata.hxx>
      54                 :            : #include <connectivity/dbexception.hxx>
      55                 :            : 
      56                 :            : #include <rtl/logfile.hxx>
      57                 :            : #include <rtl/ustrbuf.hxx>
      58                 :            : #include <tools/debug.hxx>
      59                 :            : #include <tools/diagnose_ex.h>
      60                 :            : #include <vcl/lstbox.hxx>
      61                 :            : #include <vcl/msgbox.hxx>
      62                 :            : #include <vcl/waitobj.hxx>
      63                 :            : 
      64                 :            : #include <functional>
      65                 :            : #include <o3tl/compat_functional.hxx>
      66                 :            : 
      67                 :            : using namespace ::dbaui;
      68                 :            : using namespace ::com::sun::star::uno;
      69                 :            : using namespace ::com::sun::star::beans;
      70                 :            : using namespace ::com::sun::star::container;
      71                 :            : using namespace ::com::sun::star::util;
      72                 :            : using namespace ::com::sun::star::sdb;
      73                 :            : using namespace ::com::sun::star::sdbc;
      74                 :            : using namespace ::com::sun::star::sdbcx;
      75                 :            : using namespace ::com::sun::star::lang;
      76                 :            : using namespace ::com::sun::star::task;
      77                 :            : using namespace dbtools;
      78                 :            : 
      79                 :            : namespace CopyTableOperation = ::com::sun::star::sdb::application::CopyTableOperation;
      80                 :            : 
      81                 :            : #define MAX_PAGES   4   // max. Pages die angezeigt werden
      82                 :            : 
      83                 :            : DBG_NAME(OCopyTableWizard)
      84                 :            : namespace
      85                 :            : {
      86                 :            :     //....................................................................
      87                 :          0 :     void clearColumns(ODatabaseExport::TColumns& _rColumns, ODatabaseExport::TColumnVector& _rColumnsVec)
      88                 :            :     {
      89                 :          0 :         ODatabaseExport::TColumns::iterator aIter = _rColumns.begin();
      90                 :          0 :         ODatabaseExport::TColumns::iterator aEnd  = _rColumns.end();
      91                 :            : 
      92         [ #  # ]:          0 :         for(;aIter != aEnd;++aIter)
      93 [ #  # ][ #  # ]:          0 :             delete aIter->second;
      94                 :            : 
      95                 :          0 :         _rColumnsVec.clear();
      96                 :          0 :         _rColumns.clear();
      97                 :          0 :     }
      98                 :            : }
      99                 :            : 
     100                 :            : //========================================================================
     101                 :            : //= ICopyTableSourceObject
     102                 :            : //========================================================================
     103                 :            : //------------------------------------------------------------------------
     104                 :          0 : ICopyTableSourceObject::~ICopyTableSourceObject()
     105                 :            : {
     106         [ #  # ]:          0 : }
     107                 :            : 
     108                 :            : //========================================================================
     109                 :            : //= ObjectCopySource
     110                 :            : //========================================================================
     111                 :            : //------------------------------------------------------------------------
     112                 :          0 : ObjectCopySource::ObjectCopySource( const Reference< XConnection >& _rxConnection, const Reference< XPropertySet >& _rxObject )
     113                 :            :     :m_xConnection( _rxConnection, UNO_SET_THROW )
     114         [ #  # ]:          0 :     ,m_xMetaData( _rxConnection->getMetaData(), UNO_SET_THROW )
     115                 :            :     ,m_xObject( _rxObject, UNO_SET_THROW )
     116         [ #  # ]:          0 :     ,m_xObjectPSI( _rxObject->getPropertySetInfo(), UNO_SET_THROW )
     117 [ #  # ][ #  # ]:          0 :     ,m_xObjectColumns( Reference< XColumnsSupplier >( _rxObject, UNO_QUERY_THROW )->getColumns(), UNO_SET_THROW )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     118                 :            : {
     119                 :          0 : }
     120                 :            : 
     121                 :            : //------------------------------------------------------------------------
     122                 :          0 : ::rtl::OUString ObjectCopySource::getQualifiedObjectName() const
     123                 :            : {
     124                 :          0 :     ::rtl::OUString sName;
     125                 :            : 
     126 [ #  # ][ #  # ]:          0 :     if ( !m_xObjectPSI->hasPropertyByName( PROPERTY_COMMAND ) )
         [ #  # ][ #  # ]
     127         [ #  # ]:          0 :         sName = ::dbtools::composeTableName( m_xMetaData, m_xObject, ::dbtools::eInDataManipulation, false, false, false );
     128                 :            :     else
     129 [ #  # ][ #  # ]:          0 :         m_xObject->getPropertyValue( PROPERTY_NAME ) >>= sName;
                 [ #  # ]
     130                 :          0 :     return sName;
     131                 :            : }
     132                 :            : 
     133                 :            : //------------------------------------------------------------------------
     134                 :          0 : bool ObjectCopySource::isView() const
     135                 :            : {
     136                 :          0 :     bool bIsView = false;
     137                 :            :     try
     138                 :            :     {
     139 [ #  # ][ #  # ]:          0 :         if ( m_xObjectPSI->hasPropertyByName( PROPERTY_TYPE ) )
         [ #  # ][ #  # ]
     140                 :            :         {
     141                 :          0 :             ::rtl::OUString sObjectType;
     142 [ #  # ][ #  # ]:          0 :             OSL_VERIFY( m_xObject->getPropertyValue( PROPERTY_TYPE ) >>= sObjectType );
                 [ #  # ]
     143         [ #  # ]:          0 :             bIsView = sObjectType == "VIEW";
     144                 :            :         }
     145                 :            :     }
     146                 :          0 :     catch( const Exception& )
     147                 :            :     {
     148                 :            :         DBG_UNHANDLED_EXCEPTION();
     149                 :            :     }
     150                 :          0 :     return bIsView;
     151                 :            : }
     152                 :            : 
     153                 :            : //------------------------------------------------------------------------
     154                 :          0 : void ObjectCopySource::copyUISettingsTo( const Reference< XPropertySet >& _rxObject ) const
     155                 :            : {
     156                 :            :     const ::rtl::OUString aCopyProperties[] = {
     157                 :            :         PROPERTY_FONT, PROPERTY_ROW_HEIGHT, PROPERTY_TEXTCOLOR,PROPERTY_TEXTLINECOLOR,PROPERTY_TEXTEMPHASIS,PROPERTY_TEXTRELIEF
     158 [ #  # ][ #  # ]:          0 :     };
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     159         [ #  # ]:          0 :     for ( size_t i=0; i < sizeof( aCopyProperties ) / sizeof( aCopyProperties[0] ); ++i )
     160                 :            :     {
     161 [ #  # ][ #  # ]:          0 :         if ( m_xObjectPSI->hasPropertyByName( aCopyProperties[i] ) )
                 [ #  # ]
     162 [ #  # ][ #  # ]:          0 :             _rxObject->setPropertyValue( aCopyProperties[i], m_xObject->getPropertyValue( aCopyProperties[i] ) );
         [ #  # ][ #  # ]
     163   [ #  #  #  # ]:          0 :     }
     164                 :          0 : }
     165                 :            : //------------------------------------------------------------------------
     166                 :          0 : void ObjectCopySource::copyFilterAndSortingTo( const Reference< XConnection >& _xConnection,const Reference< XPropertySet >& _rxObject ) const
     167                 :            : {
     168                 :            :     ::std::pair< ::rtl::OUString, ::rtl::OUString > aProperties[] = {
     169                 :            :                  ::std::pair< ::rtl::OUString, ::rtl::OUString >(PROPERTY_FILTER,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" AND ")))
     170                 :            :                 ,::std::pair< ::rtl::OUString, ::rtl::OUString >(PROPERTY_ORDER,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ORDER BY ")))
     171 [ #  # ][ #  # ]:          0 :     };
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     172                 :            : 
     173                 :          0 :     size_t i = 0;
     174                 :            : 
     175                 :            :     try
     176                 :            :     {
     177 [ #  # ][ #  # ]:          0 :         const String sSourceName = (::dbtools::composeTableNameForSelect(m_xConnection,m_xObject) + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")));
                 [ #  # ]
     178         [ #  # ]:          0 :         const ::rtl::OUString sTargetName = ::dbtools::composeTableNameForSelect(_xConnection,_rxObject);
     179 [ #  # ][ #  # ]:          0 :         const String sTargetNameTemp = (sTargetName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")));
     180                 :            : 
     181         [ #  # ]:          0 :         ::rtl::OUString sStatement(RTL_CONSTASCII_USTRINGPARAM("SELECT * FROM "));
     182                 :          0 :         sStatement += sTargetName;
     183         [ #  # ]:          0 :         sStatement += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WHERE 0=1"));
     184                 :            : 
     185                 :            : 
     186         [ #  # ]:          0 :         for ( i=0; i < sizeof( aProperties ) / sizeof( aProperties[0] ); ++i )
     187                 :            :         {
     188 [ #  # ][ #  # ]:          0 :             if ( m_xObjectPSI->hasPropertyByName( aProperties[i].first ) )
                 [ #  # ]
     189                 :            :             {
     190                 :          0 :                 ::rtl::OUString sFilter;
     191 [ #  # ][ #  # ]:          0 :                 m_xObject->getPropertyValue( aProperties[i].first ) >>= sFilter;
     192         [ #  # ]:          0 :                 if ( !sFilter.isEmpty() )
     193                 :            :                 {
     194                 :          0 :                     sStatement += aProperties[i].second;
     195         [ #  # ]:          0 :                     String sReplace = sFilter;
     196         [ #  # ]:          0 :                     sReplace.SearchAndReplace(sSourceName,sTargetNameTemp);
     197         [ #  # ]:          0 :                     sFilter = sReplace;
     198 [ #  # ][ #  # ]:          0 :                     _rxObject->setPropertyValue( aProperties[i].first, makeAny(sFilter) );
                 [ #  # ]
     199         [ #  # ]:          0 :                     sStatement += sFilter;
     200                 :          0 :                 }
     201                 :            :             }
     202                 :            :         }
     203                 :            : 
     204 [ #  # ][ #  # ]:          0 :         _xConnection->createStatement()->executeQuery(sStatement);
         [ #  # ][ #  # ]
     205                 :            : 
     206 [ #  # ][ #  # ]:          0 :         if ( m_xObjectPSI->hasPropertyByName( PROPERTY_APPLYFILTER ) )
         [ #  # ][ #  # ]
     207 [ #  # ][ #  # ]:          0 :             _rxObject->setPropertyValue( PROPERTY_APPLYFILTER, m_xObject->getPropertyValue( PROPERTY_APPLYFILTER ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     208                 :            :     }
     209         [ #  # ]:          0 :     catch(Exception&)
     210                 :            :     {
     211   [ #  #  #  # ]:          0 :     }
     212                 :          0 : }
     213                 :            : //------------------------------------------------------------------------
     214                 :          0 : Sequence< ::rtl::OUString > ObjectCopySource::getColumnNames() const
     215                 :            : {
     216                 :          0 :     return m_xObjectColumns->getElementNames();
     217                 :            : }
     218                 :            : 
     219                 :            : //------------------------------------------------------------------------
     220                 :          0 : Sequence< ::rtl::OUString > ObjectCopySource::getPrimaryKeyColumnNames() const
     221                 :            : {
     222         [ #  # ]:          0 :     const Reference<XNameAccess> xPrimaryKeyColumns = getPrimaryKeyColumns_throw(m_xObject);
     223         [ #  # ]:          0 :     Sequence< ::rtl::OUString > aKeyColNames;
     224         [ #  # ]:          0 :     if ( xPrimaryKeyColumns.is() )
     225 [ #  # ][ #  # ]:          0 :         aKeyColNames = xPrimaryKeyColumns->getElementNames();
         [ #  # ][ #  # ]
     226                 :          0 :     return aKeyColNames;
     227                 :            : }
     228                 :            : 
     229                 :            : //------------------------------------------------------------------------
     230                 :          0 : OFieldDescription* ObjectCopySource::createFieldDescription( const ::rtl::OUString& _rColumnName ) const
     231                 :            : {
     232 [ #  # ][ #  # ]:          0 :     Reference< XPropertySet > xColumn( m_xObjectColumns->getByName( _rColumnName ), UNO_QUERY_THROW );
                 [ #  # ]
     233 [ #  # ][ #  # ]:          0 :     return new OFieldDescription( xColumn );
     234                 :            : }
     235                 :            : //------------------------------------------------------------------------
     236                 :          0 : ::rtl::OUString ObjectCopySource::getSelectStatement() const
     237                 :            : {
     238                 :          0 :     ::rtl::OUString sSelectStatement;
     239 [ #  # ][ #  # ]:          0 :     if ( m_xObjectPSI->hasPropertyByName( PROPERTY_COMMAND ) )
         [ #  # ][ #  # ]
     240                 :            :     {   // query
     241 [ #  # ][ #  # ]:          0 :         OSL_VERIFY( m_xObject->getPropertyValue( PROPERTY_COMMAND ) >>= sSelectStatement );
                 [ #  # ]
     242                 :            :     }
     243                 :            :     else
     244                 :            :     {   // table
     245                 :          0 :         ::rtl::OUStringBuffer aSQL;
     246         [ #  # ]:          0 :         aSQL.appendAscii( "SELECT " );
     247                 :            : 
     248                 :            :         // we need to create the sql stmt with column names
     249                 :            :         // otherwise it is possible that names don't match
     250 [ #  # ][ #  # ]:          0 :         const ::rtl::OUString sQuote = m_xMetaData->getIdentifierQuoteString();
     251                 :            : 
     252         [ #  # ]:          0 :         Sequence< ::rtl::OUString > aColumnNames = getColumnNames();
     253                 :          0 :         const ::rtl::OUString* pColumnName = aColumnNames.getConstArray();
     254                 :          0 :         const ::rtl::OUString* pEnd = pColumnName + aColumnNames.getLength();
     255         [ #  # ]:          0 :         for ( ; pColumnName != pEnd; )
     256                 :            :         {
     257 [ #  # ][ #  # ]:          0 :             aSQL.append( ::dbtools::quoteName( sQuote, *pColumnName++ ) );
     258                 :            : 
     259         [ #  # ]:          0 :             if ( pColumnName == pEnd )
     260         [ #  # ]:          0 :                 aSQL.appendAscii( " " );
     261                 :            :             else
     262         [ #  # ]:          0 :                 aSQL.appendAscii( ", " );
     263                 :            :         }
     264                 :            : 
     265         [ #  # ]:          0 :         aSQL.appendAscii( "FROM " );
     266 [ #  # ][ #  # ]:          0 :         aSQL.append( ::dbtools::composeTableNameForSelect( m_xConnection, m_xObject ) );
     267                 :            : 
     268 [ #  # ][ #  # ]:          0 :         sSelectStatement = aSQL.makeStringAndClear();
     269                 :            :     }
     270                 :            : 
     271                 :          0 :     return sSelectStatement;
     272                 :            : }
     273                 :            : 
     274                 :            : //------------------------------------------------------------------------
     275                 :          0 : ::utl::SharedUNOComponent< XPreparedStatement > ObjectCopySource::getPreparedSelectStatement() const
     276                 :            : {
     277                 :            :     ::utl::SharedUNOComponent< XPreparedStatement > xStatement(
     278                 :          0 :         m_xConnection->prepareStatement( getSelectStatement() ),
     279                 :            :         ::utl::SharedUNOComponent< XPreparedStatement >::TakeOwnership
     280 [ #  # ][ #  # ]:          0 :     );
     281                 :          0 :     return xStatement;
     282                 :            : }
     283                 :            : 
     284                 :            : //========================================================================
     285                 :            : //= NamedTableCopySource
     286                 :            : //========================================================================
     287                 :            : //------------------------------------------------------------------------
     288                 :          0 : NamedTableCopySource::NamedTableCopySource( const Reference< XConnection >& _rxConnection, const ::rtl::OUString& _rTableName )
     289                 :            :     :m_xConnection( _rxConnection, UNO_SET_THROW )
     290         [ #  # ]:          0 :     ,m_xMetaData( _rxConnection->getMetaData(), UNO_SET_THROW )
     291                 :            :     ,m_sTableName( _rTableName )
     292 [ #  # ][ #  # ]:          0 :     ,m_aColumnInfo()
         [ #  # ][ #  # ]
                 [ #  # ]
     293                 :            : {
     294         [ #  # ]:          0 :     ::dbtools::qualifiedNameComponents( m_xMetaData, m_sTableName, m_sTableCatalog, m_sTableSchema, m_sTableBareName, ::dbtools::eComplete );
     295         [ #  # ]:          0 :     impl_ensureColumnInfo_throw();
     296                 :          0 : }
     297                 :            : 
     298                 :            : //------------------------------------------------------------------------
     299                 :          0 : ::rtl::OUString NamedTableCopySource::getQualifiedObjectName() const
     300                 :            : {
     301                 :          0 :     return m_sTableName;
     302                 :            : }
     303                 :            : 
     304                 :            : //------------------------------------------------------------------------
     305                 :          0 : bool NamedTableCopySource::isView() const
     306                 :            : {
     307                 :          0 :     ::rtl::OUString sTableType;
     308                 :            :     try
     309                 :            :     {
     310         [ #  # ]:          0 :         Reference< XResultSet > xTableDesc( m_xMetaData->getTables( makeAny( m_sTableCatalog ), m_sTableSchema, m_sTableBareName,
     311 [ #  # ][ #  # ]:          0 :             Sequence< ::rtl::OUString >() ) );
         [ #  # ][ #  # ]
     312         [ #  # ]:          0 :         Reference< XRow > xTableDescRow( xTableDesc, UNO_QUERY_THROW );
     313 [ #  # ][ #  # ]:          0 :         OSL_VERIFY( xTableDesc->next() );
     314 [ #  # ][ #  # ]:          0 :         sTableType = xTableDescRow->getString( 4 );
     315         [ #  # ]:          0 :         OSL_ENSURE( !xTableDescRow->wasNull(), "NamedTableCopySource::isView: invalid table type!" );
     316                 :            :     }
     317         [ #  # ]:          0 :     catch( const Exception& )
     318                 :            :     {
     319                 :            :         DBG_UNHANDLED_EXCEPTION();
     320                 :            :     }
     321                 :          0 :     return sTableType == "VIEW";
     322                 :            : }
     323                 :            : 
     324                 :            : //------------------------------------------------------------------------
     325                 :          0 : void NamedTableCopySource::copyUISettingsTo( const Reference< XPropertySet >& /*_rxObject*/ ) const
     326                 :            : {
     327                 :            :     // not supported: we do not have UI settings to copy
     328                 :          0 : }
     329                 :            : // -----------------------------------------------------------------------------
     330                 :          0 : void NamedTableCopySource::copyFilterAndSortingTo( const Reference< XConnection >& ,const Reference< XPropertySet >& /*_rxObject*/ ) const
     331                 :            : {
     332                 :          0 : }
     333                 :            : //------------------------------------------------------------------------
     334                 :          0 : void NamedTableCopySource::impl_ensureColumnInfo_throw()
     335                 :            : {
     336         [ #  # ]:          0 :     if ( !m_aColumnInfo.empty() )
     337                 :          0 :         return;
     338                 :            : 
     339 [ #  # ][ #  # ]:          0 :     Reference< XResultSetMetaDataSupplier > xStatementMetaSupp( impl_ensureStatement_throw().getTyped(), UNO_QUERY_THROW );
                 [ #  # ]
     340 [ #  # ][ #  # ]:          0 :     Reference< XResultSetMetaData > xStatementMeta( xStatementMetaSupp->getMetaData(), UNO_SET_THROW );
                 [ #  # ]
     341                 :            : 
     342 [ #  # ][ #  # ]:          0 :     sal_Int32 nColCount( xStatementMeta->getColumnCount() );
     343         [ #  # ]:          0 :     for ( sal_Int32 i = 1; i <= nColCount; ++i )
     344                 :            :     {
     345         [ #  # ]:          0 :         OFieldDescription aDesc;
     346                 :            : 
     347 [ #  # ][ #  # ]:          0 :         aDesc.SetName(          xStatementMeta->getColumnName(      i ) );
                 [ #  # ]
     348 [ #  # ][ #  # ]:          0 :         aDesc.SetHelpText(      xStatementMeta->getColumnLabel(     i ) );
                 [ #  # ]
     349 [ #  # ][ #  # ]:          0 :         aDesc.SetTypeValue(     xStatementMeta->getColumnType(      i ) );
                 [ #  # ]
     350 [ #  # ][ #  # ]:          0 :         aDesc.SetTypeName(      xStatementMeta->getColumnTypeName(  i ) );
                 [ #  # ]
     351 [ #  # ][ #  # ]:          0 :         aDesc.SetPrecision(     xStatementMeta->getPrecision(       i ) );
                 [ #  # ]
     352 [ #  # ][ #  # ]:          0 :         aDesc.SetScale(         xStatementMeta->getScale(           i ) );
                 [ #  # ]
     353 [ #  # ][ #  # ]:          0 :         aDesc.SetIsNullable(    xStatementMeta->isNullable(         i ) );
                 [ #  # ]
     354 [ #  # ][ #  # ]:          0 :         aDesc.SetCurrency(      xStatementMeta->isCurrency(         i ) );
                 [ #  # ]
     355 [ #  # ][ #  # ]:          0 :         aDesc.SetAutoIncrement( xStatementMeta->isAutoIncrement(    i ) );
                 [ #  # ]
     356                 :            : 
     357         [ #  # ]:          0 :         m_aColumnInfo.push_back( aDesc );
     358         [ #  # ]:          0 :     }
     359                 :            : }
     360                 :            : 
     361                 :            : //------------------------------------------------------------------------
     362                 :          0 : ::utl::SharedUNOComponent< XPreparedStatement > NamedTableCopySource::impl_ensureStatement_throw()
     363                 :            : {
     364         [ #  # ]:          0 :     if ( !m_xStatement.is() )
     365 [ #  # ][ #  # ]:          0 :         m_xStatement.set( m_xConnection->prepareStatement( getSelectStatement() ), UNO_SET_THROW );
     366                 :          0 :     return m_xStatement;
     367                 :            : }
     368                 :            : 
     369                 :            : //------------------------------------------------------------------------
     370                 :          0 : Sequence< ::rtl::OUString > NamedTableCopySource::getColumnNames() const
     371                 :            : {
     372                 :          0 :     Sequence< ::rtl::OUString > aNames( m_aColumnInfo.size() );
     373 [ #  # ][ #  # ]:          0 :     for (   ::std::vector< OFieldDescription >::const_iterator col = m_aColumnInfo.begin();
     374                 :          0 :             col != m_aColumnInfo.end();
     375                 :            :             ++col
     376                 :            :         )
     377 [ #  # ][ #  # ]:          0 :         aNames[ col - m_aColumnInfo.begin() ] = col->GetName();
                 [ #  # ]
     378                 :            : 
     379                 :          0 :     return aNames;
     380                 :            : }
     381                 :            : 
     382                 :            : //------------------------------------------------------------------------
     383                 :          0 : Sequence< ::rtl::OUString > NamedTableCopySource::getPrimaryKeyColumnNames() const
     384                 :            : {
     385                 :          0 :     Sequence< ::rtl::OUString > aPKColNames;
     386                 :            : 
     387                 :            :     try
     388                 :            :     {
     389 [ #  # ][ #  # ]:          0 :         Reference< XResultSet > xPKDesc( m_xMetaData->getPrimaryKeys( makeAny( m_sTableCatalog ), m_sTableSchema, m_sTableBareName ) );
                 [ #  # ]
     390         [ #  # ]:          0 :         Reference< XRow > xPKDescRow( xPKDesc, UNO_QUERY_THROW );
     391 [ #  # ][ #  # ]:          0 :         while ( xPKDesc->next() )
                 [ #  # ]
     392                 :            :         {
     393                 :          0 :             sal_Int32 len( aPKColNames.getLength() );
     394         [ #  # ]:          0 :             aPKColNames.realloc( len + 1 );
     395 [ #  # ][ #  # ]:          0 :             aPKColNames[ len ] = xPKDescRow->getString( 4 );    // COLUMN_NAME
                 [ #  # ]
     396         [ #  # ]:          0 :         }
     397                 :            :     }
     398         [ #  # ]:          0 :     catch( const Exception& )
     399                 :            :     {
     400                 :            :         DBG_UNHANDLED_EXCEPTION();
     401                 :            :     }
     402                 :            : 
     403                 :          0 :     return aPKColNames;
     404                 :            : }
     405                 :            : 
     406                 :            : //------------------------------------------------------------------------
     407                 :          0 : OFieldDescription* NamedTableCopySource::createFieldDescription( const ::rtl::OUString& _rColumnName ) const
     408                 :            : {
     409 [ #  # ][ #  # ]:          0 :     for (   ::std::vector< OFieldDescription >::const_iterator col = m_aColumnInfo.begin();
     410                 :          0 :             col != m_aColumnInfo.end();
     411                 :            :             ++col
     412                 :            :         )
     413 [ #  # ][ #  # ]:          0 :         if ( col->GetName() == _rColumnName )
     414 [ #  # ][ #  # ]:          0 :             return new OFieldDescription( *col );
     415                 :            : 
     416                 :          0 :     return NULL;
     417                 :            : }
     418                 :            : //------------------------------------------------------------------------
     419                 :          0 : ::rtl::OUString NamedTableCopySource::getSelectStatement() const
     420                 :            : {
     421                 :          0 :     ::rtl::OUStringBuffer aSQL;
     422         [ #  # ]:          0 :     aSQL.appendAscii( "SELECT * FROM " );
     423                 :            : 
     424 [ #  # ][ #  # ]:          0 :     aSQL.append( ::dbtools::composeTableNameForSelect( m_xConnection, m_sTableCatalog, m_sTableSchema, m_sTableBareName ) );
     425                 :            : 
     426         [ #  # ]:          0 :     return aSQL.makeStringAndClear();
     427                 :            : }
     428                 :            : 
     429                 :            : //------------------------------------------------------------------------
     430                 :          0 : ::utl::SharedUNOComponent< XPreparedStatement > NamedTableCopySource::getPreparedSelectStatement() const
     431                 :            : {
     432                 :          0 :     return const_cast< NamedTableCopySource* >( this )->impl_ensureStatement_throw();
     433                 :            : }
     434                 :            : 
     435                 :            : // ========================================================
     436                 :            : // DummyCopySource
     437                 :            : // ========================================================
     438         [ #  # ]:          0 : class DummyCopySource : public ICopyTableSourceObject
     439                 :            : {
     440                 :            : public:
     441                 :          0 :     DummyCopySource() { }
     442                 :            : 
     443                 :            :     static const DummyCopySource& Instance();
     444                 :            : 
     445                 :            :     // ICopyTableSourceObject overridables
     446                 :            :     virtual ::rtl::OUString     getQualifiedObjectName() const;
     447                 :            :     virtual bool                isView() const;
     448                 :            :     virtual void                copyUISettingsTo( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject ) const;
     449                 :            :     virtual void                copyFilterAndSortingTo(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject ) const;
     450                 :            :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
     451                 :            :                                 getColumnNames() const;
     452                 :            :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
     453                 :            :                                 getPrimaryKeyColumnNames() const;
     454                 :            :     virtual OFieldDescription*  createFieldDescription( const ::rtl::OUString& _rColumnName ) const;
     455                 :            :     virtual ::rtl::OUString     getSelectStatement() const;
     456                 :            :     virtual ::utl::SharedUNOComponent< XPreparedStatement >
     457                 :            :                                 getPreparedSelectStatement() const;
     458                 :            : };
     459                 :            : 
     460                 :            : //------------------------------------------------------------------------
     461                 :          0 : const DummyCopySource& DummyCopySource::Instance()
     462                 :            : {
     463 [ #  # ][ #  # ]:          0 :     static DummyCopySource s_aTheInstance;
     464                 :          0 :     return s_aTheInstance;
     465                 :            : }
     466                 :            : 
     467                 :            : //------------------------------------------------------------------------
     468                 :          0 : ::rtl::OUString DummyCopySource::getQualifiedObjectName() const
     469                 :            : {
     470                 :            :     OSL_FAIL( "DummyCopySource::getQualifiedObjectName: not to be called!" );
     471                 :          0 :     return ::rtl::OUString();
     472                 :            : }
     473                 :            : 
     474                 :            : //------------------------------------------------------------------------
     475                 :          0 : bool DummyCopySource::isView() const
     476                 :            : {
     477                 :            :     OSL_FAIL( "DummyCopySource::isView: not to be called!" );
     478                 :          0 :     return false;
     479                 :            : }
     480                 :            : 
     481                 :            : //------------------------------------------------------------------------
     482                 :          0 : void DummyCopySource::copyUISettingsTo( const Reference< XPropertySet >& /*_rxObject*/ ) const
     483                 :            : {
     484                 :            :     // no support
     485                 :          0 : }
     486                 :            : // -----------------------------------------------------------------------------
     487                 :          0 : void DummyCopySource::copyFilterAndSortingTo( const Reference< XConnection >& ,const Reference< XPropertySet >& /*_rxObject*/ ) const
     488                 :            : {
     489                 :          0 : }
     490                 :            : //------------------------------------------------------------------------
     491                 :          0 : Sequence< ::rtl::OUString > DummyCopySource::getColumnNames() const
     492                 :            : {
     493                 :          0 :     return Sequence< ::rtl::OUString >();
     494                 :            : }
     495                 :            : 
     496                 :            : //------------------------------------------------------------------------
     497                 :          0 : Sequence< ::rtl::OUString > DummyCopySource::getPrimaryKeyColumnNames() const
     498                 :            : {
     499                 :            :     OSL_FAIL( "DummyCopySource::getPrimaryKeyColumnNames: not to be called!" );
     500                 :          0 :     return Sequence< ::rtl::OUString >();
     501                 :            : }
     502                 :            : 
     503                 :            : //------------------------------------------------------------------------
     504                 :          0 : OFieldDescription* DummyCopySource::createFieldDescription( const ::rtl::OUString& /*_rColumnName*/ ) const
     505                 :            : {
     506                 :            :     OSL_FAIL( "DummyCopySource::createFieldDescription: not to be called!" );
     507                 :          0 :     return NULL;
     508                 :            : }
     509                 :            : //------------------------------------------------------------------------
     510                 :          0 : ::rtl::OUString DummyCopySource::getSelectStatement() const
     511                 :            : {
     512                 :            :     OSL_FAIL( "DummyCopySource::getSelectStatement: not to be called!" );
     513                 :          0 :     return ::rtl::OUString();
     514                 :            : }
     515                 :            : 
     516                 :            : //------------------------------------------------------------------------
     517                 :          0 : ::utl::SharedUNOComponent< XPreparedStatement > DummyCopySource::getPreparedSelectStatement() const
     518                 :            : {
     519                 :            :     OSL_FAIL( "DummyCopySource::getPreparedSelectStatement: not to be called!" );
     520                 :          0 :     return ::utl::SharedUNOComponent< XPreparedStatement >();
     521                 :            : }
     522                 :            : 
     523                 :            : //------------------------------------------------------------------------
     524                 :            : namespace
     525                 :            : {
     526                 :          0 :     bool lcl_canCreateViewFor_nothrow( const Reference< XConnection >& _rxConnection )
     527                 :            :     {
     528         [ #  # ]:          0 :         Reference< XViewsSupplier > xSup( _rxConnection, UNO_QUERY );
     529                 :          0 :         Reference< XDataDescriptorFactory > xViewFac;
     530         [ #  # ]:          0 :         if ( xSup.is() )
     531 [ #  # ][ #  # ]:          0 :             xViewFac.set( xSup->getViews(), UNO_QUERY );
                 [ #  # ]
     532                 :          0 :         return xViewFac.is();
     533                 :            :     }
     534                 :            : 
     535                 :          0 :     bool lcl_sameConnection_throw( const Reference< XConnection >& _rxLHS, const Reference< XConnection >& _rxRHS )
     536                 :            :     {
     537 [ #  # ][ #  # ]:          0 :         Reference< XDatabaseMetaData > xMetaLHS( _rxLHS->getMetaData(), UNO_QUERY_THROW );
                 [ #  # ]
     538 [ #  # ][ #  # ]:          0 :         Reference< XDatabaseMetaData > xMetaRHS( _rxRHS->getMetaData(), UNO_QUERY_THROW );
                 [ #  # ]
     539 [ #  # ][ #  # ]:          0 :         return xMetaLHS->getURL().equals( xMetaRHS->getURL() );
         [ #  # ][ #  # ]
     540                 :            :     }
     541                 :            : }
     542                 :            : 
     543                 :            : //========================================================================
     544                 :            : //= OCopyTableWizard
     545                 :            : //========================================================================
     546                 :            : //------------------------------------------------------------------------
     547                 :          0 : OCopyTableWizard::OCopyTableWizard( Window * pParent, const ::rtl::OUString& _rDefaultName, sal_Int16 _nOperation,
     548                 :            :         const ICopyTableSourceObject& _rSourceObject, const Reference< XConnection >& _xSourceConnection,
     549                 :            :         const Reference< XConnection >& _xConnection, const Reference< XMultiServiceFactory >& _rxORB,
     550                 :            :         const Reference< XInteractionHandler>&   _xInteractionHandler)
     551                 :            :     : WizardDialog( pParent, ModuleRes(WIZ_RTFCOPYTABLE))
     552                 :            :     ,m_pbHelp( this , ModuleRes(PB_HELP))
     553                 :            :     ,m_pbCancel( this , ModuleRes(PB_CANCEL))
     554                 :            :     ,m_pbPrev( this , ModuleRes(PB_PREV))
     555                 :            :     ,m_pbNext( this , ModuleRes(PB_NEXT))
     556                 :            :     ,m_pbFinish( this , ModuleRes(PB_OK))
     557 [ #  # ][ #  # ]:          0 :     ,m_mNameMapping(_xConnection->getMetaData().is() && _xConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers())
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     558                 :            :     ,m_xDestConnection( _xConnection )
     559                 :            :     ,m_rSourceObject( _rSourceObject )
     560                 :            :     ,m_xFormatter( getNumberFormatter( _xConnection, _rxORB ) )
     561                 :            :     ,m_xFactory(_rxORB)
     562                 :            :     ,m_xInteractionHandler(_xInteractionHandler)
     563                 :            :     ,m_sTypeNames(ModuleRes(STR_TABLEDESIGN_DBFIELDTYPES))
     564                 :            :     ,m_nPageCount(0)
     565                 :            :     ,m_bDeleteSourceColumns(sal_True)
     566         [ #  # ]:          0 :     ,m_bInterConnectionCopy( _xSourceConnection != _xConnection )
     567                 :            :     ,m_sName( _rDefaultName )
     568                 :            :     ,m_nOperation( _nOperation )
     569                 :            :     ,m_ePressed( WIZARD_NONE )
     570 [ #  # ][ #  # ]:          0 :     ,m_bCreatePrimaryKeyColumn(sal_False)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     571                 :            : {
     572                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::OCopyTableWizard" );
     573                 :            :     DBG_CTOR(OCopyTableWizard,NULL);
     574         [ #  # ]:          0 :     construct();
     575                 :            : 
     576                 :            :     // extract table name
     577                 :          0 :     ::rtl::OUString sInitialTableName( _rDefaultName );
     578                 :            :     try
     579                 :            :     {
     580         [ #  # ]:          0 :         m_sSourceName = m_rSourceObject.getQualifiedObjectName();
     581                 :            :         OSL_ENSURE( !m_sSourceName.isEmpty(), "OCopyTableWizard::OCopyTableWizard: unable to retrieve the source object's name!" );
     582                 :            : 
     583         [ #  # ]:          0 :         if ( sInitialTableName.isEmpty() )
     584                 :          0 :             sInitialTableName = m_sSourceName;
     585                 :            : 
     586         [ #  # ]:          0 :         if ( m_sName.isEmpty() )
     587                 :            :         {
     588 [ #  # ][ #  # ]:          0 :             if ( _xSourceConnection == m_xDestConnection )
     589                 :            :             {
     590         [ #  # ]:          0 :                 Reference< XTablesSupplier > xSup( m_xDestConnection, UNO_QUERY_THROW );
     591 [ #  # ][ #  # ]:          0 :                 m_sName = ::dbtools::createUniqueName( xSup->getTables(), sInitialTableName, sal_False );
         [ #  # ][ #  # ]
     592                 :            :             }
     593                 :            :             else
     594                 :          0 :                 m_sName = sInitialTableName;
     595                 :            :         }
     596                 :            :     }
     597         [ #  # ]:          0 :     catch ( const Exception& )
     598                 :            :     {
     599                 :          0 :         m_sName = sInitialTableName;
     600                 :            :     }
     601                 :            : 
     602         [ #  # ]:          0 :     ::dbaui::fillTypeInfo( _xSourceConnection, m_sTypeNames, m_aTypeInfo, m_aTypeInfoIndex );
     603         [ #  # ]:          0 :     ::dbaui::fillTypeInfo( m_xDestConnection, m_sTypeNames, m_aDestTypeInfo, m_aDestTypeInfoIndex );
     604         [ #  # ]:          0 :     impl_loadSourceData();
     605                 :            : 
     606                 :          0 :     bool bAllowViews = true;
     607                 :            :     // if the source is a, don't allow creating views
     608 [ #  # ][ #  # ]:          0 :     if ( m_rSourceObject.isView() )
     609                 :          0 :         bAllowViews = false;
     610                 :            :     // no views if the target connection does not support creating them
     611 [ #  # ][ #  # ]:          0 :     if ( !lcl_canCreateViewFor_nothrow( m_xDestConnection ) )
     612                 :          0 :         bAllowViews = false;
     613                 :            :     // no views if we're copying to a different database
     614 [ #  # ][ #  # ]:          0 :     if ( !lcl_sameConnection_throw( _xSourceConnection, m_xDestConnection ) )
     615                 :          0 :         bAllowViews = false;
     616                 :            : 
     617         [ #  # ]:          0 :     if ( m_bInterConnectionCopy )
     618                 :            :     {
     619 [ #  # ][ #  # ]:          0 :         Reference< XDatabaseMetaData > xSrcMeta = _xSourceConnection->getMetaData();
     620                 :          0 :         ::rtl::OUString sCatalog;
     621                 :          0 :         ::rtl::OUString sSchema;
     622                 :          0 :         ::rtl::OUString sTable;
     623                 :            :         ::dbtools::qualifiedNameComponents( xSrcMeta,
     624                 :            :                                             m_sName,
     625                 :            :                                             sCatalog,
     626                 :            :                                             sSchema,
     627                 :            :                                             sTable,
     628         [ #  # ]:          0 :                                             ::dbtools::eInDataManipulation);
     629                 :            : 
     630 [ #  # ][ #  # ]:          0 :         m_sName = ::dbtools::composeTableName(m_xDestConnection->getMetaData(),sCatalog,sSchema,sTable,sal_False,::dbtools::eInTableDefinitions);
                 [ #  # ]
     631                 :            :     }
     632                 :            : 
     633 [ #  # ][ #  # ]:          0 :     OCopyTable* pPage1( new OCopyTable( this ) );
     634         [ #  # ]:          0 :     pPage1->disallowUseHeaderLine();
     635         [ #  # ]:          0 :     if ( !bAllowViews )
     636         [ #  # ]:          0 :         pPage1->disallowViews();
     637         [ #  # ]:          0 :     pPage1->setCreateStyleAction();
     638         [ #  # ]:          0 :     AddWizardPage(pPage1);
     639                 :            : 
     640 [ #  # ][ #  # ]:          0 :     AddWizardPage( new OWizNameMatching( this ) );
                 [ #  # ]
     641 [ #  # ][ #  # ]:          0 :     AddWizardPage( new OWizColumnSelect( this ) );
                 [ #  # ]
     642 [ #  # ][ #  # ]:          0 :     AddWizardPage( new OWizNormalExtend( this ) );
                 [ #  # ]
     643         [ #  # ]:          0 :     ActivatePage();
     644                 :          0 : }
     645                 :            : 
     646                 :            : // -----------------------------------------------------------------------------
     647                 :          0 : OCopyTableWizard::OCopyTableWizard( Window* pParent, const ::rtl::OUString& _rDefaultName, sal_Int16 _nOperation,
     648                 :            :         const ODatabaseExport::TColumns& _rSourceColumns, const ODatabaseExport::TColumnVector& _rSourceColVec,
     649                 :            :         const Reference< XConnection >& _xConnection, const Reference< XNumberFormatter >&  _xFormatter,
     650                 :            :         TypeSelectionPageFactory _pTypeSelectionPageFactory, SvStream& _rTypeSelectionPageArg, const Reference< XMultiServiceFactory >& _rM )
     651                 :            :     :WizardDialog( pParent, ModuleRes(WIZ_RTFCOPYTABLE))
     652                 :            :     ,m_vSourceColumns(_rSourceColumns)
     653                 :            :     ,m_pbHelp( this , ModuleRes(PB_HELP))
     654                 :            :     ,m_pbCancel( this , ModuleRes(PB_CANCEL))
     655                 :            :     ,m_pbPrev( this , ModuleRes(PB_PREV))
     656                 :            :     ,m_pbNext( this , ModuleRes(PB_NEXT))
     657                 :            :     ,m_pbFinish( this , ModuleRes(PB_OK))
     658 [ #  # ][ #  # ]:          0 :     ,m_mNameMapping(_xConnection->getMetaData().is() && _xConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers())
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     659                 :            :     ,m_xDestConnection( _xConnection )
     660                 :          0 :     ,m_rSourceObject( DummyCopySource::Instance() )
     661                 :            :     ,m_xFormatter(_xFormatter)
     662                 :            :     ,m_xFactory(_rM)
     663                 :            :     ,m_sTypeNames(ModuleRes(STR_TABLEDESIGN_DBFIELDTYPES))
     664                 :            :     ,m_nPageCount(0)
     665                 :            :     ,m_bDeleteSourceColumns(sal_False)
     666                 :            :     ,m_bInterConnectionCopy( false )
     667                 :            :     ,m_sName(_rDefaultName)
     668                 :            :     ,m_nOperation( _nOperation )
     669                 :            :     ,m_ePressed( WIZARD_NONE )
     670 [ #  # ][ #  # ]:          0 :     ,m_bCreatePrimaryKeyColumn(sal_False)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     671                 :            : {
     672                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::OCopyTableWizard" );
     673                 :            :     DBG_CTOR(OCopyTableWizard,NULL);
     674         [ #  # ]:          0 :     construct();
     675                 :          0 :     ODatabaseExport::TColumnVector::const_iterator aIter = _rSourceColVec.begin();
     676                 :          0 :     ODatabaseExport::TColumnVector::const_iterator aEnd = _rSourceColVec.end();
     677 [ #  # ][ #  # ]:          0 :     for (; aIter != aEnd ; ++aIter)
     678                 :            :     {
     679 [ #  # ][ #  # ]:          0 :         m_vSourceVec.push_back(m_vSourceColumns.find((*aIter)->first));
     680                 :            :     }
     681                 :            : 
     682         [ #  # ]:          0 :     ::dbaui::fillTypeInfo( _xConnection, m_sTypeNames, m_aTypeInfo, m_aTypeInfoIndex );
     683         [ #  # ]:          0 :     ::dbaui::fillTypeInfo( _xConnection, m_sTypeNames, m_aDestTypeInfo, m_aDestTypeInfoIndex );
     684                 :            : 
     685 [ #  # ][ #  # ]:          0 :     m_xInteractionHandler.set( m_xFactory->createInstance( SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY);
         [ #  # ][ #  # ]
     686                 :            : 
     687 [ #  # ][ #  # ]:          0 :     OCopyTable* pPage1( new OCopyTable( this ) );
     688         [ #  # ]:          0 :     pPage1->disallowViews();
     689         [ #  # ]:          0 :     pPage1->setCreateStyleAction();
     690         [ #  # ]:          0 :     AddWizardPage( pPage1 );
     691                 :            : 
     692 [ #  # ][ #  # ]:          0 :     AddWizardPage( new OWizNameMatching( this ) );
                 [ #  # ]
     693 [ #  # ][ #  # ]:          0 :     AddWizardPage( new OWizColumnSelect( this ) );
                 [ #  # ]
     694 [ #  # ][ #  # ]:          0 :     AddWizardPage( (*_pTypeSelectionPageFactory)( this, _rTypeSelectionPageArg ) );
     695                 :            : 
     696         [ #  # ]:          0 :     ActivatePage();
     697                 :          0 : }
     698                 :            : 
     699                 :            : // -----------------------------------------------------------------------------
     700                 :          0 : void OCopyTableWizard::construct()
     701                 :            : {
     702                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::construct" );
     703                 :          0 :     AddButton( &m_pbHelp, WIZARDDIALOG_BUTTON_STDOFFSET_X );
     704                 :          0 :     AddButton( &m_pbCancel, WIZARDDIALOG_BUTTON_STDOFFSET_X );
     705                 :          0 :     AddButton( &m_pbPrev );
     706                 :          0 :     AddButton( &m_pbNext, WIZARDDIALOG_BUTTON_STDOFFSET_X );
     707                 :          0 :     AddButton( &m_pbFinish );
     708                 :            : 
     709                 :          0 :     m_pbPrev.SetClickHdl( LINK( this, OCopyTableWizard, ImplPrevHdl ) );
     710                 :          0 :     m_pbNext.SetClickHdl( LINK( this, OCopyTableWizard, ImplNextHdl ) );
     711                 :          0 :     m_pbFinish.SetClickHdl( LINK( this, OCopyTableWizard, ImplOKHdl ) );
     712                 :            : 
     713                 :          0 :     SetActivatePageHdl( LINK( this, OCopyTableWizard, ImplActivateHdl ) );
     714                 :            : 
     715                 :          0 :     SetPrevButton( &m_pbPrev );
     716                 :          0 :     SetNextButton( &m_pbNext );
     717                 :            : 
     718                 :          0 :     ShowButtonFixedLine( sal_True );
     719                 :            : 
     720                 :          0 :     m_pbNext.GrabFocus();
     721                 :            : 
     722         [ #  # ]:          0 :     if (m_vDestColumns.size())
     723                 :            :         // source is a html or rtf table
     724                 :          0 :         m_pbNext.SetStyle(m_pbFinish.GetStyle() | WB_DEFBUTTON);
     725                 :            :     else
     726                 :          0 :         m_pbFinish.SetStyle(m_pbFinish.GetStyle() | WB_DEFBUTTON);
     727                 :            : 
     728                 :          0 :     FreeResource();
     729                 :            : 
     730         [ #  # ]:          0 :     m_pTypeInfo = TOTypeInfoSP(new OTypeInfo());
     731         [ #  # ]:          0 :     m_pTypeInfo->aUIName = m_sTypeNames.GetToken(TYPE_OTHER);
     732                 :          0 :     m_bAddPKFirstTime = sal_True;
     733                 :          0 : }
     734                 :            : //------------------------------------------------------------------------
     735 [ #  # ][ #  # ]:          0 : OCopyTableWizard::~OCopyTableWizard()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     736                 :            : {
     737                 :            :     DBG_DTOR(OCopyTableWizard,NULL);
     738                 :          0 :     for ( ;; )
     739                 :            :     {
     740         [ #  # ]:          0 :         TabPage *pPage = GetPage(0);
     741         [ #  # ]:          0 :         if ( pPage == NULL )
     742                 :          0 :             break;
     743         [ #  # ]:          0 :         RemovePage( pPage );
     744 [ #  # ][ #  # ]:          0 :         delete pPage;
     745                 :            :     }
     746                 :            : 
     747         [ #  # ]:          0 :     if ( m_bDeleteSourceColumns )
     748         [ #  # ]:          0 :         clearColumns(m_vSourceColumns,m_vSourceVec);
     749                 :            : 
     750         [ #  # ]:          0 :     clearColumns(m_vDestColumns,m_aDestVec);
     751                 :            : 
     752                 :            :     // clear the type information
     753                 :          0 :     m_aTypeInfoIndex.clear();
     754                 :          0 :     m_aTypeInfo.clear();
     755                 :          0 :     m_aDestTypeInfoIndex.clear();
     756         [ #  # ]:          0 : }
     757                 :            : // -----------------------------------------------------------------------
     758                 :          0 : IMPL_LINK_NOARG(OCopyTableWizard, ImplPrevHdl)
     759                 :            : {
     760                 :          0 :     m_ePressed = WIZARD_PREV;
     761         [ #  # ]:          0 :     if ( GetCurLevel() )
     762                 :            :     {
     763         [ #  # ]:          0 :         if ( getOperation() != CopyTableOperation::AppendData )
     764                 :            :         {
     765         [ #  # ]:          0 :             if(GetCurLevel() == 2)
     766                 :          0 :                 ShowPage(GetCurLevel()-2);
     767                 :            :             else
     768                 :          0 :                 ShowPrevPage();
     769                 :            :         }
     770                 :            :         else
     771                 :          0 :             ShowPrevPage();
     772                 :            :     }
     773                 :          0 :     return 0;
     774                 :            : }
     775                 :            : 
     776                 :            : // -----------------------------------------------------------------------
     777                 :            : 
     778                 :          0 : IMPL_LINK_NOARG(OCopyTableWizard, ImplNextHdl)
     779                 :            : {
     780                 :          0 :     m_ePressed = WIZARD_NEXT;
     781         [ #  # ]:          0 :     if ( GetCurLevel() < MAX_PAGES )
     782                 :            :     {
     783         [ #  # ]:          0 :         if ( getOperation() != CopyTableOperation::AppendData )
     784                 :            :         {
     785         [ #  # ]:          0 :             if(GetCurLevel() == 0)
     786                 :          0 :                 ShowPage(GetCurLevel()+2);
     787                 :            :             else
     788                 :          0 :                 ShowNextPage();
     789                 :            :         }
     790                 :            :         else
     791                 :          0 :             ShowNextPage();
     792                 :            :     }
     793                 :          0 :     return 0;
     794                 :            : }
     795                 :            : // -----------------------------------------------------------------------
     796                 :          0 : sal_Bool OCopyTableWizard::CheckColumns(sal_Int32& _rnBreakPos)
     797                 :            : {
     798                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::CheckColumns" );
     799                 :          0 :     sal_Bool bRet = sal_True;
     800                 :          0 :     m_vColumnPos.clear();
     801                 :          0 :     m_vColumnTypes.clear();
     802                 :            : 
     803                 :            :     OSL_ENSURE( m_xDestConnection.is(), "OCopyTableWizard::CheckColumns: No connection!" );
     804                 :            :     //////////////////////////////////////////////////////////////////////
     805                 :            :     // Wenn Datenbank PrimaryKeys verarbeiten kann, PrimaryKey anlegen
     806         [ #  # ]:          0 :     if ( m_xDestConnection.is() )
     807                 :            :     {
     808         [ #  # ]:          0 :         sal_Bool bPKeyAllowed = supportsPrimaryKey();
     809                 :            : 
     810                 :          0 :         sal_Bool bContainsColumns = !m_vDestColumns.empty();
     811                 :            : 
     812 [ #  # ][ #  # ]:          0 :         if ( bPKeyAllowed && shouldCreatePrimaryKey() )
                 [ #  # ]
     813                 :            :         {
     814                 :            :             // add extra column for the primary key
     815         [ #  # ]:          0 :             TOTypeInfoSP pTypeInfo = queryPrimaryKeyType(m_aDestTypeInfo);
     816         [ #  # ]:          0 :             if ( pTypeInfo.get() )
     817                 :            :             {
     818         [ #  # ]:          0 :                 if ( m_bAddPKFirstTime )
     819                 :            :                 {
     820 [ #  # ][ #  # ]:          0 :                     OFieldDescription* pField = new OFieldDescription();
     821         [ #  # ]:          0 :                     pField->SetName(m_aKeyName);
     822         [ #  # ]:          0 :                     pField->FillFromTypeInfo(pTypeInfo,sal_True,sal_True);
     823         [ #  # ]:          0 :                     pField->SetPrimaryKey(sal_True);
     824                 :          0 :                     m_bAddPKFirstTime = sal_False;
     825         [ #  # ]:          0 :                     insertColumn(0,pField);
     826                 :            :                 }
     827 [ #  # ][ #  # ]:          0 :                 m_vColumnPos.push_back(ODatabaseExport::TPositions::value_type(1,1));
     828         [ #  # ]:          0 :                 m_vColumnTypes.push_back(pTypeInfo->nType);
     829         [ #  # ]:          0 :             }
     830                 :            :         }
     831                 :            : 
     832         [ #  # ]:          0 :         if ( bContainsColumns )
     833                 :            :         {   // we have dest columns so look for the matching column
     834         [ #  # ]:          0 :             ODatabaseExport::TColumnVector::const_iterator aSrcIter = m_vSourceVec.begin();
     835         [ #  # ]:          0 :             ODatabaseExport::TColumnVector::const_iterator aSrcEnd = m_vSourceVec.end();
     836 [ #  # ][ #  # ]:          0 :             for(;aSrcIter != aSrcEnd;++aSrcIter)
     837                 :            :             {
     838 [ #  # ][ #  # ]:          0 :                 ODatabaseExport::TColumns::iterator aDestIter = m_vDestColumns.find(m_mNameMapping[(*aSrcIter)->first]);
     839                 :            : 
     840         [ #  # ]:          0 :                 if ( aDestIter != m_vDestColumns.end() )
     841                 :            :                 {
     842 [ #  # ][ #  # ]:          0 :                     ODatabaseExport::TColumnVector::const_iterator aFind = ::std::find(m_aDestVec.begin(),m_aDestVec.end(),aDestIter);
     843         [ #  # ]:          0 :                     sal_Int32 nPos = (aFind - m_aDestVec.begin())+1;
     844 [ #  # ][ #  # ]:          0 :                     m_vColumnPos.push_back(ODatabaseExport::TPositions::value_type(nPos,nPos));
     845 [ #  # ][ #  # ]:          0 :                     m_vColumnTypes.push_back((*aFind)->second->GetType());
     846                 :            :                 }
     847                 :            :                 else
     848                 :            :                 {
     849 [ #  # ][ #  # ]:          0 :                     m_vColumnPos.push_back( ODatabaseExport::TPositions::value_type( COLUMN_POSITION_NOT_FOUND, COLUMN_POSITION_NOT_FOUND ) );
     850         [ #  # ]:          0 :                     m_vColumnTypes.push_back(0);
     851                 :            :                 }
     852                 :            :             }
     853                 :            :         }
     854                 :            :         else
     855                 :            :         {
     856 [ #  # ][ #  # ]:          0 :             Reference< XDatabaseMetaData > xMetaData( m_xDestConnection->getMetaData() );
     857 [ #  # ][ #  # ]:          0 :             ::rtl::OUString sExtraChars = xMetaData->getExtraNameCharacters();
     858         [ #  # ]:          0 :             sal_Int32 nMaxNameLen       = getMaxColumnNameLength();
     859                 :            : 
     860         [ #  # ]:          0 :             ODatabaseExport::TColumnVector::const_iterator aSrcIter = m_vSourceVec.begin();
     861         [ #  # ]:          0 :             ODatabaseExport::TColumnVector::const_iterator aSrcEnd = m_vSourceVec.end();
     862 [ #  # ][ #  # ]:          0 :             for(_rnBreakPos=0;aSrcIter != aSrcEnd && bRet ;++aSrcIter,++_rnBreakPos)
         [ #  # ][ #  # ]
     863                 :            :             {
     864 [ #  # ][ #  # ]:          0 :                 OFieldDescription* pField = new OFieldDescription(*(*aSrcIter)->second);
     865 [ #  # ][ #  # ]:          0 :                 pField->SetName(convertColumnName(TExportColumnFindFunctor(&m_vDestColumns),(*aSrcIter)->first,sExtraChars,nMaxNameLen));
     866 [ #  # ][ #  # ]:          0 :                 TOTypeInfoSP pType = convertType((*aSrcIter)->second->getSpecialTypeInfo(),bRet);
                 [ #  # ]
     867 [ #  # ][ #  # ]:          0 :                 pField->SetType(pType);
                 [ #  # ]
     868         [ #  # ]:          0 :                 if ( !bPKeyAllowed )
     869         [ #  # ]:          0 :                     pField->SetPrimaryKey(sal_False);
     870                 :            : 
     871                 :            :                 // now create a column
     872         [ #  # ]:          0 :                 insertColumn(m_vDestColumns.size(),pField);
     873 [ #  # ][ #  # ]:          0 :                 m_vColumnPos.push_back(ODatabaseExport::TPositions::value_type(m_vDestColumns.size(),m_vDestColumns.size()));
     874 [ #  # ][ #  # ]:          0 :                 m_vColumnTypes.push_back((*aSrcIter)->second->GetType());
     875         [ #  # ]:          0 :             }
     876                 :            :         }
     877                 :            :     }
     878                 :          0 :     return bRet;
     879                 :            : }
     880                 :            : // -----------------------------------------------------------------------
     881                 :          0 : IMPL_LINK_NOARG(OCopyTableWizard, ImplOKHdl)
     882                 :            : {
     883                 :          0 :     m_ePressed = WIZARD_FINISH;
     884                 :          0 :     sal_Bool bFinish = DeactivatePage() != 0;
     885                 :            : 
     886         [ #  # ]:          0 :     if(bFinish)
     887                 :            :     {
     888         [ #  # ]:          0 :         WaitObject aWait(this);
     889      [ #  #  # ]:          0 :         switch(getOperation())
     890                 :            :         {
     891                 :            :             case CopyTableOperation::CopyDefinitionAndData:
     892                 :            :             case CopyTableOperation::CopyDefinitionOnly:
     893                 :            :             {
     894                 :          0 :                 sal_Bool bOnFirstPage = GetCurLevel() == 0;
     895         [ #  # ]:          0 :                 if ( bOnFirstPage )
     896                 :            :                 {
     897                 :            :                     // we came from the first page so we have to clear
     898                 :            :                     // all column information already collected
     899         [ #  # ]:          0 :                     clearDestColumns();
     900                 :          0 :                     m_mNameMapping.clear();
     901                 :            :                 }
     902                 :          0 :                 sal_Int32 nBreakPos = 0;
     903         [ #  # ]:          0 :                 sal_Bool bCheckOk = CheckColumns(nBreakPos);
     904 [ #  # ][ #  # ]:          0 :                 if ( bOnFirstPage && !bCheckOk )
     905                 :            :                 {
     906         [ #  # ]:          0 :                     showColumnTypeNotSupported(m_vSourceVec[nBreakPos-1]->first);
     907         [ #  # ]:          0 :                     OWizTypeSelect* pPage = static_cast<OWizTypeSelect*>(GetPage(3));
     908         [ #  # ]:          0 :                     if ( pPage )
     909                 :            :                     {
     910                 :          0 :                         m_mNameMapping.clear();
     911                 :          0 :                         pPage->setDisplayRow(nBreakPos);
     912         [ #  # ]:          0 :                         ShowPage(3);
     913                 :          0 :                         return 0;
     914                 :            :                     }
     915                 :            :                 }
     916         [ #  # ]:          0 :                 if ( m_xDestConnection.is() )
     917                 :            :                 {
     918 [ #  # ][ #  # ]:          0 :                     if ( supportsPrimaryKey() )
     919                 :            :                     {
     920                 :            :                         ODatabaseExport::TColumns::iterator aFind = ::std::find_if(m_vDestColumns.begin(),m_vDestColumns.end()
     921 [ #  # ][ #  # ]:          0 :                             ,::o3tl::compose1(::std::mem_fun(&OFieldDescription::IsPrimaryKey),::o3tl::select2nd<ODatabaseExport::TColumns::value_type>()));
                 [ #  # ]
     922 [ #  # ][ #  # ]:          0 :                         if ( aFind == m_vDestColumns.end() && m_xInteractionHandler.is() )
         [ #  # ][ #  # ]
     923                 :            :                         {
     924                 :            : 
     925 [ #  # ][ #  # ]:          0 :                             String sTitle(ModuleRes(STR_TABLEDESIGN_NO_PRIM_KEY_HEAD));
     926 [ #  # ][ #  # ]:          0 :                             String sMsg(ModuleRes(STR_TABLEDESIGN_NO_PRIM_KEY));
     927         [ #  # ]:          0 :                             SQLContext aError;
     928         [ #  # ]:          0 :                             aError.Message = sMsg;
     929 [ #  # ][ #  # ]:          0 :                             ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( makeAny( aError ) ) );
     930         [ #  # ]:          0 :                             ::rtl::Reference< ::comphelper::OInteractionApprove > xYes = new ::comphelper::OInteractionApprove;
     931 [ #  # ][ #  # ]:          0 :                             xRequest->addContinuation( xYes.get() );
                 [ #  # ]
     932 [ #  # ][ #  # ]:          0 :                             xRequest->addContinuation( new ::comphelper::OInteractionDisapprove );
         [ #  # ][ #  # ]
     933         [ #  # ]:          0 :                             ::rtl::Reference< ::comphelper::OInteractionAbort > xAbort = new ::comphelper::OInteractionAbort;
     934 [ #  # ][ #  # ]:          0 :                             xRequest->addContinuation( xAbort.get() );
                 [ #  # ]
     935                 :            : 
     936 [ #  # ][ #  # ]:          0 :                             m_xInteractionHandler->handle( xRequest.get() );
         [ #  # ][ #  # ]
     937                 :            : 
     938         [ #  # ]:          0 :                             if ( xYes->wasSelected() )
     939                 :            :                             {
     940         [ #  # ]:          0 :                                 OCopyTable* pPage = static_cast<OCopyTable*>(GetPage(0));
     941                 :          0 :                                 m_bCreatePrimaryKeyColumn = sal_True;
     942 [ #  # ][ #  # ]:          0 :                                 m_aKeyName = pPage->GetKeyName();
                 [ #  # ]
     943         [ #  # ]:          0 :                                 if ( m_aKeyName.isEmpty() )
     944         [ #  # ]:          0 :                                     m_aKeyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ID" ) );
     945         [ #  # ]:          0 :                                 m_aKeyName = createUniqueName( m_aKeyName );
     946                 :          0 :                                 sal_Int32 nBreakPos2 = 0;
     947         [ #  # ]:          0 :                                 CheckColumns(nBreakPos2);
     948                 :            :                             }
     949         [ #  # ]:          0 :                             else if ( xAbort->wasSelected() )
     950                 :            :                             {
     951         [ #  # ]:          0 :                                 ShowPage(3);
     952                 :          0 :                                 return 0;
     953 [ #  # ][ #  # ]:          0 :                             }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     954                 :            :                         }
     955                 :            :                     }
     956                 :            :                 }
     957                 :            :                 break;
     958                 :            :             }
     959                 :            :             case CopyTableOperation::AppendData:
     960                 :            :             case CopyTableOperation::CreateAsView:
     961                 :          0 :                 break;
     962                 :            :             default:
     963                 :            :             {
     964                 :            :                 OSL_FAIL("OCopyTableWizard::ImplOKHdl: invalid creation style!");
     965                 :            :             }
     966                 :            :         }
     967                 :            : 
     968 [ #  # ][ #  # ]:          0 :         EndDialog(RET_OK);
                 [ #  # ]
     969                 :            :     }
     970                 :          0 :     return bFinish;
     971                 :            : }
     972                 :            : //------------------------------------------------------------------------
     973                 :          0 : sal_Bool OCopyTableWizard::shouldCreatePrimaryKey() const
     974                 :            : {
     975                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::shouldCreatePrimaryKey" );
     976                 :          0 :     return m_bCreatePrimaryKeyColumn;
     977                 :            : }
     978                 :            : 
     979                 :            : // -----------------------------------------------------------------------
     980                 :          0 : void OCopyTableWizard::setCreatePrimaryKey( bool _bDoCreate, const ::rtl::OUString& _rSuggestedName )
     981                 :            : {
     982                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::setCreatePrimaryKey" );
     983                 :          0 :     m_bCreatePrimaryKeyColumn = _bDoCreate;
     984         [ #  # ]:          0 :     if ( !_rSuggestedName.isEmpty() )
     985                 :          0 :         m_aKeyName = _rSuggestedName;
     986                 :            : 
     987         [ #  # ]:          0 :     OCopyTable* pSettingsPage = dynamic_cast< OCopyTable* >( GetPage( 0 ) );
     988                 :            :     OSL_ENSURE( pSettingsPage, "OCopyTableWizard::setCreatePrimaryKey: page should have been added in the ctor!" );
     989         [ #  # ]:          0 :     if ( pSettingsPage )
     990                 :          0 :         pSettingsPage->setCreatePrimaryKey( _bDoCreate, _rSuggestedName );
     991                 :          0 : }
     992                 :            : 
     993                 :            : // -----------------------------------------------------------------------
     994                 :          0 : IMPL_LINK_NOARG(OCopyTableWizard, ImplActivateHdl)
     995                 :            : {
     996                 :          0 :     OWizardPage* pCurrent = (OWizardPage*)GetPage(GetCurLevel());
     997         [ #  # ]:          0 :     if(pCurrent)
     998                 :            :     {
     999                 :          0 :         sal_Bool bFirstTime = pCurrent->IsFirstTime();
    1000         [ #  # ]:          0 :         if(bFirstTime)
    1001                 :          0 :             pCurrent->Reset();
    1002                 :            : 
    1003                 :          0 :         CheckButtons();
    1004                 :            : 
    1005         [ #  # ]:          0 :         SetText(pCurrent->GetTitle());
    1006                 :            : 
    1007                 :          0 :         Invalidate();
    1008                 :            :     }
    1009                 :          0 :     return 0;
    1010                 :            : }
    1011                 :            : // -----------------------------------------------------------------------
    1012                 :          0 : void OCopyTableWizard::CheckButtons()
    1013                 :            : {
    1014                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::CheckButtons" );
    1015         [ #  # ]:          0 :     if(GetCurLevel() == 0) // the first page has no back button
    1016                 :            :     {
    1017         [ #  # ]:          0 :         if(m_nPageCount > 1)
    1018                 :          0 :             m_pbNext.Enable(sal_True);
    1019                 :            :         else
    1020                 :          0 :             m_pbNext.Enable(sal_False);
    1021                 :            : 
    1022                 :          0 :         m_pbPrev.Enable(sal_False);
    1023                 :            :     }
    1024         [ #  # ]:          0 :     else if(GetCurLevel() == m_nPageCount-1) // the last page has no next button
    1025                 :            :     {
    1026                 :          0 :         m_pbNext.Enable(sal_False);
    1027                 :          0 :         m_pbPrev.Enable(sal_True);
    1028                 :            :     }
    1029                 :            :     else
    1030                 :            :     {
    1031                 :          0 :         m_pbPrev.Enable(sal_True);
    1032                 :            :         // next already has its state
    1033                 :            :     }
    1034                 :          0 : }
    1035                 :            : // -----------------------------------------------------------------------
    1036                 :          0 : void OCopyTableWizard::EnableButton(Wizard_Button_Style eStyle,sal_Bool bEnable)
    1037                 :            : {
    1038                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::EnableButton" );
    1039                 :            :     Button* pButton;
    1040         [ #  # ]:          0 :     if(eStyle == WIZARD_NEXT)
    1041                 :          0 :         pButton = &m_pbNext;
    1042         [ #  # ]:          0 :     else if(eStyle == WIZARD_PREV)
    1043                 :          0 :         pButton = &m_pbPrev;
    1044                 :            :     else
    1045                 :          0 :         pButton = &m_pbFinish;
    1046                 :          0 :     pButton->Enable(bEnable);
    1047                 :            : 
    1048                 :          0 : }
    1049                 :            : // -----------------------------------------------------------------------
    1050                 :          0 : long OCopyTableWizard::DeactivatePage()
    1051                 :            : {
    1052                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::DeactivatePage" );
    1053                 :          0 :     OWizardPage* pPage = (OWizardPage*)GetPage(GetCurLevel());
    1054         [ #  # ]:          0 :     return pPage ? pPage->LeavePage() : sal_False;
    1055                 :            : }
    1056                 :            : // -----------------------------------------------------------------------
    1057                 :          0 : void OCopyTableWizard::AddWizardPage(OWizardPage* pPage)
    1058                 :            : {
    1059                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::AddWizardPage" );
    1060                 :          0 :     AddPage(pPage);
    1061                 :          0 :     ++m_nPageCount;
    1062                 :          0 : }
    1063                 :            : // -----------------------------------------------------------------------------
    1064                 :          0 : void OCopyTableWizard::insertColumn(sal_Int32 _nPos,OFieldDescription* _pField)
    1065                 :            : {
    1066                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::insertColumn" );
    1067                 :            :     OSL_ENSURE(_pField,"FieldDescrioption is null!");
    1068         [ #  # ]:          0 :     if ( _pField )
    1069                 :            :     {
    1070 [ #  # ][ #  # ]:          0 :         ODatabaseExport::TColumns::iterator aFind = m_vDestColumns.find(_pField->GetName());
    1071         [ #  # ]:          0 :         if ( aFind != m_vDestColumns.end() )
    1072                 :            :         {
    1073 [ #  # ][ #  # ]:          0 :             delete aFind->second;
    1074         [ #  # ]:          0 :             m_vDestColumns.erase(aFind);
    1075                 :            :         }
    1076                 :            : 
    1077                 :          0 :         m_aDestVec.insert(m_aDestVec.begin() + _nPos,
    1078 [ #  # ][ #  # ]:          0 :             m_vDestColumns.insert(ODatabaseExport::TColumns::value_type(_pField->GetName(),_pField)).first);
         [ #  # ][ #  # ]
    1079 [ #  # ][ #  # ]:          0 :         m_mNameMapping[_pField->GetName()] = _pField->GetName();
                 [ #  # ]
    1080                 :            :     }
    1081                 :          0 : }
    1082                 :            : // -----------------------------------------------------------------------------
    1083                 :          0 : void OCopyTableWizard::replaceColumn(sal_Int32 _nPos,OFieldDescription* _pField,const ::rtl::OUString& _sOldName)
    1084                 :            : {
    1085                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::replaceColumn" );
    1086                 :            :     OSL_ENSURE(_pField,"FieldDescrioption is null!");
    1087         [ #  # ]:          0 :     if ( _pField )
    1088                 :            :     {
    1089                 :          0 :         m_vDestColumns.erase(_sOldName);
    1090                 :            :         OSL_ENSURE( m_vDestColumns.find(_pField->GetName()) == m_vDestColumns.end(),"Column with that name already exist!");
    1091                 :            : 
    1092                 :          0 :         m_aDestVec[_nPos] =
    1093         [ #  # ]:          0 :             m_vDestColumns.insert(ODatabaseExport::TColumns::value_type(_pField->GetName(),_pField)).first;
    1094                 :            :     }
    1095                 :          0 : }
    1096                 :            : // -----------------------------------------------------------------------------
    1097                 :          0 : void OCopyTableWizard::impl_loadSourceData()
    1098                 :            : {
    1099                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::impl_loadSourceData" );
    1100                 :          0 :     loadData( m_rSourceObject, m_vSourceColumns, m_vSourceVec );
    1101                 :          0 : }
    1102                 :            : 
    1103                 :            : // -----------------------------------------------------------------------------
    1104                 :          0 : void OCopyTableWizard::loadData(  const ICopyTableSourceObject& _rSourceObject, ODatabaseExport::TColumns& _rColumns, ODatabaseExport::TColumnVector& _rColVector )
    1105                 :            : {
    1106                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::loadData" );
    1107                 :          0 :     ODatabaseExport::TColumns::iterator colEnd = _rColumns.end();
    1108         [ #  # ]:          0 :     for ( ODatabaseExport::TColumns::iterator col = _rColumns.begin(); col != colEnd; ++col )
    1109 [ #  # ][ #  # ]:          0 :         delete col->second;
    1110                 :            : 
    1111                 :          0 :     _rColVector.clear();
    1112                 :          0 :     _rColumns.clear();
    1113                 :            : 
    1114                 :          0 :     OFieldDescription* pActFieldDescr = NULL;
    1115         [ #  # ]:          0 :     String aType;
    1116         [ #  # ]:          0 :     ::rtl::OUString sCreateParam(RTL_CONSTASCII_USTRINGPARAM("x"));
    1117                 :            :     //////////////////////////////////////////////////////////////////////
    1118                 :            :     // ReadOnly-Flag
    1119                 :            :     // Bei Drop darf keine Zeile editierbar sein.
    1120                 :            :     // Bei Add duerfen nur die leeren Zeilen editierbar sein.
    1121                 :            :     // Bei Add und Drop koennen alle Zeilen editiert werden.
    1122         [ #  # ]:          0 :     Sequence< ::rtl::OUString > aColumns( _rSourceObject.getColumnNames() );
    1123                 :          0 :     const ::rtl::OUString* pColumn      = aColumns.getConstArray();
    1124                 :          0 :     const ::rtl::OUString* pColumnEnd   = pColumn + aColumns.getLength();
    1125                 :            : 
    1126         [ #  # ]:          0 :     for ( ; pColumn != pColumnEnd; ++pColumn )
    1127                 :            :     {
    1128                 :            :         // get the properties of the column
    1129         [ #  # ]:          0 :         pActFieldDescr = _rSourceObject.createFieldDescription( *pColumn );
    1130                 :            :         OSL_ENSURE( pActFieldDescr, "OCopyTableWizard::loadData: illegal field description!" );
    1131         [ #  # ]:          0 :         if ( !pActFieldDescr )
    1132                 :          0 :             continue;
    1133                 :            : 
    1134         [ #  # ]:          0 :         sal_Int32 nType           = pActFieldDescr->GetType();
    1135         [ #  # ]:          0 :         sal_Int32 nScale          = pActFieldDescr->GetScale();
    1136         [ #  # ]:          0 :         sal_Int32 nPrecision      = pActFieldDescr->GetPrecision();
    1137         [ #  # ]:          0 :         sal_Bool bAutoIncrement   = pActFieldDescr->IsAutoIncrement();
    1138         [ #  # ]:          0 :         ::rtl::OUString sTypeName = pActFieldDescr->GetTypeName();
    1139                 :            : 
    1140                 :            :         // search for type
    1141                 :            :         sal_Bool bForce;
    1142         [ #  # ]:          0 :         TOTypeInfoSP pTypeInfo = ::dbaui::getTypeInfoFromType(m_aTypeInfo,nType,sTypeName,sCreateParam,nPrecision,nScale,bAutoIncrement,bForce);
    1143         [ #  # ]:          0 :         if ( !pTypeInfo.get() )
    1144         [ #  # ]:          0 :             pTypeInfo = m_pTypeInfo;
    1145                 :            : 
    1146         [ #  # ]:          0 :         pActFieldDescr->FillFromTypeInfo(pTypeInfo,sal_True,sal_False);
    1147 [ #  # ][ #  # ]:          0 :         _rColVector.push_back(_rColumns.insert(ODatabaseExport::TColumns::value_type(pActFieldDescr->GetName(),pActFieldDescr)).first);
                 [ #  # ]
    1148         [ #  # ]:          0 :     }
    1149                 :            : 
    1150                 :            :     // determine which coumns belong to the primary key
    1151         [ #  # ]:          0 :     Sequence< ::rtl::OUString > aPrimaryKeyColumns( _rSourceObject.getPrimaryKeyColumnNames() );
    1152                 :          0 :     const ::rtl::OUString* pKeyColName  = aPrimaryKeyColumns.getConstArray();
    1153                 :          0 :     const ::rtl::OUString* pKeyColEnd   = pKeyColName + aPrimaryKeyColumns.getLength();
    1154                 :            : 
    1155         [ #  # ]:          0 :     for( ; pKeyColName != pKeyColEnd; ++pKeyColName )
    1156                 :            :     {
    1157         [ #  # ]:          0 :         ODatabaseExport::TColumns::iterator keyPos = _rColumns.find( *pKeyColName );
    1158         [ #  # ]:          0 :         if ( keyPos != _rColumns.end() )
    1159                 :            :         {
    1160         [ #  # ]:          0 :             keyPos->second->SetPrimaryKey( sal_True );
    1161         [ #  # ]:          0 :             keyPos->second->SetIsNullable( ColumnValue::NO_NULLS );
    1162                 :            :         }
    1163 [ #  # ][ #  # ]:          0 :     }
                 [ #  # ]
    1164                 :          0 : }
    1165                 :            : // -----------------------------------------------------------------------------
    1166                 :          0 : void OCopyTableWizard::clearDestColumns()
    1167                 :            : {
    1168                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::clearDestColumns" );
    1169                 :          0 :     clearColumns(m_vDestColumns,m_aDestVec);
    1170                 :          0 :     m_bAddPKFirstTime = sal_True;
    1171                 :          0 :     m_mNameMapping.clear();
    1172                 :          0 : }
    1173                 :            : 
    1174                 :            : // -----------------------------------------------------------------------------
    1175                 :          0 : void OCopyTableWizard::appendColumns( Reference<XColumnsSupplier>& _rxColSup, const ODatabaseExport::TColumnVector* _pVec, sal_Bool _bKeyColumns) const
    1176                 :            : {
    1177                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::appendColumns" );
    1178                 :            :     // now append the columns
    1179                 :            :     OSL_ENSURE(_rxColSup.is(),"No columns supplier");
    1180         [ #  # ]:          0 :     if(!_rxColSup.is())
    1181                 :          0 :         return;
    1182 [ #  # ][ #  # ]:          0 :     Reference<XNameAccess> xColumns = _rxColSup->getColumns();
    1183                 :            :     OSL_ENSURE(xColumns.is(),"No columns");
    1184         [ #  # ]:          0 :     Reference<XDataDescriptorFactory> xColumnFactory(xColumns,UNO_QUERY);
    1185                 :            : 
    1186         [ #  # ]:          0 :     Reference<XAppend> xAppend(xColumns,UNO_QUERY);
    1187                 :            :     OSL_ENSURE(xAppend.is(),"No XAppend Interface!");
    1188                 :            : 
    1189                 :          0 :     ODatabaseExport::TColumnVector::const_iterator aIter = _pVec->begin();
    1190                 :          0 :     ODatabaseExport::TColumnVector::const_iterator aEnd = _pVec->end();
    1191 [ #  # ][ #  # ]:          0 :     for(;aIter != aEnd;++aIter)
    1192                 :            :     {
    1193                 :          0 :         OFieldDescription* pField = (*aIter)->second;
    1194         [ #  # ]:          0 :         if(!pField)
    1195                 :          0 :             continue;
    1196                 :            : 
    1197                 :          0 :         Reference<XPropertySet> xColumn;
    1198 [ #  # ][ #  # ]:          0 :         if(pField->IsPrimaryKey() || !_bKeyColumns)
         [ #  # ][ #  # ]
    1199 [ #  # ][ #  # ]:          0 :             xColumn = xColumnFactory->createDataDescriptor();
                 [ #  # ]
    1200         [ #  # ]:          0 :         if(xColumn.is())
    1201                 :            :         {
    1202         [ #  # ]:          0 :             if(!_bKeyColumns)
    1203         [ #  # ]:          0 :                 dbaui::setColumnProperties(xColumn,pField);
    1204                 :            :             else
    1205 [ #  # ][ #  # ]:          0 :                 xColumn->setPropertyValue(PROPERTY_NAME,makeAny(pField->GetName()));
         [ #  # ][ #  # ]
                 [ #  # ]
    1206                 :            : 
    1207 [ #  # ][ #  # ]:          0 :             xAppend->appendByDescriptor(xColumn);
    1208         [ #  # ]:          0 :             xColumn = NULL;
    1209                 :            :             // now only the settings are missing
    1210 [ #  # ][ #  # ]:          0 :             if(xColumns->hasByName(pField->GetName()))
         [ #  # ][ #  # ]
    1211                 :            :             {
    1212 [ #  # ][ #  # ]:          0 :                 xColumn.set(xColumns->getByName(pField->GetName()),UNO_QUERY);
         [ #  # ][ #  # ]
    1213                 :            :                 OSL_ENSURE(xColumn.is(),"OCopyTableWizard::appendColumns: Column is NULL!");
    1214         [ #  # ]:          0 :                 if ( xColumn.is() )
    1215         [ #  # ]:          0 :                     pField->copyColumnSettingsTo(xColumn);
    1216                 :            :             }
    1217                 :            :             else
    1218                 :            :             {
    1219                 :            :                 OSL_FAIL("OCopyTableWizard::appendColumns: invalid field name!");
    1220                 :            :             }
    1221                 :            : 
    1222                 :            :         }
    1223                 :          0 :     }
    1224                 :            : }
    1225                 :            : // -----------------------------------------------------------------------------
    1226                 :          0 : void OCopyTableWizard::appendKey( Reference<XKeysSupplier>& _rxSup, const ODatabaseExport::TColumnVector* _pVec) const
    1227                 :            : {
    1228                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::appendKey" );
    1229         [ #  # ]:          0 :     if(!_rxSup.is())
    1230                 :            :         return; // the database doesn't support keys
    1231                 :            :     OSL_ENSURE(_rxSup.is(),"No XKeysSupplier!");
    1232 [ #  # ][ #  # ]:          0 :     Reference<XDataDescriptorFactory> xKeyFactory(_rxSup->getKeys(),UNO_QUERY);
                 [ #  # ]
    1233                 :            :     OSL_ENSURE(xKeyFactory.is(),"No XDataDescriptorFactory Interface!");
    1234         [ #  # ]:          0 :     if ( !xKeyFactory.is() )
    1235                 :            :         return;
    1236         [ #  # ]:          0 :     Reference<XAppend> xAppend(xKeyFactory,UNO_QUERY);
    1237                 :            :     OSL_ENSURE(xAppend.is(),"No XAppend Interface!");
    1238                 :            : 
    1239 [ #  # ][ #  # ]:          0 :     Reference<XPropertySet> xKey = xKeyFactory->createDataDescriptor();
    1240                 :            :     OSL_ENSURE(xKey.is(),"Key is null!");
    1241 [ #  # ][ #  # ]:          0 :     xKey->setPropertyValue(PROPERTY_TYPE,makeAny(KeyType::PRIMARY));
         [ #  # ][ #  # ]
    1242                 :            : 
    1243         [ #  # ]:          0 :     Reference<XColumnsSupplier> xColSup(xKey,UNO_QUERY);
    1244         [ #  # ]:          0 :     if(xColSup.is())
    1245                 :            :     {
    1246         [ #  # ]:          0 :         appendColumns(xColSup,_pVec,sal_True);
    1247 [ #  # ][ #  # ]:          0 :         Reference<XNameAccess> xColumns = xColSup->getColumns();
    1248 [ #  # ][ #  # ]:          0 :         if(xColumns.is() && xColumns->getElementNames().getLength())
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    1249 [ #  # ][ #  # ]:          0 :             xAppend->appendByDescriptor(xKey);
    1250         [ #  # ]:          0 :     }
    1251                 :            : 
    1252                 :            : }
    1253                 :            : // -----------------------------------------------------------------------------
    1254                 :          0 : Reference< XPropertySet > OCopyTableWizard::createView() const
    1255                 :            : {
    1256                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::createView" );
    1257         [ #  # ]:          0 :     ::rtl::OUString sCommand( m_rSourceObject.getSelectStatement() );
    1258                 :            :     OSL_ENSURE( !sCommand.isEmpty(), "OCopyTableWizard::createView: no statement in the source object!" );
    1259                 :            :         // there are legitimate cases in which getSelectStatement does not provide a statement,
    1260                 :            :         // but in all those cases, this method here should never be called.
    1261         [ #  # ]:          0 :     return ::dbaui::createView( m_sName, m_xDestConnection, sCommand );
    1262                 :            : }
    1263                 :            : // -----------------------------------------------------------------------------
    1264                 :          0 : Reference< XPropertySet > OCopyTableWizard::createTable()
    1265                 :            : {
    1266                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::createTable" );
    1267                 :          0 :     Reference< XPropertySet > xTable;
    1268                 :            : 
    1269         [ #  # ]:          0 :     Reference<XTablesSupplier> xSup( m_xDestConnection, UNO_QUERY );
    1270                 :          0 :     Reference< XNameAccess > xTables;
    1271         [ #  # ]:          0 :     if(xSup.is())
    1272 [ #  # ][ #  # ]:          0 :         xTables = xSup->getTables();
                 [ #  # ]
    1273         [ #  # ]:          0 :     if ( getOperation() != CopyTableOperation::AppendData )
    1274                 :            :     {
    1275         [ #  # ]:          0 :         Reference<XDataDescriptorFactory> xFact(xTables,UNO_QUERY);
    1276                 :            :         OSL_ENSURE(xFact.is(),"No XDataDescriptorFactory available!");
    1277         [ #  # ]:          0 :         if(!xFact.is())
    1278         [ #  # ]:          0 :             return NULL;
    1279                 :            : 
    1280 [ #  # ][ #  # ]:          0 :         xTable = xFact->createDataDescriptor();
                 [ #  # ]
    1281                 :            :         OSL_ENSURE(xTable.is(),"Could not create a new object!");
    1282         [ #  # ]:          0 :         if(!xTable.is())
    1283         [ #  # ]:          0 :             return NULL;
    1284                 :            : 
    1285                 :          0 :         ::rtl::OUString sCatalog,sSchema,sTable;
    1286 [ #  # ][ #  # ]:          0 :         Reference< XDatabaseMetaData> xMetaData = m_xDestConnection->getMetaData();
    1287                 :            :         ::dbtools::qualifiedNameComponents(xMetaData,
    1288                 :            :                                             m_sName,
    1289                 :            :                                             sCatalog,
    1290                 :            :                                             sSchema,
    1291                 :            :                                             sTable,
    1292         [ #  # ]:          0 :                                             ::dbtools::eInDataManipulation);
    1293                 :            : 
    1294 [ #  # ][ #  # ]:          0 :         if ( sCatalog.isEmpty() && xMetaData->supportsCatalogsInTableDefinitions() )
         [ #  # ][ #  # ]
                 [ #  # ]
    1295                 :            :         {
    1296 [ #  # ][ #  # ]:          0 :             sCatalog = m_xDestConnection->getCatalog();
    1297                 :            :         }
    1298                 :            : 
    1299 [ #  # ][ #  # ]:          0 :         if ( sSchema.isEmpty() && xMetaData->supportsSchemasInTableDefinitions() )
         [ #  # ][ #  # ]
                 [ #  # ]
    1300                 :            :         {
    1301 [ #  # ][ #  # ]:          0 :             sSchema = xMetaData->getUserName();
    1302                 :            :         }
    1303                 :            : 
    1304 [ #  # ][ #  # ]:          0 :         xTable->setPropertyValue(PROPERTY_CATALOGNAME,makeAny(sCatalog));
         [ #  # ][ #  # ]
    1305 [ #  # ][ #  # ]:          0 :         xTable->setPropertyValue(PROPERTY_SCHEMANAME,makeAny(sSchema));
         [ #  # ][ #  # ]
    1306 [ #  # ][ #  # ]:          0 :         xTable->setPropertyValue(PROPERTY_NAME,makeAny(sTable));
         [ #  # ][ #  # ]
    1307                 :            : 
    1308         [ #  # ]:          0 :         Reference< XColumnsSupplier > xSuppDestinationColumns( xTable, UNO_QUERY );
    1309                 :            :         // now append the columns
    1310                 :          0 :         const ODatabaseExport::TColumnVector* pVec = getDestVector();
    1311         [ #  # ]:          0 :         appendColumns( xSuppDestinationColumns, pVec );
    1312                 :            :         // now append the primary key
    1313         [ #  # ]:          0 :         Reference<XKeysSupplier> xKeySup(xTable,UNO_QUERY);
    1314         [ #  # ]:          0 :         appendKey(xKeySup,pVec);
    1315                 :            : 
    1316         [ #  # ]:          0 :         Reference<XAppend> xAppend(xTables,UNO_QUERY);
    1317         [ #  # ]:          0 :         if(xAppend.is())
    1318 [ #  # ][ #  # ]:          0 :             xAppend->appendByDescriptor(xTable);
    1319                 :            : 
    1320                 :            :         //  xTable = NULL;
    1321                 :            :         // we need to reget the table because after appending it it is no longer valid
    1322 [ #  # ][ #  # ]:          0 :         if(xTables->hasByName(m_sName))
                 [ #  # ]
    1323 [ #  # ][ #  # ]:          0 :             xTables->getByName(m_sName) >>= xTable;
                 [ #  # ]
    1324                 :            :         else
    1325                 :            :         {
    1326                 :            :             ::rtl::OUString sComposedName(
    1327 [ #  # ][ #  # ]:          0 :                 ::dbtools::composeTableName( m_xDestConnection->getMetaData(), xTable, ::dbtools::eInDataManipulation, false, false, false ) );
                 [ #  # ]
    1328 [ #  # ][ #  # ]:          0 :             if(xTables->hasByName(sComposedName))
                 [ #  # ]
    1329                 :            :             {
    1330 [ #  # ][ #  # ]:          0 :                 xTables->getByName(sComposedName) >>= xTable;
                 [ #  # ]
    1331                 :          0 :                 m_sName = sComposedName;
    1332                 :            :             }
    1333                 :            :             else
    1334         [ #  # ]:          0 :                 xTable = NULL;
    1335                 :            :         }
    1336         [ #  # ]:          0 :         if(xTable.is())
    1337                 :            :         {
    1338         [ #  # ]:          0 :             xSuppDestinationColumns.set( xTable, UNO_QUERY_THROW );
    1339                 :            :             // insert new table name into table filter
    1340 [ #  # ][ #  # ]:          0 :             ::dbaui::appendToFilter( m_xDestConnection, m_sName, GetFactory(), this );
    1341                 :            : 
    1342                 :            :             // copy ui settings
    1343         [ #  # ]:          0 :             m_rSourceObject.copyUISettingsTo( xTable );
    1344                 :            :             //copy filter and sorting
    1345         [ #  # ]:          0 :             m_rSourceObject.copyFilterAndSortingTo(m_xDestConnection,xTable);
    1346                 :            :             // set column mappings
    1347 [ #  # ][ #  # ]:          0 :             Reference<XNameAccess> xNameAccess = xSuppDestinationColumns->getColumns();
    1348 [ #  # ][ #  # ]:          0 :             Sequence< ::rtl::OUString> aSeq = xNameAccess->getElementNames();
    1349                 :          0 :             const ::rtl::OUString* pIter = aSeq.getConstArray();
    1350                 :          0 :             const ::rtl::OUString* pEnd   = pIter + aSeq.getLength();
    1351                 :            : 
    1352         [ #  # ]:          0 :             ::std::vector<int> aAlreadyFound(m_vColumnPos.size(),0);
    1353                 :            : 
    1354         [ #  # ]:          0 :             for(sal_Int32 nNewPos=1;pIter != pEnd;++pIter,++nNewPos)
    1355                 :            :             {
    1356         [ #  # ]:          0 :                 ODatabaseExport::TColumns::const_iterator aDestIter = m_vDestColumns.find(*pIter);
    1357                 :            : 
    1358         [ #  # ]:          0 :                 if ( aDestIter != m_vDestColumns.end() )
    1359                 :            :                 {
    1360 [ #  # ][ #  # ]:          0 :                     ODatabaseExport::TColumnVector::const_iterator aFind = ::std::find(m_aDestVec.begin(),m_aDestVec.end(),aDestIter);
    1361         [ #  # ]:          0 :                     sal_Int32 nPos = (aFind - m_aDestVec.begin())+1;
    1362                 :            : 
    1363                 :            :                     ODatabaseExport::TPositions::iterator aPosFind = ::std::find_if(
    1364                 :            :                         m_vColumnPos.begin(),
    1365                 :            :                         m_vColumnPos.end(),
    1366                 :          0 :                         ::o3tl::compose1(    ::std::bind2nd( ::std::equal_to< sal_Int32 >(), nPos ),
    1367                 :            :                                             ::o3tl::select1st< ODatabaseExport::TPositions::value_type >()
    1368                 :            :                         )
    1369 [ #  # ][ #  # ]:          0 :                     );
                 [ #  # ]
    1370                 :            : 
    1371 [ #  # ][ #  # ]:          0 :                     if ( m_vColumnPos.end() != aPosFind )
    1372                 :            :                     {
    1373         [ #  # ]:          0 :                         aPosFind->second = nNewPos;
    1374                 :            :                         OSL_ENSURE( m_vColumnTypes.size() > size_t( aPosFind - m_vColumnPos.begin() ),
    1375                 :            :                             "Invalid index for vector!" );
    1376 [ #  # ][ #  # ]:          0 :                         m_vColumnTypes[ aPosFind - m_vColumnPos.begin() ] = (*aFind)->second->GetType();
                 [ #  # ]
    1377                 :            :                     }
    1378                 :            :                 }
    1379         [ #  # ]:          0 :             }
    1380         [ #  # ]:          0 :         }
    1381                 :            :     }
    1382 [ #  # ][ #  # ]:          0 :     else if(xTables.is() && xTables->hasByName(m_sName))
         [ #  # ][ #  # ]
                 [ #  # ]
    1383 [ #  # ][ #  # ]:          0 :         xTables->getByName(m_sName) >>= xTable;
                 [ #  # ]
    1384                 :            : 
    1385                 :          0 :     return xTable;
    1386                 :            : }
    1387                 :            : 
    1388                 :            : // -----------------------------------------------------------------------------
    1389                 :          0 : bool OCopyTableWizard::supportsPrimaryKey( const Reference< XConnection >& _rxConnection )
    1390                 :            : {
    1391                 :            :     OSL_PRECOND( _rxConnection.is(), "OCopyTableWizard::supportsPrimaryKey: invalid connection!" );
    1392         [ #  # ]:          0 :     if ( !_rxConnection.is() )
    1393                 :          0 :         return false;
    1394                 :            : 
    1395         [ #  # ]:          0 :     ::dbtools::DatabaseMetaData aMetaData( _rxConnection );
    1396 [ #  # ][ #  # ]:          0 :     return aMetaData.supportsPrimaryKeys();
    1397                 :            : }
    1398                 :            : 
    1399                 :            : // -----------------------------------------------------------------------------
    1400                 :          0 : bool OCopyTableWizard::supportsViews( const Reference< XConnection >& _rxConnection )
    1401                 :            : {
    1402                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::supportsViews" );
    1403                 :            :     OSL_PRECOND( _rxConnection.is(), "OCopyTableWizard::supportsViews: invalid connection!" );
    1404         [ #  # ]:          0 :     if ( !_rxConnection.is() )
    1405                 :          0 :         return false;
    1406                 :            : 
    1407                 :          0 :     bool bSupportsViews( false );
    1408                 :            :     try
    1409                 :            :     {
    1410 [ #  # ][ #  # ]:          0 :         Reference< XDatabaseMetaData > xMetaData( _rxConnection->getMetaData(), UNO_SET_THROW );
                 [ #  # ]
    1411         [ #  # ]:          0 :         Reference< XViewsSupplier > xViewSups( _rxConnection, UNO_QUERY );
    1412                 :          0 :         bSupportsViews = xViewSups.is();
    1413         [ #  # ]:          0 :         if ( !bSupportsViews )
    1414                 :            :         {
    1415                 :            :             try
    1416                 :            :             {
    1417 [ #  # ][ #  # ]:          0 :                 Reference< XResultSet > xRs( xMetaData->getTableTypes(), UNO_SET_THROW );
                 [ #  # ]
    1418         [ #  # ]:          0 :                 Reference< XRow > xRow( xRs, UNO_QUERY_THROW );
    1419 [ #  # ][ #  # ]:          0 :                 while ( xRs->next() )
                 [ #  # ]
    1420                 :            :                 {
    1421 [ #  # ][ #  # ]:          0 :                     ::rtl::OUString sValue = xRow->getString( 1 );
    1422 [ #  # ][ #  # ]:          0 :                     if ( !xRow->wasNull() && sValue.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("View")) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1423                 :            :                     {
    1424                 :          0 :                         bSupportsViews = true;
    1425                 :            :                         break;
    1426                 :            :                     }
    1427 [ #  # ][ #  # ]:          0 :                 }
    1428                 :            :             }
    1429         [ #  # ]:          0 :             catch( const SQLException& )
    1430                 :            :             {
    1431                 :            :                 DBG_UNHANDLED_EXCEPTION();
    1432                 :            :             }
    1433         [ #  # ]:          0 :         }
    1434                 :            :     }
    1435                 :          0 :     catch( const Exception& )
    1436                 :            :     {
    1437                 :            :         DBG_UNHANDLED_EXCEPTION();
    1438                 :            :     }
    1439                 :          0 :     return bSupportsViews;
    1440                 :            : }
    1441                 :            : 
    1442                 :            : // -----------------------------------------------------------------------------
    1443                 :          0 : sal_Int32 OCopyTableWizard::getMaxColumnNameLength() const
    1444                 :            : {
    1445                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::getMaxColumnNameLength" );
    1446                 :          0 :     sal_Int32 nLen = 0;
    1447         [ #  # ]:          0 :     if ( m_xDestConnection.is() )
    1448                 :            :     {
    1449                 :            :         try
    1450                 :            :         {
    1451 [ #  # ][ #  # ]:          0 :             Reference< XDatabaseMetaData > xMetaData( m_xDestConnection->getMetaData(), UNO_SET_THROW );
                 [ #  # ]
    1452 [ #  # ][ #  # ]:          0 :             nLen = xMetaData->getMaxColumnNameLength();
                 [ #  # ]
    1453                 :            :         }
    1454                 :          0 :         catch(const Exception&)
    1455                 :            :         {
    1456                 :            :             DBG_UNHANDLED_EXCEPTION();
    1457                 :            :         }
    1458                 :            :     }
    1459                 :          0 :     return nLen;
    1460                 :            : }
    1461                 :            : // -----------------------------------------------------------------------------
    1462                 :          0 : void OCopyTableWizard::setOperation( const sal_Int16 _nOperation )
    1463                 :            : {
    1464                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::setOperation" );
    1465                 :          0 :     m_nOperation = _nOperation;
    1466                 :          0 : }
    1467                 :            : // -----------------------------------------------------------------------------
    1468                 :          0 : sal_Int16 OCopyTableWizard::getOperation() const
    1469                 :            : {
    1470                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::getOperation" );
    1471                 :          0 :     return m_nOperation;
    1472                 :            : }
    1473                 :            : // -----------------------------------------------------------------------------
    1474                 :          0 : ::rtl::OUString OCopyTableWizard::convertColumnName(const TColumnFindFunctor&   _rCmpFunctor,
    1475                 :            :                                                     const ::rtl::OUString&  _sColumnName,
    1476                 :            :                                                     const ::rtl::OUString&  _sExtraChars,
    1477                 :            :                                                     sal_Int32               _nMaxNameLen)
    1478                 :            : {
    1479                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::convertColumnName" );
    1480                 :          0 :     ::rtl::OUString sAlias = _sColumnName;
    1481 [ #  # ][ #  # ]:          0 :     if ( isSQL92CheckEnabled( m_xDestConnection ) )
    1482         [ #  # ]:          0 :         sAlias = ::dbtools::convertName2SQLName(_sColumnName,_sExtraChars);
    1483 [ #  # ][ #  # ]:          0 :     if((_nMaxNameLen && sAlias.getLength() > _nMaxNameLen) || _rCmpFunctor(sAlias))
         [ #  # ][ #  # ]
                 [ #  # ]
    1484                 :            :     {
    1485                 :          0 :         sal_Int32 nDiff = 1;
    1486         [ #  # ]:          0 :         do
           [ #  #  #  # ]
    1487                 :            :         {
    1488                 :          0 :             ++nDiff;
    1489 [ #  # ][ #  # ]:          0 :             if(_nMaxNameLen && sAlias.getLength() >= _nMaxNameLen)
                 [ #  # ]
    1490                 :          0 :                 sAlias = sAlias.copy(0,sAlias.getLength() - (sAlias.getLength()-_nMaxNameLen+nDiff));
    1491                 :            : 
    1492                 :          0 :             ::rtl::OUString sName(sAlias);
    1493                 :          0 :             sal_Int32 nPos = 1;
    1494                 :          0 :             sName += ::rtl::OUString::valueOf(nPos);
    1495                 :            : 
    1496 [ #  # ][ #  # ]:          0 :             while(_rCmpFunctor(sName))
    1497                 :            :             {
    1498                 :          0 :                 sName = sAlias;
    1499                 :          0 :                 sName += ::rtl::OUString::valueOf(++nPos);
    1500                 :            :             }
    1501                 :          0 :             sAlias = sName;
    1502                 :            :             // we have to check again, it could happen that the name is already to long
    1503                 :            :         }
    1504                 :          0 :         while(_nMaxNameLen && sAlias.getLength() > _nMaxNameLen);
    1505                 :            :     }
    1506                 :            :     OSL_ENSURE(m_mNameMapping.find(_sColumnName) == m_mNameMapping.end(),"name doubled!");
    1507         [ #  # ]:          0 :     m_mNameMapping[_sColumnName] = sAlias;
    1508                 :          0 :     return sAlias;
    1509                 :            : }
    1510                 :            : 
    1511                 :            : // -----------------------------------------------------------------------------
    1512                 :          0 : void OCopyTableWizard::removeColumnNameFromNameMap(const ::rtl::OUString& _sName)
    1513                 :            : {
    1514                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::removeColumnNameFromNameMap" );
    1515                 :          0 :     m_mNameMapping.erase(_sName);
    1516                 :          0 : }
    1517                 :            : 
    1518                 :            : // -----------------------------------------------------------------------------
    1519                 :          0 : sal_Bool OCopyTableWizard::supportsType(sal_Int32 _nDataType,sal_Int32& _rNewDataType)
    1520                 :            : {
    1521                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::supportsType" );
    1522         [ #  # ]:          0 :     sal_Bool bRet = m_aDestTypeInfo.find(_nDataType) != m_aDestTypeInfo.end();
    1523         [ #  # ]:          0 :     if ( bRet )
    1524                 :          0 :         _rNewDataType = _nDataType;
    1525                 :          0 :     return bRet;
    1526                 :            : }
    1527                 :            : 
    1528                 :            : // -----------------------------------------------------------------------------
    1529                 :          0 : TOTypeInfoSP OCopyTableWizard::convertType(const TOTypeInfoSP& _pType,sal_Bool& _bNotConvert)
    1530                 :            : {
    1531                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::convertType" );
    1532         [ #  # ]:          0 :     if ( !m_bInterConnectionCopy )
    1533                 :            :         // no need to convert if the source and destination connection are the same
    1534         [ #  # ]:          0 :         return _pType;
    1535                 :            : 
    1536                 :            :     sal_Bool bForce;
    1537         [ #  # ]:          0 :     TOTypeInfoSP pType = ::dbaui::getTypeInfoFromType(m_aDestTypeInfo,_pType->nType,_pType->aTypeName,_pType->aCreateParams,_pType->nPrecision,_pType->nMaximumScale,_pType->bAutoIncrement,bForce);
    1538 [ #  # ][ #  # ]:          0 :     if ( !pType.get() || bForce )
                 [ #  # ]
    1539                 :            :     { // no type found so we have to find the correct one ourself
    1540                 :          0 :         sal_Int32 nDefaultType = DataType::VARCHAR;
    1541   [ #  #  #  #  :          0 :         switch(_pType->nType)
          #  #  #  #  #  
          #  #  #  #  #  
                      # ]
    1542                 :            :         {
    1543                 :            :             case DataType::TINYINT:
    1544 [ #  # ][ #  # ]:          0 :                 if(supportsType(DataType::SMALLINT,nDefaultType))
    1545                 :          0 :                     break;
    1546                 :            :                 // run through
    1547                 :            :             case DataType::SMALLINT:
    1548 [ #  # ][ #  # ]:          0 :                 if(supportsType(DataType::INTEGER,nDefaultType))
    1549                 :          0 :                     break;
    1550                 :            :                 // run through
    1551                 :            :             case DataType::INTEGER:
    1552 [ #  # ][ #  # ]:          0 :                 if(supportsType(DataType::FLOAT,nDefaultType))
    1553                 :          0 :                     break;
    1554                 :            :                 // run through
    1555                 :            :             case DataType::FLOAT:
    1556 [ #  # ][ #  # ]:          0 :                 if(supportsType(DataType::REAL,nDefaultType))
    1557                 :          0 :                     break;
    1558                 :            :                 // run through
    1559                 :            :             case DataType::DATE:
    1560                 :            :             case DataType::TIME:
    1561 [ #  # ][ #  # ]:          0 :                 if( DataType::DATE == _pType->nType || DataType::TIME == _pType->nType )
                 [ #  # ]
    1562                 :            :                 {
    1563 [ #  # ][ #  # ]:          0 :                     if(supportsType(DataType::TIMESTAMP,nDefaultType))
    1564                 :          0 :                         break;
    1565                 :            :                 }
    1566                 :            :                 // run through
    1567                 :            :             case DataType::TIMESTAMP:
    1568                 :            :             case DataType::REAL:
    1569                 :            :             case DataType::BIGINT:
    1570 [ #  # ][ #  # ]:          0 :                 if ( supportsType(DataType::DOUBLE,nDefaultType) )
    1571                 :          0 :                     break;
    1572                 :            :                 // run through
    1573                 :            :             case DataType::DOUBLE:
    1574 [ #  # ][ #  # ]:          0 :                 if ( supportsType(DataType::NUMERIC,nDefaultType) )
    1575                 :          0 :                     break;
    1576                 :            :                 // run through
    1577                 :            :             case DataType::NUMERIC:
    1578         [ #  # ]:          0 :                 supportsType(DataType::DECIMAL,nDefaultType);
    1579                 :          0 :                 break;
    1580                 :            :             case DataType::DECIMAL:
    1581 [ #  # ][ #  # ]:          0 :                 if ( supportsType(DataType::NUMERIC,nDefaultType) )
    1582                 :          0 :                     break;
    1583 [ #  # ][ #  # ]:          0 :                 if ( supportsType(DataType::DOUBLE,nDefaultType) )
    1584                 :          0 :                     break;
    1585                 :          0 :                 break;
    1586                 :            :             case DataType::VARCHAR:
    1587 [ #  # ][ #  # ]:          0 :                 if ( supportsType(DataType::LONGVARCHAR,nDefaultType) )
    1588                 :          0 :                     break;
    1589                 :          0 :                 break;
    1590                 :            :             case DataType::LONGVARCHAR:
    1591 [ #  # ][ #  # ]:          0 :                 if ( supportsType(DataType::CLOB,nDefaultType) )
    1592                 :          0 :                     break;
    1593                 :          0 :                 break;
    1594                 :            :             case DataType::BINARY:
    1595 [ #  # ][ #  # ]:          0 :                 if ( supportsType(DataType::VARBINARY,nDefaultType) )
    1596                 :          0 :                     break;
    1597                 :          0 :                 break;
    1598                 :            :             case DataType::VARBINARY:
    1599 [ #  # ][ #  # ]:          0 :                 if ( supportsType(DataType::LONGVARBINARY,nDefaultType) )
    1600                 :          0 :                     break;
    1601                 :          0 :                 break;
    1602                 :            :             case DataType::LONGVARBINARY:
    1603 [ #  # ][ #  # ]:          0 :                 if ( supportsType(DataType::BLOB,nDefaultType) )
    1604                 :          0 :                     break;
    1605 [ #  # ][ #  # ]:          0 :                 if ( supportsType(DataType::LONGVARCHAR,nDefaultType) )
    1606                 :          0 :                     break;
    1607 [ #  # ][ #  # ]:          0 :                 if ( supportsType(DataType::CLOB,nDefaultType) )
    1608                 :          0 :                     break;
    1609                 :          0 :                 break;
    1610                 :            :             default:
    1611                 :          0 :                 nDefaultType = DataType::VARCHAR;
    1612                 :            :         }
    1613 [ #  # ][ #  # ]:          0 :         pType = ::dbaui::getTypeInfoFromType(m_aDestTypeInfo,nDefaultType,_pType->aTypeName,_pType->aCreateParams,_pType->nPrecision,_pType->nMaximumScale,_pType->bAutoIncrement,bForce);
                 [ #  # ]
    1614         [ #  # ]:          0 :         if ( !pType.get() )
    1615                 :            :         {
    1616                 :          0 :             _bNotConvert = sal_False;
    1617         [ #  # ]:          0 :             ::rtl::OUString sCreate(RTL_CONSTASCII_USTRINGPARAM("x"));
    1618 [ #  # ][ #  # ]:          0 :             pType = ::dbaui::getTypeInfoFromType(m_aDestTypeInfo,DataType::VARCHAR,_pType->aTypeName,sCreate,50,0,sal_False,bForce);
                 [ #  # ]
    1619         [ #  # ]:          0 :             if ( !pType.get() )
    1620         [ #  # ]:          0 :                 pType = m_pTypeInfo;
    1621                 :            :         }
    1622         [ #  # ]:          0 :         else if ( bForce )
    1623                 :          0 :             _bNotConvert = sal_False;
    1624                 :            :     }
    1625 [ #  # ][ #  # ]:          0 :     return pType;
    1626                 :            : }
    1627                 :            : // -----------------------------------------------------------------------------
    1628                 :          0 : ::rtl::OUString OCopyTableWizard::createUniqueName(const ::rtl::OUString& _sName)
    1629                 :            : {
    1630                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::createUniqueName" );
    1631                 :          0 :     ::rtl::OUString sName = _sName;
    1632         [ #  # ]:          0 :     Sequence< ::rtl::OUString > aColumnNames( m_rSourceObject.getColumnNames() );
    1633         [ #  # ]:          0 :     if ( aColumnNames.getLength() )
    1634         [ #  # ]:          0 :         sName = ::dbtools::createUniqueName( aColumnNames, sName, sal_False );
    1635                 :            :     else
    1636                 :            :     {
    1637 [ #  # ][ #  # ]:          0 :         if ( m_vSourceColumns.find(sName) != m_vSourceColumns.end())
    1638                 :            :         {
    1639                 :          0 :             sal_Int32 nPos = 0;
    1640 [ #  # ][ #  # ]:          0 :             while(m_vSourceColumns.find(sName) != m_vSourceColumns.end())
    1641                 :            :             {
    1642                 :          0 :                 sName = _sName;
    1643                 :          0 :                 sName += ::rtl::OUString::valueOf(++nPos);
    1644                 :            :             }
    1645                 :            :         }
    1646                 :            :     }
    1647         [ #  # ]:          0 :     return sName;
    1648                 :            : }
    1649                 :            : // -----------------------------------------------------------------------------
    1650                 :          0 : void OCopyTableWizard::showColumnTypeNotSupported(const ::rtl::OUString& _rColumnName)
    1651                 :            : {
    1652                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::showColumnTypeNotSupported" );
    1653 [ #  # ][ #  # ]:          0 :     String sMessage( ModuleRes( STR_UNKNOWN_TYPE_FOUND ) );
    1654 [ #  # ][ #  # ]:          0 :     sMessage.SearchAndReplaceAscii("#1",_rColumnName);
                 [ #  # ]
    1655 [ #  # ][ #  # ]:          0 :     showError(sMessage);
                 [ #  # ]
    1656                 :          0 : }
    1657                 :            : //-------------------------------------------------------------------------------
    1658                 :          0 : void OCopyTableWizard::showError(const ::rtl::OUString& _sErrorMesage)
    1659                 :            : {
    1660         [ #  # ]:          0 :     SQLExceptionInfo aInfo(_sErrorMesage);
    1661 [ #  # ][ #  # ]:          0 :     showError(aInfo.get());
    1662                 :          0 : }
    1663                 :            : //-------------------------------------------------------------------------------
    1664                 :          0 : void OCopyTableWizard::showError(const Any& _aError)
    1665                 :            : {
    1666 [ #  # ][ #  # ]:          0 :     if ( _aError.hasValue() && m_xInteractionHandler.is() )
                 [ #  # ]
    1667                 :            :     {
    1668                 :            :         try
    1669                 :            :         {
    1670         [ #  # ]:          0 :             ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( _aError ) );
    1671 [ #  # ][ #  # ]:          0 :             m_xInteractionHandler->handle( xRequest.get() );
         [ #  # ][ #  # ]
                 [ #  # ]
    1672                 :            :         }
    1673                 :          0 :         catch( const Exception& )
    1674                 :            :         {
    1675                 :            :             DBG_UNHANDLED_EXCEPTION();
    1676                 :            :         }
    1677                 :            :     }
    1678                 :          0 : }
    1679                 :            : 
    1680                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10