LCOV - code coverage report
Current view: top level - libreoffice/extensions/source/abpilot - unodialogabp.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 60 0.0 %
Date: 2012-12-27 Functions: 0 18 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             : #include "unodialogabp.hxx"
      21             : #include <cppuhelper/typeprovider.hxx>
      22             : #include "abspilot.hxx"
      23             : #include <comphelper/sequence.hxx>
      24             : #include <vcl/msgbox.hxx>
      25             : 
      26           0 : extern "C" void SAL_CALL createRegistryInfo_OABSPilotUno()
      27             : {
      28           0 :     static ::abp::OMultiInstanceAutoRegistration< ::abp::OABSPilotUno > aAutoRegistration;
      29           0 : }
      30             : 
      31             : #define PROPERTY_ID_DATASOURCENAME  3
      32             : //.........................................................................
      33             : namespace abp
      34             : {
      35             : //.........................................................................
      36             : 
      37             :     using namespace ::com::sun::star::uno;
      38             :     using namespace ::com::sun::star::lang;
      39             :     using namespace ::com::sun::star::beans;
      40             :     using namespace ::com::sun::star::ui::dialogs;
      41             : 
      42             :     //=====================================================================
      43             :     //= OABSPilotUno
      44             :     //=====================================================================
      45             :     //---------------------------------------------------------------------
      46           0 :     OABSPilotUno::OABSPilotUno(const Reference< XMultiServiceFactory >& _rxORB)
      47           0 :         :OGenericUnoDialog(_rxORB)
      48             :     {
      49             :         registerProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSourceName")), PROPERTY_ID_DATASOURCENAME, PropertyAttribute::READONLY ,
      50           0 :             &m_sDataSourceName, ::getCppuType( &m_sDataSourceName ) );
      51           0 :     }
      52             : 
      53             :     //--------------------------------------------------------------------------
      54           0 :     Any SAL_CALL OABSPilotUno::queryInterface( const Type& aType ) throw (RuntimeException)
      55             :     {
      56           0 :         Any aReturn = OABSPilotUno_DBase::queryInterface( aType );
      57           0 :         return aReturn.hasValue() ? aReturn : OABSPilotUno_JBase::queryInterface( aType );
      58             :     }
      59             : 
      60             :     //--------------------------------------------------------------------------
      61           0 :     void SAL_CALL OABSPilotUno::acquire(  ) throw ()
      62             :     {
      63           0 :         OABSPilotUno_DBase::acquire();
      64           0 :     }
      65             : 
      66             :     //--------------------------------------------------------------------------
      67           0 :     void SAL_CALL OABSPilotUno::release(  ) throw ()
      68             :     {
      69           0 :         OABSPilotUno_DBase::release();
      70           0 :     }
      71             : 
      72             :     //---------------------------------------------------------------------
      73           0 :     Sequence< Type > SAL_CALL OABSPilotUno::getTypes(  ) throw (RuntimeException)
      74             :     {
      75             :         return ::comphelper::concatSequences(
      76             :             OABSPilotUno_DBase::getTypes(),
      77             :             OABSPilotUno_JBase::getTypes()
      78           0 :         );
      79             :     }
      80             : 
      81             :     //---------------------------------------------------------------------
      82           0 :     Sequence<sal_Int8> SAL_CALL OABSPilotUno::getImplementationId(  ) throw(RuntimeException)
      83             :     {
      84             :         static ::cppu::OImplementationId* s_pId;
      85           0 :         if ( !s_pId )
      86             :         {
      87           0 :             ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      88           0 :             if ( !s_pId )
      89             :             {
      90           0 :                 static ::cppu::OImplementationId s_aId;
      91           0 :                 s_pId = &s_aId;
      92           0 :             }
      93             :         }
      94           0 :         return s_pId->getImplementationId();
      95             :     }
      96             : 
      97             :     //---------------------------------------------------------------------
      98           0 :     Reference< XInterface > SAL_CALL OABSPilotUno::Create(const Reference< XMultiServiceFactory >& _rxFactory)
      99             :     {
     100           0 :         return *(new OABSPilotUno(_rxFactory));
     101             :     }
     102             : 
     103             :     //---------------------------------------------------------------------
     104           0 :     ::rtl::OUString SAL_CALL OABSPilotUno::getImplementationName() throw(RuntimeException)
     105             :     {
     106           0 :         return getImplementationName_Static();
     107             :     }
     108             : 
     109             :     //---------------------------------------------------------------------
     110           0 :     ::rtl::OUString OABSPilotUno::getImplementationName_Static() throw(RuntimeException)
     111             :     {
     112           0 :         return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.abp.OAddressBookSourcePilot"));
     113             :     }
     114             : 
     115             :     //---------------------------------------------------------------------
     116           0 :     ::comphelper::StringSequence SAL_CALL OABSPilotUno::getSupportedServiceNames() throw(RuntimeException)
     117             :     {
     118           0 :         return getSupportedServiceNames_Static();
     119             :     }
     120             : 
     121             :     //---------------------------------------------------------------------
     122           0 :     ::comphelper::StringSequence OABSPilotUno::getSupportedServiceNames_Static() throw(RuntimeException)
     123             :     {
     124           0 :         ::comphelper::StringSequence aSupported(1);
     125           0 :         aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.AddressBookSourcePilot"));
     126           0 :         return aSupported;
     127             :     }
     128             : 
     129             :     //---------------------------------------------------------------------
     130           0 :     Reference<XPropertySetInfo>  SAL_CALL OABSPilotUno::getPropertySetInfo() throw(RuntimeException)
     131             :     {
     132           0 :         Reference<XPropertySetInfo>  xInfo( createPropertySetInfo( getInfoHelper() ) );
     133           0 :         return xInfo;
     134             :     }
     135             : 
     136             :     //---------------------------------------------------------------------
     137           0 :     ::cppu::IPropertyArrayHelper& OABSPilotUno::getInfoHelper()
     138             :     {
     139           0 :         return *const_cast<OABSPilotUno*>(this)->getArrayHelper();
     140             :     }
     141             : 
     142             :     //--------------------------------------------------------------------------
     143           0 :     ::cppu::IPropertyArrayHelper* OABSPilotUno::createArrayHelper( ) const
     144             :     {
     145           0 :         Sequence< Property > aProps;
     146           0 :         describeProperties(aProps);
     147           0 :         return new ::cppu::OPropertyArrayHelper(aProps);
     148             :     }
     149             : 
     150             :     //--------------------------------------------------------------------------
     151           0 :     Dialog* OABSPilotUno::createDialog(Window* _pParent)
     152             :     {
     153           0 :         return new OAddessBookSourcePilot(_pParent, m_aContext.getLegacyServiceFactory());
     154             :     }
     155             : 
     156             :     //--------------------------------------------------------------------------
     157           0 :     Any SAL_CALL OABSPilotUno::execute( const Sequence< NamedValue >& /*lArgs*/ ) throw (IllegalArgumentException, Exception, RuntimeException)
     158             :     {
     159             :         // not interested in the context, not interested in the args
     160             :         // -> call the execute method of the XExecutableDialog
     161           0 :         static_cast< XExecutableDialog* >( this )->execute();
     162             : 
     163             :         // result interest not really ...
     164             :         // We show this dialog one times only!
     165             :         // User has one chance to accept it or not.
     166             :         // (or he can start it again by using wizard-menu!)
     167             :         // So we should deregister it on our general job execution service by using right protocol parameters.
     168           0 :         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > lProtocol(1);
     169           0 :         lProtocol[0].Name    = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Deactivate"));
     170           0 :         lProtocol[0].Value <<= sal_True;
     171           0 :         return makeAny( lProtocol );
     172             :     }
     173             :     // -----------------------------------------------------------------------------
     174           0 :     void OABSPilotUno::executedDialog(sal_Int16 _nExecutionResult)
     175             :     {
     176           0 :         if ( _nExecutionResult == RET_OK )
     177             :         {
     178           0 :             const AddressSettings& aSettings = static_cast<OAddessBookSourcePilot*>(m_pDialog)->getSettings();
     179           0 :             m_sDataSourceName = aSettings.bRegisterDataSource ? aSettings.sRegisteredDataSourceName : aSettings.sDataSourceName;
     180             :         }
     181           0 :     }
     182             : 
     183             : //.........................................................................
     184             : }   // namespace abp
     185             : //.........................................................................
     186             : 
     187             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10