LCOV - code coverage report
Current view: top level - libreoffice/dbaccess/source/ui/uno - unosqlmessage.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 58 0.0 %
Date: 2012-12-27 Functions: 0 14 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include "sqlmessage.hxx"
      22             : #include "unosqlmessage.hxx"
      23             : #include "dbu_reghelper.hxx"
      24             : #include "dbustrings.hrc"
      25             : #include <cppuhelper/typeprovider.hxx>
      26             : #include <connectivity/dbexception.hxx>
      27             : 
      28             : using namespace dbaui;
      29             : using namespace dbtools;
      30             : 
      31             : using namespace ::com::sun::star::sdbc;
      32             : using namespace ::com::sun::star::sdb;
      33             : 
      34           0 : extern "C" void SAL_CALL createRegistryInfo_OSQLMessageDialog()
      35             : {
      36           0 :     static OMultiInstanceAutoRegistration< OSQLMessageDialog > aAutoRegistration;
      37           0 : }
      38             : 
      39             : //.........................................................................
      40             : namespace dbaui
      41             : {
      42             : //.........................................................................
      43             : 
      44             :     using namespace ::com::sun::star::uno;
      45             :     using namespace ::com::sun::star::lang;
      46             :     using namespace ::com::sun::star::beans;
      47             : 
      48             : //=========================================================================
      49             : //-------------------------------------------------------------------------
      50           0 : OSQLMessageDialog::OSQLMessageDialog(const Reference< XMultiServiceFactory >& _rxORB)
      51           0 :     :OSQLMessageDialogBase(_rxORB)
      52             : {
      53             :     registerMayBeVoidProperty(PROPERTY_SQLEXCEPTION, PROPERTY_ID_SQLEXCEPTION, PropertyAttribute::TRANSIENT | PropertyAttribute::MAYBEVOID,
      54           0 :         &m_aException, ::getCppuType(static_cast<SQLException*>(NULL)));
      55             :     registerProperty( PROPERTY_HELP_URL, PROPERTY_ID_HELP_URL, PropertyAttribute::TRANSIENT,
      56           0 :         &m_sHelpURL, ::getCppuType( &m_sHelpURL ) );
      57           0 : }
      58             : 
      59             : //-------------------------------------------------------------------------
      60           0 : Sequence<sal_Int8> SAL_CALL OSQLMessageDialog::getImplementationId(  ) throw(RuntimeException)
      61             : {
      62           0 :     static ::cppu::OImplementationId aId;
      63           0 :     return aId.getImplementationId();
      64             : }
      65             : 
      66             : //-------------------------------------------------------------------------
      67           0 : Reference< XInterface > SAL_CALL OSQLMessageDialog::Create(const Reference< XMultiServiceFactory >& _rxFactory)
      68             : {
      69           0 :     return *(new OSQLMessageDialog(_rxFactory));
      70             : }
      71             : 
      72             : //-------------------------------------------------------------------------
      73           0 : ::rtl::OUString SAL_CALL OSQLMessageDialog::getImplementationName() throw(RuntimeException)
      74             : {
      75           0 :     return getImplementationName_Static();
      76             : }
      77             : 
      78             : //-------------------------------------------------------------------------
      79           0 : ::rtl::OUString OSQLMessageDialog::getImplementationName_Static() throw(RuntimeException)
      80             : {
      81           0 :     return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.dbu.OSQLMessageDialog"));
      82             : }
      83             : 
      84             : //-------------------------------------------------------------------------
      85           0 : ::comphelper::StringSequence SAL_CALL OSQLMessageDialog::getSupportedServiceNames() throw(RuntimeException)
      86             : {
      87           0 :     return getSupportedServiceNames_Static();
      88             : }
      89             : 
      90             : //-------------------------------------------------------------------------
      91           0 : ::comphelper::StringSequence OSQLMessageDialog::getSupportedServiceNames_Static() throw(RuntimeException)
      92             : {
      93           0 :     ::comphelper::StringSequence aSupported(1);
      94           0 :     aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.ErrorMessageDialog"));
      95           0 :     return aSupported;
      96             : }
      97             : 
      98             : //-------------------------------------------------------------------------
      99           0 : void OSQLMessageDialog::initialize(Sequence<Any> const & args) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
     100             : {
     101           0 :   OUString title;
     102           0 :   Reference< com::sun::star::awt::XWindow > parentWindow;
     103           0 :   Reference< com::sun::star::sdbc::SQLException > sqlException;
     104             : 
     105           0 :   if ((args.getLength() == 3) && (args[0] >>= title) && (args[1] >>= parentWindow) && (args[2] >>= sqlException)) {
     106           0 :     Sequence<Any> s(3);
     107           0 :     s[0] <<= PropertyValue( "Title", -1, makeAny(title), PropertyState_DIRECT_VALUE);
     108           0 :     s[1] <<= PropertyValue( "ParentWindow", -1, makeAny(parentWindow), PropertyState_DIRECT_VALUE);
     109           0 :     s[2] <<= PropertyValue( "SQLException", -1, makeAny(sqlException), PropertyState_DIRECT_VALUE);
     110           0 :     OGenericUnoDialog::initialize(s);
     111             :   } else {
     112           0 :     OGenericUnoDialog::initialize(args);
     113           0 :   }
     114           0 : }
     115             : 
     116             : //-------------------------------------------------------------------------
     117           0 : sal_Bool SAL_CALL OSQLMessageDialog::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue) throw(IllegalArgumentException)
     118             : {
     119           0 :     switch (_nHandle)
     120             :     {
     121             :         case PROPERTY_ID_SQLEXCEPTION:
     122             :         {
     123           0 :             SQLExceptionInfo aInfo(_rValue);
     124           0 :             if (!aInfo.isValid())
     125           0 :                 throw IllegalArgumentException();
     126             : 
     127           0 :             _rOldValue = m_aException;
     128           0 :             _rConvertedValue = aInfo.get();
     129             : 
     130           0 :             return sal_True;
     131             :                 // always assume "modified", don't bother with with comparing the two values
     132             :         }
     133             :         default:
     134           0 :             return OSQLMessageDialogBase::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue);
     135             :     }
     136             : }
     137             : 
     138             : //-------------------------------------------------------------------------
     139           0 : Reference<XPropertySetInfo>  SAL_CALL OSQLMessageDialog::getPropertySetInfo() throw(RuntimeException)
     140             : {
     141           0 :     Reference<XPropertySetInfo>  xInfo( createPropertySetInfo( getInfoHelper() ) );
     142           0 :     return xInfo;
     143             : }
     144             : 
     145             : //-------------------------------------------------------------------------
     146           0 : ::cppu::IPropertyArrayHelper& OSQLMessageDialog::getInfoHelper()
     147             : {
     148           0 :     return *const_cast<OSQLMessageDialog*>(this)->getArrayHelper();
     149             : }
     150             : 
     151             : //------------------------------------------------------------------------------
     152           0 : ::cppu::IPropertyArrayHelper* OSQLMessageDialog::createArrayHelper( ) const
     153             : {
     154           0 :     Sequence< Property > aProps;
     155           0 :     describeProperties(aProps);
     156           0 :     return new ::cppu::OPropertyArrayHelper(aProps);
     157             : }
     158             : 
     159             : //------------------------------------------------------------------------------
     160           0 : Dialog* OSQLMessageDialog::createDialog(Window* _pParent)
     161             : {
     162           0 :     if ( m_aException.hasValue() )
     163           0 :         return new OSQLMessageBox( _pParent, SQLExceptionInfo( m_aException ), WB_OK | WB_DEF_OK, m_sHelpURL );
     164             : 
     165             :     OSL_FAIL("OSQLMessageDialog::createDialog : You should use the SQLException property to specify the error to display!");
     166           0 :     return new OSQLMessageBox(_pParent, SQLException());
     167             : }
     168             : 
     169             : //.........................................................................
     170             : }   // namespace dbaui
     171             : //.........................................................................
     172             : 
     173             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10