LCOV - code coverage report
Current view: top level - libreoffice/svx/source/form - legacyformcontroller.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 54 0.0 %
Date: 2012-12-27 Functions: 0 20 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 "fmservs.hxx"
      22             : 
      23             : #include <com/sun/star/form/XFormController.hpp>
      24             : #include <com/sun/star/form/runtime/XFormController.hpp>
      25             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      26             : #include <com/sun/star/lang/XServiceInfo.hpp>
      27             : 
      28             : #include <cppuhelper/implbase2.hxx>
      29             : 
      30             : //........................................................................
      31             : namespace svxform
      32             : {
      33             : //........................................................................
      34             : 
      35             :     /** === begin UNO using === **/
      36             :     using ::com::sun::star::uno::Reference;
      37             :     using ::com::sun::star::uno::XInterface;
      38             :     using ::com::sun::star::uno::UNO_QUERY;
      39             :     using ::com::sun::star::uno::UNO_QUERY_THROW;
      40             :     using ::com::sun::star::uno::UNO_SET_THROW;
      41             :     using ::com::sun::star::uno::Exception;
      42             :     using ::com::sun::star::uno::RuntimeException;
      43             :     using ::com::sun::star::uno::Any;
      44             :     using ::com::sun::star::uno::makeAny;
      45             :     using ::com::sun::star::uno::Sequence;
      46             :     using ::com::sun::star::uno::Type;
      47             :     using ::com::sun::star::lang::XMultiServiceFactory;
      48             :     using ::com::sun::star::awt::XControl;
      49             :     using ::com::sun::star::awt::XTabControllerModel;
      50             :     using ::com::sun::star::awt::XControlContainer;
      51             :     using ::com::sun::star::lang::XServiceInfo;
      52             :     /** === end UNO using === **/
      53             : 
      54             :     using namespace ::com::sun::star;
      55             : 
      56             :     //====================================================================
      57             :     //= LegacyFormController
      58             :     //====================================================================
      59             :     typedef ::cppu::WeakImplHelper2 <   form::XFormController
      60             :                                     ,   XServiceInfo
      61             :                                     >   LegacyFormController_Base;
      62             :     /** is an implementation of the legacy form controller service, namely css.form.FormController, supporting the
      63             :         css.form.XFormController interface.
      64             : 
      65             :         This legacy API is superseded by css.form.runtime.(X)FormController, and though we migrated all OOo-internal
      66             :         usage of this old API, their might be clients external to OOo still using it (though this is rather unlikely).
      67             :     */
      68           0 :     class LegacyFormController : public LegacyFormController_Base
      69             :     {
      70             :     public:
      71           0 :         static Reference< XInterface > Create( const Reference< XMultiServiceFactory >& _rxFactory )
      72             :         {
      73           0 :             return *( new LegacyFormController( _rxFactory ) );
      74             :         }
      75             : 
      76             :     protected:
      77           0 :         LegacyFormController( const Reference< XMultiServiceFactory >& _rxFactory )
      78           0 :             :m_xDelegator( _rxFactory->createInstance( FM_FORM_CONTROLLER ), UNO_QUERY_THROW )
      79             :         {
      80           0 :         }
      81             : 
      82             :         // form::XFormController
      83             :         virtual Reference< XControl > SAL_CALL getCurrentControl(  ) throw (RuntimeException);
      84             :         virtual void SAL_CALL addActivateListener( const Reference< form::XFormControllerListener >& l ) throw (RuntimeException);
      85             :         virtual void SAL_CALL removeActivateListener( const Reference< form::XFormControllerListener >& l ) throw (RuntimeException);
      86             : 
      87             :         // awt::XTabController
      88             :         virtual void SAL_CALL setModel( const Reference< XTabControllerModel >& Model ) throw (RuntimeException);
      89             :         virtual Reference< XTabControllerModel > SAL_CALL getModel(  ) throw (RuntimeException);
      90             :         virtual void SAL_CALL setContainer( const Reference< XControlContainer >& Container ) throw (RuntimeException);
      91             :         virtual Reference< XControlContainer > SAL_CALL getContainer(  ) throw (RuntimeException);
      92             :         virtual Sequence< Reference< XControl > > SAL_CALL getControls(  ) throw (RuntimeException);
      93             :         virtual void SAL_CALL autoTabOrder(  ) throw (RuntimeException);
      94             :         virtual void SAL_CALL activateTabOrder(  ) throw (RuntimeException);
      95             :         virtual void SAL_CALL activateFirst(  ) throw (RuntimeException);
      96             :         virtual void SAL_CALL activateLast(  ) throw (RuntimeException);
      97             : 
      98             :         // XServiceInfo
      99             :         virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (RuntimeException);
     100             :         virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
     101             :         virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (RuntimeException);
     102             : 
     103             :     private:
     104             :         const Reference< form::runtime::XFormController >   m_xDelegator;
     105             :     };
     106             : 
     107             :     //--------------------------------------------------------------------
     108           0 :     Reference< XControl > SAL_CALL LegacyFormController::getCurrentControl(  ) throw (RuntimeException)
     109             :     {
     110           0 :         return m_xDelegator->getCurrentControl();
     111             :     }
     112             : 
     113             :     //--------------------------------------------------------------------
     114           0 :     void SAL_CALL LegacyFormController::addActivateListener( const Reference< form::XFormControllerListener >& _listener ) throw (RuntimeException)
     115             :     {
     116           0 :         m_xDelegator->addActivateListener( _listener );
     117           0 :     }
     118             : 
     119             :     //--------------------------------------------------------------------
     120           0 :     void SAL_CALL LegacyFormController::removeActivateListener( const Reference< form::XFormControllerListener >& _listener ) throw (RuntimeException)
     121             :     {
     122           0 :         m_xDelegator->removeActivateListener( _listener );
     123           0 :     }
     124             : 
     125             :     //--------------------------------------------------------------------
     126           0 :     void SAL_CALL LegacyFormController::setModel( const Reference< XTabControllerModel >& _model ) throw (RuntimeException)
     127             :     {
     128           0 :         m_xDelegator->setModel( _model );
     129           0 :     }
     130             : 
     131             :     //--------------------------------------------------------------------
     132           0 :     Reference< XTabControllerModel > SAL_CALL LegacyFormController::getModel(  ) throw (RuntimeException)
     133             :     {
     134           0 :         return m_xDelegator->getModel();
     135             :     }
     136             : 
     137             :     //--------------------------------------------------------------------
     138           0 :     void SAL_CALL LegacyFormController::setContainer( const Reference< XControlContainer >& _container ) throw (RuntimeException)
     139             :     {
     140           0 :         m_xDelegator->setContainer( _container );
     141           0 :     }
     142             : 
     143             :     //--------------------------------------------------------------------
     144           0 :     Reference< XControlContainer > SAL_CALL LegacyFormController::getContainer(  ) throw (RuntimeException)
     145             :     {
     146           0 :         return m_xDelegator->getContainer();
     147             :     }
     148             : 
     149             :     //--------------------------------------------------------------------
     150           0 :     Sequence< Reference< XControl > > SAL_CALL LegacyFormController::getControls(  ) throw (RuntimeException)
     151             :     {
     152           0 :         return m_xDelegator->getControls();
     153             :     }
     154             : 
     155             :     //--------------------------------------------------------------------
     156           0 :     void SAL_CALL LegacyFormController::autoTabOrder(  ) throw (RuntimeException)
     157             :     {
     158           0 :         m_xDelegator->autoTabOrder();
     159           0 :     }
     160             : 
     161             :     //--------------------------------------------------------------------
     162           0 :     void SAL_CALL LegacyFormController::activateTabOrder(  ) throw (RuntimeException)
     163             :     {
     164           0 :         m_xDelegator->activateTabOrder();
     165           0 :     }
     166             : 
     167             :     //--------------------------------------------------------------------
     168           0 :     void SAL_CALL LegacyFormController::activateFirst(  ) throw (RuntimeException)
     169             :     {
     170           0 :         m_xDelegator->activateFirst();
     171           0 :     }
     172             : 
     173             :     //--------------------------------------------------------------------
     174           0 :     void SAL_CALL LegacyFormController::activateLast(  ) throw (RuntimeException)
     175             :     {
     176           0 :         m_xDelegator->activateLast();
     177           0 :     }
     178             : 
     179             :     //--------------------------------------------------------------------
     180           0 :     ::rtl::OUString SAL_CALL LegacyFormController::getImplementationName(  ) throw (RuntimeException)
     181             :     {
     182           0 :         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.svx.LegacyFormController" ) );
     183             :     }
     184             : 
     185             :     //--------------------------------------------------------------------
     186           0 :     ::sal_Bool SAL_CALL LegacyFormController::supportsService( const ::rtl::OUString& _serviceName ) throw (RuntimeException)
     187             :     {
     188           0 :         Sequence< ::rtl::OUString > aServices( getSupportedServiceNames() );
     189           0 :         const ::rtl::OUString* pServices = aServices.getConstArray();
     190           0 :         for ( sal_Int32 i = 0; i < aServices.getLength(); ++i, ++pServices )
     191           0 :             if( pServices->equals( _serviceName ) )
     192           0 :                 return sal_True;
     193           0 :         return sal_False;
     194             :     }
     195             : 
     196             :     //--------------------------------------------------------------------
     197           0 :     Sequence< ::rtl::OUString > SAL_CALL LegacyFormController::getSupportedServiceNames(  ) throw (RuntimeException)
     198             :     {
     199           0 :         Sequence< ::rtl::OUString > aServices(2);
     200           0 :         aServices.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.FormController" ) );
     201           0 :         aServices.getArray()[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.control.TabController") );
     202           0 :         return aServices;
     203             :     }
     204             : 
     205             : //........................................................................
     206             : } // namespace svxform
     207             : //........................................................................
     208             : 
     209             : //------------------------------------------------------------------
     210             : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     211           0 :     LegacyFormController_NewInstance_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _rxORB )
     212             : {
     213           0 :     return ::svxform::LegacyFormController::Create( _rxORB );
     214             : }
     215             : 
     216             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10