LCOV - code coverage report
Current view: top level - dbaccess/source/ui/app - AppControllerDnD.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 346 0.0 %
Date: 2012-08-25 Functions: 0 16 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 925 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 "AppController.hxx"
      22                 :            : #include <comphelper/sequence.hxx>
      23                 :            : #include <comphelper/property.hxx>
      24                 :            : #include "dbustrings.hrc"
      25                 :            : #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
      26                 :            : #include <com/sun/star/sdbcx/XAppend.hpp>
      27                 :            : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
      28                 :            : #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
      29                 :            : #include <com/sun/star/container/XNameContainer.hpp>
      30                 :            : #include <com/sun/star/uno/XNamingService.hpp>
      31                 :            : #include <com/sun/star/sdbc/XDataSource.hpp>
      32                 :            : #include <com/sun/star/frame/XStorable.hpp>
      33                 :            : #include <com/sun/star/container/XChild.hpp>
      34                 :            : #include <com/sun/star/container/XHierarchicalNameContainer.hpp>
      35                 :            : #include <com/sun/star/sdbc/DataType.hpp>
      36                 :            : #include <com/sun/star/sdb/CommandType.hpp>
      37                 :            : #include <com/sun/star/sdb/XBookmarksSupplier.hpp>
      38                 :            : #include <com/sun/star/sdb/SQLContext.hpp>
      39                 :            : #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
      40                 :            : #include <com/sun/star/sdbcx/XViewsSupplier.hpp>
      41                 :            : #include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp>
      42                 :            : #include <com/sun/star/sdbcx/XDrop.hpp>
      43                 :            : #include <unotools/ucbhelper.hxx>
      44                 :            : #include "dlgsave.hxx"
      45                 :            : #include <comphelper/types.hxx>
      46                 :            : #include <vcl/msgbox.hxx>
      47                 :            : #include <cppuhelper/typeprovider.hxx>
      48                 :            : #include <cppuhelper/exc_hlp.hxx>
      49                 :            : #include <connectivity/dbexception.hxx>
      50                 :            : #include <vcl/waitobj.hxx>
      51                 :            : #include <rtl/ustrbuf.hxx>
      52                 :            : #include "AppView.hxx"
      53                 :            : #include <svx/dataaccessdescriptor.hxx>
      54                 :            : #include <svx/dbaobjectex.hxx>
      55                 :            : #include "browserids.hxx"
      56                 :            : #include "dbu_reghelper.hxx"
      57                 :            : #include "dbu_app.hrc"
      58                 :            : #include <vcl/menu.hxx>
      59                 :            : #include <comphelper/uno3.hxx>
      60                 :            : #include <vcl/svapp.hxx>
      61                 :            : #include <svtools/svlbitm.hxx>
      62                 :            : #include "listviewitems.hxx"
      63                 :            : #include "AppDetailView.hxx"
      64                 :            : #include "linkeddocuments.hxx"
      65                 :            : #include <vcl/lstbox.hxx>
      66                 :            : #include <connectivity/dbtools.hxx>
      67                 :            : #include "sqlmessage.hxx"
      68                 :            : #include <tools/string.hxx>
      69                 :            : #include "dbexchange.hxx"
      70                 :            : #include "UITools.hxx"
      71                 :            : #include <algorithm>
      72                 :            : #include <svtools/svtreebx.hxx>
      73                 :            : #include <com/sun/star/sdb/XReportDocumentsSupplier.hpp>
      74                 :            : #include <com/sun/star/sdb/XFormDocumentsSupplier.hpp>
      75                 :            : #include <unotools/pathoptions.hxx>
      76                 :            : #include <sfx2/docfilt.hxx>
      77                 :            : #include <svtools/fileview.hxx>
      78                 :            : #include <tools/diagnose_ex.h>
      79                 :            : #include <osl/diagnose.h>
      80                 :            : #include "defaultobjectnamecheck.hxx"
      81                 :            : #include <osl/mutex.hxx>
      82                 :            : #include "subcomponentmanager.hxx"
      83                 :            : 
      84                 :            : //........................................................................
      85                 :            : namespace dbaui
      86                 :            : {
      87                 :            : //........................................................................
      88                 :            : using namespace ::dbtools;
      89                 :            : using namespace ::svx;
      90                 :            : using namespace ::svtools;
      91                 :            : using namespace ::com::sun::star::uno;
      92                 :            : using namespace ::com::sun::star::task;
      93                 :            : using namespace ::com::sun::star::beans;
      94                 :            : using namespace ::com::sun::star::lang;
      95                 :            : using namespace ::com::sun::star::container;
      96                 :            : using namespace ::com::sun::star::sdb;
      97                 :            : using namespace ::com::sun::star::sdbc;
      98                 :            : using namespace ::com::sun::star::sdbcx;
      99                 :            : using namespace ::com::sun::star::frame;
     100                 :            : using namespace ::com::sun::star::ucb;
     101                 :            : using namespace ::com::sun::star::util;
     102                 :            : 
     103                 :            : // -----------------------------------------------------------------------------
     104                 :          0 : void OApplicationController::deleteTables(const ::std::vector< ::rtl::OUString>& _rList)
     105                 :            : {
     106 [ #  # ][ #  # ]:          0 :     SharedConnection xConnection( ensureConnection() );
     107                 :            : 
     108         [ #  # ]:          0 :     Reference<XTablesSupplier> xSup(xConnection,UNO_QUERY);
     109                 :            :     OSL_ENSURE(xSup.is(),"OApplicationController::deleteTable: no XTablesSuppier!");
     110         [ #  # ]:          0 :     if ( xSup.is() )
     111                 :            :     {
     112 [ #  # ][ #  # ]:          0 :         Reference<XNameAccess> xTables = xSup->getTables();
     113         [ #  # ]:          0 :         Reference<XDrop> xDrop(xTables,UNO_QUERY);
     114         [ #  # ]:          0 :         if ( xDrop.is() )
     115                 :            :         {
     116                 :          0 :             bool bConfirm = true;
     117                 :          0 :             ::std::vector< ::rtl::OUString>::const_iterator aEnd = _rList.end();
     118 [ #  # ][ #  # ]:          0 :             for (::std::vector< ::rtl::OUString>::const_iterator aIter = _rList.begin(); aIter != aEnd; ++aIter)
     119                 :            :             {
     120                 :          0 :                 ::rtl::OUString sTableName = *aIter;
     121                 :            : 
     122                 :          0 :                 sal_Int32 nResult = RET_YES;
     123         [ #  # ]:          0 :                 if ( bConfirm )
     124 [ #  # ][ #  # ]:          0 :                     nResult = ::dbaui::askForUserAction(getView(),STR_TITLE_CONFIRM_DELETION ,STR_QUERY_DELETE_TABLE,_rList.size() > 1 && (aIter+1) != _rList.end(),sTableName);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
     125                 :            : 
     126                 :            :                 bool bUserConfirmedDelete =
     127                 :            :                             ( RET_YES == nResult )
     128 [ #  # ][ #  # ]:          0 :                         ||  ( RET_ALL == nResult );
     129 [ #  # ][ #  # ]:          0 :                 if ( bUserConfirmedDelete && m_pSubComponentManager->closeSubFrames( sTableName, E_TABLE ) )
         [ #  # ][ #  # ]
     130                 :            :                 {
     131         [ #  # ]:          0 :                     SQLExceptionInfo aErrorInfo;
     132                 :            :                     try
     133                 :            :                     {
     134 [ #  # ][ #  # ]:          0 :                         if ( xTables->hasByName(sTableName) )
                 [ #  # ]
     135 [ #  # ][ #  # ]:          0 :                             xDrop->dropByName(sTableName);
     136                 :            :                         else
     137                 :            :                         {// could be a view
     138         [ #  # ]:          0 :                             Reference<XViewsSupplier> xViewsSup(xConnection,UNO_QUERY);
     139                 :            : 
     140                 :          0 :                             Reference<XNameAccess> xViews;
     141         [ #  # ]:          0 :                             if ( xViewsSup.is() )
     142                 :            :                             {
     143 [ #  # ][ #  # ]:          0 :                                 xViews = xViewsSup->getViews();
                 [ #  # ]
     144 [ #  # ][ #  # ]:          0 :                                 if ( xViews.is() && xViews->hasByName(sTableName) )
         [ #  # ][ #  # ]
                 [ #  # ]
     145                 :            :                                 {
     146         [ #  # ]:          0 :                                     xDrop.set(xViews,UNO_QUERY);
     147         [ #  # ]:          0 :                                     if ( xDrop.is() )
     148 [ #  # ][ #  # ]:          0 :                                         xDrop->dropByName(sTableName);
     149                 :            :                                 }
     150                 :          0 :                             }
     151                 :            :                         }
     152                 :            :                     }
     153   [ #  #  #  # ]:          0 :                     catch(SQLContext& e) { aErrorInfo = e; }
     154   [ #  #  #  # ]:          0 :                     catch(SQLWarning& e) { aErrorInfo = e; }
     155   [ #  #  #  # ]:          0 :                     catch(SQLException& e) { aErrorInfo = e; }
     156   [ #  #  #  #  :          0 :                     catch(WrappedTargetException& e)
             #  #  #  # ]
     157                 :            :                     {
     158         [ #  # ]:          0 :                         SQLException aSql;
     159   [ #  #  #  # ]:          0 :                         if(e.TargetException >>= aSql)
     160         [ #  # ]:          0 :                             aErrorInfo = aSql;
     161                 :            :                         else
     162         [ #  # ]:          0 :                             OSL_FAIL("OApplicationController::implDropTable: something strange happended!");
     163                 :            :                     }
     164         [ #  # ]:          0 :                     catch( const Exception& )
     165                 :            :                     {
     166                 :            :                         DBG_UNHANDLED_EXCEPTION();
     167                 :            :                     }
     168                 :            : 
     169         [ #  # ]:          0 :                     if ( aErrorInfo.isValid() )
     170         [ #  # ]:          0 :                         showError(aErrorInfo);
     171                 :            : 
     172         [ #  # ]:          0 :                     if ( RET_ALL == nResult )
     173         [ #  # ]:          0 :                         bConfirm = false;
     174                 :            :                 }
     175                 :            :                 else
     176                 :            :                     break;
     177         [ #  # ]:          0 :             }
     178                 :            :         }
     179                 :            :         else
     180                 :            :         {
     181 [ #  # ][ #  # ]:          0 :             String sMessage(ModuleRes(STR_MISSING_TABLES_XDROP));
     182         [ #  # ]:          0 :             ErrorBox aError(getView(), WB_OK, sMessage);
     183 [ #  # ][ #  # ]:          0 :             aError.Execute();
                 [ #  # ]
     184                 :          0 :         }
     185         [ #  # ]:          0 :     }
     186                 :          0 : }
     187                 :            : // -----------------------------------------------------------------------------
     188                 :          0 : void OApplicationController::deleteObjects( ElementType _eType, const ::std::vector< ::rtl::OUString>& _rList, bool _bConfirm )
     189                 :            : {
     190 [ #  # ][ #  # ]:          0 :     Reference< XNameContainer > xNames( getElements( _eType ), UNO_QUERY );
     191         [ #  # ]:          0 :     Reference< XHierarchicalNameContainer > xHierarchyName( xNames, UNO_QUERY );
     192         [ #  # ]:          0 :     if ( xNames.is() )
     193                 :            :     {
     194                 :          0 :         rtl::OString sDialogPosition;
     195         [ #  # ]:          0 :         svtools::QueryDeleteResult_Impl eResult = _bConfirm ? svtools::QUERYDELETE_YES : svtools::QUERYDELETE_ALL;
     196                 :            : 
     197                 :            :         // The list of elements to delete is allowed to contain related elements: A given element may
     198                 :            :         // be the ancestor or child of another element from the list.
     199                 :            :         // We want to ensure that ancestors get deleted first, so we normalize the list in this respect.
     200                 :            :         // #i33353#
     201         [ #  # ]:          0 :         ::std::set< ::rtl::OUString > aDeleteNames;
     202                 :            :             // Note that this implicitly uses ::std::less< ::rtl::OUString > a comparison operation, which
     203                 :            :             // results in lexicographical order, which is exactly what we need, because "foo" is *before*
     204                 :            :             // any "foo/bar" in this order.
     205                 :            :         ::std::copy(
     206                 :            :             _rList.begin(), _rList.end(),
     207                 :            :             ::std::insert_iterator< ::std::set< ::rtl::OUString > >( aDeleteNames, aDeleteNames.begin() )
     208         [ #  # ]:          0 :         );
     209                 :            : 
     210                 :          0 :         ::std::set< ::rtl::OUString >::size_type nCount = aDeleteNames.size();
     211         [ #  # ]:          0 :         for ( ::std::set< ::rtl::OUString >::size_type nObjectsLeft = nCount; !aDeleteNames.empty(); )
     212                 :            :         {
     213                 :          0 :             ::std::set< ::rtl::OUString >::iterator  aThisRound = aDeleteNames.begin();
     214                 :            : 
     215         [ #  # ]:          0 :             if ( eResult != svtools::QUERYDELETE_ALL )
     216                 :            :             {
     217 [ #  # ][ #  # ]:          0 :                 svtools::QueryDeleteDlg_Impl aDlg( getView(), *aThisRound );
                 [ #  # ]
     218                 :            : 
     219         [ #  # ]:          0 :                 if ( !sDialogPosition.isEmpty() )
     220         [ #  # ]:          0 :                     aDlg.SetWindowState( sDialogPosition );
     221                 :            : 
     222         [ #  # ]:          0 :                 if ( nObjectsLeft > 1 )
     223         [ #  # ]:          0 :                     aDlg.EnableAllButton();
     224                 :            : 
     225 [ #  # ][ #  # ]:          0 :                 if ( aDlg.Execute() == RET_OK )
     226                 :          0 :                     eResult = aDlg.GetResult();
     227                 :            :                 else
     228                 :          0 :                     return;
     229                 :            : 
     230 [ #  # ][ #  # ]:          0 :                 sDialogPosition = aDlg.GetWindowState( );
                 [ #  # ]
     231                 :            :             }
     232                 :            : 
     233                 :          0 :             bool bSuccess = false;
     234                 :            : 
     235                 :            :             bool bUserConfirmedDelete =
     236                 :            :                         ( eResult == svtools::QUERYDELETE_ALL )
     237 [ #  # ][ #  # ]:          0 :                     ||  ( eResult == svtools::QUERYDELETE_YES );
     238                 :            : 
     239 [ #  # ][ #  # ]:          0 :             if  (   bUserConfirmedDelete
         [ #  # ][ #  # ]
     240         [ #  # ]:          0 :                 &&  (   ( _eType == E_QUERY ) ? m_pSubComponentManager->closeSubFrames( *aThisRound, _eType ) : true )
     241                 :            :                 )
     242                 :            :             {
     243                 :            :                 try
     244                 :            :                 {
     245         [ #  # ]:          0 :                     if ( xHierarchyName.is() )
     246 [ #  # ][ #  # ]:          0 :                         xHierarchyName->removeByHierarchicalName( *aThisRound );
     247                 :            :                     else
     248 [ #  # ][ #  # ]:          0 :                         xNames->removeByName( *aThisRound );
     249                 :            : 
     250                 :          0 :                     bSuccess = true;
     251                 :            : 
     252                 :            :                     // now that we removed the element, care for all it's child elements
     253                 :            :                     // which may also be a part of the list
     254                 :            :                     // #i33353#
     255                 :            :                     OSL_ENSURE( aThisRound->getLength() - 1 >= 0, "OApplicationController::deleteObjects: empty name?" );
     256         [ #  # ]:          0 :                     ::rtl::OUStringBuffer sSmallestSiblingName( *aThisRound );
     257         [ #  # ]:          0 :                     sSmallestSiblingName.append( (sal_Unicode)( '/' + 1) );
     258                 :            : 
     259 [ #  # ][ #  # ]:          0 :                     ::std::set< ::rtl::OUString >::iterator aUpperChildrenBound = aDeleteNames.lower_bound( sSmallestSiblingName.makeStringAndClear() );
     260         [ #  # ]:          0 :                     for ( ::std::set< ::rtl::OUString >::iterator aObsolete = aThisRound;
     261                 :            :                           aObsolete != aUpperChildrenBound;
     262                 :            :                         )
     263                 :            :                     {
     264                 :            : #if OSL_DEBUG_LEVEL > 0
     265                 :            :                         ::rtl::OUString sObsoleteName = *aObsolete;
     266                 :            : #endif
     267                 :          0 :                         ::std::set< ::rtl::OUString >::iterator aNextObsolete = aObsolete; ++aNextObsolete;
     268         [ #  # ]:          0 :                         aDeleteNames.erase( aObsolete );
     269                 :          0 :                         --nObjectsLeft;
     270                 :          0 :                         aObsolete = aNextObsolete;
     271                 :          0 :                     }
     272                 :            :                 }
     273         [ #  # ]:          0 :                 catch(const SQLException&)
     274                 :            :                 {
     275   [ #  #  #  #  :          0 :                     showError( SQLExceptionInfo( ::cppu::getCaughtException() ) );
             #  #  #  # ]
     276                 :            :                 }
     277   [ #  #  #  #  :          0 :                 catch(const WrappedTargetException& e)
                   #  # ]
     278                 :            :                 {
     279         [ #  # ]:          0 :                     SQLException aSql;
     280   [ #  #  #  # ]:          0 :                     if ( e.TargetException >>= aSql )
     281   [ #  #  #  #  :          0 :                         showError( SQLExceptionInfo( e.TargetException ) );
                   #  # ]
     282                 :            :                     else
     283         [ #  # ]:          0 :                         OSL_FAIL( "OApplicationController::deleteObjects: something strange happended!" );
     284                 :            :                 }
     285         [ #  # ]:          0 :                 catch( const Exception& )
     286                 :            :                 {
     287                 :            :                     DBG_UNHANDLED_EXCEPTION();
     288                 :            :                 }
     289                 :            :             }
     290                 :            : 
     291         [ #  # ]:          0 :             if ( !bSuccess )
     292                 :            :             {
     293                 :            :                 // okay, this object could not be deleted (or the user did not want to delete it),
     294                 :            :                 // but continue with the rest
     295         [ #  # ]:          0 :                 aDeleteNames.erase( aThisRound );
     296                 :          0 :                 --nObjectsLeft;
     297                 :            :             }
     298 [ #  # ][ #  # ]:          0 :         }
     299 [ #  # ][ #  # ]:          0 :     }
     300                 :            : }
     301                 :            : // -----------------------------------------------------------------------------
     302                 :          0 : void OApplicationController::deleteEntries()
     303                 :            : {
     304         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     305 [ #  # ][ #  # ]:          0 :     ::osl::MutexGuard aGuard( getMutex() );
     306                 :            : 
     307 [ #  # ][ #  # ]:          0 :     if ( getContainer() )
     308                 :            :     {
     309         [ #  # ]:          0 :         ::std::vector< ::rtl::OUString> aList;
     310         [ #  # ]:          0 :         getSelectionElementNames(aList);
     311 [ #  # ][ #  # ]:          0 :         ElementType eType = getContainer()->getElementType();
     312   [ #  #  #  #  :          0 :         switch(eType)
                   #  # ]
     313                 :            :         {
     314                 :            :         case E_TABLE:
     315         [ #  # ]:          0 :             deleteTables(aList);
     316                 :          0 :             break;
     317                 :            :         case E_QUERY:
     318         [ #  # ]:          0 :             deleteObjects( E_QUERY, aList, true );
     319                 :          0 :             break;
     320                 :            :         case E_FORM:
     321         [ #  # ]:          0 :             deleteObjects( E_FORM, aList, true );
     322                 :          0 :             break;
     323                 :            :         case E_REPORT:
     324         [ #  # ]:          0 :             deleteObjects( E_REPORT, aList, true );
     325                 :          0 :             break;
     326                 :            :         case E_NONE:
     327                 :          0 :             break;
     328                 :          0 :         }
     329 [ #  # ][ #  # ]:          0 :     }
     330                 :          0 : }
     331                 :            : // -----------------------------------------------------------------------------
     332                 :          0 : const SharedConnection& OApplicationController::ensureConnection( ::dbtools::SQLExceptionInfo* _pErrorInfo )
     333                 :            : {
     334         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     335 [ #  # ][ #  # ]:          0 :     ::osl::MutexGuard aGuard( getMutex() );
     336                 :            : 
     337         [ #  # ]:          0 :     if ( !m_xDataSourceConnection.is() )
     338                 :            :     {
     339         [ #  # ]:          0 :         WaitObject aWO(getView());
     340 [ #  # ][ #  # ]:          0 :         String sConnectingContext( ModuleRes( STR_COULDNOTCONNECT_DATASOURCE ) );
     341 [ #  # ][ #  # ]:          0 :         sConnectingContext.SearchAndReplaceAscii("$name$", getStrippedDatabaseName());
         [ #  # ][ #  # ]
     342                 :            : 
     343 [ #  # ][ #  # ]:          0 :         m_xDataSourceConnection.reset( connect( getDatabaseName(), sConnectingContext, _pErrorInfo ) );
         [ #  # ][ #  # ]
     344         [ #  # ]:          0 :         if ( m_xDataSourceConnection.is() )
     345                 :            :         {
     346         [ #  # ]:          0 :             SQLExceptionInfo aError;
     347                 :            :             try
     348                 :            :             {
     349 [ #  # ][ #  # ]:          0 :                 m_xMetaData = m_xDataSourceConnection->getMetaData();
                 [ #  # ]
     350                 :            :             }
     351   [ #  #  #  #  :          0 :             catch( const SQLException& )
                      # ]
     352                 :            :             {
     353   [ #  #  #  # ]:          0 :                 aError = ::cppu::getCaughtException();
     354                 :            :             }
     355         [ #  # ]:          0 :             catch( const Exception& )
     356                 :            :             {
     357                 :            :                 DBG_UNHANDLED_EXCEPTION();
     358                 :            :             }
     359         [ #  # ]:          0 :             if ( aError.isValid() )
     360                 :            :             {
     361         [ #  # ]:          0 :                 if ( _pErrorInfo )
     362                 :            :                 {
     363         [ #  # ]:          0 :                     *_pErrorInfo = aError;
     364                 :            :                 }
     365                 :            :                 else
     366                 :            :                 {
     367         [ #  # ]:          0 :                     showError( aError );
     368                 :            :                 }
     369         [ #  # ]:          0 :             }
     370 [ #  # ][ #  # ]:          0 :         }
     371                 :            :     }
     372 [ #  # ][ #  # ]:          0 :     return m_xDataSourceConnection;
     373                 :            : }
     374                 :            : // -----------------------------------------------------------------------------
     375                 :          0 : sal_Bool OApplicationController::isDataSourceReadOnly() const
     376                 :            : {
     377         [ #  # ]:          0 :     Reference<XStorable> xStore(m_xModel,UNO_QUERY);
     378 [ #  # ][ #  # ]:          0 :     return !xStore.is() || xStore->isReadonly();
         [ #  # ][ #  # ]
     379                 :            : }
     380                 :            : // -----------------------------------------------------------------------------
     381                 :          0 : sal_Bool OApplicationController::isConnectionReadOnly() const
     382                 :            : {
     383                 :          0 :     sal_Bool bIsConnectionReadOnly = sal_True;
     384         [ #  # ]:          0 :     if ( m_xMetaData.is() )
     385                 :            :     {
     386                 :            :         try
     387                 :            :         {
     388 [ #  # ][ #  # ]:          0 :             bIsConnectionReadOnly = m_xMetaData->isReadOnly();
     389                 :            :         }
     390                 :          0 :         catch(const SQLException&)
     391                 :            :         {
     392                 :            :             DBG_UNHANDLED_EXCEPTION();
     393                 :            :         }
     394                 :            :     }
     395                 :            :     // TODO check configuration
     396         [ #  # ]:          0 :     return bIsConnectionReadOnly;
     397                 :            : }
     398                 :            : // -----------------------------------------------------------------------------
     399                 :          0 : Reference< XNameAccess > OApplicationController::getElements( ElementType _eType )
     400                 :            : {
     401                 :          0 :     Reference< XNameAccess > xElements;
     402                 :            :     try
     403                 :            :     {
     404   [ #  #  #  #  :          0 :         switch ( _eType )
                      # ]
     405                 :            :         {
     406                 :            :         case E_REPORT:
     407                 :            :         {
     408         [ #  # ]:          0 :             Reference< XReportDocumentsSupplier > xSupp( m_xModel, UNO_QUERY_THROW );
     409 [ #  # ][ #  # ]:          0 :             xElements.set( xSupp->getReportDocuments(), UNO_SET_THROW );
                 [ #  # ]
     410                 :            :         }
     411                 :          0 :         break;
     412                 :            : 
     413                 :            :         case E_FORM:
     414                 :            :         {
     415         [ #  # ]:          0 :             Reference< XFormDocumentsSupplier > xSupp( m_xModel, UNO_QUERY_THROW );
     416 [ #  # ][ #  # ]:          0 :             xElements.set( xSupp->getFormDocuments(), UNO_SET_THROW );
                 [ #  # ]
     417                 :            :         }
     418                 :          0 :         break;
     419                 :            : 
     420                 :            :         case E_QUERY:
     421                 :            :         {
     422 [ #  # ][ #  # ]:          0 :             xElements.set( getQueryDefintions(), UNO_QUERY_THROW );
     423                 :            :         }
     424                 :          0 :         break;
     425                 :            : 
     426                 :            :         case E_TABLE:
     427                 :            :         {
     428         [ #  # ]:          0 :             if ( m_xDataSourceConnection.is() )
     429                 :            :             {
     430         [ #  # ]:          0 :                 Reference< XTablesSupplier > xSup( getConnection(), UNO_QUERY_THROW );
     431 [ #  # ][ #  # ]:          0 :                 xElements.set( xSup->getTables(), UNO_SET_THROW );
         [ #  # ][ #  # ]
     432                 :            :             }
     433                 :            :         }
     434                 :          0 :         break;
     435                 :            : 
     436                 :            :         default:
     437                 :          0 :             break;
     438                 :            :         }
     439                 :            :     }
     440         [ #  # ]:          0 :     catch(const Exception&)
     441                 :            :     {
     442                 :            :         DBG_UNHANDLED_EXCEPTION();
     443                 :            :     }
     444                 :            : 
     445                 :          0 :     return xElements;
     446                 :            : }
     447                 :            : // -----------------------------------------------------------------------------
     448                 :          0 : void OApplicationController::getSelectionElementNames(::std::vector< ::rtl::OUString>& _rNames) const
     449                 :            : {
     450         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     451 [ #  # ][ #  # ]:          0 :     ::osl::MutexGuard aGuard( getMutex() );
     452                 :            : 
     453                 :            :     OSL_ENSURE(getContainer(),"View isn't valid! -> GPF");
     454                 :            : 
     455 [ #  # ][ #  # ]:          0 :     getContainer()->getSelectionElementNames( _rNames );
         [ #  # ][ #  # ]
     456                 :          0 : }
     457                 :            : 
     458                 :            : // -----------------------------------------------------------------------------
     459                 :            : SAL_WNODEPRECATED_DECLARATIONS_PUSH
     460                 :          0 : ::std::auto_ptr< OLinkedDocumentsAccess > OApplicationController::getDocumentsAccess( ElementType _eType )
     461                 :            : {
     462                 :            :     OSL_ENSURE( ( _eType == E_TABLE ) || ( _eType == E_QUERY ) || ( _eType == E_FORM ) || ( _eType == E_REPORT ),
     463                 :            :         "OApplicationController::getDocumentsAccess: only forms and reports are supported here!" );
     464                 :            : 
     465 [ #  # ][ #  # ]:          0 :     SharedConnection xConnection( ensureConnection() );
     466                 :          0 :     Reference< XNameAccess > xDocContainer;
     467                 :            : 
     468         [ #  # ]:          0 :     if ( ( _eType == E_FORM ) | ( _eType == E_REPORT ) )
     469                 :            :     {
     470 [ #  # ][ #  # ]:          0 :         xDocContainer.set( getElements( _eType ) );
     471                 :            :         OSL_ENSURE( xDocContainer.is(), "OApplicationController::getDocumentsAccess: invalid container!" );
     472                 :            :     }
     473                 :            : 
     474                 :            :     ::std::auto_ptr< OLinkedDocumentsAccess > pDocuments( new OLinkedDocumentsAccess(
     475                 :          0 :         getView(), this, getORB(), xDocContainer, xConnection, getDatabaseName()
     476 [ #  # ][ #  # ]:          0 :     ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     477         [ #  # ]:          0 :     return pDocuments;
     478                 :            : }
     479                 :            : SAL_WNODEPRECATED_DECLARATIONS_POP
     480                 :            : 
     481                 :            : // -----------------------------------------------------------------------------
     482                 :          0 : TransferableHelper* OApplicationController::copyObject()
     483                 :            : {
     484                 :            :     try
     485                 :            :     {
     486         [ #  # ]:          0 :         SolarMutexGuard aSolarGuard;
     487 [ #  # ][ #  # ]:          0 :         ::osl::MutexGuard aGuard( getMutex() );
     488                 :            : 
     489 [ #  # ][ #  # ]:          0 :         ElementType eType = getContainer()->getElementType();
     490                 :          0 :         TransferableHelper* pData = NULL;
     491      [ #  #  # ]:          0 :         switch( eType )
     492                 :            :         {
     493                 :            :             case E_TABLE:
     494                 :            :             case E_QUERY:
     495                 :            :             {
     496 [ #  # ][ #  # ]:          0 :                 SharedConnection xConnection( ensureConnection() );
     497                 :          0 :                 Reference< XDatabaseMetaData> xMetaData;
     498         [ #  # ]:          0 :                 if ( xConnection.is() )
     499 [ #  # ][ #  # ]:          0 :                     xMetaData = xConnection->getMetaData();
                 [ #  # ]
     500                 :            : 
     501 [ #  # ][ #  # ]:          0 :                 ::rtl::OUString sName = getContainer()->getQualifiedName( NULL );
     502         [ #  # ]:          0 :                 if ( !sName.isEmpty() )
     503                 :            :                 {
     504         [ #  # ]:          0 :                     ::rtl::OUString sDataSource = getDatabaseName();
     505                 :            : 
     506         [ #  # ]:          0 :                     if ( eType == E_TABLE )
     507                 :            :                     {
     508 [ #  # ][ #  # ]:          0 :                         pData = new ODataClipboard(sDataSource, CommandType::TABLE, sName, xConnection, getNumberFormatter(xConnection,getORB()), getORB());
         [ #  # ][ #  # ]
     509                 :            :                     }
     510                 :            :                     else
     511                 :            :                     {
     512 [ #  # ][ #  # ]:          0 :                         pData = new ODataClipboard(sDataSource, CommandType::QUERY, sName, getNumberFormatter(xConnection,getORB()), getORB());
         [ #  # ][ #  # ]
     513                 :          0 :                     }
     514         [ #  # ]:          0 :                 }
     515                 :            :             }
     516                 :          0 :                 break;
     517                 :            :             case E_FORM:
     518                 :            :             case E_REPORT:
     519                 :            :             {
     520         [ #  # ]:          0 :                 ::std::vector< ::rtl::OUString> aList;
     521         [ #  # ]:          0 :                 getSelectionElementNames(aList);
     522 [ #  # ][ #  # ]:          0 :                 Reference< XHierarchicalNameAccess > xElements(getElements(eType),UNO_QUERY);
     523 [ #  # ][ #  # ]:          0 :                 if ( xElements.is() && !aList.empty() )
                 [ #  # ]
     524                 :            :                 {
     525 [ #  # ][ #  # ]:          0 :                     Reference< XContent> xContent(xElements->getByHierarchicalName(*aList.begin()),UNO_QUERY);
                 [ #  # ]
     526 [ #  # ][ #  # ]:          0 :                     pData = new OComponentTransferable( getDatabaseName(), xContent );
     527                 :          0 :                 }
     528                 :            :             }
     529                 :          0 :             break;
     530                 :            :             default:
     531                 :          0 :                 break;
     532                 :            :         }
     533                 :            : 
     534                 :            :         // the owner ship goes to ODataClipboards
     535 [ #  # ][ #  # ]:          0 :         return pData;
     536                 :            :     }
     537      [ #  #  # ]:          0 :     catch(const SQLException&)
     538                 :            :     {
     539   [ #  #  #  #  :          0 :         showError( SQLExceptionInfo( ::cppu::getCaughtException() ) );
             #  #  #  # ]
     540                 :            :     }
     541                 :          0 :     catch( const Exception& )
     542                 :            :     {
     543                 :            :         DBG_UNHANDLED_EXCEPTION();
     544                 :            :     }
     545                 :          0 :     return NULL;
     546                 :            : }
     547                 :            : // -----------------------------------------------------------------------------
     548                 :          0 : sal_Bool OApplicationController::paste( ElementType _eType,const ::svx::ODataAccessDescriptor& _rPasteData,const String& _sParentFolder ,sal_Bool _bMove)
     549                 :            : {
     550                 :            :     try
     551                 :            :     {
     552         [ #  # ]:          0 :         if ( _eType == E_QUERY )
     553                 :            :         {
     554                 :          0 :             sal_Int32 nCommandType = CommandType::TABLE;
     555 [ #  # ][ #  # ]:          0 :             if ( _rPasteData.has(daCommandType) )
     556         [ #  # ]:          0 :                 _rPasteData[daCommandType]      >>= nCommandType;
     557                 :            : 
     558 [ #  # ][ #  # ]:          0 :             if ( CommandType::QUERY == nCommandType || CommandType::COMMAND == nCommandType )
     559                 :            :             {
     560                 :            :                 // read all necessary data
     561                 :            : 
     562                 :          0 :                 ::rtl::OUString sCommand;
     563                 :          0 :                 sal_Bool bEscapeProcessing = sal_True;
     564                 :            : 
     565         [ #  # ]:          0 :                 _rPasteData[daCommand] >>= sCommand;
     566 [ #  # ][ #  # ]:          0 :                 if ( _rPasteData.has(daEscapeProcessing) )
     567         [ #  # ]:          0 :                     _rPasteData[daEscapeProcessing] >>= bEscapeProcessing;
     568                 :            : 
     569                 :            :                 // plausibility check
     570                 :          0 :                 sal_Bool bValidDescriptor = sal_False;
     571         [ #  # ]:          0 :                 ::rtl::OUString sDataSourceName = _rPasteData.getDataSource();
     572         [ #  # ]:          0 :                 if (CommandType::QUERY == nCommandType)
     573 [ #  # ][ #  # ]:          0 :                     bValidDescriptor = sDataSourceName.getLength() && sCommand.getLength();
     574         [ #  # ]:          0 :                 else if (CommandType::COMMAND == nCommandType)
     575                 :          0 :                     bValidDescriptor = !sCommand.isEmpty();
     576         [ #  # ]:          0 :                 if (!bValidDescriptor)
     577                 :            :                 {
     578                 :            :                     OSL_FAIL("OApplicationController::paste: invalid descriptor!");
     579                 :          0 :                     return sal_False;
     580                 :            :                 }
     581                 :            : 
     582                 :            :                 // the target object name (as we'll suggest it to the user)
     583                 :          0 :                 ::rtl::OUString sTargetName;
     584                 :            :                 try
     585                 :            :                 {
     586         [ #  # ]:          0 :                     if ( CommandType::QUERY == nCommandType )
     587                 :          0 :                         sTargetName = sCommand;
     588                 :            : 
     589         [ #  # ]:          0 :                     if ( sTargetName.isEmpty() )
     590                 :            :                     {
     591 [ #  # ][ #  # ]:          0 :                         String sDefaultName = String( ModuleRes( STR_QRY_TITLE ) );
     592 [ #  # ][ #  # ]:          0 :                         sDefaultName = sDefaultName.GetToken( 0, ' ' );
                 [ #  # ]
     593                 :            : 
     594 [ #  # ][ #  # ]:          0 :                         Reference< XNameAccess > xQueries( getQueryDefintions(), UNO_QUERY_THROW );
     595 [ #  # ][ #  # ]:          0 :                         sTargetName = ::dbtools::createUniqueName( xQueries, sDefaultName, sal_False );
         [ #  # ][ #  # ]
     596                 :            :                     }
     597                 :            :                 }
     598         [ #  # ]:          0 :                 catch(const Exception&)
     599                 :            :                 {
     600                 :            :                     DBG_UNHANDLED_EXCEPTION();
     601                 :            :                 }
     602                 :            : 
     603                 :          0 :                 Reference< XPropertySet > xQuery;
     604         [ #  # ]:          0 :                 if (CommandType::QUERY == nCommandType)
     605                 :            :                 {
     606                 :            :                     // need to extract the statement and the escape processing flag from the query object
     607                 :          0 :                     sal_Bool bSuccess = sal_False;
     608                 :            :                     try
     609                 :            :                     {
     610                 :            :                         // the concrete query
     611                 :            :                         Reference< XQueryDefinitionsSupplier > xSourceQuerySup(
     612                 :          0 :                             getDataSourceByName( sDataSourceName, getView(), getORB(), NULL ),
     613   [ #  #  #  # ]:          0 :                             UNO_QUERY_THROW );
                 [ #  # ]
     614 [ #  # ][ #  # ]:          0 :                         Reference< XNameAccess > xQueries( xSourceQuerySup->getQueryDefinitions(), UNO_SET_THROW );
                 [ #  # ]
     615 [ #  # ][ #  # ]:          0 :                         if ( xQueries->hasByName( sCommand ) )
                 [ #  # ]
     616                 :            :                         {
     617 [ #  # ][ #  # ]:          0 :                             xQuery.set( xQueries->getByName(sCommand), UNO_QUERY_THROW );
                 [ #  # ]
     618                 :          0 :                             bSuccess = true;
     619                 :          0 :                         }
     620                 :            :                     }
     621      [ #  #  # ]:          0 :                     catch(SQLException&) { throw; } // caught and handled by the outer catch
     622         [ #  # ]:          0 :                     catch( const Exception& )
     623                 :            :                     {
     624                 :            :                         DBG_UNHANDLED_EXCEPTION();
     625                 :            :                     }
     626                 :            : 
     627         [ #  # ]:          0 :                     if (!bSuccess)
     628                 :            :                     {
     629                 :            :                         OSL_FAIL("OApplicationController::paste: could not extract the source query object!");
     630                 :            :                         // TODO: maybe this is worth an error message to be displayed to the user ....
     631                 :          0 :                         return sal_False;
     632                 :            :                     }
     633                 :            :                 }
     634                 :            : 
     635                 :            : 
     636 [ #  # ][ #  # ]:          0 :                 Reference< XNameContainer > xDestQueries(getQueryDefintions(), UNO_QUERY);
     637         [ #  # ]:          0 :                 Reference< XSingleServiceFactory > xQueryFactory(xDestQueries, UNO_QUERY);
     638         [ #  # ]:          0 :                 if (!xQueryFactory.is())
     639                 :            :                 {
     640                 :            :                     OSL_FAIL("OApplicationController::paste: invalid destination query container!");
     641                 :          0 :                     return sal_False;
     642                 :            :                 }
     643                 :            : 
     644                 :            :                 // here we have everything needed to create a new query object ...
     645                 :            :                 // ... ehm, except a new name
     646         [ #  # ]:          0 :                 ensureConnection();
     647                 :            : 
     648         [ #  # ]:          0 :                 DynamicTableOrQueryNameCheck aNameChecker( getConnection(), CommandType::QUERY );
     649         [ #  # ]:          0 :                 ::dbtools::SQLExceptionInfo aDummy;
     650                 :          0 :                 bool bNeedAskForName =  ( sCommand.isEmpty() )
     651                 :            :                                             /* we did not have a source name, so the target name was auto-generated */
     652 [ #  # ][ #  # ]:          0 :                                     ||  ( !aNameChecker.isNameValid( sTargetName, aDummy ) );
                 [ #  # ]
     653                 :            :                                             /*  name is invalid in the target DB (e.g. because it already
     654                 :            :                                                 has a /table/ with that name) */
     655         [ #  # ]:          0 :                 if ( bNeedAskForName )
     656                 :            :                 {
     657                 :          0 :                     OSaveAsDlg aAskForName( getView(),
     658                 :            :                                             CommandType::QUERY,
     659                 :            :                                             getORB(),
     660                 :          0 :                                             getConnection(),
     661                 :            :                                             sTargetName,
     662                 :            :                                             aNameChecker,
     663   [ #  #  #  #  :          0 :                                             SAD_ADDITIONAL_DESCRIPTION | SAD_TITLE_PASTE_AS);
           #  # ][ #  # ]
     664 [ #  # ][ #  # ]:          0 :                     if ( RET_OK != aAskForName.Execute() )
     665                 :            :                         // cancelled by the user
     666                 :          0 :                         return sal_False;
     667 [ #  # ][ #  # ]:          0 :                     sTargetName = aAskForName.getName();
         [ #  # ][ #  # ]
                 [ #  # ]
     668                 :            :                 }
     669                 :            : 
     670                 :            :                 // create a new object
     671 [ #  # ][ #  # ]:          0 :                 Reference< XPropertySet > xNewQuery(xQueryFactory->createInstance(), UNO_QUERY);
                 [ #  # ]
     672                 :            :                 OSL_ENSURE(xNewQuery.is(), "OApplicationController::paste: invalid object created by factory!");
     673         [ #  # ]:          0 :                 if (xNewQuery.is())
     674                 :            :                 {
     675                 :            :                     // initialize
     676         [ #  # ]:          0 :                     if ( xQuery.is() )
     677         [ #  # ]:          0 :                         ::comphelper::copyProperties(xQuery,xNewQuery);
     678                 :            :                     else
     679                 :            :                     {
     680 [ #  # ][ #  # ]:          0 :                         xNewQuery->setPropertyValue(PROPERTY_COMMAND,makeAny(sCommand));
         [ #  # ][ #  # ]
     681 [ #  # ][ #  # ]:          0 :                         xNewQuery->setPropertyValue(PROPERTY_ESCAPE_PROCESSING,makeAny(bEscapeProcessing));
         [ #  # ][ #  # ]
     682                 :            :                     }
     683                 :            :                     // insert
     684 [ #  # ][ #  # ]:          0 :                     xDestQueries->insertByName( sTargetName, makeAny(xNewQuery) );
                 [ #  # ]
     685 [ #  # ][ #  # ]:          0 :                     xNewQuery.set(xDestQueries->getByName( sTargetName),UNO_QUERY);
                 [ #  # ]
     686 [ #  # ][ #  # ]:          0 :                     if ( xQuery.is() && xNewQuery.is() )
                 [ #  # ]
     687                 :            :                     {
     688         [ #  # ]:          0 :                         Reference<XColumnsSupplier> xSrcColSup(xQuery,UNO_QUERY);
     689         [ #  # ]:          0 :                         Reference<XColumnsSupplier> xDstColSup(xNewQuery,UNO_QUERY);
     690 [ #  # ][ #  # ]:          0 :                         if ( xSrcColSup.is() && xDstColSup.is() )
                 [ #  # ]
     691                 :            :                         {
     692 [ #  # ][ #  # ]:          0 :                             Reference<XNameAccess> xSrcNameAccess = xSrcColSup->getColumns();
     693 [ #  # ][ #  # ]:          0 :                             Reference<XNameAccess> xDstNameAccess = xDstColSup->getColumns();
     694         [ #  # ]:          0 :                             Reference<XDataDescriptorFactory> xFac(xDstNameAccess,UNO_QUERY);
     695         [ #  # ]:          0 :                             Reference<XAppend> xAppend(xFac,UNO_QUERY);
     696 [ #  # ][ #  # ]:          0 :                             if ( xSrcNameAccess.is() && xDstNameAccess.is() && xSrcNameAccess->hasElements() && xAppend.is() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     697                 :            :                             {
     698 [ #  # ][ #  # ]:          0 :                                 Reference<XPropertySet> xDstProp(xFac->createDataDescriptor());
     699                 :            : 
     700 [ #  # ][ #  # ]:          0 :                                 Sequence< ::rtl::OUString> aSeq = xSrcNameAccess->getElementNames();
     701                 :          0 :                                 const ::rtl::OUString* pIter = aSeq.getConstArray();
     702                 :          0 :                                 const ::rtl::OUString* pEnd   = pIter + aSeq.getLength();
     703         [ #  # ]:          0 :                                 for( ; pIter != pEnd ; ++pIter)
     704                 :            :                                 {
     705 [ #  # ][ #  # ]:          0 :                                     Reference<XPropertySet> xSrcProp(xSrcNameAccess->getByName(*pIter),UNO_QUERY);
                 [ #  # ]
     706         [ #  # ]:          0 :                                     ::comphelper::copyProperties(xSrcProp,xDstProp);
     707 [ #  # ][ #  # ]:          0 :                                     xAppend->appendByDescriptor(xDstProp);
     708         [ #  # ]:          0 :                                 }
     709                 :          0 :                             }
     710                 :          0 :                         }
     711                 :            :                     }
     712 [ #  # ][ #  # ]:          0 :                 }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     713                 :            :             }
     714                 :            :             else
     715                 :            :                 OSL_TRACE("There should be a sequence in it!");
     716                 :          0 :             return sal_True;
     717                 :            :         }
     718 [ #  # ][ #  # ]:          0 :         else if ( _rPasteData.has(daComponent) ) // forms or reports
     719                 :            :         {
     720                 :          0 :             Reference<XContent> xContent;
     721 [ #  # ][ #  # ]:          0 :             _rPasteData[daComponent] >>= xContent;
     722 [ #  # ][ #  # ]:          0 :             return insertHierachyElement(_eType,_sParentFolder,Reference<XNameAccess>(xContent,UNO_QUERY).is(),xContent,_bMove);
     723                 :            :         }
     724                 :            :     }
     725   [ #  #  #  #  :          0 :     catch(const SQLException&) { showError( SQLExceptionInfo( ::cppu::getCaughtException() ) ); }
          #  #  #  #  #  
                   #  # ]
     726                 :          0 :     catch(const Exception& )
     727                 :            :     {
     728                 :            :         DBG_UNHANDLED_EXCEPTION();
     729                 :            :     }
     730                 :          0 :     return sal_False;
     731                 :            : }
     732                 :            : // -----------------------------------------------------------------------------
     733                 :          0 : Reference<XNameContainer> OApplicationController::getQueryDefintions() const
     734                 :            : {
     735         [ #  # ]:          0 :     Reference<XQueryDefinitionsSupplier> xSet(m_xDataSource,UNO_QUERY);
     736                 :          0 :     Reference<XNameContainer> xNames;
     737         [ #  # ]:          0 :     if ( xSet.is() )
     738                 :            :     {
     739 [ #  # ][ #  # ]:          0 :         xNames.set(xSet->getQueryDefinitions(),UNO_QUERY);
                 [ #  # ]
     740                 :            :     }
     741                 :          0 :     return xNames;
     742                 :            : }
     743                 :            : // -----------------------------------------------------------------------------
     744                 :          0 : void OApplicationController::getSupportedFormats(ElementType _eType,::std::vector<SotFormatStringId>& _rFormatIds) const
     745                 :            : {
     746      [ #  #  # ]:          0 :     switch( _eType )
     747                 :            :     {
     748                 :            :         case E_TABLE:
     749         [ #  # ]:          0 :             _rFormatIds.push_back(SOT_FORMATSTR_ID_DBACCESS_TABLE);
     750         [ #  # ]:          0 :             _rFormatIds.push_back(SOT_FORMAT_RTF);
     751         [ #  # ]:          0 :             _rFormatIds.push_back(SOT_FORMATSTR_ID_HTML);
     752                 :            :             // run through
     753                 :            :         case E_QUERY:
     754         [ #  # ]:          0 :             _rFormatIds.push_back(SOT_FORMATSTR_ID_DBACCESS_QUERY);
     755                 :          0 :             break;
     756                 :            :         default:
     757                 :          0 :             break;
     758                 :            :     }
     759                 :          0 : }
     760                 :            : // -----------------------------------------------------------------------------
     761                 :          0 : sal_Bool OApplicationController::isTableFormat()  const
     762                 :            : {
     763                 :          0 :     return m_aTableCopyHelper.isTableFormat(getViewClipboard());
     764                 :            : }
     765                 :            : // -----------------------------------------------------------------------------
     766                 :          0 : IMPL_LINK( OApplicationController, OnAsyncDrop, void*, /*NOTINTERESTEDIN*/ )
     767                 :            : {
     768                 :          0 :     m_nAsyncDrop = 0;
     769         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
     770 [ #  # ][ #  # ]:          0 :     ::osl::MutexGuard aGuard( getMutex() );
     771                 :            : 
     772                 :            : 
     773         [ #  # ]:          0 :     if ( m_aAsyncDrop.nType == E_TABLE )
     774                 :            :     {
     775 [ #  # ][ #  # ]:          0 :         SharedConnection xConnection( ensureConnection() );
     776         [ #  # ]:          0 :         if ( xConnection.is() )
     777 [ #  # ][ #  # ]:          0 :             m_aTableCopyHelper.asyncCopyTagTable( m_aAsyncDrop, getDatabaseName(), xConnection );
                 [ #  # ]
     778                 :            :     }
     779                 :            :     else
     780                 :            :     {
     781 [ #  # ][ #  # ]:          0 :         if ( paste(m_aAsyncDrop.nType,m_aAsyncDrop.aDroppedData,m_aAsyncDrop.aUrl,m_aAsyncDrop.nAction == DND_ACTION_MOVE)
         [ #  # ][ #  # ]
     782                 :            :             && m_aAsyncDrop.nAction == DND_ACTION_MOVE )
     783                 :            :         {
     784                 :          0 :             Reference<XContent> xContent;
     785 [ #  # ][ #  # ]:          0 :             m_aAsyncDrop.aDroppedData[daComponent] >>= xContent;
     786         [ #  # ]:          0 :             ::std::vector< ::rtl::OUString> aList;
     787                 :          0 :             sal_Int32 nIndex = 0;
     788 [ #  # ][ #  # ]:          0 :             ::rtl::OUString sName = xContent->getIdentifier()->getContentIdentifier();
         [ #  # ][ #  # ]
     789                 :          0 :             ::rtl::OUString sErase = sName.getToken(0,'/',nIndex); // we don't want to have the "private:forms" part
     790         [ #  # ]:          0 :             if ( nIndex != -1 )
     791                 :            :             {
     792         [ #  # ]:          0 :                 aList.push_back(sName.copy(sErase.getLength() + 1));
     793         [ #  # ]:          0 :                 deleteObjects( m_aAsyncDrop.nType, aList, false );
     794                 :          0 :             }
     795                 :            :         }
     796                 :            :     }
     797                 :            : 
     798         [ #  # ]:          0 :     m_aAsyncDrop.aDroppedData.clear();
     799                 :            : 
     800 [ #  # ][ #  # ]:          0 :     return 0L;
     801                 :            : }
     802                 :            : //........................................................................
     803                 :            : }   // namespace dbaui
     804                 :            : //........................................................................
     805                 :            : 
     806                 :            : 
     807                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10