LCOV - code coverage report
Current view: top level - dbaccess/source/ui/uno - unoDirectSql.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 6 36 16.7 %
Date: 2014-11-03 Functions: 5 18 27.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <sal/config.h>
      21             : 
      22             : #include "uiservices.hxx"
      23             : #include "unoDirectSql.hxx"
      24             : #include "dbu_reghelper.hxx"
      25             : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
      26             : #include <com/sun/star/container/XNameAccess.hpp>
      27             : #include <com/sun/star/connection/XConnection.hpp>
      28             : #include <com/sun/star/container/XNamed.hpp>
      29             : #include "directsql.hxx"
      30             : #include "dbustrings.hrc"
      31             : #include "datasourceconnector.hxx"
      32             : #include <tools/diagnose_ex.h>
      33             : #include <comphelper/processfactory.hxx>
      34             : 
      35          24 : extern "C" void SAL_CALL createRegistryInfo_ODirectSQLDialog()
      36             : {
      37          24 :     static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::ODirectSQLDialog > aAutoRegistration;
      38          24 : }
      39             : 
      40             : namespace dbaui
      41             : {
      42             : 
      43             :     using namespace ::com::sun::star::uno;
      44             :     using namespace ::com::sun::star::lang;
      45             :     using namespace ::com::sun::star::beans;
      46             :     using namespace ::com::sun::star::container;
      47             :     using namespace ::com::sun::star::sdbcx;
      48             :     using namespace ::com::sun::star::sdbc;
      49             :     using namespace ::com::sun::star::sdb;
      50             : 
      51             :     // ODirectSQLDialog
      52           0 :     ODirectSQLDialog::ODirectSQLDialog(const Reference< XComponentContext >& _rxORB)
      53           0 :         :ODirectSQLDialog_BASE( _rxORB )
      54             :     {
      55             : 
      56           0 :     }
      57             : 
      58           0 :     ODirectSQLDialog::~ODirectSQLDialog()
      59             :     {
      60             : 
      61           0 :     }
      62             : 
      63           0 :     css::uno::Sequence<sal_Int8> ODirectSQLDialog::getImplementationId()
      64             :         throw (css::uno::RuntimeException, std::exception)
      65             :     {
      66           0 :         return css::uno::Sequence<sal_Int8>();
      67             :     }
      68             : 
      69          48 :     IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(ODirectSQLDialog, "com.sun.star.comp.sdb.DirectSQLDialog")
      70           0 :     IMPLEMENT_SERVICE_INFO_SUPPORTS(ODirectSQLDialog)
      71          24 :     IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(ODirectSQLDialog, SERVICE_SDB_DIRECTSQLDIALOG)
      72             : 
      73             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
      74           0 :         SAL_CALL ODirectSQLDialog::Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB)
      75             :     {
      76           0 :         return static_cast< XServiceInfo* >(new ODirectSQLDialog( comphelper::getComponentContext(_rxORB)));
      77             :     }
      78             : 
      79           0 :     IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( ODirectSQLDialog )
      80             : 
      81           0 :     Dialog* ODirectSQLDialog::createDialog(vcl::Window* _pParent)
      82             :     {
      83             :         // obtain all the objects needed for the dialog
      84           0 :         Reference< XConnection > xConnection = m_xActiveConnection;
      85           0 :         if ( !xConnection.is() )
      86             :         {
      87             :             try
      88             :             {
      89             :                 // the connection the row set is working with
      90           0 :                 ODatasourceConnector aDSConnector(m_aContext, _pParent);
      91           0 :                 xConnection = aDSConnector.connect( m_sInitialSelection, NULL );
      92             :             }
      93           0 :             catch( const Exception& )
      94             :             {
      95             :                 DBG_UNHANDLED_EXCEPTION();
      96             :             }
      97             :         }
      98           0 :         if ( !xConnection.is() )
      99             :             // can't create the dialog if I have improper settings
     100           0 :             return NULL;
     101             : 
     102           0 :         return new DirectSQLDialog( _pParent, xConnection);
     103             :     }
     104           0 :     void ODirectSQLDialog::implInitialize(const Any& _rValue)
     105             :     {
     106           0 :         PropertyValue aProperty;
     107           0 :         if (_rValue >>= aProperty)
     108             :         {
     109           0 :             if (aProperty.Name.equalsAscii("InitialSelection"))
     110             :             {
     111           0 :                 OSL_VERIFY( aProperty.Value >>= m_sInitialSelection );
     112           0 :                 return;
     113             :             }
     114           0 :             else if (aProperty.Name.equalsAscii("ActiveConnection"))
     115             :             {
     116           0 :                 m_xActiveConnection.set( aProperty.Value, UNO_QUERY );
     117             :                 OSL_ENSURE( m_xActiveConnection.is(), "ODirectSQLDialog::implInitialize: invalid connection!" );
     118           0 :                 return;
     119             :             }
     120             :         }
     121           0 :         ODirectSQLDialog_BASE::implInitialize(_rValue);
     122             :     }
     123          72 : }   // namespace dbaui
     124             : 
     125             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10