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

Generated by: LCOV version 1.10