LCOV - code coverage report
Current view: top level - dbaccess/source/ext/macromigration - macromigrationwizard.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 54 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 16 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 "dbmm_module.hxx"
      21             : #include "dbmm_global.hrc"
      22             : #include "macromigrationdialog.hxx"
      23             : #include "macromigrationwizard.hxx"
      24             : 
      25             : #include <com/sun/star/ucb/AlreadyInitializedException.hpp>
      26             : #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
      27             : #include <com/sun/star/frame/XStorable.hpp>
      28             : 
      29             : #include <svtools/genericunodialog.hxx>
      30             : 
      31             : namespace dbmm
      32             : {
      33             : 
      34             :     using ::com::sun::star::uno::Reference;
      35             :     using ::com::sun::star::uno::XInterface;
      36             :     using ::com::sun::star::uno::UNO_QUERY;
      37             :     using ::com::sun::star::uno::UNO_QUERY_THROW;
      38             :     using ::com::sun::star::uno::UNO_SET_THROW;
      39             :     using ::com::sun::star::uno::Exception;
      40             :     using ::com::sun::star::uno::RuntimeException;
      41             :     using ::com::sun::star::uno::Any;
      42             :     using ::com::sun::star::uno::makeAny;
      43             :     using ::com::sun::star::uno::XComponentContext;
      44             :     using ::com::sun::star::uno::Sequence;
      45             :     using ::com::sun::star::beans::XPropertySetInfo;
      46             :     using ::com::sun::star::beans::Property;
      47             :     using ::com::sun::star::ucb::AlreadyInitializedException;
      48             :     using ::com::sun::star::sdb::XOfficeDatabaseDocument;
      49             :     using ::com::sun::star::lang::IllegalArgumentException;
      50             :     using ::com::sun::star::frame::XStorable;
      51             : 
      52             :     // MacroMigrationDialogService
      53             :     class MacroMigrationDialogService;
      54             :     typedef ::svt::OGenericUnoDialog                                                MacroMigrationDialogService_Base;
      55             :     typedef ::comphelper::OPropertyArrayUsageHelper< MacroMigrationDialogService >  MacroMigrationDialogService_PBase;
      56             : 
      57             :     class MacroMigrationDialogService
      58             :                 :public MacroMigrationDialogService_Base
      59             :                 ,public MacroMigrationDialogService_PBase
      60             :                 ,public MacroMigrationModuleClient
      61             :     {
      62             :     public:
      63             :         MacroMigrationDialogService( const Reference< XComponentContext >& _rxContext );
      64             : 
      65             :         // XTypeProvider
      66             :         virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(RuntimeException, std::exception) SAL_OVERRIDE;
      67             : 
      68             :         // XServiceInfo
      69             :         virtual OUString SAL_CALL getImplementationName() throw(RuntimeException, std::exception) SAL_OVERRIDE;
      70             :         virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException, std::exception) SAL_OVERRIDE;
      71             : 
      72             :         // XInitialization
      73             :         virtual void SAL_CALL initialize( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ) throw(com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      74             : 
      75             :         // XPropertySet
      76             :         virtual Reference< XPropertySetInfo >  SAL_CALL getPropertySetInfo() throw(RuntimeException, std::exception) SAL_OVERRIDE;
      77             :         virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
      78             : 
      79             :         // OPropertyArrayUsageHelper
      80             :         virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
      81             : 
      82             :         // helper for factories
      83             :         static Reference< XInterface > SAL_CALL Create( const Reference< XComponentContext >& _rxContext );
      84             :         static OUString SAL_CALL getImplementationName_static() throw(RuntimeException);
      85             :         static Sequence< OUString > SAL_CALL getSupportedServiceNames_static() throw(RuntimeException);
      86             : 
      87             :     protected:
      88             :         virtual ~MacroMigrationDialogService();
      89             : 
      90             :     protected:
      91             :         virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
      92             :         virtual void destroyDialog() SAL_OVERRIDE;
      93             : 
      94             :     private:
      95             :         Reference<XComponentContext>          m_aContext;
      96             :         Reference< XOfficeDatabaseDocument >    m_xDocument;
      97             :     };
      98             : 
      99             :     // MacroMigrationDialogService
     100           0 :     MacroMigrationDialogService::MacroMigrationDialogService( const Reference< XComponentContext >& _rxContext )
     101             :         :MacroMigrationDialogService_Base( _rxContext )
     102           0 :         ,m_aContext( _rxContext )
     103             :     {
     104           0 :         m_bNeedInitialization = true;
     105           0 :     }
     106             : 
     107           0 :     MacroMigrationDialogService::~MacroMigrationDialogService()
     108             :     {
     109             :         // we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor,
     110             :         // so this virtual-method-call the base class does does not work, we're already dead then ...
     111           0 :         if ( m_pDialog )
     112             :         {
     113           0 :             ::osl::MutexGuard aGuard( m_aMutex );
     114           0 :             if ( m_pDialog )
     115           0 :                 destroyDialog();
     116             :         }
     117           0 :     }
     118             : 
     119           0 :     Reference< XInterface > SAL_CALL MacroMigrationDialogService::Create( const Reference< XComponentContext >& _rxContext )
     120             :     {
     121           0 :         return *(new MacroMigrationDialogService( _rxContext ) );
     122             :     }
     123             : 
     124           0 :     VclPtr<Dialog> MacroMigrationDialogService::createDialog( vcl::Window* _pParent )
     125             :     {
     126           0 :         return VclPtr<MacroMigrationDialog>::Create( _pParent, m_aContext, m_xDocument );
     127             :     }
     128             : 
     129           0 :     void MacroMigrationDialogService::destroyDialog()
     130             :     {
     131           0 :         MacroMigrationDialogService_Base::destroyDialog();
     132           0 :     }
     133             : 
     134           0 :     Sequence< sal_Int8 > SAL_CALL MacroMigrationDialogService::getImplementationId() throw(RuntimeException, std::exception)
     135             :     {
     136           0 :         return css::uno::Sequence<sal_Int8>();
     137             :     }
     138             : 
     139           0 :     OUString SAL_CALL MacroMigrationDialogService::getImplementationName_static() throw(RuntimeException)
     140             :     {
     141           0 :         return OUString( "com.sun.star.comp.dbaccess.macromigration.MacroMigrationDialogService" );
     142             :     }
     143             : 
     144           0 :     Sequence< OUString > SAL_CALL MacroMigrationDialogService::getSupportedServiceNames_static() throw(RuntimeException)
     145             :     {
     146           0 :         Sequence< OUString > aServices(1);
     147           0 :         aServices[0] = "com.sun.star.sdb.application.MacroMigrationWizard";
     148           0 :         return aServices;
     149             :     }
     150             : 
     151           0 :     OUString SAL_CALL MacroMigrationDialogService::getImplementationName() throw(RuntimeException, std::exception)
     152             :     {
     153           0 :         return getImplementationName_static();
     154             :     }
     155             : 
     156           0 :     Sequence< OUString > SAL_CALL MacroMigrationDialogService::getSupportedServiceNames() throw(RuntimeException, std::exception)
     157             :     {
     158           0 :         return getSupportedServiceNames_static();
     159             :     }
     160             : 
     161           0 :     void SAL_CALL MacroMigrationDialogService::initialize( const Sequence< Any >& _rArguments ) throw(Exception, RuntimeException, std::exception)
     162             :     {
     163           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     164           0 :         if ( m_bInitialized )
     165           0 :             throw AlreadyInitializedException( OUString(), *this );
     166             : 
     167           0 :         if ( _rArguments.getLength() != 1 )
     168             :             throw IllegalArgumentException(
     169             :                 OUString(MacroMigrationResId(STR_INVALID_NUMBER_ARGS)),
     170             :                 *this,
     171             :                 1
     172           0 :             );
     173             : 
     174           0 :         m_xDocument.set( _rArguments[0], UNO_QUERY );
     175           0 :         if ( !m_xDocument.is() )
     176             :             throw IllegalArgumentException(
     177             :                 OUString(MacroMigrationResId(STR_NO_DATABASE)),
     178             :                 *this,
     179             :                 1
     180           0 :             );
     181             : 
     182           0 :         Reference< XStorable > xDocStor( m_xDocument, UNO_QUERY_THROW );
     183           0 :         if ( xDocStor->isReadonly() )
     184             :             throw IllegalArgumentException(
     185             :                 OUString(MacroMigrationResId(STR_NOT_READONLY)),
     186             :                 *this,
     187             :                 1
     188           0 :             );
     189             : 
     190           0 :         m_bInitialized = true;
     191           0 :     }
     192             : 
     193           0 :     Reference< XPropertySetInfo > SAL_CALL MacroMigrationDialogService::getPropertySetInfo() throw(RuntimeException, std::exception)
     194             :     {
     195           0 :         return createPropertySetInfo( getInfoHelper() );
     196             :     }
     197             : 
     198           0 :     ::cppu::IPropertyArrayHelper& SAL_CALL MacroMigrationDialogService::getInfoHelper()
     199             :     {
     200           0 :         return *getArrayHelper();
     201             :     }
     202             : 
     203           0 :     ::cppu::IPropertyArrayHelper* MacroMigrationDialogService::createArrayHelper( ) const
     204             :     {
     205           0 :         Sequence< Property > aProps;
     206           0 :         describeProperties( aProps );
     207           0 :         return new ::cppu::OPropertyArrayHelper( aProps );
     208             :     }
     209             : 
     210           0 :     void createRegistryInfo_MacroMigrationDialogService()
     211             :     {
     212           0 :         static OAutoRegistration< MacroMigrationDialogService > aAutoRegistration;
     213           0 :     }
     214             : 
     215             : } // namespace dbmm
     216             : 
     217             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11