Bump version to 6.4-15
[LibreOffice.git] / svx / source / form / legacyformcontroller.cxx
blob9e14d3758cd12f1dc43814fa53ecf97e70a1b022
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <fmservs.hxx>
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>
28 #include <cppuhelper/implbase.hxx>
29 #include <cppuhelper/supportsservice.hxx>
30 #include <comphelper/processfactory.hxx>
33 namespace svxform
37 using ::com::sun::star::uno::Reference;
38 using ::com::sun::star::uno::XInterface;
39 using ::com::sun::star::uno::Exception;
40 using ::com::sun::star::uno::RuntimeException;
41 using ::com::sun::star::uno::Sequence;
42 using ::com::sun::star::uno::XComponentContext;
43 using ::com::sun::star::lang::XMultiServiceFactory;
44 using ::com::sun::star::awt::XControl;
45 using ::com::sun::star::awt::XTabControllerModel;
46 using ::com::sun::star::awt::XControlContainer;
47 using ::com::sun::star::lang::XServiceInfo;
48 using ::com::sun::star::form::runtime::FormController;
50 using namespace ::com::sun::star;
53 //= LegacyFormController
55 typedef ::cppu::WeakImplHelper < form::XFormController
56 , XServiceInfo
57 > LegacyFormController_Base;
58 /** is an implementation of the legacy form controller service, namely css.form.FormController, supporting the
59 css.form.XFormController interface.
61 This legacy API is superseded by css.form.runtime.(X)FormController, and though we migrated all OOo-internal
62 usage of this old API, their might be clients external to OOo still using it (though this is rather unlikely).
64 class LegacyFormController : public LegacyFormController_Base
66 public:
67 static Reference< XInterface > Create( const Reference< XMultiServiceFactory >& _rxFactory )
69 return *( new LegacyFormController( comphelper::getComponentContext(_rxFactory) ) );
72 protected:
73 explicit LegacyFormController( const Reference< XComponentContext >& _rxContext )
74 :m_xDelegator( FormController::create(_rxContext) )
78 // form::XFormController
79 virtual Reference< XControl > SAL_CALL getCurrentControl( ) override;
80 virtual void SAL_CALL addActivateListener( const Reference< form::XFormControllerListener >& l ) override;
81 virtual void SAL_CALL removeActivateListener( const Reference< form::XFormControllerListener >& l ) override;
83 // awt::XTabController
84 virtual void SAL_CALL setModel( const Reference< XTabControllerModel >& Model ) override;
85 virtual Reference< XTabControllerModel > SAL_CALL getModel( ) override;
86 virtual void SAL_CALL setContainer( const Reference< XControlContainer >& Container ) override;
87 virtual Reference< XControlContainer > SAL_CALL getContainer( ) override;
88 virtual Sequence< Reference< XControl > > SAL_CALL getControls( ) override;
89 virtual void SAL_CALL autoTabOrder( ) override;
90 virtual void SAL_CALL activateTabOrder( ) override;
91 virtual void SAL_CALL activateFirst( ) override;
92 virtual void SAL_CALL activateLast( ) override;
94 // XServiceInfo
95 virtual OUString SAL_CALL getImplementationName( ) override;
96 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
97 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
99 private:
100 const Reference< form::runtime::XFormController > m_xDelegator;
104 Reference< XControl > SAL_CALL LegacyFormController::getCurrentControl( )
106 return m_xDelegator->getCurrentControl();
110 void SAL_CALL LegacyFormController::addActivateListener( const Reference< form::XFormControllerListener >& _listener )
112 m_xDelegator->addActivateListener( _listener );
116 void SAL_CALL LegacyFormController::removeActivateListener( const Reference< form::XFormControllerListener >& _listener )
118 m_xDelegator->removeActivateListener( _listener );
122 void SAL_CALL LegacyFormController::setModel( const Reference< XTabControllerModel >& _model )
124 m_xDelegator->setModel( _model );
128 Reference< XTabControllerModel > SAL_CALL LegacyFormController::getModel( )
130 return m_xDelegator->getModel();
134 void SAL_CALL LegacyFormController::setContainer( const Reference< XControlContainer >& _container )
136 m_xDelegator->setContainer( _container );
140 Reference< XControlContainer > SAL_CALL LegacyFormController::getContainer( )
142 return m_xDelegator->getContainer();
146 Sequence< Reference< XControl > > SAL_CALL LegacyFormController::getControls( )
148 return m_xDelegator->getControls();
152 void SAL_CALL LegacyFormController::autoTabOrder( )
154 m_xDelegator->autoTabOrder();
158 void SAL_CALL LegacyFormController::activateTabOrder( )
160 m_xDelegator->activateTabOrder();
164 void SAL_CALL LegacyFormController::activateFirst( )
166 m_xDelegator->activateFirst();
170 void SAL_CALL LegacyFormController::activateLast( )
172 m_xDelegator->activateLast();
176 OUString SAL_CALL LegacyFormController::getImplementationName( )
178 return "org.openoffice.comp.svx.LegacyFormController";
181 sal_Bool SAL_CALL LegacyFormController::supportsService( const OUString& _serviceName )
183 return cppu::supportsService(this, _serviceName);
186 Sequence< OUString > SAL_CALL LegacyFormController::getSupportedServiceNames( )
188 return { "com.sun.star.form.FormController", "com.sun.star.awt.control.TabController" };
193 css::uno::Reference< css::uno::XInterface >
194 LegacyFormController_NewInstance_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory > & _rxORB )
196 return ::svxform::LegacyFormController::Create( _rxORB );
199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */